Skip to contentSkip to conversation

Add Broadcom Capri pinctrl driver

PATCH Superseded Sherman Yin 11 participants 85 messages Oct 4, 2013 – Jan 21, 2014

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover Add Broadcom Capri pinctrl driver

The following patches adds a pinctrl driver for Broadcom Capri (BCM281xx) SoCs. The first patch, adding the void * to pinctrl_pin_desc, has been previously discussed with LinusW. See this thread:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-April/165880.html

Sherman Yin (4):
pinctrl: Add void * to pinctrl_pin_desc
pinctrl: Add pinctrl binding for Broadcom Capri SoCs
ARM: pinctrl: Add Broadcom Capri pinctrl driver
pinctrl: Enable pinctrl for Broadcom Capri SoCs

 .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  419 +++++
 arch/arm/boot/dts/bcm11351.dtsi                    |    4 +
 arch/arm/mach-bcm/Kconfig                          |    2 +
 drivers/pinctrl/Kconfig                            |   10 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/pinctrl-capri.c                    | 1727 ++++++++++++++++++++
 include/linux/pinctrl/pinctrl.h                    |    2 +
 7 files changed, 2165 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 pinctrl: Add void * to pinctrl_pin_desc

drv_data is added to the pinctrl_pin_desc for drivers to define additional driver-specific per-pin data.

---
Change-Id: I78b2c44b93d88b04897fd0af80ffce213e338d6b

---
 include/linux/pinctrl/pinctrl.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/pinctrl/pinctrl.h +2 -0
index 5979147..c8e42c4 100644
@@ -32,10 +32,12 @@ struct device_node;
  * pins, pads or other muxable units in this struct
  * @number: unique pin number from the global pin number space
  * @name: a name for this pin
+ * @drv_data: driver-defined per-pin data. pinctrl core does not touch this
  */
 struct pinctrl_pin_desc {
 	unsigned number;
 	const char *name;
+	void *drv_data;
 };
 
 /* Convenience macro to define a single named or anonymous pin descriptor */
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/4] pinctrl: Add void * to pinctrl_pin_desc

Quoted 8 lines · Sherman Yin

drv_data is added to the pinctrl_pin_desc for drivers to define additional driver-specific per-pin data.

---
Change-Id: I78b2c44b93d88b04897fd0af80ffce213e338d6b

Why are you giving me this funky Gerrit stuff along with the patch? It's not like I have any use for it, and anything below the three dashes will be deleted when applying.

The patch is OK but won't be applied until some driver is using it (i.e. this BRCM one...)

Yours,
Linus Walleij

#3 lore raw

RE: [PATCH 1/4] pinctrl: Add void * to pinctrl_pin_desc

Quoted 9 lines
Quoted 2 lines

---
Change-Id: I78b2c44b93d88b04897fd0af80ffce213e338d6b

Why are you giving me this funky Gerrit stuff along with the patch? It's not like I have any use for it, and anything below the three dashes will be deleted when applying.

The patch is OK but won't be applied until some driver is using it (i.e. this BRCM one...)

Sorry, I didn't remove it since it's after the 3 dashes and will be discarded anyway. Will remove Change-Id: from future patches.

Regards,
Sherman

#4 lore raw

PATCH 2/4 pinctrl: Add pinctrl binding for Broadcom Capri SoCs

In reply to Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
 .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  419 ++++++++++++++++++++
 1 file changed, 419 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +419 -0
new file mode 100644
index 0000000..79e0e5a
@@ -0,0 +1,419 @@
+Broadcom Capri Pin Controller
+
+This is a pin controller for the Broadcom BCM281xx SoC family, which includes
+BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs.
+
+=== Pin Controller Node ===
+
+Required Properties:
+
+- compatible:	Must be "brcm,capri-pinctrl".
+- reg:		Base address of the PAD Controller register block and the size
+		of the block.
+
+For example, the following is the bare minimum node:
+
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
+
+As a Pin Controller Device, in addition to the required properties, this node
+should also contain the pin configuration nodes that client devices reference,
+if any.
+
+=== Pin Configuration Node ===
+
+Each pin configuration node is a sub-node of the pin controller node and is a
+container of an arbitrary number of subnodes, called group nodes.
+
+Please refer to the pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the definition of a
+"pin configuration node".
+
+=== Group Node ===
+
+A group node specifies the desired pin mux and/or pin configuration for an
+arbitrary number of pins.  The group node only affect the properties specified
+in the node, and has no effect on any properties that are omitted.
+
+The names of the group nodes are optional and not used. The group nodes have
+the following properties:
+
+Required Properties:
+
+- brcm,pins:	Multiple strings.  Specifies the name(s) of one or more pins to
+		be configured by this node.
+
+Optional Properties:
+
+- brcm,function: Multiple strings.  Specifies the pin mux selection.  Values are:
+		"alt1", "alt2", "alt3", "alt4"
+- brcm,hysteresis: Multiple integers, applicable to standard pins only.  Turns
+		on hysteresis of input.
+		0: TTL input, 1: Schmitt Trigger input
+- brcm,pull:	Multiple integers, applicable to standard pins only.  Specifies
+		pull-up or pull-down.
+		0: neither, 1: pull-up, 2: pull-down, 3: both
+- brcm,input_dis: Multiple integers, applicable to all pins.  Input disable
+		control.
+		0: off, 1: input disabled
+- brcm,slew:	Multiple integers.  Slew rate of output.
+		0: fast output, 1: normal output (most pins)
+		0: normal output, 1: fast output (IC_DM and IC_DP)
+		0: Fast mode, 1: High speed mode (I2C)
+- brcm,drive_str: Multiple integers.  Drive strength.
+		0: 2 mA
+		1: 4 mA
+		2: 6 mA
+		3: 8 mA
+		4: 10 mA
+		5: 12 mA
+		6: 14 mA
+		7: 16 mA
+- brcm,pull_up_str: Multiple integers.  Pull Up strength.
+		0: No pull-up
+		1: 1.2 kOhm
+		2: 1.8 kOhm
+		3: 720 Ohm
+		4: 2.7 kOhm
+		5: 831 Ohm
+		6: 1.08 kOhm
+		7: 568 Ohm
+- brcm,mode:	Multiple integers.  Mode select.
+		0: Fast mode, 1: High Speed mode (I2C)
+
+Any optional property must have 1 or n values, where n is the number of pins
+specified in the brcm,pins property:
+- If 1 value is specified for a property, this value is applied to all pins
+  listed in the brcm,pins property.
+- If n values are specified, the i th value is applied to the i th pin, where
+  i is the index in the array of values and pins, and (0 <= i < n).  This
+  provides an easy way to set different values for different pins in the same
+  group.
+
+Example:
+
+	// pin configuration node
+	dev_a_active {
+		//group node
+		grp_1 {
+			brcm,pins	= "pin1", "pin2", "pin3";
+			brcm,function	= "alt1";
+			brcm,drive_str	= <2 4 6>;
+			brcm,slew	= <1>;
+		};
+
+		grp_2 {
+			...
+		};
+
+		...
+	};
+
+In the example above, "dev_a_active" is a pin configuration node and has a
+number of sub-nodes.  In the group node "grp_1", 3 pins are defined in the
+"brcm,pins" property.  Thus, any optional properties must have either 1 or 3
+values.  The "brcm,function" property has only one value, "alt1", therefore the
+pin mux selection for all 3 pins is "alt1".  Similarly, "brcm,slew" has only one
+value, <1>, so all 3 pins are configured with a slew rate setting of <1>.
+"brcm,drive_str" has 3 values, and they are applied in the same order of the pins
+listed in "brcm,pins": the drive strength of "pin1" is set to <2>, <4> for
+"pin2", and <6> for "pin3".  Finally, no other parameters are sepcified,
+implying no changes to any other parameters for these pins.
+
+=== Pin Names and Type ===
+
+There are 3 types of pins in the BCM281xx SoC family, each type can be
+configured by different properties in a group node.  The following is a list of
+node properties applicable to different pin types.
+
+Standard pins:
+- brcm,function
+- brcm,hysteresis
+- brcm,pull
+- brcm,input_dis
+- brcm,slew
+- brcm,drive_str
+
+I2C pins:
+- brcm,function
+- brcm,input_dis
+- brcm,slew
+- brcm,pull_up_str
+
+HDMI pins:
+- brcm,function
+- brcm,input_dis
+- brcm,mode
+
+The following are valid pin names and their pin types:
+
+	"adcsync",		std
+	"bat_rm",		std
+	"bsc1_scl",		i2c
+	"bsc1_sda",		i2c
+	"bsc2_scl",		i2c
+	"bsc2_sda",		i2c
+	"classgpwr",		std
+	"clk_cx8",		std
+	"clkout_0",		std
+	"clkout_1",		std
+	"clkout_2",		std
+	"clkout_3",		std
+	"clkreq_in_0",		std
+	"clkreq_in_1",		std
+	"cws_sys_req1",		std
+	"cws_sys_req2",		std
+	"cws_sys_req3",		std
+	"digmic1_clk",		std
+	"digmic1_dq",		std
+	"digmic2_clk",		std
+	"digmic2_dq",		std
+	"gpen13",		std
+	"gpen14",		std
+	"gpen15",		std
+	"gpio00",		std
+	"gpio01",		std
+	"gpio02",		std
+	"gpio03",		std
+	"gpio04",		std
+	"gpio05",		std
+	"gpio06",		std
+	"gpio07",		std
+	"gpio08",		std
+	"gpio09",		std
+	"gpio10",		std
+	"gpio11",		std
+	"gpio12",		std
+	"gpio13",		std
+	"gpio14",		std
+	"gps_pablank",		std
+	"gps_tmark",		std
+	"hdmi_scl",		hdmi
+	"hdmi_sda",		hdmi
+	"ic_dm",		std
+	"ic_dp",		std
+	"kp_col_ip_0",		std
+	"kp_col_ip_1",		std
+	"kp_col_ip_2",		std
+	"kp_col_ip_3",		std
+	"kp_row_op_0",		std
+	"kp_row_op_1",		std
+	"kp_row_op_2",		std
+	"kp_row_op_3",		std
+	"lcd_b_0",		std
+	"lcd_b_1",		std
+	"lcd_b_2",		std
+	"lcd_b_3",		std
+	"lcd_b_4",		std
+	"lcd_b_5",		std
+	"lcd_b_6",		std
+	"lcd_b_7",		std
+	"lcd_g_0",		std
+	"lcd_g_1",		std
+	"lcd_g_2",		std
+	"lcd_g_3",		std
+	"lcd_g_4",		std
+	"lcd_g_5",		std
+	"lcd_g_6",		std
+	"lcd_g_7",		std
+	"lcd_hsync",		std
+	"lcd_oe",		std
+	"lcd_pclk",		std
+	"lcd_r_0",		std
+	"lcd_r_1",		std
+	"lcd_r_2",		std
+	"lcd_r_3",		std
+	"lcd_r_4",		std
+	"lcd_r_5",		std
+	"lcd_r_6",		std
+	"lcd_r_7",		std
+	"lcd_vsync",		std
+	"mdmgpio0",		std
+	"mdmgpio1",		std
+	"mdmgpio2",		std
+	"mdmgpio3",		std
+	"mdmgpio4",		std
+	"mdmgpio5",		std
+	"mdmgpio6",		std
+	"mdmgpio7",		std
+	"mdmgpio8",		std
+	"mphi_data_0",		std
+	"mphi_data_1",		std
+	"mphi_data_2",		std
+	"mphi_data_3",		std
+	"mphi_data_4",		std
+	"mphi_data_5",		std
+	"mphi_data_6",		std
+	"mphi_data_7",		std
+	"mphi_data_8",		std
+	"mphi_data_9",		std
+	"mphi_data_10",		std
+	"mphi_data_11",		std
+	"mphi_data_12",		std
+	"mphi_data_13",		std
+	"mphi_data_14",		std
+	"mphi_data_15",		std
+	"mphi_ha0",		std
+	"mphi_hat0",		std
+	"mphi_hat1",		std
+	"mphi_hce0_n",		std
+	"mphi_hce1_n",		std
+	"mphi_hrd_n",		std
+	"mphi_hwr_n",		std
+	"mphi_run0",		std
+	"mphi_run1",		std
+	"mtx_scan_clk",		std
+	"mtx_scan_data",	std
+	"nand_ad_0",		std
+	"nand_ad_1",		std
+	"nand_ad_2",		std
+	"nand_ad_3",		std
+	"nand_ad_4",		std
+	"nand_ad_5",		std
+	"nand_ad_6",		std
+	"nand_ad_7",		std
+	"nand_ale",		std
+	"nand_cen_0",		std
+	"nand_cen_1",		std
+	"nand_cle",		std
+	"nand_oen",		std
+	"nand_rdy_0",		std
+	"nand_rdy_1",		std
+	"nand_wen",		std
+	"nand_wp",		std
+	"pc1",			std
+	"pc2",			std
+	"pmu_int",		std
+	"pmu_scl",		i2c
+	"pmu_sda",		i2c
+	"rfst2g_mtsloten3g",	std
+	"rgmii_0_rx_ctl",	std
+	"rgmii_0_rxc",		std
+	"rgmii_0_rxd_0",	std
+	"rgmii_0_rxd_1",	std
+	"rgmii_0_rxd_2",	std
+	"rgmii_0_rxd_3",	std
+	"rgmii_0_tx_ctl",	std
+	"rgmii_0_txc",		std
+	"rgmii_0_txd_0",	std
+	"rgmii_0_txd_1",	std
+	"rgmii_0_txd_2",	std
+	"rgmii_0_txd_3",	std
+	"rgmii_1_rx_ctl",	std
+	"rgmii_1_rxc",		std
+	"rgmii_1_rxd_0",	std
+	"rgmii_1_rxd_1",	std
+	"rgmii_1_rxd_2",	std
+	"rgmii_1_rxd_3",	std
+	"rgmii_1_tx_ctl",	std
+	"rgmii_1_txc",		std
+	"rgmii_1_txd_0",	std
+	"rgmii_1_txd_1",	std
+	"rgmii_1_txd_2",	std
+	"rgmii_1_txd_3",	std
+	"rgmii_gpio_0",		std
+	"rgmii_gpio_1",		std
+	"rgmii_gpio_2",		std
+	"rgmii_gpio_3",		std
+	"rtxdata2g_txdata3g1",	std
+	"rtxen2g_txdata3g2",	std
+	"rxdata3g0",		std
+	"rxdata3g1",		std
+	"rxdata3g2",		std
+	"sdio1_clk",		std
+	"sdio1_cmd",		std
+	"sdio1_data_0",		std
+	"sdio1_data_1",		std
+	"sdio1_data_2",		std
+	"sdio1_data_3",		std
+	"sdio4_clk",		std
+	"sdio4_cmd",		std
+	"sdio4_data_0",		std
+	"sdio4_data_1",		std
+	"sdio4_data_2",		std
+	"sdio4_data_3",		std
+	"sim_clk",		std
+	"sim_data",		std
+	"sim_det",		std
+	"sim_resetn",		std
+	"sim2_clk",		std
+	"sim2_data",		std
+	"sim2_det",		std
+	"sim2_resetn",		std
+	"sri_c",		std
+	"sri_d",		std
+	"sri_e",		std
+	"ssp_extclk",		std
+	"ssp0_clk",		std
+	"ssp0_fs",		std
+	"ssp0_rxd",		std
+	"ssp0_txd",		std
+	"ssp2_clk",		std
+	"ssp2_fs_0",		std
+	"ssp2_fs_1",		std
+	"ssp2_fs_2",		std
+	"ssp2_fs_3",		std
+	"ssp2_rxd_0",		std
+	"ssp2_rxd_1",		std
+	"ssp2_txd_0",		std
+	"ssp2_txd_1",		std
+	"ssp3_clk",		std
+	"ssp3_fs",		std
+	"ssp3_rxd",		std
+	"ssp3_txd",		std
+	"ssp4_clk",		std
+	"ssp4_fs",		std
+	"ssp4_rxd",		std
+	"ssp4_txd",		std
+	"ssp5_clk",		std
+	"ssp5_fs",		std
+	"ssp5_rxd",		std
+	"ssp5_txd",		std
+	"ssp6_clk",		std
+	"ssp6_fs",		std
+	"ssp6_rxd",		std
+	"ssp6_txd",		std
+	"stat_1",		std
+	"stat_2",		std
+	"sysclken",		std
+	"traceclk",		std
+	"tracedt00",		std
+	"tracedt01",		std
+	"tracedt02",		std
+	"tracedt03",		std
+	"tracedt04",		std
+	"tracedt05",		std
+	"tracedt06",		std
+	"tracedt07",		std
+	"tracedt08",		std
+	"tracedt09",		std
+	"tracedt10",		std
+	"tracedt11",		std
+	"tracedt12",		std
+	"tracedt13",		std
+	"tracedt14",		std
+	"tracedt15",		std
+	"txdata3g0",		std
+	"txpwrind",		std
+	"uartb1_ucts",		std
+	"uartb1_urts",		std
+	"uartb1_urxd",		std
+	"uartb1_utxd",		std
+	"uartb2_urxd",		std
+	"uartb2_utxd",		std
+	"uartb3_ucts",		std
+	"uartb3_urts",		std
+	"uartb3_urxd",		std
+	"uartb3_utxd",		std
+	"uartb4_ucts",		std
+	"uartb4_urts",		std
+	"uartb4_urxd",		std
+	"uartb4_utxd",		std
+	"vc_cam1_scl",		i2c
+	"vc_cam1_sda",		i2c
+	"vc_cam2_scl",		i2c
+	"vc_cam2_sda",		i2c
+	"vc_cam3_scl",		i2c
+	"vc_cam3_sda",		i2c
Signature · 1 line
1.7.9.5
#5 lore raw

