summaryrefslogtreecommitdiff
path: root/sys/dev/sdmmc
AgeCommit message (Collapse)Author
2020-04-19Add support for hardware where an SDHC controller lives on a bus thatMark Kettenis
only supports 32-bit access (hello Raspberry Pi). ok tobhe@
2020-04-19Add support for hardware where an SDHC controller lives on a bus thatMark Kettenis
only supports 32-bit access (hello Raspberry Pi). ok tobhe@
2020-03-14On fdt platforms attempt to load system specific .txt and .bin filesJonathan Gray
with filenames constructed from the first compatible string of the root node. Matches the format used in the linux-firmware repository. If these are not found fallback to the generic filenames. When the compatible string contains a '/' as in 'solidrun,cubox-i/q' it will be handled as everything before the '/' so the cubox filename is brcmfmac4330-sdio.solidrun,cubox-i.txt. ok kurt@ patrick@
2020-03-13Recognize BCM43341 as a BCM43340 variant.Patrick Wildt
From Rob Schmersel
2020-03-07Use snprintf(9) to create the names for the firmware and NVRAM files. ThisPatrick Wildt
reduces the amount of duplicated lines per chip, and allows us to ship per- board files in the future. Based on a diff from jsg@ ok kurt@
2020-03-06Fixup bwfm(4) register bit regarding SDIO device suspend/resume.Patrick Wildt
2020-03-06Process the NVRAM in bwfm(4) itself. So far we have relied on somePatrick Wildt
external tool to pre-process the NVRAM, even though it's simple to do ourselves. This allows easier firmware distribution. ok kurt@
2020-02-25Make bwfm(4) call if_input() only once per interrupt.Patrick Wildt
This reduces drops caused by the ifq pressure drop mechanism and hence increases throughput. ok tobhe@
2020-02-20Relax the grip the dead hand of QBUS (a.k.a. MAXPHYS) has on theKenneth R Westerback
throat of physio(). Allows individual devices to eventually be modified to support larger physio() (a.k.a. 'raw') i/o's if they prove capable of them. No immediate functional change. Tested for many weeks by and ok robert@.
2020-02-12Bring a few stragglers into line with the idiom used by the other 40+Kenneth R Westerback
scsi drivers. i.e. eliminate the struct scsi_adapter member in the softc and rely on the pointer to a static scsi_adapter in the struct scsi_link member.
2020-01-26Shuffle some names around to make reading the code less headacheKenneth R Westerback
inducing. Rename scsi_adapter member 'scsi_minphys' to 'dev_minphys' to reflect what it is supposed to do. Use consistent naming convention (<dev>_minphys) for the actual device functions. No functional change.
2020-01-25Drivers that implement their own *minphys() don't need to call theKenneth R Westerback
system minphys(). scsi_minphys() will do that and cd/sd/st will call scsi_minphys(). ok jmatthew@ as part of larger diff
2020-01-22Recognize BCM4345 rev 9, which requires a different firmware,Patrick Wildt
as shipped with the Pinebook Pro as an AMPAK AP6256 module.
2020-01-22delete wasteful ;;Theo de Raadt
ok tedu
2019-12-31Convert infinite sleeps to {m,t}sleep_nsec(9).Martin Pieuchot
ok kn@
2019-04-02Don't detach non-removable devices during resume on "sdhc* at acpi?".Stefan Sperling
Makes hibernate work with rootfs on built-in emmc storage. Tested on King Jim Portabook. ok deraadt@ kettenis@
2019-02-07Consistently use m_freem(9). This fixes possible leaks in a fewPatrick Wildt
error cases.
2019-02-04Turns out we do need to handle control messages that exceed MLEN, soMark Kettenis
allocate a cluster if the message is larger than that. Fixes a panic on shutdown on my Asus X205TA. ok patrick@, stsp@
2018-12-29Allow passing the maximum size of a segment that a SD/MMC hostPatrick Wildt
controller can handle for DMA tranfers, since not all support 64k. ok kettenis@
2018-12-22Avoid using m_trailingspace(9) on an mbuf allocated with MGET(9) as it reliesMark Kettenis
on header fields that aren't initialized, which may trigger an assertion. Check whether the control message doesn't exceed MLEN instead and turn the check into a KASSERT as the driver should not generate control messages that are larger. with help form claudio@ (who points out that the driver should not use MT_CONTROL here). ok patrick@
2018-11-09M_LEADINGSPACE() and M_TRAILINGSPACE() are just wrappers forClaudio Jeker
m_leadingspace() and m_trailingspace(). Convert all callers to call directly the functions and remove the defines. OK krw@, mpi@
2018-09-06Implement 64-bit DMA support in sdhc(4).Patrick Wildt
tested in snaps ok kettenis@
2018-08-09Implement out-of-band interrupt support in the bwfm(4) SDIO backend.Patrick Wildt
2018-08-09Allow passing per-function cookies through the SD/MMC bus to SDIOPatrick Wildt
devices. This allows SDIO device drivers to read information from the ACPI or FDT tables. ok kettenis@
2018-08-09Correct the bitmask that returns the function count. We missed a bitPatrick Wildt
and thus only supported 4 functions instead of 8. ok kettenis@
2018-07-24Add support fotr the BCM4335/4339 SDIO chip to bwfm(4). This one is a bitMark Kettenis
slow booting up, so give it a bit longer to enable the clock. ok patrick@
2018-07-17TX packets, which can be either Ethernet or control packets, must bePatrick Wildt
sent in order. Otherwise it is possible that the key is set before we send out the EAPOL packet, or that packets are sent out before the key is set. Thus modify the SDIO backend to put both types into the same internal TX queue, which will be sent asynchronously. Discussed with bluhm@
2018-07-16Add support for the BCM43455 SDIO chip to bwfm(4).Patrick Wildt
2018-07-16In certain modes SDIO-connected bwfm(4) chips might expect us to readPatrick Wildt
another packet (even though nextlen is set to none) to issue more RX interrupts.
2018-06-18Run the code to handle interrupts directly from the interrupt handlerMark Kettenis
instead of from a task. The sdmmc(4) interrupt handler is already executed in process context and returning from the interrupt handler without acknowledging the interrupts may lead to an interrupt storm. ok patrick@
2018-06-17Add curly braces to the if-condition to make sure the bus widthPatrick Wildt
is only bumped if the high-speed mode is available. ok kettenis@
2018-06-04in non-DIAGNOSTIC kernels, rw_assert_wrlock becomes a nop which leaves theTheo de Raadt
local variable dangling, so calculate the lock address by hand at invocation ok kettenis
2018-06-044-bit bus width is mandatory for SDIO cards that support High SpeedPatrick Wildt
mode, so switch from 1-bit to 4-bit bus width if the host controller supports it. ok kettenis@
2018-06-04Switch to SDIO High Speed mode if the host controller supports it.Patrick Wildt
ok kettenis@
2018-05-30Implement SDIO DMA support. This is achieved by wrapping thePatrick Wildt
sdmmc_io_rw_extended() function and loading the passed buffer using the bus dma API akin to the SDMMC memory card code. The 2-byte and 4-byte accessors continue to use PIO. ok kettenis@
2018-05-30For the upcoming SDIO DMA support we need to use DMA-able bufferPatrick Wildt
to send/receive data. This basically means that we cannot use any malloc(9)'d buffer. For this, use dma_alloc(9) to allocate a buf that can fit a whole SDIO frame (unfortunately without headers). Keep note that we need to round up the transfer sizes to block- sized (for TX packets) or 4-byte alignment, since some DMA con- trollers truncate the request size. If there's anything wrong, the KASSERTs will catch it. ok kettenis@
2018-05-30Clear the DMA select bits in case we use PIO instead of DMA. SomePatrick Wildt
SDHC controllers get confused if the ADMA bit is set even though we don't set the DMA enable flag. This can happen with the SDIO stack which uses PIO for 4 byte read/writes but DMA for larger transfers and thus switches from one mode to the other. ok kettenis@
2018-05-27BCM43430 SDIO works if we load the appropriate firmware.Mark Kettenis
ok patrick@
2018-05-26BCM4356 SDIO works if we load the appropriate firmware.Mark Kettenis
ok patrick@
2018-05-25So far the SDIO stack issued one transfer for every 64 byte to bePatrick Wildt
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. ok kettenis@
2018-05-25For SDIO multi-blocks we must not use the AUTO CMD12 feature,Patrick Wildt
this is only for memory card read/writes. ok kettenis@
2018-05-24Release rwlock on bwfm(4) SDIO initialization error. Fixes hang foundPatrick Wildt
by florian@ when firmware isn't present initially.
2018-05-23Implement a separate initialization stage so that we can still usePatrick Wildt
and initialize bwfm(4) later in the case that the firmware was not available on bootup and was only later installed. ok stsp@
2018-05-23Extend list of supported bwfm(4) SDIO chips.Patrick Wildt
2018-05-21Make the way we print "not configured" lines for SDIO devices a bit nicer.Mark Kettenis
ok stsp@
2018-05-21Consistently suffix the pre-processed NVRAM binary that the bwfm(4)'sPatrick Wildt
firmware requires on SDIO-connected chips. From ketttenis@
2018-05-19Akin to the PCI attachment driver we can extract the chip's dmesg(8)Patrick Wildt
over the SDIO bus by accessing the correct addresses. This helped me find the RX FIFO overflow issue and might help find more issues where the chip's firmware complains about our wrongdoing.
2018-05-18After reading the first frame, which we can do in two reads (softwarePatrick Wildt
plus hardware header, which tell us the length of the following data), we can issue full packet reads. The software header contains a field that informs us of the full length of the next frame that we can read, so we can do that in a single sitting. This brings us down from three SDIO read invocation to a single one per packet for a given RX stream.
2018-05-17The Broadcom FullMAC firmware has a few ways of doing flow control. OnePatrick Wildt
of those is a sequence number based window mechanism. Essentially every packet on the SDIO bus has a sequence number. The chip records which sequence number we used last and when it sends us replies, it tells us the maximum sequence number it accepts. This means we can calculate a window of sequence numbers that we are allowed to use. With this I no longer overflow the chip's RX fifo and can do stable network transfers.
2018-05-16After having finished transmitting the last mbuf, don't just return toPatrick Wildt
the caller. Otherwise we skip restarting the ifq which means that if we ever have a full queue and go oactive, there is no coming back. So break out from the loop and call ifq restart if the queue is not full.