* [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux
@ 2025-02-07 20:02 Artur Weber
2025-02-07 20:02 ` [PATCH 1/7] dt-bindings: pinctrl: Add bindings for BCM21664 pin controller Artur Weber
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Artur Weber @ 2025-02-07 20:02 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
Stanislav Jakubek, ~postmarketos/upstreaming, Artur Weber
BCM21664 is another chip from the Kona line of Broadcom SoCs, and
its pinmux shares a lot of similarities with the BCM281xx pinmux.
Add support for the BCM21664 pinmux controller to the BCM281xx driver.
This also enables pinmux support for the BCM23550, which has an
identical pinmux config to the BCM21664 (hence they can share a
single compatible, brcm,bcm21664-pinctrl).
While we're at it - fix a bug that affected higher registers in the
BCM281XX driver and replace bare "unsigned" with "unsigned int" to
comply with checkpatch requirements.
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
By the way - while working on this patch, I noticed two things that
are not implemented in mainline, but seem to be present in the pin
controller regs according to the RDB[1][2]:
- On both BCM21664 and BCM281XX, TRACE* pins only have two bits for
DRV_STR and no HYST bit. That seems like it deserves its own pin
type; however, since I don't know how to translate the reduced
DRV_STR value to a drive strength in mA, I did not implement it.
For now, I kept the same type for BCM21664 as for BCM281XX for these
pins (standard).
- On both BCM21664 and BCM281XX, two SIM-related pins (SIM and SIM2
on BCM281XX, SIMDAT and SSPDO on BCM21664) have extra PUPM0 and PUPM1
offsets (bits 11 and 12 respectively). Vendor kernel does not do
anything with these bits, so I don't know what they do.
If any Broadcom engineers could shed some light on these, I'd be
grateful. Otherwise, neither of these are pressing issues, and this
patchset is complete without them (they can be fixed in another
patchset).
[1] https://github.com/knuxdroid/android_kernel_samsung_baffinlite/blob/cm-12.1/arch/arm/mach-hawaii/include/mach/rdb/brcm_rdb_padctrlreg.h
[2] https://github.com/s2plus/android_kernel_samsung_galaxys2plus/blob/cm-10.1_base-4.2/arch/arm/mach-capri/include/mach/rdb/brcm_rdb_padctrlreg.h
---
Artur Weber (7):
dt-bindings: pinctrl: Add bindings for BCM21664 pin controller
pinctrl: bcm281xx: Fix incorrect regmap max_registers value
pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned"
pinctrl: bcm281xx: Provide pinctrl device info as OF platform data
pinctrl: bcm281xx: Add support for BCM21664 pinmux
ARM: dts: bcm2166x-common: Add pinctrl node
ARM: dts: bcm2166x: Add bcm2166x-pinctrl DTSI
.../bindings/pinctrl/brcm,bcm21664-pinctrl.yaml | 169 ++++
arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi | 7 +
arch/arm/boot/dts/broadcom/bcm2166x-pinctrl.dtsi | 297 +++++++
drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 849 +++++++++++++++++++--
4 files changed, 1259 insertions(+), 63 deletions(-)
---
base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
change-id: 20250206-bcm21664-pinctrl-13cd7d3f7866
Best regards,
--
Artur Weber <aweber.kernel@gmail.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/7] dt-bindings: pinctrl: Add bindings for BCM21664 pin controller
2025-02-07 20:02 [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
@ 2025-02-07 20:02 ` Artur Weber
2025-02-12 18:17 ` Rob Herring
2025-02-07 20:02 ` [PATCH 2/7] pinctrl: bcm281xx: Fix incorrect regmap max_registers value Artur Weber
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Artur Weber @ 2025-02-07 20:02 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
Stanislav Jakubek, ~postmarketos/upstreaming, Artur Weber
Add device tree bindings for the pin controller included in the
BCM21664 chip. The bindings are based off brcm,bcm11351-pinctrl.yaml;
both chips use the same driver, but have different pins, and the
BCM21664 has 6 alt modes instead of 4.
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
.../bindings/pinctrl/brcm,bcm21664-pinctrl.yaml | 169 +++++++++++++++++++++
1 file changed, 169 insertions(+)
diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,bcm21664-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/brcm,bcm21664-pinctrl.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..233bea91b640ffa8480637d7304f661b7a4f5d79
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm21664-pinctrl.yaml
@@ -0,0 +1,169 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm21664-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM21664 pin controller
+
+maintainers:
+ - Florian Fainelli <florian.fainelli@broadcom.com>
+ - Ray Jui <rjui@broadcom.com>
+ - Scott Branden <sbranden@broadcom.com>
+
+allOf:
+ - $ref: pinctrl.yaml#
+
+properties:
+ compatible:
+ const: brcm,bcm21664-pinctrl
+
+ reg:
+ maxItems: 1
+
+patternProperties:
+ '-pins$':
+ type: object
+ additionalProperties: false
+
+ patternProperties:
+ '-grp[0-9]$':
+ type: object
+ unevaluatedProperties: false
+
+ properties:
+ pins:
+ description:
+ Specifies the name(s) of one or more pins to be configured by
+ this node.
+ items:
+ enum: [ adcsyn, batrm, bsc1clk, bsc1dat, camcs0, camcs1, clk32k,
+ clk_cx8, dclk1, dclk4, dclkreq1, dclkreq4, dmic0clk,
+ dmic0dq, dsi0te, gpio00, gpio01, gpio02, gpio03, gpio04,
+ gpio05, gpio06, gpio07, gpio08, gpio09, gpio10, gpio11,
+ gpio12, gpio13, gpio14, gpio15, gpio16, gpio17, gpio18,
+ gpio19, gpio20, gpio21, gpio22, gpio23, gpio24, gpio25,
+ gpio26, gpio27, gpio28, gpio32, gpio33, gpio34, gpio93,
+ gpio94, gps_calreq, gps_hostreq, gps_pablank, gps_tmark,
+ icusbdm, icusbdp, lcdcs0, lcdres, lcdscl, lcdsda, lcdte,
+ mdmgpio00, mdmgpio01, mdmgpio02, mdmgpio03, mdmgpio04,
+ mdmgpio05, mdmgpio06, mdmgpio07, mdmgpio08, mmc0ck,
+ mmc0cmd, mmc0dat0, mmc0dat1, mmc0dat2, mmc0dat3, mmc0dat4,
+ mmc0dat5, mmc0dat6, mmc0dat7, mmc0rst, mmc1ck, mmc1cmd,
+ mmc1dat0, mmc1dat1, mmc1dat2, mmc1dat3, mmc1dat4,
+ mmc1dat5, mmc1dat6, mmc1dat7, mmc1rst, pc1, pc2, pmbscclk,
+ pmbscdat, pmuint, resetn, rfst2g_mtsloten3g,
+ rtxdata2g_txdata3g1, rtxen2g_txdata3g2, rxdata3g0,
+ rxdata3g1, rxdata3g2, sdck, sdcmd, sddat0, sddat1, sddat2,
+ sddat3, simclk, simdat, simdet, simrst, spi0clk, spi0fss,
+ spi0rxd, spi0txd, sri_c, sri_d, sri_e, sspck, sspdi,
+ sspdo, sspsyn, stat1, stat2, swclktck, swdiotms, sysclken,
+ tdi, tdo, testmode, traceclk, tracedt00, tracedt01,
+ tracedt02, tracedt03, tracedt04, tracedt05, tracedt06,
+ tracedt07, tracedt08, tracedt09, tracedt10, tracedt11,
+ tracedt12, tracedt13, tracedt14, tracedt15, trstb,
+ txdata3g0, ubctsn, ubrtsn, ubrx, ubtx ]
+
+ function:
+ description:
+ Specifies the pin mux selection.
+ enum: [ alt1, alt2, alt3, alt4, alt5, alt6 ]
+
+ slew-rate:
+ description: |
+ Meaning depends on configured pin mux:
+ bsc*clk/pmbscclk or bsc*dat/pmbscdat:
+ 0: Standard (100 kbps) & Fast (400 kbps) mode
+ 1: Highspeed (3.4 Mbps) mode
+ Otherwise:
+ 0: fast slew rate
+ 1: normal slew rate
+
+ bias-disable: true
+ bias-pull-up: true
+ input-disable: true
+ input-enable: true
+
+ required:
+ - pins
+
+ allOf:
+ - $ref: pincfg-node.yaml#
+
+ # Optional properties for standard pins
+ - if:
+ properties:
+ pins:
+ contains:
+ enum: [ adcsyn, batrm, camcs0, camcs1, clk32k, clk_cx8,
+ dclk1, dclk4, dclkreq1, dclkreq4, dmic0clk, dmic0dq,
+ dsi0te, gpio00, gpio01, gpio02, gpio03, gpio04,
+ gpio05, gpio06, gpio07, gpio08, gpio09, gpio10,
+ gpio11, gpio12, gpio13, gpio14, gpio15, gpio18,
+ gpio19, gpio20, gpio21, gpio22, gpio23, gpio24,
+ gpio25, gpio26, gpio27, gpio28, gpio32, gpio33,
+ gpio34, gpio93, gpio94, gps_calreq, gps_hostreq,
+ gps_pablank, gps_tmark, icusbdm, icusbdp, lcdcs0,
+ lcdres, lcdscl, lcdsda, lcdte, mdmgpio00, mdmgpio01,
+ mdmgpio02, mdmgpio03, mdmgpio04, mdmgpio05,
+ mdmgpio06, mdmgpio07, mdmgpio08, mmc0ck, mmc0cmd,
+ mmc0dat0, mmc0dat1, mmc0dat2, mmc0dat3, mmc0dat4,
+ mmc0dat5, mmc0dat6, mmc0dat7, mmc0rst, mmc1ck,
+ mmc1cmd, mmc1dat0, mmc1dat1, mmc1dat2, mmc1dat3,
+ mmc1dat4, mmc1dat5, mmc1dat6, mmc1dat7, mmc1rst,
+ pc1, pc2, pmuint, resetn, rfst2g_mtsloten3g,
+ rtxdata2g_txdata3g1, rtxen2g_txdata3g2, rxdata3g0,
+ rxdata3g1, rxdata3g2, sdck, sdcmd, sddat0, sddat1,
+ sddat2, sddat3, simclk, simdat, simdet, simrst,
+ spi0clk, spi0fss, spi0rxd, spi0txd, sri_c, sri_d,
+ sri_e, sspck, sspdi, sspdo, sspsyn, stat1, stat2,
+ swclktck, swdiotms, sysclken, tdi, tdo, testmode,
+ traceclk, tracedt00, tracedt01, tracedt02,
+ tracedt03, tracedt04, tracedt05, tracedt06,
+ tracedt07, tracedt08, tracedt09, tracedt10,
+ tracedt11, tracedt12, tracedt13, tracedt14,
+ tracedt15, trstb, txdata3g0, ubctsn, ubrtsn, ubrx,
+ ubtx ]
+ then:
+ properties:
+ drive-strength:
+ enum: [ 2, 4, 6, 8, 10, 12, 14, 16 ]
+
+ bias-pull-down: true
+ input-schmitt-enable: true
+ input-schmitt-disable: true
+
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ pinctrl@35004800 {
+ compatible = "brcm,bcm21664-pinctrl";
+ reg = <0x35004800 0x7f0>;
+
+ dev-a-active-pins {
+ /* group node defining 1 standard pin */
+ std-grp0 {
+ pins = "gpio00";
+ function = "alt1";
+ input-schmitt-enable;
+ bias-disable;
+ slew-rate = <1>;
+ drive-strength = <4>;
+ };
+
+ /* group node defining 2 I2C pins */
+ i2c-grp0 {
+ pins = "bsc1clk", "bsc1dat";
+ function = "alt2";
+ bias-pull-up = <720>;
+ input-enable;
+ };
+ };
+ };
+...
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/7] pinctrl: bcm281xx: Fix incorrect regmap max_registers value
2025-02-07 20:02 [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
2025-02-07 20:02 ` [PATCH 1/7] dt-bindings: pinctrl: Add bindings for BCM21664 pin controller Artur Weber
@ 2025-02-07 20:02 ` Artur Weber
2025-02-14 9:03 ` Linus Walleij
2025-02-07 20:02 ` [PATCH 3/7] pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned" Artur Weber
` (4 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Artur Weber @ 2025-02-07 20:02 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
Stanislav Jakubek, ~postmarketos/upstreaming, Artur Weber
The max_registers value does not take into consideration the stride;
currently, it's set to the number of the last pin, but this does not
accurately represent the final register.
Fix this by multiplying the current value by 4.
Fixes: 54b1aa5a5b16 ("ARM: pinctrl: Add Broadcom Capri pinctrl driver")
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
index 73dbf29c002f39cde71352c1bf806872dd218b62..cf6efa9c0364a1ad65885c982e7634f26d19c944 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
@@ -974,7 +974,7 @@ static const struct regmap_config bcm281xx_pinctrl_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
- .max_register = BCM281XX_PIN_VC_CAM3_SDA,
+ .max_register = BCM281XX_PIN_VC_CAM3_SDA * 4,
};
static int bcm281xx_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/7] pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned"
2025-02-07 20:02 [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
2025-02-07 20:02 ` [PATCH 1/7] dt-bindings: pinctrl: Add bindings for BCM21664 pin controller Artur Weber
2025-02-07 20:02 ` [PATCH 2/7] pinctrl: bcm281xx: Fix incorrect regmap max_registers value Artur Weber
@ 2025-02-07 20:02 ` Artur Weber
2025-02-07 20:02 ` [PATCH 4/7] pinctrl: bcm281xx: Provide pinctrl device info as OF platform data Artur Weber
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Artur Weber @ 2025-02-07 20:02 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
Stanislav Jakubek, ~postmarketos/upstreaming, Artur Weber
Replace uses of bare "unsigned" with "unsigned int" to fix checkpatch
warnings. No functional change.
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 44 +++++++++++++++++-----------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
index cf6efa9c0364a1ad65885c982e7634f26d19c944..a039b490cdb8e6c41169bfd48abb371447c150a0 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
@@ -72,7 +72,7 @@ static enum bcm281xx_pin_type hdmi_pin = BCM281XX_PIN_TYPE_HDMI;
struct bcm281xx_pin_function {
const char *name;
const char * const *groups;
- const unsigned ngroups;
+ const unsigned int ngroups;
};
/*
@@ -84,10 +84,10 @@ struct bcm281xx_pinctrl_data {
/* List of all pins */
const struct pinctrl_pin_desc *pins;
- const unsigned npins;
+ const unsigned int npins;
const struct bcm281xx_pin_function *functions;
- const unsigned nfunctions;
+ const unsigned int nfunctions;
struct regmap *regmap;
};
@@ -941,7 +941,7 @@ static struct bcm281xx_pinctrl_data bcm281xx_pinctrl = {
};
static inline enum bcm281xx_pin_type pin_type_get(struct pinctrl_dev *pctldev,
- unsigned pin)
+ unsigned int pin)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
@@ -985,7 +985,7 @@ static int bcm281xx_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
}
static const char *bcm281xx_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
- unsigned group)
+ unsigned int group)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
@@ -993,9 +993,9 @@ static const char *bcm281xx_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
}
static int bcm281xx_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
- unsigned group,
+ unsigned int group,
const unsigned **pins,
- unsigned *num_pins)
+ unsigned int *num_pins)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
@@ -1007,7 +1007,7 @@ static int bcm281xx_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
static void bcm281xx_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev,
struct seq_file *s,
- unsigned offset)
+ unsigned int offset)
{
seq_printf(s, " %s", dev_name(pctldev->dev));
}
@@ -1029,7 +1029,7 @@ static int bcm281xx_pinctrl_get_fcns_count(struct pinctrl_dev *pctldev)
}
static const char *bcm281xx_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev,
- unsigned function)
+ unsigned int function)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
@@ -1037,9 +1037,9 @@ static const char *bcm281xx_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev,
}
static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev,
- unsigned function,
+ unsigned int function,
const char * const **groups,
- unsigned * const num_groups)
+ unsigned int * const num_groups)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
@@ -1050,8 +1050,8 @@ static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev,
}
static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev,
- unsigned function,
- unsigned group)
+ unsigned int function,
+ unsigned int group)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
const struct bcm281xx_pin_function *f = &pdata->functions[function];
@@ -1082,7 +1082,7 @@ static const struct pinmux_ops bcm281xx_pinctrl_pinmux_ops = {
};
static int bcm281xx_pinctrl_pin_config_get(struct pinctrl_dev *pctldev,
- unsigned pin,
+ unsigned int pin,
unsigned long *config)
{
return -ENOTSUPP;
@@ -1091,9 +1091,9 @@ static int bcm281xx_pinctrl_pin_config_get(struct pinctrl_dev *pctldev,
/* Goes through the configs and update register val/mask */
static int bcm281xx_std_pin_update(struct pinctrl_dev *pctldev,
- unsigned pin,
+ unsigned int pin,
unsigned long *configs,
- unsigned num_configs,
+ unsigned int num_configs,
u32 *val,
u32 *mask)
{
@@ -1207,9 +1207,9 @@ static const u16 bcm281xx_pullup_map[] = {
/* Goes through the configs and update register val/mask */
static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev,
- unsigned pin,
+ unsigned int pin,
unsigned long *configs,
- unsigned num_configs,
+ unsigned int num_configs,
u32 *val,
u32 *mask)
{
@@ -1277,9 +1277,9 @@ static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev,
/* Goes through the configs and update register val/mask */
static int bcm281xx_hdmi_pin_update(struct pinctrl_dev *pctldev,
- unsigned pin,
+ unsigned int pin,
unsigned long *configs,
- unsigned num_configs,
+ unsigned int num_configs,
u32 *val,
u32 *mask)
{
@@ -1321,9 +1321,9 @@ static int bcm281xx_hdmi_pin_update(struct pinctrl_dev *pctldev,
}
static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev,
- unsigned pin,
+ unsigned int pin,
unsigned long *configs,
- unsigned num_configs)
+ unsigned int num_configs)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
enum bcm281xx_pin_type pin_type;
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/7] pinctrl: bcm281xx: Provide pinctrl device info as OF platform data
2025-02-07 20:02 [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
` (2 preceding siblings ...)
2025-02-07 20:02 ` [PATCH 3/7] pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned" Artur Weber
@ 2025-02-07 20:02 ` Artur Weber
2025-02-09 5:36 ` kernel test robot
2025-02-07 20:02 ` [PATCH 5/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
` (2 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Artur Weber @ 2025-02-07 20:02 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
Stanislav Jakubek, ~postmarketos/upstreaming, Artur Weber
Introduce a new struct type, "bcm281xx_pinctrl_info", that holds
information about the pins, pin functions and regmap config for a pin
control chip. Create such a struct for the BCM218xx and pass it as
device data for the OF compatible match.
This is done in preparation for introducing additional chip types
to the driver.
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 120 ++++++++++++++++++++++-----------
1 file changed, 79 insertions(+), 41 deletions(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
index a039b490cdb8e6c41169bfd48abb371447c150a0..6ed9bbed71f2d660a2c38d28788c1b0ca8f052c3 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
@@ -76,20 +76,40 @@ struct bcm281xx_pin_function {
};
/*
- * bcm281xx_pinctrl_data - Broadcom-specific pinctrl data
- * @reg_base - base of pinctrl registers
+ * Device types (used in bcm281xx_pinctrl_desc to differentiate
+ * the two device types from each other)
*/
-struct bcm281xx_pinctrl_data {
- void __iomem *reg_base;
+enum bcm281xx_pinctrl_type {
+ BCM281XX_PINCTRL_TYPE,
+};
+
+/*
+ * bcm281xx_pinctrl_info - description of a pinctrl device supported
+ * by this driver, intended to be used as a provider of OF match data.
+ */
+struct bcm281xx_pinctrl_info {
+ enum bcm281xx_pinctrl_type device_type;
/* List of all pins */
const struct pinctrl_pin_desc *pins;
- const unsigned int npins;
+ unsigned int npins;
const struct bcm281xx_pin_function *functions;
- const unsigned int nfunctions;
+ unsigned int nfunctions;
+
+ const struct regmap_config regmap_config;
+};
+
+/*
+ * bcm281xx_pinctrl_data - Broadcom-specific pinctrl data
+ * @reg_base - base of pinctrl registers
+ */
+struct bcm281xx_pinctrl_data {
+ struct device *dev;
+ void __iomem *reg_base;
struct regmap *regmap;
+ const struct bcm281xx_pinctrl_info *info;
};
/*
@@ -933,11 +953,22 @@ static const struct bcm281xx_pin_function bcm281xx_functions[] = {
BCM281XX_PIN_FUNCTION(alt4),
};
-static struct bcm281xx_pinctrl_data bcm281xx_pinctrl = {
+static const struct regmap_config bcm281xx_pinctrl_regmap_config = {
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+ .max_register = BCM281XX_PIN_VC_CAM3_SDA * 4,
+};
+
+static const struct bcm281xx_pinctrl_info bcm281xx_pinctrl = {
+ .device_type = BCM281XX_PINCTRL_TYPE,
+
.pins = bcm281xx_pinctrl_pins,
.npins = ARRAY_SIZE(bcm281xx_pinctrl_pins),
.functions = bcm281xx_functions,
.nfunctions = ARRAY_SIZE(bcm281xx_functions),
+
+ .regmap_config = bcm281xx_pinctrl_regmap_config,
};
static inline enum bcm281xx_pin_type pin_type_get(struct pinctrl_dev *pctldev,
@@ -945,10 +976,10 @@ static inline enum bcm281xx_pin_type pin_type_get(struct pinctrl_dev *pctldev,
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
- if (pin >= pdata->npins)
+ if (pin >= pdata->info->npins)
return BCM281XX_PIN_TYPE_UNKNOWN;
- return *(enum bcm281xx_pin_type *)(pdata->pins[pin].drv_data);
+ return *(enum bcm281xx_pin_type *)(pdata->info->pins[pin].drv_data);
}
#define BCM281XX_PIN_SHIFT(type, param) \
@@ -970,18 +1001,11 @@ static inline void bcm281xx_pin_update(u32 *reg_val, u32 *reg_mask,
*reg_mask |= param_mask;
}
-static const struct regmap_config bcm281xx_pinctrl_regmap_config = {
- .reg_bits = 32,
- .reg_stride = 4,
- .val_bits = 32,
- .max_register = BCM281XX_PIN_VC_CAM3_SDA * 4,
-};
-
static int bcm281xx_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
- return pdata->npins;
+ return pdata->info->npins;
}
static const char *bcm281xx_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
@@ -989,7 +1013,7 @@ static const char *bcm281xx_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
- return pdata->pins[group].name;
+ return pdata->info->pins[group].name;
}
static int bcm281xx_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
@@ -999,7 +1023,7 @@ static int bcm281xx_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
- *pins = &pdata->pins[group].number;
+ *pins = &pdata->info->pins[group].number;
*num_pins = 1;
return 0;
@@ -1025,7 +1049,7 @@ static int bcm281xx_pinctrl_get_fcns_count(struct pinctrl_dev *pctldev)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
- return pdata->nfunctions;
+ return pdata->info->nfunctions;
}
static const char *bcm281xx_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev,
@@ -1033,7 +1057,7 @@ static const char *bcm281xx_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev,
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
- return pdata->functions[function].name;
+ return pdata->info->functions[function].name;
}
static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev,
@@ -1043,8 +1067,8 @@ static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev,
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
- *groups = pdata->functions[function].groups;
- *num_groups = pdata->functions[function].ngroups;
+ *groups = pdata->info->functions[function].groups;
+ *num_groups = pdata->info->functions[function].ngroups;
return 0;
}
@@ -1054,14 +1078,15 @@ static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev,
unsigned int group)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
- const struct bcm281xx_pin_function *f = &pdata->functions[function];
- u32 offset = 4 * pdata->pins[group].number;
+ const struct bcm281xx_pin_function *f = &pdata->info->functions[function];
+ unsigned int pin = pdata->info->pins[group].number;
+ u32 offset = 4 * pin;
int rc = 0;
dev_dbg(pctldev->dev,
"%s(): Enable function %s (%d) of pin %s (%d) @offset 0x%x.\n",
- __func__, f->name, function, pdata->pins[group].name,
- pdata->pins[group].number, offset);
+ __func__, f->name, function, pdata->info->pins[group].name,
+ pin, offset);
rc = regmap_update_bits(pdata->regmap, offset,
BCM281XX_PIN_REG_F_SEL_MASK,
@@ -1069,7 +1094,7 @@ static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev,
if (rc)
dev_err(pctldev->dev,
"Error updating register for pin %s (%d).\n",
- pdata->pins[group].name, pdata->pins[group].number);
+ pdata->info->pins[group].name, pin);
return rc;
}
@@ -1168,7 +1193,7 @@ static int bcm281xx_std_pin_update(struct pinctrl_dev *pctldev,
"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);
+ arg, pdata->info->pins[pin].name, pin);
return -EINVAL;
}
bcm281xx_pin_update(val, mask, (arg/2)-1,
@@ -1179,7 +1204,7 @@ static int bcm281xx_std_pin_update(struct pinctrl_dev *pctldev,
default:
dev_err(pctldev->dev,
"Unrecognized pin config %d for pin %s (%d).\n",
- param, pdata->pins[pin].name, pin);
+ param, pdata->info->pins[pin].name, pin);
return -EINVAL;
} /* switch config */
@@ -1233,7 +1258,7 @@ static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev,
"Invalid pull-up value (%d) for pin %s "
"(%d). Valid values are 568, 720, 831, "
"1080, 1200, 1800, 2700 Ohms.\n",
- arg, pdata->pins[pin].name, pin);
+ arg, pdata->info->pins[pin].name, pin);
return -EINVAL;
}
@@ -1266,7 +1291,7 @@ static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev,
default:
dev_err(pctldev->dev,
"Unrecognized pin config %d for pin %s (%d).\n",
- param, pdata->pins[pin].name, pin);
+ param, pdata->info->pins[pin].name, pin);
return -EINVAL;
} /* switch config */
@@ -1311,7 +1336,7 @@ static int bcm281xx_hdmi_pin_update(struct pinctrl_dev *pctldev,
default:
dev_err(pctldev->dev,
"Unrecognized pin config %d for pin %s (%d).\n",
- param, pdata->pins[pin].name, pin);
+ param, pdata->info->pins[pin].name, pin);
return -EINVAL;
} /* switch config */
@@ -1354,7 +1379,7 @@ static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev,
default:
dev_err(pctldev->dev, "Unknown pin type for pin %s (%d).\n",
- pdata->pins[pin].name, pin);
+ pdata->info->pins[pin].name, pin);
return -EINVAL;
} /* switch pin type */
@@ -1364,13 +1389,13 @@ static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev,
dev_dbg(pctldev->dev,
"%s(): Set pin %s (%d) with config 0x%x, mask 0x%x\n",
- __func__, pdata->pins[pin].name, pin, cfg_val, cfg_mask);
+ __func__, pdata->info->pins[pin].name, pin, cfg_val, cfg_mask);
rc = regmap_update_bits(pdata->regmap, offset, cfg_mask, cfg_val);
if (rc) {
dev_err(pctldev->dev,
"Error updating register for pin %s (%d).\n",
- pdata->pins[pin].name, pin);
+ pdata->info->pins[pin].name, pin);
return rc;
}
@@ -1390,10 +1415,23 @@ static struct pinctrl_desc bcm281xx_pinctrl_desc = {
.owner = THIS_MODULE,
};
+static struct bcm281xx_pinctrl_data bcm281xx_pinctrl_pdata;
+
static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev)
{
- struct bcm281xx_pinctrl_data *pdata = &bcm281xx_pinctrl;
+ struct bcm281xx_pinctrl_data *pdata = &bcm281xx_pinctrl_pdata;
struct pinctrl_dev *pctl;
+ int rc;
+
+ /* Set device pointer in platform data */
+ pdata->dev = &pdev->dev;
+
+ /* Get the data to use from OF match */
+ pdata->info = of_device_get_match_data(&pdev->dev);
+ if (!pdata->info) {
+ dev_err(&pdev->dev, "Failed to get data from OF match\n");
+ return -ENODEV;
+ }
/* So far We can assume there is only 1 bank of registers */
pdata->reg_base = devm_platform_ioremap_resource(pdev, 0);
@@ -1404,15 +1442,15 @@ static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev)
/* Initialize the dynamic part of pinctrl_desc */
pdata->regmap = devm_regmap_init_mmio(&pdev->dev, pdata->reg_base,
- &bcm281xx_pinctrl_regmap_config);
+ &pdata->info->regmap_config);
if (IS_ERR(pdata->regmap)) {
dev_err(&pdev->dev, "Regmap MMIO init failed.\n");
return -ENODEV;
}
bcm281xx_pinctrl_desc.name = dev_name(&pdev->dev);
- bcm281xx_pinctrl_desc.pins = bcm281xx_pinctrl.pins;
- bcm281xx_pinctrl_desc.npins = bcm281xx_pinctrl.npins;
+ bcm281xx_pinctrl_desc.pins = pdata->info->pins;
+ bcm281xx_pinctrl_desc.npins = pdata->info->npins;
pctl = devm_pinctrl_register(&pdev->dev, &bcm281xx_pinctrl_desc, pdata);
if (IS_ERR(pctl)) {
@@ -1426,7 +1464,7 @@ static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev)
}
static const struct of_device_id bcm281xx_pinctrl_of_match[] = {
- { .compatible = "brcm,bcm11351-pinctrl", },
+ { .compatible = "brcm,bcm11351-pinctrl", .data = &bcm281xx_pinctrl },
{ },
};
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux
2025-02-07 20:02 [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
` (3 preceding siblings ...)
2025-02-07 20:02 ` [PATCH 4/7] pinctrl: bcm281xx: Provide pinctrl device info as OF platform data Artur Weber
@ 2025-02-07 20:02 ` Artur Weber
2025-02-07 20:02 ` [PATCH 6/7] ARM: dts: bcm2166x-common: Add pinctrl node Artur Weber
2025-02-07 20:02 ` [PATCH 7/7] ARM: dts: bcm2166x: Add bcm2166x-pinctrl DTSI Artur Weber
6 siblings, 0 replies; 12+ messages in thread
From: Artur Weber @ 2025-02-07 20:02 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
Stanislav Jakubek, ~postmarketos/upstreaming, Artur Weber
BCM21664 is another chip from the Kona line of Broadcom SoCs, and
its pinmux shares a lot of similarities with the BCM281xx pinmux.
Add support for the BCM21664 pinmux controller to the BCM281xx driver.
This also enables pinmux support for the BCM23550, which has an
identical pinmux config to the BCM21664 (hence they can share a
single compatible, brcm,bcm21664-pinctrl).
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 689 ++++++++++++++++++++++++++++++++-
1 file changed, 687 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
index 6ed9bbed71f2d660a2c38d28788c1b0ca8f052c3..e0bee0322919de8d8604f9e2e96276f07e69b54a 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
@@ -52,6 +52,12 @@
#define BCM281XX_HDMI_PIN_REG_MODE_MASK 0x0010
#define BCM281XX_HDMI_PIN_REG_MODE_SHIFT 4
+/* BCM21664 access lock registers */
+#define BCM21664_WR_ACCESS_OFFSET 0x07F0
+#define BCM21664_WR_ACCESS_PASSWORD 0xA5A501
+#define BCM21664_ACCESS_LOCK_OFFSET(lock) (0x0780 + (lock * 4))
+#define BCM21664_ACCESS_LOCK_COUNT 5
+
/*
* bcm281xx_pin_type - types of pin register
*/
@@ -81,6 +87,7 @@ struct bcm281xx_pin_function {
*/
enum bcm281xx_pinctrl_type {
BCM281XX_PINCTRL_TYPE,
+ BCM21664_PINCTRL_TYPE,
};
/*
@@ -971,6 +978,571 @@ static const struct bcm281xx_pinctrl_info bcm281xx_pinctrl = {
.regmap_config = bcm281xx_pinctrl_regmap_config,
};
+/* BCM21664 data */
+#define BCM21664_PIN_ADCSYN 0
+#define BCM21664_PIN_BATRM 1
+#define BCM21664_PIN_BSC1CLK 2
+#define BCM21664_PIN_BSC1DAT 3
+#define BCM21664_PIN_CAMCS0 4
+#define BCM21664_PIN_CAMCS1 5
+#define BCM21664_PIN_CLK32K 6
+#define BCM21664_PIN_CLK_CX8 7
+#define BCM21664_PIN_DCLK1 8
+#define BCM21664_PIN_DCLK4 9
+#define BCM21664_PIN_DCLKREQ1 10
+#define BCM21664_PIN_DCLKREQ4 11
+#define BCM21664_PIN_DMIC0CLK 12
+#define BCM21664_PIN_DMIC0DQ 13
+#define BCM21664_PIN_DSI0TE 14
+#define BCM21664_PIN_GPIO00 15
+#define BCM21664_PIN_GPIO01 16
+#define BCM21664_PIN_GPIO02 17
+#define BCM21664_PIN_GPIO03 18
+#define BCM21664_PIN_GPIO04 19
+#define BCM21664_PIN_GPIO05 20
+#define BCM21664_PIN_GPIO06 21
+#define BCM21664_PIN_GPIO07 22
+#define BCM21664_PIN_GPIO08 23
+#define BCM21664_PIN_GPIO09 24
+#define BCM21664_PIN_GPIO10 25
+#define BCM21664_PIN_GPIO11 26
+#define BCM21664_PIN_GPIO12 27
+#define BCM21664_PIN_GPIO13 28
+#define BCM21664_PIN_GPIO14 29
+#define BCM21664_PIN_GPIO15 30
+#define BCM21664_PIN_GPIO16 31
+#define BCM21664_PIN_GPIO17 32
+#define BCM21664_PIN_GPIO18 33
+#define BCM21664_PIN_GPIO19 34
+#define BCM21664_PIN_GPIO20 35
+#define BCM21664_PIN_GPIO21 36
+#define BCM21664_PIN_GPIO22 37
+#define BCM21664_PIN_GPIO23 38
+#define BCM21664_PIN_GPIO24 39
+#define BCM21664_PIN_GPIO25 40
+#define BCM21664_PIN_GPIO26 41
+#define BCM21664_PIN_GPIO27 42
+#define BCM21664_PIN_GPIO28 43
+#define BCM21664_PIN_GPIO32 44
+#define BCM21664_PIN_GPIO33 45
+#define BCM21664_PIN_GPIO34 46
+#define BCM21664_PIN_GPS_CALREQ 47
+#define BCM21664_PIN_GPS_HOSTREQ 48
+#define BCM21664_PIN_GPS_PABLANK 49
+#define BCM21664_PIN_GPS_TMARK 50
+#define BCM21664_PIN_ICUSBDM 51
+#define BCM21664_PIN_ICUSBDP 52
+#define BCM21664_PIN_LCDCS0 53
+#define BCM21664_PIN_LCDRES 54
+#define BCM21664_PIN_LCDSCL 55
+#define BCM21664_PIN_LCDSDA 56
+#define BCM21664_PIN_LCDTE 57
+#define BCM21664_PIN_MDMGPIO00 58
+#define BCM21664_PIN_MDMGPIO01 59
+#define BCM21664_PIN_MDMGPIO02 60
+#define BCM21664_PIN_MDMGPIO03 61
+#define BCM21664_PIN_MDMGPIO04 62
+#define BCM21664_PIN_MDMGPIO05 63
+#define BCM21664_PIN_MDMGPIO06 64
+#define BCM21664_PIN_MDMGPIO07 65
+#define BCM21664_PIN_MDMGPIO08 66
+#define BCM21664_PIN_MMC0CK 67
+#define BCM21664_PIN_MMC0CMD 68
+#define BCM21664_PIN_MMC0DAT0 69
+#define BCM21664_PIN_MMC0DAT1 70
+#define BCM21664_PIN_MMC0DAT2 71
+#define BCM21664_PIN_MMC0DAT3 72
+#define BCM21664_PIN_MMC0DAT4 73
+#define BCM21664_PIN_MMC0DAT5 74
+#define BCM21664_PIN_MMC0DAT6 75
+#define BCM21664_PIN_MMC0DAT7 76
+#define BCM21664_PIN_MMC0RST 77
+#define BCM21664_PIN_MMC1CK 78
+#define BCM21664_PIN_MMC1CMD 79
+#define BCM21664_PIN_MMC1DAT0 80
+#define BCM21664_PIN_MMC1DAT1 81
+#define BCM21664_PIN_MMC1DAT2 82
+#define BCM21664_PIN_MMC1DAT3 83
+#define BCM21664_PIN_MMC1DAT4 84
+#define BCM21664_PIN_MMC1DAT5 85
+#define BCM21664_PIN_MMC1DAT6 86
+#define BCM21664_PIN_MMC1DAT7 87
+#define BCM21664_PIN_MMC1RST 88
+#define BCM21664_PIN_PC1 89
+#define BCM21664_PIN_PC2 90
+#define BCM21664_PIN_PMBSCCLK 91
+#define BCM21664_PIN_PMBSCDAT 92
+#define BCM21664_PIN_PMUINT 93
+#define BCM21664_PIN_RESETN 94
+#define BCM21664_PIN_RFST2G_MTSLOTEN3G 95
+#define BCM21664_PIN_RTXDATA2G_TXDATA3G1 96
+#define BCM21664_PIN_RTXEN2G_TXDATA3G2 97
+#define BCM21664_PIN_RXDATA3G0 98
+#define BCM21664_PIN_RXDATA3G1 99
+#define BCM21664_PIN_RXDATA3G2 100
+#define BCM21664_PIN_SDCK 101
+#define BCM21664_PIN_SDCMD 102
+#define BCM21664_PIN_SDDAT0 103
+#define BCM21664_PIN_SDDAT1 104
+#define BCM21664_PIN_SDDAT2 105
+#define BCM21664_PIN_SDDAT3 106
+#define BCM21664_PIN_SIMCLK 107
+#define BCM21664_PIN_SIMDAT 108
+#define BCM21664_PIN_SIMDET 109
+#define BCM21664_PIN_SIMRST 110
+#define BCM21664_PIN_GPIO93 111
+#define BCM21664_PIN_GPIO94 112
+#define BCM21664_PIN_SPI0CLK 113
+#define BCM21664_PIN_SPI0FSS 114
+#define BCM21664_PIN_SPI0RXD 115
+#define BCM21664_PIN_SPI0TXD 116
+#define BCM21664_PIN_SRI_C 117
+#define BCM21664_PIN_SRI_D 118
+#define BCM21664_PIN_SRI_E 119
+#define BCM21664_PIN_SSPCK 120
+#define BCM21664_PIN_SSPDI 121
+#define BCM21664_PIN_SSPDO 122
+#define BCM21664_PIN_SSPSYN 123
+#define BCM21664_PIN_STAT1 124
+#define BCM21664_PIN_STAT2 125
+#define BCM21664_PIN_SWCLKTCK 126
+#define BCM21664_PIN_SWDIOTMS 127
+#define BCM21664_PIN_SYSCLKEN 128
+#define BCM21664_PIN_TDI 129
+#define BCM21664_PIN_TDO 130
+#define BCM21664_PIN_TESTMODE 131
+#define BCM21664_PIN_TRACECLK 132
+#define BCM21664_PIN_TRACEDT00 133
+#define BCM21664_PIN_TRACEDT01 134
+#define BCM21664_PIN_TRACEDT02 135
+#define BCM21664_PIN_TRACEDT03 136
+#define BCM21664_PIN_TRACEDT04 137
+#define BCM21664_PIN_TRACEDT05 138
+#define BCM21664_PIN_TRACEDT06 139
+#define BCM21664_PIN_TRACEDT07 140
+#define BCM21664_PIN_TRSTB 141
+#define BCM21664_PIN_TXDATA3G0 142
+#define BCM21664_PIN_UBCTSN 143
+#define BCM21664_PIN_UBRTSN 144
+#define BCM21664_PIN_UBRX 145
+#define BCM21664_PIN_UBTX 146
+#define BCM21664_PIN_TRACEDT08 147
+#define BCM21664_PIN_TRACEDT09 148
+#define BCM21664_PIN_TRACEDT10 149
+#define BCM21664_PIN_TRACEDT11 150
+#define BCM21664_PIN_TRACEDT12 151
+#define BCM21664_PIN_TRACEDT13 152
+#define BCM21664_PIN_TRACEDT14 153
+#define BCM21664_PIN_TRACEDT15 154
+
+static const struct pinctrl_pin_desc bcm21664_pinctrl_pins[] = {
+ BCM281XX_PIN_DESC(BCM21664_PIN_ADCSYN, "adcsyn", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_BATRM, "batrm", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_BSC1CLK, "bsc1clk", i2c),
+ BCM281XX_PIN_DESC(BCM21664_PIN_BSC1DAT, "bsc1dat", i2c),
+ BCM281XX_PIN_DESC(BCM21664_PIN_CAMCS0, "camcs0", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_CAMCS1, "camcs1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_CLK32K, "clk32k", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_CLK_CX8, "clk_cx8", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_DCLK1, "dclk1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_DCLK4, "dclk4", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_DCLKREQ1, "dclkreq1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_DCLKREQ4, "dclkreq4", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_DMIC0CLK, "dmic0clk", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_DMIC0DQ, "dmic0dq", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_DSI0TE, "dsi0te", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO00, "gpio00", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO01, "gpio01", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO02, "gpio02", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO03, "gpio03", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO04, "gpio04", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO05, "gpio05", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO06, "gpio06", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO07, "gpio07", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO08, "gpio08", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO09, "gpio09", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO10, "gpio10", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO11, "gpio11", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO12, "gpio12", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO13, "gpio13", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO14, "gpio14", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO15, "gpio15", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO16, "gpio16", i2c),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO17, "gpio17", i2c),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO18, "gpio18", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO19, "gpio19", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO20, "gpio20", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO21, "gpio21", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO22, "gpio22", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO23, "gpio23", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO24, "gpio24", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO25, "gpio25", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO26, "gpio26", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO27, "gpio27", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO28, "gpio28", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO32, "gpio32", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO33, "gpio33", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO34, "gpio34", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPS_CALREQ, "gps_calreq", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPS_HOSTREQ, "gps_hostreq", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPS_PABLANK, "gps_pablank", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPS_TMARK, "gps_tmark", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_ICUSBDM, "icusbdm", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_ICUSBDP, "icusbdp", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_LCDCS0, "lcdcs0", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_LCDRES, "lcdres", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_LCDSCL, "lcdscl", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_LCDSDA, "lcdsda", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_LCDTE, "lcdte", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO00, "mdmgpio00", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO01, "mdmgpio01", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO02, "mdmgpio02", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO03, "mdmgpio03", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO04, "mdmgpio04", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO05, "mdmgpio05", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO06, "mdmgpio06", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO07, "mdmgpio07", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MDMGPIO08, "mdmgpio08", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0CK, "mmc0ck", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0CMD, "mmc0cmd", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0DAT0, "mmc0dat0", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0DAT1, "mmc0dat1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0DAT2, "mmc0dat2", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0DAT3, "mmc0dat3", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0DAT4, "mmc0dat4", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0DAT5, "mmc0dat5", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0DAT6, "mmc0dat6", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0DAT7, "mmc0dat7", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC0RST, "mmc0rst", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1CK, "mmc1ck", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1CMD, "mmc1cmd", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1DAT0, "mmc1dat0", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1DAT1, "mmc1dat1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1DAT2, "mmc1dat2", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1DAT3, "mmc1dat3", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1DAT4, "mmc1dat4", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1DAT5, "mmc1dat5", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1DAT6, "mmc1dat6", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1DAT7, "mmc1dat7", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_MMC1RST, "mmc1rst", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_PC1, "pc1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_PC2, "pc2", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_PMBSCCLK, "pmbscclk", i2c),
+ BCM281XX_PIN_DESC(BCM21664_PIN_PMBSCDAT, "pmbscdat", i2c),
+ BCM281XX_PIN_DESC(BCM21664_PIN_PMUINT, "pmuint", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_RESETN, "resetn", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_RFST2G_MTSLOTEN3G, "rfst2g_mtsloten3g", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_RTXDATA2G_TXDATA3G1, "rtxdata2g_txdata3g1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_RTXEN2G_TXDATA3G2, "rtxen2g_txdata3g2", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_RXDATA3G0, "rxdata3g0", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_RXDATA3G1, "rxdata3g1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_RXDATA3G2, "rxdata3g2", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SDCK, "sdck", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SDCMD, "sdcmd", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SDDAT0, "sddat0", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SDDAT1, "sddat1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SDDAT2, "sddat2", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SDDAT3, "sddat3", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SIMCLK, "simclk", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SIMDAT, "simdat", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SIMDET, "simdet", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SIMRST, "simrst", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO93, "gpio93", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_GPIO94, "gpio94", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SPI0CLK, "spi0clk", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SPI0FSS, "spi0fss", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SPI0RXD, "spi0rxd", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SPI0TXD, "spi0txd", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SRI_C, "sri_c", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SRI_D, "sri_d", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SRI_E, "sri_e", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SSPCK, "sspck", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SSPDI, "sspdi", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SSPDO, "sspdo", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SSPSYN, "sspsyn", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_STAT1, "stat1", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_STAT2, "stat2", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SWCLKTCK, "swclktck", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SWDIOTMS, "swdiotms", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_SYSCLKEN, "sysclken", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TDI, "tdi", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TDO, "tdo", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TESTMODE, "testmode", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACECLK, "traceclk", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT00, "tracedt00", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT01, "tracedt01", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT02, "tracedt02", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT03, "tracedt03", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT04, "tracedt04", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT05, "tracedt05", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT06, "tracedt06", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT07, "tracedt07", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRSTB, "trstb", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TXDATA3G0, "txdata3g0", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_UBCTSN, "ubctsn", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_UBRTSN, "ubrtsn", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_UBRX, "ubrx", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_UBTX, "ubtx", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT08, "tracedt08", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT09, "tracedt09", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT10, "tracedt10", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT11, "tracedt11", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT12, "tracedt12", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT13, "tracedt13", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT14, "tracedt14", std),
+ BCM281XX_PIN_DESC(BCM21664_PIN_TRACEDT15, "tracedt15", std),
+};
+
+static const char * const bcm21664_alt_groups[] = {
+ "adcsyn",
+ "batrm",
+ "bsc1clk",
+ "bsc1dat",
+ "camcs0",
+ "camcs1",
+ "clk32k",
+ "clk_cx8",
+ "dclk1",
+ "dclk4",
+ "dclkreq1",
+ "dclkreq4",
+ "dmic0clk",
+ "dmic0dq",
+ "dsi0te",
+ "gpio00",
+ "gpio01",
+ "gpio02",
+ "gpio03",
+ "gpio04",
+ "gpio05",
+ "gpio06",
+ "gpio07",
+ "gpio08",
+ "gpio09",
+ "gpio10",
+ "gpio11",
+ "gpio12",
+ "gpio13",
+ "gpio14",
+ "gpio15",
+ "gpio16",
+ "gpio17",
+ "gpio18",
+ "gpio19",
+ "gpio20",
+ "gpio21",
+ "gpio22",
+ "gpio23",
+ "gpio24",
+ "gpio25",
+ "gpio26",
+ "gpio27",
+ "gpio28",
+ "gpio32",
+ "gpio33",
+ "gpio34",
+ "gps_calreq",
+ "gps_hostreq",
+ "gps_pablank",
+ "gps_tmark",
+ "icusbdm",
+ "icusbdp",
+ "lcdcs0",
+ "lcdres",
+ "lcdscl",
+ "lcdsda",
+ "lcdte",
+ "mdmgpio00",
+ "mdmgpio01",
+ "mdmgpio02",
+ "mdmgpio03",
+ "mdmgpio04",
+ "mdmgpio05",
+ "mdmgpio06",
+ "mdmgpio07",
+ "mdmgpio08",
+ "mmc0ck",
+ "mmc0cmd",
+ "mmc0dat0",
+ "mmc0dat1",
+ "mmc0dat2",
+ "mmc0dat3",
+ "mmc0dat4",
+ "mmc0dat5",
+ "mmc0dat6",
+ "mmc0dat7",
+ "mmc0rst",
+ "mmc1ck",
+ "mmc1cmd",
+ "mmc1dat0",
+ "mmc1dat1",
+ "mmc1dat2",
+ "mmc1dat3",
+ "mmc1dat4",
+ "mmc1dat5",
+ "mmc1dat6",
+ "mmc1dat7",
+ "mmc1rst",
+ "pc1",
+ "pc2",
+ "pmbscclk",
+ "pmbscdat",
+ "pmuint",
+ "resetn",
+ "rfst2g_mtsloten3g",
+ "rtxdata2g_txdata3g1",
+ "rtxen2g_txdata3g2",
+ "rxdata3g0",
+ "rxdata3g1",
+ "rxdata3g2",
+ "sdck",
+ "sdcmd",
+ "sddat0",
+ "sddat1",
+ "sddat2",
+ "sddat3",
+ "simclk",
+ "simdat",
+ "simdet",
+ "simrst",
+ "gpio93",
+ "gpio94",
+ "spi0clk",
+ "spi0fss",
+ "spi0rxd",
+ "spi0txd",
+ "sri_c",
+ "sri_d",
+ "sri_e",
+ "sspck",
+ "sspdi",
+ "sspdo",
+ "sspsyn",
+ "stat1",
+ "stat2",
+ "swclktck",
+ "swdiotms",
+ "sysclken",
+ "tdi",
+ "tdo",
+ "testmode",
+ "traceclk",
+ "tracedt00",
+ "tracedt01",
+ "tracedt02",
+ "tracedt03",
+ "tracedt04",
+ "tracedt05",
+ "tracedt06",
+ "tracedt07",
+ "trstb",
+ "txdata3g0",
+ "ubctsn",
+ "ubrtsn",
+ "ubrx",
+ "ubtx",
+ "tracedt08",
+ "tracedt09",
+ "tracedt10",
+ "tracedt11",
+ "tracedt12",
+ "tracedt13",
+ "tracedt14",
+ "tracedt15",
+};
+
+#define BCM21664_PIN_FUNCTION(fcn_name) \
+{ \
+ .name = #fcn_name, \
+ .groups = bcm21664_alt_groups, \
+ .ngroups = ARRAY_SIZE(bcm21664_alt_groups), \
+}
+
+static const struct bcm281xx_pin_function bcm21664_functions[] = {
+ BCM21664_PIN_FUNCTION(alt1),
+ BCM21664_PIN_FUNCTION(alt2),
+ BCM21664_PIN_FUNCTION(alt3),
+ BCM21664_PIN_FUNCTION(alt4),
+ BCM21664_PIN_FUNCTION(alt5),
+ BCM21664_PIN_FUNCTION(alt6),
+};
+
+static const struct regmap_config bcm21664_pinctrl_regmap_config = {
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+ .max_register = BCM21664_WR_ACCESS_OFFSET,
+};
+
+static const struct bcm281xx_pinctrl_info bcm21664_pinctrl = {
+ .device_type = BCM21664_PINCTRL_TYPE,
+
+ .pins = bcm21664_pinctrl_pins,
+ .npins = ARRAY_SIZE(bcm21664_pinctrl_pins),
+ .functions = bcm21664_functions,
+ .nfunctions = ARRAY_SIZE(bcm21664_functions),
+
+ .regmap_config = bcm21664_pinctrl_regmap_config,
+};
+
+/* BCM21664 pinctrl access lock handlers */
+static int bcm21664_pinctrl_lock_all(struct bcm281xx_pinctrl_data *pdata)
+{
+ int i, rc;
+
+ for (i = 0; i < BCM21664_ACCESS_LOCK_COUNT; i++) {
+ rc = regmap_write(pdata->regmap, BCM21664_WR_ACCESS_OFFSET,
+ BCM21664_WR_ACCESS_PASSWORD);
+ if (rc) {
+ dev_err(pdata->dev, "Failed to enable write access: %d\n",
+ rc);
+ return rc;
+ }
+ regmap_write(pdata->regmap, BCM21664_ACCESS_LOCK_OFFSET(i),
+ 0xffffffff);
+ if (rc) {
+ dev_err(pdata->dev, "Failed to write access lock: %d\n",
+ rc);
+ return rc;
+ }
+ }
+
+ return 0;
+}
+
+static int bcm21664_pinctrl_set_pin_lock(struct bcm281xx_pinctrl_data *pdata,
+ unsigned int pin, bool lock)
+{
+ unsigned int access_lock = pin / 32;
+ int rc;
+
+ dev_dbg(pdata->dev,
+ "%s(): %s pin %s (%d)\n",
+ __func__, lock ? "Lock" : "Unlock", pdata->info->pins[pin].name,
+ pin);
+
+ rc = regmap_write(pdata->regmap, BCM21664_WR_ACCESS_OFFSET,
+ BCM21664_WR_ACCESS_PASSWORD);
+ if (rc) {
+ dev_err(pdata->dev, "Failed to enable write access: %d\n",
+ rc);
+ return rc;
+ }
+
+ rc = regmap_update_bits(pdata->regmap,
+ BCM21664_ACCESS_LOCK_OFFSET(access_lock),
+ BIT(pin % 32),
+ (int)lock << (pin % 32));
+
+ if (rc) {
+ dev_err(pdata->dev, "Failed to %s pin: %d\n",
+ lock ? "lock" : "unlock", rc);
+ return rc;
+ }
+
+ return 0;
+}
+
static inline enum bcm281xx_pin_type pin_type_get(struct pinctrl_dev *pctldev,
unsigned int pin)
{
@@ -1079,6 +1651,7 @@ static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev,
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
const struct bcm281xx_pin_function *f = &pdata->info->functions[function];
+ enum bcm281xx_pinctrl_type device_type = pdata->info->device_type;
unsigned int pin = pdata->info->pins[group].number;
u32 offset = 4 * pin;
int rc = 0;
@@ -1088,6 +1661,14 @@ static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev,
__func__, f->name, function, pdata->info->pins[group].name,
pin, offset);
+ if (device_type == BCM21664_PINCTRL_TYPE) {
+ rc = bcm21664_pinctrl_set_pin_lock(pdata, pin, false);
+ if (rc) {
+ /* Error is printed in bcm21664_pinctrl_set_pin_lock */
+ return rc;
+ }
+ }
+
rc = regmap_update_bits(pdata->regmap, offset,
BCM281XX_PIN_REG_F_SEL_MASK,
function << BCM281XX_PIN_REG_F_SEL_SHIFT);
@@ -1096,6 +1677,14 @@ static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev,
"Error updating register for pin %s (%d).\n",
pdata->info->pins[group].name, pin);
+ if (device_type == BCM21664_PINCTRL_TYPE) {
+ rc = bcm21664_pinctrl_set_pin_lock(pdata, pin, true);
+ if (rc) {
+ /* Error is printed in bcm21664_pinctrl_set_pin_lock */
+ return rc;
+ }
+ }
+
return rc;
}
@@ -1300,6 +1889,68 @@ static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev,
return 0;
}
+/* Goes through the configs and update register val/mask */
+static int bcm21664_i2c_pin_update(struct pinctrl_dev *pctldev,
+ unsigned int pin,
+ unsigned long *configs,
+ unsigned int num_configs,
+ u32 *val,
+ u32 *mask)
+{
+ struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
+ int i;
+ enum pin_config_param param;
+ u32 arg;
+
+ for (i = 0; i < num_configs; i++) {
+ param = pinconf_to_config_param(configs[i]);
+ arg = pinconf_to_config_argument(configs[i]);
+
+ /*
+ * BCM21664 I2C pins use the same config bits as standard pins,
+ * but only pull up/none, slew rate and input enable/disable
+ * options are supported.
+ */
+ switch (param) {
+ case PIN_CONFIG_BIAS_PULL_UP:
+ bcm281xx_pin_update(val, mask, 1,
+ BCM281XX_PIN_SHIFT(STD, PULL_UP),
+ BCM281XX_PIN_MASK(STD, PULL_UP));
+ break;
+
+ case PIN_CONFIG_BIAS_DISABLE:
+ bcm281xx_pin_update(val, mask, 0,
+ BCM281XX_PIN_SHIFT(STD, PULL_UP),
+ BCM281XX_PIN_MASK(STD, PULL_UP));
+ break;
+
+ case PIN_CONFIG_SLEW_RATE:
+ arg = (arg >= 1 ? 1 : 0);
+ bcm281xx_pin_update(val, mask, arg,
+ BCM281XX_PIN_SHIFT(STD, SLEW),
+ BCM281XX_PIN_MASK(STD, SLEW));
+ break;
+
+ case PIN_CONFIG_INPUT_ENABLE:
+ /* inversed since register is for input _disable_ */
+ arg = (arg >= 1 ? 0 : 1);
+ bcm281xx_pin_update(val, mask, arg,
+ BCM281XX_PIN_SHIFT(STD, INPUT_DIS),
+ BCM281XX_PIN_MASK(STD, INPUT_DIS));
+ break;
+
+ default:
+ dev_err(pctldev->dev,
+ "Unrecognized pin config %d for pin %s (%d).\n",
+ param, pdata->info->pins[pin].name, pin);
+ return -EINVAL;
+
+ } /* switch config */
+ } /* for each config */
+
+ return 0;
+}
+
/* Goes through the configs and update register val/mask */
static int bcm281xx_hdmi_pin_update(struct pinctrl_dev *pctldev,
unsigned int pin,
@@ -1351,6 +2002,7 @@ static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev,
unsigned int num_configs)
{
struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
+ enum bcm281xx_pinctrl_type device_type = pdata->info->device_type;
enum bcm281xx_pin_type pin_type;
u32 offset = 4 * pin;
u32 cfg_val, cfg_mask;
@@ -1368,8 +2020,12 @@ static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev,
break;
case BCM281XX_PIN_TYPE_I2C:
- rc = bcm281xx_i2c_pin_update(pctldev, pin, configs,
- num_configs, &cfg_val, &cfg_mask);
+ if (device_type == BCM21664_PINCTRL_TYPE)
+ rc = bcm21664_i2c_pin_update(pctldev, pin, configs,
+ num_configs, &cfg_val, &cfg_mask);
+ else
+ rc = bcm281xx_i2c_pin_update(pctldev, pin, configs,
+ num_configs, &cfg_val, &cfg_mask);
break;
case BCM281XX_PIN_TYPE_HDMI:
@@ -1391,6 +2047,14 @@ static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev,
"%s(): Set pin %s (%d) with config 0x%x, mask 0x%x\n",
__func__, pdata->info->pins[pin].name, pin, cfg_val, cfg_mask);
+ if (device_type == BCM21664_PINCTRL_TYPE) {
+ rc = bcm21664_pinctrl_set_pin_lock(pdata, pin, false);
+ if (rc) {
+ /* Error is printed in bcm21664_pinctrl_set_pin_lock */
+ return rc;
+ }
+ }
+
rc = regmap_update_bits(pdata->regmap, offset, cfg_mask, cfg_val);
if (rc) {
dev_err(pctldev->dev,
@@ -1399,6 +2063,14 @@ static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev,
return rc;
}
+ if (device_type == BCM21664_PINCTRL_TYPE) {
+ rc = bcm21664_pinctrl_set_pin_lock(pdata, pin, true);
+ if (rc) {
+ /* Error is printed in bcm21664_pinctrl_set_pin_lock */
+ return rc;
+ }
+ }
+
return 0;
}
@@ -1452,6 +2124,18 @@ static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev)
bcm281xx_pinctrl_desc.pins = pdata->info->pins;
bcm281xx_pinctrl_desc.npins = pdata->info->npins;
+ /*
+ * For BCM21664, lock all pins by default; they will be unlocked
+ * as needed
+ */
+ if (pdata->info->device_type == BCM21664_PINCTRL_TYPE) {
+ rc = bcm21664_pinctrl_lock_all(pdata);
+ if (rc) {
+ dev_err(&pdev->dev, "Failed to lock all pins\n");
+ return rc;
+ }
+ }
+
pctl = devm_pinctrl_register(&pdev->dev, &bcm281xx_pinctrl_desc, pdata);
if (IS_ERR(pctl)) {
dev_err(&pdev->dev, "Failed to register pinctrl\n");
@@ -1465,6 +2149,7 @@ static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev)
static const struct of_device_id bcm281xx_pinctrl_of_match[] = {
{ .compatible = "brcm,bcm11351-pinctrl", .data = &bcm281xx_pinctrl },
+ { .compatible = "brcm,bcm21664-pinctrl", .data = &bcm21664_pinctrl },
{ },
};
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 6/7] ARM: dts: bcm2166x-common: Add pinctrl node
2025-02-07 20:02 [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
` (4 preceding siblings ...)
2025-02-07 20:02 ` [PATCH 5/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
@ 2025-02-07 20:02 ` Artur Weber
2025-02-07 20:02 ` [PATCH 7/7] ARM: dts: bcm2166x: Add bcm2166x-pinctrl DTSI Artur Weber
6 siblings, 0 replies; 12+ messages in thread
From: Artur Weber @ 2025-02-07 20:02 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
Stanislav Jakubek, ~postmarketos/upstreaming, Artur Weber
Now that the pinctrl driver supports the BCM21664, add a node for
pinctrl in the DTS to allow for controlling pinmux pins.
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi b/arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi
index 87180b7fd695e65b52c52743e6315cbcca385fba..d4b412ac8b0343bd3773f50c59a20fa00a3923f8 100644
--- a/arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi
+++ b/arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi
@@ -46,6 +46,11 @@ gpio: gpio@1003000 {
interrupt-controller;
};
+ pinctrl: pinctrl@1004800 {
+ compatible = "brcm,bcm21664-pinctrl";
+ reg = <0x01004800 0x7f4>;
+ };
+
timer@1006000 {
compatible = "brcm,kona-timer";
reg = <0x01006000 0x1c>;
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 7/7] ARM: dts: bcm2166x: Add bcm2166x-pinctrl DTSI
2025-02-07 20:02 [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
` (5 preceding siblings ...)
2025-02-07 20:02 ` [PATCH 6/7] ARM: dts: bcm2166x-common: Add pinctrl node Artur Weber
@ 2025-02-07 20:02 ` Artur Weber
6 siblings, 0 replies; 12+ messages in thread
From: Artur Weber @ 2025-02-07 20:02 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
Stanislav Jakubek, ~postmarketos/upstreaming, Artur Weber
Add common DTSI with common pin control configs for BCM21664/BCM23550
and include it in bcm2166x-common.dtsi. The configs are kept in a
separate DTSI to keep things cleaner (pin config definitions take up
quite a lot of space).
Currently contains pins for BSC buses and SD/MMC; more pins can be
added in the future.
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi | 2 +
arch/arm/boot/dts/broadcom/bcm2166x-pinctrl.dtsi | 297 +++++++++++++++++++++++
2 files changed, 299 insertions(+)
diff --git a/arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi b/arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi
index d4b412ac8b0343bd3773f50c59a20fa00a3923f8..f535212cb52fec0668abfc06e7268bead70d958a 100644
--- a/arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi
+++ b/arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi
@@ -337,3 +337,5 @@ master_ccu: master_ccu@3f001000 {
};
};
};
+
+#include "bcm2166x-pinctrl.dtsi"
diff --git a/arch/arm/boot/dts/broadcom/bcm2166x-pinctrl.dtsi b/arch/arm/boot/dts/broadcom/bcm2166x-pinctrl.dtsi
new file mode 100644
index 0000000000000000000000000000000000000000..51b8730c8feea501f2c5ca6a7bad8233ed708c82
--- /dev/null
+++ b/arch/arm/boot/dts/broadcom/bcm2166x-pinctrl.dtsi
@@ -0,0 +1,297 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Common pinmux configrations for BCM2166x (BCM21664/BCM23550).
+ *
+ * Copyright (C) 2025 Artur Weber <aweber.kernel@gmail.com>
+ */
+
+&pinctrl {
+ /* BSC1 */
+ bsc1_pins: bsc1-pins {
+ bsc1clk-grp0 {
+ pins = "bsc1clk";
+ function = "alt1"; /* BSC1CLK */
+ };
+
+ bsc1dat-grp0 {
+ pins = "bsc1dat";
+ function = "alt1"; /* BSC1DAT */
+ };
+ };
+
+ /* BSC2 */
+ bsc2_pins: bsc2-pins {
+ bsc2clk-grp0 {
+ pins = "gpio16";
+ function = "alt2"; /* BSC2CLK */
+ };
+
+ bsc2dat-grp0 {
+ pins = "gpio17";
+ function = "alt2"; /* BSC2DAT */
+ };
+ };
+
+ /* BSC3 */
+ bsc3_pins: bsc3-pins {
+ bsc3clk-grp0 {
+ pins = "lcdscl";
+ function = "alt1"; /* BSC3_CLK */
+ };
+
+ bsc3dat-grp0 {
+ pins = "lcdsda";
+ function = "alt1"; /* BSC3_SDA */
+ };
+ };
+
+ /* BSC4 */
+ bsc4_pins: bsc4-pins {
+ bsc4clk-grp0 {
+ pins = "lcdres";
+ function = "alt1"; /* BSC4_CLK */
+ };
+
+ bsc4dat-grp0 {
+ pins = "lcdte";
+ function = "alt1"; /* BSC4_SDA */
+ };
+ };
+
+ /* PMBSC */
+ pmbsc_pins: pmbsc-pins {
+ pmbscclk-grp0 {
+ pins = "pmbscclk";
+ function = "alt1"; /* PMBSCCLK */
+ };
+
+ pmbscdat-grp0 {
+ pins = "pmbscdat";
+ function = "alt1"; /* PMBSCDAT */
+ };
+ };
+
+ /* SD */
+ sd_width1_pins: sd-width1-pins {
+ sdck-grp0 {
+ pins = "sdck";
+ function = "alt1"; /* SDCK */
+ bias-disable;
+ };
+
+ sdcmd-grp0 {
+ pins = "sdcmd";
+ function = "alt1"; /* SDCMD */
+ bias-pull-up;
+ };
+
+ sddat-grp0 {
+ pins = "sddat0";
+ function = "alt1"; /* SDDATx */
+ bias-pull-up;
+ };
+ };
+
+ sd_width4_pins: sd-width4-pins {
+ sdck-grp0 {
+ pins = "sdck";
+ function = "alt1"; /* SDCK */
+ bias-disable;
+ };
+
+ sdcmd-grp0 {
+ pins = "sdcmd";
+ function = "alt1"; /* SDCMD */
+ bias-pull-up;
+ };
+
+ sddat-grp0 {
+ pins = "sddat0", "sddat1", "sddat2", "sddat3";
+ function = "alt1"; /* SDDATx */
+ bias-pull-up;
+ };
+ };
+
+ /* SD1 */
+ sd1_width1_pins: sd1-width1-pins {
+ sd1ck-grp0 {
+ pins = "mmc1dat7";
+ function = "alt6"; /* SD1CK */
+ bias-disable;
+ };
+
+ sd1cmd-grp0 {
+ pins = "spi0txd";
+ function = "alt2"; /* SD1CMD */
+ bias-pull-up;
+ };
+
+ sd1dat0-grp0 {
+ pins = "mmc1dat5";
+ function = "alt6"; /* SD1DAT0 */
+ bias-pull-up;
+ };
+ };
+
+ sd1_width4_pins: sd1-width4-pins {
+ sd1ck-grp0 {
+ pins = "mmc1dat7";
+ function = "alt6"; /* SD1CK */
+ bias-disable;
+ };
+
+ sd1cmd-grp0 {
+ pins = "spi0txd";
+ function = "alt2"; /* SD1CMD */
+ bias-pull-up;
+ };
+
+ sd1dat0-grp0 {
+ pins = "mmc1dat5";
+ function = "alt6"; /* SD1DAT0 */
+ bias-pull-up;
+ };
+
+ sd1dat1-grp0 {
+ pins = "gpio93";
+ function = "alt1"; /* SD1DAT1 */
+ bias-pull-up;
+ };
+
+ sd1dat2-grp0 {
+ pins = "gpio94";
+ function = "alt1"; /* SD1DAT2 */
+ bias-pull-up;
+ };
+
+ sd1dat3-grp0 {
+ pins = "mmc1dat3";
+ function = "alt6"; /* SD1DAT3 */
+ bias-pull-up;
+ };
+ };
+
+ /* MMC0 */
+ mmc0_width1_pins: mmc0-width1-pins {
+ mmc0ck-grp0 {
+ pins = "mmc0ck";
+ function = "alt1"; /* MMC0CK */
+ bias-disable;
+ };
+
+ mmc0cmd-grp0 {
+ pins = "mmc0cmd";
+ function = "alt1"; /* MMC0CMD */
+ bias-pull-up;
+ };
+
+ mmc0dat-grp0 {
+ pins = "mmc0dat0";
+ function = "alt1"; /* MMC0DATx */
+ bias-pull-up;
+ };
+ };
+
+ mmc0_width4_pins: mmc0-width4-pins {
+ mmc0ck-grp0 {
+ pins = "mmc0ck";
+ function = "alt1"; /* MMC0CK */
+ bias-disable;
+ };
+
+ mmc0cmd-grp0 {
+ pins = "mmc0cmd";
+ function = "alt1"; /* MMC0CMD */
+ bias-pull-up;
+ };
+
+ mmc0dat-grp0 {
+ pins = "mmc0dat0", "mmc0dat1", "mmc0dat2", "mmc0dat3";
+ function = "alt1"; /* MMC0DATx */
+ bias-pull-up;
+ };
+ };
+
+ mmc0_width8_pins: mmc0-width8-pins {
+ mmc0ck-grp0 {
+ pins = "mmc0ck";
+ function = "alt1"; /* MMC0CK */
+ bias-disable;
+ };
+
+ mmc0cmd-grp0 {
+ pins = "mmc0cmd";
+ function = "alt1"; /* MMC0CMD */
+ bias-pull-up;
+ };
+
+ mmc0dat-grp0 {
+ pins = "mmc0dat0", "mmc0dat1", "mmc0dat2", "mmc0dat3",
+ "mmc0dat4", "mmc0dat5", "mmc0dat6", "mmc0dat7";
+ function = "alt1"; /* MMC0DATx */
+ bias-pull-up;
+ };
+ };
+
+ /* MMC1 */
+ mmc1_width1_pins: mmc1-width1-pins {
+ mmc1ck-grp0 {
+ pins = "mmc1ck";
+ function = "alt1"; /* MMC1CK */
+ bias-disable;
+ };
+
+ mmc1cmd-grp0 {
+ pins = "mmc1cmd";
+ function = "alt1"; /* MMC1CMD */
+ bias-pull-up;
+ };
+
+ mmc1dat-grp0 {
+ pins = "mmc1dat0";
+ function = "alt1"; /* MMC1DATx */
+ bias-pull-up;
+ };
+ };
+
+ mmc1_width4_pins: mmc1-width4-pins {
+ mmc1ck-grp0 {
+ pins = "mmc1ck";
+ function = "alt1"; /* MMC1CK */
+ bias-disable;
+ };
+
+ mmc1cmd-grp0 {
+ pins = "mmc1cmd";
+ function = "alt1"; /* MMC1CMD */
+ bias-pull-up;
+ };
+
+ mmc1dat-grp0 {
+ pins = "mmc1dat0", "mmc1dat1", "mmc1dat2", "mmc1dat3";
+ function = "alt1"; /* MMC1DATx */
+ bias-pull-up;
+ };
+ };
+
+ mmc1_width8_pins: mmc1-width8-pins {
+ mmc1ck-grp0 {
+ pins = "mmc1ck";
+ function = "alt1"; /* MMC1CK */
+ bias-disable;
+ };
+
+ mmc1cmd-grp0 {
+ pins = "mmc1cmd";
+ function = "alt1"; /* MMC1CMD */
+ bias-pull-up;
+ };
+
+ mmc1dat-grp0 {
+ pins = "mmc1dat0", "mmc1dat1", "mmc1dat2", "mmc1dat3",
+ "mmc1dat4", "mmc1dat5", "mmc1dat6", "mmc1dat7";
+ function = "alt1"; /* MMC1DATx */
+ bias-pull-up;
+ };
+ };
+};
--
2.48.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 4/7] pinctrl: bcm281xx: Provide pinctrl device info as OF platform data
2025-02-07 20:02 ` [PATCH 4/7] pinctrl: bcm281xx: Provide pinctrl device info as OF platform data Artur Weber
@ 2025-02-09 5:36 ` kernel test robot
0 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2025-02-09 5:36 UTC (permalink / raw)
To: Artur Weber, Linus Walleij, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin
Cc: llvm, oe-kbuild-all, linux-gpio, devicetree, linux-kernel,
linux-arm-kernel, Stanislav Jakubek, ~postmarketos/upstreaming,
Artur Weber
Hi Artur,
kernel test robot noticed the following build errors:
[auto build test ERROR on ffd294d346d185b70e28b1a28abe367bbfe53c04]
url: https://github.com/intel-lab-lkp/linux/commits/Artur-Weber/dt-bindings-pinctrl-Add-bindings-for-BCM21664-pin-controller/20250208-040646
base: ffd294d346d185b70e28b1a28abe367bbfe53c04
patch link: https://lore.kernel.org/r/20250207-bcm21664-pinctrl-v1-4-e7cfac9b2d3b%40gmail.com
patch subject: [PATCH 4/7] pinctrl: bcm281xx: Provide pinctrl device info as OF platform data
config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20250209/202502091354.vwFJOxGn-lkp@intel.com/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250209/202502091354.vwFJOxGn-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502091354.vwFJOxGn-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/pinctrl/bcm/pinctrl-bcm281xx.c:971:19: error: initializer element is not a compile-time constant
.regmap_config = bcm281xx_pinctrl_regmap_config,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/bcm/pinctrl-bcm281xx.c:1424:6: warning: unused variable 'rc' [-Wunused-variable]
int rc;
^
1 warning and 1 error generated.
vim +971 drivers/pinctrl/bcm/pinctrl-bcm281xx.c
962
963 static const struct bcm281xx_pinctrl_info bcm281xx_pinctrl = {
964 .device_type = BCM281XX_PINCTRL_TYPE,
965
966 .pins = bcm281xx_pinctrl_pins,
967 .npins = ARRAY_SIZE(bcm281xx_pinctrl_pins),
968 .functions = bcm281xx_functions,
969 .nfunctions = ARRAY_SIZE(bcm281xx_functions),
970
> 971 .regmap_config = bcm281xx_pinctrl_regmap_config,
972 };
973
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/7] dt-bindings: pinctrl: Add bindings for BCM21664 pin controller
2025-02-07 20:02 ` [PATCH 1/7] dt-bindings: pinctrl: Add bindings for BCM21664 pin controller Artur Weber
@ 2025-02-12 18:17 ` Rob Herring
0 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2025-02-12 18:17 UTC (permalink / raw)
To: Artur Weber
Cc: Linus Walleij, Krzysztof Kozlowski, Conor Dooley,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Christian Daudt,
Sherman Yin, linux-gpio, devicetree, linux-kernel,
linux-arm-kernel, Stanislav Jakubek, ~postmarketos/upstreaming
On Fri, Feb 07, 2025 at 09:02:40PM +0100, Artur Weber wrote:
> Add device tree bindings for the pin controller included in the
> BCM21664 chip. The bindings are based off brcm,bcm11351-pinctrl.yaml;
> both chips use the same driver, but have different pins, and the
> BCM21664 has 6 alt modes instead of 4.
>
> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
> ---
> .../bindings/pinctrl/brcm,bcm21664-pinctrl.yaml | 169 +++++++++++++++++++++
> 1 file changed, 169 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,bcm21664-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/brcm,bcm21664-pinctrl.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..233bea91b640ffa8480637d7304f661b7a4f5d79
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm21664-pinctrl.yaml
> @@ -0,0 +1,169 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/pinctrl/brcm,bcm21664-pinctrl.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Broadcom BCM21664 pin controller
> +
> +maintainers:
> + - Florian Fainelli <florian.fainelli@broadcom.com>
> + - Ray Jui <rjui@broadcom.com>
> + - Scott Branden <sbranden@broadcom.com>
> +
> +allOf:
> + - $ref: pinctrl.yaml#
> +
> +properties:
> + compatible:
> + const: brcm,bcm21664-pinctrl
> +
> + reg:
> + maxItems: 1
> +
> +patternProperties:
> + '-pins$':
> + type: object
> + additionalProperties: false
> +
> + patternProperties:
> + '-grp[0-9]$':
> + type: object
> + unevaluatedProperties: false
> +
> + properties:
> + pins:
> + description:
> + Specifies the name(s) of one or more pins to be configured by
> + this node.
> + items:
> + enum: [ adcsyn, batrm, bsc1clk, bsc1dat, camcs0, camcs1, clk32k,
> + clk_cx8, dclk1, dclk4, dclkreq1, dclkreq4, dmic0clk,
> + dmic0dq, dsi0te, gpio00, gpio01, gpio02, gpio03, gpio04,
> + gpio05, gpio06, gpio07, gpio08, gpio09, gpio10, gpio11,
> + gpio12, gpio13, gpio14, gpio15, gpio16, gpio17, gpio18,
> + gpio19, gpio20, gpio21, gpio22, gpio23, gpio24, gpio25,
> + gpio26, gpio27, gpio28, gpio32, gpio33, gpio34, gpio93,
> + gpio94, gps_calreq, gps_hostreq, gps_pablank, gps_tmark,
> + icusbdm, icusbdp, lcdcs0, lcdres, lcdscl, lcdsda, lcdte,
> + mdmgpio00, mdmgpio01, mdmgpio02, mdmgpio03, mdmgpio04,
> + mdmgpio05, mdmgpio06, mdmgpio07, mdmgpio08, mmc0ck,
> + mmc0cmd, mmc0dat0, mmc0dat1, mmc0dat2, mmc0dat3, mmc0dat4,
> + mmc0dat5, mmc0dat6, mmc0dat7, mmc0rst, mmc1ck, mmc1cmd,
> + mmc1dat0, mmc1dat1, mmc1dat2, mmc1dat3, mmc1dat4,
> + mmc1dat5, mmc1dat6, mmc1dat7, mmc1rst, pc1, pc2, pmbscclk,
> + pmbscdat, pmuint, resetn, rfst2g_mtsloten3g,
> + rtxdata2g_txdata3g1, rtxen2g_txdata3g2, rxdata3g0,
> + rxdata3g1, rxdata3g2, sdck, sdcmd, sddat0, sddat1, sddat2,
> + sddat3, simclk, simdat, simdet, simrst, spi0clk, spi0fss,
> + spi0rxd, spi0txd, sri_c, sri_d, sri_e, sspck, sspdi,
> + sspdo, sspsyn, stat1, stat2, swclktck, swdiotms, sysclken,
> + tdi, tdo, testmode, traceclk, tracedt00, tracedt01,
> + tracedt02, tracedt03, tracedt04, tracedt05, tracedt06,
> + tracedt07, tracedt08, tracedt09, tracedt10, tracedt11,
> + tracedt12, tracedt13, tracedt14, tracedt15, trstb,
> + txdata3g0, ubctsn, ubrtsn, ubrx, ubtx ]
> +
> + function:
> + description:
> + Specifies the pin mux selection.
> + enum: [ alt1, alt2, alt3, alt4, alt5, alt6 ]
> +
> + slew-rate:
> + description: |
> + Meaning depends on configured pin mux:
> + bsc*clk/pmbscclk or bsc*dat/pmbscdat:
> + 0: Standard (100 kbps) & Fast (400 kbps) mode
> + 1: Highspeed (3.4 Mbps) mode
> + Otherwise:
> + 0: fast slew rate
> + 1: normal slew rate
> +
> + bias-disable: true
> + bias-pull-up: true
> + input-disable: true
> + input-enable: true
With unevaluateProperties, these have no effect.
> +
> + required:
> + - pins
> +
> + allOf:
> + - $ref: pincfg-node.yaml#
> +
> + # Optional properties for standard pins
> + - if:
> + properties:
> + pins:
> + contains:
> + enum: [ adcsyn, batrm, camcs0, camcs1, clk32k, clk_cx8,
> + dclk1, dclk4, dclkreq1, dclkreq4, dmic0clk, dmic0dq,
> + dsi0te, gpio00, gpio01, gpio02, gpio03, gpio04,
> + gpio05, gpio06, gpio07, gpio08, gpio09, gpio10,
> + gpio11, gpio12, gpio13, gpio14, gpio15, gpio18,
> + gpio19, gpio20, gpio21, gpio22, gpio23, gpio24,
> + gpio25, gpio26, gpio27, gpio28, gpio32, gpio33,
> + gpio34, gpio93, gpio94, gps_calreq, gps_hostreq,
> + gps_pablank, gps_tmark, icusbdm, icusbdp, lcdcs0,
> + lcdres, lcdscl, lcdsda, lcdte, mdmgpio00, mdmgpio01,
> + mdmgpio02, mdmgpio03, mdmgpio04, mdmgpio05,
> + mdmgpio06, mdmgpio07, mdmgpio08, mmc0ck, mmc0cmd,
> + mmc0dat0, mmc0dat1, mmc0dat2, mmc0dat3, mmc0dat4,
> + mmc0dat5, mmc0dat6, mmc0dat7, mmc0rst, mmc1ck,
> + mmc1cmd, mmc1dat0, mmc1dat1, mmc1dat2, mmc1dat3,
> + mmc1dat4, mmc1dat5, mmc1dat6, mmc1dat7, mmc1rst,
> + pc1, pc2, pmuint, resetn, rfst2g_mtsloten3g,
> + rtxdata2g_txdata3g1, rtxen2g_txdata3g2, rxdata3g0,
> + rxdata3g1, rxdata3g2, sdck, sdcmd, sddat0, sddat1,
> + sddat2, sddat3, simclk, simdat, simdet, simrst,
> + spi0clk, spi0fss, spi0rxd, spi0txd, sri_c, sri_d,
> + sri_e, sspck, sspdi, sspdo, sspsyn, stat1, stat2,
> + swclktck, swdiotms, sysclken, tdi, tdo, testmode,
> + traceclk, tracedt00, tracedt01, tracedt02,
> + tracedt03, tracedt04, tracedt05, tracedt06,
> + tracedt07, tracedt08, tracedt09, tracedt10,
> + tracedt11, tracedt12, tracedt13, tracedt14,
> + tracedt15, trstb, txdata3g0, ubctsn, ubrtsn, ubrx,
> + ubtx ]
> + then:
> + properties:
> + drive-strength:
> + enum: [ 2, 4, 6, 8, 10, 12, 14, 16 ]
Not sure this is worth the complexity. And actually, 'drive-strength'
will be allowed on the pins not listed here and can have any value.
I would just move this to the main section and drop the if/then. You
could list the subset of pins where 'drive-strength' is not valid
instead and then put 'drive-strength: false'.
Rob
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/7] pinctrl: bcm281xx: Fix incorrect regmap max_registers value
2025-02-07 20:02 ` [PATCH 2/7] pinctrl: bcm281xx: Fix incorrect regmap max_registers value Artur Weber
@ 2025-02-14 9:03 ` Linus Walleij
2025-02-14 18:32 ` Artur Weber
0 siblings, 1 reply; 12+ messages in thread
From: Linus Walleij @ 2025-02-14 9:03 UTC (permalink / raw)
To: Artur Weber
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Florian Fainelli,
Ray Jui, Scott Branden, Broadcom internal kernel review list,
Christian Daudt, Sherman Yin, linux-gpio, devicetree,
linux-kernel, linux-arm-kernel, Stanislav Jakubek,
~postmarketos/upstreaming
On Fri, Feb 7, 2025 at 9:02 PM Artur Weber <aweber.kernel@gmail.com> wrote:
> The max_registers value does not take into consideration the stride;
> currently, it's set to the number of the last pin, but this does not
> accurately represent the final register.
>
> Fix this by multiplying the current value by 4.
>
> Fixes: 54b1aa5a5b16 ("ARM: pinctrl: Add Broadcom Capri pinctrl driver")
> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
This looks like it could be causing regressions so I pulled this patch out
and applied it for fixes.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/7] pinctrl: bcm281xx: Fix incorrect regmap max_registers value
2025-02-14 9:03 ` Linus Walleij
@ 2025-02-14 18:32 ` Artur Weber
0 siblings, 0 replies; 12+ messages in thread
From: Artur Weber @ 2025-02-14 18:32 UTC (permalink / raw)
To: Linus Walleij
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Florian Fainelli,
Ray Jui, Scott Branden, Broadcom internal kernel review list,
Christian Daudt, Sherman Yin, linux-gpio, devicetree,
linux-kernel, linux-arm-kernel, Stanislav Jakubek,
~postmarketos/upstreaming
On 14.02.2025 10:03, Linus Walleij wrote:
> On Fri, Feb 7, 2025 at 9:02 PM Artur Weber <aweber.kernel@gmail.com> wrote:
>
>> The max_registers value does not take into consideration the stride;
>> currently, it's set to the number of the last pin, but this does not
>> accurately represent the final register.
>>
>> Fix this by multiplying the current value by 4.
>>
>> Fixes: 54b1aa5a5b16 ("ARM: pinctrl: Add Broadcom Capri pinctrl driver")
>> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
>
> This looks like it could be causing regressions so I pulled this patch out
> and applied it for fixes.
Thanks. I assume this means this patch can be dropped from the next version
of this patchset now? If so, which branch contains the patch so that I can
rebase the next version of this patchset on it? I've checked the "fixes",
"devel" and "for-next" branches of linux-pinctrl.git[1] but did not see it
in any of them.
Best regards
Artur
[1] https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/log/?h=fixes
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-02-14 18:33 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-07 20:02 [PATCH 0/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
2025-02-07 20:02 ` [PATCH 1/7] dt-bindings: pinctrl: Add bindings for BCM21664 pin controller Artur Weber
2025-02-12 18:17 ` Rob Herring
2025-02-07 20:02 ` [PATCH 2/7] pinctrl: bcm281xx: Fix incorrect regmap max_registers value Artur Weber
2025-02-14 9:03 ` Linus Walleij
2025-02-14 18:32 ` Artur Weber
2025-02-07 20:02 ` [PATCH 3/7] pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned" Artur Weber
2025-02-07 20:02 ` [PATCH 4/7] pinctrl: bcm281xx: Provide pinctrl device info as OF platform data Artur Weber
2025-02-09 5:36 ` kernel test robot
2025-02-07 20:02 ` [PATCH 5/7] pinctrl: bcm281xx: Add support for BCM21664 pinmux Artur Weber
2025-02-07 20:02 ` [PATCH 6/7] ARM: dts: bcm2166x-common: Add pinctrl node Artur Weber
2025-02-07 20:02 ` [PATCH 7/7] ARM: dts: bcm2166x: Add bcm2166x-pinctrl DTSI Artur Weber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).