sunxi: update H3/H5/A64 EMAC DT nodes
Subsystems (6)
v5 cover sunxi: update H3/H5/A64 EMAC DT nodes
This is the first half of the DT update series, just updating the EMAC DT nodes, for which the bindings have diverged.
Just fixed some checkpatch warnings and rebased (without conflicts) against v2018.05-rc1.
As before, this includes the patches to drop the direct MMC environment for all Allwinner boards, to finally get rid of the image size limitation.
Patch 01 leaves some hint in the README how to avoid the situation when overrunning U-Boot's image size on 64-bit boards.
The old v2 EMAC DT update series is in patches 02-08, it prepares U-Boot's EMAC driver for using the new DT binding used in Linux, also updates the DTs to the new EMAC DT node already.
The final patches lift the space limit we currently have due to the raw MMC environment.
Patch 09 disables that for all sunxi boards, to give us finally some space. Patches 10 and 11 consequently revert the disabling of features we saw a few weeks ago to migitate the size problem.
Cheers,
Andre.
Changelog v4 .. v5:
- drop Linux DT update patches for now
- fix minor checkpatch complaints
Changelog v3 .. v4:
- remove MMC environment for all Allwinner boards (including 32 bit ones)
- keep MMC environment offset to the old values
- drop DT adjustments to use fixed MMC regulator
Changelog v2 .. v3:
01: added, was on the list before
02: drop redundant H5 line
03-08: unchanged
09-20: added
Changelog v1 .. v2:
01, 02, 03: unchanged
04, 05, 06, 07: added
Andre Przywara (11):
sunxi: README.sunxi64: Add hint about non-debug of ARM Trusted
Firmware
sunxi: gpio: add missing compatible strings
net: sun8i-emac: support new pinctrl DT bindings
net: sun8i-emac: add support for new EMAC DT binding
arm: dts: sunxi: update A64 to new EMAC binding
arm: dts: sunxi: update H3 to new EMAC binding
arm: dts: sunxi: update H5 to new EMAC binding
net: sun8i-emac: remove support for old binding
sunxi: disable direct MMC environment
sunxi: revert disabling of features
Revert "sunxi: Pine64: temporarily remove extra Pine64 non-plus DT"
arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 51 ++++++++------ arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 7 +- arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts | 6 +- arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts | 7 +- arch/arm/dts/sun8i-h3-nanopi-neo.dts | 6 +- arch/arm/dts/sun8i-h3-orangepi-2.dts | 7 +- arch/arm/dts/sun8i-h3-orangepi-one.dts | 7 +- arch/arm/dts/sun8i-h3-orangepi-pc.dts | 7 +- arch/arm/dts/sun8i-h3-orangepi-plus.dts | 8 ++- arch/arm/dts/sun8i-h3-orangepi-plus2e.dts | 9 ++- arch/arm/dts/sun8i-h3.dtsi | 69 ++++++++++++++----- board/sunxi/README.sunxi64 | 6 ++ cmd/Kconfig | 5 -- configs/pine64_plus_defconfig | 1 + drivers/gpio/sunxi_gpio.c | 3 + drivers/net/sun8i_emac.c | 89 ++++++++++++++++++------- drivers/video/Kconfig | 2 - env/Kconfig | 1 - lib/Kconfig | 1 - 19 files changed, 185 insertions(+), 107 deletions(-)
Signature · 1 line
2.14.1
PATCH v5 1/11 sunxi: README.sunxi64: Add hint about non-debug of ARM Trusted Firmware
As we are running into issues where the final U-Boot FIT image file is exceeding our size limit, add a hint to the README.sunxi64 file to point out the possibility of building non-debug versions of the ATF binary. These are about 12KB smaller than the standard debug build, and so allow successful U-Boot builds for many boards with the Allwinner H5 SoC.
Please note that under normal circumstances the debug build is still recommended, as it gives valuable clues in case something goes wrong in the ATF.
--- board/sunxi/README.sunxi64 | 6 ++++++ 1 file changed, 6 insertions(+)
board/sunxi/README.sunxi64 +6 -0
@@ -38,6 +38,12 @@ the root of your U-Boot build directory (or create a symbolic link). $ export BL31=/src/arm-trusted-firmware/build/sun50iw1p1/debug/bl31.bin (adjust the actual path accordingly) +If you run into size issues with the resulting U-Boot image file, it might +help to use a release build, by using "DEBUG=0" when building bl31.bin. +As sometimes the ATF build process is a bit picky about the toolchain used, +or if you can't be bothered with building ATF, there are known working +binaries in the firmware repository[3], purely for convenience reasons. + SPL/U-Boot ------------ Both U-Boot proper and the SPL are using the 64-bit mode. As the boot ROM
Signature · 1 line
2.14.1
PATCH v5 2/11 sunxi: gpio: add missing compatible strings
In reply to Andre PrzywaraThe sunxi GPIO driver is missing some compatible strings for recent SoCs. While most of the sunxi GPIO code seems to not rely on this (and so works anyway), the sunxi_name_to_gpio() function does and fails at the moment (for instance when resolving the MMC CD pin name). Add the compatible strings for the A64 and V3s, which were missing from the list. This now covers all pinctrl nodes in our own DTs.
--- drivers/gpio/sunxi_gpio.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpio/sunxi_gpio.c +3 -0
@@ -354,12 +354,15 @@ static const struct udevice_id sunxi_gpio_ids[] = {ID ("allwinner,sun8i-a83t-pinctrl" , a_all),ID ("allwinner,sun8i-h3-pinctrl" , a_all),ID ("allwinner,sun8i-r40-pinctrl" , a_all), +ID ("allwinner,sun8i-v3s-pinctrl" , a_all),ID ("allwinner,sun9i-a80-pinctrl" , a_all), +ID ("allwinner,sun50i-a64-pinctrl" , a_all),ID ("allwinner,sun6i-a31-r-pinctrl" , l_2),ID ("allwinner,sun8i-a23-r-pinctrl" , l_1),ID ("allwinner,sun8i-a83t-r-pinctrl" , l_1),ID ("allwinner,sun8i-h3-r-pinctrl" , l_1),ID ("allwinner,sun9i-a80-r-pinctrl" , l_3), + ID("allwinner,sun50i-a64-r-pinctrl", l_1), { } };
Signature · 1 line
2.14.1
PATCH v5 3/11 net: sun8i-emac: support new pinctrl DT bindings
In reply to Andre PrzywaraThe Linux kernel driver for the Allwinner pin controller gained support for generic properties, which are now also used in the DTs. The sun8i-emac Ethernet driver for new Allwinner MACs reads the pins from the DT, but so far only supported the old binding.
Update the parsing routine to cope with both the old and new bindings, so that the newer DTs can be used with U-Boot and its Ethernet driver.
--- drivers/net/sun8i_emac.c | 52 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 13 deletions(-)
drivers/net/sun8i_emac.c +39 -13
@@ -21,6 +21,7 @@#include <malloc.h> #include <miiphy.h> #include <net.h> +#include <dt-bindings/pinctrl/sun4i-a10.h> #ifdef CONFIG_DM_GPIO #include <asm-generic/gpio.h> #endif
@@ -465,30 +466,55 @@ static int parse_phy_pins(struct udevice *dev) } 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 ); +"drive-strength" , ~0 ); +if (drive != ~0 ) { +if (drive <=10 ) + 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 (gd->fdt_blob, offset,0 , +"allwinner,drive" ,4 ); + } + +if (fdt_get_property (gd->fdt_blob, offset,"bias-pull-up" ,NULL )) + pull =SUN4I_PINCTRL_PULL_UP ; +else if (fdt_get_property (gd->fdt_blob, offset,"bias-disable" ,NULL )) + pull =SUN4I_PINCTRL_NO_PULL ; +else if (fdt_get_property (gd->fdt_blob, offset,"bias-pull-down" ,NULL )) + pull =SUN4I_PINCTRL_PULL_DOWN ; +else + 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 ) +if (!pin_name) { + pin_name =fdt_stringlist_get (gd->fdt_blob, offset, +"pins" , i,NULL ); +if (!pin_name) +break ; + } + + pin =sunxi_name_to_gpio (pin_name); +if (pin <0 )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 (drive != ~0 ) +sunxi_gpio_set_drv (pin, drive); +if (pull != ~0 ) +sunxi_gpio_set_pull (pin, pull); }if (!i) { -printf ("WARNING: emac: cannot find allwinner,pins property\n" ); +printf ("WARNING: emac: cannot find pins property\n" );return -2 ; }
Signature · 1 line
2.14.1
PATCH v5 4/11 net: sun8i-emac: add support for new EMAC DT binding
In reply to Andre PrzywaraThe Ethernet MAC used in newer Allwinner SoCs (H3, A64, H5) got an upstream Linux driver in v4.15.
This one uses a slightly different binding from the original one used by the U-Boot driver.
The differences to the old binding are:
- The "syscon" address is held in a separate node, referenced via a phandle in the "syscon" property.
- The reference to the PHY is held in a property called "phy-handle", not "phy".
- The PHY register is at offset 0x30 in the syscon device, not at 0.
- The internal PHY is activated when the node, which phy-handle points to, is a child node of an "allwinner,sun8i-h3-mdio-internal" node.
Teach the U-Boot driver how to find its resources in a "new-style" DT, so that we can use a Linux kernel compatible DT for U-Boot as well. This keeps support for the old binding for now, to allow a smooth transition.
--- drivers/net/sun8i_emac.c | 59 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 8 deletions(-)
drivers/net/sun8i_emac.c +51 -8
@@ -279,7 +279,7 @@ static int sun8i_emac_set_syscon(struct emac_eth_dev *priv)int ret;u32 reg; - reg =readl (priv->sysctl_reg); + reg =readl (priv->sysctl_reg +0x30 );if (priv->variant ==H3_EMAC ) { ret =sun8i_emac_set_syscon_ephy (priv, ®);
@@ -310,7 +310,7 @@ static int sun8i_emac_set_syscon(struct emac_eth_dev *priv)return -EINVAL ; } -writel (reg, priv->sysctl_reg); +writel (reg, priv->sysctl_reg +0x30 );return 0 ; }
@@ -806,17 +806,52 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)#endif pdata->iobase =devfdt_get_addr_name (dev,"emac" ); +if (pdata->iobase ==FDT_ADDR_T_NONE ) + pdata->iobase =devfdt_get_addr (dev); +if (pdata->iobase ==FDT_ADDR_T_NONE ) { +debug ("%s: Cannot find MAC base address\n" , __func__); +return -EINVAL ; + } + priv->sysctl_reg =devfdt_get_addr_name (dev,"syscon" ); +if (priv->sysctl_reg ==FDT_ADDR_T_NONE ) { +const fdt32_t *reg; + + offset =fdtdec_lookup_phandle (gd->fdt_blob, node,"syscon" ); +if (offset <0 ) { +debug ("%s: cannot find syscon node\n" , __func__); +return -EINVAL ; + } + reg =fdt_getprop (gd->fdt_blob, offset,"reg" ,NULL ); +if (!reg) { +debug ("%s: cannot find reg property in syscon node\n" , + __func__); +return -EINVAL ; + } + priv->sysctl_reg =fdt_translate_address ((void *)gd->fdt_blob, + offset, reg); + }else { + priv->sysctl_reg -=0x30 ; + } + +if (priv->sysctl_reg ==FDT_ADDR_T_NONE ) { +debug ("%s: Cannot find syscon base address\n" , __func__); +return -EINVAL ; + } pdata->phy_interface =-1 ; priv->phyaddr =-1 ; priv->use_internal_phy = false; - offset =fdtdec_lookup_phandle (gd->fdt_blob, node, -"phy" ); -if (offset >0 ) - priv->phyaddr =fdtdec_get_int (gd->fdt_blob, offset,"reg" , --1 ); + offset =fdtdec_lookup_phandle (gd->fdt_blob, node,"phy" ); +if (offset <0 ) + offset =fdtdec_lookup_phandle (gd->fdt_blob, node, +"phy-handle" ); +if (offset <0 ) { +debug ("%s: Cannot find PHY address\n" , __func__); +return -EINVAL ; + } + priv->phyaddr =fdtdec_get_int (gd->fdt_blob, offset,"reg" ,-1 ); phy_mode =fdt_getprop (gd->fdt_blob, node,"phy-mode" ,NULL );
@@ -839,8 +874,16 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)if (priv->variant ==H3_EMAC ) {if (fdt_getprop (gd->fdt_blob, node, -"allwinner,use-internal-phy" ,NULL )) +"allwinner,use-internal-phy" ,NULL )) { priv->use_internal_phy = true; + }else { +int parent =fdt_parent_offset (gd->fdt_blob, offset); + +if (parent >=0 && + !fdt_node_check_compatible (gd->fdt_blob, parent, +"allwinner,sun8i-h3-mdio-internal" )) + priv->use_internal_phy = true; + } } priv->interface = pdata->phy_interface;
Signature · 1 line
2.14.1
PATCH v5 5/11 arm: dts: sunxi: update A64 to new EMAC binding
In reply to Andre PrzywaraThe U-Boot driver for the sun8i-emac was using some preliminary DT binding. Now since Linux got its own driver in v4.15 and our driver can now cope with both bindings, let's convert the DT nodes used for the Pine64+ board over to the new bindings used by the kernel.
--- arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 51 +++++++++++++++---------- 1 file changed, 30 insertions(+), 21 deletions(-)
arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi +30 -21
@@ -4,25 +4,38 @@ }; soc { - emac: ethernet at 01c30000 { + syscon: syscon at 1c00000 { + compatible = "allwinner,sun50i-a64-system-controller", + "syscon"; + reg = <0x01c00000 0x1000>; + }; + + emac: ethernet at 1c30000 { compatible = "allwinner,sun50i-a64-emac"; - reg = <0x01c30000 0x2000>, <0x01c00030 0x4>; - reg-names = "emac", "syscon"; + syscon = <&syscon>; + reg = <0x01c30000 0x10000>; interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; resets = <&ccu RST_BUS_EMAC>; - reset-names = "ahb"; + reset-names = "stmmaceth"; clocks = <&ccu CLK_BUS_EMAC>; - clock-names = "ahb"; + clock-names = "stmmaceth"; #address-cells = <1>; #size-cells = <0>; pinctrl-names = "default"; pinctrl-0 = <&rgmii_pins>; phy-mode = "rgmii"; - phy = <&phy1>; + phy-handle = <&ext_rgmii_phy>; status = "okay"; - phy1: ethernet-phy at 1 { - reg = <1>; + mdio: mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + ext_rgmii_phy: ethernet-phy at 1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; }; }; };
@@ -30,21 +43,17 @@ &pio { rmii_pins: rmii_pins { - allwinner,pins = "PD10", "PD11", "PD13", "PD14", - "PD17", "PD18", "PD19", "PD20", - "PD22", "PD23"; - allwinner,function = "emac"; - allwinner,drive = <3>; - allwinner,pull = <0>; + pins = "PD10", "PD11", "PD13", "PD14", "PD17", + "PD18", "PD19", "PD20", "PD22", "PD23"; + function = "emac"; + drive-strength = <40>; }; rgmii_pins: rgmii_pins { - allwinner,pins = "PD8", "PD9", "PD10", "PD11", - "PD12", "PD13", "PD15", - "PD16", "PD17", "PD18", "PD19", - "PD20", "PD21", "PD22", "PD23"; - allwinner,function = "emac"; - allwinner,drive = <3>; - allwinner,pull = <0>; + pins = "PD8", "PD9", "PD10", "PD11", "PD12", + "PD13", "PD15", "PD16", "PD17", "PD18", + "PD19", "PD20", "PD21", "PD22", "PD23"; + function = "emac"; + drive-strength = <40>; }; };
Signature · 1 line
2.14.1
PATCH v5 6/11 arm: dts: sunxi: update H3 to new EMAC binding
In reply to Andre PrzywaraThe U-Boot driver for the sun8i-emac was using some preliminary DT binding. Now since Linux got its own driver in v4.15 and our driver can now cope with both bindings, let's convert the DT nodes used by the various H3 boards over to the new bindings used by the kernel.
--- arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts | 6 +-- arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts | 7 +-- arch/arm/dts/sun8i-h3-nanopi-neo.dts | 6 +-- arch/arm/dts/sun8i-h3-orangepi-2.dts | 7 +-- arch/arm/dts/sun8i-h3-orangepi-one.dts | 7 +-- arch/arm/dts/sun8i-h3-orangepi-pc.dts | 7 +-- arch/arm/dts/sun8i-h3-orangepi-plus.dts | 8 +++- arch/arm/dts/sun8i-h3-orangepi-plus2e.dts | 9 +++- arch/arm/dts/sun8i-h3.dtsi | 69 ++++++++++++++++++++------- 9 files changed, 75 insertions(+), 51 deletions(-)
arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts +1 -5
@@ -100,14 +100,10 @@ }; &emac { - phy = <&phy1>; + phy-handle = <&int_mii_phy>; phy-mode = "mii"; - allwinner,use-internal-phy; allwinner,leds-active-low; status = "okay"; - phy1: ethernet-phy at 1 { - reg = <1>; - }; }; &mmc0 {
arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts +1 -6
@@ -125,15 +125,10 @@ }; &emac { - phy = <&phy1>; + phy-handle = <&int_mii_phy>; phy-mode = "mii"; - allwinner,use-internal-phy; allwinner,leds-active-low; status = "okay"; - - phy1: ethernet-phy at 1 { - reg = <1>; - }; }; &ir {
arch/arm/dts/sun8i-h3-nanopi-neo.dts +1 -5
@@ -48,12 +48,8 @@ }; &emac { - phy = <&phy1>; + phy-handle = <&int_mii_phy>; phy-mode = "mii"; - allwinner,use-internal-phy; allwinner,leds-active-low; status = "okay"; - phy1: ethernet-phy at 1 { - reg = <1>; - }; };
arch/arm/dts/sun8i-h3-orangepi-2.dts +2 -5
@@ -55,6 +55,7 @@ aliases { serial0 = &uart0; /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */ + ethernet0 = &emac; ethernet1 = &rtl8189; };
@@ -110,14 +111,10 @@ }; &emac { - phy = <&phy1>; + phy-handle = <&int_mii_phy>; phy-mode = "mii"; - allwinner,use-internal-phy; allwinner,leds-active-low; status = "okay"; - phy1: ethernet-phy at 1 { - reg = <1>; - }; }; &ir {
arch/arm/dts/sun8i-h3-orangepi-one.dts +2 -5
@@ -53,6 +53,7 @@ compatible = "xunlong,orangepi-one", "allwinner,sun8i-h3"; aliases { + ethernet0 = &emac; serial0 = &uart0; };
@@ -95,14 +96,10 @@ }; &emac { - phy = <&phy1>; + phy-handle = <&int_mii_phy>; phy-mode = "mii"; - allwinner,use-internal-phy; allwinner,leds-active-low; status = "okay"; - phy1: ethernet-phy at 1 { - reg = <1>; - }; }; &mmc0 {
arch/arm/dts/sun8i-h3-orangepi-pc.dts +2 -5
@@ -53,6 +53,7 @@ compatible = "xunlong,orangepi-pc", "allwinner,sun8i-h3"; aliases { + ethernet0 = &emac; serial0 = &uart0; };
@@ -167,12 +168,8 @@ }; &emac { - phy = <&phy1>; + phy-handle = <&int_mii_phy>; phy-mode = "mii"; - allwinner,use-internal-phy; allwinner,leds-active-low; status = "okay"; - phy1: ethernet-phy at 1 { - reg = <1>; - }; };
arch/arm/dts/sun8i-h3-orangepi-plus.dts +7 -1
@@ -82,7 +82,13 @@ pinctrl-0 = <&emac_rgmii_pins>; phy-supply = <®_gmac_3v3>; phy-mode = "rgmii"; - /delete-property/allwinner,use-internal-phy; +}; + +&external_mdio { + ext_rgmii_phy: ethernet-phy at 1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; }; &mmc2 {
arch/arm/dts/sun8i-h3-orangepi-plus2e.dts +8 -1
@@ -69,8 +69,15 @@ pinctrl-names = "default"; pinctrl-0 = <&emac_rgmii_pins>; phy-supply = <®_gmac_3v3>; + phy-handle = <&ext_rgmii_phy>; phy-mode = "rgmii"; - /delete-property/allwinner,use-internal-phy; +}; + +&external_mdio { + ext_rgmii_phy: ethernet-phy at 1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; }; &pio {
arch/arm/dts/sun8i-h3.dtsi +51 -18
91 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH v5 7/11 arm: dts: sunxi: update H5 to new EMAC binding
In reply to Andre PrzywaraThe U-Boot driver for the sun8i-emac was using some preliminary DT binding. Now since Linux got its own driver in v4.15 and our driver can now cope with both bindings, let's convert the DT nodes used by the OrangePi PC2 over to the new bindings used by the kernel.
--- arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/dts/sun50i-h5-orangepi-pc2.dts +5 -2
@@ -108,10 +108,13 @@ pinctrl-names = "default"; pinctrl-0 = <&emac_rgmii_pins>; phy-mode = "rgmii"; - phy = <&phy1>; + phy-handle = <&ext_rgmii_phy>; status = "okay"; +}; - phy1: ethernet-phy at 1 { +&external_mdio { + ext_rgmii_phy: ethernet-phy at 1 { + compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; }; };
Signature · 1 line
2.14.1
PATCH v5 8/11 net: sun8i-emac: remove support for old binding
In reply to Andre PrzywaraThe original DT binding used by U-Boot's sun8i-emac driver was not really agreed upon, and deviated from the "official" binding now used by the kernel. Since now all U-Boot users have been converted to the new binding, we can remove support for the old DT nodes from the driver.
--- drivers/net/sun8i_emac.c | 78 ++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 53 deletions(-)
drivers/net/sun8i_emac.c +25 -53
@@ -456,7 +456,7 @@ static int parse_phy_pins(struct udevice *dev) {int offset;const char *pin_name; -int drive, pull, i; +int drive, pull =SUN4I_PINCTRL_NO_PULL , i; offset =fdtdec_lookup_phandle (gd->fdt_blob,dev_of_offset (dev),"pinctrl-0" );
@@ -476,31 +476,20 @@ static int parse_phy_pins(struct udevice *dev) drive =SUN4I_PINCTRL_30_MA ; else drive =SUN4I_PINCTRL_40_MA ; - }else { - drive =fdt_getprop_u32_default_node (gd->fdt_blob, offset,0 , -"allwinner,drive" ,4 ); }if (fdt_get_property (gd->fdt_blob, offset,"bias-pull-up" ,NULL )) pull =SUN4I_PINCTRL_PULL_UP ; -else if (fdt_get_property (gd->fdt_blob, offset,"bias-disable" ,NULL )) - pull =SUN4I_PINCTRL_NO_PULL ;else if (fdt_get_property (gd->fdt_blob, offset,"bias-pull-down" ,NULL )) pull =SUN4I_PINCTRL_PULL_DOWN ; -else - 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) { - pin_name =fdt_stringlist_get (gd->fdt_blob, offset, -"pins" , i,NULL ); -if (!pin_name) -break ; - } +"pins" , i,NULL ); +if (!pin_name) +break ; pin =sunxi_name_to_gpio (pin_name);if (pin <0 )
@@ -798,6 +787,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)struct eth_pdata *pdata = &sun8i_pdata->eth_pdata;struct emac_eth_dev *priv =dev_get_priv (dev);const char *phy_mode; +const fdt32_t *reg;int node =dev_of_offset (dev);int offset =0 ;#ifdef CONFIG_DM_GPIO
@@ -805,35 +795,25 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)int ret =0 ;#endif - pdata->iobase =devfdt_get_addr_name (dev,"emac" ); -if (pdata->iobase ==FDT_ADDR_T_NONE ) - pdata->iobase =devfdt_get_addr (dev); + pdata->iobase =devfdt_get_addr (dev);if (pdata->iobase ==FDT_ADDR_T_NONE ) {debug ("%s: Cannot find MAC base address\n" , __func__);return -EINVAL ; } - priv->sysctl_reg =devfdt_get_addr_name (dev,"syscon" ); -if (priv->sysctl_reg ==FDT_ADDR_T_NONE ) { -const fdt32_t *reg; - - offset =fdtdec_lookup_phandle (gd->fdt_blob, node,"syscon" ); -if (offset <0 ) { -debug ("%s: cannot find syscon node\n" , __func__); -return -EINVAL ; - } - reg =fdt_getprop (gd->fdt_blob, offset,"reg" ,NULL ); -if (!reg) { -debug ("%s: cannot find reg property in syscon node\n" , - __func__); -return -EINVAL ; - } - priv->sysctl_reg =fdt_translate_address ((void *)gd->fdt_blob, - offset, reg); - }else { - priv->sysctl_reg -=0x30 ; + offset =fdtdec_lookup_phandle (gd->fdt_blob, node,"syscon" ); +if (offset <0 ) { +debug ("%s: cannot find syscon node\n" , __func__); +return -EINVAL ; } - + reg =fdt_getprop (gd->fdt_blob, offset,"reg" ,NULL ); +if (!reg) { +debug ("%s: cannot find reg property in syscon node\n" , + __func__); +return -EINVAL ; + } + priv->sysctl_reg =fdt_translate_address ((void *)gd->fdt_blob, + offset, reg);if (priv->sysctl_reg ==FDT_ADDR_T_NONE ) {debug ("%s: Cannot find syscon base address\n" , __func__);return -EINVAL ;
@@ -843,10 +823,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev) priv->phyaddr =-1 ; priv->use_internal_phy = false; - offset =fdtdec_lookup_phandle (gd->fdt_blob, node,"phy" ); -if (offset <0 ) - offset =fdtdec_lookup_phandle (gd->fdt_blob, node, -"phy-handle" ); + offset =fdtdec_lookup_phandle (gd->fdt_blob, node,"phy-handle" );if (offset <0 ) {debug ("%s: Cannot find PHY address\n" , __func__);return -EINVAL ;
@@ -873,17 +850,12 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev) }if (priv->variant ==H3_EMAC ) { -if (fdt_getprop (gd->fdt_blob, node, -"allwinner,use-internal-phy" ,NULL )) { - priv->use_internal_phy = true; - }else { -int parent =fdt_parent_offset (gd->fdt_blob, offset); +int parent =fdt_parent_offset (gd->fdt_blob, offset); -if (parent >=0 && - !fdt_node_check_compatible (gd->fdt_blob, parent, -"allwinner,sun8i-h3-mdio-internal" )) - priv->use_internal_phy = true; - } +if (parent >=0 && + !fdt_node_check_compatible (gd->fdt_blob, parent, +"allwinner,sun8i-h3-mdio-internal" )) + priv->use_internal_phy = true; } priv->interface = pdata->phy_interface;
Signature · 1 line
2.14.1
PATCH v5 9/11 sunxi: disable direct MMC environment
In reply to Andre PrzywaraSince the dawn of time for the Allwinner support in mainline U-Boot we store the environment to the SD card and write directly at 544KB from the beginning of the device. This leads to problems when the U-Boot proper image grows beyond 504KB and eventually overlaps. With one release of having the environment preferably in a FAT partition, let's now turn off the MMC variant fallback, so we get back all the space we need to implement features.
--- env/Kconfig | 1 - 1 file changed, 1 deletion(-)
env/Kconfig +0 -1
@@ -152,7 +152,6 @@ config ENV_IS_IN_MMC bool "Environment in an MMC device" depends on !CHAIN_OF_TRUST depends on MMC - default y if ARCH_SUNXI default y if ARCH_EXYNOS4 default y if MX6SX || MX7D default y if TEGRA30 || TEGRA124
Signature · 1 line
2.14.1
PATCH v5 9/11 sunxi: disable direct MMC environment
Quoted 9 lines · Andre Przywara
Since the dawn of time for the Allwinner support in mainline U-Boot we store the environment to the SD card and write directly at 544KB from the beginning of the device. This leads to problems when the U-Boot proper image grows beyond 504KB and eventually overlaps. With one release of having the environment preferably in a FAT partition, let's now turn off the MMC variant fallback, so we get back all the space we need to implement features.
Signed-off-by Andre Przywara <[email protected]>
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180404/b0094c44/attachment.sig>
PATCH v5 9/11 sunxi: disable direct MMC environment
Hi Maxime,
Quoted 9 lines · Maxime Ripard
Quoted 8 lines · Andre Przywara
Since the dawn of time for the Allwinner support in mainline U-Boot we store the environment to the SD card and write directly at 544KB from the beginning of the device. This leads to problems when the U-Boot proper image grows beyond 504KB and eventually overlaps. With one release of having the environment preferably in a FAT partition, let's now turn off the MMC variant fallback, so we get back all the space we need to implement features.
Quoted 3 lines
Quoted 1 line
Signed-off-by Andre Przywara <[email protected]>Acked-by Maxime Ripard <[email protected]>
Thanks a lot, also for the good collaboration during the "dark times" of the U-Boot proper size limitation ;-)
Cheers,
Andre.
PATCH v5 10/11 sunxi: revert disabling of features
In reply to Andre PrzywaraIn January some commits were introduced to mitigate the U-Boot image size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we practically don't have a size limit anymore.
--- cmd/Kconfig | 5 ----- drivers/video/Kconfig | 2 -- lib/Kconfig | 1 - 3 files changed, 8 deletions(-)
cmd/Kconfig +0 -5
@@ -426,7 +426,6 @@ menu "Memory commands" config CMD_CRC32 bool "crc32" select HASH - default n if ARCH_SUNXI default y help Compute CRC32.
@@ -568,7 +567,6 @@ config CMD_LZMADEC config CMD_UNZIP bool "unzip" - default n if ARCH_SUNXI default y if CMD_BOOTI help Uncompress a zip-compressed memory region.
@@ -780,14 +778,12 @@ config CMD_I2C config CMD_LOADB bool "loadb" - default n if ARCH_SUNXI default y help Load a binary file over serial line. config CMD_LOADS bool "loads" - default n if ARCH_SUNXI default y help Load an S-Record file over serial line
@@ -1187,7 +1183,6 @@ config CMD_GETTIME # TODO: rename to CMD_SLEEP config CMD_MISC bool "sleep" - default n if ARCH_SUNXI default y help Delay execution for some time
drivers/video/Kconfig +0 -2
@@ -38,7 +38,6 @@ config BACKLIGHT_GPIO config VIDEO_BPP8 bool "Support 8-bit-per-pixel displays" depends on DM_VIDEO - default n if ARCH_SUNXI default y if DM_VIDEO help Support drawing text and bitmaps onto a 8-bit-per-pixel display.
@@ -49,7 +48,6 @@ config VIDEO_BPP8 config VIDEO_BPP16 bool "Support 16-bit-per-pixel displays" depends on DM_VIDEO - default n if ARCH_SUNXI default y if DM_VIDEO help Support drawing text and bitmaps onto a 16-bit-per-pixel display.
lib/Kconfig +0 -1
@@ -66,7 +66,6 @@ config PANIC_HANG config REGEX bool "Enable regular expression support" - default n if ARCH_SUNXI default y if NET help If this variable is defined, U-Boot is linked against the
Signature · 1 line
2.14.1
PATCH v5 11/11 Revert "sunxi: Pine64: temporarily remove extra Pine64 non-plus DT"
In reply to Andre PrzywaraNow with the MMC environment gone, we have enough space to accommodate the Pine64 "non-plus" .dtb again.
This reverts commit 47952b8e42c2790150e16d3d4235b3a1ee0ba9bb.
--- configs/pine64_plus_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/pine64_plus_defconfig +1 -0
@@ -9,6 +9,7 @@ CONFIG_SPL=y # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_SPL_ISO_PARTITION is not set # CONFIG_SPL_EFI_PARTITION is not set +CONFIG_OF_LIST="sun50i-a64-pine64 sun50i-a64-pine64-plus" CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
Signature · 1 line
2.14.1
v5 cover sunxi: update H3/H5/A64 EMAC DT nodes
In reply to Andre PrzywaraQuoted 41 lines · Andre Przywara
This is the first half of the DT update series, just updating the EMAC DT nodes, for which the bindings have diverged.
Just fixed some checkpatch warnings and rebased (without conflicts) against v2018.05-rc1.
As before, this includes the patches to drop the direct MMC environment for all Allwinner boards, to finally get rid of the image size limitation.Patch 01 leaves some hint in the README how to avoid the situation when overrunning U-Boot's image size on 64-bit boards.
The old v2 EMAC DT update series is in patches 02-08, it prepares U-Boot's EMAC driver for using the new DT binding used in Linux, also updates the DTs to the new EMAC DT node already.The final patches lift the space limit we currently have due to the raw MMC environment.
Patch 09 disables that for all sunxi boards, to give us finally some space. Patches 10 and 11 consequently revert the disabling of features we saw a few weeks ago to migitate the size problem.Cheers,
Andre.Changelog v4 .. v5:
- drop Linux DT update patches for now
- fix minor checkpatch complaintsChangelog v3 .. v4:
- remove MMC environment for all Allwinner boards (including 32 bit ones)
- keep MMC environment offset to the old values
- drop DT adjustments to use fixed MMC regulatorChangelog v2 .. v3:
01: added, was on the list before
02: drop redundant H5 line
03-08: unchanged
09-20: addedChangelog v1 .. v2:
01, 02, 03: unchanged
04, 05, 06, 07: added
Quoted 13 lines
Andre Przywara (11):
sunxi: README.sunxi64: Add hint about non-debug of ARM Trusted
Firmware
sunxi: gpio: add missing compatible strings
net: sun8i-emac: support new pinctrl DT bindings
net: sun8i-emac: add support for new EMAC DT binding
arm: dts: sunxi: update A64 to new EMAC binding
arm: dts: sunxi: update H3 to new EMAC binding
arm: dts: sunxi: update H5 to new EMAC binding
net: sun8i-emac: remove support for old binding
sunxi: disable direct MMC environment
sunxi: revert disabling of features
Revert "sunxi: Pine64: temporarily remove extra Pine64 non-plus DT"
v5 cover sunxi: update H3/H5/A64 EMAC DT nodes
Quoted 56 lines · Jagan Teki
Quoted 41 lines · Andre Przywara
This is the first half of the DT update series, just updating the EMAC DT nodes, for which the bindings have diverged.
Just fixed some checkpatch warnings and rebased (without conflicts) against v2018.05-rc1.
As before, this includes the patches to drop the direct MMC environment for all Allwinner boards, to finally get rid of the image size limitation.Patch 01 leaves some hint in the README how to avoid the situation when overrunning U-Boot's image size on 64-bit boards.
The old v2 EMAC DT update series is in patches 02-08, it prepares U-Boot's EMAC driver for using the new DT binding used in Linux, also updates the DTs to the new EMAC DT node already.The final patches lift the space limit we currently have due to the raw MMC environment.
Patch 09 disables that for all sunxi boards, to give us finally some space. Patches 10 and 11 consequently revert the disabling of features we saw a few weeks ago to migitate the size problem.Cheers,
Andre.Changelog v4 .. v5:
- drop Linux DT update patches for now
- fix minor checkpatch complaintsChangelog v3 .. v4:
- remove MMC environment for all Allwinner boards (including 32 bit ones)
- keep MMC environment offset to the old values
- drop DT adjustments to use fixed MMC regulatorChangelog v2 .. v3:
01: added, was on the list before
02: drop redundant H5 line
03-08: unchanged
09-20: addedChangelog v1 .. v2:
01, 02, 03: unchanged
04, 05, 06, 07: addedQuoted 13 lines
Andre Przywara (11):
sunxi: README.sunxi64: Add hint about non-debug of ARM Trusted
Firmware
sunxi: gpio: add missing compatible strings
net: sun8i-emac: support new pinctrl DT bindings
net: sun8i-emac: add support for new EMAC DT binding
arm: dts: sunxi: update A64 to new EMAC binding
arm: dts: sunxi: update H3 to new EMAC binding
arm: dts: sunxi: update H5 to new EMAC binding
net: sun8i-emac: remove support for old binding
sunxi: disable direct MMC environment
sunxi: revert disabling of features
Revert "sunxi: Pine64: temporarily remove extra Pine64 non-plus DT"
Quoted 1 line
Reviewed-by Jagan Teki <[email protected]>
Applied to u-boot-sunxi/master
v5 cover sunxi: update H3/H5/A64 EMAC DT nodes
Hi,
Quoted 57 lines · Jagan Teki
Quoted 56 lines · Jagan Teki
Quoted 54 lines · Andre Przywara
This is the first half of the DT update series, just updating the EMAC DT nodes, for which the bindings have diverged.
Just fixed some checkpatch warnings and rebased (without conflicts) against v2018.05-rc1.
As before, this includes the patches to drop the direct MMC environment for all Allwinner boards, to finally get rid of the image size limitation.Patch 01 leaves some hint in the README how to avoid the situation when overrunning U-Boot's image size on 64-bit boards.
The old v2 EMAC DT update series is in patches 02-08, it prepares U-Boot's EMAC driver for using the new DT binding used in Linux, also updates the DTs to the new EMAC DT node already.The final patches lift the space limit we currently have due to the raw MMC environment.
Patch 09 disables that for all sunxi boards, to give us finally some space. Patches 10 and 11 consequently revert the disabling of features we saw a few weeks ago to migitate the size problem.Cheers,
Andre.Changelog v4 .. v5:
- drop Linux DT update patches for now
- fix minor checkpatch complaintsChangelog v3 .. v4:
- remove MMC environment for all Allwinner boards (including 32 bit ones)
- keep MMC environment offset to the old values
- drop DT adjustments to use fixed MMC regulatorChangelog v2 .. v3:
01: added, was on the list before
02: drop redundant H5 line
03-08: unchanged
09-20: addedChangelog v1 .. v2:
01, 02, 03: unchanged
04, 05, 06, 07: addedAndre Przywara (11):
sunxi: README.sunxi64: Add hint about non-debug of ARM Trusted
Firmware
sunxi: gpio: add missing compatible strings
net: sun8i-emac: support new pinctrl DT bindings
net: sun8i-emac: add support for new EMAC DT binding
arm: dts: sunxi: update A64 to new EMAC binding
arm: dts: sunxi: update H3 to new EMAC binding
arm: dts: sunxi: update H5 to new EMAC binding
net: sun8i-emac: remove support for old binding
sunxi: disable direct MMC environment
sunxi: revert disabling of features
Revert "sunxi: Pine64: temporarily remove extra Pine64 non-plus DT"
Quoted 3 lines
Quoted 1 line
Reviewed-by Jagan Teki <[email protected]>Applied to u-boot-sunxi/master
Thanks for that!
Looking at the repo, I wonder if we should clean up the branches? I see:
master-next
master-pr
next
size-fixes
to be outdated, because the patches in there have been merged a long time ago. This is especially confusing with the next and master-next branch, because their name somewhat suggests bleeding edge code.
So can we either delete them or populate them with something more appropriate?
Cheers,
Andre.