diff options
author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-04-19 20:38:41 -0400 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-04-19 20:38:41 -0400 |
commit | e1c25dc638db01600069b3f9167d1b35f8d574b5 (patch) | |
tree | f3b25d6a8344f0d9b7d23c8447d4078a36bb30fd /arch | |
parent | 03414e57ad9875d0c8bfa5a4a65813cb2157372e (diff) | |
parent | 16a45bc82e61891daec1ffcd057679bdf962aeb8 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/usba-2.6.26 into base
Diffstat (limited to 'arch')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 7678fee9a885..cb47afc9fffc 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/platform_device.h> | 11 | #include <linux/platform_device.h> |
12 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
13 | #include <linux/spi/spi.h> | 13 | #include <linux/spi/spi.h> |
14 | #include <linux/usb/atmel_usba_udc.h> | ||
14 | 15 | ||
15 | #include <asm/io.h> | 16 | #include <asm/io.h> |
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
@@ -1351,9 +1352,39 @@ static struct clk usba0_hclk = { | |||
1351 | .index = 6, | 1352 | .index = 6, |
1352 | }; | 1353 | }; |
1353 | 1354 | ||
1355 | #define EP(nam, idx, maxpkt, maxbk, dma, isoc) \ | ||
1356 | [idx] = { \ | ||
1357 | .name = nam, \ | ||
1358 | .index = idx, \ | ||
1359 | .fifo_size = maxpkt, \ | ||
1360 | .nr_banks = maxbk, \ | ||
1361 | .can_dma = dma, \ | ||
1362 | .can_isoc = isoc, \ | ||
1363 | } | ||
1364 | |||
1365 | static struct usba_ep_data at32_usba_ep[] __initdata = { | ||
1366 | EP("ep0", 0, 64, 1, 0, 0), | ||
1367 | EP("ep1", 1, 512, 2, 1, 1), | ||
1368 | EP("ep2", 2, 512, 2, 1, 1), | ||
1369 | EP("ep3-int", 3, 64, 3, 1, 0), | ||
1370 | EP("ep4-int", 4, 64, 3, 1, 0), | ||
1371 | EP("ep5", 5, 1024, 3, 1, 1), | ||
1372 | EP("ep6", 6, 1024, 3, 1, 1), | ||
1373 | }; | ||
1374 | |||
1375 | #undef EP | ||
1376 | |||
1354 | struct platform_device *__init | 1377 | struct platform_device *__init |
1355 | at32_add_device_usba(unsigned int id, struct usba_platform_data *data) | 1378 | at32_add_device_usba(unsigned int id, struct usba_platform_data *data) |
1356 | { | 1379 | { |
1380 | /* | ||
1381 | * pdata doesn't have room for any endpoints, so we need to | ||
1382 | * append room for the ones we need right after it. | ||
1383 | */ | ||
1384 | struct { | ||
1385 | struct usba_platform_data pdata; | ||
1386 | struct usba_ep_data ep[7]; | ||
1387 | } usba_data; | ||
1357 | struct platform_device *pdev; | 1388 | struct platform_device *pdev; |
1358 | 1389 | ||
1359 | if (id != 0) | 1390 | if (id != 0) |
@@ -1367,13 +1398,20 @@ at32_add_device_usba(unsigned int id, struct usba_platform_data *data) | |||
1367 | ARRAY_SIZE(usba0_resource))) | 1398 | ARRAY_SIZE(usba0_resource))) |
1368 | goto out_free_pdev; | 1399 | goto out_free_pdev; |
1369 | 1400 | ||
1370 | if (data) { | 1401 | if (data) |
1371 | if (platform_device_add_data(pdev, data, sizeof(*data))) | 1402 | usba_data.pdata.vbus_pin = data->vbus_pin; |
1372 | goto out_free_pdev; | 1403 | else |
1404 | usba_data.pdata.vbus_pin = -EINVAL; | ||
1373 | 1405 | ||
1374 | if (data->vbus_pin != GPIO_PIN_NONE) | 1406 | data = &usba_data.pdata; |
1375 | at32_select_gpio(data->vbus_pin, 0); | 1407 | data->num_ep = ARRAY_SIZE(at32_usba_ep); |
1376 | } | 1408 | memcpy(data->ep, at32_usba_ep, sizeof(at32_usba_ep)); |
1409 | |||
1410 | if (platform_device_add_data(pdev, data, sizeof(usba_data))) | ||
1411 | goto out_free_pdev; | ||
1412 | |||
1413 | if (data->vbus_pin >= 0) | ||
1414 | at32_select_gpio(data->vbus_pin, 0); | ||
1377 | 1415 | ||
1378 | usba0_pclk.dev = &pdev->dev; | 1416 | usba0_pclk.dev = &pdev->dev; |
1379 | usba0_hclk.dev = &pdev->dev; | 1417 | usba0_hclk.dev = &pdev->dev; |