gtxaspec / u-boot-ingenic

U-Boot for Ingenic SoC's
GNU General Public License v3.0
11 stars 9 forks source link

Ingenic T31n with Motorcomm YT8512C ethernet #40

Open daoudeddy opened 3 weeks ago

daoudeddy commented 3 weeks ago

I have a camera board with yt8512C ethernet chip, i've been able to run thingino firmware on this board but only with stock u-boot so the ethernet can still work, is there anyway to add support to this ethernet chip with u-boot?

gtxaspec commented 3 weeks ago

can you share a stock dump of the working uboot and some logs?

daoudeddy commented 3 weeks ago

Sure, heres the stock u-boot and stop boot log, hope this helps

Stock u-boot uboot.zip Logs logs.txt

Thank you!

gtxaspec commented 2 weeks ago

@daoudeddy do you have a photo of the chip by chance?

daoudeddy commented 2 weeks ago

20241105_123746 20241105_123709

daoudeddy commented 2 weeks ago

I will try to help as much as i can Here's some of the findings:

YT8512C Kernel Driver YT8512B u-boot Driver

gtxaspec commented 2 weeks ago

can you try the latest uboot build? let me know!

daoudeddy commented 2 weeks ago

Didnt work here's the log

Timer init
CLK stop
PLL init
pll_init:363
pll_cfg.pdiv = 10, pll_cfg.h2div = 5, pll_cfg.h0div = 5, pll_cfg.cdiv = 1, pll_cfg.l2div = 2
nf = 118 nr = 1 od0 = 1 od1 = 2
cppcr is 07605100
CPM_CPAPCR 0750510d
nf = 84 nr = 1 od0 = 1 od1 = 2
cppcr is 05405100
CPM_CPMPCR 07d0590d
nf = 100 nr = 1 od0 = 1 od1 = 2
cppcr is 06405100
CPM_CPVPCR 0640510d
cppcr 0x9a773310
apll_freq = 1404000000
mpll_freq = 1000000000
vpll_freq = 1200000000
cpu clk source: apll
ddr clk source: mpll
ddrfreq 500000000
cclk  1404000000
l2clk 702000000
h0clk 200000000
h2clk 200000000
pclk  100000000
CLK init
SDRAM init
sdram init start
DDR clk rate 500000000
SDRAM init ok
board_init_r
image entry point: 0x80100000

Ingenic U-Boot Flex 2013.07-g4771c69-dirty (Nov 06 2024 - 09:42:00)

Platform: ISVP (Ingenic XBurst1)
Built profile: T31N
SOC Name: T31N
DRAM:  64 MiB
Top of RAM usable for U-Boot at: 84000000
Reserving 703k for U-Boot at: 83f50000
Reserving 32832k for malloc() at: 81f40000
Reserving 32 Bytes for Board Info at: 81f3ffe0
Reserving 124 Bytes for Global Data at: 81f3ff64
Reserving 256k for boot params() at: 81efff64
Stack Pointer at: 81efff48
Now running in RAM - U-Boot at: 83f50000

MMC:   msc: 0
JZ SFC: Flash chip ID: ef7018
JZ SFC: Unsupported ID, but still maybe good for flashing
JZ SFC: Unsupported ID, but still maybe good for flashing, size set to 16777216
ingenic: Attention! The chip is not recognized! 
SF:    Detected GENERIC*8MB (ef 70 18 00 ff)
Net:   HW address for ETH: 02:82:85:AC:B7:AB
Net:   HW address for WLAN: 02:82:85:AC:B7:AC
In:    serial
Out:   serial
Err:   serial
KEY:   Reset button undefined
GPIO:  gpio_default: 56i 52i 54i 51i 57i 58i 61i 62i 63i 64i 49o 50o
ETH:   Searching for valid PHY
ETH:   Found PHY 0:0x0-0x128
ETH:   SPEED:1, DUPLEX:2
GPIO:  gpio_ircut: 63i 64i
GPIO:  gpio_user: No GPIO env settings provided
GPIO:  gpio_motor_v: 53i 52i 54i 51i
GPIO:  gpio_motor_h: 57i 58i 61i 62i
MMC:   Checking for autoupdate files... 
sdupdate - auto upgrade file from mmc to flash

Usage:
sdupdate LOAD_ID ADDR_START ADDR_END
LOAD_ID: 0-->u-boot
         1-->kernel
         2-->rootfs
         3-->full
ex:
        sdupdate   (update all)
or 
        sdupdate 0 0x0 0x40000
