190-cambria_support.patch 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  1. --- a/arch/arm/mach-ixp4xx/Kconfig
  2. +++ b/arch/arm/mach-ixp4xx/Kconfig
  3. @@ -21,6 +21,14 @@ config MACH_AVILA
  4. Avila Network Platform. For more information on this platform,
  5. see <file:Documentation/arm/IXP4xx>.
  6. +config MACH_CAMBRIA
  7. + bool "Cambria"
  8. + select PCI
  9. + help
  10. + Say 'Y' here if you want your kernel to support the Gateworks
  11. + Cambria series. For more information on this platform,
  12. + see <file:Documentation/arm/IXP4xx>.
  13. +
  14. config MACH_LOFT
  15. bool "Loft"
  16. depends on MACH_AVILA
  17. @@ -218,7 +226,7 @@ config CPU_IXP46X
  18. config CPU_IXP43X
  19. bool
  20. - depends on MACH_KIXRP435
  21. + depends on MACH_KIXRP435 || MACH_CAMBRIA
  22. default y
  23. config MACH_GTWX5715
  24. --- a/arch/arm/mach-ixp4xx/Makefile
  25. +++ b/arch/arm/mach-ixp4xx/Makefile
  26. @@ -7,6 +7,7 @@ obj-pci-n :=
  27. obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o
  28. obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o
  29. +obj-pci-$(CONFIG_MACH_CAMBRIA) += cambria-pci.o
  30. obj-pci-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o
  31. obj-pci-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o
  32. obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o
  33. @@ -31,6 +32,7 @@ obj-y += common.o
  34. obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o
  35. obj-$(CONFIG_MACH_AVILA) += avila-setup.o
  36. +obj-$(CONFIG_MACH_CAMBRIA) += cambria-setup.o
  37. obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o
  38. obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o
  39. obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o
  40. --- /dev/null
  41. +++ b/arch/arm/mach-ixp4xx/cambria-pci.c
  42. @@ -0,0 +1,78 @@
  43. +/*
  44. + * arch/arch/mach-ixp4xx/cambria-pci.c
  45. + *
  46. + * PCI setup routines for Gateworks Cambria series
  47. + *
  48. + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  49. + *
  50. + * based on coyote-pci.c:
  51. + * Copyright (C) 2002 Jungo Software Technologies.
  52. + * Copyright (C) 2003 MontaVista Softwrae, Inc.
  53. + *
  54. + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
  55. + *
  56. + * This program is free software; you can redistribute it and/or modify
  57. + * it under the terms of the GNU General Public License version 2 as
  58. + * published by the Free Software Foundation.
  59. + *
  60. + */
  61. +
  62. +#include <linux/kernel.h>
  63. +#include <linux/pci.h>
  64. +#include <linux/init.h>
  65. +#include <linux/irq.h>
  66. +
  67. +#include <asm/mach-types.h>
  68. +#include <mach/hardware.h>
  69. +#include <asm/irq.h>
  70. +
  71. +#include <asm/mach/pci.h>
  72. +
  73. +extern void ixp4xx_pci_preinit(void);
  74. +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
  75. +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
  76. +
  77. +void __init cambria_pci_preinit(void)
  78. +{
  79. + irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
  80. + irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
  81. + irq_set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
  82. + irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
  83. +
  84. + ixp4xx_pci_preinit();
  85. +}
  86. +
  87. +static int __init cambria_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  88. +{
  89. + if (slot == 1)
  90. + return IRQ_IXP4XX_GPIO11;
  91. + else if (slot == 2)
  92. + return IRQ_IXP4XX_GPIO10;
  93. + else if (slot == 3)
  94. + return IRQ_IXP4XX_GPIO9;
  95. + else if (slot == 4)
  96. + return IRQ_IXP4XX_GPIO8;
  97. + else if (slot == 6)
  98. + return IRQ_IXP4XX_GPIO10;
  99. + else if (slot == 15)
  100. + return IRQ_IXP4XX_GPIO8;
  101. +
  102. + else return -1;
  103. +}
  104. +
  105. +struct hw_pci cambria_pci __initdata = {
  106. + .nr_controllers = 1,
  107. + .preinit = cambria_pci_preinit,
  108. + .ops = &ixp4xx_ops,
  109. + .setup = ixp4xx_setup,
  110. + .map_irq = cambria_map_irq,
  111. +};
  112. +
  113. +int __init cambria_pci_init(void)
  114. +{
  115. + if (machine_is_cambria())
  116. + pci_common_init(&cambria_pci);
  117. + return 0;
  118. +}
  119. +
  120. +subsys_initcall(cambria_pci_init);
  121. --- /dev/null
  122. +++ b/arch/arm/mach-ixp4xx/cambria-setup.c
  123. @@ -0,0 +1,1003 @@
  124. +/*
  125. + * arch/arm/mach-ixp4xx/cambria-setup.c
  126. + *
  127. + * Board setup for the Gateworks Cambria series
  128. + *
  129. + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  130. + * Copyright (C) 2012 Gateworks Corporation <support@gateworks.com>
  131. + *
  132. + * based on coyote-setup.c:
  133. + * Copyright (C) 2003-2005 MontaVista Software, Inc.
  134. + *
  135. + * Author: Imre Kaloz <kaloz@openwrt.org>
  136. + * Tim Harvey <tharvey@gateworks.com>
  137. + */
  138. +
  139. +#include <linux/device.h>
  140. +#include <linux/gpio_keys.h>
  141. +#include <linux/gpio.h>
  142. +#include <linux/i2c.h>
  143. +#include <linux/i2c-gpio.h>
  144. +#include <linux/platform_data/at24.h>
  145. +#include <linux/i2c/gw_i2c_pld.h>
  146. +#include <linux/platform_data/pca953x.h>
  147. +#include <linux/if_ether.h>
  148. +#include <linux/init.h>
  149. +#include <linux/input.h>
  150. +#include <linux/kernel.h>
  151. +#include <linux/leds.h>
  152. +#include <linux/memory.h>
  153. +#include <linux/netdevice.h>
  154. +#include <linux/serial.h>
  155. +#include <linux/serial_8250.h>
  156. +#include <linux/slab.h>
  157. +#include <linux/socket.h>
  158. +#include <linux/types.h>
  159. +#include <linux/tty.h>
  160. +#include <linux/irq.h>
  161. +#include <linux/usb/ehci_pdriver.h>
  162. +
  163. +#include <mach/hardware.h>
  164. +#include <asm/irq.h>
  165. +#include <asm/mach-types.h>
  166. +#include <asm/mach/arch.h>
  167. +#include <asm/mach/flash.h>
  168. +#include <asm/setup.h>
  169. +
  170. +#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
  171. +
  172. +struct cambria_board_info {
  173. + unsigned char *model;
  174. + void (*setup)(void);
  175. +};
  176. +
  177. +static struct cambria_board_info *cambria_info __initdata;
  178. +
  179. +static struct flash_platform_data cambria_flash_data = {
  180. + .map_name = "cfi_probe",
  181. + .width = 2,
  182. +};
  183. +
  184. +static struct resource cambria_flash_resource = {
  185. + .flags = IORESOURCE_MEM,
  186. +};
  187. +
  188. +static struct platform_device cambria_flash = {
  189. + .name = "IXP4XX-Flash",
  190. + .id = 0,
  191. + .dev = {
  192. + .platform_data = &cambria_flash_data,
  193. + },
  194. + .num_resources = 1,
  195. + .resource = &cambria_flash_resource,
  196. +};
  197. +
  198. +static struct i2c_gpio_platform_data cambria_i2c_gpio_data = {
  199. + .sda_pin = 7,
  200. + .scl_pin = 6,
  201. +};
  202. +
  203. +static struct platform_device cambria_i2c_gpio = {
  204. + .name = "i2c-gpio",
  205. + .id = 0,
  206. + .dev = {
  207. + .platform_data = &cambria_i2c_gpio_data,
  208. + },
  209. +};
  210. +
  211. +#ifdef SFP_SERIALID
  212. +static struct i2c_gpio_platform_data cambria_i2c_gpio_sfpa_data = {
  213. + .sda_pin = 113,
  214. + .scl_pin = 112,
  215. + .sda_is_open_drain = 0,
  216. + .scl_is_open_drain = 0,
  217. +};
  218. +
  219. +static struct platform_device cambria_i2c_gpio_sfpa = {
  220. + .name = "i2c-gpio",
  221. + .id = 1,
  222. + .dev = {
  223. + .platform_data = &cambria_i2c_gpio_sfpa_data,
  224. + },
  225. +};
  226. +
  227. +static struct i2c_gpio_platform_data cambria_i2c_gpio_sfpb_data = {
  228. + .sda_pin = 115,
  229. + .scl_pin = 114,
  230. + .sda_is_open_drain = 0,
  231. + .scl_is_open_drain = 0,
  232. +};
  233. +
  234. +static struct platform_device cambria_i2c_gpio_sfpb = {
  235. + .name = "i2c-gpio",
  236. + .id = 2,
  237. + .dev = {
  238. + .platform_data = &cambria_i2c_gpio_sfpb_data,
  239. + },
  240. +};
  241. +#endif // #ifdef SFP_SERIALID
  242. +
  243. +static struct eth_plat_info cambria_npec_data = {
  244. + .phy = 1,
  245. + .rxq = 4,
  246. + .txreadyq = 21,
  247. +};
  248. +
  249. +static struct eth_plat_info cambria_npea_data = {
  250. + .phy = 2,
  251. + .rxq = 2,
  252. + .txreadyq = 19,
  253. +};
  254. +
  255. +static struct platform_device cambria_npec_device = {
  256. + .name = "ixp4xx_eth",
  257. + .id = IXP4XX_ETH_NPEC,
  258. + .dev.platform_data = &cambria_npec_data,
  259. + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
  260. +};
  261. +
  262. +static struct platform_device cambria_npea_device = {
  263. + .name = "ixp4xx_eth",
  264. + .id = IXP4XX_ETH_NPEA,
  265. + .dev.platform_data = &cambria_npea_data,
  266. + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
  267. +};
  268. +
  269. +static struct resource cambria_uart_resource = {
  270. + .start = IXP4XX_UART1_BASE_PHYS,
  271. + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  272. + .flags = IORESOURCE_MEM,
  273. +};
  274. +
  275. +static struct plat_serial8250_port cambria_uart_data[] = {
  276. + {
  277. + .mapbase = IXP4XX_UART1_BASE_PHYS,
  278. + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  279. + .irq = IRQ_IXP4XX_UART1,
  280. + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  281. + .iotype = UPIO_MEM,
  282. + .regshift = 2,
  283. + .uartclk = IXP4XX_UART_XTAL,
  284. + },
  285. + { },
  286. +};
  287. +
  288. +static struct platform_device cambria_uart = {
  289. + .name = "serial8250",
  290. + .id = PLAT8250_DEV_PLATFORM,
  291. + .dev = {
  292. + .platform_data = cambria_uart_data,
  293. + },
  294. + .num_resources = 1,
  295. + .resource = &cambria_uart_resource,
  296. +};
  297. +
  298. +static struct resource cambria_optional_uart_resources[] = {
  299. + {
  300. + .start = 0x52000000,
  301. + .end = 0x52000fff,
  302. + .flags = IORESOURCE_MEM
  303. + },
  304. + {
  305. + .start = 0x53000000,
  306. + .end = 0x53000fff,
  307. + .flags = IORESOURCE_MEM
  308. + },
  309. + {
  310. + .start = 0x52000000,
  311. + .end = 0x52000fff,
  312. + .flags = IORESOURCE_MEM
  313. + },
  314. + {
  315. + .start = 0x52000000,
  316. + .end = 0x52000fff,
  317. + .flags = IORESOURCE_MEM
  318. + },
  319. + {
  320. + .start = 0x52000000,
  321. + .end = 0x52000fff,
  322. + .flags = IORESOURCE_MEM
  323. + },
  324. + {
  325. + .start = 0x52000000,
  326. + .end = 0x52000fff,
  327. + .flags = IORESOURCE_MEM
  328. + },
  329. + {
  330. + .start = 0x52000000,
  331. + .end = 0x52000fff,
  332. + .flags = IORESOURCE_MEM
  333. + },
  334. + {
  335. + .start = 0x53000000,
  336. + .end = 0x53000fff,
  337. + .flags = IORESOURCE_MEM
  338. + }
  339. +};
  340. +
  341. +static struct plat_serial8250_port cambria_optional_uart_data[] = {
  342. + {
  343. + .flags = UPF_BOOT_AUTOCONF,
  344. + .iotype = UPIO_MEM_DELAY,
  345. + .regshift = 0,
  346. + .uartclk = 1843200,
  347. + .rw_delay = 10,
  348. + },
  349. + {
  350. + .flags = UPF_BOOT_AUTOCONF,
  351. + .iotype = UPIO_MEM_DELAY,
  352. + .regshift = 0,
  353. + .uartclk = 1843200,
  354. + .rw_delay = 10,
  355. + },
  356. + {
  357. + .flags = UPF_BOOT_AUTOCONF,
  358. + .iotype = UPIO_MEM,
  359. + .regshift = 0,
  360. + .uartclk = 18432000,
  361. + },
  362. + {
  363. + .flags = UPF_BOOT_AUTOCONF,
  364. + .iotype = UPIO_MEM,
  365. + .regshift = 0,
  366. + .uartclk = 18432000,
  367. + },
  368. + {
  369. + .flags = UPF_BOOT_AUTOCONF,
  370. + .iotype = UPIO_MEM,
  371. + .regshift = 0,
  372. + .uartclk = 18432000,
  373. + },
  374. + {
  375. + .flags = UPF_BOOT_AUTOCONF,
  376. + .iotype = UPIO_MEM,
  377. + .regshift = 0,
  378. + .uartclk = 18432000,
  379. + },
  380. + {
  381. + .flags = UPF_BOOT_AUTOCONF,
  382. + .iotype = UPIO_MEM,
  383. + .regshift = 0,
  384. + .uartclk = 18432000,
  385. + },
  386. + { },
  387. +};
  388. +
  389. +static struct platform_device cambria_optional_uart = {
  390. + .name = "serial8250",
  391. + .id = PLAT8250_DEV_PLATFORM1,
  392. + .dev.platform_data = cambria_optional_uart_data,
  393. + .num_resources = 2,
  394. + .resource = cambria_optional_uart_resources,
  395. +};
  396. +
  397. +static struct resource cambria_pata_resources[] = {
  398. + {
  399. + .flags = IORESOURCE_MEM
  400. + },
  401. + {
  402. + .flags = IORESOURCE_MEM,
  403. + },
  404. + {
  405. + .name = "intrq",
  406. + .start = IRQ_IXP4XX_GPIO12,
  407. + .end = IRQ_IXP4XX_GPIO12,
  408. + .flags = IORESOURCE_IRQ,
  409. + },
  410. +};
  411. +
  412. +static struct ixp4xx_pata_data cambria_pata_data = {
  413. + .cs0_bits = 0xbfff3c03,
  414. + .cs1_bits = 0xbfff3c03,
  415. +};
  416. +
  417. +static struct platform_device cambria_pata = {
  418. + .name = "pata_ixp4xx_cf",
  419. + .id = 0,
  420. + .dev.platform_data = &cambria_pata_data,
  421. + .num_resources = ARRAY_SIZE(cambria_pata_resources),
  422. + .resource = cambria_pata_resources,
  423. +};
  424. +
  425. +static struct gpio_led cambria_gpio_leds[] = {
  426. + {
  427. + .name = "user",
  428. + .gpio = 5,
  429. + .active_low = 1,
  430. + },
  431. + {
  432. + .name = "user2",
  433. + .gpio = 0,
  434. + .active_low = 1,
  435. + },
  436. + {
  437. + .name = "user3",
  438. + .gpio = 0,
  439. + .active_low = 1,
  440. + },
  441. + {
  442. + .name = "user4",
  443. + .gpio = 0,
  444. + .active_low = 1,
  445. + }
  446. +};
  447. +
  448. +static struct gpio_led_platform_data cambria_gpio_leds_data = {
  449. + .num_leds = 1,
  450. + .leds = cambria_gpio_leds,
  451. +};
  452. +
  453. +static struct platform_device cambria_gpio_leds_device = {
  454. + .name = "leds-gpio",
  455. + .id = -1,
  456. + .dev.platform_data = &cambria_gpio_leds_data,
  457. +};
  458. +
  459. +static struct resource cambria_gpio_resources[] = {
  460. + {
  461. + .name = "gpio",
  462. + .flags = 0,
  463. + },
  464. +};
  465. +
  466. +static struct gpio cambria_gpios_gw2350[] = {
  467. + // ARM GPIO
  468. +#if 0 // configured from bootloader
  469. + { 0, GPIOF_IN, "ARM_DIO0" },
  470. + { 1, GPIOF_IN, "ARM_DIO1" },
  471. + { 2, GPIOF_IN, "ARM_DIO2" },
  472. + { 3, GPIOF_IN, "ARM_DIO3" },
  473. + { 4, GPIOF_IN, "ARM_DIO4" },
  474. + { 5, GPIOF_IN, "ARM_DIO5" },
  475. + { 12, GPIOF_OUT_INIT_HIGH, "WDOGEN#" },
  476. +#endif
  477. + { 8, GPIOF_IN, "ARM_DIO8" },
  478. + { 9, GPIOF_IN, "ARM_DIO9" },
  479. +};
  480. +
  481. +static struct gpio cambria_gpios_gw2358[] = {
  482. + // ARM GPIO
  483. +#if 0 // configured from bootloader
  484. + { 0, GPIOF_IN, "*VINLOW#" },
  485. + { 2, GPIOF_IN, "*GPS_PPS" },
  486. + { 3, GPIOF_IN, "*GPS_IRQ#" },
  487. + { 4, GPIOF_IN, "*RS485_IRQ#" },
  488. + { 5, GPIOF_IN, "*SER_EN#" },
  489. + { 14, GPIOF_OUT_INIT_HIGH, "*WDOGEN#" },
  490. +#endif
  491. +};
  492. +
  493. +static struct gpio cambria_gpios_gw2359[] = {
  494. + // ARM GPIO
  495. +#if 0 // configured from bootloader
  496. + { 0, GPIOF_IN, "*PCA_IRQ#" },
  497. + { 1, GPIOF_IN, "ARM_DIO1" },
  498. + { 2, GPIOF_IN, "ARM_DIO2" },
  499. + { 3, GPIOF_IN, "ARM_DIO3" },
  500. + { 4, GPIOF_IN, "ARM_DIO4" },
  501. + { 5, GPIOF_IN, "ARM_DIO5" },
  502. + { 8, GPIOF_OUT_INIT_HIGH, "*WDOGEN#" },
  503. +#endif
  504. + { 11, GPIOF_OUT_INIT_HIGH, "*SER_EN" }, // console serial enable
  505. + { 12, GPIOF_IN, "*GSC_IRQ#" },
  506. + { 13, GPIOF_OUT_INIT_HIGH, "*PCIE_RST#"},
  507. + // GSC GPIO
  508. +#if !(IS_ENABLED(CONFIG_KEYBOARD_GPIO_POLLED))
  509. + {100, GPIOF_IN, "*USER_PB#" },
  510. +#endif
  511. + {103, GPIOF_OUT_INIT_HIGH, "*5V_EN" }, // 5V aux supply enable
  512. + {108, GPIOF_IN, "*SMUXDA0" },
  513. + {109, GPIOF_IN, "*SMUXDA1" },
  514. + {110, GPIOF_IN, "*SMUXDA2" },
  515. + {111, GPIOF_IN, "*SMUXDB0" },
  516. + {112, GPIOF_IN, "*SMUXDB1" },
  517. + {113, GPIOF_IN, "*SMUXDB2" },
  518. + // PCA GPIO
  519. + {118, GPIOF_IN, "*USIM2_DET#"}, // USIM2 Detect
  520. + {120, GPIOF_OUT_INIT_LOW, "*USB1_PCI_SEL"}, // USB1 Select (1=PCI, 0=FP)
  521. + {121, GPIOF_OUT_INIT_LOW, "*USB2_PCI_SEL"}, // USB2 Select (1=PCI, 0=FP)
  522. + {122, GPIOF_IN, "*USIM1_DET#"}, // USIM1 Detect
  523. + {123, GPIOF_OUT_INIT_HIGH, "*COM1_DTR#" }, // J21/J10
  524. + {124, GPIOF_IN, "*COM1_DSR#" }, // J21/J10
  525. + {127, GPIOF_IN, "PCA_DIO0" },
  526. + {128, GPIOF_IN, "PCA_DIO1" },
  527. + {129, GPIOF_IN, "PCA_DIO2" },
  528. + {130, GPIOF_IN, "PCA_DIO3" },
  529. + {131, GPIOF_IN, "PCA_DIO4" },
  530. +};
  531. +
  532. +static struct gpio cambria_gpios_gw2360[] = {
  533. + // ARM GPIO
  534. + { 0, GPIOF_IN, "*PCA_IRQ#" },
  535. + { 11, GPIOF_OUT_INIT_LOW, "*SER0_EN#" },
  536. + { 12, GPIOF_IN, "*GSC_IRQ#" },
  537. + { 13, GPIOF_OUT_INIT_HIGH, "*PCIE_RST#"},
  538. + // GSC GPIO
  539. +#if !(IS_ENABLED(CONFIG_KEYBOARD_GPIO_POLLED))
  540. + {100, GPIOF_IN, "*USER_PB#" },
  541. +#endif
  542. + {108, GPIOF_OUT_INIT_LOW, "*ENET1_EN#" }, // ENET1 TX Enable
  543. + {109, GPIOF_IN, "*ENET1_PRES#" }, // ENET1 Detect (0=SFP present)
  544. + {110, GPIOF_OUT_INIT_LOW, "*ENET2_EN#" }, // ENET2 TX Enable
  545. + {111, GPIOF_IN, "*ENET2_PRES#"}, // ENET2 Detect (0=SFP present)
  546. + // PCA GPIO
  547. + {116, GPIOF_OUT_INIT_HIGH, "*USIM2_LOC"}, // USIM2 Select (1=Loc, 0=Rem)
  548. + {117, GPIOF_IN, "*USIM2_DET_LOC#" },// USIM2 Detect (Local Slot)
  549. + {118, GPIOF_IN, "*USIM2_DET_REM#" },// USIM2 Detect (Remote Slot)
  550. + {120, GPIOF_OUT_INIT_LOW, "*USB1_PCI_SEL"}, // USB1 Select (1=PCIe1, 0=J1)
  551. + {121, GPIOF_OUT_INIT_LOW, "*USB2_PCI_SEL"}, // USB2 Select (1=PCIe2, 0=J1)
  552. + {122, GPIOF_IN, "*USIM1_DET#"}, // USIM1 Detect
  553. + {127, GPIOF_IN, "DIO0" },
  554. + {128, GPIOF_IN, "DIO1" },
  555. + {129, GPIOF_IN, "DIO2" },
  556. + {130, GPIOF_IN, "DIO3" },
  557. + {131, GPIOF_IN, "DIO4" },
  558. +};
  559. +
  560. +static struct latch_led cambria_latch_leds[] = {
  561. + {
  562. + .name = "ledA", /* green led */
  563. + .bit = 0,
  564. + },
  565. + {
  566. + .name = "ledB", /* green led */
  567. + .bit = 1,
  568. + },
  569. + {
  570. + .name = "ledC", /* green led */
  571. + .bit = 2,
  572. + },
  573. + {
  574. + .name = "ledD", /* green led */
  575. + .bit = 3,
  576. + },
  577. + {
  578. + .name = "ledE", /* green led */
  579. + .bit = 4,
  580. + },
  581. + {
  582. + .name = "ledF", /* green led */
  583. + .bit = 5,
  584. + },
  585. + {
  586. + .name = "ledG", /* green led */
  587. + .bit = 6,
  588. + },
  589. + {
  590. + .name = "ledH", /* green led */
  591. + .bit = 7,
  592. + }
  593. +};
  594. +
  595. +static struct latch_led_platform_data cambria_latch_leds_data = {
  596. + .num_leds = 8,
  597. + .leds = cambria_latch_leds,
  598. + .mem = 0x53F40000,
  599. +};
  600. +
  601. +static struct platform_device cambria_latch_leds_device = {
  602. + .name = "leds-latch",
  603. + .id = -1,
  604. + .dev.platform_data = &cambria_latch_leds_data,
  605. +};
  606. +
  607. +static struct resource cambria_usb0_resources[] = {
  608. + {
  609. + .start = 0xCD000000,
  610. + .end = 0xCD000300,
  611. + .flags = IORESOURCE_MEM,
  612. + },
  613. + {
  614. + .start = 32,
  615. + .flags = IORESOURCE_IRQ,
  616. + },
  617. +};
  618. +
  619. +static struct resource cambria_usb1_resources[] = {
  620. + {
  621. + .start = 0xCE000000,
  622. + .end = 0xCE000300,
  623. + .flags = IORESOURCE_MEM,
  624. + },
  625. + {
  626. + .start = 33,
  627. + .flags = IORESOURCE_IRQ,
  628. + },
  629. +};
  630. +
  631. +static u64 ehci_dma_mask = ~(u32)0;
  632. +
  633. +static struct usb_ehci_pdata cambria_usb_pdata = {
  634. + .big_endian_desc = 1,
  635. + .big_endian_mmio = 1,
  636. + .has_tt = 1,
  637. + .caps_offset = 0x100,
  638. +};
  639. +
  640. +static struct platform_device cambria_usb0_device = {
  641. + .name = "ehci-platform",
  642. + .id = 0,
  643. + .resource = cambria_usb0_resources,
  644. + .num_resources = ARRAY_SIZE(cambria_usb0_resources),
  645. + .dev = {
  646. + .dma_mask = &ehci_dma_mask,
  647. + .coherent_dma_mask = 0xffffffff,
  648. + .platform_data = &cambria_usb_pdata,
  649. + },
  650. +};
  651. +
  652. +static struct platform_device cambria_usb1_device = {
  653. + .name = "ehci-platform",
  654. + .id = 1,
  655. + .resource = cambria_usb1_resources,
  656. + .num_resources = ARRAY_SIZE(cambria_usb1_resources),
  657. + .dev = {
  658. + .dma_mask = &ehci_dma_mask,
  659. + .coherent_dma_mask = 0xffffffff,
  660. + .platform_data = &cambria_usb_pdata,
  661. + },
  662. +};
  663. +
  664. +static struct gw_i2c_pld_platform_data gw_i2c_pld_data0 = {
  665. + .gpio_base = 16,
  666. + .nr_gpio = 8,
  667. +};
  668. +
  669. +static struct gw_i2c_pld_platform_data gw_i2c_pld_data1 = {
  670. + .gpio_base = 24,
  671. + .nr_gpio = 2,
  672. +};
  673. +
  674. +
  675. +static struct gpio_keys_button cambria_gpio_buttons[] = {
  676. + {
  677. + .desc = "user",
  678. + .type = EV_KEY,
  679. + .code = BTN_0,
  680. + .debounce_interval = 6,
  681. + .gpio = 25,
  682. + }
  683. +};
  684. +
  685. +static struct gpio_keys_platform_data cambria_gpio_buttons_data = {
  686. + .poll_interval = 500,
  687. + .nbuttons = 1,
  688. + .buttons = cambria_gpio_buttons,
  689. +};
  690. +
  691. +static struct platform_device cambria_gpio_buttons_device = {
  692. + .name = "gpio-keys-polled",
  693. + .id = -1,
  694. + .dev.platform_data = &cambria_gpio_buttons_data,
  695. +};
  696. +
  697. +static struct platform_device *cambria_devices[] __initdata = {
  698. + &cambria_i2c_gpio,
  699. + &cambria_flash,
  700. + &cambria_uart,
  701. +};
  702. +
  703. +static int cambria_register_gpio(struct gpio *array, size_t num)
  704. +{
  705. + int i, err, ret;
  706. +
  707. + ret = 0;
  708. + for (i = 0; i < num; i++, array++) {
  709. + const char *label = array->label;
  710. + if (label[0] == '*')
  711. + label++;
  712. + err = gpio_request_one(array->gpio, array->flags, label);
  713. + if (err)
  714. + ret = err;
  715. + else {
  716. + err = gpio_export(array->gpio, array->label[0] != '*');
  717. + }
  718. + }
  719. + return ret;
  720. +}
  721. +
  722. +static void __init cambria_gw23xx_setup(void)
  723. +{
  724. + cambria_gpio_resources[0].start = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) |\
  725. + (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12);
  726. + cambria_gpio_resources[0].end = cambria_gpio_resources[0].start;
  727. +
  728. + platform_device_register(&cambria_npec_device);
  729. + platform_device_register(&cambria_npea_device);
  730. +}
  731. +
  732. +static void __init cambria_gw2350_setup(void)
  733. +{
  734. + *IXP4XX_EXP_CS2 = 0xBFFF3C43;
  735. + irq_set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING);
  736. + cambria_optional_uart_data[0].mapbase = 0x52FF0000;
  737. + cambria_optional_uart_data[0].membase = (void __iomem *)ioremap(0x52FF0000, 0x0fff);
  738. + cambria_optional_uart_data[0].irq = IRQ_IXP4XX_GPIO3;
  739. +
  740. + *IXP4XX_EXP_CS3 = 0xBFFF3C43;
  741. + irq_set_irq_type(IRQ_IXP4XX_GPIO4, IRQ_TYPE_EDGE_RISING);
  742. + cambria_optional_uart_data[1].mapbase = 0x53FF0000;
  743. + cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53FF0000, 0x0fff);
  744. + cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4;
  745. +
  746. + cambria_gpio_resources[0].start = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) |\
  747. + (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12);
  748. + cambria_gpio_resources[0].end = cambria_gpio_resources[0].start;
  749. +
  750. + platform_device_register(&cambria_optional_uart);
  751. + platform_device_register(&cambria_npec_device);
  752. + platform_device_register(&cambria_npea_device);
  753. +
  754. + platform_device_register(&cambria_usb0_device);
  755. + platform_device_register(&cambria_usb1_device);
  756. +
  757. + platform_device_register(&cambria_gpio_leds_device);
  758. +
  759. + /* gpio config (/sys/class/gpio) */
  760. + cambria_register_gpio(ARRAY_AND_SIZE(cambria_gpios_gw2350));
  761. +}
  762. +
  763. +static void __init cambria_gw2358_setup(void)
  764. +{
  765. + *IXP4XX_EXP_CS3 = 0xBFFF3C43; // bit0 = 16bit vs 8bit bus
  766. + irq_set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING);
  767. + cambria_optional_uart_data[0].mapbase = 0x53FC0000;
  768. + cambria_optional_uart_data[0].membase = (void __iomem *)ioremap(0x53FC0000, 0x0fff);
  769. + cambria_optional_uart_data[0].irq = IRQ_IXP4XX_GPIO3;
  770. +
  771. + irq_set_irq_type(IRQ_IXP4XX_GPIO4, IRQ_TYPE_EDGE_RISING);
  772. + cambria_optional_uart_data[1].mapbase = 0x53F80000;
  773. + cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53F80000, 0x0fff);
  774. + cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4;
  775. +
  776. + cambria_gpio_resources[0].start = (1 << 14) | (1 << 16) | (1 << 17) | (1 << 18) |\
  777. + (1 << 19) | (1 << 20) | (1 << 24) | (1 << 25);
  778. + cambria_gpio_resources[0].end = cambria_gpio_resources[0].start;
  779. +
  780. + platform_device_register(&cambria_optional_uart);
  781. +
  782. + platform_device_register(&cambria_npec_device);
  783. + platform_device_register(&cambria_npea_device);
  784. +
  785. + platform_device_register(&cambria_usb0_device);
  786. + platform_device_register(&cambria_usb1_device);
  787. +
  788. + platform_device_register(&cambria_pata);
  789. +
  790. + cambria_gpio_leds[0].gpio = 24;
  791. + platform_device_register(&cambria_gpio_leds_device);
  792. +
  793. + platform_device_register(&cambria_latch_leds_device);
  794. +
  795. + platform_device_register(&cambria_gpio_buttons_device);
  796. +
  797. + /* gpio config (/sys/class/gpio) */
  798. + cambria_register_gpio(ARRAY_AND_SIZE(cambria_gpios_gw2358));
  799. +}
  800. +
  801. +static void __init cambria_gw2359_setup(void)
  802. +{
  803. +#if defined(CONFIG_MVSWITCH_PHY) || defined(CONFIG_MVSWITCH_PHY_MODULE)
  804. + /* The mvswitch driver has some hard-coded values which could
  805. + * easily be turned into a platform resource if needed. For now they
  806. + * match our hardware configuration:
  807. + * MV_BASE 0x10 - phy base address
  808. + * MV_WANPORT 0 - Port0 (ENET2) is WAN (SFP module)
  809. + * MV_CPUPORT 5 - Port5 is CPU NPEA (eth1)
  810. + *
  811. + * The mvswitch driver registers a fixup which forces a driver match
  812. + * if phy_addr matches MV_BASE
  813. + *
  814. + * Two static defautl VLAN's are created: WAN port in 1, and all other ports
  815. + * in the other.
  816. + */
  817. + cambria_npea_data.phy = 0x10; // mvswitch driver catches this
  818. +#else
  819. + // Switch Port5 to CPU is MII<->MII (no PHY) - this disables the genphy driver
  820. + cambria_npea_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
  821. + // CPU NPE-C is in bridge bypass mode to Port4 PHY@0x14
  822. + cambria_npec_data.phy = 0x14;
  823. +#endif
  824. + platform_device_register(&cambria_npec_device);
  825. + platform_device_register(&cambria_npea_device);
  826. +
  827. + platform_device_register(&cambria_usb0_device);
  828. + platform_device_register(&cambria_usb1_device);
  829. +
  830. + cambria_gpio_leds_data.num_leds = 3;
  831. + cambria_gpio_leds[0].name = "user1";
  832. + cambria_gpio_leds[0].gpio = 125; // PNLLED1#
  833. + cambria_gpio_leds[1].gpio = 126; // PNLLED3#
  834. + cambria_gpio_leds[2].gpio = 119; // PNLLED4#
  835. + platform_device_register(&cambria_gpio_leds_device);
  836. +
  837. +#if (IS_ENABLED(CONFIG_KEYBOARD_GPIO_POLLED))
  838. + cambria_gpio_buttons[0].gpio = 100;
  839. + platform_device_register(&cambria_gpio_buttons_device);
  840. +#endif
  841. +
  842. + /* gpio config (/sys/class/gpio) */
  843. + cambria_register_gpio(ARRAY_AND_SIZE(cambria_gpios_gw2359));
  844. +}
  845. +
  846. +static void __init cambria_gw2360_setup(void)
  847. +{
  848. + /* The GW2360 has 8 UARTs in addition to the 1 IXP4xxx UART.
  849. + * The chip-selects are expanded via a 3-to-8 decoder and CS2
  850. + * and they are 8bit devices
  851. + */
  852. + *IXP4XX_EXP_CS2 = 0xBFFF3C43;
  853. + cambria_optional_uart_data[0].mapbase = 0x52000000;
  854. + cambria_optional_uart_data[0].membase = (void __iomem *)ioremap(0x52000000, 0x0fff);
  855. + cambria_optional_uart_data[0].uartclk = 18432000;
  856. + cambria_optional_uart_data[0].iotype = UPIO_MEM;
  857. + cambria_optional_uart_data[0].irq = IRQ_IXP4XX_GPIO2;
  858. + irq_set_irq_type(IRQ_IXP4XX_GPIO2, IRQ_TYPE_EDGE_RISING);
  859. +
  860. + cambria_optional_uart_data[1].mapbase = 0x52000008;
  861. + cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x52000008, 0x0fff);
  862. + cambria_optional_uart_data[1].uartclk = 18432000;
  863. + cambria_optional_uart_data[1].iotype = UPIO_MEM;
  864. + cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO3;
  865. + irq_set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING);
  866. +
  867. + cambria_optional_uart_data[2].mapbase = 0x52000010;
  868. + cambria_optional_uart_data[2].membase = (void __iomem *)ioremap(0x52000010, 0x0fff);
  869. + cambria_optional_uart_data[2].uartclk = 18432000;
  870. + cambria_optional_uart_data[2].iotype = UPIO_MEM;
  871. + cambria_optional_uart_data[2].irq = IRQ_IXP4XX_GPIO4;
  872. + irq_set_irq_type(IRQ_IXP4XX_GPIO4, IRQ_TYPE_EDGE_RISING);
  873. +
  874. + cambria_optional_uart_data[3].mapbase = 0x52000018;
  875. + cambria_optional_uart_data[3].membase = (void __iomem *)ioremap(0x52000018, 0x0fff);
  876. + cambria_optional_uart_data[3].uartclk = 18432000;
  877. + cambria_optional_uart_data[3].iotype = UPIO_MEM;
  878. + cambria_optional_uart_data[3].irq = IRQ_IXP4XX_GPIO5;
  879. + irq_set_irq_type(IRQ_IXP4XX_GPIO5, IRQ_TYPE_EDGE_RISING);
  880. +
  881. + cambria_optional_uart_data[4].mapbase = 0x52000020;
  882. + cambria_optional_uart_data[4].membase = (void __iomem *)ioremap(0x52000020, 0x0fff);
  883. + cambria_optional_uart_data[4].uartclk = 18432000;
  884. + cambria_optional_uart_data[4].iotype = UPIO_MEM;
  885. + cambria_optional_uart_data[4].irq = IRQ_IXP4XX_GPIO8;
  886. + irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_EDGE_RISING);
  887. +
  888. + cambria_optional_uart_data[5].mapbase = 0x52000028;
  889. + cambria_optional_uart_data[5].membase = (void __iomem *)ioremap(0x52000028, 0x0fff);
  890. + cambria_optional_uart_data[5].uartclk = 18432000;
  891. + cambria_optional_uart_data[5].iotype = UPIO_MEM;
  892. + cambria_optional_uart_data[5].irq = IRQ_IXP4XX_GPIO9;
  893. + irq_set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_EDGE_RISING);
  894. +
  895. + cambria_optional_uart_data[6].mapbase = 0x52000030;
  896. + cambria_optional_uart_data[6].membase = (void __iomem *)ioremap(0x52000030, 0x0fff);
  897. + cambria_optional_uart_data[6].uartclk = 18432000;
  898. + cambria_optional_uart_data[6].iotype = UPIO_MEM;
  899. + cambria_optional_uart_data[6].irq = IRQ_IXP4XX_GPIO10;
  900. + irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_EDGE_RISING);
  901. +
  902. + cambria_optional_uart.num_resources = 7,
  903. + platform_device_register(&cambria_optional_uart);
  904. +
  905. +#if defined(CONFIG_MVSWITCH_PHY) || defined(CONFIG_MVSWITCH_PHY_MODULE)
  906. + /* The mvswitch driver has some hard-coded values which could
  907. + * easily be turned into a platform resource if needed. For now they
  908. + * match our hardware configuration:
  909. + * MV_BASE 0x10 - phy base address
  910. + * MV_WANPORT 0 - Port0 (ENET2) is WAN (SFP module)
  911. + * MV_CPUPORT 5 - Port5 is CPU NPEA (eth1)
  912. + *
  913. + * The mvswitch driver registers a fixup which forces a driver match
  914. + * if phy_addr matches MV_BASE
  915. + *
  916. + * Two static defautl VLAN's are created: WAN port in 1, and all other ports
  917. + * in the other.
  918. + */
  919. + cambria_npea_data.phy = 0x10; // mvswitch driver catches this
  920. +#else
  921. + // Switch Port5 to CPU is MII<->MII (no PHY) - this disables the generic PHY driver
  922. + cambria_npea_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
  923. +#endif
  924. +
  925. + // disable genphy autonegotiation on NPE-C PHY (eth1) as its 100BaseFX
  926. + //cambria_npec_data.noautoneg = 1; // disable autoneg
  927. + cambria_npec_data.speed_10 = 0; // 100mbps
  928. + cambria_npec_data.half_duplex = 0; // full-duplex
  929. + platform_device_register(&cambria_npec_device);
  930. + platform_device_register(&cambria_npea_device);
  931. +
  932. + platform_device_register(&cambria_usb0_device);
  933. + platform_device_register(&cambria_usb1_device);
  934. +
  935. + cambria_gpio_leds_data.num_leds = 3;
  936. + cambria_gpio_leds[0].name = "user1";
  937. + cambria_gpio_leds[0].gpio = 125;
  938. + cambria_gpio_leds[1].gpio = 126;
  939. + cambria_gpio_leds[2].gpio = 119;
  940. + platform_device_register(&cambria_gpio_leds_device);
  941. +
  942. +#if (IS_ENABLED(CONFIG_KEYBOARD_GPIO_POLLED))
  943. + cambria_gpio_buttons[0].gpio = 100;
  944. + platform_device_register(&cambria_gpio_buttons_device);
  945. +#endif
  946. +
  947. +#ifdef SFP_SERIALID
  948. + /* the SFP modules each have an i2c bus for serial ident via GSC GPIO
  949. + * To use these the i2c-gpio driver must be changed to use the _cansleep
  950. + * varients of gpio_get_value/gpio_set_value (I don't know why it doesn't
  951. + * use that anyway as it doesn't operate in an IRQ context).
  952. + * Additionally the i2c-gpio module must set the gpio to output-high prior
  953. + * to changing direction to an input to enable internal Pullups
  954. + */
  955. + platform_device_register(&cambria_i2c_gpio_sfpa);
  956. + platform_device_register(&cambria_i2c_gpio_sfpb);
  957. +#endif
  958. +
  959. + /* gpio config (/sys/class/gpio) */
  960. + cambria_register_gpio(ARRAY_AND_SIZE(cambria_gpios_gw2360));
  961. +}
  962. +
  963. +static struct cambria_board_info cambria_boards[] __initdata = {
  964. + {
  965. + .model = "GW2350",
  966. + .setup = cambria_gw2350_setup,
  967. + }, {
  968. + .model = "GW2351",
  969. + .setup = cambria_gw2350_setup,
  970. + }, {
  971. + .model = "GW2358",
  972. + .setup = cambria_gw2358_setup,
  973. + }, {
  974. + .model = "GW2359",
  975. + .setup = cambria_gw2359_setup,
  976. + }, {
  977. + .model = "GW2360",
  978. + .setup = cambria_gw2360_setup,
  979. + }, {
  980. + .model = "GW2371",
  981. + .setup = cambria_gw2358_setup,
  982. + }
  983. +};
  984. +
  985. +static struct cambria_board_info * __init cambria_find_board_info(char *model)
  986. +{
  987. + int i;
  988. + model[6] = '\0';
  989. +
  990. + for (i = 0; i < ARRAY_SIZE(cambria_boards); i++) {
  991. + struct cambria_board_info *info = &cambria_boards[i];
  992. + if (strcmp(info->model, model) == 0)
  993. + return info;
  994. + }
  995. +
  996. + return NULL;
  997. +}
  998. +
  999. +static struct memory_accessor *at24_mem_acc;
  1000. +
  1001. +static void at24_setup(struct memory_accessor *mem_acc, void *context)
  1002. +{
  1003. + char mac_addr[ETH_ALEN];
  1004. + char model[7];
  1005. +
  1006. + at24_mem_acc = mem_acc;
  1007. +
  1008. + /* Read MAC addresses */
  1009. + if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x0, 6) == 6) {
  1010. + memcpy(&cambria_npec_data.hwaddr, mac_addr, ETH_ALEN);
  1011. + }
  1012. + if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x6, 6) == 6) {
  1013. + memcpy(&cambria_npea_data.hwaddr, mac_addr, ETH_ALEN);
  1014. + }
  1015. +
  1016. + /* Read the first 6 bytes of the model number */
  1017. + if (at24_mem_acc->read(at24_mem_acc, model, 0x20, 6) == 6) {
  1018. + cambria_info = cambria_find_board_info(model);
  1019. + }
  1020. +
  1021. +}
  1022. +
  1023. +static struct at24_platform_data cambria_eeprom_info = {
  1024. + .byte_len = 1024,
  1025. + .page_size = 16,
  1026. + .flags = AT24_FLAG_READONLY,
  1027. + .setup = at24_setup,
  1028. +};
  1029. +
  1030. +static struct pca953x_platform_data cambria_pca_data = {
  1031. + .gpio_base = 100,
  1032. + .irq_base = -1,
  1033. +};
  1034. +
  1035. +static struct pca953x_platform_data cambria_pca2_data = {
  1036. + .gpio_base = 116,
  1037. + .irq_base = -1,
  1038. +};
  1039. +
  1040. +static struct i2c_board_info __initdata cambria_i2c_board_info[] = {
  1041. + {
  1042. + I2C_BOARD_INFO("pca9555", 0x23),
  1043. + .platform_data = &cambria_pca_data,
  1044. + },
  1045. + {
  1046. + I2C_BOARD_INFO("pca9555", 0x27),
  1047. + .platform_data = &cambria_pca2_data,
  1048. + },
  1049. + {
  1050. + I2C_BOARD_INFO("ds1672", 0x68),
  1051. + },
  1052. + {
  1053. + I2C_BOARD_INFO("gsp", 0x29),
  1054. + },
  1055. + {
  1056. + I2C_BOARD_INFO("ad7418", 0x28),
  1057. + },
  1058. + {
  1059. + I2C_BOARD_INFO("24c08", 0x51),
  1060. + .platform_data = &cambria_eeprom_info
  1061. + },
  1062. + {
  1063. + I2C_BOARD_INFO("gw_i2c_pld", 0x56),
  1064. + .platform_data = &gw_i2c_pld_data0,
  1065. + },
  1066. + {
  1067. + I2C_BOARD_INFO("gw_i2c_pld", 0x57),
  1068. + .platform_data = &gw_i2c_pld_data1,
  1069. + },
  1070. +};
  1071. +
  1072. +static void __init cambria_init(void)
  1073. +{
  1074. + ixp4xx_sys_init();
  1075. +
  1076. + cambria_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  1077. + cambria_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
  1078. +
  1079. + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; // make sure window is writable
  1080. + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
  1081. +
  1082. + platform_add_devices(ARRAY_AND_SIZE(cambria_devices));
  1083. +
  1084. + cambria_pata_resources[0].start = 0x53e00000;
  1085. + cambria_pata_resources[0].end = 0x53e3ffff;
  1086. +
  1087. + cambria_pata_resources[1].start = 0x53e40000;
  1088. + cambria_pata_resources[1].end = 0x53e7ffff;
  1089. +
  1090. + cambria_pata_data.cs0_cfg = IXP4XX_EXP_CS3;
  1091. + cambria_pata_data.cs1_cfg = IXP4XX_EXP_CS3;
  1092. +
  1093. + i2c_register_board_info(0, ARRAY_AND_SIZE(cambria_i2c_board_info));
  1094. +}
  1095. +
  1096. +static int __init cambria_model_setup(void)
  1097. +{
  1098. + if (!machine_is_cambria())
  1099. + return 0;
  1100. +
  1101. + if (cambria_info) {
  1102. + printk(KERN_DEBUG "Running on Gateworks Cambria %s\n",
  1103. + cambria_info->model);
  1104. + cambria_info->setup();
  1105. + } else {
  1106. + printk(KERN_INFO "Unknown/missing Cambria model number"
  1107. + " -- defaults will be used\n");
  1108. + cambria_gw23xx_setup();
  1109. + }
  1110. +
  1111. + return 0;
  1112. +}
  1113. +late_initcall(cambria_model_setup);
  1114. +
  1115. +MACHINE_START(CAMBRIA, "Gateworks Cambria series")
  1116. + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
  1117. + .map_io = ixp4xx_map_io,
  1118. + .init_irq = ixp4xx_init_irq,
  1119. + .init_time = ixp4xx_timer_init,
  1120. + .atag_offset = 0x0100,
  1121. + .init_machine = cambria_init,
  1122. +#if defined(CONFIG_PCI)
  1123. + .dma_zone_size = SZ_64M,
  1124. +#endif
  1125. + .restart = ixp4xx_restart,
  1126. +MACHINE_END