aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap/at32ap7000.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-06-14 11:37:31 -0400
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2007-10-11 05:40:27 -0400
commit6fcf0615117dcfa126083f2163c4dcea3098bbe3 (patch)
tree191a1e9968f8cefea53b1e18fd0e5e586cbaa07d /arch/avr32/mach-at32ap/at32ap7000.c
parent7808fa4853728a776d7e76d68fb406f515a4119c (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>
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap7000.c')
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c68
1 files changed, 68 insertions, 0 deletions
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 * -------------------------------------------------------------------- */
1167static 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};
1179static 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};
1186static 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
1194struct platform_device *__init
1195at32_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
1225out_free_pdev:
1226 platform_device_put(pdev);
1227 return NULL;
1228}
1229
1230/* --------------------------------------------------------------------
1165 * GCLK 1231 * GCLK
1166 * -------------------------------------------------------------------- */ 1232 * -------------------------------------------------------------------- */
1167static struct clk gclk0 = { 1233static 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,