aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mmc
Commit message (Collapse)AuthorAgeFilesLines
* MFC r279359, r279360:Ian Lepore2015-05-231-1/+1
| | | | | | | | | For new eMMC chips, we must signal controller HC capability in OP_COND command. Detect, report and use 8-bit bus if is available. Notes: svn path=/stable/10/; revision=283318
* MFC r277026: Rate-limit error logging to 5 lines per second.Ian Lepore2015-02-131-2/+9
| | | | Notes: svn path=/stable/10/; revision=278687
* MFC r275951: Log mmc and sd command failures.Ian Lepore2014-12-271-0/+31
| | | | Notes: svn path=/stable/10/; revision=276288
* MFC r269341: Populate disk->d_ident with the sd or mmc card's serial number.Ian Lepore2014-08-113-4/+18
| | | | Notes: svn path=/stable/10/; revision=269795
* MFC r261938, r261939, r261940, r261944, r261945, r261946, r261947, r261956, ↵Ian Lepore2014-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r261957, r261983, r261094, r261955, r261958, Add a driver to provide access to imx6 on-chip one-time-programmble data. Make it possible to access the ocotp registers before the ocotp device is attached, by establishing a temporary mapping of the registers when necessary. It turns out Freescale cleverly made the ocotp device compatible across several different families of SoCs, so move it to the freescale directory and prefix everything with fsl rather than imx6. Convert the imx6 sdhci "R1B fix" from a busy-loop in the interrupt handler to a callout. Increase the wait time for acquiring the SD bus from 10 to 250ms. If no compatible cards were found after probing the SD bus, say so. Add timeout logic to sdhci, separate from the timeouts done by the hardware. After a timeout, reset the controller using SDHCI_RESET_CMD|SDHCI_RESET_DATA rather than SDHCI_RESET_ALL; the latter turns off clocks and power, removing any possibility of recovering from the error. Add a helper routine to depth-search the device tree for a node with a matching 'compatible' property. Notes: svn path=/stable/10/; revision=266200
* MFC r261423, r261424, r261516, r261513, r261562, r261563, r261564, r261565,Ian Lepore2014-05-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r261596, r261606 Add the imx sdhci controller. Move Open Firmware device root on PowerPC, ARM, and MIPS systems to a sub-node of nexus (ofwbus) rather than direct attach under nexus. This fixes FDT on x86 and will make coexistence with ACPI on ARM systems easier. SPARC is unchanged. Add the missing ')' at end of sentence. Reword it to use a more common idiom. Pass the kernel physical address to initarm through the boot param struct. Make functions only used in vfp.c static, and remove vfp_enable. Fix __syscall on armeb EABI. As it returns a 64-bit value it needs to place 32-bit data in r1, not r0. 64-bit data is already packed correctly. Use abp_physaddr for the physical address over KERNPHYSADDR. This helps us remove the need to load the kernel at a fixed address. Remove references to PHYSADDR where it's used only in debugging output. Dynamically generate the page table. This will allow us to detect the physical address we are loaded at to change the mapping. Notes: svn path=/stable/10/; revision=266160
* 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
* Fix highest voltage detectionOleksandr Tymoshenko2013-01-212-1/+4
| | | | | | | | Submitted by: Daisuke Aoyama <aoyama at peach.ne.jp> Approved by: imp@ Notes: svn path=/head/; revision=245755
* Use %u for unsigned serial numberEd Maste2012-11-221-1/+1
| | | | Notes: svn path=/head/; revision=243387
* Add BCM2835 SDHCI driver and enable it in Raspberry Pi configOleksandr Tymoshenko2012-10-291-0/+1
| | | | Notes: svn path=/head/; revision=242321
* Split sdhci driver in two parts: sdhci and sdhci_pci.Oleksandr Tymoshenko2012-10-161-1/+1
| | | | | | | | | | | | | | sdchi encapsulates a generic SD Host Controller logic that relies on actual hardware driver for register access. sdhci_pci implements driver for PCI SDHC controllers using new SDHCI interface No kernel config modifications are required, but if you load sdhc as a module you must switch to sdhci_pci instead. Notes: svn path=/head/; revision=241600
* Remove an unneeded NULL check after M_WAITOK.Kevin Lo2012-09-301-2/+0
| | | | Notes: svn path=/head/; revision=241067
* The check for MAXPHYS doesn't make sense, so remove it.Warner Losh2012-08-231-7/+24
| | | | | | | | | Report errors indicated by the transport. If this is too chatty, I'll throw it behind a debug write. Remove commented out debugs that are no longer useful. Notes: svn path=/head/; revision=239607
* Merging of projects/armv6, part 10Oleksandr Tymoshenko2012-08-151-0/+1
| | | | | | | | | | | | | - Support for Texas Instruments SoCs: - AM335x - OMAP4 - Kernel configs, DTS for Beaglebone and Pandaboard Submitted by: Ben Gray, Damjan Marion Notes: svn path=/head/; revision=239281
* Add missing prototypes. While at it, sort them alphabetically.Marius Strobl2012-06-022-14/+73
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=236491
* - Fix some typos in mmc_acquire_bus() and mmc_send_csd().Marius Strobl2012-05-271-10/+104
| | | | | | | | | | | | | | - Fix some math errors in mmc_decode_csd_sd(). - Fix incorrect arguments to mmc_send_app_op_cond() in mmc_go_discovery(). - Add reporting of CSD for debug purposes. - Add detection (and skipping) of password-locked cards. - Add setting of block length on card if necessary. Submitted by: Patrick Kelsey MFC after: 3 days Notes: svn path=/head/; revision=236156
* o Fixes:Marius Strobl2012-04-215-33/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - When switching to 4-bit operation, send a SET_CLR_CARD_DETECT command to disconnect the card-detect pull-up resistor from the DAT3 line before sending the SET_BUS_WIDTH command. - Add the missing "reserved" zero entry to the mantissa table used to decode various CSD fields. This was causing SD cards to report that they could run at 30 MHz instead of the maximum 25 MHz mandated in the spec. o Enhancements: - At the MMC layer, format various info from the CID into a string that uniquely identifies the card instance (manufacturer number, serial number, product name and revision, etc). Export it as an instance variable. - At the MMCSD layer, display the formatted card ID string, and also report the clock speed of the hardware (not the card's max speed), and the number of bits and number of blocks per transfer. It comes out like this now: mmcsd0: 968MB <SD SD01G 8.0 SN 276886905 MFG 08/2008 by 3 SD> at mmc0 22.5MHz/4bit/128-block o Use DEVMETHOD_END. o Use NULL instead of 0 for pointers. PR: 156496 Submitted by: Ian Lepore MFC after: 1 week Notes: svn path=/head/; revision=234524
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-071-1/+1
| | | | | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Notes: svn path=/head/; revision=227309
* Fix integer overflow on 32bit systems when calculating media size,Alexander Motin2011-08-141-1/+1
| | | | | | | | | reintroduced by r222475. Approved by: re (kib) Notes: svn path=/head/; revision=224868
* Fix read_ivar implementation for MMC and SD.Jayachandran C.2011-05-302-12/+12
| | | | | | | | | | | | | | 1. Both mmc_read_ivar() and sdhci_read_ivar() use the expression '*(int *)result = val' to assign to result which is uintptr_t *. This does not work on big-endian 64 bit systems. 2. The media_size ivar is declared as 'off_t' which does not fit into uintptr_t in 32bit systems, change this to long. Submitted by: kanthms at netlogicmicro com (initial version) Notes: svn path=/head/; revision=222475
* Fix 32bit bit fields handling. This fixes card serial number fetching.Alexander Motin2011-01-171-1/+1
| | | | | | | | | It was just a cosmetic issue, because that number is only reported in logs. Reported by: Michael Butler on current@ Notes: svn path=/head/; revision=217509
* Wait for commands to complete 10 times longer. This makes my A-DATA 32GB SDHCPawel Jakub Dawidek2011-01-041-2/+2
| | | | | | | | | | card being detected. Reviewed by: imp MFC after: 2 weeks Notes: svn path=/head/; revision=216941
* Report relative card address to NewBus as location string.Alexander Motin2010-05-231-0/+10
| | | | Notes: svn path=/head/; revision=208441
* Temporarily revert the new-bus locking for 8.0 release. It will beJohn Baldwin2009-08-201-2/+0
| | | | | | | | | reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio Notes: svn path=/head/; revision=196403
* Make the newbus subsystem Giant free by adding the new newbus sxlock.Attilio Rao2009-08-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith) Notes: svn path=/head/; revision=196037
* read_ivar takes a uintptr_t * not a u_char *.Warner Losh2009-03-121-1/+1
| | | | Notes: svn path=/head/; revision=189727
* Add kernel dumping support. Works fine with sdhci controller driver.Alexander Motin2009-02-171-1/+30
| | | | Notes: svn path=/head/; revision=188725
* o Define some symbols for a few items that are bare constants in theWarner Losh2009-02-032-16/+34
| | | | | | | | | code. o Use NULL in preference to 0 for a few pointers. o default to bus timing normal, like we default to bus_width_1. Notes: svn path=/head/; revision=188044
* Add one more debug level.Alexander Motin2009-01-281-2/+2
| | | | Notes: svn path=/head/; revision=187877
* Improve mmc driver verbose logging.Alexander Motin2009-01-281-12/+78
| | | | | | | Make requests logging controllable by hw.mmc.debug sysctl. Notes: svn path=/head/; revision=187875
* Default to normal bus timing mode on SD cards. In practice, mostWarner Losh2009-01-211-0/+1
| | | | | | | | | cards people have today support high speed mode, so the timing field would be initialized to bus_timing_hs, but there are some slow cards... Notes: svn path=/head/; revision=187551
* Fix minor style nit for file consistency.Warner Losh2009-01-211-5/+4
| | | | Notes: svn path=/head/; revision=187546
* Make the command reporting be under boot verbose.Warner Losh2009-01-211-6/+10
| | | | | | | | Also, report a few other things under boot verbose. Small style nit to make new code look like old code in this file. Notes: svn path=/head/; revision=187543
* Fix copy/paste mistake in variable name. This could lead to using incorrectAlexander Motin2009-01-211-1/+1
| | | | | | | bus frequency. Notes: svn path=/head/; revision=187525
* Implement suspend/resume for mmc and mmcsd drivers.Alexander Motin2008-12-062-66/+164
| | | | | | | | | | | | | | Now it is possible to suspend/resume with inserted and active card. To reinitialize card on resume and to detect card change while suspended, implement bus rescan routines. It can also be used by controllers without card presence detection signals or with multiple cards per slot support. While there, cleanup msleep() usage. We have no any rights to exit without "request done" signal from driver as it could lead to modify after free. Notes: svn path=/head/; revision=185721
* Report card erase sector size as disk stripe size.Alexander Motin2008-11-231-0/+2
| | | | Notes: svn path=/head/; revision=185202
* Improve detach handling: close races, flush queue.Alexander Motin2008-11-231-13/+16
| | | | Notes: svn path=/head/; revision=185201
* Allow card reader bridge driver to report maximum supported transfer size.Alexander Motin2008-10-294-8/+8
| | | | | | | | | | | | sdhci supports up to 65535 blocks transfers, at91_mci - one block. Enable multiblock operations disabled before to follow at91_mci driver limitations. Reviewed by: imp@ Notes: svn path=/head/; revision=184452
* Coalesce sequentional BIO_DELETE requests to slightly relax size and alignmentAlexander Motin2008-10-181-8/+23
| | | | | | | constraints required by the card. Notes: svn path=/head/; revision=184034
* Implement BIO_DELETE command with MMC and SD erase commands.Alexander Motin2008-10-184-149/+333
| | | | | | | | | | | | | | | | | | | | Erase operation gives card's logic information about unused areas to help it implement wear-leveling with lower overhead comparing to usual writing. Erase is much faster then write and does not depends on data bus speed. Also as result of hitting in-card write logic optimizations I have measured up to 50% performance boost on writing undersized blocks into preerased areas. At the same time there are strict limitations on size and allignment of erase operations. We can erase only blocks aligned to the erase sector size and with size multiple of it. Different cards has different erase sector size which usually varies from 64KB to 4MB. SD cards actually allow to erase smaller blocks, but it is much more expensive as it is implemented via read-erase-write sequence and so not sutable for the BIO_DELETE purposes. Reviewed by: imp@ Notes: svn path=/head/; revision=184033