Modularizing Versatile Express
Subsystems (9)
v2 cover Modularizing Versatile Express
This series enables building various Versatile Express platform drivers as modules. The primary target is the Fast Model FVP which is supported in Android. As Android is moving towards their GKI, or generic kernel, the hardware support has to be in modules. Currently ARCH_VEXPRESS enables several built-in only drivers. Some of these are needed, but some are only needed for older 32-bit VExpress platforms and can just be disabled. For FVP, the pl111 display driver is needed. The pl111 driver depends on vexpress-osc clocks which had a dependency chain of vexpress-config --> vexpress-syscfg --> vexpress-sysreg. These components relied on fixed initcall ordering and didn't support deferred probe which would have complicated making them modules. All these levels of abstraction are needlessly complicated, so this series simplifies things a bit by merging the vexpress-config and vexpress-syscfg functionality.
There's a couple of other pieces to this which I've sent out separately as they don't have dependencies with this series. The cross subsystem dependencies in this series are mainly the ordering of enabling drivers as modules.
A complete git branch is here[1]. Tested on Fast Model FVP Rev C.
v2:
The major change is a boot fix for 32-bit VExpress platforms with patch 3. I also dropped 'power/reset: vexpress: Support building as a module' as it was incomplete and not needed for this series.
Rob
[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git vexpress-modules-v4
Rob Herring (16):
ARM: vexpress: Move vexpress_flags_set() into arch code
arm64: vexpress: Don't select CONFIG_POWER_RESET_VEXPRESS
amba: Retry adding deferred devices at late_initcall
clk: versatile: Rework kconfig structure
clk: versatile: Only enable SP810 on 32-bit by default
clk: vexpress-osc: Use the devres clock API variants
clk: vexpress-osc: Support building as a module
mfd: vexpress-sysreg: Drop selecting CONFIG_CLKSRC_MMIO
mfd: vexpress-sysreg: Drop unused syscon child devices
mfd: vexpress-sysreg: Use devres API variants
mfd: vexpress-sysreg: Support building as a module
bus: vexpress-config: Merge vexpress-syscfg into vexpress-config
bus: vexpress-config: simplify config bus probing
vexpress: Move setting master site to vexpress-config bus
bus: vexpress-config: Support building as module
ARM: vexpress: Don't select VEXPRESS_CONFIG
arch/arm/mach-integrator/Kconfig | 1 - arch/arm/mach-realview/Kconfig | 1 - arch/arm/mach-versatile/Kconfig | 1 - arch/arm/mach-vexpress/Kconfig | 4 - arch/arm/mach-vexpress/core.h | 1 + arch/arm/mach-vexpress/dcscb.c | 1 + arch/arm/mach-vexpress/v2m.c | 23 ++ arch/arm64/Kconfig.platforms | 3 - drivers/amba/bus.c | 14 +- drivers/bus/Kconfig | 2 +- drivers/bus/vexpress-config.c | 354 ++++++++++++++++++----- drivers/clk/Makefile | 2 +- drivers/clk/versatile/Kconfig | 24 +- drivers/clk/versatile/clk-vexpress-osc.c | 20 +- drivers/mfd/Kconfig | 5 +- drivers/mfd/vexpress-sysreg.c | 99 +------ drivers/misc/Kconfig | 9 - drivers/misc/Makefile | 1 - drivers/misc/vexpress-syscfg.c | 280 ------------------ include/linux/vexpress.h | 30 -- 20 files changed, 354 insertions(+), 521 deletions(-) delete mode 100644 drivers/misc/vexpress-syscfg.c
base-commit: 8f3d9f354286745c751374f5f1fcafee6b3f3136 --
2.20.1
PATCH v2 1/16 ARM: vexpress: Move vexpress_flags_set() into arch code
vexpress_flags_set() is only used by the platform SMP related code and has nothing to do with the vexpress-sysreg MFD driver other than both access the same h/w block. It's also only needed for 32-bit systems and must be built-in for them. Let's move vexpress_flags_set() closer to where it is being used. This will allow for vexpress-sysreg to be built as a module.
--- arch/arm/mach-vexpress/Kconfig | 1 - arch/arm/mach-vexpress/core.h | 1 + arch/arm/mach-vexpress/dcscb.c | 1 + arch/arm/mach-vexpress/v2m.c | 23 +++++++++++++++++++++++ drivers/mfd/vexpress-sysreg.c | 19 ------------------- include/linux/vexpress.h | 4 ---- 6 files changed, 25 insertions(+), 24 deletions(-)
arch/arm/mach-vexpress/Kconfig +0 -1
@@ -22,7 +22,6 @@ menuconfig ARCH_VEXPRESS select REGULATOR_FIXED_VOLTAGE if REGULATOR select VEXPRESS_CONFIG select VEXPRESS_SYSCFG - select MFD_VEXPRESS_SYSREG help This option enables support for systems using Cortex processor based ARM core and logic (FPGA) tiles on the Versatile Express motherboard,
arch/arm/mach-vexpress/core.h +1 -0
@@ -1,3 +1,4 @@bool vexpress_smp_init_ops (void ); +void vexpress_flags_set (u32 data);extern const struct smp_operations vexpress_smp_dt_ops;
arch/arm/mach-vexpress/dcscb.c +1 -0
@@ -20,6 +20,7 @@#include <asm/cputype.h> #include <asm/cp15.h> +#include "core.h" #define RST_HOLD0 0x0#define RST_HOLD1 0x4
arch/arm/mach-vexpress/v2m.c +23 -0
@@ -1,8 +1,31 @@// SPDX-License-Identifier: GPL-2.0 +#include <linux/of.h> +#include <linux/of_address.h> #include <asm/mach/arch.h> #include "core.h" +#define SYS_FLAGSSET 0x030 +#define SYS_FLAGSCLR 0x034 + +void vexpress_flags_set (u32 data) +{ +static void __iomem *base; + +if (!base) { +struct device_node *node =of_find_compatible_node (NULL ,NULL , +"arm,vexpress-sysreg" ); + + base =of_iomap (node,0 ); + } + +if (WARN_ON (!base)) +return ; + +writel (~0 , base +SYS_FLAGSCLR ); +writel (data, base +SYS_FLAGSSET ); +} +static const char *const v2m_dt_match[]__initconst = {"arm,vexpress" ,NULL ,
drivers/mfd/vexpress-sysreg.c +0 -19
@@ -8,7 +8,6 @@#include <linux/err.h> #include <linux/io.h> #include <linux/mfd/core.h> -#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/platform_data/syscon.h> #include <linux/platform_device.h>
@@ -42,24 +41,6 @@#define SYS_MISC_MASTERSITE (1 << 14) -void vexpress_flags_set (u32 data) -{ -static void __iomem *base; - -if (!base) { -struct device_node *node =of_find_compatible_node (NULL ,NULL , -"arm,vexpress-sysreg" ); - - base =of_iomap (node,0 ); - } - -if (WARN_ON (!base)) -return ; - -writel (~0 , base +SYS_FLAGSCLR ); -writel (data, base +SYS_FLAGSSET ); -} -/* The sysreg block is just a random collection of various functions... */ static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = {
include/linux/vexpress.h +0 -4
@@ -40,8 +40,4 @@ struct device *vexpress_config_bridge_register(struct device *parent,struct regmap *devm_regmap_init_vexpress_config (struct device *dev); -/* Platform control */ - -void vexpress_flags_set (u32 data); -#endif
Signature · 1 line
2.20.1
Re: [PATCH v2 01/16] ARM: vexpress: Move vexpress_flags_set() into arch code
Quoted 14 lines · Rob Herring
vexpress_flags_set()is only used by the platform SMP related code and has nothing to do with the vexpress-sysreg MFD driver other than both access the same h/w block. It's also only needed for 32-bit systems and must be built-in for them. Let's movevexpress_flags_set()closer to where it is being used. This will allow for vexpress-sysreg to be built as a module.Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Lee Jones <[email protected]>Acked-by Arnd Bergmann <[email protected]>Acked-by Liviu Dudau <[email protected]>Reviewed-by Sudeep Holla <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 7 lines
--- arch/arm/mach-vexpress/Kconfig | 1 - arch/arm/mach-vexpress/core.h | 1 + arch/arm/mach-vexpress/dcscb.c | 1 + arch/arm/mach-vexpress/v2m.c | 23 +++++++++++++++++++++++drivers/mfd/vexpress-sysreg.c | 19 -------------------
Quoted 2 lines
include/linux/vexpress.h | 4 ---- 6 files changed, 25 insertions(+), 24 deletions(-)
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 2/16 arm64: vexpress: Don't select CONFIG_POWER_RESET_VEXPRESS
In reply to Rob HerringThe VExpress power-off/reset driver is not needed on 64-bit platforms as PSCI power-off and reset can be used instead. Stop selecting it so it can be disabled and not always built-in.
CONFIG_VEXPRESS_CONFIG can also be dropped as it was a dependency for CONFIG_POWER_RESET_VEXPRESS.
---
v2:
- squash dropping CONFIG_VEXPRESS_CONFIG select into this patch
--- arch/arm64/Kconfig.platforms | 2 -- 1 file changed, 2 deletions(-)
arch/arm64/Kconfig.platforms +0 -2
@@ -278,8 +278,6 @@ config ARCH_VEXPRESS select GPIOLIB select PM select PM_GENERIC_DOMAINS - select POWER_RESET_VEXPRESS - select VEXPRESS_CONFIG help This enables support for the ARMv8 software model (Versatile Express).
Signature · 1 line
2.20.1
PATCH v2 3/16 amba: Retry adding deferred devices at late_initcall
In reply to Rob HerringIf amba bus devices defer when adding, the amba bus code simply retries adding the devices every 5 seconds. This doesn't work well as it completely unsynchronized with starting the init process which can happen in less than 5 secs. Add a retry during late_initcall. If the amba devices are added, then deferred probe takes over. If the dependencies have not probed at this point, then there's no improvement over previous behavior. To completely solve this, we'd need to retry after every successful probe as deferred probe does.
The list_empty() check now happens outside the mutex, but the mutex wasn't necessary in the first place.
This needed to use deferred probe instead of fragile initcall ordering on 32-bit VExpress systems where the apb_pclk has a number of probe dependencies (vexpress-sysregs, vexpress-config).
--- drivers/amba/bus.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/amba/bus.c +11 -3
@@ -505,7 +505,7 @@ static DECLARE_DELAYED_WORK(deferred_retry_work, amba_deferred_retry_func);#define DEFERRED_DEVICE_TIMEOUT (msecs_to_jiffies(5 * 1000)) -static void amba_deferred_retry_func (struct work_struct *dummy) +static int amba_deferred_retry (void ) {struct deferred_device *ddev, *tmp;
@@ -521,11 +521,19 @@ static void amba_deferred_retry_func(struct work_struct *dummy)kfree (ddev); } +mutex_unlock (&deferred_devices_lock); + +return 0 ; +} +late_initcall (amba_deferred_retry); + +static void amba_deferred_retry_func (struct work_struct *dummy) +{ +amba_deferred_retry (); +if (!list_empty (&deferred_devices))schedule_delayed_work (&deferred_retry_work,DEFERRED_DEVICE_TIMEOUT ); - -mutex_unlock (&deferred_devices_lock); }/**
--
2.20.1
PATCH v2 4/16 clk: versatile: Rework kconfig structure
In reply to Rob HerringCONFIG_COMMON_CLK_VERSATILE doesn't really do anything other than hiding Arm Ltd reference platform clock drivers. It is both selected by the platforms that need it and has a 'depends on' for those platforms. Let's drop the selects and convert CONFIG_COMMON_CLK_VERSATILE into a menuconfig entry. With this make CONFIG_ICST visible.
Move the 'select REGMAP_MMIO' to the drivers that require it (SP810 did not).
This also has the side effect of enabling CONFIG_ICST for COMPILE_TEST as it was not visible before.
---
v2:
- Correct erroneous COMPILE_TEST added and then removed later in the series.
- Bring back COMMON_CLK_VERSATILE making it a menuconfig and separate it from CONFIG_ICST
--- arch/arm/mach-integrator/Kconfig | 1 - arch/arm/mach-realview/Kconfig | 1 - arch/arm/mach-versatile/Kconfig | 1 - arch/arm/mach-vexpress/Kconfig | 1 - arch/arm64/Kconfig.platforms | 1 - drivers/clk/Makefile | 2 +- drivers/clk/versatile/Kconfig | 22 ++++++++++++---------- 7 files changed, 13 insertions(+), 16 deletions(-)
arch/arm/mach-integrator/Kconfig +0 -1
@@ -3,7 +3,6 @@ menuconfig ARCH_INTEGRATOR bool "ARM Ltd. Integrator family" depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6 select ARM_AMBA - select COMMON_CLK_VERSATILE select HAVE_TCM select ICST select MFD_SYSCON
arch/arm/mach-realview/Kconfig +0 -1
@@ -6,7 +6,6 @@ menuconfig ARCH_REALVIEW select ARM_GIC select ARM_TIMER_SP804 select CLK_SP810 - select COMMON_CLK_VERSATILE select GPIO_PL061 if GPIOLIB select HAVE_ARM_SCU if SMP select HAVE_ARM_TWD if SMP
arch/arm/mach-versatile/Kconfig +0 -1
@@ -6,7 +6,6 @@ config ARCH_VERSATILE select ARM_TIMER_SP804 select ARM_VIC select CLKSRC_VERSATILE - select COMMON_CLK_VERSATILE select CPU_ARM926T select ICST select MFD_SYSCON
arch/arm/mach-vexpress/Kconfig +0 -1
@@ -7,7 +7,6 @@ menuconfig ARCH_VEXPRESS select ARM_GIC select ARM_GLOBAL_TIMER select ARM_TIMER_SP804 - select COMMON_CLK_VERSATILE select GPIOLIB select HAVE_ARM_SCU if SMP select HAVE_ARM_TWD if SMP
arch/arm64/Kconfig.platforms +0 -1
@@ -274,7 +274,6 @@ config ARCH_UNIPHIER config ARCH_VEXPRESS bool "ARMv8 software model (Versatile Express)" - select COMMON_CLK_VERSATILE select GPIOLIB select PM select PM_GENERIC_DOMAINS
drivers/clk/Makefile +1 -1
@@ -114,7 +114,7 @@ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-y += ti/ obj-$(CONFIG_CLK_UNIPHIER) += uniphier/ obj-$(CONFIG_ARCH_U8500) += ux500/ -obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/ +obj-y += versatile/ ifeq ($(CONFIG_COMMON_CLK), y) obj-$(CONFIG_X86) += x86/ endif
drivers/clk/versatile/Kconfig +12 -10
@@ -1,22 +1,22 @@ # SPDX-License-Identifier: GPL-2.0-only -config ICST - bool -config COMMON_CLK_VERSATILE - bool "Clock driver for ARM Reference designs" - depends on ARCH_INTEGRATOR || ARCH_REALVIEW || \ - ARCH_VERSATILE || ARCH_VEXPRESS || ARM64 || \ - COMPILE_TEST +menuconfig COMMON_CLK_VERSATILE + bool "Clock driver for ARM Reference designs" if COMPILE_TEST + default y if ARCH_INTEGRATOR || ARCH_REALVIEW || \ + ARCH_VERSATILE || ARCH_VEXPRESS + +if COMMON_CLK_VERSATILE + +config ICST + bool "Clock driver for ARM Reference designs ICST" select REGMAP_MMIO ---help--- Supports clocking on ARM Reference designs: - Integrator/AP and Integrator/CP - RealView PB1176, EB, PB11MP and PBX - - Versatile Express config CLK_SP810 bool "Clock driver for ARM SP810 System Controller" - depends on COMMON_CLK_VERSATILE default y if ARCH_VEXPRESS ---help--- Supports clock muxing (REFCLK/TIMCLK to TIMERCLKEN0-3) capabilities
@@ -24,10 +24,12 @@ config CLK_SP810 config CLK_VEXPRESS_OSC bool "Clock driver for Versatile Express OSC clock generators" - depends on COMMON_CLK_VERSATILE depends on VEXPRESS_CONFIG + select REGMAP_MMIO default y if ARCH_VEXPRESS ---help--- Simple regmap-based driver driving clock generators on Versatile Express platforms hidden behind its configuration infrastructure, commonly known as OSCs. + +endif
Signature · 1 line
2.20.1
Re: [PATCH v2 04/16] clk: versatile: Rework kconfig structure
Quoted 9 lines · Rob Herring
CONFIG_COMMON_CLK_VERSATILEdoesn't really do anything other than hiding Arm Ltd reference platform clock drivers. It is both selected by the platforms that need it and has a 'depends on' for those platforms. Let's drop the selects and convertCONFIG_COMMON_CLK_VERSATILEinto a menuconfig entry. With this makeCONFIG_ICSTvisible.Move the 'select
REGMAP_MMIO' to the drivers that require it (SP810 did not).
Quoted 7 lines
This also has the side effect of enabling
CONFIG_ICSTforCOMPILE_TESTas it was not visible before.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>
FWIW,
Signature · 2 lines
Regards, Sudeep
Re: [PATCH v2 04/16] clk: versatile: Rework kconfig structure
In reply to Rob HerringQuoting Rob Herring (2020-04-29 13:58:13)
Quoted 20 lines
CONFIG_COMMON_CLK_VERSATILEdoesn't really do anything other than hiding Arm Ltd reference platform clock drivers. It is both selected by the platforms that need it and has a 'depends on' for those platforms. Let's drop the selects and convertCONFIG_COMMON_CLK_VERSATILEinto a menuconfig entry. With this makeCONFIG_ICSTvisible.Move the 'select
REGMAP_MMIO' to the drivers that require it (SP810 did not).This also has the side effect of enabling
CONFIG_ICSTforCOMPILE_TESTas it was not visible before.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Stephen Boyd <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 1 line
---
PATCH v2 5/16 clk: versatile: Only enable SP810 on 32-bit by default
In reply to Rob HerringWhile 64-bit Arm reference platforms have SP810 for clocks for SP804 timers, they are not needed since the arch timers are used instead.
--- drivers/clk/versatile/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/versatile/Kconfig +1 -1
@@ -17,7 +17,7 @@ config ICST config CLK_SP810 bool "Clock driver for ARM SP810 System Controller" - default y if ARCH_VEXPRESS + default y if (ARCH_VEXPRESS && ARM) ---help--- Supports clock muxing (REFCLK/TIMCLK to TIMERCLKEN0-3) capabilities of the ARM SP810 System Controller cell.
Signature · 1 line
2.20.1
Re: [PATCH v2 05/16] clk: versatile: Only enable SP810 on 32-bit by default
Quoted 6 lines · Rob Herring
While 64-bit Arm reference platforms have SP810 for clocks for SP804 timers, they are not needed since the arch timers are used instead.
Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Sudeep Holla <[email protected]>
With a note below for sake of information,
Quoted 16 lines
Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Stephen Boyd <[email protected]>Acked-by Arnd Bergmann <[email protected]>Acked-by Liviu Dudau <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/clk/versatile/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/versatile/Kconfig +0
-0
drivers/clk/versatile/Kconfig config ICST · line 20
Quoted 5 lines
drivers/clk/versatile/Kconfig +1
-1@@ -17,7 +17,7 @@ config ICST config CLK_SP810 bool "Clock driver for ARM SP810 System Controller" - default y if ARCH_VEXPRESS + default y if (ARCH_VEXPRESS && ARM)
Just note that SP804 is selected by ARCH_HISILICON and ARCH_BRCM or something for Raspberry Pi. So, this will result in the warnings on Juno like:
sp804: timer clock not found: -517
sp804: arm,sp804 clock not found: -2
sp804: timer clock not found: -517
sp804: arm,sp804 clock not found: -2
This can be ignored as we rely on arch-timers and they are just there in DT for completion. We can disable them in DT if that's fine ?
Signature · 7 lines
Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 05/16] clk: versatile: Only enable SP810 on 32-bit by default
In reply to Rob HerringQuoting Rob Herring (2020-04-29 13:58:14)
Quoted 13 lines
While 64-bit Arm reference platforms have SP810 for clocks for SP804 timers, they are not needed since the arch timers are used instead.
Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Stephen Boyd <[email protected]>Acked-by Arnd Bergmann <[email protected]>Acked-by Liviu Dudau <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 1 line
---
PATCH v2 6/16 clk: vexpress-osc: Use the devres clock API variants
In reply to Rob HerringIn preparation to enable the vexpress-osc clock driver as a module, convert the driver to use the managed devres clock API variants. With this, a driver .remove() hook is not needed.
--- drivers/clk/versatile/clk-vexpress-osc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/versatile/clk-vexpress-osc.c +5 -5
@@ -65,8 +65,8 @@ static int vexpress_osc_probe(struct platform_device *pdev) {struct clk_init_data init;struct vexpress_osc *osc; -struct clk *clk;u32 range[2 ]; +int ret; osc =devm_kzalloc (&pdev->dev,sizeof (*osc),GFP_KERNEL );if (!osc)
@@ -92,11 +92,11 @@ static int vexpress_osc_probe(struct platform_device *pdev) osc->hw.init = &init; - clk =clk_register (NULL , &osc->hw); -if (IS_ERR (clk)) -return PTR_ERR (clk); + ret =devm_clk_hw_register (&pdev->dev, &osc->hw); +if (ret <0 ) +return ret; -of_clk_add_provider (pdev->dev.of_node, of_clk_src_simple_get, clk); +devm_of_clk_add_hw_provider (&pdev->dev, of_clk_hw_simple_get, &osc->hw);clk_hw_set_rate_range (&osc->hw, osc->rate_min, osc->rate_max);dev_dbg (&pdev->dev,"Registered clock '%s'\n" , init.name);
Signature · 1 line
2.20.1
PATCH v2 7/16 clk: vexpress-osc: Support building as a module
In reply to Rob HerringEnable building the vexpress-osc clock driver as a module.
--- drivers/clk/versatile/clk-vexpress-osc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/clk/versatile/clk-vexpress-osc.c +4 -6
@@ -7,6 +7,7 @@#include <linux/clkdev.h> #include <linux/clk-provider.h> #include <linux/err.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/slab.h>
@@ -108,6 +109,7 @@ static const struct of_device_id vexpress_osc_of_match[] = { { .compatible = "arm,vexpress-osc", }, {} }; +MODULE_DEVICE_TABLE (of, vexpress_osc_of_match);static struct platform_driver vexpress_osc_driver = { .driver = {
@@ -116,9 +118,5 @@ static struct platform_driver vexpress_osc_driver = { }, .probe = vexpress_osc_probe, }; - -static int __init vexpress_osc_init (void ) -{ -return platform_driver_register (&vexpress_osc_driver); -} -core_initcall (vexpress_osc_init); +module_platform_driver (vexpress_osc_driver); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.20.1
Re: [PATCH v2 07/16] clk: vexpress-osc: Support building as a module
Quoted 5 lines · Rob Herring
Enable building the vexpress-osc clock driver as a module.
Cc Linus Walleij <[email protected]>Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>
With patch 3/16 fixing the issue previous reported, you now have my
😄
Signature · 2 lines
Regards, Sudeep
Re: [PATCH v2 07/16] clk: vexpress-osc: Support building as a module
In reply to Rob HerringQuoting Rob Herring (2020-04-29 13:58:16)
Quoted 11 lines
Enable building the vexpress-osc clock driver as a module.
Cc Linus Walleij <[email protected]>Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Michael Turquette <[email protected]>Cc Stephen Boyd <[email protected]>Signed-off-by Rob Herring <[email protected]>---
PATCH v2 8/16 mfd: vexpress-sysreg: Drop selecting CONFIG_CLKSRC_MMIO
In reply to Rob HerringNothing in the VExpress sysregs nor the MFD child drivers use CONFIG_CLKSRC_MMIO. There's the 24MHz counter, but that's handled by drivers/clocksource/timer-versatile.c which doesn't use CONFIG_CLKSRC_MMIO either. So let's just drop CONFIG_CLKSRC_MMIO.
As the !ARCH_USES_GETTIMEOFFSET dependency was added for CONFIG_CLKSRC_MMIO, that can be dropped, too.
--- drivers/mfd/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mfd/Kconfig +1 -2
@@ -2029,9 +2029,8 @@ endmenu config MFD_VEXPRESS_SYSREG bool "Versatile Express System Registers" - depends on VEXPRESS_CONFIG && GPIOLIB && !ARCH_USES_GETTIMEOFFSET + depends on VEXPRESS_CONFIG && GPIOLIB default y - select CLKSRC_MMIO select GPIO_GENERIC_PLATFORM select MFD_CORE select MFD_SYSCON
Signature · 1 line
2.20.1
Re: [PATCH v2 08/16] mfd: vexpress-sysreg: Drop selecting CONFIG_CLKSRC_MMIO
Quoted 9 lines · Rob Herring
Nothing in the VExpress sysregs nor the MFD child drivers use
CONFIG_CLKSRC_MMIO. There's the 24MHz counter, but that's handled bydrivers/clocksource/timer-versatile.cwhich doesn't useCONFIG_CLKSRC_MMIOeither. So let's just dropCONFIG_CLKSRC_MMIO.As the !ARCH_USES_GETTIMEOFFSET dependency was added for
CONFIG_CLKSRC_MMIO, that can be dropped, too.Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
Re: [PATCH v2 08/16] mfd: vexpress-sysreg: Drop selecting CONFIG_CLKSRC_MMIO
In reply to Rob HerringQuoted 15 lines · Rob Herring
Nothing in the VExpress sysregs nor the MFD child drivers use
CONFIG_CLKSRC_MMIO. There's the 24MHz counter, but that's handled bydrivers/clocksource/timer-versatile.cwhich doesn't useCONFIG_CLKSRC_MMIOeither. So let's just dropCONFIG_CLKSRC_MMIO.As the !ARCH_USES_GETTIMEOFFSET dependency was added for
CONFIG_CLKSRC_MMIO, that can be dropped, too.Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Lee Jones <[email protected]>Acked-by Arnd Bergmann <[email protected]>Acked-by Liviu Dudau <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 3 lines
--- drivers/mfd/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 9/16 mfd: vexpress-sysreg: Drop unused syscon child devices
In reply to Rob HerringThe "sys_id", "sys_misc" and "sys_procid" devices don't have a user anywhere in the tree and do nothing more than create a syscon regmap for a single register or 2. That's an overkill for creating child devices. Let's just remove them.
---
Note that the other GPIO child devices could probably be removed and added to the bgpio driver. Unfortunately, the model dts files were never updated 6 years ago. Not sure if the models really need LEDs...
v2:
- Add missing commmit message
--- drivers/mfd/vexpress-sysreg.c | 36 ----------------------------------- 1 file changed, 36 deletions(-)
drivers/mfd/vexpress-sysreg.c +0 -36
@@ -43,10 +43,6 @@/* The sysreg block is just a random collection of various functions... */ -static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = { - .label ="sys_id" , -}; -static struct bgpio_pdata vexpress_sysreg_sys_led_pdata = { .label ="sys_led" , .base =-1 ,
@@ -65,24 +61,8 @@ static struct bgpio_pdata vexpress_sysreg_sys_flash_pdata = { .ngpio = 1, }; -static struct syscon_platform_data vexpress_sysreg_sys_misc_pdata = { - .label ="sys_misc" , -}; - -static struct syscon_platform_data vexpress_sysreg_sys_procid_pdata = { - .label ="sys_procid" , -}; -static struct mfd_cell vexpress_sysreg_cells[] = { { - .name ="syscon" , - .num_resources =1 , - .resources = (struct resource []) { -DEFINE_RES_MEM (SYS_ID ,0x4 ), - }, - .platform_data = &vexpress_sysreg_sys_id_pdata, - .pdata_size =sizeof (vexpress_sysreg_sys_id_pdata), - }, { .name ="basic-mmio-gpio" , .of_compatible ="arm,vexpress-sysreg,sys_led" , .num_resources =1 ,
@@ -109,22 +89,6 @@ static struct mfd_cell vexpress_sysreg_cells[] = { }, .platform_data = &vexpress_sysreg_sys_flash_pdata, .pdata_size = sizeof(vexpress_sysreg_sys_flash_pdata), - }, { - .name = "syscon", - .num_resources = 1, - .resources = (struct resource []) { -DEFINE_RES_MEM (SYS_MISC ,0x4 ), - }, - .platform_data = &vexpress_sysreg_sys_misc_pdata, - .pdata_size = sizeof(vexpress_sysreg_sys_misc_pdata), - }, { - .name = "syscon", - .num_resources = 1, - .resources = (struct resource []) { -DEFINE_RES_MEM (SYS_PROCID0 ,0x8 ), - }, - .platform_data = &vexpress_sysreg_sys_procid_pdata, - .pdata_size = sizeof(vexpress_sysreg_sys_procid_pdata), }, { .name = "vexpress-syscfg", .num_resources = 1,
Signature · 1 line
2.20.1
Re: [PATCH v2 09/16] mfd: vexpress-sysreg: Drop unused syscon child devices
Quoted 7 lines · Rob Herring
The "
sys_id", "sys_misc" and "sys_procid" devices don't have a user anywhere in the tree and do nothing more than create a syscon regmap for a single register or 2. That's an overkill for creating child devices. Let's just remove them.Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>
Quoted 5 lines
---
Note that the other GPIO child devices could probably be removed and added to the bgpio driver. Unfortunately, the model dts files were never updated 6 years ago. Not sure if the models really need LEDs...
I don't understand the reference to models here. Any particular dts you are referring ? Also may be led/flash gpios can do but we may need mmci ones.
--
Regards,
Sudeep
Re: [PATCH v2 09/16] mfd: vexpress-sysreg: Drop unused syscon child devices
In reply to Rob HerringQuoted 16 lines · Rob Herring
The "
sys_id", "sys_misc" and "sys_procid" devices don't have a user anywhere in the tree and do nothing more than create a syscon regmap for a single register or 2. That's an overkill for creating child devices. Let's just remove them.Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Lee Jones <[email protected]>Signed-off-by Rob Herring <[email protected]>---
Note that the other GPIO child devices could probably be removed and added to the bgpio driver. Unfortunately, the model dts files were never updated 6 years ago. Not sure if the models really need LEDs...
Quoted 5 lines
v2:
- Add missing commmit message--- drivers/mfd/vexpress-sysreg.c | 36 ----------------------------------- 1 file changed, 36 deletions(-)
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 10/16 mfd: vexpress-sysreg: Use devres API variants
In reply to Rob HerringUse the managed devm_gpiochip_add_data() and devm_mfd_add_devices() instead of their unmanaged counterparts. With this, no .remove() hook is needed for driver unbind.
--- drivers/mfd/vexpress-sysreg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/vexpress-sysreg.c +2 -2
@@ -140,9 +140,9 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)bgpio_init (mmc_gpio_chip, &pdev->dev,0x4 , base +SYS_MCI ,NULL ,NULL ,NULL ,NULL ,0 ); mmc_gpio_chip->ngpio =2 ; -gpiochip_add_data (mmc_gpio_chip,NULL ); +devm_gpiochip_add_data (&pdev->dev, mmc_gpio_chip,NULL ); -return mfd_add_devices (&pdev->dev,PLATFORM_DEVID_AUTO , +return devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_AUTO , vexpress_sysreg_cells,ARRAY_SIZE (vexpress_sysreg_cells), mem,0 ,NULL ); }
Signature · 1 line
2.20.1
Re: [PATCH v2 10/16] mfd: vexpress-sysreg: Use devres API variants
Quoted 6 lines · Rob Herring
Use the managed
devm_gpiochip_add_data()anddevm_mfd_add_devices()instead of their unmanaged counterparts. With this, no .remove() hook is needed for driver unbind.Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
Re: [PATCH v2 10/16] mfd: vexpress-sysreg: Use devres API variants
In reply to Rob HerringQuoted 12 lines · Rob Herring
Use the managed
devm_gpiochip_add_data()anddevm_mfd_add_devices()instead of their unmanaged counterparts. With this, no .remove() hook is needed for driver unbind.Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Lee Jones <[email protected]>Acked-by Arnd Bergmann <[email protected]>Acked-by Liviu Dudau <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 3 lines
--- drivers/mfd/vexpress-sysreg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 11/16 mfd: vexpress-sysreg: Support building as a module
In reply to Rob HerringEnable building the vexpress-sysreg driver as a module.
As deferred probe between the vexpress components works now, we don't need to create struct devices early with of_platform_device_create().
--- drivers/mfd/Kconfig | 2 +- drivers/mfd/vexpress-sysreg.c | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-)
drivers/mfd/Kconfig +1 -1
@@ -2028,7 +2028,7 @@ config MCP_UCB1200_TS endmenu config MFD_VEXPRESS_SYSREG - bool "Versatile Express System Registers" + tristate "Versatile Express System Registers" depends on VEXPRESS_CONFIG && GPIOLIB default y select GPIO_GENERIC_PLATFORM
drivers/mfd/vexpress-sysreg.c +4 -11
@@ -8,6 +8,7 @@#include <linux/err.h> #include <linux/io.h> #include <linux/mfd/core.h> +#include <linux/module.h> #include <linux/of_platform.h> #include <linux/platform_data/syscon.h> #include <linux/platform_device.h>
@@ -151,6 +152,7 @@ static const struct of_device_id vexpress_sysreg_match[] = { { .compatible = "arm,vexpress-sysreg", }, {}, }; +MODULE_DEVICE_TABLE (of, vexpress_sysreg_match);static struct platform_driver vexpress_sysreg_driver = { .driver = {
@@ -160,14 +162,5 @@ static struct platform_driver vexpress_sysreg_driver = { .probe = vexpress_sysreg_probe, }; -static int __init vexpress_sysreg_init (void ) -{ -struct device_node *node; - -/* Need the sysreg early, before any other device... */ -for_each_matching_node (node, vexpress_sysreg_match) -of_platform_device_create (node,NULL ,NULL ); - -return platform_driver_register (&vexpress_sysreg_driver); -} -core_initcall (vexpress_sysreg_init); +module_platform_driver (vexpress_sysreg_driver); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.20.1
Re: [PATCH v2 11/16] mfd: vexpress-sysreg: Support building as a module
Quoted 7 lines · Rob Herring
Enable building the vexpress-sysreg driver as a module.
As deferred probe between the vexpress components works now, we don't need to create struct devices early with
of_platform_device_create().Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
Re: [PATCH v2 11/16] mfd: vexpress-sysreg: Support building as a module
In reply to Rob HerringQuoted 11 lines · Rob Herring
Enable building the vexpress-sysreg driver as a module.
As deferred probe between the vexpress components works now, we don't need to create struct devices early with
of_platform_device_create().Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Lee Jones <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 4 lines
--- drivers/mfd/Kconfig | 2 +- drivers/mfd/vexpress-sysreg.c | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-)
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 12/16 bus: vexpress-config: Merge vexpress-syscfg into vexpress-config
In reply to Rob HerringThe only thing that vexpress-syscfg does is provide a regmap to vexpress-config bus child devices. There's little reason to have 2 components for this. The current structure with initcall ordering requirements makes turning these components into modules more difficult.
So let's start to simplify things and merge vexpress-syscfg into vexpress-config. There's no functional change in this commit and it's still separate components until subsequent commits.
--- arch/arm/mach-vexpress/Kconfig | 1 - drivers/bus/vexpress-config.c | 283 +++++++++++++++++++++++++++++++-- drivers/misc/Kconfig | 9 -- drivers/misc/Makefile | 1 - drivers/misc/vexpress-syscfg.c | 280 -------------------------------- include/linux/vexpress.h | 17 -- 6 files changed, 274 insertions(+), 317 deletions(-) delete mode 100644 drivers/misc/vexpress-syscfg.c
arch/arm/mach-vexpress/Kconfig +0 -1
@@ -20,7 +20,6 @@ menuconfig ARCH_VEXPRESS select REGULATOR if MMC_ARMMMCI select REGULATOR_FIXED_VOLTAGE if REGULATOR select VEXPRESS_CONFIG - select VEXPRESS_SYSCFG help This option enables support for systems using Cortex processor based ARM core and logic (FPGA) tiles on the Versatile Express motherboard,
drivers/bus/vexpress-config.c +274 -9
318 lines not on this page · raw message
drivers/misc/Kconfig +0 -9
@@ -423,15 +423,6 @@ config SRAM config SRAM_EXEC bool -config VEXPRESS_SYSCFG - bool "Versatile Express System Configuration driver" - depends on VEXPRESS_CONFIG - default y - help - ARM Ltd. Versatile Express uses specialised platform configuration - bus. System Configuration interface is one of the possible means - of generating transactions on this bus. - config PCI_ENDPOINT_TEST depends on PCI select CRC32
drivers/misc/Makefile +0 -1
@@ -49,7 +49,6 @@ obj-$(CONFIG_SRAM_EXEC) += sram-exec.o obj-y += mic/ obj-$(CONFIG_GENWQE) += genwqe/ obj-$(CONFIG_ECHO) += echo/ -obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o obj-$(CONFIG_CXL_BASE) += cxl/ obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o obj-$(CONFIG_OCXL) += ocxl/
drivers/misc/vexpress-syscfg.c deleted +0 -280
280 lines not on this page · raw message
include/linux/vexpress.h +0 -17
@@ -18,23 +18,6 @@/* Config infrastructure */ void vexpress_config_set_master (u32 site); -u32 vexpress_config_get_master (void ); - -void vexpress_config_lock (void *arg); -void vexpress_config_unlock (void *arg); - -int vexpress_config_get_topo (struct device_node *node,u32 *site, -u32 *position,u32 *dcc); - -/* Config bridge API */ - -struct vexpress_config_bridge_ops { -struct regmap * (*regmap_init)(struct device *dev,void *context); -void (*regmap_exit)(struct regmap *regmap,void *context); -}; - -struct device *vexpress_config_bridge_register (struct device *parent, -struct vexpress_config_bridge_ops *ops,void *context);/* Config regmap API */
Signature · 1 line
2.20.1
Re: [PATCH v2 12/16] bus: vexpress-config: Merge vexpress-syscfg into vexpress-config
Quoted 10 lines · Rob Herring
The only thing that vexpress-syscfg does is provide a regmap to vexpress-config bus child devices. There's little reason to have 2 components for this. The current structure with initcall ordering requirements makes turning these components into modules more difficult.
So let's start to simplify things and merge vexpress-syscfg into vexpress-config. There's no functional change in this commit and it's still separate components until subsequent commits.
Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
PATCH v2 13/16 bus: vexpress-config: simplify config bus probing
In reply to Rob HerringThe vexpress-config initialization is dependent on the vexpress-syscfg driver probing. As vexpress-config was not a driver, deferred probe could not be used and instead initcall ordering was relied upon. This is fragile and doesn't work for modules.
Let's move the config bus init into the vexpress-syscfg probe. This eliminates the initcall ordering requirement and the need to create a struct device and the "vexpress-config" class.
--- drivers/bus/vexpress-config.c | 118 ++++++---------------------------- 1 file changed, 21 insertions(+), 97 deletions(-)
drivers/bus/vexpress-config.c +21 -97
@@ -56,7 +56,6 @@ struct vexpress_config_bridge {static DEFINE_MUTEX (vexpress_config_mutex); -static struct class *vexpress_config_class;static u32 vexpress_config_site_master =VEXPRESS_SITE_MASTER ;
@@ -121,9 +120,6 @@ struct regmap *devm_regmap_init_vexpress_config(struct device *dev)struct regmap *regmap;struct regmap **res; -if (WARN_ON (dev->parent->class != vexpress_config_class)) -return ERR_PTR (-ENODEV ); - bridge =dev_get_drvdata (dev->parent);if (WARN_ON (!bridge))return ERR_PTR (-EINVAL );
@@ -146,94 +142,6 @@ struct regmap *devm_regmap_init_vexpress_config(struct device *dev) }EXPORT_SYMBOL_GPL (devm_regmap_init_vexpress_config); -static struct device *vexpress_config_bridge_register (struct device *parent, -struct vexpress_config_bridge_ops *ops,void *context) -{ -struct device *dev; -struct vexpress_config_bridge *bridge; - -if (!vexpress_config_class) { - vexpress_config_class =class_create (THIS_MODULE , -"vexpress-config" ); -if (IS_ERR (vexpress_config_class)) -return (void *)vexpress_config_class; - } - - dev =device_create (vexpress_config_class, parent,0 , -NULL ,"%s.bridge" ,dev_name (parent)); - -if (IS_ERR (dev)) -return dev; - - bridge =devm_kmalloc (dev,sizeof (*bridge),GFP_KERNEL ); -if (!bridge) { -put_device (dev); -device_unregister (dev); -return ERR_PTR (-ENOMEM ); - } - bridge->ops = ops; - bridge->context = context; - -dev_set_drvdata (dev, bridge); - -dev_dbg (parent,"Registered bridge '%s', parent node %p\n" , -dev_name (dev), parent->of_node); - -return dev; -} - - -static int vexpress_config_node_match (struct device *dev,const void *data) -{ -const struct device_node *node = data; - -dev_dbg (dev,"Parent node %p, looking for %p\n" , - dev->parent->of_node, node); - -return dev->parent->of_node == node; -} - -static int vexpress_config_populate (struct device_node *node) -{ -struct device_node *bridge; -struct device *parent; -int ret; - - bridge =of_parse_phandle (node,"arm,vexpress,config-bridge" ,0 ); -if (!bridge) -return -EINVAL ; - - parent =class_find_device (vexpress_config_class,NULL , bridge, - vexpress_config_node_match); -of_node_put (bridge); -if (WARN_ON (!parent)) -return -ENODEV ; - - ret =of_platform_populate (node,NULL ,NULL , parent); - -put_device (parent); - -return ret; -} - -static int __init vexpress_config_init (void ) -{ -int err =0 ; -struct device_node *node; - -/* Need the config devices early, before the "normal" devices... */ -for_each_compatible_node (node,NULL ,"arm,vexpress,config-bus" ) { - err =vexpress_config_populate (node); -if (err) { -of_node_put (node); -break ; - } - } - -return err; -} -postcore_initcall (vexpress_config_init); -static int vexpress_syscfg_exec (struct vexpress_syscfg_func *func,int index,bool write,u32 *data) {
@@ -430,7 +338,8 @@ static int vexpress_syscfg_probe(struct platform_device *pdev) {struct vexpress_syscfg *syscfg;struct resource *res; -struct device *bridge; +struct vexpress_config_bridge *bridge; +struct device_node *node; syscfg =devm_kzalloc (&pdev->dev,sizeof (*syscfg),GFP_KERNEL );if (!syscfg)
@@ -443,11 +352,26 @@ static int vexpress_syscfg_probe(struct platform_device *pdev)if (IS_ERR (syscfg->base))return PTR_ERR (syscfg->base); -/* Must use dev.parent (MFD), as that's where DT phandle points at... */ - bridge =vexpress_config_bridge_register (pdev->dev.parent, - &vexpress_syscfg_bridge_ops, syscfg); + bridge =devm_kmalloc (&pdev->dev,sizeof (*bridge),GFP_KERNEL ); +if (!bridge) +return -ENOMEM ; + + bridge->ops = &vexpress_syscfg_bridge_ops; + bridge->context = syscfg; + +dev_set_drvdata (&pdev->dev, bridge); -return PTR_ERR_OR_ZERO (bridge); +for_each_compatible_node (node,NULL ,"arm,vexpress,config-bus" ) { +struct device_node *bridge_np; + + bridge_np =of_parse_phandle (node,"arm,vexpress,config-bridge" ,0 ); +if (bridge_np != pdev->dev.parent->of_node) +continue ; + +of_platform_populate (node,NULL ,NULL , &pdev->dev); + } + +return 0 ; }static const struct platform_device_id vexpress_syscfg_id_table[] = {
Signature · 1 line
2.20.1
Re: [PATCH v2 13/16] bus: vexpress-config: simplify config bus probing
Quoted 10 lines · Rob Herring
The vexpress-config initialization is dependent on the vexpress-syscfg driver probing. As vexpress-config was not a driver, deferred probe could not be used and instead initcall ordering was relied upon. This is fragile and doesn't work for modules.
Let's move the config bus init into the vexpress-syscfg probe. This eliminates the initcall ordering requirement and the need to create a struct device and the "vexpress-config" class.
Cc Sudeep Holla <[email protected]>
Thanks a lot for all these clean up. It was always confusing to remember these ordering every time I looked at the code after few months are years, but never bothered to cleanup as it was *working* 😁.
Signature · 2 lines
Regards, Sudeep
PATCH v2 14/16 vexpress: Move setting master site to vexpress-config bus
In reply to Rob HerringThere's only a single caller of vexpress_config_set_master() from vexpress-sysreg.c. Let's just make the registers needed available to vexpress-config and move all the code there. The registers needed aren't used anywhere else either. With this, we can get rid of the private API between these 2 drivers.
---
v2:
- Reword subject
--- drivers/bus/vexpress-config.c | 37 +++++++++++++++++++++++++++++++---- drivers/mfd/vexpress-sysreg.c | 25 +---------------------- include/linux/vexpress.h | 9 --------- 3 files changed, 34 insertions(+), 37 deletions(-)
drivers/bus/vexpress-config.c +33 -4
@@ -14,9 +14,17 @@#include <linux/slab.h> #include <linux/vexpress.h> -#define SYS_CFGDATA 0x0 +#define SYS_MISC 0x0 +#define SYS_MISC_MASTERSITE (1 << 14) -#define SYS_CFGCTRL 0x4 +#define SYS_PROCID0 0x24 +#define SYS_PROCID1 0x28 +#define SYS_HBI_MASK 0xfff +#define SYS_PROCIDx_HBI_SHIFT 0 + +#define SYS_CFGDATA 0x40 + +#define SYS_CFGCTRL 0x44#define SYS_CFGCTRL_START (1 << 31)#define SYS_CFGCTRL_WRITE (1 << 30)#define SYS_CFGCTRL_DCC (n) (((n) & 0xf) << 26)
@@ -25,10 +33,14 @@#define SYS_CFGCTRL_POSITION (n) (((n) & 0xf) << 12)#define SYS_CFGCTRL_DEVICE (n) (((n) & 0xfff) << 0) -#define SYS_CFGSTAT 0x8 +#define SYS_CFGSTAT 0x48#define SYS_CFGSTAT_ERR (1 << 1)#define SYS_CFGSTAT_COMPLETE (1 << 0) +#define VEXPRESS_SITE_MB 0 +#define VEXPRESS_SITE_DB1 1 +#define VEXPRESS_SITE_DB2 2 +#define VEXPRESS_SITE_MASTER 0xfstruct vexpress_syscfg {struct device *dev;
@@ -59,7 +71,7 @@ static DEFINE_MUTEX(vexpress_config_mutex);static u32 vexpress_config_site_master =VEXPRESS_SITE_MASTER ; -void vexpress_config_set_master (u32 site) +static void vexpress_config_set_master (u32 site) { vexpress_config_site_master = site; }
@@ -340,6 +352,8 @@ static int vexpress_syscfg_probe(struct platform_device *pdev)struct resource *res;struct vexpress_config_bridge *bridge;struct device_node *node; +int master; +u32 dt_hbi; syscfg =devm_kzalloc (&pdev->dev,sizeof (*syscfg),GFP_KERNEL );if (!syscfg)
@@ -361,6 +375,21 @@ static int vexpress_syscfg_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, bridge); + master =readl (syscfg->base +SYS_MISC ) &SYS_MISC_MASTERSITE ? +VEXPRESS_SITE_DB2 :VEXPRESS_SITE_DB1 ; +vexpress_config_set_master (master); + +/* Confirm board type against DT property, if available */ +if (of_property_read_u32 (of_root,"arm,hbi" , &dt_hbi) ==0 ) { +u32 id =readl (syscfg->base + (master ==VEXPRESS_SITE_DB1 ? +SYS_PROCID0 :SYS_PROCID1 )); +u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) &SYS_HBI_MASK ; + +if (WARN_ON (dt_hbi != hbi)) +dev_warn (&pdev->dev,"DT HBI (%x) is not matching hardware (%x)!\n" , + dt_hbi, hbi); + } +for_each_compatible_node (node,NULL ,"arm,vexpress,config-bus" ) {struct device_node *bridge_np;
drivers/mfd/vexpress-sysreg.c +1 -24
@@ -14,7 +14,6 @@#include <linux/platform_device.h> #include <linux/slab.h> #include <linux/stat.h> -#include <linux/vexpress.h> #define SYS_ID 0x000#define SYS_SW 0x004
@@ -37,11 +36,6 @@#define SYS_CFGCTRL 0x0a4#define SYS_CFGSTAT 0x0a8 -#define SYS_HBI_MASK 0xfff -#define SYS_PROCIDx_HBI_SHIFT 0 - -#define SYS_MISC_MASTERSITE (1 << 14) -/* The sysreg block is just a random collection of various functions... */ static struct bgpio_pdata vexpress_sysreg_sys_led_pdata = {
@@ -94,7 +88,7 @@ static struct mfd_cell vexpress_sysreg_cells[] = { .name = "vexpress-syscfg", .num_resources = 1, .resources = (struct resource []) { - DEFINE_RES_MEM(SYS_CFGDATA, 0xc), + DEFINE_RES_MEM(SYS_MISC, 0x4c), }, } };
@@ -104,8 +98,6 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)struct resource *mem;void __iomem *base;struct gpio_chip *mmc_gpio_chip; -int master; -u32 dt_hbi; mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!mem)
@@ -115,21 +107,6 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)if (!base)return -ENOMEM ; - master =readl (base +SYS_MISC ) &SYS_MISC_MASTERSITE ? -VEXPRESS_SITE_DB2 :VEXPRESS_SITE_DB1 ; -vexpress_config_set_master (master); - -/* Confirm board type against DT property, if available */ -if (of_property_read_u32 (of_root,"arm,hbi" , &dt_hbi) ==0 ) { -u32 id =readl (base + (master ==VEXPRESS_SITE_DB1 ? -SYS_PROCID0 :SYS_PROCID1 )); -u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) &SYS_HBI_MASK ; - -if (WARN_ON (dt_hbi != hbi)) -dev_warn (&pdev->dev,"DT HBI (%x) is not matching hardware (%x)!\n" , - dt_hbi, hbi); - } -/* * Duplicated SYS_MCI pseudo-GPIO controller for compatibility with * older trees using sysreg node for MMC control lines.
include/linux/vexpress.h +0 -9
@@ -10,15 +10,6 @@#include <linux/device.h> #include <linux/regmap.h> -#define VEXPRESS_SITE_MB 0 -#define VEXPRESS_SITE_DB1 1 -#define VEXPRESS_SITE_DB2 2 -#define VEXPRESS_SITE_MASTER 0xf - -/* Config infrastructure */ - -void vexpress_config_set_master (u32 site); -/* Config regmap API */ struct regmap *devm_regmap_init_vexpress_config (struct device *dev);
Signature · 1 line
2.20.1
Re: [PATCH v2 14/16] vexpress: Move setting master site to vexpress-config bus
Quoted 7 lines · Rob Herring
There's only a single caller of
vexpress_config_set_master()fromvexpress-sysreg.c. Let's just make the registers needed available to vexpress-config and move all the code there. The registers needed aren't used anywhere else either. With this, we can get rid of the private API between these 2 drivers.Cc Sudeep Holla <[email protected]>
Some of the macro changes below are not so easy to follow/review. Since nothing is broken,
for this alone 😁.
--
Regards,
Sudeep
Re: [PATCH v2 14/16] vexpress: Move setting master site to vexpress-config bus
In reply to Rob HerringQuoted 13 lines · Rob Herring
There's only a single caller of
vexpress_config_set_master()fromvexpress-sysreg.c. Let's just make the registers needed available to vexpress-config and move all the code there. The registers needed aren't used anywhere else either. With this, we can get rid of the private API between these 2 drivers.Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Cc Linus Walleij <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Acked-by Liviu Dudau <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 7 lines
---
v2:
- Reword subject--- drivers/bus/vexpress-config.c | 37 +++++++++++++++++++++++++++++++----drivers/mfd/vexpress-sysreg.c | 25 +----------------------
Quoted 2 lines
include/linux/vexpress.h | 9 --------- 3 files changed, 34 insertions(+), 37 deletions(-)
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 15/16 bus: vexpress-config: Support building as module
In reply to Rob HerringEnable building vexpress-config driver as a module.
--- drivers/bus/Kconfig | 2 +- drivers/bus/vexpress-config.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-)
drivers/bus/Kconfig +1 -1
@@ -183,7 +183,7 @@ config UNIPHIER_SYSTEM_BUS needed to use on-board devices connected to UniPhier SoCs. config VEXPRESS_CONFIG - bool "Versatile Express configuration bus" + tristate "Versatile Express configuration bus" default y if ARCH_VEXPRESS depends on ARM || ARM64 depends on OF
drivers/bus/vexpress-config.c +4 -6
@@ -7,6 +7,7 @@#include <linux/err.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/of_device.h>
@@ -407,15 +408,12 @@ static const struct platform_device_id vexpress_syscfg_id_table[] = { { "vexpress-syscfg", }, {}, }; +MODULE_DEVICE_TABLE (platform, vexpress_syscfg_id_table);static struct platform_driver vexpress_syscfg_driver = { .driver.name ="vexpress-syscfg" , .id_table = vexpress_syscfg_id_table, .probe = vexpress_syscfg_probe, }; - -static int __init vexpress_syscfg_init (void ) -{ -return platform_driver_register (&vexpress_syscfg_driver); -} -core_initcall (vexpress_syscfg_init); +module_platform_driver (vexpress_syscfg_driver); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.20.1
Re: [PATCH v2 15/16] bus: vexpress-config: Support building as module
Quoted 3 lines · Rob Herring
Enable building vexpress-config driver as a module.
Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
PATCH v2 16/16 ARM: vexpress: Don't select VEXPRESS_CONFIG
In reply to Rob HerringCONFIG_VEXPRESS_CONFIG has 'default y if ARCH_VEXPRESS', so selecting is unnecessary. Selecting it also prevents setting CONFIG_VEXPRESS_CONFIG to a module.
--- arch/arm/mach-vexpress/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/arm/mach-vexpress/Kconfig +0 -1
@@ -19,7 +19,6 @@ menuconfig ARCH_VEXPRESS select POWER_SUPPLY select REGULATOR if MMC_ARMMMCI select REGULATOR_FIXED_VOLTAGE if REGULATOR - select VEXPRESS_CONFIG help This option enables support for systems using Cortex processor based ARM core and logic (FPGA) tiles on the Versatile Express motherboard,
Signature · 1 line
2.20.1
Re: [PATCH v2 16/16] ARM: vexpress: Don't select VEXPRESS_CONFIG
Quoted 5 lines · Rob Herring
CONFIG_VEXPRESS_CONFIGhas 'default y ifARCH_VEXPRESS', so selecting is unnecessary. Selecting it also prevents settingCONFIG_VEXPRESS_CONFIGto a module.Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
Hi,
Quoted 6 lines · Rob Herring
[...]
v2:
The major change is a boot fix for 32-bit VExpress platforms with patch 3. I also dropped 'power/reset: vexpress: Support building as a module' as it was incomplete and not needed for this series.
Ok, please also drop me from Cc for v3 :)
Thanks,
-- Sebastian
Quoted 15 lines · Rob Herring
This series enables building various Versatile Express platform drivers as modules. The primary target is the Fast Model FVP which is supported in Android. As Android is moving towards their GKI, or generic kernel, the hardware support has to be in modules. Currently
ARCH_VEXPRESSenables several built-in only drivers. Some of these are needed, but some are only needed for older 32-bit VExpress platforms and can just be disabled. For FVP, the pl111 display driver is needed. The pl111 driver depends on vexpress-osc clocks which had a dependency chain of vexpress-config --> vexpress-syscfg --> vexpress-sysreg. These components relied on fixed initcall ordering and didn't support deferred probe which would have complicated making them modules. All these levels of abstraction are needlessly complicated, so this series simplifies things a bit by merging the vexpress-config and vexpress-syscfg functionality.
Quoted 6 lines
There's a couple of other pieces to this which I've sent out separately as they don't have dependencies with this series. The cross subsystem dependencies in this series are mainly the ordering of enabling drivers as modules.
A complete git branch is here[1]. Tested on Fast Model FVP Rev C.
I am assuming you will send pull request to ARM SoC guys directly. Let me know what's the plan if that's not the case.
--
Regards,
Sudeep
Quoted 15 lines · Rob Herring
This series enables building various Versatile Express platform drivers as modules. The primary target is the Fast Model FVP which is supported in Android. As Android is moving towards their GKI, or generic kernel, the hardware support has to be in modules. Currently
ARCH_VEXPRESSenables several built-in only drivers. Some of these are needed, but some are only needed for older 32-bit VExpress platforms and can just be disabled. For FVP, the pl111 display driver is needed. The pl111 driver depends on vexpress-osc clocks which had a dependency chain of vexpress-config --> vexpress-syscfg --> vexpress-sysreg. These components relied on fixed initcall ordering and didn't support deferred probe which would have complicated making them modules. All these levels of abstraction are needlessly complicated, so this series simplifies things a bit by merging the vexpress-config and vexpress-syscfg functionality.
Quoted 4 lines
There's a couple of other pieces to this which I've sent out separately as they don't have dependencies with this series. The cross subsystem dependencies in this series are mainly the ordering of enabling drivers as modules.
This series results in the vexpress-a15 console not coming up until very late in the boot process because the console arch_initcall() ends up being deferred because it's dependencies are no longer use core_initcall() to ensure they get in first.
Is there a problem registering vexpress-osc, vexpress-sysreg and vexpress-config as core_initcall's so the console behaves nicely when they are all compiled as built-ins?
Daniel.
Quoted 57 lines
A complete git branch is here[1]. Tested on Fast Model FVP Rev C.
v2:
The major change is a boot fix for 32-bit VExpress platforms with patch 3. I also dropped 'power/reset: vexpress: Support building as a module' as it was incomplete and not needed for this series.Rob
[1]
git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.gitvexpress-modules-v4Rob Herring (16):
ARM: vexpress: Movevexpress_flags_set()into arch code
arm64: vexpress: Don't selectCONFIG_POWER_RESET_VEXPRESS
amba: Retry adding deferred devices atlate_initcall
clk: versatile: Rework kconfig structure
clk: versatile: Only enable SP810 on 32-bit by default
clk: vexpress-osc: Use the devres clock API variants
clk: vexpress-osc: Support building as a module
mfd: vexpress-sysreg: Drop selectingCONFIG_CLKSRC_MMIO
mfd: vexpress-sysreg: Drop unused syscon child devices
mfd: vexpress-sysreg: Use devres API variants
mfd: vexpress-sysreg: Support building as a module
bus: vexpress-config: Merge vexpress-syscfg into vexpress-config
bus: vexpress-config: simplify config bus probing
vexpress: Move setting master site to vexpress-config bus
bus: vexpress-config: Support building as module
ARM: vexpress: Don't selectVEXPRESS_CONFIGarch/arm/mach-integrator/Kconfig | 1 - arch/arm/mach-realview/Kconfig | 1 - arch/arm/mach-versatile/Kconfig | 1 - arch/arm/mach-vexpress/Kconfig | 4 - arch/arm/mach-vexpress/core.h | 1 + arch/arm/mach-vexpress/dcscb.c | 1 + arch/arm/mach-vexpress/v2m.c | 23 ++ arch/arm64/Kconfig.platforms | 3 - drivers/amba/bus.c | 14 +- drivers/bus/Kconfig | 2 +- drivers/bus/vexpress-config.c | 354 ++++++++++++++++++----- drivers/clk/Makefile | 2 +- drivers/clk/versatile/Kconfig | 24 +- drivers/clk/versatile/clk-vexpress-osc.c | 20 +- drivers/mfd/Kconfig | 5 +- drivers/mfd/vexpress-sysreg.c | 99 +------ drivers/misc/Kconfig | 9 - drivers/misc/Makefile | 1 - drivers/misc/vexpress-syscfg.c | 280 ------------------ include/linux/vexpress.h | 30 -- 20 files changed, 354 insertions(+), 521 deletions(-) delete mode 100644 drivers/misc/vexpress-syscfg.cbase-commit:
8f3d9f354286745c751374f5f1fcafee6b3f3136
---
2.20.1
Quoted 22 lines · Daniel Thompson
Quoted 15 lines · Rob Herring
This series enables building various Versatile Express platform drivers as modules. The primary target is the Fast Model FVP which is supported in Android. As Android is moving towards their GKI, or generic kernel, the hardware support has to be in modules. Currently
ARCH_VEXPRESSenables several built-in only drivers. Some of these are needed, but some are only needed for older 32-bit VExpress platforms and can just be disabled. For FVP, the pl111 display driver is needed. The pl111 driver depends on vexpress-osc clocks which had a dependency chain of vexpress-config --> vexpress-syscfg --> vexpress-sysreg. These components relied on fixed initcall ordering and didn't support deferred probe which would have complicated making them modules. All these levels of abstraction are needlessly complicated, so this series simplifies things a bit by merging the vexpress-config and vexpress-syscfg functionality.Quoted 4 lines
There's a couple of other pieces to this which I've sent out separately as they don't have dependencies with this series. The cross subsystem dependencies in this series are mainly the ordering of enabling drivers as modules.
Quoted 4 lines
This series results in the vexpress-a15 console not coming up until very late in the boot process because the console
arch_initcall()ends up being deferred because it's dependencies are no longer usecore_initcall()to ensure they get in first.
Which was a hack...
Quoted 3 lines
Is there a problem registering vexpress-osc, vexpress-sysreg and vexpress-config as core_initcall's so the console behaves nicely when they are all compiled as built-ins?
I think the correct way to solve this is with devlinks which reduces the deferred probes. Can you see if that's better? That's still off by default and needs a kernel command line option. That may just get the console up at an earlier initcall level, but not before other h/w drivers. I think having some way to prioritize probe order without initcall hacks would be good. Then you could prioritize a console or splash screen or ???.
Also, if you really need an early console, then use earlycon.
Rob
Quoted 31 lines · Rob Herring
Quoted 22 lines · Daniel Thompson
Quoted 15 lines · Rob Herring
This series enables building various Versatile Express platform drivers as modules. The primary target is the Fast Model FVP which is supported in Android. As Android is moving towards their GKI, or generic kernel, the hardware support has to be in modules. Currently
ARCH_VEXPRESSenables several built-in only drivers. Some of these are needed, but some are only needed for older 32-bit VExpress platforms and can just be disabled. For FVP, the pl111 display driver is needed. The pl111 driver depends on vexpress-osc clocks which had a dependency chain of vexpress-config --> vexpress-syscfg --> vexpress-sysreg. These components relied on fixed initcall ordering and didn't support deferred probe which would have complicated making them modules. All these levels of abstraction are needlessly complicated, so this series simplifies things a bit by merging the vexpress-config and vexpress-syscfg functionality.Quoted 4 lines
There's a couple of other pieces to this which I've sent out separately as they don't have dependencies with this series. The cross subsystem dependencies in this series are mainly the ordering of enabling drivers as modules.
Quoted 4 lines
This series results in the vexpress-a15 console not coming up until very late in the boot process because the console
arch_initcall()ends up being deferred because it's dependencies are no longer usecore_initcall()to ensure they get in first.Which was a hack...
Quoted 7 lines
Quoted 3 lines
Is there a problem registering vexpress-osc, vexpress-sysreg and vexpress-config as core_initcall's so the console behaves nicely when they are all compiled as built-ins?
I think the correct way to solve this is with devlinks which reduces the deferred probes. Can you see if that's better? That's still off by default and needs a kernel command line option. That may just get the
"fw_devlink=on", right?
I didn't see any difference on time to console activation with this enabled.
Quoted 4 lines
console up at an earlier initcall level, but not before other h/w drivers. I think having some way to prioritize probe order without initcall hacks would be good. Then you could prioritize a console or splash screen or ???.
I don't disagree on "the right thing to do" although I am a little surprised to see the old hack removed a replacement is ready. IIUC the modularization for GKI doesn't require them to be changed.
Quoted 1 line
Also, if you really need an early console, then use earlycon.
To be honest I have relaxed a few expectations in my test harness and have already moved on ;-).
Right now the console will not come up until after we have decompressed the ramdisk even when we have configure the kernel to have a rich set of console drivers built in. That does feel pretty uncomfortable as a user, especially if you have a large initrd but the test suite doesn't mind!
Daniel.