Commit Graph

81 Commits

Author SHA1 Message Date
Kevin F. Haggerty 0fdd45c3ac Merge remote-tracking branch 'google-common/deprecated/android-3.4' into lineage-16.0
Change-Id: I363f9d4d0623906eaffffb3747a162ccbc92ccb0
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 11:41:21 +02:00
Francescodario Cuzzocrea 85baa390bf misc: Import SM-G900H kernel source code
* Samsung Package Version: G800HXXU1CRJ1
    * CAF Tag: LA.BF.1.1.3-00110-8x26.0
2019-08-02 15:14:10 +02:00
Subhash Jadavani 5c4970fdaa mmc: sdio: enable asynchronous interrupt support in 4-bit mode
SDIO 3.0 specification has added the support for asynchronous interrupt
period during which card allows the clock to be gated off. Host needs
to first read the "Support Asynchronous Interrupt" bit in CCCR register
space to check if the card supports the feature or not. If yes and if
the host wants to enable the feature, host needs to write '1' to
"Enable Asynchronous Interrupt" bit in CCCR register space.

This change allows the host controller driver to control whether to enable
the asynchronous interrupt in card or not and if the asynchronous interrupt
is enabled then clock gating feature would be enabled for such cards.

Change-Id: I678cffb63af6a2013640a5eafa6ce9bfad8a51d6
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2013-05-27 14:59:25 +05:30
Subhash Jadavani 06673c5538 mmc: sdio: fix sdio_reset_comm() to take care of UHS card reset
sdio_reset_comm() function may be invoked by the SDIO card function
driver to execute soft reset of the card but this function currently
fails to reset the UHS SDIO cards.

This change fixes this issue by simply invoking SDIO power restore
function which is capable of resetting both UHS and non-UHS SDIO cards.

CRs-Fixed: 424685
Change-Id: I4f1d76a6bfc4bfec16661aedba85c45b601f24ac
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2012-11-28 18:59:35 +05:30
Subhash Jadavani 177bf0c479 mmc: sdio: print correct UHS mode during card detection
When SDIO3.0 card is detected, incorrect bus speed mode
is printed as part of card detection print in kernel logs.

This change fixes it so that user won't be confused by
looking at incorrect card detection message in logs.

CRs-Fixed: 424685
Change-Id: I06c318895aa17879a4d4ad8c263e46fbfdce7d3b
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2012-11-28 18:59:22 +05:30
Sujit Reddy Thumma 25248b6782 mmc: sdio: Fix SDIO 3.0 UHS-I initialization sequence
According to UHS-I initialization sequence for SDIO 3.0 cards,
the host must set bit[24] (S18R) of OCR register during OCR
handshake to know whether the SDIO card is capable of doing
1.8V I/O.

CRs-Fixed: 424685
Change-Id: I8d9171ec4d24046287c9bf4c268f688ae8797646
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2012-11-28 18:53:10 +05:30
Subhash Jadavani 2679307563 mmc: sdio: fix resume failure
If SDIO keep power flag (MMC_PM_KEEP_POWER) is not set, card would
be reinitialized during resume but as we are not resetting
(CMD52 reset) the SDIO card during this reinitialization, card may
fail to respond back to subsequent commands (CMD5 etc...).

This change resets the card before the reinitialization of card
during resume.

CRs-Fixed: 424805
Change-Id: Ic4bf6fe51dbfe8722ed7bbd9f98d7a650ed6e5d0
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2012-11-27 18:31:02 +05:30
Steve Muckle f132c6cf77 Merge commit 'AU_LINUX_ANDROID_ICS.04.00.04.00.126' into msm-3.4
AU_LINUX_ANDROID_ICS.04.00.04.00.126 from msm-3.0.
First parent is from google/android-3.4.

