kernel/kernel-mfld-blackbay.git
13 years agointel_sst: Fix firmware download failure post S0i3
Dharageswari R [Thu, 6 Oct 2011 15:18:23 +0000 (16:18 +0100)]
intel_sst: Fix firmware download failure post S0i3

This patch saves the csr register value during suspend, restores it back in
resume and fixes the firmware download failure post S0i3

Change-Id: If60b1d209b3e3e3db7c4403387c0d8e5f54111e1
Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
13 years agointel_sst: update the driver version
Ramesh Babu K V [Thu, 6 Oct 2011 15:18:23 +0000 (16:18 +0100)]
intel_sst: update the driver version

Change the driver version to 2.0.01.  This driver version implements
dynamically handling OSC_CLK0 during RTPM, in addition to other RTPM changes.

Change-Id: Ib4717e76df16139489d6aa7ff7a99234e6127d7f
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
13 years agoASoC: sn95031: mfld_machine: Enable SPI Vibra controller
Vinod Koul [Thu, 6 Oct 2011 15:18:23 +0000 (16:18 +0100)]
ASoC: sn95031: mfld_machine: Enable SPI Vibra controller

This patch adds the TI codec driver changes for supporting the SPI control mode
for the Vibra devices. The PCM vibra path is also removed.

Change-Id: I838389f6a53a4347a14b22876e83bb6ea301abfa
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agoASoC: sn95032: hardware volume and mute controls for sn95038 codec driver
Ramesh Babu K V [Thu, 6 Oct 2011 15:18:22 +0000 (16:18 +0100)]
ASoC: sn95032: hardware volume and mute controls for sn95038 codec driver

This patch adds alsa mixer digital volume controls to headphone and spekaer
paths.  Application can control left and right volume individually for each
path.

Change-Id: I514ee1a6f72fde1db53721198a190a17c1150bab
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
13 years agoASoC: sn95031: sst_platform: set_params support in sn95031 codec and sst platorm
Ramesh Babu K V [Thu, 6 Oct 2011 15:18:22 +0000 (16:18 +0100)]
ASoC: sn95031: sst_platform: set_params support in sn95031 codec and sst platorm

This patch configures sn95031 codec to 24 bit word format.
Codec driver implements set_params and platform driver

Change-Id: I303d7550a531903c637fa31be1bf0aa9c9585747
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
13 years agoASoC: sst_platform: intel_sst: Audio fix the runtime PM bug when stop media is called
Vinod Koul [Thu, 6 Oct 2011 15:18:22 +0000 (16:18 +0100)]
ASoC: sst_platform: intel_sst: Audio fix the runtime PM bug when stop media is called

During stop media, the driver usage count remains 1, this cause the device to
not get suspended. This patch ensure that force close of media service which
makes a direct free to call to driver doesnt cause runtime counter to incremenat
and device goes to suspend when idle

Change-Id: I7c01baf04eacffa61a2251972ec336e83c1b433f
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agoASoC: sn95031: voice call support in codec driver
Ramesh Babu K V [Thu, 6 Oct 2011 15:18:21 +0000 (16:18 +0100)]
ASoC: sn95031: voice call support in codec driver

This patch enables PCM1 port of MSIC.  The codec driver will
have it's own dai, hence there will be new device "Voice" for
this sound card.

Change-Id: Ic21163d2731bd8df10759062687dee952a8b4243
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agoASoC: sst_platform: intel_sst: fix the runtime pm when stream is kept open
Vinod Koul [Thu, 6 Oct 2011 15:18:21 +0000 (16:18 +0100)]
ASoC: sst_platform: intel_sst: fix the runtime pm when stream is kept open

This patch does intelligent idle detction in driver and suspends LPE when not
in use.

Change-Id: Ib600b6f8b0ad0609cd3bbf3560f7b0754a413fb8
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agoASoC: mfld_machine: add voice dai support in mfld machine driver
Ramesh Babu K V [Thu, 6 Oct 2011 15:18:21 +0000 (16:18 +0100)]
ASoC: mfld_machine: add voice dai support in mfld machine driver

This patch adds support voice dai in machine driver.

Change-Id: I77356d4eeb7fcca5304fc109cd6d409d0ffc453d
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agoASoC: sst_platform: voice call support in platform driver
Ramesh Babu K V [Thu, 6 Oct 2011 15:18:21 +0000 (16:18 +0100)]
ASoC: sst_platform: voice call support in platform driver

Voice dai insided the platfor driver is a dummy dai.  It doesn't have
any standard alsa dma capabilities.  Voice dai only supports open, close and
set_params alsa apis.

Change-Id: I508d9ebca777ef3e23659e11b881fa4b52d5de41
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agointel_sst: control penwell OSC_CLK_OUT0 clock during suspend/resume
Ramesh Babu K V [Thu, 6 Oct 2011 15:18:20 +0000 (16:18 +0100)]
intel_sst: control penwell OSC_CLK_OUT0 clock during suspend/resume

This patch disables/enables the OSC_CLK_OUT0 during suspend/resume.
OSC_CLK_OUT0 is connected to MSIC PLLIN and it needs to be
disabled during audio suspend to get low power numbers.

Change-Id: I83b43cc24e6ff1c21270403b5cc771714f3d8e7c
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agoASoC: sst_platform: add 16bit, 44.1K support in audio
Vinod Koul [Thu, 6 Oct 2011 15:18:20 +0000 (16:18 +0100)]
ASoC: sst_platform: add 16bit, 44.1K support in audio

Change-Id: Iebb065a2351544f63dcc72e44bf3c8fd945069f8
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agointel_sst: ASoC: sst_platform: fix the changes required for asoc driver interface...
Vinod Koul [Thu, 6 Oct 2011 15:18:20 +0000 (16:18 +0100)]
intel_sst: ASoC: sst_platform: fix the changes required for asoc driver interface to work

This patch changes the sst driver not to call the old sound card ops during
playback and other operations

Change-Id: If399630e12c8bfd75dbc8a938918a93eacccb2cc
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
13 years agointel_sst: Fix for First audio playback through media player
Dharageswari R [Thu, 6 Oct 2011 15:18:19 +0000 (16:18 +0100)]
intel_sst: Fix for First audio playback through media player

This audio driver fixes the following issue:
Cannot play the music and appear the error of .W/AudioTrack( 1233):
obtainBuffer timed out.

Change-Id: I0f12d74f0f3ecb49fc6928986919308f4b005d73
Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agointel_sst: Addition of pcm delay field
Dharageswari.R [Thu, 6 Oct 2011 15:18:19 +0000 (16:18 +0100)]
intel_sst: Addition of pcm delay field

This audio driver patch includes the addition of pcm_delay field for
the Audio Video sync.

Change-Id: I225a2068737efebf2484b0ea63e3a261e0047141
Signed-off-by: Dharageswari.R <dharageswari.r@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agoASoC: mfld_machine: fix the asoc sound card list initialzation
Vinod Koul [Thu, 6 Oct 2011 15:18:19 +0000 (16:18 +0100)]
ASoC: mfld_machine: fix the asoc sound card list initialzation

This initilzates the sound card soc list initialization

Change-Id: Iaa529d6437658598975bb3aa39806ab477ab0191
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agointel_sst: 16-Bit and 44.1 frequency support
Dharageswari.R [Thu, 6 Oct 2011 15:18:18 +0000 (16:18 +0100)]
intel_sst: 16-Bit and 44.1 frequency support

This patch includes the audio driver support for 16 bit and 44.1
frequency only.

Change-Id: I425edbd3ad620403d1b9350ae03f7a6a452fbc5e
Signed-off-by: Dharageswari.R <<dharageswari.r@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agox86, mrst: add ASoC platform devices and audio resources
Dharageswari R [Thu, 6 Oct 2011 15:18:18 +0000 (16:18 +0100)]
x86, mrst: add ASoC platform devices and audio resources

This patch makes LPE to run with 50MHz with SCU FW support.

Change-Id: I92ab06da7c22b123f084302b01a467e6221d4d48
Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agosst: avoid unnecessary firmware reloading for MRST
Feng Tang [Fri, 8 Jul 2011 08:59:26 +0000 (09:59 +0100)]
sst: avoid unnecessary firmware reloading for MRST

SST HW on MRST doesn't need to reload the firmware during suspend/resume
cycle, so remove the extra workload. This also fix a bug that the firmware
sample rate can't be modified when there is no active playback/capture
stream.

Change-Id: If8159e1100824b5d96afec9952d5f9960d365f4c
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agosst: report correct jack event
Lu Guanqun [Fri, 8 Jul 2011 08:59:10 +0000 (09:59 +0100)]
sst: report correct jack event

The status of jack event is compared bitwise:

[in sound/core/jack.c:snd_jack_report()]
for (i = 0; i < ARRAY_SIZE(jack_switch_types); i++) {
int testbit = 1 << i;
if (jack->type & testbit)
input_report_switch(jack->input_dev,
    jack_switch_types[i],
    status & testbit);
}

So in order to report the correct events, 3 should be passed instead of 1.

Change-Id: I8a0d8c959340fab44acd11ed46dc4c763a493b36
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoASoC: core - Optimise and refactor pcm_new() to pass only rtd
Liam Girdwood [Tue, 7 Jun 2011 15:08:33 +0000 (16:08 +0100)]
ASoC: core - Optimise and refactor pcm_new() to pass only rtd

Currently pcm_new() passes in 3 arguments :- card, pcm and DAI.

Refactor this to only pass in 1 argument (i.e. the rtd) since struct rtd contains
card, pcm and DAI along with other members too that are useful too.

Change-Id: I46fa671e8ccca581475699366b687461435ac5aa
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 years agostaging: intel_sst: Fix memory leak
Andre Bartke [Tue, 31 May 2011 19:03:56 +0000 (21:03 +0200)]
staging: intel_sst: Fix memory leak

In case of an error stream_bufs is not freed here.

Change-Id: I048acbc8761f7cb718752cf4215ab64553042e08
Signed-off-by: Andre Bartke <andre.bartke@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoWATCHDOG: Enable intel_scu_watchdog driver, otherwise the firmware would
Fei Yang [Tue, 25 Oct 2011 00:12:16 +0000 (17:12 -0700)]
WATCHDOG: Enable intel_scu_watchdog driver, otherwise the firmware would
reset the cpu approximately every 75s. This is a copy from UMG K35 kernel
tree, up to the following commit

