arm64: berlin: add pinctrl support
Subsystems (5)
cover arm64: berlin: add pinctrl support
This series adds support for Marvell berlin4ct pin-controller, allowing to configure the pin muxing from the device tree.
This series applies on top of patches adding GPIO support for berlin4ct[1].
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-September/371106.html
Jisheng Zhang (5):
pinctrl: berlin: regmap as an extra argument of berlin_pinctrl_probe()
pinctrl: berlin: add the berlin4ct pinctrl driver
arm64: berlin: add the pinctrl dependency for Marvell Berlin SoCs
pinctrl: dt-binding: document berlin4ct SoC
arm64: dts: berlin4ct: add the pinctrl node and muxing setup for uart0
.../devicetree/bindings/pinctrl/berlin,pinctrl.txt | 5 +- arch/arm64/Kconfig.platforms | 1 + arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 27 ++ drivers/pinctrl/berlin/Kconfig | 5 + drivers/pinctrl/berlin/Makefile | 1 + drivers/pinctrl/berlin/berlin-bg2.c | 9 +- drivers/pinctrl/berlin/berlin-bg2cd.c | 9 +- drivers/pinctrl/berlin/berlin-bg2q.c | 9 +- drivers/pinctrl/berlin/berlin.c | 8 +- drivers/pinctrl/berlin/berlin.h | 1 + drivers/pinctrl/berlin/berlin4ct.c | 503 +++++++++++++++++++++ 11 files changed, 567 insertions(+), 11 deletions(-) create mode 100644 drivers/pinctrl/berlin/berlin4ct.c
Signature · 1 line
2.5.1
PATCH 1/5 pinctrl: berlin: regmap as an extra argument of berlin_pinctrl_probe()
Let berlin_pinctrl_probe() accepts an extra argument: regmap, this is to prepare for the next berlin4ct support, where we won't use simple-mfd any more.
--- drivers/pinctrl/berlin/berlin-bg2.c | 9 ++++++++- drivers/pinctrl/berlin/berlin-bg2cd.c | 9 ++++++++- drivers/pinctrl/berlin/berlin-bg2q.c | 9 ++++++++- drivers/pinctrl/berlin/berlin.c | 8 +------- drivers/pinctrl/berlin/berlin.h | 1 + 5 files changed, 26 insertions(+), 10 deletions(-)
drivers/pinctrl/berlin/berlin-bg2.c +8 -1
@@ -233,8 +233,15 @@ static int berlin2_pinctrl_probe(struct platform_device *pdev) {const struct of_device_id *match =of_match_device (berlin2_pinctrl_match, &pdev->dev); +struct device *dev = &pdev->dev; +struct device_node *parent_np =of_get_parent (dev->of_node); +struct regmap *regmap =syscon_node_to_regmap (parent_np); -return berlin_pinctrl_probe (pdev, match->data); +of_node_put (parent_np); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +return berlin_pinctrl_probe (pdev, regmap, match->data); }static struct platform_driver berlin2_pinctrl_driver = {
drivers/pinctrl/berlin/berlin-bg2cd.c +8 -1
@@ -176,8 +176,15 @@ static int berlin2cd_pinctrl_probe(struct platform_device *pdev) {const struct of_device_id *match =of_match_device (berlin2cd_pinctrl_match, &pdev->dev); +struct device *dev = &pdev->dev; +struct device_node *parent_np =of_get_parent (dev->of_node); +struct regmap *regmap =syscon_node_to_regmap (parent_np); -return berlin_pinctrl_probe (pdev, match->data); +of_node_put (parent_np); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +return berlin_pinctrl_probe (pdev, regmap, match->data); }static struct platform_driver berlin2cd_pinctrl_driver = {
drivers/pinctrl/berlin/berlin-bg2q.c +8 -1
@@ -395,8 +395,15 @@ static int berlin2q_pinctrl_probe(struct platform_device *pdev) {const struct of_device_id *match =of_match_device (berlin2q_pinctrl_match, &pdev->dev); +struct device *dev = &pdev->dev; +struct device_node *parent_np =of_get_parent (dev->of_node); +struct regmap *regmap =syscon_node_to_regmap (parent_np); -return berlin_pinctrl_probe (pdev, match->data); +of_node_put (parent_np); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +return berlin_pinctrl_probe (pdev, regmap, match->data); }static struct platform_driver berlin2q_pinctrl_driver = {
drivers/pinctrl/berlin/berlin.c +1 -7
@@ -293,19 +293,13 @@ static struct pinctrl_desc berlin_pctrl_desc = { };int berlin_pinctrl_probe (struct platform_device *pdev, +struct regmap *regmap,const struct berlin_pinctrl_desc *desc) {struct device *dev = &pdev->dev; -struct device_node *parent_np =of_get_parent (dev->of_node);struct berlin_pinctrl *pctrl; -struct regmap *regmap;int ret; - regmap =syscon_node_to_regmap (parent_np); -of_node_put (parent_np); -if (IS_ERR (regmap)) -return PTR_ERR (regmap); - pctrl =devm_kzalloc (dev,sizeof (*pctrl),GFP_KERNEL );if (!pctrl)return -ENOMEM ;
drivers/pinctrl/berlin/berlin.h +1 -0
@@ -56,6 +56,7 @@ struct berlin_pinctrl_function {#define BERLIN_PINCTRL_FUNCTION_UNKNOWN {}int berlin_pinctrl_probe (struct platform_device *pdev, +struct regmap *regmap,const struct berlin_pinctrl_desc *desc);#endif /* __PINCTRL_BERLIN_H */
Signature · 1 line
2.5.1
PATCH 2/5 pinctrl: berlin: add the berlin4ct pinctrl driver
In reply to Jisheng ZhangAdd the pin-controller driver for Marvell Berlin BG4CT SoC, with definition of its groups and functions. This uses the core Berlin pinctrl driver.
--- drivers/pinctrl/berlin/Kconfig | 5 + drivers/pinctrl/berlin/Makefile | 1 + drivers/pinctrl/berlin/berlin4ct.c | 503 +++++++++++++++++++++++++++++++++++++ 3 files changed, 509 insertions(+) create mode 100644 drivers/pinctrl/berlin/berlin4ct.c
drivers/pinctrl/berlin/Kconfig +5 -0
@@ -17,4 +17,9 @@ config PINCTRL_BERLIN_BG2Q bool select PINCTRL_BERLIN +config PINCTRL_BERLIN4CT + depends on OF && (ARCH_BERLIN || COMPILE_TEST) + bool "Marvell berlin4ct pin controller driver" + select PINCTRL_BERLIN + endif
drivers/pinctrl/berlin/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_PINCTRL_BERLIN) += berlin.o obj-$(CONFIG_PINCTRL_BERLIN_BG2) += berlin-bg2.o obj-$(CONFIG_PINCTRL_BERLIN_BG2CD) += berlin-bg2cd.o obj-$(CONFIG_PINCTRL_BERLIN_BG2Q) += berlin-bg2q.o +obj-$(CONFIG_PINCTRL_BERLIN4CT) += berlin4ct.o
drivers/pinctrl/berlin/berlin4ct.c new file +503 -0
503 lines not on this page · raw message
Signature · 1 line
2.5.1
Sebastian Hesselbarth
maintainerRe: [PATCH 2/5] pinctrl: berlin: add the berlin4ct pinctrl driver
Quoted 5 lines · Jisheng Zhang
Add the pin-controller driver for Marvell Berlin BG4CT SoC, with definition of its groups and functions. This uses the core Berlin pinctrl driver.
Signed-off-by Jisheng Zhang <[email protected]>---
[...]
Quoted 8 lines
drivers/pinctrl/berlin/berlin4ct.c new file +2
-0@@ -0,0 +1,503 @@ +/* +* Marvell berlin4ct pinctrl driver
[...]
drivers/pinctrl/berlin/berlin4ct.c line 31
Quoted 4 lines
drivers/pinctrl/berlin/berlin4ct.c new file +4
-0+static const struct berlin_desc_group berlin4ct_soc_pinctrl_groups[] = { +BERLIN_PINCTRL_GROUP ("EMMC_RSTn" ,0x0 ,0x3 ,0x00 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"emmc_rstn" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"gpio47" )),
Jisheng,
I am fine with naming the groups after the 0x0 function but the functions themselves should be named after a generic name, e.g. "emmc" instead of "emmc_rstn".
That will allow to add pinmux nodes like
uart_pmx {
groups = "SM_UART0_TXD", "SM_UART0_RXD";
function = "uart0";
};instead of two separate nodes like in patch 5/5.
You should however keep the actual pin function e.g. in a comment after the function define above:
BERLIN_PINCTRL_GROUP("EMMC_RSTn", 0x0, 0x3, 0x00,
BERLIN_PINCTRL_FUNCTION(0x0, "emmc"), /* RESETn */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), /* GPIO47 */
Quoted 5 lines
drivers/pinctrl/berlin/berlin4ct.c new file +5
-0+BERLIN_PINCTRL_GROUP ("NAND_IO0" ,0x0 ,0x3 ,0x03 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"nand_io0" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"rgmii_rxd0" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"sd1_clk" ), + BERLIN_PINCTRL_FUNCTION(0x3, "gpio0")),
[...]
drivers/pinctrl/berlin/berlin4ct.c line 102
Quoted 4 lines
drivers/pinctrl/berlin/berlin4ct.c new file +4
-0+ BERLIN_PINCTRL_GROUP("SD0_CLK", 0x4, 0x3, 0x12, + BERLIN_PINCTRL_FUNCTION(0x0, "gpio29"), + BERLIN_PINCTRL_FUNCTION(0x1, "sd0_clk"), + BERLIN_PINCTRL_FUNCTION(0x2, "sts4_clk"),
Please find a better name for "sts" whatever it is for.
drivers/pinctrl/berlin/berlin4ct.c line 103
Quoted 1 line
drivers/pinctrl/berlin/berlin4ct.c new file +1
-0+ BERLIN_PINCTRL_FUNCTION(0x5, "v4g_dbg8"),
ditto for "v4g"
Quoted 1 line
drivers/pinctrl/berlin/berlin4ct.c new file +1
-0+ BERLIN_PINCTRL_FUNCTION(0x7, "phy_dbg8")),
[...]
drivers/pinctrl/berlin/berlin4ct.c line 196
Quoted 3 lines
drivers/pinctrl/berlin/berlin4ct.c new file +3
-0+ BERLIN_PINCTRL_GROUP("SCRD0_RST", 0xc, 0x3, 0x06, + BERLIN_PINCTRL_FUNCTION(0x0, "gpio15"), + BERLIN_PINCTRL_FUNCTION(0x1, "scrd0_rst"),
ditto for "scrd0"
drivers/pinctrl/berlin/berlin4ct.c line 201
Quoted 5 lines
drivers/pinctrl/berlin/berlin4ct.c new file +5
-0+ BERLIN_PINCTRL_FUNCTION(0x3, "sd1a_clk")), +BERLIN_PINCTRL_GROUP ("SCRD0_DCLK" ,0xc ,0x3 ,0x09 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"gpio16" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"scrd0_dclk" ), + BERLIN_PINCTRL_FUNCTION(0x3, "sd1a_cmd")),
What is the "a" for in "sd1a" ? There is a "sd1b" below so I guess that there is two pinmux groups that mux sd1?
drivers/pinctrl/berlin/berlin4ct.c line 205
Quoted 4 lines
drivers/pinctrl/berlin/berlin4ct.c new file +4
-0+ BERLIN_PINCTRL_GROUP("SCRD0_GPIO0", 0xc, 0x3, 0x0c, + BERLIN_PINCTRL_FUNCTION(0x0, "gpio17"), + BERLIN_PINCTRL_FUNCTION(0x1, "scrd0_gpio0"), + BERLIN_PINCTRL_FUNCTION(0x2, "sif_dio"),
What kind of interface is "sif" ?
Quoted 1 line
drivers/pinctrl/berlin/berlin4ct.c new file +1
-0+ BERLIN_PINCTRL_FUNCTION(0x3, "sd1a_dat0")),
[...]
Quoted 16 lines
drivers/pinctrl/berlin/berlin4ct.c new file +16
-0+static const struct berlin_desc_group berlin4ct_soc_aviopinctrl_groups[] = { +BERLIN_PINCTRL_GROUP ("TX_EDDC_SCL" ,0x0 ,0x3 ,0x00 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"avio_gpio0" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"tx_eddc_scl" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"tw1_scl" )), +BERLIN_PINCTRL_GROUP ("TX_EDDC_SDA" ,0x0 ,0x3 ,0x03 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"avio_gpio1" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"tx_eddc_sda" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"tw1_sda" )), +BERLIN_PINCTRL_GROUP ("I2S1_LRCKO" ,0x0 ,0x3 ,0x06 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"avio_gpio2" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"i2s1_lrcko" ), +BERLIN_PINCTRL_FUNCTION (0x3 ,"sts6_clk" ), +BERLIN_PINCTRL_FUNCTION (0x4 ,"adac_dbg0" ), +BERLIN_PINCTRL_FUNCTION (0x6 ,"sd1b_clk" ), +BERLIN_PINCTRL_FUNCTION (0x7 ,"avio_dbg0" )),
[...]
drivers/pinctrl/berlin/berlin4ct.c line 345
Quoted 4 lines
drivers/pinctrl/berlin/berlin4ct.c new file +4
-0+static const struct berlin_desc_group berlin4ct_sysmgr_pinctrl_groups[] = { +BERLIN_PINCTRL_GROUP ("SM_TW2_SCL" ,0x0 ,0x3 ,0x00 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio19" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_tw2_scl" )),
I'd say, remove the "sm_" prefix for all of the SM functions if there is no collusion with any of the other functions.
drivers/pinctrl/berlin/berlin4ct.c line 356
Quoted 11 lines
drivers/pinctrl/berlin/berlin4ct.c new file +11
-0+BERLIN_PINCTRL_GROUP ("SM_TW2_SDA" ,0x0 ,0x3 ,0x03 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio20" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_tw2_sda" )), +BERLIN_PINCTRL_GROUP ("SM_TW3_SCL" ,0x0 ,0x3 ,0x06 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio21" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_tw3_scl" )), +BERLIN_PINCTRL_GROUP ("SM_TW3_SDA" ,0x0 ,0x3 ,0x09 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio22" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_tw3_sda" )), + BERLIN_PINCTRL_GROUP("SM_TMS", 0x0, 0x3, 0x0c, + BERLIN_PINCTRL_FUNCTION(0x0, "sm_tms"),
Please use function "jtag" instead.
drivers/pinctrl/berlin/berlin4ct.c line 367
Quoted 11 lines
drivers/pinctrl/berlin/berlin4ct.c new file +11
-0+ BERLIN_PINCTRL_FUNCTION(0x1, "sm_gpio0"), + BERLIN_PINCTRL_FUNCTION(0x2, "pwm0")), +BERLIN_PINCTRL_GROUP ("SM_TDI" ,0x0 ,0x3 ,0x0f , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_tdi" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_gpio1" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"pwm1" )), +BERLIN_PINCTRL_GROUP ("SM_TDO" ,0x0 ,0x3 ,0x12 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_tdo" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_gpio2" )), + BERLIN_PINCTRL_GROUP("SM_URT0_TXD", 0x0, 0x3, 0x15, + BERLIN_PINCTRL_FUNCTION(0x0, "sm_urt0_txd"),
Please avoid abbreviating acronyms even more, we can afford the few extra bytes.
[...]
drivers/pinctrl/berlin/berlin4ct.c line 378
Quoted 7 lines
drivers/pinctrl/berlin/berlin4ct.c new file +7
-0+BERLIN_PINCTRL_GROUP ("SM_URT1_TXD" ,0x0 ,0x3 ,0x1b , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio5" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_urt1_txd" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"eth1_rxclk" ), +BERLIN_PINCTRL_FUNCTION (0x3 ,"pwm2" ), +BERLIN_PINCTRL_FUNCTION (0x4 ,"sm_timer0" ), + BERLIN_PINCTRL_FUNCTION(0x5, "clk_25m")),
"clko" ?
Sebastian
[...]
Quoted 43 lines
drivers/pinctrl/berlin/berlin4ct.c new file +42
-0+static int berlin4ct_pinctrl_probe (struct platform_device *pdev) +{ +const struct of_device_id *match = +of_match_device (berlin4ct_pinctrl_match, &pdev->dev); +struct regmap_config *rmconfig; +struct regmap *regmap; +struct resource *res; +void __iomem *base; + + rmconfig =devm_kzalloc (&pdev->dev,sizeof (*rmconfig),GFP_KERNEL ); +if (!rmconfig) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (base)) +return PTR_ERR (base); + + rmconfig->reg_bits =32 , + rmconfig->val_bits =32 , + rmconfig->reg_stride =4 , + rmconfig->max_register =resource_size (res); + + regmap =devm_regmap_init_mmio (&pdev->dev, base, rmconfig); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +return berlin_pinctrl_probe (pdev, regmap, match->data); +} + +static struct platform_driver berlin4ct_pinctrl_driver = { + .probe = berlin4ct_pinctrl_probe, + .driver = { + .name ="berlin4ct-pinctrl" , + .of_match_table = berlin4ct_pinctrl_match, + }, +}; +module_platform_driver (berlin4ct_pinctrl_driver); + +MODULE_AUTHOR ("Jisheng Zhang <[email protected]>" ); +MODULE_DESCRIPTION ("Marvell berlin4ct pinctrl driver" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH 2/5] pinctrl: berlin: add the berlin4ct pinctrl driver
Dear Sebastian,
Quoted 23 lines · On Sun, 20 Sep 2015 21:32:37 +0200 Sebastian Hesselbarth…
Quoted 5 lines · Jisheng Zhang
Add the pin-controller driver for Marvell Berlin BG4CT SoC, with definition of its groups and functions. This uses the core Berlin pinctrl driver.
Signed-off-by Jisheng Zhang <[email protected]>---
[...]
Quoted 8 lines
drivers/pinctrl/berlin/berlin4ct.c new file +2
-0@@ -0,0 +1,503 @@ +/* +* Marvell berlin4ct pinctrl driver [...]
drivers/pinctrl/berlin/berlin4ct.c line 31
Quoted 4 lines
drivers/pinctrl/berlin/berlin4ct.c new file +4
-0+static const struct berlin_desc_group berlin4ct_soc_pinctrl_groups[] = { +BERLIN_PINCTRL_GROUP ("EMMC_RSTn" ,0x0 ,0x3 ,0x00 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"emmc_rstn" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"gpio47" )),Jisheng,
Quoted 3 lines
I am fine with naming the groups after the
0x0function but the functions themselves should be named after a generic name, e.g. "emmc" instead of "emmc_rstn".
This seems better. Will change in newer version.
Quoted 23 lines
That will allow to add pinmux nodes like
uart_pmx { groups = "SM_UART0_TXD", "SM_UART0_RXD"; function = "uart0"; };instead of two separate nodes like in patch 5/5.
You should however keep the actual pin function e.g. in a comment after the function define above:
BERLIN_PINCTRL_GROUP("EMMC_RSTn",
0x0,0x3,0x00,BERLIN_PINCTRL_FUNCTION(0x0, "emmc"), /* RESETn */ BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), /* GPIO47 */Quoted 5 lines
drivers/pinctrl/berlin/berlin4ct.c new file +5
-0+BERLIN_PINCTRL_GROUP ("NAND_IO0" ,0x0 ,0x3 ,0x03 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"nand_io0" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"rgmii_rxd0" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"sd1_clk" ), + BERLIN_PINCTRL_FUNCTION(0x3, "gpio0")),[...]
Quoted 6 lines
drivers/pinctrl/berlin/berlin4ct.c line 102
Quoted 4 lines
drivers/pinctrl/berlin/berlin4ct.c new file +4
-0+ BERLIN_PINCTRL_GROUP("SD0_CLK", 0x4, 0x3, 0x12, + BERLIN_PINCTRL_FUNCTION(0x0, "gpio29"), + BERLIN_PINCTRL_FUNCTION(0x1, "sd0_clk"), + BERLIN_PINCTRL_FUNCTION(0x2, "sts4_clk"),Please find a better name for "sts" whatever it is for.
sts is one kind of HW component, and that's what we called it.
Quoted 4 lines
drivers/pinctrl/berlin/berlin4ct.c line 103
Quoted 2 lines
drivers/pinctrl/berlin/berlin4ct.c new file +1
-0+ BERLIN_PINCTRL_FUNCTION(0x5, "v4g_dbg8"),ditto for "v4g"
v4g is another kind of HW component which is called as "v4g"
Quoted 8 lines
Quoted 2 lines
drivers/pinctrl/berlin/berlin4ct.c new file +1
-0+ BERLIN_PINCTRL_FUNCTION(0x7, "phy_dbg8")),[...]
drivers/pinctrl/berlin/berlin4ct.c line 196
Quoted 3 lines
drivers/pinctrl/berlin/berlin4ct.c new file +3
-0+ BERLIN_PINCTRL_GROUP("SCRD0_RST", 0xc, 0x3, 0x06, + BERLIN_PINCTRL_FUNCTION(0x0, "gpio15"), + BERLIN_PINCTRL_FUNCTION(0x1, "scrd0_rst"),ditto for "scrd0"
scrd stands for smartcard. But it's what HW/ASIC call them
Quoted 9 lines
drivers/pinctrl/berlin/berlin4ct.c line 201
Quoted 6 lines
drivers/pinctrl/berlin/berlin4ct.c new file +5
-0+ BERLIN_PINCTRL_FUNCTION(0x3, "sd1a_clk")), +BERLIN_PINCTRL_GROUP ("SCRD0_DCLK" ,0xc ,0x3 ,0x09 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"gpio16" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"scrd0_dclk" ), + BERLIN_PINCTRL_FUNCTION(0x3, "sd1a_cmd")),What is the "a" for in "sd1a" ? There is a "sd1b" below so I guess that there is two pinmux groups that mux sd1?
Yes, correct.
Quoted 7 lines
drivers/pinctrl/berlin/berlin4ct.c line 205
Quoted 5 lines
drivers/pinctrl/berlin/berlin4ct.c new file +4
-0+ BERLIN_PINCTRL_GROUP("SCRD0_GPIO0", 0xc, 0x3, 0x0c, + BERLIN_PINCTRL_FUNCTION(0x0, "gpio17"), + BERLIN_PINCTRL_FUNCTION(0x1, "scrd0_gpio0"), + BERLIN_PINCTRL_FUNCTION(0x2, "sif_dio"),What kind of interface is "sif" ?
serial interface, ASIC called it as SIF
Quoted 20 lines
Quoted 2 lines
drivers/pinctrl/berlin/berlin4ct.c new file +1
-0+ BERLIN_PINCTRL_FUNCTION(0x3, "sd1a_dat0")),[...]
Quoted 16 lines
drivers/pinctrl/berlin/berlin4ct.c new file +16
-0+static const struct berlin_desc_group berlin4ct_soc_aviopinctrl_groups[] = { +BERLIN_PINCTRL_GROUP ("TX_EDDC_SCL" ,0x0 ,0x3 ,0x00 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"avio_gpio0" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"tx_eddc_scl" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"tw1_scl" )), +BERLIN_PINCTRL_GROUP ("TX_EDDC_SDA" ,0x0 ,0x3 ,0x03 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"avio_gpio1" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"tx_eddc_sda" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"tw1_sda" )), +BERLIN_PINCTRL_GROUP ("I2S1_LRCKO" ,0x0 ,0x3 ,0x06 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"avio_gpio2" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"i2s1_lrcko" ), +BERLIN_PINCTRL_FUNCTION (0x3 ,"sts6_clk" ), +BERLIN_PINCTRL_FUNCTION (0x4 ,"adac_dbg0" ), +BERLIN_PINCTRL_FUNCTION (0x6 ,"sd1b_clk" ), +BERLIN_PINCTRL_FUNCTION (0x7 ,"avio_dbg0" )),[...]
Quoted 7 lines
drivers/pinctrl/berlin/berlin4ct.c line 345
Quoted 4 lines
drivers/pinctrl/berlin/berlin4ct.c new file +4
-0+static const struct berlin_desc_group berlin4ct_sysmgr_pinctrl_groups[] = { +BERLIN_PINCTRL_GROUP ("SM_TW2_SCL" ,0x0 ,0x3 ,0x00 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio19" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_tw2_scl" )),I'd say, remove the "
sm_" prefix for all of the SM functions if there is no collusion with any of the other functions.
Could I keep "sm_" prefix for SM GPIOs?
Quoted 14 lines
drivers/pinctrl/berlin/berlin4ct.c line 356
Quoted 12 lines
drivers/pinctrl/berlin/berlin4ct.c new file +11
-0+BERLIN_PINCTRL_GROUP ("SM_TW2_SDA" ,0x0 ,0x3 ,0x03 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio20" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_tw2_sda" )), +BERLIN_PINCTRL_GROUP ("SM_TW3_SCL" ,0x0 ,0x3 ,0x06 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio21" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_tw3_scl" )), +BERLIN_PINCTRL_GROUP ("SM_TW3_SDA" ,0x0 ,0x3 ,0x09 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio22" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_tw3_sda" )), + BERLIN_PINCTRL_GROUP("SM_TMS", 0x0, 0x3, 0x0c, + BERLIN_PINCTRL_FUNCTION(0x0, "sm_tms"),Please use function "jtag" instead.
OK. So I also need to name "jtag" in below sm_tdi, sm_sdo, right?
Quoted 17 lines
drivers/pinctrl/berlin/berlin4ct.c line 367
Quoted 12 lines
drivers/pinctrl/berlin/berlin4ct.c new file +11
-0+ BERLIN_PINCTRL_FUNCTION(0x1, "sm_gpio0"), + BERLIN_PINCTRL_FUNCTION(0x2, "pwm0")), +BERLIN_PINCTRL_GROUP ("SM_TDI" ,0x0 ,0x3 ,0x0f , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_tdi" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_gpio1" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"pwm1" )), +BERLIN_PINCTRL_GROUP ("SM_TDO" ,0x0 ,0x3 ,0x12 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_tdo" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_gpio2" )), + BERLIN_PINCTRL_GROUP("SM_URT0_TXD", 0x0, 0x3, 0x15, + BERLIN_PINCTRL_FUNCTION(0x0, "sm_urt0_txd"),Please avoid abbreviating acronyms even more, we can afford the few extra bytes.
[...]
Quoted 9 lines
drivers/pinctrl/berlin/berlin4ct.c line 378
Quoted 7 lines
drivers/pinctrl/berlin/berlin4ct.c new file +7
-0+BERLIN_PINCTRL_GROUP ("SM_URT1_TXD" ,0x0 ,0x3 ,0x1b , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_gpio5" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_urt1_txd" ), +BERLIN_PINCTRL_FUNCTION (0x2 ,"eth1_rxclk" ), +BERLIN_PINCTRL_FUNCTION (0x3 ,"pwm2" ), +BERLIN_PINCTRL_FUNCTION (0x4 ,"sm_timer0" ), + BERLIN_PINCTRL_FUNCTION(0x5, "clk_25m")),"clko" ?
This is for 25m clk output. but ASIC calls this clk_25m, there's no "o".
Quoted 48 lines
Sebastian
[...]
Quoted 43 lines
drivers/pinctrl/berlin/berlin4ct.c new file +42
-0+static int berlin4ct_pinctrl_probe (struct platform_device *pdev) +{ +const struct of_device_id *match = +of_match_device (berlin4ct_pinctrl_match, &pdev->dev); +struct regmap_config *rmconfig; +struct regmap *regmap; +struct resource *res; +void __iomem *base; + + rmconfig =devm_kzalloc (&pdev->dev,sizeof (*rmconfig),GFP_KERNEL ); +if (!rmconfig) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (base)) +return PTR_ERR (base); + + rmconfig->reg_bits =32 , + rmconfig->val_bits =32 , + rmconfig->reg_stride =4 , + rmconfig->max_register =resource_size (res); + + regmap =devm_regmap_init_mmio (&pdev->dev, base, rmconfig); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +return berlin_pinctrl_probe (pdev, regmap, match->data); +} + +static struct platform_driver berlin4ct_pinctrl_driver = { + .probe = berlin4ct_pinctrl_probe, + .driver = { + .name ="berlin4ct-pinctrl" , + .of_match_table = berlin4ct_pinctrl_match, + }, +}; +module_platform_driver (berlin4ct_pinctrl_driver); + +MODULE_AUTHOR ("Jisheng Zhang <[email protected]>" ); +MODULE_DESCRIPTION ("Marvell berlin4ct pinctrl driver" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH 2/5] pinctrl: berlin: add the berlin4ct pinctrl driver
In reply to Sebastian HesselbarthDear Sebastian,
Quoted 8 lines · On Sun, 20 Sep 2015 21:32:37 +0200 Sebastian Hesselbarth…
drivers/pinctrl/berlin/berlin4ct.c line 367
Quoted 5 lines
drivers/pinctrl/berlin/berlin4ct.c new file +5
-0+BERLIN_PINCTRL_GROUP ("SM_TDO" ,0x0 ,0x3 ,0x12 , +BERLIN_PINCTRL_FUNCTION (0x0 ,"sm_tdo" ), +BERLIN_PINCTRL_FUNCTION (0x1 ,"sm_gpio2" )), + BERLIN_PINCTRL_GROUP("SM_URT0_TXD", 0x0, 0x3, 0x15, + BERLIN_PINCTRL_FUNCTION(0x0, "sm_urt0_txd"),Please avoid abbreviating acronyms even more, we can afford the few extra bytes.
In the 2nd version, I kept using HW names, for example:
1. "urt0" as the function name,
2. "SM_URT0_TXD" as the pin name (group name)
to keep sync with HW, especially the pin names are the same as HW's, because that's what HW doc, sch, etc. call them. IMHO, using a different name with HW is not a good idea, what do you think?
Thanks,
Jisheng
PATCH 3/5 arm64: berlin: add the pinctrl dependency for Marvell Berlin SoCs
In reply to Jisheng ZhangThis is to add the pinctrl dependency for Marvell Berlin SoCs.
--- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Kconfig.platforms +1 -0
@@ -9,6 +9,7 @@ config ARCH_BERLIN bool "Marvell Berlin SoC Family" select ARCH_REQUIRE_GPIOLIB select DW_APB_ICTL + select PINCTRL help This enables support for Marvell Berlin SoC Family
Signature · 1 line
2.5.1
PATCH 4/5 pinctrl: dt-binding: document berlin4ct SoC
In reply to Jisheng ZhangAdd berlin4ct to existing berlin pinctrl device tree binding.
--- Documentation/devicetree/bindings/pinctrl/berlin,pinctrl.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/pinctrl/berlin,pinctrl.txt +4 -1
@@ -20,7 +20,10 @@ Required properties: "marvell,berlin2cd-soc-pinctrl", "marvell,berlin2cd-system-pinctrl", "marvell,berlin2q-soc-pinctrl", - "marvell,berlin2q-system-pinctrl" + "marvell,berlin2q-system-pinctrl", + "marvell,berlin4ct-avio-pinctrl", + "marvell,berlin4ct-sm-pinctrl", + "marvell,berlin4ct-soc-pinctrl" Required subnode-properties: - groups: a list of strings describing the group names.
Signature · 1 line
2.5.1
PATCH 5/5 arm64: dts: berlin4ct: add the pinctrl node and muxing setup for uart0
In reply to Jisheng ZhangAdd the avio, soc, sm pinctrl nodes for Marvell berlin4ct SoC. This patch also adds urt0 txd and rxd muxing setup in the dtsi because uart0 always use them to work, no other possibilities.
--- arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +27 -0
@@ -225,6 +225,16 @@ }; }; + soc_pinctrl: pinctrl at ea8000 { + compatible = "marvell,berlin4ct-soc-pinctrl"; + reg = <0xea8000 0x14>; + }; + + avio_pinctrl: pinctrl at ea8400 { + compatible = "marvell,berlin4ct-avio-pinctrl"; + reg = <0xea8400 8>; + }; + apb at fc0000 { compatible = "simple-bus"; #address-cells = <1>;
@@ -278,6 +288,23 @@ clocks = <&osc>; reg-shift = <2>; status = "disabled"; + pinctrl-0 = <&urt0_txd_pmux>, <&urt0_rxd_pmux>; + pinctrl-names = "default", "default"; + }; + }; + + sm_pinctrl: pinctrl at fe2200 { + compatible = "marvell,berlin4ct-sm-pinctrl"; + reg = <0xfe2200 0xc>; + + urt0_txd_pmux: urt0_txd-pmux { + groups = "SM_URT0_TXD"; + function = "sm_urt0_txd"; + }; + + urt0_rxd_pmux: urt0_rxd-pmux { + groups = "SM_URT0_RXD"; + function = "sm_urt0_rxd"; }; }; };
Signature · 1 line
2.5.1
Sebastian Hesselbarth
maintainerRe: [PATCH 5/5] arm64: dts: berlin4ct: add the pinctrl node and muxing setup for uart0
Quoted 3 lines · Jisheng Zhang
Add the avio, soc, sm pinctrl nodes for Marvell berlin4ct SoC. This patch also adds urt0 txd and rxd muxing setup in the dtsi because uart0 always use them to work, no other possibilities.
Please split the patch into two:
one adding the pinctrl nodes and
one adding the default pinmux to uart0 node.
Quoted 11 lines
Signed-off-by Jisheng Zhang <[email protected]>--- arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)arch/arm64/boot/dts/marvell/berlin4ct.dtsi +0
-0@@ -225,6 +225,16 @@ };
arch/arm64/boot/dts/marvell/berlin4ct.dtsi line 235
Quoted 10 lines
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +8
-0}; + soc_pinctrl: pinctrl at ea8000 { + compatible = "marvell,berlin4ct-soc-pinctrl"; + reg = <0xea8000 0x14>; + }; + + avio_pinctrl: pinctrl at ea8400 { + compatible = "marvell,berlin4ct-avio-pinctrl"; + reg = <0xea8400 8>;
s/8/0x8/
arch/arm64/boot/dts/marvell/berlin4ct.dtsi line 292
Quoted 11 lines
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +4
-0+ }; + apb at fc0000 { compatible = "simple-bus"; #address-cells = <1>;@@ -278,6 +288,23 @@ clocks = <&osc>; reg-shift = <2>; status = "disabled"; + pinctrl-0 = <&urt0_txd_pmux>, <&urt0_rxd_pmux>; + pinctrl-names = "default", "default";
pinctrl-names = "default", "default"; refers to pinctrl-0 and pinctrl-1 respectively. There is no pinctrl-1, so please remove the second pinctrl-names element.
Quoted 5 lines
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +5
-0+ }; + }; + + sm_pinctrl: pinctrl at fe2200 { + compatible = "marvell,berlin4ct-sm-pinctrl";
arch/arm64/boot/dts/marvell/berlin4ct.dtsi line 307
Quoted 10 lines
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +10
-0+ reg = <0xfe2200 0xc>; + + urt0_txd_pmux: urt0_txd-pmux { + groups = "SM_URT0_TXD"; + function = "sm_urt0_txd"; + }; + + urt0_rxd_pmux: urt0_rxd-pmux { + groups = "SM_URT0_RXD"; + function = "sm_urt0_rxd";
If you change the driver to generic function names ("uart0") this boils down to a single
uart0_pmux: uart0-pmux {
groups = "SM_UART0_TXD", "SM_UART0_RXD";
function = "uart0";
};pinmux node and the reference in uart0 node to
pinctrl-0 = <&uart0_pmux>;
pinctrl-names = "default";
Sebastian
Quoted 4 lines
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +0
-0}; }; };