linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] soc: brcmstb: Fix multi-platform issues
@ 2018-01-12 21:08 Florian Fainelli
  2018-01-12 21:08 ` [PATCH 1/2] soc: brcmstb: biuctrl: exit without warning on non brcmstb platforms Florian Fainelli
  2018-01-12 21:08 ` [PATCH 2/2] soc: bcm: brcmstb: Be multi-platform compatible Florian Fainelli
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Fainelli @ 2018-01-12 21:08 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This incorporates Sudeep's and Thierry's changes and makes minor tweaks
such that we don't return errors from initcalls even if we are not
running on Broadcom STB platforms.

I kept your authorship because you did 99% of the work, and I just added a
proper Fixes: tag to the first patch and combined Thierry's 4 patches into one.

This has now been properly tested by booting a QEMU ARM virtual machine to verify
we are not seeing BRCMSTB related messages anymore.

Again, sorry for missing the multi-platform kernel case!

Thank you!

Sudeep Holla (1):
  soc: brcmstb: biuctrl: exit without warning on non brcmstb platforms

Thierry Reding (1):
  soc: bcm: brcmstb: Be multi-platform compatible

 drivers/soc/bcm/brcmstb/biuctrl.c | 20 +++++++++++---------
 drivers/soc/bcm/brcmstb/common.c  | 38 +++++++++++++++++++++++++++++---------
 2 files changed, 40 insertions(+), 18 deletions(-)

-- 
2.14.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] soc: brcmstb: biuctrl: exit without warning on non brcmstb platforms
  2018-01-12 21:08 [PATCH 0/2] soc: brcmstb: Fix multi-platform issues Florian Fainelli
@ 2018-01-12 21:08 ` Florian Fainelli
  2018-01-12 21:08 ` [PATCH 2/2] soc: bcm: brcmstb: Be multi-platform compatible Florian Fainelli
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2018-01-12 21:08 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sudeep Holla <sudeep.holla@arm.com>

Currently if this driver is included, we get the following warning
on any platforms irrespective of whether it's brcmstb platform or not.
"
 brcmstb: biuctrl: missing BIU control node
 brcmstb: biuctrl: MCP: Unable to disable write pairing!
"

This patch allows to exit early without any warning messages on non
brcmstb platforms as it's meaningless for them.

Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Gregory Fong <gregory.0xf0@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: bcm-kernel-feedback-list at broadcom.com
Fixes: f780429adfbc ("soc: brcmstb: biuctrl: Move to early_initcall")
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
[florian: Add fixes tag, make initcall non fatal]
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/soc/bcm/brcmstb/biuctrl.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/soc/bcm/brcmstb/biuctrl.c b/drivers/soc/bcm/brcmstb/biuctrl.c
index 2b23ae7b5e9b..6d89ebf13b8a 100644
--- a/drivers/soc/bcm/brcmstb/biuctrl.c
+++ b/drivers/soc/bcm/brcmstb/biuctrl.c
@@ -162,17 +162,11 @@ static void __init mcp_b53_set(void)
 	cbc_writel(reg, CPU_WRITEBACK_CTRL_REG);
 }
 