commit 8ec47127745d548a591db2308f58a5ceeb4599c9
Author: mgross <mark.gross@intel.com>
Date:   Tue Oct 4 12:24:20 2011 -0700

    watchdog: detect spining in kernel and treat them as softlock ups

    BZ: 10041

    Updated watch dog to detect soft lock ups and provide WARN data to help
    debug soft lock ups in drivers that don't wedge the system so much that
    the watch dog stops getting kicked.

    The works by computing the amount of system time between the SCU warning
    interupt and the SOFT_LOCK_TIMEOUT which is 10 seconds.  If the system
    time on any cpu is within 10ms of the duration of the sample time (about
    10 sec in jiffies) then we assume that CPU has a driver wedge and needs
    to be reset.  It calls panic to get the trace data logged to the emmc
    panic area.

    Change-Id: I2b4a5bff99bae86f7431f28d161b57973774ea0a
    Reviewed-on: http://android.intel.com:8080/20482
Reviewed-by: Allyn, Mark A <mark.a.allyn@intel.com>
Tested-by: Allyn, Mark A <mark.a.allyn@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: Mangalampalli, Jayant <jayant.mangalampalli@intel.com>
Change-Id: Ib91d869741681ffb0190a2b57056192705b03687
Signed-off-by: Fei Yang <fei.yang@intel.com>
13 years agohsu with pm
sathya [Tue, 25 Oct 2011 01:38:14 +0000 (18:38 -0700)]
hsu with pm

Change-Id: Iae0bd31900f9d8987ec48ecd04835b02003efaae

13 years agommc: core: remove mmc bus legacy suspend/resume method
Chuanxiao Dong [Fri, 21 Oct 2011 01:53:53 +0000 (09:53 +0800)]
mmc: core: remove mmc bus legacy suspend/resume method

BZ: 4379

MMC bus suspend/resume was using legacy method. In system entering
S3 patch, the suspend/resume function cannot be called since MMC
bus also implemented the new suspend/resume method. So if dev_pm_ops
is defined but .suspend/.resume callbacks are not, then mmc_queue will
not be suspended/resumed

This patch will remove the legacy suspend/resume method and change to
use the new method totally.

Change-Id: I1dea4901910874f853fcb4e4c412e91df47a34d0
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
13 years agommc: core: resolve dead lock problem in pm_notify
Chuanxiao Dong [Thu, 20 Oct 2011 10:54:15 +0000 (18:54 +0800)]
mmc: core: resolve dead lock problem in pm_notify

BZ 2106

when pm_suspend() is called, in mmc_pm_notify() it will call mmc_claim_host(),
in host->bus_ops->remove(host), that is mmc_sd_remove(), at last it will
call mmc_cleanup_queue(), suspend thread will wait the mmcqd/2 thread to stop,
but in mmcqd/2 thread, mmc_blk_issue_rw_rq() will call mmc_clain_host(),
mmcqd/2 thread will wait in mmc_clain_host(), it will cause dead lock.

Change-Id: I05462d71066c4182ab01934fe64a87957ab47c6a
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
13 years agommc: remove legacy PM method for MFLD SDHCI host driver
Chuanxiao Dong [Thu, 20 Oct 2011 10:51:36 +0000 (18:51 +0800)]
mmc: remove legacy PM method for MFLD SDHCI host driver

BZ 1707

PCI core only prefer one of legacy PM and new PM. And we need to implement
runtime pm, we have already been using new PM method, so remove the legacy PM
method.

Change-Id: I67e042f283005e1b136d22735998b3be10dd5ce9
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
13 years agoREVERTME: mmc: sdhci: set SD_CD_PIN alternate function
Chuanxiao Dong [Thu, 20 Oct 2011 10:00:25 +0000 (18:00 +0800)]
REVERTME: mmc: sdhci: set SD_CD_PIN alternate function

With runtime pm enabled, SD detection should be enabled by
changing GPIO_ANO_69 alternate function to be normal.
This configuration cannot be done kernel. This should be done
by IFWI in very earlier state.

So the final change should be in IFWI(e.g. xml setting file) but
not in kernel. Before IFWI is ready, we keep this HACK.

Change-Id: Ief20c3aa686c62d41389afb7aed4bf1aad950889
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
13 years agommc: core: calculate the max_discard_to for all mmc card
Chuanxiao Dong [Thu, 20 Oct 2011 09:36:53 +0000 (17:36 +0800)]
mmc: core: calculate the max_discard_to for all mmc card

To support erase/trim feature, MFLD host need a suitable
max_discard_sectors. Currently, if not enable ERASE_GROUP_DEF,
then driver will choose pref_erase which is not suitable for
MFLD host.

MFLD host still need driver to calculate a correct max_discard_sectors
but not directly use pref_erase. This patch will help to do so

Change-Id: I29a82bfcefa948e7e698a2170e30a2639bf954c3
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
13 years agommc: sdhci-pci: add runtime pm support
Adrian Hunter [Mon, 3 Oct 2011 12:33:34 +0000 (15:33 +0300)]
mmc: sdhci-pci: add runtime pm support

Ths patch allows runtime PM for sdhci-pci, runtime suspending after
inactivity of 50ms and ensuring runtime resume before SDHC registers
are accessed.  During runtime suspend, interrupts are masked.
The host controller state is restored at runtime resume.

For Medfield, the host controller's card detect mechanism is
supplanted by an always-on GPIO which provides for card detect wake-up.

Change-Id: I0c054e7591f017b81f6efe3637ed870ae8253910
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: core: move->request() call from atomic context
Chuanxiao Dong [Wed, 19 Oct 2011 10:28:34 +0000 (18:28 +0800)]
mmc: core: move->request() call from atomic context

mmc_request_done() is sometimes called from interrupt or other atomic
context.  Mostly all mmc_request_done() does is complete(), however it
contains code to retry on error, which uses ->request().  As the error
path is certainly not performance critical, this may be moved to the
waiting function mmc_wait_for_req_done().

This allows ->request() to use runtime PM get_sync() and guarantee it
is never in an atomic context.

Change-Id: I9a13ec8f6d41b7fef8497dd7c2e794bb32585cd6
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
13 years agommc: block: support no access to boot partitions
Adrian Hunter [Fri, 23 Sep 2011 09:48:21 +0000 (12:48 +0300)]
mmc: block: support no access to boot partitions

Intel Medfield platform blocks access to eMMC boot partitions which
results in switch errors.  Since there is no access, mmcboot0/1
devices should not be created.  Add a host capability to reflect that.

Change-Id: I95d4c3788e8890d117b58bd36a449e2d9e35dd68
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: add eMMC hardware reset support
Adrian Hunter [Mon, 29 Aug 2011 13:42:15 +0000 (16:42 +0300)]
mmc: block: add eMMC hardware reset support

For cards that support hardware reset (just eMMC), try a reset and
retry before returning an I/O error.  However this is not done for
ECC errors and is never done twice for the same operation type
(READ, WRITE, DISCARD, SECURE DISCARD) until that type of operation
again succeeds.

Change-Id: I779d4d49a868a41bb058f58dc558a06934658b53
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci-pci: add eMMC hardware reset support
Adrian Hunter [Mon, 29 Aug 2011 13:42:13 +0000 (16:42 +0300)]
mmc: sdhci-pci: add eMMC hardware reset support

Implement eMMC hardware reset for Medfield.

Change-Id: If76373ca36d63d19ae64c9a7303be511c75dec0d
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci: add eMMC hardware reset support
Adrian Hunter [Mon, 29 Aug 2011 13:42:12 +0000 (16:42 +0300)]
mmc: sdhci: add eMMC hardware reset support

Add an SDHCI operation for hardware reset and connect it to the
host controller operation.

Change-Id: I5d855aa804f09d9faccf9da799551e1abb079a5e
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: core: add eMMC hardware reset support
Adrian Hunter [Mon, 29 Aug 2011 13:42:11 +0000 (16:42 +0300)]
mmc: core: add eMMC hardware reset support

eMMC's may have a hardware reset line.  This patch provides a
host controller operation to implement hardware reset and
a function to reset and reinitialize the card.  Also, for MMC,
the reset is always performed before initialization.

The host must set the new host capability MMC_CAP_HW_RESET
to enable hardware reset.

Change-Id: I7658376627faf36f1e02e98df1ef9cc414e5b2cd
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agoRevert "sdhci: Add runtime pm support for sdhci-pci"
Chuanxiao Dong [Wed, 19 Oct 2011 09:53:23 +0000 (17:53 +0800)]
Revert "sdhci: Add runtime pm support for sdhci-pci"

This reverts commit 58b9f466b5a0f6d4324c433d2e450d7a4a92a697.

Change-Id: I1e990a7774820343d0aee445b5e649bb78c37d8f

13 years agoRevert "sdhci: correct clk_gate runtime_pm init"
Chuanxiao Dong [Wed, 19 Oct 2011 09:48:15 +0000 (17:48 +0800)]
Revert "sdhci: correct clk_gate runtime_pm init"

This reverts commit e82e08ed17110e6ab73fc9c5b9a74cd93e2a6c37.

Change-Id: I2f2e612b6e4e03937f73e0d4406830ff802a0f65

13 years agoRevert "mmc: sdhci: don't try to do anything during power off"
Chuanxiao Dong [Wed, 19 Oct 2011 09:47:54 +0000 (17:47 +0800)]
Revert "mmc: sdhci: don't try to do anything during power off"

This reverts commit 80b9b1a37fb230dd03716669ee24c5ad0631880f.

Change-Id: Icb1f392eb2b667f4b9c77315233b9a4708a327b5

13 years agoRevert "MMC: Merge two patches from UMG 2.6.35"
Chuanxiao Dong [Wed, 19 Oct 2011 09:47:35 +0000 (17:47 +0800)]
Revert "MMC: Merge two patches from UMG 2.6.35"

This reverts commit c435aacac11c4c54e45ad25a8dea6d81d7f5e835.

Change-Id: Icc5525c3d432868c2e36e2d0cc639c7919f8b953

13 years agoconfig: enable optimize inlining
German Monroy [Mon, 17 Oct 2011 23:32:28 +0000 (16:32 -0700)]
config: enable optimize inlining

without this... android's init process crashes!!!

Need to find out why

Change-Id: I722dee36a86944cf9d39681a84a0fdb81b933e62

