Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 974cc7b9 authored by Pawel Moll's avatar Pawel Moll
Browse files

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: default avatarPawel Moll <pawel.moll@arm.com>
Acked-by: default avatarLee Jones <lee.jones@linaro.org>
parent 29f9b6cf
Loading
Loading
Loading
Loading
+34 −2
Original line number Original line Diff line number Diff line
@@ -8,6 +8,8 @@ interrupt generation, MMC and NOR Flash control etc.
Required node properties:
Required node properties:
- compatible value : = "arm,vexpress,sysreg";
- compatible value : = "arm,vexpress,sysreg";
- reg : physical base address and the size of the registers window
- reg : physical base address and the size of the registers window

Deprecated properties, replaced by GPIO subnodes (see below):
- gpio-controller : specifies that the node is a GPIO controller
- gpio-controller : specifies that the node is a GPIO controller
- #gpio-cells : size of the GPIO specifier, should be 2:
- #gpio-cells : size of the GPIO specifier, should be 2:
  - first cell is the pseudo-GPIO line number:
  - first cell is the pseudo-GPIO line number:
@@ -16,14 +18,44 @@ Required node properties:
    2 - NOR FLASH WPn
    2 - NOR FLASH WPn
  - second cell can take standard GPIO flags (currently ignored).
  - second cell can take standard GPIO flags (currently ignored).


Control registers providing pseudo-GPIO lines must be represented
by subnodes, each of them requiring the following properties:
- compatible value : one of
			"arm,vexpress-sysreg,sys_led"
			"arm,vexpress-sysreg,sys_mci"
			"arm,vexpress-sysreg,sys_flash"
- gpio-controller : makes the node a GPIO controller
- #gpio-cells : size of the GPIO specifier, must be 2:
  - first cell is the function number:
    - for sys_led : 0..7 = LED 0..7
    - for sys_mci : 0 = MMC CARDIN, 1 = MMC WPROT
    - for sys_flash : 0 = NOR FLASH WPn
  - second cell can take standard GPIO flags (currently ignored).

Example:
Example:
	v2m_sysreg: sysreg@10000000 {
	v2m_sysreg: sysreg@10000000 {
 		compatible = "arm,vexpress-sysreg";
 		compatible = "arm,vexpress-sysreg";
 		reg = <0x10000000 0x1000>;
 		reg = <0x10000000 0x1000>;

		v2m_led_gpios: sys_led@08 {
			compatible = "arm,vexpress-sysreg,sys_led";
			gpio-controller;
			gpio-controller;
			#gpio-cells = <2>;
			#gpio-cells = <2>;
		};
		};


		v2m_mmc_gpios: sys_mci@48 {
			compatible = "arm,vexpress-sysreg,sys_mci";
			gpio-controller;
			#gpio-cells = <2>;
		};

		v2m_flash_gpios: sys_flash@4c {
			compatible = "arm,vexpress-sysreg,sys_flash";
			gpio-controller;
			#gpio-cells = <2>;
		};
 	};

