[PATCH 0/8] EXYNOS5: USB: Add USB 2.0 and USB 3.0 support for exynos5

2012-07-18 Thread Vivek Gautam
This patchset adds arch support for USB 2.0(EHCI and OHCI)
and USB 3.0(DWC3) on exynos5.

Below patch modifies few functions to enable supporting
exynos5 later.
EXYNOS4: USB: Generalising setup-usb-phy driver for exynos

Based and tested on 'for-next' branch.

Ajay Kumar (2):
  ARM: EXYNOS5: Add machine data for USB 2.0
  ARM: EXYNOS5: Add OHCI device from device tree

Vivek Gautam (6):
  EXYNOS4: USB: Generalising setup-usb-phy driver for exynos
  ARM: EXYNOS5: Add EHCI device from device tree
  ARM: EXYNOS5: Add PHY initialization code for usb 2.0
  ARM: EXYNOS5: Add machine data for USB3.0
  ARM: EXYNOS5: Add XHCI device from device tree
  ARM: EXYNOS5: Add PHY initialization code for usb 3.0

 .../devicetree/bindings/usb/exynos-usb.txt |   60 +++
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +
 arch/arm/boot/dts/exynos5250.dtsi  |   18 +
 arch/arm/mach-exynos/Kconfig   |1 +
 arch/arm/mach-exynos/clock-exynos5.c   |   24 ++
 arch/arm/mach-exynos/common.c  |   10 +
 arch/arm/mach-exynos/include/mach/map.h|3 +
 arch/arm/mach-exynos/include/mach/regs-pmu.h   |4 +
 arch/arm/mach-exynos/include/mach/regs-usb-phy.h   |   86 
 arch/arm/mach-exynos/mach-exynos5-dt.c |   26 ++
 arch/arm/mach-exynos/setup-usb-phy.c   |  413 ++--
 arch/arm/plat-samsung/include/plat/map-s5p.h   |2 +
 .../include/plat/regs-usb3-exynos-drd-phy.h|   75 
 arch/arm/plat-samsung/include/plat/usb-phy.h   |1 +
 drivers/usb/Kconfig|1 +
 15 files changed, 695 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt
 create mode 100644 
arch/arm/plat-samsung/include/plat/regs-usb3-exynos-drd-phy.h

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/8] EXYNOS4: USB: Generalising setup-usb-phy driver for exynos

2012-07-18 Thread Vivek Gautam
This patch updates the setup-usb-phy in order to accomodate
exynos5 support later.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index b81cc56..bfc1367 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -26,10 +26,31 @@ static int exynos4_usb_host_phy_is_on(void)
return (readl(EXYNOS4_PHYPWR)  PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1;
 }
 
-static void exynos4210_usb_phy_clkset(struct platform_device *pdev)
+struct clk *exynos_usb_clock_enable(struct platform_device *pdev)
+{
+   struct clk *usb_clk = NULL;
+   int err = 0;
+
+   if (!usb_clk) {
+   usb_clk = clk_get(pdev-dev, otg);
+   if (IS_ERR(usb_clk)) {
+   dev_err(pdev-dev, Failed to get otg clock\n);
+   return NULL;
+   }
+
+   err = clk_enable(usb_clk);
+   if (err) {
+   clk_put(usb_clk);
+   return NULL;
+   }
+   }
+   return usb_clk;
+}
+
+static int exynos4210_usb_phy_clkset(struct platform_device *pdev)
 {
struct clk *xusbxti_clk;
-   u32 phyclk;
+   u32 phyclk = 0;
 
xusbxti_clk = clk_get(pdev-dev, xusbxti);
if (xusbxti_clk  !IS_ERR(xusbxti_clk)) {
@@ -80,6 +101,7 @@ static void exynos4210_usb_phy_clkset(struct platform_device 
*pdev)
}
clk_put(xusbxti_clk);
}
+   return phyclk;
 }
 
 static int exynos4210_usb_phy0_init(struct platform_device *pdev)
@@ -120,21 +142,12 @@ static int exynos4210_usb_phy1_init(struct 
platform_device *pdev)
 {
struct clk *otg_clk;
u32 rstcon;
-   int err;
 
atomic_inc(host_usage);
 
-   otg_clk = clk_get(pdev-dev, otg);
-   if (IS_ERR(otg_clk)) {
-   dev_err(pdev-dev, Failed to get otg clock\n);
-   return PTR_ERR(otg_clk);
-   }
-
-   err = clk_enable(otg_clk);
-   if (err) {
-   clk_put(otg_clk);
-   return err;
-   }
+   otg_clk = exynos_usb_clock_enable(pdev);
+   if (otg_clk == NULL)
+   dev_err(pdev-dev, Failed to enable otg clock\n);
 
if (exynos4_usb_host_phy_is_on())
return 0;
@@ -173,22 +186,13 @@ static int exynos4210_usb_phy1_init(struct 
platform_device *pdev)
 static int exynos4210_usb_phy1_exit(struct platform_device *pdev)
 {
struct clk *otg_clk;
-   int err;
 
if (atomic_dec_return(host_usage)  0)
return 0;
 
-   otg_clk = clk_get(pdev-dev, otg);
-   if (IS_ERR(otg_clk)) {
-   dev_err(pdev-dev, Failed to get otg clock\n);
-   return PTR_ERR(otg_clk);
-   }
-
-   err = clk_enable(otg_clk);
-   if (err) {
-   clk_put(otg_clk);
-   return err;
-   }
+   otg_clk = exynos_usb_clock_enable(pdev);
+   if (otg_clk == NULL)
+   dev_err(pdev-dev, Failed to enable otg clock\n);
 
writel((readl(EXYNOS4_PHYPWR) | PHY1_STD_ANALOG_POWERDOWN),
EXYNOS4_PHYPWR);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] ARM: EXYNOS5: Add machine data for USB 2.0

2012-07-18 Thread Vivek Gautam
From: Ajay Kumar ajaykumar...@samsung.com

This patch adds address mapping of USB 2.0 PHY for exynos5

Signed-off-by: Banajit Goswami banaji...@samsung.com
Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 4eb39cd..92d5e61 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -275,6 +275,11 @@ static struct map_desc exynos5_iodesc[] __initdata = {
.pfn= __phys_to_pfn(EXYNOS5_PA_GIC_DIST),
.length = SZ_4K,
.type   = MT_DEVICE,
+   }, {
+   .virtual= (unsigned long)S3C_VA_USB_HSPHY,
+   .pfn= __phys_to_pfn(EXYNOS5_PA_USB_PHY),
+   .length = SZ_4K,
+   .type   = MT_DEVICE,
},
 };
 
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index c72b675..331ae57 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -192,6 +192,8 @@
 #define EXYNOS4_PA_UART0x1380
 #define EXYNOS5_PA_UART0x12C0
 
+#define EXYNOS5_PA_USB_PHY 0x1213
+
 #define EXYNOS4_PA_VP  0x12C0
 #define EXYNOS4_PA_MIXER   0x12C1
 #define EXYNOS4_PA_SDO 0x12C2
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] ARM: EXYNOS5: Add OHCI device from device tree

2012-07-18 Thread Vivek Gautam
From: Ajay Kumar ajaykumar...@samsung.com

This patch adds OHCI device from device tree for exynos5
and adds platform data.

Signed-off-by: Banajit Goswami banaji...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
new file mode 100644
index 000..63b80b9
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -0,0 +1,19 @@
+Samsung Exynos SoC USB controller
+
+The device node for USB controller for Samsung SOC have
+following properties
+
+OHCI
+Required properties:
+ - compatible: should be samsung,exynos-ohci for USB 2.0
+   OHCI companion controller in host mode.
+ - reg: physical base address of the controller and length
+   of memory mapped.
+ - interrupts: interrupt number to the cpu.
+
+ohci {
+   compatible = samsung,exynos-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+};
+
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index a3a2eb2..3c73d15 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -58,6 +58,12 @@
interrupts = 0 42 0;
};
 
+   ohci {
+   compatible = samsung,exynos-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+   };
+
rtc {
compatible = samsung,s3c6410-rtc;
reg = 0x101E 0x100;
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index ef770bc..39a4b34 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -15,12 +15,19 @@
 #include asm/mach/arch.h
 #include asm/hardware/gic.h
 #include mach/map.h
+#include mach/ohci.h
 
 #include plat/cpu.h
 #include plat/regs-serial.h
+#include plat/usb-phy.h
 
 #include common.h
 
+static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
+   .phy_init = s5p_usb_phy_init,
+   .phy_exit = s5p_usb_phy_exit,
+};
+
 /*
  * The following lookup table is used to override device names when devices
  * are registered from device tree. This is temporarily added to enable
@@ -56,6 +63,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA(arm,pl330, EXYNOS5_PA_PDMA0, dma-pl330.0, NULL),
OF_DEV_AUXDATA(arm,pl330, EXYNOS5_PA_PDMA1, dma-pl330.1, NULL),
OF_DEV_AUXDATA(arm,pl330, EXYNOS5_PA_MDMA1, dma-pl330.2, NULL),
+   OF_DEV_AUXDATA(samsung,exynos-ohci, 0x1212,
+   exynos-ohci, smdk5250_ohci_pdata),
{},
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/8] ARM: EXYNOS5: Add EHCI device from device tree

2012-07-18 Thread Vivek Gautam
This patch adds EHCI device from device tree for exynos5
and adds platform data.

Signed-off-by: Banajit Goswami banaji...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index 63b80b9..45dadca 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -17,3 +17,25 @@ ohci {
interrupts = 0 71 0;
 };
 
+EHCI
+Required properties:
+ - compatible: should be samsung,exynos-ehci for USB 2.0
+   EHCI controller in host mode.
+ - reg: physical base address of the controller and length
+   of memory mapped.
+ - interrupts: interrupt number to the cpu.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO
+   that needs to be pulled up for the bus to be powered.
+
+ehci {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+};
+
+ehci {
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+};
+
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 8a5e348..bf18286 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -109,4 +109,8 @@
spi_2: spi@12d4 {
status = disabled;
};
+
+   ehci {
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 3c73d15..988f52a 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -64,6 +64,12 @@
interrupts = 0 71 0;
};
 
+   ehci {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   };
+
rtc {
compatible = samsung,s3c6410-rtc;
reg = 0x101E 0x100;
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 39a4b34..0cc626e 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -20,6 +20,7 @@
 #include plat/cpu.h
 #include plat/regs-serial.h
 #include plat/usb-phy.h
+#include plat/ehci.h
 
 #include common.h
 
@@ -28,6 +29,11 @@ static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
.phy_exit = s5p_usb_phy_exit,
 };
 
+static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
+   .phy_init = s5p_usb_phy_init,
+   .phy_exit = s5p_usb_phy_exit,
+};
+
 /*
  * The following lookup table is used to override device names when devices
  * are registered from device tree. This is temporarily added to enable
@@ -65,6 +71,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA(arm,pl330, EXYNOS5_PA_MDMA1, dma-pl330.2, NULL),
OF_DEV_AUXDATA(samsung,exynos-ohci, 0x1212,
exynos-ohci, smdk5250_ohci_pdata),
+   OF_DEV_AUXDATA(samsung,exynos-ehci, 0x1211,
+   s5p-ehci, smdk5250_ehci_pdata),
{},
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] ARM: EXYNOS5: Add PHY initialization code for usb 2.0

2012-07-18 Thread Vivek Gautam
This patch adds PHY setup functions usb 2.0 support on exynos5

Signed-off-by: Yulgon Kim yulgon@samsung.com
Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index e698ca0..e0bc441 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -416,6 +416,7 @@ config MACH_EXYNOS5_DT
select SOC_EXYNOS5250
select USE_OF
select ARM_AMBA
+   select EXYNOS4_SETUP_USB_PHY
help
  Machine support for Samsung Exynos4 machine with device tree enabled.
  Select this if a fdt blob is available for the EXYNOS4 SoC based 
board.
diff --git a/arch/arm/mach-exynos/include/mach/regs-usb-phy.h 
b/arch/arm/mach-exynos/include/mach/regs-usb-phy.h
index 0727773..2df4bd7 100644
--- a/arch/arm/mach-exynos/include/mach/regs-usb-phy.h
+++ b/arch/arm/mach-exynos/include/mach/regs-usb-phy.h
@@ -13,6 +13,7 @@
 
 #define EXYNOS4_HSOTG_PHYREG(x)((x) + S3C_VA_USB_HSPHY)
 
+/* Exynos 4 */
 #define EXYNOS4_PHYPWR EXYNOS4_HSOTG_PHYREG(0x00)
 #define PHY1_HSIC_NORMAL_MASK  (0xf  9)
 #define PHY1_HSIC1_SLEEP   (1  12)
@@ -71,4 +72,89 @@
 #define EXYNOS4_PHY1CONEXYNOS4_HSOTG_PHYREG(0x34)
 #define FPENABLEN  (1  0)
 
+/* Exynos 5 */
+#define EXYNOS5_PHY_HOST_CTRL0 EXYNOS4_HSOTG_PHYREG(0x00)
+#define HOST_CTRL0_PHYSWRSTALL (0x1  31)
+
+#define HOST_CTRL0_REFCLKSEL_XTAL  (0x0)
+#define HOST_CTRL0_REFCLKSEL_EXTL  (0x1)
+#define HOST_CTRL0_REFCLKSEL_CLK_CORE  (0x2)
+#define HOST_CTRL0_REFCLKSEL_MASK  (0x3)
+#define HOST_CTRL0_REFCLKSEL_SHIFT (19)
+
+#define EXYNOS5_CLKSEL_50M (0x7)
+#define EXYNOS5_CLKSEL_24M (0x5)
+#define EXYNOS5_CLKSEL_20M (0x4)
+#define EXYNOS5_CLKSEL_19200K  (0x3)
+#define EXYNOS5_CLKSEL_12M (0x2)
+#define EXYNOS5_CLKSEL_10M (0x1)
+#define EXYNOS5_CLKSEL_9600K   (0x0)
+#define HOST_CTRL0_FSEL_MASK   (0x7  16)
+#define HOST_CTRL0_CLKSEL_SHIFT(16)
+
+#define HOST_CTRL0_COMMONON_N  (0x1  9)
+#define HOST_CTRL0_SIDDQ   (0x1  6)
+#define HOST_CTRL0_FORCESLEEP  (0x1  5)
+#define HOST_CTRL0_FORCESUSPEND(0x1  4)
+#define HOST_CTRL0_WORDINTERFACE   (0x1  3)
+#define HOST_CTRL0_UTMISWRST   (0x1  2)
+#define HOST_CTRL0_LINKSWRST   (0x1  1)
+#define HOST_CTRL0_PHYSWRST(0x1  0)
+
+#define EXYNOS5_PHY_HOST_TUNE0 EXYNOS4_HSOTG_PHYREG(0x04)
+#define EXYNOS5_PHY_HOST_TEST0 EXYNOS4_HSOTG_PHYREG(0x08)
+
+#define EXYNOS5_PHY_HSIC_CTRL1 EXYNOS4_HSOTG_PHYREG(0x10)
+#define EXYNOS5_PHY_HSIC_CTRL2 EXYNOS4_HSOTG_PHYREG(0x20)
+#define HSIC_CTRL_REFCLKSEL(0x2)
+#define HSIC_CTRL_REFCLKSEL_MASK   (0x3)
+#define HSIC_CTRL_REFCLKSEL_SHIFT  (23)
+
+#define HSIC_CTRL_REFCLKDIV_12 (0x24)
+#define HSIC_CTRL_REFCLKDIV_15 (0x1C)
+#define HSIC_CTRL_REFCLKDIV_16 (0x1A)
+#define HSIC_CTRL_REFCLKDIV_19_2   (0x15)
+#define HSIC_CTRL_REFCLKDIV_20 (0x14)
+#define HSIC_CTRL_REFCLKDIV_MASK   (0x7f)
+#define HSIC_CTRL_REFCLKDIV_SHIFT  (16)
+
+#define HSIC_CTRL_SIDDQ(0x1  6)
+#define HSIC_CTRL_FORCESLEEP   (0x1  5)
+#define HSIC_CTRL_FORCESUSPEND (0x1  4)
+#define HSIC_CTRL_WORDINTERFACE(0x1  3)
+#define HSIC_CTRL_UTMISWRST(0x1  2)
+#define HSIC_CTRL_PHYSWRST (0x1  0)
+
+#define EXYNOS5_PHY_HOST_EHCICTRL  EXYNOS4_HSOTG_PHYREG(0x30)
+#define EHCICTRL_ENAINCRXALIGN (0x1  29)
+#define EHCICTRL_ENAINCR4  (0x1  28)
+#define EHCICTRL_ENAINCR8  (0x1  27)
+#define EHCICTRL_ENAINCR16 (0x1  26)
+
+#define EXYNOS5_PHY_HOST_OHCICTRL  EXYNOS4_HSOTG_PHYREG(0x34)
+#define OHCICTRL_SUSPLGCY  (0x1  3)
+#define OHCICTRL_APPSTARTCLK   (0x1  2)
+#define OHCICTRL_CNTSEL(0x1  1)
+#define OHCICTRL_CLKCKTRST (0x1  0)
+
+#define EXYNOS5_PHY_OTG_SYSEXYNOS4_HSOTG_PHYREG(0x38)
+#define OTG_SYS_PHYLINK_SW_RESET   (0x1  14)
+#define OTG_SYS_LINK_SW_RST_UOTG   (0x1  13)
+#define OTG_SYS_PHY0_SW_RST(0x1  12)
+
+#define OTG_SYS_REF_CLK_SEL_XTAL   (0x0)
+#define OTG_SYS_REF_CLK_SEL_EXTL   (0x1)
+#define

[PATCH 6/8] ARM: EXYNOS5: Add machine data for USB3.0

2012-07-18 Thread Vivek Gautam
This patch adds clock definitions and address mapping of PHY
for USB3.0 in exynos5

Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

diff --git a/arch/arm/mach-exynos/clock-exynos5.c 
b/arch/arm/mach-exynos/clock-exynos5.c
index 774533c..af1b917 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -668,6 +668,11 @@ static struct clk exynos5_init_clocks_off[] = {
.enable = exynos5_clk_ip_fsys_ctrl ,
.ctrlbit= (1  18),
}, {
+   .name   = usbdrd30,
+   .parent = exynos5_clk_aclk_200.clk,
+   .enable = exynos5_clk_ip_fsys_ctrl,
+   .ctrlbit= (1  19),
+   }, {
.name   = usbotg,
.enable = exynos5_clk_ip_fsys_ctrl,
.ctrlbit= (1  7),
@@ -909,6 +914,16 @@ struct clksrc_sources exynos5_clkset_group = {
.nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
 };
 
+struct clk *exynos5_clkset_usbdrd30_list[] = {
+   [0] = exynos5_clk_mout_mpll.clk,
+   [1] = exynos5_clk_mout_cpll.clk,
+};
+
+struct clksrc_sources exynos5_clkset_usbdrd30 = {
+   .sources= exynos5_clkset_usbdrd30_list,
+   .nr_sources = ARRAY_SIZE(exynos5_clkset_usbdrd30_list),
+};
+
 /* Possible clock sources for aclk_266_gscl_sub Mux */
 static struct clk *clk_src_gscl_266_list[] = {
[0] = clk_ext_xtal_mux,
@@ -1199,6 +1214,15 @@ static struct clksrc_clk exynos5_clksrcs[] = {
.parent = exynos5_clk_mout_cpll.clk,
},
.reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 },
+   }, {
+   .clk= {
+   .name   = sclk_usbdrd30,
+   .enable = exynos5_clksrc_mask_fsys_ctrl,
+   .ctrlbit= (1  28),
+   },
+   .sources = exynos5_clkset_usbdrd30,
+   .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 28, .size = 1 
},
+   .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 24, .size = 
4 },
},
 };
 
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 92d5e61..c17f1df 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -280,6 +280,11 @@ static struct map_desc exynos5_iodesc[] __initdata = {
.pfn= __phys_to_pfn(EXYNOS5_PA_USB_PHY),
.length = SZ_4K,
.type   = MT_DEVICE,
+   }, {
+   .virtual= (unsigned long)S5P_VA_DRD_PHY,
+   .pfn= __phys_to_pfn(EXYNOS5_PA_DRD_PHY),
+   .length = SZ_4K,
+   .type   = MT_DEVICE,
},
 };
 
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 331ae57..b95b245 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -193,6 +193,7 @@
 #define EXYNOS5_PA_UART0x12C0
 
 #define EXYNOS5_PA_USB_PHY 0x1213
+#define EXYNOS5_PA_DRD_PHY 0x1210
 
 #define EXYNOS4_PA_VP  0x12C0
 #define EXYNOS4_PA_MIXER   0x12C1
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h 
b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index d4e392b..67132b4 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -39,6 +39,10 @@
 #define S5P_HDMI_PHY_CONTROL   S5P_PMUREG(0x0700)
 #define S5P_HDMI_PHY_ENABLE(1  0)
 
+/* only for EXYNOS5250*/
+#define S5P_USBDRD_PHY_CONTROL S5P_PMUREG(0x0704)
+#define S5P_USBDRD_PHY_ENABLE  (1  0)
+
 #define S5P_DAC_PHY_CONTROLS5P_PMUREG(0x070C)
 #define S5P_DAC_PHY_ENABLE (1  0)
 
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h 
b/arch/arm/plat-samsung/include/plat/map-s5p.h
index c2d7bda..836863a 100644
--- a/arch/arm/plat-samsung/include/plat/map-s5p.h
+++ b/arch/arm/plat-samsung/include/plat/map-s5p.h
@@ -40,6 +40,8 @@
 #define S5P_VA_GIC_CPU S3C_ADDR(0x0281)
 #define S5P_VA_GIC_DISTS3C_ADDR(0x0282)
 
+#define S5P_VA_DRD_PHY S3C_ADDR(0x0300)
+
 #define VA_VIC(x)  (S3C_VA_IRQ + ((x) * 0x1))
 #define VA_VIC0VA_VIC(0)
 #define VA_VIC1VA_VIC(1)
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index a7773a3..e9cbe34 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -53,6 +53,7 @@ config USB_ARCH_HAS_EHCI
 # some non-PCI HCDs implement xHCI
 config USB_ARCH_HAS_XHCI
boolean
+   default y if ARCH_EXYNOS5
default PCI
 
 menuconfig

[PATCH 7/8] ARM: EXYNOS5: Add XHCI device from device tree

2012-07-18 Thread Vivek Gautam
This patch adds EHCI device from device tree for exynos5
and adds platform data.

Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index 45dadca..b2349fe 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -39,3 +39,22 @@ ehci {
samsung,vbus-gpio = gpx2 6 1 3 3;
 };
 
+XHCI
+Required properties:
+ - compatible: should be samsung,exynos-xhci for USB 3.0
+   DWC3 controller in host mode.
+ - reg: physical base address of the controller and length
+   of memory mapped.
+ - interrupts: interrupt number to the cpu.
+ - samsung,vbus-gpio:  if present, specifies the GPIO
+   that needs to be pulled up for the bus to be powered.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO
+   that needs to be pulled up for the bus to be powered.
+
+xhci {
+   compatible = samsung,exynos-xhci;
+   reg = 0x1200 0x1;
+   interrupts = 0 72 0;
+};
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 988f52a..bc36584 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -70,6 +70,12 @@
interrupts = 0 71 0;
};
 
+   xhci {
+   compatible = samsung,exynos-xhci;
+   reg = 0x1200 0x1;
+   interrupts = 0 72 0;
+   };
+
rtc {
compatible = samsung,s3c6410-rtc;
reg = 0x101E 0x100;
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 0cc626e..fc1ed3f 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -10,6 +10,7 @@
 */
 
 #include linux/of_platform.h
+#include linux/platform_data/dwc3-exynos.h
 #include linux/serial_core.h
 
 #include asm/mach/arch.h
@@ -34,6 +35,12 @@ static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
.phy_exit = s5p_usb_phy_exit,
 };
 
+static struct dwc3_exynos_data smdk5250_xhci_pdata = {
+   .phy_type = S5P_USB_PHY_DRD,
+   .phy_init = s5p_usb_phy_init,
+   .phy_exit = s5p_usb_phy_exit,
+};
+
 /*
  * The following lookup table is used to override device names when devices
  * are registered from device tree. This is temporarily added to enable
@@ -73,6 +80,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
exynos-ohci, smdk5250_ohci_pdata),
OF_DEV_AUXDATA(samsung,exynos-ehci, 0x1211,
s5p-ehci, smdk5250_ehci_pdata),
+   OF_DEV_AUXDATA(samsung,exynos-xhci, 0x1200,
+   exynos-dwc3, smdk5250_xhci_pdata),
{},
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/8] ARM: EXYNOS5: Add PHY initialization code for usb 3.0

2012-07-18 Thread Vivek Gautam
This patch adds PHY setup functions for usb 3.0 support on exynos5

Signed-off-by: Yulgon Kim yulgon@samsung.com
Signed-off-by: Anton Tikhomirov av.tikhomi...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index 3f7a26a..f8f64c8 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -18,12 +18,14 @@
 #include mach/regs-usb-phy.h
 #include plat/cpu.h
 #include plat/usb-phy.h
+#include plat/regs-usb3-exynos-drd-phy.h
 
 #define PHY_ENABLE 1
 #define PHY_DISABLE0
 
 enum usb_phy_type {
USB_PHY = (0x1  0),
+   USB_PHY_DRD = (0x1  1),
 };
 
 static atomic_t host_usage;
@@ -163,11 +165,44 @@ static int exynos4210_usb_phy_clkset(struct 
platform_device *pdev)
return phyclk;
 }
 
+static u32 exynos_usb_phy30_set_clock(struct platform_device *pdev)
+{
+   u32 reg, refclk;
+
+   refclk = exynos4210_usb_phy_clkset(pdev);
+   reg = EXYNOS_USB3_PHYCLKRST_REFCLKSEL(3) |
+ EXYNOS_USB3_PHYCLKRST_FSEL(refclk);
+
+   switch (refclk) {
+   case EXYNOS5_CLKSEL_50M:
+   reg |= (EXYNOS_USB3_PHYCLKRST_MPLL_MULTIPLIER(0x02) |
+   EXYNOS_USB3_PHYCLKRST_SSC_REF_CLK_SEL(0x00));
+   break;
+   case EXYNOS5_CLKSEL_20M:
+   reg |= (EXYNOS_USB3_PHYCLKRST_MPLL_MULTIPLIER(0x7d) |
+   EXYNOS_USB3_PHYCLKRST_SSC_REF_CLK_SEL(0x00));
+   break;
+   case EXYNOS5_CLKSEL_19200K:
+   reg |= (EXYNOS_USB3_PHYCLKRST_MPLL_MULTIPLIER(0x02) |
+   EXYNOS_USB3_PHYCLKRST_SSC_REF_CLK_SEL(0x88));
+   break;
+   case EXYNOS5_CLKSEL_24M:
+   default:
+   reg |= (EXYNOS_USB3_PHYCLKRST_MPLL_MULTIPLIER(0x68) |
+   EXYNOS_USB3_PHYCLKRST_SSC_REF_CLK_SEL(0x88));
+   break;
+   }
+
+   return reg;
+}
+
 static void exynos_usb_phy_control(enum usb_phy_type phy_type , int on)
 {
if (soc_is_exynos5250()) {
if (phy_type  USB_PHY)
writel(on, S5P_USBHOST_PHY_CONTROL);
+   if (phy_type  USB_PHY_DRD)
+   writel(on, S5P_USBDRD_PHY_CONTROL);
}
 }
 
@@ -415,6 +450,88 @@ static int exynos5_usb_phy20_exit(struct platform_device 
*pdev)
return 0;
 }
 
+static int exynos5_usb_phy30_init(struct platform_device *pdev)
+{
+   struct clk *host_clk;
+   u32 reg;
+
+   host_clk = exynos_usb_clock_enable(pdev);
+   if (host_clk == NULL) {
+   dev_err(pdev-dev, Failed to enable USB3.0 host clock this 
time\n);
+   return -1;
+   }
+
+   exynos_usb_phy_control(USB_PHY_DRD, PHY_ENABLE);
+
+   /* Reset USB 3.0 PHY */
+   writel(0x, EXYNOS_USB3_PHYREG0);
+   writel(0x24d4e6e4, EXYNOS_USB3_PHYPARAM0);
+   writel(0x03fff81c, EXYNOS_USB3_PHYPARAM1);
+   writel(0x, EXYNOS_USB3_PHYRESUME);
+
+   writel(0x0840, EXYNOS_USB3_LINKSYSTEM);
+   writel(0x0004, EXYNOS_USB3_PHYBATCHG);
+
+   /* PHYTEST POWERDOWN Control */
+   reg = readl(EXYNOS_USB3_PHYTEST);
+   reg = ~(EXYNOS_USB3_PHYTEST_POWERDOWN_SSP |
+EXYNOS_USB3_PHYTEST_POWERDOWN_HSP);
+   writel(reg, EXYNOS_USB3_PHYTEST);
+
+   /* UTMI Power Control */
+   writel(EXYNOS_USB3_PHYUTMI_OTGDISABLE, EXYNOS_USB3_PHYUTMI);
+
+   reg = exynos_usb_phy30_set_clock(pdev);
+
+   reg |= (EXYNOS_USB3_PHYCLKRST_PORTRESET |
+   /* Digital power supply in normal operating mode */
+   EXYNOS_USB3_PHYCLKRST_RETENABLEN |
+   /* Enable ref clock for SS function */
+   EXYNOS_USB3_PHYCLKRST_REF_SSP_EN |
+   /* Enable spread spectrum */
+   EXYNOS_USB3_PHYCLKRST_SSC_EN) |
+   EXYNOS_USB3_PHYCLKRST_COMMONONN;
+   writel(reg, EXYNOS_USB3_PHYCLKRST);
+
+   udelay(10);
+
+   reg = ~(EXYNOS_USB3_PHYCLKRST_PORTRESET);
+   writel(reg, EXYNOS_USB3_PHYCLKRST);
+
+   clk_disable(host_clk);
+   clk_put(host_clk);
+   return 0;
+}
+
+static int exynos5_usb_phy30_exit(struct platform_device *pdev)
+{
+   struct clk *host_clk;
+   u32 reg;
+
+   host_clk = exynos_usb_clock_enable(pdev);
+   if (host_clk == NULL) {
+   dev_err(pdev-dev, Failed to enable USB3.0 host clock this 
time\n);
+   return -1;
+   }
+
+   reg = EXYNOS_USB3_PHYUTMI_OTGDISABLE |
+   EXYNOS_USB3_PHYUTMI_FORCESUSPEND |
+   EXYNOS_USB3_PHYUTMI_FORCESLEEP;
+   writel(reg, EXYNOS_USB3_PHYUTMI);
+
+   /* Control PHYTEST to remove leakage current */
+   reg = readl(EXYNOS_USB3_PHYTEST);
+   reg |= (EXYNOS_USB3_PHYTEST_POWERDOWN_SSP |
+EXYNOS_USB3_PHYTEST_POWERDOWN_HSP);
+   writel(reg, EXYNOS_USB3_PHYTEST);
+
+   exynos_usb_phy_control

[PATCH 2/8 v2] ARM: EXYNOS5: Add machine data for USB 2.0

2012-07-21 Thread Vivek Gautam
From: Ajay Kumar ajaykumar...@samsung.com

This patch adds address mapping of USB 2.0 PHY for exynos5

Signed-off-by: Ajay Kumar ajaykumar...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/mach-exynos/common.c   |5 +
 arch/arm/mach-exynos/include/mach/map.h |2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 4eb39cd..92d5e61 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -275,6 +275,11 @@ static struct map_desc exynos5_iodesc[] __initdata = {
.pfn= __phys_to_pfn(EXYNOS5_PA_GIC_DIST),
.length = SZ_4K,
.type   = MT_DEVICE,
+   }, {
+   .virtual= (unsigned long)S3C_VA_USB_HSPHY,
+   .pfn= __phys_to_pfn(EXYNOS5_PA_USB_PHY),
+   .length = SZ_4K,
+   .type   = MT_DEVICE,
},
 };
 
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index c72b675..331ae57 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -192,6 +192,8 @@
 #define EXYNOS4_PA_UART0x1380
 #define EXYNOS5_PA_UART0x12C0
 
+#define EXYNOS5_PA_USB_PHY 0x1213
+
 #define EXYNOS4_PA_VP  0x12C0
 #define EXYNOS4_PA_MIXER   0x12C1
 #define EXYNOS4_PA_SDO 0x12C2
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8 v2] ARM: EXYNOS5: Add OHCI device from device tree

2012-07-21 Thread Vivek Gautam
From: Ajay Kumar ajaykumar...@samsung.com

This patch adds OHCI device from device tree for exynos5
and adds platform data.

Signed-off-by: Ajay Kumar ajaykumar...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   19 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 ++
 arch/arm/mach-exynos/mach-exynos5-dt.c |9 +
 3 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
new file mode 100644
index 000..63b80b9
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -0,0 +1,19 @@
+Samsung Exynos SoC USB controller
+
+The device node for USB controller for Samsung SOC have
+following properties
+
+OHCI
+Required properties:
+ - compatible: should be samsung,exynos-ohci for USB 2.0
+   OHCI companion controller in host mode.
+ - reg: physical base address of the controller and length
+   of memory mapped.
+ - interrupts: interrupt number to the cpu.
+
+ohci {
+   compatible = samsung,exynos-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+};
+
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index a3a2eb2..3c73d15 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -58,6 +58,12 @@
interrupts = 0 42 0;
};
 
