public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2
@ 2026-12-03  2:34 Vincent Li
  2026-12-03 17:03 ` Michael Tremer
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Li @ 2026-12-03  2:34 UTC (permalink / raw)
  To: development; +Cc: michael.tremer, Vincent Li

CONFIG_MMC_LOONGSON2 drives the Loongson-2K series SD/SDIO/eMMC
controller. It is required for onboard eMMC to be detected on
Loongson 2K3000 based boards (e.g. OrangePi Nova)

This mirrors the fix accepted upstream and in Debian, where the
missing driver was reported for the 2K3000/3B6000M platforms:
https://bugs.debian.org/1142793

Tested-by: Vincent Li <vincent.mc.li@gmail.com>
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
 config/kernel/config-loongarch64-generic | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/kernel/config-loongarch64-generic b/config/kernel/config-loongarch64-generic
index 180dd57ef..d8659be09 100644
--- a/config/kernel/config-loongarch64-generic
+++ b/config/kernel/config-loongarch64-generic
@@ -743,7 +743,7 @@ CONFIG_MMC_SDHCI_PLTFM=m
 # CONFIG_MMC_SDHCI_OF_DWCMSHC is not set
 # CONFIG_MMC_SDHCI_CADENCE is not set
 # CONFIG_MMC_SDHCI_MILBEAUT is not set
-# CONFIG_MMC_LOONGSON2 is not set
+CONFIG_MMC_LOONGSON2=m
 # CONFIG_SCSI_UFS_DWC_TC_PLATFORM is not set
 
 #
-- 
2.38.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2
  2026-12-03  2:34 [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2 Vincent Li
@ 2026-12-03 17:03 ` Michael Tremer
  2026-12-04  5:19   ` Vincent Li
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Tremer @ 2026-12-03 17:03 UTC (permalink / raw)
  To: development; +Cc: Vincent Li

Hi Vincent,

Thanks for the patch. I have merged it into next.

I added a few things around it:

- The module needs an entry in the rootfile, which the patch didn't have. I added loongson2-mmc.ko.xz in a separate commit.
- I enabled the other drivers that the 2K SoCs and the LS7A bridge need: clock, pin control, GPIO, I2C, RTC, thermal and APB DMA. I also enabled SPI with the Loongson SPI controllers, plus the generic device-tree drivers that boards usually need (OF serial, reset via GPIO, regulators, PWM, cpufreq-dt, DWC2 USB, on-board USB hubs, EFI RTC).

The loongarch64 kernel configuration so far was only meant to compile quickly and has only been run in a VM, never on real hardware. Your testing on the OrangePi Nova is therefore very valuable.

Could you try a build of next on your board and tell me:

1. Does the eMMC show up, and does it work for you now?
2. What does dmesg say? In particular, are there errors from the new drivers, or devices that still have no driver?
3. What does lspci -k show for devices without a driver?
4. Does the serial console work and does the board reboot and power off cleanly?
5. Is the board booted from a device tree or from ACPI? That tells me which of the new drivers are used.

For future patches, please drop the Tested-by: line when it is from the same person as the Signed-off-by:, and please check the link to the Debian bug, because I could not open it. Both are small points.

Thanks again for working on LoongArch support!

Best,
Michael


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2
  2026-12-03 17:03 ` Michael Tremer
@ 2026-12-04  5:19   ` Vincent Li
  2026-12-04  7:21     ` Vincent Li
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Li @ 2026-12-04  5:19 UTC (permalink / raw)
  To: Michael Tremer; +Cc: development, Vincent Li


Hi Michael,

I will try the next build on OrangePi Nova and report back. I got the 
Tested-by: point and Debian bug link that can be open.

Best

