foxg20.patch 14 KB

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