Re: [PATCH 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 64 lines · Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
  .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  419 ++++++++++++++++++++
  1 file changed, 419 insertions(+)

create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +48 -0
new file mode 100644
index 0000000..79e0e5a
@@ -0,0 +1,419 @@
+Broadcom Capri Pin Controller
+
+This is a pin controller for the Broadcom BCM281xx SoC family, which includes
+BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs.
+
+=== Pin Controller Node ===
+
+Required Properties:
+
+- compatible:	Must be "brcm,capri-pinctrl".
+- reg:		Base address of the PAD Controller register block and the size
+		of the block.
+
+For example, the following is the bare minimum node:
+
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
+
+As a Pin Controller Device, in addition to the required properties, this node
+should also contain the pin configuration nodes that client devices reference,
+if any.
+
+=== Pin Configuration Node ===
+
+Each pin configuration node is a sub-node of the pin controller node and is a
+container of an arbitrary number of subnodes, called group nodes.
+
+Please refer to the pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the definition of a
+"pin configuration node".
+
+=== Group Node ===
+
+A group node specifies the desired pin mux and/or pin configuration for an
+arbitrary number of pins.  The group node only affect the properties specified
+in the node, and has no effect on any properties that are omitted.
+
+The names of the group nodes are optional and not used. The group nodes have
+the following properties:
+
+Required Properties:
+
+- brcm,pins:	Multiple strings.  Specifies the name(s) of one or more pins to
+		be configured by this node.
+
+Optional Properties:

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 58

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +10 -0
+
+- brcm,function: Multiple strings.  Specifies the pin mux selection.  Values are:
+		"alt1", "alt2", "alt3", "alt4"
+- brcm,hysteresis: Multiple integers, applicable to standard pins only.  Turns
+		on hysteresis of input.
+		0: TTL input, 1: Schmitt Trigger input
+- brcm,pull:	Multiple integers, applicable to standard pins only.  Specifies
+		pull-up or pull-down.
+		0: neither, 1: pull-up, 2: pull-down, 3: both
+- brcm,input_dis: Multiple integers, applicable to all pins.  Input disable

I missed this before. Hyphens are preferred over underscores in property names.

Quoted 26 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +26 -0
+		control.
+		0: off, 1: input disabled
+- brcm,slew:	Multiple integers.  Slew rate of output.
+		0: fast output, 1: normal output (most pins)
+		0: normal output, 1: fast output (IC_DM and IC_DP)
+		0: Fast mode, 1: High speed mode (I2C)
+- brcm,drive_str: Multiple integers.  Drive strength.
+		0: 2 mA
+		1: 4 mA
+		2: 6 mA
+		3: 8 mA
+		4: 10 mA
+		5: 12 mA
+		6: 14 mA
+		7: 16 mA
+- brcm,pull_up_str: Multiple integers.  Pull Up strength.
+		0: No pull-up
+		1: 1.2 kOhm
+		2: 1.8 kOhm
+		3: 720 Ohm
+		4: 2.7 kOhm
+		5: 831 Ohm
+		6: 1.08 kOhm
+		7: 568 Ohm
+- brcm,mode:	Multiple integers.  Mode select.
+		0: Fast mode, 1: High Speed mode (I2C)
#6 lore raw

Re: [PATCH 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

In reply to Sherman Yin

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 64

Quoted 13 lines · Sherman Yin

+- brcm,hysteresis: Multiple integers, applicable to standard pins only. Turns

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +12 -0
+               on hysteresis of input.
+               0: TTL input, 1: Schmitt Trigger input
+- brcm,pull:   Multiple integers, applicable to standard pins only.  Specifies
+               pull-up or pull-down.
+               0: neither, 1: pull-up, 2: pull-down, 3: both
+- brcm,input_dis: Multiple integers, applicable to all pins.  Input disable
+               control.
+               0: off, 1: input disabled
+- brcm,slew:   Multiple integers.  Slew rate of output.
+               0: fast output, 1: normal output (most pins)
+               0: normal output, 1: fast output (IC_DM and IC_DP)
+               0: Fast mode, 1: High speed mode (I2C)

0,0,0? I don't get this.

Quoted 10 lines

+- brcm,drive_str: Multiple integers. Drive strength.

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +9 -0
+               0: 2 mA
+               1: 4 mA
+               2: 6 mA
+               3: 8 mA
+               4: 10 mA
+               5: 12 mA
+               6: 14 mA
+               7: 16 mA
+- brcm,pull_up_str: Multiple integers.  Pull Up strength.

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 84

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +10 -0
+               0: No pull-up
+               1: 1.2 kOhm
+               2: 1.8 kOhm
+               3: 720 Ohm
+               4: 2.7 kOhm
+               5: 831 Ohm
+               6: 1.08 kOhm
+               7: 568 Ohm
+- brcm,mode:   Multiple integers.  Mode select.
+               0: Fast mode, 1: High Speed mode (I2C)

This should *all* be using generic pin config.

For the devicetree side of this, read:
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt

Your driver should also be selecting GENERIC_PINCONF in drivers/pinctrl/Kconfig so you use the generic pinconf library.

Read
include/linux/pinctrl/pinconf-generic.h
for definitions of the generic config options.

Your driver should be calling pinconf_generic_parse_dt_config() and pinconf_generic_dt_subnode_to_map() to get the config out of the device tree nodes.

I don't understand the brcm,mode. Can this be selected on all pins or just for I2C? I would suspect it be related to things like disabling the schmitt-trigger, but elaborate on this so we understand what this is. It may need to be added to the generic options if it turns out to be unique enough.

New options can be added but first we need to exactly understand those to see that their definitions does not overlap with already existing generic pin config terminology.

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 152

Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +3 -0
+The following are valid pin names and their pin types:
+
+       "adcsync",              std

std? std what?

Sorry I don't get anything from this list... you need to be way more specific in defining what is happening here.

Yours,
Linus Walleij

#7 lore raw

RE: [PATCH 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 28 lines

This should *all* be using generic pin config.

For the devicetree side of this, read:
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt

Your driver should also be selecting GENERIC_PINCONF in drivers/pinctrl/Kconfig so you use the generic pinconf library.

Read
include/linux/pinctrl/pinconf-generic.h
for definitions of the generic config options.

Your driver should be calling pinconf_generic_parse_dt_config() and pinconf_generic_dt_subnode_to_map() to get the config out of the device tree nodes.

I don't understand the brcm,mode. Can this be selected on all pins or just for I2C? I would suspect it be related to things like disabling the schmitt-trigger, but elaborate on this so we understand what this is. It may need to be added to the generic options if it turns out to be unique enough.

New options can be added but first we need to exactly understand those to see that their definitions does not overlap with already existing generic pin config terminology.

Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 152

Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +3 -0
+The following are valid pin names and their pin types:
+
+       "adcsync",              std

std? std what?

Sorry I don't get anything from this list... you need to be way more specific in defining what is happening here.

Ok, I think some new APIs have been added since I first wrote this driver early this year. I'll take a look at the generic pin code and rework this driver.

Thanks,
Sherman

#8 lore raw

PATCH 3/4 ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
 arch/arm/mach-bcm/Kconfig       |    2 +
 drivers/pinctrl/Kconfig         |   10 +
 drivers/pinctrl/Makefile        |    1 +
 drivers/pinctrl/pinctrl-capri.c | 1727 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1740 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
arch/arm/mach-bcm/Kconfig +2 -0
index 69d67f7..2546365 100644
@@ -10,6 +10,8 @@ config ARCH_BCM
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_TIME
 	select GPIO_BCM
+	select PINCTRL
+	select PINCTRL_CAPRI
 	select SPARSE_IRQ
 	select TICK_ONESHOT
 	select CACHE_L2X0
drivers/pinctrl/Kconfig +10 -0
index b6e864e..f97eb11 100644
@@ -75,6 +75,16 @@ config PINCTRL_BCM2835
 	select PINMUX
 	select PINCONF
 
+config PINCTRL_CAPRI
+	bool "Broadcom Capri pinctrl driver"
+	select PINMUX
+	select PINCONF
+	help
+	  Say Y here to support Broadcom Capri pinctrl driver, which is used for
+	  the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351,
+	  BCM28145, and BCM28155 SoCs.  This driver requires the pinctrl
+	  framework.  GPIO is provided by a separate GPIO driver.
+
 config PINCTRL_IMX
 	bool
 	select PINMUX
drivers/pinctrl/Makefile +1 -0
index 496d9bf..5e1a68e 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_AB8505)	+= pinctrl-ab8505.o
 obj-$(CONFIG_PINCTRL_AT91)	+= pinctrl-at91.o
 obj-$(CONFIG_PINCTRL_BCM2835)	+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BAYTRAIL)	+= pinctrl-baytrail.o
+obj-$(CONFIG_PINCTRL_CAPRI)	+= pinctrl-capri.o
 obj-$(CONFIG_PINCTRL_IMX)	+= pinctrl-imx.o
 obj-$(CONFIG_PINCTRL_IMX35)	+= pinctrl-imx35.o
 obj-$(CONFIG_PINCTRL_IMX51)	+= pinctrl-imx51.o
drivers/pinctrl/pinctrl-capri.c new file +1727 -0

1,727 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#9 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 5 lines · Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

(...)

drivers/pinctrl/Kconfig config PINCTRL_BCM2835 · line 86

Quoted 9 lines
drivers/pinctrl/Kconfig +9 -0
+config PINCTRL_CAPRI
+       bool "Broadcom Capri pinctrl driver"
+       select PINMUX
+       select PINCONF
+       help
+         Say Y here to support Broadcom Capri pinctrl driver, which is used for
+         the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351,
+         BCM28145, and BCM28155 SoCs.  This driver requires the pinctrl
+         framework.  GPIO is provided by a separate GPIO driver.

As mentioned this should be selecting and using GENERIC_PINCONF. Basically I want that to happen before we look further at this code.

(But I'll take a quick glance anyway...)

drivers/pinctrl/pinctrl-capri.c line 27

Quoted 3 lines
drivers/pinctrl/pinctrl-capri.c new file +3 -0
+#define CAPRI_PINCONF_PACK(val, mask)     (((val) << 16) | ((mask) & 0xffff))
+#define CAPRI_PINCONF_UNPACK_VAL(conf)    ((conf) >> 16)
+#define CAPRI_PINCONF_UNPACK_MASK(conf)   ((conf) & 0xffff)

This custom horror goes away by using the macros from genric pin config <linux/pinctrl/pinconf-generic.h> instead.

drivers/pinctrl/pinctrl-capri.c line 53

Quoted 9 lines
drivers/pinctrl/pinctrl-capri.c new file +9 -0
+static const struct capri_cfg_param capri_pinconf_params[] = {
+       {"brcm,hysteresis",     CAPRI_PINCONF_PARAM_HYST},
+       {"brcm,pull",           CAPRI_PINCONF_PARAM_PULL},
+       {"brcm,slew",           CAPRI_PINCONF_PARAM_SLEW},
+       {"brcm,input_dis",      CAPRI_PINCONF_PARAM_INPUT_DIS},
+       {"brcm,drive_str",      CAPRI_PINCONF_PARAM_DRV_STR},
+       {"brcm,pull_up_str",    CAPRI_PINCONF_PARAM_PULL_UP_STR},
+       {"brcm,mode",           CAPRI_PINCONF_PARAM_MODE},
+};

As well as all this stuff...

Quoted 1 line

+/* Standard pin register */

Add some more elaborate explanation here. I am half-guessing that most of the registers are laid out like this and then there are two exceptions, then write that right here in the comment.

(BTW: this is a HW/driver detail and should not be written in the device tree doc as was done in patch 2)

drivers/pinctrl/pinctrl-capri.c line 91

Quoted 5 lines
drivers/pinctrl/pinctrl-capri.c new file +5 -0
+/* Macro to update reg with new pin config param */
+#define CAPRI_PIN_REG_SET(reg, type, param, val)                       \
+       (((reg) & ~CAPRI_ ## type ## _PIN_REG_ ## param ## _MASK)       \
+       | (((val) << CAPRI_ ## type ## _PIN_REG_ ## param ## _SHIFT)    \
+       & CAPRI_ ## type ## _PIN_REG_ ## param ## _MASK))

No thanks.

Rewrite this into a static inline which has the same effect when compiling, but produces *WAY* more readable code than this horrid thing. Plus you can type the arguments.

Quoted 1 line

+#define _PIN(offset) (offset)

This macro isn't exactly useful.

drivers/pinctrl/pinctrl-capri.c line 137

Quoted 5 lines
drivers/pinctrl/pinctrl-capri.c new file +5 -0
+/*
+ * Pin number definition.  The order here must be the same as defined in the
+ * PADCTRLREG block in the RDB.
+ */
+#define CAPRI_PIN_ADCSYNC              _PIN(0)

If it's just going to be like that, then skip the _PIN() macro.

drivers/pinctrl/pinctrl-capri.c line 1451

Quoted 6 lines
drivers/pinctrl/pinctrl-capri.c new file +6 -0
+/* Process the pin configuration node */
+static int capri_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
+                                       struct device_node *pnode,
+                                       struct pinctrl_map **map,
+                                       unsigned *nmaps)
+{

Make use of these from pinctrl-utils.c:
pinctrl_utils_reserve_map()
pinctrl_utils_add_map_mux()
pinctrl_utils_add_map_configs()
pinctrl_utils_dt_free_map()

Then you get rid of another big chunk of boilerplate code.

After these changes the driver will be much smaller and cleaner and we can take a closer look.

Yours,
Linus Walleij

#10 lore raw

RE: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 10 lines

drivers/pinctrl/Kconfig config PINCTRL_BCM2835 · line 86

Quoted 9 lines
drivers/pinctrl/Kconfig +9 -0
+config PINCTRL_CAPRI
+       bool "Broadcom Capri pinctrl driver"
+       select PINMUX
+       select PINCONF
+       help
+         Say Y here to support Broadcom Capri pinctrl driver, which is used for
+         the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351,
+         BCM28145, and BCM28155 SoCs.  This driver requires the pinctrl
+         framework.  GPIO is provided by a separate GPIO driver.
Quoted 4 lines

As mentioned this should be selecting and using GENERIC_PINCONF. Basically I want that to happen before we look further at this code.

(But I'll take a quick glance anyway...)

Sure, working on it.

Quoted 6 lines

drivers/pinctrl/pinctrl-capri.c line 27

Quoted 3 lines
drivers/pinctrl/pinctrl-capri.c new file +3 -0
+#define CAPRI_PINCONF_PACK(val, mask)     (((val) << 16) | ((mask) & 0xffff))
+#define CAPRI_PINCONF_UNPACK_VAL(conf)    ((conf) >> 16)
+#define CAPRI_PINCONF_UNPACK_MASK(conf)   ((conf) & 0xffff)

This custom horror goes away by using the macros from genric pin config <linux/pinctrl/pinconf-generic.h> instead.

Actually these are used differently than the pack/unpack functions in the pinconf- generic.h. These pack the bit value and bit mask to be written to a register, whereas the pinconf-generic ones pack the parameter id and value. But I get what you're saying and will try to reuse as much as possible from the pinconf generic functions and utils.

Quoted 11 lines

drivers/pinctrl/pinctrl-capri.c line 53

Quoted 9 lines
drivers/pinctrl/pinctrl-capri.c new file +9 -0
+static const struct capri_cfg_param capri_pinconf_params[] = {
+       {"brcm,hysteresis",     CAPRI_PINCONF_PARAM_HYST},
+       {"brcm,pull",           CAPRI_PINCONF_PARAM_PULL},
+       {"brcm,slew",           CAPRI_PINCONF_PARAM_SLEW},
+       {"brcm,input_dis",      CAPRI_PINCONF_PARAM_INPUT_DIS},
+       {"brcm,drive_str",      CAPRI_PINCONF_PARAM_DRV_STR},
+       {"brcm,pull_up_str",    CAPRI_PINCONF_PARAM_PULL_UP_STR},
+       {"brcm,mode",           CAPRI_PINCONF_PARAM_MODE},
+};

As well as all this stuff...

OK. Will see if I can find something suitable for "input disable" and "mode"

Quoted 8 lines
Quoted 1 line

+/* Standard pin register */

Add some more elaborate explanation here. I am half-guessing that most of the registers are laid out like this and then there are two exceptions, then write that right here in the comment.

(BTW: this is a HW/driver detail and should not be written in the device tree doc as was done in patch 2)

Yes you guessed correctly. Most of the pin have bit-field definitions like the "standard" or "std" pin register. There are 12 pins that have the i2c definitions, and 2 pins that have the hdmi definitions. Will add explanation to the code.

However, I wanted to explain this in the DT doc as well because, for example, setting a slew rate for an hdmi pin would be invalid.

Quoted 11 lines

drivers/pinctrl/pinctrl-capri.c line 91

Quoted 5 lines
drivers/pinctrl/pinctrl-capri.c new file +5 -0
+/* Macro to update reg with new pin config param */
+#define CAPRI_PIN_REG_SET(reg, type, param, val)                       \
+       (((reg) & ~CAPRI_ ## type ## _PIN_REG_ ## param ## _MASK)       \
+       | (((val) << CAPRI_ ## type ## _PIN_REG_ ## param ## _SHIFT)    \
+       & CAPRI_ ## type ## _PIN_REG_ ## param ## _MASK))

No thanks.

Rewrite this into a static inline which has the same effect when compiling, but produces *WAY* more readable code than this horrid thing. Plus you can type the arguments.

Ok. The reason I used a macro is to take shortcuts given how the SHIFT and MASK #defines follow the format

CAPRI_<pin type>_PIN_REG_<parameter name>_<mask or shift>

I'll try to simply this.

Quoted 11 lines
Quoted 1 line

+#define _PIN(offset) (offset)

This macro isn't exactly useful.

drivers/pinctrl/pinctrl-capri.c line 137

Quoted 5 lines
drivers/pinctrl/pinctrl-capri.c new file +5 -0
+/*
+ * Pin number definition.  The order here must be the same as defined in the
+ * PADCTRLREG block in the RDB.
+ */
+#define CAPRI_PIN_ADCSYNC              _PIN(0)

If it's just going to be like that, then skip the _PIN() macro.

Removed. Was following pinctrl-tegra20.c where they have the _GPIO and _PIN macros. I guess it would be useful if we need to change the order of the enums in the future, but that's not the case at the moment for capri.

Quoted 13 lines

drivers/pinctrl/pinctrl-capri.c line 1451

Quoted 6 lines
drivers/pinctrl/pinctrl-capri.c new file +6 -0
+/* Process the pin configuration node */
+static int capri_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
+                                       struct device_node *pnode,
+                                       struct pinctrl_map **map,
+                                       unsigned *nmaps)
+{

Make use of these from pinctrl-utils.c:
pinctrl_utils_reserve_map()
pinctrl_utils_add_map_mux()
pinctrl_utils_add_map_configs()
pinctrl_utils_dt_free_map()

Quoted 4 lines

Then you get rid of another big chunk of boilerplate code.

After these changes the driver will be much smaller and cleaner and we can take a closer look.

Yea actually the generic code is similar to what I have, there are some differences in terms of pre-allocating / re-allocating the pinctrl_maps. Seems like there are very few users of these functions at the moment. Anyway I'll try to make use of them.

Thanks for the review.

Regards,
Sherman

#11 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 12 lines · Sherman Yin
Quoted 11 lines

drivers/pinctrl/pinctrl-capri.c line 53

Quoted 9 lines
drivers/pinctrl/pinctrl-capri.c new file +9 -0
+static const struct capri_cfg_param capri_pinconf_params[] = {
+       {"brcm,hysteresis",     CAPRI_PINCONF_PARAM_HYST},
+       {"brcm,pull",           CAPRI_PINCONF_PARAM_PULL},
+       {"brcm,slew",           CAPRI_PINCONF_PARAM_SLEW},
+       {"brcm,input_dis",      CAPRI_PINCONF_PARAM_INPUT_DIS},
+       {"brcm,drive_str",      CAPRI_PINCONF_PARAM_DRV_STR},
+       {"brcm,pull_up_str",    CAPRI_PINCONF_PARAM_PULL_UP_STR},
+       {"brcm,mode",           CAPRI_PINCONF_PARAM_MODE},
+};

As well as all this stuff...

Quoted 1 line

OK. Will see if I can find something suitable for "input disable" and "mode"

Let's discuss this. What exactly does "input disable" and "mode" mean, in electrical terms?

When you come down to what actually happens it may turn out that "input disable" is PIN_CONFIG_OUTPUT, which implicitly turns off input does it not?

Yours,
Linus Walleij

#12 lore raw

RE: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

drivers/pinctrl/pinctrl-capri.c line 53

Quoted 9 lines
drivers/pinctrl/pinctrl-capri.c new file +9 -0
+static const struct capri_cfg_param capri_pinconf_params[] = {
+       {"brcm,hysteresis",     CAPRI_PINCONF_PARAM_HYST},
+       {"brcm,pull",           CAPRI_PINCONF_PARAM_PULL},
+       {"brcm,slew",           CAPRI_PINCONF_PARAM_SLEW},
+       {"brcm,input_dis",      CAPRI_PINCONF_PARAM_INPUT_DIS},
+       {"brcm,drive_str",      CAPRI_PINCONF_PARAM_DRV_STR},
+       {"brcm,pull_up_str",    CAPRI_PINCONF_PARAM_PULL_UP_STR},
+       {"brcm,mode",           CAPRI_PINCONF_PARAM_MODE},
+};

As well as all this stuff...

Quoted 8 lines
Quoted 1 line

OK. Will see if I can find something suitable for "input disable" and "mode"

Let's discuss this. What exactly does "input disable" and "mode" mean, in electrical terms?

When you come down to what actually happens it may turn out that "input disable" is PIN_CONFIG_OUTPUT, which implicitly turns off input does it not?

I'm going to verify the details with our hardware team first, and will let you know if we think we can use one of the existing generic parameters or if we need a new one.

Regards,
Sherman

#13 lore raw

RE: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 17 lines
Quoted 17 lines
Quoted 12 lines
Quoted 11 lines

drivers/pinctrl/pinctrl-capri.c line 53

Quoted 9 lines
drivers/pinctrl/pinctrl-capri.c new file +9 -0
+static const struct capri_cfg_param capri_pinconf_params[] = {
+       {"brcm,hysteresis",     CAPRI_PINCONF_PARAM_HYST},
+       {"brcm,pull",           CAPRI_PINCONF_PARAM_PULL},
+       {"brcm,slew",           CAPRI_PINCONF_PARAM_SLEW},
+       {"brcm,input_dis",      CAPRI_PINCONF_PARAM_INPUT_DIS},
+       {"brcm,drive_str",      CAPRI_PINCONF_PARAM_DRV_STR},
+       {"brcm,pull_up_str",    CAPRI_PINCONF_PARAM_PULL_UP_STR},
+       {"brcm,mode",           CAPRI_PINCONF_PARAM_MODE},
+};

As well as all this stuff...

Quoted 1 line

OK. Will see if I can find something suitable for "input disable" and "mode"

Let's discuss this. What exactly does "input disable" and "mode" mean, in electrical terms?

Quoted 7 lines
Quoted 3 lines

When you come down to what actually happens it may turn out that "input disable" is PIN_CONFIG_OUTPUT, which implicitly turns off input does it not?

I'm going to verify the details with our hardware team first, and will let you know if we think we can use one of the existing generic parameters or if we need a new one.

"input disable"
This setting disconnects the input (DIN) to the internal logic from the pin pad. However, the output (DOUT) can still drive the pad. It seems to match PIN_CONFIG_OUTPUT, but the current generic option is either "output-low" or "output-high" - are these referring to a static output of 0 and 1?

"mode"
This controls several aspect of the pin (slew rate, pull up strength, etc) to meet I2C specs for Standard/Fast mode vs High Speed mode. I think the best way is to map this to slew rate, which would require some explanation because the meaning of slew rate differs depending on what pin function is selected:
- When I2C (*_SCL or *_SDA) function is selected for the pin: 0: Standard (100kbps) & Fast mode (400kbps), 1: High Speed mode (3.4Mbps)
- When IC_DM or IC_DP function is selected, 0: normal slew rate, 1: fast slew rate
- Else: 0: fast slew rate, 1: normal slew rate

Also, it seems like I have to add "slew-rate" to dt_params[] in pinconf-generic.c and pinctrl-bindings.txt.

#14 lore raw

RE: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 31 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

As well as all this stuff...

OK. Will see if I can find something suitable for "input disable" and "mode"

Let's discuss this. What exactly does "input disable" and "mode" mean, in electrical terms?

Quoted 7 lines
Quoted 3 lines

When you come down to what actually happens it may turn out that "input disable" is PIN_CONFIG_OUTPUT, which implicitly turns off input does it not?

I'm going to verify the details with our hardware team first, and will let you know if we think we can use one of the existing generic parameters or if we need a new one.

"input disable"
This setting disconnects the input (DIN) to the internal logic from the pin pad. However, the output (DOUT) can still drive the pad. It seems to match PIN_CONFIG_OUTPUT, but the current generic option is either "output-low" or "output-high" - are these referring to a static output of 0 and 1?

"mode"
This controls several aspect of the pin (slew rate, pull up strength, etc) to meet I2C specs for Standard/Fast mode vs High Speed mode. I think the best way is to map this to slew rate, which would require some explanation because the meaning of slew rate differs depending on what pin function is selected:
- When I2C (*_SCL or *_SDA) function is selected for the pin: 0: Standard (100kbps) & Fast mode (400kbps), 1: High Speed mode (3.4Mbps)
- When IC_DM or IC_DP function is selected, 0: normal slew rate, 1: fast slew rate
- Else: 0: fast slew rate, 1: normal slew rate

Quoted 2 lines

Also, it seems like I have to add "slew-rate" to dt_params[] in pinconf-generic.c and pinctrl-bindings.txt.

Hi Linus,

So I will go ahead and make the change in pinconf-generic.c and pinctrl-bindings.txt to include parsing of the "slew-rate" property and submit it as part of my pinctrl changes.

Question regarding pinctrl-generic: in pinctrl-bindings.txt, this is said about the "function" property:

169- function takes a list of function names/IDs as a required argument. The

170  specific binding for the hardware defines:
171  - Whether the entries are integers or strings, and their meaning.
172  - Whether only a single entry is allowed (which is applied to all entries
173    in the pins property), or whether there may alternatively be one entry per
174    entry in the pins property, in which case the list lengths must match, and
175    for each list index i, the function at list index i is applied to the pin
176    at list index i.

(Although it looks like pinconf_generic_dt_subnode_to_map() does not support the "one entry per pin feature" for the "function" property yet.)

In my driver, I have the "one entry per pin" support for all my properties instead of just the function property, like the "drive_str" property below:

+ grp_1 {
+ brcm,pins = "pin1", "pin2", "pin3";
+ brcm,function = "alt1", "alt2", "alt1";
+ brcm,drive_str = <2 4 6>;
+ brcm,slew = <1>;
+ };

I thought that would be convenient and allow users to group pins together based on functionality and without the restriction that the pins must have the same properties. Do you think that's a good idea and are there plans to support that in the generic pinconfig? If so, I can look into porting my implementation to pinconf-generic.c - but first I have to figure out how some of the properties would work if more than one value could be specified (eg. "bias-disable" which takes no values)

Thanks,
Sherman

#15 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 3 lines · Sherman Yin

So I will go ahead and make the change in pinconf-generic.c and pinctrl-bindings.txt to include parsing of the "slew-rate" property and submit it as part of my pinctrl changes.

OK, good.

Quoted 18 lines

Question regarding pinctrl-generic: in pinctrl-bindings.txt, this is said about the "function" property:

169- function takes a list of function names/IDs as a required argument. The

170  specific binding for the hardware defines:
171  - Whether the entries are integers or strings, and their meaning.
172  - Whether only a single entry is allowed (which is applied to all entries
173    in the pins property), or whether there may alternatively be one entry per
174    entry in the pins property, in which case the list lengths must match, and
175    for each list index i, the function at list index i is applied to the pin
176    at list index i.

(Although it looks like pinconf_generic_dt_subnode_to_map() does not support the "one entry per pin feature" for the "function" property yet.)

In my driver, I have the "one entry per pin" support for all my properties instead of just the function property, like the "drive_str" property below:

Review

Quoted 6 lines
(quoted diff) +6 -0
+               grp_1 {
+                       brcm,pins       = "pin1", "pin2", "pin3";
+                       brcm,function   = "alt1", "alt2", "alt1";
+                       brcm,drive_str  = <2 4 6>;
+                       brcm,slew       = <1>;
+               };

OK.

Quoted 7 lines

I thought that would be convenient and allow users to group pins together based on functionality and without the restriction that the pins must have the same properties. Do you think that's a good idea and are there plans to support that in the generic pinconfig? If so, I can look into porting my implementation to pinconf-generic.c - but first I have to figure out how some of the properties would work if more than one value could be specified (eg. "bias-disable" which takes no values)

Hm I don't quite get it I think. It depends on the old bindings still working and full compatibility with old device trees. It might be a bit confusing.

I need help from Heiko on this I think.

Yours,
Linus Walleij

#16 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Am Montag, 4. November 2013, 13:24:10 schrieb Linus Walleij:

Quoted 21 lines
Quoted 10 lines

In my driver, I have the "one entry per pin" support for all my properties instead of just the function property, like the "drive_str" property below:

(quoted diff) +6 -0
+               grp_1 {
+                       brcm,pins       = "pin1", "pin2", "pin3";
+                       brcm,function   = "alt1", "alt2", "alt1";
+                       brcm,drive_str  = <2 4 6>;
+                       brcm,slew       = <1>;
+               };
Quoted 8 lines · Sherman Yin

I thought that would be convenient and allow users to group pins together based on functionality and without the restriction that the pins must have the same properties.
Do you think that's a good idea and are there
plans to support that in the generic pinconfig? If so, I can look into porting my implementation to pinconf-generic.c - but first I have to figure out how some of the properties would work if more than one value could be specified (eg. "bias-disable" which takes no values)

Quoted 5 lines

Hm I don't quite get it I think. It depends on the old bindings still working and full compatibility with old device trees. It might be a bit confusing.

I need help from Heiko on this I think.

I remember we had a discussion about how things like bias-disable explicitly shouldn't have a value, when they are represented in the list-format:

		pcfg_pull_none: pcfg_pull_none {
			bias-disable;
		};

so a bias-disable = <1> was explicitly "forbidden" [for a lack of a better word]. And it was similar for other options, the parameter not meant to be indicating if they are active but really only setting the "strength" or so.

But how to represent this in the list variant above, I don't know.

Having a brcm,bias-disable = <0>, <1>, ... thus looks wrong and also does not seem to scale well to all the possible options (bias-* and the others).

Having a brcm,bias = <x>, <y>, <z>, ... with constants denoting pull-up, - down, disable, etc might be possible, but I'm missing the electrical engineering knowledge on the possibility of those bias-things being combined.

For example on my rockchip-pinctrl driver, the pins also do not need to have the same configuration to be grouped together - inspired at the time by the format the at91 driver uses. Here each pin forms a tuple instead of being identified by an index. In it the basic function is set directly and then references a predefined list of pinctrl options.

		pcfg_pull_none: pcfg_pull_none {
			bias-disable;
		};

		uart0 {
			uart0_xfer: uart0-xfer {
				rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_none>,
							 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_none>;
			};

...

		};

A switch to something like to following would also be a possibility:

	pcfg1: pcfg1 {
		bias-disable;
		slew-rate = <1>;
	};

	pcfg2: pcfg2 {
		drive-strength = <2>;
	};

	grp_1 {
		brcm,pins       = "pin1", "pin2", "pin3";
		brcm,function   = "alt1", "alt2", "alt1";
		brcm,pinconf = <&pcfg1>, <&pcfg2>
	};

So far my unsorted thoughts [and recoverable memory] on this :-) Heiko

#17 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 10 lines · Heiko St?bner

I remember we had a discussion about how things like bias-disable explicitly shouldn't have a value, when they are represented in the list-format:

		pcfg_pull_none: pcfg_pull_none {
			bias-disable;
		};

so a bias-disable = <1> was explicitly "forbidden" [for a lack of a better word]. And it was similar for other options, the parameter not meant to be indicating if they are active but really only setting the "strength" or so.

Pure Boolean values should be represented as a valueless property. If the property is present, the value is true, otherwise false.

However, pinctrl bindings often don't represent Boolean values, but rather tri-states, with the following values:

* Don't touch this configuration option at all (missing)
* Enable the option (<1>)
* Disable the option (<0>)

The reason for using tri-states being that you might want to write:

xxx1 {
    pins = <PINA>, <PINB>, <PINC>;
    function = <...>;
    // this node doesn't affect pullup
}
xxx2 {
    pins = <PINA>, <PINB>;
    // this node doesn't affect function
    pull-up = <1>; // change, and enable
}
xxx3 {
    pins = <PINAC>;
    // this node doesn't affect function
    pull-up = <0>; // change, and disable
}
#18 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 25 lines · Stephen Warren
Quoted 10 lines · Heiko St?bner

I remember we had a discussion about how things like bias-disable explicitly shouldn't have a value, when they are represented in the list-format:

		pcfg_pull_none: pcfg_pull_none {
			bias-disable;
		};

so a bias-disable = <1> was explicitly "forbidden" [for a lack of a better word]. And it was similar for other options, the parameter not meant to be indicating if they are active but really only setting the "strength" or so.

Pure Boolean values should be represented as a valueless property. If the property is present, the value is true, otherwise false.

However, pinctrl bindings often don't represent Boolean values, but rather tri-states, with the following values:

* Don't touch this configuration option at all (missing)
* Enable the option (<1>)
* Disable the option (<0>)

The reason for using tri-states being that you might want to write:

Quoted 15 lines
xxx1 {
     pins = <PINA>, <PINB>, <PINC>;
     function = <...>;
     // this node doesn't affect pullup
}
xxx2 {
     pins = <PINA>, <PINB>;
     // this node doesn't affect function
     pull-up = <1>; // change, and enable
}
xxx3 {
     pins = <PINAC>;
     // this node doesn't affect function
     pull-up = <0>; // change, and disable
}

If I understand correctly, in Stephen's example, if a certain driver wants to configure PINA PINB and PINC, the pin configuration nodes "xxx1", "xxx2", and "xxx3" will all have to be selected for the particular pin state. This works fine. However, I'm just thinking that it would have been easier if we could specify just one node:

xxx {
	pins = <PINA>, <PINB>, <PINC>;
	function = <...>;
	pull-up = <1 1 0>;
}

This "feature" seems a bit more concise to me and is what I did for my original pinctrl driver. The only downside is that with this method, one cannot specify "don't touch this option for this pin" if the same property must provide values for other pins.

When Linus asked me to try using generic pinconf instead, I ran into problems with this feature due to how the generic pinconf properties are defined differently than my properties - perhaps this feature just doesn't work for generic pinconf-based drivers with the (Unless we are ok with using 1/0 for boolean properties, but it has already been pointed out that these should be valueless.).

While I'd love to be able define my pin config nodes this way, if I have to use generic pinconf for the driver to be upstreamed, then I'm fine with it.

Going back to some questions regarding generic pinconf properties - could I get some help with these?

Quoted 6 lines

"input disable"
This setting disconnects the input (DIN) to the internal logic from the pin pad. However, the output (DOUT) can still drive the pad. It seems to match PIN_CONFIG_OUTPUT, but the current generic option is either "output-low" or "output-high" - are these referring to a static output of 0 and 1?

What's the best property to use in this case?

Quoted 4 lines

"mode"
This controls several aspect of the pin (slew rate, pull up strength, etc) to meet I2C specs for Standard/Fast mode vs High Speed mode. I think the best way is to map this to slew rate, which would require

Quoted 8 lines

some explanation because the meaning of slew rate differs depending on what pin function is selected:
- When I2C (*_SCL or *_SDA) function is selected for the pin: 0:
Standard (100kbps)
& Fast mode (400kbps), 1: High Speed mode (3.4Mbps)
- When IC_DM or IC_DP function is selected, 0: normal slew rate, 1:
fast slew rate
- Else: 0: fast slew rate, 1: normal slew rate

Do we agree that the "slew rate" is the best property to use for "mode"?

Thanks,
Sherman

#19 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 6 lines · Sherman Yin

If I understand correctly, in Stephen's example, if a certain driver wants to configure PINA PINB and PINC, the pin configuration nodes "xxx1", "xxx2", and "xxx3" will all have to be selected for the particular pin state. This works fine. However, I'm just thinking that it would have been easier if we could specify just one node:

Quoted 6 lines

xxx {

        pins = <PINA>, <PINB>, <PINC>;
        function = <...>;
        pull-up = <1 1 0>;
}

The property is named bias-pull-up, not just pull-up, but whatever.

Quoted 6 lines

When Linus asked me to try using generic pinconf instead, I ran into problems with this feature due to how the generic pinconf properties are defined differently than my properties - perhaps this feature just doesn't work for generic pinconf-based drivers with the (Unless we are ok with using 1/0 for boolean properties, but it has already been pointed out that these should be valueless.).

Well it seems you would need a way to pass an array of the same boolean property and that seems a bit more complex and hard to read than the generic boolean bindings.

You would have to patch the OF core to do something like that:

bias-pull-up = <true true false>;

1/0 isn't so good I think, what should the parser do with e.g. 2? This is more to the point.

Quoted 2 lines

While I'd love to be able define my pin config nodes this way, if I have to use generic pinconf for the driver to be upstreamed, then I'm fine with it.

Well you need to use generic pin config because all the custom stuff - i.MX comes to mind - is creating a mess. I prefer that we share bindings and code, as any programmer would...

That said, if you can patch the OF core and the generic pin config parser to do what you want with lists like that, it's your pick. It may take some time though.

Quoted 2 lines

Going back to some questions regarding generic pinconf properties - could I get some help with these?

Sure...

Quoted 8 lines
Quoted 6 lines

"input disable"
This setting disconnects the input (DIN) to the internal logic from >the pin pad. However, the output (DOUT) can still drive the pad. It seems to match PIN_CONFIG_OUTPUT, but the current generic option is either "output-low" or "output-high" - are these referring to a static output of 0 and 1?

What's the best property to use in this case?

Seems like a new case.

What about you patch include/linux/pinctrl/pinconf-generic.h
to add PIN_CONFIG_INPUT_DISABLE with this semantic
and also patch the generic pinconf parser in drivers/pinctrl/pinconf-generic.c to handle this?

Quoted 13 lines
Quoted 4 lines

"mode"
This controls several aspect of the pin (slew rate, pull up strength, etc) to meet I2C specs for Standard/Fast mode vs High Speed mode. I think the best way is to map this to slew rate, which would require

Quoted 8 lines

some explanation because the meaning of slew rate differs depending on what pin function is selected:
- When I2C (*_SCL or *_SDA) function is selected for the pin: 0:
Standard (100kbps)
& Fast mode (400kbps), 1: High Speed mode (3.4Mbps)
- When IC_DM or IC_DP function is selected, 0: normal slew rate, 1:
fast slew rate
- Else: 0: fast slew rate, 1: normal slew rate

Quoted 1 line

Do we agree that the "slew rate" is the best property to use for "mode"?

It seems to be indeed mostly related to slew rate.

However if you want a custom brcm,mode binding that should be possible too, as well as augmenting the driver to use *both* generic pinconf *and* some custom config options on top. That has not been done so far though I think, so you might need a bit of hacking to do that.

Yours,
Linus Walleij

#20 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 12 lines · Linus Walleij
Quoted 6 lines · Sherman Yin

When Linus asked me to try using generic pinconf instead, I ran into problems with this feature due to how the generic pinconf properties are defined differently than my properties - perhaps this feature just doesn't work for generic pinconf-based drivers with the (Unless we are ok with using 1/0 for boolean properties, but it has already been pointed out that these should be valueless.).

Well it seems you would need a way to pass an array of the same boolean property and that seems a bit more complex and hard to read than the generic boolean bindings.

Quoted 6 lines

You would have to patch the OF core to do something like that:

bias-pull-up = <true true false>;

1/0 isn't so good I think, what should the parser do with e.g. 2? This is more to the point.

I would imagine that the platform-specific device tree bindings would need to clearly explain what the valid values are, as they should. If we're using integers, we could either have a) !0 and 0, or b) just 1 and 0, and everything else is an error. Or c) the platform could decide that the value provides addition info like pull-up-strength, so 0 = no pull up, >0 = pull up enabled and the number is the pull up strength in Ohm (bindings should indicate which values are valid), and everything else is an error.

Quoted 6 lines
Quoted 2 lines

While I'd love to be able define my pin config nodes this way, if I have to use generic pinconf for the driver to be upstreamed, then I'm fine with it.

Well you need to use generic pin config because all the custom stuff - i.MX comes to mind - is creating a mess. I prefer that we share bindings and code, as any programmer would...

Ok

Quoted 3 lines

That said, if you can patch the OF core and the generic pin config parser to do what you want with lists like that, it's your pick. It may take some time though.

I don't mind patching the generic pin config, and I don't think the core needs to change, but first there needs to be an agreement on the changes since other drivers will need to use pinconf-generic. Am I the only one who would like to see this feature, or do others see value in being able to group more pins together - resulting in fewer sub-nodes? Do the pros out-weight the cons?

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

"input disable"
This setting disconnects the input (DIN) to the internal logic from >the pin pad. However, the output (DOUT) can still drive the pad. It seems to match PIN_CONFIG_OUTPUT, but the current generic option is either "output-low" or "output-high" - are these referring to a static output of 0 and 1?

Quoted 8 lines
Quoted 1 line

What's the best property to use in this case?

Seems like a new case.

What about you patch include/linux/pinctrl/pinconf-generic.h
to add PIN_CONFIG_INPUT_DISABLE with this semantic
and also patch the generic pinconf parser in drivers/pinctrl/pinconf-generic.c to handle this?

Sure, I can add PIN_CONFIG_INPUT_DISABLE. However I suspect people might be confused by this and PIN_CONFIG_OUTPUT.

Quoted 15 lines
Quoted 13 lines
Quoted 4 lines

"mode"
This controls several aspect of the pin (slew rate, pull up strength, etc) to meet I2C specs for Standard/Fast mode vs High Speed mode. I think the best way is to map this to slew rate, which would require

Quoted 8 lines

some explanation because the meaning of slew rate differs depending on what pin function is selected:
- When I2C (*_SCL or *_SDA) function is selected for the pin: 0:
Standard (100kbps)
& Fast mode (400kbps), 1: High Speed mode (3.4Mbps)
- When IC_DM or IC_DP function is selected, 0: normal slew rate, 1:
fast slew rate
- Else: 0: fast slew rate, 1: normal slew rate

Quoted 1 line

Do we agree that the "slew rate" is the best property to use for "mode"?

Quoted 7 lines

It seems to be indeed mostly related to slew rate.

However if you want a custom brcm,mode binding that should be possible too, as well as augmenting the driver to use *both* generic pinconf *and* some custom config options on top. That has not been done so far though I think, so you might need a bit of hacking to do that.

I think I'll stick with slew rate. :)

Regards,
Sherman

#21 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 5 lines · Sherman Yin

[Me]

Quoted 4 lines · Sherman Yin

You would have to patch the OF core to do something like that:

Quoted 7 lines
Quoted 4 lines

bias-pull-up = <true true false>;

1/0 isn't so good I think, what should the parser do with e.g. 2? This is more to the point.

I would imagine that the platform-specific device tree bindings would need to clearly explain what the valid values are, as they should.

But this is not a platform-specific binding. These are the generic pin configuration bindings we're talking about.

Quoted 6 lines

If we're
using integers, we could either have a) !0 and 0, or b) just 1 and 0, and everything else is an error. Or c) the platform could decide that the value provides addition info like pull-up-strength, so 0 = no pull up, >0 = pull up enabled and the number is the pull up strength in Ohm (bindings should indicate which values are valid), and everything else is an error.

That seems to make sense, I've just not seen any system (using device tree) that can actually set the pull up/down resistance.

Quoted 6 lines
Quoted 3 lines

That said, if you can patch the OF core and the generic pin config parser to do what you want with lists like that, it's your pick. It may take some time though.

I don't mind patching the generic pin config, and I don't think the core needs to change,

If you want arrays of booleans that is a matter for the OF core parser I think.

Quoted 8 lines
Quoted 5 lines

What about you patch include/linux/pinctrl/pinconf-generic.h to add PIN_CONFIG_INPUT_DISABLE with this semantic and also patch the generic pinconf parser in drivers/pinctrl/pinconf-generic.c
to handle this?

Sure, I can add PIN_CONFIG_INPUT_DISABLE. However I suspect people might be confused by this and PIN_CONFIG_OUTPUT.

Just make sure you put in good documentation in that file right there, it's using kerneldoc and for a good reason...

Yours,
Linus Walleij

#22 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 5 lines · Linus Walleij
Quoted 2 lines

I would imagine that the platform-specific device tree bindings would need to clearly explain what the valid values are, as they should.

But this is not a platform-specific binding. These are the generic pin configuration bindings we're talking about.

Yes, the properties are generic, but I was under the impression that the values can be "custom", such as these:

* @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
* schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
* the threshold value is given on a custom format as argument when
* setting pins to this mode.

and

* @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to
* this parameter (on a custom format) tells the driver which alternative
* slew rate to use.

Quoted 15 lines
Quoted 7 lines

If we're
using integers, we could either have a) !0 and 0, or b) just 1 and 0, and everything else is an error. Or c) the platform could decide that the value provides addition info like pull-up-strength, so 0 = no pull up, >0 = pull up enabled and the number is the pull up strength in Ohm (bindings should indicate which values are valid), and everything else is an error.

That seems to make sense, I've just not seen any system (using device tree) that can actually set the pull up/down resistance.

Quoted 4 lines
Quoted 3 lines

That said, if you can patch the OF core and the generic pin config parser to do what you want with lists like that, it's your pick. It may take some time though.

Quoted 5 lines
Quoted 2 lines

I don't mind patching the generic pin config, and I don't think the core needs to change,

If you want arrays of booleans that is a matter for the OF core parser I think.

I was thinking of just using integers and accepting only 1 and 0, everything else is error.

Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

What about you patch include/linux/pinctrl/pinconf-generic.h to add PIN_CONFIG_INPUT_DISABLE with this semantic and also patch the generic pinconf parser in drivers/pinctrl/pinconf-generic.c
to handle this?

Sure, I can add PIN_CONFIG_INPUT_DISABLE. However I suspect people might be confused by this and PIN_CONFIG_OUTPUT.

Just make sure you put in good documentation in that file right there, it's using kerneldoc and for a good reason...

Thanks,
Sherman

#23 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 11 lines · Sherman Yin
Quoted 7 lines · Linus Walleij
Quoted 4 lines

I would imagine that the platform-specific device tree bindings would need
to clearly explain what the valid values are, as they should.

But this is not a platform-specific binding. These are the generic pin configuration bindings we're talking about.

Yes, the properties are generic, but I was under the impression that the values can be "custom", such as these:

Well if it makes sense, we should try to make them non-custom.

And drivers should still try to be similar, if possible.

Quoted 5 lines
Quoted 2 lines

If you want arrays of booleans that is a matter for the OF core parser I think.

I was thinking of just using integers and accepting only 1 and 0, everything else is error.

Hm OK maybe. You need to talk to the OF people about that.

Yours,
Linus Walleij

#24 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Sherman Yin
Quoted 46 lines · Sherman Yin
Quoted 29 lines · Stephen Warren
Quoted 8 lines · Heiko St?bner

I remember we had a discussion about how things like bias-disable explicitly
shouldn't have a value, when they are represented in the list-format:

        pcfg_pull_none: pcfg_pull_none {
            bias-disable;
        };
Quoted 6 lines

so a bias-disable = <1> was explicitly "forbidden" [for a lack of a better
word]. And it was similar for other options, the parameter not meant to be
indicating if they are active but really only setting the "strength" or so.

Pure Boolean values should be represented as a valueless property. If the property is present, the value is true, otherwise false.

However, pinctrl bindings often don't represent Boolean values, but rather tri-states, with the following values:

* Don't touch this configuration option at all (missing)
* Enable the option (<1>)
* Disable the option (<0>)

The reason for using tri-states being that you might want to write:

Quoted 15 lines
xxx1 {
     pins = <PINA>, <PINB>, <PINC>;
     function = <...>;
     // this node doesn't affect pullup
}
xxx2 {
     pins = <PINA>, <PINB>;
     // this node doesn't affect function
     pull-up = <1>; // change, and enable
}
xxx3 {
     pins = <PINAC>;
     // this node doesn't affect function
     pull-up = <0>; // change, and disable
}
Quoted 4 lines

If I understand correctly, in Stephen's example, if a certain driver wants to configure PINA PINB and PINC, the pin configuration nodes "xxx1", "xxx2", and "xxx3" will all have to be selected for the particular pin state.

You probably don't want to reference the individual xxx1/2/3 nodes in the client pinctrl properties, but instead wrap them in a higher-level node that represents the whole pinctrl state. Then, the client pinctrl properties can reference just that single parent node, instead of many small nodes. In other words:

pinctrl at ... {
	...
	sx: state_xxx {
		xxx1 { ... };
		xxx2 { ... };
		xxx3 { ... };
	};
	sy: state_yyy {
		yyy1 { ... };
		yyy2 { ... };
	};
}
some_client at ... {
	...
	pinctrl-names = "default";
	pinctrl-0 = <&sx>;
};
other_client at ... {
	...
	pinctrl-names = "default";
	pinctrl-0 = <&sy>;
};

rather than:

pinctrl at ... {
	...
	sx1: xxx1 { ... };
	sx2: xxx2 { ... };
	sx3: xxx3 { ... };
	sy1: yyy1 { ... };
	sy2: yyy2 { ... };
}
some_client at ... {
	...
	pinctrl-names = "default";
	pinctrl-0 = <&sx1 &sx2 &sx3>;
};
other_client at ... {
	...
	pinctrl-names = "default";
	pinctrl-0 = <&sy1 &sy2>;
};

This is exactly how the Tegra pinctrl bindings work for example.

Quoted 9 lines

This works fine. However, I'm just thinking that it would have been easier if we could specify just one node:

xxx {
    pins = <PINA>, <PINB>, <PINC>;
    function = <...>;
    pull-up = <1 1 0>;
}
Quoted 4 lines

This "feature" seems a bit more concise to me and is what I did for my original pinctrl driver. The only downside is that with this method, one cannot specify "don't touch this option for this pin" if the same property must provide values for other pins.

The other downside is that if the lists get even slightly long, it get really hard to match up the entries in the t properties.

#25 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 48 lines · Stephen Warren

You probably don't want to reference the individual xxx1/2/3 nodes in the client pinctrl properties, but instead wrap them in a higher-level node that represents the whole pinctrl state. Then, the client pinctrl properties can reference just that single parent node, instead of many small nodes. In other words:

pinctrl at ... {
	...
	sx: state_xxx {
		xxx1 { ... };
		xxx2 { ... };
		xxx3 { ... };
	};
	sy: state_yyy {
		yyy1 { ... };
		yyy2 { ... };
	};
}
some_client at ... {
	...
	pinctrl-names = "default";
	pinctrl-0 = <&sx>;
};
other_client at ... {
	...
	pinctrl-names = "default";
	pinctrl-0 = <&sy>;
};

rather than:

pinctrl at ... {
	...
	sx1: xxx1 { ... };
	sx2: xxx2 { ... };
	sx3: xxx3 { ... };
	sy1: yyy1 { ... };
	sy2: yyy2 { ... };
}
some_client at ... {
	...
	pinctrl-names = "default";
	pinctrl-0 = <&sx1 &sx2 &sx3>;
};
Quoted 7 lines
other_client at ... {
	...
	pinctrl-names = "default";
	pinctrl-0 = <&sy1 &sy2>;
};

This is exactly how the Tegra pinctrl bindings work for example.

Ok, right, I mistakenly thought the "xxx1" nodes are pin config nodes. Actually that's the way my original driver works as well, other than the fact that I don't have as many "xxx1" type nodes as decribed in the "xxx" node below.

Quoted 9 lines
Quoted 9 lines

This works fine. However, I'm just thinking that it would have been easier if we could specify just one node:

xxx {
     pins = <PINA>, <PINB>, <PINC>;
     function = <...>;
     pull-up = <1 1 0>;
}
Quoted 7 lines
Quoted 4 lines

This "feature" seems a bit more concise to me and is what I did for my original pinctrl driver. The only downside is that with this method, one cannot specify "don't touch this option for this pin" if the same property must provide values for other pins.

The other downside is that if the lists get even slightly long, it get really hard to match up the entries in the t properties.

Agree that it would start to get difficult to read if a subnode has too many pins. I guess the solution would be to somehow split up the pins to more subnodes with fewer pins each.

Regards,
Sherman

#26 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Stephen Warren
Quoted 11 lines · Stephen Warren

On 11/04/2013 04:26 PM, Heiko St?bner wrote:

Pure Boolean values should be represented as a valueless property. If the property is present, the value is true, otherwise false.

However, pinctrl bindings often don't represent Boolean values, but rather tri-states, with the following values:

* Don't touch this configuration option at all (missing)
* Enable the option (<1>)
* Disable the option (<0>)

But in this case we actually have these booleans to specify exactly what we want to do:

bias-disable            - disable any pin bias
bias-high-impedance     - high impedance mode ("third-state", "floating")
bias-bus-hold           - latch weakly
bias-pull-up            - pull up the pin
bias-pull-down          - pull down the pin
bias-pull-pin-default   - use pin-default pull state

Yours,
Linus Walleij

#27 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Sherman Yin
Quoted 18 lines · Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
 arch/arm/mach-bcm/Kconfig       |    2 +
 drivers/pinctrl/Kconfig         |   10 +
 drivers/pinctrl/Makefile        |    1 +
 drivers/pinctrl/pinctrl-capri.c | 1727 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1740 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
arch/arm/mach-bcm/Kconfig +0 -0
index 69d67f7..2546365 100644

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 17

Quoted 8 lines
arch/arm/mach-bcm/Kconfig +2 -0
@@ -10,6 +10,8 @@ config ARCH_BCM
        select GENERIC_CLOCKEVENTS
        select GENERIC_TIME
        select GPIO_BCM
+       select PINCTRL
+       select PINCTRL_CAPRI
        select SPARSE_IRQ
        select TICK_ONESHOT
        select CACHE_L2X0

On your subsequent patchset pls move this from Kconfig to arm/configs/bcm_defconfig, and break that modification into a separate patch from the drivers/* modification.

thanks,
csd

#28 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 23 lines · Christian Daudt
Quoted 22 lines · Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
 arch/arm/mach-bcm/Kconfig       |    2 +
 drivers/pinctrl/Kconfig         |   10 +
 drivers/pinctrl/Makefile        |    1 +
 drivers/pinctrl/pinctrl-capri.c | 1727 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1740 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
arch/arm/mach-bcm/Kconfig +1 -0
index 69d67f7..2546365 100644
@@ -10,6 +10,8 @@ config ARCH_BCM
        select GENERIC_CLOCKEVENTS
        select GENERIC_TIME
        select GPIO_BCM
+       select PINCTRL
Quoted 8 lines

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 17

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +1 -0
+       select PINCTRL_CAPRI
        select SPARSE_IRQ
        select TICK_ONESHOT
        select CACHE_L2X0

On your subsequent patchset pls move this from Kconfig to arm/configs/bcm_defconfig, and break that modification into a separate patch from the drivers/* modification.

The other SoCs I'm familiar with all select this from their ARCH_xxx config symbol.

#29 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 33 lines · Stephen Warren
Quoted 23 lines · Christian Daudt
Quoted 22 lines · Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
 arch/arm/mach-bcm/Kconfig       |    2 +
 drivers/pinctrl/Kconfig         |   10 +
 drivers/pinctrl/Makefile        |    1 +
 drivers/pinctrl/pinctrl-capri.c | 1727 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1740 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
arch/arm/mach-bcm/Kconfig +1 -0
index 69d67f7..2546365 100644
@@ -10,6 +10,8 @@ config ARCH_BCM
        select GENERIC_CLOCKEVENTS
        select GENERIC_TIME
        select GPIO_BCM
+       select PINCTRL
Quoted 8 lines

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 17

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +1 -0
+       select PINCTRL_CAPRI
        select SPARSE_IRQ
        select TICK_ONESHOT
        select CACHE_L2X0

On your subsequent patchset pls move this from Kconfig to arm/configs/bcm_defconfig, and break that modification into a separate patch from the drivers/* modification.

Quoted 3 lines

The other SoCs I'm familiar with all select this from their ARCH_xxx config symbol.

I had a discussion on what is best left under ARCH and what is best left to defconfig with Kevin Hilman a while back and the conclusion was that any config not strictly required for bootup is best left to defconfig. This will allow multiplatform kernels to switch to using them as loadable modules later on, something not possible with configs put under ARCH_xxx.

Thanks,
csd

#30 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 44 lines · Christian Daudt
Quoted 33 lines · Stephen Warren
Quoted 23 lines · Christian Daudt
Quoted 22 lines · Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
  arch/arm/mach-bcm/Kconfig       |    2 +
  drivers/pinctrl/Kconfig         |   10 +
  drivers/pinctrl/Makefile        |    1 +
  drivers/pinctrl/pinctrl-capri.c | 1727 +++++++++++++++++++++++++++++++++++++++
  4 files changed, 1740 insertions(+)

create mode 100644 drivers/pinctrl/pinctrl-capri.c

arch/arm/mach-bcm/Kconfig +1 -0
index 69d67f7..2546365 100644
@@ -10,6 +10,8 @@ config ARCH_BCM
         select GENERIC_CLOCKEVENTS
         select GENERIC_TIME
         select GPIO_BCM
+       select PINCTRL
Quoted 8 lines

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 17

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +1 -0
+       select PINCTRL_CAPRI
         select SPARSE_IRQ
         select TICK_ONESHOT
         select CACHE_L2X0

On your subsequent patchset pls move this from Kconfig to arm/configs/bcm_defconfig, and break that modification into a separate patch from the drivers/* modification.

Quoted 3 lines

The other SoCs I'm familiar with all select this from their ARCH_xxx config symbol.

I had a discussion on what is best left under ARCH and what is best left to defconfig with Kevin Hilman a while back and the conclusion was that any config not strictly required for bootup is best left to defconfig. This will allow multiplatform kernels to switch to using them as loadable modules later on, something not possible with configs put under ARCH_xxx.

Quoted 3 lines

Thanks,
csd

I was just trying to move "select PINCTRL" to a defconfig as Christian suggested. However, CONFIG_PINCTRL is not selectable by a defconfig file (the option will be gone by the time .config is generated), even though PINCTRL has no dependency. Also, this option is not visible in menuconfig.

I found that by adding a string after "bool" in the PINCTRL config definition (see diff below), CONFIG_PINCTRL will be selectable in a defconfig file and this option will also be visible in menuconfig.

Was this intentional or is this a bug? To address Christian's comment, I'll need to add the following patch.

Regards,
Sherman

==================

drivers/pinctrl/Kconfig +1 -1
index 6c70fc5..664c8e6 100644
@@ -3,7 +3,7 @@
  #
 
  config PINCTRL
-       bool
+       bool "Enable the pinctrl framework"
 
  if PINCTRL

==================

#31 lore raw

Re: [PATCH 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 11 lines · Sherman Yin

I was just trying to move "select PINCTRL" to a defconfig as Christian suggested. However, CONFIG_PINCTRL is not selectable by a defconfig file (the option will be gone by the time .config is generated), even though PINCTRL has no dependency. Also, this option is not visible in menuconfig.

I found that by adding a string after "bool" in the PINCTRL config definition (see diff below), CONFIG_PINCTRL will be selectable in a defconfig file and this option will also be visible in menuconfig.

Was this intentional or is this a bug? To address Christian's comment, I'll need to add the following patch.

This was intentional.

Pin control was considered an intrinsic of specific embedded systems and not to be broadcasted to anyone running menuconfig.

But if you really need this, we can discuss it.

Yours,
Linus Walleij

#32 lore raw

PATCH 4/4 pinctrl: Enable pinctrl for Broadcom Capri SoCs

In reply to Sherman Yin

Enable pinctrl for Broadcom Capri (BCM281xx) SoCs.

---
 arch/arm/boot/dts/bcm11351.dtsi |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/bcm11351.dtsi +4 -0
index 05a5aab..f497a40 100644
@@ -96,4 +96,8 @@
 		status = "disabled";
 	};
 
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
 };
Signature · 1 line
1.7.9.5
#33 lore raw

Re: [PATCH 4/4] pinctrl: Enable pinctrl for Broadcom Capri SoCs

Quoted 5 lines · Sherman Yin

Enable pinctrl for Broadcom Capri (BCM281xx) SoCs.

(...)

arch/arm/boot/dts/bcm11351.dtsi line 102

Quoted 4 lines
arch/arm/boot/dts/bcm11351.dtsi +4 -0
+       pinctrl at 35004800 {
+               compatible = "brcm,capri-pinctrl";
+               reg = <0x35004800 0x430>;
+       };

What is the point of doing this without defining some pins and connecting them to some devices?

Yours,
Linus Walleij

#34 lore raw

v2 cover Add Broadcom Capri pinctrl driver

In reply to Sherman Yin

The following patches adds a pinctrl driver for Broadcom Capri (BCM281xx) SoCs. The first patch, adding the void * to pinctrl_pin_desc, has been previously discussed with LinusW. See this thread:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-April/165880.html
---
v2: Use hyphens instead of underscore in DT property names.

Sherman Yin (4):
pinctrl: Add void * to pinctrl_pin_desc
pinctrl: Add pinctrl binding for Broadcom Capri SoCs
ARM: pinctrl: Add Broadcom Capri pinctrl driver
pinctrl: Enable pinctrl for Broadcom Capri SoCs

 .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  419 +++++
 arch/arm/boot/dts/bcm11351.dtsi                    |    4 +
 arch/arm/mach-bcm/Kconfig                          |    2 +
 drivers/pinctrl/Kconfig                            |   10 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/pinctrl-capri.c                    | 1727 ++++++++++++++++++++
 include/linux/pinctrl/pinctrl.h                    |    2 +
 7 files changed, 2165 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
Signature · 1 line
1.7.9.5
#35 lore raw

PATCH v2 1/4 pinctrl: Add void * to pinctrl_pin_desc

drv_data is added to the pinctrl_pin_desc for drivers to define additional driver-specific per-pin data.

---
Change-Id: I78b2c44b93d88b04897fd0af80ffce213e338d6b
v2: Use hyphens instead of underscore in DT property names.

---
 include/linux/pinctrl/pinctrl.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/pinctrl/pinctrl.h +2 -0
index 5979147..c8e42c4 100644
@@ -32,10 +32,12 @@ struct device_node;
  * pins, pads or other muxable units in this struct
  * @number: unique pin number from the global pin number space
  * @name: a name for this pin
+ * @drv_data: driver-defined per-pin data. pinctrl core does not touch this
  */
 struct pinctrl_pin_desc {
 	unsigned number;
 	const char *name;
+	void *drv_data;
 };
 
 /* Convenience macro to define a single named or anonymous pin descriptor */
Signature · 1 line
1.7.9.5
#36 lore raw

PATCH v2 2/4 pinctrl: Add pinctrl binding for Broadcom Capri SoCs

In reply to Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
v2: Use hyphens instead of underscore in DT property names.

---
 .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  419 ++++++++++++++++++++
 1 file changed, 419 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +419 -0
new file mode 100644
index 0000000..efee207
@@ -0,0 +1,419 @@
+Broadcom Capri Pin Controller
+
+This is a pin controller for the Broadcom BCM281xx SoC family, which includes
+BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs.
+
+=== Pin Controller Node ===
+
+Required Properties:
+
+- compatible:	Must be "brcm,capri-pinctrl".
+- reg:		Base address of the PAD Controller register block and the size
+		of the block.
+
+For example, the following is the bare minimum node:
+
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
+
+As a Pin Controller Device, in addition to the required properties, this node
+should also contain the pin configuration nodes that client devices reference,
+if any.
+
+=== Pin Configuration Node ===
+
+Each pin configuration node is a sub-node of the pin controller node and is a
+container of an arbitrary number of subnodes, called group nodes.
+
+Please refer to the pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the definition of a
+"pin configuration node".
+
+=== Group Node ===
+
+A group node specifies the desired pin mux and/or pin configuration for an
+arbitrary number of pins.  The group node only affect the properties specified
+in the node, and has no effect on any properties that are omitted.
+
+The names of the group nodes are optional and not used. The group nodes have
+the following properties:
+
+Required Properties:
+
+- brcm,pins:	Multiple strings.  Specifies the name(s) of one or more pins to
+		be configured by this node.
+
+Optional Properties:
+
+- brcm,function: Multiple strings.  Specifies the pin mux selection.  Values are:
+		"alt1", "alt2", "alt3", "alt4"
+- brcm,hysteresis: Multiple integers, applicable to standard pins only.  Turns
+		on hysteresis of input.
+		0: TTL input, 1: Schmitt Trigger input
+- brcm,pull:	Multiple integers, applicable to standard pins only.  Specifies
+		pull-up or pull-down.
+		0: neither, 1: pull-up, 2: pull-down, 3: both
+- brcm,input-dis: Multiple integers, applicable to all pins.  Input disable
+		control.
+		0: off, 1: input disabled
+- brcm,slew:	Multiple integers.  Slew rate of output.
+		0: fast output, 1: normal output (most pins)
+		0: normal output, 1: fast output (IC_DM and IC_DP)
+		0: Fast mode, 1: High speed mode (I2C)
+- brcm,drive-str: Multiple integers.  Drive strength.
+		0: 2 mA
+		1: 4 mA
+		2: 6 mA
+		3: 8 mA
+		4: 10 mA
+		5: 12 mA
+		6: 14 mA
+		7: 16 mA
+- brcm,pull-up-str: Multiple integers.  Pull Up strength.
+		0: No pull-up
+		1: 1.2 kOhm
+		2: 1.8 kOhm
+		3: 720 Ohm
+		4: 2.7 kOhm
+		5: 831 Ohm
+		6: 1.08 kOhm
+		7: 568 Ohm
+- brcm,mode:	Multiple integers.  Mode select.
+		0: Fast mode, 1: High Speed mode (I2C)
+
+Any optional property must have 1 or n values, where n is the number of pins
+specified in the brcm,pins property:
+- If 1 value is specified for a property, this value is applied to all pins
+  listed in the brcm,pins property.
+- If n values are specified, the i th value is applied to the i th pin, where
+  i is the index in the array of values and pins, and (0 <= i < n).  This
+  provides an easy way to set different values for different pins in the same
+  group.
+
+Example:
+
+	// pin configuration node
+	dev_a_active {
+		//group node
+		grp_1 {
+			brcm,pins	= "pin1", "pin2", "pin3";
+			brcm,function	= "alt1";
+			brcm,drive-str	= <2 4 6>;
+			brcm,slew	= <1>;
+		};
+
+		grp_2 {
+			...
+		};
+
+		...
+	};
+
+In the example above, "dev_a_active" is a pin configuration node and has a
+number of sub-nodes.  In the group node "grp_1", 3 pins are defined in the
+"brcm,pins" property.  Thus, any optional properties must have either 1 or 3
+values.  The "brcm,function" property has only one value, "alt1", therefore the
+pin mux selection for all 3 pins is "alt1".  Similarly, "brcm,slew" has only one
+value, <1>, so all 3 pins are configured with a slew rate setting of <1>.
+"brcm,drive-str" has 3 values, and they are applied in the same order of the pins
+listed in "brcm,pins": the drive strength of "pin1" is set to <2>, <4> for
+"pin2", and <6> for "pin3".  Finally, no other parameters are sepcified,
+implying no changes to any other parameters for these pins.
+
+=== Pin Names and Type ===
+
+There are 3 types of pins in the BCM281xx SoC family, each type can be
+configured by different properties in a group node.  The following is a list of
+node properties applicable to different pin types.
+
+Standard pins:
+- brcm,function
+- brcm,hysteresis
+- brcm,pull
+- brcm,input-dis
+- brcm,slew
+- brcm,drive-str
+
+I2C pins:
+- brcm,function
+- brcm,input-dis
+- brcm,slew
+- brcm,pull-up-str
+
+HDMI pins:
+- brcm,function
+- brcm,input-dis
+- brcm,mode
+
+The following are valid pin names and their pin types:
+
+	"adcsync",		std
+	"bat_rm",		std
+	"bsc1_scl",		i2c
+	"bsc1_sda",		i2c
+	"bsc2_scl",		i2c
+	"bsc2_sda",		i2c
+	"classgpwr",		std
+	"clk_cx8",		std
+	"clkout_0",		std
+	"clkout_1",		std
+	"clkout_2",		std
+	"clkout_3",		std
+	"clkreq_in_0",		std
+	"clkreq_in_1",		std
+	"cws_sys_req1",		std
+	"cws_sys_req2",		std
+	"cws_sys_req3",		std
+	"digmic1_clk",		std
+	"digmic1_dq",		std
+	"digmic2_clk",		std
+	"digmic2_dq",		std
+	"gpen13",		std
+	"gpen14",		std
+	"gpen15",		std
+	"gpio00",		std
+	"gpio01",		std
+	"gpio02",		std
+	"gpio03",		std
+	"gpio04",		std
+	"gpio05",		std
+	"gpio06",		std
+	"gpio07",		std
+	"gpio08",		std
+	"gpio09",		std
+	"gpio10",		std
+	"gpio11",		std
+	"gpio12",		std
+	"gpio13",		std
+	"gpio14",		std
+	"gps_pablank",		std
+	"gps_tmark",		std
+	"hdmi_scl",		hdmi
+	"hdmi_sda",		hdmi
+	"ic_dm",		std
+	"ic_dp",		std
+	"kp_col_ip_0",		std
+	"kp_col_ip_1",		std
+	"kp_col_ip_2",		std
+	"kp_col_ip_3",		std
+	"kp_row_op_0",		std
+	"kp_row_op_1",		std
+	"kp_row_op_2",		std
+	"kp_row_op_3",		std
+	"lcd_b_0",		std
+	"lcd_b_1",		std
+	"lcd_b_2",		std
+	"lcd_b_3",		std
+	"lcd_b_4",		std
+	"lcd_b_5",		std
+	"lcd_b_6",		std
+	"lcd_b_7",		std
+	"lcd_g_0",		std
+	"lcd_g_1",		std
+	"lcd_g_2",		std
+	"lcd_g_3",		std
+	"lcd_g_4",		std
+	"lcd_g_5",		std
+	"lcd_g_6",		std
+	"lcd_g_7",		std
+	"lcd_hsync",		std
+	"lcd_oe",		std
+	"lcd_pclk",		std
+	"lcd_r_0",		std
+	"lcd_r_1",		std
+	"lcd_r_2",		std
+	"lcd_r_3",		std
+	"lcd_r_4",		std
+	"lcd_r_5",		std
+	"lcd_r_6",		std
+	"lcd_r_7",		std
+	"lcd_vsync",		std
+	"mdmgpio0",		std
+	"mdmgpio1",		std
+	"mdmgpio2",		std
+	"mdmgpio3",		std
+	"mdmgpio4",		std
+	"mdmgpio5",		std
+	"mdmgpio6",		std
+	"mdmgpio7",		std
+	"mdmgpio8",		std
+	"mphi_data_0",		std
+	"mphi_data_1",		std
+	"mphi_data_2",		std
+	"mphi_data_3",		std
+	"mphi_data_4",		std
+	"mphi_data_5",		std
+	"mphi_data_6",		std
+	"mphi_data_7",		std
+	"mphi_data_8",		std
+	"mphi_data_9",		std
+	"mphi_data_10",		std
+	"mphi_data_11",		std
+	"mphi_data_12",		std
+	"mphi_data_13",		std
+	"mphi_data_14",		std
+	"mphi_data_15",		std
+	"mphi_ha0",		std
+	"mphi_hat0",		std
+	"mphi_hat1",		std
+	"mphi_hce0_n",		std
+	"mphi_hce1_n",		std
+	"mphi_hrd_n",		std
+	"mphi_hwr_n",		std
+	"mphi_run0",		std
+	"mphi_run1",		std
+	"mtx_scan_clk",		std
+	"mtx_scan_data",	std
+	"nand_ad_0",		std
+	"nand_ad_1",		std
+	"nand_ad_2",		std
+	"nand_ad_3",		std
+	"nand_ad_4",		std
+	"nand_ad_5",		std
+	"nand_ad_6",		std
+	"nand_ad_7",		std
+	"nand_ale",		std
+	"nand_cen_0",		std
+	"nand_cen_1",		std
+	"nand_cle",		std
+	"nand_oen",		std
+	"nand_rdy_0",		std
+	"nand_rdy_1",		std
+	"nand_wen",		std
+	"nand_wp",		std
+	"pc1",			std
+	"pc2",			std
+	"pmu_int",		std
+	"pmu_scl",		i2c
+	"pmu_sda",		i2c
+	"rfst2g_mtsloten3g",	std
+	"rgmii_0_rx_ctl",	std
+	"rgmii_0_rxc",		std
+	"rgmii_0_rxd_0",	std
+	"rgmii_0_rxd_1",	std
+	"rgmii_0_rxd_2",	std
+	"rgmii_0_rxd_3",	std
+	"rgmii_0_tx_ctl",	std
+	"rgmii_0_txc",		std
+	"rgmii_0_txd_0",	std
+	"rgmii_0_txd_1",	std
+	"rgmii_0_txd_2",	std
+	"rgmii_0_txd_3",	std
+	"rgmii_1_rx_ctl",	std
+	"rgmii_1_rxc",		std
+	"rgmii_1_rxd_0",	std
+	"rgmii_1_rxd_1",	std
+	"rgmii_1_rxd_2",	std
+	"rgmii_1_rxd_3",	std
+	"rgmii_1_tx_ctl",	std
+	"rgmii_1_txc",		std
+	"rgmii_1_txd_0",	std
+	"rgmii_1_txd_1",	std
+	"rgmii_1_txd_2",	std
+	"rgmii_1_txd_3",	std
+	"rgmii_gpio_0",		std
+	"rgmii_gpio_1",		std
+	"rgmii_gpio_2",		std
+	"rgmii_gpio_3",		std
+	"rtxdata2g_txdata3g1",	std
+	"rtxen2g_txdata3g2",	std
+	"rxdata3g0",		std
+	"rxdata3g1",		std
+	"rxdata3g2",		std
+	"sdio1_clk",		std
+	"sdio1_cmd",		std
+	"sdio1_data_0",		std
+	"sdio1_data_1",		std
+	"sdio1_data_2",		std
+	"sdio1_data_3",		std
+	"sdio4_clk",		std
+	"sdio4_cmd",		std
+	"sdio4_data_0",		std
+	"sdio4_data_1",		std
+	"sdio4_data_2",		std
+	"sdio4_data_3",		std
+	"sim_clk",		std
+	"sim_data",		std
+	"sim_det",		std
+	"sim_resetn",		std
+	"sim2_clk",		std
+	"sim2_data",		std
+	"sim2_det",		std
+	"sim2_resetn",		std
+	"sri_c",		std
+	"sri_d",		std
+	"sri_e",		std
+	"ssp_extclk",		std
+	"ssp0_clk",		std
+	"ssp0_fs",		std
+	"ssp0_rxd",		std
+	"ssp0_txd",		std
+	"ssp2_clk",		std
+	"ssp2_fs_0",		std
+	"ssp2_fs_1",		std
+	"ssp2_fs_2",		std
+	"ssp2_fs_3",		std
+	"ssp2_rxd_0",		std
+	"ssp2_rxd_1",		std
+	"ssp2_txd_0",		std
+	"ssp2_txd_1",		std
+	"ssp3_clk",		std
+	"ssp3_fs",		std
+	"ssp3_rxd",		std
+	"ssp3_txd",		std
+	"ssp4_clk",		std
+	"ssp4_fs",		std
+	"ssp4_rxd",		std
+	"ssp4_txd",		std
+	"ssp5_clk",		std
+	"ssp5_fs",		std
+	"ssp5_rxd",		std
+	"ssp5_txd",		std
+	"ssp6_clk",		std
+	"ssp6_fs",		std
+	"ssp6_rxd",		std
+	"ssp6_txd",		std
+	"stat_1",		std
+	"stat_2",		std
+	"sysclken",		std
+	"traceclk",		std
+	"tracedt00",		std
+	"tracedt01",		std
+	"tracedt02",		std
+	"tracedt03",		std
+	"tracedt04",		std
+	"tracedt05",		std
+	"tracedt06",		std
+	"tracedt07",		std
+	"tracedt08",		std
+	"tracedt09",		std
+	"tracedt10",		std
+	"tracedt11",		std
+	"tracedt12",		std
+	"tracedt13",		std
+	"tracedt14",		std
+	"tracedt15",		std
+	"txdata3g0",		std
+	"txpwrind",		std
+	"uartb1_ucts",		std
+	"uartb1_urts",		std
+	"uartb1_urxd",		std
+	"uartb1_utxd",		std
+	"uartb2_urxd",		std
+	"uartb2_utxd",		std
+	"uartb3_ucts",		std
+	"uartb3_urts",		std
+	"uartb3_urxd",		std
+	"uartb3_utxd",		std
+	"uartb4_ucts",		std
+	"uartb4_urts",		std
+	"uartb4_urxd",		std
+	"uartb4_utxd",		std
+	"vc_cam1_scl",		i2c
+	"vc_cam1_sda",		i2c
+	"vc_cam2_scl",		i2c
+	"vc_cam2_sda",		i2c
+	"vc_cam3_scl",		i2c
+	"vc_cam3_sda",		i2c
Signature · 1 line
1.7.9.5
#37 lore raw

PATCH v2 3/4 ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
v2: Use hyphens instead of underscore in DT property names.

---
 arch/arm/mach-bcm/Kconfig       |    2 +
 drivers/pinctrl/Kconfig         |   10 +
 drivers/pinctrl/Makefile        |    1 +
 drivers/pinctrl/pinctrl-capri.c | 1727 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1740 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
arch/arm/mach-bcm/Kconfig +2 -0
index 69d67f7..2546365 100644
@@ -10,6 +10,8 @@ config ARCH_BCM
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_TIME
 	select GPIO_BCM
+	select PINCTRL
+	select PINCTRL_CAPRI
 	select SPARSE_IRQ
 	select TICK_ONESHOT
 	select CACHE_L2X0
drivers/pinctrl/Kconfig +10 -0
index b6e864e..f97eb11 100644
@@ -75,6 +75,16 @@ config PINCTRL_BCM2835
 	select PINMUX
 	select PINCONF
 
+config PINCTRL_CAPRI
+	bool "Broadcom Capri pinctrl driver"
+	select PINMUX
+	select PINCONF
+	help
+	  Say Y here to support Broadcom Capri pinctrl driver, which is used for
+	  the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351,
+	  BCM28145, and BCM28155 SoCs.  This driver requires the pinctrl
+	  framework.  GPIO is provided by a separate GPIO driver.
+
 config PINCTRL_IMX
 	bool
 	select PINMUX
drivers/pinctrl/Makefile +1 -0
index 496d9bf..5e1a68e 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_AB8505)	+= pinctrl-ab8505.o
 obj-$(CONFIG_PINCTRL_AT91)	+= pinctrl-at91.o
 obj-$(CONFIG_PINCTRL_BCM2835)	+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BAYTRAIL)	+= pinctrl-baytrail.o
+obj-$(CONFIG_PINCTRL_CAPRI)	+= pinctrl-capri.o
 obj-$(CONFIG_PINCTRL_IMX)	+= pinctrl-imx.o
 obj-$(CONFIG_PINCTRL_IMX35)	+= pinctrl-imx35.o
 obj-$(CONFIG_PINCTRL_IMX51)	+= pinctrl-imx51.o
drivers/pinctrl/pinctrl-capri.c new file +1727 -0

1,727 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#38 lore raw

PATCH v2 4/4 pinctrl: Enable pinctrl for Broadcom Capri SoCs

In reply to Sherman Yin

Enable pinctrl for Broadcom Capri (BCM281xx) SoCs.

---
v2: Use hyphens instead of underscore in DT property names.

---
 arch/arm/boot/dts/bcm11351.dtsi |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/bcm11351.dtsi +4 -0
index 05a5aab..f497a40 100644
@@ -96,4 +96,8 @@
 		status = "disabled";
 	};
 
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
 };
