sunxi: Enable EMAC on various boards
Subsystems (3)
v2 cover sunxi: Enable EMAC on various boards
Hi,
This series enables the EMAC for some A83T and A64 boards.
Changes since v1:
- Added "bitfield: Include linux/bitops.h for ffs()" to fix build errors
- Use bitfield_replace_by_mask() instead of open coding bitfield ops
- Trimmed used pins in the device tree to only those actually needed
- Enabled Realtek PHY driver
- Added "sunxi: Enable EMAC on the Bananapi M64"
ChenYu
Chen-Yu Tsai (5):
bitfield: Include linux/bitops.h for ffs()
net: sun8i_emac: Support RX/TX delay chains
sunxi: Enable EMAC on the Cubietruck Plus
sunxi: Enable EMAC on the Bananapi M3
sunxi: Enable EMAC on the Bananapi M64
arch/arm/dts/sun50i-a64-bananapi-m64-u-boot.dtsi | 39 +++++++++++++++++++++ arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi | 40 ++++++++++++++++++++++ .../arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi | 38 ++++++++++++++++++++ configs/Cubietruck_plus_defconfig | 2 ++ configs/Sinovoip_BPI_M3_defconfig | 2 ++ drivers/net/sun8i_emac.c | 22 ++++++++++++ include/bitfield.h | 1 + 7 files changed, 144 insertions(+) create mode 100644 arch/arm/dts/sun50i-a64-bananapi-m64-u-boot.dtsi create mode 100644 arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi create mode 100644 arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi
Signature · 1 line
2.15.0
PATCH v2 1/5 bitfield: Include linux/bitops.h for ffs()
bitfield_shift() uses the ffs() function, which is provided by bitops.h.
Explicitly include this header.
--- include/bitfield.h | 1 + 1 file changed, 1 insertion(+)
include/bitfield.h +1 -0
@@ -37,6 +37,7 @@* tables which describe all bitfields in all registers. */ +#include <linux/bitops.h> #include <linux/types.h> /* Produces a mask of set bits covering a range of a uint value */
Signature · 1 line
2.15.0
PATCH v2 1/5 bitfield: Include linux/bitops.h for ffs()
Quoted 5 lines · Chen-Yu Tsai
bitfield_shift()uses theffs()function, which is provided bybitops.h.Explicitly include this header.
Signed-off-by Chen-Yu Tsai <[email protected]>
PATCH v2 2/5 net: sun8i_emac: Support RX/TX delay chains
In reply to Chen-Yu TsaiThe EMAC syscon has configurable RX/TX delay chains for use with RGMII PHYs.
This adds support for configuring them via device tree properties. The property names and format were defined in Linux's dwmac-sun8i binding that was merged at one point.
--- drivers/net/sun8i_emac.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/net/sun8i_emac.c +22 -0
@@ -14,6 +14,7 @@#include <asm/io.h> #include <asm/arch/clock.h> #include <asm/arch/gpio.h> +#include <bitfield.h> #include <common.h> #include <dm.h> #include <fdt_support.h>
@@ -56,6 +57,8 @@#define H3_EPHY_SELECT BIT(15)/* 1: internal PHY, 0: external PHY */ #define SC_RMII_EN BIT(13) +#define SC_TXDC_MASK GENMASK(12, 10) +#define SC_RXDC_MASK GENMASK(9, 5)#define SC_EPIT BIT(2)/* 1: RGMII, 0: MII */ #define SC_ETCS_MASK GENMASK(1, 0)#define SC_ETCS_EXT_GMII 0x1
@@ -125,6 +128,8 @@ struct emac_eth_dev {u32 addr;u32 tx_slot;bool use_internal_phy; +u32 tx_delay; +u32 rx_delay;enum emac_variant variant;void *mac_reg;
@@ -290,6 +295,10 @@ static int sun8i_emac_set_syscon(struct emac_eth_dev *priv)if (priv->variant ==H3_EMAC || priv->variant ==A64_EMAC ) reg &= ~SC_RMII_EN ; +/* Configure RX/TX delay chains */ + reg =bitfield_replace_by_mask (reg,SC_RXDC_MASK , priv->rx_delay); + reg =bitfield_replace_by_mask (reg,SC_TXDC_MASK , priv->tx_delay); +switch (priv->interface) {case PHY_INTERFACE_MODE_MII :/* default */
@@ -839,6 +848,19 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev) }#endif +/* Get RX/TX delays for RGMII */ + priv->rx_delay =fdtdec_get_uint (gd->fdt_blob,dev_of_offset (dev), +"allwinner,rx-delay-ps" ,0 ); +if (priv->rx_delay %100 || priv->rx_delay >3100 ) +debug ("%s: invalid rx delay value\n" , __func__); + priv->rx_delay /=100 ; + + priv->tx_delay =fdtdec_get_uint (gd->fdt_blob,dev_of_offset (dev), +"allwinner,tx-delay-ps" ,0 ); +if (priv->tx_delay %100 || priv->tx_delay >800 ) +debug ("%s: invalid tx delay value\n" , __func__); + priv->tx_delay /=100 ; +return 0 ; }
Signature · 1 line
2.15.0
PATCH v2 2/5 net: sun8i_emac: Support RX/TX delay chains
Quoted 6 lines · Chen-Yu Tsai
The EMAC syscon has configurable RX/TX delay chains for use with RGMII PHYs.
This adds support for configuring them via device tree properties. The property names and format were defined in Linux's dwmac-sun8i binding that was merged at one point.
I'm not seeing this in doc/device-tree-bindings/net/
PATCH v2 2/5 net: sun8i_emac: Support RX/TX delay chains
Quoted 9 lines · Joe Hershberger
Quoted 6 lines · Chen-Yu Tsai
The EMAC syscon has configurable RX/TX delay chains for use with RGMII PHYs.
This adds support for configuring them via device tree properties. The property names and format were defined in Linux's dwmac-sun8i binding that was merged at one point.
I'm not seeing this in doc/device-tree-bindings/net/
The bindings have been restored as of v4.15-rc1.
We are following DT bindings as defined in the Linux kernel. Deviation is kept to a minimum, and eliminated if possible. We still need to migrate the driver to the new bindings for the internal PHY bits. But that bit might still be changed during the 4.15 release cycle.
ChenYu
PATCH v2 2/5 net: sun8i_emac: Support RX/TX delay chains
Quoted 11 lines · Chen-Yu Tsai
Quoted 9 lines · Joe Hershberger
Quoted 6 lines · Chen-Yu Tsai
The EMAC syscon has configurable RX/TX delay chains for use with RGMII PHYs.
This adds support for configuring them via device tree properties. The property names and format were defined in Linux's dwmac-sun8i binding that was merged at one point.
I'm not seeing this in doc/device-tree-bindings/net/
Quoted 8 lines
The bindings have been restored as of v4.15-rc1.
We are following DT bindings as defined in the Linux kernel. Deviation is kept to a minimum, and eliminated if possible. We still need to migrate the driver to the new bindings for the internal PHY bits. But that bit might still be changed during the 4.15 release cycle.
That's good, but we want to have the currently supported bindings copied into the U-Boot tree under doc/device-tree-bindings/net/. Please include a patch that adds the bindings that your driver is using.
Thanks,
-Joe
PATCH v2 2/5 net: sun8i_emac: Support RX/TX delay chains
Quoted 21 lines · Joe Hershberger
Quoted 11 lines · Chen-Yu Tsai
Quoted 9 lines · Joe Hershberger
Quoted 6 lines · Chen-Yu Tsai
The EMAC syscon has configurable RX/TX delay chains for use with RGMII PHYs.
This adds support for configuring them via device tree properties. The property names and format were defined in Linux's dwmac-sun8i binding that was merged at one point.
I'm not seeing this in doc/device-tree-bindings/net/
Quoted 8 lines
The bindings have been restored as of v4.15-rc1.
We are following DT bindings as defined in the Linux kernel. Deviation is kept to a minimum, and eliminated if possible. We still need to migrate the driver to the new bindings for the internal PHY bits. But that bit might still be changed during the 4.15 release cycle.
Quoted 4 lines
That's good, but we want to have the currently supported bindings copied into the U-Boot tree under doc/device-tree-bindings/net/. Please include a patch that adds the bindings that your driver is using.
Looks like this is a new requirement. Or it wasn't really enforced before. Doesn't this make U-boot prone to having diverging device tree bindings? It has already happened with the regulator bindings, specifically the "regulator-name" property.
And by "currently supported", are you referring to what the driver expects, and not what the end result, i.e. the accepted bindings in Linux, should be? This driver is still in a state of catchup. The driver supports a previously merged then reverted set of bindings. These bindings were then brought back and updated for Linux v4.15 (unreleased yet, so may still change, again). So which set of bindings should I submit here?
And the goal _is_ to migrate the driver to what Linux is using, so we can share the device tree files.
Regards
ChenYu
PATCH v2 2/5 net: sun8i_emac: Support RX/TX delay chains
Quoted 41 lines · Chen-Yu Tsai
Quoted 21 lines · Joe Hershberger
Quoted 11 lines · Chen-Yu Tsai
Quoted 9 lines · Joe Hershberger
Quoted 6 lines · Chen-Yu Tsai
The EMAC syscon has configurable RX/TX delay chains for use with RGMII PHYs.
This adds support for configuring them via device tree properties. The property names and format were defined in Linux's dwmac-sun8i binding that was merged at one point.
I'm not seeing this in doc/device-tree-bindings/net/
Quoted 8 lines
The bindings have been restored as of v4.15-rc1.
We are following DT bindings as defined in the Linux kernel. Deviation is kept to a minimum, and eliminated if possible. We still need to migrate the driver to the new bindings for the internal PHY bits. But that bit might still be changed during the 4.15 release cycle.
Quoted 4 lines
That's good, but we want to have the currently supported bindings copied into the U-Boot tree under doc/device-tree-bindings/net/. Please include a patch that adds the bindings that your driver is using.
Looks like this is a new requirement. Or it wasn't really enforced before. Doesn't this make U-boot prone to having diverging device tree bindings? It has already happened with the regulator bindings, specifically the "regulator-name" property.
And by "currently supported", are you referring to what the driver expects, and not what the end result, i.e. the accepted bindings in Linux, should be? This driver is still in a state of catchup. The driver supports a previously merged then reverted set of bindings. These bindings were then brought back and updated for Linux v4.15 (unreleased yet, so may still change, again). So which set of bindings should I submit here?
Quoted 2 lines
And the goal _is_ to migrate the driver to what Linux is using, so we can share the device tree files.
I believe the goal is to have them match the current state of the driver as supported in U-Boot, and a higher-level goal of keeping the bindings + driver in sync with Linux for sharing.
Correct, Simon?
Thanks,
-Joe
PATCH v2 2/5 net: sun8i_emac: Support RX/TX delay chains
Hi Joe,
Quoted 43 lines · Joe Hershberger
Quoted 41 lines · Chen-Yu Tsai
Quoted 21 lines · Joe Hershberger
Quoted 11 lines · Chen-Yu Tsai
Quoted 9 lines · Joe Hershberger
Quoted 6 lines · Chen-Yu Tsai
The EMAC syscon has configurable RX/TX delay chains for use with RGMII PHYs.
This adds support for configuring them via device tree properties. The property names and format were defined in Linux's dwmac-sun8i binding that was merged at one point.
I'm not seeing this in doc/device-tree-bindings/net/
Quoted 8 lines
The bindings have been restored as of v4.15-rc1.
We are following DT bindings as defined in the Linux kernel. Deviation is kept to a minimum, and eliminated if possible. We still need to migrate the driver to the new bindings for the internal PHY bits. But that bit might still be changed during the 4.15 release cycle.
Quoted 4 lines
That's good, but we want to have the currently supported bindings copied into the U-Boot tree under doc/device-tree-bindings/net/. Please include a patch that adds the bindings that your driver is using.
Looks like this is a new requirement. Or it wasn't really enforced before. Doesn't this make U-boot prone to having diverging device tree bindings? It has already happened with the regulator bindings, specifically the "regulator-name" property.
And by "currently supported", are you referring to what the driver expects, and not what the end result, i.e. the accepted bindings in Linux, should be? This driver is still in a state of catchup. The driver supports a previously merged then reverted set of bindings. These bindings were then brought back and updated for Linux v4.15 (unreleased yet, so may still change, again). So which set of bindings should I submit here?
Quoted 6 lines
Quoted 2 lines
And the goal _is_ to migrate the driver to what Linux is using, so we can share the device tree files.
I believe the goal is to have them match the current state of the driver as supported in U-Boot, and a higher-level goal of keeping the bindings + driver in sync with Linux for sharing.
Yes, they should match, and we should have the same binding file.
Also, please use dev_read_...() instead of fdtdec...() for all new code since that supports live tree.
Quoted 5 lines
Correct, Simon?
Thanks,
-Joe
Regards,
Simon
PATCH v2 3/5 sunxi: Enable EMAC on the Cubietruck Plus
In reply to Chen-Yu TsaiThe Cubietruck Plus has an RTL8211E PHY connected to the EMAC using RGMII. The PHY is powered by DLDO4 @ 3.3V, while the I/O pins are powered by DLDO3 @ 2.5V.
This patch adds a U-boot specific dtsi file for the board adding an enabled EMAC node, and enables the EMAC driver in the defconfig. The binding used here is the old revision currently supported in U-boot. The U-boot driver has not been updated to support the new binding.
--- .../arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi | 38 ++++++++++++++++++++++ configs/Cubietruck_plus_defconfig | 2 ++ 2 files changed, 40 insertions(+) create mode 100644 arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +38 -0
@@ -0,0 +1,38 @@ +#include "sunxi-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &emac; + }; + + soc { + emac: ethernet at 01c30000 { + compatible = "allwinner,sun8i-a83t-emac"; + reg = <0x01c30000 0x2000>, <0x01c00030 0x4>; + reg-names = "emac", "syscon"; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + phy-mode = "rgmii"; + phy = <&phy1>; + status = "okay"; + + phy1: ethernet-phy at 1 { + reg = <1>; + }; + }; + }; +}; + +&pio { + rgmii_pins: rgmii_pins { + allwinner,pins = "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", + "PD11", "PD12", "PD13", "PD14", "PD18", + "PD19", "PD21", "PD22", "PD23"; + allwinner,function = "emac"; + allwinner,drive = <3>; + allwinner,pull = <0>; + }; +};
configs/Cubietruck_plus_defconfig +2 -0
@@ -21,6 +21,8 @@ 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_PHY_REALTEK=y +CONFIG_SUN8I_EMAC=y CONFIG_AXP_DLDO3_VOLT=2500 CONFIG_AXP_DLDO4_VOLT=3300 CONFIG_AXP_FLDO1_VOLT=1200
Signature · 1 line
2.15.0
PATCH v2 3/5 sunxi: Enable EMAC on the Cubietruck Plus
Hi,
Quoted 40 lines · Chen-Yu Tsai
The Cubietruck Plus has an RTL8211E PHY connected to the EMAC using RGMII. The PHY is powered by DLDO4 @ 3.3V, while the I/O pins are powered by DLDO3 @ 2.5V.
This patch adds a U-boot specific dtsi file for the board adding an enabled EMAC node, and enables the EMAC driver in the defconfig. The binding used here is the old revision currently supported in U-boot. The U-boot driver has not been updated to support the new binding.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi | 38 ++++++++++++++++++++++ configs/Cubietruck_plus_defconfig | 2 ++ 2 files changed, 40 insertions(+) create mode 100644 arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsiarch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +17
-0@@ -0,0 +1,38 @@ +#include "sunxi-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &emac; + }; + + soc { + emac: ethernet at 01c30000 { + compatible = "allwinner,sun8i-a83t-emac"; + reg = <0x01c30000 0x2000>, <0x01c00030 0x4>; + reg-names = "emac", "syscon"; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>;
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi line 27
Quoted 10 lines
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +10
-0+ phy-mode = "rgmii"; + phy = <&phy1>; + status = "okay"; + + phy1: ethernet-phy at 1 { + reg = <1>; + }; + }; + }; +};
Now that we have a binding merged, can't we use that instead?
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi line 38
Quoted 10 lines
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +10
-0+&pio { + rgmii_pins: rgmii_pins { + allwinner,pins = "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", + "PD11", "PD12", "PD13", "PD14", "PD18", + "PD19", "PD21", "PD22", "PD23"; + allwinner,function = "emac"; + allwinner,drive = <3>; + allwinner,pull = <0>; + }; +};
You should also use the new bindings here.
Thanks!
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: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171127/59c06f65/attachment.sig>
PATCH v2 3/5 sunxi: Enable EMAC on the Cubietruck Plus
Quoted 47 lines · Maxime Ripard
Hi,
Quoted 44 lines · Chen-Yu Tsai
The Cubietruck Plus has an RTL8211E PHY connected to the EMAC using RGMII. The PHY is powered by DLDO4 @ 3.3V, while the I/O pins are powered by DLDO3 @ 2.5V.
This patch adds a U-boot specific dtsi file for the board adding an enabled EMAC node, and enables the EMAC driver in the defconfig. The binding used here is the old revision currently supported in U-boot. The U-boot driver has not been updated to support the new binding.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi | 38 ++++++++++++++++++++++ configs/Cubietruck_plus_defconfig | 2 ++ 2 files changed, 40 insertions(+) create mode 100644 arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsiarch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +21
-0@@ -0,0 +1,38 @@ +#include "sunxi-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &emac; + }; + + soc { + emac: ethernet at 01c30000 { + compatible = "allwinner,sun8i-a83t-emac"; + reg = <0x01c30000 0x2000>, <0x01c00030 0x4>; + reg-names = "emac", "syscon"; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + phy-mode = "rgmii"; + phy = <&phy1>; + status = "okay"; +
Quoted 8 lines
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi line 27
Quoted 6 lines
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +6
-0+ phy1: ethernet-phy at 1 { + reg = <1>; + }; + }; + }; +};Now that we have a binding merged, can't we use that instead?
That is the next step. It's also why I have these in a U-boot specific dtsi file. The driver is upgraded to support the now official bindings, then we sync up the dts files and rip out the u-boot stuff.
However I'm not sure when I'll get to that, and I'd like this feature to be available for people that need might it, such as the kernelci.org board farms.
Quoted 11 lines
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi line 38
Quoted 10 lines
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +10
-0+&pio { + rgmii_pins: rgmii_pins { + allwinner,pins = "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", + "PD11", "PD12", "PD13", "PD14", "PD18", + "PD19", "PD21", "PD22", "PD23"; + allwinner,function = "emac"; + allwinner,drive = <3>; + allwinner,pull = <0>; + }; +};
Quoted 1 line
You should also use the new bindings here.
See above.
ChenYu
PATCH v2 3/5 sunxi: Enable EMAC on the Cubietruck Plus
Quoted 58 lines · Chen-Yu Tsai
Quoted 47 lines · Maxime Ripard
Hi,
Quoted 44 lines · Chen-Yu Tsai
The Cubietruck Plus has an RTL8211E PHY connected to the EMAC using RGMII. The PHY is powered by DLDO4 @ 3.3V, while the I/O pins are powered by DLDO3 @ 2.5V.
This patch adds a U-boot specific dtsi file for the board adding an enabled EMAC node, and enables the EMAC driver in the defconfig. The binding used here is the old revision currently supported in U-boot. The U-boot driver has not been updated to support the new binding.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi | 38 ++++++++++++++++++++++ configs/Cubietruck_plus_defconfig | 2 ++ 2 files changed, 40 insertions(+) create mode 100644 arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsiarch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +21
-0@@ -0,0 +1,38 @@ +#include "sunxi-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &emac; + }; + + soc { + emac: ethernet at 01c30000 { + compatible = "allwinner,sun8i-a83t-emac"; + reg = <0x01c30000 0x2000>, <0x01c00030 0x4>; + reg-names = "emac", "syscon"; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + phy-mode = "rgmii"; + phy = <&phy1>; + status = "okay"; +Quoted 8 lines
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi line 27
Quoted 6 lines
arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi new file +6
-0+ phy1: ethernet-phy at 1 { + reg = <1>; + }; + }; + }; +};Now that we have a binding merged, can't we use that instead?
Quoted 8 lines
That is the next step. It's also why I have these in a U-boot specific dtsi file. The driver is upgraded to support the now official bindings, then we sync up the dts files and rip out the u-boot stuff.
However I'm not sure when I'll get to that, and I'd like this feature to be available for people that need might it, such as the kernelci.org board farms.
Ok, that works for me.
On the DT part,
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: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171127/45911b1c/attachment.sig>
PATCH v2 4/5 sunxi: Enable EMAC on the Bananapi M3
In reply to Chen-Yu TsaiThe Bananapi M3 has an RTL8211E PHY connected to the EMAC using RGMII. The PHY is powered by DCDC1 through SW @ 3.3V.
This patch adds a U-boot specific dtsi file for the board adding an enabled EMAC node, and enables the EMAC driver in the defconfig. The binding used here is the old revision currently supported in U-boot. The U-boot driver has not been updated to support the new binding.
--- arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi | 40 +++++++++++++++++++++++++ configs/Sinovoip_BPI_M3_defconfig | 2 ++ 2 files changed, 42 insertions(+) create mode 100644 arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi
arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi new file +40 -0
@@ -0,0 +1,40 @@ +#include "sunxi-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &emac; + }; + + soc { + emac: ethernet at 01c30000 { + compatible = "allwinner,sun8i-a83t-emac"; + reg = <0x01c30000 0x2000>, <0x01c00030 0x4>; + reg-names = "emac", "syscon"; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + phy-mode = "rgmii"; + phy = <&phy1>; + allwinner,rx-delay-ps = <700>; + allwinner,tx-delay-ps = <700>; + status = "okay"; + + phy1: ethernet-phy at 1 { + reg = <1>; + }; + }; + }; +}; + +&pio { + rgmii_pins: rgmii_pins { + allwinner,pins = "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", + "PD11", "PD12", "PD13", "PD14", "PD18", + "PD19", "PD21", "PD22", "PD23"; + allwinner,function = "emac"; + allwinner,drive = <3>; + allwinner,pull = <0>; + }; +};
configs/Sinovoip_BPI_M3_defconfig +2 -0
@@ -22,6 +22,8 @@ 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_PHY_REALTEK=y +CONFIG_SUN8I_EMAC=y CONFIG_AXP_DCDC5_VOLT=1200 CONFIG_AXP_DLDO3_VOLT=2500 CONFIG_AXP_SW_ON=y
Signature · 1 line
2.15.0
PATCH v2 5/5 sunxi: Enable EMAC on the Bananapi M64
In reply to Chen-Yu TsaiThe Bananapi M64 has an RTL8211E PHY connected to the EMAC using RGMII. The PHY is powered by DCDC1 through SW @ 3.3V.
The EMAC driver is already enabled in the defconfig.
This patch adds a U-boot specific dtsi file for the board adding an enabled EMAC node. The binding used here is the old revision currently supported in U-boot. The U-boot driver has not been updated to support the new binding.
--- arch/arm/dts/sun50i-a64-bananapi-m64-u-boot.dtsi | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 arch/arm/dts/sun50i-a64-bananapi-m64-u-boot.dtsi
arch/arm/dts/sun50i-a64-bananapi-m64-u-boot.dtsi new file +39 -0
@@ -0,0 +1,39 @@ +#include "sunxi-u-boot.dtsi" + +/ { + aliases { + ethernet0 = &emac; + }; + + soc { + emac: ethernet at 01c30000 { + compatible = "allwinner,sun50i-a64-emac"; + reg = <0x01c30000 0x2000>, <0x01c00030 0x4>; + reg-names = "emac", "syscon"; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + phy-mode = "rgmii"; + phy = <&phy1>; + status = "okay"; + + phy1: ethernet-phy at 1 { + reg = <1>; + }; + }; + }; +}; + +&pio { + 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>; + }; +};
Signature · 1 line
2.15.0
v2 cover sunxi: Enable EMAC on various boards
In reply to Chen-Yu TsaiHi,
Quoted 16 lines · Chen-Yu Tsai
Hi,
This series enables the EMAC for some A83T and A64 boards.
Changes since v1:
- Added "bitfield: Include
linux/bitops.hforffs()" to fix build errors
- Usebitfield_replace_by_mask()instead of open coding bitfield ops
- Trimmed used pins in the device tree to only those actually needed
- Enabled Realtek PHY driver
- Added "sunxi: Enable EMAC on the Bananapi M64"ChenYu
Quoted 6 lines
Chen-Yu Tsai (5):
bitfield: Includelinux/bitops.hforffs()
net:sun8i_emac: Support RX/TX delay chains
sunxi: Enable EMAC on the Cubietruck Plus
sunxi: Enable EMAC on the Bananapi M3
sunxi: Enable EMAC on the Bananapi M64
Any comments (particularly two the first two patches) on this series? Joe?
ChenYu
Quoted 16 lines
arch/arm/dts/sun50i-a64-bananapi-m64-u-boot.dtsi | 39 +++++++++++++++++++++ arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi | 40 ++++++++++++++++++++++ .../arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi | 38 ++++++++++++++++++++ configs/Cubietruck_plus_defconfig | 2 ++ configs/Sinovoip_BPI_M3_defconfig | 2 ++ drivers/net/sun8i_emac.c | 22 ++++++++++++ include/bitfield.h | 1 + 7 files changed, 144 insertions(+) create mode 100644 arch/arm/dts/sun50i-a64-bananapi-m64-u-boot.dtsi create mode 100644 arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi create mode 100644 arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi--
2.15.0
v2 cover sunxi: Enable EMAC on various boards
Quoted 26 lines · Chen-Yu Tsai
Hi,
Quoted 16 lines · Chen-Yu Tsai
Hi,
This series enables the EMAC for some A83T and A64 boards.
Changes since v1:
- Added "bitfield: Include
linux/bitops.hforffs()" to fix build errors
- Usebitfield_replace_by_mask()instead of open coding bitfield ops
- Trimmed used pins in the device tree to only those actually needed
- Enabled Realtek PHY driver
- Added "sunxi: Enable EMAC on the Bananapi M64"ChenYu
Quoted 6 lines
Chen-Yu Tsai (5):
bitfield: Includelinux/bitops.hforffs()
net:sun8i_emac: Support RX/TX delay chains
sunxi: Enable EMAC on the Cubietruck Plus
sunxi: Enable EMAC on the Bananapi M3
sunxi: Enable EMAC on the Bananapi M64
Quoted 2 lines
Any comments (particularly two the first two patches) on this series? Joe?
I sent an issue with net: sun8i_emac: Support RX/TX delay chains
Cheers,
-Joe