MMC:   Checking for kernel image from MMC... 
reading thingino_t31_kernel
reading thingino_t31_kernel_1
reading thingino_t31_kernel_2
MMC:   Kernel file not found.
MMC:   Checking for boot/env files...
** Unrecognized filesystem type **
** Unrecognized filesystem type **
KEY:   ###### Press Ctrl-C now to interrupt boot... loading in 3s ######
isvp_t31# 
daoudeddy commented 2 weeks ago

if you can notice the message ETH: SPEED:1, DUPLEX:2 does that mean its 10MB SPEED?

gtxaspec commented 2 weeks ago

it finds the PHY now, which is good:

ETH:   Searching for valid PHY
ETH:   Found PHY 0:0x0-0x128
ETH:   SPEED:1, DUPLEX:2

Have you tested network in uboot to see if it works?

next question, was ethernet in thingino working ONLY with stock uboot (if you can clarify)

daoudeddy commented 2 weeks ago

it finds the PHY now, which is good:

ETH:   Searching for valid PHY
ETH:   Found PHY 0:0x0-0x128
ETH:   SPEED:1, DUPLEX:2

Have you tested network in uboot to see if it works?

next question, was ethernet in thingino working ONLY with stock uboot (if you can clarify)

the thing is i have no keyboard input in the u-boot scree

the ethernet was working on thingino firmare only with stock u-boot and BR2_PACKAGE_THINGINO_KOPT_JZ_MAC_V12=y

gtxaspec commented 2 weeks ago

after you install thingino's u-boot, please run fw_printenv in linux

daoudeddy commented 2 weeks ago
baseaddr=0x80600000
baudrate=115200
bootargs=mem=${osmem} rmem=${rmem} console=${serialport},${baudrate}n8 panic=${panic_timeout} root=/dev/mtdblock3 rootfstype=squashfs init=/init mtdparts=jz_sfc:256k(boot),64k(env),${kern_size}(kernel),${rootfs}
bootcmd=sf probe;sq probe;setenv setargs setenv bootargs ${bootargs};run setargs;sf read ${baseaddr} 0x50000 0x250000;bootm ${baseaddr};
bootdelay=3
disable_eth=false
disable_sd=false
enable_updates=true
ethact=Jz4775-9161
ethaddr=02:82:85:ac:b7:ab
gatewayip=192.168.1.1
gpio_default_net=39o
ipaddr=192.168.1.10
loads_echo=1
netmask=255.255.255.0
osmem=42M@0x0
panic_timeout=10
restore=n
rmem=22M@0x2a00000
serialport=ttyS1
serverip=192.168.1.254
soc=t31
stderr=serial
stdin=serial
stdout=serial
wlanmac=02:82:85:ac:b7:ac
boot_complete=true
hostname=ing-t31n-sc2332-b7ac
sysupgrade_complete=true
gpio_motor_v=53 52 54 51
gpio_motor_h=57 58 61 62
gpio_ircut=63 64
motor_speed=200
gpio_speaker=14
timezone=Asia/Beirut
gpio_default=56 52 54 51 57 58 61 62 63 64 49 50
disable_homing=false
motor_maxstep_h=1000
motor_maxstep_v=1100
day_night_min=5000
day_night_max=15000
gpio_white=49o
gpio_ir850=50o
motor_speed_h=500
motor_speed_v=500
motor_pos_0=428,185

and btw the ethernet in the u-boot seems to be not working since there is no link ack on the port the board connected to

gtxaspec commented 2 weeks ago

you don't get link ack until you initialize the network connection manually, via dhcp or by running tftp or something else ( in u-boot )

run this: fw_setenv gpio_default_net fw_setenv gpio_default reboot, and see if network is OK

daoudeddy commented 2 weeks ago

you don't get link ack until you initialize the network connection manually, via dhcp or by running tftp or something else ( in u-boot )

run this: fw_setenv gpio_default_net fw_setenv gpio_default reboot, and see if network is OK

still the same issue no ethernet on thingino uboot

gtxaspec commented 2 weeks ago

can you share thingino-diag -l output?

daoudeddy commented 2 weeks ago

can you share thingino-diag -l output?

here's what happen when i do dhcp in u-boot menu

isvp_t31# dhcp
ETH:   jz4775-9161 driver init
ETH:   Bus Mode Reg after write: 0x00020100
ETH:   Found PHY 0:0x0-0x128
ETH:   SPEED:1, DUPLEX:2
ETH:   PHY found 0
ETH:   PHY Autonegotiation Complete!
ETH:   GMAC init finish
BOOTP broadcast 1
Waiting for DHCP packet
error may happen, need reload
BOOTP broadcast 2
Waiting for DHCP packet
error may happen, need reload
BOOTP broadcast 3
Waiting for DHCP packet
error may happen, need reload
BOOTP broadcast 4
Waiting for DHCP packet
error may happen, need reload