13 years agomerge of related commits
German Monroy [Thu, 13 Oct 2011 19:51:52 +0000 (12:51 -0700)]
merge of related commits
config: bring from Mark and Fei's commit dc0d78f4

config: non relocatable + start addresses

Change - Id: I35f8dcdd5805b3724bb1cc4387662c638791bdee

config: enable adb, disable eth gadget
Change - Id: I03c9ad343af9bb164c8d0190f6fb4d5773e5960c

Change-Id: I7b0e05aa0abb64ba5bd4ff1c5324bbc9e02044e2

13 years agomerge of reated changes
German Monroy [Fri, 30 Sep 2011 00:39:30 +0000 (17:39 -0700)]
merge of reated changes
kernel build: add Android makefile

So that this kernel can be compiled together with the rest of Android
(i.e. build automatically creates boot.bin)

Change-Id: I7f59d0d17ed267e101f0cee2f75a5893de5cfbcb

kbuild: add a make defoldconfig make option

The oldconfig option is asking user to choose when new config options are defined in KConfig files, and not in .config
This prevents automatic builds.

This make target will use default values for all options not specified in .config

xxChange - Id: I713a5cc248130056441060dccfcb492ad0d8acb5
Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
Change-Id: I5f12ca9bc66ba7ac54bc205319c23d2875c0ea6f

