arm64: berlin: add pinctrl support
Subsystems (5)
v4 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.
Since v3:
- fix stupid build error: I missed local changes to berlin-bg4ct.c
Since v2:
- introduce new berlin_pinctrl_probe_regmap() to avoid duplicated code
- renaming such as s/urt/uart etc. but keep the group name as URT* to keep consistent with HW/ASIC
Since v1:
- use generic name for pin functions
- a new commit to add pinmux for uart0
- correct pinctrl usage in dts
Jisheng Zhang (6):
pinctrl: berlin: introduce berlin_pinctrl_probe_regmap()
pinctrl: berlin: add the berlin4ct pinctrl driver
arm64: berlin: add the pinctrl dependency for Marvell Berlin SoCs
pinctrl: dt-binding: document berlin4ct SoC pinctrl
arm64: dts: berlin4ct: add the pinctrl node
arm64: dts: berlin4ct: add default pinmux for uart0
.../devicetree/bindings/pinctrl/berlin,pinctrl.txt | 5 +- arch/arm64/Kconfig.platforms | 1 + arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 22 + drivers/pinctrl/berlin/Kconfig | 5 + drivers/pinctrl/berlin/Makefile | 1 + drivers/pinctrl/berlin/berlin-bg4ct.c | 503 +++++++++++++++++++++ drivers/pinctrl/berlin/berlin.c | 26 +- drivers/pinctrl/berlin/berlin.h | 4 + 8 files changed, 557 insertions(+), 10 deletions(-) create mode 100644 drivers/pinctrl/berlin/berlin-bg4ct.c
Signature · 1 line
2.6.1
PATCH v4 1/6 pinctrl: berlin: introduce berlin_pinctrl_probe_regmap()
This is to prepare for the next berlin4ct support, where we won't use simple-mfd any more.
--- drivers/pinctrl/berlin/berlin.c | 26 +++++++++++++++++--------- drivers/pinctrl/berlin/berlin.h | 4 ++++ 2 files changed, 21 insertions(+), 9 deletions(-)
drivers/pinctrl/berlin/berlin.c +17 -9
@@ -292,20 +292,14 @@ static struct pinctrl_desc berlin_pctrl_desc = { .owner = THIS_MODULE, }; -int berlin_pinctrl_probe (struct platform_device *pdev, -const struct berlin_pinctrl_desc *desc) +int berlin_pinctrl_probe_regmap (struct platform_device *pdev, +const struct berlin_pinctrl_desc *desc, +struct regmap *regmap) {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 ;
@@ -330,3 +324,17 @@ int berlin_pinctrl_probe(struct platform_device *pdev,return 0 ; } + +int berlin_pinctrl_probe (struct platform_device *pdev, +const struct berlin_pinctrl_desc *desc) +{ +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); + +of_node_put (parent_np); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +return berlin_pinctrl_probe_regmap (pdev, desc, regmap); +}
drivers/pinctrl/berlin/berlin.h +4 -0
@@ -58,4 +58,8 @@ struct berlin_pinctrl_function {int berlin_pinctrl_probe (struct platform_device *pdev,const struct berlin_pinctrl_desc *desc); +int berlin_pinctrl_probe_regmap (struct platform_device *pdev, +const struct berlin_pinctrl_desc *desc, +struct regmap *regmap); +#endif /* __PINCTRL_BERLIN_H */
Signature · 1 line
2.6.1
Re: [PATCH v4 1/6] pinctrl: berlin: introduce berlin_pinctrl_probe_regmap()
Quoted 4 lines · Jisheng Zhang
This is to prepare for the next berlin4ct support, where we won't use simple-mfd any more.
Signed-off-by Jisheng Zhang <[email protected]>
Quoted 67 lines
--- drivers/pinctrl/berlin/berlin.c | 26 +++++++++++++++++--------- drivers/pinctrl/berlin/berlin.h | 4 ++++ 2 files changed, 21 insertions(+), 9 deletions(-)drivers/pinctrl/berlin/berlin.c +17
-9@@ -292,20 +292,14 @@ static struct pinctrl_desc berlin_pctrl_desc = { .owner = THIS_MODULE, }; -int berlin_pinctrl_probe (struct platform_device *pdev, -const struct berlin_pinctrl_desc *desc) +int berlin_pinctrl_probe_regmap (struct platform_device *pdev, +const struct berlin_pinctrl_desc *desc, +struct regmap *regmap) {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 ;@@ -330,3 +324,17 @@ int berlin_pinctrl_probe(struct platform_device *pdev,return 0 ; } + +int berlin_pinctrl_probe (struct platform_device *pdev, +const struct berlin_pinctrl_desc *desc) +{ +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); + +of_node_put (parent_np); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +return berlin_pinctrl_probe_regmap (pdev, desc, regmap); +}drivers/pinctrl/berlin/berlin.h +4
-0@@ -58,4 +58,8 @@ struct berlin_pinctrl_function {int berlin_pinctrl_probe (struct platform_device *pdev,const struct berlin_pinctrl_desc *desc); +int berlin_pinctrl_probe_regmap (struct platform_device *pdev, +const struct berlin_pinctrl_desc *desc, +struct regmap *regmap); +#endif /* __PINCTRL_BERLIN_H */ Signature · 1 line
2.6.1
Signature · 3 lines
Antoine T?nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v4 2/6 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/berlin-bg4ct.c | 503 ++++++++++++++++++++++++++++++++++ 3 files changed, 509 insertions(+) create mode 100644 drivers/pinctrl/berlin/berlin-bg4ct.c
drivers/pinctrl/berlin/Kconfig +5 -0
@@ -17,4 +17,9 @@ config PINCTRL_BERLIN_BG2Q bool select PINCTRL_BERLIN +config PINCTRL_BERLIN_BG4CT + 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_BERLIN_BG4CT) += berlin-bg4ct.o
drivers/pinctrl/berlin/berlin-bg4ct.c new file +503 -0
503 lines not on this page · raw message
Signature · 1 line
2.6.1
Re: [PATCH v4 2/6] pinctrl: berlin: add the berlin4ct pinctrl driver
Hi Jisheng,
Quoted 5 lines · Jisheng Zhang
drivers/pinctrl/berlin/Kconfig +0
-0
drivers/pinctrl/berlin/Kconfig config PINCTRL_BERLIN_BG2Q · line 25
Quoted 9 lines
drivers/pinctrl/berlin/Kconfig +5
-0@@ -17,4 +17,9 @@ config PINCTRL_BERLIN_BG2Q bool select PINCTRL_BERLIN +config PINCTRL_BERLIN_BG4CT + depends on OF && (ARCH_BERLIN || COMPILE_TEST) + bool "Marvell berlin4ct pin controller driver" + select PINCTRL_BERLIN + endif
This endif ends the following condition:
if ARCH_BERLIN [...]
So the "depends on ARCH_BERLIN" here can be dropped. Also the COMPILE_TEST can be moved as it isn't BG4CT specific and all other Berlin pinctrl drivers would benefit from this.
So we would have something like:
if (ARCH_BERLIN || COMPILE_TEST) [...] endif
Finally you can move the OF dependency to the PINCTRL_BERLIN config as all Berlin pinctrl drivers depends on it.
Thanks!
Antoine
Signature · 3 lines
Antoine T?nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Re: [PATCH v4 2/6] pinctrl: berlin: add the berlin4ct pinctrl driver
Hi Antoine,
Quoted 23 lines · On Fri, 9 Oct 2015 11:03:53 +0200 Antoine Tenart…
Hi Jisheng,
Quoted 5 lines · Jisheng Zhang
drivers/pinctrl/berlin/Kconfig +0
-0drivers/pinctrl/berlin/Kconfig config PINCTRL_BERLIN_BG2Q · line 25
Quoted 9 lines
drivers/pinctrl/berlin/Kconfig +5
-0@@ -17,4 +17,9 @@ config PINCTRL_BERLIN_BG2Q bool select PINCTRL_BERLIN +config PINCTRL_BERLIN_BG4CT + depends on OF && (ARCH_BERLIN || COMPILE_TEST) + bool "Marvell berlin4ct pin controller driver" + select PINCTRL_BERLIN + endifThis endif ends the following condition:
if ARCH_BERLIN [...]
Quoted 7 lines
So the "depends on
ARCH_BERLIN" here can be dropped. Also theCOMPILE_TESTcan be moved as it isn't BG4CT specific and all other Berlin pinctrl drivers would benefit from this.So we would have something like:
if (ARCH_BERLIN || COMPILE_TEST)
Oh yeah! This is better.
Quoted 5 lines
[...] endifFinally you can move the OF dependency to the
PINCTRL_BERLINconfig as all Berlin pinctrl drivers depends on it.
PINCTRL_BERLIN isn't user visible and it's selected by PINCTRL_BERLIN_BG4CT. So we may have the following random config case:
CONFIG_OF=nCONFIG_PINCTRL_BERLIN_BG4CT=y
In this case, there will be build errors for we missed OF. So we have to make PINCTRL_BERLIN_BG4CT depends on OF. What do you think? Or is there better solution?
Thanks for kind review,
Jisheng
Quoted 5 lines
Thanks!
Antoine
Re: [PATCH v4 2/6] pinctrl: berlin: add the berlin4ct pinctrl driver
Hi Jisheng,
Quoted 9 lines · Jisheng Zhang
Quoted 3 lines · On Fri, 9 Oct 2015 11:03:53 +0200 Antoine Tenart…
Finally you can move the OF dependency to the
PINCTRL_BERLINconfig as all Berlin pinctrl drivers depends on it.
PINCTRL_BERLINisn't user visible and it's selected byPINCTRL_BERLIN_BG4CT. So we may have the following random config case:
Quoted 6 lines
CONFIG_OF=nCONFIG_PINCTRL_BERLIN_BG4CT=yIn this case, there will be build errors for we missed OF. So we have to make
PINCTRL_BERLIN_BG4CTdepends on OF. What do you think? Or is there better solution?
That's true.
But because other Berlin pinctrl drivers also depends on CONFIG_OF, we need to make then depend on it too. This isn't the topic of this series so I'll send a separate patch later.
Antoine
Signature · 3 lines
Antoine T?nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v4 3/6 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.6.1
Re: [PATCH v4 3/6] arm64: berlin: add the pinctrl dependency for Marvell Berlin SoCs
Quoted 3 lines · Jisheng Zhang
This is to add the pinctrl dependency for Marvell Berlin SoCs.
Signed-off-by Jisheng Zhang <[email protected]>
Quoted 19 lines
--- 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 FamilySignature · 1 line
2.6.1
Signature · 3 lines
Antoine T?nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v4 4/6 pinctrl: dt-binding: document berlin4ct SoC pinctrl
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-soc-pinctrl", + "marvell,berlin4ct-system-pinctrl" Required subnode-properties: - groups: a list of strings describing the group names.
Signature · 1 line
2.6.1
Re: [PATCH v4 4/6] pinctrl: dt-binding: document berlin4ct SoC pinctrl
Quoted 3 lines · Jisheng Zhang
Add berlin4ct to existing berlin pinctrl device tree binding.
Signed-off-by Jisheng Zhang <[email protected]>
Quoted 23 lines
--- 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-soc-pinctrl", + "marvell,berlin4ct-system-pinctrl" Required subnode-properties: - groups: a list of strings describing the group names.Signature · 1 line
2.6.1
Signature · 3 lines
Antoine T?nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v4 5/6 arm64: dts: berlin4ct: add the pinctrl node
In reply to Jisheng ZhangAdd the avio, soc, sm pinctrl nodes for Marvell berlin4ct SoC.
--- arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +15 -0
@@ -225,6 +225,16 @@ }; }; + soc_pinctrl: pin-controller at ea8000 { + compatible = "marvell,berlin4ct-soc-pinctrl"; + reg = <0xea8000 0x14>; + }; + + avio_pinctrl: pin-controller at ea8400 { + compatible = "marvell,berlin4ct-avio-pinctrl"; + reg = <0xea8400 0x8>; + }; + apb at fc0000 { compatible = "simple-bus"; #address-cells = <1>;
@@ -280,5 +290,10 @@ status = "disabled"; }; }; + + system_pinctrl: pin-controller at fe2200 { + compatible = "marvell,berlin4ct-system-pinctrl"; + reg = <0xfe2200 0xc>; + }; }; };
Signature · 1 line
2.6.1
Re: [PATCH v4 5/6] arm64: dts: berlin4ct: add the pinctrl node
Quoted 3 lines · Jisheng Zhang
Add the avio, soc, sm pinctrl nodes for Marvell berlin4ct SoC.
Signed-off-by Jisheng Zhang <[email protected]>
Quoted 39 lines
--- arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)arch/arm64/boot/dts/marvell/berlin4ct.dtsi +15
-0@@ -225,6 +225,16 @@ }; }; + soc_pinctrl: pin-controller at ea8000 { + compatible = "marvell,berlin4ct-soc-pinctrl"; + reg = <0xea8000 0x14>; + }; + + avio_pinctrl: pin-controller at ea8400 { + compatible = "marvell,berlin4ct-avio-pinctrl"; + reg = <0xea8400 0x8>; + }; + apb at fc0000 { compatible = "simple-bus"; #address-cells = <1>;@@ -280,5 +290,10 @@ status = "disabled"; }; }; + + system_pinctrl: pin-controller at fe2200 { + compatible = "marvell,berlin4ct-system-pinctrl"; + reg = <0xfe2200 0xc>; + }; }; };Signature · 1 line
2.6.1
Signature · 3 lines
Antoine T?nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v4 6/6 arm64: dts: berlin4ct: add default pinmux for uart0
In reply to Jisheng ZhangAdd urt0 txd and rxd muxing setup in the dtsi because uart0 always uses them to work, no other possibilities.
--- arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +7 -0
@@ -288,12 +288,19 @@ clocks = <&osc>; reg-shift = <2>; status = "disabled"; + pinctrl-0 = <&uart0_pmux>; + pinctrl-names = "default"; }; }; system_pinctrl: pin-controller at fe2200 { compatible = "marvell,berlin4ct-system-pinctrl"; reg = <0xfe2200 0xc>; + + uart0_pmux: uart0-pmux { + groups = "SM_URT0_TXD", "SM_URT0_RXD"; + function = "uart0"; + }; }; }; };
Signature · 1 line
2.6.1
Re: [PATCH v4 6/6] arm64: dts: berlin4ct: add default pinmux for uart0
Quoted 4 lines · Jisheng Zhang
Add urt0 txd and rxd muxing setup in the dtsi because uart0 always uses them to work, no other possibilities.
Signed-off-by Jisheng Zhang <[email protected]>
Quoted 36 lines
--- arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm64/boot/dts/marvell/berlin4ct.dtsi +7
-0@@ -288,12 +288,19 @@ clocks = <&osc>; reg-shift = <2>; status = "disabled"; + pinctrl-0 = <&uart0_pmux>; + pinctrl-names = "default"; }; }; system_pinctrl: pin-controller at fe2200 { compatible = "marvell,berlin4ct-system-pinctrl"; reg = <0xfe2200 0xc>; + + uart0_pmux: uart0-pmux { + groups = "SM_URT0_TXD", "SM_URT0_RXD"; + function = "uart0"; + }; }; }; };Signature · 7 lines
2.6.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
Antoine T?nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com