aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorMathias Kresin <dev@kresin.me>2017-07-28 20:09:53 +0200
committerMathias Kresin <dev@kresin.me>2017-07-29 09:24:55 +0200
commit5e87b01275e20226a08538d447ca7714e824cc2c (patch)
tree35f60087dc9fc7d4f05ee08849a0ddbd64076e9c /target
parent2247af82df2174829eb5a37076ead0520d3ab580 (diff)
downloadupstream-5e87b01275e20226a08538d447ca7714e824cc2c.tar.gz
upstream-5e87b01275e20226a08538d447ca7714e824cc2c.tar.bz2
upstream-5e87b01275e20226a08538d447ca7714e824cc2c.zip
brcm63xx: add NULL clock fix send upstream
Make the behaviour of clk_get_rate consistent with common clk's clk_get_rate by accepting NULL clocks as parameter. Some device drivers rely on this, and will cause an OOPS otherwise. Fixes: FS#735 Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'target')
-rw-r--r--target/linux/brcm63xx/patches-4.4/111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch48
-rw-r--r--target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch4
-rw-r--r--target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch2
-rw-r--r--target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch2
-rw-r--r--target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch2
5 files changed, 53 insertions, 5 deletions
diff --git a/target/linux/brcm63xx/patches-4.4/111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch b/target/linux/brcm63xx/patches-4.4/111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch
new file mode 100644
index 0000000000..75a3a23a9f
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.4/111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch
@@ -0,0 +1,48 @@
+From patchwork Tue Jul 18 10:17:27 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [6/9] MIPS: BCM63XX: allow NULL clock for clk_get_rate
+X-Patchwork-Submitter: Jonas Gorski <jonas.gorski@gmail.com>
+X-Patchwork-Id: 16776
+Message-Id: <20170718101730.2541-7-jonas.gorski@gmail.com>
+To: unlisted-recipients:; (no To-header on input)
+Cc: Ralf Baechle <ralf@linux-mips.org>,
+ Florian Fainelli <f.fainelli@gmail.com>,
+ bcm-kernel-feedback-list@broadcom.com,
+ James Hogan <james.hogan@imgtec.com>,
+ linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
+Date: Tue, 18 Jul 2017 12:17:27 +0200
+From: Jonas Gorski <jonas.gorski@gmail.com>
+List-Id: linux-mips <linux-mips.eddie.linux-mips.org>
+
+Make the behaviour of clk_get_rate consistent with common clk's
+clk_get_rate by accepting NULL clocks as parameter. Some device
+drivers rely on this, and will cause an OOPS otherwise.
+
+Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: Florian Fainelli <f.fainelli@gmail.com>
+Cc: bcm-kernel-feedback-list@broadcom.com
+Cc: James Hogan <james.hogan@imgtec.com>
+Cc: linux-mips@linux-mips.org
+Cc: linux-kernel@vger.kernel.org
+Reported-by: Mathias Kresin <dev@kresin.me>
+Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ arch/mips/bcm63xx/clk.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/arch/mips/bcm63xx/clk.c
++++ b/arch/mips/bcm63xx/clk.c
+@@ -345,6 +345,9 @@ EXPORT_SYMBOL(clk_disable);
+
+ unsigned long clk_get_rate(struct clk *clk)
+ {
++ if (!clk)
++ return 0;
++
+ return clk->rate;
+ }
+
diff --git a/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch b/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch
index 6ad2e89f63..25b0df5dc2 100644
--- a/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch
+++ b/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch
@@ -107,7 +107,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
}
static struct clk clk_pcie = {
-@@ -386,9 +400,11 @@ struct clk *clk_get(struct device *dev,
+@@ -389,9 +403,11 @@ struct clk *clk_get(struct device *dev,
return &clk_periph;
if ((BCMCPU_IS_3368() || BCMCPU_IS_6358()) && !strcmp(id, "pcm"))
return &clk_pcm;
@@ -121,7 +121,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
return &clk_pcie;
return ERR_PTR(-ENOENT);
}
-@@ -411,6 +427,7 @@ static int __init bcm63xx_clk_init(void)
+@@ -414,6 +430,7 @@ static int __init bcm63xx_clk_init(void)
clk_hsspi.rate = HSSPI_PLL_HZ_6328;
break;
case BCM6362_CPU_ID:
diff --git a/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch b/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch
index 28090d4f22..3b0995afcd 100644
--- a/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch
+++ b/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch
@@ -57,7 +57,7 @@ Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318
mask = CKCTL_6328_HSSPI_EN;
else if (BCMCPU_IS_6362())
mask = CKCTL_6362_HSSPI_EN;
-@@ -417,12 +419,16 @@ void clk_put(struct clk *clk)
+@@ -420,12 +422,16 @@ void clk_put(struct clk *clk)
EXPORT_SYMBOL(clk_put);
diff --git a/target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch b/target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch
index 4ffeac9633..3e28a38e02 100644
--- a/target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch
+++ b/target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch
@@ -53,7 +53,7 @@ Subject: [PATCH 53/53] MIPS: BCM63XX: add PCIe support for BCM6318
}
static struct clk clk_pcie = {
-@@ -405,7 +422,7 @@ struct clk *clk_get(struct device *dev,
+@@ -408,7 +425,7 @@ struct clk *clk_get(struct device *dev,
if ((BCMCPU_IS_6362() || BCMCPU_IS_6368() || BCMCPU_IS_63268()) &&
!strcmp(id, "ipsec"))
return &clk_ipsec;
diff --git a/target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch b/target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch
index 384702c80f..947f7223fb 100644
--- a/target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch
+++ b/target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch
@@ -42,7 +42,7 @@
if (enable)
msleep(100);
-@@ -405,9 +413,9 @@ struct clk *clk_get(struct device *dev,
+@@ -408,9 +416,9 @@ struct clk *clk_get(struct device *dev,
return &clk_enetsw;
if (!strcmp(id, "ephy"))
return &clk_ephy;