Welcome! Log In Create A New Profile

Advanced

Debian on Action Tech SG200 and MI424WR-rev-I

Posted by veriqster 
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 02, 2021 05:30AM
bodhi,

root@OpenWrt:/# dmesg | grep -i pci
[    0.035130] PCI: CLS 0 bytes, default 32
[    0.186546] mvebu-pcie mbus:pcie@82000000: PCI host bridge to bus 0000:00
[    0.186565] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.186578] pci_bus 0000:00: root bus resource [mem 0xf3000000-0xf3ffffff]
[    0.186590] pci_bus 0000:00: root bus resource [io  0x1000-0xeffff]
[    0.186724] pci 0000:00:02.0: [11ab:6500] type 01 class 0x060400
[    0.186758] pci 0000:00:02.0: reg 0x38: [mem 0x00000000-0x000007ff pref]
[    0.187962] PCI: bus0: Fast back to back transfers disabled
[    0.187978] pci 0000:00:02.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.189152] PCI: bus1: Fast back to back transfers enabled
[    0.189170] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.189378] pci 0000:00:02.0: BAR 6: assigned [mem 0xf3000000-0xf30007ff pref]
[    0.189393] pci 0000:00:02.0: PCI bridge to [bus 01]
root@OpenWrt:/# lsmod
cfg80211              299008  2 rtlwifi,mac80211
compat                 16384  4 rtl8192ce,rtlwifi,mac80211,cfg80211
crc_ccitt              16384  1 ppp_async
ehci_fsl               16384  0
ehci_hcd               45056  3 ehci_platform,ehci_orion,ehci_fsl
ehci_orion             16384  0
ehci_platform          16384  0
exfat                  73728  0
ext4                  405504  0
fat                    65536  2 msdos,vfat
fsl_mph_dr_of          16384  0
gpio_button_hotplug    16384  0
ip_tables              20480  4 iptable_nat,iptable_mangle,iptable_filter
ip6_tables             20480 24 ip6table_mangle,ip6table_filter
ip6t_REJECT            16384  2
ip6table_filter        16384  1
ip6table_mangle        16384  0
ipt_REJECT             16384  2
iptable_filter         16384  1
iptable_mangle         16384  0
iptable_nat            16384  1
jbd2                   65536  1 ext4
mac80211              544768  3 rtl8192ce,rtl_pci,rtlwifi
mbcache                16384  1 ext4
msdos                  20480  0
nf_conntrack           73728  7 xt_state,xt_nat,xt_conntrack,xt_REDIRECT,xt_MASQUERADE,nf_nat,nf_flow_table
nf_defrag_ipv4         16384  1 nf_conntrack
nf_defrag_ipv6         16384  1 nf_conntrack
nf_flow_table          24576  2 xt_FLOWOFFLOAD,nf_flow_table_hw
nf_flow_table_hw       16384  1
nf_log_common          16384  2 nf_log_ipv4,nf_log_ipv6
nf_log_ipv4            16384  0
nf_log_ipv6            16384  0
nf_nat                 28672  4 iptable_nat,xt_nat,xt_REDIRECT,xt_MASQUERADE
nf_reject_ipv4         16384  1 ipt_REJECT
nf_reject_ipv6         16384  1 ip6t_REJECT
nls_cp437              16384  0
nls_iso8859_1          16384  0
nls_utf8               16384  0
ntfs                  110592  0
ppp_async              20480  0
ppp_generic            32768  3 pppoe,ppp_async,pppox
pppoe                  20480  0
pppox                  16384  1 pppoe
rtl_pci                28672  1 rtl8192ce
rtl8192c_common        40960  1 rtl8192ce
rtl8192ce              57344  0
rtlwifi                61440  3 rtl8192ce,rtl8192c_common,rtl_pci
slhc                   16384  1 ppp_generic
vfat                   20480  0
x_tables               24576 23 xt_state,xt_nat,xt_conntrack,xt_REDIRECT,xt_MASQUERADE,xt_FLOWOFFLOAD,ipt_REJECT,xt_time,xt_tcpudp,xt_multiport,xt_mark,xt_mac,xt_limit,xt_comment,xt_TCPMSS,xt_LOG,iptable_mangle,iptable_filter,ip_tables,ip6table_mangle,ip6table_filter,ip6_tables,ip6t_REJECT
xt_FLOWOFFLOAD         16384  0
xt_LOG                 16384  0
xt_MASQUERADE          16384  1
xt_REDIRECT            16384  0
xt_TCPMSS              16384  0
xt_comment             16384107
xt_conntrack           16384 12
xt_limit               16384 20
xt_mac                 16384  0
xt_mark                16384  0
xt_multiport           16384  0
xt_nat                 16384  0
xt_state               16384  0
xt_tcpudp              16384  8
xt_time                16384  0
root@OpenWrt:/#
These information seemed useless, they are just the values in the DTS. At least we should compile MvPex.c to a binary or .ko file and have another try. I'm quite sure the key to the problem is here.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 02, 2021 05:09PM
8086k

