Skip to contentSkip to conversation

pinctrl: aspeed: Fixes for g5, implement remaining pins

PATCH Superseded Andrew Jeffery 5 participants 24 messages Nov 2, 2016 – Nov 22, 2016

Subsystems (6)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover pinctrl: aspeed: Fixes for g5, implement remaining pins

Hi all,

This is v2 of the series implementing the remainder of the pinmux tables for the AST2400 and AST2500 SoCs. v1 of the series can be found here:

https://lkml.org/lkml/2016/9/27/309

The first patch, "pinctrl-aspeed-g5: Never set SCU90[6]", is another fix that should be applied for 4.9. Please let me know if I should send such patches separately, as the series otherwise targets 4.10.

v2 is based on 4.9-rc2 as requested in feedback on v1.

Cheers,

Andrew

Significant changes since v1:

* Fixes from v1 have been applied, so have been dropped for v2
* A new fix has appeared, "pinctrl-aspeed-g5: Never set SCU90[6]", as noted above
* New bindings documents for the SoC Display and LPC Host Controllers, driven by the patch "pinctrl: aspeed: Read and write bits in LPCHC and GFX controllers"
* The v1 patch "pinctrl: aspeed: Enable capture of off-SCU pinmux state" has been significantly reworked and is now titled "pinctrl: aspeed: Read and write bits in LPCHC and GFX controllers"

Andrew Jeffery (6):
pinctrl-aspeed-g5: Never set SCU90[6]
mfd: dt: Add bindings for the Aspeed SoC Display Controller (GFX)
mfd: dt: Add bindings for the Aspeed LPC Host Controller (LPCHC)
pinctrl: aspeed: Read and write bits in LPCHC and GFX controllers
pinctrl: aspeed-g4: Add mux configuration for all pins
pinctrl: aspeed-g5: Add mux configuration for all pins

 .../devicetree/bindings/mfd/aspeed-gfx.txt         |   17 +
 .../devicetree/bindings/mfd/aspeed-lpchc.txt       |   17 +
 .../devicetree/bindings/pinctrl/pinctrl-aspeed.txt |   86 +-
 drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c         | 1115 +++++++++++++-
 drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c         | 1514 +++++++++++++++++++-
 drivers/pinctrl/aspeed/pinctrl-aspeed.c            |   66 +-
 drivers/pinctrl/aspeed/pinctrl-aspeed.h            |   33 +-
 7 files changed, 2760 insertions(+), 88 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/6 pinctrl-aspeed-g5: Never set SCU90[6]

If a pin depending on bit 6 in SCU90 is requested for GPIO, the export will succeed but changes to the GPIO's value will not be accepted by the hardware. This is because the pinmux driver has misconfigured the SCU by writing 1 to the reserved bit.

The description of SCU90[6] from the datasheet is 'Reserved, must keep at value ?0?'. The fix is to switch pinmux from the bit-flipping macro to explicitly configuring the .enable and .disable values to zero.

The patch has been tested on an AST2500 EVB.

Fixes 56e57cb6c07f (pinctrl: Add pinctrl-aspeed-g5 driver)

---

This patch should be applied for 4.9.

 drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +1 -1
index c8c72e8259d3..87b46390b695 100644
@@ -26,7 +26,7 @@
 
 #define ASPEED_G5_NR_PINS 228
 
-#define COND1		SIG_DESC_BIT(SCU90, 6, 0)
+#define COND1		{ SCU90, BIT(6), 0, 0 }
 #define COND2		{ SCU94, GENMASK(1, 0), 0, 0 }
 
 #define B14 0
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 2/6 mfd: dt: Add bindings for the Aspeed SoC Display Controller (GFX)

In reply to Andrew Jeffery

The Aspeed SoC Display Controller is presented as a syscon device to arbitrate access by display and pinmux drivers. Video pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the Display Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt
Documentation/devicetree/bindings/mfd/aspeed-gfx.txt new file +17 -0
new file mode 100644
index 000000000000..aea5370efd97
@@ -0,0 +1,17 @@
+* Device tree bindings for Aspeed SoC Display Controller (GFX)
+
+The Aspeed SoC Display Controller primarily does as its name suggests, but also
+participates in pinmux requests on the g5 SoCs. It is therefore considered a
+syscon device.
+
+Required properties:
+- compatible:		"aspeed,ast2500-gfx", "syscon"
+- reg:			contains offset/length value of the GFX memory
+			region.
+
+Example:
+
+gfx: display at 1e6e6000 {
+	compatible = "aspeed,ast2500-gfx", "syscon";
+	reg = <0x1e6e6000 0x1000>;
+};
Signature · 1 line
2.7.4
#11 lore raw

PATCH v2 3/6 mfd: dt: Add bindings for the Aspeed LPC Host Controller (LPCHC)

In reply to Andrew Jeffery

The Aspeed LPC Host Controller is presented as a syscon device to arbitrate access by LPC and pinmux drivers. LPC pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the LPC Host Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +17 -0
new file mode 100644
index 000000000000..792651488c3d
@@ -0,0 +1,17 @@
+* Device tree bindings for the Aspeed LPC Host Controller (LPCHC)
+
+The LPCHC registers configure LPC behaviour between the BMC and the host
+system. The LPCHC also participates in pinmux requests on g5 SoCs and is
+therefore considered a syscon device.
+
+Required properties:
+- compatible:		"aspeed,ast2500-lpchc", "syscon"
+- reg:			contains offset/length value of the LPCHC memory
+			region.
+
+Example:
+
+lpchc: lpchc at 1e7890a0 {
+	compatible = "aspeed,ast2500-lpchc", "syscon";
+	reg = <0x1e7890a0 0xc4>;
+};
Signature · 1 line
2.7.4
#17 lore raw

PATCH v2 4/6 pinctrl: aspeed: Read and write bits in LPCHC and GFX controllers

In reply to Andrew Jeffery

The System Control Unit IP block in the Aspeed SoCs is typically where the pinmux configuration is found, but not always. A number of pins depend on state in one of LPC Host Control (LPCHC) or SoC Display Controller (GFX) IP blocks, so the Aspeed pinmux drivers should have the means to adjust these as necessary.

We use syscon to cast a regmap over the GFX and LPCHCR blocks, which is used as an arbitration layer between the relevant driver and the pinctrl subsystem. The regmaps are then exposed to the SoC-specific pinctrl drivers by phandles in the devicetree, and are selected during a mux request by querying a new 'ip' member in struct aspeed_sig_desc.

---
Since v1:

The change is now proactive: instead of reporting that we need to flip bits in controllers we can't access, the patch provides access via regmaps for the relevant controllers. The implementation also splits out the IP block ID into its own variable rather than packing the value into the upper bits of the reg member of struct aspeed_sig_desc. This drives some churn in the diff, but I've tried to minimise it.

 .../devicetree/bindings/pinctrl/pinctrl-aspeed.txt | 50 +++++++++++++---
 drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c         | 18 +++---
 drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c         | 39 ++++++++++---
 drivers/pinctrl/aspeed/pinctrl-aspeed.c            | 66 +++++++++++++---------
 drivers/pinctrl/aspeed/pinctrl-aspeed.h            | 32 ++++++++---
 5 files changed, 144 insertions(+), 61 deletions(-)
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +43 -7
index 2ad18c4ea55c..115b0cce6c1c 100644
@@ -4,12 +4,19 @@ Aspeed Pin Controllers
 The Aspeed SoCs vary in functionality inside a generation but have a common mux
 device register layout.
 
-Required properties:
-- compatible : Should be any one of the following:
-		"aspeed,ast2400-pinctrl"
-		"aspeed,g4-pinctrl"
-		"aspeed,ast2500-pinctrl"
-		"aspeed,g5-pinctrl"
+Required properties for g4:
+- compatible : 			Should be any one of the following:
+				"aspeed,ast2400-pinctrl"
+				"aspeed,g4-pinctrl"
+
+Required properties for g5:
+- compatible : 			Should be any one of the following:
+				"aspeed,ast2500-pinctrl"
+				"aspeed,g5-pinctrl"
+
+- aspeed,external-nodes:	A cell of phandles to external controller nodes:
+				0: compatible with "aspeed,ast2500-gfx", "syscon"
+				1: compatible with "aspeed,ast2500-lpchc", "syscon"
 
 The pin controller node should be a child of a syscon node with the required
 property:
@@ -47,7 +54,7 @@ RGMII1 RGMII2 RMII1 RMII2 SD1 SPI1 SPI1DEBUG SPI1PASSTHRU TIMER4 TIMER5 TIMER6
 TIMER7 TIMER8 VGABIOSROM
 
 
-Examples:
+g4 Example:
 
 syscon: scu at 1e6e2000 {
 	compatible = "syscon", "simple-mfd";
@@ -63,5 +70,34 @@ syscon: scu at 1e6e2000 {
 	};
 };
 
+g5 Example:
+
+apb {
+	gfx: display at 1e6e6000 {
+		compatible = "aspeed,ast2500-gfx", "syscon";
+		reg = <0x1e6e6000 0x1000>;
+	};
+
+	lpchc: lpchc at 1e7890a0 {
+		compatible = "aspeed,ast2500-lpchc", "syscon";
+		reg = <0x1e7890a0 0xc4>;
+	};
+
+	syscon: scu at 1e6e2000 {
+		compatible = "syscon", "simple-mfd";
+		reg = <0x1e6e2000 0x1a8>;
+
+		pinctrl: pinctrl {
+			compatible = "aspeed,g5-pinctrl";
+			aspeed,external-nodes = <&gfx, &lpchc>;
+
+			pinctrl_i2c3_default: i2c3_default {
+				function = "I2C3";
+				groups = "I2C3";
+			};
+		};
+	};
+};
+
 Please refer to pinctrl-bindings.txt in this directory for details of the
 common pinctrl bindings used by client devices.
drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +9 -9
index a21b071ff290..558bd102416c 100644
@@ -292,7 +292,7 @@ SSSF_PIN_DECL(U18, GPIOG7, FLWP, SIG_DESC_SET(SCU84, 7));
 #define UART6_DESC	SIG_DESC_SET(SCU90, 7)
 #define ROM16_DESC	SIG_DESC_SET(SCU90, 6)
 #define FLASH_WIDE	SIG_DESC_SET(HW_STRAP1, 4)
-#define BOOT_SRC_NOR	{ HW_STRAP1, GENMASK(1, 0), 0, 0 }
+#define BOOT_SRC_NOR	{ ASPEED_IP_SCU, HW_STRAP1, GENMASK(1, 0), 0, 0 }
 
 #define A8 56
 SIG_EXPR_DECL(ROMD8, ROM16, ROM16_DESC);
@@ -418,9 +418,9 @@ FUNC_GROUP_DECL(I2C8, G5, F3);
 #define U1 88
 SSSF_PIN_DECL(U1, GPIOL0, NCTS1, SIG_DESC_SET(SCU84, 16));
 
-#define VPI18_DESC	{ SCU90, GENMASK(5, 4), 1, 0 }
-#define VPI24_DESC	{ SCU90, GENMASK(5, 4), 2, 0 }
-#define VPI30_DESC	{ SCU90, GENMASK(5, 4), 3, 0 }
+#define VPI18_DESC	{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 1, 0 }
+#define VPI24_DESC	{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 2, 0 }
+#define VPI30_DESC	{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 3, 0 }
 
 #define T5 89
 #define T5_DESC         SIG_DESC_SET(SCU84, 17)
@@ -641,11 +641,11 @@ SSSF_PIN_DECL(Y22, GPIOR2, ROMCS3, SIG_DESC_SET(SCU88, 26));
 #define U19 139
 SSSF_PIN_DECL(U19, GPIOR3, ROMCS4, SIG_DESC_SET(SCU88, 27));
 
-#define VPOOFF0_DESC	{ SCU94, GENMASK(1, 0), 0, 0 }
-#define VPO12_DESC	{ SCU94, GENMASK(1, 0), 1, 0 }
-#define VPO24_DESC	{ SCU94, GENMASK(1, 0), 2, 0 }
-#define VPOOFF1_DESC	{ SCU94, GENMASK(1, 0), 3, 0 }
-#define VPO_OFF_12      { SCU94, 0x2, 0, 0 }
+#define VPOOFF0_DESC	{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 0, 0 }
+#define VPO12_DESC	{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 1, 0 }
+#define VPO24_DESC	{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 2, 0 }
+#define VPOOFF1_DESC	{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 3, 0 }
+#define VPO_OFF_12      { ASPEED_IP_SCU, SCU94, 0x2, 0, 0 }
 #define VPO_24_OFF      SIG_DESC_SET(SCU94, 1)
 
 #define V21 140
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +30 -9
index 87b46390b695..99c4fa9bf861 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
@@ -26,8 +27,8 @@
 
 #define ASPEED_G5_NR_PINS 228
 
-#define COND1		{ SCU90, BIT(6), 0, 0 }
-#define COND2		{ SCU94, GENMASK(1, 0), 0, 0 }
+#define COND1		{ ASPEED_IP_SCU, SCU90, BIT(6), 0, 0 }
+#define COND2		{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 0, 0 }
 
 #define B14 0
 SSSF_PIN_DECL(B14, GPIOA0, MAC1LINK, SIG_DESC_SET(SCU80, 0));
@@ -186,9 +187,12 @@ MS_PIN_DECL(C20, GPIOE1, NDCD3, GPIE0OUT);
 
 FUNC_GROUP_DECL(GPIE0, B20, C20);
 
