Skip to content

Commit

Permalink
phy: sun4i: add support for USB phy0
Browse files Browse the repository at this point in the history
The driver for sun4i USB phys currently supports
only phy1 and phy2 which are used for USB host
controllers. This patch adds support for USB phy0,
which is used by the musb hdrc USB controller.

Signed-off-by: Roman Byshko <[email protected]>
Acked-by: Maxime Ripard <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
  • Loading branch information
rbyshko authored and kishon committed Nov 13, 2014
1 parent 491e049 commit 6827a46
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/phy/phy-sun4i-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ static int sun4i_usb_phy_init(struct phy *_phy)
return ret;
}

/* Enable USB 45 Ohm resistor calibration */
if (phy->index == 0)
sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, 0x01, 1);

/* Adjust PHY's magnitude and rate */
sun4i_usb_phy_write(phy, PHY_TX_AMPLITUDE_TUNE, 0x14, 5);

Expand Down Expand Up @@ -213,7 +217,7 @@ static struct phy *sun4i_usb_phy_xlate(struct device *dev,
{
struct sun4i_usb_phy_data *data = dev_get_drvdata(dev);

if (WARN_ON(args->args[0] == 0 || args->args[0] >= data->num_phys))
if (args->args[0] >= data->num_phys)
return ERR_PTR(-ENODEV);

return data->phys[args->args[0]].phy;
Expand Down Expand Up @@ -255,8 +259,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
if (IS_ERR(data->base))
return PTR_ERR(data->base);

/* Skip 0, 0 is the phy for otg which is not yet supported. */
for (i = 1; i < data->num_phys; i++) {
for (i = 0; i < data->num_phys; i++) {
struct sun4i_usb_phy *phy = data->phys + i;
char name[16];

Expand Down

0 comments on commit 6827a46

Please sign in to comment.