Vincent.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2
  2026-12-04  5:19   ` Vincent Li
@ 2026-12-04  7:21     ` Vincent Li
  2026-12-04  7:36       ` Vincent Li
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Li @ 2026-12-04  7:21 UTC (permalink / raw)
  To: Vincent Li; +Cc: Michael Tremer, development

[-- Attachment #1: Type: text/plain, Size: 8191 bytes --]


Hi Michael,

I let the AI pass through the kernel message and your question, here is 
answer from AI, sorry I am not fluent with the kernel boot message and 
lazy :).

================================================================================
ANSWERS: eMMC / dmesg / lspci -k / serial / reboot / ACPI vs DT
Sources: kernel.txt (dmesg), lsblk, lspci -k
Board: Loongson OrangePi-Nova-V1.1 (LA364, 8 cores), kernel 6.18.65-ipfire
================================================================================

--------------------------------------------------------------------------------
1. DOES THE eMMC SHOW UP, AND DOES IT WORK NOW?
--------------------------------------------------------------------------------
YES. The eMMC is detected and functional.

lsblk:
   mmcblk1        179:0    0  29.2G  0 disk
   ├─mmcblk1p1    179:1    0   512M  0 part
   ├─mmcblk1p2    179:2    0    32M  0 part
   ├─mmcblk1p3    179:3    0     1G  0 part
   └─mmcblk1p4    179:4    0  27.7G  0 part
   mmcblk1boot0   179:8    0     4M  1 disk
   mmcblk1boot1   179:16   0     4M  1 disk

dmesg:
   mmc0: new HS200 MMC card at address 0001
   mmcblk0: mmc0:0001 VM040 29.2 GiB
    mmcblk0: p1 p2 p3 p4
   mmcblk0boot0: mmc0:0001 VM040 4.00 MiB
   mmcblk0boot1: mmc0:0001 VM040 4.00 MiB

NOTE: the kernel enumerates it as mmcblk0; lsblk reports mmcblk1. Same 
device,different naming between the two captures (re-probe/udev rename). Size and
partition layout match. It probes at HS200 speed => functional, not just 
detected.

--------------------------------------------------------------------------------
2. WHAT DOES dmesg SAY? ERRORS FROM NEW DRIVERS / DEVICES WITH NO DRIVER?
--------------------------------------------------------------------------------
No device is left without a driver. eMMC and NVMe both probe successfully.
However, the NEW loongson2-mmc driver emits repeated errors because it is 
being driven through ACPI PRP0001 (the "DT-compatible" HID) without real 
DT properties:

   loongson2-mmc PRP0001:00: Can't get voltage, defaulting to 3.3V
   loongson2-mmc PRP0001:01: Can't get voltage, defaulting to 3.3V
   loongson2-mmc PRP0001:01: Failed to parse device node
   loongson2-mmc PRP0001:01: Got CD GPIO
   genirq: Setting trigger mode 3 for irq 26 failed 
(pch_pic_set_type+0x0/0x310)
   loongson2-mmc PRP0001:01: error -EINVAL: request_irq(26) 0x0 
mmc_gpio_cd_irqt
       [mmc_core] PRP0001:01 cd

Interpretation:
   - "Can't get voltage, defaulting to 3.3V": regulator/voltage property 
missing from ACPI; driver falls back. Warning, not fatal.
   - "Failed to parse device node": driver expects DT properties ACPI is 
not
     supplying. Repeats many times during boot.
   - "request_irq(26) ... -EINVAL": card-detect GPIO interrupt cannot be 
set up because pch_pic_set_type cannot program trigger mode 3 for IRQ 26.
     => hot-plug / CD detection via IRQ is broken; card still probes 
(driver continues without the CD IRQ).

Other non-fatal issues in dmesg:
   - r8169 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
   - nvme nvme0: missing or invalid SUBNQN field.
   - nvme nvme0: Ignoring bogus Namespace Identifiers  (NVMe still works)
   - xhci_hcd 0000:00:04.0: USB3 root hub has no ports
   - i8042: PNP: No PS/2 controller found.

--------------------------------------------------------------------------------
3. WHAT DOES lspci -k SHOW FOR DEVICES WITHOUT A DRIVER?
--------------------------------------------------------------------------------
PCI functions with NO "Kernel driver in use" line:

   00:06.0  Multimedia video controller
            Loongson Technology LLC LG200 GPU (rev 10)
            => NO DRIVER

   00:06.3  Multimedia controller
            Loongson Technology LLC Video Processing Unit Decoder
            => NO DRIVER

   00:06.4  Multimedia controller
            Loongson Technology LLC Video Processing Unit Encoder
            => NO DRIVER

   00:06.1  VGA compatible controller
            Loongson Technology LLC Video Display Controller (rev 10)
            => NO PCI driver bound; handled only by simpledrm /
               simple-framebuffer in dmesg (not a real GPU driver)

Everything else is bound:
   00:03.0  dwmac-loongson-pci   (dwmac_loongson)
   00:04.0  xhci_hcd             (xhci_pci)
   00:06.2  snd_hda_intel        (snd_hda_intel)
   00:07.0  snd_hda_intel        (snd_hda_intel)
   00:09.0  pcieport             (shpchp)
   00:0a.0  pcieport             (shpchp)
   00:0b.0  pcieport             (shpchp)
   00:0c.0  pcieport             (shpchp)
   00:0d.0  pcieport             (shpchp)
   00:16.0  loongson-spi-pci     (spi_loongson_pci)
   00:19.0  xhci_hcd             (xhci_pci)
   03:00.0  r8169                (r8169)
   05:00.0  nvme                 (nvme)

SUMMARY of unbound: 00:06.0 (LG200 GPU), 00:06.3 (VPU decoder),
00:06.4 (VPU encoder) have no driver; 00:06.1 (VGA) only has simpledrm.

--------------------------------------------------------------------------------
4. DOES THE SERIAL CONSOLE WORK, AND DOES THE BOARD REBOOT/POWER OFF 
CLEANLY?
--------------------------------------------------------------------------------
SERIAL: ports are initialized but NOT used as a kernel console.
   dmesg:
     00:00: ttyS0 at MMIO 0x1fe001e0 (irq = 42, base_baud = 6250000) is a 
8250
     00:01: ttyS1 at MMIO 0x10100000 (irq = 43, base_baud = 3000000) is a 
8250
     00:02: ttyS2 at MMIO 0x10100100 (irq = 43, base_baud = 3000000) is a 
8250
     00:03: ttyS3 at MMIO 0x10100200 (irq = 43, base_baud = 3000000) is a 
8250

   BUT the kernel command line is:
     BOOT_IMAGE=/boot/vmlinuz-6.18.65-ipfire root=UUID=... ro rd.auto
     panic=10 console=tty1
   => only console=tty1; NO console=ttyS0. Serial is not a kernel console 
in this boot. Interactive function cannot be proven from the log.

REBOOT: the log shows a clean second boot at Dec 4 14:47:01 (fresh kernel
banner, full ACPI/PCI re-enumeration), consistent with a successful 
reboot,but there is no explicit "reboot: Restarting system" message in the 
excerpt.

POWER OFF: ACPI PM reports "(supports S0 S5)" and
"ACPI S3 supported with Loongson ACPI SADR extension", so S5 poweroff is
advertised, but there is no explicit power-down message in the log to 
confirm it completed cleanly.

--------------------------------------------------------------------------------
5. DEVICE TREE OR ACPI? WHICH DRIVERS ARE USED?
--------------------------------------------------------------------------------
ACPI. Evidence:
   - efi: ACPI 2.0=0xeceaf000 ... (EFI passes ACPI)
   - full ACPI table set: RSDP, XSDT, FACP, DSDT, APIC, MCFG, IVRS, IOVT,
     SRAT, SLIT, VIAT, PPTT, FPDT, BGRT
   - ACPI: Interpreter enabled
   - ACPI: 1 ACPI AML tables successfully acquired and loaded
   - ACPI: PCI Root Bridge [PCI0]
   - ACPI: Using LPIC for interrupt routing
   - pnp: PnP ACPI: found 8 devices
   - eMMC enumerated as loongson2-mmc PRP0001:00 / PRP0001:01
     (PRP0001 = ACPI mechanism to bind DT-compatible drivers; NOT a real DT)

Drivers in use (ACPI path):
   loongson2-mmc (via PRP0001), dwmac-loongson-pci, r8169, nvme, xhci_hcd,
   snd_hda_intel, pcieport, loongson-spi-pci, loongson-rtc, simpledrm.

The loongson2-mmc driver is the one showing DT-property/ACPI mismatch 
errors and the CD-IRQ failure - expected when a DT-oriented driver is 
exercised via ACPI PRP0001 without full DT properties.

================================================================================
BOTTOM LINE
================================================================================
- eMMC: present and functional (HS200), 29.2G, 4 partitions + boot0/boot1.
- New driver errors: loongson2-mmc (ACPI PRP0001) logs voltage fallback,
   "Failed to parse device node", and CD IRQ request_irq(26) -EINVAL.
- No-driver PCI devices: 00:06.0 LG200 GPU, 00:06.3 VPU decoder,
   00:06.4 VPU encoder (00:06.1 VGA only has simpledrm).
- Serial: 4x 8250 ports registered, but console=tty1 only (no ttyS0 
console).
- Reboot: implied by clean second boot; poweroff (S5) advertised but not
   explicitly logged.
- Boot method: ACPI (not DT).
================================================================================

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2
  2026-12-04  7:21     ` Vincent Li