Signature · 1 line
1.7.9.5
#39 lore raw

v3 cover Add Broadcom Capri pinctrl driver

In reply to Sherman Yin

The following patches adds a pinctrl driver for Broadcom Capri (BCM281xx) SoCs. The first patch, adding the void * to pinctrl_pin_desc, has been previously discussed with LinusW. See this thread:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-April/165880.html
---
v3: Re-worked driver to be based on generic pinconfig, addressed review
comments and other supporting changes:
- moved config selection from Kconfig to defconfig
- added slew-rate, input enable, input disable properties for generic pinconfig
- added a description for PINCTRL config
v2: Use hyphens instead of underscore in DT property names.

Sherman Yin (6):
pinctrl: Add void * to pinctrl_pin_desc
pinctrl: Adds slew-rate, input-enable/disable
pinctrl: Make PINCTRL selectable by defconfig/menuconfig
pinctrl: Add pinctrl binding for Broadcom Capri SoCs
ARM: pinctrl: Add Broadcom Capri pinctrl driver
pinctrl: Enable pinctrl for Broadcom Capri SoCs

 .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  429 ++++++
 .../bindings/pinctrl/pinctrl-bindings.txt          |    3 +
 arch/arm/boot/dts/bcm11351.dtsi                    |    4 +
 arch/arm/configs/bcm_defconfig                     |    5 +
 drivers/pinctrl/Kconfig                            |   13 +-
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/pinconf-generic.c                  |    4 +
 drivers/pinctrl/pinctrl-capri.c                    | 1408 ++++++++++++++++++++
 include/linux/pinctrl/pinconf-generic.h            |    4 +
 include/linux/pinctrl/pinctrl.h                    |    2 +
 10 files changed, 1872 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
