diff mbox series

[v2,8/8] arm64: dts: rockchip: Enable SD-card interface on Radxa E20C

Message ID 20250305194638.47187-1-ziyao@disroot.org (mailing list archive)
State New
Headers show
Series Support SD/SDIO controllers on RK3528 | expand

Commit Message

Yao Zi March 5, 2025, 7:46 p.m. UTC
SD-card is available on Radxa E20C board.

Signed-off-by: Yao Zi <ziyao@disroot.org>
---
 .../boot/dts/rockchip/rk3528-radxa-e20c.dts   | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Chukun Pan March 7, 2025, 3:35 a.m. UTC | #1
Hi,

> +&sdmmc {
> +	bus-width = <4>;
> +	cap-mmc-highspeed;
> +	cap-sd-highspeed;
> +	disable-wp;
> +	no-sdio;

With 'no-sdio' property:
[  129.608986] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[  130.711168] mmc1: Card stuck being busy! __mmc_poll_for_busy
[  130.725536] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
[  131.751240] mmc1: Card stuck being busy! __mmc_poll_for_busy
[  131.765608] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)
[  132.825083] mmc1: Card stuck being busy! __mmc_poll_for_busy
[  132.839413] mmc_host mmc1: Bus speed (slot 0) = 187500Hz (slot req 187500Hz, actual 187500HZ div = 0)
[  133.960141] mmc1: Card stuck being busy! __mmc_poll_for_busy

Without 'no-sdio' property:
[  105.224019] mmc1: error -22 whilst initialising SDIO card
[  106.290838] mmc1: Card stuck being busy! __mmc_poll_for_busy
[  106.801931] dwmmc_rockchip ffc30000.mmc: Busy; trying anyway
[  107.385835] mmc_host mmc1: Timeou sending command (cmd 0x202000 arg 0x0 status 0x80202000)
[  107.400425] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
[  107.431561] mmc_host mmc1: Bus speed (slot 0) = 49800000Hz (slot req 50000000Hz, actual 49800000HZ div = 0)
[  107.433107] mmc1: new high speed SDIO card at address 0001

# cat /sys/kernel/debug/mmc1/ios
clock:          50000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    2 (sd high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)

Thanks,
Chukun
Yao Zi March 7, 2025, 5:52 a.m. UTC | #2
On Fri, Mar 07, 2025 at 11:35:08AM +0800, Chukun Pan wrote:
> Hi,
> 
> > +&sdmmc {
> > +	bus-width = <4>;
> > +	cap-mmc-highspeed;
> > +	cap-sd-highspeed;
> > +	disable-wp;
> > +	no-sdio;
> 
> With 'no-sdio' property:
> [  129.608986] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
> [  130.711168] mmc1: Card stuck being busy! __mmc_poll_for_busy
> [  130.725536] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
> [  131.751240] mmc1: Card stuck being busy! __mmc_poll_for_busy
> [  131.765608] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)
> [  132.825083] mmc1: Card stuck being busy! __mmc_poll_for_busy
> [  132.839413] mmc_host mmc1: Bus speed (slot 0) = 187500Hz (slot req 187500Hz, actual 187500HZ div = 0)
> [  133.960141] mmc1: Card stuck being busy! __mmc_poll_for_busy
> 
> Without 'no-sdio' property:
> [  105.224019] mmc1: error -22 whilst initialising SDIO card
> [  106.290838] mmc1: Card stuck being busy! __mmc_poll_for_busy
> [  106.801931] dwmmc_rockchip ffc30000.mmc: Busy; trying anyway
> [  107.385835] mmc_host mmc1: Timeou sending command (cmd 0x202000 arg 0x0 status 0x80202000)
> [  107.400425] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
> [  107.431561] mmc_host mmc1: Bus speed (slot 0) = 49800000Hz (slot req 50000000Hz, actual 49800000HZ div = 0)
> [  107.433107] mmc1: new high speed SDIO card at address 0001

So it seems the sdmmc controller actually works with SDIO commands as
well? I don't expect that since the datasheet says RK3528 has only two
SDIO 3.0 controllers.

We could remove the "no-sdio" property if SDIO actually works. Will
apply it in the next version if there's no objection against this.