-static int __init setup_hifcpubiuctrl_regs(void)
+static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
 {
-	struct device_node *np, *cpu_dn;
+	struct device_node *cpu_dn;
 	int ret = 0;
 
-	np = of_find_compatible_node(NULL, NULL, "brcm,brcmstb-cpu-biu-ctrl");
-	if (!np) {
-		pr_err("missing BIU control node\n");
-		return -ENODEV;
-	}
-
 	cpubiuctrl_base = of_iomap(np, 0);
 	if (!cpubiuctrl_base) {
 		pr_err("failed to remap BIU control base\n");
@@ -242,9 +236,17 @@ static struct syscore_ops brcmstb_cpu_credit_syscore_ops = {
 
 static int __init brcmstb_biuctrl_init(void)
 {
+	struct device_node *np;
 	int ret;
 
-	setup_hifcpubiuctrl_regs();
+	/* We might be running on a multi-platform kernel, don't make this a
+	 * fatal error, just bail out early
+	 */
+	np = of_find_compatible_node(NULL, NULL, "brcm,brcmstb-cpu-biu-ctrl");
+	if (!np)
+		return 0;
+
+	setup_hifcpubiuctrl_regs(np);
 
 	ret = mcp_write_pairing_set();
 	if (ret) {
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] soc: bcm: brcmstb: Be multi-platform compatible
  2018-01-12 21:08 [PATCH 0/2] soc: brcmstb: Fix multi-platform issues Florian Fainelli
  2018-01-12 21:08 ` [PATCH 1/2] soc: brcmstb: biuctrl: exit without warning on non brcmstb platforms Florian Fainelli
@ 2018-01-12 21:08 ` Florian Fainelli
  2018-01-15 14:47   ` Arnd Bergmann
  1 sibling, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2018-01-12 21:08 UTC (permalink / raw)
  To: linux-arm-kernel

From: Thierry Reding <treding@nvidia.com>

We were making a bunch of wrong assumptions that turned out to blow out
on non-Broadcom STB platforms:

- we would return -ENODEV from brcmstb_soc_device_early_init() if we
  could not find the sun_top_ctrl device node, this is not an error
  in the context of a multi-platform kernel
- we would still try to register the Broadcom STB SoC device, even if we
  are not running on such a platform

While at it, also fix the sun_top_ctrl device_node leaks while we change
the flow of brcmstb_soc_device_init() and
brcmstb_soc_device_early_init().

Fixes: f780429adfbc ("soc: brcmstb: biuctrl: Move to early_initcall")
Signed-off-by: Thierry Reding <treding@nvidia.com>
[florian: Combine all of Thierry's patch in one go for easier review]
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/soc/bcm/brcmstb/common.c | 38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/drivers/soc/bcm/brcmstb/common.c b/drivers/soc/bcm/brcmstb/common.c
index 781ada62d0a3..14185451901d 100644
--- a/drivers/soc/bcm/brcmstb/common.c
+++ b/drivers/soc/bcm/brcmstb/common.c
@@ -70,30 +70,49 @@ static int __init brcmstb_soc_device_early_init(void)
 {
 	struct device_node *sun_top_ctrl;
 	void __iomem *sun_top_ctrl_base;
+	int ret = 0;
 
+	/* We could be on a multi-platform kernel, don't make this fatal but
+	 * bail out early
+	 */
 	sun_top_ctrl = of_find_matching_node(NULL, sun_top_ctrl_match);
 	if (!sun_top_ctrl)
-		return -ENODEV;
+		return ret;
 
 	sun_top_ctrl_base = of_iomap(sun_top_ctrl, 0);
-	if (!sun_top_ctrl_base)
-		return -ENODEV;
+	if (!sun_top_ctrl_base) {
+		ret = -ENODEV;
+		goto out;
+	}
 
 	family_id = readl(sun_top_ctrl_base);
 	product_id = readl(sun_top_ctrl_base + 0x4);
 	iounmap(sun_top_ctrl_base);
-	return 0;
+out:
+	of_node_put(sun_top_ctrl);
+	return ret;
 }
 early_initcall(brcmstb_soc_device_early_init);
 
 static int __init brcmstb_soc_device_init(void)
 {
 	struct soc_device_attribute *soc_dev_attr;
+	struct device_node *sun_top_ctrl;
 	struct soc_device *soc_dev;
+	int ret = 0;
+
+	/* We could be on a multi-platform kernel, don't make this fatal but
+	 * bail out early
+	 */
+	sun_top_ctrl = of_find_matching_node(NULL, sun_top_ctrl_match);
+	if (!sun_top_ctrl)
+		return ret;
 
 	soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
-	if (!soc_dev_attr)
-		return -ENOMEM;
+	if (!soc_dev_attr) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	soc_dev_attr->family = kasprintf(GFP_KERNEL, "%x",
 					 family_id >> 28 ?
@@ -111,9 +130,10 @@ static int __init brcmstb_soc_device_init(void)
 		kfree(soc_dev_attr->soc_id);
 		kfree(soc_dev_attr->revision);
 		kfree(soc_dev_attr);
-		return -ENOMEM;
+		ret = -ENOMEM;
 	}
-
-	return 0;
+out:
+	of_node_put(sun_top_ctrl);
+	return ret;
 }
 arch_initcall(brcmstb_soc_device_init);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] soc: bcm: brcmstb: Be multi-platform compatible
  2018-01-12 21:08 ` [PATCH 2/2] soc: bcm: brcmstb: Be multi-platform compatible Florian Fainelli
@ 2018-01-15 14:47   ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2018-01-15 14:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 12, 2018 at 10:08 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> We were making a bunch of wrong assumptions that turned out to blow out
> on non-Broadcom STB platforms:
>
> - we would return -ENODEV from brcmstb_soc_device_early_init() if we
>   could not find the sun_top_ctrl device node, this is not an error
>   in the context of a multi-platform kernel
> - we would still try to register the Broadcom STB SoC device, even if we
>   are not running on such a platform
>
> While at it, also fix the sun_top_ctrl device_node leaks while we change
> the flow of brcmstb_soc_device_init() and
> brcmstb_soc_device_early_init().
>
> Fixes: f780429adfbc ("soc: brcmstb: biuctrl: Move to early_initcall")
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> [florian: Combine all of Thierry's patch in one go for easier review]
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied both to next/drivers, thanks!

         Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-15 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-12 21:08 [PATCH 0/2] soc: brcmstb: Fix multi-platform issues Florian Fainelli
2018-01-12 21:08 ` [PATCH 1/2] soc: brcmstb: biuctrl: exit without warning on non brcmstb platforms Florian Fainelli
2018-01-12 21:08 ` [PATCH 2/2] soc: bcm: brcmstb: Be multi-platform compatible Florian Fainelli
2018-01-15 14:47   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).