Adding usbphy node for Exynos5250 along with the platform data. Signed-off-by: Vivek Gautam <gautam.vivek@xxxxxxxxxxx> --- .../devicetree/bindings/usb/samsung-usbphy.txt | 12 ++++- arch/arm/boot/dts/exynos5250.dtsi | 5 ++ arch/arm/mach-exynos/Kconfig | 1 + arch/arm/mach-exynos/include/mach/map.h | 1 + arch/arm/mach-exynos/mach-exynos5-dt.c | 10 ++++ arch/arm/mach-exynos/setup-usb-phy.c | 45 ++++++++++++++++---- arch/arm/plat-samsung/include/plat/usb-phy.h | 3 +- 7 files changed, 66 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt index 7d54d59..35aaf91 100644 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt @@ -1,11 +1,19 @@ * Samsung's usb phy transceiver -The Samsung's phy transceiver is used for controlling usb otg phy for -s3c-hsotg usb device controller. +The Samsung's phy transceiver is used for controlling usb phy for +s3c-hsotg as well as s5p-ehci and exynos-ohci device controllers +across Samsung SOCs. TODO: Adding the PHY binding with controller(s) according to the under developement generic PHY driver. +Exynos4210: Required properties: - compatible : should be "samsung,exynos4210-usbphy" - reg : base physical address of the phy registers and length of memory mapped region. + +Exynos5250: +Required properties: +- compatible : should be "samsung,exynos5250-usbphy" +- reg : base physical address of the phy registers and length of memory mapped + region. diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index dddfd6e..82bf042 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -218,6 +218,11 @@ #size-cells = <0>; }; + usbphy { + compatible = "samsung,exynos5250-usbphy"; + reg = <0x12130000 0x100>; + }; + amba { #address-cells = <1>; #size-cells = <1>; diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 4372075..e8e3d7b 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -422,6 +422,7 @@ config MACH_EXYNOS5_DT select SOC_EXYNOS5250 select USE_OF select ARM_AMBA + select EXYNOS4_SETUP_USB_PHY help Machine support for Samsung EXYNOS5 machine with device tree enabled. Select this if a fdt blob is available for the EXYNOS5 SoC based board. diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 9694424..7f5eb03 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h @@ -195,6 +195,7 @@ #define EXYNOS4_PA_EHCI 0x12580000 #define EXYNOS4_PA_OHCI 0x12590000 #define EXYNOS4_PA_HSPHY 0x125B0000 +#define EXYNOS5_PA_HSPHY 0x12130000 #define EXYNOS4_PA_MFC 0x13400000 #define EXYNOS4_PA_UART 0x13800000 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index db1cd8e..6d9528a 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c @@ -11,6 +11,7 @@ #include <linux/of_platform.h> #include <linux/serial_core.h> +#include <linux/platform_data/samsung-usbphy.h> #include <asm/mach/arch.h> #include <asm/hardware/gic.h> @@ -18,9 +19,16 @@ #include <plat/cpu.h> #include <plat/regs-serial.h> +#include <plat/usb-phy.h> #include "common.h" +static struct samsung_usbphy_data exynos5_usbphy_pdata = { + .pmu_isolation = s5p_usb_phy_pmu_isolation, + .phy_cfg_sel = s5p_usb_phy_cfg_sel, + .type = TYPE_HOST, +}; + /* * The following lookup table is used to override device names when devices * are registered from device tree. This is temporarily added to enable @@ -72,6 +80,8 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { "exynos-gsc.2", NULL), OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3, "exynos-gsc.3", NULL), + OF_DEV_AUXDATA("samsung,exynos5250-usbphy", EXYNOS5_PA_HSPHY, + "s3c-usbphy", &exynos5_usbphy_pdata), {}, }; diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c index 1c62d20..039d246 100644 --- a/arch/arm/mach-exynos/setup-usb-phy.c +++ b/arch/arm/mach-exynos/setup-usb-phy.c @@ -14,10 +14,14 @@ #include <linux/err.h> #include <linux/io.h> #include <linux/platform_device.h> +#include <linux/platform_data/samsung-usbphy.h> #include <mach/regs-pmu.h> #include <mach/regs-usb-phy.h> #include <plat/cpu.h> #include <plat/usb-phy.h> +#include <plat/map-base.h> + +#define EXYNOS5_USB_CFG (S3C_VA_SYS + (0x230)) static atomic_t host_usage; @@ -222,15 +226,40 @@ int s5p_usb_phy_exit(struct platform_device *pdev, int type) return -EINVAL; } -void s5p_usb_phy_pmu_isolation(int on) +void s5p_usb_phy_pmu_isolation(int on, int type) { - if (on) { - writel(readl(S5P_USBDEVICE_PHY_CONTROL) - & ~S5P_USBDEVICE_PHY_ENABLE, - S5P_USBDEVICE_PHY_CONTROL); + if (type == TYPE_HOST) { + if (on) { + writel(readl(S5P_USBHOST_PHY_CONTROL) + & ~S5P_USBHOST_PHY_ENABLE, + S5P_USBHOST_PHY_CONTROL); + } else { + writel(readl(S5P_USBHOST_PHY_CONTROL) + | S5P_USBHOST_PHY_ENABLE, + S5P_USBHOST_PHY_CONTROL); + } } else { - writel(readl(S5P_USBDEVICE_PHY_CONTROL) - | S5P_USBDEVICE_PHY_ENABLE, - S5P_USBDEVICE_PHY_CONTROL); + if (on) { + writel(readl(S5P_USBDEVICE_PHY_CONTROL) + & ~S5P_USBDEVICE_PHY_ENABLE, + S5P_USBDEVICE_PHY_CONTROL); + } else { + writel(readl(S5P_USBDEVICE_PHY_CONTROL) + | S5P_USBDEVICE_PHY_ENABLE, + S5P_USBDEVICE_PHY_CONTROL); + } } } + +/* Switch between HOST or OTG link from PHY_CFG */ +void s5p_usb_phy_cfg_sel(struct device *dev, int type) +{ + u32 is_host; + + is_host = readl(EXYNOS5_USB_CFG); + writel(type, EXYNOS5_USB_CFG); + + if (is_host != type) + dev_dbg(dev, "Changed USB MUX from %s to %s", + is_host ? "Host" : "Device", type ? "Host" : "Device"); +} diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h b/arch/arm/plat-samsung/include/plat/usb-phy.h index 165ffe7..a57b8bb 100644 --- a/arch/arm/plat-samsung/include/plat/usb-phy.h +++ b/arch/arm/plat-samsung/include/plat/usb-phy.h @@ -18,6 +18,7 @@ enum s5p_usb_phy_type { extern int s5p_usb_phy_init(struct platform_device *pdev, int type); extern int s5p_usb_phy_exit(struct platform_device *pdev, int type); -extern void s5p_usb_phy_pmu_isolation(int on); +extern void s5p_usb_phy_pmu_isolation(int on, int type); +extern void s5p_usb_phy_cfg_sel(struct device *dev, int type); #endif /* __PLAT_SAMSUNG_USB_PHY_H */ -- 1.7.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html