Re: sdmmc question.
> On May 24, 2023, at 2:39 AM, Taylor R Campbell > wrote: > > 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!) Probably what that FreeBSD wiki is referring to is that you need to be able to strobe the CS line for the card explicitly (and repeatedly) outside of the context of a normal SPI I/O operation … this is required as part of the process of putting the card into SPI mode, which needs to be done any time a card is inserted. -- thorpej
Re: sdmmc question.
Looks like there are actually already two different drivers for some kind of sd@spi, but they live under evbsh3 -- so, not sure if they're actually specific to sh3 boards or what: https://nxr.netbsd.org/xref/src/sys/arch/evbsh3/t_sh7706lan/scimci.c https://nxr.netbsd.org/xref/src/sys/arch/evbsh3/t_sh7706lan/ssumci.c Maybe nonaka@ knows more?
Re: sdmmc question.
On Wed, May 24, 2023 at 09:39:11AM +, Taylor R Campbell wrote: > > Date: Tue, 23 May 2023 22:54:13 -0700 > > From: Phil Nelson > > > >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 I have dome something like that for NetBSD/tsarmips: https://www-soc.lip6.fr/svn/netbsdtsar/trunk/netbsd-8/src/sys/arch/tsarmips/ In this case I had a SPI driver called vcispi: device vcispi : sdmmcbus attach vcispi at cluster file arch/tsarmips/soclib/vcispi.c vcispi But in my case the sdmmc commands were handled in the vcispi driver (and for some part maybe in hardware - I don't remember the details). This may help, but you'll probably need a sdspi to make the translation between sdmmc commands and our SPI drivers. -- Manuel Bouyer NetBSD: 26 ans d'experience feront toujours la difference --
Re: sdmmc question.
> Date: Tue, 23 May 2023 22:54:13 -0700 > From: Phil Nelson > >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 filedev/spi/sd_spi.csdspi 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!)
sdmmc question.
Hello, I'm working with a student to get NetBSD working on the SiFive HiFive Unleashed board. I know this is no longer being made, but we have one. He has the kernel running on the board until it wants to mount root. We want to get a sd driver working. The issue is that the sd device is on the spi bus on that hardware and sdmmc doesn't work on the spi bus. We want to figure out how to connect the sdmmc to the spi bus. We have tried a number of things in the config framework to get sdmmc connected, but we don't know the internals of config well enough and we have not found any prior work that will help us get that done. Can anyone help us with the config framework and what is needed to get sdmmc to talk to the spi bus? 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? Pointers to examples and/or documentation would be appreciated. Thanks. --Phil