Further tests about the capabilities of the controller are welcome.

> # cat /sys/kernel/debug/mmc1/ios
> clock:          50000000 Hz
> vdd:            21 (3.3 ~ 3.4 V)
> bus mode:       2 (push-pull)
> chip select:    0 (don't care)
> power mode:     2 (on)
> bus width:      2 (4 bits)
> timing spec:    2 (sd high-speed)
> signal voltage: 0 (3.30 V)
> driver type:    0 (driver type B)
> 
> Thanks,
> Chukun
> 
> -- 
> 2.25.1
> 

Best regards,
Yao Zi
Jonas Karlman March 7, 2025, 6:45 a.m. UTC | #3
Hi Chukun,

On 2025-03-07 06:52, Yao Zi wrote:
> On Fri, Mar 07, 2025 at 11:35:08AM +0800, Chukun Pan wrote:
>> Hi,
>>
>>> +&sdmmc {
>>> +	bus-width = <4>;
>>> +	cap-mmc-highspeed;
>>> +	cap-sd-highspeed;
>>> +	disable-wp;
>>> +	no-sdio;
>>
>> With 'no-sdio' property:
>> [  129.608986] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
>> [  130.711168] mmc1: Card stuck being busy! __mmc_poll_for_busy
>> [  130.725536] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
>> [  131.751240] mmc1: Card stuck being busy! __mmc_poll_for_busy
>> [  131.765608] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)
>> [  132.825083] mmc1: Card stuck being busy! __mmc_poll_for_busy
>> [  132.839413] mmc_host mmc1: Bus speed (slot 0) = 187500Hz (slot req 187500Hz, actual 187500HZ div = 0)
>> [  133.960141] mmc1: Card stuck being busy! __mmc_poll_for_busy
>>
>> Without 'no-sdio' property:
>> [  105.224019] mmc1: error -22 whilst initialising SDIO card
>> [  106.290838] mmc1: Card stuck being busy! __mmc_poll_for_busy
>> [  106.801931] dwmmc_rockchip ffc30000.mmc: Busy; trying anyway
>> [  107.385835] mmc_host mmc1: Timeou sending command (cmd 0x202000 arg 0x0 status 0x80202000)
>> [  107.400425] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
>> [  107.431561] mmc_host mmc1: Bus speed (slot 0) = 49800000Hz (slot req 50000000Hz, actual 49800000HZ div = 0)
>> [  107.433107] mmc1: new high speed SDIO card at address 0001
> 
> So it seems the sdmmc controller actually works with SDIO commands as
> well? I don't expect that since the datasheet says RK3528 has only two
> SDIO 3.0 controllers.
> 
> We could remove the "no-sdio" property if SDIO actually works. Will
> apply it in the next version if there's no objection against this.

On the E20C the sdmmc controller is routed to a microSD card slot mainly
intended for use with microSD-cards and should normally not need SDIO.

What card/adapter do you have inserted in the microSD card slot that
requires use of SDIO instead of just SD or MMC? What is the use case you
have that requires removal of no-sdio on E20C?

Regards,
Jonas

> 
> Further tests about the capabilities of the controller are welcome.
> 
>> # cat /sys/kernel/debug/mmc1/ios
>> clock:          50000000 Hz
>> vdd:            21 (3.3 ~ 3.4 V)
>> bus mode:       2 (push-pull)
>> chip select:    0 (don't care)
>> power mode:     2 (on)
>> bus width:      2 (4 bits)
>> timing spec:    2 (sd high-speed)
>> signal voltage: 0 (3.30 V)
>> driver type:    0 (driver type B)
>>
>> Thanks,
>> Chukun
>>
>> -- 
>> 2.25.1
>>
> 
> Best regards,
> Yao Zi
Chukun Pan March 7, 2025, 7:10 a.m. UTC | #4
Hi,

> On the E20C the sdmmc controller is routed to a microSD card slot mainly
> intended for use with microSD-cards and should normally not need SDIO.
> 
> What card/adapter do you have inserted in the microSD card slot that
> requires use of SDIO instead of just SD or MMC? What is the use case you
> have that requires removal of no-sdio on E20C?

I inserted an sdio wifi module (via sdcard adapter) for testing.
Just out of curiosity :)

Thanks,
Chukun
Yao Zi March 7, 2025, 7:26 a.m. UTC | #5
On Fri, Mar 07, 2025 at 03:10:20PM +0800, Chukun Pan wrote:
> Hi,
> 
> > On the E20C the sdmmc controller is routed to a microSD card slot mainly
> > intended for use with microSD-cards and should normally not need SDIO.
> > 
> > What card/adapter do you have inserted in the microSD card slot that
> > requires use of SDIO instead of just SD or MMC? What is the use case you
> > have that requires removal of no-sdio on E20C?
> 
> I inserted an sdio wifi module (via sdcard adapter) for testing.
> Just out of curiosity :)

