Skip to content

Commit 974cc7b

Browse files
committed
mfd: vexpress: Define the device as MFD cells
This patch - finally, after over 6 months! :-( - addresses Samuel's request to split the vexpress-sysreg driver into smaller portions and define the device in a form of MFD cells: * LEDs code has been completely removed and replaced with "gpio-leds" nodes in the tree (referencing dedicated GPIO subnodes in sysreg - bindings documentation updated); this also better fits the reality as some variants of the motherboard don't have all the LEDs populated * syscfg bridge code has been extracted into a separate driver (placed in drivers/misc for no better place) * all the ID & MISC registers are defined as sysconf making them available for other drivers should they need to use them (and also to the user via /sys/kernel/debug/regmap which can be helpful in platform debugging) Signed-off-by: Pawel Moll <pawel.moll@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org>
1 parent 29f9b6c commit 974cc7b

File tree

12 files changed

+667
-438
lines changed

12 files changed

+667
-438
lines changed

Documentation/devicetree/bindings/arm/vexpress-sysreg.txt

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ interrupt generation, MMC and NOR Flash control etc.
88
Required node properties:
99
- compatible value : = "arm,vexpress,sysreg";
1010
- reg : physical base address and the size of the registers window
11+
12+
Deprecated properties, replaced by GPIO subnodes (see below):
1113
- gpio-controller : specifies that the node is a GPIO controller
1214
- #gpio-cells : size of the GPIO specifier, should be 2:
1315
- first cell is the pseudo-GPIO line number:
@@ -16,12 +18,42 @@ Required node properties:
1618
2 - NOR FLASH WPn
1719
- second cell can take standard GPIO flags (currently ignored).
1820

21+
Control registers providing pseudo-GPIO lines must be represented
22+
by subnodes, each of them requiring the following properties:
23+
- compatible value : one of
24+
"arm,vexpress-sysreg,sys_led"
25+
"arm,vexpress-sysreg,sys_mci"
26+
"arm,vexpress-sysreg,sys_flash"
27+
- gpio-controller : makes the node a GPIO controller
28+
- #gpio-cells : size of the GPIO specifier, must be 2:
29+
- first cell is the function number:
30+
- for sys_led : 0..7 = LED 0..7
31+
- for sys_mci : 0 = MMC CARDIN, 1 = MMC WPROT
32+
- for sys_flash : 0 = NOR FLASH WPn
33+
- second cell can take standard GPIO flags (currently ignored).
34+
1935
Example:
2036
v2m_sysreg: sysreg@10000000 {
2137
compatible = "arm,vexpress-sysreg";
2238
reg = <0x10000000 0x1000>;
23-
gpio-controller;
24-
#gpio-cells = <2>;
39+
40+
v2m_led_gpios: sys_led@08 {
41+
compatible = "arm,vexpress-sysreg,sys_led";
42+
gpio-controller;
43+
#gpio-cells = <2>;
44+
};
45+
46+
v2m_mmc_gpios: sys_mci@48 {
47+
compatible = "arm,vexpress-sysreg,sys_mci";
48+
gpio-controller;
49+
#gpio-cells = <2>;
50+
};
51+
52+
v2m_flash_gpios: sys_flash@4c {
53+
compatible = "arm,vexpress-sysreg,sys_flash";
54+
gpio-controller;
55+
#gpio-cells = <2>;
56+
};
2557
};
2658

2759
This block also can also act a bridge to the platform's configuration

arch/arm/boot/dts/vexpress-v2m-rs1.dtsi

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,24 @@
7474
v2m_sysreg: sysreg@010000 {
7575
compatible = "arm,vexpress-sysreg";
7676
reg = <0x010000 0x1000>;
77-
gpio-controller;
78-
#gpio-cells = <2>;
77+
78+
v2m_led_gpios: sys_led@08 {
79+
compatible = "arm,vexpress-sysreg,sys_led";
80+
gpio-controller;
81+
#gpio-cells = <2>;
82+
};
83+
84+
v2m_mmc_gpios: sys_mci@48 {
85+
compatible = "arm,vexpress-sysreg,sys_mci";
86+
gpio-controller;
87+
#gpio-cells = <2>;
88+
};
89+
90+
v2m_flash_gpios: sys_flash@4c {
91+
compatible = "arm,vexpress-sysreg,sys_flash";
92+
gpio-controller;
93+
#gpio-cells = <2>;
94+
};
7995
};
8096

8197
v2m_sysctl: sysctl@020000 {
@@ -113,8 +129,8 @@
113129
compatible = "arm,pl180", "arm,primecell";
114130
reg = <0x050000 0x1000>;
115131
interrupts = <9 10>;
116-
cd-gpios = <&v2m_sysreg 0 0>;
117-
wp-gpios = <&v2m_sysreg 1 0>;
132+
cd-gpios = <&v2m_mmc_gpios 0 0>;
133+
wp-gpios = <&v2m_mmc_gpios 1 0>;
118134
max-frequency = <12000000>;
119135
vmmc-supply = <&v2m_fixed_3v3>;
120136
clocks = <&v2m_clk24mhz>, <&smbclk>;
@@ -265,6 +281,58 @@
265281
clock-output-names = "v2m:refclk32khz";
266282
};
267283

284+
leds {
285+
compatible = "gpio-leds";
286+
287+
user@1 {
288+
label = "v2m:green:user1";
289+
gpios = <&v2m_led_gpios 0 0>;
290+
linux,default-trigger = "heartbeat";
291+
};
292+
293+
user@2 {
294+
label = "v2m:green:user2";
295+
gpios = <&v2m_led_gpios 1 0>;
296+
linux,default-trigger = "mmc0";
297+
};
298+
299+
user@3 {
300+
label = "v2m:green:user3";
301+
gpios = <&v2m_led_gpios 2 0>;
302+
linux,default-trigger = "cpu0";
303+
};
304+
305+
user@4 {
306+
label = "v2m:green:user4";
307+
gpios = <&v2m_led_gpios 3 0>;
308+
linux,default-trigger = "cpu1";
309+
};
310+
311+
user@5 {
312+
label = "v2m:green:user5";
313+
gpios = <&v2m_led_gpios 4 0>;
314+
linux,default-trigger = "cpu2";
315+
};
316+
317+
user@6 {
318+
label = "v2m:green:user6";
319+
gpios = <&v2m_led_gpios 5 0>;
320+
linux,default-trigger = "cpu3";
321+
};
322+
323+
user@7 {
324+
label = "v2m:green:user7";
325+
gpios = <&v2m_led_gpios 6 0>;
326+
linux,default-trigger = "cpu4";
327+
};
328+
329+
user@8 {
330+
label = "v2m:green:user8";
331+
gpios = <&v2m_led_gpios 7 0>;
332+
linux,default-trigger = "cpu5";
333+
};
334+
};
335+
268336
mcc {
269337
compatible = "arm,vexpress,config-bus";
270338
arm,vexpress,config-bridge = <&v2m_sysreg>;

arch/arm/boot/dts/vexpress-v2m.dtsi

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,24 @@
7373
v2m_sysreg: sysreg@00000 {
7474
compatible = "arm,vexpress-sysreg";
7575
reg = <0x00000 0x1000>;
76-
gpio-controller;
77-
#gpio-cells = <2>;
76+
77+
v2m_led_gpios: sys_led@08 {
78+
compatible = "arm,vexpress-sysreg,sys_led";
79+
gpio-controller;
80+
#gpio-cells = <2>;
81+
};
82+
83+
v2m_mmc_gpios: sys_mci@48 {
84+
compatible = "arm,vexpress-sysreg,sys_mci";
85+
gpio-controller;
86+
#gpio-cells = <2>;
87+
};
88+
89+
v2m_flash_gpios: sys_flash@4c {
90+
compatible = "arm,vexpress-sysreg,sys_flash";
91+
gpio-controller;
92+
#gpio-cells = <2>;
93+
};
7894
};
7995

8096
v2m_sysctl: sysctl@01000 {
@@ -112,8 +128,8 @@
112128
compatible = "arm,pl180", "arm,primecell";
113129
reg = <0x05000 0x1000>;
114130
interrupts = <9 10>;
115-
cd-gpios = <&v2m_sysreg 0 0>;
116-
wp-gpios = <&v2m_sysreg 1 0>;
131+
cd-gpios = <&v2m_mmc_gpios 0 0>;
132+
wp-gpios = <&v2m_mmc_gpios 1 0>;
117133
max-frequency = <12000000>;
118134
vmmc-supply = <&v2m_fixed_3v3>;
119135
clocks = <&v2m_clk24mhz>, <&smbclk>;
@@ -264,6 +280,58 @@
264280
clock-output-names = "v2m:refclk32khz";
265281
};
266282

283+
leds {
284+
compatible = "gpio-leds";
285+
286+
user@1 {
287+
label = "v2m:green:user1";
288+
gpios = <&v2m_led_gpios 0 0>;
289+
linux,default-trigger = "heartbeat";
290+
};
291+
292+
user@2 {
293+
label = "v2m:green:user2";
294+
gpios = <&v2m_led_gpios 1 0>;
295+
linux,default-trigger = "mmc0";
296+
};
297+
298+
user@3 {
299+
label = "v2m:green:user3";
300+
gpios = <&v2m_led_gpios 2 0>;
301+
linux,default-trigger = "cpu0";
302+
};
303+
304+
user@4 {
305+
label = "v2m:green:user4";
306+
gpios = <&v2m_led_gpios 3 0>;
307+
linux,default-trigger = "cpu1";
308+
};
309+
310+
user@5 {
311+
label = "v2m:green:user5";
312+
gpios = <&v2m_led_gpios 4 0>;
313+
linux,default-trigger = "cpu2";
314+
};
315+
316+
user@6 {
317+
label = "v2m:green:user6";
318+
gpios = <&v2m_led_gpios 5 0>;
319+
linux,default-trigger = "cpu3";
320+
};
321+
322+
user@7 {
323+
label = "v2m:green:user7";
324+
gpios = <&v2m_led_gpios 6 0>;
325+
linux,default-trigger = "cpu4";
326+
};
327+
328+
user@8 {
329+
label = "v2m:green:user8";
330+
gpios = <&v2m_led_gpios 7 0>;
331+
linux,default-trigger = "cpu5";
332+
};
333+
};
334+
267335
mcc {
268336
compatible = "arm,vexpress,config-bus";
269337
arm,vexpress,config-bridge = <&v2m_sysreg>;

arch/arm/mach-vexpress/ct-ca9x4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static void __init ct_ca9x4_init(void)
160160
amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource);
161161

162162
platform_device_register(&pmu_device);
163-
vexpress_sysreg_config_device_register(&osc1_device);
163+
vexpress_syscfg_device_register(&osc1_device);
164164
}
165165

166166
#ifdef CONFIG_SMP

arch/arm/mach-vexpress/v2m.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ static struct platform_device v2m_cf_device = {
201201

202202
static struct mmci_platform_data v2m_mmci_data = {
203203
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
204-
.gpio_wp = VEXPRESS_GPIO_MMC_WPROT,
205-
.gpio_cd = VEXPRESS_GPIO_MMC_CARDIN,
204+
.status = vexpress_get_mci_cardin,
205+
.gpio_cd = -1,
206+
.gpio_wp = -1,
206207
};
207208

208209
static struct resource v2m_sysreg_resources[] = {
@@ -351,10 +352,10 @@ static void __init v2m_init(void)
351352
for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++)
352353
amba_device_register(v2m_amba_devs[i], &iomem_resource);
353354

354-
vexpress_sysreg_config_device_register(&v2m_muxfpga_device);
355-
vexpress_sysreg_config_device_register(&v2m_shutdown_device);
356-
vexpress_sysreg_config_device_register(&v2m_reboot_device);
357-
vexpress_sysreg_config_device_register(&v2m_dvimode_device);
355+
vexpress_syscfg_device_register(&v2m_muxfpga_device);
356+
vexpress_syscfg_device_register(&v2m_shutdown_device);
357+
vexpress_syscfg_device_register(&v2m_reboot_device);
358+
vexpress_syscfg_device_register(&v2m_dvimode_device);
358359

359360
ct_desc->init_tile();
360361
}
@@ -409,8 +410,6 @@ void __init v2m_dt_init_early(void)
409410
{
410411
u32 dt_hbi;
411412

412-
vexpress_sysreg_of_early_init();
413-
414413
/* Confirm board type against DT property, if available */
415414
if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
416415
u32 hbi = vexpress_get_hbi(VEXPRESS_SITE_MASTER);

drivers/mfd/Kconfig

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,12 +1227,17 @@ config MCP_UCB1200_TS
12271227

12281228
endmenu
12291229

1230-
config VEXPRESS_CONFIG
1231-
bool "ARM Versatile Express platform infrastructure"
1232-
depends on ARM || ARM64
1230+
config MFD_VEXPRESS_SYSREG
1231+
bool "Versatile Express System Registers"
1232+
depends on VEXPRESS_CONFIG
1233+
default y
1234+
select CLKSRC_MMIO
1235+
select GPIO_GENERIC_PLATFORM
1236+
select MFD_CORE
1237+
select MFD_SYSCON
12331238
help
1234-
Platform configuration infrastructure for the ARM Ltd.
1235-
Versatile Express.
1239+
System Registers are the platform configuration block
1240+
on the ARM Ltd. Versatile Express board.
12361241

12371242
endmenu
12381243
endif

drivers/mfd/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
161161
obj-$(CONFIG_MFD_SEC_CORE) += sec-core.o sec-irq.o
162162
obj-$(CONFIG_MFD_SYSCON) += syscon.o
163163
obj-$(CONFIG_MFD_LM3533) += lm3533-core.o lm3533-ctrlbank.o
164-
obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-sysreg.o
164+
obj-$(CONFIG_MFD_VEXPRESS_SYSREG) += vexpress-sysreg.o
165165
obj-$(CONFIG_MFD_RETU) += retu-mfd.o
166166
obj-$(CONFIG_MFD_AS3711) += as3711.o
167167
obj-$(CONFIG_MFD_AS3722) += as3722.o

0 commit comments

Comments
 (0)