This block also can also act a bridge to the platform's configuration
This block also can also act a bridge to the platform's configuration
bus via "system control" interface, addressing devices with site number,
bus via "system control" interface, addressing devices with site number,
position in the board stack, config controller, function and device
position in the board stack, config controller, function and device
+72 −4
Original line number Original line Diff line number Diff line
@@ -74,9 +74,25 @@
			v2m_sysreg: sysreg@010000 {
			v2m_sysreg: sysreg@010000 {
				compatible = "arm,vexpress-sysreg";
				compatible = "arm,vexpress-sysreg";
				reg = <0x010000 0x1000>;
				reg = <0x010000 0x1000>;

				v2m_led_gpios: sys_led@08 {
					compatible = "arm,vexpress-sysreg,sys_led";
					gpio-controller;
					#gpio-cells = <2>;
				};

				v2m_mmc_gpios: sys_mci@48 {
					compatible = "arm,vexpress-sysreg,sys_mci";
					gpio-controller;
					#gpio-cells = <2>;
				};

				v2m_flash_gpios: sys_flash@4c {
					compatible = "arm,vexpress-sysreg,sys_flash";
					gpio-controller;
					gpio-controller;
					#gpio-cells = <2>;
					#gpio-cells = <2>;
				};
				};
			};


			v2m_sysctl: sysctl@020000 {
			v2m_sysctl: sysctl@020000 {
				compatible = "arm,sp810", "arm,primecell";
				compatible = "arm,sp810", "arm,primecell";
@@ -113,8 +129,8 @@
				compatible = "arm,pl180", "arm,primecell";
				compatible = "arm,pl180", "arm,primecell";
				reg = <0x050000 0x1000>;
				reg = <0x050000 0x1000>;
				interrupts = <9 10>;
				interrupts = <9 10>;
				cd-gpios = <&v2m_sysreg 0 0>;
				cd-gpios = <&v2m_mmc_gpios 0 0>;
				wp-gpios = <&v2m_sysreg 1 0>;
				wp-gpios = <&v2m_mmc_gpios 1 0>;
				max-frequency = <12000000>;
				max-frequency = <12000000>;
				vmmc-supply = <&v2m_fixed_3v3>;
				vmmc-supply = <&v2m_fixed_3v3>;
				clocks = <&v2m_clk24mhz>, <&smbclk>;
				clocks = <&v2m_clk24mhz>, <&smbclk>;
@@ -265,6 +281,58 @@
			clock-output-names = "v2m:refclk32khz";
			clock-output-names = "v2m:refclk32khz";
		};
		};


		leds {
			compatible = "gpio-leds";

			user@1 {
				label = "v2m:green:user1";
				gpios = <&v2m_led_gpios 0 0>;
				linux,default-trigger = "heartbeat";
			};

			user@2 {
				label = "v2m:green:user2";
				gpios = <&v2m_led_gpios 1 0>;
				linux,default-trigger = "mmc0";
			};

			user@3 {
				label = "v2m:green:user3";
				gpios = <&v2m_led_gpios 2 0>;
				linux,default-trigger = "cpu0";
			};

			user@4 {
				label = "v2m:green:user4";
				gpios = <&v2m_led_gpios 3 0>;
				linux,default-trigger = "cpu1";
			};

			user@5 {
				label = "v2m:green:user5";
				gpios = <&v2m_led_gpios 4 0>;
				linux,default-trigger = "cpu2";
			};

			user@6 {
				label = "v2m:green:user6";
				gpios = <&v2m_led_gpios 5 0>;
				linux,default-trigger = "cpu3";
			};

			user@7 {
				label = "v2m:green:user7";
				gpios = <&v2m_led_gpios 6 0>;
				linux,default-trigger = "cpu4";
			};

			user@8 {
				label = "v2m:green:user8";
				gpios = <&v2m_led_gpios 7 0>;
				linux,default-trigger = "cpu5";
			};
		};

		mcc {
		mcc {
			compatible = "arm,vexpress,config-bus";
			compatible = "arm,vexpress,config-bus";
			arm,vexpress,config-bridge = <&v2m_sysreg>;
			arm,vexpress,config-bridge = <&v2m_sysreg>;
+72 −4
Original line number Original line Diff line number Diff line
@@ -73,9 +73,25 @@
			v2m_sysreg: sysreg@00000 {
			v2m_sysreg: sysreg@00000 {
				compatible = "arm,vexpress-sysreg";
				compatible = "arm,vexpress-sysreg";
				reg = <0x00000 0x1000>;
				reg = <0x00000 0x1000>;

				v2m_led_gpios: sys_led@08 {
					compatible = "arm,vexpress-sysreg,sys_led";
					gpio-controller;
					#gpio-cells = <2>;
				};

				v2m_mmc_gpios: sys_mci@48 {
					compatible = "arm,vexpress-sysreg,sys_mci";
					gpio-controller;
					#gpio-cells = <2>;
				};

				v2m_flash_gpios: sys_flash@4c {
					compatible = "arm,vexpress-sysreg,sys_flash";
					gpio-controller;
					gpio-controller;
					#gpio-cells = <2>;
					#gpio-cells = <2>;
				};
				};
			};


			v2m_sysctl: sysctl@01000 {
			v2m_sysctl: sysctl@01000 {
				compatible = "arm,sp810", "arm,primecell";
				compatible = "arm,sp810", "arm,primecell";
@@ -112,8 +128,8 @@
				compatible = "arm,pl180", "arm,primecell";
				compatible = "arm,pl180", "arm,primecell";
				reg = <0x05000 0x1000>;
				reg = <0x05000 0x1000>;
				interrupts = <9 10>;
				interrupts = <9 10>;
				cd-gpios = <&v2m_sysreg 0 0>;
				cd-gpios = <&v2m_mmc_gpios 0 0>;
				wp-gpios = <&v2m_sysreg 1 0>;
				wp-gpios = <&v2m_mmc_gpios 1 0>;
				max-frequency = <12000000>;
				max-frequency = <12000000>;
				vmmc-supply = <&v2m_fixed_3v3>;
				vmmc-supply = <&v2m_fixed_3v3>;
				clocks = <&v2m_clk24mhz>, <&smbclk>;
				clocks = <&v2m_clk24mhz>, <&smbclk>;
@@ -264,6 +280,58 @@
			clock-output-names = "v2m:refclk32khz";
			clock-output-names = "v2m:refclk32khz";
		};
		};


		leds {
			compatible = "gpio-leds";

			user@1 {
				label = "v2m:green:user1";
				gpios = <&v2m_led_gpios 0 0>;
				linux,default-trigger = "heartbeat";
			};

			user@2 {
				label = "v2m:green:user2";
				gpios = <&v2m_led_gpios 1 0>;
				linux,default-trigger = "mmc0";
			};

			user@3 {
				label = "v2m:green:user3";
				gpios = <&v2m_led_gpios 2 0>;
				linux,default-trigger = "cpu0";
			};

			user@4 {
				label = "v2m:green:user4";
				gpios = <&v2m_led_gpios 3 0>;
				linux,default-trigger = "cpu1";
			};

			user@5 {
				label = "v2m:green:user5";
				gpios = <&v2m_led_gpios 4 0>;
				linux,default-trigger = "cpu2";
			};

			user@6 {
				label = "v2m:green:user6";
				gpios = <&v2m_led_gpios 5 0>;
				linux,default-trigger = "cpu3";
			};

			user@7 {
				label = "v2m:green:user7";
				gpios = <&v2m_led_gpios 6 0>;
				linux,default-trigger = "cpu4";
			};

			user@8 {
				label = "v2m:green:user8";
				gpios = <&v2m_led_gpios 7 0>;
				linux,default-trigger = "cpu5";
			};
		};

		mcc {
		mcc {
			compatible = "arm,vexpress,config-bus";
			compatible = "arm,vexpress,config-bus";
			arm,vexpress,config-bridge = <&v2m_sysreg>;
			arm,vexpress,config-bridge = <&v2m_sysreg>;
+1 −1
Original line number Original line Diff line number Diff line
@@ -160,7 +160,7 @@ static void __init ct_ca9x4_init(void)
		amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource);
		amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource);


	platform_device_register(&pmu_device);
	platform_device_register(&pmu_device);
	vexpress_sysreg_config_device_register(&osc1_device);
	vexpress_syscfg_device_register(&osc1_device);
}
}


