History log of /src/sys/dev/sdmmc/
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base netbsd-9-3-RELEASE thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
1.3 02-Dec-2019 christos

drop my name from the advertising clause.


Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
1.2 03-Jun-2017 christos

branches: 1.2.10;
remove my copyright.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14; 1.1.32; 1.1.50;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.6 19-Jan-2025 jmcneill

bwi(4): Add support for Nintendo Wii WLAN.

Adapt the bwi(4) driver to support SDIO attachment and driving TX/RX using
PIO instead of DMA since the latter is not supported on SDIO busses.


Revision tags: netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base netbsd-9-3-RELEASE thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
1.5 07-Nov-2017 khorben

branches: 1.5.36; 1.5.42;
Add driver for Broadcom 802.11a/b/g/n/ac SDIO wireless devices, based on
the OpenBSD bwfm(4) driver.

I could not test this on any hardware yet, as it does not attach as-is on
my Raspberry PI 3.


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
1.4 02-Oct-2014 jmcneill

debug ld_sdmmc with LD_SDMMC_DEBUG instead of SDMMC_DEBUG


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.3 01-Feb-2012 matt

branches: 1.3.6;
Use "opt_sdmmc.h" for SDMMC_DEBUG, etc.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 jym-xensuspend-nbase
1.2 28-Jun-2009 hubertf

branches: 1.2.2; 1.2.8; 1.2.16; 1.2.20;
Remove trailing whitespace,
from KIYOHARA Takashi on current-users@


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


1.33 13-Dec-2025 mlelstv

Prevent kernel panic when corrupted data is read
from a super frame.


1.32 12-Dec-2025 mlelstv

Match another chip version found in RPI zero 2 W.
Fix frame parser and add more verbose checks.
Handle transmit sequence counter.

Work around transmit scheduler issue by always allowing
a send space of 1 packet. This avoids a permanent stall on
RPI zero 2 W.

There is currently no way to correctly identify the
chip used on RPI zero 2 W,


1.31 04-Oct-2025 thorpej

Use device-path, not fdt-path.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base
1.30 03-Dec-2022 mlelstv

Fix bug in protocol parser that often caused fatal 'checksum error'.
Defer power save setting to interface start.
More verbose on errors.
Allow build without FDT.


Revision tags: bouyer-sunxi-drm-base
1.29 18-Jun-2022 skrll

Trailing whitespace


1.28 14-Mar-2022 mlelstv

Add OpenBSD to code to optionally load CLM (Country Locale Matrix) files.


Revision tags: thorpej-i2c-spi-conf2-base
1.27 08-Aug-2021 jmcneill

Use SMBIOS system product instead of the string "netbsd,generic-acpi"
for firmware loading on ACPI systems.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
1.26 21-Jun-2021 christos

fix proplib deprecation


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
1.25 27-Jan-2021 thorpej

branches: 1.25.4;
Rename of_match_compat_data() to of_compatible_match(). Similarly,
rename of_search_compatible() to of_compatible_lookup().

Standardize on of_compatible_match() for driver matching, and adapt
all call sites.


1.24 03-Nov-2020 mlelstv

Continue parsing frames after empty payload.
Add diagnostic messages.


1.23 22-Jul-2020 riastradh

branches: 1.23.2;
Sort includes. Nix trailing whitespace.

No functional change intended.


1.22 22-Jul-2020 riastradh

Need <sys/kmem.h> for kmem_*.

Currently accidentally side-loaded by <sys/pcq.h>.


1.21 20-Jul-2020 mrg

clear all interrupts, not just those we expect from the hostintmask.

this removes the final hard hang i have seen in pinebookpro wifi,
though one may still need to 'ifconfig bwfm0 down up' occasionally,
so we still have bugs to fix here (the hang is usually associated
with 'checksum error' from bwfm/sdio.)


1.20 20-Jul-2020 mrg

only ask for SDPCMD_INTSTATUS_HMB_SW_MASK and SDPCMD_INTSTATUS_CHIPACTIVE
interrupts, not all of them. we only ack these ones.

mostly fixes pinebookpro wifi hard hangs. still is problematic and can
trigger interrupt storm that appears as a hard hang without NET_MPSAFE,
and a follow up, less clearly right, change will reduce that to a soft
hang of the interface that can be cleared with 'ifconfig bwfm0 down up',
and even often recovers itself now.


1.19 23-Jun-2020 martin

Make this work on big endian machines


1.18 30-May-2020 jdolecek

discussed with thorpej@, and it seems it's better to allocate the bss
alignment buffer statically (as part of softc) just to be sure to not
affect performance


1.17 30-May-2020 jdolecek

constify, and make static where possible


1.16 24-May-2020 riastradh

Fix races in sdmmc tasks and teach ld@sdmmc to abort xfers on detach.

- Teach sdmmc_add_task to queue it only if not already queued.
- Remove now-redundant logic to avoid repeated queueing elsewhere.
- Teach sdmmc_del_task to wait until task has completed.
- Call sdmmc_del_task in various needful places.
- Replace abuse of pcq by a lock and a tailq.
(pcq is multi-producer, _single_-consumer, but there are potentially
multiple consumers here and really only one producer.)
- Teach ld_sdmmc to abort xfers on detach.
(Mechanism is kinda kludgey but it'll do for now; any effort one is
tempted to spend overhauling this should be spent overhauling sdmmc
to support proper asynchronous commands.)
- Make sure ld_sdmmc_discard either returns failure or eventually calls
ldenddiscard.

XXX Currently ld_sdmmc_detach aborts xfers _before_ ldbegindetach has
has committed to detaching or not. This is currently necessary to
avoid a deadlock because ldbegindetach waits for xfers to drain --
which strikes me as wrong; ldbegindetach shouldn't wait for anything,
and should only make the decision to commit to detaching or not so
the caller can decide whether to abort xfers before we actually wait
for them in ldenddetach.

XXX pullup -- although this changes some kernel symbols (sdmmc_add_task
and sdmmc_del_task), it shouldn't affect any existing modules; the only
module that uses sdmmc is ld_sdmmc.kmod, which is `.if 0' in the build
so there shouldn't be any of them floating around.


1.15 07-May-2020 macallan

add entry for BCM43362, found on Cubietruck
ok jmcneill@


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
1.14 25-Mar-2020 thorpej

- Refactor the firmware loading code into a set of common routines in the
core driver that understand how to find model-specific files before the
generic files. This greatly simplifies the firmware loading procedure
in each of the bus front ends. Adding additional firmware file types
(such as CLM files) much simpler.
- Make firmware image selection table-driven rather than a set of switch()
and if() statements.
- Add several additional firmware image entries.


Revision tags: is-mlppp-base ad-namecache-base3
1.13 29-Jan-2020 thorpej

Adopt <net/if_stats.h>.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
1.12 04-Jan-2020 mlelstv

branches: 1.12.2;
size check was backwards.


1.11 01-Jan-2020 jmcneill

Use correct firmware for BCM43456


1.10 30-Dec-2019 mlelstv

Follow the Linux driver an use the FDT "compatible" property to build a
filename for the nvram config file, fall back to the standard filename.

E.g.

# ofctl -p /
[Caching 123 nodes and 1093 properties]
#address-cells 00000001 ........ ........ ........ 1
#size-cells 00000001 ........ ........ ........ 1
compatible 73696e6f 766f6970 2c627069 2d6d322d "sinovoip,bpi-m2-
0010: 7a65726f 00...... ........ ........ zero"
0015: 616c6c77 696e6e65 722c7375 6e38692d "allwinner,sun8i-
0025: 68322d70 6c757300 ........ ........ h2-plus"
interrupt-parent 00000001 ........ ........ ........ ....
model 42616e61 6e612050 69204250 492d4d32 "Banana Pi BPI-M2
0010: 2d5a6572 6f00.... ........ ........ -Zero"
name 00...... ........ ........ ........ ""
serial-number 30326330 30303432 65636431 36376566 02c00042ecd167ef
0010: 00...... ........ ........ ........ .


-rw-r--r-- 1 root wheel 875 Nov 2 12:06 brcmfmac43430-sdio.AP6212.txt
lrwxr-xr-x 1 root wheel 29 Dec 30 16:19 brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt -> brcmfmac43430-sdio.AP6212.txt
-rw-r--r-- 1 root wheel 874 Jun 30 2019 brcmfmac43430-sdio.raspberrypi,3-model-b.txt
-rw-r--r-- 1 root wheel 1864 Jun 30 2019 brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
lrwxr-xr-x 1 root wheel 29 Dec 30 11:24 brcmfmac43455-sdio.raspberrypi,4-model-b-plus.txt -> brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt


Revision tags: phil-wifi-20191119
1.9 28-Oct-2019 mlelstv

More code from OpenBSD
no need to splnet() when enqueing packets
explicit structure padding
make internal functions static

also prepare for GPIO interrupts.


1.8 28-Oct-2019 mlelstv

Simplyfy sdmmc_io_set_blocklen function signature by dropping the
extra softc pointer. Aligns with OpenBSD.


1.7 27-Oct-2019 bad

white space police.


1.6 25-Sep-2019 mlelstv

Use correct function to verify if a task has been queued. Avoids race
that can corrupt the task queue.


1.5 13-Sep-2019 mlelstv

Don't pass empty mbufs to the network stack.


1.4 01-Sep-2019 mlelstv

From OpenBSD:
- All the missing pieces (firmware load, chip setup, protocol handling)
TX queue and interrupt handling via sdmmc_task.
Fix locking.
Fix packet parsing.
Add parser for original firmware config files.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
1.3 11-May-2018 maya

branches: 1.3.2; 1.3.8;
sync with openbsd bwfm to some extent.

add a txcheck
set chip active/passive for more kinds of chips
add wrapper around setting active/passive
detect chip RAM
make bwfm_rx take an mbuf


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
1.2 11-Mar-2018 khorben

Outsource setting the backplane window into a specific function so it
can be called and reused in different places.

From OpenBSD.


Revision tags: pgoyette-compat-base tls-maxphys-base-20171202
1.1 07-Nov-2017 khorben

branches: 1.1.2; 1.1.4;
Add driver for Broadcom 802.11a/b/g/n/ac SDIO wireless devices, based on
the OpenBSD bwfm(4) driver.

I could not test this on any hardware yet, as it does not attach as-is on
my Raspberry PI 3.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base
1.3 08-Aug-2021 jmcneill

Fixup bwfm(4) register bit regarding SDIO device suspend/resume.

From OpenBSD if_bwfm_sdio.h r1.3


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.2 03-Oct-2019 mlelstv

branches: 1.2.4; 1.2.10;
More register definitions.


1.1 01-Sep-2019 mlelstv

From OpenBSD:
- All the missing pieces (firmware load, chip setup, protocol handling)
TX queue and interrupt handling via sdmmc_task.
Fix locking.
Fix packet parsing.
Add parser for original firmware config files.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.1 19-Jan-2025 jmcneill

branches: 1.1.2; 1.1.6;
bwi(4): Add support for Nintendo Wii WLAN.

Adapt the bwi(4) driver to support SDIO attachment and driving TX/RX using
PIO instead of DMA since the latter is not supported on SDIO busses.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.45 13-Apr-2025 rin

ld(4): Convert blkno argument for sc_dump() to daddr_t

PR kern/59153

(1) For backends that accept 64-bit block address, i.e.,
nvme(4), virtio(4), aac(4), iop(4), and mainbus(usermode/4),
this should enable to dump beyond 2Gi blocks.

(2) sdmmc(4) backend allows to dump up to the last block.

(3) For other backends, block address is handled as `int`.
Some of them may support blocks up to 4Gi, but I do not have
enough time to examine datasheets. So, continue to reject >2Gi
blocks as before.

XXX
This is KABI change, and cannot be pulled up into netbsd-{10,9}.

XXX
Compile-test only (for amd64/ALL) due to lack of large SSDs ;)

Thanks mlelstv@ for discussion and careful review!!


1.44 18-Oct-2024 jmcneill

sdmmc: Add support for SD card caches.

SD physical 6.0 specification introduced Application Performance Class 2
(A2), which adds support for drive caches and command queueing.

Add support for enabling and flushing the cache when this feature is
present.


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
1.43 23-Jan-2024 riastradh

branches: 1.43.2;
ld@sdmmc(4): Hack around deadlock in cache sync on detach.

Yanking a card triggers the sdmmc discovery task, which runs in the
sdmmc task thread, to detach any attached child devices.

Detaching ld@sdmmc triggers a cache flush (via ldbegindetach ->
disk_begindetach -> ld_lastclose -> ld_flush -> ioctl DIOCCACHESYNC),
which is implemented by scheduling a task to do sdmmc_mem_flush_cache
and then waiting for it to complete.

The sdmmc_mem_cache_flush is done by an sdmmc task so it happens
after all previously scheduled I/O operations -- that way the cache
flush doesn't complete until the previously scheduled I/O operations
are complete.

However, when the cache flush task is issued from the discovery task,
this doesn't work, because the cache flush task can't start until the
discovery task has returned -- but the discovery task won't return
until the cache flush task has completed.

To work around this deadlock, which usually happens only when the
device has been yanked anyway so further I/O would be lost anyway,
just do the cache flush synchronously in DIOCCACHESYNC if we're
running in the task thread.

This isn't quite right -- implementation details of the task thread
shouldn't bleed into ld@sdmmc, and running the cache sync _before_
any subsequently scheduled I/O tasks is asking for trouble -- but it
should serve to avoid the deadlock in PR kern/57870 until we can fix
a host of concurrency bugs in sdmmc by fixing the locking scheme and
running discovery in a separate thread from tasks.

XXX pullup-10


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base
1.42 16-May-2022 jmcneill

branches: 1.42.4;
sdmmc: ld: Include the card type (SD card, MMC) in the disk description.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
1.41 02-Aug-2020 riastradh

Remove unnecessary wait in ldbegindetach.

Like disk_begindetach, ldbegindetach only commits to detaching but
doesn't wait for existing xfers to drain; it is up to the driver to
abort them, once we are committed, and then ldenddetach to wait for
them to drain.


1.40 22-Jul-2020 riastradh

Sort #includes. Nix trailing whitespace.

No functional change intended.


1.39 22-Jul-2020 riastradh

Omit needless <sys/pcq.h>.


1.38 24-May-2020 riastradh

Fix races in sdmmc tasks and teach ld@sdmmc to abort xfers on detach.

- Teach sdmmc_add_task to queue it only if not already queued.
- Remove now-redundant logic to avoid repeated queueing elsewhere.
- Teach sdmmc_del_task to wait until task has completed.
- Call sdmmc_del_task in various needful places.
- Replace abuse of pcq by a lock and a tailq.
(pcq is multi-producer, _single_-consumer, but there are potentially
multiple consumers here and really only one producer.)
- Teach ld_sdmmc to abort xfers on detach.
(Mechanism is kinda kludgey but it'll do for now; any effort one is
tempted to spend overhauling this should be spent overhauling sdmmc
to support proper asynchronous commands.)
- Make sure ld_sdmmc_discard either returns failure or eventually calls
ldenddiscard.

XXX Currently ld_sdmmc_detach aborts xfers _before_ ldbegindetach has
has committed to detaching or not. This is currently necessary to
avoid a deadlock because ldbegindetach waits for xfers to drain --
which strikes me as wrong; ldbegindetach shouldn't wait for anything,
and should only make the decision to commit to detaching or not so
the caller can decide whether to abort xfers before we actually wait
for them in ldenddetach.

XXX pullup -- although this changes some kernel symbols (sdmmc_add_task
and sdmmc_del_task), it shouldn't affect any existing modules; the only
module that uses sdmmc is ld_sdmmc.kmod, which is `.if 0' in the build
so there shouldn't be any of them floating around.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.37 28-Oct-2019 mlelstv

