diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2007-06-14 11:37:31 -0400 |
---|---|---|
committer | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2007-10-11 05:40:27 -0400 |
commit | 6fcf0615117dcfa126083f2163c4dcea3098bbe3 (patch) | |
tree | 191a1e9968f8cefea53b1e18fd0e5e586cbaa07d | |
parent | 7808fa4853728a776d7e76d68fb406f515a4119c (diff) |
[AVR32] Wire up USBA device
Implement at32_add_device_usba() and use it to wire up the USBA device
on ATSTK1000 and ATNGW100.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
-rw-r--r-- | arch/avr32/boards/atngw100/setup.c | 1 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1002.c | 1 | ||||
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap7000.c | 68 | ||||
-rw-r--r-- | include/asm-avr32/arch-at32ap/board.h | 8 |
4 files changed, 78 insertions, 0 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index ef801563bbf5..6e180f435253 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c | |||
@@ -154,6 +154,7 @@ static int __init atngw100_init(void) | |||
154 | set_hw_addr(at32_add_device_eth(1, ð_data[1])); | 154 | set_hw_addr(at32_add_device_eth(1, ð_data[1])); |
155 | 155 | ||
156 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); | 156 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); |
157 | at32_add_device_usba(0, NULL); | ||
157 | 158 | ||
158 | for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) { | 159 | for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) { |
159 | at32_select_gpio(ngw_leds[i].gpio, | 160 | at32_select_gpio(ngw_leds[i].gpio, |
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index c9981b731efa..6b9e466104ad 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -241,6 +241,7 @@ static int __init atstk1002_init(void) | |||
241 | at32_add_device_lcdc(0, &atstk1000_lcdc_data, | 241 | at32_add_device_lcdc(0, &atstk1000_lcdc_data, |
242 | fbmem_start, fbmem_size); | 242 | fbmem_start, fbmem_size); |
243 | #endif | 243 | #endif |
244 | at32_add_device_usba(0, NULL); | ||
244 | #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM | 245 | #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM |
245 | at32_add_device_ssc(0, ATMEL_SSC_TX); | 246 | at32_add_device_ssc(0, ATMEL_SSC_TX); |
246 | #endif | 247 | #endif |
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c index 373242aab976..f6d154ca4d24 100644 --- a/arch/avr32/mach-at32ap/at32ap7000.c +++ b/arch/avr32/mach-at32ap/at32ap7000.c | |||
@@ -1162,6 +1162,72 @@ at32_add_device_ssc(unsigned int id, unsigned int flags) | |||
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | /* -------------------------------------------------------------------- | 1164 | /* -------------------------------------------------------------------- |
1165 | * USB Device Controller | ||
1166 | * -------------------------------------------------------------------- */ | ||
1167 | static struct resource usba0_resource[] __initdata = { | ||
1168 | { | ||
1169 | .start = 0xff300000, | ||
1170 | .end = 0xff3fffff, | ||
1171 | .flags = IORESOURCE_MEM, | ||
1172 | }, { | ||
1173 | .start = 0xfff03000, | ||
1174 | .end = 0xfff033ff, | ||
1175 | .flags = IORESOURCE_MEM, | ||
1176 | }, | ||
1177 | IRQ(31), | ||
1178 | }; | ||
1179 | static struct clk usba0_pclk = { | ||
1180 | .name = "pclk", | ||
1181 | .parent = &pbb_clk, | ||
1182 | .mode = pbb_clk_mode, | ||
1183 | .get_rate = pbb_clk_get_rate, | ||
1184 | .index = 12, | ||
1185 | }; | ||
1186 | static struct clk usba0_hclk = { | ||
1187 | .name = "hclk", | ||
1188 | .parent = &hsb_clk, | ||
1189 | .mode = hsb_clk_mode, | ||
1190 | .get_rate = hsb_clk_get_rate, | ||
1191 | .index = 6, | ||
1192 | }; | ||
1193 | |||
1194 | struct platform_device *__init | ||
1195 | at32_add_device_usba(unsigned int id, struct usba_platform_data *data) | ||
1196 | { | ||
1197 | struct platform_device *pdev; | ||
1198 | |||
1199 | if (id != 0) | ||
1200 | return NULL; | ||
1201 | |||
1202 | pdev = platform_device_alloc("atmel_usba_udc", 0); | ||
1203 | if (!pdev) | ||
1204 | return NULL; | ||
1205 | |||
1206 | if (platform_device_add_resources(pdev, usba0_resource, | ||
1207 | ARRAY_SIZE(usba0_resource))) | ||
1208 | goto out_free_pdev; | ||
1209 | |||
1210 | if (data) { | ||
1211 | if (platform_device_add_data(pdev, data, sizeof(*data))) | ||
1212 | goto out_free_pdev; | ||
1213 | |||
1214 | if (data->vbus_pin != GPIO_PIN_NONE) | ||
1215 | at32_select_gpio(data->vbus_pin, 0); | ||
1216 | } | ||
1217 | |||
1218 | usba0_pclk.dev = &pdev->dev; | ||
1219 | usba0_hclk.dev = &pdev->dev; | ||
1220 | |||
1221 | platform_device_add(pdev); | ||
1222 | |||
1223 | return pdev; | ||
1224 | |||
1225 | out_free_pdev: | ||
1226 | platform_device_put(pdev); | ||
1227 | return NULL; | ||
1228 | } | ||
1229 | |||
1230 | /* -------------------------------------------------------------------- | ||
1165 | * GCLK | 1231 | * GCLK |
1166 | * -------------------------------------------------------------------- */ | 1232 | * -------------------------------------------------------------------- */ |
1167 | static struct clk gclk0 = { | 1233 | static struct clk gclk0 = { |
@@ -1246,6 +1312,8 @@ struct clk *at32_clock_list[] = { | |||
1246 | &ssc0_pclk, | 1312 | &ssc0_pclk, |
1247 | &ssc1_pclk, | 1313 | &ssc1_pclk, |
1248 | &ssc2_pclk, | 1314 | &ssc2_pclk, |
1315 | &usba0_hclk, | ||
1316 | &usba0_pclk, | ||
1249 | &gclk0, | 1317 | &gclk0, |
1250 | &gclk1, | 1318 | &gclk1, |
1251 | &gclk2, | 1319 | &gclk2, |
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h index 0215965dc586..7dbd603c38cc 100644 --- a/include/asm-avr32/arch-at32ap/board.h +++ b/include/asm-avr32/arch-at32ap/board.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | 8 | ||
9 | #define GPIO_PIN_NONE (-1) | ||
10 | |||
9 | /* Add basic devices: system manager, interrupt controller, portmuxes, etc. */ | 11 | /* Add basic devices: system manager, interrupt controller, portmuxes, etc. */ |
10 | void at32_add_system_devices(void); | 12 | void at32_add_system_devices(void); |
11 | 13 | ||
@@ -36,6 +38,12 @@ struct platform_device * | |||
36 | at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, | 38 | at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, |
37 | unsigned long fbmem_start, unsigned long fbmem_len); | 39 | unsigned long fbmem_start, unsigned long fbmem_len); |
38 | 40 | ||
41 | struct usba_platform_data { | ||
42 | int vbus_pin; | ||
43 | }; | ||
44 | struct platform_device * | ||
45 | at32_add_device_usba(unsigned int id, struct usba_platform_data *data); | ||
46 | |||
39 | /* depending on what's hooked up, not all SSC pins will be used */ | 47 | /* depending on what's hooked up, not all SSC pins will be used */ |
40 | #define ATMEL_SSC_TK 0x01 | 48 | #define ATMEL_SSC_TK 0x01 |
41 | #define ATMEL_SSC_TF 0x02 | 49 | #define ATMEL_SSC_TF 0x02 |