Download the Debian kernel linux-5.12.6-kirkwood-tld-1-bodhi.tar.bz2 here:

https://forum.doozan.com/read.php?2,12096

Create uImage (for now just use avanta-mi424wr.dtb to test).

cp -a zImage-5.12.6-kirkwood-tld-1  zImage.fdt
cat dts/avanta-mi424wr.dtb  >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n 5.12.6-kirkwood-tld-1 -d zImage.fdt  uImage

And then use tftp to boot this kernel uImage.

See how far you go in booting it and if the PCIe port is initialized OK.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 04, 2021 05:28AM
bodhi,

!! this file is out of date, please scroll down to get the newest hacked uboot for F420/F660

I find another way to 'autoboot' openwrt. I can use the tftp upgrade function. This function will be called when pushing reset button. Tftp means ethernet must be initialized that time. But a problem is not solved yet. I still can't make the uboot header. Do you have any ideas about that?

edit: I have tested my idea and it works well. To my surprise, this also fixes the serial problem! I'm very happy. Now it's time to figure out how to remake the header of this uboot image to flash it into nand. I have proved bootrom uses checksum, when I flash it directly, bootrom won't boot it.

The hacked file is here, now users must use kwboot to boot it, it can solve the serial console problem. When booting this image, keep press the reset button, or it won't run bootcmd automatically. Finally, don't forget to change 'bootcmd' env to ''wdtdbg watchdog 0; nand read 0x2000000 0x80000 0x200000; bootm''.

8086k



Edited 4 time(s). Last edit at 06/07/2021 05:50AM by 8086k.
Attachments:
open | download - uboot-hacked.bin (239.7 KB)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 05, 2021 11:04PM
bodhi,

I'm trying to use doimage to create an image, but everytime when I run it, it returns 'segmentation fault' . Have you got this error when building sg200 uboot? I am using the same argument as makefile.

edit: The problem is solved. I use the binary which is compiled already and make the nand boot image succeasfully. Now the uboot hack is done. :)

edit2: 88f6560's boot image does have an 32bit checksum, but it is located at the end of the image.

8086k



Edited 2 time(s). Last edit at 06/05/2021 11:58PM by 8086k.
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 06, 2021 12:53AM
bodhi,

This is the final hacked u-boot file.

To use it, follow the following steps:
1,Flash it to the NAND in uboot or linux(the uboot partition is 512KB)
2,Make sure you have flashed openwrt or other custom OS
3,Change 'bootcmd' to a suitable command for your OS(when using openwrt, you can leave it alone, because I have changed it for my openwrt)
4,Turn off your F660 or F420, keep pressing 'reset' button and power it on(you need to press it for 5 seconds)
5,Then your OS should be booted without problems

8086k



Edited 1 time(s). Last edit at 06/07/2021 05:30AM by 8086k.
Attachments:
open | download - F660_u-boot-hacked-full.bin (512 KB)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 06, 2021 03:23PM
8086k Wrote:
-------------------------------------------------------
> bodhi,
>
> This is the final hacked u-boot file.
>
> 8086k

Thanks!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 07, 2021 05:20AM
bodhi,

Please run 'mpp' command in uboot and post the output. This may help me figure out the buttons' or LEDs' gpio in F660.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 07, 2021 04:44PM
8086k,

Somewhere in this thread, there is a link to the MI424WR-rev-I GPL source. That's where you can find more info about stock u-boot.

My MI424WR-rev-I has been shut down and put back in the shelf. It will be a while until I play with this box again.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 06/07/2021 04:46PM by bodhi.
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 08, 2021 06:41AM
bodhi,

Okay, I think this is enough. Without buttons and LEDs it works well too. I will have a rest from doing it.