+   ohci {
+   compatible = samsung,exynos-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+   };
+
rtc {
compatible = samsung,s3c6410-rtc;
reg = 0x101E 0x100;
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index ef770bc..39a4b34 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -15,12 +15,19 @@
 #include asm/mach/arch.h
 #include asm/hardware/gic.h
 #include mach/map.h
+#include mach/ohci.h
 
 #include plat/cpu.h
 #include plat/regs-serial.h
+#include plat/usb-phy.h
 
 #include common.h
 
+static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
+   .phy_init = s5p_usb_phy_init,
+   .phy_exit = s5p_usb_phy_exit,
+};
+
 /*
  * The following lookup table is used to override device names when devices
  * are registered from device tree. This is temporarily added to enable
@@ -56,6 +63,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA(arm,pl330, EXYNOS5_PA_PDMA0, dma-pl330.0, NULL),
OF_DEV_AUXDATA(arm,pl330, EXYNOS5_PA_PDMA1, dma-pl330.1, NULL),
OF_DEV_AUXDATA(arm,pl330, EXYNOS5_PA_MDMA1, dma-pl330.2, NULL),
+   OF_DEV_AUXDATA(samsung,exynos-ohci, 0x1212,
+   exynos-ohci, smdk5250_ohci_pdata),
{},
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/8 v2] ARM: EXYNOS5: Add EHCI device from device tree

2012-07-21 Thread Vivek Gautam
This patch adds EHCI device from device tree for exynos5
and adds platform data.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   22 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |8 +++
 4 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index 63b80b9..45dadca 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -17,3 +17,25 @@ ohci {
interrupts = 0 71 0;
 };
 
+EHCI
+Required properties:
+ - compatible: should be samsung,exynos-ehci for USB 2.0
+   EHCI controller in host mode.
+ - reg: physical base address of the controller and length
+   of memory mapped.
+ - interrupts: interrupt number to the cpu.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO
+   that needs to be pulled up for the bus to be powered.
+
+ehci {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+};
+
+ehci {
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+};
+
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 8a5e348..bf18286 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -109,4 +109,8 @@
spi_2: spi@12d4 {
status = disabled;
};
+
+   ehci {
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 3c73d15..988f52a 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -64,6 +64,12 @@
interrupts = 0 71 0;
};
 
+   ehci {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   };
+
rtc {
compatible = samsung,s3c6410-rtc;
reg = 0x101E 0x100;
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 39a4b34..0cc626e 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -20,6 +20,7 @@
 #include plat/cpu.h
 #include plat/regs-serial.h
 #include plat/usb-phy.h
+#include plat/ehci.h
 
 #include common.h
 
@@ -28,6 +29,11 @@ static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
.phy_exit = s5p_usb_phy_exit,
 };
 
+static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
+   .phy_init = s5p_usb_phy_init,
+   .phy_exit = s5p_usb_phy_exit,
+};
+
 /*
  * The following lookup table is used to override device names when devices
  * are registered from device tree. This is temporarily added to enable
@@ -65,6 +71,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA(arm,pl330, EXYNOS5_PA_MDMA1, dma-pl330.2, NULL),
OF_DEV_AUXDATA(samsung,exynos-ohci, 0x1212,
exynos-ohci, smdk5250_ohci_pdata),
+   OF_DEV_AUXDATA(samsung,exynos-ehci, 0x1211,
+   s5p-ehci, smdk5250_ehci_pdata),
{},
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8 v2] ARM: EXYNOS5: Add machine data for USB3.0

2012-07-21 Thread Vivek Gautam
This patch adds clock definitions and address mapping of PHY
for USB3.0 in exynos5

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/mach-exynos/clock-exynos5.c |   24 
 arch/arm/mach-exynos/common.c|5 +
 arch/arm/mach-exynos/include/mach/map.h  |1 +
 arch/arm/mach-exynos/include/mach/regs-pmu.h |4 
 arch/arm/plat-samsung/include/plat/map-s5p.h |2 ++
 drivers/usb/Kconfig  |1 +
 6 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/clock-exynos5.c 
b/arch/arm/mach-exynos/clock-exynos5.c
index 774533c..af1b917 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -668,6 +668,11 @@ static struct clk exynos5_init_clocks_off[] = {
.enable = exynos5_clk_ip_fsys_ctrl ,
.ctrlbit= (1  18),
}, {
+   .name   = usbdrd30,
+   .parent = exynos5_clk_aclk_200.clk,
+   .enable = exynos5_clk_ip_fsys_ctrl,
+   .ctrlbit= (1  19),
+   }, {
.name   = usbotg,
.enable = exynos5_clk_ip_fsys_ctrl,
.ctrlbit= (1  7),
@@ -909,6 +914,16 @@ struct clksrc_sources exynos5_clkset_group = {
.nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
 };
 
+struct clk *exynos5_clkset_usbdrd30_list[] = {
+   [0] = exynos5_clk_mout_mpll.clk,
+   [1] = exynos5_clk_mout_cpll.clk,
+};
+
+struct clksrc_sources exynos5_clkset_usbdrd30 = {
+   .sources= exynos5_clkset_usbdrd30_list,
+   .nr_sources = ARRAY_SIZE(exynos5_clkset_usbdrd30_list),
+};
+
 /* Possible clock sources for aclk_266_gscl_sub Mux */
 static struct clk *clk_src_gscl_266_list[] = {
[0] = clk_ext_xtal_mux,
@@ -1199,6 +1214,15 @@ static struct clksrc_clk exynos5_clksrcs[] = {
.parent = exynos5_clk_mout_cpll.clk,
},
.reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 },
+   }, {
+   .clk= {
+   .name   = sclk_usbdrd30,
+   .enable = exynos5_clksrc_mask_fsys_ctrl,
+   .ctrlbit= (1  28),
+   },
+   .sources = exynos5_clkset_usbdrd30,
+   .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 28, .size = 1 
},
+   .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 24, .size = 
4 },
},
 };
 
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 92d5e61..c17f1df 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -280,6 +280,11 @@ static struct map_desc exynos5_iodesc[] __initdata = {
.pfn= __phys_to_pfn(EXYNOS5_PA_USB_PHY),
.length = SZ_4K,
.type   = MT_DEVICE,
+   }, {
+   .virtual= (unsigned long)S5P_VA_DRD_PHY,
+   .pfn= __phys_to_pfn(EXYNOS5_PA_DRD_PHY),
+   .length = SZ_4K,
+   .type   = MT_DEVICE,
},
 };
 
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 331ae57..b95b245 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -193,6 +193,7 @@
 #define EXYNOS5_PA_UART0x12C0
 
 #define EXYNOS5_PA_USB_PHY 0x1213
+#define EXYNOS5_PA_DRD_PHY 0x1210
 
 #define EXYNOS4_PA_VP  0x12C0
 #define EXYNOS4_PA_MIXER   0x12C1
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h 
b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index d4e392b..67132b4 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -39,6 +39,10 @@
 #define S5P_HDMI_PHY_CONTROL   S5P_PMUREG(0x0700)
 #define S5P_HDMI_PHY_ENABLE(1  0)
 
+/* only for EXYNOS5250*/
+#define S5P_USBDRD_PHY_CONTROL S5P_PMUREG(0x0704)
+#define S5P_USBDRD_PHY_ENABLE  (1  0)
+
 #define S5P_DAC_PHY_CONTROLS5P_PMUREG(0x070C)
 #define S5P_DAC_PHY_ENABLE (1  0)
 
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h 
b/arch/arm/plat-samsung/include/plat/map-s5p.h
index c2d7bda..836863a 100644
--- a/arch/arm/plat-samsung/include/plat/map-s5p.h
+++ b/arch/arm/plat-samsung/include/plat/map-s5p.h
@@ -40,6 +40,8 @@
 #define S5P_VA_GIC_CPU S3C_ADDR(0x0281)
 #define S5P_VA_GIC_DISTS3C_ADDR(0x0282)
 
+#define S5P_VA_DRD_PHY S3C_ADDR(0x0300)
+
 #define VA_VIC(x)  (S3C_VA_IRQ + ((x) * 0x1))
 #define VA_VIC0VA_VIC(0)
 #define VA_VIC1

[PATCH 7/8 v2] ARM: EXYNOS5: Add XHCI device from device tree

2012-07-21 Thread Vivek Gautam
This patch adds EHCI device from device tree for exynos5
and adds platform data.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   19 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 ++
 arch/arm/mach-exynos/mach-exynos5-dt.c |9 +
 3 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index 45dadca..b2349fe 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -39,3 +39,22 @@ ehci {
samsung,vbus-gpio = gpx2 6 1 3 3;
 };
 
+XHCI
+Required properties:
+ - compatible: should be samsung,exynos-xhci for USB 3.0
+   DWC3 controller in host mode.
+ - reg: physical base address of the controller and length
+   of memory mapped.
+ - interrupts: interrupt number to the cpu.
+ - samsung,vbus-gpio:  if present, specifies the GPIO
+   that needs to be pulled up for the bus to be powered.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO
+   that needs to be pulled up for the bus to be powered.
+
+xhci {
+   compatible = samsung,exynos-xhci;
+   reg = 0x1200 0x1;
+   interrupts = 0 72 0;
+};
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 988f52a..bc36584 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -70,6 +70,12 @@
interrupts = 0 71 0;
};
 
+   xhci {
+   compatible = samsung,exynos-xhci;
+   reg = 0x1200 0x1;
+   interrupts = 0 72 0;
+   };
+
rtc {
compatible = samsung,s3c6410-rtc;
reg = 0x101E 0x100;
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 0cc626e..fc1ed3f 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -10,6 +10,7 @@
 */
 
 #include linux/of_platform.h
+#include linux/platform_data/dwc3-exynos.h
 #include linux/serial_core.h
 
 #include asm/mach/arch.h
@@ -34,6 +35,12 @@ static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
.phy_exit = s5p_usb_phy_exit,
 };
 
+static struct dwc3_exynos_data smdk5250_xhci_pdata = {
+   .phy_type = S5P_USB_PHY_DRD,
+   .phy_init = s5p_usb_phy_init,
+   .phy_exit = s5p_usb_phy_exit,
+};
+
 /*
  * The following lookup table is used to override device names when devices
  * are registered from device tree. This is temporarily added to enable
@@ -73,6 +80,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
exynos-ohci, smdk5250_ohci_pdata),
OF_DEV_AUXDATA(samsung,exynos-ehci, 0x1211,
s5p-ehci, smdk5250_ehci_pdata),
+   OF_DEV_AUXDATA(samsung,exynos-xhci, 0x1200,
+   exynos-dwc3, smdk5250_xhci_pdata),
{},
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/8 v2] ARM: EXYNOS5: Add PHY initialization code for usb 3.0

2012-07-21 Thread Vivek Gautam
This patch adds PHY setup functions for usb 3.0 support on exynos5

Signed-off-by: Yulgon Kim yulgon@samsung.com
Signed-off-by: Anton Tikhomirov av.tikhomi...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/mach-exynos/setup-usb-phy.c   |  127 
 .../include/plat/regs-usb3-exynos-drd-phy.h|   75 
 arch/arm/plat-samsung/include/plat/usb-phy.h   |1 +
 3 files changed, 203 insertions(+), 0 deletions(-)
 create mode 100644 
arch/arm/plat-samsung/include/plat/regs-usb3-exynos-drd-phy.h

diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index e6f2f84..b90871d 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -18,12 +18,14 @@
 #include mach/regs-usb-phy.h
 #include plat/cpu.h
 #include plat/usb-phy.h
+#include plat/regs-usb3-exynos-drd-phy.h
 
 #define PHY_ENABLE 1
 #define PHY_DISABLE0
 
 enum usb_phy_type {
USB_PHY = (0x1  0),
+   USB_PHY_DRD = (0x1  1),
 };
 
 static atomic_t host_usage;
@@ -161,11 +163,44 @@ static int exynos4210_usb_phy_clkset(struct 
platform_device *pdev)
return phyclk;
 }
 
+static u32 exynos_usb_phy30_set_clock(struct platform_device *pdev)
+{
+   u32 reg, refclk;
+
+   refclk = exynos4210_usb_phy_clkset(pdev);
+   reg = EXYNOS_USB3_PHYCLKRST_REFCLKSEL(3) |
+ EXYNOS_USB3_PHYCLKRST_FSEL(refclk);
+
+   switch (refclk) {
+   case EXYNOS5_CLKSEL_50M:
+   reg |= (EXYNOS_USB3_PHYCLKRST_MPLL_MULTIPLIER(0x02) |
+   EXYNOS_USB3_PHYCLKRST_SSC_REF_CLK_SEL(0x00));
+   break;
+   case EXYNOS5_CLKSEL_20M:
+   reg |= (EXYNOS_USB3_PHYCLKRST_MPLL_MULTIPLIER(0x7d) |
+   EXYNOS_USB3_PHYCLKRST_SSC_REF_CLK_SEL(0x00));
+   break;
+   case EXYNOS5_CLKSEL_19200K:
+   reg |= (EXYNOS_USB3_PHYCLKRST_MPLL_MULTIPLIER(0x02) |
+   EXYNOS_USB3_PHYCLKRST_SSC_REF_CLK_SEL(0x88));
+   break;
+   case EXYNOS5_CLKSEL_24M:
+   default:
+   reg |= (EXYNOS_USB3_PHYCLKRST_MPLL_MULTIPLIER(0x68) |
+   EXYNOS_USB3_PHYCLKRST_SSC_REF_CLK_SEL(0x88));
+   break;
+   }
+
+   return reg;
+}
+
 static void exynos_usb_phy_control(enum usb_phy_type phy_type , int on)
 {
if (soc_is_exynos5250()) {
if (phy_type  USB_PHY)
writel(on, S5P_USBHOST_PHY_CONTROL);
+   if (phy_type  USB_PHY_DRD)
+   writel(on, S5P_USBDRD_PHY_CONTROL);
}
 }
 
@@ -413,6 +448,88 @@ static int exynos5_usb_phy20_exit(struct platform_device 
*pdev)
return 0;
 }
 
+static int exynos5_usb_phy30_init(struct platform_device *pdev)
+{
+   struct clk *host_clk;
+   u32 reg;
+
+   host_clk = exynos_usb_clock_enable(pdev);
+   if (host_clk == NULL) {
+   dev_err(pdev-dev, Failed to enable USB3.0 host clock this 
time\n);
+   return -1;
+   }
+
+   exynos_usb_phy_control(USB_PHY_DRD, PHY_ENABLE);
+
+   /* Reset USB 3.0 PHY */
+   writel(0x, EXYNOS_USB3_PHYREG0);
+   writel(0x24d4e6e4, EXYNOS_USB3_PHYPARAM0);
+   writel(0x03fff81c, EXYNOS_USB3_PHYPARAM1);
+   writel(0x, EXYNOS_USB3_PHYRESUME);
+
+   writel(0x0840, EXYNOS_USB3_LINKSYSTEM);
+   writel(0x0004, EXYNOS_USB3_PHYBATCHG);
+
+   /* PHYTEST POWERDOWN Control */
+   reg = readl(EXYNOS_USB3_PHYTEST);
+   reg = ~(EXYNOS_USB3_PHYTEST_POWERDOWN_SSP |
+EXYNOS_USB3_PHYTEST_POWERDOWN_HSP);
+   writel(reg, EXYNOS_USB3_PHYTEST);
+
+   /* UTMI Power Control */
+   writel(EXYNOS_USB3_PHYUTMI_OTGDISABLE, EXYNOS_USB3_PHYUTMI);
+
+   reg = exynos_usb_phy30_set_clock(pdev);
+
+   reg |= (EXYNOS_USB3_PHYCLKRST_PORTRESET |
+   /* Digital power supply in normal operating mode */
+   EXYNOS_USB3_PHYCLKRST_RETENABLEN |
+   /* Enable ref clock for SS function */
+   EXYNOS_USB3_PHYCLKRST_REF_SSP_EN |
+   /* Enable spread spectrum */
+   EXYNOS_USB3_PHYCLKRST_SSC_EN) |
+   EXYNOS_USB3_PHYCLKRST_COMMONONN;
+   writel(reg, EXYNOS_USB3_PHYCLKRST);
+
+   udelay(10);
+
+   reg = ~(EXYNOS_USB3_PHYCLKRST_PORTRESET);
+   writel(reg, EXYNOS_USB3_PHYCLKRST);
+
+   clk_disable(host_clk);
+   clk_put(host_clk);
+   return 0;
+}
+
+static int exynos5_usb_phy30_exit(struct platform_device *pdev)
+{
+   struct clk *host_clk;
+   u32 reg;
+
+   host_clk = exynos_usb_clock_enable(pdev);
+   if (host_clk == NULL) {
+   dev_err(pdev-dev, Failed to enable USB3.0 host clock this 
time\n);
+   return -1;
+   }
+
+   reg = EXYNOS_USB3_PHYUTMI_OTGDISABLE |
+   EXYNOS_USB3_PHYUTMI_FORCESUSPEND

[PATCH 0/2] Enable ehci and ohci devices for exynos5250

2012-10-05 Thread Vivek Gautam
Based on for-next branch of linux-samsung.

Vivek Gautam (2):
  ARM: Exynos5250: Enabling ehci-s5p driver
  ARM: Exynos5250: Enabling ohci-exynos driver

 .../devicetree/bindings/usb/exynos-usb.txt |   40 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 ++
 arch/arm/boot/dts/exynos5250.dtsi  |   12 ++
 arch/arm/mach-exynos/include/mach/map.h|2 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |4 ++
 5 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-10-05 Thread Vivek Gautam
Adding EHCI device tree node for Exynos5250 along with
the device base adress and gpio line for vbus.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   25 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
 5 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
new file mode 100644
index 000..56e35c7
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -0,0 +1,25 @@
+Samsung Exynos SoC USB controller
+
+The USB devices interface with USB controllers on Exynos SOCs.
+The device node has following properties.
+
+EHCI
+Required properties:
+ - compatible: should be samsung,exynos-ehci for USB 2.0
+   EHCI controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO that
+   needs to be pulled up for the bus to be powered.
+
+Example:
+
+   ehci {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index a352df4..089576b 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -166,4 +166,8 @@
spi_2: spi@12d4 {
status = disabled;
};
+
+   ehci {
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index dddfd6e..73ea844 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -218,6 +218,12 @@
#size-cells = 0;
};
 
+   ehci {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 8480849..825fe40 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_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_EHCI0x1211
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index fee9dcd..6d950d7b 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -72,6 +72,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,exynos-ehci, EXYNOS5_PA_EHCI,
+   s5p-ehci, NULL),
{},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ARM: Exynos5250: Enabling ohci-exynos driver

2012-10-05 Thread Vivek Gautam
Adding OHCI device tree node for Exynos5250 along with
the device base address.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   15 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 ++
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 ++
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index 56e35c7..bff10a8 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -23,3 +23,18 @@ Example:
interrupts = 0 71 0;
samsung,vbus-gpio = gpx2 6 1 3 3;
};
+
+OHCI
+Required properties:
+ - compatible: should be samsung,exynos-ohci for USB 2.0
+   OHCI companion controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Example:
+   ohci {
+   compatible = samsung,exynos-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+   };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 73ea844..bcdfbe2 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -224,6 +224,12 @@
interrupts = 0 71 0;
};
 
+   ohci {
+   compatible = samsung,exynos-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 825fe40..cfede1f 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -196,6 +196,7 @@
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
 #define EXYNOS5_PA_EHCI0x1211
+#define EXYNOS5_PA_OHCI0x1212
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 6d950d7b..e6c2144 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -74,6 +74,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
exynos-gsc.3, NULL),
OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
s5p-ehci, NULL),
+   OF_DEV_AUXDATA(samsung,exynos-ohci, EXYNOS5_PA_OHCI,
+   exynos-ohci, NULL),
{},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: EXYNOS5: Remove wrongly placed usb2.0 PHY_CFG definition from PMU_REG

2012-10-05 Thread Vivek Gautam
EXYNOS5_USB_CFG macro should actually point to USB20PHY_CFG
system register (base addr + 0x230). It's wrongly placed in regs-pmu.
Actual register at offset 0x230 in PMU is SEQ_TRANSITION4.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/mach-exynos/include/mach/regs-pmu.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h 
b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index d4e392b..70b2795 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -230,8 +230,6 @@
 
 /* For EXYNOS5 */
 
-#define EXYNOS5_USB_CFG
S5P_PMUREG(0x0230)
-
 #define EXYNOS5_AUTO_WDTRESET_DISABLE  
S5P_PMUREG(0x0408)
 #define EXYNOS5_MASK_WDTRESET_REQUEST  
S5P_PMUREG(0x040C)
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] Adding usb2.0 host-phy support for exynos5250

2012-10-08 Thread Vivek Gautam
This patchset is based on the work by Praveen Paneri for
samsung-usbphy driver:
http://comments.gmane.org/gmane.linux.kernel.samsung-soc/12653

Tested on smdk5250 target with usb-next branch along with
arch patches for exynos5250:
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13042
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13048

Also tested successfully on smdkv310 for any break.

Vivek Gautam (5):
  usb: phy: samsung: Add host phy support to samsung-phy driver
  ARM: S3C64XX: Add phy_type to pmu_isolation
  ARM: Exynos5250: Enabling samsung-usbphy driver
  usb: s5p-ehci: Adding phy driver support
  usb: exynos-ohci: Adding phy driver support

 .../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/mach-s3c64xx/setup-usb-phy.c  |2 +-
 arch/arm/plat-samsung/include/plat/usb-phy.h   |3 +-
 drivers/usb/host/ehci-s5p.c|   62 +++-
 drivers/usb/host/ohci-exynos.c |   62 +++-
 drivers/usb/phy/Kconfig|1 -
 drivers/usb/phy/samsung-usbphy.c   |  362 ++--
 include/linux/platform_data/samsung-usbphy.h   |9 +-
 13 files changed, 497 insertions(+), 78 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-10-08 Thread Vivek Gautam
This patch adds host phy support for samsung's exynos5250.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/phy/Kconfig  |1 -
 drivers/usb/phy/samsung-usbphy.c |  362 --
 include/linux/platform_data/samsung-usbphy.h |9 +-
 3 files changed, 344 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 313685f..1ce5b32 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -35,7 +35,6 @@ config MV_U3D_PHY
 
 config SAMSUNG_USBPHY
bool Samsung USB PHY controller Driver
-   depends on USB_S3C_HSOTG
select USB_OTG_UTILS
help
  Enable this to support Samsung USB phy controller for samsung
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index ee2dee0..504ef84 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -61,9 +61,114 @@
 #define MHZ (1000*1000)
 #endif
 
+/* EXYNOS5 */
+#define EXYNOS5_PHYHOST(0x00)
+
+#define EXYNOS5_PHYHOST_PHYSWRSTALL(0x1  31)
+
+#define EXYNOS5_PHYHOST_REFCLKSEL_MASK (0x3)
+#define EXYNOS5_PHYHOST_REFCLKSEL(_x)  ((_x)  19)
+#define EXYNOS5_PHYHOST_REFCLKSEL_XTAL \
+   EXYNOS5_PHYHOST_REFCLKSEL(0x0)
+#define EXYNOS5_PHYHOST_REFCLKSEL_EXTL \
+   EXYNOS5_PHYHOST_REFCLKSEL(0x1)
+#define EXYNOS5_PHYHOST_REFCLKSEL_CLKCORE  \
+   EXYNOS5_PHYHOST_REFCLKSEL(0x2)
+
+#define EXYNOS5_PHYHOST_FSEL_MASK  (0x7  16)
+#define EXYNOS5_PHYHOST_FSEL(_x)   ((_x)  16)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_50M(0x7)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_24M(0x5)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_20M(0x4)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_19200K (0x3)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_12M(0x2)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_10M(0x1)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_9600K  (0x0)
+
+#define EXYNOS5_PHYHOST_COMMONON_N (0x1  9)
+#define EXYNOS5_PHYHOST_SIDDQ  (0x1  6)
+#define EXYNOS5_PHYHOST_FORCESLEEP (0x1  5)
+#define EXYNOS5_PHYHOST_FORCESUSPEND   (0x1  4)
+#define EXYNOS5_PHYHOST_WORDINTERFACE  (0x1  3)
+#define EXYNOS5_PHYHOST_UTMISWRST  (0x1  2)
+#define EXYNOS5_PHYHOST_LINKSWRST  (0x1  1)
+#define EXYNOS5_PHYHOST_PHYSWRST   (0x1  0)
+
+#define EXYNOS5_PHYHOST_TUNE0  (0x04)
+
+#define EXYNOS5_PHYHOST_TEST0  (0x08)
+
+#define EXYNOS5_PHYHSIC1   (0x10)
+
+#define EXYNOS5_PHYHSIC2   (0x20)
+
+#define EXYNOS5_PHYHSIC_REFCLKSEL_MASK (0x3)
+#define EXYNOS5_PHYHSIC_REFCLKSEL  (0x2  23)
+
+#define EXYNOS5_PHYHSIC_REFCLKDIV_MASK (0x7f)
+#define EXYNOS5_PHYHSIC_REFCLKDIV(_x)  ((_x)  16)
+#define EXYNOS5_PHYHSIC_REFCLKDIV_12   \
+   EXYNOS5_PHYHSIC_REFCLKDIV(0x24)
+#define EXYNOS5_PHYHSIC_REFCLKDIV_15   \
+   EXYNOS5_PHYHSIC_REFCLKDIV(0x1C)
+#define EXYNOS5_PHYHSIC_REFCLKDIV_16   \
+   EXYNOS5_PHYHSIC_REFCLKDIV(0x1A)
+#define EXYNOS5_PHYHSIC_REFCLKDIV_19_2 \
+   EXYNOS5_PHYHSIC_REFCLKDIV(0x15)
+#define EXYNOS5_PHYHSIC_REFCLKDIV_20   \
+   EXYNOS5_PHYHSIC_REFCLKDIV(0x14)
+
+#define EXYNOS5_PHYHSIC_SIDDQ  (0x1  6)
+#define EXYNOS5_PHYHSIC_FORCESLEEP (0x1  5)
+#define EXYNOS5_PHYHSIC_FORCESUSPEND   (0x1  4)
+#define EXYNOS5_PHYHSIC_WORDINTERFACE  (0x1  3)
+#define EXYNOS5_PHYHSIC_UTMISWRST  (0x1  2)
+#define EXYNOS5_PHYHSIC_PHYSWRST   (0x1  0)
+
+#define EXYNOS5_EHCICTRL   (0x30)
+
+#define EXYNOS5_EHCICTRL_ENAINCRXALIGN (0x1  29)
+#define EXYNOS5_EHCICTRL_ENAINCR4  (0x1  28)
+#define EXYNOS5_EHCICTRL_ENAINCR8  (0x1  27)
+#define EXYNOS5_EHCICTRL_ENAINCR16 (0x1  26)
+
+#define EXYNOS5_OHCICTRL   (0x34)
+
+#define EXYNOS5_OHCICTRL_SUSPLGCY  (0x1  3)
+#define EXYNOS5_OHCICTRL_APPSTARTCLK   (0x1  2)
+#define EXYNOS5_OHCICTRL_CNTSEL(0x1  1)
+#define EXYNOS5_OHCICTRL_CLKCKTRST (0x1  0)
+
+#define EXYNOS5_PHYOTG (0x38)
+
+#define EXYNOS5_PHYOTG_PHYLINK_SWRESET (0x1  14)
+#define EXYNOS5_PHYOTG_LINKSWRST_UOTG  (0x1  13)
+#define EXYNOS5_PHYOTG_PHY0_SWRST  (0x1  12)
+
+#define EXYNOS5_PHYOTG_REFCLKSEL_MASK  (0x3  9)
+#define EXYNOS5_PHYOTG_REFCLKSEL(_x)   ((_x)  9)
+#define EXYNOS5_PHYOTG_REFCLKSEL_XTAL  \
+   EXYNOS5_PHYOTG_REFCLKSEL(0x0)
+#define EXYNOS5_PHYOTG_REFCLKSEL_EXTL  \
+   EXYNOS5_PHYOTG_REFCLKSEL(0x1)
+#define

[PATCH 2/5] ARM: S3C64XX: Add phy_type to pmu_isolation

2012-10-08 Thread Vivek Gautam
It adds 'type' argument to pmu_isolation function, aligning
with other platforms, which keeps track of usbphy_type.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/mach-s3c64xx/setup-usb-phy.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c 
b/arch/arm/mach-s3c64xx/setup-usb-phy.c
index 3aee778..b7d1d95 100644
--- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -13,7 +13,7 @@
 #include mach/map.h
 #include mach/regs-sys.h
 
-void s5p_usb_phy_pmu_isolation(int on)
+void s5p_usb_phy_pmu_isolation(int on, int type)
 {
if (on) {
writel(readl(S3C64XX_OTHERS)  ~S3C64XX_OTHERS_USBMASK,
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] ARM: Exynos5250: Enabling samsung-usbphy driver

2012-10-08 Thread Vivek Gautam
Adding usbphy node for Exynos5250 along with the platform data.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../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 = 0x1213 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_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_HSPHY   0x1213
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
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

[PATCH 4/5] usb: s5p-ehci: Adding phy driver support

2012-10-08 Thread Vivek Gautam
Adding the transceiver to ehci driver. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-s5p.c |   62 +-
 1 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 85b74be..ac22893 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -18,6 +18,7 @@
 #include linux/of_gpio.h
 #include linux/platform_data/usb-ehci-s5p.h
 #include plat/usb-phy.h
+#include linux/usb/phy.h
 
 #define EHCI_INSNREG00(base)   (base + 0x90)
 #define EHCI_INSNREG00_ENA_INCR16  (0x1  25)
@@ -32,6 +33,8 @@ struct s5p_ehci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct s5p_ehci_platdata *pdata;
 };
 
 static const struct hc_driver s5p_ehci_hc_driver = {
@@ -65,6 +68,26 @@ static const struct hc_driver s5p_ehci_hc_driver = {
.clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
 };
 
+static void s5p_ehci_phy_enable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy)
+   usb_phy_init(s5p_ehci-phy);
+   else if (s5p_ehci-pdata-phy_init)
+   s5p_ehci-pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+}
+
+static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy)
+   usb_phy_shutdown(s5p_ehci-phy);
+   else if (s5p_ehci-pdata-phy_exit)
+   s5p_ehci-pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+}
+
 static void s5p_setup_vbus_gpio(struct platform_device *pdev)
 {
int err;
@@ -92,15 +115,10 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -118,6 +136,20 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
if (!s5p_ehci)
return -ENOMEM;
 
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   /* Fallback to Phy transceiver */
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   s5p_ehci-phy = phy;
+   }
+   } else {
+   s5p_ehci-pdata = pdata;
+   }
+
s5p_ehci-dev = pdev-dev;
 
hcd = usb_create_hcd(s5p_ehci_hc_driver, pdev-dev,
@@ -163,8 +195,7 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   s5p_ehci_phy_enable(s5p_ehci);
 
ehci = hcd_to_ehci(hcd);
ehci-caps = hcd-regs;
@@ -184,6 +215,7 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
 
 fail_io:
clk_disable(s5p_ehci-clk);
+   s5p_ehci_phy_disable(s5p_ehci);
 fail_clk:
usb_put_hcd(hcd);
return err;
@@ -191,14 +223,12 @@ fail_clk:
 
 static int __devexit s5p_ehci_remove(struct platform_device *pdev)
 {
-   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
struct s5p_ehci_hcd *s5p_ehci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = s5p_ehci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   s5p_ehci_phy_disable(s5p_ehci);
 
clk_disable(s5p_ehci-clk);
 
@@ -222,14 +252,11 @@ static int s5p_ehci_suspend(struct device *dev)
struct s5p_ehci_hcd *s5p_ehci = dev_get_drvdata(dev);
struct usb_hcd *hcd = s5p_ehci-hcd;
bool do_wakeup = device_may_wakeup(dev);
-   struct platform_device *pdev = to_platform_device(dev);
-   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
int rc;
 
rc = ehci_suspend(hcd, do_wakeup);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   s5p_ehci_phy_disable(s5p_ehci);
 
clk_disable(s5p_ehci-clk);
 
@@ -240,13 +267,10 @@ static int s5p_ehci_resume(struct device *dev)
 {
struct s5p_ehci_hcd *s5p_ehci = dev_get_drvdata(dev);
struct usb_hcd *hcd

[PATCH 5/5] usb: exynos-ohci: Adding phy driver support

2012-10-08 Thread Vivek Gautam
Adding the transceiver to ohci driver. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ohci-exynos.c |   62 +++
 1 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 20a5008..e0ed594 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -16,13 +16,36 @@
 #include linux/platform_device.h
 #include linux/platform_data/usb-exynos.h
 #include plat/usb-phy.h
+#include linux/usb/phy.h
 
 struct exynos_ohci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct exynos4_ohci_platdata *pdata;
 };
 
+static void exynos_ohci_phy_enable(struct exynos_ohci_hcd *exynos_ohci)
+{
+   struct platform_device *pdev = to_platform_device(exynos_ohci-dev);
+
+   if (exynos_ohci-phy)
+   usb_phy_init(exynos_ohci-phy);
+   else if (exynos_ohci-pdata-phy_init)
+   exynos_ohci-pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+}
+
+static void exynos_ohci_phy_disable(struct exynos_ohci_hcd *exynos_ohci)
+{
+   struct platform_device *pdev = to_platform_device(exynos_ohci-dev);
+
+   if (exynos_ohci-phy)
+   usb_phy_shutdown(exynos_ohci-phy);
+   else if (exynos_ohci-pdata-phy_exit)
+   exynos_ohci-pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+}
+
 static int ohci_exynos_start(struct usb_hcd *hcd)
 {
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
@@ -81,15 +104,10 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
struct usb_hcd *hcd;
struct ohci_hcd *ohci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -105,6 +123,20 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
if (!exynos_ohci)
return -ENOMEM;
 
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   /* Fallback to Phy transceiver */
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   exynos_ohci-phy = phy;
+   }
+   } else {
+   exynos_ohci-pdata = pdata;
+   }
+
exynos_ohci-dev = pdev-dev;
 
hcd = usb_create_hcd(exynos_ohci_hc_driver, pdev-dev,
@@ -150,8 +182,7 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   exynos_ohci_phy_enable(exynos_ohci);
 
ohci = hcd_to_ohci(hcd);
ohci_hcd_init(ohci);
@@ -168,6 +199,7 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
 
 fail_io:
clk_disable(exynos_ohci-clk);
+   exynos_ohci_phy_disable(exynos_ohci);
 fail_clken:
clk_put(exynos_ohci-clk);
 fail_clk:
@@ -177,14 +209,12 @@ fail_clk:
 
 static int __devexit exynos_ohci_remove(struct platform_device *pdev)
 {
-   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = exynos_ohci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   exynos_ohci_phy_disable(exynos_ohci);
 
clk_disable(exynos_ohci-clk);
clk_put(exynos_ohci-clk);
@@ -209,8 +239,6 @@ static int exynos_ohci_suspend(struct device *dev)
struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
struct usb_hcd *hcd = exynos_ohci-hcd;
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   struct platform_device *pdev = to_platform_device(dev);
-   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
unsigned long flags;
int rc = 0;
 
@@ -229,8 +257,7 @@ static int exynos_ohci_suspend(struct device *dev)
 
clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   exynos_ohci_phy_disable(exynos_ohci);
 
clk_disable(exynos_ohci-clk);
 
@@ -244,13 +271,10 @@ static int exynos_ohci_resume(struct device *dev)
 {
struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
struct usb_hcd *hcd

Re: [PATCH 2/5] ARM: S3C64XX: Add phy_type to pmu_isolation

2012-10-09 Thread Vivek Gautam
Hi Kishon,

Firstly, thanks for the quick review.

On Tue, Oct 9, 2012 at 11:03 AM, kishon kis...@ti.com wrote:
 Hi,


 On Monday 08 October 2012 07:42 PM, Vivek Gautam wrote:

 It adds 'type' argument to pmu_isolation function, aligning
 with other platforms, which keeps track of usbphy_type.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
   arch/arm/mach-s3c64xx/setup-usb-phy.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c
 b/arch/arm/mach-s3c64xx/setup-usb-phy.c
 index 3aee778..b7d1d95 100644
 --- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
 +++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
 @@ -13,7 +13,7 @@
   #include mach/map.h
   #include mach/regs-sys.h

 -void s5p_usb_phy_pmu_isolation(int on)
 +void s5p_usb_phy_pmu_isolation(int on, int type)


 IMO, this patch should have been squashed with the previous patch. IIUC, you
 have changed the call to this function for taking two arguments in your
 previous patch. Wouldn't that introduce compilation break after applying
 your first patch?
Yes, that's right it will introduce compilation break, my fault.
Just one querry, will it be good to put this arch change in [patch 1/5]?
and then can i move similar change in [patch 3/5] as given below again
in [patch 1/5]?

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
@@ -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)


 Thanks
 Kishon

 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

Best regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/5] ARM: S3C64XX: Add phy_type to pmu_isolation

2012-10-09 Thread Vivek Gautam
Hi,

On Tue, Oct 9, 2012 at 4:42 PM, Jingoo Han jg1@samsung.com wrote:
 On Tuesday, October 09, 2012 7:51 PM Vivek Gautam wrote

 Hi Kishon,

 Firstly, thanks for the quick review.

 On Tue, Oct 9, 2012 at 11:03 AM, kishon kis...@ti.com wrote:
  Hi,
 
 
  On Monday 08 October 2012 07:42 PM, Vivek Gautam wrote:
 
  It adds 'type' argument to pmu_isolation function, aligning
  with other platforms, which keeps track of usbphy_type.
 
  Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
  ---
arch/arm/mach-s3c64xx/setup-usb-phy.c |2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
 
  diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c
  b/arch/arm/mach-s3c64xx/setup-usb-phy.c
  index 3aee778..b7d1d95 100644
  --- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
  +++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
  @@ -13,7 +13,7 @@
#include mach/map.h
#include mach/regs-sys.h
 
  -void s5p_usb_phy_pmu_isolation(int on)
  +void s5p_usb_phy_pmu_isolation(int on, int type)
 
 
  IMO, this patch should have been squashed with the previous patch. IIUC, 
  you
  have changed the call to this function for taking two arguments in your
  previous patch. Wouldn't that introduce compilation break after applying
  your first patch?
 Yes, that's right it will introduce compilation break, my fault.
 Just one querry, will it be good to put this arch change in [patch 1/5]?
 and then can i move similar change in [patch 3/5] as given below again
 in [patch 1/5]?

 In my opinion, it would be better.
 This is because it can prevent build errors.

Sure, I shall update this in the next patchset.

 Best regards,
 Jingoo Han


 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
 @@ -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)

 
  Thanks
  Kishon
 
  --
  To unsubscribe from this list: send the line unsubscribe linux-usb in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html

 Best regards
 Vivek


Thanks
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] usb: s5p-ehci: Adding phy driver support