#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
+7 −8
Original line number Original line Diff line number Diff line
@@ -201,8 +201,9 @@ static struct platform_device v2m_cf_device = {


static struct mmci_platform_data v2m_mmci_data = {
static struct mmci_platform_data v2m_mmci_data = {
	.ocr_mask	= MMC_VDD_32_33|MMC_VDD_33_34,
	.ocr_mask	= MMC_VDD_32_33|MMC_VDD_33_34,
	.gpio_wp	= VEXPRESS_GPIO_MMC_WPROT,
	.status		= vexpress_get_mci_cardin,
	.gpio_cd	= VEXPRESS_GPIO_MMC_CARDIN,
	.gpio_cd	= -1,
	.gpio_wp	= -1,
};
};


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


	vexpress_sysreg_config_device_register(&v2m_muxfpga_device);
	vexpress_syscfg_device_register(&v2m_muxfpga_device);
	vexpress_sysreg_config_device_register(&v2m_shutdown_device);
	vexpress_syscfg_device_register(&v2m_shutdown_device);
	vexpress_sysreg_config_device_register(&v2m_reboot_device);
	vexpress_syscfg_device_register(&v2m_reboot_device);
	vexpress_sysreg_config_device_register(&v2m_dvimode_device);
	vexpress_syscfg_device_register(&v2m_dvimode_device);


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


	vexpress_sysreg_of_early_init();

	/* Confirm board type against DT property, if available */
	/* Confirm board type against DT property, if available */
	if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
	if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
		u32 hbi = vexpress_get_hbi(VEXPRESS_SITE_MASTER);
		u32 hbi = vexpress_get_hbi(VEXPRESS_SITE_MASTER);
Loading