X-Git-Url: https://git.archive.openwrt.org/?p=openwrt.git;a=blobdiff_plain;f=target%2Flinux%2Fbrcm63xx%2Fpatches-3.18%2F103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch;fp=target%2Flinux%2Fbrcm63xx%2Fpatches-3.18%2F103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch;h=0000000000000000000000000000000000000000;hp=40bbe083a7bd8bef524c47a8b61a73cd46377ce2;hb=a00612bf4158769b7fc9795a4f5beec46e9e327a;hpb=1f10696c43780636d75b2ee8d89fb3bde1fc05ca diff --git a/target/linux/brcm63xx/patches-3.18/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch b/target/linux/brcm63xx/patches-3.18/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch deleted file mode 100644 index 40bbe083a7..0000000000 --- a/target/linux/brcm63xx/patches-3.18/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 28758a9da77954ed323f86123ef448c6a563c037 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:22 +0100 -Subject: [PATCH 04/11] MIPS: BCM63XX: add OHCI/EHCI configuration bits to - common USB code - -This patch updates the common USB code touching the USB private -registers with the specific bits to properly enable OHCI and EHCI -controllers on BCM63xx SoCs. As a result we now need to protect access -to Read Modify Write sequences using a spinlock because we cannot -guarantee that any of the exposed helper will not be called -concurrently. - -Signed-off-by: Maxime Bizon -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/usb-common.c | 97 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h | 2 + - 2 files changed, 99 insertions(+) - ---- a/arch/mips/bcm63xx/usb-common.c -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -5,10 +5,12 @@ - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * -+ * Copyright (C) 2008 Maxime Bizon - * Copyright (C) 2012 Kevin Cernekee - * Copyright (C) 2012 Broadcom Corporation - * - */ -+#include - #include - - #include -@@ -16,9 +18,14 @@ - #include - #include - -+static DEFINE_SPINLOCK(usb_priv_reg_lock); -+ - void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device) - { - u32 val; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); - - val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); - if (is_device) { -@@ -36,12 +43,17 @@ void bcm63xx_usb_priv_select_phy_mode(u3 - else - val &= ~USBH_PRIV_SWAP_USBD_MASK; - bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG); -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); - } - EXPORT_SYMBOL(bcm63xx_usb_priv_select_phy_mode); - - void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on) - { - u32 val; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); - - val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); - if (is_on) -@@ -49,5 +61,90 @@ void bcm63xx_usb_priv_select_pullup(u32 - else - val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); - bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); - } - EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup); -+ -+/* The following array represents the meaning of the DESC/DATA -+ * endian swapping with respect to the CPU configured endianness -+ * -+ * DATA ENDN mmio descriptor -+ * 0 0 BE invalid -+ * 0 1 BE LE -+ * 1 0 BE BE -+ * 1 1 BE invalid -+ * -+ * Since BCM63XX SoCs are configured to be in big-endian mode -+ * we want configuration at line 3. -+ */ -+void bcm63xx_usb_priv_ohci_cfg_set(void) -+{ -+ u32 reg; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); -+ -+ 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_6328() || BCMCPU_IS_6362() || 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); -+ } -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); -+} -+ -+void bcm63xx_usb_priv_ehci_cfg_set(void) -+{ -+ u32 reg; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); -+ -+ if (BCMCPU_IS_6358()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_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_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_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); -+ } -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); -+} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h -@@ -5,5 +5,7 @@ - - void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device); - void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on); -+void bcm63xx_usb_priv_ohci_cfg_set(void); -+void bcm63xx_usb_priv_ehci_cfg_set(void); - - #endif /* BCM63XX_USB_PRIV_H_ */