2012-10-09 Thread Vivek Gautam
Hi,

On Tue, Oct 9, 2012 at 3:10 PM, Jingoo Han jg1@samsung.com wrote:
 On Monday, October 08, 2012 11:12 PM Vivek Gautam wrote

 Adding the transceiver to ehci driver. Keeping the platform data
 for continuing the smooth operation for boards which still uses it

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

 Hi Vivek Gautam,

 Could you replace the patch subject with
 'USB: ehci-s5p: Add phy driver support'.

Yeah, sure. I shall update this in the next patchset.

 I also added some comments.

 ---
  drivers/usb/host/ehci-s5p.c |   62 
 +-
  1 files changed, 43 insertions(+), 19 deletions(-)

 diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
 index 85b74be..ac22893 100644
 --- a/drivers/usb/host/ehci-s5p.c
 +++ b/drivers/usb/host/ehci-s5p.c
 @@ -18,6 +18,7 @@
  #include linux/of_gpio.h
  #include linux/platform_data/usb-ehci-s5p.h
  #include plat/usb-phy.h
 +#include linux/usb/phy.h

 Please, move header include to proper place as bellows:

Sure, i will change this accordingly.

 #include linux/platform_data/usb-ehci-s5p.h
 +#include linux/usb/phy.h
 ##include plat/usb-phy.h


  #define EHCI_INSNREG00(base) (base + 0x90)
  #define EHCI_INSNREG00_ENA_INCR16(0x1  25)
 @@ -32,6 +33,8 @@ struct s5p_ehci_hcd {
   struct device *dev;
   struct usb_hcd *hcd;
   struct clk *clk;
 + struct usb_phy *phy;
 + struct s5p_ehci_platdata *pdata;
  };

  static const struct hc_driver s5p_ehci_hc_driver = {
 @@ -65,6 +68,26 @@ static const struct hc_driver s5p_ehci_hc_driver = {
   .clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
  };

 +static void s5p_ehci_phy_enable(struct s5p_ehci_hcd *s5p_ehci)
 +{
 + struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
 +
 + if (s5p_ehci-phy)
 + usb_phy_init(s5p_ehci-phy);
 + else if (s5p_ehci-pdata-phy_init)
 + s5p_ehci-pdata-phy_init(pdev, S5P_USB_PHY_HOST);
 +}
 +
 +static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
 +{
 + struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
 +
 + if (s5p_ehci-phy)
 + usb_phy_shutdown(s5p_ehci-phy);
 + else if (s5p_ehci-pdata-phy_exit)
 + s5p_ehci-pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
 +}
 +
  static void s5p_setup_vbus_gpio(struct platform_device *pdev)
  {
   int err;
 @@ -92,15 +115,10 @@ static int __devinit s5p_ehci_probe(struct 
 platform_device *pdev)
   struct usb_hcd *hcd;
   struct ehci_hcd *ehci;
   struct resource *res;
 + struct usb_phy *phy;
   int irq;
   int err;

 - pdata = pdev-dev.platform_data;
 - if (!pdata) {
 - dev_err(pdev-dev, No platform data defined\n);
 - return -EINVAL;
 - }
 -
   /*
* Right now device-tree probed devices don't get dma_mask set.
* Since shared usb code relies on it, set it here for now.
 @@ -118,6 +136,20 @@ static int __devinit s5p_ehci_probe(struct 
 platform_device *pdev)
   if (!s5p_ehci)
   return -ENOMEM;

 + pdata = pdev-dev.platform_data;
 + if (!pdata) {
 + /* Fallback to Phy transceiver */
 + phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
 + if (IS_ERR_OR_NULL(phy)) {
 + dev_err(pdev-dev, no platform data or transceiver 
 defined\n);
 + return -EPROBE_DEFER;
 + } else {
 + s5p_ehci-phy = phy;
 + }
 + } else {
 + s5p_ehci-pdata = pdata;
 + }
 +
   s5p_ehci-dev = pdev-dev;

   hcd = usb_create_hcd(s5p_ehci_hc_driver, pdev-dev,
 @@ -163,8 +195,7 @@ static int __devinit s5p_ehci_probe(struct 
 platform_device *pdev)
   goto fail_io;
   }

 - if (pdata-phy_init)
 - pdata-phy_init(pdev, S5P_USB_PHY_HOST);
 + s5p_ehci_phy_enable(s5p_ehci);

   ehci = hcd_to_ehci(hcd);
   ehci-caps = hcd-regs;
 @@ -184,6 +215,7 @@ static int __devinit s5p_ehci_probe(struct 
 platform_device *pdev)

  fail_io:
   clk_disable(s5p_ehci-clk);
 + s5p_ehci_phy_disable(s5p_ehci);

 This is wrong path for errors.
 For example, when devm_ioremap() fails, s5p_ehci_phy_disable()
 is called. However, in this case, s5p_ehci_phy_enable() is not
 called. So, s5p_ehci_phy_disable() should not be called.

 Please fix them as follows:

 err = usb_add_hcd(hcd, irq, IRQF_SHARED);
 if (err) {
 dev_err(pdev-dev, Failed to add USB HCD\n);
 -   goto fail_io;
 +   goto fail_add_hcd;
 }

 platform_set_drvdata(pdev, s5p_ehci);

 return 0;

 +fail_add_hcd:
 +   s5p_ehci_phy_disable(s5p_ehci);
 fail_io:
 clk_disable(s5p_ehci-clk);
 fail_clk:
 usb_put_hcd(hcd);

Right, nice catch, thanks. I shall modify this as suggested and update.


  fail_clk:
   usb_put_hcd(hcd);
   return err

[PATCH 0/4 v2] Adding usb2.0 host-phy support for exynos5250

2012-10-10 Thread Vivek Gautam
This patchset is based on the work by Praveen Paneri for
samsung-usbphy driver:
http://comments.gmane.org/gmane.linux.kernel.samsung-soc/12653

Changes from v1:
 - squashed the patch ARM: S3C64XX: Add phy_type to pmu_isolation into
   usb: phy: samsung: Add host phy support to samsung-phy driver.
 - moved similar change of adding phy_type to pmu_isolation for exynos from
   ARM: Exynos5250: Enabling samsung-usbphy driver to
   usb: phy: samsung: Add host phy support to samsung-phy driver.
 - moved s5p_usb_phy_pmu_isolation() declaration from
   ARM: Exynos5250: Enabling samsung-usbphy driver to
   usb: phy: samsung: Add host phy support to samsung-phy driver.
 - moved phy_cfg_sel function pointer declaration from
   usb: phy: samsung: Add host phy support to samsung-phy driver to
   ARM: Exynos5250: Enabling samsung-usbphy driver.
 - Replaced the patch subject usb: s5p-ehci: Adding phy driver support and
   usb: exynos-ohci: Adding phy driver support with
   USB: ehci-s5p: Add phy driver support and
   USB: ohci-exynos: Add phy driver support respectively.
 - Corrected the header include order in ehci-s5p and ohci-exynos.
 - Corrected wrong error path for s5p_ehci_phy_disable() and
   exynos_ohci_phy_disable() in ehci-s5p and ohci-exynos respectively.

Tested on smdk5250 target with usb-next branch along with arch patches
for exynos5250:
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13042
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13048

Vivek Gautam (4):
  usb: phy: samsung: Add host phy support to samsung-phy driver
  ARM: Exynos5250: Enabling samsung-usbphy driver
  USB: ehci-s5p: Add phy driver support
  USB: ohci-exynos: Add phy driver support

 .../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/mach-s3c64xx/setup-usb-phy.c  |2 +-
 arch/arm/plat-samsung/include/plat/usb-phy.h   |3 +-
 drivers/usb/host/ehci-s5p.c|   65 +++-
 drivers/usb/host/ohci-exynos.c |   65 +++-
 drivers/usb/phy/Kconfig|1 -
 drivers/usb/phy/samsung-usbphy.c   |  368 ++--
 include/linux/platform_data/samsung-usbphy.h   |9 +-
 13 files changed, 507 insertions(+), 80 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4 v2] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-10-10 Thread Vivek Gautam
This patch adds host phy support to samsung-usbphy.c and
further adds support for samsung's exynos5250 usb-phy.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/mach-exynos/setup-usb-phy.c |2 +-
 arch/arm/mach-s3c64xx/setup-usb-phy.c|2 +-
 arch/arm/plat-samsung/include/plat/usb-phy.h |2 +-
 drivers/usb/phy/Kconfig  |1 -
 drivers/usb/phy/samsung-usbphy.c |  368 --
 include/linux/platform_data/samsung-usbphy.h |8 +-
 6 files changed, 352 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index 1c62d20..be6cd4f 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -222,7 +222,7 @@ 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)
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c 
b/arch/arm/mach-s3c64xx/setup-usb-phy.c
index 3aee778..b7d1d95 100644
--- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -13,7 +13,7 @@
 #include mach/map.h
 #include mach/regs-sys.h
 
-void s5p_usb_phy_pmu_isolation(int on)
+void s5p_usb_phy_pmu_isolation(int on, int type)
 {
if (on) {
writel(readl(S3C64XX_OTHERS)  ~S3C64XX_OTHERS_USBMASK,
diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h 
b/arch/arm/plat-samsung/include/plat/usb-phy.h
index 165ffe7..7a4a959 100644
--- a/arch/arm/plat-samsung/include/plat/usb-phy.h
+++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
@@ -18,6 +18,6 @@ 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);
 
 #endif /* __PLAT_SAMSUNG_USB_PHY_H */
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 313685f..1ce5b32 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -35,7 +35,6 @@ config MV_U3D_PHY
 
 config SAMSUNG_USBPHY
bool Samsung USB PHY controller Driver
-   depends on USB_S3C_HSOTG
select USB_OTG_UTILS
help
  Enable this to support Samsung USB phy controller for samsung
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index ee2dee0..bd6a5e8 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -61,9 +61,120 @@
 #define MHZ (1000*1000)
 #endif
 
+/* EXYNOS5 */
+#define EXYNOS5_PHYHOST(0x00)
+
+#define EXYNOS5_PHYHOST_PHYSWRSTALL(0x1  31)
+
+#define EXYNOS5_PHYHOST_REFCLKSEL_MASK (0x3)
+#define EXYNOS5_PHYHOST_REFCLKSEL(_x)  ((_x)  19)
+#define EXYNOS5_PHYHOST_REFCLKSEL_XTAL \
+   EXYNOS5_PHYHOST_REFCLKSEL(0x0)
+#define EXYNOS5_PHYHOST_REFCLKSEL_EXTL \
+   EXYNOS5_PHYHOST_REFCLKSEL(0x1)
+#define EXYNOS5_PHYHOST_REFCLKSEL_CLKCORE  \
+   EXYNOS5_PHYHOST_REFCLKSEL(0x2)
+
+#define EXYNOS5_PHYHOST_FSEL_MASK  (0x7  16)
+#define EXYNOS5_PHYHOST_FSEL(_x)   ((_x)  16)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_50M(0x7)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_24M(0x5)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_20M(0x4)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_19200K (0x3)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_12M(0x2)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_10M(0x1)
+#define EXYNOS5_PHYHOST_FSEL_CLKSEL_9600K  (0x0)
+
+#define EXYNOS5_PHYHOST_TESTBURNIN (0x1  11)
+#define EXYNOS5_PHYHOST_RETENABLE  (0x1  10)
+#define EXYNOS5_PHYHOST_COMMONON_N (0x1  9)
+#define EXYNOS5_PHYHOST_SIDDQ  (0x1  6)
+#define EXYNOS5_PHYHOST_FORCESLEEP (0x1  5)
+#define EXYNOS5_PHYHOST_FORCESUSPEND   (0x1  4)
+#define EXYNOS5_PHYHOST_WORDINTERFACE  (0x1  3)
+#define EXYNOS5_PHYHOST_UTMISWRST  (0x1  2)
+#define EXYNOS5_PHYHOST_LINKSWRST  (0x1  1)
+#define EXYNOS5_PHYHOST_PHYSWRST   (0x1  0)
+
+#define EXYNOS5_PHYHOST_TUNE0  (0x04)
+
+#define EXYNOS5_PHYHSIC1   (0x10)
+
+#define EXYNOS5_PHYHSIC_TUNE1  (0x14)
+
+#define EXYNOS5_PHYHSIC2   (0x20)
+
+#define EXYNOS5_PHYHSIC_TUNE2  (0x24)
+
+#define EXYNOS5_PHYHSIC_REFCLKSEL_MASK (0x3)
+#define EXYNOS5_PHYHSIC_REFCLKSEL  (0x2  23)
+
+#define EXYNOS5_PHYHSIC_REFCLKDIV_MASK (0x7f)
+#define EXYNOS5_PHYHSIC_REFCLKDIV(_x)  ((_x)  16)
+#define EXYNOS5_PHYHSIC_REFCLKDIV_12

[PATCH 3/4 v2] USB: ehci-s5p: Add phy driver support

2012-10-10 Thread Vivek Gautam
Adding the transceiver to ehci driver. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-s5p.c |   65 +-
 1 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 85b74be..6dac38f 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -17,6 +17,7 @@
 #include linux/platform_device.h
 #include linux/of_gpio.h
 #include linux/platform_data/usb-ehci-s5p.h
+#include linux/usb/phy.h
 #include plat/usb-phy.h
 
 #define EHCI_INSNREG00(base)   (base + 0x90)
@@ -32,6 +33,8 @@ struct s5p_ehci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct s5p_ehci_platdata *pdata;
 };
 
 static const struct hc_driver s5p_ehci_hc_driver = {
@@ -65,6 +68,26 @@ static const struct hc_driver s5p_ehci_hc_driver = {
.clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
 };
 
+static void s5p_ehci_phy_enable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy)
+   usb_phy_init(s5p_ehci-phy);
+   else if (s5p_ehci-pdata-phy_init)
+   s5p_ehci-pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+}
+
+static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy)
+   usb_phy_shutdown(s5p_ehci-phy);
+   else if (s5p_ehci-pdata-phy_exit)
+   s5p_ehci-pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+}
+
 static void s5p_setup_vbus_gpio(struct platform_device *pdev)
 {
int err;
@@ -92,15 +115,10 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -118,6 +136,20 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
if (!s5p_ehci)
return -ENOMEM;
 
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   /* Fallback to Phy transceiver */
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   s5p_ehci-phy = phy;
+   }
+   } else {
+   s5p_ehci-pdata = pdata;
+   }
+
s5p_ehci-dev = pdev-dev;
 
hcd = usb_create_hcd(s5p_ehci_hc_driver, pdev-dev,
@@ -163,8 +195,7 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   s5p_ehci_phy_enable(s5p_ehci);
 
ehci = hcd_to_ehci(hcd);
ehci-caps = hcd-regs;
@@ -175,13 +206,15 @@ static int __devinit s5p_ehci_probe(struct 
platform_device *pdev)
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
dev_err(pdev-dev, Failed to add USB HCD\n);
-   goto fail_io;
+   goto fail_add_hcd;
}
 
platform_set_drvdata(pdev, s5p_ehci);
 
return 0;
 
+fail_add_hcd:
+   s5p_ehci_phy_disable(s5p_ehci);
 fail_io:
clk_disable(s5p_ehci-clk);
 fail_clk:
@@ -191,14 +224,12 @@ fail_clk:
 
 static int __devexit s5p_ehci_remove(struct platform_device *pdev)
 {
-   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
struct s5p_ehci_hcd *s5p_ehci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = s5p_ehci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   s5p_ehci_phy_disable(s5p_ehci);
 
clk_disable(s5p_ehci-clk);
 
@@ -222,14 +253,11 @@ static int s5p_ehci_suspend(struct device *dev)
struct s5p_ehci_hcd *s5p_ehci = dev_get_drvdata(dev);
struct usb_hcd *hcd = s5p_ehci-hcd;
bool do_wakeup = device_may_wakeup(dev);
-   struct platform_device *pdev = to_platform_device(dev);
-   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
int rc;
 
rc = ehci_suspend(hcd, do_wakeup);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   s5p_ehci_phy_disable

Re: [PATCH 2/4 v2] ARM: Exynos5250: Enabling samsung-usbphy driver

2012-10-21 Thread Vivek Gautam
Hi,

On Mon, Oct 22, 2012 at 10:33 AM, Jingoo Han jg1@samsung.com wrote:
 On Wednesday, October 10, 2012 7:43 PM Vivek Gautam wrote

 Adding usbphy node for Exynos5250 along with the platform data.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  .../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   |   43 
 ---
  arch/arm/plat-samsung/include/plat/usb-phy.h   |1 +
  include/linux/platform_data/samsung-usbphy.h   |1 +
  8 files changed, 65 insertions(+), 9 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 index 7d54d59..c644d01 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 ehci-s5p and ohci-exynos usb 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 = 0x1213 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  0x1258
  #define EXYNOS4_PA_OHCI  0x1259
  #define EXYNOS4_PA_HSPHY 0x125B
 +#define EXYNOS5_PA_HSPHY 0x1213
  #define EXYNOS4_PA_MFC   0x1340

  #define EXYNOS4_PA_UART  0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index db1cd8e..bc041be 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 be6cd4f..bebc99b 100644
 --- a/arch/arm/mach-exynos/setup-usb-phy.c
 +++ b/arch/arm/mach-exynos/setup-usb-phy.c
 @@ -14,11

Re: [PATCH 1/4 v2] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-10-21 Thread Vivek Gautam
HI,

On Mon, Oct 22, 2012 at 10:27 AM, Jingoo Han jg1@samsung.com wrote:
 On Wednesday, October 10, 2012 7:43 PM Vivek Gautam wrote

 This patch adds host phy support to samsung-usbphy.c and
 further adds support for samsung's exynos5250 usb-phy.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  arch/arm/mach-exynos/setup-usb-phy.c |2 +-
  arch/arm/mach-s3c64xx/setup-usb-phy.c|2 +-
  arch/arm/plat-samsung/include/plat/usb-phy.h |2 +-
  drivers/usb/phy/Kconfig  |1 -
  drivers/usb/phy/samsung-usbphy.c |  368 
 --
  include/linux/platform_data/samsung-usbphy.h |8 +-
  6 files changed, 352 insertions(+), 31 deletions(-)

 diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
 b/arch/arm/mach-exynos/setup-usb-phy.c
 index 1c62d20..be6cd4f 100644
 --- a/arch/arm/mach-exynos/setup-usb-phy.c
 +++ b/arch/arm/mach-exynos/setup-usb-phy.c
 @@ -222,7 +222,7 @@ 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)
 diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c 
 b/arch/arm/mach-s3c64xx/setup-usb-phy.c
 index 3aee778..b7d1d95 100644
 --- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
 +++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
 @@ -13,7 +13,7 @@
  #include mach/map.h
  #include mach/regs-sys.h

 -void s5p_usb_phy_pmu_isolation(int on)
 +void s5p_usb_phy_pmu_isolation(int on, int type)
  {
   if (on) {
   writel(readl(S3C64XX_OTHERS)  ~S3C64XX_OTHERS_USBMASK,
 diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h 
 b/arch/arm/plat-samsung/include/plat/usb-phy.h
 index 165ffe7..7a4a959 100644
 --- a/arch/arm/plat-samsung/include/plat/usb-phy.h
 +++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
 @@ -18,6 +18,6 @@ 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);

  #endif /* __PLAT_SAMSUNG_USB_PHY_H */
 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 313685f..1ce5b32 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -35,7 +35,6 @@ config MV_U3D_PHY

  config SAMSUNG_USBPHY
   bool Samsung USB PHY controller Driver
 - depends on USB_S3C_HSOTG
   select USB_OTG_UTILS
   help
 Enable this to support Samsung USB phy controller for samsung
 diff --git a/drivers/usb/phy/samsung-usbphy.c 
 b/drivers/usb/phy/samsung-usbphy.c
 index ee2dee0..bd6a5e8 100644
 --- a/drivers/usb/phy/samsung-usbphy.c
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -61,9 +61,120 @@
  #define MHZ (1000*1000)
  #endif


 How about using exact name for the definition, as possible?
 PHY SFRs are defined in Exynos5250 and Exynos5410:
 HOSTPHYCTRL0 0x
 HOSTPHYTUNE0 0x0004
 HSICPHYCTRL1 0x0010
 HSICPHYTUNE1 0x0014
 HSICPHYCTRL2 0x0020
 HSICPHYTUNE2 0x0024
 HOSTEHCICTRL 0x0030
 HOSTOHCICTRL 0x0034
 USBOTG_SYS 0x0038
 USBOTG_TUNE 0x0040

Yes, using above suggested names will be good.

 It would be better to use 'EXYNOS5_PHY_' as the common prefix.

shall modify these SFRs' names accordingly and resubmit. Thanks for
pointing out.


 +/* EXYNOS5 */
 +#define EXYNOS5_PHYHOST  (0x00)

 EXYNOS5_PHY_HOST_CTRL0???

shall change this as suggested.

 +
 +#define EXYNOS5_PHYHOST_PHYSWRSTALL  (0x1  31)
 +
 +#define EXYNOS5_PHYHOST_REFCLKSEL_MASK   (0x3)
 +#define EXYNOS5_PHYHOST_REFCLKSEL(_x)((_x)  19)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_XTAL   \
 + EXYNOS5_PHYHOST_REFCLKSEL(0x0)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_EXTL   \
 + EXYNOS5_PHYHOST_REFCLKSEL(0x1)
 +#define EXYNOS5_PHYHOST_REFCLKSEL_CLKCORE\
 + EXYNOS5_PHYHOST_REFCLKSEL(0x2)
 +
 +#define EXYNOS5_PHYHOST_FSEL_MASK(0x7  16)
 +#define EXYNOS5_PHYHOST_FSEL(_x) ((_x)  16)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_50M  (0x7)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_24M  (0x5)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_20M  (0x4)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_19200K   (0x3)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_12M  (0x2)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_10M  (0x1)
 +#define EXYNOS5_PHYHOST_FSEL_CLKSEL_9600K(0x0)
 +
 +#define EXYNOS5_PHYHOST_TESTBURNIN   (0x1  11)
 +#define EXYNOS5_PHYHOST_RETENABLE(0x1  10)
 +#define EXYNOS5_PHYHOST_COMMONON_N   (0x1  9)
 +#define EXYNOS5_PHYHOST_SIDDQ(0x1  6)
 +#define EXYNOS5_PHYHOST_FORCESLEEP   (0x1  5)
 +#define EXYNOS5_PHYHOST_FORCESUSPEND (0x1  4

[PATCH v3 0/4] Adding usb2.0 host-phy support for exynos5250

2012-10-29 Thread Vivek Gautam
This patchset is based on the work by Praveen Paneri for
samsung-usbphy driver:
http://comments.gmane.org/gmane.linux.kernel.samsung-soc/12653

Changes from v2:
 - Using EXYNOS5_PHY_ as common prefix along with exact names for
   PHY SFRs for register definitions
 - Using register names with bit macros to make things more clear.
 - Removed parentheses around 0x230 in definition for EXYNOS5_USB_CFG
   in [patch 2/4 v2].

Tested on smdk5250 target with usb-next branch along with arch patches
for exynos5250:
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13042
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13048

Vivek Gautam (4):
  usb: phy: samsung: Add host phy support to samsung-phy driver
  ARM: Exynos5250: Enabling samsung-usbphy driver
  USB: ehci-s5p: Add phy driver support
  USB: ohci-exynos: Add phy driver support

 .../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/mach-s3c64xx/setup-usb-phy.c  |2 +-
 arch/arm/plat-samsung/include/plat/usb-phy.h   |3 +-
 drivers/usb/host/ehci-s5p.c|   65 +++-
 drivers/usb/host/ohci-exynos.c |   65 +++-
 drivers/usb/phy/Kconfig|1 -
 drivers/usb/phy/samsung-usbphy.c   |  369 ++--
 include/linux/platform_data/samsung-usbphy.h   |9 +-
 13 files changed, 508 insertions(+), 80 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/4] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-10-29 Thread Vivek Gautam
This patch adds host phy support to samsung-usbphy.c and
further adds support for samsung's exynos5250 usb-phy.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/mach-exynos/setup-usb-phy.c |2 +-
 arch/arm/mach-s3c64xx/setup-usb-phy.c|2 +-
 arch/arm/plat-samsung/include/plat/usb-phy.h |2 +-
 drivers/usb/phy/Kconfig  |1 -
 drivers/usb/phy/samsung-usbphy.c |  369 --
 include/linux/platform_data/samsung-usbphy.h |8 +-
 6 files changed, 353 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index 1c62d20..be6cd4f 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -222,7 +222,7 @@ 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)
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c 
b/arch/arm/mach-s3c64xx/setup-usb-phy.c
index 3aee778..b7d1d95 100644
--- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -13,7 +13,7 @@
 #include mach/map.h
 #include mach/regs-sys.h
 
-void s5p_usb_phy_pmu_isolation(int on)
+void s5p_usb_phy_pmu_isolation(int on, int type)
 {
if (on) {
writel(readl(S3C64XX_OTHERS)  ~S3C64XX_OTHERS_USBMASK,
diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h 
b/arch/arm/plat-samsung/include/plat/usb-phy.h
index 165ffe7..7a4a959 100644
--- a/arch/arm/plat-samsung/include/plat/usb-phy.h
+++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
@@ -18,6 +18,6 @@ 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);
 
 #endif /* __PLAT_SAMSUNG_USB_PHY_H */
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 313685f..1ce5b32 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -35,7 +35,6 @@ config MV_U3D_PHY
 
 config SAMSUNG_USBPHY
bool Samsung USB PHY controller Driver
-   depends on USB_S3C_HSOTG
select USB_OTG_UTILS
help
  Enable this to support Samsung USB phy controller for samsung
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 4efe89c..006f72e 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -57,6 +57,116 @@
 #define S3C_RSTCON_HCLK(1  1)
 #define S3C_RSTCON_PHY (1  0)
 
+/* EXYNOS5 */
+#define EXYNOS5_PHY_HOST_CTRL0 (0x00)
+
+#define HOST_CTRL0_PHYSWRSTALL (0x1  31)
+
+#define HOST_CTRL0_REFCLKSEL_MASK  (0x3)
+#define HOST_CTRL0_REFCLKSEL(_x)   ((_x)  19)
+#define HOST_CTRL0_REFCLKSEL_XTAL  \
+   HOST_CTRL0_REFCLKSEL(0x0)
+#define HOST_CTRL0_REFCLKSEL_EXTL  \
+   HOST_CTRL0_REFCLKSEL(0x1)
+#define HOST_CTRL0_REFCLKSEL_CLKCORE   \
+   HOST_CTRL0_REFCLKSEL(0x2)
+
+#define HOST_CTRL0_FSEL_MASK   (0x7  16)
+#define HOST_CTRL0_FSEL(_x)((_x)  16)
+#define HOST_CTRL0_FSEL_CLKSEL_50M (0x7)
+#define HOST_CTRL0_FSEL_CLKSEL_24M (0x5)
+#define HOST_CTRL0_FSEL_CLKSEL_20M (0x4)
+#define HOST_CTRL0_FSEL_CLKSEL_19200K  (0x3)
+#define HOST_CTRL0_FSEL_CLKSEL_12M (0x2)
+#define HOST_CTRL0_FSEL_CLKSEL_10M (0x1)
+#define HOST_CTRL0_FSEL_CLKSEL_9600K   (0x0)
+
+#define HOST_CTRL0_TESTBURNIN  (0x1  11)
+#define HOST_CTRL0_RETENABLE   (0x1  10)
+#define HOST_CTRL0_COMMONON_N  (0x1  9)
+#define HOST_CTRL0_SIDDQ   (0x1  6)
+#define HOST_CTRL0_FORCESLEEP  (0x1  5)
+#define HOST_CTRL0_FORCESUSPEND(0x1  4)
+#define HOST_CTRL0_WORDINTERFACE   (0x1  3)
+#define HOST_CTRL0_UTMISWRST   (0x1  2)
+#define HOST_CTRL0_LINKSWRST   (0x1  1)
+#define HOST_CTRL0_PHYSWRST(0x1  0)
+
+#define EXYNOS5_PHY_HOST_TUNE0 (0x04)
+
+#define EXYNOS5_PHY_HSIC_CTRL1 (0x10)
+
+#define EXYNOS5_PHY_HSIC_TUNE1 (0x14)
+
+#define EXYNOS5_PHY_HSIC_CTRL2 (0x20)
+
+#define EXYNOS5_PHY_HSIC_TUNE2 (0x24)
+
+#define HSIC_CTRL_REFCLKSEL_MASK   (0x3)
+#define HSIC_CTRL_REFCLKSEL(0x2  23)
+
+#define HSIC_CTRL_REFCLKDIV_MASK   (0x7f)
+#define HSIC_CTRL_REFCLKDIV(_x)((_x)  16)
+#define HSIC_CTRL_REFCLKDIV_12

[PATCH v3 2/4] ARM: Exynos5250: Enabling samsung-usbphy driver

2012-10-29 Thread Vivek Gautam
Adding usbphy node for Exynos5250 along with the platform data.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../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   |   43 ---
 arch/arm/plat-samsung/include/plat/usb-phy.h   |1 +
 include/linux/platform_data/samsung-usbphy.h   |1 +
 8 files changed, 65 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
index 7b26e2d..9e21f4b 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 ehci-s5p and ohci-exynos usb 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 = 0x1213 0x100;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index da55107..d73fa42 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -419,6 +419,7 @@ config MACH_EXYNOS5_DT
bool SAMSUNG EXYNOS5 Machine using device tree
depends on ARCH_EXYNOS5
select ARM_AMBA
+   select EXYNOS4_SETUP_USB_PHY
select SOC_EXYNOS5250
select USE_OF
help
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_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_HSPHY   0x1213
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index db1cd8e..bc041be 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 be6cd4f..5aafc93 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -14,11 +14,15 @@
 #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/map-base.h
 #include plat/usb-phy.h
 
+#define

[PATCH v3 3/4] USB: ehci-s5p: Add phy driver support

2012-10-29 Thread Vivek Gautam
Adding the transceiver to ehci driver. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---

No change since v2.

 drivers/usb/host/ehci-s5p.c |   65 +-
 1 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index abc178d..e0a99af 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -17,6 +17,7 @@
 #include linux/platform_device.h
 #include linux/of_gpio.h
 #include linux/platform_data/usb-ehci-s5p.h
+#include linux/usb/phy.h
 #include plat/usb-phy.h
 
 #define EHCI_INSNREG00(base)   (base + 0x90)
@@ -32,6 +33,8 @@ struct s5p_ehci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct s5p_ehci_platdata *pdata;
 };
 
 static const struct hc_driver s5p_ehci_hc_driver = {
@@ -65,6 +68,26 @@ static const struct hc_driver s5p_ehci_hc_driver = {
.clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
 };
 
+static void s5p_ehci_phy_enable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy)
+   usb_phy_init(s5p_ehci-phy);
+   else if (s5p_ehci-pdata-phy_init)
+   s5p_ehci-pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+}
+
+static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy)
+   usb_phy_shutdown(s5p_ehci-phy);
+   else if (s5p_ehci-pdata-phy_exit)
+   s5p_ehci-pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+}
+
 static void s5p_setup_vbus_gpio(struct platform_device *pdev)
 {
int err;
@@ -92,15 +115,10 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -118,6 +136,20 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
if (!s5p_ehci)
return -ENOMEM;
 
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   /* Fallback to Phy transceiver */
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   s5p_ehci-phy = phy;
+   }
+   } else {
+   s5p_ehci-pdata = pdata;
+   }
+
s5p_ehci-dev = pdev-dev;
 
