Hi,

> Am 03.06.2015 um 17:29 schrieb Hrishikesh Murukkathampoondi 
> <[email protected]>:
> 
> Hello Bitrig Tech
> 
> Bitrig install on a Freescale iMX6 SABRE Smart Devices board fails with:
> 
> ---
> Creating a ext2fs partition and an OpenBSD partition for rest of sd0...done.
> disklabel: ioctl DIOCWDINFO: Input/output error
> newfs_ext2fs: /dev/rsd0i: open for read: Device not configured
> ---
> 
> Patrick mentioned that the SD driver needs to be fixed for the iMX6 based 
> devices.
> 
> Is this the driver in /sys/dev/sdmmc or does the installer use a different 
> driver?
> 
> Or is it arch/armv7/imx/imxesdhc.c - the first comment there says
> /* i.MX SD/MMC support derived from /sys/dev/sdmmc/sdhc.c */
> 

The broken driver is arch/armv7/imx/imxesdhc.c. It was, as the comment
said, derived from dev/sdmmc/sdhc.c and was modified to "work" for
i.MX6. I think omap/ommmc.c was also used as a resource for that driver.

Anyway, the issue is in imxesdhc.c. That driver needs to be revisited
and fixed up. Apparently FreeBSD has a working driver, which is not
similar to ours, but does a good enough job explaining the quirks of
that specific controller.

The last few weeks I have backported quite a few changes to sdhc/sdmmc
from NetBSD. Their sdhc(4) driver, the other one mentioned, can support
a variety of controllers using flags passed by the attachment driver.
Thus one does not need to write another completely new sdhc driver like
imxesdhc, but instead can use what already is in sdhc(4).

NetBSD already supported the Freescale eSDHC (flag enhanced), but it
looks like not the uSDHC. Another viable option, instead of fixing
imxesdhc, would be to make imxesdhc compatible to sdhc(4) and implement
uSDHC specific quirks in sdhc(4).

> 
> The reason I ask is because there is a GSoC project for OpenBSD trying to 
> implement simple versions of this driver in libsa. That project is intended 
> to enable boot loaders access SD and it appears unfeasible to use a "full" 
> driver at boot. I presume there will be two such drivers in Bitrig also - a 
> stripped down one for boot/install and another when the OS is up and running.
> 

Yes, there is. That project is doing the right thing by implementing a
bootloader that can be put onto some boot partition and is able to boot
a kernel loaded from a FFS partition.

It will be interesting to see what techniques will be used to have it
work with all the very different supported boards.

> Would the section on I/O system (drivers) in the book The Design and 
> Implementation of the FreeBSD Operating System 2/e be relevant for Bitrig? As 
> a way to learn how drivers work/should be written in BSD.
> 

No idea, sorry. Trying to read and understand sdhc(4)/imxesdhc should be
another good way to learn how it works.

> I am going to try my hand at getting a driver working for the iMX6 board. Do 
> let me know if I am barking up the wrong tree. Any pointers on what to read 
> etc would be welcome.
> 
> Thank you
> Hrishi

Hope it helps, feel free to ask!
Patrick

Reply via email to