Skip to contentSkip to conversation

more S3C HSOTG fixes

PATCH New Marek Szyprowski 2 participants 4 messages Jul 19, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 more S3C HSOTG fixes

Hello,

This patch series adds 2 simple changes to enable the driver on S5PV210 SoCs and a simple compile error fix. This is a continuation of 'S3C HSOTG fixes' series posted by Ben Dooks. The first one should be applied to 2.6.35. The latter can be also considered as a bug fixes because it is not possible to use the driver on Samsung Aquila and Goni boards without them.

List of patches:
[PATCH 1/3] USB: s3c-hsotg: fix compilation problem
[PATCH 2/3] USB: s3c-hsotg: modify only selected bits in S3C_PHYPWR register [PATCH 3/3] USB: s3c-hsotg: add support for clock gating

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center

A message that is not in the archive (sent off-list or not yet received): 1279548102-32390-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org

#2 lore raw

PATCH 2/3 USB: s3c-hsotg: modify only selected bits in S3C_PHYPWR register

S5PV210 SoCs has 2 USB PHY interfaces, both enabled by writing zero to S3C_PHYPWR register. HS/OTG driver uses only PHY0, so do not touch bits related to PHY1.

---
 drivers/usb/gadget/s3c-hsotg.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/usb/gadget/s3c-hsotg.c +4 -2
index ce272b4..258ca01 100644
@@ -2801,9 +2801,11 @@ static void __devinit s3c_hsotg_initep(struct s3c_hsotg *hsotg,
 static void s3c_hsotg_otgreset(struct s3c_hsotg *hsotg)
 {
 	struct clk *xusbxti;
-	u32 osc;
+	u32 pwr, osc;
 
-	writel(0, S3C_PHYPWR);
+	pwr = readl(S3C_PHYPWR);
+	pwr &= ~0x19;
+	writel(pwr, S3C_PHYPWR);
 	mdelay(1);
 
 	osc = hsotg->plat->is_osc ? S3C_PHYCLK_EXT_OSC : 0;
Signature · 6 lines
1.7.1.569.g6f426

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH 3/3 USB: s3c-hsotg: add support for clock gating

In reply to a message not in the archive

This patch adds support for clock gating of the HS/OTG block. On S5PV210 otg gating clock is initally disabled so the driver needs to get and enable it before it can access its registers.

---
 drivers/usb/gadget/s3c-hsotg.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
drivers/usb/gadget/s3c-hsotg.c +12 -2
index 258ca01..521ebed 100644
@@ -152,6 +152,7 @@ struct s3c_hsotg {
 	void __iomem		*regs;
 	struct resource		*regs_res;
 	int			irq;
+	struct clk		*clk;
 
 	unsigned int		dedicated_fifos:1;
 
@@ -3258,13 +3259,20 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 	hsotg->dev = dev;
 	hsotg->plat = plat;
 
+	hsotg->clk = clk_get(&pdev->dev, "otg");
+	if (IS_ERR(hsotg->clk)) {
+		dev_err(dev, "cannot get otg clock\n");
+		ret = -EINVAL;
+		goto err_mem;
+	}
+
 	platform_set_drvdata(pdev, hsotg);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
 		dev_err(dev, "cannot find register resource 0\n");
 		ret = -EINVAL;
-		goto err_mem;
+		goto err_clk;
 	}
 
 	hsotg->regs_res = request_mem_region(res->start, resource_size(res),
@@ -3272,7 +3280,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 	if (!hsotg->regs_res) {
 		dev_err(dev, "cannot reserve registers\n");
 		ret = -ENOENT;
-		goto err_mem;
+		goto err_clk;
 	}
 
 	hsotg->regs = ioremap(res->start, resource_size(res));
@@ -3325,6 +3333,8 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 
 	/* reset the system */
 
+	clk_enable(hsotg->clk);
+
 	s3c_hsotg_gate(pdev, true);
 
 	s3c_hsotg_otgreset(hsotg);
@@ -3348,7 +3358,8 @@ err_regs:
 err_regs_res:
 	release_resource(hsotg->regs_res);
 	kfree(hsotg->regs_res);
#4 lore raw

PATCH 1/3 USB: s3c-hsotg: fix compilation problem

In reply to Marek Szyprowski

drivers/usb/gadget/s3c-hsotg.c: In function ‘s3c_hsotg_otgreset’:
drivers/usb/gadget/s3c-hsotg.c:2816: error: ‘MHZ’ undeclared (first use in this function) drivers/usb/gadget/s3c-hsotg.c:2816: error: (Each undeclared identifier is reported only once drivers/usb/gadget/s3c-hsotg.c:2816: error: for each function it appears in.)

---
 drivers/usb/gadget/s3c-hsotg.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/gadget/s3c-hsotg.c +1 -0
index a4e0b0f..ce272b4 100644
@@ -36,6 +36,7 @@
 #include <plat/regs-usb-hsotg.h>
 #include <mach/regs-sys.h>
 #include <plat/udc-hs.h>
+#include <plat/cpu.h>
 
 #define DMA_ADDR_INVALID (~((dma_addr_t)0))
 
Signature · 1 line
1.7.1.569.g6f426