8086k



Edited 1 time(s). Last edit at 06/08/2021 06:41AM by 8086k.
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 13, 2021 08:56AM
bodhi,

I pushed the code to github, this is my repositry.
github.com/msdos03/openwrt-f660
To compile it for f660, just select mi424wr in menuconfig. I can't add a target to it successfully.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 13, 2021 08:58AM
bodhi,

Hope to see the neta driver of new kernel versions will be available soon.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 18, 2021 08:13AM
bodhi,

I run sg200's uboot on F660 successfully. But the whole network config is a mess. I compared mi424wr's uboot and sg200's uboot and can't find anything about ethernet config. It will shut down the switch and the 3xFE PHYs. Can you discover any of these configs in uboot code?

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 18, 2021 05:23PM
8086k,

The MI424WR-rev-I patches are quite clearly documented in the GPL source. So you could look at the part where the switch is configured in MI424WR-rev-I code. And modify it for the F660.

I'm not at all interested in this stock u-boot, so cannot be of much help to you. My goal was to have the DTS defined in the latest kernel for the MI424WR-rev-I, and then the variants. But some other more important stuff have taken priority.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 19, 2021 10:59AM
bodhi,

I build mi424wr's uboot. Hope to find an easier way to make it work.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 30, 2021 12:07AM
bodhi,

Sorry for asking again. I want to figure out the gpio numbers of F660. How can I read the state of gpios? I read your post about setting gpios of kirkwood but I cannot find the differences when I push a button or plug in an rj45 port.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
June 30, 2021 03:53PM
8086k,

> Sorry for asking again. I want to figure out the
> gpio numbers of F660. How can I read the state of
> gpios?

Not at all, it's a general question. In the Wiki thread:

https://forum.doozan.com/read.php?2,23630

Quote

Developer Section

Jeff's Notes on building uBoot for the Kirwood plugs
Finding address of stock envs of fw_printenv
Basic steps in building Linux modules
Peek/Poke GPIOs in serial console (Armada SoC example)
Peek/Poke GPIOs in serial console (Kirkwood SoC example)

The basic idea is to use md command to display memory. And the GPIOs are at a memory location that you can dump out and parse the bits to see if certain GPIO is set or clear.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 05, 2021 01:03AM
bodhi,

Thank you for your help!
Now I can control the LEDs in U-Boot. But how can I read the state of buttons? The gpio memory values doesn't react that event.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 05, 2021 03:13PM
8086k,

The button is trickier. Try holding the button while doing md. Some button when you press it, the GPIO is set, but some other button the GPIO is clear.

If there is no change when you press and hold, then I don't have any idea why (without the GPL source we don't know exactly what driver it uses, and whether the button is active).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 05, 2021 06:22PM
bodhi,

I found that 88f6560 have 3 groups of GPIO. The first two have 32 GPIOs the last one have 24 GPIOs. This means I must change the DTS. But the successive interrupts which are used in the original DTS is not enough. Can I use other free interrupts?

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 06, 2021 09:47AM
bodhi,

The pinctrl driver in linux is another problem. Kirkwood's driver can only control one and a half bank of GPIOs. I found that armada370's pinctrl driver is more suitable for avanta and it can control two and a half banks of GPIOs. But avanta has three groups of GPIOs. Still several GPIOs can't be controlled.

8086k



Edited 2 time(s). Last edit at 07/06/2021 09:49AM by 8086k.
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 09, 2021 07:41AM
bodhi,

I modified the pinctrl driver of armada370. Now all the leds can work. How I can control them through terminal commands?

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 09, 2021 04:10PM
The Wiki thread


Quote

Sensors & Fan & WOL

OWFSPlug : 1-Wire File System + Motion Detection Software in a NAND Package
OWFS & Motion Detection (external link)
How to control GPIO in Linux userspace for GPIO-enable fan
Zyxel NSA 310S/320S/325/326 CPU Temperature and Fan Speed reading
Zyxel NAS326 WOL
Zyxel NAS326 Auto-Power Up
Zyxel NAS326 WOL and Auto-Power Up I2C commands
Zyxel NSA320 Auto-Power Up

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 11, 2021 08:42AM
bodhi,

