Skip to contentSkip to conversation

pinctrl-rockchip: Change wrong initial assumptions

PATCH New Heiko Stübner 3 participants 12 messages May 5, 2014 – May 9, 2014

Subsystems (3)
lore
Share & tools
lore

Heiko Stübner

author maintainer
#0 lore raw

v2 cover pinctrl-rockchip: Change wrong initial assumptions

Initially due to lack of documentation and (personal) understanding I assumed that the area holding the iomux settings would be separate from everything else, while in fact the grf registers contain not only pinctrl stuff but also dma, usb-phy and general soc-status settings. Also things like drive-strength we do not support currently are intermixed.

The same is true for the pmu, which does not only contain power domains but also the system reset as well as well as general registers surviving system-resets. Additionally the rk3188 moved parts of the pull-setting registers into the pmu space.

While this wasn't a problem until now, the upcoming rk3288 introduces additional changes to both the grf and pmu areas. On it even part of the pinmux registers move into the pmu space.

The code in it's current form supports both the old as well as the changed bindings.

As stated in the v1 thread, this is also a first step to deprecate the wrongly included gpio-controllers which now duplicate the recently added gpio-dwapb, that should be used instead.

changes since v1:
- add select MFD_SYSCON as suggested by Max

Heiko Stuebner (8):
pinctrl: rockchip: do not require 2nd register area
pinctrl: rockchip: use regmaps instead of raw mappings
pinctrl: rockchip: rockchip_pinctrl in rockchip_get_bank_data
pinctrl: rockchip: let pmu registers be supplied by a syscon
pinctrl: rockchip: only map bank0-pull-region when pmu regmap missing
pinctrl: rockchip: base regmap supplied by a syscon
dt-bindings: adapt rockchip-pinctrl doc to changed bindings
ARM: dts: rockchip: convert pinctrl nodes to new bindings

 .../bindings/pinctrl/rockchip,pinctrl.txt          |  28 +++-
 arch/arm/boot/dts/rk3066a.dtsi                     |   2 +-
 arch/arm/boot/dts/rk3188.dtsi                      |   9 +-
 arch/arm/boot/dts/rk3xxx.dtsi                      |   9 +-
 drivers/pinctrl/Kconfig                            |   1 +
 drivers/pinctrl/pinctrl-rockchip.c                 | 178 +++++++++++++++------
 6 files changed, 165 insertions(+), 62 deletions(-)
Signature · 1 line
1.9.0
author maintainer
#1 lore raw

PATCH v2 1/8 pinctrl: rockchip: do not require 2nd register area

Deprecate secondary register area for rk3188 pulls. Instead use big enough initial mapping of grf registers to catch all.

The now deprecated register is still supported though.

---
 .../devicetree/bindings/pinctrl/rockchip,pinctrl.txt      |  2 ++
 drivers/pinctrl/pinctrl-rockchip.c                        | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt +2 -0
index f378d34..78dafc9 100644
@@ -22,6 +22,8 @@ Required properties for iomux controller:
   - compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl"
 		       "rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl"
   - reg: first element is the general register space of the iomux controller
+	 It should be large enough to contain also separate pull registers.
+	 Deprecated:
 	 second element is the separate pull register space of the rk3188
 
 Required properties for gpio sub nodes:
drivers/pinctrl/pinctrl-rockchip.c +12 -3
index 2e198a4..ab71de8 100644
@@ -160,6 +160,7 @@ struct rockchip_pmx_func {
 
 struct rockchip_pinctrl {
 	void __iomem			*reg_base;
+	int				reg_size;
 	void __iomem			*reg_pull;
 	struct device			*dev;
 	struct rockchip_pin_ctrl	*ctrl;
@@ -416,6 +417,7 @@ static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
 	*bit = pin_num % RK2928_PULL_PINS_PER_REG;
 };
 
+#define RK3188_PULL_OFFSET		0x164
 #define RK3188_PULL_BITS_PER_PIN	2
 #define RK3188_PULL_PINS_PER_REG	8
 #define RK3188_PULL_BANK_STRIDE		16
@@ -432,7 +434,10 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
 		*bit = pin_num % RK3188_PULL_PINS_PER_REG;
 		*bit *= RK3188_PULL_BITS_PER_PIN;
 	} else {
-		*reg = info->reg_pull - 4;
+		*reg = info->reg_pull ? info->reg_pull
+				      : info->reg_base + RK3188_PULL_OFFSET;
+		/* correct the offset, as it is the 2nd pull register */
+		*reg -= 4;
 		*reg += bank->bank_num * RK3188_PULL_BANK_STRIDE;
 		*reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
 
@@ -1427,6 +1432,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
 	 */
 	if (of_device_is_compatible(bank->of_node,
 				    "rockchip,rk3188-gpio-bank0")) {
+
 		bank->bank_type = RK3188_BANK0;
 
 		if (of_address_to_resource(bank->of_node, 1, &res)) {
@@ -1525,8 +1531,11 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	if (IS_ERR(info->reg_base))
 		return PTR_ERR(info->reg_base);
 
-	/* The RK3188 has its pull registers in a separate place */
-	if (ctrl->type == RK3188) {
+	/* to check for the old dt-bindings */
+	info->reg_size = resource_size(res);
+
+	/* Honor the old binding, with pull registers as 2nd resource */
+	if (ctrl->type == RK3188 &&  info->reg_size < 0x200) {
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 		info->reg_pull = devm_ioremap_resource(&pdev->dev, res);
 		if (IS_ERR(info->reg_pull))
Signature · 1 line
1.9.0
author maintainer
#2 lore raw

PATCH v2 2/8 pinctrl: rockchip: use regmaps instead of raw mappings

In reply to Heiko Stübner

This allows us to use syscons in the future.

---
 drivers/pinctrl/Kconfig            |   1 +
 drivers/pinctrl/pinctrl-rockchip.c | 116 +++++++++++++++++++++++++------------
 2 files changed, 81 insertions(+), 36 deletions(-)
drivers/pinctrl/Kconfig +1 -0
index 934fd89..96ca6c1 100644
@@ -275,6 +275,7 @@ config PINCTRL_ROCKCHIP
 	select PINMUX
 	select GENERIC_PINCONF
 	select GENERIC_IRQ_CHIP
+	select MFD_SYSCON
 
 config PINCTRL_SINGLE
 	tristate "One-register-per-pin type device tree based pinctrl driver"
drivers/pinctrl/pinctrl-rockchip.c +80 -36

285 lines not on this page · raw message

Signature · 1 line
1.9.0
author maintainer
#3 lore raw

PATCH v2 3/8 pinctrl: rockchip: rockchip_pinctrl in rockchip_get_bank_data

In reply to Heiko Stübner

Convert rockchip_get_bank_data to use the struct rockchip_pinctrl because later on we need to check a value from it when registering the gpio banks.

---
 drivers/pinctrl/pinctrl-rockchip.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +9 -8
index 71d9c99..b67771d 100644
@@ -1440,17 +1440,17 @@ static int rockchip_gpiolib_unregister(struct platform_device *pdev,
 }
 
 static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
-				  struct device *dev)
+				  struct rockchip_pinctrl *info)
 {
 	struct resource res;
 	void __iomem *base;
 
 	if (of_address_to_resource(bank->of_node, 0, &res)) {
-		dev_err(dev, "cannot find IO resource for bank\n");
+		dev_err(info->dev, "cannot find IO resource for bank\n");
 		return -ENOENT;
 	}
 
-	bank->reg_base = devm_ioremap_resource(dev, &res);
+	bank->reg_base = devm_ioremap_resource(info->dev, &res);
 	if (IS_ERR(bank->reg_base))
 		return PTR_ERR(bank->reg_base);
 
@@ -1464,16 +1464,16 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
 		bank->bank_type = RK3188_BANK0;
 
 		if (of_address_to_resource(bank->of_node, 1, &res)) {
-			dev_err(dev, "cannot find IO resource for bank\n");
+			dev_err(info->dev, "cannot find IO resource for bank\n");
 			return -ENOENT;
 		}
 
-		base = devm_ioremap_resource(dev, &res);
+		base = devm_ioremap_resource(info->dev, &res);
 		if (IS_ERR(base))
 			return PTR_ERR(base);
 		rockchip_regmap_config.max_register = resource_size(&res) - 4;
 		rockchip_regmap_config.name = "rockchip,rk3188-gpio-bank0-pull";
-		bank->regmap_pull = devm_regmap_init_mmio(dev, base,
+		bank->regmap_pull = devm_regmap_init_mmio(info->dev, base,
 						  &rockchip_regmap_config);
 
 	} else {
@@ -1515,7 +1515,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
 			if (!strcmp(bank->name, np->name)) {
 				bank->of_node = np;
 
-				if (!rockchip_get_bank_data(bank, &pdev->dev))
+				if (!rockchip_get_bank_data(bank, d))
 					bank->valid = true;
 
 				break;
@@ -1552,13 +1552,14 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	if (!info)
 		return -ENOMEM;
 
+	info->dev = dev;
+
 	ctrl = rockchip_pinctrl_get_soc_data(info, pdev);
 	if (!ctrl) {
 		dev_err(dev, "driver data not available\n");
 		return -EINVAL;
 	}
 	info->ctrl = ctrl;
-	info->dev = dev;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap_resource(&pdev->dev, res);
Signature · 1 line
1.9.0
author maintainer
#4 lore raw

PATCH v2 4/8 pinctrl: rockchip: let pmu registers be supplied by a syscon

In reply to Heiko Stübner

Currently the pmu registers containing pin pull settings on the rk3188 are mapped locally when bank0 is instantiated. Add an alternative that can resolve the pmu from a syscon phandle.

---
 drivers/pinctrl/pinctrl-rockchip.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +15 -2
index b67771d..11ad643 100644
@@ -38,6 +38,7 @@
 #include <linux/irqchip/chained_irq.h>
 #include <linux/clk.h>
 #include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
 #include <dt-bindings/pinctrl/rockchip.h>
 
 #include "core.h"
@@ -164,6 +165,7 @@ struct rockchip_pinctrl {
 	struct regmap			*regmap_base;
 	int				reg_size;
 	struct regmap			*regmap_pull;
+	struct regmap			*regmap_pmu;
 	struct device			*dev;
 	struct rockchip_pin_ctrl	*ctrl;
 	struct pinctrl_desc		pctl;
@@ -438,6 +440,7 @@ static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
 #define RK3188_PULL_BITS_PER_PIN	2
 #define RK3188_PULL_PINS_PER_REG	8
 #define RK3188_PULL_BANK_STRIDE		16
+#define RK3188_PULL_PMU_OFFSET		0x64
 
 static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
 				    int pin_num, struct regmap **regmap,
@@ -447,8 +450,9 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
 
 	/* The first 12 pins of the first bank are located elsewhere */
 	if (bank->bank_type == RK3188_BANK0 && pin_num < 12) {
-		*regmap = bank->regmap_pull;
-		*reg = 0;
+		*regmap = info->regmap_pmu ? info->regmap_pmu
+					   : bank->regmap_pull;
+		*reg = info->regmap_pmu ? RK3188_PULL_PMU_OFFSET : 0;
 		*reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
 		*bit = pin_num % RK3188_PULL_PINS_PER_REG;
 		*bit *= RK3188_PULL_BITS_PER_PIN;
@@ -1539,6 +1543,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	struct rockchip_pinctrl *info;
 	struct device *dev = &pdev->dev;
 	struct rockchip_pin_ctrl *ctrl;
+	struct device_node *np = pdev->dev.of_node, *node;
 	struct resource *res;
 	void __iomem *base;
 	int ret;
@@ -1587,6 +1592,14 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 						  &rockchip_regmap_config);
 	}
 
+	/* try to find the optional reference to the pmu syscon */
+	node = of_parse_phandle(np, "rockchip,pmu", 0);
+	if (node) {
+		info->regmap_pmu = syscon_node_to_regmap(node);
+		if (IS_ERR(info->regmap_pmu))
+			return PTR_ERR(info->regmap_pmu);
+	}
+
 	ret = rockchip_gpiolib_register(pdev, info);
 	if (ret)
 		return ret;
Signature · 1 line
1.9.0
author maintainer
#5 lore raw

PATCH v2 5/8 pinctrl: rockchip: only map bank0-pull-region when pmu regmap missing

In reply to Heiko Stübner

When the pmu registers are supplied through a syscon regmap we do not need to map the registers ourself.

---
 drivers/pinctrl/pinctrl-rockchip.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +19 -11
index 11ad643..d6e2401 100644
@@ -1464,21 +1464,29 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
 	 */
 	if (of_device_is_compatible(bank->of_node,
 				    "rockchip,rk3188-gpio-bank0")) {
+		struct device_node *node;
 
 		bank->bank_type = RK3188_BANK0;
 
-		if (of_address_to_resource(bank->of_node, 1, &res)) {
-			dev_err(info->dev, "cannot find IO resource for bank\n");
-			return -ENOENT;
-		}
+		node = of_parse_phandle(bank->of_node->parent,
+					"rockchip,pmu", 0);
+		if (!node) {
+			if (of_address_to_resource(bank->of_node, 1, &res)) {
+				dev_err(info->dev, "cannot find IO resource for bank\n");
+				return -ENOENT;
+			}
 
-		base = devm_ioremap_resource(info->dev, &res);
-		if (IS_ERR(base))
-			return PTR_ERR(base);
-		rockchip_regmap_config.max_register = resource_size(&res) - 4;
-		rockchip_regmap_config.name = "rockchip,rk3188-gpio-bank0-pull";
-		bank->regmap_pull = devm_regmap_init_mmio(info->dev, base,
-						  &rockchip_regmap_config);
+			base = devm_ioremap_resource(info->dev, &res);
+			if (IS_ERR(base))
+				return PTR_ERR(base);
+			rockchip_regmap_config.max_register =
+						    resource_size(&res) - 4;
+			rockchip_regmap_config.name =
+					    "rockchip,rk3188-gpio-bank0-pull";
+			bank->regmap_pull = devm_regmap_init_mmio(info->dev,
+						    base,
+						    &rockchip_regmap_config);
+		}
 
 	} else {
 		bank->bank_type = COMMON_BANK;
Signature · 1 line
1.9.0
author maintainer
#6 lore raw

PATCH v2 6/8 pinctrl: rockchip: base regmap supplied by a syscon

In reply to Heiko Stübner

This allows the basic registers of the general register files to be supplied by a syscon instead of being mapped locally.

The GRF registers contain a lot more than pinctrl functions like dma, usb-phy and general soc control and status registers, intermixed with the iomux, pull and drive-strength registers.

---
 drivers/pinctrl/pinctrl-rockchip.c | 47 +++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 19 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +28 -19
index d6e2401..bb805d5 100644
@@ -1574,30 +1574,39 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	}
 	info->ctrl = ctrl;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(base))
-		return PTR_ERR(base);
-
-	rockchip_regmap_config.max_register = resource_size(res) - 4;
-	rockchip_regmap_config.name = "rockchip,pinctrl";
-	info->regmap_base = devm_regmap_init_mmio(&pdev->dev, base,
-						  &rockchip_regmap_config);
-
-	/* to check for the old dt-bindings */
-	info->reg_size = resource_size(res);
-
-	/* Honor the old binding, with pull registers as 2nd resource */
-	if (ctrl->type == RK3188 && info->reg_size < 0x200) {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	node = of_parse_phandle(np, "rockchip,grf", 0);
+	if (node) {
+		info->regmap_base = syscon_node_to_regmap(node);
+		if (IS_ERR(info->regmap_base))
+			return PTR_ERR(info->regmap_base);
+	} else {
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		base = devm_ioremap_resource(&pdev->dev, res);
 		if (IS_ERR(base))
 			return PTR_ERR(base);
 
 		rockchip_regmap_config.max_register = resource_size(res) - 4;
-		rockchip_regmap_config.name = "rockchip,pinctrl-pull";
-		info->regmap_pull = devm_regmap_init_mmio(&pdev->dev, base,
-						  &rockchip_regmap_config);
+		rockchip_regmap_config.name = "rockchip,pinctrl";
+		info->regmap_base = devm_regmap_init_mmio(&pdev->dev, base,
+						    &rockchip_regmap_config);
+
+		/* to check for the old dt-bindings */
+		info->reg_size = resource_size(res);
+
+		/* Honor the old binding, with pull registers as 2nd resource */
+		if (ctrl->type == RK3188 && info->reg_size < 0x200) {
+			res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+			base = devm_ioremap_resource(&pdev->dev, res);
+			if (IS_ERR(base))
+				return PTR_ERR(base);
+
+			rockchip_regmap_config.max_register =
+							resource_size(res) - 4;
+			rockchip_regmap_config.name = "rockchip,pinctrl-pull";
+			info->regmap_pull = devm_regmap_init_mmio(&pdev->dev,
+						    base,
+						    &rockchip_regmap_config);
+		}
 	}
 
 	/* try to find the optional reference to the pmu syscon */
Signature · 1 line
1.9.0
author maintainer
#7 lore raw

PATCH v2 7/8 dt-bindings: adapt rockchip-pinctrl doc to changed bindings

In reply to Heiko Stübner

Introduce the syscons for grf and pmu and deprecate the previous register areas.

---
 .../bindings/pinctrl/rockchip,pinctrl.txt          | 28 +++++++++++++++-------
 1 file changed, 20 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt +20 -8
index 78dafc9..cefef74 100644
@@ -21,15 +21,23 @@ defined as gpio sub-nodes of the pinmux controller.
 Required properties for iomux controller:
   - compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl"
 		       "rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl"
+  - rockchip,grf: phandle referencing a syscon providing the
+	 "general register files"
+
+Optional properties for iomux controller:
+  - rockchip,pmu: phandle referencing a syscon providing the pmu registers
+	 as some SoCs carry parts of the iomux controller registers there.
+	 Required for at least rk3188 and rk3288.
+
+Deprecated properties for iomux controller:
   - reg: first element is the general register space of the iomux controller
 	 It should be large enough to contain also separate pull registers.
-	 Deprecated:
-	 second element is the separate pull register space of the rk3188
+	 second element is the separate pull register space of the rk3188.
+	 Use rockchip,grf and rockchip,pmu described above instead.
 
 Required properties for gpio sub nodes:
   - compatible: "rockchip,gpio-bank", "rockchip,rk3188-gpio-bank0"
   - reg: register of the gpio bank (different than the iomux registerset)
-         second element: separate pull register for rk3188 bank0
   - interrupts: base interrupt of the gpio bank in the interrupt controller
   - clocks: clock that drives this bank
   - gpio-controller: identifies the node as a gpio controller and pin bank.
@@ -41,6 +49,10 @@ Required properties for gpio sub nodes:
     cells should use the standard two-cell scheme described in
     bindings/interrupt-controller/interrupts.txt
 
+Deprecated properties for gpio sub nodes:
+  - reg: second element: separate pull register for rk3188 bank0, use
+	 rockchip,pmu described above instead
+
 Required properties for pin configuration node:
   - rockchip,pins: 3 integers array, represents a group of pins mux and config
     setting. The format is rockchip,pins = <PIN_BANK PIN_BANK_IDX MUX &phandle>.
@@ -56,7 +68,8 @@ Examples:
 
 pinctrl at 20008000 {
 	compatible = "rockchip,rk3066a-pinctrl";
-	reg = <0x20008000 0x150>;
+	rockchip,grf = <&grf>;
+
 	#address-cells = <1>;
 	#size-cells = <1>;
 	ranges;
@@ -105,16 +118,15 @@ Example for rk3188:
 
 	pinctrl at 20008000 {
 		compatible = "rockchip,rk3188-pinctrl";
-		reg = <0x20008000 0xa0>,
-		      <0x20008164 0x1a0>;
+		rockchip,grf = <&grf>;
+		rockchip,pmu = <&pmu>;
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges;
 
 		gpio0: gpio0 at 0x2000a000 {
 			compatible = "rockchip,rk3188-gpio-bank0";
-			reg = <0x2000a000 0x100>,
-			      <0x20004064 0x8>;
+			reg = <0x2000a000 0x100>;
 			interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clk_gates8 9>;
 
Signature · 1 line
1.9.0
author maintainer
#8 lore raw

PATCH v2 8/8 ARM: dts: rockchip: convert pinctrl nodes to new bindings

In reply to Heiko Stübner

Introduce the grf syscon and convert the pinctrl drivers for rk3066 and rk3188 to use it, instead of mapping the grf registers themselfs.

---
 arch/arm/boot/dts/rk3066a.dtsi | 2 +-
 arch/arm/boot/dts/rk3188.dtsi  | 9 ++++-----
 arch/arm/boot/dts/rk3xxx.dtsi  | 9 +++++++--
 3 files changed, 12 insertions(+), 8 deletions(-)
arch/arm/boot/dts/rk3066a.dtsi +1 -1
index 4d4dfbb..048c5de 100644
@@ -79,7 +79,7 @@
 
 		pinctrl at 20008000 {
 			compatible = "rockchip,rk3066a-pinctrl";
-			reg = <0x20008000 0x150>;
+			rockchip,grf = <&grf>;
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges;
arch/arm/boot/dts/rk3188.dtsi +4 -5
index ed9a70a..a494fb0 100644
@@ -75,17 +75,16 @@
 
 		pinctrl at 20008000 {
 			compatible = "rockchip,rk3188-pinctrl";
-			reg = <0x20008000 0xa0>,
-			      <0x20008164 0x1a0>;
-			reg-names = "base", "pull";
+			rockchip,grf = <&grf>;
+			rockchip,pmu = <&pmu>;
+
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges;
 
 			gpio0: gpio0 at 0x2000a000 {
 				compatible = "rockchip,rk3188-gpio-bank0";
-				reg = <0x2000a000 0x100>,
-				      <0x20004064 0x8>;
+				reg = <0x2000a000 0x100>;
 				interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clk_gates8 9>;
 
arch/arm/boot/dts/rk3xxx.dtsi +7 -2
index 26e5a96..2adf1cc9e 100644
@@ -31,11 +31,16 @@
 			reg = <0x1013c000 0x100>;
 		};
 
-		pmu at 20004000 {
-			compatible = "rockchip,rk3066-pmu";
+		pmu: pmu at 20004000 {
+			compatible = "rockchip,rk3066-pmu", "syscon";
 			reg = <0x20004000 0x100>;
 		};
 
+		grf: grf at 20008000 {
+			compatible = "syscon";
+			reg = <0x20008000 0x200>;
+		};
+
 		gic: interrupt-controller at 1013d000 {
 			compatible = "arm,cortex-a9-gic";
 			interrupt-controller;
Signature · 1 line
1.9.0
#9 lore raw

PATCH v2 8/8 ARM: dts: rockchip: convert pinctrl nodes to new bindings

Quoted 5 lines · Heiko St?bner

Introduce the grf syscon and convert the pinctrl drivers for rk3066 and rk3188 to use it, instead of mapping the grf registers themselfs.

Please funnel this through the ARM SoC tree with the rest of the Rockchip changes for v3.16. (I'll take patches 1-7.)

Yours,
Linus Walleij

#10 lore raw

v2 cover pinctrl-rockchip: Change wrong initial assumptions

In reply to Heiko Stübner

Am Montag, 5. Mai 2014, 13:57:31 schrieb Heiko St?bner:

Quoted 36 lines

Initially due to lack of documentation and (personal) understanding I assumed that the area holding the iomux settings would be separate from everything else, while in fact the grf registers contain not only pinctrl stuff but also dma, usb-phy and general soc-status settings. Also things like drive-strength we do not support currently are intermixed.

The same is true for the pmu, which does not only contain power domains but also the system reset as well as well as general registers surviving system-resets. Additionally the rk3188 moved parts of the pull-setting registers into the pmu space.

While this wasn't a problem until now, the upcoming rk3288 introduces additional changes to both the grf and pmu areas. On it even part of the pinmux registers move into the pmu space.

The code in it's current form supports both the old as well as the changed bindings.

As stated in the v1 thread, this is also a first step to deprecate the wrongly included gpio-controllers which now duplicate the recently added gpio-dwapb, that should be used instead.

changes since v1:
- add select MFD_SYSCON as suggested by Max

Heiko Stuebner (8):
pinctrl: rockchip: do not require 2nd register area
pinctrl: rockchip: use regmaps instead of raw mappings
pinctrl: rockchip: rockchip_pinctrl in rockchip_get_bank_data
pinctrl: rockchip: let pmu registers be supplied by a syscon
pinctrl: rockchip: only map bank0-pull-region when pmu regmap missing
pinctrl: rockchip: base regmap supplied by a syscon
dt-bindings: adapt rockchip-pinctrl doc to changed bindings
ARM: dts: rockchip: convert pinctrl nodes to new bindings

Quoted 7 lines
 .../bindings/pinctrl/rockchip,pinctrl.txt          |  28 +++-
 arch/arm/boot/dts/rk3066a.dtsi                     |   2 +-
 arch/arm/boot/dts/rk3188.dtsi                      |   9 +-
 arch/arm/boot/dts/rk3xxx.dtsi                      |   9 +-
 drivers/pinctrl/Kconfig                            |   1 +
 drivers/pinctrl/pinctrl-rockchip.c                 | 178

+++++++++++++++------ 6 files changed, 165 insertions(+), 62 deletions(-)

This series

Cheers,
Max

#11 lore raw

v2 cover pinctrl-rockchip: Change wrong initial assumptions

In reply to Heiko Stübner
Quoted 15 lines · Heiko St?bner

Initially due to lack of documentation and (personal) understanding I assumed that the area holding the iomux settings would be separate from everything else, while in fact the grf registers contain not only pinctrl stuff but also dma, usb-phy and general soc-status settings. Also things like drive-strength we do not support currently are intermixed.

The same is true for the pmu, which does not only contain power domains but also the system reset as well as well as general registers surviving system-resets. Additionally the rk3188 moved parts of the pull-setting registers into the pmu space.

While this wasn't a problem until now, the upcoming rk3288 introduces additional changes to both the grf and pmu areas. On it even part of the pinmux registers move into the pmu space.

Quoted 6 lines

The code in it's current form supports both the old as well as the changed bindings.

As stated in the v1 thread, this is also a first step to deprecate the wrongly included gpio-controllers which now duplicate the recently added gpio-dwapb, that should be used instead.

Patched 1 thru 7 applied to the pin control tree.

We knew this would be a bumpy ride when the merging started so this is all expected.

Yours,
Linus Walleij