13 years agoUSB: Merge the following changes from UMG 2.6.35 tree
Fei Yang [Thu, 6 Oct 2011 23:27:37 +0000 (16:27 -0700)]
USB: Merge the following changes from UMG 2.6.35 tree

Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
Signed-off-by: Fei Yang <fei.yang@intel.com>
commit 6a9f1076fde6cbcac68d51efe0bf8c8776d57f42
Author: jzhuan5 <jin.can.zhuang@intel.com>
Date:   Fri Sep 16 17:03:33 2011 -0400

    usb: langwell_udc: protect access to ep->desc and clear Auto low power featu

    BZ: 9110

    Two issue fixed:
    1. When langwell_ep_queue is being called, there could be interrupts, then e
    is set NULL, after returning from interrupt, langwell_ep_queue() calls queue
    which will access ep->desc without checking it, this leads to NULL pointer k

    The patch adds lock protection to ep->desc to avoid this.

    2. The auto low power feature is causing fabric error when calling langwell_
    in some extreme timing situtation. In this bug, langwell_ep_disable() is cal
    after bus suspend is received by device controller. If auto low power featur
    PHCD bit will be set by controller automatically. Then, langwell_ep_disable(
    fabric error.

    Since langwell_udc driver has not utilized this feature, this patch simply d

    Change-Id: Ia95d9ee9dee22c19e55f046b62a864a2fb4bd084
Signed-off-by: jzhuan5 <jin.can.zhuang@intel.com>
    Reviewed-on: http://android.intel.com:8080/18772
Reviewed-by: Yin, Fengwei <fengwei.yin@intel.com>
Tested-by: Yin, Fengwei <fengwei.yin@intel.com>
commit cfbe81d988a2201ca0a02fa33481f0f014cab3ab
Author: Wu, Hao <hao.wu@intel.com>
Date:   Thu Sep 1 22:24:24 2011 +0800

    usb/penwell_otg: increase ulpi access timeout

    BZ:  7272

    This patch increase the timeout for each ulpi access via
    PNW USB controller to MSIC ULPI registers, to increase
    tolerance for bad case.

    Change-Id: I5ee9769ba990f591744d08e4fc2147037f57fab6
Signed-off-by: Wu, Hao <hao.wu@intel.com>
    Reviewed-on: http://android.intel.com:8080/17034
Reviewed-by: buildbot <buildbot@intel.com>
Reviewed-by: Yin, Fengwei <fengwei.yin@intel.com>
Tested-by: Yin, Fengwei <fengwei.yin@intel.com>
commit 02bbb3bf258225f59fcd4f28827ae77d817db2d6
Author: jzhuan5 <jin.can.zhuang@intel.com>
Date:   Thu Sep 1 16:38:58 2011 -0400

    usb: client: Fix the issue of test mode fail in TEST_PACKET

    BZ:  8285 8779

    PET sends set_feature request to enable USB client to a state of TEST MODE.
    After the completion of status stage, USB client should enable TEST MODE by
    programming PORTSC1 register. Also stop TEST MODE after USB device power
    cycle according to USB Spec.

    Change-Id: Ie973dabd227ddde6fdbea30e55866ee07b9bb884
Signed-off-by: jzhuan5 <jin.can.zhuang@intel.com>
Signed-off-by: Wu, Hao <hao.wu@intel.com>
    Reviewed-on: http://android.intel.com:8080/17146
Reviewed-by: Yin, Fengwei <fengwei.yin@intel.com>
Tested-by: Yin, Fengwei <fengwei.yin@intel.com>
commit 87f8a45120ee13c30100d687499be97c6d31bf04
Author: Yu Wang <yu.y.wang@intel.com>
Date:   Fri Aug 26 17:14:19 2011 +0800

    usb: langwell_udc: fix flush ep met fabric error.

    BZ:  7888

    When UDC flush ep, sometimes system met fabric error. The root cause is
    before flush ep, PHY would exit low power mode. And there is a latency
    in HW did this operation, if driver access UDC during this latency,
    system will meet fabric error.

    This patch add 3 millisecond delay to ensure the PHY HW exit low power
    mode, then operate UDC.

    Change-Id: I39992616c58e3c89789830413a323439ba785764
Signed-off-by: Yu Wang <yu.y.wang@intel.com>
commit d4252773bed09a139437efc975c78b1d684c527e
Author: jzhuan5 <jin.can.zhuang@intel.com>
Date:   Fri Aug 26 12:00:58 2011 -0400

    usb: otg: Disable MSIC interrupt when system is shutting down

    BZ:  7832

    This patch implements shutdown callback of penwell_otg driver.
    The shutdown callback disables MSIC interrupts to prevent from
    disturbing the process of system shutdown.
Signed-off-by: jzhuan5 <jin.can.zhuang@intel.com>
    Change-Id: I3de7f54d09b5b9b06304775403115e5932b28b72

commit 14a840ae3eb1d4d7dc886e332abd8afb0840633d
Author: Wu, Hao <hao.wu@intel.com>
Date:   Tue Aug 16 01:44:35 2011 +0800

    usb/penwell_otg: fix PD_DCP detection compliance Test issue.

    BZ:  4360

    This patch add 1ms sleep between Primary and Secondary Detection,
    and assert VDPSRC when DCP detected and attached. This resolved
    BC1.2 compliance test case PD_DCP issue.

    Change-Id: I9cf3b71e33a795748702a3cf582b8fa51abc6a11
Signed-off-by: Wu, Hao <hao.wu@intel.com>
commit 1c3d68c874898e90442c2dfb541c8dd2397a3749
Author: Wu, Hao <hao.wu@intel.com>
Date:   Wed Aug 3 04:00:10 2011 +0800

    usb/langwell_udc: fix some issue to avoid blocking into D0i1.

    BZ:  6378
    This patch is from Borqs, resolve issue if ep flush timeout, then
    USB D0i1 state will be blocked.

    Change-Id: I9697cc2c310db20b337e8dd9032f1eb951a0f2e5
Signed-off-by: Wu, Hao <hao.wu@intel.com>
commit 63e1d6fa995a95991b668d34126017629909099c
Author: Wu, Hao <hao.wu@intel.com>
Date:   Fri Jul 29 19:02:15 2011 +0800

    usb/penwell_otg: manual charger detection flow

    BZ:  2921

    This is a SW workaround for a hardware issue which cause charging
    failure, using manual charger detection flow instead of original one
    to avoid this hardware issue.
    Please note that the new flow using ULPI, only works on PNW C0 or later
    version.

    Change-Id: I1941c2dd7364b13b7354995f0eb5a3a6ec2da402
Signed-off-by: Wu, Hao <hao.wu@intel.com>
commit 1ad65047b445da5455da82b8b05b168516979b56
Author: Wu, Hao <hao.wu@intel.com>
Date:   Thu Jul 28 02:45:12 2011 +0800

    usb/penwell_otg: enable OTG_VBUS_OFF test mode for compliance test

    BZ:  5895

    This patch enabled OTG_VBUS_OFF test mode in driver for USB OTG 2.0 complian
    case CT_A_CAP (OTG Compliance Plan 8.1.2 A-UUT Bypass Capacitance).

    Change-Id: I07891cb9d1138e620361b30c7d894b0f5f4dfec4
Signed-off-by: Wu, Hao <hao.wu@intel.com>
commit 105bf83d769f9b5a4fc13287595080a236df4ece
Author: Wu, Hao <hao.wu@intel.com>
Date:   Fri Jul 15 03:50:30 2011 +0800
    usb/penwell:  fix incorrect charging current when USB is in unconfigured sta

    BZ: 5146

    This patch is for USB OTG2.0 Compliance issue, after a USB reset, USB will
    be back to unconfigured state, then only can draw less than IB_UNCFG max
    (2.5mA) current from connected SDP. This patch add related action triggered
    by USB reset event.

    Change-Id: I4d325de485e468b0bd808c0ccebc2aadea95768c
Signed-off-by: Wu, Hao <hao.wu@intel.com>
commit 03da966f597139a67f7644a7b17631d06cda5c5e
Author: Yu Wang <yu.y.wang@intel.com>
Date:   Thu Jul 14 16:57:14 2011 +0800

    usb:  langwell_udc: fix pull up USB met fabric error issue.

    BZ: 5087

    After enabled the "USB tethering" from Android settings application,
    pulled up USB cable, board would meet fabric error. The root cause is
    after pulled up USB cable, UDC would go to D0I1 mode. And Android
    framework would find USB cabled was disconnected, then wrote zero to funtion
    enable interface of sysfs. But this sysfs interface hadn't resume UDC to D0
    mode before operated UDC HW, then met fabric error.

    This patch fixes this issue by resume UDC from DOI1 before operating HW
    in langwell_pullup function.

    Change-Id: I9b7c698afec79f0ef355c3053ef9538e8b9dd4e6
Signed-off-by: Yu Wang <yu.y.wang@intel.com>
commit ed3cd9c69c33d5a70f4918e8822413dd95001007
Author: Wu, Hao <hao.wu@intel.com>
Date:   Wed Jul 13 02:29:45 2011 +0800

    usb/penwell:  add SRP test mode support

    BZ: 4974
    This patch is for SRP Test mode support, please refer to USB OTG 2.0
    Spec 6.4.3, OTG Compliance Test 6.3.4.

    Change-Id: Iaba1d89b79c28862a0239c0cf5cc57a00fef8e8c
Signed-off-by: Wu, Hao <hao.wu@intel.com>
commit b49721682faf6a42aecbddfa71ebb10d537cf661
Author: Jiebing Li <jiebing.li@intel.com>
Date:   Fri Jul 1 04:10:08 2011 +0800

    usb:  langwell_udc: fix pull-up enable issue in langwell_pullup()

    BZ: 4154

    Sometimes USB host sends bus_suspend request to device due to
    some reason. When device receives the request, PHY will be put
    into low power suspend by device driver. If at this time
    langwell_pullup() is called by gadget driver to set USBCMD
    Run/Stop bit, the pull-up on D+ will not be enabled as expected.

    This patch fixes the issue by exiting PHY low power in langwell_pullup().

    Change-Id: I1b9836f57e0a25e16eeaa31b3c4319e811a542ad
Signed-off-by: Jiebing Li <jiebing.li@intel.com>
commit 2e1aa820ecc706cde4798ead132629b276bcc84f
Author: Hao Wu <hao.wu@intel.com>
Date:   Mon Jun 20 10:43:42 2011 +0800

    usb/penwell_otg:  enable timer ta_wait_bcon for wait connection state.

    BZ: 4357

    After USB A-cable is inserted into OTG port, USB driver will enable
    Host stack and VBUS power supply, then wait device to connect. Per
    spec, enable the wait timeout as 15s (< 30s max).
    This is for OTG2.0 Compliance Test: 6.2.2 A_UUT Power up Test.

    Change-Id: I4a9ae8c23c26aabb461fa7c5c77b9057cbe6290d
Signed-off-by: Wu, Hao <hao.wu@intel.com>
commit 1163dcda8ec382b08299bf09d01f1f76ba977da7
Author: Hao Wu <hao.wu@intel.com>
Date:   Mon May 30 20:33:41 2011 +0800

    usb/langwell_udc: hold wakelock when USB is connected and not suspended

    BZ: 2824

    This patch enable USB udc driver to hold wake lock when USB is connected
    and usb bus is active state. This will prevent system from trying to enter
    S3 when usb is still alive.

    Change-Id: Ibc2ae6a985ea6d9168265c3ce4227f4a4309eba4
Signed-off-by: Hao Wu <hao.wu@intel.com>
commit 500c0f18a30a222620027446294d913fa3e9a60e
Author: Shanyu Zhao <shanyu.zhao@intel.com>
Date:   Tue May 17 15:31:55 2011 -0700

    USB: Fix commanded stall feature in the device controller

    BZ: 2314

    usbtest TEST CASE 13 - endpoint halt feature fails. Commanded stall
    occurs when host explicitly calls the endpoint's halt feature.
    The set_halt function at the gadget side will not halt theendpoint
    if the queue is not empty. Therefore when the host calls the
    halt feature for some gadget function such as the gadget zero, which
    always put a usb_request in the queue, the halt always  fails.

    To fix the failure, for commanded stall don't check for the queue.
    Also when reset the endpoint the halt flag shall be cleared manually.

    Change-Id: I1f5789a4c8115d46c800ee5b808141cab9c2da20
Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com>
Signed-off-by: Jiebing Li <jiebing.li@intel.com>
commit acb6ef93331fb854408ba0748e26ae6e18c0b653
Author: Shanyu Zhao <shanyu.zhao@intel.com>
Date:   Tue May 17 14:39:52 2011 -0700

    USB:  disable HW zero length termination for device control endpoints
    BZ: 2767

    Since the control endpoints know the expected number of bytes in a
    transaction, zero length termination (zlt) is not needed. If enabled
    the device controller would wait indefinitely for the USB host to send
    an zero length packet which never  happens.

    This fixes the failure of the usbtest TEST CASE 14.

    Change-Id: Ib31f2c6dd87b60c669c265bb87afbead056d536f
Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com>
commit 35eaa2fdf470e9b6bf922ba67ca5ca48fdb8bfd1
Author: Hao Wu <hao.wu@intel.com>
Date:   Fri May 6 13:26:25 2011 +0800

    usb: penwell_otg: use separate suspend/resume functions for D3

    BZ: 1424

    This patch updated penwell_otg driver to use separate resume/suspend
    function for D3 instead of reuse runtime pm functions, they contain
     more state machine handling for USB D3 state, including PHY Low
    power mode setting, timer delete and state transition. It resolved
     unstable issue caused by incorrect handle on USB states and events
     when D3 suspend/resume.

    Change-Id: I94d395a2851b5cfda0c8e2dd49ebd83c92e6aa83
Signed-off-by: Hao Wu <hao.wu@intel.com>
commit e29a44d2438cd13521af9b36719f00ebe8527593
Author: Sundar Iyer <sundar.iyer@intel.com>
Date:   Mon Apr 25 18:53:52 2011 +0530

    usb/penwell_otg: use dev_pm_ops interfaces for D3 suspend/resume.

    BZ:#1378/#1301

    This patch updates the penwell_otg to use .suspend/.resume in the dev_pm_ops
     interface instead of the legacy pci driver suspend/resume functions.
    This patch also removes duplicate pci related opeartions in suspend/resume
    functions.

    Change-Id: I66f2bf841979bc40787d3b3b884583c7b30511d8
Signed-off-by: Sundar Iyer <sundar.iyer@intel.com>
Signed-off-by: Hao Wu <hao.wu@intel.com>
commit 6e2bf9dc73b990dc693ed6413d2f7ddc33df8615
Author: Jiebing Li <jiebing.li@intel.com>
Date:   Tue Apr 19 15:37:46 2011 +0800

    usb: langwell_udc: fix cable unplug issues

    BZ: 1001

    This patch fixed stop USB peripheral stack issue after received unplug event

    Two issues are fixed in this patch:
    1. add dtd_pool pointer check in order to avoid dtd pool free error
    2. remove PHY low power set in order to avoid EP flush timeout

    Change-Id: Ib259268cdffcb0ad30a19dd3258992efe63720cb
Signed-off-by: Jiebing Li <jiebing.li@intel.com>
commit 9e6b9018a137bb68d8c55bcd9a9096a1134693d3
Author: Hao Wu <hao.wu@intel.com>
Date:   Tue Apr 19 14:59:34 2011 +0800

    usb: penwell_otg: fix missing unplug USB cable event.

    BZ: 1001

    This patch is for BZ1001, mainly solve missing unplug USB wall charger
    (DCP) event when USB is in D0i3 and charging from DCP.

    Main change in penwell_otg:
    - Use PNW USB OTGSC status register to check wakeup event.
    - Ensure mode is set and PHY is in low power mode before enter D0i3
    - Remove duplicate PHY low power mode setting.

    Change-Id: I4c842a7b8a10332360b7b7695139666870094284
Signed-off-by: Hao Wu <hao.wu@intel.com>
commit c2846926367114bead0e6cd0f1b4dff6fc6a121f
Author: Hao Wu <hao.wu@intel.com>
Date:   Fri Apr 15 11:36:30 2011 +0800

    usb: penwell_otg: fixing SRP failure.

    Fixing patch for Sighting 3742776: SRP failed

    Change-Id: I64b9446b7ba8b5e87b1e95e87ea20b2682c071f4
Signed-off-by: Hao Wu <hao.wu@intel.com>
commit 3f35456f90c7ff997e078cc9083cfefda4bc4f02
Author: Jiebing Li <jiebing.li@intel.com>
Date:   Thu Mar 10 16:56:26 2011 +0800

    runtime PM mode change in gadget unregister operation

    put usb client to D0 mode in gagdet unregister operation and put it
    back to D0i3 after the operation done

    Change-Id: Ib8fe33f9f46947ed4a9e26458db75f2ae16318d3
Signed-off-by: Jiebing Li <jiebing.li@intel.com>
commit d17c4c027c5c8e0e2e42d9c637cf4452c204b443
Author: Jiebing Li <jiebing.li@intel.com>
Date:   Fri Aug 20 13:49:09 2010 -0700

    linux-2.6.36-usb-penwell-otg-add-aca-device-support.patch

commit 80900b4c8976ec78b12393d64244e2f186998736
Author: Hao Wu <hao.wu@intel.com>
Date:   Fri Aug 20 13:49:09 2010 -0700

    linux-2.6.36-usb-penwell_otg-HACK-resume-controller-before-reg-access.patch

commit f5ec09219efa41149a38930e84cd77dd402ed9dc
Author: Hao Wu <hao.wu@intel.com>
Date:   Fri Aug 20 13:49:09 2010 -0700

    linux-2.6.36-usb-penwell_otg-add-phy-config.patch

commit ede32384e6a8021d6fa9627ead3ac378bafe60e7
Author: Hao Wu <hao.wu@intel.com>
Date:   Fri Aug 20 13:49:09 2010 -0700

    linux-2.6.36-usb-penwell_otg-update-otg-state-machine-for-runtime_pm.patch

commit 7f1584ff3eac1fa4c01762c071c0b5bdeaba0da9
Author: Hao Wu <hao.wu@intel.com>
Date:   Fri Aug 20 13:49:09 2010 -0700

    linux-2.6.36-usb-langwell_udc-add-runtime-pm-support-for-otg.patch

Change-Id: I06a291cee179b1efe450eadf96e278434246742a

13 years agopci_quirks: adding D0i1 in usb hsu and D0i2 in sep
Illyas Mansoor [Tue, 17 May 2011 21:48:21 +0000 (03:18 +0530)]
pci_quirks: adding D0i1 in usb hsu and D0i2 in sep

BZ: 2280

currently USB, HSU don't have d1_supported flag set in pm capabilities
register, hence the D0i1 to D0i0 transition is prevented by
the pci framework. Also d2_supported flag is not set for sep.

This needs to be fixed in the IA FW, till then we add pci quirks
to fix this.

Change-Id: Ib4f1937896dc569472e7dd0dfbd7389f95ce80fd
Signed-off-by: Illyas Mansoor <illyas.mansoor@intel.com>
13 years agoPMU: register choose_state fucntion for MID PCI platform ops with
Fei Yang [Tue, 4 Oct 2011 16:46:59 +0000 (09:46 -0700)]
PMU: register choose_state fucntion for MID PCI platform ops with
pmu_pci_choose_state() implemented in the pmu driver.

The following limitations apply to Medfield SoC,
LSS_04: SECURITY supports only D0i2
LSS_06: USB OTG supports only D0i1
LSS_07: USB HOST supports only D0i1
LSS_41: HSU supports only D0i1

Change-Id: I9ddcd198a3eed09efd7be307e8bc6fefa96e3a59
Signed-off-by: Fei Yang <fei.yang@intel.com>
13 years agopenwell_otg: enable runtime_pm
Kristen Carlson Accardi [Fri, 26 Aug 2011 10:55:08 +0000 (11:55 +0100)]
penwell_otg: enable runtime_pm

runtime_pm was already implemented, but not enabled at probe.

Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agolangwell_otg: enable runtime pm at probe time
Kristen Carlson Accardi [Thu, 25 Aug 2011 11:20:33 +0000 (12:20 +0100)]
langwell_otg: enable runtime pm at probe time

decrement the usage count at probe time and enable runtime pm.
At remove time, prevent runtime pm by incrementing usage count
and forbidding runtime pm.

Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
13 years agoSCU_IPC: Found the following patch is needed as mmc driver is getting probed
Fei Yang [Fri, 23 Sep 2011 17:22:40 +0000 (10:22 -0700)]
SCU_IPC: Found the following patch is needed as mmc driver is getting probed
before intel_scu_ipc driver, thus intel_scu_ipc_command returns -ENODEV. Also
cleanup one compilation warning in intel_scu_ipcutil.c

commit 91c2605a6c2d4098ef2cefca8e3d783ade02468b
Author: Pierre Tardy <pierre.tardy@intel.com>
Date:   Fri Jan 14 11:45:33 2011 +0100

    intel_scu: change init time to early in the boot

    This will resolve lot of problem with gpio not beeing available, and
    other scu capability needed by drivers early in the boot process.

Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
Change-Id: I4db59373fbe9cb2eaa756d02d07b56c9837b1957
Signed-off-by: Fei Yang <fei.yang@intel.com>
13 years agoMMC: Merge two patches from UMG 2.6.35
Fei Yang [Fri, 23 Sep 2011 16:20:41 +0000 (09:20 -0700)]
MMC: Merge two patches from UMG 2.6.35

commit 471bd99eac8935361ada496d59e1b4cc1ad83e90
Author: Chuanxiao Dong <chuanxiao.dong@intel.com>
Date:   Thu Mar 3 13:49:00 2011 +0800

    mmc: emmc mutex support for medfield

    One of the Medfield eMMC controller (PCI device id 0x0823, SDIO3)
    is a shared resource used by the SCU and the IA processors.
    SCU primarily uses the eMMC host controller to access the eMMC device's
    Boot Partition, while the IA CPU uses the eMMC host controller to
    access the eMMC device's User Partition.

    After the SCU hands off the system to the IA processor, the IA processor
    assumes ownership to the eMMC host controller. Due to absence of any
    arbitration at the eMMC host controller, this could result in concurrent
    eMMC host accesses resulting in bus contention and garbage data ending up
    in either of the partitions.

    To circumvent this from happening, eMMC host controller locking mechanism
    is employed, where at any one given time, only one agent, SCU or IA,
    may be allowed to access the host. This is achieved by implementing
    Dekker's Algorithm (http://en.wikipedia.org/wiki/Dekker's_algorithm)
    between the two processors.

    Before handing off the system to the IA processor, SCU must set up three
    housekeeping mutex variables allocated in the shared SRAM as follows:

    eMMC_Owner = IA (SCU and IA processors - RW, 32bit)
    IA_Req = FALSE (IA -RW, SCU - RO, 32bit)
    SCU_Req = FALSE (IA - RO, SCU - R/W, 32bit)

    There is no hardware based access control to these variables and so code
    executing on SCU and IA processors must follow access rules of
    Dekker's algorithm. Detail info about this algorithm can be found in
    comments and code of this patch.

    Change-Id: Iaa27dcf5eaeaed30348073b041d3268890839a8b
Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
commit 9a8b4cc0bc0908006c566fd21c927fdc191fb185
Author: Chuanxiao Dong <chuanxiao.dong@intel.com>
Date:   Thu Mar 3 13:50:02 2011 +0800

    mmc: use emmc mutex api to protect emmc

    Apply the eMMC mutext APIs to protect the critical sections of
    eMMC0 host controller opeartions on Medfield platform.

    Change-Id: I2ff82ab66c05f56b16c50431e27f78c8ee5cfa0b
Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Change-Id: I670b72c18c2bdac4e6165b82f5f60084b1809aa9
Signed-off-by: Fei Yang <fei.yang@yahoo.com>
13 years agommc: mmc_test: avoid stalled file in debugfs
Andy Shevchenko [Fri, 22 Jul 2011 13:13:36 +0000 (16:13 +0300)]
mmc: mmc_test: avoid stalled file in debugfs

