[Letux-kernel] X1600 / LX16 support - here: adding MMC - MAJOR BREAKTHROUGH

H. Nikolaus Schaller hns at goldelico.com
Sun Feb 11 08:50:53 CET 2024


Andreas, Paul,

> Am 11.02.2024 um 00:31 schrieb Andreas Kemnade <andreas at kemnade.info>:
> 
> But interestingly, as also tried with mmc0, I set bus-width to 1

First I tried to reduce bus-width to 1 with no success.

But then I did (for both mmc nodes with bus-width 4):

+++ b/arch/mips/boot/dts/ingenic/lx16.dts
-       max-frequency = <50000000>;
+       max-frequency = <5000000>;

Now I get:

Starting kernel ...

[    0.000000] Linux version 6.8.0-rc3-letux-lx16+ (hns at iMac.local) (mipsel-linux-gnu-gcc (GCC) 6.3.0, GNU ld (GNU Binutils) 2.28.1) #16505 PREEMPT Sun Feb 11 08:08:36 CET 2024
[    0.000000] CPU0 revision is: 00d00000 (Ingenic XBurst)
[    0.000000] FPU revision is: 00b70000
[    0.000000] MIPS: machine is Letux LX16
[    0.000000] Malformed early option 'earlycon'
[    0.000000] printk: debug: ignoring loglevel setting.
[    0.000000] User-defined physical RAM map overwrite
[    0.000000] Reserved memory: created DMA memory pool at 0x02000000, size 32 MiB
[    0.000000] OF: reserved mem: initialized node reserved_mem at 2000000, compatible id shared-dma-pool
[    0.000000] OF: reserved mem: 0x02000000..0x03ffffff (32768 KiB) map non-reusable reserved_mem at 2000000
[    0.000000] cma: Failed to reserve 32 MiB on node -1
[    0.000000] Primary instruction cache 16kiB, VIPT, 8-way, 64 sets, linesize 32 bytes.
[    0.000000] Primary data cache 16kiB, VIPT, 8-way, 64 sets, linesize 32 bytes.
[    0.000000] Unified secondary cache 128kiB, VIPT, 8-way, 512 sets, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Kernel command line: console=ttyS2,115200n8  rootfstype=ext4 root=/dev/mmcblk0p2 rw mem=32M at 0x0 earlycon console=ttyS2,115200 clk_ignore_unused ignore_loglevel rootwait
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.000000] Built 1 zonelists, mobility grouping off.  Total pages: 8120
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 21476K/32768K available (8460K kernel code, 271K rwdata, 1660K rodata, 288K init, 165K bss, 11292K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000]  Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 256
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] clocksource: ingenic-ost: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000001] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000074] ingenic_tcu_clocksource_init: 65535 vs. 65535
[    0.000086] ingenic_tcu_clocksource_init: 65535 vs. 65535
[    0.000104] clocksource: ingenic-timer: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 1215128 ns
[    0.000162] ingenic_tcu_setup_cevt: 65535 vs. 65535
[    0.000175] ingenic_tcu_init: 16 vs. 16
[    0.000201] sched_clock: 16 bits at 24MHz, resolution 41ns, wraps every 1365312ns
[    0.000201] Console: colour dummy device 80x25
[    0.000201] Calibrating delay loop... 1099.36 BogoMIPS (lpj=5496832)
[    0.000201] pid_max: default: 32768 minimum: 301
[    0.000201] LSM: initializing lsm=capability,integrity
[    0.000201] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000201] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000201] RCU Tasks: Setting shift to 0 and lim to 1 rcu_task_cb_adjust=1.
[    0.000201] rcu: Hierarchical SRCU implementation.
[    0.000201] rcu:     Max phase no-delay instances is 1000.
[    0.000201] devtmpfs: initialized
[    0.000201] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.000201] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.000201] pinctrl core: initialized pinctrl subsystem
[    0.000201] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.000201] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.000201] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.000201] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.000201] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.000201] jz4780-dma 13420000.dma: JZ4780 DMA controller initialised
[    0.000201] SCSI subsystem initialized
[    0.000201] usbcore: registered new interface driver usbfs
[    0.000201] usbcore: registered new interface driver hub
[    0.000201] usbcore: registered new device driver usb
[    0.000201] clocksource: Switched to clocksource ingenic-ost
[    0.000201] VFS: Disk quotas dquot_6.6.0
[    0.000201] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.000201] NET: Registered PF_INET protocol family
[    0.000201] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.000201] tcp_listen_portaddr_hash hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000201] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000201] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000201] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.000201] TCP: Hash tables configured (established 1024 bind 1024)
[    0.000201] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.000201] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.000201] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.000201] RPC: Registered named UNIX socket transport module.
[    0.000201] RPC: Registered udp transport module.
[    0.000201] RPC: Registered tcp transport module.
[    0.000201] RPC: Registered tcp-with-tls transport module.
[    0.000201] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.000201] Initialise system trusted keyrings
[    0.000201] workingset: timestamp_bits=14 max_order=13 bucket_order=0
[    0.000201] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.000201] Key type asymmetric registered
[    0.000201] Asymmetric key parser 'x509' registered
[    0.000201] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.000201] io scheduler mq-deadline registered
[    0.000201] io scheduler kyber registered
[    0.000201] Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
[    0.000201] 10030000.serial: ttyS0 at MMIO 0x10030000 (irq = 47, base_baud = 1500000) is a 16550A
[    0.000201] 10031000.serial: ttyS1 at MMIO 0x10031000 (irq = 46, base_baud = 1500000) is a 16550A
[    0.000201] 10032000.serial: ttyS2 at MMIO 0x10032000 (irq = 45, base_baud = 1500000) is a 16550A
[    0.000201] printk: legacy console [ttyS2] enabled
[    0.000201] 10033000.serial: ttyS3 at MMIO 0x10033000 (irq = 44, base_baud = 1500000) is a 16550A
[    0.000201] brd: module loaded
[    0.000201] loop: module loaded
[    0.000201] mtdoops: mtd device (mtddev=name/number) must be supplied
[    0.000201] usbcore: registered new interface driver usb-storage
[    0.000201] mousedev: PS/2 mouse device common for all mice
[    0.000201] i2c_dev: i2c /dev entries driver
[    0.000201] ledtrig-cpu: registered to indicate activity on CPUs
[    0.000201] usbcore: registered new interface driver usbhid
[    0.000201] usbhid: USB HID core driver
[    0.000201] NET: Registered PF_PACKET protocol family
[    0.000201] Loading compiled-in X.509 certificates
[    0.000201] MSC reset did timeout!!!
[    0.000201] MSC reset did timeout!!!
[    0.000201] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[    0.000201] clk: Not disabling unused clocks
[    0.000201] jz4740-mmc 13450000.mmc: Ingenic SD/MMC card driver registered
[    0.000201] jz4740-mmc 13450000.mmc: Using DMA, 1-bit mode
[    0.000201] Waiting for root device /dev/mmcblk0p2...
[    0.000201] mmc0: host does not support reading read-only switch, assuming write-enable
[    0.000201] mmc0: new high speed SDHC card at address 59b4
[    0.000201] mmcblk0: mmc0:59b4 USDU1 14.9 GiB
[    0.000201]  mmcblk0: p1 p2
[    0.000201] EXT4-fs (mmcblk0p2): mounted filesystem 25199531-41cc-41bb-8287-dec899b6b5f3 r/w without journal. Quota mode: none.
[    0.000201] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    0.000201] devtmpfs: mounted
[    0.000201] Freeing unused kernel image (initmem) memory: 288K
[    0.000201] This architecture does not have kernel memory protection.
[    0.000201] Run /sbin/init as init process
[    0.000201]   with arguments:
[    0.000201]     /sbin/init
[    0.000201]   with environment:
[    0.000201]     HOME=/
[    0.000201]     TERM=linux
[    0.000201] process '/sbin/init' started with executable stack
Mount failed for selinuxfs on /sys/fs/selinux:  No such file or directory
INIT: version 2.88 booting
[info] Using makefile-style concurrent boot in runlevel S.
[....] Starting the hotplug events dispatcher: udevd[    0.000201] systemd-udevd[523]: starting version 215
^[[c.
[ ok ] Synthesizing the initial hotplug events...done.
^[[c[....] Waiting for /dev to be fully populated...[    0.000201] random: crng init done
done.
[ ok ....] Setting parameters of disc: (none).
[ ok ....] Activating swap...done.
^[[c[    0.000201] EXT4-fs (mmcblk0p2): re-mounted 25199531-41cc-41bb-8287-dec899b6b5f3 ro. Quota mode: none.
[....] Checking root file system...fsck from util-linux 2.25.2
e2fsck 1.42.12 (29-Aug-2014)
rootfs: clean, 21447/925696 files, 198521/3701504 blocks
done.
^[[c[    0.000201] EXT4-fs (mmcblk0p2): re-mounted 25199531-41cc-41bb-8287-dec899b6b5f3 r/w. Quota mode: none.
[ ok ] Activating lvm and md swap...done.
^[[c[....] Checking file systems...fsck from util-linux 2.25.2
done.
[ ok ....] Cleaning up temporary files... /tmp.
[ ok ....] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok [[c[....] Cleaning up temporary files....
[ ok ....] Setting kernel variables ...done.
^[[c[    0.000201] UDC core: g_ether: couldn't find an available UDC
[....] Configuring network interfaces...Cannot find device "usb0"
Failed to bring up usb0.
done.
[ ok ....] Cleaning up temporary files....
[ ok ....] Setting up ALSA...done (none loaded).
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[....] Starting cgroup management daemon: cgmanager[....] Starting cgroup management proxy daemon: cgproxy[....] Star[ ok enhanced syslogd: rsyslogd.
[ ok ....] Starting periodic command scheduler: cron.
[ ok ....] Starting system message bus: dbus.
[ ok ....] Starting bluetooth: bluetoothd.
[ ok ....] Loading cpufreq kernel modules...done (none).
[ ok ....] CPUFreq Utilities: Setting ondemand CPUFreq governor...disabled, governor not available...done.
[ ok ....] Starting NTP server: ntpd.
[ ok ....] Starting OpenBSD Secure Shell server: sshd.
[ ok ....] Setting sysfs variables....
^[[c
Debian GNU/Linux 8 letux console

letux login: root
Password: 
Last login: Sat Feb 10 09:49:01 UTC 2024 on console
Linux letux 6.8.0-rc3-letux-lx16+ #16505 PREEMPT Sun Feb 11 08:08:36 CET 2024 mips

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

!!!  LetuxOS WARNING                                                      !!!
!!!  Root access through ssh and console with empty password is enabled.  !!!
!!!  This is a big security hole.                                         !!!
!!!  To disable, run 'apt-get remove letux-ssh-root'                      !!!

root at letux:~# uname -a
Linux letux 6.8.0-rc3-letux-lx16+ #16505 PREEMPT Sun Feb 11 08:08:36 CET 2024 mips GNU/Linux
root at letux:~# 
Thu Jan  1 00:08:14 UTC 1970
root at letux:~# date
Thu Jan  1 00:08:14 UTC 1970
root at letux:~# evtest /dev/input/event0 
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio_keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 143 (KEY_WAKEUP)
    Event code 158 (KEY_BACK)
Properties:
Testing ... (interrupt to exit)
Event: time 518.571759, type 1 (EV_KEY), code 143 (KEY_WAKEUP), value 1
Event: time 518.571759, -------------- EV_SYN ------------
^C
root at letux:~# which devmem2
/usr/bin/mipsel-linux-gnu/devmem2
root at letux:~# 
root at letux:~# poweroff

Broadcast message from root at letux (console) (Thu Jan  1 00:11:01 1970):

The system is going down for system halt NOW!
INIT: Switching to runlevel: 0
INIT: Sending processes the TERM signal
[info] Using makefile-style concurrent boot in runlevel 0.
[ ok ] Shutting down ALSA...done (none loaded).
[ ok ....] Stopping cgroup management daemon: cgmanager[....] Stopping bluetooth: /usr/sbin/bluetoothd.
[ ok ....] Stopping cgroup management proxy daemon: cgproxy[....] Asking all remaining processes to terminate...done.

[ ok ] All processes ended within 2 seconds...done.
[ ok [[c[....] Stopping enhanced syslogd: rsyslogd.
^[[c[info] Saving the system clock.
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.
[ ok ] Deconfiguring network interfaces...done.
[ ok ....] Deactivating swap...done.
^[[c[    0.000201] EXT4-fs (mmcblk0p2): re-mounted 25199531-41cc-41bb-8287-dec899b6b5f3 ro. Quota mode: none.
[info] Will now halt.
[    0.000201] reboot: Power off not available: System halted instead

This is A MAJOR BREAKTHROUGH!

So the main factor is indeed the SD card speed (and clock calculations).
Reduced bus width may work with some SD cards and X1600 unit.

I have pushed this working code to 

	https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-x1600-v3

Now we can think about cleaning up some x1600 specific hacks (and the jz4730 hasdma = false)
so that we can integrate this status back to full letux-current.

Then we can start to work on fixing more issues and omissions.

BR and thanks,
Nikolaus


Notes:
- driver does not detect release of WAKEUP key...
- there is no power-controller code installed for real power-off



More information about the Letux-kernel mailing list