* commit 'AU_LINUX_ANDROID_ICS.04.00.04.00.126': (8712 commits)
  PRNG: Device tree entry for qrng device.
  vidc:1080p: Set video core timeout value for Thumbnail mode
  msm: sps: improve the debugging support in SPS driver
  board-8064 msm: Overlap secure and non secure video firmware heaps.
  msm: clock: Add handoff ops for 7x30 and copper XO clocks
  msm_fb: display: Wait for external vsync before DTV IOMMU unmap
  msm: Fix ciruclar dependency in debug UART settings
  msm: gdsc: Add GDSC regulator driver for msm-copper
  defconfig: Enable Mobicore Driver.
  mobicore: Add mobicore driver.
  mobicore: rename variable to lower case.
  mobicore: rename folder.
  mobicore: add makefiles
  mobicore: initial import of kernel driver
  ASoC: msm: Add SLIMBUS_2_RX CPU DAI
  board-8064-gpio: Update FUNC for EPM SPI CS
  msm_fb: display: Remove chicken bit config during video playback
  mmc: msm_sdcc: enable the sanitize capability
  msm-fb: display: lm2 writeback support on mpq platfroms
  msm_fb: display: Disable LVDS phy & pll during panel off
  ...

Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
2012-06-06 18:45:28 -07:00
Nicolas Pitre fed14d9343 mmc: sdio: avoid spurious calls to interrupt handlers
Commit 06e8935feb ("optimized SDIO IRQ handling for single irq")
introduced some spurious calls to SDIO function interrupt handlers,
such as when the SDIO IRQ thread is started, or the safety check
performed upon a system resume.  Let's add a flag to perform the
optimization only when a real interrupt is signaled by the host
driver and we know there is no point confirming it.

Change-Id: Ibfd6b35589b15fabea7b1c18dfa2197a78866b61
Reported-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2012-05-16 08:18:01 +05:30
Dmitry Shmidt fe6271ebd8 mmc: sdio: Fix enable_hs and enable_wide in sdio_reset_comm()
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-04-09 13:57:44 -07:00
Daniel Chen 676751d2a9 mmc: sdio: Add high speed support to sdio_reset_comm()
Signed-off-by: San Mehat <san@google.com>
2012-04-09 13:57:44 -07:00
Dmitry Shmidt 4c5391f1f7 mmc: sdio: Claim host in sdio_reset_comm()
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-04-09 13:57:44 -07:00
San Mehat 35fe42ee47 mmc: Add new API call 'sdio_reset_comm' for resetting communication with an SDIO device
Signed-off-by: San Mehat <san@android.com>
2012-04-09 13:53:17 -07:00
San Mehat e01587a794 mmc: Add concept of an 'embedded' SDIO device.
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-04-09 13:53:17 -07:00
Rohit Vaswani a76e99abc5 Merge branch 'Linux 3.0.21' into msm-3.0
Merge Upstream's stable 3.0.21 branch into msm-3.0
This consists 814 commits and some merge conflicts.

The merge conflicts are because of some local changes to
msm-3.0 as well as some conflicts between google's tree and
the upstream tree.

Conflicts:
	arch/arm/kernel/head.S
	drivers/bluetooth/ath3k.c
	drivers/bluetooth/btusb.c
	drivers/mmc/core/core.c
	drivers/tty/serial/serial_core.c
	drivers/usb/host/ehci-hub.c
	drivers/usb/serial/qcserial.c
	fs/namespace.c
	fs/proc/base.c

Change-Id: I62e2edbe213f84915e27f8cd6e4f6ce23db22a21
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2012-03-30 00:09:34 -07:00
Girish K S a3f4169e47 mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices.
The eMMC 4.5 devices have support for 200MHz bus speed. The function
prototype of the tuning function is modified to handle the tuning
command number which is different in sd and mmc case.

Change-Id: If52eab150592d96adb58d98ec19110fe43d2fbc0
Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
[subhashj@codeaurora.org: Fixed merge conflicts and compilation errors]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
2012-03-08 12:13:44 +05:30
Ulf Hansson e7747475b6 mmc: core: Fixup suspend/resume issues for UHS-I cards
Even if cards supports 1.8V I/O voltage those should anyway be
initialized at 3.3V I/O according to (e)MMC, SD and SDIO specs.
Some eMMC and embedded SDIO devices are able to be initialized
at 1.8V as well, but it is better to be safe.

Do note that initialization in this context means that the card
has been completely powered off, otherwise the card will remain
at the last I/O voltage level that were negotitiated.

Due to the above being taken care of the suspend/resume issues
for UHS-I SD-cards has been fixed.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Acked-by: Philip Rakity <prakity@marvell.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2012-03-04 12:25:15 -05:00
Philip Rakity 2d0d68f583 mmc: core: UHS sdio card that fails should not exceed 50MHz
A UHS sdio card that fails initialization at 1.8v signaling is not in
UHS mode.  We cannot use the speed in the the cis to reflect the bus
speed as this is the maxiumum value and will not reflect the fact
that the host is operating at a lower (non uhs) bus speed.

Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Reviewed-by: Aaron Lu <aaron.lu@amd.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2012-02-13 20:38:28 -05:00
Girish K S a4924c71aa mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices.
The eMMC 4.5 devices have support for 200MHz bus speed. The function
prototype of the tuning function is modified to handle the tuning
command number which is different in sd and mmc case.

Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2012-01-12 15:17:15 -05:00
Adrian Hunter d304950488 mmc: allow upper layers to know immediately if card has been removed
Add a function mmc_detect_card_removed() which upper layers can use to
determine immediately if a card has been removed. This function should
be called after an I/O request fails so that all queued I/O requests
can be errored out immediately instead of waiting for the card device
to be removed.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2012-01-11 23:58:43 -05:00
Philip Rakity a303c5319c mmc: sdio: support SDIO UHS cards
This patch adds support for sdio UHS cards per the version 3.0
spec.

