diff options
author | Vivek Gautam <gautam.vivek@samsung.com> | 2013-03-12 19:14:15 +0530 |
---|---|---|
committer | Andrey Konovalov <andrey.konovalov@linaro.org> | 2014-02-28 17:30:57 +0400 |
commit | 4ec68fbc989f431b96b381984bc9669c7c9906d3 (patch) | |
tree | d5aa39c96b9b834b1d1e03c985c1b911885eb652 | |
parent | 582c574a05204170a1302537f12aed4250bdaa81 (diff) |
usb: phy: samsung: Add provision for channel numbers for usb-phy
Multiple USB-PHY controllers shall be identofied by their aliases,
thereby making it possible to use the alias numbers as channel numbers
for USB 3.0 PHY controllers.
Based on this corresponding PHYs can be powered.
This patch also updates binding documentation samsung-usbphy for alias
numbers.
BUG=chrome-os-partner:19007
TEST=build and boot on smdk5420 and peach pit;
tested usb HID devices and mass storage devices on
USB 2.0 and USB 3.0 ports.
Change-Id: I0afdd1edd0093957d361f7f926c6b4526664e121
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/56398
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Julius Werner <jwerner@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
-rw-r--r-- | Documentation/devicetree/bindings/usb/samsung-usbphy.txt | 5 | ||||
-rw-r--r-- | drivers/usb/phy/phy-samsung-usb.c | 31 | ||||
-rw-r--r-- | drivers/usb/phy/phy-samsung-usb.h | 2 |
3 files changed, 28 insertions, 10 deletions
diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt index cd846219db0a..44b8d1a24064 100644 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt @@ -115,6 +115,11 @@ Optional properties: USBDEVICE_PHY_CONTROL and USBHOST_PHY_CONTROL registers in exynos4x). and so on. +- Aliases: exynos5420 has multiple usb 3.0 phy transceivers interacting with multiple + dwc3 controllers. So the usb 3.0 phy controller nodes should be represented + in the aliases node using the following format: + 'usb3phy{n}' where n is a unique number for the alias. + Example: usbphy@12100000 { compatible = "samsung,exynos5250-usb3phy"; diff --git a/drivers/usb/phy/phy-samsung-usb.c b/drivers/usb/phy/phy-samsung-usb.c index aa396420818b..75314620498b 100644 --- a/drivers/usb/phy/phy-samsung-usb.c +++ b/drivers/usb/phy/phy-samsung-usb.c @@ -34,9 +34,15 @@ int samsung_usbphy_parse_dt(struct samsung_usbphy *sphy) { struct device_node *usbphy_sys; + struct device_node *node = sphy->dev->of_node; + + /* Get the Channel number in case of multiple PHY controllers */ + sphy->channel = of_alias_get_id(node, "usb3phy"); + if (sphy->channel < 0) + dev_info(sphy->dev, "Not a multi controller PHY\n"); /* Getting node for system controller interface for usb-phy */ - usbphy_sys = of_get_child_by_name(sphy->dev->of_node, "usbphy-sys"); + usbphy_sys = of_get_child_by_name(node, "usbphy-sys"); if (!usbphy_sys) { dev_err(sphy->dev, "No sys-controller interface for usb-phy\n"); return -ENODEV; @@ -85,21 +91,26 @@ void samsung_usbphy_set_isolation_4210(struct samsung_usbphy *sphy, bool on) } if (sphy->phy_type == USB_PHY_TYPE_DEVICE) { - reg = sphy->pmuregs + sphy->drv_data->dev0_phy_reg_offset; + if (sphy->channel == 1) + reg = sphy->pmuregs + + sphy->drv_data->dev1_phy_reg_offset; + else + reg = sphy->pmuregs + + sphy->drv_data->dev0_phy_reg_offset; en_mask = sphy->drv_data->devphy_en_mask; } else if (sphy->phy_type == USB_PHY_TYPE_HOST) { reg = sphy->pmuregs + sphy->drv_data->hostphy_reg_offset; en_mask = sphy->drv_data->hostphy_en_mask; } - reg_val = readl(reg); - - if (on) - reg_val &= ~en_mask; - else - reg_val |= en_mask; - - writel(reg_val, reg); + if (reg) { + reg_val = readl(reg); + if (on) + reg_val &= ~en_mask; + else + reg_val |= en_mask; + writel(reg_val, reg); + } if (sphy->drv_data->cpu_type == TYPE_EXYNOS4X12) { writel(reg_val, sphy->pmuregs + EXYNOS4X12_PHY_HSIC_CTRL0); diff --git a/drivers/usb/phy/phy-samsung-usb.h b/drivers/usb/phy/phy-samsung-usb.h index af065b9e1eff..8d191b874ff4 100644 --- a/drivers/usb/phy/phy-samsung-usb.h +++ b/drivers/usb/phy/phy-samsung-usb.h @@ -309,6 +309,7 @@ struct samsung_usbphy_drvdata { * #DEVICE * @phy_usage: usage count for phy * @lock: lock for phy operations + * @channel: Channel number of controller in multi controller scenerio. */ struct samsung_usbphy { struct usb_phy phy; @@ -323,6 +324,7 @@ struct samsung_usbphy { enum samsung_usb_phy_type phy_type; atomic_t phy_usage; spinlock_t lock; + int channel; }; #define phy_to_sphy(x) container_of((x), struct samsung_usbphy, phy) |