Signature · 1 line
1.7.9.5
#40 lore raw

PATCH v3 1/6 pinctrl: Add void * to pinctrl_pin_desc

drv_data is added to the pinctrl_pin_desc for drivers to define additional driver-specific per-pin data.

---
v3: no change
v2: no change

---
 include/linux/pinctrl/pinctrl.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/pinctrl/pinctrl.h +2 -0
index fefb886..cc8e1af 100644
@@ -32,10 +32,12 @@ struct device_node;
  * pins, pads or other muxable units in this struct
  * @number: unique pin number from the global pin number space
  * @name: a name for this pin
+ * @drv_data: driver-defined per-pin data. pinctrl core does not touch this
  */
 struct pinctrl_pin_desc {
 	unsigned number;
 	const char *name;
+	void *drv_data;
 };
 
 /* Convenience macro to define a single named or anonymous pin descriptor */
Signature · 1 line
1.7.9.5
#41 lore raw

PATCH v3 2/6 pinctrl: Adds slew-rate, input-enable/disable

In reply to Sherman Yin

This commit adds slew-rate and input-enable/disable support for pinconf -generic.

---
v3: added to patchset

 .../bindings/pinctrl/pinctrl-bindings.txt          |    3 +++
 drivers/pinctrl/pinconf-generic.c                  |    4 ++++
 include/linux/pinctrl/pinconf-generic.h            |    4 ++++
 3 files changed, 11 insertions(+)
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt +3 -0
index 1958ca9..4414163 100644
@@ -151,6 +151,8 @@ drive-push-pull		- drive actively high and low
 drive-open-drain	- drive with open drain
 drive-open-source	- drive with open source
 drive-strength		- sink or source at most X mA