UHS mode is only enabled for version 3.0 cards when both the
host and the controller support UHS modes.

1.8v signaling support is removed if both the card and the
host do not support UHS.  This is done to maintain
compatibility and some system/card combinations break when
1.8v signaling is enabled when the host does not support UHS.

Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Aaron Lu <Aaron.lu@amd.com>
Reviewed-by: Arindam Nath <arindam.nath@amd.com>
Tested-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2012-01-11 23:58:41 -05:00
Adrian Hunter 8b581b08ef mmc: allow upper layers to know immediately if card has been removed
Add a function mmc_detect_card_removed() which upper layers can use to
determine immediately if a card has been removed. This function should
be called after an I/O request fails so that all queued I/O requests
can be errored out immediately instead of waiting for the card device
to be removed.

Change-Id: Iad4806319b6ad67048674adfdd919458186521d6
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
[sthumma@codeaurora.org: Fixed merge conflicts]
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2011-12-30 16:03:48 +05:30
Sujit Reddy Thumma abb9681051 mmc: core: Ensure clocks are always enabled before host interaction
Ensure clocks are always enabled before any interaction with the
host controller driver. This makes sure that there is no race
between host execution and the core layer turning off clocks
in different context with clock gating framework.

CRs-Fixed: 324380
Change-Id: Id3dc2074ed81bf758649bc61ce918500a95e9bae
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
2011-12-12 15:00:03 +05:30
Ulf Hansson 311c3c10f6 mmc: core: Fix hangs related to insert/remove of cards
commit 7f7e4129c2 upstream.

During a rescan operation mmc_attach(sd|mmc|sdio) functions are
called. The error handling in these function can trigger a detach
of the bus, which also meant a power off. This is not notified by
the rescan operation which then continues to the next attach function.

If a power off has been done, the framework must never send any
new commands to the host driver, without first doing a new power up.
This will most likely trigger any host driver to hang.

Moving power off out of detach and instead handle power off
separately when it is actually needed, solves the issue.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11 09:35:22 -08:00
Bing Zhao b4625dab2c mmc: recognise SDIO cards with SDIO_CCCR_REV 3.00
Table 6-2: CCCR bit Definitions, address 00h.  Part E1 SDIO Simplified
Specification Version 3.00, Feb. 25, 2011.

This patch has been tested with Marvell WLAN device SD8797.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-10-26 16:32:31 -04:00
Girish K S a3c76eb9d4 mmc: replace printk with appropriate display macro
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-10-26 16:32:22 -04:00
Stefan Nilsson XK 4466903481 mmc: core: Set correct bus mode before card init
Earlier all cards where initiated with bus mode set as OPENDRAIN, and then
later switched to PUSHPULL. According to the MMC/SD/SDIO specifications
only MMC cards use OPENDRAIN during init. For both SD and SDIO the bus
mode shall be PUSHPULL before attempting to init the card.

The consequence of having incorrect bus mode can lead to not being able
to detect the card. Therefore the default behavior have now been changed
to PUSHPULL in mmc_power_up, and will only be temporarily switched when
trying to attach or init a MMC card.

Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
Signed-off-by: Ulf HANSSON <ulf.hansson@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-10-26 16:32:03 -04:00
Ulf Hansson 7f7e4129c2 mmc: core: Fix hangs related to insert/remove of cards
During a rescan operation mmc_attach(sd|mmc|sdio) functions are
called. The error handling in these function can trigger a detach
of the bus, which also meant a power off. This is not notified by
the rescan operation which then continues to the next attach function.

If a power off has been done, the framework must never send any
new commands to the host driver, without first doing a new power up.
This will most likely trigger any host driver to hang.

