Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22909
b: refs/heads/master
c: 4b10cfd
h: refs/heads/master
i:
  22907: 1cf70db
v: v3
  • Loading branch information
Kumar Gala authored and Paul Mackerras committed Feb 7, 2006
1 parent 2f382c9 commit e0a7180
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 158daa4cc827bda9f7206279a1dc55de2cb9c902
refs/heads/master: 4b10cfd40e3fa1c1663b9c9fa22260d41e669c6f
140 changes: 140 additions & 0 deletions trunk/arch/powerpc/sysdev/fsl_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,143 @@ static int __init mpc83xx_wdt_init(void)

arch_initcall(mpc83xx_wdt_init);
#endif

static enum fsl_usb2_phy_modes determine_usb_phy(char * phy_type)
{
if (!phy_type)
return FSL_USB2_PHY_NONE;
if (!strcasecmp(phy_type, "ulpi"))
return FSL_USB2_PHY_ULPI;
if (!strcasecmp(phy_type, "utmi"))
return FSL_USB2_PHY_UTMI;
if (!strcasecmp(phy_type, "utmi_wide"))
return FSL_USB2_PHY_UTMI_WIDE;
if (!strcasecmp(phy_type, "serial"))
return FSL_USB2_PHY_SERIAL;

return FSL_USB2_PHY_NONE;
}

static int __init fsl_usb_of_init(void)
{
struct device_node *np;
unsigned int i;
struct platform_device *usb_dev;
int ret;

for (np = NULL, i = 0;
(np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL;
i++) {
struct resource r[2];
struct fsl_usb2_platform_data usb_data;
unsigned char *prop = NULL;

memset(&r, 0, sizeof(r));
memset(&usb_data, 0, sizeof(usb_data));

ret = of_address_to_resource(np, 0, &r[0]);
if (ret)
goto err;

r[1].start = np->intrs[0].line;
r[1].end = np->intrs[0].line;
r[1].flags = IORESOURCE_IRQ;

usb_dev =
platform_device_register_simple("fsl-usb2-mph", i, r, 2);
if (IS_ERR(usb_dev)) {
ret = PTR_ERR(usb_dev);
goto err;
}

usb_dev->dev.coherent_dma_mask = 0xffffffffUL;
usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask;

usb_data.operating_mode = FSL_USB2_MPH_HOST;

prop = get_property(np, "port0", NULL);
if (prop)
usb_data.port_enables |= FSL_USB2_PORT0_ENABLED;

prop = get_property(np, "port1", NULL);
if (prop)
usb_data.port_enables |= FSL_USB2_PORT1_ENABLED;

prop = get_property(np, "phy_type", NULL);
usb_data.phy_mode = determine_usb_phy(prop);

ret =
platform_device_add_data(usb_dev, &usb_data,
sizeof(struct
fsl_usb2_platform_data));
if (ret)
goto unreg;
}

return 0;

unreg:
platform_device_unregister(usb_dev);
err:
return ret;
}

arch_initcall(fsl_usb_of_init);

static int __init fsl_usb_dr_of_init(void)
{
struct device_node *np;
unsigned int i;
struct platform_device *usb_dev;
int ret;

for (np = NULL, i = 0;
(np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL;
i++) {
struct resource r[2];
struct fsl_usb2_platform_data usb_data;
unsigned char *prop = NULL;

memset(&r, 0, sizeof(r));
memset(&usb_data, 0, sizeof(usb_data));

ret = of_address_to_resource(np, 0, &r[0]);
if (ret)
goto err;

r[1].start = np->intrs[0].line;
r[1].end = np->intrs[0].line;
r[1].flags = IORESOURCE_IRQ;

usb_dev =
platform_device_register_simple("fsl-usb2-dr", i, r, 2);
if (IS_ERR(usb_dev)) {
ret = PTR_ERR(usb_dev);
goto err;
}

usb_dev->dev.coherent_dma_mask = 0xffffffffUL;
usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask;

usb_data.operating_mode = FSL_USB2_DR_HOST;

prop = get_property(np, "phy_type", NULL);
usb_data.phy_mode = determine_usb_phy(prop);

ret =
platform_device_add_data(usb_dev, &usb_data,
sizeof(struct
fsl_usb2_platform_data));
if (ret)
goto unreg;
}

return 0;

unreg:
platform_device_unregister(usb_dev);
err:
return ret;
}

arch_initcall(fsl_usb_dr_of_init);

0 comments on commit e0a7180

Please sign in to comment.