Whitespace police


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
1.36 19-Mar-2019 mlelstv

branches: 1.36.4;
Provide CID data (manufacturer/product id/product name) as disk type.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
1.35 09-Nov-2018 jmcneill

Defer DIOCCACHESYNC to the sdmmc task queue so they are serialized with other requests.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
1.34 20-Aug-2017 mlelstv

branches: 1.34.2; 1.34.4;
make the sc_discard interface for the ld backend asynchronous and
signal completion through new callback lddiscardend. Use a standard
struct buf to pass disk address and range instead of two off_t values.

make lddiscard synchronous again. This is a requirement of the current
ffs discard code.


1.33 11-Aug-2017 jmcneill

Defer sdmmc discard operations to the sdmmc task queue. Fixes a panic
introduced by ld.c r1.102.


1.32 09-Aug-2017 mlelstv

While ld(4) is MP safe, many backends are not.

Add a flag for backends that are MP safe. Take KERNEL_LOCK when calling
into a backend that doesn't have the flag set. Do the same for the
discard routine.

Fixes PR 52462.


Revision tags: perseant-stdc-iso10646-base
1.31 16-Jul-2017 jmcneill

branches: 1.31.2;
Add support for eMMC 4.5's optional cache feature. If a cache is present,
and the host controller reports the SMC_CAPS_POLLING capability (needed
to flush cache at shutdown), it will be automatically enabled and used.


1.30 10-Jul-2017 mlelstv

Decrypt comment about the attach thread. No functional change.


1.29 08-Jul-2017 jmcneill

The config_* APIs are not MPSAFE, so make sure the deferred attach
thread holds KERNEL_LOCK.


1.28 24-Jun-2017 jmcneill

Add discard support to ld@sdmmc using the ERASE (CMD38) command.


1.27 06-Jun-2017 jmcneill

Fix a race between ld_sdmmc_start and ld_sdmmc_dobio that could result in
tasks getting lost from the task queue. The symptom of this is a NULL
deref in ld_sdmmc_start since the code assumes that a task will always be
available from the pool.

This changes the code to use pcq(9) instead of a TAILQ to manage the free
task list.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
1.26 22-Apr-2017 jmcneill

branches: 1.26.4;
Ensure that the task is returned to the free task list in an error branch.


Revision tags: bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base
1.25 07-Jan-2017 martin

Add missing includes


1.24 07-Jan-2017 kiyohara

Support retry when error. like wd(4).


Revision tags: pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004
1.23 27-Sep-2016 pgoyette

Modularize the ld driver and all of its attachments. Ensure that all
parents are capable of rescan (or otherwise provide a means of attaching
children post-initialization).


1.22 16-Sep-2016 jdolecek

modify ldattach() to have default strategy as a parameter


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
1.21 28-Aug-2015 mlelstv

branches: 1.21.2;
remove unused include sys/rndsource.h


1.20 09-Aug-2015 mlelstv

Add small command queue to reduce latency between ld driver and
sdmmc I/O thread.


1.19 03-Aug-2015 jmcneill

Print the selected transfer mode if known.


1.18 03-Aug-2015 mlelstv

use mutex locking for MP safety.


1.17 27-Jul-2015 skrll

Don't timeout waiting for ld_sdmmc_dobio in the IO thread to start.

XXX why does it take >1s to get scheduled?


Revision tags: nick-nhusb-base-20150606
1.16 20-May-2015 jmcneill

need to call lddone with splbio and kernel lock held


1.15 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
1.14 02-Oct-2014 jmcneill

branches: 1.14.2;
debug ld_sdmmc with LD_SDMMC_DEBUG instead of SDMMC_DEBUG


1.13 02-Oct-2014 mlelstv

Be a bit more verbose about errors, also pass through error code
from lower layer like other drivers.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
1.12 12-Oct-2013 christos

branches: 1.12.4;
Pass the device name in, so we can debug what deferred drivers did not work.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
1.11 14-Dec-2012 jakllsch

branches: 1.11.2;
Display the whole CID register upon attach as "<MID:OID:PNM:PRV:PSN:MDT>"
instead of just "<PNM>". Probably should figure out a way to stuff this
into the device properties database too, but not everything has
pseudo-device drvctl enabled.

Also, drop trailing whitespace.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.10 02-Feb-2012 tls

branches: 1.10.6;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.


1.9 01-Feb-2012 matt

Use "opt_sdmmc.h" for SDMMC_DEBUG, etc.


1.8 27-Jan-2012 tsutsui

Protect ldattach ops with config_pending_intr(9)/config_pending_decr(9)
so that "boot device: ld0" detection works properly even on slower zaurus.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
1.7 13-Nov-2010 uebayasi

branches: 1.7.8; 1.7.12;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
1.6 23-Sep-2010 kiyohara

Print bus width and clock for feature(High speed support).


1.5 20-Sep-2010 kiyohara

Print product name. like sd(4), wd(4) and etc...


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
1.4 28-Nov-2009 nonaka

branches: 1.4.2; 1.4.4; 1.4.6;
Always sector size is treated as 512 bytes.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
1.3 29-May-2009 nonaka

branches: 1.3.2;
It is avoided that the error occurs when the card attaches it,
when wedge is supported.


Revision tags: yamt-nfs-mp-base4 jym-xensuspend-base
1.2 06-May-2009 cegger

branches: 1.2.2;
struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.9 05-Jul-2024 rin

sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@


Revision tags: netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.8 10-Nov-2019 chs

branches: 1.8.32;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020
1.7 14-Oct-2018 jdolecek

remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect


Revision tags: pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422
1.6 18-Apr-2018 maxv

branches: 1.6.2;
m_free -> m_freem, m_copyback could have added mbufs in the chain


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
1.5 14-Jul-2016 msaitoh

branches: 1.5.10; 1.5.16;
- Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
1.4 20-May-2014 rmind

branches: 1.4.4;
netbt: rename some attach/detach functions to have _pcb suffix, so
we could use standard attach/detach naming for pr_usrreq functions.
No functional change.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
1.3 27-Oct-2012 chs

branches: 1.3.10;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase
1.2 06-May-2009 cegger

branches: 1.2.2; 1.2.4; 1.2.10; 1.2.18; 1.2.28;
struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


1.124 10-Dec-2025 mlelstv

Use the SCF_NO_STOP flag to disable AUTO_CMD12_ENABLE
instead of checking the SD_IO_RW_EXTENDED command op code.

Also add this logic to sunxi_mmc.


1.123 06-Dec-2025 jmcneill

sdhc: Do not set auto cmd12 enable for SDIO RW extended ops


1.122 02-Sep-2025 jmcneill

sdhc: Disable bus power for 32-bit register accesses.

SDHC_FLAG_32BIT_ACCESS shouldn't prohibit clearing the SD Bus Power bit in
the Power Control Register, that's what SDHC_FLAG_NO_PWR0 is for.

Should help with card initialization issues at boot on controllers that
set the 32-bit access flag.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.121 16-Feb-2025 jmcneill

branches: 1.121.2;
sdhc: Remove delay in sdhc_wait_state

Replace the 10us delay loop in sdhc_wait_state with a microuptime based
timeout test.


1.120 16-Feb-2025 jmcneill

sdhc: Remove now unused sc_write_delay


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
1.119 09-May-2024 dyoung

branches: 1.119.2;
If the ACPI flag "non-removable" is present and true for an SD/MMC
slot, then set a new flag on that slot to indicate that the media
is non-removable. Make sdhc_card_detect always return true for a
slot if its non-removable media flag is set.

This change lets the kernel automatically configure the
permanently-installed MMC slot on the NXP LX2160-based HoneyComb
LX2 board.


1.118 20-Jan-2024 jmcneill

sdmmc: add support for optional delay after register write


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base
1.117 02-Nov-2022 jmcneill

branches: 1.117.2;
Select DMA mode after programming the ADMA base address register(s).

The Arasan SDHCI 8.9a found in the Xilinx Zynq-7000 SoC requires this
sequence to avoid sporadic transfer errors.


1.116 14-Oct-2022 jmcneill

Disable ADMA2 on Ricoh SDHCI controllers.

PR# 57015


Revision tags: bouyer-sunxi-drm-base
1.115 06-Feb-2022 jmcneill

sdhc: Retire SDHC_FLAG_USE_ADMA2 flag.

ADMA2 support in sdhc is mature now, so no need for it to be opt-in.


1.114 17-Jan-2022 mrg

sdhc: avoid taking adaptive mutex while holding spin mutex

the clock_bus pre- and post- callbacks used in sdhc_bus_clock_ddr()
are called with a spin mutex held, and the new sdhc@acpi ends up
calling into (sleeping) ACPI code, triggering lockdebug assertion.

introduce an adaptive mutex that is held around these callbacks,
and reduce the spin mutex held time in sdhc_bus_clock_ddr().


1.113 15-Jan-2022 jmcneill

sdhc: High speed support capability flag applies to eMMC too.


1.112 10-Nov-2021 msaitoh

s/suport/support/ in comment.


Revision tags: thorpej-i2c-spi-conf2-base
1.111 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
1.110 13-May-2021 msaitoh

branches: 1.110.4;
Use unsigned to avoid undefined behavior in hwrite[12](). Found by kUBSan.


Revision tags: cjep_staticlib_x-base
1.109 24-Apr-2021 thorpej

branches: 1.109.2; 1.109.4;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
1.108 13-Mar-2021 mlelstv

branches: 1.108.2;
Enable block count only for count > 0.
Don't enable autostop when command sets new flag SCF_NO_STOP.


1.107 15-Jul-2020 msaitoh

branches: 1.107.2;
Identify SDHC 4.1 and 4.2. From {DragonFly,Free}BSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.106 28-Oct-2019 joerg

Avoid warnings for tautological shifts as sole conditional.


1.105 28-Oct-2019 mlelstv

Skip setting power when the voltage doesn't change.
Also increase some timeouts.


1.104 23-Oct-2019 hkenken

Add SDHC flags.

+ SDHC_FLAG_BROKEN_ADMA2_ZEROLEN
Broken ADMA2 Zero length descriptor.
Can't 64K Byte data transfer.
+ SDHC_FLAG_NO_1_8_V
Support no 1.8V Supply.
Disable UHS-I bus speed mode (SDR50, DDR50, SDR104).


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base
1.103 03-Jul-2019 jmcneill

branches: 1.103.2;
If switching to fixed sampling clock, do not return an error to the sdmmc layer.


Revision tags: phil-wifi-20190609 isaki-audio2-base
1.102 13-Mar-2019 jmcneill

Add vendor callback for post-bus clock ops and add SDHC_FLAG_STOP_WITH_TC flag


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825 perseant-stdc-iso10646-base
1.101 23-Jun-2017 ryo

branches: 1.101.6;
fix problem for ESDHC/USDHC due to change of r1.96

on ESDHC/USDHC, even if the iosize is less than SDHC_HOST_CTL_VERSION,
specver must be an appropriate value.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
1.100 22-Apr-2017 jmcneill

branches: 1.100.4;
Add a vendor callback for setting signal voltage.


Revision tags: bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
1.99 17-Feb-2017 nonaka

sdhc(4): hardware reset support for Intel eMMC controller


1.98 17-Feb-2017 nonaka

sdhc(4), sdmmc(4): Added MMC HS DDR52 support.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base
1.97 07-Jan-2017 kiyohara

branches: 1.97.2;
Add flags SDHC_FLAG_NO_AUTO_STOP and SDHC_FLAG_NO_BUSY_INTR.


1.96 07-Jan-2017 kiyohara

Don't access SDHC_HOST_CTL_VERSION, if iosize less than this.


Revision tags: pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
1.95 10-Aug-2016 nonaka

Use 1.65-1.95 voltage window for 1.8V support.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
1.94 03-Jul-2016 kiyohara

branches: 1.94.2;
Please more delay, if timeout in sdhc_wait_intr().


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
1.93 31-Dec-2015 ryo

add support iMX6 uSDHC
- some UHS-I/SDR104 card are not stable
- eMMC doesn't work yet


1.92 28-Dec-2015 ryo

fix typo. use pmask for SDHC_PRESENT_STATE.


Revision tags: nick-nhusb-base-20151226
1.91 03-Nov-2015 mlelstv

Also wait for DAT when sending RSP_BSY commands. Fixes PR 50388.


1.90 03-Nov-2015 mlelstv

fix timeout path in soft reset when building with SDHC_DEBUG


1.89 02-Nov-2015 jmcneill

allow vendor specific code to hook into bus width changes


1.88 06-Oct-2015 mlelstv

support hiding command timeout messages with a new command flag and use this
when probing for cards. Should fix PR 50302.


Revision tags: nick-nhusb-base-20150921
1.87 09-Sep-2015 mlelstv

The iMX uSDHC controller doesn't have an interrupt error status flag,
the bit position is reserved and reads as value 0.
- Fake the flag if any of the error bits is set.
- uSDHC supports the 32bit access, the 16bit path doesn't need that quirk.


1.86 09-Sep-2015 mlelstv

Don't test flags from error value in status value. Instead test the
error interrupt status.


1.85 09-Sep-2015 mlelstv

fix DPRINTF parameters


1.84 09-Aug-2015 mlelstv

Ignore data inhibit for commands that do not use the DAT line.
Do a soft reset when the inhibit condition persists for better
error recovery.

Simplify interrupt handling and print errors reported by the controller.

Add more specific debug messages for timeout errors.


1.83 09-Aug-2015 mlelstv

Protect the whole tuning operation including the register setup.


1.82 09-Aug-2015 mlelstv

Add a quirk for Ricoh 5U823 controller. Operation with a 100MHz
bus clock for SDR50 seems to be unstable, reduce frequency one notch
(effectively down to 66MHz with divisor = 3).


1.81 06-Aug-2015 jmcneill

don't hold intr_lock while calling sdhc_execute_tuning


1.80 05-Aug-2015 jmcneill

support re-tuning modes 1 and 2


1.79 05-Aug-2015 jmcneill

Implement SDHC sampling clock tuning procedure.


1.78 05-Aug-2015 mlelstv

lock more hardware accesses


1.77 03-Aug-2015 jmcneill

Add SDHC_FLAG_POLL_CARD_DET flag which lets the bus glue request polling
instead of standard SDHC card insert / detach events.


1.76 03-Aug-2015 jmcneill

Add support for DDR50 transfer modes.


1.75 03-Aug-2015 mlelstv

better error message


1.74 03-Aug-2015 jmcneill

don't select SDR12 mode if we are <= 400 kHz


1.73 03-Aug-2015 jmcneill

dont confuse signaling voltage and bus voltage


1.72 02-Aug-2015 jmcneill

let SDHC_FLAG_HOSTCAPS override SDHC_CAPABILITIES2 as well


1.71 02-Aug-2015 jmcneill

add support for UHS-I modes on capable 3.0+ controllers


1.70 02-Aug-2015 jmcneill

bus_dma_segment_t ds_addr is bus_addr_t not paddr_t (another case of it)


1.69 02-Aug-2015 jmcneill

bus_dma_segment_t ds_addr is bus_addr_t not paddr_t


1.68 02-Aug-2015 mlelstv

Be more verbose about error conditions.


1.67 02-Aug-2015 mlelstv

correct (the commented out) calculation of bus frequency.


1.66 02-Aug-2015 jmcneill

return MMC_OCR_HCS bit from host_ocr if the controller supports high-speed mode


1.65 31-Jul-2015 jmcneill

Simplify sdhc(4) locking


1.64 30-Jul-2015 jmcneill

print "platform DMA" instead of "SDMA" when using external DMA engine


1.63 29-Jul-2015 jmcneill

Add ADMA2 support, which enables scatter gather DMA for data transfers on
controllers that support it.


1.62 28-Jul-2015 skrll

Remove unnecessary #include


1.61 23-Jul-2015 jmcneill

Add a SDHC_FLAG_NO_TIMEOUT quirk to handle spurious timeouts on Tegra K1
during data transfers. While here, increase the soft timeout for DMA
transfers from 1s to 3s.


1.60 22-Jul-2015 skrll

Use C99 designated initializers.

No functional change.


Revision tags: nick-nhusb-base-20150606
1.59 30-May-2015 jmcneill

support 8-bit mode for SDHC 3.0+ controllers


1.58 03-May-2015 jmcneill

print some useful information at attach time


1.57 03-May-2015 jmcneill

Add SDHC_FLAG_SINGLE_POWER_WRITE flag, that tells the driver to update
the SDHC_POWER_CTL register with a single write rather than in multiple
steps. Required for Tegra K1 SDHC.


1.56 02-May-2015 jmcneill

support SDHC 4.0, allow for overriding clk base frequency


1.55 14-Apr-2015 bouyer

Add a new SDHC_FLAG, SDHC_FLAG_EXTDMA_DMAEN, which request that the
SDHC_DMA_ENABLE bit be set in the command, even if we're using an
external DMA engine. Needed by the upcoming DMA support for AM335x
(beaglebone).


Revision tags: nick-nhusb-base-20150406
1.54 27-Feb-2015 nonaka

eSDHC has no DMA_BOUNDARY in BLOCK_SIZE register.
So clear multi segment DMA transfer support bit.


1.53 27-Feb-2015 nonaka

Don't clear other bits. pq3sdhc is set more bits.


1.52 26-Jan-2015 nonaka

eSDHC has non standard Host Controller Version Register offset.


Revision tags: nick-nhusb-base
1.51 04-Oct-2014 jmcneill

branches: 1.51.2;
pass sdhc_softc instead of sdhc_host to sc_vendor_transfer_data_dma, since the vendor specific code has no visibility into struct sdhc_host and can easily do device_private(sdhc_softc->sc_dev)


1.50 02-Oct-2014 mlelstv

Fix divisor calculation for SDHC 3.0.
1/1 -> 0
1/2 -> 1
1/4 -> 2
...
1/2*N -> N


1.49 01-Oct-2014 jmcneill

correct clk div calculation for SD 3.0 controllers


1.48 01-Oct-2014 jmcneill

Don't check slot type for pre-3.0 controllers, the bits were reserved at
the time. If an older controller advertises 1.8V support, just use it.
This fixes high-speed mode support for me on BeagleBone Black.


1.47 14-Sep-2014 skrll

When doing vendor dma transfer wait for SDHC_TRANSFER_COMPLETE.

From jmcneill@ with some layout changes from me.


1.46 12-Sep-2014 jakllsch

Avoid NULL deref when sdhc(4) attaches via config_interrupts().


1.45 12-Sep-2014 jakllsch

Allow sdhc(4) to use a non-integrated DMA engine.


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
1.44 24-May-2014 hkenken

branches: 1.44.2;
eSDHC Controller doesn't have "Host SDMA Buffer Boundary" bit field


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8
1.43 10-Jan-2013 jmcneill

branches: 1.43.10;
add SDHC_FLAG_NO_HS_BIT flag to prevent sdhc driver from setting the SDHC_HIGH_SPEED bit in SDHC_HOST_CTL, required to get many high speed cards working on rpi


1.42 08-Jan-2013 jakllsch

If the command protocol calls for a trailing busy signal,
wait (up to 10 seconds) for it to be released.


1.41 07-Jan-2013 jakllsch

Find correct slot index in sdhc_cfprint().


1.40 24-Dec-2012 jakllsch

SDHC_VOLTAGE_SUPP_1_8V is only valid in the presence of SDHC_EMBEDDED_SLOT.
Fixes probing of full-size 1GB Toshiba card made in 2008 that fails to
respond with a 1.8V supply. (JMB389 (in TS-RDF1) host claims
SDHC_VOLTAGE_SUPP_1_8V but does not claim SDHC_EMBEDDED_SLOT.)


1.39 23-Dec-2012 jakllsch

SMC_CAPS_DMA without SMC_CAPS_MULTI_SEG_DMA means we as a host driver only
can support one segment per operation. This is not the case with SDHCI SDMA,
the only SDHCI DMA mechanism we currently support in sdhc(4). Should fix
corrupt data on DMA-enabled SDHCI controllers claiming conformance to a SDHCI
Specification other than 1.0.


1.38 22-Dec-2012 jakllsch

Add support for SDHCI 3.0 bus clock generation, which unlike 1.0 and 2.0
has support for non-power-of-two divisors from 1 to 1023. Additionally
restore finding the correct power-of-two divisor for standard-compliant
pre-3.0 SDHCI parts. Also, calculate minimum divided clock for the
clkmsk-quirk parts correctly.

XXX Will future standard-compliant SDHCI versions have a SDHCI 3.0
backwards-compatible clock generator, or just SDHCI 1.0/2.0?


1.37 20-Dec-2012 jakllsch

If we get a SDMA boundary-crossing interrupt at the end of the final
segment, the transfer is not implicitly complete; we still need to wait
for the transfer complete interrupt so that we can issue new commands
successfully.

