sunxi: update Pine64/A64 DTs
Subsystems (7)
cover sunxi: update Pine64/A64 DTs
Hi,
in the wake of the sunxi DM enablement series it became apparent that the current device tree files for the A64 SoC and its board are outdated.
Since Linux v4.10-rc1 there are now basic .dts files for the Allwinner A64 SoC and the Pine64 boards in the mainline kernel.
Linux v4.11-rc1 added MMC and USB support.
Because our preliminary device trees used in U-Boot differ significantly, let's update our copy with what's in the current Linus' master tree. Since in contrast to U-Boot the kernel still lacks support for Ethernet, we keep our preliminary nodes for that IP, but adjust it slightly to match the new clocks and reset bindings.
As the sun8i-emac driver is actually using the DT for the pinmux setup, we teach it how to cope with the new pinctrl bindings in the first two patches. This is probably becoming somewhat obsolete very soon (with DM GPIO support on the list already), however I consider these two patches as merely fixes for the existing driver to maintain bisectability. It would make sense to merge the new DTs before the DM patches, so we need to have something in place which works meanwhile.
Let me know what you think.
Cheers,
Andre.
Andre Przywara (6):
sunxi: GPIO: introduce sunxi_gpio_setup_dt_pins()
net: sun8i-emac: use new, generic GPIO setup routine
sunxi: dts: update sun50i-a64.dtsi from Linux
sunxi: dts: update Pine64 .dts
sunxi: dts: remove now obsolete pine64-common.dtsi
sunxi: dts: add Bananapi M64 .dts
arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-bananapi-m64.dts | 135 +++++++ arch/arm/dts/sun50i-a64-pine64-common.dtsi | 93 ----- arch/arm/dts/sun50i-a64-pine64-plus.dts | 16 +- arch/arm/dts/sun50i-a64-pine64.dts | 72 +++- arch/arm/dts/sun50i-a64.dtsi | 615 +++++++++-------------------- arch/arm/include/asm/arch-sunxi/gpio.h | 4 + arch/arm/mach-sunxi/pinmux.c | 77 ++++ drivers/net/sun8i_emac.c | 38 +- include/dt-bindings/clock/sun50i-a64-ccu.h | 134 +++++++ include/dt-bindings/reset/sun50i-a64-ccu.h | 98 +++++ 11 files changed, 706 insertions(+), 579 deletions(-) create mode 100644 arch/arm/dts/sun50i-a64-bananapi-m64.dts delete mode 100644 arch/arm/dts/sun50i-a64-pine64-common.dtsi create mode 100644 include/dt-bindings/clock/sun50i-a64-ccu.h create mode 100644 include/dt-bindings/reset/sun50i-a64-ccu.h
Signature · 1 line
2.8.2
PATCH 1/6 sunxi: GPIO: introduce sunxi_gpio_setup_dt_pins()
Instead of hard-coding GPIO pins used for a certain peripheral, we should just use the pinctrl information from the DT. The sun8i-emac driver has some simple implementation of that, so let's just generalize this and move the code into a more common location.
On the way we add support for the new, generic pinctrl binding now used by all Allwinner SoCs.
--- arch/arm/include/asm/arch-sunxi/gpio.h | 4 ++ arch/arm/mach-sunxi/pinmux.c | 77 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+)
arch/arm/include/asm/arch-sunxi/gpio.h +4 -0
@@ -239,4 +239,8 @@ int axp_gpio_init(void);static inline int axp_gpio_init (void ) {return 0 ; }#endif +int sunxi_gpio_parse_pin_name (const char *pin_name); +int sunxi_gpio_setup_dt_pins (const void *volatile fdt_blob,int node, +const char * mux_name,int mux_sel); +#endif /* _SUNXI_GPIO_H */
arch/arm/mach-sunxi/pinmux.c +77 -0
86 lines not on this page · raw message
Signature · 1 line
2.8.2
PATCH 2/6 net: sun8i-emac: use new, generic GPIO setup routine
In reply to Andre PrzywaraInstead of open-coding the fairly generic pinmux setup in the sun8i-emac driver, let's just use the new common implementation of that. This has also the advantage of supporting the newpinctrl bindings, so the driver can cope with the upstream Linux DTs.
--- drivers/net/sun8i_emac.c | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-)
drivers/net/sun8i_emac.c +6 -32
@@ -438,42 +438,16 @@ static int _sun8i_emac_eth_init(struct emac_eth_dev *priv, u8 *enetaddr)static int parse_phy_pins (struct udevice *dev) { -int offset; -const char *pin_name; -int drive, pull, i; +int ret =sunxi_gpio_setup_dt_pins (gd->fdt_blob, dev->of_offset, +"emac" ,SUN8I_GPD8_GMAC ); - offset =fdtdec_lookup_phandle (gd->fdt_blob,dev_of_offset (dev), -"pinctrl-0" ); -if (offset <0 ) { +if (ret <0 ) {printf ("WARNING: emac: cannot find pinctrl-0 node\n" ); -return offset; +return ret; } - drive =fdt_getprop_u32_default_node (gd->fdt_blob, offset,0 , -"allwinner,drive" ,4 ); - pull =fdt_getprop_u32_default_node (gd->fdt_blob, offset,0 , -"allwinner,pull" ,0 ); -for (i =0 ; ; i++) { -int pin; - - pin_name =fdt_stringlist_get (gd->fdt_blob, offset, -"allwinner,pins" , i,NULL ); -if (!pin_name) -break ; -if (pin_name[0 ] !='P' ) -continue ; - pin = (pin_name[1 ] -'A' ) <<5 ; -if (pin >=26 <<5 ) -continue ; - pin +=simple_strtol (&pin_name[2 ],NULL ,10 ); - -sunxi_gpio_set_cfgpin (pin,SUN8I_GPD8_GMAC ); -sunxi_gpio_set_drv (pin, drive); -sunxi_gpio_set_pull (pin, pull); - } - -if (!i) { -printf ("WARNING: emac: cannot find allwinner,pins property\n" ); +if (!ret) { +printf ("WARNING: emac: cannot find pins property\n" );return -2 ; }
Signature · 1 line
2.8.2
PATCH 3/6 sunxi: dts: update sun50i-a64.dtsi from Linux
In reply to Andre PrzywaraNow with USB and MMC for the A64 supported in mainline Linux, let's sync our DT with what's in the official Linux repository. This completely changes the clock representation, but U-Boot doesn't use this anyway.
Also it switches to a new pinctrl binding, which uses generic property names.
The only user of that was the sun8i-emac, which has just learned how to deal with this. Since mainline Linux does not support this Ethernet IP yet, let's copy over our previous DT nodes for that, adjusting them to match the new clock and pinctrl bindings.
--- arch/arm/dts/sun50i-a64-pine64-common.dtsi | 2 +- arch/arm/dts/sun50i-a64.dtsi | 615 +++++++++-------------------- include/dt-bindings/clock/sun50i-a64-ccu.h | 134 +++++++ include/dt-bindings/reset/sun50i-a64-ccu.h | 98 +++++ 4 files changed, 411 insertions(+), 438 deletions(-) create mode 100644 include/dt-bindings/clock/sun50i-a64-ccu.h create mode 100644 include/dt-bindings/reset/sun50i-a64-ccu.h
arch/arm/dts/sun50i-a64-pine64-common.dtsi +1 -1
@@ -61,7 +61,7 @@ &mmc0 { pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins>, <&mmc0_default_cd_pin>; + pinctrl-0 = <&mmc0_pins>; vmmc-supply = <®_vcc3v3>; cd-gpios = <&pio 5 6 0>; cd-inverted;
arch/arm/dts/sun50i-a64.dtsi +178 -437
787 lines not on this page · raw message
include/dt-bindings/clock/sun50i-a64-ccu.h new file +134 -0
134 lines not on this page · raw message
include/dt-bindings/reset/sun50i-a64-ccu.h new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
2.8.2
PATCH 4/6 sunxi: dts: update Pine64 .dts
In reply to Andre PrzywaraUpdate the two .dts files for the Pine64 boards with those used in the kernel. This switches from using a -common.dtsi to including the .dts for the non-plus model in the -plus file.
Again we keep our EMAC driver nodes in, which are not yet in mainline Linux.
--- arch/arm/dts/sun50i-a64-pine64-plus.dts | 16 ++------ arch/arm/dts/sun50i-a64-pine64.dts | 72 +++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 16 deletions(-)
arch/arm/dts/sun50i-a64-pine64-plus.dts +3 -13
@@ -40,22 +40,13 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -/dts-v1/; - -#include "sun50i-a64-pine64-common.dtsi" +#include "sun50i-a64-pine64.dts" / { model = "Pine64+"; compatible = "pine64,pine64-plus", "allwinner,sun50i-a64"; - chosen { - stdout-path = "serial0:115200n8"; - }; - - /* There is a model with 2GB of DRAM, but U-Boot fixes this for us. */ - memory { - reg = <0x40000000 0x40000000>; - }; + /* TODO: Camera, Ethernet PHY, touchscreen, etc. */ }; &emac {
@@ -66,7 +57,6 @@ status = "okay"; phy1: ethernet-phy at 1 { - reg = <1>; + reg = <1>; }; }; -
arch/arm/dts/sun50i-a64-pine64.dts +69 -3
86 lines not on this page · raw message
Signature · 1 line
2.8.2
PATCH 5/6 sunxi: dts: remove now obsolete pine64-common.dtsi
In reply to Andre PrzywaraNow since the common DT nodes between the two Pine64 boards have been moved into the .dts for the non-plus model, we no longer need the extra -common.dtsi.
Let's just remove it.
--- arch/arm/dts/sun50i-a64-pine64-common.dtsi | 93 ------------------------------ 1 file changed, 93 deletions(-) delete mode 100644 arch/arm/dts/sun50i-a64-pine64-common.dtsi
arch/arm/dts/sun50i-a64-pine64-common.dtsi deleted +0 -93
@@ -1,93 +0,0 @@ -/* - * Copyright (c) 2016 ARM Ltd. - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "sun50i-a64.dtsi" - -/ { - - aliases { - serial0 = &uart0; - ethernet0 = &emac; - }; - - soc { - reg_vcc3v3: vcc3v3 { - compatible = "regulator-fixed"; - regulator-name = "vcc3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - }; - }; -}; - -&mmc0 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins>; - vmmc-supply = <®_vcc3v3>; - cd-gpios = <&pio 5 6 0>; - cd-inverted; - status = "okay"; -}; - -&uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; - status = "okay"; -}; - -&i2c1 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c1_pins>; - status = "okay"; -}; - -&usbphy { - status = "okay"; -}; - -&ohci1 { - status = "okay"; -}; - -&ehci1 { - status = "okay"; -};
Signature · 1 line
2.8.2
PATCH 6/6 sunxi: dts: add Bananapi M64 .dts
In reply to Andre PrzywaraSince mainline Linux gained support for the BananaPi-M64, let's just copy this DT to prepare the U-Boot support for that board. Again add the required DT nodes for the Ethernet IP.
--- arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-bananapi-m64.dts | 135 +++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/sun50i-a64-bananapi-m64.dts
arch/arm/dts/Makefile +2 -1
@@ -299,7 +299,8 @@ dtb-$(CONFIG_MACH_SUN50I_H5) += \ sun50i-h5-orangepi-pc2.dtb dtb-$(CONFIG_MACH_SUN50I) += \ sun50i-a64-pine64-plus.dtb \ - sun50i-a64-pine64.dtb + sun50i-a64-pine64.dtb \ + sun50i-a64-bananapi-m64.dtb dtb-$(CONFIG_MACH_SUN9I) += \ sun9i-a80-optimus.dtb \ sun9i-a80-cubieboard4.dtb
arch/arm/dts/sun50i-a64-bananapi-m64.dts new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.8.2
cover sunxi: update Pine64/A64 DTs
In reply to Andre PrzywaraQuoted 27 lines · Andre Przywara
Hi,
in the wake of the sunxi DM enablement series it became apparent that the current device tree files for the A64 SoC and its board are outdated.
Since Linux v4.10-rc1 there are now basic .dts files for the Allwinner A64 SoC and the Pine64 boards in the mainline kernel.
Linux v4.11-rc1 added MMC and USB support.
Because our preliminary device trees used in U-Boot differ significantly, let's update our copy with what's in the current Linus' master tree. Since in contrast to U-Boot the kernel still lacks support for Ethernet, we keep our preliminary nodes for that IP, but adjust it slightly to match the new clocks and reset bindings.As the sun8i-emac driver is actually using the DT for the pinmux setup, we teach it how to cope with the new pinctrl bindings in the first two patches. This is probably becoming somewhat obsolete very soon (with DM GPIO support on the list already), however I consider these two patches as merely fixes for the existing driver to maintain bisectability. It would make sense to merge the new DTs before the DM patches, so we need to have something in place which works meanwhile.
Let me know what you think.
Cheers,
Andre.
Quoted 7 lines
Andre Przywara (6):
sunxi: GPIO: introducesunxi_gpio_setup_dt_pins()
net: sun8i-emac: use new, generic GPIO setup routine
sunxi: dts: updatesun50i-a64.dtsifrom Linux
sunxi: dts: update Pine64 .dts
sunxi: dts: remove now obsoletepine64-common.dtsi
sunxi: dts: add Bananapi M64 .dts
Could we keep this simple, and just do a "sync with the kernel" commit for sun50i, which also keeps the sun8i-emac specific bits. And also explicitly mention the git commit or tag you are syncing to.
ChenYu
Quoted 21 lines
arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-bananapi-m64.dts | 135 +++++++ arch/arm/dts/sun50i-a64-pine64-common.dtsi | 93 ----- arch/arm/dts/sun50i-a64-pine64-plus.dts | 16 +- arch/arm/dts/sun50i-a64-pine64.dts | 72 +++- arch/arm/dts/sun50i-a64.dtsi | 615 +++++++++-------------------- arch/arm/include/asm/arch-sunxi/gpio.h | 4 + arch/arm/mach-sunxi/pinmux.c | 77 ++++ drivers/net/sun8i_emac.c | 38 +- include/dt-bindings/clock/sun50i-a64-ccu.h | 134 +++++++ include/dt-bindings/reset/sun50i-a64-ccu.h | 98 +++++ 11 files changed, 706 insertions(+), 579 deletions(-) create mode 100644 arch/arm/dts/sun50i-a64-bananapi-m64.dts delete mode 100644 arch/arm/dts/sun50i-a64-pine64-common.dtsi create mode 100644 include/dt-bindings/clock/sun50i-a64-ccu.h create mode 100644 include/dt-bindings/reset/sun50i-a64-ccu.h--
2.8.2
PATCH 1/6 sunxi: GPIO: introduce sunxi_gpio_setup_dt_pins()
In reply to Andre PrzywaraQuoted 77 lines · Andre Przywara
Instead of hard-coding GPIO pins used for a certain peripheral, we should just use the pinctrl information from the DT. The sun8i-emac driver has some simple implementation of that, so let's just generalize this and move the code into a more common location.
On the way we add support for the new, generic pinctrl binding now used by all Allwinner SoCs.Signed-off-by Andre Przywara <[email protected]>--- arch/arm/include/asm/arch-sunxi/gpio.h | 4 ++ arch/arm/mach-sunxi/pinmux.c | 77 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+)arch/arm/include/asm/arch-sunxi/gpio.h +4
-0@@ -239,4 +239,8 @@ int axp_gpio_init(void);static inline int axp_gpio_init (void ) {return 0 ; }#endif +int sunxi_gpio_parse_pin_name (const char *pin_name); +int sunxi_gpio_setup_dt_pins (const void *volatile fdt_blob,int node, +const char * mux_name,int mux_sel); +#endif /* _SUNXI_GPIO_H */ arch/arm/mach-sunxi/pinmux.c +35
-0@@ -9,6 +9,9 @@#include <common.h> #include <asm/io.h> #include <asm/arch/gpio.h> +#include <fdtdec.h> +#include <fdt_support.h> +#include <dt-bindings/pinctrl/sun4i-a10.h> void sunxi_gpio_set_cfgbank (struct sunxi_gpio *pio,int bank_offset,u32 val) {@@ -69,3 +72,77 @@ int sunxi_gpio_set_pull(u32 pin, u32 val)return 0 ; } + +int sunxi_gpio_parse_pin_name (const char *pin_name) +{ +int pin; + +if (pin_name[0 ] !='P' ) +return -1 ; + +if (pin_name[1 ] <'A' || pin_name[1 ] >'Z' ) +return -1 ; + + pin = (pin_name[1 ] -'A' ) <<5 ; + pin +=simple_strtol (&pin_name[2 ],NULL ,10 ); + +return pin; +} + +int sunxi_gpio_setup_dt_pins (const void *volatile fdt_blob,int node, +const char * mux_name,int mux_sel) +{ +int drive, pull, pin, i; +const char *pin_name; +int offset; + + offset =fdtdec_lookup_phandle (fdt_blob, node,"pinctrl-0" ); +if (offset <0 ) +return offset; + + drive =fdt_getprop_u32_default_node (fdt_blob, offset,0 , +"drive-strength" ,0 ); +if (drive) { +if (drive <=10 )
arch/arm/mach-sunxi/pinmux.c int sunxi_gpio_set_pull(u32 pin, u32 val) · line 116
Quoted 10 lines
arch/arm/mach-sunxi/pinmux.c +10
-0+ drive =SUN4I_PINCTRL_10_MA ; + else if (drive <= 20) + drive =SUN4I_PINCTRL_20_MA ; + else if (drive <= 30) + drive =SUN4I_PINCTRL_30_MA ; + else + drive =SUN4I_PINCTRL_40_MA ; + }else { + drive =fdt_getprop_u32_default_node (fdt_blob, offset,0 , +"allwinner,drive" ,4 );
You should use a different default, something invalid.
arch/arm/mach-sunxi/pinmux.c int sunxi_gpio_set_pull(u32 pin, u32 val) · line 127
Quoted 11 lines
arch/arm/mach-sunxi/pinmux.c +11
-0+ } + +if (fdt_get_property (fdt_blob, offset,"bias-pull-up" ,NULL )) + pull =SUN4I_PINCTRL_PULL_UP ; +else if (fdt_get_property (fdt_blob, offset,"bias-disable" ,NULL )) + pull =SUN4I_PINCTRL_NO_PULL ; +else if (fdt_get_property (fdt_blob, offset,"bias-pull-down" ,NULL )) + pull =SUN4I_PINCTRL_PULL_DOWN ; +else + pull =fdt_getprop_u32_default_node (fdt_blob, offset,0 , +"allwinner,pull" ,0 );
Same here.
Quoted 7 lines
arch/arm/mach-sunxi/pinmux.c +7
-0+ +for (i =0 ; ; i++) { + pin_name =fdt_stringlist_get (fdt_blob, offset, +"allwinner,pins" , i,NULL ); +if (!pin_name) { + pin_name =fdt_stringlist_get (fdt_blob, offset, +"pins" , i,NULL );
arch/arm/mach-sunxi/pinmux.c int sunxi_gpio_set_pull(u32 pin, u32 val) · line 144
Quoted 10 lines
arch/arm/mach-sunxi/pinmux.c +10
-0+if (!pin_name) +break ; + } + pin =sunxi_gpio_parse_pin_name (pin_name); +if (pin <0 ) +continue ; + +sunxi_gpio_set_cfgpin (pin, mux_sel); +sunxi_gpio_set_drv (pin, drive); +sunxi_gpio_set_pull (pin, pull);
As the defaults implied by the bindings are to not touch the settings if they aren't specified, as in "whatever the hardware was set to". This applies to both drive strength and bias/pull.
Regards
ChenYu
Quoted 7 lines
arch/arm/mach-sunxi/pinmux.c +4
-1+ } + +return i; +} --2.8.2
cover sunxi: update Pine64/A64 DTs
In reply to Chen-Yu TsaiHi,
Quoted 36 lines · Chen-Yu Tsai
Quoted 27 lines · Andre Przywara
Hi,
in the wake of the sunxi DM enablement series it became apparent that the current device tree files for the A64 SoC and its board are outdated.
Since Linux v4.10-rc1 there are now basic .dts files for the Allwinner A64 SoC and the Pine64 boards in the mainline kernel.
Linux v4.11-rc1 added MMC and USB support.
Because our preliminary device trees used in U-Boot differ significantly, let's update our copy with what's in the current Linus' master tree. Since in contrast to U-Boot the kernel still lacks support for Ethernet, we keep our preliminary nodes for that IP, but adjust it slightly to match the new clocks and reset bindings.As the sun8i-emac driver is actually using the DT for the pinmux setup, we teach it how to cope with the new pinctrl bindings in the first two patches. This is probably becoming somewhat obsolete very soon (with DM GPIO support on the list already), however I consider these two patches as merely fixes for the existing driver to maintain bisectability. It would make sense to merge the new DTs before the DM patches, so we need to have something in place which works meanwhile.
Let me know what you think.
Cheers,
Andre.Quoted 7 lines
Andre Przywara (6):
sunxi: GPIO: introducesunxi_gpio_setup_dt_pins()
net: sun8i-emac: use new, generic GPIO setup routine
sunxi: dts: updatesun50i-a64.dtsifrom Linux
sunxi: dts: update Pine64 .dts
sunxi: dts: remove now obsoletepine64-common.dtsi
sunxi: dts: add Bananapi M64 .dts
Quoted 3 lines
Could we keep this simple, and just do a "sync with the kernel" commit for sun50i, which also keeps the sun8i-emac specific bits. And also explicitly mention the git commit or tag you are syncing to.
So you mean to drop patch 1 and 2 and keep the old style pinctrl bindings around for the EMAC node?
I can certainly do this (if others agree), but didn't want to dodge a more proper solution in the first place.
Another alternative would be to squash the functionality of patch 1 directly into sun8i_emac.c, so without the moving to pinmux.c. This would mean dropping patch 1/6 and just having a fix for the sun8i_emac.
Let me know what's the preferred solution here.
Cheers,
Andre.
Quoted 20 lines
Quoted 20 lines
arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-bananapi-m64.dts | 135 +++++++ arch/arm/dts/sun50i-a64-pine64-common.dtsi | 93 ----- arch/arm/dts/sun50i-a64-pine64-plus.dts | 16 +- arch/arm/dts/sun50i-a64-pine64.dts | 72 +++- arch/arm/dts/sun50i-a64.dtsi | 615 +++++++++-------------------- arch/arm/include/asm/arch-sunxi/gpio.h | 4 + arch/arm/mach-sunxi/pinmux.c | 77 ++++ drivers/net/sun8i_emac.c | 38 +- include/dt-bindings/clock/sun50i-a64-ccu.h | 134 +++++++ include/dt-bindings/reset/sun50i-a64-ccu.h | 98 +++++ 11 files changed, 706 insertions(+), 579 deletions(-) create mode 100644 arch/arm/dts/sun50i-a64-bananapi-m64.dts delete mode 100644 arch/arm/dts/sun50i-a64-pine64-common.dtsi create mode 100644 include/dt-bindings/clock/sun50i-a64-ccu.h create mode 100644 include/dt-bindings/reset/sun50i-a64-ccu.h--
2.8.2
PATCH 1/6 sunxi: GPIO: introduce sunxi_gpio_setup_dt_pins()
In reply to Andre PrzywaraQuoted 51 lines · Andre Przywara
Instead of hard-coding GPIO pins used for a certain peripheral, we should just use the pinctrl information from the DT. The sun8i-emac driver has some simple implementation of that, so let's just generalize this and move the code into a more common location.
On the way we add support for the new, generic pinctrl binding now used by all Allwinner SoCs.Signed-off-by Andre Przywara <[email protected]>--- arch/arm/include/asm/arch-sunxi/gpio.h | 4 ++ arch/arm/mach-sunxi/pinmux.c | 77 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+)arch/arm/include/asm/arch-sunxi/gpio.h +4
-0@@ -239,4 +239,8 @@ int axp_gpio_init(void);static inline int axp_gpio_init (void ) {return 0 ; }#endif +int sunxi_gpio_parse_pin_name (const char *pin_name); +int sunxi_gpio_setup_dt_pins (const void *volatile fdt_blob,int node, +const char * mux_name,int mux_sel); +#endif /* _SUNXI_GPIO_H */ arch/arm/mach-sunxi/pinmux.c +9
-0@@ -9,6 +9,9 @@#include <common.h> #include <asm/io.h> #include <asm/arch/gpio.h> +#include <fdtdec.h> +#include <fdt_support.h> +#include <dt-bindings/pinctrl/sun4i-a10.h> void sunxi_gpio_set_cfgbank (struct sunxi_gpio *pio,int bank_offset,u32 val) {@@ -69,3 +72,77 @@ int sunxi_gpio_set_pull(u32 pin, u32 val)return 0 ; } + +int sunxi_gpio_parse_pin_name (const char *pin_name) +{ +int pin; + +if (pin_name[0 ] !='P' )
arch/arm/mach-sunxi/pinmux.c int sunxi_gpio_set_pull(u32 pin, u32 val) · line 90
Quoted 10 lines
arch/arm/mach-sunxi/pinmux.c +10
-0+return -1 ; + +if (pin_name[1 ] <'A' || pin_name[1 ] >'Z' ) +return -1 ; + + pin = (pin_name[1 ] -'A' ) <<5 ; + pin +=simple_strtol (&pin_name[2 ],NULL ,10 ); + +return pin; +}
That function already exists, sunxi_name_to_gpio.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170227/de627360/attachment.sig>
PATCH 1/6 sunxi: GPIO: introduce sunxi_gpio_setup_dt_pins()
Hi,
Quoted 56 lines · Maxime Ripard
Quoted 55 lines · Andre Przywara
Instead of hard-coding GPIO pins used for a certain peripheral, we should just use the pinctrl information from the DT. The sun8i-emac driver has some simple implementation of that, so let's just generalize this and move the code into a more common location.
On the way we add support for the new, generic pinctrl binding now used by all Allwinner SoCs.Signed-off-by Andre Przywara <[email protected]>--- arch/arm/include/asm/arch-sunxi/gpio.h | 4 ++ arch/arm/mach-sunxi/pinmux.c | 77 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+)arch/arm/include/asm/arch-sunxi/gpio.h +4
-0@@ -239,4 +239,8 @@ int axp_gpio_init(void);static inline int axp_gpio_init (void ) {return 0 ; }#endif +int sunxi_gpio_parse_pin_name (const char *pin_name); +int sunxi_gpio_setup_dt_pins (const void *volatile fdt_blob,int node, +const char * mux_name,int mux_sel); +#endif /* _SUNXI_GPIO_H */ arch/arm/mach-sunxi/pinmux.c +13
-0@@ -9,6 +9,9 @@#include <common.h> #include <asm/io.h> #include <asm/arch/gpio.h> +#include <fdtdec.h> +#include <fdt_support.h> +#include <dt-bindings/pinctrl/sun4i-a10.h> void sunxi_gpio_set_cfgbank (struct sunxi_gpio *pio,int bank_offset,u32 val) {@@ -69,3 +72,77 @@ int sunxi_gpio_set_pull(u32 pin, u32 val)return 0 ; } + +int sunxi_gpio_parse_pin_name (const char *pin_name) +{ +int pin; + +if (pin_name[0 ] !='P' ) +return -1 ; + +if (pin_name[1 ] <'A' || pin_name[1 ] >'Z' ) +return -1 ;
Quoted 8 lines
arch/arm/mach-sunxi/pinmux.c int sunxi_gpio_set_pull(u32 pin, u32 val) · line 90
Quoted 6 lines
arch/arm/mach-sunxi/pinmux.c +6
-0+ + pin = (pin_name[1 ] -'A' ) <<5 ; + pin +=simple_strtol (&pin_name[2 ],NULL ,10 ); + +return pin; +}That function already exists,
sunxi_name_to_gpio.
Indeed, I found this yesterday _after_ sending the patches ;-) For some reasons I missed that when I originally wrote the patches, sorry for that.
Cheers,
Andre.
cover sunxi: update Pine64/A64 DTs
In reply to Andre PrzywaraHi,
Quoted 39 lines · Andre Przywara
Hi,
Quoted 36 lines · Chen-Yu Tsai
Quoted 34 lines · Andre Przywara
Hi,
in the wake of the sunxi DM enablement series it became apparent that the current device tree files for the A64 SoC and its board are outdated.
Since Linux v4.10-rc1 there are now basic .dts files for the Allwinner A64 SoC and the Pine64 boards in the mainline kernel.
Linux v4.11-rc1 added MMC and USB support.
Because our preliminary device trees used in U-Boot differ significantly, let's update our copy with what's in the current Linus' master tree. Since in contrast to U-Boot the kernel still lacks support for Ethernet, we keep our preliminary nodes for that IP, but adjust it slightly to match the new clocks and reset bindings.As the sun8i-emac driver is actually using the DT for the pinmux setup, we teach it how to cope with the new pinctrl bindings in the first two patches. This is probably becoming somewhat obsolete very soon (with DM GPIO support on the list already), however I consider these two patches as merely fixes for the existing driver to maintain bisectability. It would make sense to merge the new DTs before the DM patches, so we need to have something in place which works meanwhile.
Let me know what you think.
Cheers,
Andre.Andre Przywara (6):
sunxi: GPIO: introducesunxi_gpio_setup_dt_pins()
net: sun8i-emac: use new, generic GPIO setup routine
sunxi: dts: updatesun50i-a64.dtsifrom Linux
sunxi: dts: update Pine64 .dts
sunxi: dts: remove now obsoletepine64-common.dtsi
sunxi: dts: add Bananapi M64 .dts
Quoted 8 lines
Quoted 3 lines
Could we keep this simple, and just do a "sync with the kernel" commit for sun50i, which also keeps the sun8i-emac specific bits. And also explicitly mention the git commit or tag you are syncing to.
So you mean to drop patch 1 and 2 and keep the old style pinctrl bindings around for the EMAC node?
I can certainly do this (if others agree), but didn't want to dodge a more proper solution in the first place.
I've actually no preference on this. What I meant was you don't need four patches to do the sync-up, just one, i.e. copy sun50i*.{dts,dtsi} from the kernel, and patch back whatever the emac needs, since it's not in mainline yet.
I guess you could update sun8i-emac to deal with generic pinconf, or update the gpio driver, but that would be a separate series.
ChenYu
Quoted 29 lines
Another alternative would be to squash the functionality of patch 1 directly into
sun8i_emac.c, so without the moving topinmux.c. This would mean dropping patch 1/6 and just having a fix for thesun8i_emac.Let me know what's the preferred solution here.
Cheers,
Andre.Quoted 20 lines
Quoted 20 lines
arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-bananapi-m64.dts | 135 +++++++ arch/arm/dts/sun50i-a64-pine64-common.dtsi | 93 ----- arch/arm/dts/sun50i-a64-pine64-plus.dts | 16 +- arch/arm/dts/sun50i-a64-pine64.dts | 72 +++- arch/arm/dts/sun50i-a64.dtsi | 615 +++++++++-------------------- arch/arm/include/asm/arch-sunxi/gpio.h | 4 + arch/arm/mach-sunxi/pinmux.c | 77 ++++ drivers/net/sun8i_emac.c | 38 +- include/dt-bindings/clock/sun50i-a64-ccu.h | 134 +++++++ include/dt-bindings/reset/sun50i-a64-ccu.h | 98 +++++ 11 files changed, 706 insertions(+), 579 deletions(-) create mode 100644 arch/arm/dts/sun50i-a64-bananapi-m64.dts delete mode 100644 arch/arm/dts/sun50i-a64-pine64-common.dtsi create mode 100644 include/dt-bindings/clock/sun50i-a64-ccu.h create mode 100644 include/dt-bindings/reset/sun50i-a64-ccu.h--
2.8.2
cover sunxi: update Pine64/A64 DTs
Quoted 51 lines · Chen-Yu Tsai
Hi,
Quoted 39 lines · Andre Przywara
Hi,
Quoted 36 lines · Chen-Yu Tsai
Quoted 34 lines · Andre Przywara
Hi,
in the wake of the sunxi DM enablement series it became apparent that the current device tree files for the A64 SoC and its board are outdated.
Since Linux v4.10-rc1 there are now basic .dts files for the Allwinner A64 SoC and the Pine64 boards in the mainline kernel.
Linux v4.11-rc1 added MMC and USB support.
Because our preliminary device trees used in U-Boot differ significantly, let's update our copy with what's in the current Linus' master tree. Since in contrast to U-Boot the kernel still lacks support for Ethernet, we keep our preliminary nodes for that IP, but adjust it slightly to match the new clocks and reset bindings.As the sun8i-emac driver is actually using the DT for the pinmux setup, we teach it how to cope with the new pinctrl bindings in the first two patches. This is probably becoming somewhat obsolete very soon (with DM GPIO support on the list already), however I consider these two patches as merely fixes for the existing driver to maintain bisectability. It would make sense to merge the new DTs before the DM patches, so we need to have something in place which works meanwhile.
Let me know what you think.
Cheers,
Andre.Andre Przywara (6):
sunxi: GPIO: introducesunxi_gpio_setup_dt_pins()
net: sun8i-emac: use new, generic GPIO setup routine
sunxi: dts: updatesun50i-a64.dtsifrom Linux
sunxi: dts: update Pine64 .dts
sunxi: dts: remove now obsoletepine64-common.dtsi
sunxi: dts: add Bananapi M64 .dtsQuoted 8 lines
Quoted 3 lines
Could we keep this simple, and just do a "sync with the kernel" commit for sun50i, which also keeps the sun8i-emac specific bits. And also explicitly mention the git commit or tag you are syncing to.
So you mean to drop patch 1 and 2 and keep the old style pinctrl bindings around for the EMAC node?
I can certainly do this (if others agree), but didn't want to dodge a more proper solution in the first place.
Quoted 7 lines
I've actually no preference on this. What I meant was you don't need four patches to do the sync-up, just one, i.e. copy sun50i*.{dts,dtsi} from the kernel, and patch back whatever the emac needs, since it's not in mainline yet.
I guess you could update sun8i-emac to deal with generic pinconf, or update the gpio driver, but that would be a separate series.
Agree with ChenYu, and will update the status on this on patchwork as "Superseded"
thanks!
Signature · 4 lines
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.