RaspberryPi SDIO
- BCM2835 ha two sdhost controllers.
- 1 sdhci : Arasan sdhci controller (SD / SDIO)
- 2 sdhost : custom sdhost controller (SD only, but better performance)
- RPi1 use sdhci for SD slot.
- RPi3 use sdhost for SD slot. RPi3 use sdhci for Wi-Fi.
- pin 48 - 53 (0x30 - 0x35): SD slot
- pin 34 - 39 (0x22 - 0x27): wi-fi module
- alt-0
- alt-3
- BASE : 0x20300000
- see SDA's sdhci spec. https://www.sdcard.org/developers/overview/host_controller/simple_spec/
- BASE : 0x20202000
- 00 SDCMD : command and flags
- 04 SDARG : command argument
- 08 SDTOUT : timeout counter
- 0C SDCDIV : clock divider
- 10 SDRSP0
- 14 SDRSP1
- 18 SDRSP2
- 1C SDRSP3
- 20 SDHSTS : sdhost status
- 30 SDVDD : voltage setting
- 34 SDEDM : for debug
- 38 SDHCFG : sdhost config
- 3C SDHBCT : block size
- 40 ? : data port
- 50 ? : block count
- sdhci IRQ62
- sdhost IRQ56
sdhci
- 30 Normal interrupt status
- 32 Error interrupt status
- 34 Normal interrupt status enable
- 36 Error interrupt status enable
sdhost
- 20 SDHSTS : R/W : enalbe and status
- 0400 SDHSTS_BUSY_IRPT
- 0200 SDHSTS_BLOCK_IRPT
- 0100 SDHSTS_SDIO_IRPT
- 0001 SDHSTS_DATA_FLAG
- get power state 0x00020001
- set power state 0x00028001
- see https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
- get clocks 0x00010007
- get clock state 0x00030001
- set clock state 0x00038001
- get clock rate 0x00030002
- set clock rate 0x00038002
- get max clock rate 0x00030004
- get min clock rate 0x00030007
- see https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
add_sdhci()
- get capabilities (read SDHCI_CAPABILITIES)
- reset all (write SDHCI_SOFTWARE_RESET)
- wait (read SDHCI_SOFTWARE_RESET)
sdhci_init()
- assign dma buffer
- set voltage setting (write SDHCI_POWER_CONTROL)
- int enable (write SDHCI_INT_ENABLE)
- signal enable (write SDHCI_SIGNAL_ENABLE)
- https://github.com/gonzoua/u-boot-pi
- bcm2835_sdhci.c 1st commit https://github.com/gonzoua/u-boot-pi/commit/c78b8ea9ae717432770843b825ea8a1a77f223fc
- 2nd commit https://github.com/gonzoua/u-boot-pi/commit/1c2b43a634955661d6f7b69459de00ffd1c2d7a6#diff-b8d41d21faea850aed30c940aa31d77f
- 3rd commit https://github.com/gonzoua/u-boot-pi/commit/326d6404974236f48b437824138c092d6a71e41b#diff-b8d41d21faea850aed30c940aa31d77f
- https://github.com/u-boot/u-boot/blob/master/drivers/mmc/bcm2835_sdhci.c
- bcm2835_sdhost.c 1st commit from linux https://github.com/u-boot/u-boot/commit/c8a73a26d6dd9b7d489e66529fe1412425d8f2d1
- https://github.com/u-boot/u-boot/blob/master/drivers/mmc/bcm2835_sdhost.c
- 1st sdhci-bcm2708.c commit https://github.com/raspberrypi/linux/commit/f5b930be71d6de64c3264b2f9eff4a4079d50c14
- https://github.com/raspberrypi/linux/blob/rpi-3.6.y/drivers/mmc/host/sdhci-bcm2708.c
- sdhci-bcm2835.c 1st commit https://github.com/raspberrypi/linux/commit/1a94715d4db7b71f825cd5585bc8d653eae1faf4
- https://github.com/raspberrypi/linux/blob/rpi-3.19.y/drivers/mmc/host/sdhci-bcm2835.c
- bcm2835-mmc.c 1st commit https://github.com/raspberrypi/linux/commit/7ec18e818133424bf20d58993fa6822dd241e096
- 2nd commit https://github.com/raspberrypi/linux/commit/0ecdaeb739edb714add6d8ae452d12d2ce821573
- 3rd commit https://github.com/raspberrypi/linux/commit/d7580af2f81793fd3312608de95a9009123d8710
- 4th commit https://github.com/raspberrypi/linux/commit/ae7169ee054f60e3db61f1a5bb6eb1f52913886a#diff-35478566f2c5aa0482f2c20a155aa4d9
- 5th commit https://github.com/raspberrypi/linux/commit/a946e70fd45a1f24f99816f72f5bbb0a7de0c1f3
- https://github.com/raspberrypi/linux/blob/rpi-4.0.y/drivers/mmc/host/bcm2835-mmc.c
- bcm2835-sdhost.c 1st commit https://github.com/raspberrypi/linux/commit/12b12cf1a7a825c46dcefa06bdde683cac053189
- https://github.com/raspberrypi/linux/blob/rpi-4.0.y/drivers/mmc/host/bcm2835-sdhost.c
- sdhci-bcm2835.c 1st commit https://github.com/torvalds/linux/commit/1a94715d4db7b71f825cd5585bc8d653eae1faf4
- latest version https://github.com/torvalds/linux/blob/13db83e2b60464266098b52344c7db6b848f4154/drivers/mmc/host/sdhci-bcm2835.c
- remove commit https://github.com/torvalds/linux/commit/7eb16493ecaa41ceeb448717ee2c59690cd9047f
- sdhci-bcm2835 is no more needed since it has been replaced by sdhci-iproc.
- drivers/mmc/host/bcm2835.c 1st commit https://github.com/torvalds/linux/commit/660fc733bd7436f4fa1a351376493e635514ed64
- 2nd commit https://github.com/torvalds/linux/commit/bf3240bada0211b4a555d75f027181c8432b2d20
- 3rd commit https://github.com/torvalds/linux/commit/c00a231ba053a9b0be8d512957b99395b92bc620
- 4th commit https://github.com/torvalds/linux/commit/c00a231ba053a9b0be8d512957b99395b92bc620
- 5th commit https://github.com/torvalds/linux/commit/c00a231ba053a9b0be8d512957b99395b92bc620
- https://github.com/torvalds/linux/blob/master/drivers/mmc/host/bcm2835.c
- 1st commit sdhci-iproc.c https://github.com/torvalds/linux/commit/b580c52d58d92f1e054c8b4515cf0fa617a77a26
- BCM2835 suuport commit https://github.com/torvalds/linux/commit/77cb7d3a4d9b790d929d425f623f48f72fd496c1
- https://github.com/torvalds/linux/blob/master/drivers/mmc/host/sdhci-iproc.c
- https://github.com/freebsd/freebsd/blob/master/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
- bchm2835_sdhost.c review https://reviews.freebsd.org/D14168
- https://github.com/NetBSD/src/blob/trunk/sys/arch/arm/broadcom/bcm2835_emmc.c
- https://github.com/NetBSD/src/blob/trunk/sys/arch/arm/broadcom/bcm2835_sdhost.c
I'm developing an operating system on raspberry pi 3, this post helps me a lot, thanks!