During card removal and inserting cycle the test file in the debugfs could be
stalled until the host driver removes it. Let's keep the file in the linked
list and destroy it when card is removed.

Change-Id: I9a8340a2b38ffa9afa3086b0a36c5e75434a16e2
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Per Forlin <per.forlin@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: mmc_test: add debugfs file to list all tests
Per Forlin [Fri, 1 Jul 2011 16:55:25 +0000 (18:55 +0200)]
mmc: mmc_test: add debugfs file to list all tests

Add a debugfs file "testlist" to print all available tests.

Change-Id: I899def93bf537b75748aecc40088c7f8b14b6e7b
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar<sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: mmc_test: test to measure how sg_len affect performance
Per Forlin [Fri, 1 Jul 2011 16:55:27 +0000 (18:55 +0200)]
mmc: mmc_test: test to measure how sg_len affect performance

Add a test that measures how the mmc bandwidth depends on the numbers of
sg elements in the sg list. The transfer size if fixed and sg length goes
from a few up to 512. The purpose is to measure overhead caused by
multiple sg elements.

Change-Id: I8cbe352653938bc36a9d40863fe8a7b98ca06b93
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: mmc_test: add test for non-blocking transfers
Per Forlin [Fri, 1 Jul 2011 16:55:26 +0000 (18:55 +0200)]
mmc: mmc_test: add test for non-blocking transfers

Add four tests for read and write performance per
different transfer size, 4k to 4M.
 * Read using blocking mmc request
 * Read using non-blocking mmc request
 * Write using blocking mmc request
 * Write using non-blocking mmc request

The host driver must support pre_req() and post_req()
in order to run the non-blocking test cases.

Change-Id: Ief4ec9607d09659acce7ce30e0d13378576f2c11
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar<sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: core: use defined R1_STATE_PRG macro for card status
Jaehoon Chung [Wed, 10 Aug 2011 09:46:28 +0000 (18:46 +0900)]
mmc: core: use defined R1_STATE_PRG macro for card status

Change-Id: I8d6b242cb324c6fa83b289cbdd4dd4d66fdd0836
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: core: Detect eMMC v4.5 ext_csd entries
Kyungmin Park [Tue, 26 Jul 2011 08:12:37 +0000 (17:12 +0900)]
mmc: core: Detect eMMC v4.5 ext_csd entries

The eMMC v4.5 Spec is released now:

EXT_CSD_REV Extended CSD Revision
255-7 Reserved
6 Revision 1.6 (for MMC v4.5)
5 Revision 1.5 (for MMV v4.41)
...

Change-Id: I24f84b7bea41ffc480c3fbce1960fc1a97eedd75
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agonotifiers: pm: move pm notifiers into suspend.h
Amerigo Wang [Tue, 26 Jul 2011 00:13:11 +0000 (17:13 -0700)]
notifiers: pm: move pm notifiers into suspend.h

It is not necessary to share the same notifier.h.

Change-Id: Icb098842df77e217d15cb4609e181ad9945983ff
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: David Miller <davem@davemloft.net>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agommc: print debug messages for runtime PM actions
Daniel Drake [Sun, 17 Jul 2011 15:38:41 +0000 (16:38 +0100)]
mmc: print debug messages for runtime PM actions

At http://www.mail-archive.com/linux-mmc@vger.kernel.org/msg08371.html
(thread: "mmc: sdio: reset card during power_restore") we found and
fixed a bug where mmc's runtime power management functions were not being
called. We have now also made improvements to the SDIO powerup routine
which could possibly mask this kind of issue in future.

Add debug messages to the runtime PM hooks so that it is easy to verify
if and when runtime PM is happening.

Change-Id: I563bcd5b7f9902b1ec54ad6d1d44af58c416b039
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: fix runtime PM with -ENOSYS suspend case
Ohad Ben-Cohen [Sun, 17 Jul 2011 15:38:21 +0000 (16:38 +0100)]
mmc: fix runtime PM with -ENOSYS suspend case

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().

Change-Id: I4309732b25ae3c4d4c45a141d520abac7c899241
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: fixed NULL pointer dereference
Jaehoon Chung [Wed, 13 Jul 2011 08:02:16 +0000 (17:02 +0900)]
mmc: block: fixed NULL pointer dereference

We already check for ongoing async transfers when handling discard
requests, but not in mmc_blk_issue_flush().  This patch fixes that
omission.

Tested with an SDHCI controller and eMMC4.41.

Change-Id: I514b79abcbe91a23311a7b8a4ea08dfdf02f03c8
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Per Forlin <per.forlin@linaro.org>
Cc: <stable@kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: core: Set non-default Drive Strength via platform hook
Philip Rakity [Wed, 6 Jul 2011 15:51:32 +0000 (08:51 -0700)]
mmc: core: Set non-default Drive Strength via platform hook

Non default Drive Strength cannot be set automatically.  It is a function
of the board design and only if there is a specific platform handler can
it be set.  The platform handler needs to take into account the board
design.  Pass to the platform code the necessary information.

For example:  The card and host controller may indicate they support HIGH
and LOW drive strength.  There is no way to know what should be chosen
without specific board knowledge.  Setting HIGH may lead to reflections
and setting LOW may not suffice.  There is no mechanism (like ethernet
duplex or speed pulses) to determine what should be done automatically.

If no platform handler is defined -- use the default value.