hcd = usb_create_hcd(s5p_ehci_hc_driver, pdev-dev,
@@ -163,8 +195,7 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   s5p_ehci_phy_enable(s5p_ehci);
 
ehci = hcd_to_ehci(hcd);
ehci-caps = hcd-regs;
@@ -175,13 +206,15 @@ static int __devinit s5p_ehci_probe(struct 
platform_device *pdev)
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
dev_err(pdev-dev, Failed to add USB HCD\n);
-   goto fail_io;
+   goto fail_add_hcd;
}
 
platform_set_drvdata(pdev, s5p_ehci);
 
return 0;
 
+fail_add_hcd:
+   s5p_ehci_phy_disable(s5p_ehci);
 fail_io:
clk_disable_unprepare(s5p_ehci-clk);
 fail_clk:
@@ -191,14 +224,12 @@ fail_clk:
 
 static int __devexit s5p_ehci_remove(struct platform_device *pdev)
 {
-   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
struct s5p_ehci_hcd *s5p_ehci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = s5p_ehci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   s5p_ehci_phy_disable(s5p_ehci);
 
clk_disable_unprepare(s5p_ehci-clk);
 
@@ -222,14 +253,11 @@ static int s5p_ehci_suspend(struct device *dev)
struct s5p_ehci_hcd *s5p_ehci = dev_get_drvdata(dev);
struct usb_hcd *hcd = s5p_ehci-hcd;
bool do_wakeup = device_may_wakeup(dev);
-   struct platform_device *pdev = to_platform_device(dev);
-   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
int rc;
 
rc = ehci_suspend(hcd, do_wakeup);
 
-   if (pdata  pdata-phy_exit

[PATCH v3 4/4] USB: ohci-exynos: Add phy driver support

2012-10-29 Thread Vivek Gautam
Adding the transceiver to ohci driver. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---

No change since v2.

 drivers/usb/host/ohci-exynos.c |   65 +++
 1 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 2f30329..c98dd96 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -15,14 +15,37 @@
 #include linux/of.h
 #include linux/platform_device.h
 #include linux/platform_data/usb-exynos.h
+#include linux/usb/phy.h
 #include plat/usb-phy.h
 
 struct exynos_ohci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct exynos4_ohci_platdata *pdata;
 };
 
+static void exynos_ohci_phy_enable(struct exynos_ohci_hcd *exynos_ohci)
+{
+   struct platform_device *pdev = to_platform_device(exynos_ohci-dev);
+
+   if (exynos_ohci-phy)
+   usb_phy_init(exynos_ohci-phy);
+   else if (exynos_ohci-pdata-phy_init)
+   exynos_ohci-pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+}
+
+static void exynos_ohci_phy_disable(struct exynos_ohci_hcd *exynos_ohci)
+{
+   struct platform_device *pdev = to_platform_device(exynos_ohci-dev);
+
+   if (exynos_ohci-phy)
+   usb_phy_shutdown(exynos_ohci-phy);
+   else if (exynos_ohci-pdata-phy_exit)
+   exynos_ohci-pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+}
+
 static int ohci_exynos_start(struct usb_hcd *hcd)
 {
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
@@ -81,15 +104,10 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
struct usb_hcd *hcd;
struct ohci_hcd *ohci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -105,6 +123,20 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
if (!exynos_ohci)
return -ENOMEM;
 
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   /* Fallback to Phy transceiver */
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   exynos_ohci-phy = phy;
+   }
+   } else {
+   exynos_ohci-pdata = pdata;
+   }
+
exynos_ohci-dev = pdev-dev;
 
hcd = usb_create_hcd(exynos_ohci_hc_driver, pdev-dev,
@@ -150,8 +182,7 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   exynos_ohci_phy_enable(exynos_ohci);
 
ohci = hcd_to_ohci(hcd);
ohci_hcd_init(ohci);
@@ -159,13 +190,15 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
dev_err(pdev-dev, Failed to add USB HCD\n);
-   goto fail_io;
+   goto fail_add_hcd;
}
 
platform_set_drvdata(pdev, exynos_ohci);
 
return 0;
 
+fail_add_hcd:
+   exynos_ohci_phy_disable(exynos_ohci);
 fail_io:
clk_disable_unprepare(exynos_ohci-clk);
 fail_clk:
@@ -175,14 +208,12 @@ fail_clk:
 
 static int __devexit exynos_ohci_remove(struct platform_device *pdev)
 {
-   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = exynos_ohci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   exynos_ohci_phy_disable(exynos_ohci);
 
clk_disable_unprepare(exynos_ohci-clk);
 
@@ -206,8 +237,6 @@ static int exynos_ohci_suspend(struct device *dev)
struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
struct usb_hcd *hcd = exynos_ohci-hcd;
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   struct platform_device *pdev = to_platform_device(dev);
-   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
unsigned long flags;
int rc = 0;
 
@@ -226,8 +255,7 @@ static int exynos_ohci_suspend(struct device *dev)
 
clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags);
 
-   if (pdata  pdata-phy_exit

Re: [PATCH] ARM: EXYNOS5: Remove wrongly placed usb2.0 PHY_CFG definition from PMU_REG

2012-10-30 Thread Vivek Gautam
Hi all,

On Tue, Oct 9, 2012 at 2:04 PM, Jingoo Han jg1@samsung.com wrote:
 On Friday, October 05, 2012 10:27 PM Vivek Gautam wrote

 EXYNOS5_USB_CFG macro should actually point to USB20PHY_CFG
 system register (base addr + 0x230). It's wrongly placed in regs-pmu.
 Actual register at offset 0x230 in PMU is SEQ_TRANSITION4.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

 As you mentioned, this definition is wrong.
 So, it should be removed.

 Reviewed-by: Jingoo Han jg1@samsung.com


 ---
  arch/arm/mach-exynos/include/mach/regs-pmu.h |2 --
  1 files changed, 0 insertions(+), 2 deletions(-)

 diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h 
 b/arch/arm/mach-exynos/include/mach/regs-pmu.h
 index d4e392b..70b2795 100644
 --- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
 +++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
 @@ -230,8 +230,6 @@

  /* For EXYNOS5 */

 -#define EXYNOS5_USB_CFG  
 S5P_PMUREG(0x0230)
 -

Any thoughts about this please.

  #define EXYNOS5_AUTO_WDTRESET_DISABLE
 S5P_PMUREG(0x0408)
  #define EXYNOS5_MASK_WDTRESET_REQUEST
 S5P_PMUREG(0x040C)

 --
 1.7.6.5





-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] ARM: Exynos5250: Enabling ohci-exynos driver

2012-10-31 Thread Vivek Gautam
Hi all,

On Tue, Oct 9, 2012 at 1:59 PM, Jingoo Han jg1@samsung.com wrote:
 On Friday, October 05, 2012 7:10 PM Vivek Gautam wrote

 Adding OHCI device tree node for Exynos5250 along with
 the device base address.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

 It looks good. Also I have tested this patch with Exynos5250.

 Acked-by: Jingoo Han jg1@samsung.com


Any thought about this please.

 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   15 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 ++
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 ++
  4 files changed, 24 insertions(+), 0 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 index 56e35c7..bff10a8 100644
 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -23,3 +23,18 @@ Example:
   interrupts = 0 71 0;
   samsung,vbus-gpio = gpx2 6 1 3 3;
   };
 +
 +OHCI
 +Required properties:
 + - compatible: should be samsung,exynos-ohci for USB 2.0
 +   OHCI companion controller in host mode.
 + - reg: physical base address of the controller and length of memory mapped
 +   region.
 + - interrupts: interrupt number to the cpu.
 +
 +Example:
 + ohci {
 + compatible = samsung,exynos-ohci;
 + reg = 0x1212 0x100;
 + interrupts = 0 71 0;
 + };
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index 73ea844..bcdfbe2 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -224,6 +224,12 @@
   interrupts = 0 71 0;
   };

 + ohci {
 + compatible = samsung,exynos-ohci;
 + reg = 0x1212 0x100;
 + interrupts = 0 71 0;
 + };
 +
   amba {
   #address-cells = 1;
   #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index 825fe40..cfede1f 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm/mach-exynos/include/mach/map.h
 @@ -196,6 +196,7 @@
  #define EXYNOS4_PA_OHCI  0x1259
  #define EXYNOS4_PA_HSPHY 0x125B
  #define EXYNOS5_PA_EHCI  0x1211
 +#define EXYNOS5_PA_OHCI  0x1212
  #define EXYNOS4_PA_MFC   0x1340

  #define EXYNOS4_PA_UART  0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index 6d950d7b..e6c2144 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -74,6 +74,8 @@ static const struct of_dev_auxdata 
 exynos5250_auxdata_lookup[] __initconst = {
   exynos-gsc.3, NULL),
   OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
   s5p-ehci, NULL),
 + OF_DEV_AUXDATA(samsung,exynos-ohci, EXYNOS5_PA_OHCI,
 + exynos-ohci, NULL),
   {},
  };

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-10-31 Thread Vivek Gautam
Hi all,


On Tue, Oct 9, 2012 at 1:57 PM, Jingoo Han jg1@samsung.com wrote:
 On Friday, October 05, 2012 7:10 PM Vivek Gautam wrote

 Adding EHCI device tree node for Exynos5250 along with
 the device base adress and gpio line for vbus.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

 It looks good. Also I have tested this patch with Exynos5250.

 Acked-by: Jingoo Han jg1@samsung.com

Any thoughts about this please.

 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   25 
 
  arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
  5 files changed, 38 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 new file mode 100644
 index 000..56e35c7
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -0,0 +1,25 @@
 +Samsung Exynos SoC USB controller
 +
 +The USB devices interface with USB controllers on Exynos SOCs.
 +The device node has following properties.
 +
 +EHCI
 +Required properties:
 + - compatible: should be samsung,exynos-ehci for USB 2.0
 +   EHCI controller in host mode.
 + - reg: physical base address of the controller and length of memory mapped
 +   region.
 + - interrupts: interrupt number to the cpu.
 +
 +Optional properties:
 + - samsung,vbus-gpio:  if present, specifies the GPIO that
 +   needs to be pulled up for the bus to be powered.
 +
 +Example:
 +
 + ehci {
 + compatible = samsung,exynos-ehci;
 + reg = 0x1211 0x100;
 + interrupts = 0 71 0;
 + samsung,vbus-gpio = gpx2 6 1 3 3;
 + };
 diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
 b/arch/arm/boot/dts/exynos5250-smdk5250.dts
 index a352df4..089576b 100644
 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
 +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
 @@ -166,4 +166,8 @@
   spi_2: spi@12d4 {
   status = disabled;
   };
 +
 + ehci {
 + samsung,vbus-gpio = gpx2 6 1 3 3;
 + };
  };
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index dddfd6e..73ea844 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -218,6 +218,12 @@
   #size-cells = 0;
   };

 + ehci {
 + compatible = samsung,exynos-ehci;
 + reg = 0x1211 0x100;
 + interrupts = 0 71 0;
 + };
 +
   amba {
   #address-cells = 1;
   #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index 8480849..825fe40 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  0x1258
  #define EXYNOS4_PA_OHCI  0x1259
  #define EXYNOS4_PA_HSPHY 0x125B
 +#define EXYNOS5_PA_EHCI  0x1211
  #define EXYNOS4_PA_MFC   0x1340

  #define EXYNOS4_PA_UART  0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index fee9dcd..6d950d7b 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -72,6 +72,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,exynos-ehci, EXYNOS5_PA_EHCI,
 + s5p-ehci, NULL),
   {},
  };

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/4] Adding usb2.0 host-phy support for exynos5250

2012-11-06 Thread Vivek Gautam
Hi Balbi,


On Tue, Nov 6, 2012 at 6:44 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Oct 29, 2012 at 07:12:36PM +0530, Vivek Gautam wrote:
 This patchset is based on the work by Praveen Paneri for
 samsung-usbphy driver:
 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/12653

 Changes from v2:
  - Using EXYNOS5_PHY_ as common prefix along with exact names for
PHY SFRs for register definitions
  - Using register names with bit macros to make things more clear.
  - Removed parentheses around 0x230 in definition for EXYNOS5_USB_CFG
in [patch 2/4 v2].

 Tested on smdk5250 target with usb-next branch along with arch patches
 for exynos5250:
 http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13042
 http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13048

 Vivek Gautam (4):
   usb: phy: samsung: Add host phy support to samsung-phy driver
   ARM: Exynos5250: Enabling samsung-usbphy driver
   USB: ehci-s5p: Add phy driver support
   USB: ohci-exynos: Add phy driver support

 I really don't know what to do with this series. I know it depends on
 the other PHY changes which I have in my queue, but it touches too much
 arch specific code, plus the USB Host code which I don't maintain.


True, that it has dependency on the work by Praveen Paneri for samsung-usbphy
driver plus the arch support patches.

This is based on usb-next branch, so the host-code can be taken care of ?

 On top of all that, I have no platform to test these patches, which
 makes me even more worried about signing off under this series ;-)

The patches have however been tested. The two patches:
USB: ehci-s5p: Add phy driver support,
USB: ohci-exynos: Add phy driver support have been acked by Jingoo Han
based on the patch-series.

Possibly Kukjin Kim can help on this one.

Kukjin,
Can we have a thought on this please.

 Would it be ok if we delay this to v3.9 ? At least the dependency with
 other PHY changes would be dropped by then.

This changes are almost in shape ;-) and i am updating the next patchset soon.
If possible can we try to get this in 3.8 please. :-)

 --
 balbi


-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/5] Adding usb2.0 host-phy support for exynos5250

2012-11-06 Thread Vivek Gautam
This patchset is based on the work by Praveen Paneri for
samsung-usbphy driver:
http://www.spinics.net/lists/linux-usb/msg73518.html

Changes from v3:
 - Moved enums S5P_USB_PHY_DEVICE, S5P_USB_PHY_HOST from machine to file
   include/linux/usb/samsung_usb_phy.h as USB_PHY_TYPE_DEVICE and
   USB_PHY_TYPE_HOST to make it more generic. Further resolve its
   dependencies.
 - Introduced a function 'samsung_usbphy_set_type()' which takes
   care of setting up the phy_type: HOST/DEVICE. This function
   can be called by host/otg drivers to setup phy_type prior to
   handling the respective PHYs.
 - Added an error-path for HOST type phy in s5p_usb_phy_pmu_isolation()
   for 'mach-s3c64xx'.
 - Moving to PHY driver as default for ehci-s5p and ohci-exynos, and only
   when failed fall back to plat-data.
 - Added samsung_usbphy_set_type() prior to doing usb_phy_init() or
   usb_phy_shutdown() so that appropriate PHY gets init or shutdown.

Tested on smdk5250 target with usb-next branch along with arch patches
for exynos5250:
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13042
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/13048

Vivek Gautam (5):
  ARM: EXYNOS: Update  move usb-phy types to generic include layer
  usb: phy: samsung: Add host phy support to samsung-phy driver
  ARM: Exynos5250: Enabling samsung-usbphy driver
  USB: ehci-s5p: Add phy driver support
  USB: ohci-exynos: Add phy driver support

 .../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 |9 +
 arch/arm/mach-exynos/setup-usb-phy.c   |   52 ++-
 arch/arm/mach-s3c64xx/setup-usb-phy.c  |   18 +-
 arch/arm/mach-s5pv210/setup-usb-phy.c  |5 +-
 arch/arm/plat-samsung/include/plat/usb-phy.h   |8 +-
 drivers/usb/host/ehci-s5p.c|   71 +++-
 drivers/usb/host/ohci-exynos.c |   71 +++-
 drivers/usb/phy/Kconfig|2 +-
 drivers/usb/phy/samsung-usbphy.c   |  383 ++--
 include/linux/platform_data/samsung-usbphy.h   |4 +-
 include/linux/usb/samsung_usb_phy.h|   30 ++
 15 files changed, 571 insertions(+), 101 deletions(-)
 create mode 100644 include/linux/usb/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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/5] ARM: EXYNOS: Update move usb-phy types to generic include layer

2012-11-06 Thread Vivek Gautam
Updating the names of usb-phy types to more generic names:
USB_PHY_TYPE_DEIVCE  USB_PHY_TYPE_HOST; and further update its
dependencies.

Signed-off-by: Praveen Paneri p.pan...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/mach-exynos/setup-usb-phy.c |9 +
 arch/arm/mach-s5pv210/setup-usb-phy.c|5 +++--
 arch/arm/plat-samsung/include/plat/usb-phy.h |5 -
 drivers/usb/host/ehci-s5p.c  |9 +
 drivers/usb/host/ohci-exynos.c   |9 +
 include/linux/usb/samsung_usb_phy.h  |   17 +
 6 files changed, 35 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/usb/samsung_usb_phy.h

diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index 1c62d20..c77f51b 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -14,6 +14,7 @@
 #include linux/err.h
 #include linux/io.h
 #include linux/platform_device.h
+#include linux/usb/samsung_usb_phy.h
 #include mach/regs-pmu.h
 #include mach/regs-usb-phy.h
 #include plat/cpu.h
@@ -204,9 +205,9 @@ static int exynos4210_usb_phy1_exit(struct platform_device 
*pdev)
 
 int s5p_usb_phy_init(struct platform_device *pdev, int type)
 {
-   if (type == S5P_USB_PHY_DEVICE)
+   if (type == USB_PHY_TYPE_DEVICE)
return exynos4210_usb_phy0_init(pdev);
-   else if (type == S5P_USB_PHY_HOST)
+   else if (type == USB_PHY_TYPE_HOST)
return exynos4210_usb_phy1_init(pdev);
 
return -EINVAL;
@@ -214,9 +215,9 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
 
 int s5p_usb_phy_exit(struct platform_device *pdev, int type)
 {
-   if (type == S5P_USB_PHY_DEVICE)
+   if (type == USB_PHY_TYPE_DEVICE)
return exynos4210_usb_phy0_exit(pdev);
-   else if (type == S5P_USB_PHY_HOST)
+   else if (type == USB_PHY_TYPE_HOST)
return exynos4210_usb_phy1_exit(pdev);
 
return -EINVAL;
diff --git a/arch/arm/mach-s5pv210/setup-usb-phy.c 
b/arch/arm/mach-s5pv210/setup-usb-phy.c
index be39cf4..cdb80a5 100644
--- a/arch/arm/mach-s5pv210/setup-usb-phy.c
+++ b/arch/arm/mach-s5pv210/setup-usb-phy.c
@@ -12,6 +12,7 @@
 #include linux/err.h
 #include linux/io.h
 #include linux/platform_device.h
+#include linux/usb/samsung_usb_phy.h
 #include mach/map.h
 #include mach/regs-sys.h
 #include plat/cpu.h
@@ -75,7 +76,7 @@ static int s5pv210_usb_otgphy_exit(struct platform_device 
*pdev)
 
 int s5p_usb_phy_init(struct platform_device *pdev, int type)
 {
-   if (type == S5P_USB_PHY_DEVICE)
+   if (type == USB_PHY_TYPE_DEVICE)
return s5pv210_usb_otgphy_init(pdev);
 
return -EINVAL;
@@ -83,7 +84,7 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
 
 int s5p_usb_phy_exit(struct platform_device *pdev, int type)
 {
-   if (type == S5P_USB_PHY_DEVICE)
+   if (type == USB_PHY_TYPE_DEVICE)
return s5pv210_usb_otgphy_exit(pdev);
 
return -EINVAL;
diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h 
b/arch/arm/plat-samsung/include/plat/usb-phy.h
index 165ffe7..4e6f370 100644
--- a/arch/arm/plat-samsung/include/plat/usb-phy.h
+++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
@@ -11,11 +11,6 @@
 #ifndef __PLAT_SAMSUNG_USB_PHY_H
 #define __PLAT_SAMSUNG_USB_PHY_H __FILE__
 
-enum s5p_usb_phy_type {
-   S5P_USB_PHY_DEVICE,
-   S5P_USB_PHY_HOST,
-};
-
 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);
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index abc178d..0cd0c7b 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -17,6 +17,7 @@
 #include linux/platform_device.h
 #include linux/of_gpio.h
 #include linux/platform_data/usb-ehci-s5p.h
+#include linux/usb/samsung_usb_phy.h
 #include plat/usb-phy.h
 
 #define EHCI_INSNREG00(base)   (base + 0x90)
@@ -164,7 +165,7 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
}
 
if (pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
 
ehci = hcd_to_ehci(hcd);
ehci-caps = hcd-regs;
@@ -198,7 +199,7 @@ static int __devexit s5p_ehci_remove(struct platform_device 
*pdev)
usb_remove_hcd(hcd);
 
if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
 
clk_disable_unprepare(s5p_ehci-clk);
 
@@ -229,7 +230,7 @@ static int s5p_ehci_suspend(struct device *dev)
rc = ehci_suspend(hcd, do_wakeup);
 
if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST

[PATCH 2/5] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-11-06 Thread Vivek Gautam
This patch adds host phy support to samsung-usbphy.c and
further adds support for samsung's exynos5250 usb-phy.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Signed-off-by: Praveen Paneri p.pan...@samsung.com
---
 arch/arm/mach-exynos/setup-usb-phy.c |2 +-
 arch/arm/mach-s3c64xx/setup-usb-phy.c|   18 +-
 arch/arm/plat-samsung/include/plat/usb-phy.h |2 +-
 drivers/usb/phy/Kconfig  |2 +-
 drivers/usb/phy/samsung-usbphy.c |  383 --
 include/linux/platform_data/samsung-usbphy.h |4 +-
 include/linux/usb/samsung_usb_phy.h  |   13 +
 7 files changed, 385 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index c77f51b..39de35f 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -223,7 +223,7 @@ 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)
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c 
b/arch/arm/mach-s3c64xx/setup-usb-phy.c
index 3aee778..da134f3 100644
--- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -10,16 +10,22 @@
  */
 
 #include linux/io.h
+#include linux/usb/samsung_usb_phy.h
 #include mach/map.h
 #include mach/regs-sys.h
 
-void s5p_usb_phy_pmu_isolation(int on)
+void s5p_usb_phy_pmu_isolation(int on, int type)
 {
-   if (on) {
-   writel(readl(S3C64XX_OTHERS)  ~S3C64XX_OTHERS_USBMASK,
-   S3C64XX_OTHERS);
+   if (type == USB_PHY_TYPE_HOST) {
+   pr_err( Not a valid phy type\n);
+   return -EINVAL;
} else {
-   writel(readl(S3C64XX_OTHERS) | S3C64XX_OTHERS_USBMASK,
-   S3C64XX_OTHERS);
+   if (on) {
+   writel(readl(S3C64XX_OTHERS)  ~S3C64XX_OTHERS_USBMASK,
+   S3C64XX_OTHERS);
+   } else {
+   writel(readl(S3C64XX_OTHERS) | S3C64XX_OTHERS_USBMASK,
+   S3C64XX_OTHERS);
+   }
}
 }
diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h 
b/arch/arm/plat-samsung/include/plat/usb-phy.h
index 4e6f370..5156343 100644
--- a/arch/arm/plat-samsung/include/plat/usb-phy.h
+++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
@@ -13,6 +13,6 @@
 
 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);
 
 #endif /* __PLAT_SAMSUNG_USB_PHY_H */
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 313685f..65b9551 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -35,7 +35,7 @@ config MV_U3D_PHY
 
 config SAMSUNG_USBPHY
bool Samsung USB PHY controller Driver
-   depends on USB_S3C_HSOTG
+   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS
select USB_OTG_UTILS
help
  Enable this to support Samsung USB phy controller for samsung
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 3c84aab..3b4863d 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -5,7 +5,8 @@
  *
  * Author: Praveen Paneri p.pan...@samsung.com
  *
- * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller
+ * Samsung USB-PHY transceiver; talks to S3C HS OTG controller, EHCI-S5P and
+ * OHCI-EXYNOS controllers.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -24,7 +25,7 @@
 #include linux/err.h
 #include linux/io.h
 #include linux/of.h
-#include linux/usb/otg.h
+#include linux/usb/samsung_usb_phy.h
 #include linux/platform_data/samsung-usbphy.h
 
 /* Register definitions */
@@ -56,6 +57,116 @@
 #define RSTCON_HLINK_SWRST (0x1  1)
 #define RSTCON_SWRST   (0x1  0)
 
+/* EXYNOS5 */
+#define EXYNOS5_PHY_HOST_CTRL0 (0x00)
+
+#define HOST_CTRL0_PHYSWRSTALL (0x1  31)
+
+#define HOST_CTRL0_REFCLKSEL_MASK  (0x3)
+#define HOST_CTRL0_REFCLKSEL(_x)   ((_x)  19)
+#define HOST_CTRL0_REFCLKSEL_XTAL  \
+   HOST_CTRL0_REFCLKSEL(0x0)
+#define HOST_CTRL0_REFCLKSEL_EXTL  \
+   HOST_CTRL0_REFCLKSEL(0x1)
+#define HOST_CTRL0_REFCLKSEL_CLKCORE   \
+   HOST_CTRL0_REFCLKSEL(0x2)
+
+#define HOST_CTRL0_FSEL_MASK   (0x7  16)
+#define HOST_CTRL0_FSEL(_x)((_x)  16)
+#define HOST_CTRL0_FSEL_CLKSEL_50M (0x7

[PATCH v4 3/5] ARM: Exynos5250: Enabling samsung-usbphy driver

2012-11-06 Thread Vivek Gautam
Adding usbphy node for Exynos5250 along with the platform data

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../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 |9 
 arch/arm/mach-exynos/setup-usb-phy.c   |   41 ---
 arch/arm/plat-samsung/include/plat/usb-phy.h   |1 +
 7 files changed, 61 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
index 7b26e2d..9e21f4b 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 ehci-s5p and ohci-exynos usb 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 = 0x1213 0x100;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index da55107..d73fa42 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -419,6 +419,7 @@ config MACH_EXYNOS5_DT
bool SAMSUNG EXYNOS5 Machine using device tree
depends on ARCH_EXYNOS5
select ARM_AMBA
+   select EXYNOS4_SETUP_USB_PHY
select SOC_EXYNOS5250
select USE_OF
help
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_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_HSPHY   0x1213
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index db1cd8e..bf20918 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,15 @@
 
 #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,
+};
+
 /*
  * 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 +79,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 39de35f..6c768e0 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -15,11 +15,15 @@
 #include linux/io.h
 #include linux/platform_device.h
 #include linux/usb/samsung_usb_phy.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/map-base.h
 #include plat/usb-phy.h
 
+#define EXYNOS5_USB_CFG(S3C_VA_SYS + 0x230)
+
 static

[PATCH v4 4/5] USB: ehci-s5p: Add phy driver support

2012-11-06 Thread Vivek Gautam
Adding the phy driver to ehci-s5p. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 drivers/usb/host/ehci-s5p.c |   70 ++-
 1 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 0cd0c7b..14f01c6 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -17,6 +17,7 @@
 #include linux/platform_device.h
 #include linux/of_gpio.h
 #include linux/platform_data/usb-ehci-s5p.h
+#include linux/usb/phy.h
 #include linux/usb/samsung_usb_phy.h
 #include plat/usb-phy.h
 
@@ -33,6 +34,8 @@ struct s5p_ehci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct s5p_ehci_platdata *pdata;
 };
 
 static const struct hc_driver s5p_ehci_hc_driver = {
@@ -66,6 +69,30 @@ static const struct hc_driver s5p_ehci_hc_driver = {
.clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
 };
 
+static void s5p_ehci_phy_enable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy) {
+   samsung_usbphy_set_type(s5p_ehci-phy, USB_PHY_TYPE_HOST);
+   usb_phy_init(s5p_ehci-phy);
+   } else if (s5p_ehci-pdata-phy_init) {
+   s5p_ehci-pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
+   }
+}
+
+static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy) {
+   samsung_usbphy_set_type(s5p_ehci-phy, USB_PHY_TYPE_HOST);
+   usb_phy_shutdown(s5p_ehci-phy);
+   } else if (s5p_ehci-pdata-phy_exit) {
+   s5p_ehci-pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
+   }
+}
+
 static void s5p_setup_vbus_gpio(struct platform_device *pdev)
 {
int err;
@@ -88,20 +115,15 @@ static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
 
 static int __devinit s5p_ehci_probe(struct platform_device *pdev)
 {
-   struct s5p_ehci_platdata *pdata;
+   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
struct s5p_ehci_hcd *s5p_ehci;
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -119,6 +141,19 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
if (!s5p_ehci)
return -ENOMEM;
 
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   /* Fallback to pdata */
+   if (!pdata) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   s5p_ehci-pdata = pdata;
+   }
+   } else {
+   s5p_ehci-phy = phy;
+   }
+
s5p_ehci-dev = pdev-dev;
 
hcd = usb_create_hcd(s5p_ehci_hc_driver, pdev-dev,
@@ -164,8 +199,7 @@ static int __devinit s5p_ehci_probe(struct platform_device 
*pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
+   s5p_ehci_phy_enable(s5p_ehci);
 
ehci = hcd_to_ehci(hcd);
ehci-caps = hcd-regs;
@@ -176,13 +210,15 @@ static int __devinit s5p_ehci_probe(struct 
platform_device *pdev)
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
dev_err(pdev-dev, Failed to add USB HCD\n);
-   goto fail_io;
+   goto fail_add_hcd;
}
 
platform_set_drvdata(pdev, s5p_ehci);
 
return 0;
 
+fail_add_hcd:
+   s5p_ehci_phy_disable(s5p_ehci);
 fail_io:
clk_disable_unprepare(s5p_ehci-clk);
 fail_clk:
@@ -192,14 +228,12 @@ fail_clk:
 
 static int __devexit s5p_ehci_remove(struct platform_device *pdev)
 {
-   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
struct s5p_ehci_hcd *s5p_ehci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = s5p_ehci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
+   s5p_ehci_phy_disable(s5p_ehci);
 
clk_disable_unprepare(s5p_ehci-clk);
 
@@ -223,14 +257,11 @@ static int s5p_ehci_suspend(struct device *dev)
struct s5p_ehci_hcd *s5p_ehci = dev_get_drvdata(dev);
struct usb_hcd *hcd = s5p_ehci-hcd

[PATCH v4 5/5] USB: ohci-exynos: Add phy driver support

2012-11-06 Thread Vivek Gautam
Adding the phy-driver to ohci-exynos. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 drivers/usb/host/ohci-exynos.c |   70 
 1 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 1f46898..97d5aa5 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -15,6 +15,7 @@
 #include linux/of.h
 #include linux/platform_device.h
 #include linux/platform_data/usb-exynos.h
+#include linux/usb/phy.h
 #include linux/usb/samsung_usb_phy.h
 #include plat/usb-phy.h
 
@@ -22,8 +23,34 @@ struct exynos_ohci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct exynos4_ohci_platdata *pdata;
 };
 
+static void exynos_ohci_phy_enable(struct exynos_ohci_hcd *exynos_ohci)
+{
+   struct platform_device *pdev = to_platform_device(exynos_ohci-dev);
+
+   if (exynos_ohci-phy) {
+   samsung_usbphy_set_type(exynos_ohci-phy, USB_PHY_TYPE_HOST);
+   usb_phy_init(exynos_ohci-phy);
+   } else if (exynos_ohci-pdata-phy_init) {
+   exynos_ohci-pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
+   }
+}
+
+static void exynos_ohci_phy_disable(struct exynos_ohci_hcd *exynos_ohci)
+{
+   struct platform_device *pdev = to_platform_device(exynos_ohci-dev);
+
+   if (exynos_ohci-phy) {
+   samsung_usbphy_set_type(exynos_ohci-phy, USB_PHY_TYPE_HOST);
+   usb_phy_shutdown(exynos_ohci-phy);
+   } else if (exynos_ohci-pdata-phy_exit) {
+   exynos_ohci-pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
+   }
+}
+
 static int ohci_exynos_reset(struct usb_hcd *hcd)
 {
return ohci_init(hcd_to_ohci(hcd));
@@ -79,20 +106,15 @@ static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32);
 
 static int __devinit exynos_ohci_probe(struct platform_device *pdev)
 {
-   struct exynos4_ohci_platdata *pdata;
+   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
struct exynos_ohci_hcd *exynos_ohci;
struct usb_hcd *hcd;
struct ohci_hcd *ohci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -108,6 +130,19 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
if (!exynos_ohci)
return -ENOMEM;
 
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   /* Fallback to pdata */
+   if (!pdata) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   exynos_ohci-pdata = pdata;
+   }
+   } else {
+   exynos_ohci-phy = phy;
+   }
+
exynos_ohci-dev = pdev-dev;
 
hcd = usb_create_hcd(exynos_ohci_hc_driver, pdev-dev,
@@ -153,8 +188,7 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
+   exynos_ohci_phy_enable(exynos_ohci);
 
ohci = hcd_to_ohci(hcd);
ohci_hcd_init(ohci);
@@ -162,13 +196,15 @@ static int __devinit exynos_ohci_probe(struct 
platform_device *pdev)
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
dev_err(pdev-dev, Failed to add USB HCD\n);
-   goto fail_io;
+   goto fail_add_hcd;
}
 
