Skip to content

Commit

Permalink
opizero2w: Support h618 emac
Browse files Browse the repository at this point in the history
  • Loading branch information
orangepi-xunlong committed Aug 18, 2023
1 parent 5ad66f8 commit 97b4762
Show file tree
Hide file tree
Showing 13 changed files with 4,386 additions and 32 deletions.
87 changes: 64 additions & 23 deletions arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2w.dts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
serial3 = &uart3;
serial4 = &uart4;
serial5 = &uart5;
ethernet0 = &emac1;
};

chosen {
Expand All @@ -47,6 +48,18 @@
gpios = <&pio 2 13 GPIO_ACTIVE_HIGH>; /* PC13 */
linux,default-trigger = "heartbeat";
};

100m_link {
label = "100m_link";
gpios = <&pio 2 15 GPIO_ACTIVE_HIGH>; /* PC15 */
default-state = "off";
};

100m_act {
label = "100m_act";
gpios = <&pio 2 16 GPIO_ACTIVE_HIGH>; /* PC16 */
default-state = "off";
};
};

reg_vcc5v: vcc5v {
Expand Down Expand Up @@ -85,6 +98,22 @@
reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */
post-power-on-delay-ms = <200>;
};

ac200_pwm_clk: ac200_clk {
compatible = "pwm-clock";
#clock-cells = <0>;
// pwm5 period_ns = 500 > 334 for select 24M clock.
pwms = <&pwm 5 500 0>;
clock-frequency = <2000000>;
status = "okay";
};
};

&pwm5 {
// clk_bypass_output = 1 for Clock direct output without frequency division
// so pwm5 output is 24MHz for AC200 & AC300 clock
clk_bypass_output = <0x1>;
status = "okay";
};

&de {
Expand All @@ -107,26 +136,6 @@
status = "disabled";
};

&emac0 {
pinctrl-names = "default";
pinctrl-0 = <&ext_rgmii_pins>;
phy-mode = "rgmii";
phy-handle = <&ext_rgmii_phy>;
allwinner,rx-delay-ps = <1800>;
allwinner,tx-delay-ps = <700>;
status = "disabled";
};

&mdio0 {
ext_rgmii_phy: ethernet-phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <1>;
motorcomm,clk-out-frequency-hz = <125000000>;
motorcomm,keep-pll-enabled;
motorcomm,auto-sleep-disabled;
};
};

&mmc0 {
vmmc-supply = <&reg_dldo1>;
cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
Expand Down Expand Up @@ -264,7 +273,7 @@
&ir {
pinctrl-names = "default";
pinctrl-0 = <&ir_rx_pin>;
status = "disabled";
status = "okay";
};

&i2c0 {
Expand All @@ -286,9 +295,23 @@
};

&i2c3 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c3_ph_pins>;
status = "disabled";
pinctrl-0 = <&i2c3_pa_pins>;

ac200_x: mfd@10 {
compatible = "x-powers,ac200";
reg = <0x10>;
clocks = <&ac200_pwm_clk>;
// ephy id
nvmem-cells = <&ephy_calibration>;
nvmem-cell-names = "calibration";

ac200_ephy: phy {
compatible = "x-powers,ac200-ephy";
status = "okay";
};
};
};

&i2c4 {
Expand Down Expand Up @@ -404,3 +427,21 @@
pinctrl-names = "default";
pinctrl-0 = <&pwm4_pi_pin>;
};

&emac1 {
pinctrl-names = "default";
pinctrl-0 = <&rmii_pins>;
phy-mode = "rmii";
phy-handle = <&rmii_phy>;
phy-supply = <&reg_dldo1>;
allwinner,rx-delay-ps = <3100>;
allwinner,tx-delay-ps = <700>;
status = "okay";
};

&mdio1 {
rmii_phy: ethernet-phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <1>;
};
};
36 changes: 28 additions & 8 deletions arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@

syscon: syscon@3000000 {
compatible = "allwinner,sun50i-h616-system-control";
reg = <0x03000000 0x1000>;
reg = <0x03000000 0x30>,<0x03000038 0x0fc8>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
Expand Down Expand Up @@ -271,6 +271,10 @@
ths_calibration: thermal-sensor-calibration@14 {
reg = <0x14 0x8>;
};

ephy_calibration: ephy-calibration@2c {
reg = <0x2c 0x2>;
};
};

watchdog: watchdog@30090a0 {
Expand Down Expand Up @@ -392,6 +396,12 @@
function = "i2c3";
};

i2c3_pa_pins: i2c3-pa-pins {
pins = "PA10", "PA11";
function = "i2c3";
bias-pull-up;
};

/omit-if-no-ref/
i2c4_ph_pins: i2c4-ph-pins {
pins = "PH6", "PH7";
Expand Down Expand Up @@ -945,19 +955,29 @@
};

emac1: ethernet@5030000 {
compatible = "allwinner,sun50i-h616-emac";
syscon = <&syscon 1>;
reg = <0x05030000 0x10000>;
compatible = "allwinner,sunxi-gmac";
reg = <0x05030000 0x10000>,
<0x03000034 0x4>;
reg-names = "gmac1_reg","ephy_reg";
interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "macirq";
interrupt-names = "gmacirq";
resets = <&ccu RST_BUS_EMAC1>;
reset-names = "stmmaceth";
clocks = <&ccu CLK_BUS_EMAC1>;
clock-names = "stmmaceth";
clocks = <&ccu CLK_BUS_EMAC1>,<&ccu CLK_EMAC_25M>;
clock-names = "bus-emac1","emac-25m";
pinctrl-0 = <&rmii_pins>;
pinctrl-names = "default";
phy-mode = "rmii";
tx-delay = <7>;
rx-delay = <31>;
phy-rst;
gmac-power0;
gmac-power1;
gmac-power2;
status = "disabled";

mdio1: mdio {
compatible = "snps,dwmac-mdio";
compatible = "ethernet-phy-ieee802.3-c22";
#address-cells = <1>;
#size-cells = <0>;
};
Expand Down
9 changes: 9 additions & 0 deletions drivers/mfd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ config MFD_AC100
This driver include only the core APIs. You have to select individual
components like codecs or RTC under the corresponding menus.

config MFD_AC200
bool "X-Powers AC200"
select MFD_CORE
depends on I2C
help
If you say Y here you get support for the X-Powers AC200 IC.
This driver include only the core APIs. You have to select individual
components like Ethernet PHY or RTC under the corresponding menus.

config MFD_AXP20X
tristate
select MFD_CORE
Expand Down
1 change: 1 addition & 0 deletions drivers/mfd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o

obj-$(CONFIG_MFD_AC100) += ac100.o
obj-$(CONFIG_MFD_AC200) += sunxi-ac200.o
obj-$(CONFIG_MFD_AXP20X) += axp20x.o
obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o
obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o
Expand Down
Loading

0 comments on commit 97b4762

Please sign in to comment.