foxg20.patch 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. diff -Nur linux-2.6.32.2.orig/arch/arm/Kconfig linux-2.6.32.2/arch/arm/Kconfig
  2. --- linux-2.6.32.2.orig/arch/arm/Kconfig 2009-12-18 23:27:07.000000000 +0100
  3. +++ linux-2.6.32.2/arch/arm/Kconfig 2010-02-17 19:41:01.000000000 +0100
  4. @@ -18,6 +18,9 @@
  5. select HAVE_KRETPROBES if (HAVE_KPROBES)
  6. select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
  7. select HAVE_GENERIC_DMA_COHERENT
  8. + select HAVE_KERNEL_GZIP
  9. + select HAVE_KERNEL_BZIP2
  10. + select HAVE_KERNEL_LZMA
  11. help
  12. The ARM series is a line of low-power-consumption RISC chip designs
  13. licensed by ARM Ltd and targeted at embedded applications and
  14. diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/at91sam9260_devices.c linux-2.6.32.2/arch/arm/mach-at91/at91sam9260_devices.c
  15. --- linux-2.6.32.2.orig/arch/arm/mach-at91/at91sam9260_devices.c 2009-12-18 23:27:07.000000000 +0100
  16. +++ linux-2.6.32.2/arch/arm/mach-at91/at91sam9260_devices.c 2010-02-17 19:41:01.000000000 +0100
  17. @@ -454,7 +454,15 @@
  18. .sda_is_open_drain = 1,
  19. .scl_pin = AT91_PIN_PA24,
  20. .scl_is_open_drain = 1,
  21. +#if defined(CONFIG_MACH_FOXG20)
  22. + /* Some I2C devices are limited to 100 kHz and i2c-gpio.h
  23. + * says "frequency is (500 / udelay) kHz" so 5 is best (and is
  24. + * used in i2c-gpio.c)
  25. + */
  26. + .udelay = 5, /* ~100 kHz */
  27. +#else
  28. .udelay = 2, /* ~100 kHz */
  29. +#endif
  30. };
  31. static struct platform_device at91sam9260_twi_device = {
  32. diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/board-foxg20.c linux-2.6.32.2/arch/arm/mach-at91/board-foxg20.c
  33. --- linux-2.6.32.2.orig/arch/arm/mach-at91/board-foxg20.c 1970-01-01 01:00:00.000000000 +0100
  34. +++ linux-2.6.32.2/arch/arm/mach-at91/board-foxg20.c 2010-02-17 19:41:01.000000000 +0100
  35. @@ -0,0 +1,371 @@
  36. +/*
  37. + * Copyright (C) 2005 SAN People
  38. + * Copyright (C) 2008 Atmel
  39. + * Copyright (C) 2010 Lee McLoughlin - lee@lmmrtech.com
  40. + *
  41. + * This program is free software; you can redistribute it and/or modify
  42. + * it under the terms of the GNU General Public License as published by
  43. + * the Free Software Foundation; either version 2 of the License, or
  44. + * (at your option) any later version.
  45. + *
  46. + * This program is distributed in the hope that it will be useful,
  47. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  48. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  49. + * GNU General Public License for more details.
  50. + *
  51. + * You should have received a copy of the GNU General Public License
  52. + * along with this program; if not, write to the Free Software
  53. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  54. + */
  55. +
  56. +#include <linux/types.h>
  57. +#include <linux/init.h>
  58. +#include <linux/mm.h>
  59. +#include <linux/module.h>
  60. +#include <linux/platform_device.h>
  61. +#include <linux/spi/spi.h>
  62. +#include <linux/spi/at73c213.h>
  63. +#include <linux/gpio_keys.h>
  64. +#include <linux/input.h>
  65. +#include <linux/clk.h>
  66. +#include <linux/w1-gpio.h>
  67. +
  68. +#include <mach/hardware.h>
  69. +#include <asm/setup.h>
  70. +#include <asm/mach-types.h>
  71. +#include <asm/irq.h>
  72. +
  73. +#include <asm/mach/arch.h>
  74. +#include <asm/mach/map.h>
  75. +#include <asm/mach/irq.h>
  76. +
  77. +#include <mach/board.h>
  78. +#include <mach/gpio.h>
  79. +#include <mach/at91sam9_smc.h>
  80. +
  81. +#include "sam9_smc.h"
  82. +#include "generic.h"
  83. +
  84. +/*
  85. + * The FOX hardware comes as the "Netus" board with just the cpu, ram,
  86. + * dataflash and two header connectors. This is plugged into the Fox board
  87. + * which provides the ethernet, usb, rtc, leds, switch, ...
  88. + * Other version of the Fox board are planned which could contain
  89. + * both NAND and sound (WM8731).
  90. + *
  91. + * By default USART4 and USART5 are not enabled (freeing up those pins
  92. + * for general use)
  93. + *
  94. + * Note: Enabling the NAND without a NAND device present doesn't cause
  95. + * any issues as on boot the probe will fail.
  96. + */
  97. +/* #define FOXG20_NAND */
  98. +/* #define FOXG20_WM8731 */
  99. +/* #define FOX_USART4 */
  100. +/* #define FOX_USART5 */
  101. +
  102. +static void __init foxg20_map_io(void)
  103. +{
  104. + /* Initialize processor: 18.432 MHz crystal */
  105. + at91sam9260_initialize(18432000);
  106. +
  107. + /* DBGU on ttyS0. (Rx & Tx only) */
  108. + at91_register_uart(0, 0, 0);
  109. +
  110. + /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
  111. + at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
  112. + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
  113. + | ATMEL_UART_RI);
  114. +
  115. + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
  116. + at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
  117. +
  118. + /* USART2 on ttyS3. (Rx & Tx only) */
  119. + at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
  120. +
  121. + /* USART3 on ttyS4. (Rx, Tx, RTS, CTS) */
  122. + at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_CTS | ATMEL_UART_RTS);
  123. +
  124. +#if defined(FOX_USART4)
  125. + /* USART4 on ttyS5. (Rx & Tx only) */
  126. + at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
  127. +#endif
  128. +
  129. +#if defined(FOX_USART5)
  130. + /* USART5 on ttyS6. (Rx & Tx only) */
  131. + at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
  132. +#endif
  133. +
  134. + /* set serial console to ttyS0 (ie, DBGU) */
  135. + at91_set_serial_console(0);
  136. +}
  137. +
  138. +static void __init foxg20_init_irq(void)
  139. +{
  140. + at91sam9260_init_interrupts(NULL);
  141. +}
  142. +
  143. +
  144. +/*
  145. + * USB Host port
  146. + */
  147. +static struct at91_usbh_data __initdata foxg20_usbh_data = {
  148. + .ports = 2,
  149. +};
  150. +
  151. +/*
  152. + * USB Device port
  153. + */
  154. +static struct at91_udc_data __initdata foxg20_udc_data = {
  155. + .vbus_pin = AT91_PIN_PC6,
  156. + .pullup_pin = 0, /* pull-up driven by UDC */
  157. +};
  158. +
  159. +
  160. +/*
  161. + * SPI devices.
  162. + */
  163. +static struct spi_board_info foxg20_spi_devices[] = {
  164. +#if !defined(CONFIG_MMC_AT91)
  165. + {
  166. + .modalias = "mtd_dataflash",
  167. + .chip_select = 1,
  168. + .max_speed_hz = 15 * 1000 * 1000,
  169. + .bus_num = 0,
  170. + },
  171. +#endif
  172. +};
  173. +
  174. +
  175. +/*
  176. + * MACB Ethernet device
  177. + */
  178. +static struct at91_eth_data __initdata foxg20_macb_data = {
  179. + .phy_irq_pin = AT91_PIN_PA7,
  180. + .is_rmii = 1,
  181. +};
  182. +
  183. +
  184. +#ifdef FOXG20_NAND
  185. +/* The Fox doesn't have NAND memory */
  186. +/*
  187. + * NAND flash
  188. + */
  189. +static struct mtd_partition __initdata foxg20_nand_partition[] = {
  190. + {
  191. + .name = "Bootstrap",
  192. + .offset = 0,
  193. + .size = 4 * SZ_1M,
  194. + },
  195. + {
  196. + .name = "Partition 1",
  197. + .offset = MTDPART_OFS_NXTBLK,
  198. + .size = 60 * SZ_1M,
  199. + },
  200. + {
  201. + .name = "Partition 2",
  202. + .offset = MTDPART_OFS_NXTBLK,
  203. + .size = MTDPART_SIZ_FULL,
  204. + },
  205. +};
  206. +
  207. +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
  208. +{
  209. + *num_partitions = ARRAY_SIZE(foxg20_nand_partition);
  210. + return foxg20_nand_partition;
  211. +}
  212. +
  213. +/* det_pin is not connected */
  214. +static struct atmel_nand_data __initdata foxg20_nand_data = {
  215. + .ale = 21,
  216. + .cle = 22,
  217. + .rdy_pin = AT91_PIN_PC13,
  218. + .enable_pin = AT91_PIN_PC14,
  219. + .partition_info = nand_partitions,
  220. +#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
  221. + .bus_width_16 = 1,
  222. +#else
  223. + .bus_width_16 = 0,
  224. +#endif
  225. +};
  226. +
  227. +static struct sam9_smc_config __initdata foxg20_nand_smc_config = {
  228. + .ncs_read_setup = 0,
  229. + .nrd_setup = 2,
  230. + .ncs_write_setup = 0,
  231. + .nwe_setup = 2,
  232. +
  233. + .ncs_read_pulse = 4,
  234. + .nrd_pulse = 4,
  235. + .ncs_write_pulse = 4,
  236. + .nwe_pulse = 4,
  237. +
  238. + .read_cycle = 7,
  239. + .write_cycle = 7,
  240. +
  241. + .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
  242. + .tdf_cycles = 3,
  243. +};
  244. +
  245. +static void __init foxg20_add_device_nand(void)
  246. +{
  247. + /* setup bus-width (8 or 16) */
  248. + if (foxg20_nand_data.bus_width_16)
  249. + foxg20_nand_smc_config.mode |= AT91_SMC_DBW_16;
  250. + else
  251. + foxg20_nand_smc_config.mode |= AT91_SMC_DBW_8;
  252. +
  253. + /* configure chip-select 3 (NAND) */
  254. + sam9_smc_configure(3, &foxg20_nand_smc_config);
  255. +
  256. + at91_add_device_nand(&foxg20_nand_data);
  257. +}
  258. +#endif
  259. +
  260. +
  261. +/*
  262. + * MCI (SD/MMC)
  263. + * det_pin, wp_pin and vcc_pin are not connected
  264. + */
  265. +static struct at91_mmc_data __initdata foxg20_mmc_data = {
  266. + .slot_b = 1,
  267. + .wire4 = 1,
  268. +};
  269. +
  270. +
  271. +/*
  272. + * LEDs
  273. + */
  274. +static struct gpio_led foxg20_leds[] = {
  275. + { /* user led, red */
  276. + .name = "user_led",
  277. + .gpio = AT91_PIN_PC7,
  278. + .active_low = 0,
  279. + .default_trigger = "heartbeat",
  280. + },
  281. +};
  282. +
  283. +
  284. +/*
  285. + * GPIO Buttons
  286. + */
  287. +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  288. +static struct gpio_keys_button foxg20_buttons[] = {
  289. + {
  290. + .gpio = AT91_PIN_PC4,
  291. + .code = BTN_1,
  292. + .desc = "Button 1",
  293. + .active_low = 1,
  294. + .wakeup = 1,
  295. + },
  296. +};
  297. +
  298. +static struct gpio_keys_platform_data foxg20_button_data = {
  299. + .buttons = foxg20_buttons,
  300. + .nbuttons = ARRAY_SIZE(foxg20_buttons),
  301. +};
  302. +
  303. +static struct platform_device foxg20_button_device = {
  304. + .name = "gpio-keys",
  305. + .id = -1,
  306. + .num_resources = 0,
  307. + .dev = {
  308. + .platform_data = &foxg20_button_data,
  309. + }
  310. +};
  311. +
  312. +static void __init foxg20_add_device_buttons(void)
  313. +{
  314. + at91_set_gpio_input(AT91_PIN_PC4, 1); /* btn1 */
  315. + at91_set_deglitch(AT91_PIN_PC4, 1);
  316. +
  317. + platform_device_register(&foxg20_button_device);
  318. +}
  319. +#else
  320. +static void __init foxg20_add_device_buttons(void) {}
  321. +#endif
  322. +
  323. +
  324. +#if !defined(FOXG20_WM8731)
  325. +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
  326. +static struct w1_gpio_platform_data w1_gpio_pdata = {
  327. + /* If you choose to use a pin other than PB16 it needs to be 3.3V */
  328. + .pin = AT91_PIN_PB16,
  329. + .is_open_drain = 1,
  330. +};
  331. +
  332. +static struct platform_device w1_device = {
  333. + .name = "w1-gpio",
  334. + .id = -1,
  335. + .dev.platform_data = &w1_gpio_pdata,
  336. +};
  337. +
  338. +static void __init at91_add_device_w1(void)
  339. +{
  340. + at91_set_GPIO_periph(w1_gpio_pdata.pin, 1);
  341. + at91_set_multi_drive(w1_gpio_pdata.pin, 1);
  342. + platform_device_register(&w1_device);
  343. +}
  344. +
  345. +#endif
  346. +#endif
  347. +
  348. +
  349. +static struct i2c_board_info __initdata foxg20_i2c_devices[] = {
  350. + {
  351. + I2C_BOARD_INFO("24c512", 0x50),
  352. +#ifdef FOXG20_WM8731
  353. + I2C_BOARD_INFO("wm8731", 0x1b),
  354. +#endif
  355. + },
  356. +};
  357. +
  358. +
  359. +static void __init foxg20_board_init(void)
  360. +{
  361. + /* Serial */
  362. + at91_add_device_serial();
  363. + /* USB Host */
  364. + at91_add_device_usbh(&foxg20_usbh_data);
  365. + /* USB Device */
  366. + at91_add_device_udc(&foxg20_udc_data);
  367. + /* SPI */
  368. + at91_add_device_spi(foxg20_spi_devices, ARRAY_SIZE(foxg20_spi_devices));
  369. +#ifdef FOXG20_NAND
  370. + /* The Fox doesn't have NAND memory */
  371. + /* NAND */
  372. + foxg20_add_device_nand();
  373. +#endif
  374. + /* Ethernet */
  375. + at91_add_device_eth(&foxg20_macb_data);
  376. + /* MMC */
  377. + at91_add_device_mmc(0, &foxg20_mmc_data);
  378. + /* I2C */
  379. + at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices));
  380. + /* LEDs */
  381. + at91_gpio_leds(foxg20_leds, ARRAY_SIZE(foxg20_leds));
  382. + /* Push Buttons */
  383. + foxg20_add_device_buttons();
  384. +#ifdef FOXG20_WM8731
  385. + /* The Fox doesn't have this sound chip */
  386. + /* PCK0 provides MCLK to the WM8731 */
  387. + at91_set_B_periph(AT91_PIN_PC1, 0);
  388. + /* SSC (for WM8731) */
  389. + at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
  390. +#else
  391. +#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
  392. + at91_add_device_w1();
  393. +#endif
  394. +#endif
  395. +}
  396. +
  397. +MACHINE_START(AT91SAM9G20EK, "Acme Systems FOXG20")
  398. + /* Maintainer: Lee McLoughlin */
  399. + .phys_io = AT91_BASE_SYS,
  400. + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
  401. + .boot_params = AT91_SDRAM_BASE + 0x100,
  402. + .timer = &at91sam926x_timer,
  403. + .map_io = foxg20_map_io,
  404. + .init_irq = foxg20_init_irq,
  405. + .init_machine = foxg20_board_init,
  406. +MACHINE_END
  407. diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/Kconfig linux-2.6.32.2/arch/arm/mach-at91/Kconfig
  408. --- linux-2.6.32.2.orig/arch/arm/mach-at91/Kconfig 2009-12-18 23:27:07.000000000 +0100
  409. +++ linux-2.6.32.2/arch/arm/mach-at91/Kconfig 2010-02-17 19:41:01.000000000 +0100
  410. @@ -333,6 +333,13 @@
  411. Select this if you are using a Eukrea Electromatique's
  412. CPU9G20 Board <http://www.eukrea.com/>
  413. +config MACH_FOXG20
  414. + bool "Acme Systems FOX G20"
  415. + depends on ARCH_AT91SAM9G20
  416. + help
  417. + Select this if you are using Acme Systems
  418. + FOX Board G20 <http://netus.acmesystems.it>
  419. +
  420. endif
  421. # ----------------------------------------------------------
  422. @@ -388,13 +395,13 @@
  423. config MTD_AT91_DATAFLASH_CARD
  424. bool "Enable DataFlash Card support"
  425. - depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9G10EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_ECBAT91 || MACH_SAM9_L9260 || MACH_AT91CAP9ADK || MACH_NEOCORE926)
  426. + depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9G10EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_ECBAT91 || MACH_SAM9_L9260 || MACH_AT91CAP9ADK || MACH_NEOCORE926 || MACH_FOXG20)
  427. help
  428. Enable support for the DataFlash card.
  429. config MTD_NAND_ATMEL_BUSWIDTH_16
  430. bool "Enable 16-bit data bus interface to NAND flash"
  431. - depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9G10EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_AT91SAM9G20EK_2MMC || MACH_AT91SAM9G45EKES || MACH_AT91CAP9ADK)
  432. + depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9G10EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_AT91SAM9G20EK_2MMC || MACH_AT91SAM9G45EKES || MACH_AT91CAP9ADK || MACH_FOXG20)
  433. help
  434. On AT91SAM926x boards both types of NAND flash can be present
  435. (8 and 16 bit data bus width).
  436. diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/Makefile linux-2.6.32.2/arch/arm/mach-at91/Makefile
  437. --- linux-2.6.32.2.orig/arch/arm/mach-at91/Makefile 2009-12-18 23:27:07.000000000 +0100
  438. +++ linux-2.6.32.2/arch/arm/mach-at91/Makefile 2010-02-17 19:41:01.000000000 +0100
  439. @@ -65,6 +65,9 @@
  440. # AT91SAM9G45 board-specific support
  441. obj-$(CONFIG_MACH_AT91SAM9G45EKES) += board-sam9m10g45ek.o
  442. +# FOXG20 board-specific support
  443. +obj-$(CONFIG_MACH_FOXG20) += board-foxg20.o
  444. +
  445. # AT91CAP9 board-specific support
  446. obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
  447. diff -Nur linux-2.6.32.2.orig/drivers/mmc/host/at91_mci.c linux-2.6.32.2/drivers/mmc/host/at91_mci.c
  448. --- linux-2.6.32.2.orig/drivers/mmc/host/at91_mci.c 2009-12-18 23:27:07.000000000 +0100
  449. +++ linux-2.6.32.2/drivers/mmc/host/at91_mci.c 2010-02-17 19:41:01.000000000 +0100
  450. @@ -461,7 +461,7 @@
  451. at91_mci_write(host, AT91_MCI_DTOR, AT91_MCI_DTOMUL_1M | AT91_MCI_DTOCYC);
  452. mr = AT91_MCI_PDCMODE | 0x34a;
  453. - if (cpu_is_at91sam9260() || cpu_is_at91sam9263())
  454. + if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20())
  455. mr |= AT91_MCI_RDPROOF | AT91_MCI_WRPROOF;
  456. at91_mci_write(host, AT91_MCI_MR, mr);
  457. @@ -1017,7 +1017,7 @@
  458. host->bus_mode = 0;
  459. host->board = pdev->dev.platform_data;
  460. if (host->board->wire4) {
  461. - if (cpu_is_at91sam9260() || cpu_is_at91sam9263())
  462. + if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20())
  463. mmc->caps |= MMC_CAP_4_BIT_DATA;
  464. else
  465. dev_warn(&pdev->dev, "4 wire bus mode not supported"