linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC.
@ 2011-06-21  7:03 p.paneri at samsung.com
  2011-06-21  7:03 ` [RFC][PATCH 1/5] USB: DWC OTG: Modification in DWC OTG driver for ARM based SoCs p.paneri at samsung.com
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: p.paneri at samsung.com @ 2011-06-21  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Praveen Paneri <p.paneri@samsung.com>

These patches modify DWC OTG driver for ARM and add it for ARM based SoCs.
Currently it has been tested for Samsung's S5P6440. The development is still 
under process so these are not the best set of patches. They are just for review
and not for merge. Intent of these patches is to show required modifications
to make dwc_otg patches work on ARM.

Following features are tested for basic functions on SMDK6440
board after modifications:
OTG HOST: HID and mass-storage
OTG DEVICE: mass-storage and adb

This patch series is based on below dwc_otg patches
	http://patchwork.ozlabs.org/patch/89560/

To: Tirumala Marri, Felipe Balbi
[PATCH 1/5] USB: DWC OTG: Modification in DWC OTG driver for ARM based SoCs

To: Kukjin Kim
[PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung
[PATCH 3/5] ARM: SAMSUNG: Adding IO mapping for OTG
[PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
[PATCH 5/5] ARM: S5P64x0: Adding OTG device and initialization code for smdk6440

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 1/5] USB: DWC OTG: Modification in DWC OTG driver for ARM based SoCs.
  2011-06-21  7:03 [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC p.paneri at samsung.com
@ 2011-06-21  7:03 ` p.paneri at samsung.com
  2011-06-21  9:25   ` Felipe Balbi
  2011-06-21  7:03 ` [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung p.paneri at samsung.com
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: p.paneri at samsung.com @ 2011-06-21  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Praveen Paneri <p.paneri@samsung.com>

This patch modifies DWC OTG for ARM based SoCs. Currently it has
been tested for Samsung S5P6440. Can easily be built for others
as well.

Following features are tested for basic functions on SMDK6440
board after modifications:
OTG HOST: HID and mass-storage
OTG DEVICE: mass-storage and adb

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
---
 drivers/usb/dwc/Makefile |    3 ++
 drivers/usb/dwc/apmppc.c |   36 +++++++++++++++++++++++++++-----
 drivers/usb/dwc/cil.h    |   50 +++++++++++++++++++++++++++++++++++++++++++++-
 drivers/usb/dwc/param.c  |   28 +++++++++++++++++++++++--
 4 files changed, 107 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/dwc/Makefile b/drivers/usb/dwc/Makefile
index 4102add..7f60caa 100644
--- a/drivers/usb/dwc/Makefile
+++ b/drivers/usb/dwc/Makefile
@@ -8,6 +8,9 @@ dwc-objs := cil.o cil_intr.o param.o
 ifeq ($(CONFIG_4xx_SOC),y)
 dwc-objs += apmppc.o
 endif
+ifeq ($(CONFIG_CPU_S5P6440),y)
+dwc-objs += apmppc.o
+endif
 
 ifneq ($(CONFIG_DWC_DEVICE_ONLY),y)
 dwc-objs += hcd.o hcd_intr.o \
diff --git a/drivers/usb/dwc/apmppc.c b/drivers/usb/dwc/apmppc.c
index ffbe6dd..b0dcae9 100644
--- a/drivers/usb/dwc/apmppc.c
+++ b/drivers/usb/dwc/apmppc.c
@@ -50,9 +50,6 @@
  * this file system to perform diagnostics on the driver components or the
  * device.
  */
-
-#include <linux/of_platform.h>
-
 #include "driver.h"
 
 #define DWC_DRIVER_VERSION		"1.05"
@@ -110,6 +107,9 @@ static int __devexit dwc_otg_driver_remove(struct platform_device *ofdev)
 {
 	struct device *dev = &ofdev->dev;
 	struct dwc_otg_device *dwc_dev = dev_get_drvdata(dev);
+#ifdef CONFIG_CPU_S5P6440
+	struct s5p_otg_platdata *pdata = ofdev->dev.platform_data;
+#endif
 
 	/* Memory allocation for dwc_otg_device may have failed. */
 	if (!dwc_dev)
@@ -152,6 +152,11 @@ static int __devexit dwc_otg_driver_remove(struct platform_device *ofdev)
 
 	/* Clear the drvdata pointer. */
 	dev_set_drvdata(dev, NULL);
+#ifdef CONFIG_CPU_S5P6440
+	/* OTG Phy off */
+	if (pdata && pdata->phy_exit)
+		pdata->phy_exit(ofdev, S5P_USB_PHY_DEVICE);
+#endif
 	return 0;
 }
 
@@ -169,12 +174,14 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
 	int retval;
 	struct dwc_otg_device *dwc_dev;
 	struct device *dev = &ofdev->dev;
+#ifdef CONFIG_CPU_S5P6440
+	struct s5p_otg_platdata *pdata = ofdev->dev.platform_data;
+#endif
 	struct resource res;
 	ulong gusbcfg_addr;
 	u32 usbcfg = 0;
 
 	dev_dbg(dev, "dwc_otg_driver_probe(%p)\n", dev);
-
 	dwc_dev = kzalloc(sizeof(*dwc_dev), GFP_KERNEL);
 	if (!dwc_dev) {
 		dev_err(dev, "kmalloc of dwc_otg_device failed\n");
@@ -182,15 +189,24 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
 		goto fail_dwc_dev;
 	}
 
+#ifdef CONFIG_CPU_S5P6440
+	/* OTG Phy init */
+	if (pdata && pdata->phy_init)
+		pdata->phy_init(ofdev, S5P_USB_PHY_DEVICE);
+#endif
 	/* Retrieve the memory and IRQ resources. */
+#ifdef CONFIG_ARM
+	dwc_dev->irq = ofdev->resource[1].start;
+#else
 	dwc_dev->irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
+#endif
 	if (dwc_dev->irq == NO_IRQ) {
 		dev_err(dev, "no device irq\n");
 		retval = -ENODEV;
 		goto fail_of_irq;
 	}
 	dev_dbg(dev, "OTG - device irq: %d\n", dwc_dev->irq);
-
+#ifndef CONFIG_ARM
 	if (of_address_to_resource(ofdev->dev.of_node, 0, &res)) {
 		dev_err(dev, "%s: Can't get USB-OTG register address\n",
 			__func__);
@@ -200,8 +216,14 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
 	dev_dbg(dev, "OTG - ioresource_mem start0x%llx: end:0x%llx\n",
 		(unsigned long long)res.start, (unsigned long long)res.end);
 
+
 	dwc_dev->phys_addr = res.start;
 	dwc_dev->base_len = res.end - res.start + 1;
+#else
+	dwc_dev->phys_addr = ofdev->resource[0].start;
+	dwc_dev->base_len = ofdev->resource[0].end -
+				ofdev->resource[0].start + 1;
+#endif
 	if (!request_mem_region(dwc_dev->phys_addr,
 				dwc_dev->base_len, dwc_driver_name)) {
 		dev_err(dev, "request_mem_region failed\n");
@@ -235,7 +257,7 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
 	/*
 	 * Validate parameter values after dwc_otg_cil_init.
 	 */
-	if (check_parameters(dwc_dev->core_if)) {
+	if (check_parameters(dwc_dev->core_if, ofdev)) {
 		retval = -EINVAL;
 		goto fail_check_param;
 	}
@@ -296,6 +318,7 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
 			dwc_dev->hcd = NULL;
 			goto fail_hcd;
 		}
+#ifndef CONFIG_ARM
 		/* configure chargepump interrupt */
 		dwc_dev->hcd->cp_irq = irq_of_parse_and_map(ofdev->dev.of_node,
 							    3);
@@ -316,6 +339,7 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
 				dwc_dev->hcd->cp_irq_installed = 1;
 			}
 		}
+#endif
 	}
 	/*
 	 * Enable the global interrupt after all the interrupt
diff --git a/drivers/usb/dwc/cil.h b/drivers/usb/dwc/cil.h
index 80b7da5..c1a11f1 100644
--- a/drivers/usb/dwc/cil.h
+++ b/drivers/usb/dwc/cil.h
@@ -37,6 +37,15 @@
 #if !defined(__DWC_CIL_H__)
 #define __DWC_CIL_H__
 #include <linux/io.h>
+#ifdef CONFIG_ARM
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <plat/otg.h>
+#include <plat/usb-phy.h>
+#else
+#include <linux/of_platform.h>
+#endif
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/interrupt.h>
@@ -50,6 +59,7 @@
 #define DEBUG
 #endif
 
+#ifndef CONFIG_ARM
 /**
  * Reads the content of a register.
  */
@@ -108,6 +118,43 @@ static inline u32 dwc_read_fifo32(ulong _reg)
 	return in_be32((unsigned __iomem *) _reg);
 #endif
 };
+#else
+/**
+ * Reads the content of a register.
+ */
+static inline u32 dwc_read32(u32 reg)
+{
+	return readl(reg);
+};
+
+/**
+ * Writes a register with a 32 bit value.
+ */
+static inline void dwc_write32(u32 reg, const u32 value)
+{
+	writel(value, reg);
+};
+
+/**
+ * This function modifies bit values in a register.  Using the
+ * algorithm: (reg_contents & ~clear_mask) | set_mask.
+ */
+static inline
+	void dwc_modify32(u32 reg, const u32 _clear_mask, const u32 _set_mask)
+{
+	dwc_write32(reg, (dwc_read32(reg) & ~_clear_mask) | _set_mask);
+};
+
+static inline void dwc_write_fifo32(u32 reg, const u32 _value)
+{
+	writel(_value, reg);
+};
+
+static inline u32 dwc_read_fifo32(u32 _reg)
+{
+	return readl(_reg);
+};
+#endif /* CONFIG_ARM */
 
 /*
  * Debugging support vanishes in non-debug builds.
@@ -1173,5 +1220,6 @@ static inline int dwc_has_feature(struct core_if *core_if,
 	return core_if->features & feature;
 }
 extern struct core_params dwc_otg_module_params;
-extern int __devinit check_parameters(struct core_if *core_if);
+extern int __devinit check_parameters(struct core_if *core_if,
+						struct platform_device *ofdev);
 #endif
diff --git a/drivers/usb/dwc/param.c b/drivers/usb/dwc/param.c
index 523f0db..b48c510 100644
--- a/drivers/usb/dwc/param.c
+++ b/drivers/usb/dwc/param.c
@@ -116,8 +116,12 @@ static int set_valid_tx_fifo_sizes(struct core_if *core_if)
  * This function is called during module intialization to verify that
  * the module parameters are in a valid state.
  */