thingino-diag -l output


[thingino-diag-BJmb.log](https://github.com/user-attachments/files/17650884/thingino-diag-BJmb.log)
gtxaspec commented 2 weeks ago

your config is wrong, you need V13, not V12 ethernet

BR2_PACKAGE_THINGINO_KOPT_JZ_MAC=y
BR2_PACKAGE_THINGINO_KOPT_JZ_MAC_V13=y

please post your entire configs as indicated in the thingino issue

daoudeddy commented 2 weeks ago

your config is wrong, you need V13, not V12 ethernet

BR2_PACKAGE_THINGINO_KOPT_JZ_MAC=y
BR2_PACKAGE_THINGINO_KOPT_JZ_MAC_V13=y

please post your entire configs as indicated in the thingino issue

Didn't work either on V13

And o stock u-uboot it only worked on V12

daoudeddy commented 2 weeks ago

new error appeared

Ingenic on chip Ethernet MAC driver V13
wait stable.[289][cgu_macphy]
Bus Mode Reg after reset: 0x00020101, cnt=0
Bus Mode Reg after reset: 0x00020101, cnt=1
Bus Mode Reg after reset: 0x00020101, cnt=2
Bus Mode Reg after reset: 0x00020101, cnt=3
Bus Mode Reg after reset: 0x00020101, cnt=4
Bus Mode Reg after reset: 0x00020101, cnt=5
Bus Mode Reg after reset: 0x00020101, cnt=6
Bus Mode Reg after reset: 0x00020101, cnt=7
Bus Mode Reg after reset: 0x00020101, cnt=8
Bus Mode Reg after reset: 0x00020101, cnt=9
func:jz_mii_bus_probe, synopGMAC_reset failed
jz_mii_bus: probe of jz_mii_bus.0 failed with error -1
=======>gmacdev = 0x8223bf00<================
=========>gmacdev->MacBase = 0xb34b0000 DmaBase = 0xb34b1000
Bus Mode Reg after reset: 0x00020101, cnt=0
Bus Mode Reg after reset: 0x00020101, cnt=1
Bus Mode Reg after reset: 0x00020101, cnt=2
Bus Mode Reg after reset: 0x00020101, cnt=3
Bus Mode Reg after reset: 0x00020101, cnt=4
Bus Mode Reg after reset: 0x00020101, cnt=5
Bus Mode Reg after reset: 0x00020101, cnt=6
Bus Mode Reg after reset: 0x00020101, cnt=7
Bus Mode Reg after reset: 0x00020101, cnt=8
Bus Mode Reg after reset: 0x00020101, cnt=9
func:jz_mac_probe, synopGMAC_reset failed
jz_mac: probe of jz_mac.0 failed with error -1
daoudeddy commented 2 weeks ago

new error appeared

Ingenic on chip Ethernet MAC driver V13
wait stable.[289][cgu_macphy]
Bus Mode Reg after reset: 0x00020101, cnt=0
Bus Mode Reg after reset: 0x00020101, cnt=1
Bus Mode Reg after reset: 0x00020101, cnt=2
Bus Mode Reg after reset: 0x00020101, cnt=3
Bus Mode Reg after reset: 0x00020101, cnt=4
Bus Mode Reg after reset: 0x00020101, cnt=5
Bus Mode Reg after reset: 0x00020101, cnt=6
Bus Mode Reg after reset: 0x00020101, cnt=7
Bus Mode Reg after reset: 0x00020101, cnt=8
Bus Mode Reg after reset: 0x00020101, cnt=9
func:jz_mii_bus_probe, synopGMAC_reset failed
jz_mii_bus: probe of jz_mii_bus.0 failed with error -1
=======>gmacdev = 0x8223bf00<================
=========>gmacdev->MacBase = 0xb34b0000 DmaBase = 0xb34b1000
Bus Mode Reg after reset: 0x00020101, cnt=0
Bus Mode Reg after reset: 0x00020101, cnt=1
Bus Mode Reg after reset: 0x00020101, cnt=2
Bus Mode Reg after reset: 0x00020101, cnt=3
Bus Mode Reg after reset: 0x00020101, cnt=4
Bus Mode Reg after reset: 0x00020101, cnt=5
Bus Mode Reg after reset: 0x00020101, cnt=6
Bus Mode Reg after reset: 0x00020101, cnt=7
Bus Mode Reg after reset: 0x00020101, cnt=8
Bus Mode Reg after reset: 0x00020101, cnt=9
func:jz_mac_probe, synopGMAC_reset failed
jz_mac: probe of jz_mac.0 failed with error -1

sorry my bad disable_eth wasn't set