-#define SPI1_DESC		{ HW_STRAP1, GENMASK(13, 12), 1, 0 }
-#define SPI1DEBUG_DESC		{ HW_STRAP1, GENMASK(13, 12), 2, 0 }
-#define SPI1PASSTHRU_DESC	{ HW_STRAP1, GENMASK(13, 12), 3, 0 }
+#define SPI1_DESC \
+	{ ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 1, 0 }
+#define SPI1DEBUG_DESC \
+	{ ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 2, 0 }
+#define SPI1PASSTHRU_DESC \
+	{ ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 3, 0 }
 
 #define C18 64
 SIG_EXPR_DECL(SYSCS, SPI1DEBUG, COND1, SPI1DEBUG_DESC);
@@ -325,10 +329,11 @@ SS_PIN_DECL(R1, GPIOK7, SDA8);
 
 FUNC_GROUP_DECL(I2C8, P2, R1);
 
-#define VPIOFF0_DESC    { SCU90, GENMASK(5, 4), 0, 0 }
-#define VPIOFF1_DESC    { SCU90, GENMASK(5, 4), 1, 0 }
-#define VPI24_DESC      { SCU90, GENMASK(5, 4), 2, 0 }
-#define VPIRSVD_DESC    { SCU90, GENMASK(5, 4), 3, 0 }
+#define VPIOFF0_DESC    { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 0, 0 }
+#define VPIOFF1_DESC    { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 1, 0 }
+#define VPI24_DESC      { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 2, 0 }
+#define VPIRSVD_DESC    { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 3, 0 }
+
 
 #define V2 104
 #define V2_DESC         SIG_DESC_SET(SCU88, 0)
