Amlogic Meson pinctrl driver for u-boot
Subsystems (7)
cover Amlogic Meson pinctrl driver for u-boot
Hi,
these patches add a pinctrl driver for Meson GXBB and enable Ethernet support through the device tree.
Beniamino Galvani (4):
pinctrl: generic: scan for "pins" and "groups" properties in sub-nodes
arm: dts: update DTS files for meson-gxbb and odroid-c2
pinctrl: add driver for meson-gxbb pin controller
meson: odroid-c2: enable Ethernet support through the device tree
arch/arm/dts/meson-gxbb-odroidc2.dts | 19 + arch/arm/dts/meson-gxbb.dtsi | 170 +++++++- arch/arm/include/asm/arch-meson/gxbb.h | 3 - board/amlogic/odroid-c2/odroid-c2.c | 13 - configs/odroid-c2_defconfig | 3 + drivers/net/designware.c | 1 + drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/meson/Kconfig | 11 + drivers/pinctrl/meson/Makefile | 6 + drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 432 +++++++++++++++++++++ drivers/pinctrl/meson/pinctrl-meson.c | 179 +++++++++ drivers/pinctrl/meson/pinctrl-meson.h | 74 ++++ drivers/pinctrl/pinctrl-generic.c | 6 +- include/dt-bindings/gpio/meson-gxbb-gpio.h | 154 ++++++++ .../dt-bindings/reset/amlogic,meson-gxbb-reset.h | 210 ++++++++++ 16 files changed, 1264 insertions(+), 19 deletions(-) create mode 100644 drivers/pinctrl/meson/Kconfig create mode 100644 drivers/pinctrl/meson/Makefile create mode 100644 drivers/pinctrl/meson/pinctrl-meson-gxbb.c create mode 100644 drivers/pinctrl/meson/pinctrl-meson.c create mode 100644 drivers/pinctrl/meson/pinctrl-meson.h create mode 100644 include/dt-bindings/gpio/meson-gxbb-gpio.h create mode 100644 include/dt-bindings/reset/amlogic,meson-gxbb-reset.h
Signature · 1 line
2.7.4
PATCH 1/4 pinctrl: generic: scan for "pins" and "groups" properties in sub-nodes
In cases where the pins and groups definitions are in a sub-node, as:
uart_a {
mux {
groups = "uart_tx_a", "uart_rx_a";
function = "uart_a";
};
};pinctrl_generic_set_state_subnode() returns an error for the top-level node and pinctrl_generic_set_state() fails. Instead, return success so that the child nodes are tried.
--- drivers/pinctrl/pinctrl-generic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-generic.c +4 -2
@@ -312,8 +312,10 @@ static int pinctrl_generic_set_state_subnode(struct udevice *dev, is_group = true; strings_count =fdt_count_strings (fdt, node, subnode_target_type); -if (strings_count <0 ) -return -EINVAL ; +if (strings_count <0 ) { +/* skip this node; may contain config child nodes */ +return 0 ; + } }for (i =0 ; i < strings_count; i++) {
Signature · 1 line
2.7.4
PATCH 1/4 pinctrl: generic: scan for "pins" and "groups" properties in sub-nodes
Quoted 9 lines · Beniamino Galvani
In cases where the pins and groups definitions are in a sub-node, as:
uart_a { mux { groups = "uart_tx_a", "uart_rx_a"; function = "uart_a"; }; };
Quoted 8 lines
pinctrl_generic_set_state_subnode()returns an error for the top-level node andpinctrl_generic_set_state()fails. Instead, return success so that the child nodes are tried.Signed-off-by Beniamino Galvani <[email protected]>--- drivers/pinctrl/pinctrl-generic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Masahiro, are you happy with this change?
We really need some pinctrl tests.
Quoted 19 lines
drivers/pinctrl/pinctrl-generic.c +4
-3@@ -312,8 +312,10 @@ static int pinctrl_generic_set_state_subnode(struct udevice *dev, is_group = true; strings_count =fdt_count_strings (fdt, node, subnode_target_type); -if (strings_count <0 ) -return -EINVAL ; +if (strings_count <0 ) { +/* skip this node; may contain config child nodes */ +return 0 ; + } }for (i =0 ; i < strings_count; i++) { --
Quoted 2 lines
2.7.4
Regards,
Simon
PATCH 1/4 pinctrl: generic: scan for "pins" and "groups" properties in sub-nodes
In reply to Beniamino Galvani2016-08-16 18:49 GMT+09:00 Beniamino Galvani <[email protected]>:
Quoted 9 lines
In cases where the pins and groups definitions are in a sub-node, as:
uart_a { mux { groups = "uart_tx_a", "uart_rx_a"; function = "uart_a"; }; };
Quoted 6 lines
pinctrl_generic_set_state_subnode()returns an error for the top-level node andpinctrl_generic_set_state()fails. Instead, return success so that the child nodes are tried.Signed-off-by Beniamino Galvani <[email protected]>---
Looks good to me. Thanks!
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/4 pinctrl: generic: scan for "pins" and "groups" properties in sub-nodes
In reply to Beniamino GalvaniQuoted 9 lines · Beniamino Galvani
In cases where the pins and groups definitions are in a sub-node, as:
uart_a { mux { groups = "uart_tx_a", "uart_rx_a"; function = "uart_a"; }; };
Quoted 7 lines
pinctrl_generic_set_state_subnode()returns an error for the top-level node andpinctrl_generic_set_state()fails. Instead, return success so that the child nodes are tried.Signed-off-by Beniamino Galvani <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160907/07d357f4/attachment.sig>
PATCH 2/4 arm: dts: update DTS files for meson-gxbb and odroid-c2
In reply to Beniamino GalvaniImport DTS files and dt-bindings includes from Linux 4.8-rc1.
--- arch/arm/dts/meson-gxbb-odroidc2.dts | 19 ++ arch/arm/dts/meson-gxbb.dtsi | 170 ++++++++++++++++- include/dt-bindings/gpio/meson-gxbb-gpio.h | 154 +++++++++++++++ .../dt-bindings/reset/amlogic,meson-gxbb-reset.h | 210 +++++++++++++++++++++ 4 files changed, 552 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/gpio/meson-gxbb-gpio.h create mode 100644 include/dt-bindings/reset/amlogic,meson-gxbb-reset.h
arch/arm/dts/meson-gxbb-odroidc2.dts +19 -0
@@ -45,6 +45,7 @@ /dts-v1/; #include "meson-gxbb.dtsi" +#include <dt-bindings/gpio/gpio.h> / { compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
@@ -62,8 +63,26 @@ device_type = "memory"; reg = <0x0 0x0 0x0 0x80000000>; }; + + leds { + compatible = "gpio-leds"; + blue { + label = "c2:blue:alive"; + gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + default-state = "off"; + }; + }; }; &uart_AO { status = "okay"; + pinctrl-0 = <&uart_ao_a_pins>; + pinctrl-names = "default"; +}; + +ðmac { + status = "okay"; + pinctrl-0 = <ð_pins>; + pinctrl-names = "default"; };
arch/arm/dts/meson-gxbb.dtsi +169 -1
205 lines not on this page · raw message
include/dt-bindings/gpio/meson-gxbb-gpio.h new file +154 -0
154 lines not on this page · raw message
include/dt-bindings/reset/amlogic,meson-gxbb-reset.h new file +210 -0
210 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 2/4 arm: dts: update DTS files for meson-gxbb and odroid-c2
Quoted 11 lines · Beniamino Galvani
Import DTS files and dt-bindings includes from Linux 4.8-rc1.
Signed-off-by Beniamino Galvani <[email protected]>--- arch/arm/dts/meson-gxbb-odroidc2.dts | 19 ++ arch/arm/dts/meson-gxbb.dtsi | 170 ++++++++++++++++- include/dt-bindings/gpio/meson-gxbb-gpio.h | 154 +++++++++++++++ .../dt-bindings/reset/amlogic,meson-gxbb-reset.h | 210 +++++++++++++++++++++ 4 files changed, 552 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/gpio/meson-gxbb-gpio.h create mode 100644 include/dt-bindings/reset/amlogic,meson-gxbb-reset.h
PATCH 2/4 arm: dts: update DTS files for meson-gxbb and odroid-c2
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Import DTS files and dt-bindings includes from Linux 4.8-rc1.
Signed-off-by Beniamino Galvani <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160907/66bb9740/attachment.sig>
PATCH 3/4 pinctrl: add driver for meson-gxbb pin controller
In reply to Beniamino GalvaniAdd a pin controller driver for Meson GXBB adapted from Linux kernel.
--- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/meson/Kconfig | 11 + drivers/pinctrl/meson/Makefile | 6 + drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 432 +++++++++++++++++++++++++++++ drivers/pinctrl/meson/pinctrl-meson.c | 179 ++++++++++++ drivers/pinctrl/meson/pinctrl-meson.h | 74 +++++ 7 files changed, 704 insertions(+) create mode 100644 drivers/pinctrl/meson/Kconfig create mode 100644 drivers/pinctrl/meson/Makefile create mode 100644 drivers/pinctrl/meson/pinctrl-meson-gxbb.c create mode 100644 drivers/pinctrl/meson/pinctrl-meson.c create mode 100644 drivers/pinctrl/meson/pinctrl-meson.h
drivers/pinctrl/Kconfig +1 -0
@@ -161,6 +161,7 @@ config PIC32_PINCTRL endif +source "drivers/pinctrl/meson/Kconfig" source "drivers/pinctrl/nxp/Kconfig" source "drivers/pinctrl/uniphier/Kconfig" source "drivers/pinctrl/exynos/Kconfig"
drivers/pinctrl/Makefile +1 -0
@@ -13,3 +13,4 @@ obj-$(CONFIG_PINCTRL_SANDBOX) += pinctrl-sandbox.o obj-$(CONFIG_PINCTRL_UNIPHIER) += uniphier/ obj-$(CONFIG_PIC32_PINCTRL) += pinctrl_pic32.o obj-$(CONFIG_PINCTRL_EXYNOS) += exynos/ +obj-$(CONFIG_PINCTRL_MESON) += meson/
drivers/pinctrl/meson/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +if ARCH_MESON + +config PINCTRL_MESON + depends on PINCTRL_GENERIC + bool + +config PINCTRL_MESON_GXBB + bool "Amlogic Meson GXBB SoC pinctrl driver" + select PINCTRL_MESON + +endif
drivers/pinctrl/meson/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += pinctrl-meson.o +obj-$(CONFIG_PINCTRL_MESON_GXBB) += pinctrl-meson-gxbb.o
drivers/pinctrl/meson/pinctrl-meson-gxbb.c new file +432 -0
432 lines not on this page · raw message
drivers/pinctrl/meson/pinctrl-meson.c new file +179 -0
179 lines not on this page · raw message
drivers/pinctrl/meson/pinctrl-meson.h new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/4 pinctrl: add driver for meson-gxbb pin controller
Quoted 17 lines · Beniamino Galvani
Add a pin controller driver for Meson GXBB adapted from Linux kernel.
Signed-off-by Beniamino Galvani <[email protected]>--- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/meson/Kconfig | 11 + drivers/pinctrl/meson/Makefile | 6 + drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 432 +++++++++++++++++++++++++++++ drivers/pinctrl/meson/pinctrl-meson.c | 179 ++++++++++++ drivers/pinctrl/meson/pinctrl-meson.h | 74 +++++ 7 files changed, 704 insertions(+) create mode 100644 drivers/pinctrl/meson/Kconfig create mode 100644 drivers/pinctrl/meson/Makefile create mode 100644 drivers/pinctrl/meson/pinctrl-meson-gxbb.c create mode 100644 drivers/pinctrl/meson/pinctrl-meson.c create mode 100644 drivers/pinctrl/meson/pinctrl-meson.h
PATCH 3/4 pinctrl: add driver for meson-gxbb pin controller
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Add a pin controller driver for Meson GXBB adapted from Linux kernel.
Signed-off-by Beniamino Galvani <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160907/8a5f7229/attachment.sig>
PATCH 3/4 pinctrl: add driver for meson-gxbb pin controller
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Add a pin controller driver for Meson GXBB adapted from Linux kernel.
Signed-off-by Beniamino Galvani <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160907/a59e4def/attachment.sig>
PATCH 4/4 meson: odroid-c2: enable Ethernet support through the device tree
In reply to Beniamino GalvaniRemove the device definition from board file, update the driver with the new compatible property and update config with necessary options.
--- arch/arm/include/asm/arch-meson/gxbb.h | 3 --- board/amlogic/odroid-c2/odroid-c2.c | 13 ------------- configs/odroid-c2_defconfig | 3 +++ drivers/net/designware.c | 1 + 4 files changed, 4 insertions(+), 16 deletions(-)
arch/arm/include/asm/arch-meson/gxbb.h +0 -3
@@ -20,9 +20,6 @@#define GXBB_GPIO_IN (n) GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 1)#define GXBB_GPIO_OUT (n) GXBB_PERIPHS_ADDR(_GXBB_GPIO_OFF(n) + 2) -/* Pinmux registers 0 to 12 */ -#define GXBB_PINMUX (n) GXBB_PERIPHS_ADDR(0x2c + (n)) -#define GXBB_ETH_REG_0 GXBB_PERIPHS_ADDR(0x50)#define GXBB_ETH_REG_1 GXBB_PERIPHS_ADDR(0x51)
board/amlogic/odroid-c2/odroid-c2.c +0 -13
@@ -21,24 +21,11 @@ int board_init(void)return 0 ; } -static const struct eth_pdata gxbb_eth_pdata = { - .iobase =GXBB_ETH_BASE , - .phy_interface =PHY_INTERFACE_MODE_RGMII , -}; - -U_BOOT_DEVICE (meson_eth) = { - .name ="eth_designware" , - .platdata = &gxbb_eth_pdata, -}; -int misc_init_r (void ) {u8 mac_addr[EFUSE_MAC_SIZE ];ssize_t len; -/* Select Ethernet function */ -setbits_le32 (GXBB_PINMUX (6 ),0x3fff ); -/* Set RGMII mode */ setbits_le32(GXBB_ETH_REG_0, GXBB_ETH_REG_0_PHY_INTF | GXBB_ETH_REG_0_TX_PHASE(1) |
configs/odroid-c2_defconfig +3 -0
@@ -14,6 +14,9 @@ CONFIG_HUSH_PARSER=y CONFIG_OF_CONTROL=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_DM_ETH=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_MESON_GXBB=y CONFIG_DEBUG_UART=y CONFIG_DEBUG_UART_MESON=y CONFIG_DEBUG_UART_BASE=0xc81004c0
drivers/net/designware.c +1 -0
@@ -737,6 +737,7 @@ static int designware_eth_ofdata_to_platdata(struct udevice *dev)static const struct udevice_id designware_eth_ids[] = { { .compatible ="allwinner,sun7i-a20-gmac" }, { .compatible ="altr,socfpga-stmmac" }, + { .compatible ="amlogic,meson6-dwmac" }, { } };
Signature · 1 line
2.7.4
PATCH 4/4 meson: odroid-c2: enable Ethernet support through the device tree
Quoted 10 lines · Beniamino Galvani
Remove the device definition from board file, update the driver with the new compatible property and update config with necessary options.
Signed-off-by Beniamino Galvani <[email protected]>--- arch/arm/include/asm/arch-meson/gxbb.h | 3 --- board/amlogic/odroid-c2/odroid-c2.c | 13 ------------- configs/odroid-c2_defconfig | 3 +++ drivers/net/designware.c | 1 + 4 files changed, 4 insertions(+), 16 deletions(-)
PATCH 4/4 meson: odroid-c2: enable Ethernet support through the device tree
In reply to Beniamino GalvaniQuoted 5 lines · Beniamino Galvani
Remove the device definition from board file, update the driver with the new compatible property and update config with necessary options.
Signed-off-by Beniamino Galvani <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20160907/def3687d/attachment.sig>