+input-enable		- enable input on pin (no effect on output)
+input-disable		- disable input on pin (no effect on output)
 input-schmitt-enable	- enable schmitt-trigger mode
 input-schmitt-disable	- disable schmitt-trigger mode
 input-debounce		- debounce mode with debound time X
@@ -158,6 +160,7 @@ low-power-enable	- enable low power mode
 low-power-disable	- disable low power mode
 output-low		- set the pin to output mode with low level
 output-high		- set the pin to output mode with high level
+slew-rate		- set the slew rate
 
 Some of the generic properties take arguments. For those that do, the
 arguments are described below.
drivers/pinctrl/pinconf-generic.c +4 -0
index 55a0ebe..3d9a999 100644
@@ -48,6 +48,7 @@ static struct pin_config_item conf_items[] = {
 	PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL),
 	PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL),
 	PCONFDUMP(PIN_CONFIG_DRIVE_STRENGTH, "output drive strength", "mA"),
+	PCONFDUMP(PIN_CONFIG_INPUT_ENABLE, "input enabled", NULL),
 	PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT_ENABLE, "input schmitt enabled", NULL),
 	PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT, "input schmitt trigger", NULL),
 	PCONFDUMP(PIN_CONFIG_INPUT_DEBOUNCE, "input debounce", "usec"),
