Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130573
b: refs/heads/master
c: 36f2db4
h: refs/heads/master
i:
  130571: 991b246
v: v3
  • Loading branch information
Phil Sutter authored and Ralf Baechle committed Jan 30, 2009
1 parent bd433c5 commit 06440e2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7060886fb745b705bcf189131eb49c50485ba233
refs/heads/master: 36f2db4b9c01689b1311d57a6297022d82000185
39 changes: 39 additions & 0 deletions trunk/arch/mips/rb532/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,34 @@

extern unsigned int idt_cpu_freq;

static struct mpmc_device dev3;

void set_latch_u5(unsigned char or_mask, unsigned char nand_mask)
{
unsigned long flags;

spin_lock_irqsave(&dev3.lock, flags);

dev3.state = (dev3.state | or_mask) & ~nand_mask;
writeb(dev3.state, dev3.base);

spin_unlock_irqrestore(&dev3.lock, flags);
}
EXPORT_SYMBOL(set_latch_u5);

unsigned char get_latch_u5(void)
{
return dev3.state;
}
EXPORT_SYMBOL(get_latch_u5);

static struct resource rb532_dev3_ctl_res[] = {
{
.name = "dev3_ctl",
.flags = IORESOURCE_MEM,
}
};

static struct resource korina_dev0_res[] = {
{
.name = "korina_regs",
Expand Down Expand Up @@ -314,6 +342,17 @@ static int __init plat_setup_devices(void)
nand_slot0_res[0].start = readl(IDT434_REG_BASE + DEV2BASE);
nand_slot0_res[0].end = nand_slot0_res[0].start + 0x1000;

/* Read the third (multi purpose) resources from the DC */
rb532_dev3_ctl_res[0].start = readl(IDT434_REG_BASE + DEV3BASE);
rb532_dev3_ctl_res[0].end = rb532_dev3_ctl_res[0].start + 0x1000;

dev3.base = ioremap_nocache(rb532_dev3_ctl_res[0].start, 0x1000);

if (!dev3.base) {
printk(KERN_ERR "rb532: cannot remap device controller 3\n");
return -ENXIO;
}

/* Initialise the NAND device */
rb532_nand_setup();

Expand Down
39 changes: 0 additions & 39 deletions trunk/arch/mips/rb532/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ struct rb532_gpio_chip {
void __iomem *regbase;
};

struct mpmc_device dev3;

static struct resource rb532_gpio_reg0_res[] = {
{
.name = "gpio_reg0",
Expand All @@ -52,13 +50,6 @@ static struct resource rb532_gpio_reg0_res[] = {
}
};

static struct resource rb532_dev3_ctl_res[] = {
{
.name = "dev3_ctl",
.flags = IORESOURCE_MEM,
}
};

void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val)
{
unsigned long flags;
Expand Down Expand Up @@ -86,25 +77,6 @@ unsigned get_434_reg(unsigned reg_offs)
}
EXPORT_SYMBOL(get_434_reg);

void set_latch_u5(unsigned char or_mask, unsigned char nand_mask)
{
unsigned long flags;

spin_lock_irqsave(&dev3.lock, flags);

dev3.state = (dev3.state | or_mask) & ~nand_mask;
writeb(dev3.state, dev3.base);

spin_unlock_irqrestore(&dev3.lock, flags);
}
EXPORT_SYMBOL(set_latch_u5);

unsigned char get_latch_u5(void)
{
return dev3.state;
}
EXPORT_SYMBOL(get_latch_u5);

/* rb532_set_bit - sanely set a bit
*
* bitval: new value for the bit
Expand Down Expand Up @@ -249,17 +221,6 @@ int __init rb532_gpio_init(void)
/* Register our GPIO chip */
gpiochip_add(&rb532_gpio_chip->chip);

rb532_dev3_ctl_res[0].start = readl(IDT434_REG_BASE + DEV3BASE);
rb532_dev3_ctl_res[0].end = rb532_dev3_ctl_res[0].start + 0x1000;

r = rb532_dev3_ctl_res;
dev3.base = ioremap_nocache(r->start, r->end - r->start);

if (!dev3.base) {
printk(KERN_ERR "rb532: cannot remap device controller 3\n");
return -ENXIO;
}

return 0;
}
arch_initcall(rb532_gpio_init);

0 comments on commit 06440e2

Please sign in to comment.