platform_set_drvdata(pdev, exynos_ohci);
 
return 0;
 
+fail_add_hcd:
+   exynos_ohci_phy_disable(exynos_ohci);
 fail_io:
clk_disable_unprepare(exynos_ohci-clk);
 fail_clk:
@@ -178,14 +214,12 @@ fail_clk:
 
 static int __devexit exynos_ohci_remove(struct platform_device *pdev)
 {
-   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = exynos_ohci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
+   exynos_ohci_phy_disable(exynos_ohci);
 
clk_disable_unprepare(exynos_ohci-clk);
 
@@ -209,8 +243,6 @@ static int exynos_ohci_suspend(struct device *dev)
struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
struct usb_hcd *hcd = exynos_ohci-hcd;
struct ohci_hcd

[PATCH] ARM: EXYNOS5250: Add support for USB 3.0 dwc3 controller

2012-11-06 Thread Vivek Gautam
Here we add the required support for device tree and further
clocks and device reigster base address.

Based on 'for-next' branch of linux-samsung tree.
Tested with required driver DT patches for dwc3-exynos:
http://www.spinics.net/lists/linux-usb/msg73857.html
and USB 3.0 phy support patches:
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-November/021915.html

Vivek Gautam (1):
  ARM: Exynos5250: Enabling dwc3-exynos driver

 arch/arm/boot/dts/exynos5250.dtsi   |6 ++
 arch/arm/mach-exynos/clock-exynos5.c|   24 
 arch/arm/mach-exynos/include/mach/map.h |1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c  |2 ++
 drivers/usb/Kconfig |1 +
 5 files changed, 34 insertions(+), 0 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: Exynos5250: Enabling dwc3-exynos driver

2012-11-06 Thread Vivek Gautam
Adding DWC3 device tree node for Exynos5250 along with the
device address and clock support needed for the controller.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/boot/dts/exynos5250.dtsi   |6 ++
 arch/arm/mach-exynos/clock-exynos5.c|   24 
 arch/arm/mach-exynos/include/mach/map.h |1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c  |2 ++
 drivers/usb/Kconfig |1 +
 5 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index cf6a02d..52bca54 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -68,6 +68,12 @@
interrupts = 0 96 0;
};
 
+   dwc3 {
+   compatible = samsung,exynos-dwc3;
+   reg = 0x1200 0x1;
+   interrupts = 0 72 0;
+   };
+
rtc {
compatible = samsung,s3c6410-rtc;
reg = 0x101E 0x100;
diff --git a/arch/arm/mach-exynos/clock-exynos5.c 
b/arch/arm/mach-exynos/clock-exynos5.c
index a88e0d9..ee094ee 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -740,6 +740,11 @@ static struct clk exynos5_init_clocks_off[] = {
.enable = exynos5_clk_ip_fsys_ctrl ,
.ctrlbit= (1  18),
}, {
+   .name   = usbdrd30,
+   .parent = exynos5_clk_aclk_200.clk,
+   .enable = exynos5_clk_ip_fsys_ctrl,
+   .ctrlbit= (1  19),
+   }, {
.name   = usbotg,
.enable = exynos5_clk_ip_fsys_ctrl,
.ctrlbit= (1  7),
@@ -1004,6 +1009,16 @@ struct clksrc_sources exynos5_clkset_group = {
.nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
 };
 
+struct clk *exynos5_clkset_usbdrd30_list[] = {
+   [0] = exynos5_clk_mout_mpll.clk,
+   [1] = exynos5_clk_mout_cpll.clk,
+};
+
+struct clksrc_sources exynos5_clkset_usbdrd30 = {
+   .sources= exynos5_clkset_usbdrd30_list,
+   .nr_sources = ARRAY_SIZE(exynos5_clkset_usbdrd30_list),
+};
+
 /* Possible clock sources for aclk_266_gscl_sub Mux */
 static struct clk *clk_src_gscl_266_list[] = {
[0] = clk_ext_xtal_mux,
@@ -1288,6 +1303,15 @@ static struct clksrc_clk exynos5_clksrcs[] = {
.parent = exynos5_clk_mout_cpll.clk,
},
.reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 },
+   }, {
+   .clk= {
+   .name   = sclk_usbdrd30,
+   .enable = exynos5_clksrc_mask_fsys_ctrl,
+   .ctrlbit= (1  28),
+   },
+   .sources = exynos5_clkset_usbdrd30,
+   .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 28, .size = 1 
},
+   .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 24, .size = 
4 },
},
 };
 
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index ef4958b..397fb9d 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -197,6 +197,7 @@
 #define EXYNOS4_PA_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_DRD 0x1200
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index ed37273..8896926 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -86,6 +86,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
exynos5-hdmi, NULL),
OF_DEV_AUXDATA(samsung,exynos5-mixer, 0x1445,
exynos5-mixer, NULL),
+   OF_DEV_AUXDATA(samsung,exynos-dwc3, EXYNOS5_PA_DRD,
+   exynos-dwc3, NULL),
{},
 };
 
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 4c90b51..0454b8a 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -53,6 +53,7 @@ config USB_ARCH_HAS_EHCI
 # some non-PCI HCDs implement xHCI
 config USB_ARCH_HAS_XHCI
boolean
+   default y if ARCH_EXYNOS5
default PCI
 
 menuconfig USB_SUPPORT
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] Adding USB 3.0 DRD-phy support for exynos5250

2012-11-06 Thread Vivek Gautam
This patchset is based on the work for USB 2.0 host phy support
for exynos5250
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-November/021915.html

Based on 'usb-next' branch.
Tested on smdk5250 with following patch-series:
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-November/021923.html
http://www.spinics.net/lists/linux-usb/msg73857.html

Vivek Gautam (2):
  USB: PHY: Add support for USB 3.0 phy for exynos5250
  ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver

 arch/arm/boot/dts/exynos5250.dtsi|3 +-
 arch/arm/mach-exynos/include/mach/regs-pmu.h |4 +
 arch/arm/mach-exynos/setup-usb-phy.c |9 +
 drivers/usb/phy/samsung-usbphy.c |  337 ++
 include/linux/usb/samsung_usb_phy.h  |1 +
 5 files changed, 353 insertions(+), 1 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] USB: PHY: Add support for USB 3.0 phy for exynos5250

2012-11-06 Thread Vivek Gautam
Adding support for USB3.0 phy for dwc3 controller on
exynso5250 SOC.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/phy/samsung-usbphy.c|  337 +++
 include/linux/usb/samsung_usb_phy.h |1 +
 2 files changed, 338 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 3b4863d..e3b5fb1 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -167,6 +167,99 @@
 
 #define EXYNOS5_PHY_OTG_TUNE   (0x40)
 
+/* USB 3.0: DRD */
+#define EXYNOS5_DRD_LINKSYSTEM (0x04)
+
+#define LINKSYSTEM_FLADJ_MASK  (0x3f  1)
+#define LINKSYSTEM_FLADJ(_x)   ((_x)  1)
+#define LINKSYSTEM_XHCI_VERSION_CONTROL(1  27)
+
+#define EXYNOS5_DRD_PHYUTMI(0x08)
+
+#define PHYUTMI_OTGDISABLE (1  6)
+#define PHYUTMI_FORCESUSPEND   (1  1)
+#define PHYUTMI_FORCESLEEP (1  0)
+
+#define EXYNOS5_DRD_PHYPIPE(0x0C)
+
+#define EXYNOS5_DRD_PHYCLKRST  (0x10)
+
+#define PHYCLKRST_SSC_REFCLKSEL_MASK   (0xff  23)
+#define PHYCLKRST_SSC_REFCLKSEL(_x)((_x)  23)
+
+#define PHYCLKRST_SSC_RANGE_MASK   (0x03  21)
+#define PHYCLKRST_SSC_RANGE(_x)((_x)  21)
+
+#define PHYCLKRST_SSC_EN   (1  20)
+#define PHYCLKRST_REF_SSP_EN   (1  19)
+#define PHYCLKRST_REF_CLKDIV2  (1  18)
+
+#define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f  11)
+#define PHYCLKRST_MPLL_MULTIPLIER(_x)  ((_x)  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF   \
+   PHYCLKRST_MPLL_MULTIPLIER(0x19)
+#define PHYCLKRST_MPLL_MULTIPLIER_50M_REF  \
+   PHYCLKRST_MPLL_MULTIPLIER(0x02)
+#define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF\
+   PHYCLKRST_MPLL_MULTIPLIER(0x68)
+#define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF\
+   PHYCLKRST_MPLL_MULTIPLIER(0x7d)
+#define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF \
+   PHYCLKRST_MPLL_MULTIPLIER(0x02)
+
+#define PHYCLKRST_FSEL_MASK(0x3f  5)
+#define PHYCLKRST_FSEL(_x) ((_x)  5)
+#define PHYCLKRST_FSEL_PAD_100MHZ  \
+   PHYCLKRST_FSEL(0x27)
+#define PHYCLKRST_FSEL_PAD_24MHZ   \
+   PHYCLKRST_FSEL(0x2a)
+#define PHYCLKRST_FSEL_PAD_20MHZ   \
+   PHYCLKRST_FSEL(0x31)
+#define PHYCLKRST_FSEL_PAD_19_2MHZ \
+   PHYCLKRST_FSEL(0x38)
+
+#define PHYCLKRST_RETENABLEN   (1  4)
+
+#define PHYCLKRST_REFCLKSEL_MASK   (0x03  2)
+#define PHYCLKRST_REFCLKSEL(_x)((_x)  2)
+#define PHYCLKRST_REFCLKSEL_PAD_REFCLK \
+   PHYCLKRST_REFCLKSEL(2)
+#define PHYCLKRST_REFCLKSEL_EXT_REFCLK \
+   PHYCLKRST_REFCLKSEL(3)
+
+#define PHYCLKRST_PORTRESET(1  1)
+#define PHYCLKRST_COMMONONN(1  0)
+
+#define EXYNOS5_DRD_PHYREG0(0x14)
+#define EXYNOS5_DRD_PHYREG1(0x18)
+
+#define EXYNOS5_DRD_PHYPARAM0  (0x1C)
+
+#define PHYPARAM0_REF_USE_PAD  (0x1  31)
+#define PHYPARAM0_REF_LOSLEVEL_MASK(0x1f  26)
+#define PHYPARAM0_REF_LOSLEVEL (0x9  26)
+
+#define EXYNOS5_DRD_PHYPARAM1  (0x20)
+
+#define PHYPARAM1_PCS_TXDEEMPH_MASK(0x1f  0)
+#define PHYPARAM1_PCS_TXDEEMPH (0x1C)
+
+#define EXYNOS5_DRD_PHYTERM(0x24)
+
+#define EXYNOS5_DRD_PHYTEST(0x28)
+
+#define PHYTEST_POWERDOWN_SSP  (1  3)
+#define PHYTEST_POWERDOWN_HSP  (1  2)
+
+#define EXYNOS5_DRD_PHYADP (0x2C)
+
+#define EXYNOS5_DRD_PHYBATCHG  (0x30)
+
+#define PHYBATCHG_UTMI_CLKSEL  (0x1  2)
+
+#define EXYNOS5_DRD_PHYRESUME  (0x34)
+#define EXYNOS5_DRD_LINKPORT   (0x44)
+
 #ifndef MHZ
 #define MHZ (1000*1000)
 #endif
@@ -180,10 +273,12 @@ enum samsung_cpu_type {
 /*
  * struct samsung_usbphy - transceiver driver state
  * @phy: transceiver structure
+ * @phy3: transceiver structure for USB 3.0
  * @plat: platform data
  * @dev: The parent device supplied to the probe function
  * @clk: usb phy clock
  * @regs: usb phy register memory base
+ * @regs_phy3: usb 3.0 phy register memory base
  * @ref_clk_freq: reference clock frequency selection
  * @cpu_type: machine identifier
  * @phy_type: It keeps track of the PHY type.
@@ -191,10 +286,12 @@ enum samsung_cpu_type {
  */
 struct samsung_usbphy {
struct usb_phy  phy;
+   struct usb_phy  phy3;
struct samsung_usbphy_data *plat;
struct device   *dev;
struct clk  *clk;
void __iomem

[PATCH 2/2] ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver

2012-11-06 Thread Vivek Gautam
Adding base address information and required platform data
support for enabling USB DRD phy on exynos5250 SOC.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/boot/dts/exynos5250.dtsi|3 ++-
 arch/arm/mach-exynos/include/mach/regs-pmu.h |4 
 arch/arm/mach-exynos/setup-usb-phy.c |9 +
 3 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 82bf042..51693af 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -220,7 +220,8 @@
 
usbphy {
compatible = samsung,exynos5250-usbphy;
-   reg = 0x1213 0x100;
+   reg = 0x1213 0x100,
+ 0x1210 0x100;
};
 
amba {
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h 
b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index d4e392b..67132b4 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -39,6 +39,10 @@
 #define S5P_HDMI_PHY_CONTROL   S5P_PMUREG(0x0700)
 #define S5P_HDMI_PHY_ENABLE(1  0)
 
+/* only for EXYNOS5250*/
+#define S5P_USBDRD_PHY_CONTROL S5P_PMUREG(0x0704)
+#define S5P_USBDRD_PHY_ENABLE  (1  0)
+
 #define S5P_DAC_PHY_CONTROLS5P_PMUREG(0x070C)
 #define S5P_DAC_PHY_ENABLE (1  0)
 
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c 
b/arch/arm/mach-exynos/setup-usb-phy.c
index 6c768e0..5e46fdd 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -238,6 +238,15 @@ void s5p_usb_phy_pmu_isolation(int on, int type)
writel(readl(S5P_USBHOST_PHY_CONTROL)
| S5P_USBHOST_PHY_ENABLE,
S5P_USBHOST_PHY_CONTROL);
+   } else if (type == USB_PHY_TYPE_DRD) {
+   if (on)
+   writel(readl(S5P_USBDRD_PHY_CONTROL)
+~S5P_USBDRD_PHY_ENABLE,
+   S5P_USBDRD_PHY_CONTROL);
+   else
+   writel(readl(S5P_USBDRD_PHY_CONTROL)
+   | S5P_USBDRD_PHY_ENABLE,
+   S5P_USBDRD_PHY_CONTROL);
} else {
if (on)
writel(readl(S5P_USBDEVICE_PHY_CONTROL)
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: Exynos5250: Enabling dwc3-exynos driver

2012-11-07 Thread Vivek Gautam
Hi,


On Tue, Nov 6, 2012 at 10:13 PM, Felipe Balbi ba...@ti.com wrote:
 On Tue, Nov 06, 2012 at 08:58:49PM +0530, Vivek Gautam wrote:
 Adding DWC3 device tree node for Exynos5250 along with the
 device address and clock support needed for the controller.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  arch/arm/boot/dts/exynos5250.dtsi   |6 ++
  arch/arm/mach-exynos/clock-exynos5.c|   24 
  arch/arm/mach-exynos/include/mach/map.h |1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c  |2 ++
  drivers/usb/Kconfig |1 +
  5 files changed, 34 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index cf6a02d..52bca54 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -68,6 +68,12 @@
   interrupts = 0 96 0;
   };

 + dwc3 {

 shouldn't this be usb@1200 ??

Kept this in accordance with controller's name, similar to the change
in following:
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg12800.html

Needs to be changed ?

 + compatible = samsung,exynos-dwc3;
 + reg = 0x1200 0x1;
 + interrupts = 0 72 0;
 + };
 +
   rtc {
   compatible = samsung,s3c6410-rtc;
   reg = 0x101E 0x100;
 diff --git a/arch/arm/mach-exynos/clock-exynos5.c 
 b/arch/arm/mach-exynos/clock-exynos5.c
 index a88e0d9..ee094ee 100644
 --- a/arch/arm/mach-exynos/clock-exynos5.c
 +++ b/arch/arm/mach-exynos/clock-exynos5.c
 @@ -740,6 +740,11 @@ static struct clk exynos5_init_clocks_off[] = {
   .enable = exynos5_clk_ip_fsys_ctrl ,
   .ctrlbit= (1  18),
   }, {
 + .name   = usbdrd30,
 + .parent = exynos5_clk_aclk_200.clk,
 + .enable = exynos5_clk_ip_fsys_ctrl,
 + .ctrlbit= (1  19),
 + }, {
   .name   = usbotg,
   .enable = exynos5_clk_ip_fsys_ctrl,
   .ctrlbit= (1  7),
 @@ -1004,6 +1009,16 @@ struct clksrc_sources exynos5_clkset_group = {
   .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
  };

 +struct clk *exynos5_clkset_usbdrd30_list[] = {
 + [0] = exynos5_clk_mout_mpll.clk,
 + [1] = exynos5_clk_mout_cpll.clk,

 looks like [0] and [1] indexes are unnecessary ?!? Not sure about
 mach-exynos' preferred array initialization style, though ;-)

These are in sync with code-style in mach-exynos/clock-exynos5.c
Probably this is how it is used with mach-exynos.

 diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
 index 4c90b51..0454b8a 100644
 --- a/drivers/usb/Kconfig
 +++ b/drivers/usb/Kconfig
 @@ -53,6 +53,7 @@ config USB_ARCH_HAS_EHCI
  # some non-PCI HCDs implement xHCI
  config USB_ARCH_HAS_XHCI
   boolean
 + default y if ARCH_EXYNOS5

 NAK, this should be done on your arch/arm/mach-exynos/Kconfig. Just
 select USB_ARCH_HAS_XHCI.

Oops !! Sure, will move this to arch/arm/mach-exynos/Kconfig.

 --
 balbi



--
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] USB: PHY: Add support for USB 3.0 phy for exynos5250

2012-11-07 Thread Vivek Gautam
Hi,


On Wed, Nov 7, 2012 at 5:10 AM, Sylwester Nawrocki
sylvester.nawro...@gmail.com wrote:

 Hi,

 I have a few comments. Please see below...


 On 11/06/2012 04:36 PM, Vivek Gautam wrote:

 Adding support for USB3.0 phy for dwc3 controller on
 exynso5250 SOC.


 exynso - exynos

Sure, will correct this.




 Signed-off-by: Vivek Gautamgautam.vi...@samsung.com
 ---
   drivers/usb/phy/samsung-usbphy.c|  337 
 +++
   include/linux/usb/samsung_usb_phy.h |1 +
   2 files changed, 338 insertions(+), 0 deletions(-)

 diff --git a/drivers/usb/phy/samsung-usbphy.c 
 b/drivers/usb/phy/samsung-usbphy.c
 index 3b4863d..e3b5fb1 100644
 --- a/drivers/usb/phy/samsung-usbphy.c
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -167,6 +167,99 @@

   #define EXYNOS5_PHY_OTG_TUNE  (0x40)

 +/* USB 3.0: DRD */
 +#define EXYNOS5_DRD_LINKSYSTEM (0x04)
 +
 +#define LINKSYSTEM_FLADJ_MASK  (0x3f  1)
 +#define LINKSYSTEM_FLADJ(_x)   ((_x)  1)
 +#define LINKSYSTEM_XHCI_VERSION_CONTROL(1  27)
 +
 +#define EXYNOS5_DRD_PHYUTMI(0x08)
 +
 +#define PHYUTMI_OTGDISABLE (1  6)
 +#define PHYUTMI_FORCESUSPEND   (1  1)
 +#define PHYUTMI_FORCESLEEP (1  0)
 +
 +#define EXYNOS5_DRD_PHYPIPE(0x0C)


 Would be nice to put all hex numbers in lower case.

Sure, will put the hex numbers in sync.


 +
 +#define EXYNOS5_DRD_PHYCLKRST  (0x10)
 +
 +#define PHYCLKRST_SSC_REFCLKSEL_MASK   (0xff  23)
 +#define PHYCLKRST_SSC_REFCLKSEL(_x)((_x)  23)
 +
 +#define PHYCLKRST_SSC_RANGE_MASK   (0x03  21)
 +#define PHYCLKRST_SSC_RANGE(_x)((_x)  21)
 +
 +#define PHYCLKRST_SSC_EN   (1  20)
 +#define PHYCLKRST_REF_SSP_EN   (1  19)
 +#define PHYCLKRST_REF_CLKDIV2  (1  18)
 +
 +#define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f  11)
 +#define PHYCLKRST_MPLL_MULTIPLIER(_x)  ((_x)  11)


 Is this macro-definition going to be used anywhere else except the
 5 definitions below ? Is this really helpful ? In anything else than
 forcing you to use questionable line breaking below ?

 +#define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF   \


 How about simply defining it as

 #define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF(0x19  11)


 ?

Yes, we can write the way as suggested. Will amend this.


 +   PHYCLKRST_MPLL_MULTIPLIER(0x19)
 +#define PHYCLKRST_MPLL_MULTIPLIER_50M_REF  \
 +   PHYCLKRST_MPLL_MULTIPLIER(0x02)
 +#define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF\
 +   PHYCLKRST_MPLL_MULTIPLIER(0x68)
 +#define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF\
 +   PHYCLKRST_MPLL_MULTIPLIER(0x7d)
 +#define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF \
 +   PHYCLKRST_MPLL_MULTIPLIER(0x02)
 +
 +#define PHYCLKRST_FSEL_MASK(0x3f  5)
 +#define PHYCLKRST_FSEL(_x) ((_x)  5)


 Ditto.

Will amend this.


 +#define PHYCLKRST_FSEL_PAD_100MHZ  \
 +   PHYCLKRST_FSEL(0x27)
 +#define PHYCLKRST_FSEL_PAD_24MHZ   \
 +   PHYCLKRST_FSEL(0x2a)
 +#define PHYCLKRST_FSEL_PAD_20MHZ   \
 +   PHYCLKRST_FSEL(0x31)
 +#define PHYCLKRST_FSEL_PAD_19_2MHZ \
 +   PHYCLKRST_FSEL(0x38)
 +
 +#define PHYCLKRST_RETENABLEN   (1  4)
 +
 +#define PHYCLKRST_REFCLKSEL_MASK   (0x03  2)
 +#define PHYCLKRST_REFCLKSEL(_x)((_x)  2)


 Ditto.

Will amend this.


 +#define PHYCLKRST_REFCLKSEL_PAD_REFCLK \
 +   PHYCLKRST_REFCLKSEL(2)
 +#define PHYCLKRST_REFCLKSEL_EXT_REFCLK \
 +   PHYCLKRST_REFCLKSEL(3)
 +
 +#define PHYCLKRST_PORTRESET(1  1)
 +#define PHYCLKRST_COMMONONN(1  0)
 +
 +#define EXYNOS5_DRD_PHYREG0(0x14)
 +#define EXYNOS5_DRD_PHYREG1(0x18)
 +
 +#define EXYNOS5_DRD_PHYPARAM0  (0x1C)
 +
 +#define PHYPARAM0_REF_USE_PAD  (0x1  31)
 +#define PHYPARAM0_REF_LOSLEVEL_MASK(0x1f  26)
 +#define PHYPARAM0_REF_LOSLEVEL (0x9  26)
 +
 +#define EXYNOS5_DRD_PHYPARAM1  (0x20)
 +
 +#define PHYPARAM1_PCS_TXDEEMPH_MASK(0x1f  0)
 +#define PHYPARAM1_PCS_TXDEEMPH (0x1C)
 +
 +#define EXYNOS5_DRD_PHYTERM(0x24)
 +
 +#define EXYNOS5_DRD_PHYTEST(0x28)
 +
 +#define PHYTEST_POWERDOWN_SSP  (1  3)
 +#define PHYTEST_POWERDOWN_HSP  (1  2)
 +
 +#define EXYNOS5_DRD_PHYADP (0x2C)
 +
 +#define EXYNOS5_DRD_PHYBATCHG  (0x30)
 +
 +#define PHYBATCHG_UTMI_CLKSEL  (0x1  2)
 +
 +#define EXYNOS5_DRD_PHYRESUME  (0x34)
 +#define

Re: [PATCH] ARM: Exynos5250: Enabling dwc3-exynos driver

2012-11-07 Thread Vivek Gautam
Hi,


On Wed, Nov 7, 2012 at 10:48 PM, Tomasz Figa tomasz.f...@gmail.com wrote:
 Hi Vivek, Felipe,

 On Wednesday 07 of November 2012 18:43:22 Felipe Balbi wrote:
 Hi,

 On Wed, Nov 07, 2012 at 06:55:03PM +0530, Vivek Gautam wrote:
  Hi,
 
  On Tue, Nov 6, 2012 at 10:13 PM, Felipe Balbi ba...@ti.com wrote:
   On Tue, Nov 06, 2012 at 08:58:49PM +0530, Vivek Gautam wrote:
   Adding DWC3 device tree node for Exynos5250 along with the
   device address and clock support needed for the controller.
  
   Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
   ---
  
arch/arm/boot/dts/exynos5250.dtsi   |6 ++
arch/arm/mach-exynos/clock-exynos5.c|   24

arch/arm/mach-exynos/include/mach/map.h |1 +
arch/arm/mach-exynos/mach-exynos5-dt.c  |2 ++
drivers/usb/Kconfig |1 +
5 files changed, 34 insertions(+), 0 deletions(-)
  
   diff --git a/arch/arm/boot/dts/exynos5250.dtsi
   b/arch/arm/boot/dts/exynos5250.dtsi index cf6a02d..52bca54 100644
   --- a/arch/arm/boot/dts/exynos5250.dtsi
   +++ b/arch/arm/boot/dts/exynos5250.dtsi
   @@ -68,6 +68,12 @@
  
 interrupts = 0 96 0;
  
 };
  
   + dwc3 {
  
   shouldn't this be usb@1200 ??
 
  Kept this in accordance with controller's name, similar to the change
  in following:
  http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg12800.
  html
 
  Needs to be changed ?

 I'll leave it to DT experts, but I was under the impression that we
 should be using generic functionality names (usb, i2c, spi, uart, gpio,
 etc) instead of the IP name. IP name is something more for compatible
 flag.

 Don't take my word for it though :-) DT experts are the ones with final
 saying

 Wrt node name, as far as I am aware of, there is no strict convention of
 naming nodes, but the way you suggested is better in terms of readability -
 you don't have to know this particular IP to find out what it is used for.

 Similar thing is with @addr in node names. I've been always adding @addr to
 the name whenever the node had reg property inside (with the same address
 of course), but I'm not sure if there is a strict convention here.


Better to make things more readable ;-)
It will be nice that i change this to dwc3 as well as ehci and ohci in
the change:
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg12800.
Thanks for suggestions.
I shall also update the Documentation/devicetree/bindings. I missed
that here :-(

 Best regards,
 Tomasz Figa




--
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/2] Enable ehci and ohci devices for exynos5250

2012-11-07 Thread Vivek Gautam
Changes from v1:
 - Changed the device node names from 'ehci' and 'ohci' to
   'usb@1211' and 'usb@1212' as per discussion for the
   change 'http://www.spinics.net/lists/linux-usb/msg73993.html'
 - Rebased on for-next branch of linux-samsung.

Vivek Gautam (2):
  ARM: Exynos5250: Enabling ehci-s5p driver
  ARM: Exynos5250: Enabling ohci-exynos driver

 .../devicetree/bindings/usb/exynos-usb.txt |   40 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 ++
 arch/arm/boot/dts/exynos5250.dtsi  |   12 ++
 arch/arm/mach-exynos/include/mach/map.h|2 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |4 ++
 5 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-11-07 Thread Vivek Gautam
Adding EHCI device tree node for Exynos5250 along with
the device base adress and gpio line for vbus.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   25 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
 5 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
new file mode 100644
index 000..833f5cf
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -0,0 +1,25 @@
+Samsung Exynos SoC USB controller
+
+The USB devices interface with USB controllers on Exynos SOCs.
+The device node has following properties.
+
+EHCI
+Required properties:
+ - compatible: should be samsung,exynos-ehci for USB 2.0
+   EHCI controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO that
+   needs to be pulled up for the bus to be powered.
+
+Example:
+
+   usb@1211 {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 405009c..7c8064f 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -193,4 +193,8 @@
hdmi {
hpd-gpio = gpx3 7 0xf 1 3;
};
+
+   usb@1211 {
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index cf6a02d..2995445 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -238,6 +238,12 @@
#size-cells = 0;
};
 
+   usb@1211 {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index ef4958b..9a86b99 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -197,6 +197,7 @@
 #define EXYNOS4_PA_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_EHCI0x1211
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index ed37273..f60994e 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -86,6 +86,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
exynos5-hdmi, NULL),
OF_DEV_AUXDATA(samsung,exynos5-mixer, 0x1445,
exynos5-mixer, NULL),
+   OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
+   s5p-ehci, NULL),
{},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-11-08 Thread Vivek Gautam
Hi all,

On Thu, Nov 8, 2012 at 12:24 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Adding EHCI device tree node for Exynos5250 along with
 the device base adress and gpio line for vbus.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Acked-by: Jingoo Han jg1@samsung.com
 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   25 
 
  arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
  5 files changed, 38 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 new file mode 100644
 index 000..833f5cf
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -0,0 +1,25 @@
 +Samsung Exynos SoC USB controller
 +
 +The USB devices interface with USB controllers on Exynos SOCs.
 +The device node has following properties.
 +
 +EHCI
 +Required properties:
 + - compatible: should be samsung,exynos-ehci for USB 2.0
 +   EHCI controller in host mode.
 + - reg: physical base address of the controller and length of memory mapped
 +   region.
 + - interrupts: interrupt number to the cpu.
 +
 +Optional properties:
 + - samsung,vbus-gpio:  if present, specifies the GPIO that
 +   needs to be pulled up for the bus to be powered.
 +
 +Example:
 +
 +   usb@1211 {
 +   compatible = samsung,exynos-ehci;
 +   reg = 0x1211 0x100;
 +   interrupts = 0 71 0;
 +   samsung,vbus-gpio = gpx2 6 1 3 3;
 +   };
 diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
 b/arch/arm/boot/dts/exynos5250-smdk5250.dts
 index 405009c..7c8064f 100644
 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
 +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
 @@ -193,4 +193,8 @@
 hdmi {
 hpd-gpio = gpx3 7 0xf 1 3;
 };
 +
 +   usb@1211 {
 +   samsung,vbus-gpio = gpx2 6 1 3 3;
 +   };
  };
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index cf6a02d..2995445 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -238,6 +238,12 @@
 #size-cells = 0;
 };

 +   usb@1211 {
 +   compatible = samsung,exynos-ehci;
 +   reg = 0x1211 0x100;
 +   interrupts = 0 71 0;
 +   };
 +
 amba {
 #address-cells = 1;
 #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index ef4958b..9a86b99 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm/mach-exynos/include/mach/map.h
 @@ -197,6 +197,7 @@
  #define EXYNOS4_PA_EHCI0x1258
  #define EXYNOS4_PA_OHCI0x1259
  #define EXYNOS4_PA_HSPHY   0x125B
 +#define EXYNOS5_PA_EHCI0x1211
  #define EXYNOS4_PA_MFC 0x1340

  #define EXYNOS4_PA_UART0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index ed37273..f60994e 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -86,6 +86,8 @@ static const struct of_dev_auxdata 
 exynos5250_auxdata_lookup[] __initconst = {
 exynos5-hdmi, NULL),
 OF_DEV_AUXDATA(samsung,exynos5-mixer, 0x1445,
 exynos5-mixer, NULL),
 +   OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
 +   s5p-ehci, NULL),
missed the alignment here :-(

 {},
  };

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] ARM: Exynos5250: Enabling ohci-exynos driver

2012-11-08 Thread Vivek Gautam
Hi all,

On Thu, Nov 8, 2012 at 12:24 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Adding OHCI device tree node for Exynos5250 along with
 the device base address.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Acked-by: Jingoo Han jg1@samsung.com
 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   15 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 ++
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 ++
  4 files changed, 24 insertions(+), 0 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 index 833f5cf..5ff3def1 100644
 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -23,3 +23,18 @@ Example:
 interrupts = 0 71 0;
 samsung,vbus-gpio = gpx2 6 1 3 3;
 };
 +
 +OHCI
 +Required properties:
 + - compatible: should be samsung,exynos-ohci for USB 2.0
 +   OHCI companion controller in host mode.
 + - reg: physical base address of the controller and length of memory mapped
 +   region.
 + - interrupts: interrupt number to the cpu.
 +
 +Example:
 +   usb@1212 {
 +   compatible = samsung,exynos-ohci;
 +   reg = 0x1212 0x100;
 +   interrupts = 0 71 0;
 +   };
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index 2995445..f18abe0 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -244,6 +244,12 @@
 interrupts = 0 71 0;
 };

 +   usb@1212 {
 +   compatible = samsung,exynos-ohci;
 +   reg = 0x1212 0x100;
 +   interrupts = 0 71 0;
 +   };
 +
 amba {
 #address-cells = 1;
 #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index 9a86b99..471ffaf 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm/mach-exynos/include/mach/map.h
 @@ -198,6 +198,7 @@
  #define EXYNOS4_PA_OHCI0x1259
  #define EXYNOS4_PA_HSPHY   0x125B
  #define EXYNOS5_PA_EHCI0x1211
 +#define EXYNOS5_PA_OHCI0x1212
  #define EXYNOS4_PA_MFC 0x1340

  #define EXYNOS4_PA_UART0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index f60994e..6348acb 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -88,6 +88,8 @@ static const struct of_dev_auxdata 
 exynos5250_auxdata_lookup[] __initconst = {
 exynos5-mixer, NULL),
 OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
 s5p-ehci, NULL),
 +   OF_DEV_AUXDATA(samsung,exynos-ohci, EXYNOS5_PA_OHCI,
 +   exynos-ohci, NULL),
missed the alignment here :-(

 {},
  };

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-11-08 Thread Vivek Gautam
Adding EHCI device tree node for Exynos5250 along with
the device base adress and gpio line for vbus.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   25 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
 5 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
