tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sdmmc question.



> Date: Tue, 23 May 2023 22:54:13 -0700
> From: Phil Nelson <phil%netbsd.org@localhost>
> 
>    I'm presuming that we'll need something in the dev/spi/files.spi,
> but haven't figured out what to say to get it to work.   And I'm
> assuming there is a .c file that needs to implement the interface
> between the sdmmc and the spi, but I'm not sure.   Do we need
> something in another place?  

Guessing someone will need to write a driver for sdmmc at spi
following Chapter 7: SPI Mode of the SD specification:

https://www.sdcard.org/downloads/pls/pdf/?p=Part1_Physical_Layer_Simplified_Specification_Ver9.00.jpg&f=Part1_Physical_Layer_Simplified_Specification_Ver9.00.pdf&e=EN_SS1_9

You'll probably want to create a driver, say `sdspi', at
sys/dev/spi/sd_spi.c that implements struct sdmmc_chip_functions and
does config_found with sdmmcbus_attach_args and .iattr = "sdmmcbus",
and with

device	sdspi: sdmmcbus
attach	sdspi at spi
file	dev/spi/sd_spi.c	sdspi

in sys/dev/spi/files.spi, and

sdspi* 	at spi?

in riscv/conf/GENERIC.common.

Of course, you'll also need a spi controller driver!  Not sure if
there is one yet for this SoC.

Possible complication -- not sure if the spibus interface provides the
hardware access needed by sd@spi, judging by this FreeBSD wiki page:
https://wiki.freebsd.org/riscv/HiFiveUnmatched  (But this is outside
my area of expertise, so don't let my assessment get in your way!)


Home | Main Index | Thread Index | Old Index