Sg2000-pinctrl not initalizing

Im trying to compile mainline for the Milkv Duo S. I dont get any output when using a device tree from mainline. However I can get console output when using the device tree from the 2.0.1 release. Ive gotten it to boot but I cant get it to load the SD card, getting stuck at:

...
[    1.919981] Waiting for root device /dev/mmcblk0p3...
[   12.006346] platform 4010000.i2c: deferred probe pending: (reason unknown)
[   12.013591] platform 4020000.i2c: deferred probe pending: (reason unknown)
[   12.020822] platform 4030000.i2c: deferred probe pending: (reason unknown)
[   12.027945] platform 4040000.i2c: deferred probe pending: (reason unknown)
[   12.035068] platform 41b0000.spi3: deferred probe pending: (reason unknown)

Earlier in the boot I can see the pinctrl module having an issue.

[    0.731541] sg2000-pinctrl 300100000001000.pinctrl: probe with driver sg2000-pinctrl failed with error -12

It would make sense that it cannot load the SD card because it cannot mux the pins as needed. I decompiled the 2.0.1 device tree and have been modifying it to try to get the SD card to mount.

My two questions are:

  1. Why would there be no console output when using the mainline device tree? It could be related to the pin mux but it works if I remove the old pin mux device tree entry, meaning the console is earlier in the process.
  2. Why is the sg2000-pinctrl module failing to probe? -12 is ENOMEM, but I cant think of a reason for it not being able to allocate.
1 Like

I got the console to work by decompiling the device tree from mainline and changing the serial from this:

                serial@4140000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x4140000 0x100>;
                        interrupts = <0x00 0x1c 0x04>;
                        clocks = <0x04 0x4d 0x04 0x4e>;
                        clock-names = "baudclk", "apb_pclk";
                        reg-shift = <0x02>;
                        reg-io-width = <0x04>;
                        resets = <0x03 0x17>;
                        status = "okay";
                        pinctrl-0 = <0x09>;
                        pinctrl-names = "default";
                };

To the serial defined in the 2.0.1 device tree:

               serial@04140000 {
                        compatible = "snps,dw-apb-uart";
                        //reg = <0x00 0x4140000 0x00 0x1000>;
                        reg = <0x4140000 0x1000>;
                        clock-frequency = <0x17d7840>;
                        reg-shift = <0x02>;
                        reg-io-width = <0x04>;
                        status = "okay";
                        interrupts = <0x00 0x1c 0x04>;
                };
1 Like

I was able to get console output using the mainline generated device tree by removing the resets property from uart0. Here is what my device tree looks like:

/dts-v1/;                                                                      
                                       
#include <dt-bindings/pinctrl/pinctrl-sg2000.h>
#include "sg2000.dtsi"           
                                                                               
/ {                                  
        model = "Milk-V DuoS";                                                 
        compatible = "milkv,duo-s", "sophgo,sg2000";
                                       
        aliases {                      
                serial0 = &uart0; 
        };                                                                     
                                                                               
        chosen {                                                               
                stdout-path = "serial0:115200n8";        
        };                           
};                                                                             
                                                                               
&osc {                                 
        clock-frequency = <25000000>;
};

&pinctrl {                             
        sdhci0_cfg: sdhci0-cfg {                                               
                sdhci0-cd-pins {
                        pinmux = <PINMUX(PIN_SD0_CD, 0)>;
                        bias-pull-up;
                        drive-strength-microamp = <10800>;
                        power-source = <3300>;
                };

                sdhci0-clk-pins {
                        pinmux = <PINMUX(PIN_SD0_CLK, 0)>;
                        bias-pull-up;
                        drive-strength-microamp = <16100>;
                        power-source = <3300>;
                };

                sdhci0-cmd-pins {
                        pinmux = <PINMUX(PIN_SD0_CMD, 0)>;
                        bias-pull-up;
                        drive-strength-microamp = <10800>;
                        power-source = <3300>;
                };

                sdhci0-data-pins {
                        pinmux = <PINMUX(PIN_SD0_D0, 0)>,
                                 <PINMUX(PIN_SD0_D1, 0)>,
                                 <PINMUX(PIN_SD0_D2, 0)>,
                                 <PINMUX(PIN_SD0_D3, 0)>;
                        bias-pull-up;
                        drive-strength-microamp = <10800>;
                        power-source = <3300>;
                };
        };
uart0_cfg: uart0-cfg {
                uart0-pins {
                        pinmux = <PINMUX(PIN_UART0_TX, 0)>,
                                 <PINMUX(PIN_UART0_RX, 0)>;
                        bias-pull-up;
                        drive-strength-microamp = <10800>;
                        power-source = <3300>;
                };
        };
};