I doubt whether the module actually works, they usually require more
pins than a simple SDIO bus to function. Additionally, it really doesn't
sound like a real use case for me.

Have you tried transferring some data? The log you showed only indicates
the controller doesn't bail out or freeze when encountering SDIO command
sequences during initialization, but cannot prove the controller is
really in a good state and could transfer as normal.

Again, connecting SDIO WiFi modules to a SDcard slot doesn't seem an
usual case for me. I'll change my mind to keep SDIO sequence disabled if
you didn't get the module really working but only observed the
initialization didn't fail,

> Thanks,
> Chukun
> 
> -- 
> 2.25.1
> 

Best regards,
Yao Zi
Yao Zi March 8, 2025, 3:27 p.m. UTC | #6
Hi Jonas,

On Fri, Mar 07, 2025 at 07:45:00AM +0100, Jonas Karlman wrote:
> Hi Chukun,
> 
> On 2025-03-07 06:52, Yao Zi wrote:
> > On Fri, Mar 07, 2025 at 11:35:08AM +0800, Chukun Pan wrote:
> >> Hi,
> >>
> >>> +&sdmmc {
> >>> +	bus-width = <4>;
> >>> +	cap-mmc-highspeed;
> >>> +	cap-sd-highspeed;
> >>> +	disable-wp;
> >>> +	no-sdio;
> >>
> >> With 'no-sdio' property:
> >> [  129.608986] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
> >> [  130.711168] mmc1: Card stuck being busy! __mmc_poll_for_busy
> >> [  130.725536] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
> >> [  131.751240] mmc1: Card stuck being busy! __mmc_poll_for_busy
> >> [  131.765608] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)
> >> [  132.825083] mmc1: Card stuck being busy! __mmc_poll_for_busy
> >> [  132.839413] mmc_host mmc1: Bus speed (slot 0) = 187500Hz (slot req 187500Hz, actual 187500HZ div = 0)
> >> [  133.960141] mmc1: Card stuck being busy! __mmc_poll_for_busy
> >>
> >> Without 'no-sdio' property:
> >> [  105.224019] mmc1: error -22 whilst initialising SDIO card
> >> [  106.290838] mmc1: Card stuck being busy! __mmc_poll_for_busy
> >> [  106.801931] dwmmc_rockchip ffc30000.mmc: Busy; trying anyway
> >> [  107.385835] mmc_host mmc1: Timeou sending command (cmd 0x202000 arg 0x0 status 0x80202000)
> >> [  107.400425] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
> >> [  107.431561] mmc_host mmc1: Bus speed (slot 0) = 49800000Hz (slot req 50000000Hz, actual 49800000HZ div = 0)
> >> [  107.433107] mmc1: new high speed SDIO card at address 0001
> > 
> > So it seems the sdmmc controller actually works with SDIO commands as
> > well? I don't expect that since the datasheet says RK3528 has only two
> > SDIO 3.0 controllers.
> > 
> > We could remove the "no-sdio" property if SDIO actually works. Will
> > apply it in the next version if there's no objection against this.
> 
> On the E20C the sdmmc controller is routed to a microSD card slot mainly
> intended for use with microSD-cards and should normally not need SDIO.

As pointed out by Chukun, I found the hardware design guide for
RK3528[1] (in Chinese) does claim that SDIO 3.0 is supported on all
these three controllers in Chapter 2.3.1 (SDMMC/SDIO),

  RK3528 集成了 1 个 SDMMC 控制器和 2 个 SDIO 控制器,均可支持 SDIO3.0 协
  议,以及 MMC V4.51 协议。其中 SDIO0 和 SDIO1 最高可支持 200MHz,SDMMC
  最高只支持到 150MHz

