resource: introduce add_usb_ehci_device to register echi device
pass the hccr and hcor register base via resource instroduce add_generic_usb_echi_device with hccr = base + 0x100 and hcor = base + 0x140 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
parent
06c36cf09e
commit
ee80cbcd61
|
@ -327,20 +327,6 @@ static int register_persistant_environment(void)
|
|||
return devfs_add_partition("disk0.1", 0, cdev->size, DEVFS_PARTITION_FIXED, "env0");
|
||||
}
|
||||
|
||||
static struct ehci_platform_data chumby_usb_pdata = {
|
||||
.flags = EHCI_HAS_TT,
|
||||
.hccr_offset = 0x100,
|
||||
.hcor_offset = 0x140,
|
||||
};
|
||||
|
||||
static struct device_d usb_dev = {
|
||||
.name = "ehci",
|
||||
.id = -1,
|
||||
.map_base = IMX_USB_BASE,
|
||||
.size = 0x200,
|
||||
.platform_data = &chumby_usb_pdata,
|
||||
};
|
||||
|
||||
#define GPIO_USB_HUB_RESET 29
|
||||
#define GPIO_USB_HUB_POWER 26
|
||||
|
||||
|
@ -353,7 +339,8 @@ static void falconwing_init_usb(void)
|
|||
gpio_direction_output(GPIO_USB_HUB_RESET, 1);
|
||||
|
||||
imx_usb_phy_enable();
|
||||
register_device(&usb_dev);
|
||||
|
||||
add_generic_usb_ehci_device(-1, IMX_USB_BASE, NULL);
|
||||
}
|
||||
|
||||
static int falconwing_devices_init(void)
|
||||
|
|
|
@ -149,12 +149,6 @@ static void imx25_usb_init(void)
|
|||
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
|
||||
}
|
||||
|
||||
static struct device_d usbh2_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE + 0x400,
|
||||
.size = 0x200,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct fsl_usb2_platform_data usb_pdata = {
|
||||
|
@ -284,7 +278,7 @@ static int eukrea_cpuimx25_devices_init(void)
|
|||
|
||||
#ifdef CONFIG_USB
|
||||
imx25_usb_init();
|
||||
register_device(&usbh2_dev);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
|
||||
#endif
|
||||
register_device(&usbotg_dev);
|
||||
|
||||
|
|
|
@ -117,13 +117,6 @@ static void imx35_usb_init(void)
|
|||
tmp = readl(IMX_OTG_BASE + 0x5a8);
|
||||
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
|
||||
}
|
||||
|
||||
static struct device_d usbh2_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE + 0x400,
|
||||
.size = 0x200,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_GADGET
|
||||
|
@ -183,7 +176,7 @@ static int eukrea_cpuimx35_devices_init(void)
|
|||
|
||||
#ifdef CONFIG_USB
|
||||
imx35_usb_init();
|
||||
register_device(&usbh2_dev);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
|
||||
#endif
|
||||
#ifdef CONFIG_USB_GADGET
|
||||
/* Workaround ENGcm09152 */
|
||||
|
|
|
@ -138,13 +138,6 @@ static void imx25_usb_init(void)
|
|||
tmp = readl(IMX_OTG_BASE + 0x5a8);
|
||||
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
|
||||
}
|
||||
|
||||
static struct device_d usbh2_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE + 0x400,
|
||||
.size = 0x200,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct i2c_board_info i2c_devices[] = {
|
||||
|
@ -208,7 +201,7 @@ static int imx25_devices_init(void)
|
|||
* the CPLD has to be initialized.
|
||||
*/
|
||||
imx25_usb_init();
|
||||
register_device(&usbh2_dev);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
|
||||
#endif
|
||||
|
||||
imx25_iim_register_fec_ethaddr();
|
||||
|
|
|
@ -114,14 +114,6 @@ static struct imx_fb_platform_data neso_fb_data = {
|
|||
};
|
||||
|
||||
#ifdef CONFIG_USB
|
||||
|
||||
static struct device_d usbh2_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE + 0x400,
|
||||
.size = 0x200,
|
||||
};
|
||||
|
||||
static void neso_usbh_init(void)
|
||||
{
|
||||
uint32_t temp;
|
||||
|
@ -304,7 +296,7 @@ static int neso_devices_init(void)
|
|||
|
||||
#ifdef CONFIG_USB
|
||||
neso_usbh_init();
|
||||
register_device(&usbh2_dev);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
|
||||
#endif
|
||||
|
||||
imx27_add_fec(&fec_info);
|
||||
|
|
|
@ -271,16 +271,6 @@ static struct omap_hcd omap_ehci_pdata = {
|
|||
|
||||
static struct ehci_platform_data ehci_pdata = {
|
||||
.flags = 0,
|
||||
.hccr_offset = 0x100,
|
||||
.hcor_offset = 0x110,
|
||||
};
|
||||
|
||||
static struct device_d usbh_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = 0x48064700,
|
||||
.size = 4 * 1024,
|
||||
.platform_data = &ehci_pdata,
|
||||
};
|
||||
#endif /* CONFIG_USB_EHCI_OMAP */
|
||||
|
||||
|
@ -318,7 +308,8 @@ static int beagle_devices_init(void)
|
|||
|
||||
#ifdef CONFIG_USB_EHCI_OMAP
|
||||
if (ehci_omap_init(&omap_ehci_pdata) >= 0)
|
||||
register_device(&usbh_dev);
|
||||
add_usb_ehci_device(-1, 0x48064700 + 0x100,
|
||||
0x48064700 + 0x110, &ehci_pdata);
|
||||
#endif /* CONFIG_USB_EHCI_OMAP */
|
||||
#ifdef CONFIG_GPMC
|
||||
/* WP is made high and WAIT1 active Low */
|
||||
|
|
|
@ -61,18 +61,9 @@ static int panda_mmu_init(void)
|
|||
device_initcall(panda_mmu_init);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_EHCI
|
||||
static struct ehci_platform_data ehci_pdata = {
|
||||
.flags = 0,
|
||||
.hccr_offset = 0x0,
|
||||
.hcor_offset = 0x10,
|
||||
};
|
||||
|
||||
static struct device_d usbh_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = 0x4a064c00,
|
||||
.size = 4 * 1024,
|
||||
.platform_data = &ehci_pdata,
|
||||
};
|
||||
|
||||
static void panda_ehci_init(void)
|
||||
|
@ -105,8 +96,13 @@ static void panda_ehci_init(void)
|
|||
/* enable power to hub */
|
||||
gpio_set_value(GPIO_HUB_POWER, 1);
|
||||
|
||||
register_device(&usbh_dev);
|
||||
add_usb_ehci_device(-1, 0x4a064c00,
|
||||
0x4a064c00 + 0x10, &ehci_pdata);
|
||||
}
|
||||
#else
|
||||
static void panda_ehci_init(void)
|
||||
{}
|
||||
#endif
|
||||
|
||||
static void __init panda_boardrev_init(void)
|
||||
{
|
||||
|
|
|
@ -58,20 +58,6 @@ struct imx_nand_platform_data nand_info = {
|
|||
};
|
||||
|
||||
#ifdef CONFIG_USB
|
||||
static struct device_d usbotg_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE,
|
||||
.size = 0x200,
|
||||
};
|
||||
|
||||
static struct device_d usbh2_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE + 0x400,
|
||||
.size = 0x200,
|
||||
};
|
||||
|
||||
static void pcm037_usb_init(void)
|
||||
{
|
||||
u32 tmp;
|
||||
|
@ -245,8 +231,8 @@ static int imx31_devices_init(void)
|
|||
#endif
|
||||
#ifdef CONFIG_USB
|
||||
pcm037_usb_init();
|
||||
register_device(&usbotg_dev);
|
||||
register_device(&usbh2_dev);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
|
||||
#endif
|
||||
|
||||
armlinux_set_bootparams((void *)0x80000100);
|
||||
|
|
|
@ -109,13 +109,6 @@ static struct imx_fb_platform_data pcm038_fb_data = {
|
|||
};
|
||||
|
||||
#ifdef CONFIG_USB
|
||||
static struct device_d usbh2_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE + 0x400,
|
||||
.size = 0x200,
|
||||
};
|
||||
|
||||
static void pcm038_usbh_init(void)
|
||||
{
|
||||
uint32_t temp;
|
||||
|
@ -271,7 +264,7 @@ static int pcm038_devices_init(void)
|
|||
|
||||
#ifdef CONFIG_USB
|
||||
pcm038_usbh_init();
|
||||
register_device(&usbh2_dev);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
|
||||
#endif
|
||||
|
||||
/* Register the fec device after the PLL re-initialisation
|
||||
|
|
|
@ -53,20 +53,6 @@ struct imx_nand_platform_data nand_info = {
|
|||
};
|
||||
|
||||
#ifdef CONFIG_USB
|
||||
static struct device_d usbotg_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE,
|
||||
.size = 0x200,
|
||||
};
|
||||
|
||||
static struct device_d usbh2_dev = {
|
||||
.id = -1,
|
||||
.name = "ehci",
|
||||
.map_base = IMX_OTG_BASE + 0x400,
|
||||
.size = 0x200,
|
||||
};
|
||||
|
||||
static void pca100_usb_register(void)
|
||||
{
|
||||
mdelay(10);
|
||||
|
@ -77,9 +63,9 @@ static void pca100_usb_register(void)
|
|||
mdelay(10);
|
||||
|
||||
isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1);
|
||||
register_device(&usbotg_dev);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
|
||||
isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
|
||||
register_device(&usbh2_dev);
|
||||
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -97,3 +97,24 @@ struct device_d *add_dm9000_device(int id, resource_size_t base,
|
|||
}
|
||||
EXPORT_SYMBOL(add_dm9000_device);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_EHCI
|
||||
struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
|
||||
resource_size_t hcor, void *pdata)
|
||||
{
|
||||
struct device_d *dev;
|
||||
|
||||
dev = alloc_device("ehci", id, pdata);
|
||||
dev->resource = xzalloc(sizeof(struct resource) * 2);
|
||||
dev->num_resources = 2;
|
||||
dev->resource[0].start = hccr;
|
||||
dev->resource[0].flags = IORESOURCE_MEM;
|
||||
dev->resource[1].start = hcor;
|
||||
dev->resource[1].flags = IORESOURCE_MEM;
|
||||
|
||||
register_device(dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
EXPORT_SYMBOL(add_usb_ehci_device);
|
||||
#endif
|
||||
|
|
|
@ -900,20 +900,22 @@ static int ehci_probe(struct device_d *dev)
|
|||
host = &ehci->host;
|
||||
dev->priv = ehci;
|
||||
|
||||
if (pdata) {
|
||||
/* default to EHCI_HAS_TT to not change behaviour of boards
|
||||
* without platform_data
|
||||
*/
|
||||
if (pdata)
|
||||
ehci->flags = pdata->flags;
|
||||
ehci->hccr = (void *)(dev->map_base + pdata->hccr_offset);
|
||||
ehci->hcor = (void *)(dev->map_base + pdata->hcor_offset);
|
||||
}
|
||||
else {
|
||||
/* default to EHCI_HAS_TT to not change behaviour of boards
|
||||
* with platform_data
|
||||
*/
|
||||
else
|
||||
ehci->flags = EHCI_HAS_TT;
|
||||
ehci->hccr = (void *)(dev->map_base + 0x100);
|
||||
ehci->hcor = (void *)(dev->map_base + 0x140);
|
||||
|
||||
if (dev->num_resources < 2) {
|
||||
printf("echi: need 2 resources base and data");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ehci->hccr = dev_request_mem_region(dev, 0);
|
||||
ehci->hcor = dev_request_mem_region(dev, 1);
|
||||
|
||||
host->init = ehci_init;
|
||||
host->submit_int_msg = submit_int_msg;
|
||||
host->submit_control_msg = submit_control_msg;
|
||||
|
|
|
@ -246,6 +246,23 @@ static inline struct device_d *add_dm9000_device(int id, resource_size_t base,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_EHCI
|
||||
struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
|
||||
resource_size_t hcor, void *pdata);
|
||||
#else
|
||||
static inline struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
|
||||
resource_size_t hcor, void *pdata)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline struct device_d *add_generic_usb_ehci_device(int id,
|
||||
resource_size_t base, void *pdata)
|
||||
{
|
||||
return add_usb_ehci_device(id, base + 0x100, base + 0x140, pdata);
|
||||
}
|
||||
|
||||
/* linear list over all available devices
|
||||
*/
|
||||
extern struct list_head device_list;
|
||||
|
|
Loading…
Reference in New Issue