aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mmc
Commit message (Collapse)AuthorAgeFilesLines
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-1/+1
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* sys/dev: extend use of the howmany() macro when available.Pedro F. Giffuni2016-04-261-1/+1
| | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Notes: svn path=/head/; revision=298646
* Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni2016-04-101-1/+1
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
* Use correct response bits for MMC_RSP_R4-R7 typesAlexander Kabaev2016-03-271-2/+5
| | | | Notes: svn path=/head/; revision=297329
* Fix fallout from r292180 (Dec 2015)... ensure that every driver which hasIan Lepore2016-03-212-0/+3
| | | | | | | | | | | | a DRIVER_MODULE() referencing mmc_driver has a MODULE_DEPEND() on mmc. This is because the kernel linker only searches for symbols in dependent modules, so loading sdhci_pci (and other bus-flavors of sdhci) would fail when mmc was not compiled into the kernel (even if you hand-loaded mmc first). (Thanks to jilles@ for providing the vital clue about the kernel linker.) Notes: svn path=/head/; revision=297127
* Create an API to reset a struct bio (g_reset_bio). This is mandatoryWarner Losh2016-02-171-1/+2
| | | | | | | | | | | | for all struct bio you get back from g_{new,alloc}_bio. Temporary bios that you create on the stack or elsewhere should use this before first use of the bio, and between uses of the bio. At the moment, it is nothing more than a wrapper around bzero, but that may change in the future. The wrapper also removes one place where we encode the size of struct bio in the KBI. Notes: svn path=/head/; revision=295707
* Flag sysctl hw.mmc.debug as a tunable, since often you want to debug theIan Lepore2015-12-181-1/+1
| | | | | | | bus probing during system startup. Notes: svn path=/head/; revision=292420
* Move the DRIVER_MODULE() statements that declare mmc(4) to be a child ofIan Lepore2015-12-143-16/+8
| | | | | | | | | the various bridge drivers out of dev/mmc.c and into the bridge drivers. Requested by: jhb (almost two years ago; better late than never) Notes: svn path=/head/; revision=292180
* Add support for the DesignWare MMC hardware in the HiSilicon hi6220. ThisAndrew Turner2015-09-011-0/+96
| | | | | | | | | | | | | | | | | SoC is used in the HiKey board from 96boards. Currently on the SD card is working on the HiKey, as such devices 0 and 2 will need to be disabled, for example by adding the following to loader.conf: hint.hisi_dwmmc.0.disabled=1 hint.hisi_dwmmc.2.disabled=1 Relnotes: yes (Hikey board booting) Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287371
* Finish allowing the dwmmc driver to be subclassed, move the softc to a newAndrew Turner2015-09-012-45/+91
| | | | | | | | | header, along with the hwtype enum, device attach prototype, and driver_t. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287367
* Remove an variable we only ever write to, and stop assigning 0 to valuesAndrew Turner2015-09-011-4/+1
| | | | | | | | | | in the softc as it's the default value. The latter helps with subclassing this driver. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287356
* Move dwmmc.h to dwmmc_reg.h. This is in preperation for adding support toAndrew Turner2015-08-282-1/+6
| | | | | | | | | subclass the dwmmc driver to allow SoC specific attachments. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287258
* Only check for the bus frequency if it has not already been set, forAndrew Turner2015-08-281-4/+6
| | | | | | | | | example through a driver running as a subclass of this. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287250
* There is no need to get the bus tag or handle.Andrew Turner2015-08-271-6/+0
| | | | | | | Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287214
* Limit the speed to the bus frequency.Andrew Turner2015-08-271-1/+1
| | | | | | | Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287213
* Allow the fifo-depth and num-slots to be missing. For the former we readAndrew Turner2015-08-271-8/+16
| | | | | | | | | the value from the hardware, for the latter assume a single slot. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287212
* Allow us to select the transfer count. This allows us to work with hardwareAndrew Turner2015-08-271-7/+9
| | | | | | | | | that seems to only work with a single block at a time. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287202
* Fix freescale sdhc driver, and add it to the files list.Justin Hibbits2015-08-271-0/+1
| | | | | | | Also, add it to the mmc DRIVER_MODULE attachment list. Notes: svn path=/head/; revision=287189
* Only access the Samsung registers when targeting Samsung hardware.Andrew Turner2015-08-261-1/+1
| | | | | | | Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=287161
* Attach dwmmc to the ofwbus, som devicetrees place it here.Andrew Turner2015-08-071-0/+1
| | | | | | | Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=286408
* Stop including machine/fdt.h, it's unneeded, and purposefullyAndrew Turner2015-08-071-1/+0
| | | | | | | | | unimplemented on arm64. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=286407
* Deselect the sd card before re-selecting it when working around a problemIan Lepore2015-07-181-10/+11
| | | | | | | | | | | with some cards that causes them to become deselected after probing for switch capabilities. The old workaround fixes the behavior with some cards, but causes problems with the cards the behave correctly and don't become deselected. Forcing a deselect then reselect appears to work correctly with all cards in initial testing. Notes: svn path=/head/; revision=285678
* Do not set d_fwsectors nor d_fwheads. Primarily because the valuesMarcel Moolenaar2015-05-291-24/+1
| | | | | | | | | | | tend to be invalid. On a Beaglebone Black, we get 8192 sectors per track and that causes major breakages. Differential Revision: D2646 Reviewed by: ian@ imp@ Notes: svn path=/head/; revision=283754
* Add the MMC/SD driver for Allwinner SoCs.Luiz Otavio O Souza2015-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This is based on the patch sent by Alexander Fedorov with the following fixes/improvements: - Better error handling; - Clock is derived from PLL6 (obtained from netbsd); - No more unnecessary busy loops on interrupt handler; - style(9) fixes and code cleanup. I also want to thanks Martin Galvan who has sent an alternative implementation with some interesting fixes. Tested on CubieBoard2, Banana-Pi (thanks to netgate!) and Cubieboard1 (Pratik Singhal). This is intended to pave the way for the upcoming GSoC work (and make easier the build of images for the supported boards). PR: 196081 Submitted by: Alexander Fedorov <alexander.fedorov@rtlservice.com> Notes: svn path=/head/; revision=283253
* Re-select the SD card before getting the SD status. On a couple AtmelWarner Losh2015-05-191-0/+14
| | | | | | | | | | | | boards, this prevents some error messages during enumeration and also gives us the correct erase block size. They appear to be harmless elsewhere. # Note: we treat too many commands as 'can't fail' if they don't work # after a couple of retries. We need to fix that, but not today... Notes: svn path=/head/; revision=283128
* Add necessary changes to support various Amlogic SoC devicesGanbold Tsagaankhuu2015-03-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specially aml8726-m6 and aml8726-m8b SoC based devices. aml8726-m6 SoC exist in devices such as Visson ATV-102. Hardkernel ODROID-C1 board has aml8726-m8b SoC. The following support is included: Basic machdep code SMP Interrupt controller Clock control driver (aka gate) Pinctrl Timer Real time clock UART GPIO I2C SD controller SDXC controller USB Watchdog Random number generator PLL / Clock frequency measurement Frame buffer Submitted by: John Wehle Approved by: stas (mentor) Notes: svn path=/head/; revision=280905
* MMC: Signal HC capability to (e)MMC.Ian Lepore2015-02-271-1/+1
| | | | | | | | | | | | | | Summary: For new eMMC chips, we must signal controller HC capability in OP_COND command. Reviewers: imp, ian Reviewed By: ian Differential Revision: https://reviews.freebsd.org/D1920 Notes: svn path=/head/; revision=279359
* Enable Synopsys DesignWare Mobile Storage Host ControllerGanbold Tsagaankhuu2015-01-202-29/+142
| | | | | | | | | | | driver on Rockchip boards. It currently supports PIO mode and dma mode needs external dma controller to be used. Submitted by: jmcneill Approved by: stas (mentor) Notes: svn path=/head/; revision=277413
* Rate-limit error logging to 5 lines per second, so that when an sdcardIan Lepore2015-01-111-2/+9
| | | | | | | goes bad it doesn't lock up the console with continuous output. Notes: svn path=/head/; revision=277026
* Always select the card before we do the 4.x specific stuff andWarner Losh2014-12-231-3/+3
| | | | | | | | | | | | deselect it after setting the block size. This is a similar bug that was fixed elsewhere, but not here. This makes sure that we leave the card deselected at the end of the loop, and we don't send any commands to the card without it selected. Reviewed by: ian@ Notes: svn path=/head/; revision=276106
* Log mmc and sd command failures. Reporting of routine expected errors,Ian Lepore2014-12-201-0/+31
| | | | | | | | | | | | | such as timeouts while probing a bus or testing for a feature, is squelched. Also, error reporting is limited to 5 events per second, because when an sdcard goes bad on a low-end embedded board, flooding the console at high speed isn't helpful. Original logging code contributed by Michal Meloun, but then I fancied it up with squelching and ppsratecheck. Notes: svn path=/head/; revision=275951
* Don't deselect the card too soon. To set the block size or switch theWarner Losh2014-12-181-2/+2
| | | | | | | | | | | | | | function parameters, the card has to be in transfer state. If it is in the idle state, the commands are ignored. This caused us not to set the proper parameters that we later assume to be present, leading to downstream failures of the card / interface as our state machine mismatches the card's. Submitted by: Svatopluk Kraus <onwahe at gmail.com>, Michal Meloun <meloun at miracle.cz> Notes: svn path=/head/; revision=275905
* fwsectors and fwheads used to be somehwat arbitrary. However, they areWarner Losh2014-10-161-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | used to align partitions in gpart. We also try to align partitions by stripe size when creating new media. Align these two concepts by making fwsectors the same as the stripe size. Select a sensible number of heads so we wind up with about 20 cylinders. This number was selected to keep the rounding effects to a few percent while keeping the number of cylinder groups low. Sadly, it is not possible to make these numbers match the numbers used by SD card readers. There apperas to be much variation between brands so there's no one universal number. These numbers are also not aligned to the stripe size, so some performance problems may still be present when SD cards are created this way. Also, these numbers will differ from the far less common SD to ATA adapters, which present a different, but more uniform, set of numbers that also happened to match the old defaults. Nothing should change for current users. Any suboptimal performance caused by misalignment will still be there. gpart will honor the partitions that aren't on proper boudnaries, but editing the partition tables may result in different alignments being used than before when editing things natively. Ideally, there'd be some way to override these values in the disk subsystem by the user for the USB adapter use case where all "native" notions of geometry disappear. This does not implement that. Notes: svn path=/head/; revision=273180
* Always wait 'command done' interrupt status bit before proceeding next command.Ruslan Bukin2014-10-081-6/+4
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=272736
* Add driver for Synopsys DesignWare Mobile Storage Host Controller.Ruslan Bukin2014-10-073-0/+1254
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=272712
* Export an mmc or sd card's serial number from the mmc layer as an ivar.Ian Lepore2014-07-313-4/+18
| | | | | | | | | In the mmcsd layer use this value to populate disk->d_ident. Also set disk->d_descr to the full set of card identification info (includes vendor, model, manufacturing date, etc). Notes: svn path=/head/; revision=269341
* If no compatible cards were found after probing the bus, say so.Ian Lepore2014-02-151-0/+1
| | | | Notes: svn path=/head/; revision=261944
* Sort the list.Ian Lepore2014-02-031-3/+4
| | | | Notes: svn path=/head/; revision=261424
* Add the imx sdhci controller.Ian Lepore2014-02-031-0/+1
| | | | Notes: svn path=/head/; revision=261423
* Don't give up so easily on failure of CMD55 to put the card into app-cmdIan Lepore2013-08-231-3/+3
| | | | | | | | | mode. We don't know why it failed, so we can't know that a retry will also fail (the low-level driver might have reset the controller state machine or something similar that would allow a retry to work). Notes: svn path=/head/; revision=254716
* Make the standard sdhci(4) driver work for the TI OMAP family SoCs.Ian Lepore2013-08-201-0/+1
| | | | | | | | | | | | | | | | | The MMCHS hardware is pretty much a standard SDHCI v2.0 controller with a couple quirks, which are now supported by sdhci(4) as of r254507. This should work for all TI SoCs that use the MMCHS hardware, but it has only been tested on AM335x right now, so this enables it on those platforms but leaves the existing ti_mmchs driver in place for other OMAP variants until they can be tested. This initial incarnation lacks DMA support (coming soon). Even without it this improves performance pretty noticibly over the ti_mmchs driver, primarily because it now does multiblock IO. Notes: svn path=/head/; revision=254559
* Consistently init all mmc request, command, and data structures to zeroIan Lepore2013-08-172-10/+27
| | | | | | | before using them. Notes: svn path=/head/; revision=254432
* Handle command retries for commands originating at the mmc layer, andIan Lepore2013-08-161-32/+41
| | | | | | | | | | | | | | | | | | | | | | | ensure that all such commands have a non-zero retry count except for those that are expected to fail (for example, because they are used to probe for feature support). While it is possible to pass a retry count down to the hardware driver in the command request structure, no hardware driver currently implements any retry logic. The hardware doesn't know much about the context of a single request, so it makes more sense to handle retries at a layer that does. This adds retry loops to the mmc_wait_for_cmd() and mmc_wait_for_app_cmd() functions. These functions are the gateway from other code within mmc.c to the hardware. App commands are a sequence of two commands and a retry has to rerun both of them in order, so it needs its own retry loop. Retry looping is specifically NOT implemented in mmc_wait_for_request() because it is the gateway for children on the bus, and they have to implement their own retry logic depending on what makes sense for them. Notes: svn path=/head/; revision=254431
* During card identification, run the bus at 400KHz, not the minimumIan Lepore2013-08-161-4/+5
| | | | | | | | speed the bus claims to be capable of. The 400KHz speed is dictated by the SD and MMC standards. Notes: svn path=/head/; revision=254427
* Print the card relative address in hex, because that's what all theIan Lepore2013-08-161-1/+1
| | | | | | | | other debugging output does (when it appears in command arguments, for example). Notes: svn path=/head/; revision=254425
* Use meaningful names when creating mmc/sd threads.Rui Paulo2013-07-091-2/+4
| | | | | | | This can be useful when we want to be able to identify which mmcsd is stuck. Notes: svn path=/head/; revision=253054
* When reporting the user readable size, round up. Several SD cards notWarner Losh2013-05-161-3/+5
| | | | | | | | only use SI units, but also are a couple of percent short. If you need to know the exact size, diskinfo will return exact results. Notes: svn path=/head/; revision=250709
* Add Xilinx Zynq ARM/FPGA SoC support to FreeBSD/arm port.Wojciech A. Koszek2013-04-271-0/+1
| | | | | | | | | Submitted by: Thomas Skibo <ThomasSkibo (at) sbcglobal.net> Tested by: wkoszek (ZedBoard) Reviewed by: wkoszek, freebsd-arm@ (no objections raised) Notes: svn path=/head/; revision=249999
* Print MB and GB instead of MiB and GiB mislabeled as MB and GB.Warner Losh2013-04-141-24/+24
| | | | | | | | SD cards are sold in GB not GiB, this will result in less confusion. Also, cache parent device pointer to save a few cycles for loops. Notes: svn path=/head/; revision=249485
* Set the backlink in mmc commands to the mmc request that contains them.Ian Lepore2013-03-242-0/+4
| | | | Notes: svn path=/head/; revision=248689