Moving power off out of detach and instead handle power off
separately when it is actually needed, solves the issue.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <stable@kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-10-26 16:32:01 -04:00
Bryan Huntsman 3f2bc4d6eb Initial Contribution
msm-2.6.38: tag AU_LINUX_ANDROID_GINGERBREAD.02.03.04.00.142

Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
2011-10-03 09:57:10 -07:00
Colin Cross e55d4fa967 Merge commit 'v3.0-rc5' into android-3.0 2011-06-29 13:54:42 -07:00
Daniel Drake c6e633ad91 mmc: sdio: reset card during power_restore
mmc_sdio_power_restore() skips some steps that are performed in other
power-related codepaths which are necessary to fully reset the card.
Without this, runtime PM fails for SD8686 SDIO wifi on OLPC XO-1.5.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-06-25 18:52:44 -04:00
Dmitry Shmidt cd86f663d6 mmc: sdio: Fix enable_hs and enable_wide in sdio_reset_comm()
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-06-14 09:09:37 -07:00
Daniel Chen 8f5ed00afe mmc: sdio: Add high speed support to sdio_reset_comm()
Signed-off-by: San Mehat <san@google.com>
2011-06-14 09:08:53 -07:00
Dmitry Shmidt 7e053b36fc mmc: sdio: Claim host in sdio_reset_comm()
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-06-14 09:08:52 -07:00
San Mehat 200a8e86c8 mmc: Add new API call 'sdio_reset_comm' for resetting communication with an SDIO device
Signed-off-by: San Mehat <san@android.com>
2011-06-14 09:08:51 -07:00
San Mehat 9a248205b3 mmc: Add concept of an 'embedded' SDIO device.
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>
2011-06-14 09:08:51 -07:00
Arindam Nath d6d50a15a2 mmc: sd: add support for driver type selection
This patch adds support for setting driver strength during UHS-I
initialization procedure. Since UHS-I cards set S18A (bit 24) in
response to ACMD41, we use this as a base for UHS-I initialization.
We modify the parameter list of mmc_sd_get_cid() so that we can
save the ROCR from ACMD41 to check whether bit 24 is set.

We decide whether the Host Controller supports A, C, or D driver
type depending on the Capabilities register. Driver type B is
suported by default. We then set the appropriate driver type for
the card using CMD6 mode 1. As per Host Controller spec v3.00, we
set driver type for the host only if Preset Value Enable in the
Host Control2 register is not set. SDHCI_HOST_CONTROL has been
renamed to SDHCI_HOST_CONTROL1 to conform to the spec.

Tested by Zhangfei Gao with a Toshiba uhs card and general hs card,
on mmp2 in SDMA mode.

Signed-off-by: Arindam Nath <arindam.nath@amd.com>
Reviewed-by: Philip Rakity <prakity@marvell.com>
Tested-by: Philip Rakity <prakity@marvell.com>
Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24 23:53:24 -04:00
Andrei Warkentin 32780cd135 mmc: quirks: Extends card quirks with MMC/SD quirks matching the CID.
The current mechanism is SDIO-only. This allows us to create
function-specific quirks, without creating messy Kconfig dependencies,
or polluting core/ with function-specific code.

Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24 21:00:54 -04:00
Ohad Ben-Cohen 2059a02dcb mmc: add MMC_QUIRK_DISABLE_CD
006ebd5d introduced sdio_disable_cd(), which disconnects the pull-up
resistor on CD/DAT[3] (pin 1) of the card.

Make it possible to start using sdio_disable_cd() by introducing
MMC_QUIRK_DISABLE_CD.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24 21:00:01 -04:00
Ohad Ben-Cohen eab4068795 mmc: add MMC_QUIRK_NONSTD_FUNC_IF
Introduce MMC_QUIRK_NONSTD_FUNC_IF to ignore the "SDIO Standard Function
interface code" as indicated by the card's FBR, and instead treat all
functions as non-standard interfaces.

This is required to prevent standard drivers from facing
errors when trying to communicate with SDIO cards that erroneously
indicate standard function interface codes.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24 20:59:52 -04:00
Ohad Ben-Cohen 6b93d01fe5 mmc: do not switch to 1-bit mode if not required
6b5eda36 followed SDIO spec part E1 section 8, which states that
in case SDIO interrupts are being used to wake up a suspended host,
then it is required to switch to 1-bit mode before stopping the clock.

Before switching to 1-bit mode (or back to 4-bit mode on resume),
make sure that SDIO interrupts are really being used to wake the host.

This is helpful for devices which have an external irq line (e.g.
wl1271), and do not use SDIO interrupts to wake up the host.

In this case, switching to 1-bit mode (and back to 4-bit mode on resume)
is not necessary.

Reported-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24 20:59:47 -04:00
Ohad Ben-Cohen a5e9425d20 mmc: mmc_card_keep_power cleanups
mmc_card_is_powered_resumed is a mouthful; instead, simply use
mmc_card_keep_power, which also better explains the purpose of
the macro.