translated to English,

  RK3528 integrates one SDMMC controller and two SDIO controllers, all
  support SDIO3.0 protocol and MMC V4.51 protocol. Among them SDIO0 and
  SDIO1 support 200MHz frequency at maximum, and SDMMC supports up to
  150MHz.

So I think there's no reason to explicitly deny SDIO initialization
sequence for the controller on Radxa E20C. imho this won't break
anything even for a sdcard slot, will it?

Additionally, this piece of information points out that wrong
max-frequency is set for SDIO{0,1}. Rockchip overrides the frequency in
devicetrees for the demo boards[2], I'm not sure whether it's for some
speical reason or not.

Since I don't have a SDIO-capable board on hand, could you please test
whether 200MHz actually works? If so I'll correct the SoC devicetree in
v3.

> What card/adapter do you have inserted in the microSD card slot that
> requires use of SDIO instead of just SD or MMC? What is the use case you
> have that requires removal of no-sdio on E20C?
> 
> Regards,
> Jonas
> 
> > 
> > Further tests about the capabilities of the controller are welcome.
> > 
> >> # cat /sys/kernel/debug/mmc1/ios
> >> clock:          50000000 Hz
> >> vdd:            21 (3.3 ~ 3.4 V)
> >> bus mode:       2 (push-pull)
> >> chip select:    0 (don't care)
> >> power mode:     2 (on)
> >> bus width:      2 (4 bits)
> >> timing spec:    2 (sd high-speed)
> >> signal voltage: 0 (3.30 V)
> >> driver type:    0 (driver type B)
> >>
> >> Thanks,
> >> Chukun
> >>
> >> -- 
> >> 2.25.1
> >>
> > 
> > Best regards,
> > Yao Zi
> 

Thanks,
Yao Zi

[1]: https://github.com/DeciHD/rockchip_docs/blob/main/rk3528/RK3528%20Hardware%20Design%20Guide-CN-V1.0-20230525.pdf
[2]: https://github.com/rockchip-linux/kernel/blob/604cec4004abe5a96c734f2fab7b74809d2d742f/arch/arm64/boot/dts/rockchip/rk3528-demo1-lp4-v10.dtsi#L47
Jonas Karlman March 8, 2025, 5:23 p.m. UTC | #7
On 2025-03-08 16:27, Yao Zi wrote:
> Hi Jonas,
> 
> On Fri, Mar 07, 2025 at 07:45:00AM +0100, Jonas Karlman wrote:
>> Hi Chukun,
>>
>> On 2025-03-07 06:52, Yao Zi wrote:
>>> On Fri, Mar 07, 2025 at 11:35:08AM +0800, Chukun Pan wrote:
>>>> Hi,
>>>>
>>>>> +&sdmmc {
>>>>> +	bus-width = <4>;
>>>>> +	cap-mmc-highspeed;
>>>>> +	cap-sd-highspeed;
>>>>> +	disable-wp;
>>>>> +	no-sdio;
>>>>
>>>> With 'no-sdio' property:
>>>> [  129.608986] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
>>>> [  130.711168] mmc1: Card stuck being busy! __mmc_poll_for_busy
>>>> [  130.725536] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
>>>> [  131.751240] mmc1: Card stuck being busy! __mmc_poll_for_busy
>>>> [  131.765608] mmc_host mmc1: Bus speed (slot 0) = 200000Hz (slot req 200000Hz, actual 200000HZ div = 0)
>>>> [  132.825083] mmc1: Card stuck being busy! __mmc_poll_for_busy
>>>> [  132.839413] mmc_host mmc1: Bus speed (slot 0) = 187500Hz (slot req 187500Hz, actual 187500HZ div = 0)
>>>> [  133.960141] mmc1: Card stuck being busy! __mmc_poll_for_busy
>>>>
>>>> Without 'no-sdio' property:
>>>> [  105.224019] mmc1: error -22 whilst initialising SDIO card
>>>> [  106.290838] mmc1: Card stuck being busy! __mmc_poll_for_busy
>>>> [  106.801931] dwmmc_rockchip ffc30000.mmc: Busy; trying anyway
>>>> [  107.385835] mmc_host mmc1: Timeou sending command (cmd 0x202000 arg 0x0 status 0x80202000)
>>>> [  107.400425] mmc_host mmc1: Bus speed (slot 0) = 300000Hz (slot req 300000Hz, actual 300000HZ div = 0)
>>>> [  107.431561] mmc_host mmc1: Bus speed (slot 0) = 49800000Hz (slot req 50000000Hz, actual 49800000HZ div = 0)
>>>> [  107.433107] mmc1: new high speed SDIO card at address 0001
>>>
>>> So it seems the sdmmc controller actually works with SDIO commands as
>>> well? I don't expect that since the datasheet says RK3528 has only two
>>> SDIO 3.0 controllers.
>>>
>>> We could remove the "no-sdio" property if SDIO actually works. Will
>>> apply it in the next version if there's no objection against this.
>>
>> On the E20C the sdmmc controller is routed to a microSD card slot mainly
>> intended for use with microSD-cards and should normally not need SDIO.
> 
> As pointed out by Chukun, I found the hardware design guide for
> RK3528[1] (in Chinese) does claim that SDIO 3.0 is supported on all
> these three controllers in Chapter 2.3.1 (SDMMC/SDIO),
> 
>   RK3528 集成了 1 个 SDMMC 控制器和 2 个 SDIO 控制器,均可支持 SDIO3.0 协
>   议,以及 MMC V4.51 协议。其中 SDIO0 和 SDIO1 最高可支持 200MHz,SDMMC
>   最高只支持到 150MHz
> 
> translated to English,
> 
>   RK3528 integrates one SDMMC controller and two SDIO controllers, all
>   support SDIO3.0 protocol and MMC V4.51 protocol. Among them SDIO0 and
>   SDIO1 support 200MHz frequency at maximum, and SDMMC supports up to
>   150MHz.
> 
> So I think there's no reason to explicitly deny SDIO initialization
> sequence for the controller on Radxa E20C. imho this won't break
> anything even for a sdcard slot, will it?

I have no strong opinion on this, just something I have done on a few
boards recently.

When sd/sdio/mmc controller is attached to a microSD card slot I add
no-sdio, when my uSD to eMMC adapter is not working I also add no-mmc.

Similar if the controller is attached to emmc, I add no-sd and no-sdio,
and if used for sdio wifi, I add no-sd and no-mmc.

Mostly to minimize initialization time when slot is unpopulated or card
or module is faulty.

Not sure how common it is to use a microSD to SDIO adapter, sound like
an uncommon edge case, possible by someone who would know how to create
and use a dt-overlay. I also do not think there will be a common use
case with a uSD to eMMC adapter, however that is something this board
vendor sell themself [3], so may be a slightly more likely use case.

[3] https://radxa.com/products/accessories/emmc-to-usd

Use of these no- props could possible be considered configuration
and not information about the board hw design, so I am torn and as
mentioned above, I have no strong opinion about keeping no-sdio or not.

> 
> Additionally, this piece of information points out that wrong
> max-frequency is set for SDIO{0,1}. Rockchip overrides the frequency in
> devicetrees for the demo boards[2], I'm not sure whether it's for some
> speical reason or not.
> 
> Since I don't have a SDIO-capable board on hand, could you please test
> whether 200MHz actually works? If so I'll correct the SoC devicetree in
> v3.

I would change to use default 200MHz as stated in the HW design guide.

Did a short boot test on my Sige1 board and the SDIO module can at
least be identified using 200 MHz:

  dwmmc_rockchip ffc10000.mmc: IDMAC supports 32-bit address mode.
  dwmmc_rockchip ffc10000.mmc: Using internal DMA controller.
  dwmmc_rockchip ffc10000.mmc: Version ID is 270a
  dwmmc_rockchip ffc10000.mmc: DW MMC controller at irq 35,32 bit host data width,256 deep fifo
  mmc_host mmc2: card is non-removable.
  mmc_host mmc2: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
  mmc_host mmc2: Bus speed (slot 0) = 198000000Hz (slot req 200000000Hz, actual 198000000HZ div = 0)
  dwmmc_rockchip ffc10000.mmc: Successfully tuned phase to 30
  mmc2: new UHS-I speed SDR104 SDIO card at address 0001
  brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43752-sdio for chip BCM43752/2
  brcmfmac mmc2:0001:1: Direct firmware load for brcm/brcmfmac43752-sdio.armsom,sige1.bin failed with error -2
  brcmfmac mmc2:0001:1: Direct firmware load for brcm/brcmfmac43752-sdio.bin failed with error -2
  brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50

  ~ # cat /sys/kernel/debug/mmc2/ios
  clock:          200000000 Hz
  actual clock:   198000000 Hz
  vdd:            21 (3.3 ~ 3.4 V)
  bus mode:       2 (push-pull)
  chip select:    0 (don't care)
  power mode:     2 (on)
  bus width:      2 (4 bits)
  timing spec:    6 (sd uhs SDR104)
  signal voltage: 1 (1.80 V)
  driver type:    0 (driver type B)

If it turns out to be any instability issues for a specific board using
default 200 MHz, such board can always define a lower max-frequency in
its board .dts-file.

Regards,
Jonas

> 
>> What card/adapter do you have inserted in the microSD card slot that
>> requires use of SDIO instead of just SD or MMC? What is the use case you
>> have that requires removal of no-sdio on E20C?
>>
>> Regards,
>> Jonas
>>
>>>
>>> Further tests about the capabilities of the controller are welcome.
>>>
>>>> # cat /sys/kernel/debug/mmc1/ios
>>>> clock:          50000000 Hz
>>>> vdd:            21 (3.3 ~ 3.4 V)
>>>> bus mode:       2 (push-pull)
>>>> chip select:    0 (don't care)
>>>> power mode:     2 (on)
>>>> bus width:      2 (4 bits)
>>>> timing spec:    2 (sd high-speed)
>>>> signal voltage: 0 (3.30 V)
>>>> driver type:    0 (driver type B)
>>>>
>>>> Thanks,
>>>> Chukun
>>>>
>>>> -- 
>>>> 2.25.1
>>>>
>>>
>>> Best regards,
>>> Yao Zi
>>
> 
> Thanks,
> Yao Zi
> 
> [1]: https://github.com/DeciHD/rockchip_docs/blob/main/rk3528/RK3528%20Hardware%20Design%20Guide-CN-V1.0-20230525.pdf
> [2]: https://github.com/rockchip-linux/kernel/blob/604cec4004abe5a96c734f2fab7b74809d2d742f/arch/arm64/boot/dts/rockchip/rk3528-demo1-lp4-v10.dtsi#L47
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts b/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
index 5346ef457c2a..a52a7924bb75 100644
--- a/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
@@ -15,6 +15,10 @@  / {
 	model = "Radxa E20C";
 	compatible = "radxa,e20c", "rockchip,rk3528";
 
+	aliases {
+		mmc1 = &sdmmc;
+	};
+
 	chosen {
 		stdout-path = "serial0:1500000n8";
 	};
@@ -104,6 +108,18 @@  vcc5v0_sys: regulator-5v0-vcc-sys {
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
 	};
+
+	vccio_sd: regulator-vccio-sd {
+		compatible = "regulator-gpio";
+		gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&sdmmc_vol_ctrl_h>;
+		regulator-name = "vccio_sd";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+		states = <1800000 0x0>, <3300000 0x1>;
+		vin-supply = <&vcc5v0_sys>;
+	};
 };
 
 &pinctrl {
@@ -126,6 +142,12 @@  wan_led_g: wan-led-g {
 			rockchip,pins = <4 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
+
+	sdmmc {
+		sdmmc_vol_ctrl_h: sdmmc-vol-ctrl-h {
+			rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
 };
 
 &saradc {
@@ -133,6 +155,18 @@  &saradc {
 	status = "okay";
 };
 
+&sdmmc {
+	bus-width = <4>;
+	cap-mmc-highspeed;
+	cap-sd-highspeed;
+	disable-wp;
+	no-sdio;
+	sd-uhs-sdr104;
+	vmmc-supply = <&vcc_3v3>;
+	vqmmc-supply = <&vccio_sd>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0m0_xfer>;