| 1 | From f1c9b41720476cd660a852134b0e8a8acd601441 Mon Sep 17 00:00:00 2001 |
| 2 | From: John Crispin <blogic@openwrt.org> |
| 3 | Date: Fri, 3 Aug 2012 10:23:08 +0200 |
| 4 | Subject: [PATCH 13/25] machtype support |
| 5 | |
| 6 | --- |
| 7 | arch/mips/lantiq/Makefile | 2 +- |
| 8 | arch/mips/lantiq/devices.c | 18 ++++ |
| 9 | arch/mips/lantiq/devices.h | 1 + |
| 10 | arch/mips/lantiq/falcon/Kconfig | 8 ++ |
| 11 | arch/mips/lantiq/falcon/Makefile | 4 + |
| 12 | arch/mips/lantiq/falcon/mach-easy98000.c | 162 ++++++++++++++++++++++++++--- |
| 13 | arch/mips/lantiq/machtypes.h | 42 ++++++++ |
| 14 | arch/mips/lantiq/xway/Kconfig | 32 ++++++ |
| 15 | arch/mips/lantiq/xway/Makefile | 11 ++ |
| 16 | arch/mips/lantiq/xway/devices.c | 95 +++++++++++++++++ |
| 17 | arch/mips/lantiq/xway/devices.h | 6 + |
| 18 | 11 files changed, 363 insertions(+), 18 deletions(-) |
| 19 | |
| 20 | diff --git a/arch/mips/lantiq/Makefile b/arch/mips/lantiq/Makefile |
| 21 | index db1ce50..4f245d8 100644 |
| 22 | --- a/arch/mips/lantiq/Makefile |
| 23 | +++ b/arch/mips/lantiq/Makefile |
| 24 | @@ -4,7 +4,7 @@ |
| 25 | # under the terms of the GNU General Public License version 2 as published |
| 26 | # by the Free Software Foundation. |
| 27 | |
| 28 | -obj-y := irq.o setup.o clk.o prom.o devices.o |
| 29 | +obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o |
| 30 | |
| 31 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
| 32 | |
| 33 | diff --git a/arch/mips/lantiq/devices.c b/arch/mips/lantiq/devices.c |
| 34 | index 7193d78..2d7c46a 100644 |
| 35 | --- a/arch/mips/lantiq/devices.c |
| 36 | +++ b/arch/mips/lantiq/devices.c |
| 37 | @@ -18,6 +18,7 @@ |
| 38 | #include <linux/time.h> |
| 39 | #include <linux/io.h> |
| 40 | #include <linux/gpio.h> |
| 41 | +#include <linux/dma-mapping.h> |
| 42 | |
| 43 | #include <asm/bootinfo.h> |
| 44 | #include <asm/irq.h> |
| 45 | @@ -100,3 +101,20 @@ void __init ltq_register_pci(struct ltq_pci_data *data) |
| 46 | pr_err("kernel is compiled without PCI support\n"); |
| 47 | } |
| 48 | #endif |
| 49 | + |
| 50 | +static unsigned int *cp1_base = 0; |
| 51 | +unsigned int* |
| 52 | +ltq_get_cp1_base(void) |
| 53 | +{ |
| 54 | + return cp1_base; |
| 55 | +} |
| 56 | +EXPORT_SYMBOL(ltq_get_cp1_base); |
| 57 | + |
| 58 | +void __init |
| 59 | +ltq_register_tapi(void) |
| 60 | +{ |
| 61 | +#define CP1_SIZE (1 << 20) |
| 62 | + dma_addr_t dma; |
| 63 | + cp1_base = |
| 64 | + (void*)CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, &dma, GFP_ATOMIC)); |
| 65 | +} |
| 66 | diff --git a/arch/mips/lantiq/devices.h b/arch/mips/lantiq/devices.h |
| 67 | index a03c23f..59d904c 100644 |
| 68 | --- a/arch/mips/lantiq/devices.h |
| 69 | +++ b/arch/mips/lantiq/devices.h |
| 70 | @@ -23,5 +23,6 @@ extern void ltq_register_nor(struct physmap_flash_data *data); |
| 71 | extern void ltq_register_wdt(void); |
| 72 | extern void ltq_register_asc(int port); |
| 73 | extern void ltq_register_pci(struct ltq_pci_data *data); |
| 74 | +extern void ltq_register_tapi(void); |
| 75 | |
| 76 | #endif |
| 77 | diff --git a/arch/mips/lantiq/falcon/Kconfig b/arch/mips/lantiq/falcon/Kconfig |
| 78 | index 03e999d..2e3e59c 100644 |
| 79 | --- a/arch/mips/lantiq/falcon/Kconfig |
| 80 | +++ b/arch/mips/lantiq/falcon/Kconfig |
| 81 | @@ -6,6 +6,14 @@ config LANTIQ_MACH_EASY98000 |
| 82 | bool "Easy98000" |
| 83 | default y |
| 84 | |
| 85 | +config LANTIQ_MACH_EASY98020 |
| 86 | + bool "Easy98020" |
| 87 | + default y |
| 88 | + |
| 89 | +config LANTIQ_MACH_95C3AM1 |
| 90 | + bool "95C3AM1" |
| 91 | + default y |
| 92 | + |
| 93 | endmenu |
| 94 | |
| 95 | endif |
| 96 | diff --git a/arch/mips/lantiq/falcon/Makefile b/arch/mips/lantiq/falcon/Makefile |
| 97 | index 3634154..aa1fc69 100644 |
| 98 | --- a/arch/mips/lantiq/falcon/Makefile |
| 99 | +++ b/arch/mips/lantiq/falcon/Makefile |
| 100 | @@ -1,2 +1,6 @@ |
| 101 | obj-y := prom.o reset.o sysctrl.o devices.o gpio.o |
| 102 | +obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o |
| 103 | +obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o |
| 104 | obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o |
| 105 | +obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o |
| 106 | +obj-$(CONFIG_LANTIQ_MACH_95C3AM1) += mach-95C3AM1.o |
| 107 | diff --git a/arch/mips/lantiq/falcon/mach-easy98000.c b/arch/mips/lantiq/falcon/mach-easy98000.c |
| 108 | index fc5720d..adf6b5d 100644 |
| 109 | --- a/arch/mips/lantiq/falcon/mach-easy98000.c |
| 110 | +++ b/arch/mips/lantiq/falcon/mach-easy98000.c |
| 111 | @@ -1,23 +1,48 @@ |
| 112 | -/* |
| 113 | - * This program is free software; you can redistribute it and/or modify it |
| 114 | - * under the terms of the GNU General Public License version 2 as published |
| 115 | - * by the Free Software Foundation. |
| 116 | - * |
| 117 | - * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com> |
| 118 | - * Copyright (C) 2011 John Crispin <blogic@openwrt.org> |
| 119 | - */ |
| 120 | - |
| 121 | +#include <linux/init.h> |
| 122 | #include <linux/platform_device.h> |
| 123 | +#include <linux/leds.h> |
| 124 | +#include <linux/gpio.h> |
| 125 | +#include <linux/gpio_buttons.h> |
| 126 | +#include <linux/etherdevice.h> |
| 127 | +#include <linux/mtd/mtd.h> |
| 128 | #include <linux/mtd/partitions.h> |
| 129 | +#include <linux/mtd/physmap.h> |
| 130 | +#include <linux/input.h> |
| 131 | +#include <linux/interrupt.h> |
| 132 | +#include <linux/dm9000.h> |
| 133 | +#include <linux/i2c.h> |
| 134 | +#include <linux/i2c-gpio.h> |
| 135 | #include <linux/spi/spi.h> |
| 136 | #include <linux/spi/spi_gpio.h> |
| 137 | #include <linux/spi/eeprom.h> |
| 138 | +#include <falcon/lantiq_soc.h> |
| 139 | + |
| 140 | +#include <dev-gpio-leds.h> |
| 141 | |
| 142 | #include "../machtypes.h" |
| 143 | |
| 144 | #include "devices.h" |
| 145 | |
| 146 | -static struct mtd_partition easy98000_nor_partitions[] = { |
| 147 | +#define EASY98000_GPIO_LED_0 9 |
| 148 | +#define EASY98000_GPIO_LED_1 10 |
| 149 | +#define EASY98000_GPIO_LED_2 11 |
| 150 | +#define EASY98000_GPIO_LED_3 12 |
| 151 | +#define EASY98000_GPIO_LED_4 13 |
| 152 | +#define EASY98000_GPIO_LED_5 14 |
| 153 | + |
| 154 | +static unsigned char ltq_ethaddr[6] = {0}; |
| 155 | + |
| 156 | +static int __init falcon_set_ethaddr(char *str) |
| 157 | +{ |
| 158 | + sscanf(str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", |
| 159 | + <q_ethaddr[0], <q_ethaddr[1], <q_ethaddr[2], |
| 160 | + <q_ethaddr[3], <q_ethaddr[4], <q_ethaddr[5]); |
| 161 | + return 0; |
| 162 | +} |
| 163 | +__setup("ethaddr=", falcon_set_ethaddr); |
| 164 | + |
| 165 | +static struct mtd_partition easy98000_nor_partitions[] = |
| 166 | +{ |
| 167 | { |
| 168 | .name = "uboot", |
| 169 | .offset = 0x0, |
| 170 | @@ -35,7 +60,7 @@ static struct mtd_partition easy98000_nor_partitions[] = { |
| 171 | }, |
| 172 | }; |
| 173 | |
| 174 | -struct physmap_flash_data easy98000_nor_flash_data = { |
| 175 | +static struct physmap_flash_data easy98000_nor_flash_data = { |
| 176 | .nr_parts = ARRAY_SIZE(easy98000_nor_partitions), |
| 177 | .parts = easy98000_nor_partitions, |
| 178 | }; |
| 179 | @@ -55,12 +80,104 @@ static struct spi_board_info easy98000_spi_flash_data __initdata = { |
| 180 | .platform_data = &easy98000_spi_flash_platform_data |
| 181 | }; |
| 182 | |
| 183 | +static struct gpio_led easy98000_gpio_leds[] __initdata = { |
| 184 | + { |
| 185 | + .name = "easy98000:green:0", |
| 186 | + .gpio = EASY98000_GPIO_LED_0, |
| 187 | + .active_low = 0, |
| 188 | + }, { |
| 189 | + .name = "easy98000:green:1", |
| 190 | + .gpio = EASY98000_GPIO_LED_1, |
| 191 | + .active_low = 0, |
| 192 | + }, { |
| 193 | + .name = "easy98000:green:2", |
| 194 | + .gpio = EASY98000_GPIO_LED_2, |
| 195 | + .active_low = 0, |
| 196 | + }, { |
| 197 | + .name = "easy98000:green:3", |
| 198 | + .gpio = EASY98000_GPIO_LED_3, |
| 199 | + .active_low = 0, |
| 200 | + }, { |
| 201 | + .name = "easy98000:green:4", |
| 202 | + .gpio = EASY98000_GPIO_LED_4, |
| 203 | + .active_low = 0, |
| 204 | + }, { |
| 205 | + .name = "easy98000:green:5", |
| 206 | + .gpio = EASY98000_GPIO_LED_5, |
| 207 | + .active_low = 0, |
| 208 | + } |
| 209 | +}; |
| 210 | + |
| 211 | +#define CONFIG_DM9000_BASE 0x14000000 |
| 212 | +#define DM9000_IO (CONFIG_DM9000_BASE + 3) |
| 213 | +#define DM9000_DATA (CONFIG_DM9000_BASE + 1) |
| 214 | + |
| 215 | +static struct dm9000_plat_data dm9000_plat_data = { |
| 216 | + .flags = DM9000_PLATF_8BITONLY, |
| 217 | +}; |
| 218 | + |
| 219 | +static struct resource dm9000_resources[] = { |
| 220 | + MEM_RES("dm9000_io", DM9000_IO, 1), |
| 221 | + MEM_RES("dm9000_data", DM9000_DATA, 1), |
| 222 | + [2] = { |
| 223 | + /* with irq (210 -> gpio 110) the driver is very unreliable */ |
| 224 | + .start = -1, /* use polling */ |
| 225 | + .end = -1, |
| 226 | + .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, |
| 227 | + }, |
| 228 | +}; |
| 229 | + |
| 230 | +static struct platform_device dm9000_platform = { |
| 231 | + .name = "dm9000", |
| 232 | + .id = 0, |
| 233 | + .num_resources = ARRAY_SIZE(dm9000_resources), |
| 234 | + .resource = dm9000_resources, |
| 235 | + .dev = { |
| 236 | + .platform_data = (void *) &dm9000_plat_data, |
| 237 | + } |
| 238 | +}; |
| 239 | + |
| 240 | +extern int easy98000_addon_has_dm9000(void); |
| 241 | +static void __init register_davicom(void) |
| 242 | +{ |
| 243 | + if (!easy98000_addon_has_dm9000()) |
| 244 | + return; |
| 245 | + |
| 246 | + if (!is_valid_ether_addr(ltq_ethaddr)) |
| 247 | + random_ether_addr(dm9000_plat_data.dev_addr); |
| 248 | + else { |
| 249 | + memcpy(dm9000_plat_data.dev_addr, ltq_ethaddr, 6); |
| 250 | + /* change to "Locally Administered Address" */ |
| 251 | + dm9000_plat_data.dev_addr[0] |= 0x2; |
| 252 | + } |
| 253 | + platform_device_register(&dm9000_platform); |
| 254 | +} |
| 255 | + |
| 256 | +static struct i2c_gpio_platform_data easy98000_i2c_gpio_data = { |
| 257 | + .sda_pin = 107, |
| 258 | + .scl_pin = 108, |
| 259 | +}; |
| 260 | + |
| 261 | +static struct platform_device easy98000_i2c_gpio_device = { |
| 262 | + .name = "i2c-gpio", |
| 263 | + .id = 0, |
| 264 | + .dev = { |
| 265 | + .platform_data = &easy98000_i2c_gpio_data, |
| 266 | + } |
| 267 | +}; |
| 268 | + |
| 269 | +void __init register_easy98000_cpld(void) |
| 270 | +{ |
| 271 | + platform_device_register_simple("easy98000_cpld_led", 0, NULL, 0); |
| 272 | + platform_device_register_simple("easy98000_addon", 0, NULL, 0); |
| 273 | +} |
| 274 | + |
| 275 | /* setup gpio based spi bus/device for access to the eeprom on the board */ |
| 276 | -#define SPI_GPIO_MRST 102 |
| 277 | -#define SPI_GPIO_MTSR 103 |
| 278 | -#define SPI_GPIO_CLK 104 |
| 279 | -#define SPI_GPIO_CS0 105 |
| 280 | -#define SPI_GPIO_CS1 106 |
| 281 | +#define SPI_GPIO_MRST 102 |
| 282 | +#define SPI_GPIO_MTSR 103 |
| 283 | +#define SPI_GPIO_CLK 104 |
| 284 | +#define SPI_GPIO_CS0 105 |
| 285 | +#define SPI_GPIO_CS1 106 |
| 286 | #define SPI_GPIO_BUS_NUM 1 |
| 287 | |
| 288 | static struct spi_gpio_platform_data easy98000_spi_gpio_data = { |
| 289 | @@ -94,11 +211,22 @@ static struct spi_board_info easy98000_spi_gpio_devices __initdata = { |
| 290 | }; |
| 291 | |
| 292 | static void __init |
| 293 | -easy98000_init_common(void) |
| 294 | +easy98000_spi_gpio_init(void) |
| 295 | { |
| 296 | spi_register_board_info(&easy98000_spi_gpio_devices, 1); |
| 297 | platform_device_register(&easy98000_spi_gpio_device); |
| 298 | +} |
| 299 | + |
| 300 | +static void __init |
| 301 | +easy98000_init_common(void) |
| 302 | +{ |
| 303 | falcon_register_i2c(); |
| 304 | + platform_device_register(&easy98000_i2c_gpio_device); |
| 305 | + register_davicom(); |
| 306 | + ltq_add_device_gpio_leds(-1, ARRAY_SIZE(easy98000_gpio_leds), |
| 307 | + easy98000_gpio_leds); |
| 308 | + register_easy98000_cpld(); |
| 309 | + easy98000_spi_gpio_init(); |
| 310 | } |
| 311 | |
| 312 | static void __init |
| 313 | diff --git a/arch/mips/lantiq/machtypes.h b/arch/mips/lantiq/machtypes.h |
| 314 | index dfc6af7..7690f6a 100644 |
| 315 | --- a/arch/mips/lantiq/machtypes.h |
| 316 | +++ b/arch/mips/lantiq/machtypes.h |
| 317 | @@ -16,10 +16,52 @@ enum lantiq_mach_type { |
| 318 | LTQ_MACH_EASY50712, /* Danube evaluation board */ |
| 319 | LTQ_MACH_EASY50601, /* Amazon SE evaluation board */ |
| 320 | |
| 321 | + /* SVIP */ |
| 322 | + LANTIQ_MACH_EASY33016, /* SVIP Easy33016 */ |
| 323 | + LANTIQ_MACH_EASY336, /* SVIP Easy336, NOR Flash */ |
| 324 | + LANTIQ_MACH_EASY336SF, /* SVIP Easy336, Serial Flash */ |
| 325 | + LANTIQ_MACH_EASY336NAND, /* SVIP Easy336, NAND Flash */ |
| 326 | + |
| 327 | /* FALCON */ |
| 328 | LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */ |
| 329 | LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */ |
| 330 | LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */ |
| 331 | + LANTIQ_MACH_EASY98020, /* EASY98020 Eval Board */ |
| 332 | + LANTIQ_MACH_EASY98020_1LAN, /* EASY98020 Eval Board (1 LAN port) */ |
| 333 | + LANTIQ_MACH_EASY98020_2LAN, /* EASY98020 Eval Board (2 LAN port) */ |
| 334 | + LANTIQ_MACH_95C3AM1, /* 95C3AM1 Eval Board */ |
| 335 | + |
| 336 | + /* Arcadyan */ |
| 337 | + LANTIQ_MACH_ARV3527P, /* Arcor easybox a401 */ |
| 338 | + LANTIQ_MACH_ARV4510PW, /* Wippies Homebox */ |
| 339 | + LANTIQ_MACH_ARV4518PW, /* Airties WAV-221, SMC-7908A-ISP */ |
| 340 | + LANTIQ_MACH_ARV4519PW, /* Vodafone, Pirelli */ |
| 341 | + LANTIQ_MACH_ARV4520PW, /* Airties WAV-281, Arcor EasyboxA800 */ |
| 342 | + LANTIQ_MACH_ARV452CPW, /* Arcor EasyboxA801 */ |
| 343 | + LANTIQ_MACH_ARV4525PW, /* Speedport W502V */ |
| 344 | + LANTIQ_MACH_ARV7525PW, /* Speedport W303V */ |
| 345 | + LANTIQ_MACH_ARV752DPW, /* Arcor easybox a802 */ |
| 346 | + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */ |
| 347 | + LANTIQ_MACH_ARV7518PW, /* ASTORIA */ |
| 348 | + |
| 349 | + /* Netgear */ |
| 350 | + LANTIQ_MACH_DGN3500B, /* Netgear DGN3500 */ |
| 351 | + |
| 352 | + /* FRITZ!BOX */ |
| 353 | + LANTIQ_MACH_FRITZ3370, /* FRITZ!BOX 3370 vdsl cpe */ |
| 354 | + LANTIQ_MACH_FRITZ7320, /* FRITZ!BOX 7320 1&1 homeserver */ |
| 355 | + |
| 356 | + /* Gigaset */ |
| 357 | + LANTIQ_MACH_GIGASX76X, /* Gigaset SX76x */ |
| 358 | + |
| 359 | + /* Buffalo */ |
| 360 | + LANTIQ_MACH_WBMR, /* WBMR-HP-G300H */ |
| 361 | + |
| 362 | + /* ZyXEL */ |
| 363 | + LANTIQ_MACH_P2601HNFX, /* ZyXEL P-2601HN-Fx */ |
| 364 | + |
| 365 | + /* ZTE */ |
| 366 | + LANTIQ_MACH_H201L, /* ZTE ZXV10 H201L */ |
| 367 | }; |
| 368 | |
| 369 | #endif |
| 370 | diff --git a/arch/mips/lantiq/xway/Kconfig b/arch/mips/lantiq/xway/Kconfig |
| 371 | index 54a51ff..8ad481c 100644 |
| 372 | --- a/arch/mips/lantiq/xway/Kconfig |
| 373 | +++ b/arch/mips/lantiq/xway/Kconfig |
| 374 | @@ -6,6 +6,38 @@ config LANTIQ_MACH_EASY50712 |
| 375 | bool "Easy50712 - Danube" |
| 376 | default y |
| 377 | |
| 378 | +config LANTIQ_MACH_ARV |
| 379 | + bool "ARV" |
| 380 | + default y |
| 381 | + |
| 382 | +config LANTIQ_MACH_NETGEAR |
| 383 | + bool "Netgear" |
| 384 | + default y |
| 385 | + |
| 386 | +config LANTIQ_MACH_GIGASX76X |
| 387 | + bool "GIGASX76X" |
| 388 | + default y |
| 389 | + |
| 390 | +config LANTIQ_MACH_WBMR |
| 391 | + bool "WBMR-HP-G300H" |
| 392 | + default y |
| 393 | + |
| 394 | +config LANTIQ_MACH_P2601HNFX |
| 395 | + bool "P2601HNFX" |
| 396 | + default y |
| 397 | + |
| 398 | +config LANTIQ_MACH_H201L |
| 399 | + bool "H201L" |
| 400 | + default y |
| 401 | + |
| 402 | +config LANTIQ_MACH_FRITZ_VR9 |
| 403 | + bool "FRITZ3370" |
| 404 | + default y |
| 405 | + |
| 406 | +config LANTIQ_MACH_FRITZ_AR9 |
| 407 | + bool "FRITZ7320" |
| 408 | + default y |
| 409 | + |
| 410 | endmenu |
| 411 | |
| 412 | choice |
| 413 | diff --git a/arch/mips/lantiq/xway/Makefile b/arch/mips/lantiq/xway/Makefile |
| 414 | index c9baf91..d9f3685 100644 |
| 415 | --- a/arch/mips/lantiq/xway/Makefile |
| 416 | +++ b/arch/mips/lantiq/xway/Makefile |
| 417 | @@ -1,4 +1,15 @@ |
| 418 | obj-y := sysctrl.o reset.o gpio.o gpio_stp.o gpio_ebu.o devices.o dma.o clk.o prom.o nand.o timer.o dev-ifxhcd.o |
| 419 | |
| 420 | +obj-y += dev-dwc_otg.o |
| 421 | +obj-$(CONFIG_PCI) += dev-wifi-rt2x00.o dev-wifi-athxk.o pci-ath-fixup.o |
| 422 | + |
| 423 | obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o |
| 424 | obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o |
| 425 | +obj-$(CONFIG_LANTIQ_MACH_ARV) += mach-arv.o |
| 426 | +obj-$(CONFIG_LANTIQ_MACH_FRITZ_AR9) += mach-fritz_ar9.o |
| 427 | +obj-$(CONFIG_LANTIQ_MACH_FRITZ_VR9) += mach-fritz_vr9.o |
| 428 | +obj-$(CONFIG_LANTIQ_MACH_GIGASX76X) += mach-gigasx76x.o |
| 429 | +obj-$(CONFIG_LANTIQ_MACH_NETGEAR) += mach-netgear.o |
| 430 | +obj-$(CONFIG_LANTIQ_MACH_WBMR) += mach-wbmr.o |
| 431 | +obj-$(CONFIG_LANTIQ_MACH_P2601HNFX) += mach-p2601hnfx.o |
| 432 | +obj-$(CONFIG_LANTIQ_MACH_H201L) += mach-h201l.o |
| 433 | diff --git a/arch/mips/lantiq/xway/devices.c b/arch/mips/lantiq/xway/devices.c |
| 434 | index 5d4650d..64fe713 100644 |
| 435 | --- a/arch/mips/lantiq/xway/devices.c |
| 436 | +++ b/arch/mips/lantiq/xway/devices.c |
| 437 | @@ -19,6 +19,7 @@ |
| 438 | #include <linux/time.h> |
| 439 | #include <linux/io.h> |
| 440 | #include <linux/gpio.h> |
| 441 | +#include <linux/spi/spi.h> |
| 442 | |
| 443 | #include <asm/bootinfo.h> |
| 444 | #include <asm/irq.h> |
| 445 | @@ -119,3 +120,97 @@ ltq_register_vrx200(struct ltq_eth_data *eth) |
| 446 | ltq_vrx200.dev.platform_data = eth; |
| 447 | platform_device_register(<q_vrx200); |
| 448 | } |
| 449 | + |
| 450 | +/* ebu */ |
| 451 | +static struct resource ltq_ebu_resource = |
| 452 | +{ |
| 453 | + .name = "gpio_ebu", |
| 454 | + .start = LTQ_EBU_GPIO_START, |
| 455 | + .end = LTQ_EBU_GPIO_START + LTQ_EBU_GPIO_SIZE - 1, |
| 456 | + .flags = IORESOURCE_MEM, |
| 457 | +}; |
| 458 | + |
| 459 | +static struct platform_device ltq_ebu = |
| 460 | +{ |
| 461 | + .name = "ltq_ebu", |
| 462 | + .resource = <q_ebu_resource, |
| 463 | + .num_resources = 1, |
| 464 | +}; |
| 465 | + |
| 466 | +void __init |
| 467 | +ltq_register_gpio_ebu(unsigned int value) |
| 468 | +{ |
| 469 | + ltq_ebu.dev.platform_data = (void*) value; |
| 470 | + platform_device_register(<q_ebu); |
| 471 | +} |
| 472 | + |
| 473 | +/* gpio buttons */ |
| 474 | +static struct gpio_buttons_platform_data ltq_gpio_buttons_platform_data; |
| 475 | + |
| 476 | +static struct platform_device ltq_gpio_buttons_platform_device = |
| 477 | +{ |
| 478 | + .name = "gpio-buttons", |
| 479 | + .id = 0, |
| 480 | + .dev = { |
| 481 | + .platform_data = (void *) <q_gpio_buttons_platform_data, |
| 482 | + }, |
| 483 | +}; |
| 484 | + |
| 485 | +void __init |
| 486 | +ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt) |
| 487 | +{ |
| 488 | + ltq_gpio_buttons_platform_data.buttons = buttons; |
| 489 | + ltq_gpio_buttons_platform_data.nbuttons = cnt; |
| 490 | + platform_device_register(<q_gpio_buttons_platform_device); |
| 491 | +} |
| 492 | + |
| 493 | +static struct resource ltq_spi_resources[] = { |
| 494 | + { |
| 495 | + .start = LTQ_SSC_BASE_ADDR, |
| 496 | + .end = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1, |
| 497 | + .flags = IORESOURCE_MEM, |
| 498 | + }, |
| 499 | + IRQ_RES(spi_tx, LTQ_SSC_TIR), |
| 500 | + IRQ_RES(spi_rx, LTQ_SSC_RIR), |
| 501 | + IRQ_RES(spi_err, LTQ_SSC_EIR), |
| 502 | +}; |
| 503 | + |
| 504 | +static struct resource ltq_spi_resources_ar9[] = { |
| 505 | + { |
| 506 | + .start = LTQ_SSC_BASE_ADDR, |
| 507 | + .end = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1, |
| 508 | + .flags = IORESOURCE_MEM, |
| 509 | + }, |
| 510 | + IRQ_RES(spi_tx, LTQ_SSC_TIR_AR9), |
| 511 | + IRQ_RES(spi_rx, LTQ_SSC_RIR_AR9), |
| 512 | + IRQ_RES(spi_err, LTQ_SSC_EIR), |
| 513 | +}; |
| 514 | + |
| 515 | +static struct resource ltq_spi_resources_ase[] = { |
| 516 | + { |
| 517 | + .start = LTQ_SSC_BASE_ADDR, |
| 518 | + .end = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1, |
| 519 | + .flags = IORESOURCE_MEM, |
| 520 | + }, |
| 521 | + IRQ_RES(spi_tx, LTQ_SSC_TIR_ASE), |
| 522 | + IRQ_RES(spi_rx, LTQ_SSC_RIR_ASE), |
| 523 | + IRQ_RES(spi_err, LTQ_SSC_EIR_ASE), |
| 524 | +}; |
| 525 | + |
| 526 | +static struct platform_device ltq_spi = { |
| 527 | + .name = "ltq_spi", |
| 528 | + .resource = ltq_spi_resources, |
| 529 | + .num_resources = ARRAY_SIZE(ltq_spi_resources), |
| 530 | +}; |
| 531 | + |
| 532 | +void __init ltq_register_spi(struct ltq_spi_platform_data *pdata, |
| 533 | + struct spi_board_info const *info, unsigned n) |
| 534 | +{ |
| 535 | + if (ltq_is_ar9()) |
| 536 | + ltq_spi.resource = ltq_spi_resources_ar9; |
| 537 | + else if (ltq_is_ase()) |
| 538 | + ltq_spi.resource = ltq_spi_resources_ase; |
| 539 | + spi_register_board_info(info, n); |
| 540 | + ltq_spi.dev.platform_data = pdata; |
| 541 | + platform_device_register(<q_spi); |
| 542 | +} |
| 543 | diff --git a/arch/mips/lantiq/xway/devices.h b/arch/mips/lantiq/xway/devices.h |
| 544 | index 08befd9..dcf2a14 100644 |
| 545 | --- a/arch/mips/lantiq/xway/devices.h |
| 546 | +++ b/arch/mips/lantiq/xway/devices.h |
| 547 | @@ -11,6 +11,8 @@ |
| 548 | |
| 549 | #include "../devices.h" |
| 550 | #include <linux/phy.h> |
| 551 | +#include <linux/spi/spi.h> |
| 552 | +#include <linux/gpio_buttons.h> |
| 553 | |
| 554 | extern void ltq_register_gpio(void); |
| 555 | extern void ltq_register_gpio_stp(void); |
| 556 | @@ -18,5 +20,9 @@ extern void ltq_register_ase_asc(void); |
| 557 | extern void ltq_register_etop(struct ltq_eth_data *eth); |
| 558 | extern void xway_register_nand(struct mtd_partition *parts, int count); |
| 559 | extern void ltq_register_vrx200(struct ltq_eth_data *eth); |
| 560 | +extern void ltq_register_gpio_ebu(unsigned int value); |
| 561 | +extern void ltq_register_spi(struct ltq_spi_platform_data *pdata, |
| 562 | + struct spi_board_info const *info, unsigned n); |
| 563 | +extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt); |
| 564 | |
| 565 | #endif |
| 566 | -- |
| 567 | 1.7.9.1 |
| 568 | |
| 569 | |