summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2014-01-19 13:45:42 +0000
committerJonas Gorski <jogo@openwrt.org>2014-01-19 13:45:42 +0000
commit52b7f55cb31dd477377301a0f37bf6efe100acc3 (patch)
tree0929a98e9c0a4fb86c47607f3b6719c8193afab5 /target/linux/brcm63xx
parentb6e1cbd8dd5b8fe3833547480abdbd57edb3238c (diff)
downloadmtk-20170518-52b7f55cb31dd477377301a0f37bf6efe100acc3.zip
mtk-20170518-52b7f55cb31dd477377301a0f37bf6efe100acc3.tar.gz
mtk-20170518-52b7f55cb31dd477377301a0f37bf6efe100acc3.tar.bz2
brcm63xx: prevent usb clock state inconsistency on BCM6318
Return the same clock for usbh and usbd on BCM6318 to prevent the clock getting disabled despite being supposed to be enabled, e.g. by the following sequence: clk_enable(usbh); <- usbh->usage = 1, enabled clk_enable(usbd); <- usbd->usage = 1, enabled (no effect) clk_disable(usbd); <- usbd->usage = 0, -> disabled! Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 39321
Diffstat (limited to 'target/linux/brcm63xx')
-rw-r--r--target/linux/brcm63xx/patches-3.10/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch64
1 files changed, 35 insertions, 29 deletions
diff --git a/target/linux/brcm63xx/patches-3.10/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch b/target/linux/brcm63xx/patches-3.10/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch
index 8876f26..2854006 100644
--- a/target/linux/brcm63xx/patches-3.10/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch
+++ b/target/linux/brcm63xx/patches-3.10/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch
@@ -13,38 +13,44 @@
bcm_hwclock_set(CKCTL_6328_ROBOSW_EN, enable);
else if (BCMCPU_IS_6362())
bcm_hwclock_set(CKCTL_6362_ROBOSW_EN, enable);
-@@ -179,11 +183,22 @@ static struct clk clk_pcm = {
- };
-
- /*
-+ * 6318 USB host & slave clock
-+ */
-+static void bcm_6318_usb_clock_set(int enable)
-+{
-+ bcm_hwclock_set(CKCTL_6318_USB_EN, enable);
-+ bcm_ub_hwclock_set(UB_CKCTL_6318_USB_EN, enable);
-+}
-+
-+/*
- * USB host clock
+@@ -183,18 +187,22 @@ static struct clk clk_pcm = {
*/
static void usbh_set(struct clk *clk, int enable)
{
- if (BCMCPU_IS_6328())
-+ if (BCMCPU_IS_6318())
-+ bcm_6318_usb_clock_set(enable);
-+ else if (BCMCPU_IS_6328())
++ if (BCMCPU_IS_6318()) {
++ bcm_hwclock_set(CKCTL_6318_USB_EN, enable);
++ bcm_ub_hwclock_set(UB_CKCTL_6318_USB_EN, enable);
++ } else if (BCMCPU_IS_6328()) {
bcm_hwclock_set(CKCTL_6328_USBH_EN, enable);
- else if (BCMCPU_IS_6348())
+- else if (BCMCPU_IS_6348())
++ } else if (BCMCPU_IS_6348()) {
bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
-@@ -209,7 +224,9 @@ static struct clk clk_usbh = {
- */
- static void usbd_set(struct clk *clk, int enable)
- {
-- if (BCMCPU_IS_6328())
-+ if (BCMCPU_IS_6318())
-+ bcm_6318_usb_clock_set(enable);
-+ else if (BCMCPU_IS_6328())
- bcm_hwclock_set(CKCTL_6328_USBD_EN, enable);
- else if (BCMCPU_IS_6362())
- bcm_hwclock_set(CKCTL_6362_USBD_EN, enable);
+- else if (BCMCPU_IS_6362())
++ } else if (BCMCPU_IS_6362()) {
+ bcm_hwclock_set(CKCTL_6362_USBH_EN, enable);
+- else if (BCMCPU_IS_6368())
++ } else if (BCMCPU_IS_6368()) {
+ bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
+- else if (BCMCPU_IS_63268())
++ } else if (BCMCPU_IS_63268()) {
+ bcm_hwclock_set(CKCTL_63268_USBH_EN, enable);
+- else
++ } else {
+ return;
++ }
+
+ if (enable)
+ msleep(100);
+@@ -393,9 +401,9 @@ struct clk *clk_get(struct device *dev,
+ return &clk_enetsw;
+ if (!strcmp(id, "ephy"))
+ return &clk_ephy;
+- if (!strcmp(id, "usbh"))
++ if (!strcmp(id, "usbh") || (BCMCPU_IS_6318() && !strcmp(id, "usbd")))
+ return &clk_usbh;
+- if (!strcmp(id, "usbd"))
++ if (!strcmp(id, "usbd") && !BCMCPU_IS_6318())
+ return &clk_usbd;
+ if (!strcmp(id, "spi"))
+ return &clk_spi;