&uart0 {
        pinctrl-0 = <&uart0_cfg>;
        pinctrl-names = "default";
        status = "okay";

        /delete-property/ resets;
};

&sdhci0 {
        bus-width = <4>;
        no-1-8-v;
        no-mmc;
        no-sdio;
        non-removable;
        keep-power-in-suspend;
        disable-wp;
        pinctrl-0 = <&sdhci0_cfg>;
        pinctrl-names = "default";
        status = "okay";
};

I am now getting messages from pinctrl and I can see it mux uart0:

...
[    0.727466] sg2000-pinctrl 3001000.pinctrl: found group selector 0 for uart0-cfg.uart0-pins
[    0.727479] sg2000-pinctrl 3001000.pinctrl: found group selector 0 for uart0-cfg.uart0-pins
[    0.727495] sg2000-pinctrl 3001000.pinctrl: request pin 3332 (UART0_TX) for 4140000.serial
[    0.727509] sg2000-pinctrl 3001000.pinctrl: request pin 3331 (UART0_RX) for 4140000.serial
...

But I still cannot get it to see the sd. I do not see any logs for it muxing the sdhci0 or mmc config, so Im wondering if it is and if there is a way to probe it / force it.

1 Like

Turns out I was missing some required drivers under STMicro for to get the SDHC to work. I can now boot to the sd card but dont have ethernet. Im getting the following kernel logs:

[   13.037752] stmmaceth 4070000.ethernet: IRQ eth_wake_irq not found
[   13.052716] stmmaceth 4070000.ethernet: IRQ eth_lpi not found
[   13.068369] stmmaceth 4070000.ethernet: IRQ sfty not found
[   13.081017] stmmaceth 4070000.ethernet: Hash table entries set to unexpected value 0
[   13.091176] stmmaceth 4070000.ethernet: dt configuration failed
[   13.102631] platform 3009800.mdio-mux: deferred probe pending: mdio-mux-mmioreg: failed to register mdio-mux bus /soc/mdio-mux@3009800
[   13.115262] platform 4070000.ethernet: deferred probe pending: (reason unknown)
[   13.126790] platform 4010000.i2c: deferred probe pending: (reason unknown)
[   13.135846] platform 4020000.i2c: deferred probe pending: (reason unknown)
[   13.145082] platform 4030000.i2c: deferred probe pending: (reason unknown)
[   13.154168] platform 3020000.gpio: deferred probe pending: gpio-dwapb: Cannot get reset descriptor
[   13.164631] platform 3021000.gpio: deferred probe pending: gpio-dwapb: Cannot get reset descriptor
[   13.176666] platform 3022000.gpio: deferred probe pending: gpio-dwapb: Cannot get reset descriptor
[   13.187844] platform 3023000.gpio: deferred probe pending: gpio-dwapb: Cannot get reset descriptor
[   13.199219] platform 4150000.serial: deferred probe pending: (reason unknown)
[   13.208539] platform 4160000.serial: deferred probe pending: (reason unknown)
[   13.217913] platform 4170000.serial: deferred probe pending: (reason unknown)
[   13.227227] platform 41c0000.serial: deferred probe pending: (reason unknown)
1 Like

Have you applied the Ethernet patches? They do work.

2 Likes

The Ethernet mdio patches listed here? I have not applied these and will try. Thanks for the tip.

1 Like
$ git grep -l mdio-mux-mmioreg drivers/net/mdio
drivers/net/mdio/Makefile
drivers/net/mdio/mdio-mux-mmioreg.c

$ git grep mdio-mux-mmioreg drivers/net/mdio/Makefile
drivers/net/mdio/Makefile:35:obj-$(CONFIG_MDIO_BUS_MUX_MMIOREG) 	+= mdio-mux-mmioreg.o

Please enable MDIO_BUS_MUX_MMIOREG

2 Likes

I was using kernel 6.12 for my commit, so yes, a subset may be needed after 6.17.

2 Likes

I have that enabled and im still seeing the error. Im thinking it is something with my device tree. Do you know if the pinctrl is needed to mux any pins for it?

1 Like

I do not remember exactly. Here’s the patch I applied.

1 Like

Please dmesg (or boot messages via serial) and your dts

maybe also your kernel version.

1 Like