summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx/patches-3.6/400-ohci-add-driver-for-bcm63xx-integrated-controller.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/brcm63xx/patches-3.6/400-ohci-add-driver-for-bcm63xx-integrated-controller.patch')
-rw-r--r--target/linux/brcm63xx/patches-3.6/400-ohci-add-driver-for-bcm63xx-integrated-controller.patch235
1 files changed, 0 insertions, 235 deletions
diff --git a/target/linux/brcm63xx/patches-3.6/400-ohci-add-driver-for-bcm63xx-integrated-controller.patch b/target/linux/brcm63xx/patches-3.6/400-ohci-add-driver-for-bcm63xx-integrated-controller.patch
deleted file mode 100644
index 572419cb68..0000000000
--- a/target/linux/brcm63xx/patches-3.6/400-ohci-add-driver-for-bcm63xx-integrated-controller.patch
+++ /dev/null
@@ -1,235 +0,0 @@
-From 7b510c5754d3c46e1287803f51e8ecb177414438 Mon Sep 17 00:00:00 2001
-From: Maxime Bizon <mbizon@freebox.fr>
-Date: Fri, 10 Jun 2011 19:14:30 +0200
-Subject: [PATCH 23/63] ohci: add driver for bcm63xx integrated controller.
-
----
- drivers/usb/host/Kconfig | 9 ++
- drivers/usb/host/ohci-bcm63xx.c | 175 +++++++++++++++++++++++++++++++++++++++
- drivers/usb/host/ohci-hcd.c | 5 +
- drivers/usb/host/ohci.h | 2 +-
- 4 files changed, 190 insertions(+), 1 deletions(-)
- create mode 100644 drivers/usb/host/ohci-bcm63xx.c
-
---- a/drivers/usb/host/Kconfig
-+++ b/drivers/usb/host/Kconfig
-@@ -306,6 +306,15 @@ config USB_OHCI_HCD
- To compile this driver as a module, choose M here: the
- module will be called ohci-hcd.
-
-+config USB_OHCI_BCM63XX
-+ bool "Support for Broadcom 63xx on-chip OHCI USB controller"
-+ depends on USB_OHCI_HCD && BCM63XX
-+ select USB_OHCI_BIG_ENDIAN_DESC
-+ select USB_OHCI_BIG_ENDIAN_MMIO
-+ ---help---
-+ Enables support for the on-chip OHCI controller on
-+ BCM63XX chips.
-+
- config USB_OHCI_HCD_OMAP1
- bool "OHCI support for OMAP1/2 chips"
- depends on USB_OHCI_HCD && ARCH_OMAP1
---- /dev/null
-+++ b/drivers/usb/host/ohci-bcm63xx.c
-@@ -0,0 +1,176 @@
-+/*
-+ * This file is subject to the terms and conditions of the GNU General Public
-+ * License. See the file "COPYING" in the main directory of this archive
-+ * for more details.
-+ *
-+ * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
-+ */
-+
-+#include <linux/init.h>
-+#include <linux/clk.h>
-+#include <linux/platform_device.h>
-+#include <bcm63xx_cpu.h>
-+#include <bcm63xx_regs.h>
-+#include <bcm63xx_io.h>
-+
-+static struct clk *usb_host_clock;
-+
-+static int __devinit ohci_bcm63xx_start(struct usb_hcd *hcd)
-+{
-+ struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-+ int ret;
-+
-+ ohci->num_ports = 1;
-+
-+ ret = ohci_init(ohci);
-+ if (ret < 0)
-+ return ret;
-+
-+ /* FIXME: autodetected port 2 is shared with USB slave */
-+
-+ ret = ohci_run(ohci);
-+ if (ret < 0) {
-+ dev_err(hcd->self.controller, "can't start %s\n",
-+ hcd->self.bus_name);
-+ ohci_stop(hcd);
-+ return ret;
-+ }
-+ return 0;
-+}
-+
-+static const struct hc_driver ohci_bcm63xx_hc_driver = {
-+ .description = hcd_name,
-+ .product_desc = "BCM63XX integrated OHCI controller",
-+ .hcd_priv_size = sizeof(struct ohci_hcd),
-+
-+ .irq = ohci_irq,
-+ .flags = HCD_USB11 | HCD_MEMORY,
-+ .start = ohci_bcm63xx_start,
-+ .stop = ohci_stop,
-+ .shutdown = ohci_shutdown,
-+ .urb_enqueue = ohci_urb_enqueue,
-+ .urb_dequeue = ohci_urb_dequeue,
-+ .endpoint_disable = ohci_endpoint_disable,
-+ .get_frame_number = ohci_get_frame,
-+ .hub_status_data = ohci_hub_status_data,
-+ .hub_control = ohci_hub_control,
-+ .start_port_reset = ohci_start_port_reset,
-+};
-+
-+static int __devinit ohci_hcd_bcm63xx_drv_probe(struct platform_device *pdev)
-+{
-+ struct resource *res_mem;
-+ struct usb_hcd *hcd;
-+ struct ohci_hcd *ohci;
-+ struct clk *clk;
-+ u32 reg;
-+ int ret, irq;
-+
-+ res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+ irq = platform_get_irq(pdev, 0);
-+ if (!res_mem || irq < 0)
-+ return -ENODEV;
-+
-+ /* enable USB host clock */
-+ clk = clk_get(&pdev->dev, "usbh");
-+ if (IS_ERR(clk))
-+ return -ENODEV;
-+
-+ clk_enable(clk);
-+ usb_host_clock = clk;
-+ msleep(100);
-+
-+ if (BCMCPU_IS_6348())
-+ bcm_rset_writel(RSET_OHCI_PRIV, 0, OHCI_PRIV_REG);
-+ else if (BCMCPU_IS_6358()) {
-+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG);
-+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
-+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
-+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG);
-+ /*
-+ * The magic value comes for the original vendor BSP
-+ * and is needed for USB to work. Datasheet does not
-+ * help, so the magic value is used as-is.
-+ */
-+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
-+ USBH_PRIV_TEST_6358_REG);
-+
-+ } else if (BCMCPU_IS_6368()) {
-+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
-+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
-+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
-+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG);
-+
-+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG);
-+ reg |= USBH_PRIV_SETUP_IOC_MASK;
-+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG);
-+ }
-+
-+ hcd = usb_create_hcd(&ohci_bcm63xx_hc_driver, &pdev->dev, "bcm63xx");
-+ if (!hcd)
-+ return -ENOMEM;
-+ hcd->rsrc_start = res_mem->start;
-+ hcd->rsrc_len = res_mem->end - res_mem->start + 1;
-+
-+ if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
-+ pr_debug("request_mem_region failed\n");
-+ ret = -EBUSY;
-+ goto out;
-+ }
-+
-+ hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
-+ if (!hcd->regs) {
-+ pr_debug("ioremap failed\n");
-+ ret = -EIO;
-+ goto out1;
-+ }
-+
-+ ohci = hcd_to_ohci(hcd);
-+ ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC |
-+ OHCI_QUIRK_FRAME_NO;
-+ ohci_hcd_init(ohci);
-+
-+ ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
-+ if (ret)
-+ goto out2;
-+
-+ platform_set_drvdata(pdev, hcd);
-+ return 0;
-+
-+out2:
-+ iounmap(hcd->regs);
-+out1:
-+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
-+out:
-+ usb_put_hcd(hcd);
-+ return ret;
-+}
-+
-+static int __devexit ohci_hcd_bcm63xx_drv_remove(struct platform_device *pdev)
-+{
-+ struct usb_hcd *hcd;
-+
-+ hcd = platform_get_drvdata(pdev);
-+ usb_remove_hcd(hcd);
-+ iounmap(hcd->regs);
-+ usb_put_hcd(hcd);
-+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
-+ if (usb_host_clock) {
-+ clk_disable(usb_host_clock);
-+ clk_put(usb_host_clock);
-+ }
-+ platform_set_drvdata(pdev, NULL);
-+ return 0;
-+}
-+
-+static struct platform_driver ohci_hcd_bcm63xx_driver = {
-+ .probe = ohci_hcd_bcm63xx_drv_probe,
-+ .remove = __devexit_p(ohci_hcd_bcm63xx_drv_remove),
-+ .shutdown = usb_hcd_platform_shutdown,
-+ .driver = {
-+ .name = "bcm63xx_ohci",
-+ .owner = THIS_MODULE,
-+ },
-+};
-+
-+MODULE_ALIAS("platform:bcm63xx_ohci");
---- a/drivers/usb/host/ohci-hcd.c
-+++ b/drivers/usb/host/ohci-hcd.c
-@@ -1120,6 +1120,11 @@ MODULE_LICENSE ("GPL");
- #define OHCI_PLATFORM_DRIVER ohci_platform_driver
- #endif
-
-+#ifdef CONFIG_USB_OHCI_BCM63XX
-+#include "ohci-bcm63xx.c"
-+#define PLATFORM_DRIVER ohci_hcd_bcm63xx_driver
-+#endif
-+
- #if !defined(PCI_DRIVER) && \
- !defined(PLATFORM_DRIVER) && \
- !defined(OMAP1_PLATFORM_DRIVER) && \
---- a/drivers/usb/host/ohci.h
-+++ b/drivers/usb/host/ohci.h
-@@ -647,7 +647,7 @@ static inline u32 hc32_to_cpup (const st
- * some big-endian SOC implementations. Same thing happens with PSW access.
- */
-
--#ifdef CONFIG_PPC_MPC52xx
-+#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_BCM63XX)
- #define big_endian_frame_no_quirk(ohci) (ohci->flags & OHCI_QUIRK_FRAME_NO)
- #else
- #define big_endian_frame_no_quirk(ohci) 0