0001-grasshopper.patch 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900
  1. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/button.c linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/button.c
  2. --- linux-4.7.3/arch/avr32/boards/grasshopper/button.c 1970-01-01 01:00:00.000000000 +0100
  3. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/button.c 2016-09-13 11:23:21.454833158 +0200
  4. @@ -0,0 +1,55 @@
  5. +/*
  6. + * init code specific for grasshoppers Buttons
  7. + *
  8. + * This program is free software; you can redistribute it and/or modify
  9. + * it under the terms of the GNU General Public License version 2 as
  10. + * published by the Free Software Foundation.
  11. + */
  12. +
  13. +#include <linux/gpio.h>
  14. +#include <linux/gpio_keys.h>
  15. +#include <linux/init.h>
  16. +#include <linux/input.h>
  17. +#include <linux/platform_device.h>
  18. +
  19. +#include <mach/at32ap700x.h>
  20. +#include <mach/board.h>
  21. +#include <mach/init.h>
  22. +#include <mach/portmux.h>
  23. +
  24. +static struct gpio_keys_button grasshopper_buttons_btn[] = {
  25. + {
  26. + .gpio = GPIO_PIN_PA(31),
  27. + .code = BTN_0,
  28. + .desc = "Button 0",
  29. + .active_low = 1,
  30. + .type = EV_KEY,
  31. + },
  32. +};
  33. +
  34. +static struct gpio_keys_platform_data grasshopper_buttons_data = {
  35. + .buttons = grasshopper_buttons_btn,
  36. + .nbuttons = 1,
  37. +};
  38. +
  39. +static struct platform_device grasshopper_buttons = {
  40. + .name = "gpio-keys",
  41. + .id = -1,
  42. + .num_resources = 0,
  43. + .dev = {
  44. + .platform_data = &grasshopper_buttons_data,
  45. + },
  46. +};
  47. +
  48. +static int __init grasshopper_init_buttons(void)
  49. +{
  50. + int i;
  51. +
  52. + for (i=0; i<grasshopper_buttons_data.nbuttons;i++) {
  53. + at32_select_gpio(grasshopper_buttons_btn[i].gpio, AT32_GPIOF_DEGLITCH);
  54. + }
  55. +
  56. + platform_device_register(&grasshopper_buttons);
  57. + return 0;
  58. +}
  59. +arch_initcall(grasshopper_init_buttons);
  60. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/flash.c linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/flash.c
  61. --- linux-4.7.3/arch/avr32/boards/grasshopper/flash.c 1970-01-01 01:00:00.000000000 +0100
  62. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/flash.c 2016-09-13 11:23:21.454833158 +0200
  63. @@ -0,0 +1,101 @@
  64. +/*
  65. + * GRASSHOPPER board-specific flash initialization
  66. + *
  67. + * Copyright (C) 2005-2006 Atmel Corporation
  68. + *
  69. + * This program is free software; you can redistribute it and/or modify
  70. + * it under the terms of the GNU General Public License version 2 as
  71. + * published by the Free Software Foundation.
  72. + */
  73. +#include <linux/init.h>
  74. +#include <linux/platform_device.h>
  75. +#include <linux/mtd/mtd.h>
  76. +#include <linux/mtd/partitions.h>
  77. +#include <linux/mtd/physmap.h>
  78. +
  79. +#include <mach/smc.h>
  80. +
  81. +static struct smc_timing flash_timing __initdata = {
  82. + .ncs_read_setup = 0,
  83. + .nrd_setup = 40,
  84. + .ncs_write_setup = 0,
  85. + .nwe_setup = 10,
  86. +
  87. + .ncs_read_pulse = 80,
  88. + .nrd_pulse = 40,
  89. + .ncs_write_pulse = 65,
  90. + .nwe_pulse = 55,
  91. +
  92. + .read_cycle = 120,
  93. + .write_cycle = 120,
  94. +};
  95. +
  96. +static struct smc_config flash_config __initdata = {
  97. + .bus_width = 2,
  98. + .nrd_controlled = 1,
  99. + .nwe_controlled = 1,
  100. + .byte_write = 1,
  101. +};
  102. +
  103. +// To prevent trouble when flashing with Linux, take care that the same values for offsets
  104. +// and lengths are set here and in the file
  105. +// 'buildroot_basedir/project_build_avr32/grasshopper/u-boot-1.3.4/include/configs/grasshopper.h' !!!
  106. +static struct mtd_partition flash_parts[] = {
  107. + {
  108. + .name = "u-boot",
  109. + .offset = 0x00000000,
  110. + .size = 0x00020000, /* 128 KiB */
  111. + .mask_flags = MTD_WRITEABLE,
  112. + },
  113. + {
  114. + .name = "env", /* 64 KB */
  115. + .offset = 0x00020000,
  116. + .size = 0x00010000,
  117. + .mask_flags = MTD_WRITEABLE,
  118. + },
  119. + {
  120. + .name = "root",
  121. + .offset = 0x00030000,
  122. + .size = 0x007d0000,
  123. + },
  124. +};
  125. +
  126. +static struct physmap_flash_data flash_data = {
  127. + .width = 2,
  128. + .nr_parts = ARRAY_SIZE(flash_parts),
  129. + .parts = flash_parts,
  130. +};
  131. +
  132. +static struct resource flash_resource = {
  133. + .start = 0x00000000,
  134. + .end = 0x007fffff,
  135. + .flags = IORESOURCE_MEM,
  136. +};
  137. +
  138. +static struct platform_device flash_device = {
  139. + .name = "physmap-flash",
  140. + .id = 0,
  141. + .resource = &flash_resource,
  142. + .num_resources = 1,
  143. + .dev = {
  144. + .platform_data = &flash_data,
  145. + },
  146. +};
  147. +
  148. +/* This needs to be called after the SMC has been initialized */
  149. +static int __init grasshopper_flash_init(void)
  150. +{
  151. + int ret;
  152. +
  153. + smc_set_timing(&flash_config, &flash_timing);
  154. + ret = smc_set_configuration(0, &flash_config);
  155. + if (ret < 0) {
  156. + printk(KERN_ERR "grasshopper: failed to set NOR flash timing\n");
  157. + return ret;
  158. + }
  159. +
  160. + platform_device_register(&flash_device);
  161. +
  162. + return 0;
  163. +}
  164. +device_initcall(grasshopper_flash_init);
  165. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/Kconfig linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Kconfig
  166. --- linux-4.7.3/arch/avr32/boards/grasshopper/Kconfig 1970-01-01 01:00:00.000000000 +0100
  167. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Kconfig 2016-09-13 11:23:21.454833158 +0200
  168. @@ -0,0 +1,5 @@
  169. +# Grasshopper customization
  170. +
  171. +if BOARD_GRASSHOPPER
  172. +
  173. +endif # BOARD_GRASSHOPPER
  174. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/led.c linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/led.c
  175. --- linux-4.7.3/arch/avr32/boards/grasshopper/led.c 1970-01-01 01:00:00.000000000 +0100
  176. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/led.c 2016-09-13 11:23:21.454833158 +0200
  177. @@ -0,0 +1,155 @@
  178. +/*
  179. + * init code specific for grasshoppers LEDs
  180. + *
  181. + * This program is free software; you can redistribute it and/or modify
  182. + * it under the terms of the GNU General Public License version 2 as
  183. + * published by the Free Software Foundation.
  184. + */
  185. +
  186. +#include <linux/gpio.h>
  187. +#include <linux/init.h>
  188. +#include <linux/leds.h>
  189. +#include <linux/platform_device.h>
  190. +
  191. +#include <mach/at32ap700x.h>
  192. +#include <mach/board.h>
  193. +#include <mach/gpio.h>
  194. +#include <mach/init.h>
  195. +#include <mach/portmux.h>
  196. +
  197. + // LEDs
  198. +static struct gpio_led grasshopper_led[] = {
  199. +#ifndef CONFIG_BOARD_GRASSHOPPER_PWM0
  200. + {
  201. + .name = "pwrled:red",
  202. + .gpio = GPIO_PIN_PA(22),
  203. + .active_low = 1,
  204. + },
  205. +#endif
  206. + {
  207. + .name = "led1:green",
  208. + .gpio = GPIO_PIN_PA(23),
  209. + .default_trigger = "heartbeat",
  210. + },
  211. + {
  212. + .name = "led2:green",
  213. + .gpio = GPIO_PIN_PA(24),
  214. + },
  215. + {
  216. + .name = "led3:green",
  217. + .gpio = GPIO_PIN_PA(25),
  218. + },
  219. + {
  220. + .name = "led4:green",
  221. + .gpio = GPIO_PIN_PA(26),
  222. + },
  223. + {
  224. + .name = "led5:green",
  225. + .gpio = GPIO_PIN_PA(27),
  226. + },
  227. +#ifndef CONFIG_BOARD_GRASSHOPPER_PWM0
  228. + {
  229. + .name = "led6:green",
  230. + .gpio = GPIO_PIN_PA(28),
  231. + },
  232. +#endif
  233. +#ifndef CONFIG_BOARD_GRASSHOPPER_PWM1
  234. + {
  235. + .name = "led7:green",
  236. + .gpio = GPIO_PIN_PA(29),
  237. + },
  238. +#endif
  239. + {
  240. + .name = "led8:green",
  241. + .gpio = GPIO_PIN_PA(30),
  242. + },
  243. +};
  244. +
  245. +static struct gpio_led_platform_data grasshopper_led_data = {
  246. + .num_leds = ARRAY_SIZE(grasshopper_led),
  247. + .leds = grasshopper_led,
  248. +};
  249. +
  250. +static struct platform_device grasshopper_led_dev = {
  251. + .name = "leds-gpio",
  252. + .dev = {
  253. + .platform_data = &grasshopper_led_data,
  254. + },
  255. +};
  256. +
  257. +/* PWM */
  258. +#ifdef CONFIG_LEDS_ATMEL_PWM
  259. +static struct gpio_led pwm_led[] = {
  260. + /* here the "gpio" is actually a PWM channel */
  261. +#ifdef CONFIG_BOARD_GRASSHOPPER_PWM0
  262. + {
  263. + .name = "pwm0",
  264. + .gpio = 0,
  265. + },
  266. +#endif
  267. +#ifdef CONFIG_BOARD_GRASSHOPPER_PWM1
  268. + {
  269. + .name = "pwm1",
  270. + .gpio = 1,
  271. + },
  272. +#endif
  273. +#ifdef CONFIG_BOARD_GRASSHOPPER_PWM2
  274. + {
  275. + .name = "pwm2",
  276. + .gpio = 2,
  277. + },
  278. +#endif
  279. +#ifdef CONFIG_BOARD_GRASSHOPPER_PWM3
  280. + {
  281. + .name = "pwm3",
  282. + .gpio = 3,
  283. + },
  284. +#endif
  285. +};
  286. +
  287. +static struct gpio_led_platform_data pwm_led_data = {
  288. + .num_leds = ARRAY_SIZE(pwm_led),
  289. + .leds = pwm_led,
  290. +};
  291. +
  292. +static struct platform_device pwm_led_dev = {
  293. + .name = "leds-atmel-pwm",
  294. + .id = -1,
  295. + .dev = {
  296. + .platform_data = &pwm_led_data,
  297. + },
  298. +};
  299. +#endif
  300. +
  301. +static int __init grasshopper_setup_leds(void)
  302. +{
  303. + printk("Grasshopper: Setting up %d LEDs\n", grasshopper_led_data.num_leds);
  304. + //for (i=0; i<grasshopper_led_data.num_leds; i++)
  305. + // at32_select_gpio(grasshopper_led[i].gpio, AT32_GPIOF_OUTPUT);
  306. +
  307. + platform_device_register(&grasshopper_led_dev);
  308. +
  309. +#ifdef CONFIG_LEDS_ATMEL_PWM
  310. + at32_add_device_pwm(0
  311. +#ifdef CONFIG_BOARD_GRASSHOPPER_PWM0
  312. + | (1 << 0)
  313. +#endif
  314. +#ifdef CONFIG_BOARD_GRASSHOPPER_PWM1
  315. + | (1 << 1)
  316. +#endif
  317. +#ifdef CONFIG_BOARD_GRASSHOPPER_PWM2
  318. + | (1 << 2)
  319. +#endif
  320. +#ifdef CONFIG_BOARD_GRASSHOPPER_PWM3
  321. + | (1 << 3)
  322. +#endif
  323. + );
  324. +
  325. + printk("Grasshopper: Setting up %d PWMs\n", pwm_led_data.num_leds);
  326. + platform_device_register(&pwm_led_dev);
  327. +#endif
  328. +
  329. + return 0;
  330. +}
  331. +
  332. +arch_initcall(grasshopper_setup_leds);
  333. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/mac.c linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/mac.c
  334. --- linux-4.7.3/arch/avr32/boards/grasshopper/mac.c 1970-01-01 01:00:00.000000000 +0100
  335. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/mac.c 2016-09-13 11:23:21.454833158 +0200
  336. @@ -0,0 +1,94 @@
  337. +/*
  338. + * Init Code for the ethernet interface of the Grasshopper board.
  339. + *
  340. + * This program is free software; you can redistribute it and/or modify
  341. + * it under the terms of the GNU General Public License version 2 as
  342. + * published by the Free Software Foundation.
  343. + */
  344. +#include <linux/clk.h>
  345. +#include <linux/etherdevice.h>
  346. +#include <linux/init.h>
  347. +#include <linux/platform_device.h>
  348. +
  349. +#include <asm/setup.h>
  350. +
  351. +#include <mach/board.h>
  352. +
  353. +/* Initialized by bootloader-specific startup code. */
  354. +struct tag *bootloader_tags __initdata;
  355. +
  356. +/* Ethernet */
  357. +struct eth_addr {
  358. + u8 addr[6];
  359. +};
  360. +
  361. +static struct eth_addr __initdata hw_addr[1];
  362. +static struct macb_platform_data __initdata eth_data[] = {
  363. + {
  364. + .phy_mask = ~(1U << 0),
  365. + },
  366. +};
  367. +
  368. +/*
  369. + * The next two functions should go away as the boot loader is
  370. + * supposed to initialize the macb address registers with a valid
  371. + * ethernet address. But we need to keep it around for a while until
  372. + * we can be reasonably sure the boot loader does this.
  373. + *
  374. + * The phy_id is ignored as the driver will probe for it.
  375. + */
  376. +static int __init parse_tag_ethernet(struct tag *tag)
  377. +{
  378. + int i;
  379. +
  380. + i = tag->u.ethernet.mac_index;
  381. + if (i < ARRAY_SIZE(hw_addr))
  382. + memcpy(hw_addr[i].addr, tag->u.ethernet.hw_address,
  383. + sizeof(hw_addr[i].addr));
  384. +
  385. + return 0;
  386. +}
  387. +__tagtable(ATAG_ETHERNET, parse_tag_ethernet);
  388. +
  389. +static void __init set_hw_addr(struct platform_device *pdev)
  390. +{
  391. + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  392. + const u8 *addr;
  393. + void __iomem *regs;
  394. + struct clk *pclk;
  395. +
  396. + if (!res)
  397. + return;
  398. + if (pdev->id >= ARRAY_SIZE(hw_addr))
  399. + return;
  400. +
  401. + addr = hw_addr[pdev->id].addr;
  402. + if (!is_valid_ether_addr(addr))
  403. + return;
  404. +
  405. + /*
  406. + * Since this is board-specific code, we'll cheat and use the
  407. + * physical address directly as we happen to know that it's
  408. + * the same as the virtual address.
  409. + */
  410. + regs = (void __iomem __force *)res->start;
  411. + pclk = clk_get(&pdev->dev, "pclk");
  412. + if (!pclk)
  413. + return;
  414. +
  415. + clk_enable(pclk);
  416. + __raw_writel((addr[3] << 24) | (addr[2] << 16)
  417. + | (addr[1] << 8) | addr[0], regs + 0x98);
  418. + __raw_writel((addr[5] << 8) | addr[4], regs + 0x9c);
  419. + clk_disable(pclk);
  420. + clk_put(pclk);
  421. +}
  422. +
  423. +static int __init grasshopper_init_mac(void)
  424. +{
  425. + printk("Grasshopper: Setting up Ethernet\n");
  426. + set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
  427. +
  428. + return 0;
  429. +}
  430. +arch_initcall(grasshopper_init_mac);
  431. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/Makefile linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Makefile
  432. --- linux-4.7.3/arch/avr32/boards/grasshopper/Makefile 1970-01-01 01:00:00.000000000 +0100
  433. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Makefile 2016-09-13 11:23:21.454833158 +0200
  434. @@ -0,0 +1,5 @@
  435. +obj-y += button.o
  436. +obj-y += flash.o
  437. +obj-y += led.o
  438. +obj-y += mac.o
  439. +obj-y += setup.o
  440. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/setup.c linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/setup.c
  441. --- linux-4.7.3/arch/avr32/boards/grasshopper/setup.c 1970-01-01 01:00:00.000000000 +0100
  442. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/setup.c 2016-09-13 11:23:21.454833158 +0200
  443. @@ -0,0 +1,210 @@
  444. +/*
  445. + * init code specific for grasshopper
  446. + *
  447. + * based on icnova_base.c from in-circuit.de
  448. + *
  449. + * This program is free software; you can redistribute it and/or modify
  450. + * it under the terms of the GNU General Public License version 2 as
  451. + * published by the Free Software Foundation.
  452. + */
  453. +#include <linux/clk.h>
  454. +#include <linux/gpio.h>
  455. +#include <linux/irq.h>
  456. +#include <linux/i2c.h>
  457. +#include <linux/i2c-gpio.h>
  458. +#include <linux/init.h>
  459. +#include <linux/linkage.h>
  460. +#include <linux/platform_device.h>
  461. +#include <linux/string.h>
  462. +#include <linux/types.h>
  463. +#include <linux/spi/spi.h>
  464. +#include <linux/spi/ads7846.h>
  465. +#include <linux/spi/at73c213.h>
  466. +#include <linux/input.h>
  467. +#include <linux/gpio_keys.h>
  468. +
  469. +#include <linux/fb.h>
  470. +#include <video/atmel_lcdc.h>
  471. +
  472. +#include <linux/atmel-mci.h>
  473. +#include <asm/io.h>
  474. +#include <asm/setup.h>
  475. +
  476. +#include <mach/at32ap700x.h>
  477. +#include <mach/board.h>
  478. +#include <mach/init.h>
  479. +#include <mach/portmux.h>
  480. +
  481. +#define PIN_TS_EXTINT GPIO_PIN_PA(19)
  482. +
  483. +static struct at73c213_board_info at73c213_data = {
  484. + .ssc_id = 0,
  485. + .shortname = "AT73C213 Sound",
  486. +};
  487. +
  488. +static int ads7846_pendown_state(void)
  489. +{
  490. + // active low!
  491. + return !gpio_get_value(PIN_TS_EXTINT);
  492. +}
  493. +
  494. +static struct ads7846_platform_data ads_info = {
  495. + .model = 7846,
  496. + .vref_delay_usecs = 100,
  497. + .settle_delay_usecs = 800,
  498. + .penirq_recheck_delay_usecs = 800,
  499. + .x_plate_ohms = 750, /* FIXME */
  500. + .y_plate_ohms = 300, /* FIXME */
  501. + .pressure_max = 4096,
  502. + .debounce_max = 1,
  503. + .debounce_rep = 0,
  504. + .debounce_tol = (~0),
  505. + .get_pendown_state = ads7846_pendown_state,
  506. +};
  507. +
  508. +static struct spi_board_info spi0_board_info[] __initdata = {
  509. + {
  510. + .modalias = "at73c213",
  511. + .max_speed_hz = 200000,
  512. + .chip_select = 1,
  513. + .mode = SPI_MODE_1,
  514. + .platform_data = &at73c213_data,
  515. + },
  516. + {
  517. + .modalias = "ads7846",
  518. + .max_speed_hz = 31250*26,
  519. + .chip_select = 0,
  520. + .platform_data = &ads_info,
  521. + .irq = -1,
  522. + },
  523. +};
  524. +
  525. +/* Oscillator frequencies. These are board-specific */
  526. +unsigned long at32_board_osc_rates[3] = {
  527. + [0] = 32768, /* 32.768 kHz on RTC osc */
  528. + [1] = 20000000, /* 20 MHz on osc0 */
  529. + [2] = 12000000, /* 12 MHz on osc1 */
  530. +};
  531. +
  532. +/* LCD */
  533. +#ifdef CONFIG_GRASSHOPPER_LCD
  534. +static struct fb_videomode __initdata grasshopper_tft_modes[] = {
  535. + {
  536. + .name = "480x272 @ 60Hz",
  537. + .refresh = 60,
  538. + .xres = 480, .yres = 272,
  539. + .pixclock = KHZ2PICOS(9000),
  540. +
  541. + .left_margin = 2, .right_margin = 2,
  542. + .upper_margin = 12, .lower_margin = 2,
  543. + .hsync_len = 41, .vsync_len = 10,
  544. +
  545. + .sync = 0,
  546. + .vmode = FB_VMODE_NONINTERLACED,
  547. + },
  548. +};
  549. +
  550. +static struct fb_monspecs __initdata grasshopper_default_monspecs = {
  551. + .manufacturer = "SHA",
  552. + .monitor = "LQ043T3DX02",
  553. + .modedb = grasshopper_tft_modes,
  554. + .modedb_len = ARRAY_SIZE(grasshopper_tft_modes),
  555. + .hfmin = 15000,
  556. + .hfmax = 30000,
  557. + .vfmin = 60,
  558. + .vfmax = 700,
  559. + .dclkmax = 90000000,
  560. +};
  561. +
  562. +struct atmel_lcdfb_info __initdata grasshopper_lcdc_data = {
  563. + .default_bpp = 24, // Color depth
  564. + .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
  565. + .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
  566. + | ATMEL_LCDC_PIXELSIZE_24
  567. + | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
  568. + | ATMEL_LCDC_MEMOR_BIG),
  569. + .default_monspecs = &grasshopper_default_monspecs,
  570. + .guard_time = 2,
  571. + .lcdcon_is_backlight = 1,
  572. +};
  573. +#endif
  574. +
  575. +/* MCI */
  576. +#ifdef CONFIG_MMC_ATMELMCI
  577. +static struct mci_platform_data __initdata mci0_data = {
  578. + .slot[0] = {
  579. + .bus_width = 4,
  580. + .detect_pin = GPIO_PIN_NONE,
  581. + .wp_pin = GPIO_PIN_NONE,
  582. + // .detect_pin = GPIO_PIN_PC(14), /* gpio30/sdcd */
  583. + // .wp_pin = GPIO_PIN_PC(15), /* gpio31/sdwp */
  584. + }
  585. +};
  586. +#endif
  587. +
  588. +void __init setup_board(void)
  589. +{
  590. + at32_map_usart(1, 0, 0); // USART 1: /dev/ttyS0, CP2102
  591. + at32_setup_serial_console(0);
  592. +
  593. + // grasshopper_add_spi();
  594. +}
  595. +
  596. +static int __init grasshopper_init(void)
  597. +{
  598. + int i;
  599. +
  600. + /*
  601. + * grasshopper uses 32-bit SDRAM interface. Reserve the
  602. + * SDRAM-specific pins so that nobody messes with them.
  603. + */
  604. + at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL);
  605. + at32_add_device_usba(0, NULL);
  606. + at32_add_device_usart(0);
  607. +
  608. +#ifdef CONFIG_GRASSHOPPER_LCD
  609. + at32_add_device_lcdc(0, &grasshopper_lcdc_data,
  610. + fbmem_start, fbmem_size,
  611. + ATMEL_LCDC_PRI_CONTROL | ATMEL_LCDC_PRI_24BIT);
  612. +#endif
  613. +
  614. +#ifdef CONFIG_MMC_ATMELMCI
  615. +// at32_add_device_mci(0, &mci0_data); /* MMC/SD */
  616. +#endif
  617. +
  618. +// printk("registering penirq gpio-pin...\n");
  619. +// at32_select_gpio(PIN_TS_EXTINT, AT32_GPIOF_DEGLITCH);
  620. +// spi0_board_info[1].irq = gpio_to_irq(PIN_TS_EXTINT);
  621. +// printk("done\n");
  622. +
  623. + //at32_select_periph(PIN_TS_EXTINT, GPIO_PERIPH_A, AT32_GPIOF_DEGLITCH);
  624. +// printk("registering SSC1 for external DAC...\n");
  625. +// at32_add_device_ssc(0, ATMEL_SSC_TX);
  626. +// printk("registering SPI for touchscreen and sound...\n");
  627. +/*
  628. + struct clk *gclk;
  629. + struct clk *pll;
  630. +
  631. + gclk = clk_get(NULL, "gclk0");
  632. + if (IS_ERR(gclk)) {
  633. + printk("failed to get clk gclk0\n");
  634. + } else {
  635. + pll = clk_get(NULL, "pll0");
  636. + if (IS_ERR(pll)) {
  637. + printk("failed to get clk pll0\n");
  638. + } else {
  639. + if (clk_set_parent(gclk, pll)) {
  640. + printk("failed to set pll0 as parent for DAC clock\n");
  641. + } else {
  642. + at32_select_periph(GPIO_PIOA_BASE, (1 << 30), GPIO_PERIPH_A, 0);
  643. + at73c213_data.dac_clk = gclk;
  644. + }
  645. + }
  646. + }
  647. +*/
  648. +// at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
  649. +// printk("done\n");
  650. +
  651. + return 0;
  652. +}
  653. +arch_initcall(grasshopper_init);
  654. diff -Naur linux-4.7.3/arch/avr32/configs/grasshopper_defconfig linux-4.7.3.grasshopper/arch/avr32/configs/grasshopper_defconfig
  655. --- linux-4.7.3/arch/avr32/configs/grasshopper_defconfig 1970-01-01 01:00:00.000000000 +0100
  656. +++ linux-4.7.3.grasshopper/arch/avr32/configs/grasshopper_defconfig 2016-09-13 11:23:29.341833182 +0200
  657. @@ -0,0 +1,182 @@
  658. +CONFIG_EXPERIMENTAL=y
  659. +# CONFIG_LOCALVERSION_AUTO is not set
  660. +CONFIG_SYSVIPC=y
  661. +CONFIG_POSIX_MQUEUE=y
  662. +CONFIG_BSD_PROCESS_ACCT=y
  663. +CONFIG_BSD_PROCESS_ACCT_V3=y
  664. +CONFIG_DEFAULT_HOSTNAME="grasshopper"
  665. +CONFIG_LOG_BUF_SHIFT=14
  666. +CONFIG_SYSFS_DEPRECATED=y
  667. +CONFIG_SYSFS_DEPRECATED_V2=y
  668. +CONFIG_BLK_DEV_INITRD=y
  669. +# CONFIG_RD_GZIP is not set
  670. +CONFIG_CC_OPTIMIZE_FOR_SIZE=y
  671. +# CONFIG_SYSCTL_SYSCALL is not set
  672. +# CONFIG_BASE_FULL is not set
  673. +CONFIG_EMBEDDED=y
  674. +CONFIG_PROFILING=y
  675. +CONFIG_OPROFILE=m
  676. +CONFIG_KPROBES=y
  677. +CONFIG_MODULES=y
  678. +CONFIG_MODULE_UNLOAD=y
  679. +CONFIG_MODULE_FORCE_UNLOAD=y
  680. +# CONFIG_BLK_DEV_BSG is not set
  681. +# CONFIG_IOSCHED_DEADLINE is not set
  682. +CONFIG_BOARD_GRASSHOPPER=y
  683. +CONFIG_AP700X_32_BIT_SMC=y
  684. +# CONFIG_OWNERSHIP_TRACE is not set
  685. +# CONFIG_SUSPEND is not set
  686. +CONFIG_CPU_FREQ=y
  687. +# CONFIG_CPU_FREQ_STAT is not set
  688. +CONFIG_CPU_FREQ_GOV_USERSPACE=y
  689. +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
  690. +CONFIG_CPU_FREQ_AT32AP=y
  691. +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
  692. +CONFIG_NET=y
  693. +CONFIG_PACKET=y
  694. +CONFIG_UNIX=y
  695. +CONFIG_XFRM_USER=y
  696. +CONFIG_NET_KEY=y
  697. +CONFIG_INET=y
  698. +CONFIG_IP_MULTICAST=y
  699. +CONFIG_IP_ADVANCED_ROUTER=y
  700. +CONFIG_IP_PNP=y
  701. +CONFIG_IP_PNP_DHCP=y
  702. +CONFIG_IP_MROUTE=y
  703. +CONFIG_IP_PIMSM_V1=y
  704. +CONFIG_SYN_COOKIES=y
  705. +CONFIG_INET_AH=y
  706. +CONFIG_INET_ESP=y
  707. +CONFIG_INET_IPCOMP=y
  708. +# CONFIG_INET_LRO is not set
  709. +CONFIG_IPV6=y
  710. +CONFIG_INET6_AH=y
  711. +CONFIG_INET6_ESP=y
  712. +CONFIG_INET6_IPCOMP=y
  713. +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
  714. +# CONFIG_PREVENT_FIRMWARE_BUILD is not set
  715. +# CONFIG_FW_LOADER is not set
  716. +CONFIG_MTD=y
  717. +CONFIG_MTD_CMDLINE_PARTS=y
  718. +CONFIG_MTD_CHAR=y
  719. +CONFIG_MTD_BLKDEVS=y
  720. +CONFIG_MTD_BLOCK=y
  721. +CONFIG_MTD_CFI=y
  722. +CONFIG_MTD_JEDECPROBE=y
  723. +CONFIG_MTD_GEN_PROBE=y
  724. +CONFIG_MTD_CFI_AMDSTD=y
  725. +CONFIG_MTD_RAM=y
  726. +CONFIG_MTD_PHYSMAP=y
  727. +CONFIG_MTD_UBI=y
  728. +CONFIG_MTD_UBI_WL_THRESHOLD=4096
  729. +CONFIG_MTD_UBI_BEB_RESERVE=1
  730. +CONFIG_MTD_DATAFLASH=m
  731. +CONFIG_MTD_DATAFLASH_WRITE_VERIFY=y
  732. +CONFIG_BLK_DEV=y
  733. +CONFIG_BLK_DEV_LOOP=y
  734. +CONFIG_BLK_DEV_NBD=y
  735. +CONFIG_BLK_DEV_RAM=y
  736. +CONFIG_MISC_DEVICES=y
  737. +CONFIG_ATMEL_PWM=y
  738. +CONFIG_ATMEL_TCLIB=y
  739. +CONFIG_ATMEL_SSC=y
  740. +CONFIG_NETDEVICES=y
  741. +CONFIG_TUN=m
  742. +CONFIG_MARVELL_PHY=y
  743. +CONFIG_DAVICOM_PHY=y
  744. +CONFIG_NET_ETHERNET=y
  745. +CONFIG_MACB=y
  746. +# CONFIG_NETDEV_1000 is not set
  747. +# CONFIG_NETDEV_10000 is not set
  748. +CONFIG_INPUT_EVDEV=y
  749. +# CONFIG_KEYBOARD_ATKBD is not set
  750. +CONFIG_KEYBOARD_GPIO=y
  751. +CONFIG_MOUSE_GPIO=y
  752. +CONFIG_INPUT_TOUCHSCREEN=y
  753. +CONFIG_TOUCHSCREEN_ADS7846=y
  754. +# CONFIG_SERIO_I8042 is not set
  755. +# CONFIG_SERIO_SERPORT is not set
  756. +CONFIG_SERIO_AT32PSIF=y
  757. +# CONFIG_LEGACY_PTYS is not set
  758. +CONFIG_SERIAL_ATMEL=y
  759. +CONFIG_SERIAL_ATMEL_CONSOLE=y
  760. +# CONFIG_HW_RANDOM is not set
  761. +CONFIG_I2C=m
  762. +CONFIG_I2C_CHARDEV=m
  763. +CONFIG_I2C_GPIO=m
  764. +CONFIG_SPI=y
  765. +CONFIG_SPI_ATMEL=y
  766. +CONFIG_SPI_SPIDEV=m
  767. +CONFIG_GPIO_SYSFS=y
  768. +# CONFIG_HWMON is not set
  769. +CONFIG_WATCHDOG=y
  770. +CONFIG_AT32AP700X_WDT=y
  771. +CONFIG_FB=y
  772. +CONFIG_FB_ATMEL=y
  773. +CONFIG_BACKLIGHT_LCD_SUPPORT=y
  774. +CONFIG_LCD_CLASS_DEVICE=y
  775. +CONFIG_LCD_PLATFORM=y
  776. +CONFIG_BACKLIGHT_CLASS_DEVICE=y
  777. +CONFIG_BACKLIGHT_ATMEL_LCDC=y
  778. +# CONFIG_BACKLIGHT_GENERIC is not set
  779. +CONFIG_LOGO=y
  780. +CONFIG_SOUND=y
  781. +CONFIG_SND=y
  782. +CONFIG_SND_AT73C213=y
  783. +# CONFIG_USB_SUPPORT is not set
  784. +CONFIG_MMC=y
  785. +CONFIG_MMC_SDHCI=y
  786. +CONFIG_MMC_ATMELMCI=y
  787. +CONFIG_NEW_LEDS=y
  788. +CONFIG_LEDS_CLASS=y
  789. +CONFIG_LEDS_GPIO=y
  790. +CONFIG_LEDS_TRIGGERS=y
  791. +CONFIG_LEDS_TRIGGER_TIMER=y
  792. +CONFIG_LEDS_TRIGGER_HEARTBEAT=y
  793. +CONFIG_LEDS_TRIGGER_GPIO=y
  794. +CONFIG_RTC_CLASS=y
  795. +CONFIG_RTC_DRV_AT32AP700X=y
  796. +CONFIG_DMADEVICES=y
  797. +CONFIG_EXT2_FS=y
  798. +CONFIG_EXT3_FS=y
  799. +# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
  800. +# CONFIG_EXT3_FS_XATTR is not set
  801. +# CONFIG_DNOTIFY is not set
  802. +CONFIG_FUSE_FS=m
  803. +CONFIG_MSDOS_FS=m
  804. +CONFIG_VFAT_FS=m
  805. +CONFIG_FAT_DEFAULT_CODEPAGE=850
  806. +CONFIG_TMPFS=y
  807. +CONFIG_CONFIGFS_FS=m
  808. +CONFIG_JFFS2_FS=y
  809. +CONFIG_JFFS2_FS_WRITEBUFFER=y
  810. +CONFIG_JFFS2_FS_WBUF_VERIFY=y
  811. +CONFIG_JFFS2_COMPRESSION_OPTIONS=y
  812. +CONFIG_JFFS2_ZLIB=y
  813. +CONFIG_JFFS2_LZO=y
  814. +CONFIG_JFFS2_RTIME=y
  815. +CONFIG_JFFS2_RUBIN=y
  816. +CONFIG_JFFS2_CMODE_PRIORITY=y
  817. +CONFIG_NFS_FS=y
  818. +CONFIG_NFS_V3=y
  819. +CONFIG_ROOT_NFS=y
  820. +CONFIG_NFSD=m
  821. +CONFIG_NFSD_V3=y
  822. +CONFIG_CIFS=m
  823. +CONFIG_NLS=y
  824. +CONFIG_NLS_CODEPAGE_437=y
  825. +CONFIG_NLS_CODEPAGE_1250=y
  826. +CONFIG_NLS_ASCII=y
  827. +CONFIG_NLS_ISO8859_1=y
  828. +CONFIG_NLS_ISO8859_15=y
  829. +CONFIG_NLS_UTF8=y
  830. +CONFIG_MAGIC_SYSRQ=y
  831. +CONFIG_DEBUG_FS=y
  832. +CONFIG_DEBUG_KERNEL=y
  833. +CONFIG_DETECT_HUNG_TASK=y
  834. +CONFIG_FRAME_POINTER=y
  835. +CONFIG_CRYPTO_PCBC=m
  836. +# CONFIG_CRYPTO_ANSI_CPRNG is not set
  837. +CONFIG_CRC_CCITT=m
  838. +CONFIG_CRC_ITU_T=m
  839. +CONFIG_CRC7=m
  840. diff -Naur linux-4.7.3/arch/avr32/include/asm/kprobes.h linux-4.7.3.grasshopper/arch/avr32/include/asm/kprobes.h
  841. --- linux-4.7.3/arch/avr32/include/asm/kprobes.h 2016-09-07 08:35:12.000000000 +0200
  842. +++ linux-4.7.3.grasshopper/arch/avr32/include/asm/kprobes.h 2016-09-13 11:23:21.455833158 +0200
  843. @@ -40,6 +40,19 @@
  844. char jprobes_stack[MAX_STACK_SIZE];
  845. };
  846. +struct prev_kprobe {
  847. + struct kprobe *kp;
  848. + unsigned int status;
  849. +};
  850. +
  851. +/* per-cpu kprobe control block */
  852. +struct kprobe_ctlblk {
  853. + unsigned int kprobe_status;
  854. + struct prev_kprobe prev_kprobe;
  855. + struct pt_regs jprobe_saved_regs;
  856. + char jprobes_stack[MAX_STACK_SIZE];
  857. +};
  858. +
  859. extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
  860. extern int kprobe_exceptions_notify(struct notifier_block *self,
  861. unsigned long val, void *data);
  862. diff -Naur linux-4.7.3/arch/avr32/Kconfig linux-4.7.3.grasshopper/arch/avr32/Kconfig
  863. --- linux-4.7.3/arch/avr32/Kconfig 2016-09-07 08:35:12.000000000 +0200
  864. +++ linux-4.7.3.grasshopper/arch/avr32/Kconfig 2016-09-13 11:23:21.455833158 +0200
  865. @@ -156,6 +156,15 @@
  866. config BOARD_MIMC200
  867. bool "MIMC200 CPU board"
  868. select CPU_AT32AP7000
  869. +
  870. +config BOARD_GRASSHOPPER
  871. + bool "Grasshopper Board"
  872. + select CPU_AT32AP7000
  873. + help
  874. + Grasshopper is the Nickname of the AVR32-based ICNova
  875. + AP7000 base board that is distributed by IN-Circuit.
  876. +
  877. + For more information see: http://www.ic-board.de/
  878. endchoice
  879. source "arch/avr32/boards/atstk1000/Kconfig"
  880. @@ -163,6 +172,7 @@
  881. source "arch/avr32/boards/hammerhead/Kconfig"
  882. source "arch/avr32/boards/favr-32/Kconfig"
  883. source "arch/avr32/boards/merisc/Kconfig"
  884. +source "arch/avr32/boards/grasshopper/Kconfig"
  885. choice
  886. prompt "Boot loader type"
  887. diff -Naur linux-4.7.3/arch/avr32/Makefile linux-4.7.3.grasshopper/arch/avr32/Makefile
  888. --- linux-4.7.3/arch/avr32/Makefile 2016-09-07 08:35:12.000000000 +0200
  889. +++ linux-4.7.3.grasshopper/arch/avr32/Makefile 2016-09-13 11:23:21.455833158 +0200
  890. @@ -37,6 +37,7 @@
  891. core-$(CONFIG_BOARD_FAVR_32) += arch/avr32/boards/favr-32/
  892. core-$(CONFIG_BOARD_MERISC) += arch/avr32/boards/merisc/
  893. core-$(CONFIG_BOARD_MIMC200) += arch/avr32/boards/mimc200/
  894. +core-$(CONFIG_BOARD_GRASSHOPPER) += arch/avr32/boards/grasshopper/
  895. core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/
  896. core-y += arch/avr32/kernel/
  897. core-y += arch/avr32/mm/