@ 2026-12-04  7:36       ` Vincent Li
  2026-12-04  8:43         ` Vincent Li
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Li @ 2026-12-04  7:36 UTC (permalink / raw)
  To: Vincent Li; +Cc: Michael Tremer, development


Just from my observation as a human, the device reboot cleanly, and works 
great!

Vincent


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2
  2026-12-04  7:36       ` Vincent Li
@ 2026-12-04  8:43         ` Vincent Li
  2026-12-04 14:37           ` Michael Tremer
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Li @ 2026-12-04  8:43 UTC (permalink / raw)
  To: Vincent Li; +Cc: Michael Tremer, development

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]


After the devices runs for a while, I noticed there is no temperatures 
report from the web UI status hardware:

No Sensors
This system does not report any temperatures, fans or voltages. The graphs 
will show up as soon as the hardware has sensors and the system has 
collected data from them.

I ran the sensors command, here is the output:

[root@ipfire ~]# sensors
r8169_0_300:00-mdio-0
Adapter: MDIO adapter
temp1:        +42.0°C  (high = +120.0°C)

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +33.0°C

nvme-pci-0500
Adapter: PCI adapter
Composite:    +44.9°C  (low  = -273.1°C, high = +82.8°C)
                        (crit = +84.8°C)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2
  2026-12-04  8:43         ` Vincent Li