This fixes the problem my Ricoh R5C822 was having where all writes after
a larger (64KiB) write were failing because we attempted to issue CMD13
(to check the status of the aformentioned write) too soon afterwards.

I suspect this fix to apply to other Ricoh SDHCI controllers I've heard
people have had trouble with. Sorry I didn't look at this sooner.


1.36 20-Dec-2012 jakllsch

Change sdhc_detach so that it detaches all host controllers at once.
This should make multiple slot controllers, for example those with
a controller on more than one PCI/CardBus BAR, detach with fewer bugs.
Tested with as-of-yet-uncommited sdhc_pci changes on a single-host
ExpressCard JMicron JMB38[89].


Revision tags: yamt-pagecache-base7
1.35 13-Dec-2012 riastradh

Implement TI AM335x's SDHC reset quirk. Beaglebone SDHC works now!

On the AM335x, we first must wait for the controller to acknowledge
the reset; then we can wait for the reset to complete.

I believe this quirk also applies to the OMAP4 ES, but I don't have
one of those to test and we don't seem to have an obvious conditional
for it anyway.

This quirk may work for controllers that don't require it too, but I
am nervous about doing it by default because if we miss the reset
acknowledgement, then we'll just time out even though everything is
really hunky-dory.

Also, for all sdhc, don't bother writing 0 in sdhc_soft_reset while
waiting for the reset to complete; there is no need.

ok matt


1.34 12-Dec-2012 matt

Add sc_vendor_bus_clock hook
From jmcneill.


1.33 12-Dec-2012 riastradh

Avoid the 16-bit read in sdhc_host_found for 32-bit-only devices.

This change makes sdhc_host_found allocate hp up front before showing
the identification, in order to avoid having to open-code a copy of
HREAD2 before hp is available.


Revision tags: yamt-pagecache-base6
1.32 29-Oct-2012 kiyohara

Support omap3 SDHC driver. tested on OVERO only.


1.31 13-Sep-2012 joerg

Don't use const foo const as type, one const is enough.


1.30 31-Aug-2012 matt

branches: 1.30.2;
Support deciphering SDHCv3 clock rates.


1.29 30-Jul-2012 matt

Make PIO on normal SDHC devices work correctly on big-endian machines.
Add locking around interrupt manipulation (it should now be MP safe).


1.28 28-Jul-2012 matt

Only SDHC 1.0 controllers can do that fucky MULTI_SEG stuff.


1.27 28-Jul-2012 jakllsch

sdhc(4) currently only implements support for the SDHC 1.0 DMA mechanism, so
only enable in that case.


1.26 26-Jul-2012 matt

MULTI_SEG does not for ESDHC. (Don't know how it works at all on any SDHC
but ...)


1.25 23-Jul-2012 matt