What problem do you think is in mvneta driver? Mvneta in kernel 5.4 is very different from kernel 3.14, porting it is very hard. I have tested with 3.18 kernel, mvneta doesn't work too. I'm not sure which is the cause to the problem. 3.18 is more similar to 3.14 but there are still some differences.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 18, 2021 09:13AM
bodhi,

Yeah, I think I solved the serial interrupt problem. If you want to avoid this problem when booting from uboot console, use go command instead of bootm command. I'm not sure whether it will work on actiontech devices yet.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 18, 2021 04:55PM
8086k,

The MI424WR-rev-I does not have any serial console problem.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 18, 2021 11:54PM
bodhi,

root@OpenWrt:/# lspci
00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 6560 (rev 02)
00:02.0 PCI bridge: Marvell Technology Group Ltd. Device 6500 (rev 02)
02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8192CE PCIe Wirel                                                                                        ess Network Adapter (rev 01)
root@OpenWrt:/# lspci -v
00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 6560 (rev 02) (prog-if                                                                                         00 [Normal decode])
        Flags: fast devsel
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        Prefetchable memory behind bridge: 00000000-000fffff
lspci: Unable to load libkmod resources: error -12

00:02.0 PCI bridge: Marvell Technology Group Ltd. Device 6500 (rev 02) (prog-if                                                                                         00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
        I/O behind bridge: 00010000-00010fff
        Memory behind bridge: f3000000-f30fffff
        Prefetchable memory behind bridge: 00000000-000fffff

02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8192CE PCIe Wirel                                                                                        ess Network Adapter (rev 01)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL8192CE PCIe Wireless Netwo                                                                                        rk Adapter
        Flags: bus master, fast devsel, latency 0, IRQ 24
        I/O ports at 10000 [size=256]
        Memory at f3000000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number 01-91-81-fe-ff-4c-e0-00
        Kernel driver in use: rtl8192ce

See this, Claudio's PCIE1 IO BASE is wrong. I fix it.
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 19, 2021 12:17AM
8086k,

> See this, Claudio's PCIE1 IO BASE is wrong. I fix
> it.

You just don't know what you're talking about :)

Claudio DTS was not wrong. It just mean you have a different box and a different Wifi chip.

https://forum.doozan.com/read.php?2,78499,120849#msg-120849

Quote

root@mi424:~# lspci -v
00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 6560 (rev 02) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
Memory behind bridge: f3000000-f30fffff
Prefetchable memory behind bridge: 00000000-000fffff
[virtual] Expansion ROM at f3100000 [disabled] [size=2K]
Capabilities: [40] Express Root Port (Slot+), MSI 00

01:00.0 Network controller: Qualcomm Atheros AR9287 Wireless Network Adapter (PCI-Express) (rev 01)
Subsystem: Qualcomm Atheros AR9287 Wireless Network Adapter (PCI-Express)
Flags: bus master, fast devsel, latency 0, IRQ 31
Memory at f3000000 (64-bit, non-prefetchable) [size=64K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit-
Capabilities: [60] Express Legacy Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Capabilities: [160] Device Serial Number 00-15-xx-ff-xx-xx-xx-xx
Capabilities: [170] Power Budgeting <?>
Kernel driver in use: ath9k
Kernel modules: ath9k


I hope it makes sense.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 19, 2021 01:04AM
bodhi,

DTS isn't wrong. But in 3.14 kernel, some configs are not in DTS. I modified KIRKWOOD_PCIE1_IO_PHYS_BASE in kirkwood.h and it works. MI424WR-REVI uses PCIE0 and KIRKWOOD_PCIE_IO_PHYS_BASE is correct. This is why when a box uses PCIE1, the device won't work.

8086k
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 19, 2021 06:25PM
8086k,

As I said,

Quote

It just mean you have a different box and a different Wifi chip

I have been saying that you have a different box, and you need to tailor the DTS to work with it. There is nothing wrong about Claudio's MI424WR-rev-I DTS.

Perhaps something was "lost in translation".

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian on Action Tech SG200 and MI424WR-rev-I
July 21, 2021 10:30AM
bodhi,

There is a strange problem again. When I try to enable WIFI in openwrt, the whole system halted. No more thing is printed through the serial console. Sometimes the serial console will print something, but just few lines.

The driver found the chip and loaded successfully, I can see the device through lspci too. But I can't enable it. What a strange thing.

8086k



Edited 1 time(s). Last edit at 07/21/2021 10:32AM by 8086k.
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: