aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/adm5120/files/arch
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-04-29 07:36:43 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-04-29 07:36:43 +0000
commite96d52d198511789d66d8fb7bd9a0f3c3c9c0107 (patch)
treea91c5c6dbd1ccf52974ba5063918e1c171ebeb1a /target/linux/adm5120/files/arch
parent19be4923e0a2dfa6dd173288fc0ead976a0f2b38 (diff)
downloadupstream-e96d52d198511789d66d8fb7bd9a0f3c3c9c0107.tar.gz
upstream-e96d52d198511789d66d8fb7bd9a0f3c3c9c0107.tar.bz2
upstream-e96d52d198511789d66d8fb7bd9a0f3c3c9c0107.zip
adm5120: merge 3.3 patches
SVN-Revision: 31511
Diffstat (limited to 'target/linux/adm5120/files/arch')
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/Platform19
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/cellvision/cellvision.c6
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/common/clock.c2
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/common/irq.c34
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/common/platform.c52
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/compex/wp54.c18
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/edimax/br-61xx.c19
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/generic/eb-214a.c18
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/infineon/infineon.c6
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.c20
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.h2
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/motorola/pmugw.c4
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/osbridge/5gxi.c4
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/zyxel/p-33x.c4
-rw-r--r--target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_platform.h11
-rw-r--r--target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c2
16 files changed, 112 insertions, 109 deletions
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/Platform b/target/linux/adm5120/files/arch/mips/adm5120/Platform
new file mode 100644
index 0000000000..0c9edf218b
--- /dev/null
+++ b/target/linux/adm5120/files/arch/mips/adm5120/Platform
@@ -0,0 +1,19 @@
+#
+# Infineon/ADMtek ADM5120
+#
+
+platform-$(CONFIG_ADM5120) += adm5120/common/
+
+platform-$(CONFIG_ADM5120_OEM_CELLVISION) += adm5120/cellvision/
+platform-$(CONFIG_ADM5120_OEM_COMPEX) += adm5120/compex/
+platform-$(CONFIG_ADM5120_OEM_EDIMAX) += adm5120/edimax/
+platform-$(CONFIG_ADM5120_OEM_GENERIC) += adm5120/generic/
+platform-$(CONFIG_ADM5120_OEM_INFINEON) += adm5120/infineon/
+platform-$(CONFIG_ADM5120_OEM_MIKROTIK) += adm5120/mikrotik/
+platform-$(CONFIG_ADM5120_OEM_MOTOROLA) += adm5120/motorola/
+platform-$(CONFIG_ADM5120_OEM_OSBRIDGE) += adm5120/osbridge/
+platform-$(CONFIG_ADM5120_OEM_ZYXEL) += adm5120/zyxel/
+
+cflags-$(CONFIG_ADM5120) += -I$(srctree)/arch/mips/include/asm/mach-adm5120
+libs-$(CONFIG_ADM5120) += arch/mips/adm5120/prom/
+load-$(CONFIG_ADM5120) += 0xffffffff80001000
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/cellvision/cellvision.c b/target/linux/adm5120/files/arch/mips/adm5120/cellvision/cellvision.c
index eceef1312f..a7cedf03bc 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/cellvision/cellvision.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/cellvision/cellvision.c
@@ -19,7 +19,6 @@
#define CELLVISION_CONFIG_OFFSET 0x8000
#define CELLVISION_CONFIG_SIZE 0x1000
-#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition cas6xx_partitions[] = {
{
.name = "admboot",
@@ -65,7 +64,6 @@ static struct mtd_partition cas7xx_partitions[] = {
.size = MTDPART_SIZ_FULL,
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
static void switch_bank_gpio5(unsigned bank)
{
@@ -105,20 +103,16 @@ void __init cellvision_mac_setup(void)
void __init cas6xx_flash_setup(void)
{
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions);
adm5120_flash0_data.parts = cas6xx_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
cellvision_flash_setup();
}
void __init cas7xx_flash_setup(void)
{
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions);
adm5120_flash0_data.parts = cas7xx_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
cellvision_flash_setup();
}
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/common/clock.c b/target/linux/adm5120/files/arch/mips/adm5120/common/clock.c
index 1ada60fedd..52ae64c419 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/common/clock.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/common/clock.c
@@ -33,7 +33,7 @@ static struct clk uart_clk = {
struct clk *clk_get(struct device *dev, const char *id)
{
- char *name = dev_name(dev);
+ const char *name = dev_name(dev);
if (!strcmp(name, "apb:uart0") || !strcmp(name, "apb:uart1"))
return &uart_clk;
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/common/irq.c b/target/linux/adm5120/files/arch/mips/adm5120/common/irq.c
index 9a259b2d11..a26e65176e 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/common/irq.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/common/irq.c
@@ -23,9 +23,9 @@
#include <asm/mach-adm5120/adm5120_defs.h>
-static void adm5120_intc_irq_unmask(unsigned int irq);
-static void adm5120_intc_irq_mask(unsigned int irq);
-static int adm5120_intc_irq_set_type(unsigned int irq, unsigned int flow_type);
+static void adm5120_intc_irq_unmask(struct irq_data *d);
+static void adm5120_intc_irq_mask(struct irq_data *d);
+static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type);
static inline void intc_write_reg(unsigned int reg, u32 val)
{
@@ -43,10 +43,10 @@ static inline u32 intc_read_reg(unsigned int reg)
static struct irq_chip adm5120_intc_irq_chip = {
.name = "INTC",
- .unmask = adm5120_intc_irq_unmask,
- .mask = adm5120_intc_irq_mask,
- .mask_ack = adm5120_intc_irq_mask,
- .set_type = adm5120_intc_irq_set_type
+ .irq_unmask = adm5120_intc_irq_unmask,
+ .irq_mask = adm5120_intc_irq_mask,
+ .irq_mask_ack = adm5120_intc_irq_mask,
+ .irq_set_type = adm5120_intc_irq_set_type
};
static struct irqaction adm5120_intc_irq_action = {
@@ -54,20 +54,19 @@ static struct irqaction adm5120_intc_irq_action = {
.name = "cascade [INTC]"
};
-static void adm5120_intc_irq_unmask(unsigned int irq)
+static void adm5120_intc_irq_unmask(struct irq_data *d)
{
- irq -= ADM5120_INTC_IRQ_BASE;
- intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << irq);
+ intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE));
}
-static void adm5120_intc_irq_mask(unsigned int irq)
+static void adm5120_intc_irq_mask(struct irq_data *d)
{
- irq -= ADM5120_INTC_IRQ_BASE;
- intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << irq);
+ intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE));
}
-static int adm5120_intc_irq_set_type(unsigned int irq, unsigned int flow_type)
+static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type)
{
+ unsigned int irq = d->irq;
unsigned int sense;
unsigned long mode;
int err = 0;
@@ -105,10 +104,6 @@ static int adm5120_intc_irq_set_type(unsigned int irq, unsigned int flow_type)
mode &= ~(1 << (irq - ADM5120_INTC_IRQ_BASE));
intc_write_reg(INTC_REG_INT_MODE, mode);
- /* fallthrough */
- default:
- irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK;
- irq_desc[irq].status |= sense;
break;
}
@@ -162,8 +157,7 @@ static void __init adm5120_intc_irq_init(void)
for (i = ADM5120_INTC_IRQ_BASE;
i <= ADM5120_INTC_IRQ_BASE + INTC_IRQ_LAST;
i++) {
- irq_desc[i].status = INTC_IRQ_STATUS;
- set_irq_chip_and_handler(i, &adm5120_intc_irq_chip,
+ irq_set_chip_and_handler(i, &adm5120_intc_irq_chip,
handle_level_irq);
}
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/common/platform.c b/target/linux/adm5120/files/arch/mips/adm5120/common/platform.c
index de761095c6..809d77b8a3 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/common/platform.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/common/platform.c
@@ -18,6 +18,7 @@
#include <linux/gpio.h>
#include <linux/irq.h>
#include <linux/slab.h>
+#include <linux/export.h>
#include <asm/bootinfo.h>
@@ -244,31 +245,44 @@ void __init adm5120_add_device_uart(unsigned id)
/*
* GPIO buttons
*/
-#define ADM5120_BUTTON_INTERVAL 20
-struct gpio_buttons_platform_data adm5120_gpio_buttons_data = {
- .poll_interval = ADM5120_BUTTON_INTERVAL,
-};
-
-struct platform_device adm5120_gpio_buttons_device = {
- .name = "gpio-buttons",
- .id = -1,
- .dev.platform_data = &adm5120_gpio_buttons_data,
-};
-
-void __init adm5120_add_device_gpio_buttons(unsigned nbuttons,
- struct gpio_button *buttons)
+void __init adm5120_register_gpio_buttons(int id,
+ unsigned poll_interval,
+ unsigned nbuttons,
+ struct gpio_keys_button *buttons)
{
- struct gpio_button *p;
+ struct platform_device *pdev;
+ struct gpio_keys_platform_data pdata;
+ struct gpio_keys_button *p;
+ int err;
- p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL);
+ p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL);
if (!p)
return;
- memcpy(p, buttons, nbuttons * sizeof(*p));
- adm5120_gpio_buttons_data.nbuttons = nbuttons;
- adm5120_gpio_buttons_data.buttons = p;
+ pdev = platform_device_alloc("gpio-keys-polled", id);
+ if (!pdev)
+ goto err_free_buttons;
+
+ memset(&pdata, 0, sizeof(pdata));
+ pdata.poll_interval = poll_interval;
+ pdata.nbuttons = nbuttons;
+ pdata.buttons = p;
+
+ err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+ if (err)
+ goto err_put_pdev;
+
+ err = platform_device_add(pdev);
+ if (err)
+ goto err_put_pdev;
+
+ return;
+
+err_put_pdev:
+ platform_device_put(pdev);
- platform_device_register(&adm5120_gpio_buttons_device);
+err_free_buttons:
+ kfree(p);
}
/*
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/compex/wp54.c b/target/linux/adm5120/files/arch/mips/adm5120/compex/wp54.c
index ef71302779..8aa35c555a 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/compex/wp54.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/compex/wp54.c
@@ -11,7 +11,9 @@
#include "compex.h"
-#ifdef CONFIG_MTD_PARTITIONS
+#define WP54_KEYS_POLL_INTERVAL 20
+#define WP54_KEYS_DEBOUNCE_INTERVAL (3 * WP54_KEYS_POLL_INTERVAL)
+
static struct mtd_partition wp54g_wrt_partitions[] = {
{
.name = "cfe",
@@ -28,18 +30,17 @@ static struct mtd_partition wp54g_wrt_partitions[] = {
.size = 0x010000,
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
};
-static struct gpio_button wp54_gpio_buttons[] __initdata = {
+static struct gpio_keys_button wp54_gpio_buttons[] __initdata = {
{
.desc = "reset_button",
.type = EV_KEY,
- .code = BTN_0,
- .threshold = 5,
+ .code = KEY_RESTART,
+ .debounce_interval = WP54_KEYS_DEBOUNCE_INTERVAL,
.gpio = ADM5120_GPIO_PIN4,
}
};
@@ -71,8 +72,9 @@ static void __init wp54_setup(void)
adm5120_board_reset = wp54_reset;
adm5120_add_device_switch(2, wp54_vlans);
- adm5120_add_device_gpio_buttons(ARRAY_SIZE(wp54_gpio_buttons),
- wp54_gpio_buttons);
+ adm5120_register_gpio_buttons(-1, WP54_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(wp54_gpio_buttons),
+ wp54_gpio_buttons);
adm5120_add_device_gpio_leds(ARRAY_SIZE(wp54_gpio_leds),
wp54_gpio_leds);
@@ -83,10 +85,8 @@ MIPS_MACHINE(MACH_ADM5120_WP54, "WP54", "Compex WP54 family", wp54_setup);
static void __init wp54_wrt_setup(void)
{
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
adm5120_flash0_data.parts = wp54g_wrt_partitions;
-#endif
wp54_setup();
}
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/edimax/br-61xx.c b/target/linux/adm5120/files/arch/mips/adm5120/edimax/br-61xx.c
index 6ecdb4e425..cc64ccba24 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/edimax/br-61xx.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/edimax/br-61xx.c
@@ -18,7 +18,9 @@
#define BR61XX_CONFIG_OFFSET 0x8000
#define BR61XX_CONFIG_SIZE 0x1000
-#ifdef CONFIG_MTD_PARTITIONS
+#define BR61XX_KEYS_POLL_INTERVAL 20
+#define BR61XX_KEYS_DEBOUNCE_INTERVAL (3 * BR61XX_KEYS_POLL_INTERVAL)
+
static struct mtd_partition br61xx_partitions[] = {
{
.name = "admboot",
@@ -35,14 +37,13 @@ static struct mtd_partition br61xx_partitions[] = {
.size = MTDPART_SIZ_FULL,
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
-static struct gpio_button br61xx_gpio_buttons[] __initdata = {
+static struct gpio_keys_button br61xx_gpio_buttons[] __initdata = {
{
.desc = "reset_button",
.type = EV_KEY,
- .code = BTN_0,
- .threshold = 5,
+ .code = KEY_RESTART,
+ .debounce_interval = BR61XX_KEYS_DEBOUNCE_INTERVAL,
.gpio = ADM5120_GPIO_PIN2,
}
};
@@ -68,10 +69,8 @@ static void __init br61xx_mac_setup(void)
void __init br61xx_generic_setup(void)
{
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(br61xx_partitions);
adm5120_flash0_data.parts = br61xx_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
adm5120_add_device_flash(0);
adm5120_add_device_gpio(BR61XX_GPIO_DEV_MASK);
@@ -80,8 +79,10 @@ void __init br61xx_generic_setup(void)
adm5120_add_device_uart(1);
adm5120_add_device_switch(5, br61xx_vlans);
- adm5120_add_device_gpio_buttons(ARRAY_SIZE(br61xx_gpio_buttons),
- br61xx_gpio_buttons);
+
+ adm5120_register_gpio_buttons(-1, BR61XX_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(br61xx_gpio_buttons),
+ br61xx_gpio_buttons);
br61xx_mac_setup();
}
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/generic/eb-214a.c b/target/linux/adm5120/files/arch/mips/adm5120/generic/eb-214a.c
index d1d5fa99f4..c62c147c5a 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/generic/eb-214a.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/generic/eb-214a.c
@@ -28,7 +28,9 @@
#define EB214A_GPIO_DEV_MASK 0
#define EB214A_CONFIG_OFFSET 0x4000
-#ifdef CONFIG_MTD_PARTITIONS
+#define EB214A_KEYS_POLL_INTERVAL 20
+#define EB214A_KEYS_DEBOUNCE_INTERVAL (3 * EB214A_KEYS_POLL_INTERVAL)
+
static struct mtd_partition eb214a_partitions[] = {
{
.name = "bootloader",
@@ -45,7 +47,6 @@ static struct mtd_partition eb214a_partitions[] = {
.size = MTDPART_SIZ_FULL,
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
static struct adm5120_pci_irq eb214a_pci_irqs[] __initdata = {
PCIIRQ(4, 0, 1, ADM5120_IRQ_PCI0),
@@ -62,12 +63,12 @@ static struct gpio_led eb214a_gpio_leds[] __initdata = {
GPIO_LED_INV(ADM5120_GPIO_P3L0, "usb4", NULL),
};
-static struct gpio_button eb214a_gpio_buttons[] __initdata = {
+static struct gpio_keys_button eb214a_gpio_buttons[] __initdata = {
{
.desc = "reset",
.type = EV_KEY,
- .code = BTN_0,
- .threshold = 5,
+ .code = KEY_RESTART,
+ .debounce_interval = EB214A_KEYS_DEBOUNCE_INTERVAL,
.gpio = ADM5120_GPIO_PIN1,
}
};
@@ -94,10 +95,8 @@ static void __init eb214a_mac_setup(void)
static void __init eb214a_setup(void)
{
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(eb214a_partitions);
adm5120_flash0_data.parts = eb214a_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
adm5120_add_device_flash(0);
adm5120_add_device_gpio(EB214A_GPIO_DEV_MASK);
@@ -109,8 +108,9 @@ static void __init eb214a_setup(void)
eb214a_mac_setup();
- adm5120_add_device_gpio_buttons(ARRAY_SIZE(eb214a_gpio_buttons),
- eb214a_gpio_buttons);
+ adm5120_register_gpio_buttons(-1, EB214A_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(eb214a_gpio_buttons),
+ eb214a_gpio_buttons);
adm5120_add_device_gpio_leds(ARRAY_SIZE(eb214a_gpio_leds),
eb214a_gpio_leds);
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/infineon/infineon.c b/target/linux/adm5120/files/arch/mips/adm5120/infineon/infineon.c
index b52edf0f67..5c441da90e 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/infineon/infineon.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/infineon/infineon.c
@@ -16,7 +16,6 @@
#define EASY_CONFIG_OFFSET 0x10000
#define EASY_CONFIG_SIZE 0x1000
-#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition easy_partitions[] = {
{
.name = "admboot",
@@ -33,7 +32,6 @@ static struct mtd_partition easy_partitions[] = {
.size = MTDPART_SIZ_FULL,
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
static __init void easy_setup_mac(void)
{
@@ -68,10 +66,8 @@ void __init easy_setup_pqfp(void)
gpio_direction_output(ADM5120_GPIO_PIN3, 0);
adm5120_flash0_data.switch_bank = switch_bank_gpio3;
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
adm5120_flash0_data.parts = easy_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
adm5120_add_device_uart(0);
adm5120_add_device_uart(1);
@@ -100,10 +96,8 @@ void __init easy_setup_bga(void)
gpio_direction_output(ADM5120_GPIO_PIN5, 0);
adm5120_flash0_data.switch_bank = switch_bank_gpio5;
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
adm5120_flash0_data.parts = easy_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
adm5120_add_device_uart(0);
adm5120_add_device_uart(1);
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.c b/target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.c
index 7fc6e74dad..2ad8c42200 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.c
@@ -19,13 +19,15 @@
#define RB1XX_NAND_CHIP_DELAY 25
+#define RB1XX_KEYS_POLL_INTERVAL 20
+#define RB1XX_KEYS_DEBOUNCE_INTERVAL (3 * RB1XX_KEYS_POLL_INTERVAL)
+
static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
PCIIRQ(1, 0, 1, ADM5120_IRQ_PCI0),
PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI1),
PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2)
};
-#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition rb1xx_nor_parts[] = {
{
.name = "booter",
@@ -50,7 +52,6 @@ static struct mtd_partition rb1xx_nand_parts[] = {
.size = MTDPART_SIZ_FULL
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
/*
* We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader
@@ -79,22 +80,20 @@ static int rb1xx_nand_fixup(struct mtd_info *mtd)
struct platform_nand_data rb1xx_nand_data __initdata = {
.chip = {
.nr_chips = 1,
-#ifdef CONFIG_MTD_PARTITIONS
.nr_partitions = ARRAY_SIZE(rb1xx_nand_parts),
.partitions = rb1xx_nand_parts,
-#endif /* CONFIG_MTD_PARTITIONS */
.chip_delay = RB1XX_NAND_CHIP_DELAY,
.options = NAND_NO_AUTOINCR,
.chip_fixup = rb1xx_nand_fixup,
},
};
-struct gpio_button rb1xx_gpio_buttons[] __initdata = {
+struct gpio_keys_button rb1xx_gpio_buttons[] __initdata = {
{
.desc = "reset_button",
.type = EV_KEY,
- .code = BTN_0,
- .threshold = 5,
+ .code = KEY_RESTART,
+ .debounce_interval = RB1XX_KEYS_DEBOUNCE_INTERVAL,
.gpio = ADM5120_GPIO_PIN7,
}
};
@@ -114,10 +113,8 @@ static void __init rb1xx_mac_setup(void)
void __init rb1xx_add_device_flash(void)
{
/* setup data for flash0 device */
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_parts);
adm5120_flash0_data.parts = rb1xx_nor_parts;
-#endif /* CONFIG_MTD_PARTITIONS */
adm5120_flash0_data.window_size = 128*1024;
adm5120_add_device_flash(0);
@@ -144,8 +141,9 @@ void __init rb1xx_generic_setup(void)
adm5120_add_device_uart(0);
adm5120_add_device_uart(1);
- adm5120_add_device_gpio_buttons(ARRAY_SIZE(rb1xx_gpio_buttons),
- rb1xx_gpio_buttons);
+ adm5120_register_gpio_buttons(-1, RB1XX_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(rb1xx_gpio_buttons),
+ rb1xx_gpio_buttons);
rb1xx_add_device_flash();
rb1xx_mac_setup();
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.h b/target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.h
index 835110db51..05e68bd0a8 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.h
+++ b/target/linux/adm5120/files/arch/mips/adm5120/mikrotik/rb-1xx.h
@@ -26,7 +26,7 @@
#include <prom/routerboot.h>
extern struct platform_nand_data rb1xx_nand_data __initdata;
-extern struct gpio_button rb1xx_gpio_buttons[] __initdata;
+extern struct gpio_keys_button rb1xx_gpio_buttons[] __initdata;
extern void rb1xx_add_device_flash(void) __init;
extern void rb1xx_add_device_nand(void) __init;
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/motorola/pmugw.c b/target/linux/adm5120/files/arch/mips/adm5120/motorola/pmugw.c
index 1e82bd8d4d..a706e573c1 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/motorola/pmugw.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/motorola/pmugw.c
@@ -26,7 +26,6 @@
#define PMUGW_CONFIG_OFFSET 0x10000
#define PMUGW_CONFIG_SIZE 0x1000
-#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition pmugw_partitions[] = {
{
.name = "admboot",
@@ -43,7 +42,6 @@ static struct mtd_partition pmugw_partitions[] = {
.size = MTDPART_SIZ_FULL,
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
static u8 pmugw_vlans[6] __initdata = {
0x41, 0x42, 0x44, 0x48, 0x50, 0x00
@@ -82,10 +80,8 @@ void __init pmugw_setup(void)
gpio_direction_output(ADM5120_GPIO_PIN5, 0);
adm5120_flash0_data.switch_bank = switch_bank_gpio5;
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(pmugw_partitions);
adm5120_flash0_data.parts = pmugw_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
adm5120_add_device_uart(1); /* ttyS0 */
adm5120_add_device_uart(0); /* ttyS1 */
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/osbridge/5gxi.c b/target/linux/adm5120/files/arch/mips/adm5120/osbridge/5gxi.c
index 0fd449aecf..a5c2c3653e 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/osbridge/5gxi.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/osbridge/5gxi.c
@@ -20,7 +20,6 @@
#include <asm/mach-adm5120/adm5120_platform.h>
#include <asm/mach-adm5120/adm5120_info.h>
-#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition osbridge_5gxi_partitions[] = {
{
.name = "bootloader",
@@ -37,7 +36,6 @@ static struct mtd_partition osbridge_5gxi_partitions[] = {
.size = MTDPART_SIZ_FULL,
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
static struct gpio_led osbridge_5gxi_gpio_leds[] __initdata = {
GPIO_LED_INV(ADM5120_GPIO_PIN6, "5gxi:green:user", NULL),
@@ -54,10 +52,8 @@ static u8 osbridge_5gxi_vlans[6] __initdata = {
static void __init osbridge_5gxi_setup(void)
{
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(osbridge_5gxi_partitions);
adm5120_flash0_data.parts = osbridge_5gxi_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
adm5120_add_device_uart(0);
adm5120_add_device_uart(1);
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/zyxel/p-33x.c b/target/linux/adm5120/files/arch/mips/adm5120/zyxel/p-33x.c
index 24dce32558..7f86cab850 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/zyxel/p-33x.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/zyxel/p-33x.c
@@ -16,7 +16,6 @@
#define P33X_GPIO_FLASH_A20 ADM5120_GPIO_PIN5
#define P33X_GPIO_DEV_MASK (1 << P33X_GPIO_FLASH_A20)
-#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition p33x_partitions[] = {
{
.name = "bootbase",
@@ -46,7 +45,6 @@ static struct mtd_partition p33x_partitions[] = {
.size = MTDPART_SIZ_FULL,
}
};
-#endif /* CONFIG_MTD_PARTITIONS */
static struct adm5120_pci_irq p33x_pci_irqs[] __initdata = {
PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
@@ -75,10 +73,8 @@ void __init p33x_generic_setup(void)
gpio_request(P33X_GPIO_FLASH_A20, NULL); /* for flash A20 line */
gpio_direction_output(P33X_GPIO_FLASH_A20, 0);
adm5120_flash0_data.switch_bank = switch_bank_gpio5;
-#ifdef CONFIG_MTD_PARTITIONS
adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions);
adm5120_flash0_data.parts = p33x_partitions;
-#endif /* CONFIG_MTD_PARTITIONS */
adm5120_add_device_flash(0);
adm5120_add_device_uart(0);
diff --git a/target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_platform.h b/target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_platform.h
index 0159301d22..952c7adc8d 100644
--- a/target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_platform.h
+++ b/target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_platform.h
@@ -20,7 +20,8 @@
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/nand.h>
-#include <linux/gpio_buttons.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
#include <linux/amba/bus.h>
#include <linux/amba/serial.h>
@@ -28,10 +29,8 @@ struct adm5120_flash_platform_data {
void (*set_vpp)(struct map_info *, int);
void (*switch_bank)(unsigned);
u32 window_size;
-#ifdef CONFIG_MTD_PARTITIONS
unsigned int nr_parts;
struct mtd_partition *parts;
-#endif
};
struct adm5120_switch_platform_data {
@@ -68,8 +67,10 @@ extern void adm5120_add_device_uart(unsigned id) __init;
extern void adm5120_add_device_nand(struct platform_nand_data *pdata) __init;
extern void adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map) __init;
extern void adm5120_add_device_gpio(u32 disable_mask) __init;
-extern void adm5120_add_device_gpio_buttons(unsigned nbuttons,
- struct gpio_button *buttons) __init;
+extern void adm5120_register_gpio_buttons(int id,
+ unsigned poll_interval,
+ unsigned nbuttons,
+ struct gpio_keys_button *buttons);
#define GPIO_LED_DEF(g, n, t, a) { \
.name = (n), \
diff --git a/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c b/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c
index 86657ce841..f8d359806a 100644
--- a/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c
+++ b/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c
@@ -49,7 +49,7 @@
static unsigned int adm5120_pci_nr_irqs __initdata;
static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata;
-static spinlock_t pci_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(pci_lock);
/* -------------------------------------------------------------------------*/