Responses are actually in host order (except SCR which is return in
big endian so that's convert to host order).


1.24 21-Jul-2012 skrll

Provide a method for attachments to specify capabilites.


1.23 20-Jul-2012 matt

Add use of watermark register when PIO to an ESDHC. After every kill or
drain of watermask words, pause a bit to give time for the fifo to recover.
Always the command response in BE byteorder. Rewrite __bitfield to deal
with this.


1.22 17-Jul-2012 matt

If there was an error in 32-bit mode, just set ERROR_INTERRUPT otherwise
see if matched anything we care about.


1.21 17-Jul-2012 skrll

Handle interrupt acknowledgement in the SDHC_FLAG_32BIT_ACCESS case in
the same way as non-SDHC_FLAG_32BIT_ACCESS case.


1.20 12-Jul-2012 jakllsch

bus_space_*_stream_N() functions are not universally available.
Provite alternate implementation for when they are unavailable.


1.19 12-Jul-2012 jakllsch

Completely rework (and enable) SDHC 1.0 DMA data transfer.

While without a large physically-contiguous buffer the performance
suffers severly, this should still be better than PIO.


1.18 12-Jul-2012 jakllsch

No need to panic on failure to find a divisor.
Additionally, add commented out calculation of actual clock frequency.


1.17 12-Jul-2012 jakllsch

SDHC can have multiple slots, note which slot a specific sdmmc(4) attaches to.


1.16 12-Jul-2012 jakllsch

SDHCI byte swaps the BE response on the wire into LE registers.
As we always want response data in LE, use bus_space_read_stream.
Additonally, read response data in 1 or 4 4-byte chunks, instead of
one 4-byte chunk or 15 1-byte chunks.


1.15 12-Jul-2012 jakllsch

Always enable and set block count register. We never do infinite transfers.
The old way seemed to be causing issues on a R5C822, at least with DMA enabled.


1.14 12-Jul-2012 matt

Add a flag for the lack of LED_ON in HOST_CTL (ti omap3 doesn't do that).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8
1.13 15-Mar-2012 bouyer

Do not read past array end, found by gcc -O3.
This could cause to HWRITE4() a bad value, but maybe last 2 bytes are
probably ignored by hardware anyway.


Revision tags: jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base4
1.12 02-Mar-2012 nonaka

Added Ricoh 5U822/5U823 SD/MMC Controller support.


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base3
1.11 23-Feb-2012 matt

Support 32-bit only access to the SDHC registers.
Add support for FreeScale "Enhanced" SDHC port.
Add support for CGM mode (XLP and BCM2835 (Arason)).


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
1.10 02-Feb-2012 nonaka

branches: 1.10.2;
Use "opt_sdmmc.h" for SDHC_DEBUG.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
1.9 29-Jun-2011 matt

branches: 1.9.2; 1.9.6;
Add some inital changes for the Freescale eSDHC.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 rmind-uvmplock-base
1.8 07-Oct-2010 kiyohara

Support change Open-drain/Push-pull by bus_rod().


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
1.7 27-Mar-2010 nonaka

branches: 1.7.2;
Added sdhc at cardbus support.


Revision tags: yamt-nfs-mp-base9
1.6 24-Feb-2010 dyoung

branches: 1.6.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
1.5 12-Jan-2010 uebayasi

branches: 1.5.2;
According to SD Host Controller Simplified Specification Version 2.00, 2.2.10.
Host Control Register (Offset 028h), the "Data Transfer Width" bit is in Host
Control Register (Offset 028h), not Power Control Register (Offset 029h).


1.4 08-Jan-2010 dyoung

Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 jym-xensuspend-nbase
1.3 02-Oct-2009 uebayasi

branches: 1.3.2;
Typo in comment.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
1.2 17-May-2009 cegger

fix crash with LOCKDEBUG+DIAGNOSTIC kernels:

sdhc_bus_clock() calls mutex_enter().
then in DIAGNOSTIC section, sdhc_bus_clock() calls sdhc_card_detect().
sdhc_card_detect() calls mutex_enter() on the same mutex again.
when LOCKDEBUG is enabled, you get

Mutex error: lockdebug_wantlock: locking against myself


Revision tags: yamt-nfs-mp-base4 jym-xensuspend-base yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
1.21 15-Jul-2020 msaitoh

Identify SDHC 4.1 and 4.2. From {DragonFly,Free}BSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.20 23-Oct-2019 hkenken

Add SDHC flags.

+ SDHC_FLAG_BROKEN_ADMA2_ZEROLEN
Broken ADMA2 Zero length descriptor.
Can't 64K Byte data transfer.
+ SDHC_FLAG_NO_1_8_V
Support no 1.8V Supply.
Disable UHS-I bus speed mode (SDR50, DDR50, SDR104).


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825 perseant-stdc-iso10646-base
1.19 23-Jun-2017 ryo

branches: 1.19.6; 1.19.12;
fix problem for ESDHC/USDHC due to change of r1.96

on ESDHC/USDHC, even if the iosize is less than SDHC_HOST_CTL_VERSION,
specver must be an appropriate value.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
1.18 31-Dec-2015 ryo

branches: 1.18.10;
add support iMX6 uSDHC
- some UHS-I/SDR104 card are not stable
- eMMC doesn't work yet


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
1.17 05-Aug-2015 jmcneill

support re-tuning modes 1 and 2


1.16 05-Aug-2015 jmcneill

Implement SDHC sampling clock tuning procedure.


1.15 02-Aug-2015 jmcneill

add support for UHS-I modes on capable 3.0+ controllers


1.14 29-Jul-2015 jmcneill

Add ADMA2 support, which enables scatter gather DMA for data transfers on
controllers that support it.


Revision tags: nick-nhusb-base-20150606
1.13 02-May-2015 jmcneill

support SDHC 4.0, allow for overriding clk base frequency


Revision tags: nick-nhusb-base-20150406
1.12 26-Jan-2015 nonaka

eSDHC has non standard Host Controller Version Register offset.


Revision tags: nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
1.11 24-Dec-2012 jakllsch

branches: 1.11.12; 1.11.14;
Add a few more register bits from SDHCI 3.0.
Also, add comment to denote an ESDHC bit.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
1.10 15-Oct-2012 jakllsch

Make whitespace following preprocessor keywords consistent
with the predominating form in this file (that is, a space).


1.9 31-Aug-2012 matt

branches: 1.9.2;
Support deciphering SDHCv3 clock rates.


1.8 20-Jul-2012 matt

Add use of watermark register when PIO to an ESDHC. After every kill or
drain of watermask words, pause a bit to give time for the fifo to recover.
Always the command response in BE byteorder. Rewrite __bitfield to deal
with this.


1.7 12-Jul-2012 jakllsch

Add DMA boundary field shift and mask.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base4
1.6 02-Mar-2012 nonaka

Added Ricoh 5U822/5U823 SD/MMC Controller support.


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.5 01-Feb-2012 matt

branches: 1.5.2;
Add XLP specific CGM mode for SDHC_CLOCK_CTL.


1.4 01-Feb-2012 matt

Add some more FreeScale ESDHC defintions.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
1.3 29-Jun-2011 matt

branches: 1.3.2; 1.3.6;
Add some inital changes for the Freescale eSDHC.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
1.2 17-Mar-2011 matt

Add stuff that the Freescale PowerQUICC3 ESDHC controllers have.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.14; 1.1.16;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.36 16-Feb-2025 jmcneill

sdhc: Remove now unused sc_write_delay


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
1.35 09-May-2024 dyoung

branches: 1.35.2;
If the ACPI flag "non-removable" is present and true for an SD/MMC
slot, then set a new flag on that slot to indicate that the media
is non-removable. Make sdhc_card_detect always return true for a
slot if its non-removable media flag is set.

This change lets the kernel automatically configure the
permanently-installed MMC slot on the NXP LX2160-based HoneyComb
LX2 board.


1.34 20-Jan-2024 jmcneill

sdmmc: add support for optional delay after register write


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base
1.33 14-Oct-2022 jmcneill

branches: 1.33.2;
Disable ADMA2 on Ricoh SDHCI controllers.

PR# 57015


Revision tags: bouyer-sunxi-drm-base
1.32 06-Feb-2022 jmcneill

sdhc: Retire SDHC_FLAG_USE_ADMA2 flag.

ADMA2 support in sdhc is mature now, so no need for it to be opt-in.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.31 23-Oct-2019 hkenken

Add SDHC flags.

+ SDHC_FLAG_BROKEN_ADMA2_ZEROLEN
Broken ADMA2 Zero length descriptor.
Can't 64K Byte data transfer.
+ SDHC_FLAG_NO_1_8_V
Support no 1.8V Supply.
Disable UHS-I bus speed mode (SDR50, DDR50, SDR104).


Revision tags: netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
1.30 13-Mar-2019 jmcneill

Add vendor callback for post-bus clock ops and add SDHC_FLAG_STOP_WITH_TC flag


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426
1.29 22-Apr-2017 jmcneill

branches: 1.29.12;
Add a vendor callback for setting signal voltage.


Revision tags: bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
1.28 17-Feb-2017 nonaka

sdhc(4): hardware reset support for Intel eMMC controller


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base
1.27 07-Jan-2017 kiyohara

branches: 1.27.2;
Add flags SDHC_FLAG_NO_AUTO_STOP and SDHC_FLAG_NO_BUSY_INTR.


Revision tags: pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
1.26 31-Dec-2015 ryo

branches: 1.26.2;
add support iMX6 uSDHC
- some UHS-I/SDR104 card are not stable
- eMMC doesn't work yet


Revision tags: nick-nhusb-base-20151226
1.25 02-Nov-2015 jmcneill

allow vendor specific code to hook into bus width changes


Revision tags: nick-nhusb-base-20150921
1.24 09-Aug-2015 mlelstv

Add a quirk for Ricoh 5U823 controller. Operation with a 100MHz
bus clock for SDR50 seems to be unstable, reduce frequency one notch
(effectively down to 66MHz with divisor = 3).


1.23 03-Aug-2015 jmcneill

Add SDHC_FLAG_POLL_CARD_DET flag which lets the bus glue request polling
instead of standard SDHC card insert / detach events.


1.22 02-Aug-2015 jmcneill

let SDHC_FLAG_HOSTCAPS override SDHC_CAPABILITIES2 as well


1.21 31-Jul-2015 jmcneill

Simplify sdhc(4) locking


1.20 29-Jul-2015 jmcneill

Add ADMA2 support, which enables scatter gather DMA for data transfers on
controllers that support it.


1.19 23-Jul-2015 jmcneill

Add a SDHC_FLAG_NO_TIMEOUT quirk to handle spurious timeouts on Tegra K1
during data transfers. While here, increase the soft timeout for DMA
transfers from 1s to 3s.


Revision tags: nick-nhusb-base-20150606
1.18 03-May-2015 jmcneill

Add SDHC_FLAG_SINGLE_POWER_WRITE flag, that tells the driver to update
the SDHC_POWER_CTL register with a single write rather than in multiple
steps. Required for Tegra K1 SDHC.


1.17 02-May-2015 jmcneill

support SDHC 4.0, allow for overriding clk base frequency


1.16 14-Apr-2015 bouyer

Add a new SDHC_FLAG, SDHC_FLAG_EXTDMA_DMAEN, which request that the
SDHC_DMA_ENABLE bit be set in the command, even if we're using an
external DMA engine. Needed by the upcoming DMA support for AM335x
(beaglebone).


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
1.15 04-Oct-2014 jmcneill

branches: 1.15.2;
pass sdhc_softc instead of sdhc_host to sc_vendor_transfer_data_dma, since the vendor specific code has no visibility into struct sdhc_host and can easily do device_private(sdhc_softc->sc_dev)


1.14 12-Sep-2014 jakllsch

Allow sdhc(4) to use a non-integrated DMA engine.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
1.13 10-Jan-2013 jmcneill

branches: 1.13.12;
add SDHC_FLAG_NO_HS_BIT flag to prevent sdhc driver from setting the SDHC_HIGH_SPEED bit in SDHC_HOST_CTL, required to get many high speed cards working on rpi


1.12 20-Dec-2012 jakllsch

Change sdhc_detach so that it detaches all host controllers at once.
This should make multiple slot controllers, for example those with
a controller on more than one PCI/CardBus BAR, detach with fewer bugs.
Tested with as-of-yet-uncommited sdhc_pci changes on a single-host
ExpressCard JMicron JMB38[89].


Revision tags: yamt-pagecache-base7
1.11 13-Dec-2012 riastradh

Implement TI AM335x's SDHC reset quirk. Beaglebone SDHC works now!

On the AM335x, we first must wait for the controller to acknowledge
the reset; then we can wait for the reset to complete.

I believe this quirk also applies to the OMAP4 ES, but I don't have
one of those to test and we don't seem to have an obvious conditional
for it anyway.

This quirk may work for controllers that don't require it too, but I
am nervous about doing it by default because if we miss the reset
acknowledgement, then we'll just time out even though everything is
really hunky-dory.

Also, for all sdhc, don't bother writing 0 in sdhc_soft_reset while
waiting for the reset to complete; there is no need.

ok matt


1.10 12-Dec-2012 matt

Add sc_vendor_bus_clock hook
From jmcneill.


Revision tags: yamt-pagecache-base6
1.9 29-Oct-2012 kiyohara

Support omap3 SDHC driver. tested on OVERO only.


1.8 21-Jul-2012 skrll

branches: 1.8.2;
Provide a method for attachments to specify capabilites.


1.7 12-Jul-2012 matt

Add a flag for the lack of LED_ON in HOST_CTL (ti omap3 doesn't do that).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.6 01-Feb-2012 matt

branches: 1.6.2;
Add more FLAGS


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
1.5 29-Jun-2011 matt

branches: 1.5.2; 1.5.6;
Add some inital changes for the Freescale eSDHC.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base
1.4 27-Mar-2010 nonaka

branches: 1.4.2;
Added sdhc at cardbus support.


Revision tags: yamt-nfs-mp-base9
1.3 24-Feb-2010 dyoung

branches: 1.3.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
1.2 08-Jan-2010 dyoung

branches: 1.2.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.44 24-Jun-2025 gutteridge

sdmmc.c: add missing newlines to several device_printf(9) calls


Revision tags: netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base
1.43 07-Aug-2021 thorpej

branches: 1.43.12;
Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
1.42 13-Jun-2021 mlelstv

branches: 1.42.2;
Don't crash on detach where interlock == NULL.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
1.41 24-Apr-2021 thorpej

branches: 1.41.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base
1.40 24-May-2020 riastradh

branches: 1.40.4;
Fix races in sdmmc tasks and teach ld@sdmmc to abort xfers on detach.

- Teach sdmmc_add_task to queue it only if not already queued.
- Remove now-redundant logic to avoid repeated queueing elsewhere.
- Teach sdmmc_del_task to wait until task has completed.
- Call sdmmc_del_task in various needful places.
- Replace abuse of pcq by a lock and a tailq.
(pcq is multi-producer, _single_-consumer, but there are potentially
multiple consumers here and really only one producer.)
- Teach ld_sdmmc to abort xfers on detach.
(Mechanism is kinda kludgey but it'll do for now; any effort one is
tempted to spend overhauling this should be spent overhauling sdmmc
to support proper asynchronous commands.)
- Make sure ld_sdmmc_discard either returns failure or eventually calls
ldenddiscard.

XXX Currently ld_sdmmc_detach aborts xfers _before_ ldbegindetach has
has committed to detaching or not. This is currently necessary to
avoid a deadlock because ldbegindetach waits for xfers to drain --
which strikes me as wrong; ldbegindetach shouldn't wait for anything,
and should only make the decision to commit to detaching or not so
the caller can decide whether to abort xfers before we actually wait
for them in ldenddetach.

XXX pullup -- although this changes some kernel symbols (sdmmc_add_task
and sdmmc_del_task), it shouldn't affect any existing modules; the only
module that uses sdmmc is ld_sdmmc.kmod, which is `.if 0' in the build
so there shouldn't be any of them floating around.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.39 28-Oct-2019 mlelstv

Add and use sdmmc_pause to avoid long-term busy waits.
Add sdio abort function.
Additional error messages.
Print parameters for SDIO devices.
Minor cosmetics.


1.38 23-Oct-2019 hkenken

Add SDHC flags.

+ SDHC_FLAG_BROKEN_ADMA2_ZEROLEN
Broken ADMA2 Zero length descriptor.
Can't 64K Byte data transfer.
+ SDHC_FLAG_NO_1_8_V
Support no 1.8V Supply.
Disable UHS-I bus speed mode (SDR50, DDR50, SDR104).


1.37 01-Sep-2019 mlelstv

From OpenBSD:
- support block length per function
- add functions to read/write regions
Decode (but not use) SDIO tuple in CIS.
Fix locking.
Add more SDIO defines (partially from version 3.0).


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
1.36 06-Nov-2018 jmcneill

branches: 1.36.4;
Increase kthread priority to PRI_SOFTBIO.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
1.35 06-Mar-2018 mlelstv

branches: 1.35.2;
correct whitespace in attach message


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
1.34 17-Feb-2017 nonaka

branches: 1.34.12;
sdhc(4): hardware reset support for Intel eMMC controller


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
1.33 22-Dec-2015 mlelstv

branches: 1.33.2; 1.33.4;
ignore timeouts for APP_CMD prefix as for the application command itself.


1.32 29-Nov-2015 jmcneill

Add some event counters to track transfer sizes.


Revision tags: nick-nhusb-base-20150921
1.31 09-Aug-2015 mlelstv

Send an explicit CMD12 (stop transmission) when there was an error
in multi-sector I/O.

The SDHC spec has a complex flowchart describing when an explicit
CMD12 is necessary, so we probably use it too often.


1.30 09-Aug-2015 mlelstv

protect card detection with mutex.


1.29 03-Aug-2015 jmcneill

Add support for DDR50 transfer modes.


1.28 03-Aug-2015 mlelstv

use mutex locking for MP safety.


1.27 28-Jul-2015 mlelstv

Be more verbose about errors.


Revision tags: nick-nhusb-base-20150606
1.26 21-May-2015 jmcneill

sdmmc_task_thread isn't MPSAFE so instead of just wrapping the callback
in KERNEL_LOCK/KERNEL_UNLOCK_ONE, remove KTHREAD_MPSAFE. While here, use
PRI_BIO instead of PRI_NONE for the task thread priority. Since this is
how all transfers are queued, and we have a 1 second timeout on the task
being picked up off the queue (!), better not to rely on a PRI_NONE thread.


1.25 20-May-2015 jmcneill

need to call lddone with splbio and kernel lock held


Revision tags: nick-nhusb-base-20150406
1.24 27-Feb-2015 nonaka

fix to simulate multi-segment dma transfer for pq3sdhc(4).


Revision tags: nick-nhusb-base
1.23 16-Nov-2014 ozaki-r

branches: 1.23.2;
Replace callout_stop with callout_halt

In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.

Discussed with martin@ and riastradh@.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
1.22 19-Mar-2014 nonaka

branches: 1.22.4;
Add a driver for Realtek RTS5209/RTS5229 Card Reader.
Ported from OpenBSD.


Revision tags: riastradh-drm2-base3
1.21 12-Oct-2013 christos

Pass the device name in, so we can debug what deferred drivers did not work.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
1.20 22-Dec-2012 jakllsch

branches: 1.20.2;
We can't block our interrupt while sdmmc_detach_card is called, as
it can issue commands, and some host drivers have interrupt-driven
command completion. Prevents assertion (or deadlock) upon detach
of sdhc(4) with inserted card.


1.19 22-Dec-2012 jakllsch

Revert sdmmc.c r1.18 (previous commit to this file).
It seems to have caused regressions to detaching drivers from cards at
the appropriate time.

DETACH_FORCE to sdmmc_card_detach really means the SD/SDIO card is gone,
and can not be abused to mean that the host controller disappered.


1.18 20-Dec-2012 jakllsch

Only use DETACH_FORCE as flags argument to sdmmc_card_detach when the
host controller has disappeared or is detaching.
XXX should pass flags from sdmmc_detach through to the task thread ending
to differentiate host controller disappearance from mere detachment.


1.17 15-Dec-2012 jakllsch

It's also useful to compile-test before committing.


1.16 15-Dec-2012 jakllsch

When debugging, it's useful to know what exactly failed.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
1.15 04-Aug-2012 kiyohara

branches: 1.15.2;
Print 'Standard Function Interface Code" in sdmmc_print(), if not SD_IO_SFIC_NO_STANDARD.


1.14 17-Jul-2012 skrll

Whitespace.


1.13 12-Jul-2012 jakllsch

If necessary, unload and destroy dmamap upon detach.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.12 01-Feb-2012 matt

Use "opt_sdmmc.h" for SDMMC_DEBUG, etc.


1.11 26-Jan-2012 matt

Print error if couldn't enable card.


1.10 21-Jan-2012 nonaka

fix my license notice.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
1.9 20-Mar-2011 nonaka

branches: 1.9.4; 1.9.8;
if poll card detect is enabled, don't show "couldn't enable card".


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
1.8 13-Feb-2011 nonaka

- Don't switch MMC high-speed timing, if host controller isn't supported.
- Only check EXT_CSD STRUCTURE version when CSD version is 3.
- initialize width at sdmmc_function_alloc().


1.7 05-Feb-2011 nonaka

Don't switch SD high-speed timing, if host controller isn't supported.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
1.6 07-Oct-2010 kiyohara

branches: 1.6.2; 1.6.4;
Fix read CIS. And pass to attach args the standard function interface code.


1.5 07-Oct-2010 kiyohara

Support High-Speed mode.


1.4 01-Oct-2010 kiyohara

Use DMA bounce buffer, if DMA buffer is making by multiple segments. A lot
of host controllers do not support to two or more segments.


1.3 20-Sep-2010 kiyohara

Clear SMF_CARD_PRESENT, if failed to attach.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
1.2 06-Apr-2010 nonaka

branches: 1.2.2;
- mention MMC SPI mode.
- support SD 4bit bus width mode.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.10 17-Jan-2025 jmcneill

sdmmc: Capture lan_nid and expose sdmmc_cisptr

LAN NID contains the MAC address for networking adapters.

Device drivers may want to processor vendor specific tuple codes, so
expose sdmmc_cisptr to help this.


1.9 13-Oct-2024 jmcneill

sdmmc: Decode CISTPL_FUNCE of type PCMCIA_TPLFE_TYPE_LAN_NID


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.8 28-Oct-2019 mlelstv

branches: 1.8.26; 1.8.32;
Whitespace police


1.7 24-Sep-2019 mlelstv

Remove debug printf.


1.6 01-Sep-2019 mlelstv

From OpenBSD:
- support block length per function
- add functions to read/write regions
Decode (but not use) SDIO tuple in CIS.
Fix locking.
Add more SDIO defines (partially from version 3.0).


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
1.5 28-Jan-2018 jmcneill

branches: 1.5.4; 1.5.10;
Don't print an error when we find a CIS tuple code in the vendor-unique
range (80h-8Fh).


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.4 01-Feb-2012 matt

Use "opt_sdmmc.h" for SDMMC_DEBUG, etc.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 rmind-uvmplock-base
1.3 07-Oct-2010 kiyohara

branches: 1.3.8; 1.3.12;
Fix build failure. s/const static/static const/.


1.2 07-Oct-2010 kiyohara

Fix read CIS. And pass to attach args the standard function interface code.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12; 1.1.14;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


1.24 12-Dec-2025 mlelstv

Use DMA for SD_IO_RW_EXTENDED.


1.23 10-Dec-2025 mlelstv

Use the SCF_NO_STOP flag to disable AUTO_CMD12_ENABLE
instead of checking the SD_IO_RW_EXTENDED command op code.

Also add this logic to sunxi_mmc.


1.22 06-Dec-2025 jmcneill

sdmmc: Use block mode for multi block SDIO transfers.

Change from OpenBSD:
https://github.com/openbsd/src/commit/5e0782b17abc2070c235843e37de911ce3f98ef8

So far the SDIO stack issued one transfer for every 64 byte to be
copied. This severely limits the speed over the bus. By using
block mode we can issue block-sized transfers, which bumps the
transfer size to at least 512 bytes. By using multi-block mode
we can copy up to 511 blocks per transfer.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
1.21 17-Oct-2020 mlelstv

branches: 1.21.28;
Fix error message. No functional change, both commands use the same
bit to select read or write mode.


1.20 24-May-2020 riastradh

Fix races in sdmmc tasks and teach ld@sdmmc to abort xfers on detach.

- Teach sdmmc_add_task to queue it only if not already queued.
- Remove now-redundant logic to avoid repeated queueing elsewhere.
- Teach sdmmc_del_task to wait until task has completed.
- Call sdmmc_del_task in various needful places.
- Replace abuse of pcq by a lock and a tailq.
(pcq is multi-producer, _single_-consumer, but there are potentially
multiple consumers here and really only one producer.)
- Teach ld_sdmmc to abort xfers on detach.
(Mechanism is kinda kludgey but it'll do for now; any effort one is
tempted to spend overhauling this should be spent overhauling sdmmc
to support proper asynchronous commands.)
- Make sure ld_sdmmc_discard either returns failure or eventually calls
ldenddiscard.

XXX Currently ld_sdmmc_detach aborts xfers _before_ ldbegindetach has
has committed to detaching or not. This is currently necessary to
avoid a deadlock because ldbegindetach waits for xfers to drain --
which strikes me as wrong; ldbegindetach shouldn't wait for anything,
and should only make the decision to commit to detaching or not so
the caller can decide whether to abort xfers before we actually wait
for them in ldenddetach.

XXX pullup -- although this changes some kernel symbols (sdmmc_add_task
and sdmmc_del_task), it shouldn't affect any existing modules; the only
module that uses sdmmc is ld_sdmmc.kmod, which is `.if 0' in the build
so there shouldn't be any of them floating around.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
1.19 04-Jan-2020 mlelstv

Be less noisy for some commands.


Revision tags: phil-wifi-20191119
1.18 28-Oct-2019 mlelstv

Simplyfy sdmmc_io_set_blocklen function signature by dropping the
extra softc pointer. Aligns with OpenBSD.


1.17 28-Oct-2019 mlelstv

Add and use sdmmc_pause to avoid long-term busy waits.
Add sdio abort function.
Additional error messages.
Print parameters for SDIO devices.
Minor cosmetics.


1.16 02-Sep-2019 jmcneill

SD_IO_RW_EXTENDED is a data transfer command, so set ADTC flag instead of AC


1.15 01-Sep-2019 mlelstv

From OpenBSD:
- support block length per function
- add functions to read/write regions
Decode (but not use) SDIO tuple in CIS.
Fix locking.
Add more SDIO defines (partially from version 3.0).


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020
1.14 14-Oct-2018 jdolecek

branches: 1.14.4;
remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect


Revision tags: pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
1.13 23-Oct-2017 jmcneill

branches: 1.13.2; 1.13.4;
- Get SDIO reset working (from OpenBSD).
- After switching bus width, notify the host controller of the change.


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
1.12 06-Oct-2015 mlelstv

support hiding command timeout messages with a new command flag and use this
when probing for cards. Should fix PR 50302.


Revision tags: nick-nhusb-base-20150921
1.11 05-Aug-2015 mlelstv

lock around interrupt registration.
don't release lock around interrupt handlers, the code cannot
handle an unstable handler list.


1.10 03-Aug-2015 jmcneill

Add support for DDR50 transfer modes.


1.9 03-Aug-2015 mlelstv

use mutex locking for MP safety.


1.8 28-Jul-2015 mlelstv

cosmetic change only.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.7 01-Feb-2012 matt

branches: 1.7.6; 1.7.24;
Use "opt_sdmmc.h" for SDMMC_DEBUG, etc.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
1.6 13-Feb-2011 nonaka

branches: 1.6.4; 1.6.8;
- Don't switch MMC high-speed timing, if host controller isn't supported.
- Only check EXT_CSD STRUCTURE version when CSD version is 3.
- initialize width at sdmmc_function_alloc().


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
1.5 07-Oct-2010 kiyohara

branches: 1.5.2; 1.5.4;
Fix read CIS. And pass to attach args the standard function interface code.


1.4 07-Oct-2010 kiyohara

Remove unnecessary Tab.


1.3 07-Oct-2010 kiyohara

Support High-Speed mode.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
1.2 05-Dec-2009 pooka

branches: 1.2.2; 1.2.4; 1.2.6;
Convert tsleep(&lbolt) to kpause(). Make ltsleep/mtsleep on lbolt
illegal. I examined all places where lbolt is referenced to make
sure there were pointer aliases of it passed to tsleep, but put a
KASSERT in m/ltsleep() just to be sure.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
1.6 19-Dec-2019 kamil

Avoid changing signedness bit with << in sdmmc_ioreg.h

Reported by <prlw1>


Revision tags: phil-wifi-20191119
1.5 28-Oct-2019 mlelstv

Missing commit for sdio abort function.


1.4 01-Sep-2019 mlelstv

From OpenBSD:
- support block length per function
- add functions to read/write regions
Decode (but not use) SDIO tuple in CIS.
Fix locking.
Add more SDIO defines (partially from version 3.0).


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base
1.3 24-Jul-2019 msaitoh

branches: 1.3.2;
Define SD_ARG_CMD52_WRITE macro correctly. Found by KUBSan. This macro is
used in sdmmc_io_write_1() and sdmmc_io_reset.


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 rmind-uvmplock-base
1.2 07-Oct-2010 kiyohara

branches: 1.2.60;
Fix read CIS. And pass to attach args the standard function interface code.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12; 1.1.14;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.77 24-Oct-2024 skrll

Don't stop sd card initialization early when bus clock is already set
to the target rate.

From jmnceill@ and tested by me on beagle-v.


1.76 18-Oct-2024 jmcneill

sdmmc: Add support for SD card caches.

SD physical 6.0 specification introduced Application Performance Class 2
(A2), which adds support for drive caches and command queueing.

Add support for enabling and flushing the cache when this feature is
present.


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base thorpej-ifq-base thorpej-altq-separation-base
1.75 29-Apr-2023 jmcneill

branches: 1.75.6;
sdmmc: Only check chipset WP status for SD cards.

The sdmmc_chip_write_protect callback returns the write protect switch
status from the controller (SDWP#). This signal does not exist for eMMC;
instead, write protect is signaled using card registers (CSD). So lets
skip asking the chipset for WP status on eMMC cards for each write
request.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base
1.74 03-Aug-2021 msaitoh

branches: 1.74.8;
Use unsigned to avoid undefined behavior in sdmmc_mem_sd_switch().
Found by kUBSan.


Revision tags: thorpej-cfargs2-base thorpej-i2c-spi-conf-base
1.73 13-Jun-2021 mlelstv

Be less verbose normally and more when debugging.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
1.72 11-May-2020 jdc

branches: 1.72.6;
If the controller doesn't support switch func (opcode 6) then skip
setting this but continue with other settings. This allows us to use
a card, albeit at a lower speed.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
1.71 04-Jan-2020 mlelstv

Be less noisy for some commands.


Revision tags: phil-wifi-20191119
1.70 28-Oct-2019 mlelstv

Whitespace police


1.69 28-Oct-2019 mlelstv

Add and use sdmmc_pause to avoid long-term busy waits.
Add sdio abort function.
Additional error messages.
Print parameters for SDIO devices.
Minor cosmetics.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609
1.68 06-Jun-2019 jmcneill

branches: 1.68.2;
If setting HS_TIMING fails, keep trying slower speeds instead of bailing
out.


1.67 28-May-2019 jmcneill

If a mem function fails to initialize, set the error flag so sdmmc doesn't try to use it anyway.


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
1.66 09-Nov-2018 jmcneill

Wait for data ready after eMMC flush cache commands


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
1.65 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
1.64 07-Feb-2018 bouyer

branches: 1.64.2; 1.64.4;
Fix uninitialized variable use:
if there is an error, or if we are using a SPI controller,
sdmmc_mem_send_op_cond() doens't assign a value to *ocrp,
but it is used unconditionally in sdmmc_mem_enable() to see if we can switch
to low voltage.

In sdmmc_mem_send_op_cond(), if the new ocr is not returned by the
card for whatever reason, set *ocrp to the orig value.


Revision tags: tls-maxphys-base-20171202
1.63 12-Sep-2017 jmcneill

For SD cards, send the SET_WR_BLK_ERASE_COUNT app command before a
multi-block write to improve write performance.


Revision tags: nick-nhusb-base-20170825
1.62 20-Aug-2017 mlelstv

make the sc_discard interface for the ld backend asynchronous and
signal completion through new callback lddiscardend. Use a standard
struct buf to pass disk address and range instead of two off_t values.

make lddiscard synchronous again. This is a requirement of the current
ffs discard code.


Revision tags: perseant-stdc-iso10646-base
1.61 16-Jul-2017 jmcneill

branches: 1.61.2;
Add support for eMMC 4.5's optional cache feature. If a cache is present,
and the host controller reports the SMC_CAPS_POLLING capability (needed
to flush cache at shutdown), it will be automatically enabled and used.


1.60 24-Jun-2017 jmcneill

Revert part of previous; the SD card spec recommends not to issue a DISCARD
command to the file system area.


1.59 24-Jun-2017 jmcneill

Read SD status register and print card status when a new SD card is found:

sdmmc0: SD card status: 4-bit, C10, U1, V10

If the SD status register reports discard support, set the DISCARD arg to
the ERASE operation to let the card know that the host doesn't care if the
erase is performed.


1.58 24-Jun-2017 jmcneill

Add discard support to ld@sdmmc using the ERASE (CMD38) command.


1.57 04-Jun-2017 jmcneill

Give a hint to controllers in the command flags if we are performing a
transfer with an SDHC capable card. If the controller needs to adjust
command args, it can use this hint to understand how it is encoded.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
1.56 11-Apr-2017 jmcneill

branches: 1.56.4;
Remove a test that prevents tuning from happening on eMMC devices.


Revision tags: jdolecek-ncq-base pgoyette-localcount-20170320
1.55 17-Feb-2017 nonaka

sdhc(4): hardware reset support for Intel eMMC controller


1.54 17-Feb-2017 nonaka

sdhc(4), sdmmc(4): Added MMC HS DDR52 support.


1.53 17-Feb-2017 nonaka

sdmmc(4): Use EXT_CSD[HS_TIMING] definitions.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
1.52 11-Aug-2016 nonaka

branches: 1.52.2;
Fix incorrect sector counts with MMC.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
1.51 13-Mar-2016 tsutsui

branches: 1.51.2;
Call the second sdmmc_mem_send_if_cond() only where it's necessary.

This makes SMC_CAPS_SPI_MODE devices (currently evbsh3 only) work again.
"Maybe ok" from nonaka@.


Revision tags: nick-nhusb-base-20151226
1.50 22-Dec-2015 mlelstv

Be graceful about command timeouts when probing.


1.49 29-Nov-2015 jmcneill

Add some event counters to track transfer sizes.


1.48 29-Oct-2015 jmcneill

After setting HS_TIMING value for HS200 or later, send repeated SEND_STATUS
command until the device is no longer busy or the SWITCH_ERROR bit is set.


1.47 06-Oct-2015 mlelstv

support hiding command timeout messages with a new command flag and use this
when probing for cards. Should fix PR 50302.


Revision tags: nick-nhusb-base-20150921
1.46 08-Aug-2015 jmcneill

eMMC fixes


1.45 05-Aug-2015 jmcneill

Add support for sampling clock tuning, required for some UHS modes and
MMC HS200.


1.44 04-Aug-2015 jmcneill

ODROID-C1 has a bug where the card is not power-cycled when the board is
reset. If you had previously switched to 1.8V signaling level, upon reboot
the card will still be in 1.8V mode and you cannot detect it with an S18R
request.

A card in 1.8V mode will report UHS modes though, so if the card reports
SDR50, DDR50, or SDR104 capabilities, and the previous S18R request failed
to switch, use this as an opportunity to re-enable UHS support in the
subsystem and host controller drivers.


1.43 04-Aug-2015 jmcneill

instead of trying to handle cards already in 1.8V mode, request host controller to switch to 3.3V signaling before starting the init sequence


1.42 03-Aug-2015 jmcneill

Handle cards that are already in low voltage (1.8V) mode. Test correct
bit when determining the best SD transfer mode.


1.41 03-Aug-2015 jmcneill

clear SMF_UHS_MODE flag before enabling card


1.40 03-Aug-2015 jmcneill

fix SDMMC_DEBUG build


1.39 03-Aug-2015 jmcneill

Add support for DDR50 transfer modes.


1.38 03-Aug-2015 mlelstv

use mutex locking for MP safety.


1.37 03-Aug-2015 mlelstv

more debug output


1.36 02-Aug-2015 jmcneill

Add support for eMMC 5.0 HS200 timings.


1.35 02-Aug-2015 jmcneill

Add basic UHS-I support. SDR50 and SDR104 are supported, but not DDR50.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
1.34 27-Feb-2015 nonaka

fix to simulate multi-segment dma transfer for pq3sdhc(4).


1.33 07-Feb-2015 christos

Return an actual error. Reported by:
http://www.m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-4


1.32 07-Dec-2014 jmcneill

Fix high capacity (> 2GB) eMMC support, from OpenBSD.


Revision tags: nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
1.31 19-Mar-2014 nonaka

branches: 1.31.4; 1.31.6;
Add a driver for Realtek RTS5209/RTS5229 Card Reader.
Ported from OpenBSD.


Revision tags: riastradh-drm2-base3
1.30 25-Oct-2013 martin

Turn a few __unused into __diagused


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
1.29 03-May-2013 matt

branches: 1.29.4;
Add support for the valid card types in eMMC v4.4 (needed by beaglebone
black).


1.28 03-May-2013 matt

Fix typo.


Revision tags: agc-symver-base yamt-pagecache-base8
1.27 20-Dec-2012 jakllsch

fix off-by-one in switch function argument validation.


1.26 15-Dec-2012 jakllsch

Correctly read the 512-bit-wide big-endian Switch Function Status register.
Some of this could/will also be useful for the SD Status register.


1.25 14-Dec-2012 jakllsch

The Card Command Class (CCC) field is valid in both SD_CSD_CSDVER_1_0
and SD_CSD_CSDVER_2_0.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
1.24 13-Oct-2012 kiyohara

Fix variable name for message of printf.


1.23 26-Jul-2012 matt

branches: 1.23.2;
Fix a delay to a correct value.


1.22 23-Jul-2012 matt

Responses are actually in host order (except SCR which is return in
big endian so that's convert to host order).


1.21 20-Jul-2012 matt

Add use of watermark register when PIO to an ESDHC. After every kill or
drain of watermask words, pause a bit to give time for the fifo to recover.
Always the command response in BE byteorder. Rewrite __bitfield to deal
with this.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.20 01-Feb-2012 matt

branches: 1.20.2;
Use "opt_sdmmc.h" for SDMMC_DEBUG, etc.


1.19 27-Jan-2012 matt

Fix sdmmmc_mem_decode_scr for BE machines.


1.18 21-Jan-2012 nonaka

fix my license notice.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
1.17 13-Feb-2011 nonaka

branches: 1.17.4; 1.17.8;
use MMC_CSD_CSDVER_EXT_CSD.


1.16 13-Feb-2011 nonaka

- Don't switch MMC high-speed timing, if host controller isn't supported.
- Only check EXT_CSD STRUCTURE version when CSD version is 3.
- initialize width at sdmmc_function_alloc().


1.15 05-Feb-2011 nonaka

Don't switch SD high-speed timing, if host controller isn't supported.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
1.14 13-Nov-2010 uebayasi

branches: 1.14.2; 1.14.4;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
1.13 07-Oct-2010 kiyohara

Support High-Speed mode.


1.12 01-Oct-2010 kiyohara

Use DMA bounce buffer, if DMA buffer is making by multiple segments. A lot
of host controllers do not support to two or more segments.


1.11 23-Sep-2010 kiyohara

Print bus width and clock for feature(High speed support).


1.10 21-Sep-2010 kiyohara

Fix build failure.
A new variable width and value had been forgotten since r1.7.


1.9 20-Sep-2010 kiyohara

Clean up return/error in sdmem_mem_send_scr().


1.8 20-Sep-2010 kiyohara

Fix SCR data.


1.7 20-Sep-2010 kiyohara

Support MMC 4,8-bit mode.
It tested only 4bit on Marvell Sheevaplug.


1.6 20-Sep-2010 kiyohara

Sync with POSTREAD before memcpy.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
1.5 01-May-2010 reinoud

Initialise error variable to zero. If all the if's fail it exists the function
sdmmc_init returning the then still uninitialised variable.

gcc can't know if one of the if's is bound to happen.

Detected with -DDEBUG -DDIAGNOSTIC -DKGDB - ...


Revision tags: uebayasi-xip-base1
1.4 06-Apr-2010 nonaka

branches: 1.4.2;
- mention MMC SPI mode.
- support SD 4bit bus width mode.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
1.3 28-Nov-2009 nonaka

branches: 1.3.2; 1.3.4;
Always sector size is treated as 512 bytes.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
1.2 24-May-2009 nonaka

branches: 1.2.2;
SDHC card was able to be used.


Revision tags: yamt-nfs-mp-base4 jym-xensuspend-base yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.10 23-Oct-2019 hkenken

Add SDHC flags.

+ SDHC_FLAG_BROKEN_ADMA2_ZEROLEN
Broken ADMA2 Zero length descriptor.
Can't 64K Byte data transfer.
+ SDHC_FLAG_NO_1_8_V
Support no 1.8V Supply.
Disable UHS-I bus speed mode (SDR50, DDR50, SDR104).


Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
1.9 17-Feb-2017 nonaka

branches: 1.9.14;
sdhc(4): hardware reset support for Intel eMMC controller


1.8 17-Feb-2017 nonaka

sdhc(4), sdmmc(4): Added MMC HS DDR52 support.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
1.7 05-Aug-2015 jmcneill

branches: 1.7.2; 1.7.4;
Add support for sampling clock tuning, required for some UHS modes and
MMC HS200.


1.6 03-Aug-2015 jmcneill

Add support for DDR50 transfer modes.


1.5 02-Aug-2015 jmcneill

Add basic UHS-I support. SDR50 and SDR104 are supported, but not DDR50.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
1.4 18-May-2011 dyoung

branches: 1.4.14; 1.4.32;
#include <sys/bus.h>, not <machine/bus.h>.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
1.3 07-Oct-2010 kiyohara

branches: 1.3.2;
Add bus_rod. It use to change to Data Transfer mode.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
1.2 06-Apr-2010 nonaka

branches: 1.2.2;
- mention MMC SPI mode.
- support SD 4bit bus width mode.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.9 17-Jan-2025 jmcneill

sdmmc: Add Nintendo Wii WLAN device ID


Revision tags: netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
1.8 01-Jan-2020 jmcneill

branches: 1.8.26; 1.8.32;
Add product ID for Broadcom BCM43455


Revision tags: phil-wifi-20191119
1.7 28-Oct-2019 mlelstv

Whitespace police


1.6 24-Aug-2019 mlelstv

Fix typo


1.5 18-Aug-2019 mlelstv

Add Broadcom devices


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
1.4 29-Dec-2018 thorpej

branches: 1.4.4;
Add ReakTek RTL8189FTV SDIO 802.11 interface.


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base
1.3 28-Jun-2018 jmcneill

branches: 1.3.2;
Add vendor REALTEK and product RTL8703BS


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
1.2 19-Oct-2013 mlelstv

branches: 1.2.28;
add Ricoh MMC reader


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14; 1.1.22; 1.1.32; 1.1.36;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.9 17-Jan-2025 jmcneill

sdmmc: regen sdmmcdevs.h


Revision tags: netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
1.8 01-Jan-2020 jmcneill

branches: 1.8.26; 1.8.32;
regen


Revision tags: phil-wifi-20191119
1.7 28-Oct-2019 mlelstv

regen


1.6 24-Aug-2019 mlelstv

regen


1.5 18-Aug-2019 mlelstv

regen


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
1.4 29-Dec-2018 thorpej

branches: 1.4.4;
Regen.


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base
1.3 28-Jun-2018 jmcneill

branches: 1.3.2;
Regen


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.2 21-Apr-2009 nonaka

branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.14; 1.2.72;
regen


1.1 21-Apr-2009 nonaka

Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.35 18-Oct-2024 jmcneill

sdmmc: Add support for SD card caches.

SD physical 6.0 specification introduced Application Performance Class 2
(A2), which adds support for drive caches and command queueing.

Add support for enabling and flushing the cache when this feature is
present.


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base netbsd-9-3-RELEASE thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422
1.34 19-Apr-2018 christos

branches: 1.34.34; 1.34.40;
s/static inline/static __inline/g for consistency.


Revision tags: pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
1.33 12-Sep-2017 jmcneill

branches: 1.33.2;
For SD cards, send the SET_WR_BLK_ERASE_COUNT app command before a
multi-block write to improve write performance.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
1.32 16-Jul-2017 jmcneill

branches: 1.32.2;
Add support for eMMC 4.5's optional cache feature. If a cache is present,
and the host controller reports the SMC_CAPS_POLLING capability (needed
to flush cache at shutdown), it will be automatically enabled and used.


1.31 24-Jun-2017 jmcneill

Read SD status register and print card status when a new SD card is found:

sdmmc0: SD card status: 4-bit, C10, U1, V10

If the SD status register reports discard support, set the DISCARD arg to
the ERASE operation to let the card know that the host doesn't care if the
erase is performed.


1.30 24-Jun-2017 jmcneill

Add discard support to ld@sdmmc using the ERASE (CMD38) command.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
1.29 17-Feb-2017 nonaka

branches: 1.29.6;
sdhc(4): hardware reset support for Intel eMMC controller


1.28 17-Feb-2017 nonaka

sdmmc(4): Added EXT_CSD[HS_TIMING] definitions.


1.27 17-Feb-2017 nonaka

sdmmc(4): Change EXT_CSD[CARD_TYPE] HS DDR 52 MHz definition.

Because it has been difficult to understand from the definition is DDR.


1.26 17-Feb-2017 nonaka

sdmmc(4): Remove unused EXT_CSD[CARD_TYPE] definitions.


1.25 17-Feb-2017 nonaka

sdmmc(4): Added comments at EXT_CSD[CARD_TYPE] definitions.


1.24 17-Feb-2017 nonaka

sdmmc(4): Added 4 and 8 bit mode DDR definitions at EXT_CSD[BUS_WIDTH].


1.23 17-Feb-2017 nonaka

sdmmc(4): Fix cell type in comments.

From JEDEC Standard No.84-B51, 7.4. Extended CSD register.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
1.22 10-Aug-2016 nonaka

branches: 1.22.2;
Use 1.65-1.95 voltage window for 1.8V support.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
1.21 29-Oct-2015 jmcneill

branches: 1.21.2;
After setting HS_TIMING value for HS200 or later, send repeated SEND_STATUS
command until the device is no longer busy or the SWITCH_ERROR bit is set.


Revision tags: nick-nhusb-base-20150921
1.20 08-Aug-2015 jmcneill

eMMC fixes


1.19 05-Aug-2015 jmcneill

Add support for sampling clock tuning, required for some UHS modes and
MMC HS200.


1.18 03-Aug-2015 jmcneill

Add support for DDR50 transfer modes.


1.17 02-Aug-2015 jmcneill

Add support for eMMC 5.0 HS200 timings.


1.16 02-Aug-2015 jmcneill

Add basic UHS-I support. SDR50 and SDR104 are supported, but not DDR50.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
1.15 07-Dec-2014 jmcneill

Fix high capacity (> 2GB) eMMC support, from OpenBSD.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
1.14 03-May-2013 matt

branches: 1.14.12;
Add support for the valid card types in eMMC v4.4 (needed by beaglebone
black).


Revision tags: agc-symver-base yamt-pagecache-base8
1.13 15-Dec-2012 jakllsch

Correctly read the 512-bit-wide big-endian Switch Function Status register.
Some of this could/will also be useful for the SD Status register.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
1.12 28-Jul-2012 matt

branches: 1.12.2;
Fix comments about __bitfield.


1.11 23-Jul-2012 matt

Responses are actually in host order (except SCR which is return in
big endian so that's convert to host order).


1.10 20-Jul-2012 matt

Add use of watermark register when PIO to an ESDHC. After every kill or
drain of watermask words, pause a bit to give time for the fifo to recover.
Always the command response in BE byteorder. Rewrite __bitfield to deal
with this.


1.9 12-Jul-2012 jakllsch

Add SD_STATUS (ACMD13) opcode.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.8 27-Jan-2012 matt

branches: 1.8.2;
Remove suplurfious ++


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
1.7 13-Feb-2011 nonaka

branches: 1.7.4; 1.7.8;
use MMC_CSD_CSDVER_EXT_CSD.


1.6 13-Feb-2011 nonaka

- Don't switch MMC high-speed timing, if host controller isn't supported.
- Only check EXT_CSD STRUCTURE version when CSD version is 3.
- initialize width at sdmmc_function_alloc().


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
1.5 07-Oct-2010 kiyohara

branches: 1.5.2; 1.5.4;
Support High-Speed mode.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
1.4 06-Apr-2010 nonaka

branches: 1.4.2;
- mention MMC SPI mode.
- support SD 4bit bus width mode.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.3 26-Apr-2009 nonaka

branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8; 1.3.10; 1.3.12;
fix build broken.
Pointed by Takeshi Nakayama.


1.2 26-Apr-2009 nonaka

Added some command definitions.


1.1 21-Apr-2009 nonaka

Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.38 17-Jan-2025 jmcneill

sdmmc: Capture lan_nid and expose sdmmc_cisptr

LAN NID contains the MAC address for networking adapters.

Device drivers may want to processor vendor specific tuple codes, so
expose sdmmc_cisptr to help this.


1.37 18-Oct-2024 jmcneill

sdmmc: Add support for SD card caches.

SD physical 6.0 specification introduced Application Performance Class 2
(A2), which adds support for drive caches and command queueing.

Add support for enabling and flushing the cache when this feature is
present.


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
1.36 13-Mar-2021 mlelstv

branches: 1.36.18; 1.36.24;
define NO_STOP flag


1.35 24-May-2020 riastradh

branches: 1.35.2;
Fix races in sdmmc tasks and teach ld@sdmmc to abort xfers on detach.

- Teach sdmmc_add_task to queue it only if not already queued.
- Remove now-redundant logic to avoid repeated queueing elsewhere.
- Teach sdmmc_del_task to wait until task has completed.
- Call sdmmc_del_task in various needful places.
- Replace abuse of pcq by a lock and a tailq.
(pcq is multi-producer, _single_-consumer, but there are potentially
multiple consumers here and really only one producer.)
- Teach ld_sdmmc to abort xfers on detach.
(Mechanism is kinda kludgey but it'll do for now; any effort one is
tempted to spend overhauling this should be spent overhauling sdmmc
to support proper asynchronous commands.)
- Make sure ld_sdmmc_discard either returns failure or eventually calls
ldenddiscard.

XXX Currently ld_sdmmc_detach aborts xfers _before_ ldbegindetach has
has committed to detaching or not. This is currently necessary to
avoid a deadlock because ldbegindetach waits for xfers to drain --
which strikes me as wrong; ldbegindetach shouldn't wait for anything,
and should only make the decision to commit to detaching or not so
the caller can decide whether to abort xfers before we actually wait
for them in ldenddetach.

XXX pullup -- although this changes some kernel symbols (sdmmc_add_task
and sdmmc_del_task), it shouldn't affect any existing modules; the only
module that uses sdmmc is ld_sdmmc.kmod, which is `.if 0' in the build
so there shouldn't be any of them floating around.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
1.34 28-Oct-2019 mlelstv

Simplyfy sdmmc_io_set_blocklen function signature by dropping the
extra softc pointer. Aligns with OpenBSD.


1.33 28-Oct-2019 mlelstv

Add and use sdmmc_pause to avoid long-term busy waits.
Add sdio abort function.
Additional error messages.
Print parameters for SDIO devices.
Minor cosmetics.


1.32 23-Oct-2019 hkenken

Add SDHC flags.

+ SDHC_FLAG_BROKEN_ADMA2_ZEROLEN
Broken ADMA2 Zero length descriptor.
Can't 64K Byte data transfer.
+ SDHC_FLAG_NO_1_8_V
Support no 1.8V Supply.
Disable UHS-I bus speed mode (SDR50, DDR50, SDR104).


1.31 01-Sep-2019 mlelstv

From OpenBSD:
- support block length per function
- add functions to read/write regions
Decode (but not use) SDIO tuple in CIS.
Fix locking.
Add more SDIO defines (partially from version 3.0).


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
1.30 25-Feb-2019 jmcneill

branches: 1.30.4;
Add SCF_NEED_BOUNCE command flag. Can be used by a driver to keep track of
which command(s) need data transfers to go through DMA bounce buffers.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 nick-nhusb-base-20170825
1.29 20-Aug-2017 mlelstv

branches: 1.29.4;
make the sc_discard interface for the ld backend asynchronous and
signal completion through new callback lddiscardend. Use a standard
struct buf to pass disk address and range instead of two off_t values.

make lddiscard synchronous again. This is a requirement of the current
ffs discard code.


Revision tags: perseant-stdc-iso10646-base
1.28 16-Jul-2017 jmcneill

branches: 1.28.2;
Add support for eMMC 4.5's optional cache feature. If a cache is present,
and the host controller reports the SMC_CAPS_POLLING capability (needed
to flush cache at shutdown), it will be automatically enabled and used.


1.27 24-Jun-2017 jmcneill

Revert part of previous; the SD card spec recommends not to issue a DISCARD
command to the file system area.


1.26 24-Jun-2017 jmcneill

Read SD status register and print card status when a new SD card is found:

sdmmc0: SD card status: 4-bit, C10, U1, V10

If the SD status register reports discard support, set the DISCARD arg to
the ERASE operation to let the card know that the host doesn't care if the
erase is performed.


1.25 24-Jun-2017 jmcneill

Add discard support to ld@sdmmc using the ERASE (CMD38) command.


1.24 04-Jun-2017 jmcneill

Give a hint to controllers in the command flags if we are performing a
transfer with an SDHC capable card. If the controller needs to adjust
command args, it can use this hint to understand how it is encoded.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
1.23 17-Feb-2017 nonaka

branches: 1.23.6;
sdhc(4): hardware reset support for Intel eMMC controller


1.22 17-Feb-2017 nonaka

sdmmc(4): Add MMC HS DDR52 timing support bit and use __BIT() macro.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
1.21 29-Nov-2015 jmcneill

branches: 1.21.2; 1.21.4;
Add some event counters to track transfer sizes.


1.20 06-Oct-2015 mlelstv

support hiding command timeout messages with a new command flag and use this
when probing for cards. Should fix PR 50302.


Revision tags: nick-nhusb-base-20150921
1.19 09-Aug-2015 mlelstv

Send an explicit CMD12 (stop transmission) when there was an error
in multi-sector I/O.

The SDHC spec has a complex flowchart describing when an explicit
CMD12 is necessary, so we probably use it too often.


1.18 03-Aug-2015 jmcneill

Add support for DDR50 transfer modes.


1.17 02-Aug-2015 jmcneill

Add basic UHS-I support. SDR50 and SDR104 are supported, but not DDR50.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
1.16 27-Feb-2015 nonaka

fix to simulate multi-segment dma transfer for pq3sdhc(4).


Revision tags: nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
1.15 19-Mar-2014 nonaka

branches: 1.15.4; 1.15.6;
Add a driver for Realtek RTS5209/RTS5229 Card Reader.
Ported from OpenBSD.


Revision tags: riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
1.14 12-Jul-2012 jakllsch

branches: 1.14.2; 1.14.4;
Replace integer constant SDMMC_MAXNSEGS with the formula said value was
calculated from.


1.13 11-Jul-2012 jakllsch

Fix transposition typo in comment.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
1.12 01-Feb-2012 matt

Use "opt_sdmmc.h" for SDMMC_DEBUG, etc.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
1.11 18-May-2011 dyoung

branches: 1.11.4; 1.11.8;
#include <sys/bus.h>, not <machine/bus.h>.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
1.10 13-Feb-2011 nonaka

- Don't switch MMC high-speed timing, if host controller isn't supported.
- Only check EXT_CSD STRUCTURE version when CSD version is 3.
- initialize width at sdmmc_function_alloc().


1.9 05-Feb-2011 nonaka

Don't switch SD high-speed timing, if host controller isn't supported.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
1.8 07-Oct-2010 kiyohara

branches: 1.8.2; 1.8.4;
Support High-Speed mode.


1.7 01-Oct-2010 kiyohara

Use DMA bounce buffer, if DMA buffer is making by multiple segments. A lot
of host controllers do not support to two or more segments.


1.6 23-Sep-2010 kiyohara

Print bus width and clock for feature(High speed support).


1.5 22-Sep-2010 kiyohara

Back out previous change. "automagically" is NOT a typo.


1.4 21-Sep-2010 kiyohara

+ Add macro SMC_CAPS_8BIT_MODE for 8bit mode support.
+ Typo. s/automagically/automatically/.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
1.3 06-Apr-2010 nonaka

branches: 1.3.2;
- mention MMC SPI mode.
- support SD 4bit bus width mode.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
1.2 28-Nov-2009 nonaka

branches: 1.2.2; 1.2.4;
Always sector size is treated as 512 bytes.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base nick-hppapmap-base3
1.1 21-Apr-2009 nonaka

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Added SD/MMC support from OpenBSD.
tested on i386, amd64 at current-users ML by pgoyette@.
tested on zaurus by myself.