ethernet: arc: Add support for Rockchip SoC layer device tree bindings
Subsystems (4)
PATCH v6 1/4 ethernet: arc: Add support for Rockchip SoC layer device tree bindings
This patch defines a platform glue layer for Rockchip SoCs which support arc-emac driver. It ensures that regulator for the rmii is on before trying to connect to the ethernet controller. It applies right speed and mode changes to the grf when ethernet settings change.
--- drivers/net/ethernet/arc/Kconfig | 10 ++ drivers/net/ethernet/arc/Makefile | 1 + drivers/net/ethernet/arc/emac.h | 4 +- drivers/net/ethernet/arc/emac_main.c | 2 + drivers/net/ethernet/arc/emac_rockchip.c | 228 +++++++++++++++++++++++++++++++ 5 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/arc/emac_rockchip.c
drivers/net/ethernet/arc/Kconfig +10 -0
@@ -32,4 +32,14 @@ config ARC_EMAC non-standard on-chip ethernet device ARC EMAC 10/100 is used. Say Y here if you have such a board. If unsure, say N. +config EMAC_ROCKCHIP + tristate "Rockchip EMAC support" + select ARC_EMAC_CORE + depends on OF_IRQ && OF_NET && REGULATOR + ---help--- + Support for Rockchip RK3066/RK3188 EMAC ethernet controllers. + This selects Rockchip SoC glue layer support for the + emac device driver. This driver is used for RK3066/RK3188 + EMAC ethernet controller. + endif # NET_VENDOR_ARC
drivers/net/ethernet/arc/Makefile +1 -0
@@ -5,3 +5,4 @@ arc_emac-objs := emac_main.o emac_mdio.o obj-$(CONFIG_ARC_EMAC_CORE) += arc_emac.o obj-$(CONFIG_ARC_EMAC) += emac_arc.o +obj-$(CONFIG_EMAC_ROCKCHIP) += emac_rockchip.o
drivers/net/ethernet/arc/emac.h +3 -1
@@ -123,9 +123,11 @@ struct buffer_state {* @speed: PHY's last set speed. */ struct arc_emac_priv { -/* Devices */ const char *drv_name;const char *drv_version; +void (*set_mac_speed)(void *priv,unsigned int speed); + +/* Devices */ struct device *dev;struct phy_device *phy_dev;struct mii_bus *bus;
drivers/net/ethernet/arc/emac_main.c +2 -0
@@ -48,6 +48,8 @@ static void arc_emac_adjust_link(struct net_device *ndev)if (priv->speed != phy_dev->speed) { priv->speed = phy_dev->speed; state_changed =1 ; +if (priv->set_mac_speed) + priv->set_mac_speed (priv, priv->speed); }if (priv->duplex != phy_dev->duplex) {
drivers/net/ethernet/arc/emac_rockchip.c new file +228 -0
228 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 2/4 dt-bindings: Document EMAC Rockchip
This adds the necessary binding documentation for the EMAC Rockchip platform driver found in RK3066 and RK3188 SoCs.
--- .../devicetree/bindings/net/emac_rockchip.txt | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/emac_rockchip.txt
Documentation/devicetree/bindings/net/emac_rockchip.txt new file +50 -0
@@ -0,0 +1,50 @@ +* ARC EMAC 10/100 Ethernet platform driver for Rockchip Rk3066/RK3188 SoCs + +Required properties: +- compatible: Should be "rockchip,rk3066-emac" or "rockchip,rk3188-emac" + according to the target SoC. +- reg: Address and length of the register set for the device +- interrupts: Should contain the EMAC interrupts +- rockchip,grf: phandle to the syscon grf used to control speed and mode + for emac. +- phy: see ethernet.txt file in the same directory. +- phy-mode: see ethernet.txt file in the same directory. + +Optional properties: +- phy-supply: phandle to a regulator if the PHY needs one + +Clock handling: +- clocks: Must contain an entry for each entry in clock-names. +- clock-names: Shall be "hclk" for the host clock needed to calculate and set + polling period of EMAC and "macref" for the reference clock needed to transfer + data to and from the phy. + +Child nodes of the driver are the individual PHY devices connected to the +MDIO bus. They must have a "reg" property given the PHY address on the MDIO bus. + +Examples: + +ethernet@10204000 { + compatible = "rockchip,rk3188-emac"; + reg = <0xc0fc2000 0x3c>; + interrupts = <6>; + mac-address = [ 00 11 22 33 44 55 ]; + + clocks = <&cru HCLK_EMAC>, <&cru SCLK_MAC>; + clock-names = "hclk", "macref"; + + pinctrl-names = "default"; + pinctrl-0 = <&emac_xfer>, <&emac_mdio>, <&phy_int>; + + rockchip,grf = <&grf>; + + phy = <&phy0>; + phy-mode = "rmii"; + phy-supply = <&vcc_rmii>; + + #address-cells = <1>; + #size-cells = <0>; + phy0: ethernet-phy@0 { + reg = <1>; + }; +};
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): 1410196490-5646-2-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
David Miller
AppliedRe: [PATCH v2 2/4] dt-bindings: Document EMAC Rockchip
From: Romain Perier <[email protected]>
Date: Mon, 8 Sep 2014 17:14:48 +0000
Quoted 4 lines
This adds the necessary binding documentation for the EMAC Rockchip platform driver found in RK3066 and RK3188 SoCs.
Signed-off-by Romain Perier <[email protected]>
Applied.
PATCH v2 3/4 ARM: dts: Add emac nodes to the rk3188 device tree
In reply to Romain PerierThis adds support for EMAC Rockchip driver on RK3188 SoCs.
--- arch/arm/boot/dts/rk3188.dtsi | 22 ++++++++++++++++++++++ arch/arm/boot/dts/rk3xxx.dtsi | 17 +++++++++++++++++ 2 files changed, 39 insertions(+)
arch/arm/boot/dts/rk3188.dtsi +22 -0
@@ -147,6 +147,24 @@ bias-disable; }; + emac { + emac_xfer: emac-xfer { + rockchip,pins = <RK_GPIO3 16 RK_FUNC_2 &pcfg_pull_none>, /* tx_en */ + <RK_GPIO3 17 RK_FUNC_2 &pcfg_pull_none>, /* txd1 */ + <RK_GPIO3 18 RK_FUNC_2 &pcfg_pull_none>, /* txd0 */ + <RK_GPIO3 19 RK_FUNC_2 &pcfg_pull_none>, /* rxd0 */ + <RK_GPIO3 20 RK_FUNC_2 &pcfg_pull_none>, /* rxd1 */ + <RK_GPIO3 21 RK_FUNC_2 &pcfg_pull_none>, /* mac_clk */ + <RK_GPIO3 22 RK_FUNC_2 &pcfg_pull_none>, /* rx_err */ + <RK_GPIO3 23 RK_FUNC_2 &pcfg_pull_none>; /* crs_dvalid */ + }; + + emac_mdio: emac-mdio { + rockchip,pins = <RK_GPIO3 24 RK_FUNC_2 &pcfg_pull_none>, + <RK_GPIO3 25 RK_FUNC_2 &pcfg_pull_none>; + }; + }; + i2c0 { i2c0_xfer: i2c0-xfer { rockchip,pins = <RK_GPIO1 24 RK_FUNC_1 &pcfg_pull_none>,
@@ -323,6 +341,10 @@ }; }; +&emac { + compatible = "rockchip,rk3188-emac"; +}; + &global_timer { interrupts = <GIC_PPI 11 0xf04>; };
arch/arm/boot/dts/rk3xxx.dtsi +17 -0
@@ -91,6 +91,23 @@ status = "disabled"; }; + emac: ethernet@10204000 { + compatible = "snps,arc-emac"; + reg = <0x10204000 0x3c>; + interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + + rockchip,grf = <&grf>; + + clocks = <&cru HCLK_EMAC>, <&cru SCLK_MAC>; + clock-names = "hclk", "macref"; + max-speed = <100>; + phy-mode = "rmii"; + + status = "disabled"; + }; + mmc0: dwmmc@10214000 { compatible = "rockchip,rk2928-dw-mshc"; reg = <0x10214000 0x1000>;
Signature · 1 line
1.9.1
Re: [PATCH v2 3/4] ARM: dts: Add emac nodes to the rk3188 device tree
From: Romain Perier <[email protected]>
Date: Mon, 8 Sep 2014 17:14:49 +0000
Quoted 3 lines
This adds support for EMAC Rockchip driver on RK3188 SoCs.
Signed-off-by Romain Perier <[email protected]>
Applied.
PATCH v2 4/4 ARM: dts: Enable emac node on the rk3188-radxarock boards
In reply to Romain PerierThis enables EMAC Rockchip support on radxa rock boards.
--- arch/arm/boot/dts/rk3188-radxarock.dts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm/boot/dts/rk3188-radxarock.dts +22 -0
@@ -76,6 +76,22 @@ }; }; +&emac { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&emac_xfer>, <&emac_mdio>, <&phy_int>; + + phy = <&phy0>; + phy-supply = <&vcc_rmii>; + + phy0: ethernet-phy@0 { + reg = <0>; + interrupt-parent = <&gpio3>; + interrupts = <26 IRQ_TYPE_LEVEL_LOW>; + }; +}; + &i2c1 { status = "okay"; clock-frequency = <400000>;
@@ -201,6 +217,12 @@ }; }; + lan8720a { + phy_int: phy-int { + rockchip,pins = <RK_GPIO3 26 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + ir-receiver { ir_recv_pin: ir-recv-pin { rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO &pcfg_pull_none>;
Signature · 1 line
1.9.1
Re: [PATCH v2 4/4] ARM: dts: Enable emac node on the rk3188-radxarock boards
From: Romain Perier <[email protected]>
Date: Mon, 8 Sep 2014 17:14:50 +0000
Quoted 3 lines
This enables EMAC Rockchip support on radxa rock boards.
Signed-off-by Romain Perier <[email protected]>
Applied.
From: Romain Perier <[email protected]>
Date: Mon, 8 Sep 2014 17:14:47 +0000
Quoted 6 lines
This patch defines a platform glue layer for Rockchip SoCs which support arc-emac driver. It ensures that regulator for the rmii is on before trying to connect to the ethernet controller. It applies right speed and mode changes to the grf when ethernet settings change.
Signed-off-by Romain Perier <[email protected]>
Applied.