aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/core/sdio_bus.c
AgeCommit message (Collapse)Author
2013-04-29mmc: Add concept of an 'embedded' SDIO device.San Mehat
This is required to support chips which use SDIO for signaling/ communication but do not implement the various card enumeration registers as required for full SD / SDIO cards. mmc: sdio: Fix bug where we're freeing the CIS tables we never allocated when using EMBEDDED_SDIO mmc: Add max_blksize to embedded SDIO data Signed-off-by: San Mehat <san@google.com>
2012-12-06mmc: Remove redundant null check before kfree in sdio_bus.cSachin Kamat
kfree on a null pointer is a no-op. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-12-06mmc: sdio: Add empty bus-level suspend/resume callbacksRafael J. Wysocki
Suspend methods provided by SDIO drivers are not supposed to be called by the PM core. Instead, when the SDIO core gets to suspend a device's ancestor, it calls the device driver's suspend routine. However, the PM core executes suspend callback routines directly for device drivers whose bus types don't provide suspend callbacks. In consequece, because the SDIO bus type doesn't provide a suspend callback, the SDIO drivers' suspend routines will be executed by the PM core (which shouldn't happen). To prevent this from happening, add empty system suspend/resume callbacks for the SDIO bus type. An analogous change had been made already by commit (e841a7c mmc: sdio: Use empty system suspend/resume callbacks at the bus level), but then it was reverted inadvertently by commit (d8e2ac3 mmc: sdio: Fix PM_SLEEP related build warnings) that attempted to fix build warnings introduced by commit e841a7c. Reported-by: NeilBrown <neilb@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-09-19mmc: sdio: Fix PM_SLEEP related build warningsThierry Reding
Power management callbacks defined by SIMPLE_DEV_PM_OPS are only used if the PM_SLEEP Kconfig symbol has been defined. If not, the compiler will complain about them being unused. However, since the callback for this driver doesn't do anything it can just as well be dropped. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-04-05mmc: sdio: Use empty system suspend/resume callbacks at the bus levelRafael J. Wysocki
Neil Brown reports that commit 35cd133c PM: Run the driver callback directly if the subsystem one is not there breaks suspend for his libertas wifi, because SDIO has a protocol where the suspend method can return -ENOSYS and this means "There is no point in suspending, just turn me off". Moreover, the suspend methods provided by SDIO drivers are not supposed to be called by the PM core or bus-level suspend routines (which aren't presend for SDIO). Instead, when the SDIO core gets to suspend the device's ancestor, it calls the device driver's suspend function, catches the ENOSYS, and turns the device off. The commit above breaks the SDIO core's assumption that the device drivers' callbacks won't be executed if it doesn't provide any bus-level callbacks. If fact, however, this assumption has never been really satisfied, because device class or device type suspend might very well use the driver's callback even without that commit. The simplest way to address this problem is to make the SDIO core tell the PM core to ignore driver callbacks, for example by providing no-operation suspend/resume callbacks at the bus level for it, which is implemented by this change. Reported-and-tested-by: Neil Brown <neilb@suse.de> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> [stable: please apply to 3.3-stable only] Cc: <stable@vger.kernel.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-10-31mmc: Add export.h for EXPORT_SYMBOL/THIS_MODULE as requiredPaul Gortmaker
These two basic defines were everywhere, simply because module.h was also everywhere. But we are cleaning up the latter. So make the exporters actually call out their need for the include. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-26mmc: replace printk with appropriate display macroGirish K S
All the files using printk function for displaying kernel messages in the mmc driver have been replaced with corresponding macro. Signed-off-by: Girish K S <girish.shivananjappa@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-07-21mmc: fix runtime PM with -ENOSYS suspend caseOhad Ben-Cohen
In the case where a driver returns -ENOSYS from its suspend handler to indicate that the device should be powered down over suspend, the remove routine of the driver was not being called, leading to lots of confusion during resume. The problem is that runtime PM is disabled during this process, and when we reach mmc_sdio_remove, calling the runtime PM functions here (validly) return errors, and this was causing us to skip the remove function. Fix this by ignoring the error value of pm_runtime_get_sync(), which can return valid errors. This also matches the behaviour of pci_device_remove(). Signed-off-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-06-25mmc: sdio: fix runtime PM path during driver removalOhad Ben-Cohen
After commit e1866b3 "PM / Runtime: Rework runtime PM handling during driver removal" was introduced, the driver core stopped incrementing the runtime PM usage counter of the device during the invocation of the ->remove() callback. This indirectly broke SDIO's runtime PM path during driver removal, because no one calls _put_sync() anymore after ->remove() completes. This means that the power of runtime-PM-managed SDIO cards is kept high after their driver is removed (even if it was powered down beforehand). Fix that by directly calling _put_sync() when the last usage counter is downref'ed by the SDIO bus. Reported-and-tested-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-01-08mmc: sdio: don't power up cards on system suspendOhad Ben-Cohen
Initial SDIO runtime PM implementation took a conservative approach of powering up cards (and fully reinitializing them) on system suspend, just before the suspend handlers of the relevant drivers were executed. To avoid redundant power and reinitialization cycles, this patch removes this behavior: if a card is already powered off when system suspend kicks in, it is left at that state. If a card is active when a system sleep starts, everything is straightforward and works exactly like before. But if the card was already suspended before the sleep began, then when the MMC core powers it back up on resume, its run-time PM status has to be updated to reflect the actual post-system sleep status. The technique to do that is borrowed from the I2C runtime PM implementation (for more info see Documentation/power/runtime_pm.txt). Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Reviewed-by: Chris Ball <cjb@laptop.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2010-11-19mmc: sdio: fix runtime PM anomalies by introducing MMC_CAP_POWER_OFF_CARDOhad Ben-Cohen
Some board/card/host configurations are not capable of powering off the card after boot. To support such configurations, and to allow smoother transition to runtime PM behavior, MMC_CAP_POWER_OFF_CARD is added, so hosts need to explicitly indicate whether it's OK to power off their cards after boot. SDIO core will enable runtime PM for a card only if that cap is set. As a result, the card will be powered down after boot, and will only be powered up again when a driver is loaded (and then it's up to the driver to decide whether power will be kept or not). This will prevent sdio_bus_probe() failures with setups that do not support powering off the card. Reported-and-tested-by: Daniel Drake <dsd@laptop.org> Reported-and-tested-by: Arnd Hannemann <arnd@arndnet.de> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23mmc: sdio: support suspend/resume while runtime suspendedOhad Ben-Cohen
Bring SDIO devices back to full power before their suspend handler is invoked. Doing so ensures that SDIO suspend/resume semantics are maintained (drivers still get to decide whether their card should be removed or kept during system suspend, and at what power state), and that SDIO suspend/resume execution paths are unchanged. This is achieved by resuming a runtime-suspended SDIO device in its ->prepare() PM callback (similary to the PCI subsystem). Since the PM core always increments the run-time usage counter before calling the ->prepare() callback and decrements it after calling the ->complete() callback, it is guaranteed that when the system will come out of suspend, our device's power state will reflect its runtime PM usage counter. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Tested-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23mmc: sdio: enable runtime PM for SDIO functionsOhad Ben-Cohen
Enable runtime PM for SDIO functions. SDIO functions are initialized with a disabled runtime PM state, and are set active (and their usage count is incremented) only before potential drivers are probed. SDIO function drivers that support runtime PM should call pm_runtime_put_noidle() in their probe routine, and pm_runtime_get_noresume() in their remove routine (very similarly to PCI drivers). In case a matching driver does not support runtime PM, power will always be kept high (since the usage count is positive). Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Tested-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23mmc: sdio: use the generic runtime PM handlersOhad Ben-Cohen
Assign the generic runtime PM handlers for SDIO. These handlers invoke the relevant SDIO function drivers' handlers, if exist, otherwise they just return success (so SDIO drivers don't have to define any runtime PM handlers unless they need to). Runtime PM is still disabled by default, so this patch alone has no immediate effect. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Tested-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2009-12-17sdio: fix reference counting in sdio_remove_func()Daniel Drake
sdio_remove_func() needs to be more careful about reference counting. It can be called in error paths where sdio_add_func() has never been called e.g. mmc_attach_sdio error path --> mmc_sdio_remove --> sdio_remove_func Signed-off-by: Daniel Drake <dsd@laptop.org> Reviewed-by: Matt Fleming <matt@console-pimps.org> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-23mmc: make SDIO device/driver struct accessors publicNicolas Pitre
Especially with the PM framework, those are quite handy to have in driver code too. Signed-off-by: Nicolas Pitre <nico@marvell.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-08mmc: struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers
Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-10-14uevent environment changes falloutAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-09-23sdio: store vendor stringsPierre Ossman
Store vendor strings found in CISTPL_VERS_1 so that function drivers can access them. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdio: kmalloc + memset conversion to kzallocMariusz Kozlowski
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdio: set the functions' block sizeDavid Vrabel
Before a driver is probed, set the function's block size to the default so the driver is sure the block size is something sensible and it needn't explicitly set it. The default block size is the largest that's supported by both the card and the host, with a maximum of 512 to ensure aribitrarily sized transfer use the optimal (least) number of commands. See http://lkml.org/lkml/2007/8/7/150 for reasons for the block size choice. Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23make struct sdio_dev_attrs[] staticAdrian Bunk
On Wed, Jul 25, 2007 at 04:03:04AM -0700, Andrew Morton wrote: >... > Changes since 2.6.22-rc6-mm1: >... > git-mmc.patch >... > git trees >... sdio_dev_attrs[] can become static. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdio: core support for SDIO function interruptNicolas Pitre
Signed-off-by: Nicolas Pitre <npitre@mvista.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdio: add basic sysfs attributesPierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdio: add modalias supportPierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdio: add device id table and matchingPierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdio: split up common and function CIS parsingPierre Ossman
Add a more clean separation between global, common CIS information and the function specific one as we need the common information in places where no specific function is specified. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdio: link unknown CIS tuples to the sdio_func structureNicolas Pitre
This way those tuples that the core cares about are consumed by the core code, and tuples that only function drivers might make sense of are available to drivers. Signed-off-by: Nicolas Pitre <npitre@mvista.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23mmc: add SDIO driver handlingPierre Ossman
Add basic driver handling to the SDIO device model. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23mmc: basic SDIO device modelPierre Ossman
Add the sdio bus type and basic device handling. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>