new file mode 100644
index 000..833f5cf
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -0,0 +1,25 @@
+Samsung Exynos SoC USB controller
+
+The USB devices interface with USB controllers on Exynos SOCs.
+The device node has following properties.
+
+EHCI
+Required properties:
+ - compatible: should be samsung,exynos-ehci for USB 2.0
+   EHCI controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO that
+   needs to be pulled up for the bus to be powered.
+
+Example:
+
+   usb@1211 {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 405009c..7c8064f 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -193,4 +193,8 @@
hdmi {
hpd-gpio = gpx3 7 0xf 1 3;
};
+
+   usb@1211 {
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index cf6a02d..2995445 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -238,6 +238,12 @@
#size-cells = 0;
};
 
+   usb@1211 {
+   compatible = samsung,exynos-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index ef4958b..9a86b99 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -197,6 +197,7 @@
 #define EXYNOS4_PA_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_EHCI0x1211
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index ed37273..89fa624 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -86,6 +86,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
exynos5-hdmi, NULL),
OF_DEV_AUXDATA(samsung,exynos5-mixer, 0x1445,
exynos5-mixer, NULL),
+   OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
+   s5p-ehci, NULL),
{},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/2] ARM: Exynos5250: Enabling ohci-exynos driver

2012-11-08 Thread Vivek Gautam
Adding OHCI device tree node for Exynos5250 along with
the device base address.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   15 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 ++
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 ++
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index 833f5cf..5ff3def1 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -23,3 +23,18 @@ Example:
interrupts = 0 71 0;
samsung,vbus-gpio = gpx2 6 1 3 3;
};
+
+OHCI
+Required properties:
+ - compatible: should be samsung,exynos-ohci for USB 2.0
+   OHCI companion controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Example:
+   usb@1212 {
+   compatible = samsung,exynos-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+   };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 2995445..f18abe0 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -244,6 +244,12 @@
interrupts = 0 71 0;
};
 
+   usb@1212 {
+   compatible = samsung,exynos-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index 9a86b99..471ffaf 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -198,6 +198,7 @@
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
 #define EXYNOS5_PA_EHCI0x1211
+#define EXYNOS5_PA_OHCI0x1212
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 89fa624..c03f3dd 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -88,6 +88,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
exynos5-mixer, NULL),
OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
s5p-ehci, NULL),
+   OF_DEV_AUXDATA(samsung,exynos-ohci, EXYNOS5_PA_OHCI,
+   exynos-ohci, NULL),
{},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] ARM: EXYNOS5250: Add support for USB 3.0 dwc3 controller

2012-11-08 Thread Vivek Gautam
Changes from v1:
 - Changed the device node name from 'dwc3' to 'usb@1200'.
 - Added the documentation for device tree bindings for dwc3 controller.

Based on changes for USB 2.0:
'https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-November/022046.html'

Tested with required driver DT patches for dwc3-exynos:
http://www.spinics.net/lists/linux-usb/msg73857.html
and USB 3.0 phy support patches:
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-November/021926.html

Vivek Gautam (1):
  ARM: Exynos5250: Enabling dwc3-exynos driver

 .../devicetree/bindings/usb/exynos-usb.txt |   14 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 +
 arch/arm/mach-exynos/Kconfig   |1 +
 arch/arm/mach-exynos/clock-exynos5.c   |   24 
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
 6 files changed, 48 insertions(+), 0 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-12-03 Thread Vivek Gautam
Hi Kukjin,


On Thu, Nov 8, 2012 at 1:49 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Adding EHCI device tree node for Exynos5250 along with
 the device base adress and gpio line for vbus.

Any thoughts about this please ?

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Acked-by: Jingoo Han jg1@samsung.com
 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   25 
 
  arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
  5 files changed, 38 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 new file mode 100644
 index 000..833f5cf
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -0,0 +1,25 @@
 +Samsung Exynos SoC USB controller
 +
 +The USB devices interface with USB controllers on Exynos SOCs.
 +The device node has following properties.
 +
 +EHCI
 +Required properties:
 + - compatible: should be samsung,exynos-ehci for USB 2.0
 +   EHCI controller in host mode.
 + - reg: physical base address of the controller and length of memory mapped
 +   region.
 + - interrupts: interrupt number to the cpu.
 +
 +Optional properties:
 + - samsung,vbus-gpio:  if present, specifies the GPIO that
 +   needs to be pulled up for the bus to be powered.
 +
 +Example:
 +
 +   usb@1211 {
 +   compatible = samsung,exynos-ehci;
 +   reg = 0x1211 0x100;
 +   interrupts = 0 71 0;
 +   samsung,vbus-gpio = gpx2 6 1 3 3;
 +   };
 diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
 b/arch/arm/boot/dts/exynos5250-smdk5250.dts
 index 405009c..7c8064f 100644
 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
 +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
 @@ -193,4 +193,8 @@
 hdmi {
 hpd-gpio = gpx3 7 0xf 1 3;
 };
 +
 +   usb@1211 {
 +   samsung,vbus-gpio = gpx2 6 1 3 3;
 +   };
  };
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index cf6a02d..2995445 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -238,6 +238,12 @@
 #size-cells = 0;
 };

 +   usb@1211 {
 +   compatible = samsung,exynos-ehci;
 +   reg = 0x1211 0x100;
 +   interrupts = 0 71 0;
 +   };
 +
 amba {
 #address-cells = 1;
 #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index ef4958b..9a86b99 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm/mach-exynos/include/mach/map.h
 @@ -197,6 +197,7 @@
  #define EXYNOS4_PA_EHCI0x1258
  #define EXYNOS4_PA_OHCI0x1259
  #define EXYNOS4_PA_HSPHY   0x125B
 +#define EXYNOS5_PA_EHCI0x1211
  #define EXYNOS4_PA_MFC 0x1340

  #define EXYNOS4_PA_UART0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index ed37273..89fa624 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -86,6 +86,8 @@ static const struct of_dev_auxdata 
 exynos5250_auxdata_lookup[] __initconst = {
 exynos5-hdmi, NULL),
 OF_DEV_AUXDATA(samsung,exynos5-mixer, 0x1445,
 exynos5-mixer, NULL),
 +   OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
 +   s5p-ehci, NULL),
 {},
  };

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] ARM: Exynos5250: Enabling ohci-exynos driver

2012-12-03 Thread Vivek Gautam
Hi Kukjin,


On Thu, Nov 8, 2012 at 1:51 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Adding OHCI device tree node for Exynos5250 along with
 the device base address.

Any thoughts about this please ?

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Acked-by: Jingoo Han jg1@samsung.com
 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   15 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 ++
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 ++
  4 files changed, 24 insertions(+), 0 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 index 833f5cf..5ff3def1 100644
 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -23,3 +23,18 @@ Example:
 interrupts = 0 71 0;
 samsung,vbus-gpio = gpx2 6 1 3 3;
 };
 +
 +OHCI
 +Required properties:
 + - compatible: should be samsung,exynos-ohci for USB 2.0
 +   OHCI companion controller in host mode.
 + - reg: physical base address of the controller and length of memory mapped
 +   region.
 + - interrupts: interrupt number to the cpu.
 +
 +Example:
 +   usb@1212 {
 +   compatible = samsung,exynos-ohci;
 +   reg = 0x1212 0x100;
 +   interrupts = 0 71 0;
 +   };
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index 2995445..f18abe0 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -244,6 +244,12 @@
 interrupts = 0 71 0;
 };

 +   usb@1212 {
 +   compatible = samsung,exynos-ohci;
 +   reg = 0x1212 0x100;
 +   interrupts = 0 71 0;
 +   };
 +
 amba {
 #address-cells = 1;
 #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index 9a86b99..471ffaf 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm/mach-exynos/include/mach/map.h
 @@ -198,6 +198,7 @@
  #define EXYNOS4_PA_OHCI0x1259
  #define EXYNOS4_PA_HSPHY   0x125B
  #define EXYNOS5_PA_EHCI0x1211
 +#define EXYNOS5_PA_OHCI0x1212
  #define EXYNOS4_PA_MFC 0x1340

  #define EXYNOS4_PA_UART0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index 89fa624..c03f3dd 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -88,6 +88,8 @@ static const struct of_dev_auxdata 
 exynos5250_auxdata_lookup[] __initconst = {
 exynos5-mixer, NULL),
 OF_DEV_AUXDATA(samsung,exynos-ehci, EXYNOS5_PA_EHCI,
 s5p-ehci, NULL),
 +   OF_DEV_AUXDATA(samsung,exynos-ohci, EXYNOS5_PA_OHCI,
 +   exynos-ohci, NULL),
 {},
  };

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] ARM: Exynos5250: Enabling dwc3-exynos driver

2012-12-03 Thread Vivek Gautam
Hi Kukjin,

On Thu, Nov 8, 2012 at 2:02 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Adding DWC3 device tree node for Exynos5250 along with the
 device address and clock support needed for the controller.


Does this change needs looks fine?
Any thoughts about this please ?

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   14 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 +
  arch/arm/mach-exynos/Kconfig   |1 +
  arch/arm/mach-exynos/clock-exynos5.c   |   24 
 
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
  6 files changed, 48 insertions(+), 0 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 index 5ff3def1..a7e3eaa 100644
 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -38,3 +38,17 @@ Example:
 reg = 0x1212 0x100;
 interrupts = 0 71 0;
 };
 +
 +DWC3
 +Required properties:
 + - compatible: should be samsung,exynos-dwc3 for USB 3.0 DWC3 controller.
 + - reg: physical base address of the controller and length of memory mapped
 +   region.
 + - interrupts: interrupt number to the cpu.
 +
 +Example:
 +   usb@1200 {
 +   compatible = samsung,exynos-dwc3;
 +   reg = 0x1200 0x1;
 +   interrupts = 0 72 0;
 +   };
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index f18abe0..d349636 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -68,6 +68,12 @@
 interrupts = 0 96 0;
 };

 +   usb@1200 {
 +   compatible = samsung,exynos-dwc3;
 +   reg = 0x1200 0x1;
 +   interrupts = 0 72 0;
 +   };
 +
 rtc {
 compatible = samsung,s3c6410-rtc;
 reg = 0x101E 0x100;
 diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
 index bb3b09a..588814a 100644
 --- a/arch/arm/mach-exynos/Kconfig
 +++ b/arch/arm/mach-exynos/Kconfig
 @@ -422,6 +422,7 @@ config MACH_EXYNOS5_DT
 select ARM_AMBA
 select SOC_EXYNOS5250
 select USE_OF
 +   select USB_ARCH_HAS_XHCI
 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/clock-exynos5.c 
 b/arch/arm/mach-exynos/clock-exynos5.c
 index a88e0d9..ee094ee 100644
 --- a/arch/arm/mach-exynos/clock-exynos5.c
 +++ b/arch/arm/mach-exynos/clock-exynos5.c
 @@ -740,6 +740,11 @@ static struct clk exynos5_init_clocks_off[] = {
 .enable = exynos5_clk_ip_fsys_ctrl ,
 .ctrlbit= (1  18),
 }, {
 +   .name   = usbdrd30,
 +   .parent = exynos5_clk_aclk_200.clk,
 +   .enable = exynos5_clk_ip_fsys_ctrl,
 +   .ctrlbit= (1  19),
 +   }, {
 .name   = usbotg,
 .enable = exynos5_clk_ip_fsys_ctrl,
 .ctrlbit= (1  7),
 @@ -1004,6 +1009,16 @@ struct clksrc_sources exynos5_clkset_group = {
 .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
  };

 +struct clk *exynos5_clkset_usbdrd30_list[] = {
 +   [0] = exynos5_clk_mout_mpll.clk,
 +   [1] = exynos5_clk_mout_cpll.clk,
 +};
 +
 +struct clksrc_sources exynos5_clkset_usbdrd30 = {
 +   .sources= exynos5_clkset_usbdrd30_list,
 +   .nr_sources = ARRAY_SIZE(exynos5_clkset_usbdrd30_list),
 +};
 +
  /* Possible clock sources for aclk_266_gscl_sub Mux */
  static struct clk *clk_src_gscl_266_list[] = {
 [0] = clk_ext_xtal_mux,
 @@ -1288,6 +1303,15 @@ static struct clksrc_clk exynos5_clksrcs[] = {
 .parent = exynos5_clk_mout_cpll.clk,
 },
 .reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 
 },
 +   }, {
 +   .clk= {
 +   .name   = sclk_usbdrd30,
 +   .enable = exynos5_clksrc_mask_fsys_ctrl,
 +   .ctrlbit= (1  28),
 +   },
 +   .sources = exynos5_clkset_usbdrd30,
 +   .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 28, .size = 
 1 },
 +   .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 24, .size 
 = 4 },
 },
  };

 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index 471ffaf..064ca1c 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm

Re: [PATCH v2] ARM: Exynos5250: Enabling dwc3-exynos driver

2012-12-06 Thread Vivek Gautam
Hi Grant,


On Thu, Dec 6, 2012 at 3:45 PM, Grant Likely grant.lik...@secretlab.ca wrote:
 On Thu, 08 Nov 2012 14:02:13 +0530, Vivek Gautam gautam.vi...@samsung.com 
 wrote:
 Adding DWC3 device tree node for Exynos5250 along with the
 device address and clock support needed for the controller.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   14 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 +
  arch/arm/mach-exynos/Kconfig   |1 +
  arch/arm/mach-exynos/clock-exynos5.c   |   24 
 
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
  6 files changed, 48 insertions(+), 0 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 index 5ff3def1..a7e3eaa 100644
 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -38,3 +38,17 @@ Example:
   reg = 0x1212 0x100;
   interrupts = 0 71 0;
   };
 +
 +DWC3
 +Required properties:
 + - compatible: should be samsung,exynos-dwc3 for USB 3.0 DWC3 controller.

 Nit: Please use a specific chip in compatible strings. ie.
 samsung,exynos5250-dwc3. Newer parts using the same core can claim
 compatibility by including the older string in the compatible list.


The compatible string samsung,exynos-dwc3 is added in accordance
with the driver dt changes
present at drivers drivers/usb/dwc3/dwc3-exynos.c. Should i be
amending the driver side also likewise ?

 + - reg: physical base address of the controller and length of memory mapped
 +   region.
 + - interrupts: interrupt number to the cpu.
 +
 +Example:
 + usb@1200 {
 + compatible = samsung,exynos-dwc3;
 + reg = 0x1200 0x1;
 + interrupts = 0 72 0;
 + };
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index f18abe0..d349636 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -68,6 +68,12 @@
   interrupts = 0 96 0;
   };

 + usb@1200 {
 + compatible = samsung,exynos-dwc3;
 + reg = 0x1200 0x1;
 + interrupts = 0 72 0;
 + };
 +
   rtc {
   compatible = samsung,s3c6410-rtc;
   reg = 0x101E 0x100;
 diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
 index bb3b09a..588814a 100644
 --- a/arch/arm/mach-exynos/Kconfig
 +++ b/arch/arm/mach-exynos/Kconfig
 @@ -422,6 +422,7 @@ config MACH_EXYNOS5_DT
   select ARM_AMBA
   select SOC_EXYNOS5250
   select USE_OF
 + select USB_ARCH_HAS_XHCI
   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/clock-exynos5.c 
 b/arch/arm/mach-exynos/clock-exynos5.c
 index a88e0d9..ee094ee 100644
 --- a/arch/arm/mach-exynos/clock-exynos5.c
 +++ b/arch/arm/mach-exynos/clock-exynos5.c
 @@ -740,6 +740,11 @@ static struct clk exynos5_init_clocks_off[] = {
   .enable = exynos5_clk_ip_fsys_ctrl ,
   .ctrlbit= (1  18),
   }, {
 + .name   = usbdrd30,
 + .parent = exynos5_clk_aclk_200.clk,
 + .enable = exynos5_clk_ip_fsys_ctrl,
 + .ctrlbit= (1  19),
 + }, {
   .name   = usbotg,
   .enable = exynos5_clk_ip_fsys_ctrl,
   .ctrlbit= (1  7),
 @@ -1004,6 +1009,16 @@ struct clksrc_sources exynos5_clkset_group = {
   .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
  };

 +struct clk *exynos5_clkset_usbdrd30_list[] = {
 + [0] = exynos5_clk_mout_mpll.clk,
 + [1] = exynos5_clk_mout_cpll.clk,
 +};
 +
 +struct clksrc_sources exynos5_clkset_usbdrd30 = {
 + .sources= exynos5_clkset_usbdrd30_list,
 + .nr_sources = ARRAY_SIZE(exynos5_clkset_usbdrd30_list),
 +};
 +
  /* Possible clock sources for aclk_266_gscl_sub Mux */
  static struct clk *clk_src_gscl_266_list[] = {
   [0] = clk_ext_xtal_mux,
 @@ -1288,6 +1303,15 @@ static struct clksrc_clk exynos5_clksrcs[] = {
   .parent = exynos5_clk_mout_cpll.clk,
   },
   .reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 
 },
 + }, {
 + .clk= {
 + .name   = sclk_usbdrd30,
 + .enable = exynos5_clksrc_mask_fsys_ctrl,
 + .ctrlbit= (1  28),
 + },
 + .sources = exynos5_clkset_usbdrd30,
 + .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 28, .size

Re: [PATCH v2 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-12-06 Thread Vivek Gautam
On Thu, Dec 6, 2012 at 3:46 PM, Grant Likely grant.lik...@secretlab.ca wrote:
 On Thu, 08 Nov 2012 12:24:24 +0530, Vivek Gautam gautam.vi...@samsung.com 
 wrote:
 Adding EHCI device tree node for Exynos5250 along with
 the device base adress and gpio line for vbus.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Acked-by: Jingoo Han jg1@samsung.com
 ---
  .../devicetree/bindings/usb/exynos-usb.txt |   25 
 
  arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
  arch/arm/boot/dts/exynos5250.dtsi  |6 
  arch/arm/mach-exynos/include/mach/map.h|1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
  5 files changed, 38 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

 diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
 b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 new file mode 100644
 index 000..833f5cf
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
 @@ -0,0 +1,25 @@
 +Samsung Exynos SoC USB controller
 +
 +The USB devices interface with USB controllers on Exynos SOCs.
 +The device node has following properties.
 +
 +EHCI
 +Required properties:
 + - compatible: should be samsung,exynos-ehci for USB 2.0

 Ditto here. Please be specific in compatible strings.  
 samsung,exynos5250-ehci

 Otherwise the binding looks fine to me.


Again here, the compatible string is added as per
drivers/usb/host/ehci-s5p.c, since same driver works across exynos.
Please suggest do we need driver side change also to accomodate this ?

 g.

 ___
 devicetree-discuss mailing list
 devicetree-disc...@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/devicetree-discuss



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] usb: exynos: Fix compatible strings used for device

2012-12-13 Thread Vivek Gautam
Using chip specific compatible string as it should be.
So fixing this for ehci-s5p, ohci-exynos and dwc3-exynos
which till now used a generic 'exynos' in their compatible strings.

This goes as per the discussion happened in the thread for
[PATCH v2] ARM: Exynos5250: Enabling dwc3-exynos driver
available at:
http://www.spinics.net/lists/linux-usb/msg74145.html

Vivek Gautam (2):
  usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device
  usb: dwc3-exynos: Fix compatible strings for the device

 drivers/usb/dwc3/dwc3-exynos.c |2 +-
 drivers/usb/host/ehci-s5p.c|2 +-
 drivers/usb/host/ohci-exynos.c |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device

2012-12-13 Thread Vivek Gautam
Using specific chip in compatible strings. Newer SOCs can claim
device by using older string in the compatible list.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-s5p.c|2 +-
 drivers/usb/host/ohci-exynos.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 319dcfa..f18e6ac 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -266,7 +266,7 @@ static const struct dev_pm_ops s5p_ehci_pm_ops = {
 
 #ifdef CONFIG_OF
 static const struct of_device_id exynos_ehci_match[] = {
-   { .compatible = samsung,exynos-ehci },
+   { .compatible = samsung,exynos4210-ehci },
{},
 };
 MODULE_DEVICE_TABLE(of, exynos_ehci_match);
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index aa3b884..77f2017 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -267,7 +267,7 @@ static const struct dev_pm_ops exynos_ohci_pm_ops = {
 
 #ifdef CONFIG_OF
 static const struct of_device_id exynos_ohci_match[] = {
-   { .compatible = samsung,exynos-ohci },
+   { .compatible = samsung,exynos4210-ohci },
{},
 };
 MODULE_DEVICE_TABLE(of, exynos_ohci_match);
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] usb: dwc3-exynos: Fix compatible strings for the device

2012-12-13 Thread Vivek Gautam
Using specific chip in compatible strings. Newer SOCs can claim
device by using older string in the compatible list.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/dwc3/dwc3-exynos.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index aae5328..9dce99a 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -188,7 +188,7 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static const struct of_device_id exynos_dwc3_match[] = {
-   { .compatible = samsung,exynos-dwc3 },
+   { .compatible = samsung,exynos5250-dwc3 },
{},
 };
 MODULE_DEVICE_TABLE(of, exynos_dwc3_match);
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] usb: exynos: Fix compatible strings used for device

2012-12-13 Thread Vivek Gautam
CC: LKML

On Thu, Dec 13, 2012 at 8:22 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Using chip specific compatible string as it should be.
 So fixing this for ehci-s5p, ohci-exynos and dwc3-exynos
 which till now used a generic 'exynos' in their compatible strings.

 This goes as per the discussion happened in the thread for
 [PATCH v2] ARM: Exynos5250: Enabling dwc3-exynos driver
 available at:
 http://www.spinics.net/lists/linux-usb/msg74145.html

 Vivek Gautam (2):
   usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device
   usb: dwc3-exynos: Fix compatible strings for the device

  drivers/usb/dwc3/dwc3-exynos.c |2 +-
  drivers/usb/host/ehci-s5p.c|2 +-
  drivers/usb/host/ohci-exynos.c |2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device

2012-12-13 Thread Vivek Gautam
On Thu, Dec 13, 2012 at 8:22 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Using specific chip in compatible strings. Newer SOCs can claim
 device by using older string in the compatible list.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/host/ehci-s5p.c|2 +-
  drivers/usb/host/ohci-exynos.c |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

 diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
 index 319dcfa..f18e6ac 100644
 --- a/drivers/usb/host/ehci-s5p.c
 +++ b/drivers/usb/host/ehci-s5p.c
 @@ -266,7 +266,7 @@ static const struct dev_pm_ops s5p_ehci_pm_ops = {

  #ifdef CONFIG_OF
  static const struct of_device_id exynos_ehci_match[] = {
 -   { .compatible = samsung,exynos-ehci },
 +   { .compatible = samsung,exynos4210-ehci },
 {},
  };
  MODULE_DEVICE_TABLE(of, exynos_ehci_match);
 diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
 index aa3b884..77f2017 100644
 --- a/drivers/usb/host/ohci-exynos.c
 +++ b/drivers/usb/host/ohci-exynos.c
 @@ -267,7 +267,7 @@ static const struct dev_pm_ops exynos_ohci_pm_ops = {

  #ifdef CONFIG_OF
  static const struct of_device_id exynos_ohci_match[] = {
 -   { .compatible = samsung,exynos-ohci },
 +   { .compatible = samsung,exynos4210-ohci },
 {},
  };
  MODULE_DEVICE_TABLE(of, exynos_ohci_match);
 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: dwc3-exynos: Fix compatible strings for the device

2012-12-13 Thread Vivek Gautam
CC: LKML

On Thu, Dec 13, 2012 at 8:22 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Using specific chip in compatible strings. Newer SOCs can claim
 device by using older string in the compatible list.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/dwc3/dwc3-exynos.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
 index aae5328..9dce99a 100644
 --- a/drivers/usb/dwc3/dwc3-exynos.c
 +++ b/drivers/usb/dwc3/dwc3-exynos.c
 @@ -188,7 +188,7 @@ static int dwc3_exynos_remove(struct platform_device 
 *pdev)

  #ifdef CONFIG_OF
  static const struct of_device_id exynos_dwc3_match[] = {
 -   { .compatible = samsung,exynos-dwc3 },
 +   { .compatible = samsung,exynos5250-dwc3 },
 {},
  };
  MODULE_DEVICE_TABLE(of, exynos_dwc3_match);
 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/2] Enable ehci and ohci devices for exynos5250

2012-12-13 Thread Vivek Gautam
Changes from v2:
 - Changed the compatible string to chip specific(samsung,exynos4210),
   since ehci-s5p and ohci-exynos are being used from exynso4210 onwards.
 - Based on changes for drivers available at:
   http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg23218.html

Changes from v1:
 - Changed the device node names from 'ehci' and 'ohci' to
   'usb@1211' and 'usb@1212' as per discussion for the
   change 'http://www.spinics.net/lists/linux-usb/msg73993.html'
 - Rebased on for-next branch of linux-samsung.

Vivek Gautam (2):
  ARM: Exynos5250: Enabling ehci-s5p driver
  ARM: Exynos5250: Enabling ohci-exynos driver

 .../devicetree/bindings/usb/exynos-usb.txt |   40 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 ++
 arch/arm/boot/dts/exynos5250.dtsi  |   12 ++
 arch/arm/mach-exynos/include/mach/map.h|2 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |4 ++
 5 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-12-13 Thread Vivek Gautam
Adding EHCI device tree node for Exynos5250 along with
the device base adress and gpio line for vbus.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   25 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
 5 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
new file mode 100644
index 000..e8bbb47
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -0,0 +1,25 @@
+Samsung Exynos SoC USB controller
+
+The USB devices interface with USB controllers on Exynos SOCs.
+The device node has following properties.
+
+EHCI
+Required properties:
+ - compatible: should be samsung,exynos4210-ehci for USB 2.0
+   EHCI controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO that
+   needs to be pulled up for the bus to be powered.
+
+Example:
+
+   usb@1211 {
+   compatible = samsung,exynos4210-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 711b55f..f990086 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -218,4 +218,8 @@
i2s_2: i2s@12D7 {
status = disabled;
};
+
+   usb@1211 {
+   samsung,vbus-gpio = gpx2 6 1 3 3;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 581e57a..584bb9a 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -299,6 +299,12 @@
rx-dma-channel = pdma0 11; /* preliminary */
};
 
+   usb@1211 {
+   compatible = samsung,exynos4210-ehci;
+   reg = 0x1211 0x100;
+   interrupts = 0 71 0;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index cbb2852..b2c662f 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -201,6 +201,7 @@
 #define EXYNOS4_PA_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_EHCI0x1211
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 462e5ac..b3b9af1 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -110,6 +110,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
samsung-i2s.1, NULL),
OF_DEV_AUXDATA(samsung,samsung-i2s, 0x12D7,
samsung-i2s.2, NULL),
+   OF_DEV_AUXDATA(samsung,exynos4210-ehci, EXYNOS5_PA_EHCI,
+   s5p-ehci, NULL),
{},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/2] ARM: Exynos5250: Enabling ohci-exynos driver

2012-12-13 Thread Vivek Gautam
Adding OHCI device tree node for Exynos5250 along with
the device base address.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 .../devicetree/bindings/usb/exynos-usb.txt |   15 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 ++
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 ++
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index e8bbb47..f66fcdd 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -23,3 +23,18 @@ Example:
interrupts = 0 71 0;
samsung,vbus-gpio = gpx2 6 1 3 3;
};
+
+OHCI
+Required properties:
+ - compatible: should be samsung,exynos4210-ohci for USB 2.0
+   OHCI companion controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Example:
+   usb@1212 {
+   compatible = samsung,exynos4210-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+   };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 584bb9a..75510d1 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -305,6 +305,12 @@
interrupts = 0 71 0;
};
 
+   usb@1212 {
+   compatible = samsung,exynos4210-ohci;
+   reg = 0x1212 0x100;
+   interrupts = 0 71 0;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index b2c662f..4bf6fd9 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -202,6 +202,7 @@
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
 #define EXYNOS5_PA_EHCI0x1211
+#define EXYNOS5_PA_OHCI0x1212
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index b3b9af1..07aa586 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -112,6 +112,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
samsung-i2s.2, NULL),
OF_DEV_AUXDATA(samsung,exynos4210-ehci, EXYNOS5_PA_EHCI,
s5p-ehci, NULL),
+   OF_DEV_AUXDATA(samsung,exynos4210-ohci, EXYNOS5_PA_OHCI,
+   exynos-ohci, NULL),
{},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3] ARM: Exynos5250: Enabling dwc3-exynos driver

2012-12-13 Thread Vivek Gautam
Adding DWC3 device tree node for Exynos5250 along with the
device address and clock support needed for the controller.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
Changes from v2:
 - Changed the compatible string to chip specific(samsung,exynos5250),
   since dwc3-exynos is being used from exynso5250 onwards.
 - Based on changes for USB 2.0:
   
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-December/024413.html

Changes from v1:
 - Changed the device node name from 'dwc3' to 'usb@1200'.
 - Added the documentation for device tree bindings for dwc3 controller.


 .../devicetree/bindings/usb/exynos-usb.txt |   14 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 +
 arch/arm/mach-exynos/Kconfig   |1 +
 arch/arm/mach-exynos/clock-exynos5.c   |   24 
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
 6 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index f66fcdd..d660410 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -38,3 +38,17 @@ Example:
reg = 0x1212 0x100;
interrupts = 0 71 0;
};
+
+DWC3
+Required properties:
+ - compatible: should be samsung,exynos5250-dwc3 for USB 3.0 DWC3 controller.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Example:
+   usb@1200 {
+   compatible = samsung,exynos5250-dwc3;
+   reg = 0x1200 0x1;
+   interrupts = 0 72 0;
+   };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 75510d1..001a31b 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -299,6 +299,12 @@
rx-dma-channel = pdma0 11; /* preliminary */
};
 