Employ mmc_card_keep_power() where possible.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24 20:59:43 -04:00
Stefan Nilsson XK 0aab399548 mmc: sdio: remember new card RCA when redetecting card
During redetection of a SDIO card, a request for a new card RCA
was submitted to the card, but was then overwritten by the old RCA.
This caused the card to be deselected instead of selected when using
the incorrect RCA.  This bug's been present since the "oldcard"
handling was introduced in 2.6.32.

Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
Reviewed-by: Ulf Hansson <ulf.hansson@stericsson.com>
Reviewed-by: Pawel Wieczorkiewicz <pawel.wieczorkiewicz@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <stable@kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-17 15:35:09 -04:00
Pierre Tardy 57f0adc7ea mmc: add per device quirk placeholder
Some cards have quirks valid for every platforms using current
platform quirk hooks leads to a lot of code and debug duplication.

So we inspire a bit from what exists in PCI subsystem and do our own
per vendorid/deviceid quirk.  We still drop the complexity of the pci
quirk system (with special section tables, and so on).
That can be added later if needed.

Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-15 13:48:33 -04:00
Dmitry Shmidt 34497913f2 mmc: sdio: Allow sdio operations in other threads during sdio_add_func()
This fixes a bug introduced by 807e8e4067 ("mmc: Fix sd/sdio/mmc
initialization frequency retries") that prevented SDIO drivers from
performing SDIO commands in their probe routines -- the above patch
called mmc_claim_host() before sdio_add_func(), which causes a deadlock
if an external SDIO driver calls sdio_claim_host().

Fix tested on an OLPC XO-1.75 with libertas on SDIO.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Reviewed-and-Tested-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-07 16:55:44 -05:00
Andy Ross 807e8e4067 mmc: Fix sd/sdio/mmc initialization frequency retries
Rewrite and clean up mmc_rescan() to properly retry frequencies lower
than 400kHz.  Failures can happen both in sd_send_* calls and
mmc_attach_*.  Break out "mmc_rescan_try_freq" from the frequency
selection loop.  Symmetrize claim/release logic in mmc_attach_* API,
and move the sd_send_* calls there to make mmc_rescan easier to read.

Signed-off-by: Andy Ross <andy.ross@windriver.com>
Reviewed-and-Tested-by: Hein Tibosch <hein_tibosch@yahoo.es>
Reviewed-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-01-08 23:52:25 -05:00
Ohad Ben-Cohen 080bc9774b mmc: sdio: don't reinitialize nonremovable powered-resumed cards
Upon system resume, SDIO core must reinitialize cards that were
powered off during suspend.

If the card had its power kept during suspend (and thus it is
'powered-resumed'), SDIO core performs only a limited reinitializing,
mainly needed to make sure that the card wasn't removed/replaced.

If a __nonremovable__ card is powered-resumed, we can safely skip the
reinitializing phase.

Note: 9b966aa (mmc: sdio: fully reconfigure oldcard on resume) removed
the bus width reconfiguration since mmc_sdio_init_card already does it.
It is brought back now in case mmc_sdio_init_card is skipped.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-01-08 22:48:17 -05:00
Takashi Iwai 8f230f454f mmc: Add support for JMicron 388 SD/MMC controller
JMicron 388 SD/MMC combo controller supports the 1.8V low-voltage for
SD, but MMC doesn't work with the low-voltage, resulting in an error
at probing.

This patch adds the support for multiple voltage mask per device type,
so that SD works with 1.8V while MMC forces 3.3V.  Here new ocr_avail_*
fields for each device are introduced, so that the actual OCR mask is
switched dynamically.

Also, the restriction of low-voltage in core/sd.c is removed when the
bit is allowed explicitly via ocr_avail_sd mask.

This patch was rewritten from scratch based on Aries' original code.

Signed-off-by: Aries Lee <arieslee@jmicron.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-01-08 22:48:04 -05:00
Ohad Ben-Cohen ed919b0125 mmc: sdio: fix runtime PM anomalies by introducing MMC_CAP_POWER_OFF_CARD
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-11-19 17:07:01 -05:00
Ohad Ben-Cohen 4d0812c37f mmc: sdio: fix nasty oops in mmc_sdio_detect
Power off the card in mmc_sdio_detect __before__ a potential error
handler, which completely removes the card, executes, and only if the
card was successfully powered on beforehand.

While we're at it, use the _sync variant of the runtime PM put API, in
order to ensure that the card is left powered off in case an error
occurred, and the card is going to be removed.

Reproduced and tested on the OLPC XO-1.5.

Reported-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-11-19 17:06:52 -05:00