Change-Id: I76b34da2a62d6c3fe307ac92f241ead2f98d4950
Signed-off-by: Philip Rakity <prakity@marvell.com>
Reviewed-by: Arindam Nath <arindam.nath@amd.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: add handling for two parallel block requests in issue_rw_rq
Per Forlin [Fri, 1 Jul 2011 16:55:33 +0000 (18:55 +0200)]
mmc: block: add handling for two parallel block requests in issue_rw_rq

Change mmc_blk_issue_rw_rq() to become asynchronous.
The execution flow looks like this:

* The mmc-queue calls issue_rw_rq(), which sends the request
  to the host and returns back to the mmc-queue.
* The mmc-queue calls issue_rw_rq() again with a new request.
* This new request is prepared in issue_rw_rq(), then it waits for
  the active request to complete before pushing it to the host.
* When the mmc-queue is empty it will call issue_rw_rq() with a NULL
  req to finish off the active request without starting a new request.

Change-Id: I77a4906a11dddb6570e87b92d048ef209f37fb01
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: queue: add a second mmc queue request member
Per Forlin [Fri, 1 Jul 2011 16:55:31 +0000 (18:55 +0200)]
mmc: queue: add a second mmc queue request member

Add an additional mmc queue request instance to make way for two active
block requests. One request may be active while the other request is
being prepared.

Change-Id: I306d5f0ab4eeac7fbad0e600e131e4862cd24a19
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: move error path in issue_rw_rq to a separate function.
Per Forlin [Fri, 1 Jul 2011 16:55:30 +0000 (18:55 +0200)]
mmc: block: move error path in issue_rw_rq to a separate function.

Break out code without functional changes. This simplifies the code and
makes way for handling two parallel requests.

Change-Id: Ie27ee124fbd933603ebcf59de96ab1798e1ef105
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar<sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: add a block request prepare function
Per Forlin [Fri, 1 Jul 2011 16:55:29 +0000 (18:55 +0200)]
mmc: block: add a block request prepare function

Break out code from mmc_blk_issue_rw_rq to create a block request prepare
function. This doesn't change any functionallity. This helps when handling
more than one active block request.

Change-Id: I8df6f5422cb03a839154680e160f1be86ca10346
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: core: add non-blocking mmc request function
Per Forlin [Fri, 1 Jul 2011 16:55:22 +0000 (18:55 +0200)]
mmc: core: add non-blocking mmc request function

Previously there has only been one function mmc_wait_for_req()
to start and wait for a request. This patch adds:

 * mmc_start_req() - starts a request wihtout waiting
   If there is on ongoing request wait for completion
   of that request and start the new one and return.
   Does not wait for the new command to complete.

This patch also adds new function members in struct mmc_host_ops
only called from core.c:

 * pre_req - asks the host driver to prepare for the next job
 * post_req - asks the host driver to clean up after a completed job

The intention is to use pre_req() and post_req() to do cache maintenance
while a request is active. pre_req() can be called while a request is
active to minimize latency to start next job. post_req() can be used after
the next job is started to clean up the request. This will minimize the
host driver request end latency. post_req() is typically used before
ending the block request and handing over the buffer to the block layer.

Add a host-private member in mmc_data to be used by pre_req to mark the
data. The host driver will then check this mark to see if the data is
prepared or not.

Change-Id: Ifc89392648d50d4616f9ef89372517fb54af2fcb
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: add member in mmc queue struct to hold request data
Per Forlin [Sat, 9 Jul 2011 21:12:36 +0000 (17:12 -0400)]
mmc: block: add member in mmc queue struct to hold request data

The way the request data is organized in the mmc queue struct, it only
allows processing of one request at a time.  This patch adds a new struct
to hold mmc queue request data such as sg list, request, blk request and
bounce buffers, and updates any functions depending on the mmc queue
struct. This prepares for using multiple active requests in one mmc queue.

Change-Id: Ica93d986bfa0671ce9bc3583362ca488859c3770
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Venkatraman S <svenkatr@ti.com>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: add checking of r/w command response
Russell King - ARM Linux [Mon, 20 Jun 2011 19:10:49 +0000 (20:10 +0100)]
mmc: block: add checking of r/w command response

Check the status bits in the r/w command response for any errors.
If error bits are set, then we won't have seen any data transferred,
so it's pointless doing any further checking.

Change-Id: Ib4b533ae646db48dbf452b632ca9e4b394f3c73d
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: improve error recovery from command channel errors
Russell King - ARM Linux [Mon, 20 Jun 2011 19:10:28 +0000 (20:10 +0100)]
mmc: block: improve error recovery from command channel errors

Command channel errors fall into four classes:

1. The command was issued with the card in the wrong state
2. The command failed to be received by the card correctly
3. The cards response failed to be received by the host (CRC error)
4. The card failed to respond to the card

For (1), in theory we should know that the card is in the correct state.
However, a failed stop command (or other failure) may result in the card
remaining in a data transfer state from the previous command.  If we
detect this condition, we try to recover by sending a stop command.

For the initial commands (set block count and the read/write command)
no data will have been transferred.  All that we need deal with is
retrying at this point.  A failed stop command can be remedied as
above.