+   usb@1200 {
+   compatible = samsung,exynos5250-dwc3;
+   reg = 0x1200 0x1;
+   interrupts = 0 72 0;
+   };
+
usb@1211 {
compatible = samsung,exynos4210-ehci;
reg = 0x1211 0x100;
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 91d5b6f..09f9587 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -426,6 +426,7 @@ config MACH_EXYNOS5_DT
depends on ARCH_EXYNOS5
select ARM_AMBA
select USE_OF
+   select USB_ARCH_HAS_XHCI
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/clock-exynos5.c 
b/arch/arm/mach-exynos/clock-exynos5.c
index 5c63bc7..f2214a0 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -768,6 +768,11 @@ static struct clk exynos5_init_clocks_off[] = {
.enable = exynos5_clk_ip_fsys_ctrl ,
.ctrlbit= (1  18),
}, {
+   .name   = usbdrd30,
+   .parent = exynos5_clk_aclk_200.clk,
+   .enable = exynos5_clk_ip_fsys_ctrl,
+   .ctrlbit= (1  19),
+   }, {
.name   = usbotg,
.enable = exynos5_clk_ip_fsys_ctrl,
.ctrlbit= (1  7),
@@ -1121,6 +1126,16 @@ static struct clksrc_sources exynos5_clkset_group = {
.nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
 };
 
+struct clk *exynos5_clkset_usbdrd30_list[] = {
+   [0] = exynos5_clk_mout_mpll.clk,
+   [1] = exynos5_clk_mout_cpll.clk,
+};
+
+struct clksrc_sources exynos5_clkset_usbdrd30 = {
+   .sources= exynos5_clkset_usbdrd30_list,
+   .nr_sources = ARRAY_SIZE(exynos5_clkset_usbdrd30_list),
+};
+
 /* Possible clock sources for aclk_266_gscl_sub Mux */
 static struct clk *clk_src_gscl_266_list[] = {
[0] = clk_ext_xtal_mux,
@@ -1415,6 +1430,15 @@ static struct clksrc_clk exynos5_clksrcs[] = {
.parent = exynos5_clk_mout_cpll.clk,
},
.reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 },
+   }, {
+   .clk= {
+   .name   = sclk_usbdrd30,
+   .enable = exynos5_clksrc_mask_fsys_ctrl,
+   .ctrlbit= (1  28),
+   },
+   .sources = exynos5_clkset_usbdrd30,
+   .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 28, .size = 1 
},
+   .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 24, .size = 
4

[PATCH] usb: phy: samsung: Add support to set pmu isolation

2012-12-17 Thread Vivek Gautam
Adding support to parse device node data in order to get
required properties to set pmu isolation for usb-phy.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../devicetree/bindings/usb/samsung-usbphy.txt |   10 +++
 drivers/usb/phy/samsung-usbphy.c   |   80 ++--
 2 files changed, 82 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
index 7b26e2d..112eaa6 100644
--- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
+++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
@@ -9,3 +9,13 @@ Required properties:
 - compatible : should be samsung,exynos4210-usbphy
 - reg : base physical address of the phy registers and length of memory mapped
region.
+- samsung,usb-phyctrl : should point to usb-phyctrl sub-node which provides
+   binding data to enable/disable device PHY handled by
+   PMU register.
+
+   Required properties:
+   - compatible : should be samsung,usbdev-phyctrl for
+   DEVICE type phy.
+   - samsung,phyctrl-reg: base physical address of
+   PHY_CONTROL register in PMU.
+- samsung,enable-mask : should be '1'
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 5c5e1bb5..ef394c3 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -72,6 +72,8 @@ enum samsung_cpu_type {
  * @dev: The parent device supplied to the probe function
  * @clk: usb phy clock
  * @regs: usb phy register memory base
+ * @devctrl_reg: usb phy-control pmu register memory base
+ * @en_mask: enable mask
  * @ref_clk_freq: reference clock frequency selection
  * @cpu_type: machine identifier
  */
@@ -81,12 +83,62 @@ struct samsung_usbphy {
struct device   *dev;
struct clk  *clk;
void __iomem*regs;
+   void __iomem*devctrl_reg;
+   u32 en_mask;
int ref_clk_freq;
int cpu_type;
 };
 
 #define phy_to_sphy(x) container_of((x), struct samsung_usbphy, phy)
 
+static int samsung_usbphy_parse_dt_param(struct samsung_usbphy *sphy)
+{
+   struct device_node *usb_phyctrl;
+   u32 reg;
+
+   if (!sphy-dev-of_node) {
+   sphy-devctrl_reg = NULL;
+   return -ENODEV;
+   }
+
+   usb_phyctrl = of_parse_phandle(sphy-dev-of_node,
+   samsung,usb-phyctrl, 0);
+   if (!usb_phyctrl) {
+   dev_dbg(sphy-dev, Can't get usb-phy control node\n);
+   sphy-devctrl_reg = NULL;
+   return -ENODEV;
+   }
+
+   of_property_read_u32(usb_phyctrl, samsung,phyctrl-reg, reg);
+
+   sphy-devctrl_reg = ioremap(reg, SZ_4);
+
+   of_property_read_u32(sphy-dev-of_node, samsung,enable-mask,
+   sphy-en_mask);
+
+   return 0;
+}
+
+/*
+ * Set isolation here for phy.
+ * SOCs control this by controlling corresponding PMU registers
+ */
+static void samsung_usbphy_set_isolation(struct samsung_usbphy *sphy, int on)
+{
+   void __iomem *usb_phyctrl_reg;
+   u32 en_mask = sphy-en_mask;
+   u32 reg;
+
+   usb_phyctrl_reg = sphy-devctrl_reg;
+
+   reg = readl(usb_phyctrl_reg);
+
+   if (on)
+   writel(reg  ~en_mask, usb_phyctrl_reg);
+   else
+   writel(reg | en_mask, usb_phyctrl_reg);
+}
+
 /*
  * Returns reference clock frequency selection value
  */
@@ -199,6 +251,8 @@ static int samsung_usbphy_init(struct usb_phy *phy)
/* Disable phy isolation */
if (sphy-plat  sphy-plat-pmu_isolation)
sphy-plat-pmu_isolation(false);
+   else
+   samsung_usbphy_set_isolation(sphy, false);
 
/* Initialize usb phy registers */
samsung_usbphy_enable(sphy);
@@ -228,6 +282,8 @@ static void samsung_usbphy_shutdown(struct usb_phy *phy)
/* Enable phy isolation */
if (sphy-plat  sphy-plat-pmu_isolation)
sphy-plat-pmu_isolation(true);
+   else
+   samsung_usbphy_set_isolation(sphy, true);
 
clk_disable_unprepare(sphy-clk);
 }
@@ -249,17 +305,12 @@ static inline int samsung_usbphy_get_driver_data(struct 
platform_device *pdev)
 static int __devinit samsung_usbphy_probe(struct platform_device *pdev)
 {
struct samsung_usbphy *sphy;
-   struct samsung_usbphy_data *pdata;
+   struct samsung_usbphy_data *pdata = pdev-dev.platform_data;
struct device *dev = pdev-dev;
struct resource *phy_mem;
void __iomem*phy_base;
struct clk *clk;
-
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, %s: no platform data defined\n, __func__

[PATCH] usb: phy: samsung: Add support to set pmu isolation

2012-12-17 Thread Vivek Gautam
Based on patches for samsung-usbphy driver available at:
https://patchwork.kernel.org/patch/1794651/

In this patch we are adding support to parse device tree data for
samsung-usbphy driver and further setting pmu_isolation to
enable/disable phy as and when needed.
This further chucks out the need of platform data for samsung-usbphy on
DT enabled system and hence serves the purpose of the discussion
in the thread for:
[PATCH v8 2/2] usb: s3c-hsotg: Adding phy driver support

Vivek Gautam (1):
  usb: phy: samsung: Add support to set pmu isolation

 .../devicetree/bindings/usb/samsung-usbphy.txt |   10 +++
 drivers/usb/phy/samsung-usbphy.c   |   80 ++--
 2 files changed, 82 insertions(+), 8 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] usb: phy: samsung: Add support to set pmu isolation

2012-12-18 Thread Vivek Gautam
Adding support to parse device node data in order to get
required properties to set pmu isolation for usb-phy.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---

Changes from v1:
 - Changed the name of property for phy handler from'samsung,usb-phyctrl'
   to 'samsung,usb-phyhandle' to make it look more generic.
 - Similarly 'samsung,phyctrl-reg' is changed to 'samsung,phyhandle-reg'
 - Added a check for 'samsung,usb-phyhandle' before getting node from
   phandle.
 - Putting the node using 'of_node_put()' which had been missed.
 - Adding necessary check for the pointer in 'samsung_usbphy_set_isolation()'
   to avoid any NULL pointer dereferencing.
 - Unmapping the register ioremapped in 'samsung_usbphy_parse_dt_param()'.


 .../devicetree/bindings/usb/samsung-usbphy.txt |   12 +++
 drivers/usb/phy/samsung-usbphy.c   |   94 ++--
 2 files changed, 98 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
index 7b26e2d..a7b28b2 100644
--- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
+++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
@@ -9,3 +9,15 @@ Required properties:
 - compatible : should be samsung,exynos4210-usbphy
 - reg : base physical address of the phy registers and length of memory mapped
region.
+
+Optional properties:
+- samsung,usb-phyhandle : should point to usb-phyhandle sub-node which provides
+   binding data to enable/disable device PHY handled by
+   PMU register.
+
+   Required properties:
+   - compatible : should be samsung,usbdev-phyctrl for
+   DEVICE type phy.
+   - samsung,phyhandle-reg: base physical address of
+   PHY_CONTROL register in PMU.
+- samsung,enable-mask : should be '1'
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 5c5e1bb5..4ceabe3 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -72,6 +72,8 @@ enum samsung_cpu_type {
  * @dev: The parent device supplied to the probe function
  * @clk: usb phy clock
  * @regs: usb phy register memory base
+ * @devctrl_reg: usb device phy-control pmu register memory base
+ * @en_mask: enable mask
  * @ref_clk_freq: reference clock frequency selection
  * @cpu_type: machine identifier
  */
@@ -81,12 +83,73 @@ struct samsung_usbphy {
struct device   *dev;
struct clk  *clk;
void __iomem*regs;
+   void __iomem*devctrl_reg;
+   u32 en_mask;
int ref_clk_freq;
int cpu_type;
 };
 
 #define phy_to_sphy(x) container_of((x), struct samsung_usbphy, phy)
 
+static int samsung_usbphy_parse_dt_param(struct samsung_usbphy *sphy)
+{
+   struct device_node *usb_phyctrl;
+   u32 reg;
+   int lenp;
+
+   if (!sphy-dev-of_node) {
+   sphy-devctrl_reg = NULL;
+   return -ENODEV;
+   }
+
+   if (of_get_property(sphy-dev-of_node, samsung,usb-phyhandle, 
lenp)) {
+   usb_phyctrl = of_parse_phandle(sphy-dev-of_node,
+   samsung,usb-phyhandle, 0);
+   if (!usb_phyctrl) {
+   dev_warn(sphy-dev, Can't get usb-phy handle\n);
+   sphy-devctrl_reg = NULL;
+   }
+
+   of_property_read_u32(usb_phyctrl, samsung,phyhandle-reg, 
reg);
+
+   sphy-devctrl_reg = ioremap(reg, SZ_4);
+
+   of_property_read_u32(sphy-dev-of_node, samsung,enable-mask,
+   sphy-en_mask);
+   of_node_put(usb_phyctrl);
+   } else {
+   dev_warn(sphy-dev, Can't get usb-phy handle\n);
+   sphy-devctrl_reg = NULL;
+   }
+
+   return 0;
+}
+
+/*
+ * Set isolation here for phy.
+ * SOCs control this by controlling corresponding PMU registers
+ */
+static void samsung_usbphy_set_isolation(struct samsung_usbphy *sphy, int on)
+{
+   void __iomem *usb_phyctrl_reg;
+   u32 en_mask = sphy-en_mask;
+   u32 reg;
+
+   usb_phyctrl_reg = sphy-devctrl_reg;
+
+   if (!usb_phyctrl_reg) {
+   dev_warn(sphy-dev, Can't set pmu isolation\n);
+   return;
+   }
+
+   reg = readl(usb_phyctrl_reg);
+
+   if (on)
+   writel(reg  ~en_mask, usb_phyctrl_reg);
+   else
+   writel(reg | en_mask, usb_phyctrl_reg);
+}
+
 /*
  * Returns reference clock frequency selection value
  */
@@ -199,6 +262,8 @@ static int samsung_usbphy_init(struct usb_phy *phy)
/* Disable phy isolation */
if (sphy-plat  sphy-plat-pmu_isolation)
sphy-plat-pmu_isolation(false);
+   else

[PATCH v5 0/4] Adding usb2.0 host-phy support for exynos5250

2012-12-18 Thread Vivek Gautam
Changes from v4:
 - Moved architecture side changes out of this patch-set.
 - Added support for multiple usbphy phandle parsing and
   doing all pmu_isolation() and phy_cfg_sel() related changes
   in samsung-usbphy driver only instead of architecture
   as in v4 patch-set.
 - Removed unnecessary multi line definitions for macros.

Changes from v3:
 - Moved enums S5P_USB_PHY_DEVICE, S5P_USB_PHY_HOST from machine to file
   include/linux/usb/samsung_usb_phy.h as USB_PHY_TYPE_DEVICE and
   USB_PHY_TYPE_HOST to make it more generic. Further resolve its
   dependencies.
 - Introduced a function 'samsung_usbphy_set_type()' which takes
   care of setting up the phy_type: HOST/DEVICE. This function
   can be called by host/otg drivers to setup phy_type prior to
   handling the respective PHYs.
 - Added an error-path for HOST type phy in s5p_usb_phy_pmu_isolation()
   for 'mach-s3c64xx'.
 - Moving to PHY driver as default for ehci-s5p and ohci-exynos, and only
   when failed fall back to plat-data.
 - Added samsung_usbphy_set_type() prior to doing usb_phy_init() or
   usb_phy_shutdown() so that appropriate PHY gets init or shutdown.

Based on patches for samsung-usbphy driver:
 
1)http://lists.infradead.org/pipermail/linux-arm-kernel/2012-November/134476.html
 2)https://lkml.org/lkml/2012/12/18/187
 
Vivek Gautam (4):
  ARM: EXYNOS: Update  move usb-phy types to generic include layer
  usb: phy: samsung: Add host phy support to samsung-phy driver
  USB: ehci-s5p: Add phy driver support
  USB: ohci-exynos: Add phy driver support

 .../devicetree/bindings/usb/samsung-usbphy.txt |   25 +-
 drivers/usb/host/ehci-s5p.c|   71 +++-
 drivers/usb/host/ohci-exynos.c |   71 +++-
 drivers/usb/phy/Kconfig|2 +-
 drivers/usb/phy/samsung-usbphy.c   |  465 ++--
 include/linux/usb/samsung_usb_phy.h|   29 ++
 6 files changed, 570 insertions(+), 93 deletions(-)
 create mode 100644 include/linux/usb/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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 1/4] ARM: EXYNOS: Update move usb-phy types to generic include layer

2012-12-18 Thread Vivek Gautam
Updating the names of usb-phy types to more generic names:
USB_PHY_TYPE_DEIVCE  USB_PHY_TYPE_HOST; and further update
its dependencies.

Signed-off-by: Praveen Paneri p.pan...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-s5p.c |9 +
 drivers/usb/host/ohci-exynos.c  |9 +
 include/linux/usb/samsung_usb_phy.h |   16 
 3 files changed, 26 insertions(+), 8 deletions(-)
 create mode 100644 include/linux/usb/samsung_usb_phy.h

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 319dcfa..46ca5ef 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -17,6 +17,7 @@
 #include linux/platform_device.h
 #include linux/of_gpio.h
 #include linux/platform_data/usb-ehci-s5p.h
+#include linux/usb/samsung_usb_phy.h
 #include plat/usb-phy.h
 
 #define EHCI_INSNREG00(base)   (base + 0x90)
@@ -164,7 +165,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
}
 
if (pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
 
ehci = hcd_to_ehci(hcd);
ehci-caps = hcd-regs;
@@ -198,7 +199,7 @@ static int s5p_ehci_remove(struct platform_device *pdev)
usb_remove_hcd(hcd);
 
if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
 
clk_disable_unprepare(s5p_ehci-clk);
 
@@ -229,7 +230,7 @@ static int s5p_ehci_suspend(struct device *dev)
rc = ehci_suspend(hcd, do_wakeup);
 
if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
 
clk_disable_unprepare(s5p_ehci-clk);
 
@@ -246,7 +247,7 @@ static int s5p_ehci_resume(struct device *dev)
clk_prepare_enable(s5p_ehci-clk);
 
if (pdata  pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
 
/* DMA burst Enable */
writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd-regs));
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index aa3b884..804fb62 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -15,6 +15,7 @@
 #include linux/of.h
 #include linux/platform_device.h
 #include linux/platform_data/usb-exynos.h
+#include linux/usb/samsung_usb_phy.h
 #include plat/usb-phy.h
 
 struct exynos_ohci_hcd {
@@ -153,7 +154,7 @@ static int exynos_ohci_probe(struct platform_device *pdev)
}
 
if (pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
 
ohci = hcd_to_ohci(hcd);
ohci_hcd_init(ohci);
@@ -184,7 +185,7 @@ static int exynos_ohci_remove(struct platform_device *pdev)
usb_remove_hcd(hcd);
 
if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
 
clk_disable_unprepare(exynos_ohci-clk);
 
@@ -229,7 +230,7 @@ static int exynos_ohci_suspend(struct device *dev)
clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags);
 
if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
 
clk_disable_unprepare(exynos_ohci-clk);
 
@@ -249,7 +250,7 @@ static int exynos_ohci_resume(struct device *dev)
clk_prepare_enable(exynos_ohci-clk);
 
if (pdata  pdata-phy_init)
-   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
+   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
 
ohci_resume(hcd, false);
 
diff --git a/include/linux/usb/samsung_usb_phy.h 
b/include/linux/usb/samsung_usb_phy.h
new file mode 100644
index 000..9167826
--- /dev/null
+++ b/include/linux/usb/samsung_usb_phy.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Co.Ltd
+ * http://www.samsung.com/
+ *
+ * Defines phy types for samsung usb phy controllers - HOST or DEIVCE.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+enum samsung_usb_phy_type {
+   USB_PHY_TYPE_DEVICE,
+   USB_PHY_TYPE_HOST,
+};
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 2/4] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-12-18 Thread Vivek Gautam
This patch adds host phy support to samsung-usbphy.c and
further adds support for samsung's exynos5250 usb-phy.

Signed-off-by: Praveen Paneri p.pan...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 .../devicetree/bindings/usb/samsung-usbphy.txt |   25 +-
 drivers/usb/phy/Kconfig|2 +-
 drivers/usb/phy/samsung-usbphy.c   |  465 ++--
 include/linux/usb/samsung_usb_phy.h|   13 +
 4 files changed, 454 insertions(+), 51 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
index a7b28b2..2ec5400 100644
--- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
+++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
@@ -1,23 +1,38 @@
 * 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 ehci-s5p and ohci-exynos usb controllers
+across Samsung SOCs.
 TODO: Adding the PHY binding with controller(s) according to the under
 developement generic PHY driver.
 
 Required properties:
+
+Exynos4210:
 - compatible : should be samsung,exynos4210-usbphy
 - reg : base physical address of the phy registers and length of memory mapped
region.
 
+Exynos5250:
+- compatible : should be samsung,exynos5250-usbphy
+- reg : base physical address of the phy registers and length of memory mapped
+   region.
+
 Optional properties:
 - samsung,usb-phyhandle : should point to usb-phyhandle sub-node which provides
binding data to enable/disable device PHY handled by
-   PMU register.
+   PMU register; or to configure usb2.0 phy handled by
+   SYSREG.
 
Required properties:
- compatible : should be samsung,usbdev-phyctrl for
-   DEVICE type phy.
+  DEVICE type phy; or
+  should be samsung,usbhost-phyctrl for
+  HOST type phy; or
+  should be samsung,usb-phycfg for
+  USB2.0 PHY_CFG.
- samsung,phyhandle-reg: base physical address of
-   PHY_CONTROL register in PMU.
+PHY_CONTROL register in PMU;
+or USB2.0 PHY_CFG register
+in SYSREG.
 - samsung,enable-mask : should be '1'
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 17ad743..13c0eaf 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -47,7 +47,7 @@ config USB_RCAR_PHY
 
 config SAMSUNG_USBPHY
bool Samsung USB PHY controller Driver
-   depends on USB_S3C_HSOTG
+   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS
select USB_OTG_UTILS
help
  Enable this to support Samsung USB phy controller for samsung
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 4ceabe3..621348a 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -5,7 +5,8 @@
  *
  * Author: Praveen Paneri p.pan...@samsung.com
  *
- * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller
+ * Samsung USB-PHY transceiver; talks to S3C HS OTG controller, EHCI-S5P and
+ * OHCI-EXYNOS controllers.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -24,7 +25,7 @@
 #include linux/err.h
 #include linux/io.h
 #include linux/of.h
-#include linux/usb/otg.h
+#include linux/usb/samsung_usb_phy.h
 #include linux/platform_data/samsung-usbphy.h
 
 /* Register definitions */
@@ -56,6 +57,103 @@
 #define RSTCON_HLINK_SWRST (0x1  1)
 #define RSTCON_SWRST   (0x1  0)
 
+/* EXYNOS5 */
+#define EXYNOS5_PHY_HOST_CTRL0 (0x00)
+
+#define HOST_CTRL0_PHYSWRSTALL (0x1  31)
+
+#define HOST_CTRL0_REFCLKSEL_MASK  (0x3)
+#define HOST_CTRL0_REFCLKSEL_XTAL  (0x0  19)
+#define HOST_CTRL0_REFCLKSEL_EXTL  (0x1  19)
+#define HOST_CTRL0_REFCLKSEL_CLKCORE   (0x2  19)
+
+#define HOST_CTRL0_FSEL_MASK   (0x7  16)
+#define HOST_CTRL0_FSEL(_x)((_x)  16)
+#define HOST_CTRL0_FSEL_CLKSEL_50M (0x7)
+#define HOST_CTRL0_FSEL_CLKSEL_24M (0x5)
+#define HOST_CTRL0_FSEL_CLKSEL_20M (0x4)
+#define HOST_CTRL0_FSEL_CLKSEL_19200K  (0x3)
+#define HOST_CTRL0_FSEL_CLKSEL_12M

[PATCH v5 3/4] USB: ehci-s5p: Add phy driver support

2012-12-18 Thread Vivek Gautam
Adding the phy driver to ehci-s5p. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 drivers/usb/host/ehci-s5p.c |   70 ++-
 1 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 46ca5ef..50c93af 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -17,6 +17,7 @@
 #include linux/platform_device.h
 #include linux/of_gpio.h
 #include linux/platform_data/usb-ehci-s5p.h
+#include linux/usb/phy.h
 #include linux/usb/samsung_usb_phy.h
 #include plat/usb-phy.h
 
@@ -33,6 +34,8 @@ struct s5p_ehci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct s5p_ehci_platdata *pdata;
 };
 
 static const struct hc_driver s5p_ehci_hc_driver = {
@@ -66,6 +69,30 @@ static const struct hc_driver s5p_ehci_hc_driver = {
.clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
 };
 
+static void s5p_ehci_phy_enable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy) {
+   samsung_usbphy_set_type(s5p_ehci-phy, USB_PHY_TYPE_HOST);
+   usb_phy_init(s5p_ehci-phy);
+   } else if (s5p_ehci-pdata-phy_init) {
+   s5p_ehci-pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
+   }
+}
+
+static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
+{
+   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
+
+   if (s5p_ehci-phy) {
+   samsung_usbphy_set_type(s5p_ehci-phy, USB_PHY_TYPE_HOST);
+   usb_phy_shutdown(s5p_ehci-phy);
+   } else if (s5p_ehci-pdata-phy_exit) {
+   s5p_ehci-pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
+   }
+}
+
 static void s5p_setup_vbus_gpio(struct platform_device *pdev)
 {
int err;
@@ -88,20 +115,15 @@ static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
 
 static int s5p_ehci_probe(struct platform_device *pdev)
 {
-   struct s5p_ehci_platdata *pdata;
+   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
struct s5p_ehci_hcd *s5p_ehci;
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -119,6 +141,19 @@ static int s5p_ehci_probe(struct platform_device *pdev)
if (!s5p_ehci)
return -ENOMEM;
 
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   /* Fallback to pdata */
+   if (!pdata) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   s5p_ehci-pdata = pdata;
+   }
+   } else {
+   s5p_ehci-phy = phy;
+   }
+
s5p_ehci-dev = pdev-dev;
 
hcd = usb_create_hcd(s5p_ehci_hc_driver, pdev-dev,
@@ -164,8 +199,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
+   s5p_ehci_phy_enable(s5p_ehci);
 
ehci = hcd_to_ehci(hcd);
ehci-caps = hcd-regs;
@@ -176,13 +210,15 @@ static int s5p_ehci_probe(struct platform_device *pdev)
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
dev_err(pdev-dev, Failed to add USB HCD\n);
-   goto fail_io;
+   goto fail_add_hcd;
}
 
platform_set_drvdata(pdev, s5p_ehci);
 
return 0;
 
+fail_add_hcd:
+   s5p_ehci_phy_disable(s5p_ehci);
 fail_io:
clk_disable_unprepare(s5p_ehci-clk);
 fail_clk:
@@ -192,14 +228,12 @@ fail_clk:
 
 static int s5p_ehci_remove(struct platform_device *pdev)
 {
-   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
struct s5p_ehci_hcd *s5p_ehci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = s5p_ehci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
+   s5p_ehci_phy_disable(s5p_ehci);
 
clk_disable_unprepare(s5p_ehci-clk);
 
@@ -223,14 +257,11 @@ static int s5p_ehci_suspend(struct device *dev)
struct s5p_ehci_hcd *s5p_ehci = dev_get_drvdata(dev);
struct usb_hcd *hcd = s5p_ehci-hcd;
bool do_wakeup = device_may_wakeup(dev

[PATCH v5 4/4] USB: ohci-exynos: Add phy driver support

2012-12-18 Thread Vivek Gautam
Adding the phy-driver to ohci-exynos. Keeping the platform data
for continuing the smooth operation for boards which still uses it

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Acked-by: Jingoo Han jg1@samsung.com
---
 drivers/usb/host/ohci-exynos.c |   70 
 1 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 804fb62..c92ab7b 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -15,6 +15,7 @@
 #include linux/of.h
 #include linux/platform_device.h
 #include linux/platform_data/usb-exynos.h
+#include linux/usb/phy.h
 #include linux/usb/samsung_usb_phy.h
 #include plat/usb-phy.h
 
@@ -22,8 +23,34 @@ struct exynos_ohci_hcd {
struct device *dev;
struct usb_hcd *hcd;
struct clk *clk;
+   struct usb_phy *phy;
+   struct exynos4_ohci_platdata *pdata;
 };
 
+static void exynos_ohci_phy_enable(struct exynos_ohci_hcd *exynos_ohci)
+{
+   struct platform_device *pdev = to_platform_device(exynos_ohci-dev);
+
+   if (exynos_ohci-phy) {
+   samsung_usbphy_set_type(exynos_ohci-phy, USB_PHY_TYPE_HOST);
+   usb_phy_init(exynos_ohci-phy);
+   } else if (exynos_ohci-pdata-phy_init) {
+   exynos_ohci-pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
+   }
+}
+
+static void exynos_ohci_phy_disable(struct exynos_ohci_hcd *exynos_ohci)
+{
+   struct platform_device *pdev = to_platform_device(exynos_ohci-dev);
+
+   if (exynos_ohci-phy) {
+   samsung_usbphy_set_type(exynos_ohci-phy, USB_PHY_TYPE_HOST);
+   usb_phy_shutdown(exynos_ohci-phy);
+   } else if (exynos_ohci-pdata-phy_exit) {
+   exynos_ohci-pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
+   }
+}
+
 static int ohci_exynos_reset(struct usb_hcd *hcd)
 {
return ohci_init(hcd_to_ohci(hcd));
@@ -79,20 +106,15 @@ static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32);
 
 static int exynos_ohci_probe(struct platform_device *pdev)
 {
-   struct exynos4_ohci_platdata *pdata;
+   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
struct exynos_ohci_hcd *exynos_ohci;
struct usb_hcd *hcd;
struct ohci_hcd *ohci;
struct resource *res;
+   struct usb_phy *phy;
int irq;
int err;
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(pdev-dev, No platform data defined\n);
-   return -EINVAL;
-   }
-
/*
 * Right now device-tree probed devices don't get dma_mask set.
 * Since shared usb code relies on it, set it here for now.
@@ -108,6 +130,19 @@ static int exynos_ohci_probe(struct platform_device *pdev)
if (!exynos_ohci)
return -ENOMEM;
 
+   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
+   if (IS_ERR_OR_NULL(phy)) {
+   /* Fallback to pdata */
+   if (!pdata) {
+   dev_err(pdev-dev, no platform data or transceiver 
defined\n);
+   return -EPROBE_DEFER;
+   } else {
+   exynos_ohci-pdata = pdata;
+   }
+   } else {
+   exynos_ohci-phy = phy;
+   }
+
exynos_ohci-dev = pdev-dev;
 
hcd = usb_create_hcd(exynos_ohci_hc_driver, pdev-dev,
@@ -153,8 +188,7 @@ static int exynos_ohci_probe(struct platform_device *pdev)
goto fail_io;
}
 
-   if (pdata-phy_init)
-   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
+   exynos_ohci_phy_enable(exynos_ohci);
 
ohci = hcd_to_ohci(hcd);
ohci_hcd_init(ohci);
@@ -162,13 +196,15 @@ static int exynos_ohci_probe(struct platform_device *pdev)
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
dev_err(pdev-dev, Failed to add USB HCD\n);
-   goto fail_io;
+   goto fail_add_hcd;
}
 
platform_set_drvdata(pdev, exynos_ohci);
 
return 0;
 
+fail_add_hcd:
+   exynos_ohci_phy_disable(exynos_ohci);
 fail_io:
clk_disable_unprepare(exynos_ohci-clk);
 fail_clk:
@@ -178,14 +214,12 @@ fail_clk:
 
 static int exynos_ohci_remove(struct platform_device *pdev)
 {
-   struct exynos4_ohci_platdata *pdata = pdev-dev.platform_data;
struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = exynos_ohci-hcd;
 
usb_remove_hcd(hcd);
 
-   if (pdata  pdata-phy_exit)
-   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
+   exynos_ohci_phy_disable(exynos_ohci);
 
clk_disable_unprepare(exynos_ohci-clk);
 
@@ -209,8 +243,6 @@ static int exynos_ohci_suspend(struct device *dev)
struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
struct usb_hcd *hcd = exynos_ohci-hcd;
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   struct

[PATCH v2] Adding USB 3.0 DRD-phy support for exynos5250

2012-12-18 Thread Vivek Gautam
Changes form v1:
 - Moved architecture related patch out of this patch-set.
 - Replaced unnecessary multi-line macro definitions by
   single line definitions.
 - Creating new data structure for USB 3.0 phy type and embedding
   it in 'samsung_usbphy' structure.
 - Adding a flag in 'samsung_usbphy' structure to check if device
   has usb 3.0 type phy or not.
 - Restructuring probe sequence for USB 3.0 phy, such that we are
   initializing only when device has usb3.0 type phy.

This patchset is based on the following patch-sets:
 - https://lkml.org/lkml/2012/12/18/201
 - 
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-November/134476.html
 - https://lkml.org/lkml/2012/12/18/187

Vivek Gautam (1):
  usb: phy: samsung: Add support for USB 3.0 phy for exynos5250

 drivers/usb/phy/samsung-usbphy.c |  339 +-
 1 files changed, 337 insertions(+), 2 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: phy: samsung: Add support for USB 3.0 phy for exynos5250

2012-12-18 Thread Vivek Gautam
Adding support for USB3.0 phy for dwc3 controller on
exynos5250 SOC.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/phy/samsung-usbphy.c |  339 +-
 1 files changed, 337 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 621348a..246eb28 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -154,6 +154,86 @@
 
 #define EXYNOS5_PHY_OTG_TUNE   (0x40)
 
+/* EXYNOS5: USB 3.0 DRD */
+#define EXYNOS5_DRD_LINKSYSTEM (0x04)
+
+#define LINKSYSTEM_FLADJ_MASK  (0x3f  1)
+#define LINKSYSTEM_FLADJ(_x)   ((_x)  1)
+#define LINKSYSTEM_XHCI_VERSION_CONTROL(0x1  27)
+
+#define EXYNOS5_DRD_PHYUTMI(0x08)
+
+#define PHYUTMI_OTGDISABLE (0x1  6)
+#define PHYUTMI_FORCESUSPEND   (0x1  1)
+#define PHYUTMI_FORCESLEEP (0x1  0)
+
+#define EXYNOS5_DRD_PHYPIPE(0x0c)
+
+#define EXYNOS5_DRD_PHYCLKRST  (0x10)
+
+#define PHYCLKRST_SSC_REFCLKSEL_MASK   (0xff  23)
+#define PHYCLKRST_SSC_REFCLKSEL(_x)((_x)  23)
+
+#define PHYCLKRST_SSC_RANGE_MASK   (0x03  21)
+#define PHYCLKRST_SSC_RANGE(_x)((_x)  21)
+
+#define PHYCLKRST_SSC_EN   (0x1  20)
+#define PHYCLKRST_REF_SSP_EN   (0x1  19)
+#define PHYCLKRST_REF_CLKDIV2  (0x1  18)
+
+#define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF   (0x19  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_50M_REF  (0x02  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF(0x68  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF(0x7d  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF (0x02  11)
+
+#define PHYCLKRST_FSEL_MASK(0x3f  5)
+#define PHYCLKRST_FSEL(_x) ((_x)  5)
+#define PHYCLKRST_FSEL_PAD_100MHZ  (0x27  5)
+#define PHYCLKRST_FSEL_PAD_24MHZ   (0x2a  5)
+#define PHYCLKRST_FSEL_PAD_20MHZ   (0x31  5)
+#define PHYCLKRST_FSEL_PAD_19_2MHZ (0x38  5)
+
+#define PHYCLKRST_RETENABLEN   (0x1  4)
+
+#define PHYCLKRST_REFCLKSEL_MASK   (0x03  2)
+#define PHYCLKRST_REFCLKSEL_PAD_REFCLK (0x2  2)
+#define PHYCLKRST_REFCLKSEL_EXT_REFCLK (0x3  2)
+
+#define PHYCLKRST_PORTRESET(0x1  1)
+#define PHYCLKRST_COMMONONN(0x1  0)
+
+#define EXYNOS5_DRD_PHYREG0(0x14)
+#define EXYNOS5_DRD_PHYREG1(0x18)
+
+#define EXYNOS5_DRD_PHYPARAM0  (0x1c)
+
+#define PHYPARAM0_REF_USE_PAD  (0x1  31)
+#define PHYPARAM0_REF_LOSLEVEL_MASK(0x1f  26)
+#define PHYPARAM0_REF_LOSLEVEL (0x9  26)
+
+#define EXYNOS5_DRD_PHYPARAM1  (0x20)
+
+#define PHYPARAM1_PCS_TXDEEMPH_MASK(0x1f  0)
+#define PHYPARAM1_PCS_TXDEEMPH (0x1c)
+
+#define EXYNOS5_DRD_PHYTERM(0x24)
+
+#define EXYNOS5_DRD_PHYTEST(0x28)
+
+#define PHYTEST_POWERDOWN_SSP  (0x1  3)
+#define PHYTEST_POWERDOWN_HSP  (0x1  2)
+
+#define EXYNOS5_DRD_PHYADP (0x2c)
+
+#define EXYNOS5_DRD_PHYBATCHG  (0x30)
+
+#define PHYBATCHG_UTMI_CLKSEL  (0x1  2)
+
+#define EXYNOS5_DRD_PHYRESUME  (0x34)
+#define EXYNOS5_DRD_LINKPORT   (0x44)
+
 #ifndef MHZ
 #define MHZ (1000*1000)
 #endif
@@ -164,6 +244,15 @@ enum samsung_cpu_type {
TYPE_EXYNOS5250,
 };
 
+/* structure usb3 - usb3.0 phy trasceiver state
+ * @phy: transceiver structure for USB 3.0
+ * @regs_phy: usb 3.0 phy register memory base
+ */
+struct usb3 {
+   struct usb_phy  phy;
+   void __iomem*regs_phy;
+};
+
 /*
  * struct samsung_usbphy - transceiver driver state
  * @phy: transceiver structure
@@ -192,11 +281,15 @@ struct samsung_usbphy {
u32 en_mask;
int ref_clk_freq;
int cpu_type;
+   struct usb3 usb3phy;
+   int has_usb3;
enum samsung_usb_phy_type phy_type;
atomic_thost_usage;
 };
 
 #define phy_to_sphy(x) container_of((x), struct samsung_usbphy, phy)
+#define phy_to_usb3phy(x)  container_of((x), struct usb3, phy);
+#define usb3phy_to_sphy(x) container_of((x), struct samsung_usbphy, 
usb3phy)
 
 static int samsung_usbphy_parse_dt_param(struct samsung_usbphy *sphy)
 {
@@ -394,6 +487,42 @@ static int samsung_usbphy_get_refclk_freq(struct 
samsung_usbphy *sphy)
return refclk_freq;
 }
 
+/*
+ * Sets the phy clk as EXTREFCLK (XXTI) which is internal clock form clock 
core.
+ */
+static u32 exynos5_usb3phy_set_clock(struct samsung_usbphy *sphy

[PATCH 0/2] ARM: Exynos5250: Enabling samsung usb phy

2012-12-18 Thread Vivek Gautam
This patch-set enables the samsung-usbphy driver on exynos5250,
which enables the support for USB2 type and USB3 type phys.
The corresponding phy driver patches are available at:
 1) https://lkml.org/lkml/2012/12/18/201
 2) 
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-December/024559.html

Tested this patch-set on exynos5250 with following patch-sets for
USB 2.0 and USB 3.0:
 - https://patchwork.kernel.org/patch/1794651/
 - https://lkml.org/lkml/2012/12/18/201
 - 
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-December/024559.html
 - http://comments.gmane.org/gmane.linux.usb.general/76352
 - https://lkml.org/lkml/2012/12/13/492

Vivek Gautam (2):
  ARM: Exynos5250: Enabling samsung-usbphy driver
  ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver

 arch/arm/boot/dts/exynos5250.dtsi   |   23 +++
 arch/arm/mach-exynos/include/mach/map.h |1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c  |2 ++
 3 files changed, 26 insertions(+), 0 deletions(-)

-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ARM: Exynos5250: Enabling samsung-usbphy driver