@ 2026-12-04 14:37           ` Michael Tremer
  2026-12-05  0:36             ` Vincent Li
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Tremer @ 2026-12-04 14:37 UTC (permalink / raw)
  To: Vincent Li; +Cc: development

Hi Vincent,

Thank you very much for testing this. We have no LoongArch hardware to try things on, so your reports are the only real-world feedback we get. The Nova looks like a good board, though I can't find it on the Orange Pi website. Do you have a link to the product page?

Good to hear that the eMMC works and that the board reboots cleanly. The loongson2-mmc messages are expected. The driver is written for device trees, and your firmware hands it over through ACPI PRP0001. The card still works, but card-detect won't, so the driver will just treat the card as always present. That is fine for onboard eMMC.

On the sensors:

- The web UI shows no processor temperature because the system doesn't expose a CPU sensor. The Loongson thermal driver we have enabled only works with a device tree, and you boot with ACPI.
- We deliberately don't plot acpitz, because many firmwares report rubbish values.
- The NIC sensor isn't plotted either. The NVMe temperature is read directly from the drive, so it should show on the Storage page. Could you check there and tell me whether the NVMe temperature and health data appear?

The serial console is off by default on IPFire. If you want it, add console=ttyS0,115200n8 to the kernel command line.

In early January we plan to switch to the new LTS kernel, which should be out by then. It will probably have better driver support for these boards, including sensors and possibly the GPU and VPU. I would appreciate it if you tested again after that.

Best,
Michael


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2
  2026-12-04 14:37           ` Michael Tremer
@ 2026-12-05  0:36             ` Vincent Li
  0 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2026-12-05  0:36 UTC (permalink / raw)
  To: Michael Tremer; +Cc: Vincent Li, development


Hi Michael,

The Orange Pi Nova right now seems only available in China from some 
loongson's partner from online taobao.com. Loongfans community lend me one 
for testing. here is the device page from loongfans https://loongfans.cn/en/devices/opi-nova-v1.1

The storage page indeed shows the NVMe temperature.

It is good to hear IPFire will switch to new LTS kernel in January, I know 
some loongson 3A6000 NUC available from aliexpress come with 
motorcomm yt6801 NIC that only new LTS kernel has the upstream driver for.

Best,
Vincent



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-12-05  0:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03  2:34 [PATCH] kernel: Enable loongarch64 kernel config MMC_LOONGSON2 Vincent Li
2026-12-03 17:03 ` Michael Tremer
2026-12-04  5:19   ` Vincent Li
2026-12-04  7:21     ` Vincent Li
2026-12-04  7:36       ` Vincent Li
2026-12-04  8:43         ` Vincent Li
2026-12-04 14:37           ` Michael Tremer
2026-12-05  0:36             ` Vincent Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox