Page 1 of 1

Trying to get ethernet PHY #4 to work - need assistance

Posted: Mon Nov 11, 2024 9:33 am
by tom
Hi!,

I've successfully gotten PHY0 to work with an ethernet transformer. Now I'd like to use one more ethernet PHY. Namely, the PHY #4.
Therefore I soldered another ethernet transformer and ethernet jack to these pins:

    * SD CLK (54)
    * SD CMD (55)
    * SD D3 (56)
    * SD D2 (57)

Unfortunately this was not enough to get it working. Then I found your blog post: https://vonger.cn/?p=15041 and this post on the Forum: viewtopic.php?f=16&t=4071

... so I used busybox's "devmem" to alter the registers:

First read register so what the current state is

Code: Select all
root@openwrt:/# devmem 0x1000003c
0x00FE01FF


Then alter according to blog post:

Code: Select all
devmem 0x1000003c w 0xe001ff


At this point, the "10M" LED on the attached Netgear switch lights up, but at the same time, the VoCore seems to freeze: The UART terminal on TXD2 and RXD2 renders unresponsive.

Reading your instructions more carefully, I found out that UART 2 cannot be used anymore. (Why is that? How could I find out myself? ;) )

Therefore I moved my serial console to UART 1 (RXD1/TXD1) by using this patch for the Linux device tree:

Code: Select all
--- a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi
+++ b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi
@@ -10,7 +10,7 @@
        };
 
        chosen {
-               bootargs = "console=ttyS2,115200";
+               bootargs = "console=ttyS1,115200";
        };
 };


It worked fine and the _Linux_ serial console is now available at the desired ports RXD1/TXD1.
RXD2/TXD2 should now be unoccupied and will not disturb ethernet operation anymore.

Now I wanted to apply a similar patch for UBoot, because the UBoot serial also needs to change from UART2 to UART1. I've tried the following in the Uboot Vocore Device tree:

Code: Select all
--- a/arch/mips/dts/vocore_vocore2.dts
+++ b/arch/mips/dts/vocore_vocore2.dts
@@ -13,7 +13,7 @@
        model = "VoCore2";
 
        aliases {
-               serial0 = &uart2;
+               serial0 = &uart1;
                spi0 = &spi0;
        };
 
@@ -32,8 +32,8 @@
        };
 
        chosen {
-               bootargs = "console=ttyS2,115200";
-               stdout-path = &uart2;
+               bootargs = "console=ttyS1,115200";
+               stdout-path = &uart1;
        };
 };
 
@@ -46,11 +46,11 @@
        };
 };
 
-&uart2 {
+&uart1 {
        status = "okay";
 
        pinctrl-names = "default";
-       pinctrl-0 = <&uart2_pwm_pins>;
+       pinctrl-0 = <&uart1_pwm_pins>;
 };
 
 &spi0 {


... but unfortunately the U-Boot console is still not available at UART1. Am I missing something? I'd like to resolve this issue first and then continue with the Ethernet PHY #4 port :)

Re: Trying to get ethernet PHY #4 to work - need assistance

Posted: Mon Nov 18, 2024 1:07 pm
by Vonger
UBOOT have to modify UBOOT source code to change it. :) You can get uboot source code at github.com/vonger/uboot, and must use a very old gcc toolchain 3.4.2 in x86 to compile it. (new toochain should work too but I did not try). Or you can use official uboot and compile it by yourself, that is a little tricky, need to reduce uboot size or change NOR flash partition or the default uboot partition size is not enough(128KB as I remember). Before you flash uboot make sure you have learned fix bricked VoCore by another VoCore, tutorial can be find at https://vocore.io/v2.html too.
When system power up, UBOOT start itself, it is not related to Linux DTS.

Other question, the reason of UART2 do not work, it is because MT7628AN only supports two modes, one is IOT mode(one ethernet), another is router mode(five ethernets), so once you enable second ethernet, all of the pins of UART2, SDIO and PWM etc change to ethernet mode(even you only use two ethernet have to enable five). This pinmux you can find at vocore.io/v2.html, there is a table of the reuse, but this is not on MT7628 datasheet.