Commit e1c25dc6 authored by Haavard Skinnemoen's avatar Haavard Skinnemoen

Merge branch 'master' of...

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/usba-2.6.26 into base
parents 03414e57 16a45bc8
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/usb/atmel_usba_udc.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
...@@ -1351,9 +1352,39 @@ static struct clk usba0_hclk = { ...@@ -1351,9 +1352,39 @@ static struct clk usba0_hclk = {
.index = 6, .index = 6,
}; };
#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
[idx] = { \
.name = nam, \
.index = idx, \
.fifo_size = maxpkt, \
.nr_banks = maxbk, \
.can_dma = dma, \
.can_isoc = isoc, \
}
static struct usba_ep_data at32_usba_ep[] __initdata = {
EP("ep0", 0, 64, 1, 0, 0),
EP("ep1", 1, 512, 2, 1, 1),
EP("ep2", 2, 512, 2, 1, 1),
EP("ep3-int", 3, 64, 3, 1, 0),
EP("ep4-int", 4, 64, 3, 1, 0),
EP("ep5", 5, 1024, 3, 1, 1),
EP("ep6", 6, 1024, 3, 1, 1),
};
#undef EP
struct platform_device *__init struct platform_device *__init
at32_add_device_usba(unsigned int id, struct usba_platform_data *data) at32_add_device_usba(unsigned int id, struct usba_platform_data *data)
{ {
/*
* pdata doesn't have room for any endpoints, so we need to
* append room for the ones we need right after it.
*/
struct {
struct usba_platform_data pdata;
struct usba_ep_data ep[7];
} usba_data;
struct platform_device *pdev; struct platform_device *pdev;
if (id != 0) if (id != 0)
...@@ -1367,13 +1398,20 @@ at32_add_device_usba(unsigned int id, struct usba_platform_data *data) ...@@ -1367,13 +1398,20 @@ at32_add_device_usba(unsigned int id, struct usba_platform_data *data)
ARRAY_SIZE(usba0_resource))) ARRAY_SIZE(usba0_resource)))
goto out_free_pdev; goto out_free_pdev;
if (data) { if (data)
if (platform_device_add_data(pdev, data, sizeof(*data))) usba_data.pdata.vbus_pin = data->vbus_pin;
else
usba_data.pdata.vbus_pin = -EINVAL;
data = &usba_data.pdata;
data->num_ep = ARRAY_SIZE(at32_usba_ep);
memcpy(data->ep, at32_usba_ep, sizeof(at32_usba_ep));
if (platform_device_add_data(pdev, data, sizeof(usba_data)))
goto out_free_pdev; goto out_free_pdev;
if (data->vbus_pin != GPIO_PIN_NONE) if (data->vbus_pin >= 0)
at32_select_gpio(data->vbus_pin, 0); at32_select_gpio(data->vbus_pin, 0);
}
usba0_pclk.dev = &pdev->dev; usba0_pclk.dev = &pdev->dev;
usba0_hclk.dev = &pdev->dev; usba0_hclk.dev = &pdev->dev;
......
...@@ -118,10 +118,10 @@ config USB_AMD5536UDC ...@@ -118,10 +118,10 @@ config USB_AMD5536UDC
config USB_GADGET_ATMEL_USBA config USB_GADGET_ATMEL_USBA
boolean "Atmel USBA" boolean "Atmel USBA"
select USB_GADGET_DUALSPEED select USB_GADGET_DUALSPEED
depends on AVR32 depends on AVR32 || ARCH_AT91CAP9
help help
USBA is the integrated high-speed USB Device controller on USBA is the integrated high-speed USB Device controller on
the AT32AP700x processors from Atmel. the AT32AP700x and AT91CAP9 processors from Atmel.
config USB_ATMEL_USBA config USB_ATMEL_USBA
tristate tristate
......
This diff is collapsed.
...@@ -41,6 +41,15 @@ ...@@ -41,6 +41,15 @@
#define USBA_EN_USBA (1 << 8) #define USBA_EN_USBA (1 << 8)
#define USBA_DETACH (1 << 9) #define USBA_DETACH (1 << 9)
#define USBA_REMOTE_WAKE_UP (1 << 10) #define USBA_REMOTE_WAKE_UP (1 << 10)
#define USBA_PULLD_DIS (1 << 11)
#if defined(CONFIG_AVR32)
#define USBA_ENABLE_MASK USBA_EN_USBA
#define USBA_DISABLE_MASK 0
#elif defined(CONFIG_ARCH_AT91)
#define USBA_ENABLE_MASK (USBA_EN_USBA | USBA_PULLD_DIS)
#define USBA_DISABLE_MASK USBA_DETACH
#endif /* CONFIG_ARCH_AT91 */
/* Bitfields in FNUM */ /* Bitfields in FNUM */
#define USBA_MICRO_FRAME_NUM_OFFSET 0 #define USBA_MICRO_FRAME_NUM_OFFSET 0
......
...@@ -38,9 +38,7 @@ struct platform_device * ...@@ -38,9 +38,7 @@ struct platform_device *
at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
unsigned long fbmem_start, unsigned long fbmem_len); unsigned long fbmem_start, unsigned long fbmem_len);
struct usba_platform_data { struct usba_platform_data;
int vbus_pin;
};
struct platform_device * struct platform_device *
at32_add_device_usba(unsigned int id, struct usba_platform_data *data); at32_add_device_usba(unsigned int id, struct usba_platform_data *data);
......
/*
* Platform data definitions for Atmel USBA gadget driver.
*/
#ifndef __LINUX_USB_USBA_H
#define __LINUX_USB_USBA_H
struct usba_ep_data {
char *name;
int index;
int fifo_size;
int nr_banks;
int can_dma;
int can_isoc;
};
struct usba_platform_data {
int vbus_pin;
int num_ep;
struct usba_ep_data ep[0];
};
#endif /* __LINUX_USB_USBA_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment