MIPS: Fix read buffer overflow
[safe/jmp/linux-2.6] / arch / mips / rb532 / devices.c
index 3c74561..9f40e1f 100644 (file)
 
 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 korina_dev0_res[] = {
        {
                .name = "korina_regs",
@@ -179,26 +200,9 @@ static struct platform_device rb532_led = {
        .id = -1,
 };
 
-static struct gpio_keys_button rb532_gpio_btn[] = {
-       {
-               .gpio = 1,
-               .code = BTN_0,
-               .desc = "S1",
-               .active_low = 1,
-       }
-};
-
-static struct gpio_keys_platform_data rb532_gpio_btn_data = {
-       .buttons = rb532_gpio_btn,
-       .nbuttons = ARRAY_SIZE(rb532_gpio_btn),
-};
-
 static struct platform_device rb532_button = {
-       .name   = "gpio-keys",
+       .name   = "rb532-button",
        .id     = -1,
-       .dev    = {
-               .platform_data = &rb532_gpio_btn_data,
-       }
 };
 
 static struct resource rb532_wdt_res[] = {
@@ -314,6 +318,14 @@ 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 and map device controller 3 */
+       dev3.base = ioremap_nocache(readl(IDT434_REG_BASE + DEV3BASE), 1);
+
+       if (!dev3.base) {
+               printk(KERN_ERR "rb532: cannot remap device controller 3\n");
+               return -ENXIO;
+       }
+
        /* Initialise the NAND device */
        rb532_nand_setup();