If we are unable to recover the card (eg, the card ignores our requests
for status, or we don't recognise the error code) then we immediately
fail the request.

Change-Id: I94d2350be32efad1cdd01b075a598949314c8c55
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: block: allow get_card_status() to return error status
Russell King - ARM Linux [Mon, 20 Jun 2011 19:10:08 +0000 (20:10 +0100)]
mmc: block: allow get_card_status() to return error status

If the MMC_SEND_STATUS command is not successful, we should not return
a zero status word, but instead allow the caller to know positively
that an error occurred.

Convert the open-coded get_card_status() to use the helper function,
and provide definitions for the card state field.

Change-Id: Id6c2809b6e1f1d9ab38238f732d93b060affb5b1
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: queue: let host controllers specify maximum discard timeout
Adrian Hunter [Tue, 28 Jun 2011 14:16:02 +0000 (17:16 +0300)]
mmc: queue: let host controllers specify maximum discard timeout

Some host controllers will not operate without a hardware
timeout that is limited in value.  However large discards
require large timeouts, so there needs to be a way to
specify the maximum discard size.

A host controller driver may now specify the maximum discard
timeout possible so that max_discard_sectors can be calculated.

However, for eMMC when the High Capacity Erase Group Size
is not in use, the timeout calculation depends on clock
rate which may change.  For that case Preferred Erase Size
is used instead.

Change-Id: I3badc5c160cafe8fb7788736ebdd5c21b895e12e
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: Standardize header file inclusion checks.
Robert P. J. Day [Fri, 27 May 2011 20:04:03 +0000 (16:04 -0400)]
mmc: Standardize header file inclusion checks.

Standardize the checks for multiple MMC header file inclusion,
including adding comments to terminating #endif's, and fixing
one incorrect comment.

Change-Id: I9e5ab7eaebc2b26a96087b560bb786c5e7cdae51
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci: don't try to do anything during power off
Andy Shevchenko [Thu, 25 Aug 2011 11:13:49 +0000 (12:13 +0100)]
mmc: sdhci: don't try to do anything during power off

The commit c5d3189 ("sdhci: Add runtime pm support for sdhci-pci") brings
runtime pm support partially. Due to this we could get a traceback:

<2>[    3.954232] kernel BUG at /home/ash/work/linux/drivers/mmc/host/sdhci.c:1155!
<0>[    3.954253] invalid opcode: 0000 [#1] PREEMPT SMP
<4>[    3.954282] Modules linked in:
<4>[    3.954299]
<4>[    3.954316] Pid: 10, comm: kworker/0:1 Not tainted 3.0.0+ #669
<4>[    3.954345] EIP: 0060:[<c12e8f15>] EFLAGS: 00010083 CPU: 0
<4>[    3.954373] EIP is at sdhci_set_power+0x35/0xf0
<4>[    3.954390] EAX: f56607f0 EBX: 00000001 ECX: 00000000 EDX: 00000000
<4>[    3.954410] ESI: f5660698 EDI: f56608b0 EBP: f5c8be8c ESP: f5c8be88
<4>[    3.954430]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
<0>[    3.954451] Process kworker/0:1 (pid: 10, ti=f5c8a000 task=f5c88260 task.ti=f5c8a000)
<0>[    3.954468] Stack:
<4>[    3.954479]  f56607f0 f5c8bea4 c12e9e33 00000286 f56603b0 f5660698 00000000 f5c8bef4
<4>[    3.954531]  c12dbf01 00000002 f5c88260 00000006 f5c8becc c107fc56 f5c88260 c13a5fcd
<4>[    3.954583]  f56605fc f5c8bedc c107fd9c f56605fc 00000282 f5c8bee4 c107fdeb f5c8bef4
<0>[    3.954635] Call Trace:
<4>[    3.954660]  [<c12e9e33>] sdhci_set_ios+0x1d3/0x370
<4>[    3.954687]  [<c12dbf01>] mmc_gate_clock+0x71/0x120
<4>[    3.954712]  [<c107fc56>] ? mark_held_locks+0x56/0x80
<4>[    3.954739]  [<c13a5fcd>] ? _raw_spin_unlock_irqrestore+0x4d/0x60
<4>[    3.954763]  [<c107fd9c>] ? trace_hardirqs_on_caller+0x11c/0x160
<4>[    3.954787]  [<c107fdeb>] ? trace_hardirqs_on+0xb/0x10
<4>[    3.954813]  [<c12dd816>] mmc_host_clk_gate_delayed+0xd6/0x150
<4>[    3.954840]  [<c105f93a>] ? process_one_work+0xfa/0x550
<4>[    3.954866]  [<c12dd89d>] mmc_host_clk_gate_work+0xd/0x10
<4>[    3.954891]  [<c105f9b6>] process_one_work+0x176/0x550
<4>[    3.954915]  [<c105f93a>] ? process_one_work+0xfa/0x550
<4>[    3.954940]  [<c12dd890>] ? mmc_host_clk_gate_delayed+0x150/0x150
<4>[    3.954966]  [<c1061c2a>] worker_thread+0x12a/0x2c0
<4>[    3.954990]  [<c1061b00>] ? manage_workers.clone.18+0x100/0x100
<4>[    3.955015]  [<c1066244>] kthread+0x74/0x80
<4>[    3.955040]  [<c10661d0>] ? __init_kthread_worker+0x60/0x60
<4>[    3.955066]  [<c13a707a>] kernel_thread_helper+0x6/0xd
<0>[    3.955080] Code: 74 5c bb 01 00 00 00 d3 e3 81 fb 00 00 04 00 74 31 7e 1b 81 fb 00 00 10 00 0f 84 b7 00 00 00 81 fb 00 00 20 00 0f 84 ab 00 00 00 <0f> 0b 90 81 fb 80 00 00 00 0f 84 94 00 00 00 81 fb 00 00 02 00
<0>[    3.955377] EIP: [<c12e8f15>] sdhci_set_power+0x35/0xf0 SS:ESP 0068:f5c8be88

The patch corrects logic of the sdhci_set_ios() in case of clock = 0
(asynchronous power off).

Change-Id: If58b8d20f8d6ce001d316da323dcf17d681ff912
Reported-by: Alexander Shishin <alexander.shishkin@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Kristen Carlson Accardi <kristen@linux.intel.com>
13 years agosdhci: correct clk_gate runtime_pm init
Pierre Tardy [Thu, 25 Aug 2011 11:13:29 +0000 (12:13 +0100)]
sdhci: correct clk_gate runtime_pm init

at init, the default state of mmc_clkgate fw is clock not gate
So at boot, set_ios is not ensured to be called with ios->clock!=0
This may result to fabric errors at boot.

Correct this by setting the default host->iosclock to !=0
and taking a runtime_pm ref counter at init.

Change-Id: I32e8f31861b268d17047ca15eea45044b635a4bc
Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
13 years agosdhci: Add runtime pm support for sdhci-pci
Kristen Carlson Accardi [Thu, 25 Aug 2011 11:12:47 +0000 (12:12 +0100)]
sdhci: Add runtime pm support for sdhci-pci

Ported the parts that were not upstream from the mrst kernel.

Change-Id: I78ada0b020c11376e09120236fc8bbec92d036ea
Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
13 years agommc: sdhci: use f_max instead of host->clock for timeouts
Andy Shevchenko [Wed, 3 Aug 2011 15:36:01 +0000 (18:36 +0300)]
mmc: sdhci: use f_max instead of host->clock for timeouts

When timeout_clk is calculated the host->clock could be zero.
So, instead of host->clock the calculation now uses mmc->f_max.

Change-Id: I7f69c4506df90de4f661443403774f259bea8201
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci: move timeout_clk calculation farther down
Andy Shevchenko [Wed, 3 Aug 2011 15:36:00 +0000 (18:36 +0300)]
mmc: sdhci: move timeout_clk calculation farther down

This moves the calculation below the assignment of mmc->f_max, which
we need for calculating timeout_clk in the next patch in this series.

Change-Id: I5392567df246e7519184d71c868f392284c38c2d
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci: check host->clock before using it as a denominator
Andy Shevchenko [Wed, 3 Aug 2011 15:35:59 +0000 (18:35 +0300)]
mmc: sdhci: check host->clock before using it as a denominator

Sometimes host->clock could be zero which is a legal situation. This
patch checks host->clock before usage as a denominator when timeout is
calculated. A similar patch is applied for mmc core (see commit e9b8684,
"mmc: fix division by zero in MMC core").

Without this patch, the execution of the sdhci_calc_timeout could end up
with a backtrace:

<0>[    4.014319] divide error: 0000 [#1] PREEMPT SMP
<4>[    4.014352] Modules linked in: g_ether
<4>[    4.014376]
<4>[    4.014393] Pid: 33, comm: kworker/u:2 Not tainted 3.0.0+ #646
<4>[    4.014421] EIP: 0060:[<c12fa38e>] EFLAGS: 00010046 CPU: 1
<4>[    4.014449] EIP is at sdhci_calc_timeout+0x2e/0x100
<4>[    4.014468] EAX: 00000000 EBX: f5930fc8 ECX: 00000000 EDX: 00000000
<4>[    4.014488] ESI: f5291de8 EDI: f5291db8 EBP: f5291c6c ESP: f5291c50
<4>[    4.014508]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
<0>[    4.014529] Process kworker/u:2 (pid: 33, ti=f5290000 task=f53065a0 task.ti=f5290000)
<0>[    4.014546] Stack:
<4>[    4.014557]  00000082 c1054fdd f5291c78 04000000 f5930fc8 f5291de8 f5291db8 f5291cac
<4>[    4.014611]  c12fab7c c107a98b f5291c88 c13b6d3f f593109c f5882000 f5291cac c1054fdd
<4>[    4.014663]  00000000 00000000 f5882000 00000082 f5930fc8 f5291db8 0000000a f5291ccc
<0>[    4.014716] Call Trace:
<4>[    4.014743]  [<c1054fdd>] ? mod_timer+0x11d/0x380
<4>[    4.014770]  [<c12fab7c>] sdhci_prepare_data+0x2c/0x3a0
<4>[    4.014798]  [<c107a98b>] ? trace_hardirqs_off+0xb/0x10
<4>[    4.014827]  [<c13b6d3f>] ? _raw_spin_unlock_irqrestore+0x2f/0x60
<4>[    4.014854]  [<c1054fdd>] ? mod_timer+0x11d/0x380
<4>[    4.014880]  [<c12fc7db>] sdhci_send_command+0xdb/0x210
<4>[    4.014906]  [<c12fd5f3>] sdhci_request+0xc3/0x150
<4>[    4.014932]  [<c12ec56a>] mmc_start_request+0xda/0x200
<4>[    4.014960]  [<c120d7c2>] ? __raw_spin_lock_init+0x32/0x60
<4>[    4.014989]  [<c1066a85>] ? __init_waitqueue_head+0x35/0x50
<4>[    4.015015]  [<c12ec70b>] mmc_wait_for_req+0x7b/0x90
<4>[    4.015045]  [<c12f0c67>] mmc_send_cxd_data+0xf7/0x130
<4>[    4.015076]  [<c12ecbc0>] ? mmc_erase+0x140/0x140
<4>[    4.015102]  [<c12f139d>] mmc_send_ext_csd+0x1d/0x20
<4>[    4.015125]  [<c12efef0>] mmc_get_ext_csd+0x70/0x140
<4>[    4.015151]  [<c12effe8>] mmc_compare_ext_csds+0x28/0x190
<4>[    4.015176]  [<c12f039f>] mmc_init_card+0x24f/0x650
<4>[    4.015201]  [<c13b6d5d>] ? _raw_spin_unlock_irqrestore+0x4d/0x60
<4>[    4.015226]  [<c107fd9c>] ? trace_hardirqs_on_caller+0x11c/0x160
<4>[    4.015255]  [<c12f09a4>] mmc_attach_mmc+0xa4/0x190
<4>[    4.015282]  [<c12ee3f0>] mmc_rescan+0x210/0x240
<4>[    4.015311]  [<c105f9b6>] process_one_work+0x176/0x550
<4>[    4.015336]  [<c105f93a>] ? process_one_work+0xfa/0x550
<4>[    4.015360]  [<c12ee1e0>] ? mmc_init_erase+0x140/0x140
<4>[    4.015385]  [<c1061c2a>] worker_thread+0x12a/0x2c0
<4>[    4.015410]  [<c1061b00>] ? manage_workers.clone.18+0x100/0x100
<4>[    4.015437]  [<c1066244>] kthread+0x74/0x80
<4>[    4.015463]  [<c10661d0>] ? __init_kthread_worker+0x60/0x60
<4>[    4.015490]  [<c13b7dfa>] kernel_thread_helper+0x6/0xd
<0>[    4.015507] Code: 57 89 d7 56 53 89 c3 83 ec 10 8b 40 04 8b 72 28 f6 c4 10 89 45 f0 0f 85 91 00 00 00 85 f6 0f 84 c1 00 00 00 8b 4e 04 31 d2 89 c8 <f7> 73 58 ba d3 4d 62 10 89 c1 8b 06 f7 e2 c1 ea 06 01 d1 f7 45
<0>[    4.015829] EIP: [<c12fa38e>] sdhci_calc_timeout+0x2e/0x100 SS:ESP 0068:f5291c50

Change-Id: I55ff5e66a7a58c85615226ba5f41c374bc65ae42
Reported-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: Revert "mmc: sdhci: Fix SDHCI_QUIRK_TIMEOUT_USES_SDCLK"
Andy Shevchenko [Wed, 3 Aug 2011 15:35:58 +0000 (18:35 +0300)]
mmc: Revert "mmc: sdhci: Fix SDHCI_QUIRK_TIMEOUT_USES_SDCLK"

This reverts commit 4b01681c7764, which introduced a new potential
divide by zero in the process of fixing one.  The subsequent commits
attempt to fix the issue properly.

Change-Id: I7317a5e43dca24b9f7829e7e8d2afe2fb2823d0d
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci-pci: allow 8-bit bus width for Intel Medfield eMMCs
Adrian Hunter [Wed, 29 Jun 2011 11:23:47 +0000 (14:23 +0300)]
mmc: sdhci-pci: allow 8-bit bus width for Intel Medfield eMMCs

Unless MMC_CAP_8_BIT_DATA is set, the bus width defaults to 4.

Change-Id: Iec2df14ed23d433f71eac8152c0a9c865e2cc2cf
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci-pci: add 8-bit bus width support for mrst hc0
Major Lee [Wed, 29 Jun 2011 11:23:46 +0000 (14:23 +0300)]
mmc: sdhci-pci: add 8-bit bus width support for mrst hc0

And hook platform_8bit_width to support 8-bit bus width.

Change-Id: I894565bb280be251a1a1998a555b25ef9b91268f
Signed-off-by: Major Lee <major_lee@wistron.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci: specify maximum discard timeout
Adrian Hunter [Tue, 28 Jun 2011 14:16:03 +0000 (17:16 +0300)]
mmc: sdhci: specify maximum discard timeout

In general, SDHC hardware timeout cannot be avoided.
Accordingly, the maximum timeout is specified to limit
the maximum discard size.

Change-Id: Id51635ccf890fd9a1558cff58ac39fbb79e3cee1
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agommc: sdhci: fix interrupt storm from card detection
Shawn Guo [Tue, 21 Jun 2011 14:41:48 +0000 (22:41 +0800)]
mmc: sdhci: fix interrupt storm from card detection

The issue was initially found by Eric Benard as below.

http://permalink.gmane.org/gmane.linux.ports.arm.kernel/108031

Not sure about other SDHCI based controller, but on Freescale eSDHC,
the SDHCI_INT_CARD_INSERT bits will be immediately set again when it
gets cleared, if a card is inserted. The driver need to mask the irq
to prevent interrupt storm which will freeze the system.  And the
SDHCI_INT_CARD_REMOVE gets the same situation.

The patch fixes the problem based on the initial idea from
Eric Benard.

Change-Id: Ibcb5031c1c751da98bb6744c71240a0d984cab4d
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Eric Benard <eric@eukrea.com>
Tested-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
13 years agousb-gadget: fix build error
Fengwei Yin [Mon, 19 Sep 2011 06:38:15 +0000 (14:38 +0800)]
usb-gadget: fix build error

Change-Id: If7c07fa8d790a109a8f7c1c8bd4a17b16d75a31d

13 years agousb: gadget: Add host_request_flag for hnp polling
Hao Wu [Fri, 26 Aug 2011 10:55:05 +0000 (11:55 +0100)]
usb: gadget: Add host_request_flag for hnp polling

HNP polling is a new feature from USB OTG 2.0 spec, OTG host will
poll the host request flag from the OTG device side using get_status().
This patch add one member in usb_gadget data structure for this purpose.

Change-Id: Ica076eaf0b2635bfe00e666c266c4db9590a4592
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agopenwell_otg: fix typo
Kristen Carlson Accardi [Fri, 26 Aug 2011 10:55:07 +0000 (11:55 +0100)]
penwell_otg: fix typo

just because it bugged me.

Change-Id: I9a713227e8a1390e08aaf667bc6e3063cc861645
Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agousb: penwell_otg: Enable hnp polling
Hao Wu [Fri, 26 Aug 2011 10:55:06 +0000 (11:55 +0100)]
usb: penwell_otg: Enable hnp polling

This patch only enables basic HNP function on penwell back-to-back
case. This driver is still in development and not enough OTG Spec
compliance test was done due to no OPT currently, but more work on
it in next step.

Change-Id: I93f0915b42429cb8f16437ad2bc762fb5e1d58f7
Signed-off-by: Hao Wu <hao.wu@intel.com>
[Added bug fixes from Hao Wu]
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agousb: penwell_otg: Add hnp polling support
Hao Wu [Fri, 26 Aug 2011 10:55:06 +0000 (11:55 +0100)]
usb: penwell_otg: Add hnp polling support

Add HNP polling support in penwell_otg transceiver driver.

Change-Id: I42206a88982b211e25af7f6842f7ba86bbd17577
Signed-off-by: Hao Wu <hao.wu@intel.com>
[Reapplied by hand due to other changes]
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agousb: penwell_otg: Add srp support
Hao Wu [Fri, 26 Aug 2011 10:55:05 +0000 (11:55 +0100)]
usb: penwell_otg: Add srp support

This penwell_otg transceiver driver patch enables
MFLD USB OTG SRP function per OTG 2.0 spec requirement.

Change-Id: I647ac2a88b24f81835a936cc55de25037141bf3b
Signed-off-by: Hao Wu <hao.wu@intel.com>
[Removed unnecessary bus polling]
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agousb: penwell_otg: Fix usb interrupt issue
Hao Wu [Fri, 26 Aug 2011 10:55:05 +0000 (11:55 +0100)]
usb: penwell_otg: Fix usb interrupt issue

This patch clears PHCD bit (set PHY into normal mode) before driver starts to
do something on controller. The reason is that bootloader may set PHY into Low
power mode, if initialize controller with PHY in Low power mode, will cause
unexpected behavior on usb controller.

Change-Id: Iaab7b1ebecea46b6ee6b4da5975d9604a3cd49d8
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agoThis adds current_event variable to the struct otg_bc_cap. The current_event allows...
Hao Wu [Thu, 25 Aug 2011 11:20:35 +0000 (12:20 +0100)]
This adds current_event variable to the struct otg_bc_cap. The current_event allows the battery driver to read the event even after the bc_callback() is called.

Change-Id: Id6a7c412d769bc9bcc6c0358838a9a4e13e588db
Signed-off-by: Hao Wu <hao.wu@intel.com>
[Rewrote the commit message]
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agousb: penwell_otg: add runtime pm support
Hao Wu [Thu, 25 Aug 2011 11:20:35 +0000 (12:20 +0100)]
usb: penwell_otg: add runtime pm support

Add runtime pm support in penwell_otg transceiver driver.

Change-Id: I30f9bbb33efb3a0a6d8e313c6dd6dfefe656c3a8
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
13 years agousb: penwell_otg: add charging current negotiation and notification support
Hao Wu [Thu, 25 Aug 2011 11:20:35 +0000 (12:20 +0100)]
usb: penwell_otg: add charging current negotiation and notification support

This patch adds charging current negotiation in Transceiver driver for
SDP/CDP/DCP cases and it also provides notification/query interfaces to
Battery driver for charging current information notification.

*It requires device controller/gadget driver modification to fully
support SDP/CDP cases.

Change-Id: I2d7db99bf16423d308a738bdc25206d9a90e2db4
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
13 years agousb: penwell_otg: add USB charger detection
Hao Wu [Thu, 25 Aug 2011 11:20:35 +0000 (12:20 +0100)]
usb: penwell_otg: add USB charger detection

This patch enables penwell USB OTG Transceiver driver USB Charger Detection
support. It can detect different types of USB charger based on MSIC.
SDP (Standard Downstream Port - USB Host port charger), DCP (Dedicated
Charging Port - USB Wall charger), CDP (Charging Downstream Port - Special
USB Host port charger).

Change-Id: I34009bb775bba53357f91a23c9190317d69d3654
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
13 years agousb: penwell_otg: Add Intel Penwell USB OTG Transceiver driver
Hao Wu [Thu, 25 Aug 2011 11:20:34 +0000 (12:20 +0100)]
usb: penwell_otg: Add Intel Penwell USB OTG Transceiver driver

Description
  This driver tries to implement host/device role switch according to
  OTG 2.0 spec on MFLD. The actual host and device functions are
  accomplished in modified EHCI driver and Intel Penwell USB OTG device
  controller driver. This is the first version and it only support Host
  Peripheral role switch per different USB cable. Development work is
  still on going, more features will be submitted soon after verified.

Dependency
  CONFIG_INTEL_SCU_IPC - IPC driver.

Enable driver in Kernel
  "Device Drivers"  --->  "USB support"  --->
          "Intel Penwell USB OTG dual-role support"

Kernel configs
  CONFIG_INTEL_SCU_IPC=y
  CONFIG_USB=y
  CONFIG_USB_OTG=y
  CONFIG_USB_OTG_UTILS=y
  CONFIG_PENWELL_OTG=y

Todo List
  USB Charging Support
  Power management (runtime)
  MHL-USB coexistence
  HNP/HNP Polling/SRP
  ADP(Attach Detection Protocol) Support

Change-Id: Ie9daf11fc21f03be659ed6c8992a4ac904421e0f
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
13 years agousb: langwell_udc: Add hnp polling support
Hao Wu [Fri, 26 Aug 2011 10:55:05 +0000 (11:55 +0100)]
usb: langwell_udc: Add hnp polling support

This patch adds get_status support for HNP polling in langwell_udc.

Change-Id: Ia700cb6a64d3c428de2fdd047960be6c98c1736b
Signed-off-by: Hao Wu <hao.wu@intel.com>
[Reapplied by hand due to other changes]
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
13 years agousb: langwell_udc: Init SRAM on S0i3 resume
Sundar Iyer [Thu, 25 Aug 2011 11:20:34 +0000 (12:20 +0100)]
usb: langwell_udc: Init SRAM on S0i3 resume

On an exit from S0i3, the USB stack tries to access the SRAM
without initializing. Add SRAM initialization code to avoid
ECC error. This patch is for langwell_udc controller driver.

Change-Id: I92c80eed95094706020b8659a3db6585bdd8fca3
Signed-off-by: Sundar Iyer <sundar.iyer@intel.com>
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
13 years agousb: langwell_udc: Fix max packet size calculations
JiebingLi [Thu, 25 Aug 2011 11:20:34 +0000 (12:20 +0100)]
usb: langwell_udc: Fix max packet size calculations

This patch is used to fix max packet size issue in langwell_udc
controller driver.  As max packct size is 1024 for ISO transfer, 0x7ff
(bit 0~10) should be used to compute the value. If 0x8ff is used, the
value may be wrongly set as 0 instead of 1024 or 512.

Change-Id: Ic78105f17d949d98c6f3c1667b0bac2c0fb8ae6c
Signed-off-by: JiebingLi <jiebing.li@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
13 years agousb: langwell_udc: cancel pending requests when controller is suspended.
Philippe Skowronski [Thu, 25 Aug 2011 11:20:33 +0000 (12:20 +0100)]
usb: langwell_udc: cancel pending requests when controller is suspended.

It is safer to cancel pending requests before free dTD and dQH when
controller enters suspend state.

Change-Id: I5cb342093934af111ce70911908f492914c3001e
Signed-off-by: Philippe Skowronski <philippe.skowronski@intel.com>
Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
13 years agousb/gadget/langwell: do not hold spin_lock when sleep
Jacob Pan [Thu, 25 Aug 2011 11:20:33 +0000 (12:20 +0100)]
usb/gadget/langwell: do not hold spin_lock when sleep

Use GFP_ATOMIC to avoid going to sleep while holding spin_lock.
Fix based on following call trace.
[  443.445677]  [<c102a8e8>] __might_sleep+0xf7/0xff
[  443.445677]  [<c10bca9b>] dma_pool_alloc+0x27/0x2ec
[  443.445677]  [<c12e4346>] ? langwell_ep_queue+0x1eb/0x25a
[  443.445677]  [<c12e4346>] ? langwell_ep_queue+0x1eb/0x25a
[  443.445677]  [<c12e3bd9>] req_to_dtd+0x37/0x10e
[  443.445677]  [<c14d08bd>] ? _raw_spin_lock_irqsave+0x35/0x3e
[  443.445677]  [<c12e4350>] langwell_ep_queue+0x1f5/0x25a

Change-Id: I6f15cf806444caaf8ddef8b899c083445eb24345
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>