-int __devinit check_parameters(struct core_if *core_if)
+int __devinit check_parameters(struct core_if *core_if,
+						struct platform_device *ofdev)
 {
+#ifdef CONFIG_CPU_S5P6440
+	struct s5p_otg_platdata *pdata = ofdev->dev.platform_data;
+#endif
 	/* Default values */
 	dwc_otg_module_params.otg_cap = dwc_param_otg_cap_default;
 	dwc_otg_module_params.dma_enable = dwc_param_dma_enable_default;
@@ -145,6 +149,23 @@ int __devinit check_parameters(struct core_if *core_if)
 	 */
 	dwc_otg_module_params.enable_dynamic_fifo =
 	    DWC_HWCFG2_DYN_FIFO_RD(core_if->hwcfg2);
+#ifdef CONFIG_CPU_S5P6440
+	if (pdata && pdata->dev_rx_fifo_size)
+		dwc_otg_module_params.dev_rx_fifo_size =
+						pdata->dev_rx_fifo_size;
+	if (pdata && pdata->dev_nptx_fifo_size)
+		dwc_otg_module_params.dev_nperio_tx_fifo_size =
+						pdata->dev_nptx_fifo_size;
+
+	if (pdata && pdata->host_rx_fifo_size)
+		dwc_otg_module_params.host_rx_fifo_size =
+						pdata->host_rx_fifo_size;
+	if (pdata && pdata->host_nptx_fifo_size)
+		dwc_otg_module_params.host_nperio_tx_fifo_size =
+						pdata->host_nptx_fifo_size;
+	if (pdata && pdata->host_ch_num)
+		dwc_otg_module_params.host_channels = pdata->host_ch_num;
+#else
 	dwc_otg_module_params.dev_rx_fifo_size =
 	    dwc_read32(core_if->core_global_regs + DWC_GRXFSIZ);
 	dwc_otg_module_params.dev_nperio_tx_fifo_size =
@@ -154,6 +175,9 @@ int __devinit check_parameters(struct core_if *core_if)
 	    dwc_read32(core_if->core_global_regs + DWC_GRXFSIZ);
 	dwc_otg_module_params.host_nperio_tx_fifo_size =
 	    dwc_read32(core_if->core_global_regs + DWC_GNPTXFSIZ) >> 16;
+	dwc_otg_module_params.host_channels =
+	    DWC_HWCFG2_NO_HST_CHAN_RD(core_if->hwcfg2) + 1;
+#endif
 	dwc_otg_module_params.host_perio_tx_fifo_size =
 	    dwc_read32(core_if->core_global_regs + DWC_HPTXFSIZ) >> 16;
 	dwc_otg_module_params.max_transfer_size =
@@ -163,8 +187,6 @@ int __devinit check_parameters(struct core_if *core_if)
 	    (1 << (DWC_HWCFG3_PKTSIZE_CTR_WIDTH_RD(core_if->hwcfg3) + 4))
 	    - 1;
 
-	dwc_otg_module_params.host_channels =
-	    DWC_HWCFG2_NO_HST_CHAN_RD(core_if->hwcfg2) + 1;
 	dwc_otg_module_params.dev_endpoints =
 	    DWC_HWCFG2_NO_DEV_EP_RD(core_if->hwcfg2);
 	dwc_otg_module_params.en_multiple_tx_fifo =
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung.
  2011-06-21  7:03 [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC p.paneri at samsung.com
  2011-06-21  7:03 ` [RFC][PATCH 1/5] USB: DWC OTG: Modification in DWC OTG driver for ARM based SoCs p.paneri at samsung.com
@ 2011-06-21  7:03 ` p.paneri at samsung.com
  2011-06-21  9:16   ` Felipe Balbi
  2011-06-21 11:47   ` Sergei Shtylyov
  2011-06-21  7:03 ` [RFC][PATCH 3/5] ARM: SAMSUNG: Adding IO mapping for OTG PHY p.paneri at samsung.com
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 23+ messages in thread
From: p.paneri at samsung.com @ 2011-06-21  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Praveen Paneri <p.paneri@samsung.com>

Adding dwc driver name in existing platform device
to probe DWC OTG driver.
Introduced otg_set_platdata function to pass platform data
Added selectable config option to add DWC OTG driver for different
machines.

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
---
 arch/arm/plat-samsung/Kconfig         |    6 ++++++
 arch/arm/plat-samsung/Makefile        |    1 +
 arch/arm/plat-samsung/dev-usb-hsotg.c |   20 ++++++++++++++++++++
 3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 4d79519..58ed8b1 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -227,6 +227,12 @@ config S3C_DEV_USB_HSOTG
 	help
 	  Compile in platform device definition for USB high-speed OtG
 
+config S3C_DEV_DWC_OTG
+	bool
+	help
+	  Compile in platform device definition for DWC OTG. This
+	  will make it selectable for different machines.
+
 config S3C_DEV_WDT
 	bool
 	default y if ARCH_S3C2410
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 53eb15b..785ca79 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -49,6 +49,7 @@ obj-$(CONFIG_S3C_DEV_FB)	+= dev-fb.o
 obj-y				+= dev-uart.o
 obj-$(CONFIG_S3C_DEV_USB_HOST)	+= dev-usb.o
 obj-$(CONFIG_S3C_DEV_USB_HSOTG)	+= dev-usb-hsotg.o
+obj-$(CONFIG_S3C_DEV_DWC_OTG)	+= dev-usb-hsotg.o
 obj-$(CONFIG_S3C_DEV_WDT)	+= dev-wdt.o
 obj-$(CONFIG_S3C_DEV_NAND)	+= dev-nand.o
 obj-$(CONFIG_S3C_DEV_ONENAND)	+= dev-onenand.o
diff --git a/arch/arm/plat-samsung/dev-usb-hsotg.c b/arch/arm/plat-samsung/dev-usb-hsotg.c
index 33a844a..7e6228b 100644
--- a/arch/arm/plat-samsung/dev-usb-hsotg.c
+++ b/arch/arm/plat-samsung/dev-usb-hsotg.c
@@ -20,6 +20,8 @@
 #include <mach/map.h>
 
 #include <plat/devs.h>
+#include <plat/otg.h>
+#include <plat/usb-phy.h>
 
 static struct resource s3c_usb_hsotg_resources[] = {
 	[0] = {
@@ -37,7 +39,12 @@ static struct resource s3c_usb_hsotg_resources[] = {
 static u64 s3c_hsotg_dmamask = DMA_BIT_MASK(32);
 
 struct platform_device s3c_device_usb_hsotg = {
+#ifdef CONFIG_S3C_DEV_USB_HSOTG
 	.name		= "s3c-hsotg",
+#endif
+#ifdef CONFIG_S3C_DEV_DWC_OTG
+	.name		= "dwc_otg",
+#endif
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(s3c_usb_hsotg_resources),
 	.resource	= s3c_usb_hsotg_resources,
@@ -46,3 +53,16 @@ struct platform_device s3c_device_usb_hsotg = {
 		.coherent_dma_mask	= DMA_BIT_MASK(32),
 	},
 };
+
+void __init s5p_otg_set_platdata(struct s5p_otg_platdata *pd)
+{
+	struct s5p_otg_platdata *npd;
+
+	npd = s3c_set_platdata(pd, sizeof(struct s5p_otg_platdata),
+			&s3c_device_usb_hsotg);
+
+	if (!npd->phy_init)
+		npd->phy_init = s5p_usb_phy_init;
+	if (!npd->phy_exit)
+		npd->phy_exit = s5p_usb_phy_exit;
+}
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [RFC][PATCH 3/5] ARM: SAMSUNG: Adding IO mapping for OTG PHY.
  2011-06-21  7:03 [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC p.paneri at samsung.com
  2011-06-21  7:03 ` [RFC][PATCH 1/5] USB: DWC OTG: Modification in DWC OTG driver for ARM based SoCs p.paneri at samsung.com
  2011-06-21  7:03 ` [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung p.paneri at samsung.com
@ 2011-06-21  7:03 ` p.paneri at samsung.com
  2011-06-21 11:18   ` Banajit Goswami
  2011-06-21  7:03 ` [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code p.paneri at samsung.com
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: p.paneri at samsung.com @ 2011-06-21  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Praveen Paneri <p.paneri@samsung.com>

Adding virtual addresses for OTG PHY.

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
---
 arch/arm/mach-s5p64x0/cpu.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c
index a5c0095..8dc6f20 100644
--- a/arch/arm/mach-s5p64x0/cpu.c
+++ b/arch/arm/mach-s5p64x0/cpu.c
@@ -57,6 +57,11 @@ static struct map_desc s5p64x0_iodesc[] __initdata = {
 		.pfn		= __phys_to_pfn(S5P64X0_PA_VIC1),
 		.length		= SZ_16K,
 		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S3C_VA_USB_HSPHY,
+		.pfn		= __phys_to_pfn(S5P64X0_PA_USB_HSPHY),
+		.length		= SZ_1M,
+		.type		= MT_DEVICE,
 	},
 };
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
  2011-06-21  7:03 [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC p.paneri at samsung.com
                   ` (2 preceding siblings ...)
  2011-06-21  7:03 ` [RFC][PATCH 3/5] ARM: SAMSUNG: Adding IO mapping for OTG PHY p.paneri at samsung.com
@ 2011-06-21  7:03 ` p.paneri at samsung.com
  2011-06-21  9:31   ` Felipe Balbi
                     ` (2 more replies)
  2011-06-21  7:03 ` [RFC][PATCH 5/5] ARM: S5P64x0: Adding OTG device for smdk6440 p.paneri at samsung.com
  2011-06-21  9:45 ` [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC Marek Szyprowski
  5 siblings, 3 replies; 23+ messages in thread
From: p.paneri at samsung.com @ 2011-06-21  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Praveen Paneri <p.paneri@samsung.com>

A generic method to initialize and exit OTG PHY which can be
used for all the samsung SoCs.
OTG platdata structure added in platform to pass required
platform specific functions and data to the driver.

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
---
 arch/arm/mach-s5p64x0/Makefile           |    1 +
 arch/arm/mach-s5p64x0/include/mach/map.h |    4 +
 arch/arm/mach-s5p64x0/setup-otg-phy.c    |   89 ++++++++++++++++++++++++++++++
 arch/arm/plat-s5p/include/plat/otg.h     |   29 ++++++++++
 4 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5p64x0/setup-otg-phy.c
 create mode 100644 arch/arm/plat-s5p/include/plat/otg.h

diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index ae6bf6f..611fb3a 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -28,3 +28,4 @@ obj-y				+= dev-audio.o
 obj-$(CONFIG_S3C64XX_DEV_SPI)	+= dev-spi.o
 
 obj-$(CONFIG_S5P64X0_SETUP_I2C1)	+= setup-i2c1.o
+obj-$(CONFIG_S3C_DEV_DWC_OTG)	+= setup-otg-phy.o
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
index 95c9125..717c279 100644
--- a/arch/arm/mach-s5p64x0/include/mach/map.h
+++ b/arch/arm/mach-s5p64x0/include/mach/map.h
@@ -44,6 +44,8 @@
 #define S5P64X0_PA_SPI1		0xEC500000
 
 #define S5P64X0_PA_HSOTG	0xED100000
+#define S5P64X0_PA_USB_HSPHY	0xED200000
+#define S5P64X0_VA_USB_HSPHY	S3C_ADDR_CPU(0x00100000)
 
 #define S5P64X0_PA_HSMMC(x)	(0xED800000 + ((x) * 0x100000))
 
@@ -71,6 +73,8 @@
 #define S5P_PA_TIMER		S5P64X0_PA_TIMER
 
 #define SAMSUNG_PA_ADC		S5P64X0_PA_ADC
+#define S3C_PA_USB_HSOTG	S5P64X0_PA_HSOTG
+#define S3C_VA_USB_HSPHY        S5P64X0_VA_USB_HSPHY
 
 /* UART */
 
diff --git a/arch/arm/mach-s5p64x0/setup-otg-phy.c b/arch/arm/mach-s5p64x0/setup-otg-phy.c
new file mode 100644
index 0000000..c351554
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/setup-otg-phy.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Praveen Paneri <p.paneri@samsung.com>
+ * based on arch/arm/mach-exynos4/setup-usb-phy.c
+ * written by Joonyoung Shim <jy0922.shim@samsung.com>
+ *
+ *  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.
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <mach/regs-clock.h>
+#include <mach/gpio.h>
+#include <plat/regs-usb-hsotg-phy.h>
+#include <plat/usb-phy.h>
+
+struct clk *otg_clk;
+static int s5p64x0_otg_phy_init(struct platform_device *pdev)
+{
+	int err;
+
+	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;
+	}
+
+	if (gpio_is_valid(S5P6440_GPN(1))) {
+		err = gpio_request(S5P6440_GPN(1), "GPN");
+		if (err)
+			printk(KERN_ERR "failed to request GPN1\n");
+		gpio_direction_output(S5P6440_GPN(1), 1);
+	}
+
+	writel(readl(S5P64X0_OTHERS)&~S5P64X0_OTHERS_USB_SIG_MASK,
+							S5P64X0_OTHERS);
+	writel(0x0, S3C_PHYPWR);         /* Power up */
+	writel(S3C_PHYCLK_CLKSEL_12M, S3C_PHYCLK);
+	writel(S3C_RSTCON_PHY, S3C_RSTCON);
+
+	udelay(50);
+	writel(0x0, S3C_RSTCON);
+	udelay(50);
+
+	return 0;
+}
+
+static int s5p64x0_otg_phy_exit(struct platform_device *pdev)
+{
+	writel(readl(S3C_PHYPWR)|(0x1F<<1), S3C_PHYPWR);
+	writel(readl(S5P64X0_OTHERS)&~S5P64X0_OTHERS_USB_SIG_MASK,
+							S5P64X0_OTHERS);
+
+	gpio_free(S5P6440_GPN(1));
+
+	clk_disable(otg_clk);
+	clk_put(otg_clk);
+
+	return 0;
+}
+
+int s5p_usb_phy_init(struct platform_device *pdev, int type)
+{
+	if (type == S5P_USB_PHY_DEVICE)
+		return s5p64x0_otg_phy_init(pdev);
+
+	return -EINVAL;
+}
+
+int s5p_usb_phy_exit(struct platform_device *pdev, int type)
+{
+	if (type == S5P_USB_PHY_DEVICE)
+		return s5p64x0_otg_phy_exit(pdev);
+
+	return -EINVAL;
+}
diff --git a/arch/arm/plat-s5p/include/plat/otg.h b/arch/arm/plat-s5p/include/plat/otg.h
new file mode 100644
index 0000000..3111dcc
--- /dev/null
+++ b/arch/arm/plat-s5p/include/plat/otg.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Praveen Paneri <p.paneri@samsung.com>
+ * based on arch/arm/plat-s5p/include/plat/usb-phy.h
+ * written by Joonyoung Shim <jy0922.shim@samsung.com>
+ *
+ * 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.
+ */
+
+#ifndef __PLAT_S5P_OTG_H
+#define __PLAT_S5P_OTG_H
+
+struct s5p_otg_platdata {
+	int (*phy_init)(struct platform_device *pdev, int type);
+	int (*phy_exit)(struct platform_device *pdev, int type);
+	u32 dev_rx_fifo_size;
+	u32 dev_nptx_fifo_size;
+	u32 host_rx_fifo_size;
+	u32 host_nptx_fifo_size;
+	u32 host_ch_num;
+
+};
+
+extern void s5p_otg_set_platdata(struct s5p_otg_platdata *pd);
+
+#endif /* __PLAT_S5P_OTG_H */
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [RFC][PATCH 5/5] ARM: S5P64x0: Adding OTG device for smdk6440
  2011-06-21  7:03 [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC p.paneri at samsung.com
                   ` (3 preceding siblings ...)
  2011-06-21  7:03 ` [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code p.paneri at samsung.com
@ 2011-06-21  7:03 ` p.paneri at samsung.com
  2011-06-21  9:45 ` [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC Marek Szyprowski
  5 siblings, 0 replies; 23+ messages in thread
From: p.paneri at samsung.com @ 2011-06-21  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Praveen Paneri <p.paneri@samsung.com>

Selected DWC OTG for smdk6440 and added platform specific
data in machine file.

Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
---
 arch/arm/Kconfig                      |    1 +
 arch/arm/mach-s5p64x0/mach-smdk6440.c |   24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9adc278..e98bb53 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -728,6 +728,7 @@ config ARCH_S5P64X0
 	select HAVE_SCHED_CLOCK
 	select HAVE_S3C2410_I2C if I2C
 	select HAVE_S3C_RTC if RTC_CLASS
+	select S3C_DEV_DWC_OTG
 	help
 	  Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440,
 	  SMDK6450.
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 2d559f1..515e252 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -46,6 +46,7 @@
 #include <plat/adc.h>
 #include <plat/ts.h>
 #include <plat/s5p-time.h>
+#include <plat/otg.h>
 
 #define SMDK6440_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
 				S3C2410_UCON_RXILEVEL |		\
@@ -130,6 +131,27 @@ static struct platform_device smdk6440_backlight_device = {
 	},
 };
 
+/* USB OTG */
+#define S3C_DEV_RX_FIFO_SIZ	(4096>>2)
+#define S3C_DEV_NPTX_FIFO_SIZ	(4096>>2)
+#define S3C_HOST_RX_FIFO_SIZ	0x0000010D
+#define S3C_HOST_NPTX_FIFO_SIZ	0x0080010D
+#define S3C_HOST_CH_NUM		12
+
+static struct s5p_otg_platdata smdk6440_otg_pdata = {
+	.dev_rx_fifo_size	= S3C_DEV_RX_FIFO_SIZ,
+	.dev_nptx_fifo_size	= S3C_DEV_NPTX_FIFO_SIZ,
+	.host_rx_fifo_size	= S3C_HOST_RX_FIFO_SIZ,
+	.host_nptx_fifo_size	= S3C_HOST_NPTX_FIFO_SIZ,
+	.host_ch_num		= S3C_HOST_CH_NUM,
+};
+
+static void __init smdk6440_otg_init(void)
+{
+	struct s5p_otg_platdata *pdata = &smdk6440_otg_pdata;
+
+	s5p_otg_set_platdata(pdata);
+}
 static struct platform_device *smdk6440_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_rtc,
@@ -141,6 +163,7 @@ static struct platform_device *smdk6440_devices[] __initdata = {
 	&s5p6440_device_iis,
 	&s3c_device_timer[1],
 	&smdk6440_backlight_device,
+	&s3c_device_usb_hsotg,
 };
 
 static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
@@ -193,6 +216,7 @@ static void __init smdk6440_machine_init(void)
 			ARRAY_SIZE(smdk6440_i2c_devs0));
 	i2c_register_board_info(1, smdk6440_i2c_devs1,
 			ARRAY_SIZE(smdk6440_i2c_devs1));
+	smdk6440_otg_init();
 
 	platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung.
  2011-06-21  7:03 ` [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung p.paneri at samsung.com
@ 2011-06-21  9:16   ` Felipe Balbi
  2011-06-21 11:47   ` Sergei Shtylyov
  1 sibling, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2011-06-21  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Jun 21, 2011 at 12:33:44PM +0530, p.paneri at samsung.com wrote:
> From: Praveen Paneri <p.paneri@samsung.com>
> 
> Adding dwc driver name in existing platform device
> to probe DWC OTG driver.
> Introduced otg_set_platdata function to pass platform data
> Added selectable config option to add DWC OTG driver for different
> machines.
> 
> Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
> ---
>  arch/arm/plat-samsung/Kconfig         |    6 ++++++
>  arch/arm/plat-samsung/Makefile        |    1 +
>  arch/arm/plat-samsung/dev-usb-hsotg.c |   20 ++++++++++++++++++++
>  3 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
> index 4d79519..58ed8b1 100644
> --- a/arch/arm/plat-samsung/Kconfig
> +++ b/arch/arm/plat-samsung/Kconfig
> @@ -227,6 +227,12 @@ config S3C_DEV_USB_HSOTG
>  	help
>  	  Compile in platform device definition for USB high-speed OtG
>  
> +config S3C_DEV_DWC_OTG
> +	bool
> +	help
> +	  Compile in platform device definition for DWC OTG. This
> +	  will make it selectable for different machines.
> +
>  config S3C_DEV_WDT
>  	bool
>  	default y if ARCH_S3C2410
> diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
> index 53eb15b..785ca79 100644
> --- a/arch/arm/plat-samsung/Makefile
> +++ b/arch/arm/plat-samsung/Makefile
> @@ -49,6 +49,7 @@ obj-$(CONFIG_S3C_DEV_FB)	+= dev-fb.o
>  obj-y				+= dev-uart.o
>  obj-$(CONFIG_S3C_DEV_USB_HOST)	+= dev-usb.o
>  obj-$(CONFIG_S3C_DEV_USB_HSOTG)	+= dev-usb-hsotg.o
> +obj-$(CONFIG_S3C_DEV_DWC_OTG)	+= dev-usb-hsotg.o
>  obj-$(CONFIG_S3C_DEV_WDT)	+= dev-wdt.o
>  obj-$(CONFIG_S3C_DEV_NAND)	+= dev-nand.o
>  obj-$(CONFIG_S3C_DEV_ONENAND)	+= dev-onenand.o
> diff --git a/arch/arm/plat-samsung/dev-usb-hsotg.c b/arch/arm/plat-samsung/dev-usb-hsotg.c
> index 33a844a..7e6228b 100644
> --- a/arch/arm/plat-samsung/dev-usb-hsotg.c
> +++ b/arch/arm/plat-samsung/dev-usb-hsotg.c
> @@ -20,6 +20,8 @@
>  #include <mach/map.h>
>  
>  #include <plat/devs.h>
> +#include <plat/otg.h>
> +#include <plat/usb-phy.h>
>  
>  static struct resource s3c_usb_hsotg_resources[] = {
>  	[0] = {
> @@ -37,7 +39,12 @@ static struct resource s3c_usb_hsotg_resources[] = {
>  static u64 s3c_hsotg_dmamask = DMA_BIT_MASK(32);
>  
>  struct platform_device s3c_device_usb_hsotg = {
> +#ifdef CONFIG_S3C_DEV_USB_HSOTG
>  	.name		= "s3c-hsotg",
> +#endif
> +#ifdef CONFIG_S3C_DEV_DWC_OTG
> +	.name		= "dwc_otg",
> +#endif

no, don't do that. See we're going through a big re-factor on the gadget
framework to allow multiple UDC drivers to be compiled as modules. The
idea is to be able to have distro-like kernels for embedded too.

Take a look at my gadget branch [1] and see how the gadget controllers
are modified to start allowing that.

I also have patch to the Kconfig allowing all controllers to be enabled
as modules, I just need some more time to figure out one warning on the
renenesas controller.

IOW, it's best to add both platform devices. Or move to device tree.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110621/a7ebcf4b/attachment.sig>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 1/5] USB: DWC OTG: Modification in DWC OTG driver for ARM based SoCs.
  2011-06-21  7:03 ` [RFC][PATCH 1/5] USB: DWC OTG: Modification in DWC OTG driver for ARM based SoCs p.paneri at samsung.com
@ 2011-06-21  9:25   ` Felipe Balbi
  0 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2011-06-21  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Jun 21, 2011 at 12:33:43PM +0530, p.paneri at samsung.com wrote:
> From: Praveen Paneri <p.paneri@samsung.com>
> 
> This patch modifies DWC OTG for ARM based SoCs. Currently it has
> been tested for Samsung S5P6440. Can easily be built for others
> as well.
> 
> Following features are tested for basic functions on SMDK6440
> board after modifications:
> OTG HOST: HID and mass-storage
> OTG DEVICE: mass-storage and adb
> 
> Signed-off-by: Praveen Paneri <p.paneri@samsung.com>

this is wrong is so many levels... We shouldn't be adding ifdefs to
allow the driver to be compiled for multiple architectures. The correct
way to handle this, is to phase out the core driver from the SoC- or
PCI-specific parts and make that a glue layer that bridges to the core
driver.

I'm writing the driver for a similar core, the DWC USB3, take a look at
my dwc3 branch [1] to see how this should be done.

> diff --git a/drivers/usb/dwc/apmppc.c b/drivers/usb/dwc/apmppc.c
> index ffbe6dd..b0dcae9 100644
> --- a/drivers/usb/dwc/apmppc.c
> +++ b/drivers/usb/dwc/apmppc.c
> @@ -50,9 +50,6 @@
>   * this file system to perform diagnostics on the driver components or the
>   * device.
>   */
> -
> -#include <linux/of_platform.h>
> -
>  #include "driver.h"
>  
>  #define DWC_DRIVER_VERSION		"1.05"
> @@ -110,6 +107,9 @@ static int __devexit dwc_otg_driver_remove(struct platform_device *ofdev)
>  {
>  	struct device *dev = &ofdev->dev;
>  	struct dwc_otg_device *dwc_dev = dev_get_drvdata(dev);
> +#ifdef CONFIG_CPU_S5P6440
> +	struct s5p_otg_platdata *pdata = ofdev->dev.platform_data;
> +#endif

NAK

> @@ -152,6 +152,11 @@ static int __devexit dwc_otg_driver_remove(struct platform_device *ofdev)
>  
>  	/* Clear the drvdata pointer. */
>  	dev_set_drvdata(dev, NULL);
> +#ifdef CONFIG_CPU_S5P6440
> +	/* OTG Phy off */
> +	if (pdata && pdata->phy_exit)
> +		pdata->phy_exit(ofdev, S5P_USB_PHY_DEVICE);
> +#endif

NAK

> @@ -169,12 +174,14 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
>  	int retval;
>  	struct dwc_otg_device *dwc_dev;
>  	struct device *dev = &ofdev->dev;
> +#ifdef CONFIG_CPU_S5P6440
> +	struct s5p_otg_platdata *pdata = ofdev->dev.platform_data;
> +#endif

NAK

> @@ -182,15 +189,24 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
>  		goto fail_dwc_dev;
>  	}
>  
> +#ifdef CONFIG_CPU_S5P6440
> +	/* OTG Phy init */
> +	if (pdata && pdata->phy_init)
> +		pdata->phy_init(ofdev, S5P_USB_PHY_DEVICE);
> +#endif
>  	/* Retrieve the memory and IRQ resources. */
> +#ifdef CONFIG_ARM
> +	dwc_dev->irq = ofdev->resource[1].start;
> +#else
>  	dwc_dev->irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
> +#endif

NAK

> +#ifndef CONFIG_ARM

NAK

> @@ -200,8 +216,14 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
>  	dev_dbg(dev, "OTG - ioresource_mem start0x%llx: end:0x%llx\n",
>  		(unsigned long long)res.start, (unsigned long long)res.end);
>  
> +
>  	dwc_dev->phys_addr = res.start;
>  	dwc_dev->base_len = res.end - res.start + 1;
> +#else
> +	dwc_dev->phys_addr = ofdev->resource[0].start;
> +	dwc_dev->base_len = ofdev->resource[0].end -
> +				ofdev->resource[0].start + 1;
> +#endif

NAK

> @@ -296,6 +318,7 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
>  			dwc_dev->hcd = NULL;
>  			goto fail_hcd;
>  		}
> +#ifndef CONFIG_ARM

NAK

> @@ -316,6 +339,7 @@ static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
>  				dwc_dev->hcd->cp_irq_installed = 1;
>  			}
>  		}
> +#endif

NAK

> diff --git a/drivers/usb/dwc/cil.h b/drivers/usb/dwc/cil.h
> index 80b7da5..c1a11f1 100644
> --- a/drivers/usb/dwc/cil.h
> +++ b/drivers/usb/dwc/cil.h
> @@ -37,6 +37,15 @@
>  #if !defined(__DWC_CIL_H__)
>  #define __DWC_CIL_H__
>  #include <linux/io.h>
> +#ifdef CONFIG_ARM
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <plat/otg.h>
> +#include <plat/usb-phy.h>
> +#else
> +#include <linux/of_platform.h>
> +#endif

I can't even say how ugly this is.

> diff --git a/drivers/usb/dwc/param.c b/drivers/usb/dwc/param.c
> index 523f0db..b48c510 100644
> --- a/drivers/usb/dwc/param.c
> +++ b/drivers/usb/dwc/param.c
> @@ -116,8 +116,12 @@ static int set_valid_tx_fifo_sizes(struct core_if *core_if)
>   * This function is called during module intialization to verify that
>   * the module parameters are in a valid state.
>   */
> -int __devinit check_parameters(struct core_if *core_if)
> +int __devinit check_parameters(struct core_if *core_if,
> +						struct platform_device *ofdev)
>  {
> +#ifdef CONFIG_CPU_S5P6440
> +	struct s5p_otg_platdata *pdata = ofdev->dev.platform_data;
> +#endif

NAK.

> @@ -145,6 +149,23 @@ int __devinit check_parameters(struct core_if *core_if)
>  	 */
>  	dwc_otg_module_params.enable_dynamic_fifo =
>  	    DWC_HWCFG2_DYN_FIFO_RD(core_if->hwcfg2);
> +#ifdef CONFIG_CPU_S5P6440
> +	if (pdata && pdata->dev_rx_fifo_size)
> +		dwc_otg_module_params.dev_rx_fifo_size =
> +						pdata->dev_rx_fifo_size;
> +	if (pdata && pdata->dev_nptx_fifo_size)
> +		dwc_otg_module_params.dev_nperio_tx_fifo_size =
> +						pdata->dev_nptx_fifo_size;
> +
> +	if (pdata && pdata->host_rx_fifo_size)
> +		dwc_otg_module_params.host_rx_fifo_size =
> +						pdata->host_rx_fifo_size;
> +	if (pdata && pdata->host_nptx_fifo_size)
> +		dwc_otg_module_params.host_nperio_tx_fifo_size =
> +						pdata->host_nptx_fifo_size;
> +	if (pdata && pdata->host_ch_num)
> +		dwc_otg_module_params.host_channels = pdata->host_ch_num;
> +#else

then let's say another company licenses this core from Synopsys. Will
you add another pre-processor directive here ?


[1]
http://git.kernel.org/?p=linux/kernel/git/balbi/usb.git;a=tree;f=drivers/usb/dwc3;h=6ace38c51cfab18de3be257f86ae2c9afabf8237;hb=refs/heads/dwc3

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110621/1b834c42/attachment.sig>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
  2011-06-21  7:03 ` [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code p.paneri at samsung.com
@ 2011-06-21  9:31   ` Felipe Balbi
  2011-06-21  9:36   ` Russell King - ARM Linux
  2011-06-22  4:18   ` Kyungmin Park
  2 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2011-06-21  9:31 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Jun 21, 2011 at 12:33:46PM +0530, p.paneri at samsung.com wrote:
> From: Praveen Paneri <p.paneri@samsung.com>
> 
> A generic method to initialize and exit OTG PHY which can be
> used for all the samsung SoCs.
> OTG platdata structure added in platform to pass required
> platform specific functions and data to the driver.
> 
> Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
> ---
>  arch/arm/mach-s5p64x0/Makefile           |    1 +
>  arch/arm/mach-s5p64x0/include/mach/map.h |    4 +
>  arch/arm/mach-s5p64x0/setup-otg-phy.c    |   89 ++++++++++++++++++++++++++++++
>  arch/arm/plat-s5p/include/plat/otg.h     |   29 ++++++++++
>  4 files changed, 123 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/mach-s5p64x0/setup-otg-phy.c
>  create mode 100644 arch/arm/plat-s5p/include/plat/otg.h
> 
> diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
> index ae6bf6f..611fb3a 100644
> --- a/arch/arm/mach-s5p64x0/Makefile
> +++ b/arch/arm/mach-s5p64x0/Makefile
> @@ -28,3 +28,4 @@ obj-y				+= dev-audio.o
>  obj-$(CONFIG_S3C64XX_DEV_SPI)	+= dev-spi.o
>  
>  obj-$(CONFIG_S5P64X0_SETUP_I2C1)	+= setup-i2c1.o
> +obj-$(CONFIG_S3C_DEV_DWC_OTG)	+= setup-otg-phy.o
> diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
> index 95c9125..717c279 100644
> --- a/arch/arm/mach-s5p64x0/include/mach/map.h
> +++ b/arch/arm/mach-s5p64x0/include/mach/map.h
> @@ -44,6 +44,8 @@
>  #define S5P64X0_PA_SPI1		0xEC500000
>  
>  #define S5P64X0_PA_HSOTG	0xED100000
> +#define S5P64X0_PA_USB_HSPHY	0xED200000
> +#define S5P64X0_VA_USB_HSPHY	S3C_ADDR_CPU(0x00100000)
>  
>  #define S5P64X0_PA_HSMMC(x)	(0xED800000 + ((x) * 0x100000))
>  
> @@ -71,6 +73,8 @@
>  #define S5P_PA_TIMER		S5P64X0_PA_TIMER
>  
>  #define SAMSUNG_PA_ADC		S5P64X0_PA_ADC
> +#define S3C_PA_USB_HSOTG	S5P64X0_PA_HSOTG
> +#define S3C_VA_USB_HSPHY        S5P64X0_VA_USB_HSPHY
>  
>  /* UART */
>  
> diff --git a/arch/arm/mach-s5p64x0/setup-otg-phy.c b/arch/arm/mach-s5p64x0/setup-otg-phy.c

drivers should not live in arch/arm/*, why don't you move this to
drivers/usb/otg where the PHYs are staying right now ?

> new file mode 100644
> index 0000000..c351554
> --- /dev/null
> +++ b/arch/arm/mach-s5p64x0/setup-otg-phy.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright (C) 2011 Samsung Electronics Co.Ltd
> + * Author: Praveen Paneri <p.paneri@samsung.com>
> + * based on arch/arm/mach-exynos4/setup-usb-phy.c
> + * written by Joonyoung Shim <jy0922.shim@samsung.com>
> + *
> + *  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.
> + *
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/platform_device.h>
> +#include <mach/regs-clock.h>
> +#include <mach/gpio.h>
> +#include <plat/regs-usb-hsotg-phy.h>
> +#include <plat/usb-phy.h>
> +
> +struct clk *otg_clk;
> +static int s5p64x0_otg_phy_init(struct platform_device *pdev)
> +{
> +	int err;
> +
> +	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;
> +	}
> +
> +	if (gpio_is_valid(S5P6440_GPN(1))) {
> +		err = gpio_request(S5P6440_GPN(1), "GPN");
> +		if (err)
> +			printk(KERN_ERR "failed to request GPN1\n");
> +		gpio_direction_output(S5P6440_GPN(1), 1);
> +	}
> +
> +	writel(readl(S5P64X0_OTHERS)&~S5P64X0_OTHERS_USB_SIG_MASK,
> +							S5P64X0_OTHERS);
> +	writel(0x0, S3C_PHYPWR);         /* Power up */
> +	writel(S3C_PHYCLK_CLKSEL_12M, S3C_PHYCLK);
> +	writel(S3C_RSTCON_PHY, S3C_RSTCON);
> +
> +	udelay(50);
> +	writel(0x0, S3C_RSTCON);
> +	udelay(50);
> +
> +	return 0;
> +}
> +
> +static int s5p64x0_otg_phy_exit(struct platform_device *pdev)
> +{
> +	writel(readl(S3C_PHYPWR)|(0x1F<<1), S3C_PHYPWR);
> +	writel(readl(S5P64X0_OTHERS)&~S5P64X0_OTHERS_USB_SIG_MASK,
> +							S5P64X0_OTHERS);
> +
> +	gpio_free(S5P6440_GPN(1));
> +
> +	clk_disable(otg_clk);
> +	clk_put(otg_clk);
> +
> +	return 0;
> +}
> +
> +int s5p_usb_phy_init(struct platform_device *pdev, int type)
> +{
> +	if (type == S5P_USB_PHY_DEVICE)
> +		return s5p64x0_otg_phy_init(pdev);
> +
> +	return -EINVAL;
> +}
> +
> +int s5p_usb_phy_exit(struct platform_device *pdev, int type)
> +{
> +	if (type == S5P_USB_PHY_DEVICE)
> +		return s5p64x0_otg_phy_exit(pdev);
> +
> +	return -EINVAL;
> +}

no way to make this a real driver instead of set a exported functions ??

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110621/951fcaf1/attachment.sig>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
  2011-06-21  7:03 ` [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code p.paneri at samsung.com
  2011-06-21  9:31   ` Felipe Balbi
@ 2011-06-21  9:36   ` Russell King - ARM Linux
  2011-06-22  4:18   ` Kyungmin Park
  2 siblings, 0 replies; 23+ messages in thread
From: Russell King - ARM Linux @ 2011-06-21  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 21, 2011 at 12:33:46PM +0530, p.paneri at samsung.com wrote:
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/platform_device.h>
> +#include <mach/regs-clock.h>
> +#include <mach/gpio.h>

linux/gpio.h please.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC.
  2011-06-21  7:03 [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC p.paneri at samsung.com
                   ` (4 preceding siblings ...)
  2011-06-21  7:03 ` [RFC][PATCH 5/5] ARM: S5P64x0: Adding OTG device for smdk6440 p.paneri at samsung.com
@ 2011-06-21  9:45 ` Marek Szyprowski
  5 siblings, 0 replies; 23+ messages in thread
From: Marek Szyprowski @ 2011-06-21  9:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On Tuesday, June 21, 2011 9:04 AM p.paneri at samsung.com wrote:

> From: Praveen Paneri <p.paneri@samsung.com>
> 
> These patches modify DWC OTG driver for ARM and add it for ARM based SoCs.
> Currently it has been tested for Samsung's S5P6440. The development is
> still
> under process so these are not the best set of patches. They are just for
> review
> and not for merge. Intent of these patches is to show required
> modifications
> to make dwc_otg patches work on ARM.

What are the differences between DWC OTG hardware and OTG hardware found
in s3c64xx/s5pc100/s5pv210 and Exynos4 SoCs series? I've did a brief look
at register definitions and most of them looks same. Can this driver be
merged with s3c-hsotg.c driver?

> Following features are tested for basic functions on SMDK6440
> board after modifications:
> OTG HOST: HID and mass-storage
> OTG DEVICE: mass-storage and adb

Does it mean that HID or mass-storage (both host or gadget drivers) needs
modifications to get them working with this DWC OTG driver?

(snipped)

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 3/5] ARM: SAMSUNG: Adding IO mapping for OTG PHY.
  2011-06-21  7:03 ` [RFC][PATCH 3/5] ARM: SAMSUNG: Adding IO mapping for OTG PHY p.paneri at samsung.com
@ 2011-06-21 11:18   ` Banajit Goswami
  2011-06-21 12:15     ` Praveen Paneri
  0 siblings, 1 reply; 23+ messages in thread
From: Banajit Goswami @ 2011-06-21 11:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Praveen,

On Tue, Jun 21, 2011 at 12:33 PM, <p.paneri@samsung.com> wrote:
>
> From: Praveen Paneri <p.paneri@samsung.com>
>
> Adding virtual addresses for OTG PHY.
>
> Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
> ---
> ?arch/arm/mach-s5p64x0/cpu.c | ? ?5 +++++
> ?1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c
> index a5c0095..8dc6f20 100644
> --- a/arch/arm/mach-s5p64x0/cpu.c
> +++ b/arch/arm/mach-s5p64x0/cpu.c
> @@ -57,6 +57,11 @@ static struct map_desc s5p64x0_iodesc[] __initdata = {
> ? ? ? ? ? ? ? ?.pfn ? ? ? ? ? ?= __phys_to_pfn(S5P64X0_PA_VIC1),
> ? ? ? ? ? ? ? ?.length ? ? ? ? = SZ_16K,
> ? ? ? ? ? ? ? ?.type ? ? ? ? ? = MT_DEVICE,
> + ? ? ? }, {
> + ? ? ? ? ? ? ? .virtual ? ? ? ?= (unsigned long)S3C_VA_USB_HSPHY,
> + ? ? ? ? ? ? ? .pfn ? ? ? ? ? ?= __phys_to_pfn(S5P64X0_PA_USB_HSPHY),
> + ? ? ? ? ? ? ? .length ? ? ? ? = SZ_1M,

Do we really need 1M for this??

> + ? ? ? ? ? ? ? .type ? ? ? ? ? = MT_DEVICE,
> ? ? ? ?},
> ?};
>
> --
> 1.7.0.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung.
  2011-06-21  7:03 ` [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung p.paneri at samsung.com
  2011-06-21  9:16   ` Felipe Balbi
@ 2011-06-21 11:47   ` Sergei Shtylyov
  2011-06-21 11:49     ` Felipe Balbi
  1 sibling, 1 reply; 23+ messages in thread
From: Sergei Shtylyov @ 2011-06-21 11:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 21-06-2011 11:03, p.paneri at samsung.com wrote:

> From: Praveen Paneri<p.paneri@samsung.com>

> Adding dwc driver name in existing platform device
> to probe DWC OTG driver.
> Introduced otg_set_platdata function to pass platform data
> Added selectable config option to add DWC OTG driver for different
> machines.

> Signed-off-by: Praveen Paneri<p.paneri@samsung.com>
[...]

> diff --git a/arch/arm/plat-samsung/dev-usb-hsotg.c b/arch/arm/plat-samsung/dev-usb-hsotg.c
> index 33a844a..7e6228b 100644
> --- a/arch/arm/plat-samsung/dev-usb-hsotg.c
> +++ b/arch/arm/plat-samsung/dev-usb-hsotg.c
[...]
> @@ -37,7 +39,12 @@ static struct resource s3c_usb_hsotg_resources[] = {
>   static u64 s3c_hsotg_dmamask = DMA_BIT_MASK(32);
>
>   struct platform_device s3c_device_usb_hsotg = {
> +#ifdef CONFIG_S3C_DEV_USB_HSOTG
>   	.name		= "s3c-hsotg",
> +#endif
> +#ifdef CONFIG_S3C_DEV_DWC_OTG
> +	.name		= "dwc_otg",
> +#endif

    I'd done it as:

+#if defined(CONFIG_S3C_DEV_USB_HSOTG)
   	.name		= "s3c-hsotg",
+#elif defined(CONFIG_S3C_DEV_DWC_OTG)
+	.name		= "dwc_otg",
+#endif

WBR, Sergei

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung.
  2011-06-21 11:47   ` Sergei Shtylyov
@ 2011-06-21 11:49     ` Felipe Balbi
  2011-06-21 12:00       ` Sergei Shtylyov
  0 siblings, 1 reply; 23+ messages in thread
From: Felipe Balbi @ 2011-06-21 11:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Jun 21, 2011 at 03:47:04PM +0400, Sergei Shtylyov wrote:
> Hello.
> 
> On 21-06-2011 11:03, p.paneri at samsung.com wrote:
> 
> >From: Praveen Paneri<p.paneri@samsung.com>
> 
> >Adding dwc driver name in existing platform device
> >to probe DWC OTG driver.
> >Introduced otg_set_platdata function to pass platform data
> >Added selectable config option to add DWC OTG driver for different
> >machines.
> 
> >Signed-off-by: Praveen Paneri<p.paneri@samsung.com>
> [...]
> 
> >diff --git a/arch/arm/plat-samsung/dev-usb-hsotg.c b/arch/arm/plat-samsung/dev-usb-hsotg.c
> >index 33a844a..7e6228b 100644
> >--- a/arch/arm/plat-samsung/dev-usb-hsotg.c
> >+++ b/arch/arm/plat-samsung/dev-usb-hsotg.c
> [...]
> >@@ -37,7 +39,12 @@ static struct resource s3c_usb_hsotg_resources[] = {
> >  static u64 s3c_hsotg_dmamask = DMA_BIT_MASK(32);
> >
> >  struct platform_device s3c_device_usb_hsotg = {
> >+#ifdef CONFIG_S3C_DEV_USB_HSOTG
> >  	.name		= "s3c-hsotg",
> >+#endif
> >+#ifdef CONFIG_S3C_DEV_DWC_OTG
> >+	.name		= "dwc_otg",
> >+#endif
> 
>    I'd done it as:
> 
> +#if defined(CONFIG_S3C_DEV_USB_HSOTG)
>   	.name		= "s3c-hsotg",
> +#elif defined(CONFIG_S3C_DEV_DWC_OTG)
> +	.name		= "dwc_otg",
> +#endif

no... don't do that. How many times do I have to repeat ? No ifdefs!! we
want both drivers to be able to be compiled as modules, so add both
platform devices.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110621/fdefed2c/attachment.sig>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung.
  2011-06-21 11:49     ` Felipe Balbi
@ 2011-06-21 12:00       ` Sergei Shtylyov
  0 siblings, 0 replies; 23+ messages in thread
From: Sergei Shtylyov @ 2011-06-21 12:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 21-06-2011 15:49, Felipe Balbi wrote:

>>> From: Praveen Paneri<p.paneri@samsung.com>

>>> Adding dwc driver name in existing platform device
>>> to probe DWC OTG driver.
>>> Introduced otg_set_platdata function to pass platform data
>>> Added selectable config option to add DWC OTG driver for different
>>> machines.

>>> Signed-off-by: Praveen Paneri<p.paneri@samsung.com>
>> [...]

>>> diff --git a/arch/arm/plat-samsung/dev-usb-hsotg.c b/arch/arm/plat-samsung/dev-usb-hsotg.c
>>> index 33a844a..7e6228b 100644
>>> --- a/arch/arm/plat-samsung/dev-usb-hsotg.c
>>> +++ b/arch/arm/plat-samsung/dev-usb-hsotg.c
>> [...]

>>> @@ -37,7 +39,12 @@ static struct resource s3c_usb_hsotg_resources[] = {
>>>   static u64 s3c_hsotg_dmamask = DMA_BIT_MASK(32);
>>>
>>>   struct platform_device s3c_device_usb_hsotg = {
>>> +#ifdef CONFIG_S3C_DEV_USB_HSOTG
>>>   	.name		= "s3c-hsotg",
>>> +#endif
>>> +#ifdef CONFIG_S3C_DEV_DWC_OTG
>>> +	.name		= "dwc_otg",
>>> +#endif

>>     I'd done it as:

>> +#if defined(CONFIG_S3C_DEV_USB_HSOTG)
>>    	.name		= "s3c-hsotg",
>> +#elif defined(CONFIG_S3C_DEV_DWC_OTG)
>> +	.name		= "dwc_otg",
>> +#endif

> no... don't do that. How many times do I have to repeat ? No ifdefs!! we
> want both drivers to be able to be compiled as modules, so add both
> platform devices.

    Sorry, hadn't seen your mail when replying.

WBR, Sergei

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 3/5] ARM: SAMSUNG: Adding IO mapping for OTG PHY.
  2011-06-21 11:18   ` Banajit Goswami
@ 2011-06-21 12:15     ` Praveen Paneri
  0 siblings, 0 replies; 23+ messages in thread
From: Praveen Paneri @ 2011-06-21 12:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Jun 21, 2011 at 4:48 PM, Banajit Goswami
<banajit.goswami@gmail.com> wrote:
> Hi Praveen,
>
> On Tue, Jun 21, 2011 at 12:33 PM, <p.paneri@samsung.com> wrote:
>>
>> From: Praveen Paneri <p.paneri@samsung.com>
>>
>> Adding virtual addresses for OTG PHY.
>>
>> Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
>> ---
>> ?arch/arm/mach-s5p64x0/cpu.c | ? ?5 +++++
>> ?1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c
>> index a5c0095..8dc6f20 100644
>> --- a/arch/arm/mach-s5p64x0/cpu.c
>> +++ b/arch/arm/mach-s5p64x0/cpu.c
>> @@ -57,6 +57,11 @@ static struct map_desc s5p64x0_iodesc[] __initdata = {
>> ? ? ? ? ? ? ? ?.pfn ? ? ? ? ? ?= __phys_to_pfn(S5P64X0_PA_VIC1),
>> ? ? ? ? ? ? ? ?.length ? ? ? ? = SZ_16K,
>> ? ? ? ? ? ? ? ?.type ? ? ? ? ? = MT_DEVICE,
>> + ? ? ? }, {
>> + ? ? ? ? ? ? ? .virtual ? ? ? ?= (unsigned long)S3C_VA_USB_HSPHY,
>> + ? ? ? ? ? ? ? .pfn ? ? ? ? ? ?= __phys_to_pfn(S5P64X0_PA_USB_HSPHY),
>> + ? ? ? ? ? ? ? .length ? ? ? ? = SZ_1M,
>
> Do we really need 1M for this??
Accepted, will give lesser length in subsequent versions.
>
>> + ? ? ? ? ? ? ? .type ? ? ? ? ? = MT_DEVICE,
>> ? ? ? ?},
>> ?};
>>
>> --
>> 1.7.0.4
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>



-- 
Praveen Paneri

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
       [not found] <0LN4003P2ZGJSGU0@mailout4.samsung.com>
@ 2011-06-21 12:26 ` Praveen Paneri
  2011-06-21 12:39   ` Russell King - ARM Linux
  0 siblings, 1 reply; 23+ messages in thread
From: Praveen Paneri @ 2011-06-21 12:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Jun 21, 2011 at 4:20 PM, PRAVEEN PANERI <p.paneri@samsung.com> wrote:
>
> On Tue, Jun 21, 2011 at 12:33:46PM +0530, p.paneri at samsung.com wrote:
> > +#include
> > +#include
> > +#include
> > +#include
> > +#include
> > +#include
> > +#include
>
> linux/gpio.h please.
will change it
Thanks
Paneri
>
>
>
>
>
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
  2011-06-21 12:26 ` [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code Praveen Paneri
@ 2011-06-21 12:39   ` Russell King - ARM Linux
  0 siblings, 0 replies; 23+ messages in thread
From: Russell King - ARM Linux @ 2011-06-21 12:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 21, 2011 at 05:56:05PM +0530, Praveen Paneri wrote:
> Hi,
> 
> On Tue, Jun 21, 2011 at 4:20 PM, PRAVEEN PANERI <p.paneri@samsung.com> wrote:

Err, that attributation is wrong.

> > On Tue, Jun 21, 2011 at 12:33:46PM +0530, p.paneri at samsung.com wrote:
> > > +#include
> > > +#include
> > > +#include
> > > +#include
> > > +#include
> > > +#include
> > > +#include
> >
> > linux/gpio.h please.
> will change it

You should question why your mailer decided to remove the contents after
the "#include" when quoting.  Maybe you need to get a better mailer, fix
some configuration setting, or complain to google that gmail is messing
with emails in ways it shouldn't.

However, I doubt that gmail itself is as broken as it appears to be
above... but whatever it is, it needs fixing.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
  2011-06-21  7:03 ` [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code p.paneri at samsung.com
  2011-06-21  9:31   ` Felipe Balbi
  2011-06-21  9:36   ` Russell King - ARM Linux
@ 2011-06-22  4:18   ` Kyungmin Park
  2 siblings, 0 replies; 23+ messages in thread
From: Kyungmin Park @ 2011-06-22  4:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 21, 2011 at 4:03 PM,  <p.paneri@samsung.com> wrote:
> From: Praveen Paneri <p.paneri@samsung.com>
>
> A generic method to initialize and exit OTG PHY which can be
> used for all the samsung SoCs.
> OTG platdata structure added in platform to pass required
> platform specific functions and data to the driver.
>
> Signed-off-by: Praveen Paneri <p.paneri@samsung.com>
> ---
> ?arch/arm/mach-s5p64x0/Makefile ? ? ? ? ? | ? ?1 +
> ?arch/arm/mach-s5p64x0/include/mach/map.h | ? ?4 +
> ?arch/arm/mach-s5p64x0/setup-otg-phy.c ? ?| ? 89 ++++++++++++++++++++++++++++++
> ?arch/arm/plat-s5p/include/plat/otg.h ? ? | ? 29 ++++++++++
> ?4 files changed, 123 insertions(+), 0 deletions(-)
> ?create mode 100644 arch/arm/mach-s5p64x0/setup-otg-phy.c
> ?create mode 100644 arch/arm/plat-s5p/include/plat/otg.h
>
> diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
> index ae6bf6f..611fb3a 100644
> --- a/arch/arm/mach-s5p64x0/Makefile
> +++ b/arch/arm/mach-s5p64x0/Makefile
> @@ -28,3 +28,4 @@ obj-y ? ? ? ? ? ? ? ? ? ? ? ? += dev-audio.o
> ?obj-$(CONFIG_S3C64XX_DEV_SPI) ?+= dev-spi.o
>
> ?obj-$(CONFIG_S5P64X0_SETUP_I2C1) ? ? ? += setup-i2c1.o
> +obj-$(CONFIG_S3C_DEV_DWC_OTG) ?+= setup-otg-phy.o
> diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
> index 95c9125..717c279 100644
> --- a/arch/arm/mach-s5p64x0/include/mach/map.h
> +++ b/arch/arm/mach-s5p64x0/include/mach/map.h
> @@ -44,6 +44,8 @@
> ?#define S5P64X0_PA_SPI1 ? ? ? ? ? ? ? ?0xEC500000
>
> ?#define S5P64X0_PA_HSOTG ? ? ? 0xED100000
> +#define S5P64X0_PA_USB_HSPHY ? 0xED200000
> +#define S5P64X0_VA_USB_HSPHY ? S3C_ADDR_CPU(0x00100000)
>
> ?#define S5P64X0_PA_HSMMC(x) ? ?(0xED800000 + ((x) * 0x100000))
>
> @@ -71,6 +73,8 @@
> ?#define S5P_PA_TIMER ? ? ? ? ? S5P64X0_PA_TIMER
>
> ?#define SAMSUNG_PA_ADC ? ? ? ? S5P64X0_PA_ADC
> +#define S3C_PA_USB_HSOTG ? ? ? S5P64X0_PA_HSOTG
> +#define S3C_VA_USB_HSPHY ? ? ? ?S5P64X0_VA_USB_HSPHY
>
> ?/* UART */
>
> diff --git a/arch/arm/mach-s5p64x0/setup-otg-phy.c b/arch/arm/mach-s5p64x0/setup-otg-phy.c
> new file mode 100644
> index 0000000..c351554
> --- /dev/null
> +++ b/arch/arm/mach-s5p64x0/setup-otg-phy.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright (C) 2011 Samsung Electronics Co.Ltd
> + * Author: Praveen Paneri <p.paneri@samsung.com>
> + * based on arch/arm/mach-exynos4/setup-usb-phy.c
> + * written by Joonyoung Shim <jy0922.shim@samsung.com>
> + *
> + * ?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.
> + *
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/platform_device.h>
> +#include <mach/regs-clock.h>
> +#include <mach/gpio.h>
> +#include <plat/regs-usb-hsotg-phy.h>
> +#include <plat/usb-phy.h>
> +
> +struct clk *otg_clk;
> +static int s5p64x0_otg_phy_init(struct platform_device *pdev)
> +{
> + ? ? ? int err;
> +
> + ? ? ? 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;
> + ? ? ? }
> +
> + ? ? ? if (gpio_is_valid(S5P6440_GPN(1))) {
> + ? ? ? ? ? ? ? err = gpio_request(S5P6440_GPN(1), "GPN");
> + ? ? ? ? ? ? ? if (err)
> + ? ? ? ? ? ? ? ? ? ? ? printk(KERN_ERR "failed to request GPN1\n");
> + ? ? ? ? ? ? ? gpio_direction_output(S5P6440_GPN(1), 1);
> + ? ? ? }

What's the GPN(1)? I think it's board specific pins. so please replace
it at board file.
> +
> + ? ? ? writel(readl(S5P64X0_OTHERS)&~S5P64X0_OTHERS_USB_SIG_MASK,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? S5P64X0_OTHERS);
> + ? ? ? writel(0x0, S3C_PHYPWR); ? ? ? ? /* Power up */
> + ? ? ? writel(S3C_PHYCLK_CLKSEL_12M, S3C_PHYCLK);
> + ? ? ? writel(S3C_RSTCON_PHY, S3C_RSTCON);
> +
> + ? ? ? udelay(50);
> + ? ? ? writel(0x0, S3C_RSTCON);
> + ? ? ? udelay(50);
> +
> + ? ? ? return 0;
> +}
> +
> +static int s5p64x0_otg_phy_exit(struct platform_device *pdev)
> +{
> + ? ? ? writel(readl(S3C_PHYPWR)|(0x1F<<1), S3C_PHYPWR);
> + ? ? ? writel(readl(S5P64X0_OTHERS)&~S5P64X0_OTHERS_USB_SIG_MASK,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? S5P64X0_OTHERS);
> +
> + ? ? ? gpio_free(S5P6440_GPN(1));
ditto
> +
> + ? ? ? clk_disable(otg_clk);
> + ? ? ? clk_put(otg_clk);
> +
> + ? ? ? return 0;
> +}
> +
> +int s5p_usb_phy_init(struct platform_device *pdev, int type)
> +{
> + ? ? ? if (type == S5P_USB_PHY_DEVICE)
> + ? ? ? ? ? ? ? return s5p64x0_otg_phy_init(pdev);
> +
> + ? ? ? return -EINVAL;
> +}
> +
> +int s5p_usb_phy_exit(struct platform_device *pdev, int type)
> +{
> + ? ? ? if (type == S5P_USB_PHY_DEVICE)
> + ? ? ? ? ? ? ? return s5p64x0_otg_phy_exit(pdev);
> +
> + ? ? ? return -EINVAL;
> +}
> diff --git a/arch/arm/plat-s5p/include/plat/otg.h b/arch/arm/plat-s5p/include/plat/otg.h
> new file mode 100644
> index 0000000..3111dcc
> --- /dev/null
> +++ b/arch/arm/plat-s5p/include/plat/otg.h
> @@ -0,0 +1,29 @@
> +/*
> + * Copyright (C) 2011 Samsung Electronics Co.Ltd
> + * Author: Praveen Paneri <p.paneri@samsung.com>
> + * based on arch/arm/plat-s5p/include/plat/usb-phy.h
> + * written by Joonyoung Shim <jy0922.shim@samsung.com>
> + *
> + * 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.
> + */
> +
> +#ifndef __PLAT_S5P_OTG_H
> +#define __PLAT_S5P_OTG_H
> +
> +struct s5p_otg_platdata {
> + ? ? ? int (*phy_init)(struct platform_device *pdev, int type);
> + ? ? ? int (*phy_exit)(struct platform_device *pdev, int type);
> + ? ? ? u32 dev_rx_fifo_size;
> + ? ? ? u32 dev_nptx_fifo_size;
> + ? ? ? u32 host_rx_fifo_size;
> + ? ? ? u32 host_nptx_fifo_size;
> + ? ? ? u32 host_ch_num;
> +
> +};
> +
> +extern void s5p_otg_set_platdata(struct s5p_otg_platdata *pd);
> +
> +#endif /* __PLAT_S5P_OTG_H */
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
       [not found] <0LN400HTOZEQDIL0@mailout1.samsung.com>
@ 2011-06-22  8:26 ` Praveen Paneri
  2011-06-22  9:49   ` Felipe Balbi
  0 siblings, 1 reply; 23+ messages in thread
From: Praveen Paneri @ 2011-06-22  8:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Jun 21, 2011 at 4:19 PM, PRAVEEN PANERI <p.paneri@samsung.com> wrote:
>
>
>
> Hi,
>
> On Tue, Jun 21, 2011 at 12:33:46PM +0530, p.paneri at samsung.com wrote:
> > From: Praveen Paneri
> >
> > A generic method to initialize and exit OTG PHY which can be
> > used for all the samsung SoCs.
> > OTG platdata structure added in platform to pass required
> > platform specific functions and data to the driver.
> >
> > Signed-off-by: Praveen Paneri
> > ---
> >??arch/arm/mach-s5p64x0/Makefile?????????? |????1 +
> >??arch/arm/mach-s5p64x0/include/mach/map.h |????4 +
> >??arch/arm/mach-s5p64x0/setup-otg-phy.c????|?? 89 ++++++++++++++++++++++++++++++
> >??arch/arm/plat-s5p/include/plat/otg.h???? |?? 29 ++++++++++
> >??4 files changed, 123 insertions(+), 0 deletions(-)
> >??create mode 100644 arch/arm/mach-s5p64x0/setup-otg-phy.c
> >??create mode 100644 arch/arm/plat-s5p/include/plat/otg.h
> >
> > diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
> > index ae6bf6f..611fb3a 100644
> > --- a/arch/arm/mach-s5p64x0/Makefile
> > +++ b/arch/arm/mach-s5p64x0/Makefile
> > @@ -28,3 +28,4 @@ obj-y += dev-audio.o
> >??obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
> >
> >??obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
> > +obj-$(CONFIG_S3C_DEV_DWC_OTG) += setup-otg-phy.o
> > diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
> > index 95c9125..717c279 100644
> > --- a/arch/arm/mach-s5p64x0/include/mach/map.h
> > +++ b/arch/arm/mach-s5p64x0/include/mach/map.h
> > @@ -44,6 +44,8 @@
> >??#define S5P64X0_PA_SPI1 0xEC500000
> >
> >??#define S5P64X0_PA_HSOTG 0xED100000
> > +#define S5P64X0_PA_USB_HSPHY 0xED200000
> > +#define S5P64X0_VA_USB_HSPHY S3C_ADDR_CPU(0x00100000)
> >
> >??#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
> >
> > @@ -71,6 +73,8 @@
> >??#define S5P_PA_TIMER S5P64X0_PA_TIMER
> >
> >??#define SAMSUNG_PA_ADC S5P64X0_PA_ADC
> > +#define S3C_PA_USB_HSOTG S5P64X0_PA_HSOTG
> > +#define S3C_VA_USB_HSPHY????????S5P64X0_VA_USB_HSPHY
> >
> >??/* UART */
> >
> > diff --git a/arch/arm/mach-s5p64x0/setup-otg-phy.c b/arch/arm/mach-s5p64x0/setup-otg-phy.c
>
> drivers should not live in arch/arm/*, why don't you move this to
> drivers/usb/otg where the PHYs are staying right now ?
PHY init/exit code can vary across SoCs. Wouldn't it be better to have it in the
SoC specific location?
>
> > new file mode 100644
> > index 0000000..c351554
> > --- /dev/null
> > +++ b/arch/arm/mach-s5p64x0/setup-otg-phy.c
> > @@ -0,0 +1,89 @@
> > +/*
> > + * Copyright (C) 2011 Samsung Electronics Co.Ltd
> > + * Author: Praveen Paneri
> > + * based on arch/arm/mach-exynos4/setup-usb-phy.c
> > + * written by Joonyoung Shim
> > + *
> > + *??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.
> > + *
> > + */
> > +
> > +#include
> > +#include
> > +#include
> > +#include
> > +#include
> > +#include
> > +#include
> > +#include
> > +#include
> > +
> > +struct clk *otg_clk;
> > +static int s5p64x0_otg_phy_init(struct platform_device *pdev)
> > +{
> > + int err;
> > +
> > + 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;
> > + }
> > +
> > + if (gpio_is_valid(S5P6440_GPN(1))) {
> > + err = gpio_request(S5P6440_GPN(1), "GPN");
> > + if (err)
> > + printk(KERN_ERR "failed to request GPN1\n");
> > + gpio_direction_output(S5P6440_GPN(1), 1);
> > + }
> > +
> > + writel(readl(S5P64X0_OTHERS)&~S5P64X0_OTHERS_USB_SIG_MASK,
> > + S5P64X0_OTHERS);
> > + writel(0x0, S3C_PHYPWR);???????? /* Power up */
> > + writel(S3C_PHYCLK_CLKSEL_12M, S3C_PHYCLK);
> > + writel(S3C_RSTCON_PHY, S3C_RSTCON);
> > +
> > + udelay(50);
> > + writel(0x0, S3C_RSTCON);
> > + udelay(50);
> > +
> > + return 0;
> > +}
> > +
> > +static int s5p64x0_otg_phy_exit(struct platform_device *pdev)
> > +{
> > + writel(readl(S3C_PHYPWR)|(0x1F<<1), S3C_PHYPWR);
> > + writel(readl(S5P64X0_OTHERS)&~S5P64X0_OTHERS_USB_SIG_MASK,
> > + S5P64X0_OTHERS);
> > +
> > + gpio_free(S5P6440_GPN(1));
> > +
> > + clk_disable(otg_clk);
> > + clk_put(otg_clk);
> > +
> > + return 0;
> > +}
> > +
> > +int s5p_usb_phy_init(struct platform_device *pdev, int type)
> > +{
> > + if (type == S5P_USB_PHY_DEVICE)
> > + return s5p64x0_otg_phy_init(pdev);
> > +
> > + return -EINVAL;
> > +}
> > +
> > +int s5p_usb_phy_exit(struct platform_device *pdev, int type)
> > +{
> > + if (type == S5P_USB_PHY_DEVICE)
> > + return s5p64x0_otg_phy_exit(pdev);
> > +
> > + return -EINVAL;
> > +}
>
> no way to make this a real driver instead of set a exported functions ??
>
> --
> balbi
>
paneri

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
  2011-06-22  8:26 ` Praveen Paneri
@ 2011-06-22  9:49   ` Felipe Balbi
  2011-07-06  5:33     ` Praveen Paneri
  0 siblings, 1 reply; 23+ messages in thread
From: Felipe Balbi @ 2011-06-22  9:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Jun 22, 2011 at 01:56:25PM +0530, Praveen Paneri wrote:
> > > diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
> > > index ae6bf6f..611fb3a 100644
> > > --- a/arch/arm/mach-s5p64x0/Makefile
> > > +++ b/arch/arm/mach-s5p64x0/Makefile
> > > @@ -28,3 +28,4 @@ obj-y += dev-audio.o
> > >??obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
> > >
> > >??obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
> > > +obj-$(CONFIG_S3C_DEV_DWC_OTG) += setup-otg-phy.o
> > > diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
> > > index 95c9125..717c279 100644
> > > --- a/arch/arm/mach-s5p64x0/include/mach/map.h
> > > +++ b/arch/arm/mach-s5p64x0/include/mach/map.h
> > > @@ -44,6 +44,8 @@
> > >??#define S5P64X0_PA_SPI1 0xEC500000
> > >
> > >??#define S5P64X0_PA_HSOTG 0xED100000
> > > +#define S5P64X0_PA_USB_HSPHY 0xED200000
> > > +#define S5P64X0_VA_USB_HSPHY S3C_ADDR_CPU(0x00100000)
> > >
> > >??#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
> > >
> > > @@ -71,6 +73,8 @@
> > >??#define S5P_PA_TIMER S5P64X0_PA_TIMER
> > >
> > >??#define SAMSUNG_PA_ADC S5P64X0_PA_ADC
> > > +#define S3C_PA_USB_HSOTG S5P64X0_PA_HSOTG
> > > +#define S3C_VA_USB_HSPHY????????S5P64X0_VA_USB_HSPHY
> > >
> > >??/* UART */
> > >
> > > diff --git a/arch/arm/mach-s5p64x0/setup-otg-phy.c b/arch/arm/mach-s5p64x0/setup-otg-phy.c
> >
> > drivers should not live in arch/arm/*, why don't you move this to
> > drivers/usb/otg where the PHYs are staying right now ?
> PHY init/exit code can vary across SoCs. Wouldn't it be better to have it in the
> SoC specific location?

It will vary how ? If it's only regarding e.g. a different GPIO pin or a
different IRQ number, you handle that by passing data down to driver
(via platform_data or struct resource), now if it varies because a
different board uses a different PHY, then another driver should be
written (well, as long as it's really different from the one you have
now, otherwise you should see if it's worth making the existing driver
more flexible).

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110622/40104a24/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
  2011-06-22  9:49   ` Felipe Balbi
@ 2011-07-06  5:33     ` Praveen Paneri
  2011-07-06  7:18       ` Felipe Balbi
  0 siblings, 1 reply; 23+ messages in thread
From: Praveen Paneri @ 2011-07-06  5:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Felipe,

Sorry for a delayed response to your comment. I have been addressing
all the comment given
by you, following two points remain where I need your suggestion.

On Wed, Jun 22, 2011 at 3:19 PM, Felipe Balbi <balbi@ti.com> wrote:
> Hi,
>
> On Wed, Jun 22, 2011 at 01:56:25PM +0530, Praveen Paneri wrote:
>> > > diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
>> > > index ae6bf6f..611fb3a 100644
>> > > --- a/arch/arm/mach-s5p64x0/Makefile
>> > > +++ b/arch/arm/mach-s5p64x0/Makefile
>> > > @@ -28,3 +28,4 @@ obj-y += dev-audio.o
>> > >??obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
>> > >
>> > >??obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
>> > > +obj-$(CONFIG_S3C_DEV_DWC_OTG) += setup-otg-phy.o
>> > > diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
>> > > index 95c9125..717c279 100644
>> > > --- a/arch/arm/mach-s5p64x0/include/mach/map.h
>> > > +++ b/arch/arm/mach-s5p64x0/include/mach/map.h
>> > > @@ -44,6 +44,8 @@
>> > >??#define S5P64X0_PA_SPI1 0xEC500000
>> > >
>> > >??#define S5P64X0_PA_HSOTG 0xED100000
>> > > +#define S5P64X0_PA_USB_HSPHY 0xED200000
>> > > +#define S5P64X0_VA_USB_HSPHY S3C_ADDR_CPU(0x00100000)
>> > >
>> > >??#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
>> > >
>> > > @@ -71,6 +73,8 @@
>> > >??#define S5P_PA_TIMER S5P64X0_PA_TIMER
>> > >
>> > >??#define SAMSUNG_PA_ADC S5P64X0_PA_ADC
>> > > +#define S3C_PA_USB_HSOTG S5P64X0_PA_HSOTG
>> > > +#define S3C_VA_USB_HSPHY????????S5P64X0_VA_USB_HSPHY
>> > >
>> > >??/* UART */
>> > >
>> > > diff --git a/arch/arm/mach-s5p64x0/setup-otg-phy.c b/arch/arm/mach-s5p64x0/setup-otg-phy.c
>> >
>> > drivers should not live in arch/arm/*, why don't you move this to
>> > drivers/usb/otg where the PHYs are staying right now ?
>> PHY init/exit code can vary across SoCs. Wouldn't it be better to have it in the
>> SoC specific location?
>
> It will vary how ? If it's only regarding e.g. a different GPIO pin or a
> different IRQ number, you handle that by passing data down to driver
> (via platform_data or struct resource), now if it varies because a
> different board uses a different PHY, then another driver should be
> written (well, as long as it's really different from the one you have
> now, otherwise you should see if it's worth making the existing driver
> more flexible).
We have only 4 registers which are used for phy control. The bit structure
of these registers vary across the SoCs.
1) PHY power control
2) PHY clock control
3) OTG reset control
4) PHY tune

To init/de-init the phy we just need to set the above 4 registers appropriately.
Do you still think there is a necessity for a separate driver ?

I have gone through the reference drivers suggested by you.
Functionality of this PHY
control remains very less relative to those drivers.

I have removed a lot of ifdefery from the initial patches. The only
problem I am facing is
in implementing a generic register I/O method which can work for both
ARM and PPC.
Existing code for PPC was using following funtions
in_le32, in_be32, out_le32, out_be32
while in ARM readl and writel functions are used.
kindly suggest a way out of it.
>
> --
> balbi
>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code
  2011-07-06  5:33     ` Praveen Paneri
@ 2011-07-06  7:18       ` Felipe Balbi
  0 siblings, 0 replies; 23+ messages in thread
From: Felipe Balbi @ 2011-07-06  7:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Jul 06, 2011 at 11:03:10AM +0530, Praveen Paneri wrote:
> >> > drivers should not live in arch/arm/*, why don't you move this to
> >> > drivers/usb/otg where the PHYs are staying right now ?
> >> PHY init/exit code can vary across SoCs. Wouldn't it be better to have it in the
> >> SoC specific location?
> >
> > It will vary how ? If it's only regarding e.g. a different GPIO pin or a
> > different IRQ number, you handle that by passing data down to driver
> > (via platform_data or struct resource), now if it varies because a
> > different board uses a different PHY, then another driver should be
> > written (well, as long as it's really different from the one you have
> > now, otherwise you should see if it's worth making the existing driver
> > more flexible).
> We have only 4 registers which are used for phy control. The bit structure
> of these registers vary across the SoCs.
> 1) PHY power control
> 2) PHY clock control
> 3) OTG reset control
> 4) PHY tune
> 
> To init/de-init the phy we just need to set the above 4 registers appropriately.
> Do you still think there is a necessity for a separate driver ?

well, we do have the otg utilities on drivers/usb/otg/ ;-)

> I have gone through the reference drivers suggested by you.
> Functionality of this PHY
> control remains very less relative to those drivers.

on OMAP4 we have one "PHY" which actually only handle VBUS and ID pin
detection :-p

> I have removed a lot of ifdefery from the initial patches. The only
> problem I am facing is
> in implementing a generic register I/O method which can work for both
> ARM and PPC.
> Existing code for PPC was using following funtions
> in_le32, in_be32, out_le32, out_be32
> while in ARM readl and writel functions are used.
> kindly suggest a way out of it.

Can you use the versions on include/asm-generic/io.h ?
ioread8(addr), ioread16(addr), ioread32(addr)

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110706/f9eb3262/attachment.sig>

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2011-07-06  7:18 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21  7:03 [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC p.paneri at samsung.com
2011-06-21  7:03 ` [RFC][PATCH 1/5] USB: DWC OTG: Modification in DWC OTG driver for ARM based SoCs p.paneri at samsung.com
2011-06-21  9:25   ` Felipe Balbi
2011-06-21  7:03 ` [RFC][PATCH 2/5] ARM: SAMSUNG: Changing the build condition of OTG platform device for samsung p.paneri at samsung.com
2011-06-21  9:16   ` Felipe Balbi
2011-06-21 11:47   ` Sergei Shtylyov
2011-06-21 11:49     ` Felipe Balbi
2011-06-21 12:00       ` Sergei Shtylyov
2011-06-21  7:03 ` [RFC][PATCH 3/5] ARM: SAMSUNG: Adding IO mapping for OTG PHY p.paneri at samsung.com
2011-06-21 11:18   ` Banajit Goswami
2011-06-21 12:15     ` Praveen Paneri
2011-06-21  7:03 ` [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code p.paneri at samsung.com
2011-06-21  9:31   ` Felipe Balbi
2011-06-21  9:36   ` Russell King - ARM Linux
2011-06-22  4:18   ` Kyungmin Park
2011-06-21  7:03 ` [RFC][PATCH 5/5] ARM: S5P64x0: Adding OTG device for smdk6440 p.paneri at samsung.com
2011-06-21  9:45 ` [RFC][PATCH 0/5] USB: DWC OTG: Add dwc_otg driver for S5P6440 samsung SoC Marek Szyprowski
     [not found] <0LN4003P2ZGJSGU0@mailout4.samsung.com>
2011-06-21 12:26 ` [RFC][PATCH 4/5] ARM: S5P64x0: Adding OTG PHY control code Praveen Paneri
2011-06-21 12:39   ` Russell King - ARM Linux
     [not found] <0LN400HTOZEQDIL0@mailout1.samsung.com>
2011-06-22  8:26 ` Praveen Paneri
2011-06-22  9:49   ` Felipe Balbi
2011-07-06  5:33     ` Praveen Paneri
2011-07-06  7:18       ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).