2012-12-18 Thread Vivek Gautam
Adding usbphy node for Exynos5250 along with the
necessary device data to be parsed.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/boot/dts/exynos5250.dtsi   |   22 ++
 arch/arm/mach-exynos/include/mach/map.h |1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c  |2 ++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 581e57a..bbdb2c2 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -299,6 +299,28 @@
rx-dma-channel = pdma0 11; /* preliminary */
};
 
+   phy_h0: usbdev_phyctrl@10040704 {
+   compatible = samsung,usbdev-phyctrl;
+   samsung,phyhandle-reg = 0x10040704;
+   };
+
+   phy_h1: usbhost_phyctrl@10040708 {
+   compatible = samsung,usbhost-phyctrl;
+   samsung,phyhandle-reg = 0x10040708;
+   };
+
+   phy_h2: usbhost_phycfg@10050230 {
+   compatible = samsung,usb-phycfg;
+   samsung,phyhandle-reg = 0x10050230;
+   };
+
+   usbphy@1213 {
+   compatible = samsung,exynos5250-usbphy;
+   reg = 0x1213 0x100;
+   samsung,usb-phyhandle = phy_h0 phy_h1 phy_h2;
+   samsung,enable-mask = 1;
+   };
+
amba {
#address-cells = 1;
#size-cells = 1;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index cbb2852..778348e 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -201,6 +201,7 @@
 #define EXYNOS4_PA_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_HSPHY   0x1213
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 462e5ac..24e7529 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -110,6 +110,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
samsung-i2s.1, NULL),
OF_DEV_AUXDATA(samsung,samsung-i2s, 0x12D7,
samsung-i2s.2, NULL),
+   OF_DEV_AUXDATA(samsung,exynos5250-usbphy, EXYNOS5_PA_HSPHY,
+   s3c-usbphy, NULL),
{},
 };
 
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver

2012-12-18 Thread Vivek Gautam
Adding base address information required for enabling
USB 3.0 DRD phy on exynos5250 SOC.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/boot/dts/exynos5250.dtsi |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index bbdb2c2..07b7477 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -316,7 +316,8 @@
 
usbphy@1213 {
compatible = samsung,exynos5250-usbphy;
-   reg = 0x1213 0x100;
+   reg = 0x1213 0x100,
+ 0x1210 0x100;
samsung,usb-phyhandle = phy_h0 phy_h1 phy_h2;
samsung,enable-mask = 1;
};
-- 
1.7.6.5

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/4] USB: ehci-s5p: Add phy driver support

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson.


On Tue, Dec 18, 2012 at 8:13 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Adding the phy driver to ehci-s5p. Keeping the platform data
 for continuing the smooth operation for boards which still uses it

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Acked-by: Jingoo Han jg1@samsung.com
 ---
  drivers/usb/host/ehci-s5p.c |   70 
 ++-
  1 files changed, 49 insertions(+), 21 deletions(-)

 diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
 index 46ca5ef..50c93af 100644
 --- a/drivers/usb/host/ehci-s5p.c
 +++ b/drivers/usb/host/ehci-s5p.c
 @@ -17,6 +17,7 @@
  #include linux/platform_device.h
  #include linux/of_gpio.h
  #include linux/platform_data/usb-ehci-s5p.h
 +#include linux/usb/phy.h
  #include linux/usb/samsung_usb_phy.h
  #include plat/usb-phy.h

 @@ -33,6 +34,8 @@ struct s5p_ehci_hcd {
 struct device *dev;
 struct usb_hcd *hcd;
 struct clk *clk;
 +   struct usb_phy *phy;
 +   struct s5p_ehci_platdata *pdata;
  };

  static const struct hc_driver s5p_ehci_hc_driver = {
 @@ -66,6 +69,30 @@ static const struct hc_driver s5p_ehci_hc_driver = {
 .clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
  };

 +static void s5p_ehci_phy_enable(struct s5p_ehci_hcd *s5p_ehci)
 +{
 +   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
 +
 +   if (s5p_ehci-phy) {
 +   samsung_usbphy_set_type(s5p_ehci-phy, USB_PHY_TYPE_HOST);
 +   usb_phy_init(s5p_ehci-phy);
 +   } else if (s5p_ehci-pdata-phy_init) {
 +   s5p_ehci-pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
 +   }
 +}
 +
 +static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
 +{
 +   struct platform_device *pdev = to_platform_device(s5p_ehci-dev);
 +
 +   if (s5p_ehci-phy) {
 +   samsung_usbphy_set_type(s5p_ehci-phy, USB_PHY_TYPE_HOST);
 +   usb_phy_shutdown(s5p_ehci-phy);
 +   } else if (s5p_ehci-pdata-phy_exit) {
 +   s5p_ehci-pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
 +   }
 +}
 +
  static void s5p_setup_vbus_gpio(struct platform_device *pdev)
  {
 int err;
 @@ -88,20 +115,15 @@ static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);

  static int s5p_ehci_probe(struct platform_device *pdev)
  {
 -   struct s5p_ehci_platdata *pdata;
 +   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
 struct s5p_ehci_hcd *s5p_ehci;
 struct usb_hcd *hcd;
 struct ehci_hcd *ehci;
 struct resource *res;
 +   struct usb_phy *phy;
 int irq;
 int err;

 -   pdata = pdev-dev.platform_data;
 -   if (!pdata) {
 -   dev_err(pdev-dev, No platform data defined\n);
 -   return -EINVAL;
 -   }
 -
 /*
  * Right now device-tree probed devices don't get dma_mask set.
  * Since shared usb code relies on it, set it here for now.
 @@ -119,6 +141,19 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 if (!s5p_ehci)
 return -ENOMEM;

 +   phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2);
 +   if (IS_ERR_OR_NULL(phy)) {
 +   /* Fallback to pdata */
 +   if (!pdata) {
 +   dev_err(pdev-dev, no platform data or transceiver 
 defined\n);
 +   return -EPROBE_DEFER;
 +   } else {
 +   s5p_ehci-pdata = pdata;
 +   }
 +   } else {
 +   s5p_ehci-phy = phy;
 +   }
 +
 s5p_ehci-dev = pdev-dev;

 hcd = usb_create_hcd(s5p_ehci_hc_driver, pdev-dev,
 @@ -164,8 +199,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 goto fail_io;
 }

 -   if (pdata-phy_init)
 -   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);
 +   s5p_ehci_phy_enable(s5p_ehci);

 ehci = hcd_to_ehci(hcd);
 ehci-caps = hcd-regs;
 @@ -176,13 +210,15 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 err = usb_add_hcd(hcd, irq, IRQF_SHARED);
 if (err) {
 dev_err(pdev-dev, Failed to add USB HCD\n);
 -   goto fail_io;
 +   goto fail_add_hcd;
 }

 platform_set_drvdata(pdev, s5p_ehci);

 return 0;

 +fail_add_hcd:
 +   s5p_ehci_phy_disable(s5p_ehci);
  fail_io:
 clk_disable_unprepare(s5p_ehci-clk);
  fail_clk:
 @@ -192,14 +228,12 @@ fail_clk:

  static int s5p_ehci_remove(struct platform_device *pdev)
  {
 -   struct s5p_ehci_platdata *pdata = pdev-dev.platform_data;
 struct s5p_ehci_hcd *s5p_ehci = platform_get_drvdata(pdev);
 struct usb_hcd *hcd = s5p_ehci-hcd;

 usb_remove_hcd(hcd);

 -   if (pdata  pdata-phy_exit)
 -   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);
 +   s5p_ehci_phy_disable(s5p_ehci);

 clk_disable_unprepare(s5p_ehci-clk);

 @@ -223,14

Re: [PATCH v2] usb: phy: samsung: Add support to set pmu isolation

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson


On Wed, Dec 19, 2012 at 4:49 AM, Sylwester Nawrocki
sylvester.nawro...@gmail.com wrote:
 Hi Vivek,


 On 12/18/2012 02:56 PM, Vivek Gautam wrote:

 Adding support to parse device node data in order to get
 required properties to set pmu isolation for usb-phy.

 Signed-off-by: Vivek Gautamgautam.vi...@samsung.com
 ---

 Changes from v1:
   - Changed the name of property for phy handler from'samsung,usb-phyctrl'
 to 'samsung,usb-phyhandle' to make it look more generic.
   - Similarly 'samsung,phyctrl-reg' is changed to 'samsung,phyhandle-reg'
   - Added a check for 'samsung,usb-phyhandle' before getting node from
 phandle.
   - Putting the node using 'of_node_put()' which had been missed.
   - Adding necessary check for the pointer in
 'samsung_usbphy_set_isolation()'
 to avoid any NULL pointer dereferencing.
   - Unmapping the register ioremapped in
 'samsung_usbphy_parse_dt_param()'.


   .../devicetree/bindings/usb/samsung-usbphy.txt |   12 +++
   drivers/usb/phy/samsung-usbphy.c   |   94
 ++--
   2 files changed, 98 insertions(+), 8 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 index 7b26e2d..a7b28b2 100644
 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 @@ -9,3 +9,15 @@ Required properties:
   - compatible : should be samsung,exynos4210-usbphy
   - reg : base physical address of the phy registers and length of memory
 mapped
 region.
 +
 +Optional properties:
 +- samsung,usb-phyhandle : should point to usb-phyhandle sub-node which
 provides
 +   binding data to enable/disable device PHY handled
 by
 +   PMU register.
 +
 +   Required properties:
 +   - compatible : should be samsung,usbdev-phyctrl
 for
 +   DEVICE type phy.
 +   - samsung,phyhandle-reg: base physical address of
 +   PHY_CONTROL register in
 PMU.
 +- samsung,enable-mask : should be '1'


 This should only be 1 for Exynos4210+ SoCs, right ?
 S5PV210 uses bit 0 for OTG and bit1 for USB host, doesn't it ? And for
 s3c64xx
 it seems to be bit 16.

 How about deriving this information from 'compatible' property instead ?

 Maybe you could just encode the USB PMU registers (I assume those aren't
 touched by anything but the usb drivers) in a regular 'reg' property in
 an usbphy subnode. Then the driver could interpret it also with help
 of 'compatible' property. And you could just use of_iomap(). E.g.

  usbphy@1213 {
 compatible = samsung,exynos5250-usbphy;
 reg = 0x1213 0x100, 0x1210 0x100;
 usbphy-pmu {
 /* USB device and host PHY_CONTROL registers */
 reg = 0x10040704 8;
 };
  };

 Your samsung,usb-phyhandle approach seems over-engineered to me.
 I might be missing something though.


 diff --git a/drivers/usb/phy/samsung-usbphy.c
 b/drivers/usb/phy/samsung-usbphy.c
 index 5c5e1bb5..4ceabe3 100644
 --- a/drivers/usb/phy/samsung-usbphy.c
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -72,6 +72,8 @@ enum samsung_cpu_type {
* @dev: The parent device supplied to the probe function
* @clk: usb phy clock
* @regs: usb phy register memory base
 + * @devctrl_reg: usb device phy-control pmu register memory base


 hum, this name is not really helpful in understanding what's going
 on here.

 Looking at arch/arm/mach-s5pv210/setup-usb-phy.c, there is only one
 PHY_CONTROL (Power Management Unit) register for both OTG and USB host
 PHYs. So are you really taking care of that case as well ?


 + * @en_mask: enable mask
* @ref_clk_freq: reference clock frequency selection
* @cpu_type: machine identifier
*/
 @@ -81,12 +83,73 @@ struct samsung_usbphy {
 struct device   *dev;
 struct clk  *clk;
 void __iomem*regs;
 +   void __iomem*devctrl_reg;
 +   u32 en_mask;
 int ref_clk_freq;
 int cpu_type;
   };

   #define phy_to_sphy(x)container_of((x), struct
 samsung_usbphy, phy)

 +static int samsung_usbphy_parse_dt_param(struct samsung_usbphy *sphy)
 +{
 +   struct device_node *usb_phyctrl;
 +   u32 reg;
 +   int lenp;
 +
 +   if (!sphy-dev-of_node) {
 +   sphy-devctrl_reg = NULL;
 +   return -ENODEV;
 +   }
 +
 +   if (of_get_property(sphy-dev-of_node,
 samsung,usb-phyhandle,lenp)) {
 +   usb_phyctrl = of_parse_phandle(sphy-dev-of_node,
 +   samsung,usb-phyhandle,
 0);
 +   if (!usb_phyctrl) {
 +   dev_warn(sphy-dev, Can't get usb-phy handle\n);
 +   sphy-devctrl_reg

Re: [PATCH v2] Adding USB 3.0 DRD-phy support for exynos5250

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson.


On Tue, Dec 18, 2012 at 8:40 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Changes form v1:
  - Moved architecture related patch out of this patch-set.
  - Replaced unnecessary multi-line macro definitions by
single line definitions.
  - Creating new data structure for USB 3.0 phy type and embedding
it in 'samsung_usbphy' structure.
  - Adding a flag in 'samsung_usbphy' structure to check if device
has usb 3.0 type phy or not.
  - Restructuring probe sequence for USB 3.0 phy, such that we are
initializing only when device has usb3.0 type phy.

 This patchset is based on the following patch-sets:
  - https://lkml.org/lkml/2012/12/18/201
  - 
 http://lists.infradead.org/pipermail/linux-arm-kernel/2012-November/134476.html
  - https://lkml.org/lkml/2012/12/18/187

 Vivek Gautam (1):
   usb: phy: samsung: Add support for USB 3.0 phy for exynos5250

  drivers/usb/phy/samsung-usbphy.c |  339 
 +-
  1 files changed, 337 insertions(+), 2 deletions(-)

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: phy: samsung: Add support for USB 3.0 phy for exynos5250

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson


On Tue, Dec 18, 2012 at 8:43 PM, Felipe Balbi ba...@ti.com wrote:
 On Tue, Dec 18, 2012 at 08:40:26PM +0530, Vivek Gautam wrote:
 Adding support for USB3.0 phy for dwc3 controller on
 exynos5250 SOC.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/phy/samsung-usbphy.c |  339 
 +-

 let's make the phy names standard from now on and call this
 phy-samsung.c :-)

  1 files changed, 337 insertions(+), 2 deletions(-)

 diff --git a/drivers/usb/phy/samsung-usbphy.c 
 b/drivers/usb/phy/samsung-usbphy.c
 index 621348a..246eb28 100644
 --- a/drivers/usb/phy/samsung-usbphy.c
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -154,6 +154,86 @@

  #define EXYNOS5_PHY_OTG_TUNE (0x40)

 +/* EXYNOS5: USB 3.0 DRD */
 +#define EXYNOS5_DRD_LINKSYSTEM   (0x04)
 +
 +#define LINKSYSTEM_FLADJ_MASK(0x3f  1)
 +#define LINKSYSTEM_FLADJ(_x) ((_x)  1)
 +#define LINKSYSTEM_XHCI_VERSION_CONTROL  (0x1  27)
 +
 +#define EXYNOS5_DRD_PHYUTMI  (0x08)
 +
 +#define PHYUTMI_OTGDISABLE   (0x1  6)
 +#define PHYUTMI_FORCESUSPEND (0x1  1)
 +#define PHYUTMI_FORCESLEEP   (0x1  0)
 +
 +#define EXYNOS5_DRD_PHYPIPE  (0x0c)
 +
 +#define EXYNOS5_DRD_PHYCLKRST(0x10)
 +
 +#define PHYCLKRST_SSC_REFCLKSEL_MASK (0xff  23)
 +#define PHYCLKRST_SSC_REFCLKSEL(_x)  ((_x)  23)
 +
 +#define PHYCLKRST_SSC_RANGE_MASK (0x03  21)
 +#define PHYCLKRST_SSC_RANGE(_x)  ((_x)  21)
 +
 +#define PHYCLKRST_SSC_EN (0x1  20)
 +#define PHYCLKRST_REF_SSP_EN (0x1  19)
 +#define PHYCLKRST_REF_CLKDIV2(0x1  18)
 +
 +#define PHYCLKRST_MPLL_MULTIPLIER_MASK   (0x7f  11)
 +#define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF (0x19  11)
 +#define PHYCLKRST_MPLL_MULTIPLIER_50M_REF(0x02  11)
 +#define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF  (0x68  11)
 +#define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF  (0x7d  11)
 +#define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF   (0x02  11)
 +
 +#define PHYCLKRST_FSEL_MASK  (0x3f  5)
 +#define PHYCLKRST_FSEL(_x)   ((_x)  5)
 +#define PHYCLKRST_FSEL_PAD_100MHZ(0x27  5)
 +#define PHYCLKRST_FSEL_PAD_24MHZ (0x2a  5)
 +#define PHYCLKRST_FSEL_PAD_20MHZ (0x31  5)
 +#define PHYCLKRST_FSEL_PAD_19_2MHZ   (0x38  5)
 +
 +#define PHYCLKRST_RETENABLEN (0x1  4)
 +
 +#define PHYCLKRST_REFCLKSEL_MASK (0x03  2)
 +#define PHYCLKRST_REFCLKSEL_PAD_REFCLK   (0x2  2)
 +#define PHYCLKRST_REFCLKSEL_EXT_REFCLK   (0x3  2)
 +
 +#define PHYCLKRST_PORTRESET  (0x1  1)
 +#define PHYCLKRST_COMMONONN  (0x1  0)
 +
 +#define EXYNOS5_DRD_PHYREG0  (0x14)
 +#define EXYNOS5_DRD_PHYREG1  (0x18)
 +
 +#define EXYNOS5_DRD_PHYPARAM0(0x1c)
 +
 +#define PHYPARAM0_REF_USE_PAD(0x1  31)
 +#define PHYPARAM0_REF_LOSLEVEL_MASK  (0x1f  26)
 +#define PHYPARAM0_REF_LOSLEVEL   (0x9  26)
 +
 +#define EXYNOS5_DRD_PHYPARAM1(0x20)
 +
 +#define PHYPARAM1_PCS_TXDEEMPH_MASK  (0x1f  0)
 +#define PHYPARAM1_PCS_TXDEEMPH   (0x1c)
 +
 +#define EXYNOS5_DRD_PHYTERM  (0x24)
 +
 +#define EXYNOS5_DRD_PHYTEST  (0x28)
 +
 +#define PHYTEST_POWERDOWN_SSP(0x1  3)
 +#define PHYTEST_POWERDOWN_HSP(0x1  2)
 +
 +#define EXYNOS5_DRD_PHYADP   (0x2c)
 +
 +#define EXYNOS5_DRD_PHYBATCHG(0x30)
 +
 +#define PHYBATCHG_UTMI_CLKSEL(0x1  2)
 +
 +#define EXYNOS5_DRD_PHYRESUME(0x34)
 +#define EXYNOS5_DRD_LINKPORT (0x44)
 +
  #ifndef MHZ
  #define MHZ (1000*1000)
  #endif
 @@ -164,6 +244,15 @@ enum samsung_cpu_type {
   TYPE_EXYNOS5250,
  };

 +/* structure usb3 - usb3.0 phy trasceiver state
 + * @phy: transceiver structure for USB 3.0
 + * @regs_phy: usb 3.0 phy register memory base
 + */
 +struct usb3 {
 + struct usb_phy  phy;
 + void __iomem*regs_phy;
 +};
 +
  /*
   * struct samsung_usbphy - transceiver driver state
   * @phy: transceiver structure
 @@ -192,11 +281,15 @@ struct samsung_usbphy {
   u32 en_mask;
   int ref_clk_freq;
   int cpu_type;
 + struct usb3 usb3phy;
 + int has_usb3;
   enum samsung_usb_phy_type phy_type;
   atomic_thost_usage;
  };

  #define phy_to_sphy(x)   container_of((x), struct 
 samsung_usbphy, phy)
 +#define phy_to_usb3phy(x)container_of((x), struct usb3, phy);
 +#define usb3phy_to_sphy(x)   container_of((x), struct samsung_usbphy

Re: [PATCH 0/2] ARM: Exynos5250: Enabling samsung usb phy

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson.


On Tue, Dec 18, 2012 at 9:09 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 This patch-set enables the samsung-usbphy driver on exynos5250,
 which enables the support for USB2 type and USB3 type phys.
 The corresponding phy driver patches are available at:
  1) https://lkml.org/lkml/2012/12/18/201
  2) 
 https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-December/024559.html

 Tested this patch-set on exynos5250 with following patch-sets for
 USB 2.0 and USB 3.0:
  - https://patchwork.kernel.org/patch/1794651/
  - https://lkml.org/lkml/2012/12/18/201
  - 
 https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-December/024559.html
  - http://comments.gmane.org/gmane.linux.usb.general/76352
  - https://lkml.org/lkml/2012/12/13/492

 Vivek Gautam (2):
   ARM: Exynos5250: Enabling samsung-usbphy driver
   ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver

  arch/arm/boot/dts/exynos5250.dtsi   |   23 +++
  arch/arm/mach-exynos/include/mach/map.h |1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c  |2 ++
  3 files changed, 26 insertions(+), 0 deletions(-)

 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 1/4] ARM: EXYNOS: Update move usb-phy types to generic include layer

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson.


On Tue, Dec 18, 2012 at 8:13 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Updating the names of usb-phy types to more generic names:
 USB_PHY_TYPE_DEIVCE  USB_PHY_TYPE_HOST; and further update
 its dependencies.

 Signed-off-by: Praveen Paneri p.pan...@samsung.com
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/host/ehci-s5p.c |9 +
  drivers/usb/host/ohci-exynos.c  |9 +
  include/linux/usb/samsung_usb_phy.h |   16 
  3 files changed, 26 insertions(+), 8 deletions(-)
  create mode 100644 include/linux/usb/samsung_usb_phy.h

 diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
 index 319dcfa..46ca5ef 100644
 --- a/drivers/usb/host/ehci-s5p.c
 +++ b/drivers/usb/host/ehci-s5p.c
 @@ -17,6 +17,7 @@
  #include linux/platform_device.h
  #include linux/of_gpio.h
  #include linux/platform_data/usb-ehci-s5p.h
 +#include linux/usb/samsung_usb_phy.h
  #include plat/usb-phy.h

  #define EHCI_INSNREG00(base)   (base + 0x90)
 @@ -164,7 +165,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 }

 if (pdata-phy_init)
 -   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
 +   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);

 ehci = hcd_to_ehci(hcd);
 ehci-caps = hcd-regs;
 @@ -198,7 +199,7 @@ static int s5p_ehci_remove(struct platform_device *pdev)
 usb_remove_hcd(hcd);

 if (pdata  pdata-phy_exit)
 -   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
 +   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);

 clk_disable_unprepare(s5p_ehci-clk);

 @@ -229,7 +230,7 @@ static int s5p_ehci_suspend(struct device *dev)
 rc = ehci_suspend(hcd, do_wakeup);

 if (pdata  pdata-phy_exit)
 -   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
 +   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);

 clk_disable_unprepare(s5p_ehci-clk);

 @@ -246,7 +247,7 @@ static int s5p_ehci_resume(struct device *dev)
 clk_prepare_enable(s5p_ehci-clk);

 if (pdata  pdata-phy_init)
 -   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
 +   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);

 /* DMA burst Enable */
 writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd-regs));
 diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
 index aa3b884..804fb62 100644
 --- a/drivers/usb/host/ohci-exynos.c
 +++ b/drivers/usb/host/ohci-exynos.c
 @@ -15,6 +15,7 @@
  #include linux/of.h
  #include linux/platform_device.h
  #include linux/platform_data/usb-exynos.h
 +#include linux/usb/samsung_usb_phy.h
  #include plat/usb-phy.h

  struct exynos_ohci_hcd {
 @@ -153,7 +154,7 @@ static int exynos_ohci_probe(struct platform_device *pdev)
 }

 if (pdata-phy_init)
 -   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
 +   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);

 ohci = hcd_to_ohci(hcd);
 ohci_hcd_init(ohci);
 @@ -184,7 +185,7 @@ static int exynos_ohci_remove(struct platform_device 
 *pdev)
 usb_remove_hcd(hcd);

 if (pdata  pdata-phy_exit)
 -   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
 +   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);

 clk_disable_unprepare(exynos_ohci-clk);

 @@ -229,7 +230,7 @@ static int exynos_ohci_suspend(struct device *dev)
 clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags);

 if (pdata  pdata-phy_exit)
 -   pdata-phy_exit(pdev, S5P_USB_PHY_HOST);
 +   pdata-phy_exit(pdev, USB_PHY_TYPE_HOST);

 clk_disable_unprepare(exynos_ohci-clk);

 @@ -249,7 +250,7 @@ static int exynos_ohci_resume(struct device *dev)
 clk_prepare_enable(exynos_ohci-clk);

 if (pdata  pdata-phy_init)
 -   pdata-phy_init(pdev, S5P_USB_PHY_HOST);
 +   pdata-phy_init(pdev, USB_PHY_TYPE_HOST);

 ohci_resume(hcd, false);

 diff --git a/include/linux/usb/samsung_usb_phy.h 
 b/include/linux/usb/samsung_usb_phy.h
 new file mode 100644
 index 000..9167826
 --- /dev/null
 +++ b/include/linux/usb/samsung_usb_phy.h
 @@ -0,0 +1,16 @@
 +/*
 + * Copyright (C) 2012 Samsung Electronics Co.Ltd
 + * http://www.samsung.com/
 + *
 + * Defines phy types for samsung usb phy controllers - HOST or DEIVCE.
 + *
 + * This program is free software; you can redistribute  it and/or modify it
 + * under  the terms of  the GNU General  Public License as published by the
 + * Free Software Foundation;  either version 2 of the  License, or (at your
 + * option) any later version.
 + */
 +
 +enum samsung_usb_phy_type {
 +   USB_PHY_TYPE_DEVICE,
 +   USB_PHY_TYPE_HOST,
 +};
 --
 1.7.6.5

 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards

Re: [PATCH 1/2] ARM: Exynos5250: Enabling samsung-usbphy driver

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson.


On Tue, Dec 18, 2012 at 9:09 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Adding usbphy node for Exynos5250 along with the
 necessary device data to be parsed.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  arch/arm/boot/dts/exynos5250.dtsi   |   22 ++
  arch/arm/mach-exynos/include/mach/map.h |1 +
  arch/arm/mach-exynos/mach-exynos5-dt.c  |2 ++
  3 files changed, 25 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index 581e57a..bbdb2c2 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -299,6 +299,28 @@
 rx-dma-channel = pdma0 11; /* preliminary */
 };

 +   phy_h0: usbdev_phyctrl@10040704 {
 +   compatible = samsung,usbdev-phyctrl;
 +   samsung,phyhandle-reg = 0x10040704;
 +   };
 +
 +   phy_h1: usbhost_phyctrl@10040708 {
 +   compatible = samsung,usbhost-phyctrl;
 +   samsung,phyhandle-reg = 0x10040708;
 +   };
 +
 +   phy_h2: usbhost_phycfg@10050230 {
 +   compatible = samsung,usb-phycfg;
 +   samsung,phyhandle-reg = 0x10050230;
 +   };
 +
 +   usbphy@1213 {
 +   compatible = samsung,exynos5250-usbphy;
 +   reg = 0x1213 0x100;
 +   samsung,usb-phyhandle = phy_h0 phy_h1 phy_h2;
 +   samsung,enable-mask = 1;
 +   };
 +
 amba {
 #address-cells = 1;
 #size-cells = 1;
 diff --git a/arch/arm/mach-exynos/include/mach/map.h 
 b/arch/arm/mach-exynos/include/mach/map.h
 index cbb2852..778348e 100644
 --- a/arch/arm/mach-exynos/include/mach/map.h
 +++ b/arch/arm/mach-exynos/include/mach/map.h
 @@ -201,6 +201,7 @@
  #define EXYNOS4_PA_EHCI0x1258
  #define EXYNOS4_PA_OHCI0x1259
  #define EXYNOS4_PA_HSPHY   0x125B
 +#define EXYNOS5_PA_HSPHY   0x1213
  #define EXYNOS4_PA_MFC 0x1340

  #define EXYNOS4_PA_UART0x1380
 diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
 b/arch/arm/mach-exynos/mach-exynos5-dt.c
 index 462e5ac..24e7529 100644
 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c
 +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
 @@ -110,6 +110,8 @@ static const struct of_dev_auxdata 
 exynos5250_auxdata_lookup[] __initconst = {
 samsung-i2s.1, NULL),
 OF_DEV_AUXDATA(samsung,samsung-i2s, 0x12D7,
 samsung-i2s.2, NULL),
 +   OF_DEV_AUXDATA(samsung,exynos5250-usbphy, EXYNOS5_PA_HSPHY,
 +   s3c-usbphy, NULL),
 {},
  };

 --
 1.7.6.5

 ___
 devicetree-discuss mailing list
 devicetree-disc...@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/devicetree-discuss



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 2/4] usb: phy: samsung: Add host phy support to samsung-phy driver

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson.


On Tue, Dec 18, 2012 at 8:13 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 This patch adds host phy support to samsung-usbphy.c and
 further adds support for samsung's exynos5250 usb-phy.

 Signed-off-by: Praveen Paneri p.pan...@samsung.com
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  .../devicetree/bindings/usb/samsung-usbphy.txt |   25 +-
  drivers/usb/phy/Kconfig|2 +-
  drivers/usb/phy/samsung-usbphy.c   |  465 
 ++--
  include/linux/usb/samsung_usb_phy.h|   13 +
  4 files changed, 454 insertions(+), 51 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
 b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 index a7b28b2..2ec5400 100644
 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 @@ -1,23 +1,38 @@
  * 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 ehci-s5p and ohci-exynos usb controllers
 +across Samsung SOCs.
  TODO: Adding the PHY binding with controller(s) according to the under
  developement generic PHY driver.

  Required properties:
 +
 +Exynos4210:
  - compatible : should be samsung,exynos4210-usbphy
  - reg : base physical address of the phy registers and length of memory 
 mapped
 region.

 +Exynos5250:
 +- compatible : should be samsung,exynos5250-usbphy
 +- reg : base physical address of the phy registers and length of memory 
 mapped
 +   region.
 +
  Optional properties:
  - samsung,usb-phyhandle : should point to usb-phyhandle sub-node which 
 provides
 binding data to enable/disable device PHY handled by
 -   PMU register.
 +   PMU register; or to configure usb2.0 phy handled by
 +   SYSREG.

 Required properties:
 - compatible : should be samsung,usbdev-phyctrl for
 -   DEVICE type phy.
 +  DEVICE type phy; or
 +  should be samsung,usbhost-phyctrl for
 +  HOST type phy; or
 +  should be samsung,usb-phycfg for
 +  USB2.0 PHY_CFG.
 - samsung,phyhandle-reg: base physical address of
 -   PHY_CONTROL register in PMU.
 +PHY_CONTROL register in PMU;
 +or USB2.0 PHY_CFG register
 +in SYSREG.
  - samsung,enable-mask : should be '1'
 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 17ad743..13c0eaf 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -47,7 +47,7 @@ config USB_RCAR_PHY

  config SAMSUNG_USBPHY
 bool Samsung USB PHY controller Driver
 -   depends on USB_S3C_HSOTG
 +   depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS
 select USB_OTG_UTILS
 help
   Enable this to support Samsung USB phy controller for samsung
 diff --git a/drivers/usb/phy/samsung-usbphy.c 
 b/drivers/usb/phy/samsung-usbphy.c
 index 4ceabe3..621348a 100644
 --- a/drivers/usb/phy/samsung-usbphy.c
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -5,7 +5,8 @@
   *
   * Author: Praveen Paneri p.pan...@samsung.com
   *
 - * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller
 + * Samsung USB-PHY transceiver; talks to S3C HS OTG controller, EHCI-S5P and
 + * OHCI-EXYNOS controllers.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
 @@ -24,7 +25,7 @@
  #include linux/err.h
  #include linux/io.h
  #include linux/of.h
 -#include linux/usb/otg.h
 +#include linux/usb/samsung_usb_phy.h
  #include linux/platform_data/samsung-usbphy.h

  /* Register definitions */
 @@ -56,6 +57,103 @@
  #define RSTCON_HLINK_SWRST (0x1  1)
  #define RSTCON_SWRST   (0x1  0)

 +/* EXYNOS5 */
 +#define EXYNOS5_PHY_HOST_CTRL0 (0x00)
 +
 +#define HOST_CTRL0_PHYSWRSTALL (0x1  31)
 +
 +#define HOST_CTRL0_REFCLKSEL_MASK  (0x3)
 +#define HOST_CTRL0_REFCLKSEL_XTAL  (0x0  19)
 +#define HOST_CTRL0_REFCLKSEL_EXTL  (0x1  19)
 +#define HOST_CTRL0_REFCLKSEL_CLKCORE   (0x2  19)
 +
 +#define HOST_CTRL0_FSEL_MASK   (0x7  16)
 +#define HOST_CTRL0_FSEL(_x)((_x)  16)
 +#define HOST_CTRL0_FSEL_CLKSEL_50M (0x7

Re: [PATCH 2/2] ARM: Exynos5250: Enabling USB 3.0 phy for samsung-usbphy driver

2012-12-18 Thread Vivek Gautam
CC: Doug Anderson.


On Wed, Dec 19, 2012 at 5:02 AM, Sylwester Nawrocki
sylvester.nawro...@gmail.com wrote:
 On 12/18/2012 04:39 PM, Vivek Gautam wrote:

 Adding base address information required for enabling
 USB 3.0 DRD phy on exynos5250 SOC.

 Signed-off-by: Vivek Gautamgautam.vi...@samsung.com
 ---
   arch/arm/boot/dts/exynos5250.dtsi |3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)

 diff --git a/arch/arm/boot/dts/exynos5250.dtsi
 b/arch/arm/boot/dts/exynos5250.dtsi
 index bbdb2c2..07b7477 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -316,7 +316,8 @@

 usbphy@1213 {
 compatible = samsung,exynos5250-usbphy;
 -   reg =0x1213 0x100;
 +   reg =0x1213 0x100,
 +   0x1210 0x100;


 Doesn't this second memory region mean distinct PHY controller device ?
 Why separate usbphy node can't/shouldn't be created for it ?

 samsung,usb-phyhandle =phy_h0phy_h1phy_h2;
 samsung,enable-mask =1;
 };

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks  Regards
Vivek
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   4   5   6   7   >