@@ -160,6 +161,8 @@ static struct pinconf_generic_dt_params dt_params[] = {
 	{ "drive-open-drain", PIN_CONFIG_DRIVE_OPEN_DRAIN, 0 },
 	{ "drive-open-source", PIN_CONFIG_DRIVE_OPEN_SOURCE, 0 },
 	{ "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 0 },
+	{ "input-enable", PIN_CONFIG_INPUT_ENABLE, 1 },
+	{ "input-disable", PIN_CONFIG_INPUT_ENABLE, 0 },
 	{ "input-schmitt-enable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 1 },
 	{ "input-schmitt-disable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 0 },
 	{ "input-debounce", PIN_CONFIG_INPUT_DEBOUNCE, 0 },
@@ -167,6 +170,7 @@ static struct pinconf_generic_dt_params dt_params[] = {
 	{ "low-power-disable", PIN_CONFIG_LOW_POWER_MODE, 0 },
 	{ "output-low", PIN_CONFIG_OUTPUT, 0, },
 	{ "output-high", PIN_CONFIG_OUTPUT, 1, },
+	{ "slew-rate", PIN_CONFIG_SLEW_RATE, 0},
 };
 
 /**
include/linux/pinctrl/pinconf-generic.h +4 -0
index fb90ef5..0db67bf 100644
@@ -61,6 +61,9 @@
  *	argument is ignored.
  * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current
  *	passed as argument. The argument is in mA.
+ * @PIN_CONFIG_INPUT_ENABLE: enable the pin's input.  Note that this does not
+ *	affect the pin's ability to drive output.  1 enables input, 0 disables
+ *	input.
  * @PIN_CONFIG_INPUT_SCHMITT_ENABLE: control schmitt-trigger mode on the pin.
  *      If the argument != 0, schmitt-trigger mode is enabled. If it's 0,
  *      schmitt-trigger mode is disabled.
@@ -99,6 +102,7 @@ enum pin_config_param {
 	PIN_CONFIG_DRIVE_OPEN_DRAIN,
 	PIN_CONFIG_DRIVE_OPEN_SOURCE,
 	PIN_CONFIG_DRIVE_STRENGTH,
+	PIN_CONFIG_INPUT_ENABLE,
 	PIN_CONFIG_INPUT_SCHMITT_ENABLE,
 	PIN_CONFIG_INPUT_SCHMITT,
 	PIN_CONFIG_INPUT_DEBOUNCE,
Signature · 1 line
1.7.9.5
#42 lore raw

Re: [PATCH v3 2/6] pinctrl: Adds slew-rate, input-enable/disable

Quoted 6 lines · Sherman Yin

This commit adds slew-rate and input-enable/disable support for pinconf -generic.

---
v3: added to patchset

I really like this patch and would like to apply it but I want to give the device tree people a few days to think about it.

Yours,
Linus Walleij

#44 lore raw

PATCH v3 3/6 pinctrl: Make PINCTRL selectable by defconfig/menuconfig

In reply to Sherman Yin

Adds a string to the PINCTRL config option so that 1) CONFIG_PINCTRL=y would not be erased by make config, and 2) PINCTRL option would show up in menuconfig.

---
v3: added to patchset

 drivers/pinctrl/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/Kconfig +1 -1
index 33f9dc1..a921ff1 100644
@@ -3,7 +3,7 @@
 #
 
 config PINCTRL
-	bool
+	bool "Enable the pinctrl framework"
 
 if PINCTRL
 
Signature · 1 line
1.7.9.5
#45 lore raw

Re: [PATCH v3 3/6] pinctrl: Make PINCTRL selectable by defconfig/menuconfig

Quoted 6 lines · Sherman Yin

Adds a string to the PINCTRL config option so that 1) CONFIG_PINCTRL=y would not be erased by make config, and 2) PINCTRL option would show up in menuconfig.

---
v3: added to patchset

NAK. The pin control subsystem has been designed so that you should select the pin controller through select statements from the SoC using it.

This was requested at one time by Linus (Torvalds).

You need to convince me that this is really needed.

Yours,
Linus Walleij

#46 lore raw

Re: [PATCH v3 3/6] pinctrl: Make PINCTRL selectable by defconfig/menuconfig

Quoted 13 lines · Linus Walleij
Quoted 6 lines · Sherman Yin

Adds a string to the PINCTRL config option so that 1) CONFIG_PINCTRL=y would not be erased by make config, and 2) PINCTRL option would show up in menuconfig.

---
v3: added to patchset

NAK. The pin control subsystem has been designed so that you should select the pin controller through select statements from the SoC using it.

Quoted 6 lines

This was requested at one time by Linus (Torvalds).

You need to convince me that this is really needed.

Yours,
Linus Walleij

Hi Linus,
I had requested this from Sherman. The reason is so that pinctrl can
be selectable through defconfig, instead of through SoC select statements. And the reason for that is so that, in the future, some of these can be switched into loadable modules (which can't be done from Kconfig). This will become necessary with the move to multiplatform - we won't be able to have everything static anymore.

Thanks,
csd

#47 lore raw

Re: [PATCH v3 3/6] pinctrl: Make PINCTRL selectable by defconfig/menuconfig

Quoted 6 lines · Christian Daudt

I had requested this from Sherman. The reason is so that pinctrl can
be selectable through defconfig, instead of through SoC select statements. And the reason for that is so that, in the future, some of these can be switched into loadable modules (which can't be done from Kconfig). This will become necessary with the move to multiplatform - we won't be able to have everything static anymore.

Isn't it sufficient to make the pin controller entry tristate rather than bool?

And as mentioned elsewhere this does not at all solve the issue that we still need to have all basic IRQchips and timer drivers compiled into the kernel.

Yours,
Linus Walleij

#48 lore raw

Re: [PATCH v3 3/6] pinctrl: Make PINCTRL selectable by defconfig/menuconfig

Quoted 9 lines · Linus Walleij
Quoted 6 lines · Christian Daudt

I had requested this from Sherman. The reason is so that pinctrl can
be selectable through defconfig, instead of through SoC select statements. And the reason for that is so that, in the future, some of these can be switched into loadable modules (which can't be done from Kconfig). This will become necessary with the move to multiplatform - we won't be able to have everything static anymore.

Quoted 6 lines

Isn't it sufficient to make the pin controller entry tristate rather than bool?

And as mentioned elsewhere this does not at all solve the issue that we still need to have all basic IRQchips and timer drivers compiled into the kernel.

No matter how we build the individual pinctrl drivers we will always need the pinctrl framework in a multi-soc zImage; so I can't see that we gain anything from being able to compile PINCTRL as a module.

I don't like compiling the individual pinctrl drivers as modules, as it leaves us with a waterfall of PROBE_DEFERRs.

Regards,
Bjorn

#49 lore raw

Re: [PATCH v3 3/6] pinctrl: Make PINCTRL selectable by defconfig/menuconfig

Quoted 3 lines · Bjorn Andersson

No matter how we build the individual pinctrl drivers we will always need the pinctrl framework in a multi-soc zImage; so I can't see that we gain anything from being able to compile PINCTRL as a module.

I discussed this matter with Christian on IRC and I believe we could basically do "select PINCTRL" on ARCH_MULTIPLATFORM as the vast majority of multiplatforms appear to be using this anyway, this would make the submenu for pin control pop up in menuconfig for this, and make it possible to move different subdrivers to modules if desired.

MULTIPLATFORM does not seem to be about saving footprint bytes on a very fine-granular level anyway, more about doing the module loading/unloading approach to footprint.

(That drivers such as clk, regulator, pin control, GPIO, irqchip are usually impossible to rmmod as their tentacles will invariably be in all drivers everywhere is another issue, but this approach will solve modular *loading* atleast.)

Yours,
Linus Walleij

#50 lore raw

Re: [PATCH v3 3/6] pinctrl: Make PINCTRL selectable by defconfig/menuconfig

Quoted 14 lines · Linus Walleij
Quoted 3 lines · Bjorn Andersson

No matter how we build the individual pinctrl drivers we will always need the pinctrl framework in a multi-soc zImage; so I can't see that we gain anything from being able to compile PINCTRL as a module.

I discussed this matter with Christian on IRC and I believe we could basically do "select PINCTRL" on ARCH_MULTIPLATFORM as the vast majority of multiplatforms appear to be using this anyway, this would make the submenu for pin control pop up in menuconfig for this, and make it possible to move different subdrivers to modules if desired.

Quoted 3 lines

MULTIPLATFORM does not seem to be about saving footprint bytes on a very fine-granular level anyway, more about doing the module loading/unloading approach to footprint.

Let's review the list of platforms that don't select PINCTRL. There are some platforms that are indeed sensitive about memory footprint, and I promised people that converting to multiplatform won't cause a significant increase in kernel binary size as long as no other platforms are enabled.

Arnd

#51 lore raw

Re: [PATCH v3 3/6] pinctrl: Make PINCTRL selectable by defconfig/menuconfig

Quoted 19 lines · Arnd Bergmann
Quoted 14 lines · Linus Walleij
Quoted 3 lines · Bjorn Andersson

No matter how we build the individual pinctrl drivers we will always need the pinctrl framework in a multi-soc zImage; so I can't see that we gain anything from being able to compile PINCTRL as a module.

I discussed this matter with Christian on IRC and I believe we could basically do "select PINCTRL" on ARCH_MULTIPLATFORM as the vast majority of multiplatforms appear to be using this anyway, this would make the submenu for pin control pop up in menuconfig for this, and make it possible to move different subdrivers to modules if desired.

Quoted 3 lines

MULTIPLATFORM does not seem to be about saving footprint bytes on a very fine-granular level anyway, more about doing the module loading/unloading approach to footprint.

Quoted 8 lines

Let's review the list of platforms that don't select PINCTRL. There are some platforms that are indeed sensitive about memory footprint, and I promised people that converting to multiplatform won't cause a significant increase in kernel binary size as long as no other platforms are enabled.

Arnd

Ok, for this driver, I'll just select PINCTRL under the ARCH_BCM_MOBILE.
We can move this to ARCH_MULTIPLATFORM once we're sure this is okay
for other platforms.

Regards,
Sherman

#52 lore raw

PATCH v3 4/6 pinctrl: Add pinctrl binding for Broadcom Capri SoCs

In reply to Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
v3: Use generic pin config properties instead of brcm-specific ones. Clarified
pin types (standard, i2c, hdmi).
v2: Use hyphens instead of underscore in DT property names.

---
 .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  429 ++++++++++++++++++++
 1 file changed, 429 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +429 -0
new file mode 100644
index 0000000..7973cbd
@@ -0,0 +1,429 @@
+Broadcom Capri Pin Controller
+
+This is a pin controller for the Broadcom BCM281xx SoC family, which includes
+BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs.
+
+=== Pin Controller Node ===
+
+Required Properties:
+
+- compatible:	Must be "brcm,capri-pinctrl".
+- reg:		Base address of the PAD Controller register block and the size
+		of the block.
+
+For example, the following is the bare minimum node:
+
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
+
+As a pin controller device, in addition to the required properties, this node
+should also contain the pin configuration nodes that client devices reference,
+if any.
+
+=== Pin Configuration Node ===
+
+Each pin configuration node is a sub-node of the pin controller node and is a
+container of an arbitrary number of subnodes, called pin group nodes in this
+document.
+
+Please refer to the pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the definition of a
+"pin configuration node".
+
+=== Pin Group Node ===
+
+A pin group node specifies the desired pin mux and/or pin configuration for an
+arbitrary number of pins.  The name of the pin group node is optional and not
+used.
+
+A pin group node only affects the properties specified in the node, and has no
+effect on any properties that are omitted.
+
+The pin group node accepts a subset of the generic pin config properties. For
+details generic pin config properties, please refer to pinctrl-bindings.txt
+and <include/linux/pinctrl/pinconfig-generic.h>.
+
+Each pin controlled by this pin controller belong to one of three types:
+Standard, I2C, and HDMI.  Each type accepts a different set of pin config
+properties.  A list of pins and their types is provided below.
+
+Required Properties (applicable to all pins):
+
+- pins:		Multiple strings.  Specifies the name(s) of one or more pins to
+		be configured by this node.
+
+Optional Properties (for standard pins):
+
+- function:			String. Specifies the pin mux selection. Values
+				must be one of: "alt1", "alt2", "alt3", "alt4"
+- input-schmitt-enable:		No arguments. Enable schmitt-trigger mode.
+- input-schmitt-disable:	No arguments. Disable schmitt-trigger mode.
+- bias-pull-up:			No arguments. Pull up on pin.
+- bias-pull-down:		No arguments. Pull down on pin.
+- bias-disable:			No arguments. Disable pin bias.
+- slew-rate:			Integer. Meaning depends on configured pin mux:
+				*_SCL or *_SDA:
+					0: Standard(100kbps)& Fast(400kbps) mode
+					1: Highspeed (3.4Mbps) mode
+				IC_DM or IC_DP:
+					0: normal slew rate
+					1: fast slew rate
+				Otherwise:
+					0: fast slew rate
+					1: normal slew rate
+- input-enable:			No arguements. Enable input (does not affect
+				output.)
+- input-disable:		No arguements. Disable input (does not affect
+				output.)
+- drive-strength:		Integer. Drive strength in mA.  Valid values are
+				2, 4, 6, 8, 10, 12, 14, 16 mA.
+
+Optional Properties (for I2C pins):
+
+- function:			String. Specifies the pin mux selection. Values
+				must be one of: "alt1", "alt2", "alt3", "alt4"
+- bias-pull-up:			Integer. Pull up strength in Ohm:
+					1: 1.2 kOhm
+					2: 1.8 kOhm
+					3: 720 Ohm
+					4: 2.7 kOhm
+					5: 831 Ohm
+					6: 1.08 kOhm
+					7: 568 Ohm
+- bias-disable:			No arguments. Disable pin bias.
+- slew-rate:			Integer. Meaning depends on configured pin mux:
+				*_SCL or *_SDA:
+					0: Standard(100kbps)& Fast(400kbps) mode
+					1: Highspeed (3.4Mbps) mode
+				IC_DM or IC_DP:
+					0: normal slew rate
+					1: fast slew rate
+				Otherwise:
+					0: fast slew rate
+					1: normal slew rate
+- input-enable:			No arguements. Enable input (does not affect
+				output.)
+- input-disable:		No arguements. Disable input (does not affect
+				output.)
+
+Optional Properties (for HDMI pins):
+
+- function:			String. Specifies the pin mux selection. Values
+				must be one of: "alt1", "alt2", "alt3", "alt4"
+- slew-rate:			Integer. Controls slew rate.
+					0: Standard(100kbps)& Fast(400kbps) mode
+					1: Highspeed (3.4Mbps) mode
+- input-enable:			No arguements. Enable input (does not affect
+				output.)
+- input-disable:		No arguements. Disable input (does not affect
+				output.)
+
+Example:
+// pin controller node
+pinctrl at 35004800 {
+	compatible = "brcm,capri-pinctrl";
+	reg = <0x35004800 0x430>;
+
+	// pin configuration node
+	dev_a_default: dev_a_active {
+		//group node
+		grp_1 {
+			pins		= "pin1", "pin2", "pin3";
+			function	= "alt1";
+			drive-strength	= <4>;
+			slew-rate	= <1>;
+		};
+
+		grp_2 {
+			...
+		};
+
+		// other pin group nodes
+		...
+	};
+
+	// other pin configuration nodes
+	...
+};
+
+In the example above, "dev_a_active" is a pin configuration node with a number
+of sub-nodes.  In the pin group node "grp_1", 3 pins are defined in the
+"pins" property.  Thus, the remaining properties in the "grp_1" node applies to
+these 3 pins, including setting the pinmux to "alt1", setting the drive strength
+to 4 mA, and seting the slew rate to normal.  No other properties are sepcified,
+implying no changes to any other parameters for these pins.
+
+=== Pin Names and Type ===
+
+The following are valid pin names and their pin types:
+
+	"adcsync",		Standard
+	"bat_rm",		Standard
+	"bsc1_scl",		I2C
+	"bsc1_sda",		I2C
+	"bsc2_scl",		I2C
+	"bsc2_sda",		I2C
+	"classgpwr",		Standard
+	"clk_cx8",		Standard
+	"clkout_0",		Standard
+	"clkout_1",		Standard
+	"clkout_2",		Standard
+	"clkout_3",		Standard
+	"clkreq_in_0",		Standard
+	"clkreq_in_1",		Standard
+	"cws_sys_req1",		Standard
+	"cws_sys_req2",		Standard
+	"cws_sys_req3",		Standard
+	"digmic1_clk",		Standard
+	"digmic1_dq",		Standard
+	"digmic2_clk",		Standard
+	"digmic2_dq",		Standard
+	"gpen13",		Standard
+	"gpen14",		Standard
+	"gpen15",		Standard
+	"gpio00",		Standard
+	"gpio01",		Standard
+	"gpio02",		Standard
+	"gpio03",		Standard
+	"gpio04",		Standard
+	"gpio05",		Standard
+	"gpio06",		Standard
+	"gpio07",		Standard
+	"gpio08",		Standard
+	"gpio09",		Standard
+	"gpio10",		Standard
+	"gpio11",		Standard
+	"gpio12",		Standard
+	"gpio13",		Standard
+	"gpio14",		Standard
+	"gps_pablank",		Standard
+	"gps_tmark",		Standard
+	"hdmi_scl",		HDMI
+	"hdmi_sda",		HDMI
+	"ic_dm",		Standard
+	"ic_dp",		Standard
+	"kp_col_ip_0",		Standard
+	"kp_col_ip_1",		Standard
+	"kp_col_ip_2",		Standard
+	"kp_col_ip_3",		Standard
+	"kp_row_op_0",		Standard
+	"kp_row_op_1",		Standard
+	"kp_row_op_2",		Standard
+	"kp_row_op_3",		Standard
+	"lcd_b_0",		Standard
+	"lcd_b_1",		Standard
+	"lcd_b_2",		Standard
+	"lcd_b_3",		Standard
+	"lcd_b_4",		Standard
+	"lcd_b_5",		Standard
+	"lcd_b_6",		Standard
+	"lcd_b_7",		Standard
+	"lcd_g_0",		Standard
+	"lcd_g_1",		Standard
+	"lcd_g_2",		Standard
+	"lcd_g_3",		Standard
+	"lcd_g_4",		Standard
+	"lcd_g_5",		Standard
+	"lcd_g_6",		Standard
+	"lcd_g_7",		Standard
+	"lcd_hsync",		Standard
+	"lcd_oe",		Standard
+	"lcd_pclk",		Standard
+	"lcd_r_0",		Standard
+	"lcd_r_1",		Standard
+	"lcd_r_2",		Standard
+	"lcd_r_3",		Standard
+	"lcd_r_4",		Standard
+	"lcd_r_5",		Standard
+	"lcd_r_6",		Standard
+	"lcd_r_7",		Standard
+	"lcd_vsync",		Standard
+	"mdmgpio0",		Standard
+	"mdmgpio1",		Standard
+	"mdmgpio2",		Standard
+	"mdmgpio3",		Standard
+	"mdmgpio4",		Standard
+	"mdmgpio5",		Standard
+	"mdmgpio6",		Standard
+	"mdmgpio7",		Standard
+	"mdmgpio8",		Standard
+	"mphi_data_0",		Standard
+	"mphi_data_1",		Standard
+	"mphi_data_2",		Standard
+	"mphi_data_3",		Standard
+	"mphi_data_4",		Standard
+	"mphi_data_5",		Standard
+	"mphi_data_6",		Standard
+	"mphi_data_7",		Standard
+	"mphi_data_8",		Standard
+	"mphi_data_9",		Standard
+	"mphi_data_10",		Standard
+	"mphi_data_11",		Standard
+	"mphi_data_12",		Standard
+	"mphi_data_13",		Standard
+	"mphi_data_14",		Standard
+	"mphi_data_15",		Standard
+	"mphi_ha0",		Standard
+	"mphi_hat0",		Standard
+	"mphi_hat1",		Standard
+	"mphi_hce0_n",		Standard
+	"mphi_hce1_n",		Standard
+	"mphi_hrd_n",		Standard
+	"mphi_hwr_n",		Standard
+	"mphi_run0",		Standard
+	"mphi_run1",		Standard
+	"mtx_scan_clk",		Standard
+	"mtx_scan_data",	Standard
+	"nand_ad_0",		Standard
+	"nand_ad_1",		Standard
+	"nand_ad_2",		Standard
+	"nand_ad_3",		Standard
+	"nand_ad_4",		Standard
+	"nand_ad_5",		Standard
+	"nand_ad_6",		Standard
+	"nand_ad_7",		Standard
+	"nand_ale",		Standard
+	"nand_cen_0",		Standard
+	"nand_cen_1",		Standard
+	"nand_cle",		Standard
+	"nand_oen",		Standard
+	"nand_rdy_0",		Standard
+	"nand_rdy_1",		Standard
+	"nand_wen",		Standard
+	"nand_wp",		Standard
+	"pc1",			Standard
+	"pc2",			Standard
+	"pmu_int",		Standard
+	"pmu_scl",		I2C
+	"pmu_sda",		I2C
+	"rfst2g_mtsloten3g",	Standard
+	"rgmii_0_rx_ctl",	Standard
+	"rgmii_0_rxc",		Standard
+	"rgmii_0_rxd_0",	Standard
+	"rgmii_0_rxd_1",	Standard
+	"rgmii_0_rxd_2",	Standard
+	"rgmii_0_rxd_3",	Standard
+	"rgmii_0_tx_ctl",	Standard
+	"rgmii_0_txc",		Standard
+	"rgmii_0_txd_0",	Standard
+	"rgmii_0_txd_1",	Standard
+	"rgmii_0_txd_2",	Standard
+	"rgmii_0_txd_3",	Standard
+	"rgmii_1_rx_ctl",	Standard
+	"rgmii_1_rxc",		Standard
+	"rgmii_1_rxd_0",	Standard
+	"rgmii_1_rxd_1",	Standard
+	"rgmii_1_rxd_2",	Standard
+	"rgmii_1_rxd_3",	Standard
+	"rgmii_1_tx_ctl",	Standard
+	"rgmii_1_txc",		Standard
+	"rgmii_1_txd_0",	Standard
+	"rgmii_1_txd_1",	Standard
+	"rgmii_1_txd_2",	Standard
+	"rgmii_1_txd_3",	Standard
+	"rgmii_gpio_0",		Standard
+	"rgmii_gpio_1",		Standard
+	"rgmii_gpio_2",		Standard
+	"rgmii_gpio_3",		Standard
+	"rtxdata2g_txdata3g1",	Standard
+	"rtxen2g_txdata3g2",	Standard
+	"rxdata3g0",		Standard
+	"rxdata3g1",		Standard
+	"rxdata3g2",		Standard
+	"sdio1_clk",		Standard
+	"sdio1_cmd",		Standard
+	"sdio1_data_0",		Standard
+	"sdio1_data_1",		Standard
+	"sdio1_data_2",		Standard
+	"sdio1_data_3",		Standard
+	"sdio4_clk",		Standard
+	"sdio4_cmd",		Standard
+	"sdio4_data_0",		Standard
+	"sdio4_data_1",		Standard
+	"sdio4_data_2",		Standard
+	"sdio4_data_3",		Standard
+	"sim_clk",		Standard
+	"sim_data",		Standard
+	"sim_det",		Standard
+	"sim_resetn",		Standard
+	"sim2_clk",		Standard
+	"sim2_data",		Standard
+	"sim2_det",		Standard
+	"sim2_resetn",		Standard
+	"sri_c",		Standard
+	"sri_d",		Standard
+	"sri_e",		Standard
+	"ssp_extclk",		Standard
+	"ssp0_clk",		Standard
+	"ssp0_fs",		Standard
+	"ssp0_rxd",		Standard
+	"ssp0_txd",		Standard
+	"ssp2_clk",		Standard
+	"ssp2_fs_0",		Standard
+	"ssp2_fs_1",		Standard
+	"ssp2_fs_2",		Standard
+	"ssp2_fs_3",		Standard
+	"ssp2_rxd_0",		Standard
+	"ssp2_rxd_1",		Standard
+	"ssp2_txd_0",		Standard
+	"ssp2_txd_1",		Standard
+	"ssp3_clk",		Standard
+	"ssp3_fs",		Standard
+	"ssp3_rxd",		Standard
+	"ssp3_txd",		Standard
+	"ssp4_clk",		Standard
+	"ssp4_fs",		Standard
+	"ssp4_rxd",		Standard
+	"ssp4_txd",		Standard
+	"ssp5_clk",		Standard
+	"ssp5_fs",		Standard
+	"ssp5_rxd",		Standard
+	"ssp5_txd",		Standard
+	"ssp6_clk",		Standard
+	"ssp6_fs",		Standard
+	"ssp6_rxd",		Standard
+	"ssp6_txd",		Standard
+	"stat_1",		Standard
+	"stat_2",		Standard
+	"sysclken",		Standard
+	"traceclk",		Standard
+	"tracedt00",		Standard
+	"tracedt01",		Standard
+	"tracedt02",		Standard
+	"tracedt03",		Standard
+	"tracedt04",		Standard
+	"tracedt05",		Standard
+	"tracedt06",		Standard
+	"tracedt07",		Standard
+	"tracedt08",		Standard
+	"tracedt09",		Standard
+	"tracedt10",		Standard
+	"tracedt11",		Standard
+	"tracedt12",		Standard
+	"tracedt13",		Standard
+	"tracedt14",		Standard
+	"tracedt15",		Standard
+	"txdata3g0",		Standard
+	"txpwrind",		Standard
+	"uartb1_ucts",		Standard
+	"uartb1_urts",		Standard
+	"uartb1_urxd",		Standard
+	"uartb1_utxd",		Standard
+	"uartb2_urxd",		Standard
+	"uartb2_utxd",		Standard
+	"uartb3_ucts",		Standard
+	"uartb3_urts",		Standard
+	"uartb3_urxd",		Standard
+	"uartb3_utxd",		Standard
+	"uartb4_ucts",		Standard
+	"uartb4_urts",		Standard
+	"uartb4_urxd",		Standard
+	"uartb4_utxd",		Standard
+	"vc_cam1_scl",		I2C
+	"vc_cam1_sda",		I2C
+	"vc_cam2_scl",		I2C
+	"vc_cam2_sda",		I2C
+	"vc_cam3_scl",		I2C
+	"vc_cam3_sda",		I2C
Signature · 1 line
1.7.9.5
#53 lore raw

Re: [PATCH v3 4/6] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 9 lines · Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
v3: Use generic pin config properties instead of brcm-specific ones. Clarified
pin types (standard, i2c, hdmi).
v2: Use hyphens instead of underscore in DT property names.

Overall this is very nice!

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 94

Quoted 8 lines

+- bias-pull-up: Integer. Pull up strength in Ohm:

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +7 -0
+                                       1: 1.2 kOhm
+                                       2: 1.8 kOhm
+                                       3: 720 Ohm
+                                       4: 2.7 kOhm
+                                       5: 831 Ohm
+                                       6: 1.08 kOhm
+                                       7: 568 Ohm

Please do not use these custom enumerators 1 thru 7. Instead say that the argument is given in ohms, so for example:

bias-pull-up = <12000>;

Then translate this into the proper enumerator in your driver instead.

No full example provided in the binding! This needs to be there for understanding.

Yours,
Linus Walleij

#54 lore raw

Re: [PATCH v3 4/6] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 12 lines · Linus Walleij
Quoted 9 lines · Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
v3: Use generic pin config properties instead of brcm-specific ones. Clarified
pin types (standard, i2c, hdmi).
v2: Use hyphens instead of underscore in DT property names.

Quoted 1 line

Overall this is very nice!

Thanks!

Quoted 9 lines

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 94

Quoted 8 lines

+- bias-pull-up: Integer. Pull up strength in Ohm:

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +7 -0
+                                       1: 1.2 kOhm
+                                       2: 1.8 kOhm
+                                       3: 720 Ohm
+                                       4: 2.7 kOhm
+                                       5: 831 Ohm
+                                       6: 1.08 kOhm
+                                       7: 568 Ohm
Quoted 8 lines

Please do not use these custom enumerators 1 thru 7. Instead say that the argument is given in ohms, so for example:

bias-pull-up = <12000>;

Then translate this into the proper enumerator in your driver instead.

Ok. The 3 bits in this enumeration correspond to enabling the 3 pull up Rs (1.2k, 1.8k, 2.7k) in parallel, so the enum kind of make sense. But sure I can change it to actual ohms and will error out in the driver if specified value is not one of the 7.

Quoted 2 lines

No full example provided in the binding! This needs to be there for understanding.

Ok Will add some examples.

Thanks,
Sherman

#55 lore raw

Re: [PATCH v3 4/6] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 16 lines · Sherman Yin
Quoted 16 lines

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 94

Quoted 8 lines

+- bias-pull-up: Integer. Pull up strength in Ohm:

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +7 -0
+                                       1: 1.2 kOhm
+                                       2: 1.8 kOhm
+                                       3: 720 Ohm
+                                       4: 2.7 kOhm
+                                       5: 831 Ohm
+                                       6: 1.08 kOhm
+                                       7: 568 Ohm

Please do not use these custom enumerators 1 thru 7. Instead say that the argument is given in ohms, so for example:

bias-pull-up = <12000>;

Quoted 7 lines
Quoted 2 lines

Then translate this into the proper enumerator in your driver instead.

Ok. The 3 bits in this enumeration correspond to enabling the 3 pull up Rs (1.2k, 1.8k, 2.7k) in parallel, so the enum kind of make sense. But sure I can change it to actual ohms and will error out in the driver if specified value is not one of the 7.

Aha, that's how they do it :-)

Please write this in a comment in the driver because it makes it a lot easier to understand what is going on, and e.g. how to fuzz an apropriate resistance.

Can you tell me something about how such resistors are produced in silicon?

Yours,
Linus Walleij

#56 lore raw

Re: [PATCH v3 4/6] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 26 lines · Linus Walleij
Quoted 16 lines · Sherman Yin
Quoted 16 lines

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 94

Quoted 8 lines

+- bias-pull-up: Integer. Pull up strength in Ohm:

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +7 -0
+                                       1: 1.2 kOhm
+                                       2: 1.8 kOhm
+                                       3: 720 Ohm
+                                       4: 2.7 kOhm
+                                       5: 831 Ohm
+                                       6: 1.08 kOhm
+                                       7: 568 Ohm

Please do not use these custom enumerators 1 thru 7. Instead say that the argument is given in ohms, so for example:

bias-pull-up = <12000>;

Quoted 7 lines
Quoted 2 lines

Then translate this into the proper enumerator in your driver instead.

Ok. The 3 bits in this enumeration correspond to enabling the 3 pull up Rs (1.2k, 1.8k, 2.7k) in parallel, so the enum kind of make sense. But sure I can change it to actual ohms and will error out in the driver if specified value is not one of the 7.

Quoted 5 lines

Aha, that's how they do it :-)

Please write this in a comment in the driver because it makes it a lot easier to understand what is going on, and e.g. how to fuzz an apropriate resistance.

Yes, I plan to explain where those odd numbers come from in this file.

Quoted 2 lines

Can you tell me something about how such resistors are produced in silicon?

Sorry I'm not quite sure. I only know a little bit of the circuitry down to the schematic level...

Regards,
Sherman

#57 lore raw

PATCH v3 5/6 ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
v3: Re-work driver to be based on generic pin config. Moved config selection
from Kconfig to bcm_defconfig.
v2: Use hyphens instead of underscore in DT property names.

---
 arch/arm/configs/bcm_defconfig  |    5 +
 drivers/pinctrl/Kconfig         |   11 +
 drivers/pinctrl/Makefile        |    1 +
 drivers/pinctrl/pinctrl-capri.c | 1408 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1425 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
arch/arm/configs/bcm_defconfig +5 -0
index 287ac1d..6b94987 100644
@@ -126,3 +126,8 @@ CONFIG_CRC_ITU_T=y
 CONFIG_CRC7=y
 CONFIG_XZ_DEC=y
 CONFIG_AVERAGE=y
+CONFIG_PINCTRL=y
+CONFIG_PINMUX=y
+CONFIG_PINCONF=y
+CONFIG_GENERIC_PINCONF=y
+CONFIG_PINCTRL_CAPRI=y
drivers/pinctrl/Kconfig +11 -0
index a921ff1..664c8e6 100644
@@ -104,6 +104,17 @@ config PINCTRL_BCM2835
 	select PINMUX
 	select PINCONF
 
+config PINCTRL_CAPRI
+	bool "Broadcom Capri pinctrl driver"
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	help
+	  Say Y here to support Broadcom Capri pinctrl driver, which is used for
+	  the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351,
+	  BCM28145, and BCM28155 SoCs.  This driver requires the pinctrl
+	  framework.  GPIO is provided by a separate GPIO driver.
+
 config PINCTRL_IMX
 	bool
 	select PINMUX
drivers/pinctrl/Makefile +1 -0
index 4f7be29..86cac40 100644
@@ -21,6 +21,7 @@ obj-$(CONFIG_PINCTRL_BF60x)	+= pinctrl-adi2-bf60x.o
 obj-$(CONFIG_PINCTRL_AT91)	+= pinctrl-at91.o
 obj-$(CONFIG_PINCTRL_BCM2835)	+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BAYTRAIL)	+= pinctrl-baytrail.o
+obj-$(CONFIG_PINCTRL_CAPRI)	+= pinctrl-capri.o
 obj-$(CONFIG_PINCTRL_IMX)	+= pinctrl-imx.o
 obj-$(CONFIG_PINCTRL_IMX1_CORE)	+= pinctrl-imx1-core.o
 obj-$(CONFIG_PINCTRL_IMX27)	+= pinctrl-imx27.o
drivers/pinctrl/pinctrl-capri.c new file +1408 -0

1,408 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#58 lore raw

Re: [PATCH v3 5/6] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 8 lines · Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
v3: Re-work driver to be based on generic pin config. Moved config selection
from Kconfig to bcm_defconfig.

(...)

drivers/pinctrl/pinctrl-capri.c line 964

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+#define CAPRI_PIN_SHIFT(type, param) \
+       (CAPRI_ ## type ## _PIN_REG_ ## param ## _SHIFT)
+
+#define CAPRI_PIN_MASK(type, param) \
+       (CAPRI_ ## type ## _PIN_REG_ ## param ## _MASK)
+
+/* Macro to update reg with new pin config param */
+#define CAPRI_PIN_UPDATE(reg, type, param, val)                                \
+       (((reg) & ~CAPRI_PIN_MASK(type, param)) |                       \
+       (((val) << CAPRI_PIN_SHIFT(type, param)) & CAPRI_PIN_MASK(type, param)))

Yuck! Are you sure you cannot convert these to static inlines and make them much simpler in the process?

We do have an optimizing compiler, you don't need to do everything on one line... besides we're not on the hotpath.

Quoted 16 lines
drivers/pinctrl/pinctrl-capri.c new file +16 -0
+/*
+ * Write to the register using the value and mask if current value is different
+ */
+static void capri_reg_write(struct pinctrl_dev *pctldev,
+                           void __iomem *reg,
+                           u32 val,
+                           u32 mask)
+{
+       u32 old_val;
+       u32 new_val;
+
+       old_val = readl(reg);
+       new_val = (old_val & ~mask) | (val & mask);
+
+       if (new_val == old_val) {
+               dev_dbg(pctldev->dev,

drivers/pinctrl/pinctrl-capri.c line 991

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+                       "Reg 0x%p=0x%x (no change)\n",
+                       reg, old_val);
+               return;
+       }
+
+       dev_dbg(pctldev->dev,
+               "Reg 0x%p change from 0x%x to 0x%x\n",
+               reg, old_val, new_val);
+       writel(new_val, reg);
+}

This is a reimplementation of regmap for MMIO. See drivers/base/regmap/regmap-mmio.c
Notice how regmap_update_bits() is used throughout the kernel.

If you want to do this, use regmap.

drivers/pinctrl/pinctrl-capri.c line 1174

Quoted 13 lines
drivers/pinctrl/pinctrl-capri.c new file +13 -0
+               case PIN_CONFIG_DRIVE_STRENGTH:
+                       /* Valid range is 2-16 mA, even numbers only */
+                       if ((arg < 2) || (arg > 16) || (arg % 2)) {
+                               dev_err(pctldev->dev,
+                                       "Invalid Drive Strength value (%d) for "
+                                       "pin %s (%d). Valid values are "
+                                       "(2..16) mA, even numbers only.\n",
+                                       arg, pdata->pins[pin].name, pin);
+                               return -EINVAL;
+                       }
+                       *val = CAPRI_PIN_UPDATE(*val, STD, DRV_STR, (arg/2)-1);
+                       *mask |= CAPRI_STD_PIN_REG_DRV_STR_MASK;
+                       break;

Hm rather nice integer math...

Quoted 16 lines
drivers/pinctrl/pinctrl-capri.c new file +16 -0
+/* Goes through the configs and update register val/mask */
+static int capri_i2c_pin_update(struct pinctrl_dev *pctldev,
+                               unsigned pin,
+                               unsigned long *configs,
+                               unsigned num_configs,
+                               u32 *val,
+                               u32 *mask)
+{
+       struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
+       int i;
+       enum pin_config_param param;
+       u16 arg;
+
+       for (i = 0; i < num_configs; i++) {
+               param = pinconf_to_config_param(configs[i]);
+               arg = pinconf_to_config_argument(configs[i]);

drivers/pinctrl/pinctrl-capri.c line 1213

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+
+               switch (param) {
+               case PIN_CONFIG_BIAS_PULL_UP:
+                       if ((arg < 1) || (arg > 7)) {
+                               dev_err(pctldev->dev,
+                                       "Invalid Pull Up value (%d) for pin %s "
+                                       "(%d). Valid values are (1..7).\n",
+                                       arg, pdata->pins[pin].name, pin);
+                               return -EINVAL;
+                       }

No don't do that as mentioned in the other patch. Pass pull up strength in Ohms.

Then have a translation table here, and do some best-effort fuzzy match.

Quoted 6 lines
drivers/pinctrl/pinctrl-capri.c new file +6 -0
+       /* Different pins have different configuration options */
+       switch (pin_type) {
+       case CAPRI_PIN_TYPE_STD:
+               rc = capri_std_pin_update(pctldev, pin, configs, num_configs,
+                       &cfg_val, &cfg_mask);
+               break;

drivers/pinctrl/pinctrl-capri.c line 1321

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+
+       case CAPRI_PIN_TYPE_I2C:
+               rc = capri_i2c_pin_update(pctldev, pin, configs, num_configs,
+                       &cfg_val, &cfg_mask);
+               break;
+
+       case CAPRI_PIN_TYPE_HDMI:
+               rc = capri_hdmi_pin_update(pctldev, pin, configs, num_configs,
+                       &cfg_val, &cfg_mask);
+               break;

This is really nice and elegant.

Yours,
Linus Walleij

#59 lore raw

Re: [PATCH v3 5/6] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 6 lines · Linus Walleij

This is a reimplementation of regmap for MMIO. See drivers/base/regmap/regmap-mmio.c
Notice how regmap_update_bits() is used throughout the kernel.

If you want to do this, use regmap.

Or if this is very performance sensitive (which I'd not expect for
pinctrl) there's a helper in review at the minute which just uses a
spinlock.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131213/52664436/attachment.sig>

#60 lore raw

Re: [PATCH v3 5/6] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 7 lines · Mark Brown
Quoted 4 lines · Linus Walleij

This is a reimplementation of regmap for MMIO. See drivers/base/regmap/regmap-mmio.c
Notice how regmap_update_bits() is used throughout the kernel.

Quoted 6 lines
Quoted 1 line

If you want to do this, use regmap.

Or if this is very performance sensitive (which I'd not expect for pinctrl) there's a helper in review at the minute which just uses a spinlock.

Thanks Mark. It's not expected to be performance sensitive, so I'll probably go with regmap.

Regards,
Sherman

#61 lore raw

Re: [PATCH v3 5/6] ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Linus Walleij
Quoted 14 lines · Linus Walleij

drivers/pinctrl/pinctrl-capri.c line 964

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+#define CAPRI_PIN_SHIFT(type, param) \
+       (CAPRI_ ## type ## _PIN_REG_ ## param ## _SHIFT)
+
+#define CAPRI_PIN_MASK(type, param) \
+       (CAPRI_ ## type ## _PIN_REG_ ## param ## _MASK)
+
+/* Macro to update reg with new pin config param */
+#define CAPRI_PIN_UPDATE(reg, type, param, val)                                \
+       (((reg) & ~CAPRI_PIN_MASK(type, param)) |                       \
+       (((val) << CAPRI_PIN_SHIFT(type, param)) & CAPRI_PIN_MASK(type, param)))

Yuck! Are you sure you cannot convert these to static inlines and make them much simpler in the process?

Quoted 2 lines

We do have an optimizing compiler, you don't need to do everything on one line... besides we're not on the hotpath.

If I were to convert the first 2 #defines to functions, it would either be a 2-level switch statement or a 2D lookup table. IMO both of these options are more difficult to read than this simple concatenation, so I really rather keep them this way.

CAPRI_PIN_UPDATE, OTOH, doesn't require any concatenation so I can easily make that into an inline.

Quoted 33 lines
Quoted 17 lines
drivers/pinctrl/pinctrl-capri.c new file +16 -0
+/*
+ * Write to the register using the value and mask if current value is different
+ */
+static void capri_reg_write(struct pinctrl_dev *pctldev,
+                           void __iomem *reg,
+                           u32 val,
+                           u32 mask)
+{
+       u32 old_val;
+       u32 new_val;
+
+       old_val = readl(reg);
+       new_val = (old_val & ~mask) | (val & mask);
+
+       if (new_val == old_val) {
+               dev_dbg(pctldev->dev,

drivers/pinctrl/pinctrl-capri.c line 991

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+                       "Reg 0x%p=0x%x (no change)\n",
+                       reg, old_val);
+               return;
+       }
+
+       dev_dbg(pctldev->dev,
+               "Reg 0x%p change from 0x%x to 0x%x\n",
+               reg, old_val, new_val);
+       writel(new_val, reg);
+}

This is a reimplementation of regmap for MMIO. See drivers/base/regmap/regmap-mmio.c
Notice how regmap_update_bits() is used throughout the kernel.

Quoted 1 line

If you want to do this, use regmap.

Ok.

Quoted 15 lines
Quoted 4 lines
drivers/pinctrl/pinctrl-capri.c new file +3 -0
+               case PIN_CONFIG_DRIVE_STRENGTH:
+                       /* Valid range is 2-16 mA, even numbers only */
+                       if ((arg < 2) || (arg > 16) || (arg % 2)) {

drivers/pinctrl/pinctrl-capri.c line 1174

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+                               dev_err(pctldev->dev,
+                                       "Invalid Drive Strength value (%d) for "
+                                       "pin %s (%d). Valid values are "
+                                       "(2..16) mA, even numbers only.\n",
+                                       arg, pdata->pins[pin].name, pin);
+                               return -EINVAL;
+                       }
+                       *val = CAPRI_PIN_UPDATE(*val, STD, DRV_STR, (arg/2)-1);
+                       *mask |= CAPRI_STD_PIN_REG_DRV_STR_MASK;
+                       break;
Quoted 1 line

Hm rather nice integer math...

Sorry, I can't tell if you are being sarcastic :) Drive strength is represented by 3 bits in the register. If the values were 2-14 I could have done some bit-checking instead of those 3 conditions in the if statement. Or, if we use a enum of 0-7 then the check is much easier. But as we discussed re: pull-up resistance, we rather let users specify real numbers. The (arg/2)-1 is just to convert the mA into the 3 bits.

Quoted 30 lines
Quoted 16 lines
drivers/pinctrl/pinctrl-capri.c new file +16 -0
+/* Goes through the configs and update register val/mask */
+static int capri_i2c_pin_update(struct pinctrl_dev *pctldev,
+                               unsigned pin,
+                               unsigned long *configs,
+                               unsigned num_configs,
+                               u32 *val,
+                               u32 *mask)
+{
+       struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
+       int i;
+       enum pin_config_param param;
+       u16 arg;
+
+       for (i = 0; i < num_configs; i++) {
+               param = pinconf_to_config_param(configs[i]);
+               arg = pinconf_to_config_argument(configs[i]);

drivers/pinctrl/pinctrl-capri.c line 1213

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+
+               switch (param) {
+               case PIN_CONFIG_BIAS_PULL_UP:
+                       if ((arg < 1) || (arg > 7)) {
+                               dev_err(pctldev->dev,
+                                       "Invalid Pull Up value (%d) for pin %s "
+                                       "(%d). Valid values are (1..7).\n",
+                                       arg, pdata->pins[pin].name, pin);
+                               return -EINVAL;
+                       }

No don't do that as mentioned in the other patch. Pass pull up strength in Ohms.

Quoted 1 line

Then have a translation table here, and do some best-effort fuzzy match.

Sure. I'm just going to error out if the user-supplied value is off, since it is very clear what is acceptable from the binding documentation.

Quoted 10 lines
Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+       /* Different pins have different configuration options */
+       switch (pin_type) {
+       case CAPRI_PIN_TYPE_STD:
+               rc = capri_std_pin_update(pctldev, pin, configs, num_configs,
+                       &cfg_val, &cfg_mask);
+               break;
+
+       case CAPRI_PIN_TYPE_I2C:
+               rc = capri_i2c_pin_update(pctldev, pin, configs, num_configs,
+                       &cfg_val, &cfg_mask);
Quoted 8 lines

drivers/pinctrl/pinctrl-capri.c line 1321

Quoted 6 lines
drivers/pinctrl/pinctrl-capri.c new file +6 -0
+               break;
+
+       case CAPRI_PIN_TYPE_HDMI:
+               rc = capri_hdmi_pin_update(pctldev, pin, configs, num_configs,
+                       &cfg_val, &cfg_mask);
+               break;

This is really nice and elegant.

Thanks. :)

Regards,
Sherman

#62 lore raw

Re: [PATCH v3 5/6] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 35 lines · Sherman Yin
Quoted 33 lines · Linus Walleij
Quoted 17 lines

+/*
+ * Write to the register using the value and mask if current value is different
+ */

drivers/pinctrl/pinctrl-capri.c new file +13 -0
+static void capri_reg_write(struct pinctrl_dev *pctldev,
+                           void __iomem *reg,
+                           u32 val,
+                           u32 mask)
+{
+       u32 old_val;
+       u32 new_val;
+
+       old_val = readl(reg);
+       new_val = (old_val & ~mask) | (val & mask);
+
+       if (new_val == old_val) {
+               dev_dbg(pctldev->dev,

drivers/pinctrl/pinctrl-capri.c line 991

Quoted 10 lines
drivers/pinctrl/pinctrl-capri.c new file +10 -0
+                       "Reg 0x%p=0x%x (no change)\n",
+                       reg, old_val);
+               return;
+       }
+
+       dev_dbg(pctldev->dev,
+               "Reg 0x%p change from 0x%x to 0x%x\n",
+               reg, old_val, new_val);
+       writel(new_val, reg);
+}

This is a reimplementation of regmap for MMIO. See drivers/base/regmap/regmap-mmio.c
Notice how regmap_update_bits() is used throughout the kernel.

Quoted 3 lines
Quoted 1 line

If you want to do this, use regmap.

Ok.

As you can see in v4 of my patchset, I've changed my driver to use the mmio regmap. However, as I was tracing through regmap_update_bits(), it looks like I have to go through a lot of checks and function pointers just to do a simple write to a register. Also, I have to select REGMAP_MMIO which brings in a bunch of code as well.

I understand the benefits of using common code, but in this case it seems there is a lot of extra code and run-time overhead to use regmap.
In the end it also doesn't buy much in terms of functionality.

Just a quick note - it looks like the 2nd parameter of regmap_update_bits() wants the offset of a register (offset from regmap_mmio_context.regs). So calling the parameter "reg" is a little confusing, at least in the MMIO case.

Regards,
Sherman

#63 lore raw

PATCH v3 6/6 pinctrl: Enable pinctrl for Broadcom Capri SoCs

In reply to Sherman Yin

Enable pinctrl for Broadcom Capri (BCM281xx) SoCs.

---
v3: no change
v2: no change

---
 arch/arm/boot/dts/bcm11351.dtsi |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/bcm11351.dtsi +4 -0
index b0c0610..dd8e878 100644
@@ -142,4 +142,8 @@
 		status = "disabled";
 	};
 
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
 };
Signature · 1 line
1.7.9.5
#64 lore raw

v4 cover Add Broadcom Capri pinctrl driver

In reply to Sherman Yin

The following patches adds a pinctrl driver for Broadcom Capri (BCM281xx) SoCs. The first patch, adding the void * to pinctrl_pin_desc, has been previously discussed with LinusW. See this thread:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-April/165880.html
---
v4: - removed patch to add new properties to generic pinconfig (merged)
- Updated bias-pull-up property to accept R value in Ohms instead of an enum
- move PINCTRL_CAPRI to defconfig
- Use regmap MMIO
v3: Re-worked driver to be based on generic pinconfig, addressed review
comments and other supporting changes:
- moved config selection from Kconfig to defconfig
- added slew-rate, input enable, input disable properties for generic pinconfig
- added a description for PINCTRL config
v2: Use hyphens instead of underscore in DT property names.

Sherman Yin (6):
pinctrl: Add void * to pinctrl_pin_desc
pinctrl: Adds slew-rate, input-enable/disable
pinctrl: Make PINCTRL selectable by defconfig/menuconfig
pinctrl: Add pinctrl binding for Broadcom Capri SoCs
ARM: pinctrl: Add Broadcom Capri pinctrl driver
pinctrl: Enable pinctrl for Broadcom Capri SoCs

 .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  429 ++++++
 .../bindings/pinctrl/pinctrl-bindings.txt          |    3 +
 arch/arm/boot/dts/bcm11351.dtsi                    |    4 +
 arch/arm/configs/bcm_defconfig                     |    5 +
 drivers/pinctrl/Kconfig                            |   13 +-
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/pinconf-generic.c                  |    4 +
 drivers/pinctrl/pinctrl-capri.c                    | 1408 ++++++++++++++++++++
 include/linux/pinctrl/pinconf-generic.h            |    4 +
 include/linux/pinctrl/pinctrl.h                    |    2 +
 10 files changed, 1872 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
Signature · 1 line
1.7.9.5
#65 lore raw

PATCH v4 1/4 pinctrl: Add void * to pinctrl_pin_desc

drv_data is added to the pinctrl_pin_desc for drivers to define additional driver-specific per-pin data.

---
v4: no change
v3: no change
v2: no change

---
 include/linux/pinctrl/pinctrl.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/pinctrl/pinctrl.h +2 -0
index fefb886..cc8e1af 100644
@@ -32,10 +32,12 @@ struct device_node;
  * pins, pads or other muxable units in this struct
  * @number: unique pin number from the global pin number space
  * @name: a name for this pin
+ * @drv_data: driver-defined per-pin data. pinctrl core does not touch this
  */
 struct pinctrl_pin_desc {
 	unsigned number;
 	const char *name;
+	void *drv_data;
 };
 
 /* Convenience macro to define a single named or anonymous pin descriptor */
Signature · 1 line
1.7.9.5
#67 lore raw

PATCH v4 2/4 pinctrl: Add pinctrl binding for Broadcom Capri SoCs

In reply to Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
v4: Changed valid values for "bias-pull-up" property for I2C pins. Expanded
pin configuration node example.
v3: Use generic pin config properties instead of brcm-specific ones. Clarified
pin types (standard, i2c, hdmi).
v2: Use hyphens instead of underscore in DT property names.

---
 .../bindings/pinctrl/brcm,capri-pinctrl.txt        |  461 ++++++++++++++++++++
 1 file changed, 461 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +461 -0
new file mode 100644
index 0000000..9e9e9ef
@@ -0,0 +1,461 @@
+Broadcom Capri Pin Controller
+
+This is a pin controller for the Broadcom BCM281xx SoC family, which includes
+BCM11130, BCM11140, BCM11351, BCM28145, and BCM28155 SoCs.
+
+=== Pin Controller Node ===
+
+Required Properties:
+
+- compatible:	Must be "brcm,capri-pinctrl".
+- reg:		Base address of the PAD Controller register block and the size
+		of the block.
+
+For example, the following is the bare minimum node:
+
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
+
+As a pin controller device, in addition to the required properties, this node
+should also contain the pin configuration nodes that client devices reference,
+if any.
+
+=== Pin Configuration Node ===
+
+Each pin configuration node is a sub-node of the pin controller node and is a
+container of an arbitrary number of subnodes, called pin group nodes in this
+document.
+
+Please refer to the pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the definition of a
+"pin configuration node".
+
+=== Pin Group Node ===
+
+A pin group node specifies the desired pin mux and/or pin configuration for an
+arbitrary number of pins.  The name of the pin group node is optional and not
+used.
+
+A pin group node only affects the properties specified in the node, and has no
+effect on any properties that are omitted.
+
+The pin group node accepts a subset of the generic pin config properties. For
+details generic pin config properties, please refer to pinctrl-bindings.txt
+and <include/linux/pinctrl/pinconfig-generic.h>.
+
+Each pin controlled by this pin controller belong to one of three types:
+Standard, I2C, and HDMI.  Each type accepts a different set of pin config
+properties.  A list of pins and their types is provided below.
+
+Required Properties (applicable to all pins):
+
+- pins:		Multiple strings.  Specifies the name(s) of one or more pins to
+		be configured by this node.
+
+Optional Properties (for standard pins):
+
+- function:			String. Specifies the pin mux selection. Values
+				must be one of: "alt1", "alt2", "alt3", "alt4"
+- input-schmitt-enable:		No arguments. Enable schmitt-trigger mode.
+- input-schmitt-disable:	No arguments. Disable schmitt-trigger mode.
+- bias-pull-up:			No arguments. Pull up on pin.
+- bias-pull-down:		No arguments. Pull down on pin.
+- bias-disable:			No arguments. Disable pin bias.
+- slew-rate:			Integer. Meaning depends on configured pin mux:
+				*_SCL or *_SDA:
+					0: Standard(100kbps)& Fast(400kbps) mode
+					1: Highspeed (3.4Mbps) mode
+				IC_DM or IC_DP:
+					0: normal slew rate
+					1: fast slew rate
+				Otherwise:
+					0: fast slew rate
+					1: normal slew rate
+- input-enable:			No arguements. Enable input (does not affect
+				output.)
+- input-disable:		No arguements. Disable input (does not affect
+				output.)
+- drive-strength:		Integer. Drive strength in mA.  Valid values are
+				2, 4, 6, 8, 10, 12, 14, 16 mA.
+
+Optional Properties (for I2C pins):
+
+- function:			String. Specifies the pin mux selection. Values
+				must be one of: "alt1", "alt2", "alt3", "alt4"
+- bias-pull-up:			Integer. Pull up strength in Ohm. There are 3
+				pull-up resisitors (1.2k, 1.8k, 2.7k) available
+				in parallel for I2C pins, so the valid values
+				are: 568, 720, 831, 1080, 1200, 1800, 2700 Ohm.
+- bias-disable:			No arguments. Disable pin bias.
+- slew-rate:			Integer. Meaning depends on configured pin mux:
+				*_SCL or *_SDA:
+					0: Standard(100kbps)& Fast(400kbps) mode
+					1: Highspeed (3.4Mbps) mode
+				IC_DM or IC_DP:
+					0: normal slew rate
+					1: fast slew rate
+				Otherwise:
+					0: fast slew rate
+					1: normal slew rate
+- input-enable:			No arguements. Enable input (does not affect
+				output.)
+- input-disable:		No arguements. Disable input (does not affect
+				output.)
+
+Optional Properties (for HDMI pins):
+
+- function:			String. Specifies the pin mux selection. Values
+				must be one of: "alt1", "alt2", "alt3", "alt4"
+- slew-rate:			Integer. Controls slew rate.
+					0: Standard(100kbps)& Fast(400kbps) mode
+					1: Highspeed (3.4Mbps) mode
+- input-enable:			No arguements. Enable input (does not affect
+				output.)
+- input-disable:		No arguements. Disable input (does not affect
+				output.)
+
+Example:
+// pin controller node
+pinctrl at 35004800 {
+	compatible = "brcm,capri-pinctrl";
+	reg = <0x35004800 0x430>;
+
+	// pin configuration node
+	dev_a_default: dev_a_active {
+		//group node defining 1 standard pin
+		grp_1 {
+			pins		= "std_pin1";
+			function	= "alt1";
+			input-schmitt-enable;
+			bias-disable;
+			slew-rate	= <1>;
+			drive-strength	= <4>;
+		};
+
+		// group node defining 2 I2C pins
+		grp_2 {
+			pins		= "i2c_pin1", "i2c_pin2";
+			function	= "alt2";
+			bias-pull-up	= <720>;
+			input-enable;
+		};
+
+		// group node defining 2 HDMI pins
+		grp_3 {
+			pins		= "hdmi_pin1", "hdmi_pin2";
+			function	= "alt3";
+			slew-rate	= <1>;
+		};
+
+		// other pin group nodes
+		...
+	};
+
+	// other pin configuration nodes
+	...
+};
+
+In the example above, "dev_a_active" is a pin configuration node with a number
+of sub-nodes.  In the pin group node "grp_1", one pin, "std_pin1", is defined in
+the "pins" property.  Thus, the remaining properties in the "grp_1" node applies
+only to this pin, including the following settings:
+ - setting pinmux to "alt1"
+ - enabling schmitt-trigger (hystersis) mode
+ - disabling pin bias
+ - setting the slew-rate to 1
+ - setting the drive strength to 4 mA
+Note that neither "input-enable" nor "input-disable" was specified - the pinctrl
+subsystem will therefore leave this property unchanged from whatever state it
+was in before applying these changes.
+
+The "pins" property in the pin group node "grp_2" specifies two pins -
+"i2c_pin1" and "i2c_pin2"; the remaining properties in this pin group node,
+therefore, applies to both of these pins.  The properties include:
+ - setting pinmux to "alt2"
+ - setting pull-up resistance to 720 Ohm (ie. enabling 1.2k and 1.8k resistors
+   in parallel)
+ - enabling both pins' input
+"slew-rate" is not specified in this pin group node, so the slew-rate for these
+pins are left as-is.
+
+Finally, "grp_3" defines two HDMI pins.  The following properties are applied to
+both pins:
+ - setting pinmux to "alt3"
+ - setting slew-rate to 1; for HDMI pins, this corresponds to the 3.4 Mbps
+   Highspeed mode
+The input is neither enabled or disabled, and is left untouched.
+
+=== Pin Names and Type ===
+
+The following are valid pin names and their pin types:
+
+	"adcsync",		Standard
+	"bat_rm",		Standard
+	"bsc1_scl",		I2C
+	"bsc1_sda",		I2C
+	"bsc2_scl",		I2C
+	"bsc2_sda",		I2C
+	"classgpwr",		Standard
+	"clk_cx8",		Standard
+	"clkout_0",		Standard
+	"clkout_1",		Standard
+	"clkout_2",		Standard
+	"clkout_3",		Standard
+	"clkreq_in_0",		Standard
+	"clkreq_in_1",		Standard
+	"cws_sys_req1",		Standard
+	"cws_sys_req2",		Standard
+	"cws_sys_req3",		Standard
+	"digmic1_clk",		Standard
+	"digmic1_dq",		Standard
+	"digmic2_clk",		Standard
+	"digmic2_dq",		Standard
+	"gpen13",		Standard
+	"gpen14",		Standard
+	"gpen15",		Standard
+	"gpio00",		Standard
+	"gpio01",		Standard
+	"gpio02",		Standard
+	"gpio03",		Standard
+	"gpio04",		Standard
+	"gpio05",		Standard
+	"gpio06",		Standard
+	"gpio07",		Standard
+	"gpio08",		Standard
+	"gpio09",		Standard
+	"gpio10",		Standard
+	"gpio11",		Standard
+	"gpio12",		Standard
+	"gpio13",		Standard
+	"gpio14",		Standard
+	"gps_pablank",		Standard
+	"gps_tmark",		Standard
+	"hdmi_scl",		HDMI
+	"hdmi_sda",		HDMI
+	"ic_dm",		Standard
+	"ic_dp",		Standard
+	"kp_col_ip_0",		Standard
+	"kp_col_ip_1",		Standard
+	"kp_col_ip_2",		Standard
+	"kp_col_ip_3",		Standard
+	"kp_row_op_0",		Standard
+	"kp_row_op_1",		Standard
+	"kp_row_op_2",		Standard
+	"kp_row_op_3",		Standard
+	"lcd_b_0",		Standard
+	"lcd_b_1",		Standard
+	"lcd_b_2",		Standard
+	"lcd_b_3",		Standard
+	"lcd_b_4",		Standard
+	"lcd_b_5",		Standard
+	"lcd_b_6",		Standard
+	"lcd_b_7",		Standard
+	"lcd_g_0",		Standard
+	"lcd_g_1",		Standard
+	"lcd_g_2",		Standard
+	"lcd_g_3",		Standard
+	"lcd_g_4",		Standard
+	"lcd_g_5",		Standard
+	"lcd_g_6",		Standard
+	"lcd_g_7",		Standard
+	"lcd_hsync",		Standard
+	"lcd_oe",		Standard
+	"lcd_pclk",		Standard
+	"lcd_r_0",		Standard
+	"lcd_r_1",		Standard
+	"lcd_r_2",		Standard
+	"lcd_r_3",		Standard
+	"lcd_r_4",		Standard
+	"lcd_r_5",		Standard
+	"lcd_r_6",		Standard
+	"lcd_r_7",		Standard
+	"lcd_vsync",		Standard
+	"mdmgpio0",		Standard
+	"mdmgpio1",		Standard
+	"mdmgpio2",		Standard
+	"mdmgpio3",		Standard
+	"mdmgpio4",		Standard
+	"mdmgpio5",		Standard
+	"mdmgpio6",		Standard
+	"mdmgpio7",		Standard
+	"mdmgpio8",		Standard
+	"mphi_data_0",		Standard
+	"mphi_data_1",		Standard
+	"mphi_data_2",		Standard
+	"mphi_data_3",		Standard
+	"mphi_data_4",		Standard
+	"mphi_data_5",		Standard
+	"mphi_data_6",		Standard
+	"mphi_data_7",		Standard
+	"mphi_data_8",		Standard
+	"mphi_data_9",		Standard
+	"mphi_data_10",		Standard
+	"mphi_data_11",		Standard
+	"mphi_data_12",		Standard
+	"mphi_data_13",		Standard
+	"mphi_data_14",		Standard
+	"mphi_data_15",		Standard
+	"mphi_ha0",		Standard
+	"mphi_hat0",		Standard
+	"mphi_hat1",		Standard
+	"mphi_hce0_n",		Standard
+	"mphi_hce1_n",		Standard
+	"mphi_hrd_n",		Standard
+	"mphi_hwr_n",		Standard
+	"mphi_run0",		Standard
+	"mphi_run1",		Standard
+	"mtx_scan_clk",		Standard
+	"mtx_scan_data",	Standard
+	"nand_ad_0",		Standard
+	"nand_ad_1",		Standard
+	"nand_ad_2",		Standard
+	"nand_ad_3",		Standard
+	"nand_ad_4",		Standard
+	"nand_ad_5",		Standard
+	"nand_ad_6",		Standard
+	"nand_ad_7",		Standard
+	"nand_ale",		Standard
+	"nand_cen_0",		Standard
+	"nand_cen_1",		Standard
+	"nand_cle",		Standard
+	"nand_oen",		Standard
+	"nand_rdy_0",		Standard
+	"nand_rdy_1",		Standard
+	"nand_wen",		Standard
+	"nand_wp",		Standard
+	"pc1",			Standard
+	"pc2",			Standard
+	"pmu_int",		Standard
+	"pmu_scl",		I2C
+	"pmu_sda",		I2C
+	"rfst2g_mtsloten3g",	Standard
+	"rgmii_0_rx_ctl",	Standard
+	"rgmii_0_rxc",		Standard
+	"rgmii_0_rxd_0",	Standard
+	"rgmii_0_rxd_1",	Standard
+	"rgmii_0_rxd_2",	Standard
+	"rgmii_0_rxd_3",	Standard
+	"rgmii_0_tx_ctl",	Standard
+	"rgmii_0_txc",		Standard
+	"rgmii_0_txd_0",	Standard
+	"rgmii_0_txd_1",	Standard
+	"rgmii_0_txd_2",	Standard
+	"rgmii_0_txd_3",	Standard
+	"rgmii_1_rx_ctl",	Standard
+	"rgmii_1_rxc",		Standard
+	"rgmii_1_rxd_0",	Standard
+	"rgmii_1_rxd_1",	Standard
+	"rgmii_1_rxd_2",	Standard
+	"rgmii_1_rxd_3",	Standard
+	"rgmii_1_tx_ctl",	Standard
+	"rgmii_1_txc",		Standard
+	"rgmii_1_txd_0",	Standard
+	"rgmii_1_txd_1",	Standard
+	"rgmii_1_txd_2",	Standard
+	"rgmii_1_txd_3",	Standard
+	"rgmii_gpio_0",		Standard
+	"rgmii_gpio_1",		Standard
+	"rgmii_gpio_2",		Standard
+	"rgmii_gpio_3",		Standard
+	"rtxdata2g_txdata3g1",	Standard
+	"rtxen2g_txdata3g2",	Standard
+	"rxdata3g0",		Standard
+	"rxdata3g1",		Standard
+	"rxdata3g2",		Standard
+	"sdio1_clk",		Standard
+	"sdio1_cmd",		Standard
+	"sdio1_data_0",		Standard
+	"sdio1_data_1",		Standard
+	"sdio1_data_2",		Standard
+	"sdio1_data_3",		Standard
+	"sdio4_clk",		Standard
+	"sdio4_cmd",		Standard
+	"sdio4_data_0",		Standard
+	"sdio4_data_1",		Standard
+	"sdio4_data_2",		Standard
+	"sdio4_data_3",		Standard
+	"sim_clk",		Standard
+	"sim_data",		Standard
+	"sim_det",		Standard
+	"sim_resetn",		Standard
+	"sim2_clk",		Standard
+	"sim2_data",		Standard
+	"sim2_det",		Standard
+	"sim2_resetn",		Standard
+	"sri_c",		Standard
+	"sri_d",		Standard
+	"sri_e",		Standard
+	"ssp_extclk",		Standard
+	"ssp0_clk",		Standard
+	"ssp0_fs",		Standard
+	"ssp0_rxd",		Standard
+	"ssp0_txd",		Standard
+	"ssp2_clk",		Standard
+	"ssp2_fs_0",		Standard
+	"ssp2_fs_1",		Standard
+	"ssp2_fs_2",		Standard
+	"ssp2_fs_3",		Standard
+	"ssp2_rxd_0",		Standard
+	"ssp2_rxd_1",		Standard
+	"ssp2_txd_0",		Standard
+	"ssp2_txd_1",		Standard
+	"ssp3_clk",		Standard
+	"ssp3_fs",		Standard
+	"ssp3_rxd",		Standard
+	"ssp3_txd",		Standard
+	"ssp4_clk",		Standard
+	"ssp4_fs",		Standard
+	"ssp4_rxd",		Standard
+	"ssp4_txd",		Standard
+	"ssp5_clk",		Standard
+	"ssp5_fs",		Standard
+	"ssp5_rxd",		Standard
+	"ssp5_txd",		Standard
+	"ssp6_clk",		Standard
+	"ssp6_fs",		Standard
+	"ssp6_rxd",		Standard
+	"ssp6_txd",		Standard
+	"stat_1",		Standard
+	"stat_2",		Standard
+	"sysclken",		Standard
+	"traceclk",		Standard
+	"tracedt00",		Standard
+	"tracedt01",		Standard
+	"tracedt02",		Standard
+	"tracedt03",		Standard
+	"tracedt04",		Standard
+	"tracedt05",		Standard
+	"tracedt06",		Standard
+	"tracedt07",		Standard
+	"tracedt08",		Standard
+	"tracedt09",		Standard
+	"tracedt10",		Standard
+	"tracedt11",		Standard
+	"tracedt12",		Standard
+	"tracedt13",		Standard
+	"tracedt14",		Standard
+	"tracedt15",		Standard
+	"txdata3g0",		Standard
+	"txpwrind",		Standard
+	"uartb1_ucts",		Standard
+	"uartb1_urts",		Standard
+	"uartb1_urxd",		Standard
+	"uartb1_utxd",		Standard
+	"uartb2_urxd",		Standard
+	"uartb2_utxd",		Standard
+	"uartb3_ucts",		Standard
+	"uartb3_urts",		Standard
+	"uartb3_urxd",		Standard
+	"uartb3_utxd",		Standard
+	"uartb4_ucts",		Standard
+	"uartb4_urts",		Standard
+	"uartb4_urxd",		Standard
+	"uartb4_utxd",		Standard
+	"vc_cam1_scl",		I2C
+	"vc_cam1_sda",		I2C
+	"vc_cam2_scl",		I2C
+	"vc_cam2_sda",		I2C
+	"vc_cam3_scl",		I2C
+	"vc_cam3_sda",		I2C
Signature · 1 line
1.7.9.5
#68 lore raw

Re: [PATCH v4 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 8 lines · Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
v4: Changed valid values for "bias-pull-up" property for I2C pins. Expanded
pin configuration node example.

Starting to look real good...

Quoted 15 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +15 -0
+Optional Properties (for standard pins):
+
+- function:                    String. Specifies the pin mux selection. Values
+                               must be one of: "alt1", "alt2", "alt3", "alt4"
+- input-schmitt-enable:                No arguments. Enable schmitt-trigger mode.
+- input-schmitt-disable:       No arguments. Disable schmitt-trigger mode.
+- bias-pull-up:                        No arguments. Pull up on pin.
+- bias-pull-down:              No arguments. Pull down on pin.
+- bias-disable:                        No arguments. Disable pin bias.
+- slew-rate:                   Integer. Meaning depends on configured pin mux:
+                               *_SCL or *_SDA:
+                                       0: Standard(100kbps)& Fast(400kbps) mode
+                                       1: Highspeed (3.4Mbps) mode
+                               IC_DM or IC_DP:
+                                       0: normal slew rate

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 81

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +10 -0
+                                       1: fast slew rate
+                               Otherwise:
+                                       0: fast slew rate
+                                       1: normal slew rate
+- input-enable:                        No arguements. Enable input (does not affect
+                               output.)
+- input-disable:               No arguements. Disable input (does not affect
+                               output.)
+- drive-strength:              Integer. Drive strength in mA.  Valid values are
+                               2, 4, 6, 8, 10, 12, 14, 16 mA.

Also patch Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt Since you're adding generic properties.

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 90

Quoted 8 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +8 -0
+Optional Properties (for I2C pins):
+
+- function:                    String. Specifies the pin mux selection. Values
+                               must be one of: "alt1", "alt2", "alt3", "alt4"
+- bias-pull-up:                        Integer. Pull up strength in Ohm. There are 3
+                               pull-up resisitors (1.2k, 1.8k, 2.7k) available
+                               in parallel for I2C pins, so the valid values
+                               are: 568, 720, 831, 1080, 1200, 1800, 2700 Ohm.

Also patch Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 75

Quoted 11 lines
+- bias-disable:                        No arguments. Disable pin bias.
+- slew-rate:                   Integer. Meaning depends on configured pin mux:
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +9 -0
+                               *_SCL or *_SDA:
+                                       0: Standard(100kbps)& Fast(400kbps) mode
+                                       1: Highspeed (3.4Mbps) mode
+                               IC_DM or IC_DP:
+                                       0: normal slew rate
+                                       1: fast slew rate
+                               Otherwise:
+                                       0: fast slew rate
+                                       1: normal slew rate

Hm that does not seem generic though, so let's not add this to the generic bindings.

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 113

Quoted 12 lines

+- input-enable: No arguements. Enable input (does not affect

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +11 -0
+                               output.)
+- input-disable:               No arguements. Disable input (does not affect
+                               output.)
+
+Optional Properties (for HDMI pins):
+
+- function:                    String. Specifies the pin mux selection. Values
+                               must be one of: "alt1", "alt2", "alt3", "alt4"
+- slew-rate:                   Integer. Controls slew rate.
+                                       0: Standard(100kbps)& Fast(400kbps) mode
+                                       1: Highspeed (3.4Mbps) mode

Hmmmm slew rate is not specifiec in "bps" but rather in something like volts per second. But maybe it's best to keep this value driver-specific.

Yours,
Linus Walleij

#69 lore raw

Re: [PATCH v4 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 22 lines · Linus Walleij
Quoted 21 lines · Sherman Yin
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +21 -0
+Optional Properties (for standard pins):
+
+- function:                    String. Specifies the pin mux selection. Values
+                               must be one of: "alt1", "alt2", "alt3", "alt4"
+- input-schmitt-enable:                No arguments. Enable schmitt-trigger mode.
+- input-schmitt-disable:       No arguments. Disable schmitt-trigger mode.
+- bias-pull-up:                        No arguments. Pull up on pin.
+- bias-pull-down:              No arguments. Pull down on pin.
+- bias-disable:                        No arguments. Disable pin bias.
+- slew-rate:                   Integer. Meaning depends on configured pin mux:
+                               *_SCL or *_SDA:
+                                       0: Standard(100kbps)& Fast(400kbps) mode
+                                       1: Highspeed (3.4Mbps) mode
+                               IC_DM or IC_DP:
+                                       0: normal slew rate
+                                       1: fast slew rate
+                               Otherwise:
+                                       0: fast slew rate
+                                       1: normal slew rate
+- input-enable:                        No arguements. Enable input (does not affect
+                               output.)
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 81

Quoted 4 lines

+- input-disable: No arguements. Disable input (does not affect

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +3 -0
+                               output.)
+- drive-strength:              Integer. Drive strength in mA.  Valid values are
+                               2, 4, 6, 8, 10, 12, 14, 16 mA.

Also patch Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt Since you're adding generic properties.

Please note that I removed from this patchset the patch that you've merged to your for-next branch already:

https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-pinctrl.git/commit/?h=for-next&id=8ba3f4d00078e7a49c60c0bd6298f29402c3a0a0

Is that what you wanted to see in pinctrl-bindings.txt, or is there something else you want to see added to that txt file? I didn't want to add the description of slew-rate arguments there because this is capri-specific. I'm not quite sure what else to add.

Quoted 11 lines

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 90

Quoted 8 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +8 -0
+Optional Properties (for I2C pins):
+
+- function:                    String. Specifies the pin mux selection. Values
+                               must be one of: "alt1", "alt2", "alt3", "alt4"
+- bias-pull-up:                        Integer. Pull up strength in Ohm. There are 3
+                               pull-up resisitors (1.2k, 1.8k, 2.7k) available
+                               in parallel for I2C pins, so the valid values
+                               are: 568, 720, 831, 1080, 1200, 1800, 2700 Ohm.

Also patch Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt

That doc already says bias-pull-up is specified in Ohm, and the specific values are chip-specific, so I don't think they should be mentioned there.

Quoted 15 lines

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 75

Quoted 11 lines
+- bias-disable:                        No arguments. Disable pin bias.
+- slew-rate:                   Integer. Meaning depends on configured pin mux:
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +9 -0
+                               *_SCL or *_SDA:
+                                       0: Standard(100kbps)& Fast(400kbps) mode
+                                       1: Highspeed (3.4Mbps) mode
+                               IC_DM or IC_DP:
+                                       0: normal slew rate
+                                       1: fast slew rate
+                               Otherwise:
+                                       0: fast slew rate
+                                       1: normal slew rate

Hm that does not seem generic though, so let's not add this to the generic bindings.

Quoted 16 lines

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt line 113

Quoted 12 lines

+- input-enable: No arguements. Enable input (does not affect

Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +11 -0
+                               output.)
+- input-disable:               No arguements. Disable input (does not affect
+                               output.)
+
+Optional Properties (for HDMI pins):
+
+- function:                    String. Specifies the pin mux selection. Values
+                               must be one of: "alt1", "alt2", "alt3", "alt4"
+- slew-rate:                   Integer. Controls slew rate.
+                                       0: Standard(100kbps)& Fast(400kbps) mode
+                                       1: Highspeed (3.4Mbps) mode

Hmmmm slew rate is not specifiec in "bps" but rather in something like volts per second. But maybe it's best to keep this value driver-specific.

Right, I think the slew-rates values are capri specific.

Thanks for the review.

Regards,
Sherman

#70 lore raw

Re: [PATCH v4 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 6 lines · Sherman Yin

On 14-01-07 09:15 AM, Linus Walleij wrote:

Is that what you wanted to see in pinctrl-bindings.txt, or is there something else you want to see added to that txt file? I didn't want to add the description of slew-rate arguments there because this is capri-specific. I'm not quite sure what else to add.

(...)

Quoted 2 lines

That doc already says bias-pull-up is specified in Ohm, and the specific values are chip-specific, so I don't think they should be mentioned there.

You're right, forget about this. I didn't realize the pinctrl bindings doc was that good...

Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +3 -0
+Optional Properties (for HDMI pins):
+
+- function:                    String. Specifies the pin mux selection.

Values
+ must be one of: "alt1", "alt2", "alt3",
"alt4"

Quoted 8 lines
Quoted 4 lines
+- slew-rate:                   Integer. Controls slew rate.
+                                       0: Standard(100kbps)&

Fast(400kbps) mode
+ 1: Highspeed (3.4Mbps) mode

Hmmmm slew rate is not specifiec in "bps" but rather in something like volts per second. But maybe it's best to keep this value driver-specific.

Quoted 1 line

Right, I think the slew-rates values are capri specific.

OK

Yours,
Linus Walleij

#71 lore raw

Re: [PATCH v4 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 29 lines · Linus Walleij
Quoted 6 lines · Sherman Yin

On 14-01-07 09:15 AM, Linus Walleij wrote:

Is that what you wanted to see in pinctrl-bindings.txt, or is there something else you want to see added to that txt file? I didn't want to add the description of slew-rate arguments there because this is capri-specific. I'm not quite sure what else to add.

(...)

Quoted 2 lines

That doc already says bias-pull-up is specified in Ohm, and the specific values are chip-specific, so I don't think they should be mentioned there.

You're right, forget about this. I didn't realize the pinctrl bindings doc was that good...

Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,capri-pinctrl.txt new file +3 -0
+Optional Properties (for HDMI pins):
+
+- function:                    String. Specifies the pin mux selection.

Values
+ must be one of: "alt1", "alt2", "alt3",
"alt4"

+- slew-rate:                   Integer. Controls slew rate.
+                                       0: Standard(100kbps)&

Fast(400kbps) mode
+ 1: Highspeed (3.4Mbps) mode

Hmmmm slew rate is not specifiec in "bps" but rather in something like volts per second. But maybe it's best to keep this value driver-specific.

Quoted 4 lines
Quoted 1 line

Right, I think the slew-rates values are capri specific.

OK

Great! Is there anything else you would like to see changed before this patchset can be accepted?

Thanks,
Sherman

#72 lore raw

Re: [PATCH v4 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Quoted 2 lines · Sherman Yin

Great! Is there anything else you would like to see changed before this patchset can be accepted?

I'd like some sign of life from the DT binding maintainers.

Yours,
Linus Walleij

#73 lore raw

Re: [PATCH v4 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

Hi Linus,

Quoted 6 lines · Linus Walleij
Quoted 2 lines · Sherman Yin

Great! Is there anything else you would like to see changed before this patchset can be accepted?

I'd like some sign of life from the DT binding maintainers.

Let's check the electrocardiogram...

_ _ _ _ _
__________/ \ ________/ \ _____/ \ ___/ \ ___/ \ __

             \_/           \_/        \_/      \_/      \_/

I don't see anything objectionable in the binding.

Linus, if you think that this binding is sane, feel free to add my ack.

Cheers,
Mark.

#74 lore raw

Re: [PATCH v4 2/4] pinctrl: Add pinctrl binding for Broadcom Capri SoCs

In reply to Sherman Yin
Quoted 8 lines · Sherman Yin

Adds pinctrl driver devicetree binding for Broadcom Capri (BCM281xx) SoCs.

---
v4: Changed valid values for "bias-pull-up" property for I2C pins. Expanded
pin configuration node example.

Patch applied with Mark R's ACK and a copy of his ECG.

Yours,
Linus Walleij

#75 lore raw

PATCH v4 3/4 ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Sherman Yin

Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

---
v4: - PINCTRL selected in Kconfig, PINCTRL_CAPRI selected in bcm_defconfig
- make use of regmap
- change CAPRI_PIN_UPDATE from macro to inline function.
- Handle pull-up strength arg in Ohm instead of enum
v3: Re-work driver to be based on generic pin config. Moved config selection
from Kconfig to bcm_defconfig.
v2: Use hyphens instead of underscore in DT property names.

---
 arch/arm/configs/bcm_defconfig  |    1 +
 arch/arm/mach-bcm/Kconfig       |    1 +
 drivers/pinctrl/Kconfig         |   12 +
 drivers/pinctrl/Makefile        |    1 +
 drivers/pinctrl/pinctrl-capri.c | 1454 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 1469 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-capri.c
arch/arm/configs/bcm_defconfig +1 -0
index 287ac1d..bede511 100644
@@ -126,3 +126,4 @@ CONFIG_CRC_ITU_T=y
 CONFIG_CRC7=y
 CONFIG_XZ_DEC=y
 CONFIG_AVERAGE=y
+CONFIG_PINCTRL_CAPRI=y
arch/arm/mach-bcm/Kconfig +1 -0
index 9fe6d88..b1aa6a9 100644
@@ -25,6 +25,7 @@ config ARCH_BCM_MOBILE
 	select TICK_ONESHOT
 	select CACHE_L2X0
 	select HAVE_ARM_ARCH_TIMER
+	select PINCTRL
 	help
 	  This enables support for systems based on Broadcom mobile SoCs.
 	  It currently supports the 'BCM281XX' family, which includes
drivers/pinctrl/Kconfig +12 -0
index 33f9dc1..a9f6405 100644
@@ -104,6 +104,18 @@ config PINCTRL_BCM2835
 	select PINMUX
 	select PINCONF
 
+config PINCTRL_CAPRI
+	bool "Broadcom Capri pinctrl driver"
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select REGMAP_MMIO
+	help
+	  Say Y here to support Broadcom Capri pinctrl driver, which is used for
+	  the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351,
+	  BCM28145, and BCM28155 SoCs.  This driver requires the pinctrl
+	  framework.  GPIO is provided by a separate GPIO driver.
+
 config PINCTRL_IMX
 	bool
 	select PINMUX
drivers/pinctrl/Makefile +1 -0
index 4f7be29..86cac40 100644
@@ -21,6 +21,7 @@ obj-$(CONFIG_PINCTRL_BF60x)	+= pinctrl-adi2-bf60x.o
 obj-$(CONFIG_PINCTRL_AT91)	+= pinctrl-at91.o
 obj-$(CONFIG_PINCTRL_BCM2835)	+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BAYTRAIL)	+= pinctrl-baytrail.o
+obj-$(CONFIG_PINCTRL_CAPRI)	+= pinctrl-capri.o
 obj-$(CONFIG_PINCTRL_IMX)	+= pinctrl-imx.o
 obj-$(CONFIG_PINCTRL_IMX1_CORE)	+= pinctrl-imx1-core.o
 obj-$(CONFIG_PINCTRL_IMX27)	+= pinctrl-imx27.o
drivers/pinctrl/pinctrl-capri.c new file +1454 -0

1,454 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#76 lore raw

Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

On Sat, Dec 21, 2013 at 3:13 AM, Sherman Yin <[email protected]> wrote:

'> Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

Quoted 9 lines

---
v4: - PINCTRL selected in Kconfig, PINCTRL_CAPRI selected in bcm_defconfig
- make use of regmap
- change CAPRI_PIN_UPDATE from macro to inline function.
- Handle pull-up strength arg in Ohm instead of enum

Patch applied. It is really good now! It's late before the merge window, but you've done a tremendous work on this driver and I don't want to delay its deployment further.

But note:

Quoted 2 lines
 arch/arm/configs/bcm_defconfig  |    1 +
 arch/arm/mach-bcm/Kconfig       |    1 +

I've optimistically applied these two hunks of the patch as well, but if there is any conflict with the ARM SoC tree I will just rebase the patch and pull these *out*.

ARM SoC maintainers: be warned if something collides.

Yours,
Linus Walleij

#77 lore raw

Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 13 lines · Linus Walleij

On Sat, Dec 21, 2013 at 3:13 AM, Sherman Yin <[email protected]> wrote:

'> Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

Quoted 9 lines

---
v4: - PINCTRL selected in Kconfig, PINCTRL_CAPRI selected in bcm_defconfig
- make use of regmap
- change CAPRI_PIN_UPDATE from macro to inline function.
- Handle pull-up strength arg in Ohm instead of enum

Quoted 3 lines

Patch applied. It is really good now! It's late before the merge window, but you've done a tremendous work on this driver and I don't want to delay its deployment further.

Great, thanks for the support and reviews!

Quoted 10 lines

But note:

Quoted 2 lines
  arch/arm/configs/bcm_defconfig  |    1 +
  arch/arm/mach-bcm/Kconfig       |    1 +

I've optimistically applied these two hunks of the patch as well, but if there is any conflict with the ARM SoC tree I will just rebase the patch and pull these *out*.

ARM SoC maintainers: be warned if something collides.

Ok, will keep an eye on this and fix accordingly. Should be simple fixes.

Regards,
Sherman

#78 lore raw

Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 14 lines · Sherman Yin
Quoted 13 lines · Linus Walleij

On Sat, Dec 21, 2013 at 3:13 AM, Sherman Yin <[email protected]> wrote:

'> Adds pinctrl driver for Broadcom Capri (BCM281xx) SoCs.

Quoted 9 lines

---
v4: - PINCTRL selected in Kconfig, PINCTRL_CAPRI selected in bcm_defconfig
- make use of regmap
- change CAPRI_PIN_UPDATE from macro to inline function.
- Handle pull-up strength arg in Ohm instead of enum

Quoted 5 lines
Quoted 3 lines

Patch applied. It is really good now! It's late before the merge window, but you've done a tremendous work on this driver and I don't want to delay its deployment further.

Great, thanks for the support and reviews!

Very nice! Now after having completely missing something fundamental on my reviews, I feel compelled to bring it up at the 11^H^H12th hour.

That is, this is the *only* BCM281xx driver to be named Capri, both in the filename and driver code, but also in the binding compatible. We didn't do that on anything else that's gone upstream to date. This really introduces an unfortunate inconsistency as it obscures which SoC family this binding and driver belong with.

I wonder if Linus would accept a rename at this point (too late for 3.14 presumably, but for 3.15) of s/capri/bcm281xx throughout, bcm11351 for the compatible string, as we have for the machine compatible, and also BCM281XX for the Kconfig option. If not, I'll survive, but it pains me to see one thing completely different out of this entire family. If nothing else, it would be great to address the compatible string before this hits the 3.14 release.

Linus?

-Matt

#79 lore raw

Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 4 lines · Matt Porter

I wonder if Linus would accept a rename at this point (too late for 3.14 presumably, but for 3.15) of s/capri/bcm281xx throughout, bcm11351 for the compatible string, as we have for the machine compatible, and also BCM281XX for the Kconfig option.

Yes, if there is some consensus that this is what we want to do.

I can certainly merge that during the 3.14-rc phase for that matter.

Yours,
Linus Walleij

#80 lore raw

Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 10 lines · Linus Walleij
Quoted 4 lines · Matt Porter

I wonder if Linus would accept a rename at this point (too late for 3.14 presumably, but for 3.15) of s/capri/bcm281xx throughout, bcm11351 for the compatible string, as we have for the machine compatible, and also BCM281XX for the Kconfig option.

Yes, if there is some consensus that this is what we want to do.

I can certainly merge that during the 3.14-rc phase for that matter.

Hi Linus,

I'll confirm the new name with Matt before sending out another patch. Which would work better for you - a) a set of patches replacing my previous ones, b) a set of patches on top of my previous ones, c) a single patch on top of my previous ones? d) something else?

Thanks,
Sherman

#81 lore raw

Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

Quoted 4 lines · Sherman Yin

I'll confirm the new name with Matt before sending out another patch. Which would work better for you - a) a set of patches replacing my previous ones,
b) a set of patches on top of my previous ones, c) a single patch on top of my previous ones? d) something else?

(c)

The tree goes upstream now, you have to make this fix on top.

Yours,
Linus Walleij

#82 lore raw

Re: [PATCH v4 3/4] ARM: pinctrl: Add Broadcom Capri pinctrl driver

In reply to Linus Walleij
Quoted 10 lines · Linus Walleij
Quoted 4 lines · Matt Porter

I wonder if Linus would accept a rename at this point (too late for 3.14 presumably, but for 3.15) of s/capri/bcm281xx throughout, bcm11351 for the compatible string, as we have for the machine compatible, and also BCM281XX for the Kconfig option.

Yes, if there is some consensus that this is what we want to do.

I can certainly merge that during the 3.14-rc phase for that matter.

Ok, sounds great, thanks.

-Matt

#83 lore raw

PATCH v4 4/4 pinctrl: Enable pinctrl for Broadcom Capri SoCs

In reply to Sherman Yin

Enable pinctrl for Broadcom Capri (BCM281xx) SoCs.

---
v4: no change
v3: No change.
v2: Use hyphens instead of underscore in DT property names.

---
 arch/arm/boot/dts/bcm11351.dtsi |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/bcm11351.dtsi +4 -0
index b0c0610..dd8e878 100644
@@ -142,4 +142,8 @@
 		status = "disabled";
 	};
 
+	pinctrl at 35004800 {
+		compatible = "brcm,capri-pinctrl";
+		reg = <0x35004800 0x430>;
+	};
 };
Signature · 1 line
1.7.9.5