@@ -848,10 +853,26 @@ static struct pinctrl_desc aspeed_g5_pinctrl_desc = {
 static int aspeed_g5_pinctrl_probe(struct platform_device *pdev)
 {
 	int i;
+	struct regmap **map;
+	struct device_node *node;
 
 	for (i = 0; i < ARRAY_SIZE(aspeed_g5_pins); i++)
 		aspeed_g5_pins[i].number = i;
 
+	map = &aspeed_g5_pinctrl_data.maps[ASPEED_IP_GFX];
+	node = of_parse_phandle(pdev->dev.of_node, "aspeed,external-nodes", 0);
+	*map = syscon_node_to_regmap(node);
+	of_node_put(node);
+	if (IS_ERR(*map))
+		return PTR_ERR(*map);
+
+	map = &aspeed_g5_pinctrl_data.maps[ASPEED_IP_LPCHC];
+	node = of_parse_phandle(pdev->dev.of_node, "aspeed,external-nodes", 1);
+	*map = syscon_node_to_regmap(node);
+	of_node_put(node);
+	if (IS_ERR(*map))
+		return PTR_ERR(*map);
+
 	return aspeed_pinctrl_probe(pdev, &aspeed_g5_pinctrl_desc,
 			&aspeed_g5_pinctrl_data);
 }
drivers/pinctrl/aspeed/pinctrl-aspeed.c +39 -27

198 lines not on this page · raw message

drivers/pinctrl/aspeed/pinctrl-aspeed.h +23 -9
index 3e72ef8c54bf..727728b86c07 100644
@@ -232,6 +232,11 @@
  * group.
  */
 
+#define ASPEED_IP_SCU	0
+#define ASPEED_IP_GFX	1
+#define ASPEED_IP_LPCHC	2
+#define ASPEED_NR_PINMUX_IPS	3
+
 /*
  * The "Multi-function Pins Mapping and Control" table in the SoC datasheet
  * references registers by the device/offset mnemonic. The register macros
@@ -261,7 +266,9 @@
   * A signal descriptor, which describes the register, bits and the
   * enable/disable values that should be compared or written.
   *
-  * @reg: The register offset from base in bytes
+  * @ip: The IP block identifier, used as an index into the regmap array in
+  *      struct aspeed_pinctrl_data
+  * @reg: The register offset with respect to the base address of the IP block
   * @mask: The mask to apply to the register. The lowest set bit of the mask is
   *        used to derive the shift value.
   * @enable: The value that enables the function. Value should be in the LSBs,
@@ -270,6 +277,7 @@
   *           LSBs, not at the position of the mask.
   */
 struct aspeed_sig_desc {
+	unsigned int ip;
 	unsigned int reg;
 	u32 mask;
 	u32 enable;
@@ -313,24 +321,30 @@ struct aspeed_pin_desc {
 
 /* Macro hell */
 
+#define SIG_DESC_IP_BIT(ip, reg, idx, val) \
+	{ ip, reg, BIT_MASK(idx), val, (((val) + 1) & 1) }
+
 /**
- * Short-hand macro for describing a configuration enabled by the state of one
- * bit. The disable value is derived.
+ * Short-hand macro for describing an SCU descriptor enabled by the state of
+ * one bit. The disable value is derived.
  *
  * @reg: The signal's associated register, offset from base
  * @idx: The signal's bit index in the register
  * @val: The value (0 or 1) that enables the function
  */
 #define SIG_DESC_BIT(reg, idx, val) \
-	{ reg, BIT_MASK(idx), val, (((val) + 1) & 1) }
+	SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, val)
+
+#define SIG_DESC_IP_SET(ip, reg, idx) SIG_DESC_IP_BIT(ip, reg, idx, 1)
 
 /**
- * A further short-hand macro describing a configuration enabled with a set bit.
+ * A further short-hand macro expanding to an SCU descriptor enabled by a set
+ * bit.
  *
- * @reg: The configuration's associated register, offset from base
- * @idx: The configuration's bit index in the register
+ * @reg: The register, offset from base
+ * @idx: The bit index in the register
  */
-#define SIG_DESC_SET(reg, idx) SIG_DESC_BIT(reg, idx, 1)
+#define SIG_DESC_SET(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 1)
 
 #define SIG_DESC_LIST_SYM(sig, func) sig_descs_ ## sig ## _ ## func
 #define SIG_DESC_LIST_DECL(sig, func, ...) \
@@ -500,7 +514,7 @@ struct aspeed_pin_desc {
 	MS_PIN_DECL_(pin, SIG_EXPR_LIST_PTR(gpio))
 
 struct aspeed_pinctrl_data {
-	struct regmap *map;
+	struct regmap *maps[ASPEED_NR_PINMUX_IPS];
 
 	const struct pinctrl_pin_desc *pins;
 	const unsigned int npins;
Signature · 1 line
2.7.4
#22 lore raw

PATCH v2 5/6 pinctrl: aspeed-g4: Add mux configuration for all pins

In reply to Andrew Jeffery

The patch introducing the g4 pinctrl driver implemented a smattering of pins to flesh out the implementation of the core and provide bare-bones support for some OpenPOWER platforms. Now, update the bindings document to reflect the complete functionality and implement the necessary pin configuration tables in the driver.

---
No significant change since v1.

 .../devicetree/bindings/pinctrl/pinctrl-aspeed.txt |   19 +-
 drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c         | 1097 +++++++++++++++++++-
 2 files changed, 1096 insertions(+), 20 deletions(-)
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +12 -7
index 115b0cce6c1c..f5c427d11337 100644
@@ -38,13 +38,18 @@ supported:
 
 aspeed,ast2400-pinctrl, aspeed,g4-pinctrl:
 
-ACPI BMCINT DDCCLK DDCDAT FLACK FLBUSY FLWP GPID0 GPIE0 GPIE2 GPIE4 GPIE6 I2C10
-I2C11 I2C12 I2C13 I2C3 I2C4 I2C5 I2C6 I2C7 I2C8 I2C9 LPCPD LPCPME LPCSMI MDIO1
-MDIO2 NCTS1 NCTS3 NCTS4 NDCD1 NDCD3 NDCD4 NDSR1 NDSR3 NDTR1 NDTR3 NRI1 NRI3
-NRI4 NRTS1 NRTS3 PWM0 PWM1 PWM2 PWM3 PWM4 PWM5 PWM6 PWM7 RGMII1 RMII1 ROM16
-ROM8 ROMCS1 ROMCS2 ROMCS3 ROMCS4 RXD1 RXD3 RXD4 SD1 SGPMI SIOPBI SIOPBO TIMER3
-TIMER5 TIMER6 TIMER7 TIMER8 TXD1 TXD3 TXD4 UART6 VGAHS VGAVS VPI18 VPI24 VPI30
-VPO12 VPO24
+ACPI ADC0 ADC1 ADC10 ADC11 ADC12 ADC13 ADC14 ADC15 ADC2 ADC3 ADC4 ADC5 ADC6
+ADC7 ADC8 ADC9 BMCINT DDCCLK DDCDAT EXTRST FLACK FLBUSY FLWP GPID GPID0 GPID2
+GPID4 GPID6 GPIE0 GPIE2 GPIE4 GPIE6 I2C10 I2C11 I2C12 I2C13 I2C14 I2C3 I2C4
+I2C5 I2C6 I2C7 I2C8 I2C9 LPCPD LPCPME LPCRST LPCSMI MAC1LINK MAC2LINK MDIO1
+MDIO2 NCTS1 NCTS2 NCTS3 NCTS4 NDCD1 NDCD2 NDCD3 NDCD4 NDSR1 NDSR2 NDSR3 NDSR4
+NDTR1 NDTR2 NDTR3 NDTR4 NDTS4 NRI1 NRI2 NRI3 NRI4 NRTS1 NRTS2 NRTS3 OSCCLK PWM0
+PWM1 PWM2 PWM3 PWM4 PWM5 PWM6 PWM7 RGMII1 RGMII2 RMII1 RMII2 ROM16 ROM8 ROMCS1
+ROMCS2 ROMCS3 ROMCS4 RXD1 RXD2 RXD3 RXD4 SALT1 SALT2 SALT3 SALT4 SD1 SD2 SGPMCK
+SGPMI SGPMLD SGPMO SGPSCK SGPSI0 SGPSI1 SGPSLD SIOONCTRL SIOPBI SIOPBO SIOPWREQ
+SIOPWRGD SIOS3 SIOS5 SIOSCI SPI1 SPI1DEBUG SPI1PASSTHRU SPICS1 TIMER3 TIMER4
+TIMER5 TIMER6 TIMER7 TIMER8 TXD1 TXD2 TXD3 TXD4 UART6 USBCKI VGABIOS_ROM VGAHS
+VGAVS VPI18 VPI24 VPI30 VPO12 VPO24 WDTRST1 WDTRST2
 
 aspeed,ast2500-pinctrl, aspeed,g5-pinctrl:
 
drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +1084 -13

1,440 lines not on this page · raw message

Signature · 1 line
2.7.4
#23 lore raw

PATCH v2 6/6 pinctrl: aspeed-g5: Add mux configuration for all pins

In reply to Andrew Jeffery

The patch introducing the g5 pinctrl driver implemented a smattering of pins to flesh out the implementation of the core and provide bare-bones support for some OpenPOWER platforms and the AST2500 evaluation board. Now, update the bindings document to reflect the complete functionality and implement the necessary pin configuration tables in the driver.

---
No significant change since v1.

 .../devicetree/bindings/pinctrl/pinctrl-aspeed.txt |   17 +-
 drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c         | 1475 +++++++++++++++++++-
 drivers/pinctrl/aspeed/pinctrl-aspeed.h            |    1 +
 3 files changed, 1486 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +13 -4
index f5c427d11337..f16be8fe6c76 100644
@@ -53,10 +53,19 @@ VGAVS VPI18 VPI24 VPI30 VPO12 VPO24 WDTRST1 WDTRST2
 
 aspeed,ast2500-pinctrl, aspeed,g5-pinctrl:
 
-GPID0 GPID2 GPIE0 I2C10 I2C11 I2C12 I2C13 I2C14 I2C3 I2C4 I2C5 I2C6 I2C7 I2C8
-I2C9 MAC1LINK MDIO1 MDIO2 OSCCLK PEWAKE PWM0 PWM1 PWM2 PWM3 PWM4 PWM5 PWM6 PWM7
-RGMII1 RGMII2 RMII1 RMII2 SD1 SPI1 SPI1DEBUG SPI1PASSTHRU TIMER4 TIMER5 TIMER6
-TIMER7 TIMER8 VGABIOSROM
+ACPI ADC0 ADC1 ADC10 ADC11 ADC12 ADC13 ADC14 ADC15 ADC2 ADC3 ADC4 ADC5 ADC6
+ADC7 ADC8 ADC9 BMCINT DDCCLK DDCDAT ESPI FWSPICS1 FWSPICS2 GPID0 GPID2 GPID4
+GPID6 GPIE0 GPIE2 GPIE4 GPIE6 I2C10 I2C11 I2C12 I2C13 I2C14 I2C3 I2C4 I2C5 I2C6
+I2C7 I2C8 I2C9 LAD0 LAD1 LAD2 LAD3 LCLK LFRAME LPCHC LPCPD LPCPLUS LPCPME
+LPCRST LPCSMI LSIRQ MAC1LINK MAC2LINK MDIO1 MDIO2 NCTS1 NCTS2 NCTS3 NCTS4 NDCD1
+NDCD2 NDCD3 NDCD4 NDSR1 NDSR2 NDSR3 NDSR4 NDTR1 NDTR2 NDTR3 NDTR4 NRI1 NRI2
+NRI3 NRI4 NRTS1 NRTS2 NRTS3 NRTS4 OSCCLK PEWAKE PNOR PWM0 PWM1 PWM2 PWM3 PWM4
+PWM5 PWM6 PWM7 RGMII1 RGMII2 RMII1 RMII2 RXD1 RXD2 RXD3 RXD4 SALT1 SALT10
+SALT11 SALT12 SALT13 SALT14 SALT2 SALT3 SALT4 SALT5 SALT6 SALT7 SALT8 SALT9
+SCL1 SCL2 SD1 SD2 SDA1 SDA2 SGPS1 SGPS2 SIOONCTRL SIOPBI SIOPBO SIOPWREQ
+SIOPWRGD SIOS3 SIOS5 SIOSCI SPI1 SPI1CS1 SPI1DEBUG SPI1PASSTHRU SPI2CK SPI2CS0
+SPI2CS1 SPI2MISO SPI2MOSI TIMER3 TIMER4 TIMER5 TIMER6 TIMER7 TIMER8 TXD1 TXD2
+TXD3 TXD4 UART6 USBCKI VGABIOSROM VGAHS VGAVS VPI24 VPO WDTRST1 WDTRST2
 
 
 g4 Example:
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +1472 -3

1,700 lines not on this page · raw message

drivers/pinctrl/aspeed/pinctrl-aspeed.h +1 -0
index 727728b86c07..f0dad016c9fd 100644
@@ -260,6 +260,7 @@
 #define SCUA0           0xA0 /* Multi-function Pin Control #7 */
 #define SCUA4           0xA4 /* Multi-function Pin Control #8 */
 #define SCUA8           0xA8 /* Multi-function Pin Control #9 */
+#define SCUAC           0xAC /* Multi-function Pin Control #10 */
 #define HW_STRAP2       0xD0 /* Strapping */
 
  /**
Signature · 1 line
2.7.4
maintainer Reviewed-by on v2 1/6
#2 lore raw

Re: [PATCH v2 1/6] pinctrl-aspeed-g5: Never set SCU90[6]

In reply to Andrew Jeffery
Quoted 9 lines · Andrew Jeffery

If a pin depending on bit 6 in SCU90 is requested for GPIO, the export will succeed but changes to the GPIO's value will not be accepted by the hardware. This is because the pinmux driver has misconfigured the SCU by writing 1 to the reserved bit.

The description of SCU90[6] from the datasheet is 'Reserved, must keep at value ?0?'. The fix is to switch pinmux from the bit-flipping macro to explicitly configuring the .enable and .disable values to zero.

Quoted 5 lines

The patch has been tested on an AST2500 EVB.

Fixes 56e57cb6c07f (pinctrl: Add pinctrl-aspeed-g5 driver)

And tested-by.

Quoted 1 line

This patch should be applied for 4.9.

In the future I think we should send fixes separately from the rest of the series, so it's clear to Linus where we expect patches to end up.

Perhaps Linus can share his preference with us?

Cheers,

Joel

Quoted 19 lines
 drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +1 -2
index c8c72e8259d3..87b46390b695 100644
@@ -26,7 +26,7 @@
 
 #define ASPEED_G5_NR_PINS 228
 
-#define COND1          SIG_DESC_BIT(SCU90, 6, 0)
+#define COND1          { SCU90, BIT(6), 0, 0 }
 #define COND2          { SCU94, GENMASK(1, 0), 0, 0 }
 
 #define B14 0
--

2.7.4

maintainer
#12 lore raw

Re: [PATCH v2 3/6] mfd: dt: Add bindings for the Aspeed LPC Host Controller (LPCHC)

In reply to Andrew Jeffery
Quoted 17 lines · Andrew Jeffery

The Aspeed LPC Host Controller is presented as a syscon device to arbitrate access by LPC and pinmux drivers. LPC pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the LPC Host Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +0 -0
new file mode 100644
index 000000000000..792651488c3d

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt line 1

Quoted 1 line
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +1 -0
@@ -0,0 +1,17 @@
+* Device tree bindings for the Aspeed LPC Host Controller (LPCHC)

I had to check the data sheet for that acronym. They call the registers LHC. I somewhat prefer that name, but if you're happy with it as-is then that's fine.

I assume this is not an issue on the g4/ast2400?

Quoted 5 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +5 -0
+
+The LPCHC registers configure LPC behaviour between the BMC and the host
+system. The LPCHC also participates in pinmux requests on g5 SoCs and is
+therefore considered a syscon device.
+

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +10 -0
+Required properties:
+- compatible:          "aspeed,ast2500-lpchc", "syscon"
+- reg:                 contains offset/length value of the LPCHC memory
+                       region.
+
+Example:
+
+lpchc: lpchc at 1e7890a0 {
+       compatible = "aspeed,ast2500-lpchc", "syscon";
+       reg = <0x1e7890a0 0xc4>;

Where's the 0xc4 come from? I can see 9 registers, which would mean the length should be 0x24?

Cheers,

Joel

maintainer
#18 lore raw

Re: [PATCH v2 4/6] pinctrl: aspeed: Read and write bits in LPCHC and GFX controllers

In reply to Andrew Jeffery
Quoted 6 lines · Andrew Jeffery

The System Control Unit IP block in the Aspeed SoCs is typically where the pinmux configuration is found, but not always. A number of pins depend on state in one of LPC Host Control (LPCHC) or SoC Display Controller (GFX) IP blocks, so the Aspeed pinmux drivers should have the means to adjust these as necessary.

Quoted 7 lines

We use syscon to cast a regmap over the GFX and LPCHCR blocks, which is used as an arbitration layer between the relevant driver and the pinctrl subsystem. The regmaps are then exposed to the SoC-specific pinctrl drivers by phandles in the devicetree, and are selected during a mux request by querying a new 'ip' member in struct aspeed_sig_desc.

I like this a lot more than the first go. Good work.

Some minor comments below.

Quoted 192 lines

---
Since v1:

The change is now proactive: instead of reporting that we need to flip bits in controllers we can't access, the patch provides access via regmaps for the relevant controllers. The implementation also splits out the IP block ID into its own variable rather than packing the value into the upper bits of the reg member of struct aspeed_sig_desc. This drives some churn in the diff, but I've tried to minimise it.

 .../devicetree/bindings/pinctrl/pinctrl-aspeed.txt | 50 +++++++++++++---
 drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c         | 18 +++---
 drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c         | 39 ++++++++++---
 drivers/pinctrl/aspeed/pinctrl-aspeed.c            | 66 +++++++++++++---------
 drivers/pinctrl/aspeed/pinctrl-aspeed.h            | 32 ++++++++---
 5 files changed, 144 insertions(+), 61 deletions(-)
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +43 -7
index 2ad18c4ea55c..115b0cce6c1c 100644
@@ -4,12 +4,19 @@ Aspeed Pin Controllers
 The Aspeed SoCs vary in functionality inside a generation but have a common mux
 device register layout.
 
-Required properties:
-- compatible : Should be any one of the following:
-               "aspeed,ast2400-pinctrl"
-               "aspeed,g4-pinctrl"
-               "aspeed,ast2500-pinctrl"
-               "aspeed,g5-pinctrl"
+Required properties for g4:
+- compatible :                         Should be any one of the following:
+                               "aspeed,ast2400-pinctrl"
+                               "aspeed,g4-pinctrl"
+
+Required properties for g5:
+- compatible :                         Should be any one of the following:
+                               "aspeed,ast2500-pinctrl"
+                               "aspeed,g5-pinctrl"
+
+- aspeed,external-nodes:       A cell of phandles to external controller nodes:
+                               0: compatible with "aspeed,ast2500-gfx", "syscon"
+                               1: compatible with "aspeed,ast2500-lpchc", "syscon"
 
 The pin controller node should be a child of a syscon node with the required
 property:
@@ -47,7 +54,7 @@ RGMII1 RGMII2 RMII1 RMII2 SD1 SPI1 SPI1DEBUG SPI1PASSTHRU TIMER4 TIMER5 TIMER6
 TIMER7 TIMER8 VGABIOSROM
 
 
-Examples:
+g4 Example:
 
 syscon: scu at 1e6e2000 {
        compatible = "syscon", "simple-mfd";
@@ -63,5 +70,34 @@ syscon: scu at 1e6e2000 {
        };
 };
 
+g5 Example:
+
+apb {
+       gfx: display at 1e6e6000 {
+               compatible = "aspeed,ast2500-gfx", "syscon";
+               reg = <0x1e6e6000 0x1000>;
+       };
+
+       lpchc: lpchc at 1e7890a0 {
+               compatible = "aspeed,ast2500-lpchc", "syscon";
+               reg = <0x1e7890a0 0xc4>;
+       };
+
+       syscon: scu at 1e6e2000 {
+               compatible = "syscon", "simple-mfd";
+               reg = <0x1e6e2000 0x1a8>;
+
+               pinctrl: pinctrl {
+                       compatible = "aspeed,g5-pinctrl";
+                       aspeed,external-nodes = <&gfx, &lpchc>;
+
+                       pinctrl_i2c3_default: i2c3_default {
+                               function = "I2C3";
+                               groups = "I2C3";
+                       };
+               };
+       };
+};
+
 Please refer to pinctrl-bindings.txt in this directory for details of the
 common pinctrl bindings used by client devices.
drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +9 -9
index a21b071ff290..558bd102416c 100644
@@ -292,7 +292,7 @@ SSSF_PIN_DECL(U18, GPIOG7, FLWP, SIG_DESC_SET(SCU84, 7));
 #define UART6_DESC     SIG_DESC_SET(SCU90, 7)
 #define ROM16_DESC     SIG_DESC_SET(SCU90, 6)
 #define FLASH_WIDE     SIG_DESC_SET(HW_STRAP1, 4)
-#define BOOT_SRC_NOR   { HW_STRAP1, GENMASK(1, 0), 0, 0 }
+#define BOOT_SRC_NOR   { ASPEED_IP_SCU, HW_STRAP1, GENMASK(1, 0), 0, 0 }
 
 #define A8 56
 SIG_EXPR_DECL(ROMD8, ROM16, ROM16_DESC);
@@ -418,9 +418,9 @@ FUNC_GROUP_DECL(I2C8, G5, F3);
 #define U1 88
 SSSF_PIN_DECL(U1, GPIOL0, NCTS1, SIG_DESC_SET(SCU84, 16));
 
-#define VPI18_DESC     { SCU90, GENMASK(5, 4), 1, 0 }
-#define VPI24_DESC     { SCU90, GENMASK(5, 4), 2, 0 }
-#define VPI30_DESC     { SCU90, GENMASK(5, 4), 3, 0 }
+#define VPI18_DESC     { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 1, 0 }
+#define VPI24_DESC     { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 2, 0 }
+#define VPI30_DESC     { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 3, 0 }
 
 #define T5 89
 #define T5_DESC         SIG_DESC_SET(SCU84, 17)
@@ -641,11 +641,11 @@ SSSF_PIN_DECL(Y22, GPIOR2, ROMCS3, SIG_DESC_SET(SCU88, 26));
 #define U19 139
 SSSF_PIN_DECL(U19, GPIOR3, ROMCS4, SIG_DESC_SET(SCU88, 27));
 
-#define VPOOFF0_DESC   { SCU94, GENMASK(1, 0), 0, 0 }
-#define VPO12_DESC     { SCU94, GENMASK(1, 0), 1, 0 }
-#define VPO24_DESC     { SCU94, GENMASK(1, 0), 2, 0 }
-#define VPOOFF1_DESC   { SCU94, GENMASK(1, 0), 3, 0 }
-#define VPO_OFF_12      { SCU94, 0x2, 0, 0 }
+#define VPOOFF0_DESC   { ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 0, 0 }
+#define VPO12_DESC     { ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 1, 0 }
+#define VPO24_DESC     { ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 2, 0 }
+#define VPOOFF1_DESC   { ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 3, 0 }
+#define VPO_OFF_12      { ASPEED_IP_SCU, SCU94, 0x2, 0, 0 }
 #define VPO_24_OFF      SIG_DESC_SET(SCU94, 1)
 
 #define V21 140
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +14 -9
index 87b46390b695..99c4fa9bf861 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
@@ -26,8 +27,8 @@
 
 #define ASPEED_G5_NR_PINS 228
 
-#define COND1          { SCU90, BIT(6), 0, 0 }
-#define COND2          { SCU94, GENMASK(1, 0), 0, 0 }
+#define COND1          { ASPEED_IP_SCU, SCU90, BIT(6), 0, 0 }
+#define COND2          { ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 0, 0 }
 
 #define B14 0
 SSSF_PIN_DECL(B14, GPIOA0, MAC1LINK, SIG_DESC_SET(SCU80, 0));
@@ -186,9 +187,12 @@ MS_PIN_DECL(C20, GPIOE1, NDCD3, GPIE0OUT);
 
 FUNC_GROUP_DECL(GPIE0, B20, C20);
 
-#define SPI1_DESC              { HW_STRAP1, GENMASK(13, 12), 1, 0 }
-#define SPI1DEBUG_DESC         { HW_STRAP1, GENMASK(13, 12), 2, 0 }
-#define SPI1PASSTHRU_DESC      { HW_STRAP1, GENMASK(13, 12), 3, 0 }
+#define SPI1_DESC \
+       { ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 1, 0 }
+#define SPI1DEBUG_DESC \
+       { ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 2, 0 }
+#define SPI1PASSTHRU_DESC \
+       { ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 3, 0 }
 
 #define C18 64
 SIG_EXPR_DECL(SYSCS, SPI1DEBUG, COND1, SPI1DEBUG_DESC);
@@ -325,10 +329,11 @@ SS_PIN_DECL(R1, GPIOK7, SDA8);
 
 FUNC_GROUP_DECL(I2C8, P2, R1);
 
-#define VPIOFF0_DESC    { SCU90, GENMASK(5, 4), 0, 0 }
-#define VPIOFF1_DESC    { SCU90, GENMASK(5, 4), 1, 0 }
-#define VPI24_DESC      { SCU90, GENMASK(5, 4), 2, 0 }
-#define VPIRSVD_DESC    { SCU90, GENMASK(5, 4), 3, 0 }
+#define VPIOFF0_DESC    { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 0, 0 }
+#define VPIOFF1_DESC    { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 1, 0 }
+#define VPI24_DESC      { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 2, 0 }
+#define VPIRSVD_DESC    { ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 3, 0 }
+
 
 #define V2 104
 #define V2_DESC         SIG_DESC_SET(SCU88, 0)
@@ -848,10 +853,26 @@ static struct pinctrl_desc aspeed_g5_pinctrl_desc = {
 static int aspeed_g5_pinctrl_probe(struct platform_device *pdev)
 {

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c static struct pinctrl_desc aspeed_g5_pinctrl_desc = { · line 864

Quoted 10 lines
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +5 -0
        int i;
+       struct regmap **map;
+       struct device_node *node;
 
        for (i = 0; i < ARRAY_SIZE(aspeed_g5_pins); i++)
                aspeed_g5_pins[i].number = i;
 
+       map = &aspeed_g5_pinctrl_data.maps[ASPEED_IP_GFX];
+       node = of_parse_phandle(pdev->dev.of_node, "aspeed,external-nodes", 0);
+       *map = syscon_node_to_regmap(node);

I think you can use syscon_regmap_lookup_by_phandle to replace both of these lines.

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c static struct pinctrl_desc aspeed_g5_pinctrl_desc = { · line 867

Quoted 3 lines
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +3 -0
+       of_node_put(node);
+       if (IS_ERR(*map))
+               return PTR_ERR(*map);

Do we want to fail, or warn and continue?

The sequence is a bit messy. How about:

struct regmap *map;

map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "aspeed,external-nodes");
if (IS_ERR(map))
return PTR_ERR(map);

aspeed_g5_pinctrl_data.maps[ASPEED_IP_GFX] = map;

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c static struct pinctrl_desc aspeed_g5_pinctrl_desc = { · line 875

Quoted 8 lines
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +8 -0
+
+       map = &aspeed_g5_pinctrl_data.maps[ASPEED_IP_LPCHC];
+       node = of_parse_phandle(pdev->dev.of_node, "aspeed,external-nodes", 1);
+       *map = syscon_node_to_regmap(node);
+       of_node_put(node);
+       if (IS_ERR(*map))
+               return PTR_ERR(*map);
+

Same comments as above.

Quoted 8 lines
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +0 -0
        return aspeed_pinctrl_probe(pdev, &aspeed_g5_pinctrl_desc,
                        &aspeed_g5_pinctrl_data);
 }
drivers/pinctrl/aspeed/pinctrl-aspeed.c +0 -0
index 49aeba912531..23586aac7a5a 100644

drivers/pinctrl/aspeed/pinctrl-aspeed.c line 20

Quoted 7 lines
drivers/pinctrl/aspeed/pinctrl-aspeed.c +4 -0
@@ -14,6 +14,12 @@
 #include "../core.h"
 #include "pinctrl-aspeed.h"
 
+static const char *const aspeed_pinmux_ips[] = {
+       [ASPEED_IP_SCU] = "SCU",
+       [ASPEED_IP_GFX] = "GFX",
+       [ASPEED_IP_LPCHC] = "LHCR",

We've got both LPCHC and LHCR here. As I said when commenting on the regmap bindings, I like LHC(R) better.

drivers/pinctrl/aspeed/pinctrl-aspeed.c int aspeed_pinmux_get_fn_groups(struct pinctrl_dev *pctldev, · line 85

Quoted 8 lines
drivers/pinctrl/aspeed/pinctrl-aspeed.c +2 -0
+};
+
 int aspeed_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
 {
        struct aspeed_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
@@ -78,7 +84,8 @@ int aspeed_pinmux_get_fn_groups(struct pinctrl_dev *pctldev,
 static inline void aspeed_sig_desc_print_val(
                const struct aspeed_sig_desc *desc, bool enable, u32 rv)

What's a rv? Perhaps "reg" or "value"?

Quoted 282 lines
drivers/pinctrl/aspeed/pinctrl-aspeed.c +33 -27
 {
-       pr_debug("SCU%x[0x%08x]=0x%x, got 0x%x from 0x%08x\n", desc->reg,
+       pr_debug("Want %s%X[0x%08X]=0x%X, got 0x%X from 0x%08X\n",
+                       aspeed_pinmux_ips[desc->ip], desc->reg,
                        desc->mask, enable ? desc->enable : desc->disable,
                        (rv & desc->mask) >> __ffs(desc->mask), rv);
 }
@@ -88,7 +95,7 @@ static inline void aspeed_sig_desc_print_val(
  *
  * @desc: The signal descriptor of interest
  * @enabled: True to query the enabled state, false to query disabled state
- * @regmap: The SCU regmap instance
+ * @regmap: The IP block's regmap instance
  *
  * @return True if the descriptor's bitfield is configured to the state
  * selected by @enabled, false otherwise
@@ -119,7 +126,7 @@ static bool aspeed_sig_desc_eval(const struct aspeed_sig_desc *desc,
  *
  * @expr: An expression controlling the signal for a mux function on a pin
  * @enabled: True to query the enabled state, false to query disabled state
- * @regmap: The SCU regmap instance
+ * @maps: The list of regmap instances
  *
  * @return True if the expression composed by @enabled evaluates true, false
  * otherwise
@@ -136,15 +143,16 @@ static bool aspeed_sig_desc_eval(const struct aspeed_sig_desc *desc,
  * either condition as required.
  */
 static bool aspeed_sig_expr_eval(const struct aspeed_sig_expr *expr,
-                                bool enabled, struct regmap *map)
+                                bool enabled, struct regmap * const *maps)
 {
        int i;
 
        for (i = 0; i < expr->ndescs; i++) {
                const struct aspeed_sig_desc *desc = &expr->descs[i];
 
-               if (!aspeed_sig_desc_eval(desc, enabled, map))
+               if (!aspeed_sig_desc_eval(desc, enabled, maps[desc->ip]))
                        return false;
+
        }
 
        return true;
@@ -158,12 +166,12 @@ static bool aspeed_sig_expr_eval(const struct aspeed_sig_expr *expr,
  *        configured
  * @enable: true to enable an function's signal through a pin's signal
  *          expression, false to disable the function's signal
- * @map: The SCU's regmap instance for pinmux register access.
+ * @maps: The list of regmap instances for pinmux register access.
  *
  * @return true if the expression is configured as requested, false otherwise
  */
 static bool aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
-                               bool enable, struct regmap *map)
+                               bool enable, struct regmap * const *maps)
 {
        int i;
 
@@ -171,6 +179,7 @@ static bool aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
                bool ret;
                const struct aspeed_sig_desc *desc = &expr->descs[i];
                u32 pattern = enable ? desc->enable : desc->disable;
+               u32 val = (pattern << __ffs(desc->mask));
 
                /*
                 * Strap registers are configured in hardware or by early-boot
@@ -179,48 +188,49 @@ static bool aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
                 * deconfigured and is the reason we re-evaluate after writing
                 * all descriptor bits.
                 */
-               if (desc->reg == HW_STRAP1 || desc->reg == HW_STRAP2)
+               if ((desc->reg == HW_STRAP1 || desc->reg == HW_STRAP2) &&
+                               desc->ip == ASPEED_IP_SCU)
                        continue;
 
-               ret = regmap_update_bits(map, desc->reg, desc->mask,
-                               pattern << __ffs(desc->mask)) == 0;
+               ret = regmap_update_bits(maps[desc->ip], desc->reg,
+                                        desc->mask, val) == 0;
 
                if (!ret)
                        return ret;
        }
 
-       return aspeed_sig_expr_eval(expr, enable, map);
+       return aspeed_sig_expr_eval(expr, enable, maps);
 }
 
 static bool aspeed_sig_expr_enable(const struct aspeed_sig_expr *expr,
-                                  struct regmap *map)
+                                  struct regmap * const *maps)
 {
-       if (aspeed_sig_expr_eval(expr, true, map))
+       if (aspeed_sig_expr_eval(expr, true, maps))
                return true;
 
-       return aspeed_sig_expr_set(expr, true, map);
+       return aspeed_sig_expr_set(expr, true, maps);
 }
 
 static bool aspeed_sig_expr_disable(const struct aspeed_sig_expr *expr,
-                                   struct regmap *map)
+                                   struct regmap * const *maps)
 {
-       if (!aspeed_sig_expr_eval(expr, true, map))
+       if (!aspeed_sig_expr_eval(expr, true, maps))
                return true;
 
-       return aspeed_sig_expr_set(expr, false, map);
+       return aspeed_sig_expr_set(expr, false, maps);
 }
 
 /**
  * Disable a signal on a pin by disabling all provided signal expressions.
  *
  * @exprs: The list of signal expressions (from a priority level on a pin)
- * @map: The SCU's regmap instance for pinmux register access.
+ * @maps: The list of regmap instances for pinmux register access.
  *
  * @return true if all expressions in the list are successfully disabled, false
  * otherwise
  */
 static bool aspeed_disable_sig(const struct aspeed_sig_expr **exprs,
-                              struct regmap *map)
+                              struct regmap * const *maps)
 {
        bool disabled = true;
 
@@ -230,7 +240,7 @@ static bool aspeed_disable_sig(const struct aspeed_sig_expr **exprs,
        while (*exprs) {
                bool ret;
 
-               ret = aspeed_sig_expr_disable(*exprs, map);
+               ret = aspeed_sig_expr_disable(*exprs, maps);
                disabled = disabled && ret;
 
                exprs++;
@@ -343,6 +353,8 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
                const struct aspeed_sig_expr **funcs;
                const struct aspeed_sig_expr ***prios;
 
+               pr_debug("Muxing pin %d for %s\n", pin, pfunc->name);
+
                if (!pdesc)
                        return -EINVAL;
 
@@ -358,7 +370,7 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
                        if (expr)
                                break;
 
-                       if (!aspeed_disable_sig(funcs, pdata->map))
+                       if (!aspeed_disable_sig(funcs, pdata->maps))
                                return -EPERM;
 
                        prios++;
@@ -377,7 +389,7 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
                        return -ENXIO;
                }
 
-               if (!aspeed_sig_expr_enable(expr, pdata->map))
+               if (!aspeed_sig_expr_enable(expr, pdata->maps))
                        return -EPERM;
        }
 
@@ -432,7 +444,7 @@ int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev,
                if (aspeed_gpio_in_exprs(funcs))
                        break;
 
-               if (!aspeed_disable_sig(funcs, pdata->map))
+               if (!aspeed_disable_sig(funcs, pdata->maps))
                        return -EPERM;
 
                prios++;
@@ -462,7 +474,7 @@ int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev,
         * If GPIO is not the lowest priority signal type, assume there is only
         * one expression defined to enable the GPIO function
         */
-       if (!aspeed_sig_expr_enable(expr, pdata->map))
+       if (!aspeed_sig_expr_enable(expr, pdata->maps))
                return -EPERM;
 
        return 0;
@@ -481,10 +493,10 @@ int aspeed_pinctrl_probe(struct platform_device *pdev,
                return -ENODEV;
        }
 
-       pdata->map = syscon_node_to_regmap(parent->of_node);
-       if (IS_ERR(pdata->map)) {
+       pdata->maps[ASPEED_IP_SCU] = syscon_node_to_regmap(parent->of_node);
+       if (IS_ERR(pdata->maps[ASPEED_IP_SCU])) {
                dev_err(&pdev->dev, "No regmap for syscon pincontroller parent\n");
-               return PTR_ERR(pdata->map);
+               return PTR_ERR(pdata->maps[ASPEED_IP_SCU]);
        }
 
        pctl = pinctrl_register(pdesc, &pdev->dev, pdata);
drivers/pinctrl/aspeed/pinctrl-aspeed.h +23 -10
index 3e72ef8c54bf..727728b86c07 100644
@@ -232,6 +232,11 @@
  * group.
  */
 
+#define ASPEED_IP_SCU  0
+#define ASPEED_IP_GFX  1
+#define ASPEED_IP_LPCHC        2
+#define ASPEED_NR_PINMUX_IPS   3
+
 /*
  * The "Multi-function Pins Mapping and Control" table in the SoC datasheet
  * references registers by the device/offset mnemonic. The register macros
@@ -261,7 +266,9 @@
   * A signal descriptor, which describes the register, bits and the
   * enable/disable values that should be compared or written.
   *
-  * @reg: The register offset from base in bytes
+  * @ip: The IP block identifier, used as an index into the regmap array in
+  *      struct aspeed_pinctrl_data
+  * @reg: The register offset with respect to the base address of the IP block
   * @mask: The mask to apply to the register. The lowest set bit of the mask is
   *        used to derive the shift value.
   * @enable: The value that enables the function. Value should be in the LSBs,
@@ -270,6 +277,7 @@
   *           LSBs, not at the position of the mask.
   */
 struct aspeed_sig_desc {
+       unsigned int ip;
        unsigned int reg;
        u32 mask;
        u32 enable;
@@ -313,24 +321,30 @@ struct aspeed_pin_desc {
 
 /* Macro hell */
 
+#define SIG_DESC_IP_BIT(ip, reg, idx, val) \
+       { ip, reg, BIT_MASK(idx), val, (((val) + 1) & 1) }
+
 /**
- * Short-hand macro for describing a configuration enabled by the state of one
- * bit. The disable value is derived.
+ * Short-hand macro for describing an SCU descriptor enabled by the state of
+ * one bit. The disable value is derived.
  *
  * @reg: The signal's associated register, offset from base
  * @idx: The signal's bit index in the register
  * @val: The value (0 or 1) that enables the function
  */
 #define SIG_DESC_BIT(reg, idx, val) \
-       { reg, BIT_MASK(idx), val, (((val) + 1) & 1) }
+       SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, val)
+
+#define SIG_DESC_IP_SET(ip, reg, idx) SIG_DESC_IP_BIT(ip, reg, idx, 1)
 
 /**
- * A further short-hand macro describing a configuration enabled with a set bit.
+ * A further short-hand macro expanding to an SCU descriptor enabled by a set
+ * bit.
  *
- * @reg: The configuration's associated register, offset from base
- * @idx: The configuration's bit index in the register
+ * @reg: The register, offset from base
+ * @idx: The bit index in the register
  */
-#define SIG_DESC_SET(reg, idx) SIG_DESC_BIT(reg, idx, 1)
+#define SIG_DESC_SET(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 1)
 
 #define SIG_DESC_LIST_SYM(sig, func) sig_descs_ ## sig ## _ ## func
 #define SIG_DESC_LIST_DECL(sig, func, ...) \
@@ -500,7 +514,7 @@ struct aspeed_pin_desc {
        MS_PIN_DECL_(pin, SIG_EXPR_LIST_PTR(gpio))
 
 struct aspeed_pinctrl_data {
-       struct regmap *map;
+       struct regmap *maps[ASPEED_NR_PINMUX_IPS];
 
        const struct pinctrl_pin_desc *pins;
        const unsigned int npins;
--

2.7.4

#13 lore raw

Re: [PATCH v2 3/6] mfd: dt: Add bindings for the Aspeed LPC Host Controller (LPCHC)

In reply to Joel Stanley
Quoted 13 lines · Joel Stanley
Quoted 12 lines · Andrew Jeffery

The Aspeed LPC Host Controller is presented as a syscon device to arbitrate access by LPC and pinmux drivers. LPC pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the LPC Host Controller.

---
?Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt | 17 +++++++++++++++++ ?1 file changed, 17 insertions(+)
?create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt

Quoted 10 lines

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt line 1

Quoted 7 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +1 -0
new file mode 100644
index 000000000000..792651488c3d
@@ -0,0 +1,17 @@
+* Device tree bindings for the Aspeed LPC Host Controller (LPCHC)

I had to check the data sheet for that acronym. They call the registers LHC. I somewhat prefer that name, but if you're happy with it as-is then that's fine.

I had an internal debate about this. I figured LPCHC might give a bit more context to the acronym. I'm not unhappy with it but I wouldn't claim I'm happy either. I will change it to LHC since you somewhat prefer it, and it better aligns with the datasheet.

Quoted 2 lines

I assume this is not an issue on the g4/ast2400?

Correct, we don't have the issue of pinmux needing to reach into the LPC IO space on the AST2400. I don't think we've had anything else to drive us to looking at the host controller space there, so I wasn't going to add it to the bindings yet.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +9 -0
+
+The LPCHC registers configure LPC behaviour between the BMC and the host
+system. The LPCHC also participates in pinmux requests on g5 SoCs and is
+therefore considered a syscon device.
+
+Required properties:
+- compatible:??????????"aspeed,ast2500-lpchc", "syscon"
+- reg:?????????????????contains offset/length value of the LPCHC memory
+???????????????????????region.
Quoted 8 lines

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt

Quoted 6 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +6 -0
+
+Example:
+
+lpchc: lpchc at 1e7890a0 {
+???????compatible = "aspeed,ast2500-lpchc", "syscon";
+???????reg = <0x1e7890a0 0xc4>;

Where's the 0xc4 come from? I can see 9 registers, which would mean the length should be 0x24?

Yes, it should be 0x24. I can't even claim that 'c' is near '2'. Thanks for catching that.

Andrew

Quoted 4 lines

Cheers,

Joel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161104/19c05671/attachment.sig>

#19 lore raw

Re: [PATCH v2 4/6] pinctrl: aspeed: Read and write bits in LPCHC and GFX controllers

In reply to Joel Stanley
Quoted 216 lines · Joel Stanley
Quoted 7 lines · Andrew Jeffery

The System Control Unit IP block in the Aspeed SoCs is typically where the pinmux configuration is found, but not always. A number of pins depend on state in one of LPC Host Control (LPCHC) or SoC Display Controller (GFX) IP blocks, so the Aspeed pinmux drivers should have the means to adjust these as necessary.

Quoted 7 lines

We use syscon to cast a regmap over the GFX and LPCHCR blocks, which is used as an arbitration layer between the relevant driver and the pinctrl subsystem. The regmaps are then exposed to the SoC-specific pinctrl drivers by phandles in the devicetree, and are selected during a mux request by querying a new 'ip' member in struct aspeed_sig_desc.

I like this a lot more than the first go. Good work.

Some minor comments below.

Quoted 197 lines

---
Since v1:

The change is now proactive: instead of reporting that we need to flip bits in controllers we can't access, the patch provides access via regmaps for the relevant controllers. The implementation also splits out the IP block ID into its own variable rather than packing the value into the upper bits of the reg member of struct aspeed_sig_desc. This drives some churn in the diff, but I've tried to minimise it.

?.../devicetree/bindings/pinctrl/pinctrl-aspeed.txt | 50 +++++++++++++---
?drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c?????????| 18 +++---
?drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c?????????| 39 ++++++++++---
?drivers/pinctrl/aspeed/pinctrl-aspeed.c????????????| 66 +++++++++++++---------
?drivers/pinctrl/aspeed/pinctrl-aspeed.h????????????| 32 ++++++++---

?5 files changed, 144 insertions(+), 61 deletions(-)

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +0 -0
index 2ad18c4ea55c..115b0cce6c1c 100644
@@ -4,12 +4,19 @@ Aspeed Pin Controllers

?The Aspeed SoCs vary in functionality inside a generation but have a common mux ?device register layout.

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +13 -6
-Required properties:
-- compatible : Should be any one of the following:
-???????????????"aspeed,ast2400-pinctrl"
-???????????????"aspeed,g4-pinctrl"
-???????????????"aspeed,ast2500-pinctrl"
-???????????????"aspeed,g5-pinctrl"
+Required properties for g4:
+- compatible :?????????????????????????Should be any one of the following:
+???????????????????????????????"aspeed,ast2400-pinctrl"
+???????????????????????????????"aspeed,g4-pinctrl"
+
+Required properties for g5:
+- compatible :?????????????????????????Should be any one of the following:
+???????????????????????????????"aspeed,ast2500-pinctrl"
+???????????????????????????????"aspeed,g5-pinctrl"
+
+- aspeed,external-nodes:???????A cell of phandles to external controller nodes:
+???????????????????????????????0: compatible with "aspeed,ast2500-gfx", "syscon"
+???????????????????????????????1: compatible with "aspeed,ast2500-lpchc", "syscon"

?The pin controller node should be a child of a syscon node with the required ?property:

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +0 -0
@@ -47,7 +54,7 @@ RGMII1 RGMII2 RMII1 RMII2 SD1 SPI1 SPI1DEBUG SPI1PASSTHRU TIMER4 TIMER5 TIMER6

?TIMER7 TIMER8 VGABIOSROM

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +1 -1
-Examples:
+g4 Example:

?syscon: scu at 1e6e2000 {
????????compatible = "syscon", "simple-mfd";

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +29 -0
@@ -63,5 +70,34 @@ syscon: scu at 1e6e2000 {
 ????????};
 ?};
 
+g5 Example:
+
+apb {
+???????gfx: display at 1e6e6000 {
+???????????????compatible = "aspeed,ast2500-gfx", "syscon";
+???????????????reg = <0x1e6e6000 0x1000>;
+???????};
+
+???????lpchc: lpchc at 1e7890a0 {
+???????????????compatible = "aspeed,ast2500-lpchc", "syscon";
+???????????????reg = <0x1e7890a0 0xc4>;
+???????};
+
+???????syscon: scu at 1e6e2000 {
+???????????????compatible = "syscon", "simple-mfd";
+???????????????reg = <0x1e6e2000 0x1a8>;
+
+???????????????pinctrl: pinctrl {
+???????????????????????compatible = "aspeed,g5-pinctrl";
+???????????????????????aspeed,external-nodes = <&gfx, &lpchc>;
+
+???????????????????????pinctrl_i2c3_default: i2c3_default {
+???????????????????????????????function = "I2C3";
+???????????????????????????????groups = "I2C3";
+???????????????????????};
+???????????????};
+???????};
+};
+

?Please refer to pinctrl-bindings.txt in this directory for details of the ?common pinctrl bindings used by client devices.

drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +1 -1
index a21b071ff290..558bd102416c 100644
@@ -292,7 +292,7 @@ SSSF_PIN_DECL(U18, GPIOG7, FLWP, SIG_DESC_SET(SCU84, 7));
 ?#define UART6_DESC?????SIG_DESC_SET(SCU90, 7)
 ?#define ROM16_DESC?????SIG_DESC_SET(SCU90, 6)
 ?#define FLASH_WIDE?????SIG_DESC_SET(HW_STRAP1, 4)
-#define BOOT_SRC_NOR???{ HW_STRAP1, GENMASK(1, 0), 0, 0 }
+#define BOOT_SRC_NOR???{ ASPEED_IP_SCU, HW_STRAP1, GENMASK(1, 0), 0, 0 }
 

?#define A8 56
?SIG_EXPR_DECL(ROMD8, ROM16, ROM16_DESC);

drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +0 -0
@@ -418,9 +418,9 @@ FUNC_GROUP_DECL(I2C8, G5, F3);

?#define U1 88
?SSSF_PIN_DECL(U1, GPIOL0, NCTS1, SIG_DESC_SET(SCU84, 16));

drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +3 -3
-#define VPI18_DESC?????{ SCU90, GENMASK(5, 4), 1, 0 }
-#define VPI24_DESC?????{ SCU90, GENMASK(5, 4), 2, 0 }
-#define VPI30_DESC?????{ SCU90, GENMASK(5, 4), 3, 0 }
+#define VPI18_DESC?????{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 1, 0 }
+#define VPI24_DESC?????{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 2, 0 }
+#define VPI30_DESC?????{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 3, 0 }

?#define T5 89
?#define T5_DESC?????????SIG_DESC_SET(SCU84, 17)

drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +0 -0
@@ -641,11 +641,11 @@ SSSF_PIN_DECL(Y22, GPIOR2, ROMCS3, SIG_DESC_SET(SCU88, 26));

?#define U19 139
?SSSF_PIN_DECL(U19, GPIOR3, ROMCS4, SIG_DESC_SET(SCU88, 27));

drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +5 -5
-#define VPOOFF0_DESC???{ SCU94, GENMASK(1, 0), 0, 0 }
-#define VPO12_DESC?????{ SCU94, GENMASK(1, 0), 1, 0 }
-#define VPO24_DESC?????{ SCU94, GENMASK(1, 0), 2, 0 }
-#define VPOOFF1_DESC???{ SCU94, GENMASK(1, 0), 3, 0 }
-#define VPO_OFF_12??????{ SCU94, 0x2, 0, 0 }
+#define VPOOFF0_DESC???{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 0, 0 }
+#define VPO12_DESC?????{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 1, 0 }
+#define VPO24_DESC?????{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 2, 0 }
+#define VPOOFF1_DESC???{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 3, 0 }
+#define VPO_OFF_12??????{ ASPEED_IP_SCU, SCU94, 0x2, 0, 0 }

?#define VPO_24_OFF??????SIG_DESC_SET(SCU94, 1)

?#define V21 140

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +0 -0
index 87b46390b695..99c4fa9bf861 100644
@@ -10,6 +10,7 @@

?#include
?#include
?#include
+#include
?#include
?#include
?#include

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +0 -0
@@ -26,8 +27,8 @@
 

?#define ASPEED_G5_NR_PINS 228

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +2 -2
-#define COND1??????????{ SCU90, BIT(6), 0, 0 }
-#define COND2??????????{ SCU94, GENMASK(1, 0), 0, 0 }
+#define COND1??????????{ ASPEED_IP_SCU, SCU90, BIT(6), 0, 0 }
+#define COND2??????????{ ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 0, 0 }

?#define B14 0
?SSSF_PIN_DECL(B14, GPIOA0, MAC1LINK, SIG_DESC_SET(SCU80, 0));

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +6 -3
@@ -186,9 +187,12 @@ MS_PIN_DECL(C20, GPIOE1, NDCD3, GPIE0OUT);
 
 ?FUNC_GROUP_DECL(GPIE0, B20, C20);
 
-#define SPI1_DESC??????????????{ HW_STRAP1, GENMASK(13, 12), 1, 0 }
-#define SPI1DEBUG_DESC?????????{ HW_STRAP1, GENMASK(13, 12), 2, 0 }
-#define SPI1PASSTHRU_DESC??????{ HW_STRAP1, GENMASK(13, 12), 3, 0 }
+#define SPI1_DESC \
+???????{ ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 1, 0 }
+#define SPI1DEBUG_DESC \
+???????{ ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 2, 0 }
+#define SPI1PASSTHRU_DESC \
+???????{ ASPEED_IP_SCU, HW_STRAP1, GENMASK(13, 12), 3, 0 }
 

?#define C18 64
?SIG_EXPR_DECL(SYSCS, SPI1DEBUG, COND1, SPI1DEBUG_DESC);

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +5 -4
@@ -325,10 +329,11 @@ SS_PIN_DECL(R1, GPIOK7, SDA8);
 
 ?FUNC_GROUP_DECL(I2C8, P2, R1);
 
-#define VPIOFF0_DESC????{ SCU90, GENMASK(5, 4), 0, 0 }
-#define VPIOFF1_DESC????{ SCU90, GENMASK(5, 4), 1, 0 }
-#define VPI24_DESC??????{ SCU90, GENMASK(5, 4), 2, 0 }
-#define VPIRSVD_DESC????{ SCU90, GENMASK(5, 4), 3, 0 }
+#define VPIOFF0_DESC????{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 0, 0 }
+#define VPIOFF1_DESC????{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 1, 0 }
+#define VPI24_DESC??????{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 2, 0 }
+#define VPIRSVD_DESC????{ ASPEED_IP_SCU, SCU90, GENMASK(5, 4), 3, 0 }
+
 

?#define V2 104
?#define V2_DESC?????????SIG_DESC_SET(SCU88, 0)

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +2 -0
@@ -848,10 +853,26 @@ static struct pinctrl_desc aspeed_g5_pinctrl_desc = {
 ?static int aspeed_g5_pinctrl_probe(struct platform_device *pdev)
 ?{
 ????????int i;
+???????struct regmap **map;
+???????struct device_node *node;
 
Quoted 8 lines

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c static struct pinctrl_desc aspeed_g5_pinctrl_desc = { · line 864

Quoted 6 lines
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +3 -0
 ????????for (i = 0; i < ARRAY_SIZE(aspeed_g5_pins); i++)
 ????????????????aspeed_g5_pins[i].number = i;
 
+???????map = &aspeed_g5_pinctrl_data.maps[ASPEED_IP_GFX];
+???????node = of_parse_phandle(pdev->dev.of_node, "aspeed,external-nodes", 0);
+???????*map = syscon_node_to_regmap(node);

I think you can use syscon_regmap_lookup_by_phandle to replace both of these lines.

Good call, will do.

Quoted 6 lines

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c static struct pinctrl_desc aspeed_g5_pinctrl_desc = { · line 867

Quoted 5 lines
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +3 -0
+???????of_node_put(node);
+???????if (IS_ERR(*map))
+???????????????return PTR_ERR(*map);

Do we want to fail, or warn and continue?

We would need to add further checks to defend against null dereferences if we were to continue. I think the broken devicetree should be fixed.

Quoted 11 lines

The sequence is a bit messy. How about:

struct regmap *map;

map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "aspeed,external-nodes");
if (IS_ERR(map))
???return PTR_ERR(map);

aspeed_g5_pinctrl_data.maps[ASPEED_IP_GFX] = map;

That looks neater, I will switch.

Quoted 12 lines

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c static struct pinctrl_desc aspeed_g5_pinctrl_desc = { · line 875

Quoted 11 lines
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +8 -0
+
+???????map = &aspeed_g5_pinctrl_data.maps[ASPEED_IP_LPCHC];
+???????node = of_parse_phandle(pdev->dev.of_node, "aspeed,external-nodes", 1);
+???????*map = syscon_node_to_regmap(node);
+???????of_node_put(node);
+???????if (IS_ERR(*map))
+???????????????return PTR_ERR(*map);
+

Same comments as above.

Ack.

Quoted 309 lines
Quoted 13 lines
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +0 -0
 ????????return aspeed_pinctrl_probe(pdev, &aspeed_g5_pinctrl_desc,
 ????????????????????????&aspeed_g5_pinctrl_data);
 ?}
drivers/pinctrl/aspeed/pinctrl-aspeed.c +0 -0
index 49aeba912531..23586aac7a5a 100644
@@ -14,6 +14,12 @@

?#include "../core.h"
?#include "pinctrl-aspeed.h"

Quoted 4 lines

+static const char *const aspeed_pinmux_ips[] = {
+???????[ASPEED_IP_SCU] = "SCU",
+???????[ASPEED_IP_GFX] = "GFX",
+???????[ASPEED_IP_LPCHC] = "LHCR",

We've got both LPCHC and LHCR here. As I said when commenting on the regmap bindings, I like LHC(R) better.

Quoted 9 lines
drivers/pinctrl/aspeed/pinctrl-aspeed.c +2 -0
+};
+

?int aspeed_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) ?{
????????struct aspeed_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);

drivers/pinctrl/aspeed/pinctrl-aspeed.c +0 -0
@@ -78,7 +84,8 @@ int aspeed_pinmux_get_fn_groups(struct pinctrl_dev *pctldev,

?static inline void aspeed_sig_desc_print_val( ????????????????const struct aspeed_sig_desc *desc, bool enable, u32 rv)

What's a rv? Perhaps "reg" or "value"?

Quoted 278 lines

?{
-???????pr_debug("SCU%x[0x%08x]=0x%x, got 0x%x from 0x%08x\n", desc->reg, +???????pr_debug("Want %s%X[0x%08X]=0x%X, got 0x%X from 0x%08X\n", +???????????????????????aspeed_pinmux_ips[desc->ip], desc->reg, ????????????????????????desc->mask, enable ? desc->enable : desc->disable, ????????????????????????(rv & desc->mask) >> __ffs(desc->mask), rv); ?}

drivers/pinctrl/aspeed/pinctrl-aspeed.c +0 -0
@@ -88,7 +95,7 @@ static inline void aspeed_sig_desc_print_val(

? *
? * @desc: The signal descriptor of interest
? * @enabled: True to query the enabled state, false to query disabled state
- * @regmap: The SCU regmap instance
+ * @regmap: The IP block's regmap instance
? *
? * @return True if the descriptor's bitfield is configured to the state ? * selected by @enabled, false otherwise

drivers/pinctrl/aspeed/pinctrl-aspeed.c +0 -0
@@ -119,7 +126,7 @@ static bool aspeed_sig_desc_eval(const struct aspeed_sig_desc *desc,

? *
? * @expr: An expression controlling the signal for a mux function on a pin ? * @enabled: True to query the enabled state, false to query disabled state
- * @regmap: The SCU regmap instance
+ * @maps: The list of regmap instances
? *
? * @return True if the expression composed by @enabled evaluates true, false ? * otherwise

drivers/pinctrl/aspeed/pinctrl-aspeed.c +0 -0
@@ -136,15 +143,16 @@ static bool aspeed_sig_desc_eval(const struct aspeed_sig_desc *desc,

? * either condition as required.
? */
?static bool aspeed_sig_expr_eval(const struct aspeed_sig_expr *expr, -????????????????????????????????bool enabled, struct regmap *map) +????????????????????????????????bool enabled, struct regmap * const *maps) ?{
????????int i;

????????for (i = 0; i < expr->ndescs; i++) { ????????????????const struct aspeed_sig_desc *desc = &expr->descs[i];

-???????????????if (!aspeed_sig_desc_eval(desc, enabled, map)) +???????????????if (!aspeed_sig_desc_eval(desc, enabled, maps[desc->ip])) ????????????????????????return false;
+
????????}

????????return true;

drivers/pinctrl/aspeed/pinctrl-aspeed.c +0 -0
@@ -158,12 +166,12 @@ static bool aspeed_sig_expr_eval(const struct aspeed_sig_expr *expr,

? *????????configured
? * @enable: true to enable an function's signal through a pin's signal ? *??????????expression, false to disable the function's signal
- * @map: The SCU's regmap instance for pinmux register access.
+ * @maps: The list of regmap instances for pinmux register access. ? *
? * @return true if the expression is configured as requested, false otherwise ? */
?static bool aspeed_sig_expr_set(const struct aspeed_sig_expr *expr, -???????????????????????????????bool enable, struct regmap *map) +???????????????????????????????bool enable, struct regmap * const *maps) ?{
????????int i;

drivers/pinctrl/aspeed/pinctrl-aspeed.c +1 -0
@@ -171,6 +179,7 @@ static bool aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
 ????????????????bool ret;
 ????????????????const struct aspeed_sig_desc *desc = &expr->descs[i];
 ????????????????u32 pattern = enable ? desc->enable : desc->disable;
+???????????????u32 val = (pattern << __ffs(desc->mask));
 

????????????????/*
?????????????????* Strap registers are configured in hardware or by early-boot

drivers/pinctrl/aspeed/pinctrl-aspeed.c +0 -0
@@ -179,48 +188,49 @@ static bool aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,

?????????????????* deconfigured and is the reason we re-evaluate after writing ?????????????????* all descriptor bits.
?????????????????*/
-???????????????if (desc->reg == HW_STRAP1 || desc->reg == HW_STRAP2) +???????????????if ((desc->reg == HW_STRAP1 || desc->reg == HW_STRAP2) && +???????????????????????????????desc->ip == ASPEED_IP_SCU) ????????????????????????continue;

-???????????????ret = regmap_update_bits(map, desc->reg, desc->mask, -???????????????????????????????pattern << __ffs(desc->mask)) == 0; +???????????????ret = regmap_update_bits(maps[desc->ip], desc->reg, +????????????????????????????????????????desc->mask, val) == 0;

????????????????if (!ret)
????????????????????????return ret;
????????}

-???????return aspeed_sig_expr_eval(expr, enable, map); +???????return aspeed_sig_expr_eval(expr, enable, maps); ?}

?static bool aspeed_sig_expr_enable(const struct aspeed_sig_expr *expr, -??????????????????????????????????struct regmap *map) +??????????????????????????????????struct regmap * const *maps) ?{
-???????if (aspeed_sig_expr_eval(expr, true, map)) +???????if (aspeed_sig_expr_eval(expr, true, maps)) ????????????????return true;

-???????return aspeed_sig_expr_set(expr, true, map); +???????return aspeed_sig_expr_set(expr, true, maps); ?}

?static bool aspeed_sig_expr_disable(const struct aspeed_sig_expr *expr, -???????????????????????????????????struct regmap *map) +???????????????????????????????????struct regmap * const *maps) ?{
-???????if (!aspeed_sig_expr_eval(expr, true, map)) +???????if (!aspeed_sig_expr_eval(expr, true, maps)) ????????????????return true;

-???????return aspeed_sig_expr_set(expr, false, map); +???????return aspeed_sig_expr_set(expr, false, maps); ?}

?/**
? * Disable a signal on a pin by disabling all provided signal expressions. ? *
? * @exprs: The list of signal expressions (from a priority level on a pin)
- * @map: The SCU's regmap instance for pinmux register access.
+ * @maps: The list of regmap instances for pinmux register access. ? *
? * @return true if all expressions in the list are successfully disabled, false ? * otherwise
? */
?static bool aspeed_disable_sig(const struct aspeed_sig_expr **exprs, -??????????????????????????????struct regmap *map) +??????????????????????????????struct regmap * const *maps)
?{
????????bool disabled = true;

drivers/pinctrl/aspeed/pinctrl-aspeed.c +6 -4
@@ -230,7 +240,7 @@ static bool aspeed_disable_sig(const struct aspeed_sig_expr **exprs,
 ????????while (*exprs) {
 ????????????????bool ret;
 
-???????????????ret = aspeed_sig_expr_disable(*exprs, map);
+???????????????ret = aspeed_sig_expr_disable(*exprs, maps);
 ????????????????disabled = disabled && ret;
 
 ????????????????exprs++;
@@ -343,6 +353,8 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
 ????????????????const struct aspeed_sig_expr **funcs;
 ????????????????const struct aspeed_sig_expr ***prios;
 
+???????????????pr_debug("Muxing pin %d for %s\n", pin, pfunc->name);
+
 ????????????????if (!pdesc)
 ????????????????????????return -EINVAL;
 
@@ -358,7 +370,7 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
 ????????????????????????if (expr)
 ????????????????????????????????break;
 
-???????????????????????if (!aspeed_disable_sig(funcs, pdata->map))
+???????????????????????if (!aspeed_disable_sig(funcs, pdata->maps))
 ????????????????????????????????return -EPERM;
 
 ????????????????????????prios++;
@@ -377,7 +389,7 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
 ????????????????????????return -ENXIO;
 ????????????????}
 
-???????????????if (!aspeed_sig_expr_enable(expr, pdata->map))
+???????????????if (!aspeed_sig_expr_enable(expr, pdata->maps))
 ????????????????????????return -EPERM;
 ????????}
 
@@ -432,7 +444,7 @@ int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev,
 ????????????????if (aspeed_gpio_in_exprs(funcs))
 ????????????????????????break;
 
-???????????????if (!aspeed_disable_sig(funcs, pdata->map))
+???????????????if (!aspeed_disable_sig(funcs, pdata->maps))
 ????????????????????????return -EPERM;
 
 ????????????????prios++;
@@ -462,7 +474,7 @@ int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev,

?????????* If GPIO is not the lowest priority signal type, assume there is only ?????????* one expression defined to enable the GPIO function ?????????*/
-???????if (!aspeed_sig_expr_enable(expr, pdata->map))
+???????if (!aspeed_sig_expr_enable(expr, pdata->maps)) ????????????????return -EPERM;

????????return 0;

drivers/pinctrl/aspeed/pinctrl-aspeed.c +3 -3
@@ -481,10 +493,10 @@ int aspeed_pinctrl_probe(struct platform_device *pdev,
 ????????????????return -ENODEV;
 ????????}
 
-???????pdata->map = syscon_node_to_regmap(parent->of_node);
-???????if (IS_ERR(pdata->map)) {
+???????pdata->maps[ASPEED_IP_SCU] = syscon_node_to_regmap(parent->of_node);
+???????if (IS_ERR(pdata->maps[ASPEED_IP_SCU])) {
 ????????????????dev_err(&pdev->dev, "No regmap for syscon pincontroller parent\n");
-???????????????return PTR_ERR(pdata->map);
+???????????????return PTR_ERR(pdata->maps[ASPEED_IP_SCU]);
 ????????}
 
 ????????pctl = pinctrl_register(pdesc, &pdev->dev, pdata);
drivers/pinctrl/aspeed/pinctrl-aspeed.h +0 -0
index 3e72ef8c54bf..727728b86c07 100644
@@ -232,6 +232,11 @@

? * group.
? */

drivers/pinctrl/aspeed/pinctrl-aspeed.h +5 -0
+#define ASPEED_IP_SCU??0
+#define ASPEED_IP_GFX??1
+#define ASPEED_IP_LPCHC????????2
+#define ASPEED_NR_PINMUX_IPS???3
+

?/*
? * The "Multi-function Pins Mapping and Control" table in the SoC datasheet ? * references registers by the device/offset mnemonic. The register macros

drivers/pinctrl/aspeed/pinctrl-aspeed.h +0 -0
@@ -261,7 +266,9 @@

???* A signal descriptor, which describes the register, bits and the ???* enable/disable values that should be compared or written.
???*
-??* @reg: The register offset from base in bytes
+??* @ip: The IP block identifier, used as an index into the regmap array in +??*??????struct aspeed_pinctrl_data
+??* @reg: The register offset with respect to the base address of the IP block ???* @mask: The mask to apply to the register. The lowest set bit of the mask is ???*????????used to derive the shift value.
???* @enable: The value that enables the function. Value should be in the LSBs,

drivers/pinctrl/aspeed/pinctrl-aspeed.h +0 -0
@@ -270,6 +277,7 @@

???*???????????LSBs, not at the position of the mask. ???*/
?struct aspeed_sig_desc {
+???????unsigned int ip;
????????unsigned int reg;
????????u32 mask;
????????u32 enable;

drivers/pinctrl/aspeed/pinctrl-aspeed.h +0 -0
@@ -313,24 +321,30 @@ struct aspeed_pin_desc {
 

?/* Macro hell */

drivers/pinctrl/aspeed/pinctrl-aspeed.h +3 -0
+#define SIG_DESC_IP_BIT(ip, reg, idx, val) \
+???????{ ip, reg, BIT_MASK(idx), val, (((val) + 1) & 1) }
+

?/**
- * Short-hand macro for describing a configuration enabled by the state of one
- * bit. The disable value is derived.
+ * Short-hand macro for describing an SCU descriptor enabled by the state of
+ * one bit. The disable value is derived.
? *
? * @reg: The signal's associated register, offset from base
? * @idx: The signal's bit index in the register
? * @val: The value (0 or 1) that enables the function
? */
?#define SIG_DESC_BIT(reg, idx, val) \
-???????{ reg, BIT_MASK(idx), val, (((val) + 1) & 1) } +???????SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, val)

drivers/pinctrl/aspeed/pinctrl-aspeed.h +2 -0
+
+#define SIG_DESC_IP_SET(ip, reg, idx) SIG_DESC_IP_BIT(ip, reg, idx, 1)

?/**
- * A further short-hand macro describing a configuration enabled with a set bit.
+ * A further short-hand macro expanding to an SCU descriptor enabled by a set
+ * bit.
? *
- * @reg: The configuration's associated register, offset from base
- * @idx: The configuration's bit index in the register
+ * @reg: The register, offset from base
+ * @idx: The bit index in the register
? */

drivers/pinctrl/aspeed/pinctrl-aspeed.h +1 -1
-#define SIG_DESC_SET(reg, idx) SIG_DESC_BIT(reg, idx, 1)
+#define SIG_DESC_SET(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 1)

?#define SIG_DESC_LIST_SYM(sig, func) sig_descs_ ## sig ## _ ## func ?#define SIG_DESC_LIST_DECL(sig, func, ...) \

drivers/pinctrl/aspeed/pinctrl-aspeed.h +1 -1
@@ -500,7 +514,7 @@ struct aspeed_pin_desc {
 ????????MS_PIN_DECL_(pin, SIG_EXPR_LIST_PTR(gpio))
 
 ?struct aspeed_pinctrl_data {
-???????struct regmap *map;
+???????struct regmap *maps[ASPEED_NR_PINMUX_IPS];
 
Quoted 5 lines
Quoted 5 lines
drivers/pinctrl/aspeed/pinctrl-aspeed.h +0 -1
 ????????const struct pinctrl_pin_desc *pins;
 ????????const unsigned int npins;
--

2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161104/a6f587a0/attachment-0001.sig>

#5 lore raw

Re: [PATCH v2 1/6] pinctrl-aspeed-g5: Never set SCU90[6]

In reply to Andrew Jeffery
Quoted 9 lines · Andrew Jeffery

If a pin depending on bit 6 in SCU90 is requested for GPIO, the export will succeed but changes to the GPIO's value will not be accepted by the hardware. This is because the pinmux driver has misconfigured the SCU by writing 1 to the reserved bit.

The description of SCU90[6] from the datasheet is 'Reserved, must keep at value ?0?'. The fix is to switch pinmux from the bit-flipping macro to explicitly configuring the .enable and .disable values to zero.

Quoted 8 lines

The patch has been tested on an AST2500 EVB.

Fixes 56e57cb6c07f (pinctrl: Add pinctrl-aspeed-g5 driver)

---

This patch should be applied for 4.9.

Patch applied for fixes, adding Joel's review tag.

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH v2 1/6] pinctrl-aspeed-g5: Never set SCU90[6]

In reply to Joel Stanley
Quoted 4 lines · Joel Stanley

In the future I think we should send fixes separately from the rest of the series, so it's clear to Linus where we expect patches to end up.

Perhaps Linus can share his preference with us?

Just make it clear to me where the patch is headed, if it is a fix or a new feature.

Also mixing stuff in big series is of course problematic because all the CC:in on MFD patches and whatnot that I don't apply makes the picture blurry, but sometimes it is anyways needed for context so it is a soft requirement.

Yours,
Linus Walleij

#4 lore raw

Re: [PATCH v2 1/6] pinctrl-aspeed-g5: Never set SCU90[6]

Quoted 7 lines · Linus Walleij
Quoted 6 lines · Joel Stanley

In the future I think we should send fixes separately from the rest of the series, so it's clear to Linus where we expect patches to end up.

Perhaps Linus can share his preference with us?

Quoted 7 lines

Just make it clear to me where the patch is headed, if it is a fix or a new feature.

Also mixing stuff in big series is of course problematic because all the CC:in on MFD patches and whatnot that I don't apply makes the picture blurry, but sometimes it is anyways needed for context so it is a soft requirement.

Context was my concern here and I would otherwise have split the rest of the patches along mfd/pinctrl boundaries. I felt the situation was odd enough to warrant presenting the full picture.

Andrew

Quoted 3 lines

Yours,
Linus Walleij

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161108/472a2ae8/attachment.sig>

maintainer
#7 lore raw

Re: [PATCH v2 2/6] mfd: dt: Add bindings for the Aspeed SoC Display Controller (GFX)

In reply to Andrew Jeffery
Quoted 8 lines · Andrew Jeffery

The Aspeed SoC Display Controller is presented as a syscon device to arbitrate access by display and pinmux drivers. Video pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the Display Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt | 17 +++++++++++++++++

The register space can't be split to 2 nodes?

Quoted 9 lines
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt
Documentation/devicetree/bindings/mfd/aspeed-gfx.txt new file +0 -0
new file mode 100644
index 000000000000..aea5370efd97

Documentation/devicetree/bindings/mfd/aspeed-gfx.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/mfd/aspeed-gfx.txt new file +8 -0
@@ -0,0 +1,17 @@
+* Device tree bindings for Aspeed SoC Display Controller (GFX)
+
+The Aspeed SoC Display Controller primarily does as its name suggests, but also
+participates in pinmux requests on the g5 SoCs. It is therefore considered a
+syscon device.
+
+Required properties:
+- compatible:		"aspeed,ast2500-gfx", "syscon"

I think perhaps we should drop the syscon here and the driver should just register as a syscon.

Rob

maintainer
#20 lore raw

Re: [PATCH v2 4/6] pinctrl: aspeed: Read and write bits in LPCHC and GFX controllers

In reply to Andrew Jeffery
Quoted 81 lines · Andrew Jeffery

The System Control Unit IP block in the Aspeed SoCs is typically where the pinmux configuration is found, but not always. A number of pins depend on state in one of LPC Host Control (LPCHC) or SoC Display Controller (GFX) IP blocks, so the Aspeed pinmux drivers should have the means to adjust these as necessary.

We use syscon to cast a regmap over the GFX and LPCHCR blocks, which is used as an arbitration layer between the relevant driver and the pinctrl subsystem. The regmaps are then exposed to the SoC-specific pinctrl drivers by phandles in the devicetree, and are selected during a mux request by querying a new 'ip' member in struct aspeed_sig_desc.

---
Since v1:

The change is now proactive: instead of reporting that we need to flip bits in controllers we can't access, the patch provides access via regmaps for the relevant controllers. The implementation also splits out the IP block ID into its own variable rather than packing the value into the upper bits of the reg member of struct aspeed_sig_desc. This drives some churn in the diff, but I've tried to minimise it.

 .../devicetree/bindings/pinctrl/pinctrl-aspeed.txt | 50 +++++++++++++---
 drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c         | 18 +++---
 drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c         | 39 ++++++++++---
 drivers/pinctrl/aspeed/pinctrl-aspeed.c            | 66 +++++++++++++---------
 drivers/pinctrl/aspeed/pinctrl-aspeed.h            | 32 ++++++++---
 5 files changed, 144 insertions(+), 61 deletions(-)
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +22 -7
index 2ad18c4ea55c..115b0cce6c1c 100644
@@ -4,12 +4,19 @@ Aspeed Pin Controllers
 The Aspeed SoCs vary in functionality inside a generation but have a common mux
 device register layout.
 
-Required properties:
-- compatible : Should be any one of the following:
-		"aspeed,ast2400-pinctrl"
-		"aspeed,g4-pinctrl"
-		"aspeed,ast2500-pinctrl"
-		"aspeed,g5-pinctrl"
+Required properties for g4:
+- compatible : 			Should be any one of the following:
+				"aspeed,ast2400-pinctrl"
+				"aspeed,g4-pinctrl"
+
+Required properties for g5:
+- compatible : 			Should be any one of the following:
+				"aspeed,ast2500-pinctrl"
+				"aspeed,g5-pinctrl"
+
+- aspeed,external-nodes:	A cell of phandles to external controller nodes:
+				0: compatible with "aspeed,ast2500-gfx", "syscon"
+				1: compatible with "aspeed,ast2500-lpchc", "syscon"
 
 The pin controller node should be a child of a syscon node with the required
 property:
@@ -47,7 +54,7 @@ RGMII1 RGMII2 RMII1 RMII2 SD1 SPI1 SPI1DEBUG SPI1PASSTHRU TIMER4 TIMER5 TIMER6
 TIMER7 TIMER8 VGABIOSROM
 
 
-Examples:
+g4 Example:
 
 syscon: scu at 1e6e2000 {
 	compatible = "syscon", "simple-mfd";
@@ -63,5 +70,34 @@ syscon: scu at 1e6e2000 {
 	};
 };
 
+g5 Example:
+
+apb {
+	gfx: display at 1e6e6000 {
+		compatible = "aspeed,ast2500-gfx", "syscon";
+		reg = <0x1e6e6000 0x1000>;
+	};
+

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt syscon: scu at 1e6e2000 { · line 90

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +10 -0
+	lpchc: lpchc at 1e7890a0 {
+		compatible = "aspeed,ast2500-lpchc", "syscon";
+		reg = <0x1e7890a0 0xc4>;
+	};
+
+	syscon: scu at 1e6e2000 {
+		compatible = "syscon", "simple-mfd";
+		reg = <0x1e6e2000 0x1a8>;
+
+		pinctrl: pinctrl {

Why the single child node here? Doesn't look like any reason for it in the example.

Quoted 13 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +11 -0
+			compatible = "aspeed,g5-pinctrl";
+			aspeed,external-nodes = <&gfx, &lpchc>;
+
+			pinctrl_i2c3_default: i2c3_default {
+				function = "I2C3";
+				groups = "I2C3";
+			};
+		};
+	};
+};
+
 Please refer to pinctrl-bindings.txt in this directory for details of the
 common pinctrl bindings used by client devices.
#21 lore raw

Re: [PATCH v2 4/6] pinctrl: aspeed: Read and write bits in LPCHC and GFX controllers

Quoted 87 lines · Rob Herring
Quoted 86 lines · Andrew Jeffery

The System Control Unit IP block in the Aspeed SoCs is typically where the pinmux configuration is found, but not always. A number of pins depend on state in one of LPC Host Control (LPCHC) or SoC Display Controller (GFX) IP blocks, so the Aspeed pinmux drivers should have the means to adjust these as necessary.

We use syscon to cast a regmap over the GFX and LPCHCR blocks, which is used as an arbitration layer between the relevant driver and the pinctrl subsystem. The regmaps are then exposed to the SoC-specific pinctrl drivers by phandles in the devicetree, and are selected during a mux request by querying a new 'ip' member in struct aspeed_sig_desc.

Quoted 1 line
Quoted 1 line

---
Since v1:

The change is now proactive: instead of reporting that we need to flip bits in controllers we can't access, the patch provides access via regmaps for the relevant controllers. The implementation also splits out the IP block ID into its own variable rather than packing the value into the upper bits of the reg member of struct aspeed_sig_desc. This drives some churn in the diff, but I've tried to minimise it.

?.../devicetree/bindings/pinctrl/pinctrl-aspeed.txt | 50 +++++++++++++---
?drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c?????????| 18 +++---
?drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c?????????| 39 ++++++++++---
?drivers/pinctrl/aspeed/pinctrl-aspeed.c????????????| 66 +++++++++++++---------
?drivers/pinctrl/aspeed/pinctrl-aspeed.h????????????| 32 ++++++++---

?5 files changed, 144 insertions(+), 61 deletions(-)

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +0 -0
index 2ad18c4ea55c..115b0cce6c1c 100644
@@ -4,12 +4,19 @@ Aspeed Pin Controllers

?The Aspeed SoCs vary in functionality inside a generation but have a common mux ?device register layout.
?

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +13 -6
-Required properties:
-- compatible : Should be any one of the following:
-		"aspeed,ast2400-pinctrl"
-		"aspeed,g4-pinctrl"
-		"aspeed,ast2500-pinctrl"
-		"aspeed,g5-pinctrl"
+Required properties for g4:
+- compatible :?			Should be any one of the following:
+				"aspeed,ast2400-pinctrl"
+				"aspeed,g4-pinctrl"
+
+Required properties for g5:
+- compatible :?			Should be any one of the following:
+				"aspeed,ast2500-pinctrl"
+				"aspeed,g5-pinctrl"
+
+- aspeed,external-nodes:	A cell of phandles to external controller nodes:
+				0: compatible with "aspeed,ast2500-gfx", "syscon"
+				1: compatible with "aspeed,ast2500-lpchc", "syscon"

?
?The pin controller node should be a child of a syscon node with the required ?property:

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +0 -0
@@ -47,7 +54,7 @@ RGMII1 RGMII2 RMII1 RMII2 SD1 SPI1 SPI1DEBUG SPI1PASSTHRU TIMER4 TIMER5 TIMER6

?TIMER7 TIMER8 VGABIOSROM
?
?

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +1 -1
-Examples:
+g4 Example:

?
?syscon: scu at 1e6e2000 {
? compatible = "syscon", "simple-mfd";

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +0 -0
@@ -63,5 +70,34 @@ syscon: scu at 1e6e2000 {
 ?	};
 ?};

?

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +13 -0
+g5 Example:
+
+apb {
+	gfx: display at 1e6e6000 {
+		compatible = "aspeed,ast2500-gfx", "syscon";
+		reg = <0x1e6e6000 0x1000>;
+	};
+
+	lpchc: lpchc at 1e7890a0 {
+		compatible = "aspeed,ast2500-lpchc", "syscon";
+		reg = <0x1e7890a0 0xc4>;
+	};
+
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt syscon: scu at 1e6e2000 { · line 90

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +5 -0
+	syscon: scu at 1e6e2000 {
+		compatible = "syscon", "simple-mfd";
+		reg = <0x1e6e2000 0x1a8>;
+
+		pinctrl: pinctrl {

Why the single child node here? Doesn't look like any reason for it in? the example.?

The SCU contains other miscellaneous functionality besides pinctrl registers, but that's not relevant for the pinctrl bindings. This is an example for the g5 SoCs demonstrating use of the aspeed,external-nodes property, which isn't required for the g4 and is why I split the examples.

Maybe I should split out the bindings for each SoC generation into separate files?

Quoted 3 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt syscon: scu at 1e6e2000 { · line 92

Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +2 -0
+			compatible = "aspeed,g5-pinctrl";
+			aspeed,external-nodes = <&gfx, &lpchc>;

You didn't comment on my approach here, but I'm interested in feedback.
I've gone the route of fixed ordering of the phandles, but there are
two other approaches:

1. Relax the fixed ordering requirement by adding an "aspeed,external- node-names" property and requiring correlated indices between them
2. Using separate properties for each required external node

Approach 1 seems pretty idiomatic and only crossed my mind after I'd sent the patch. Approach 2 seems a bit ugly as the number of properties scales with the number of controllers participating in the pinmux configuration.

Something that also wasn't clear to me was whether I need the "aspeed" prefix on the property name. What's the convention here? Do I need it in this case?

Cheers,

Andrew

Quoted 11 lines
Quoted 11 lines

+

Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +6 -0
+			pinctrl_i2c3_default: i2c3_default {
+				function = "I2C3";
+				groups = "I2C3";
+			};
+		};
+	};
Documentation/devicetree/bindings/pinctrl/pinctrl-aspeed.txt +2 -0
+};
+

?Please refer to pinctrl-bindings.txt in this directory for details of the ?common pinctrl bindings used by client devices.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161110/5d339d90/attachment.sig>

maintainer
#8 lore raw

Re: [PATCH v2 2/6] mfd: dt: Add bindings for the Aspeed SoC Display Controller (GFX)

In reply to Rob Herring
Quoted 11 lines · Rob Herring
Quoted 8 lines · Andrew Jeffery

The Aspeed SoC Display Controller is presented as a syscon device to arbitrate access by display and pinmux drivers. Video pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the Display Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt | 17 +++++++++++++++++

The register space can't be split to 2 nodes?

Do you mean splitting the GFX IP and enable register into two nodes?

We can't. Pinmux needs to check bit 6 and 7 in GFX064, which is in the middle the IP block:

GFX060: CRT Control Register I
GFX064: CRT Control Register II
GFX068: CRT Status Register
GFX06C: CRT Misc Setting Register

Quoted 9 lines

Documentation/devicetree/bindings/mfd/aspeed-gfx.txt line 8

Quoted 6 lines
Documentation/devicetree/bindings/mfd/aspeed-gfx.txt new file +6 -0
+The Aspeed SoC Display Controller primarily does as its name suggests, but also
+participates in pinmux requests on the g5 SoCs. It is therefore considered a
+syscon device.
+
+Required properties:
+- compatible:                "aspeed,ast2500-gfx", "syscon"

I think perhaps we should drop the syscon here and the driver should just register as a syscon.

We want the regmap to be present whenever the GFX driver or pinmux is loaded. If we register it in pinmux but chose to not build in that driver, we lack the regmap. Same for the case where a user builds in the GFX driver and not pinmux. I think this means we want the syscon compatible string, unless my understanding is wrong?

Cheers,

Joel

maintainer Acked-by
#9 lore raw

Re: [PATCH v2 2/6] mfd: dt: Add bindings for the Aspeed SoC Display Controller (GFX)

Quoted 15 lines · Joel Stanley
Quoted 11 lines · Rob Herring
Quoted 8 lines · Andrew Jeffery

The Aspeed SoC Display Controller is presented as a syscon device to arbitrate access by display and pinmux drivers. Video pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the Display Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt | 17 +++++++++++++++++

The register space can't be split to 2 nodes?

Do you mean splitting the GFX IP and enable register into two nodes?

Quoted 7 lines

We can't. Pinmux needs to check bit 6 and 7 in GFX064, which is in the middle the IP block:

GFX060: CRT Control Register I
GFX064: CRT Control Register II
GFX068: CRT Status Register
GFX06C: CRT Misc Setting Register

Okay.

Quoted 10 lines
Quoted 9 lines

Documentation/devicetree/bindings/mfd/aspeed-gfx.txt line 8

Quoted 6 lines
Documentation/devicetree/bindings/mfd/aspeed-gfx.txt new file +6 -0
+The Aspeed SoC Display Controller primarily does as its name suggests, but also
+participates in pinmux requests on the g5 SoCs. It is therefore considered a
+syscon device.
+
+Required properties:
+- compatible:                "aspeed,ast2500-gfx", "syscon"

I think perhaps we should drop the syscon here and the driver should just register as a syscon.

Quoted 5 lines

We want the regmap to be present whenever the GFX driver or pinmux is loaded. If we register it in pinmux but chose to not build in that driver, we lack the regmap. Same for the case where a user builds in the GFX driver and not pinmux. I think this means we want the syscon compatible string, unless my understanding is wrong?

Right.

Rob

#15 lore raw

Re: [PATCH v2 3/6] mfd: dt: Add bindings for the Aspeed LPC Host Controller (LPCHC)

In reply to Lee Jones

[Sending Arnd this time!]

Quoted 46 lines

Arnd,

Do you have a preference?

Quoted 8 lines

The Aspeed LPC Host Controller is presented as a syscon device to arbitrate access by LPC and pinmux drivers. LPC pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the LPC Host Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt | 17 +++++++++++++++++

Create a new directory in bindings/mfd called 'syscon'.

Or perhaps 'bindings/syscon'.

Quoted 9 lines
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +0 -0
new file mode 100644
index 000000000000..792651488c3d

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +10 -0
@@ -0,0 +1,17 @@
+* Device tree bindings for the Aspeed LPC Host Controller (LPCHC)
+
+The LPCHC registers configure LPC behaviour between the BMC and the host
+system. The LPCHC also participates in pinmux requests on g5 SoCs and is
+therefore considered a syscon device.
+
+Required properties:
+- compatible:		"aspeed,ast2500-lpchc", "syscon"
+- reg:			contains offset/length value of the LPCHC memory
+			region.

Why not just use a single tab, then you don't have to linewrap?

Quoted 6 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +6 -0
+Example:
+
+lpchc: lpchc@1e7890a0 {
+	compatible = "aspeed,ast2500-lpchc", "syscon";
+	reg = <0x1e7890a0 0xc4>;
+};
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#10 lore raw

Re: [PATCH v2 2/6] mfd: dt: Add bindings for the Aspeed SoC Display Controller (GFX)

In reply to Andrew Jeffery
Quoted 10 lines · Andrew Jeffery

The Aspeed SoC Display Controller is presented as a syscon device to arbitrate access by display and pinmux drivers. Video pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the Display Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-gfx.txt

Same here.

Quoted 23 lines
Documentation/devicetree/bindings/mfd/aspeed-gfx.txt new file +17 -0
new file mode 100644
index 000000000000..aea5370efd97
@@ -0,0 +1,17 @@
+* Device tree bindings for Aspeed SoC Display Controller (GFX)
+
+The Aspeed SoC Display Controller primarily does as its name suggests, but also
+participates in pinmux requests on the g5 SoCs. It is therefore considered a
+syscon device.
+
+Required properties:
+- compatible:		"aspeed,ast2500-gfx", "syscon"
+- reg:			contains offset/length value of the GFX memory
+			region.
+
+Example:
+
+gfx: display@1e6e6000 {
+	compatible = "aspeed,ast2500-gfx", "syscon";
+	reg = <0x1e6e6000 0x1000>;
+};
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#14 lore raw

Re: [PATCH v2 3/6] mfd: dt: Add bindings for the Aspeed LPC Host Controller (LPCHC)

In reply to Andrew Jeffery

Arnd,

Do you have a preference?

Quoted 8 lines

The Aspeed LPC Host Controller is presented as a syscon device to arbitrate access by LPC and pinmux drivers. LPC pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the LPC Host Controller.

---
 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt | 17 +++++++++++++++++

Create a new directory in bindings/mfd called 'syscon'.

Or perhaps 'bindings/syscon'.

Quoted 9 lines
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +0 -0
new file mode 100644
index 000000000000..792651488c3d

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +10 -0
@@ -0,0 +1,17 @@
+* Device tree bindings for the Aspeed LPC Host Controller (LPCHC)
+
+The LPCHC registers configure LPC behaviour between the BMC and the host
+system. The LPCHC also participates in pinmux requests on g5 SoCs and is
+therefore considered a syscon device.
+
+Required properties:
+- compatible:		"aspeed,ast2500-lpchc", "syscon"
+- reg:			contains offset/length value of the LPCHC memory
+			region.

Why not just use a single tab, then you don't have to linewrap?

Quoted 6 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +6 -0
+Example:
+
+lpchc: lpchc at 1e7890a0 {
+	compatible = "aspeed,ast2500-lpchc", "syscon";
+	reg = <0x1e7890a0 0xc4>;
+};
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#16 lore raw

Re: [PATCH v2 3/6] mfd: dt: Add bindings for the Aspeed LPC Host Controller (LPCHC)

In reply to Lee Jones
Quoted 19 lines · Lee Jones

[Sending Arnd this time!]

Quoted 17 lines

Arnd,

Do you have a preference?

Quoted 8 lines

The Aspeed LPC Host Controller is presented as a syscon device to arbitrate access by LPC and pinmux drivers. LPC pinmux configuration on fifth generation SoCs depends on bits in both the System Control Unit and the LPC Host Controller.

Quoted 1 line
Quoted 1 line
Quoted 1 line

---
?Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt | 17 +++++++++++++++++

Create a new directory in bindings/mfd called 'syscon'.

Or perhaps 'bindings/syscon'.

Sounds good to me. I'll wait for Arnd's feedback.

Note that this patch conflicts with some of the ideas I outlined in

https://www.spinics.net/lists/arm-kernel/msg543233.html

I sent it hoping to get some feedback on the approach to take for these LPC-related bits. Did you have any suggestions? The problems with hardware complexity are amplified by the fact that the datasheet is only available under NDA, but I will do what I can to clarify.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

?1 file changed, 17 insertions(+)
?create mode 100644 Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +7 -0
new file mode 100644
index 000000000000..792651488c3d
@@ -0,0 +1,17 @@
+* Device tree bindings for the Aspeed LPC Host Controller (LPCHC)
+
+The LPCHC registers configure LPC behaviour between the BMC and the host
+system. The LPCHC also participates in pinmux requests on g5 SoCs and is
+therefore considered a syscon device.
+
+Required properties:
Quoted 5 lines
Quoted 5 lines

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt line 10

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+- compatible:		"aspeed,ast2500-lpchc", "syscon"
+- reg:			contains offset/length value of the LPCHC memory
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +1 -0
+			region.

Why not just use a single tab, then you don't have to linewrap?

I'll clean that up.

Cheers,

Andrew

Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +2 -0
+Example:
+
Quoted 3 lines
Quoted 3 lines

Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt line 16

Quoted 3 lines
Documentation/devicetree/bindings/mfd/aspeed-lpchc.txt new file +3 -0
+lpchc: lpchc at 1e7890a0 {
+	compatible = "aspeed,ast2500-lpchc", "syscon";
+	reg = <0x1e7890a0 0xc4>;

+};

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161122/b6462917/attachment.sig>