[linux-yocto] [PATCH 18/30] drivers/usb: USB driver/dts on PPC was broken.
Charlie Paul
cpaul.windriver at gmail.com
Thu Apr 17 19:37:06 PDT 2014
From: SangeethaRao <sangeetha.rao at lsi.com>
Fixed the DTS to have correct entries and updated USB driver
to exclude 55xx relevant code from PPC build
drivers/usb: added a new ehci halt function
New halt function halts the EHCI controller.
This is to be called during startup since spinlocks are not
initialized at that point.
Signed-off-by: SangeethaRao <sangeetha.rao at lsi.com>
---
arch/powerpc/boot/dts/acp342x.dts | 7 ++++---
drivers/usb/host/ehci-ci13612.c | 30 +++++++++++++++++++++++++++++-
2 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/boot/dts/acp342x.dts b/arch/powerpc/boot/dts/acp342x.dts
index 4db67df..8e400e3 100644
--- a/arch/powerpc/boot/dts/acp342x.dts
+++ b/arch/powerpc/boot/dts/acp342x.dts
@@ -112,9 +112,10 @@
};
USB0: usb at 004a4000 {
device_type = "usb";
- compatible = "acp-usb";
- enabled = <0>;
- reg = <0x004a4000 0x00020000>;
+ compatible = "lsi,acp-usb";
+ enabled = <1>;
+ reg = <0x20 0x004A0000 0x0 0020000>,
+ <0x20 0x0040C000 0x0 0001000>;
interrupt-parent = <&MPIC>;
interrupts = <31>;
};
diff --git a/drivers/usb/host/ehci-ci13612.c b/drivers/usb/host/ehci-ci13612.c
index b995a32..3badbd8 100644
--- a/drivers/usb/host/ehci-ci13612.c
+++ b/drivers/usb/host/ehci-ci13612.c
@@ -32,6 +32,8 @@
#include "ehci-ci13612.h"
+static int ci13612_ehci_halt(struct ehci_hcd *ehci);
+
#ifdef CONFIG_LSI_USB_SW_WORKAROUND
static void ci13612_usb_setup(struct usb_hcd *hcd)
{
@@ -104,7 +106,7 @@ static int ci13612_ehci_init(struct usb_hcd *hcd)
ehci->sbrn = 0x20;
/* Reset is only allowed on a stopped controller */
- ehci_halt(ehci);
+ ci13612_ehci_halt(ehci);
/* reset controller */
ehci_reset(ehci);
@@ -183,8 +185,11 @@ static int ci13612_ehci_run(struct usb_hcd *hcd)
if (retval)
return retval;
+
+#ifndef CONFIG_LSI_USB_SW_WORKAROUND
/* Setup AMBA interface to force INCR16 busts when possible */
writel(3, USB_SBUSCFG);
+#endif
retval = ehci_run(hcd);
if (retval)
@@ -192,10 +197,12 @@ static int ci13612_ehci_run(struct usb_hcd *hcd)
ci13612_fixup_txpburst(ehci);
+#ifndef CONFIG_LSI_USB_SW_WORKAROUND
/* Set ITC (bits [23:16]) to zero for interrupt on every micro-frame */
tmp = ehci_readl(ehci, &ehci->regs->command);
tmp &= 0xFFFF;
ehci_writel(ehci, tmp & 0xFFFF, &ehci->regs->command);
+#endif
return retval;
}
@@ -238,6 +245,7 @@ static int ci13612_ehci_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
+ dev_dbg(&pdev->dev, "error getting irq number\n");
retval = irq;
goto fail_create_hcd;
}
@@ -255,9 +263,12 @@ static int ci13612_ehci_probe(struct platform_device *pdev)
return -ENODEV;
}
+
+#ifndef CONFIG_LSI_USB_SW_WORKAROUND
/* Device using 32-bit addressing */
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+#endif
hcd = usb_create_hcd(&ci13612_hc_driver, &pdev->dev,
dev_name(&pdev->dev));
@@ -316,6 +327,18 @@ static int ci13612_ehci_remove(struct platform_device *pdev)
return 0;
}
+static int ci13612_ehci_halt(struct ehci_hcd *ehci)
+{
+ u32 temp;
+
+ temp = ehci_readl(ehci, &ehci->regs->command);
+ temp &= ~CMD_RUN;
+ ehci_writel(ehci, temp, &ehci->regs->command);
+
+ return handshake(ehci, &ehci->regs->status,
+ STS_HALT, STS_HALT, 16 * 125);
+}
+
MODULE_ALIAS("platform:ci13612-ehci");
static struct of_device_id ci13612_match[] = {
@@ -323,6 +346,10 @@ static struct of_device_id ci13612_match[] = {
.type = "usb",
.compatible = "lsi,acp-usb",
},
+ {
+ .type = "usb",
+ .compatible = "acp-usb",
+ },
{},
};
@@ -333,4 +360,5 @@ static struct platform_driver ci13612_ehci_driver = {
.name = "ci13612-ehci",
.of_match_table = ci13612_match,
},
+
};
--
1.7.9.5
More information about the linux-yocto
mailing list