Re: [PATCH] mmc: don't request CD IRQ until mmc_start_host()

2014-09-23 Thread Ulf Hansson
On 22 September 2014 17:57, Stephen Warren swar...@wwwdotorg.org wrote:
 From: Stephen Warren swar...@nvidia.com

 As soon as the CD IRQ is requested, it can trigger, since it's an
 externally controlled event. If it does, delayed_work host-detect will
 be scheduled.

 Many host controller probe()s are roughly structured as:

 *_probe() {
 host = sdhci_pltfm_init();
 mmc_of_parse(host-mmc);
 rc = sdhci_add_host(host);
 if (rc) {
 sdhci_pltfm_free();
 return rc;
 }

 In 3.17, CD IRQs can are enabled quite early via *_probe() -
 mmc_of_parse() - mmc_gpio_request_cd() - mmc_gpiod_request_cd_irq().

 Note that in linux-next, mmc_of_parse() calls mmc_gpio*d*_request_cd()
 rather than mmc_gpio_request_cd(), and mmc_gpio*d*_request_cd() doesn't
 call mmc_gpiod_request_cd_irq(). However, this issue still exists if
 mmc_gpio_request_cd() is called directly before mmc_start_host().

 sdhci_add_host() may fail part way through (e.g. due to deferred
 probe for a vmmc regulator), and sdhci_pltfm_free() does nothing to
 unrequest the CD IRQ nor cancel the delayed_work. sdhci_pltfm_free() is
 coded to assume that if sdhci_add_host() failed, then the delayed_work
 cannot (or should not) have been triggered.

 This can lead to the following with CONFIG_DEBUG_OBJECTS_* enabled, when
 kfree(host) is eventually called inside sdhci_pltfm_free():

 WARNING: CPU: 2 PID: 6 at lib/debugobjects.c:263 
 debug_print_object+0x8c/0xb4()
 ODEBUG: free active (active state 0) object type: timer_list hint: 
 delayed_work_timer_fn+0x0/0x18

 The object being complained about is host-detect.

 There's no need to request the CD IRQ so early; mmc_start_host() already
 requests it. For most SDHCI hosts at least, the typical call path that
 does this is: *_probe() - sdhci_add_host() - mmc_add_host() -
 mmc_start_host(). Therefore, remove the call to mmc_gpiod_request_cd_irq()
 from mmc_gpio_request_cd(). This also matches mmc_gpio*d*_request_cd(),
 which already doesn't call mmc_gpiod_request_cd_irq().

 However, some host controller drivers call mmc_gpio_request_cd() after
 mmc_start_host() has already been called, and assume that this will also
 call mmc_gpiod_request_cd_irq(). Update those drivers to explicitly call
 mmc_gpiod_request_cd_irq() themselves. Ideally, these drivers should be
 modified to move their call to mmc_gpio_request_cd() before their call
 to mmc_add_host(). However that's too large a change for stable.

 This solves the problem (eliminates the kernel error message above),
 since it guarantees that the IRQ can't trigger before mmc_start_host()
 is called.

 The critical point here is that once sdhci_add_host() calls
 mmc_add_host() - mmc_start_host(), sdhci_add_host() is coded not to
 fail. In other words, if there's a chance that mmc_start_host() may have
 been called, and CD IRQs triggered, and the delayed_work scheduled,
 sdhci_add_host() won't fail, and so cleanup is no longer via
 sdhci_pltfm_free() (which doesn't free the IRQ or cancel the work queue)
 but instead must be via sdhci_remove_host(), which calls mmc_remove_host()
 - mmc_stop_host(), which does free the IRQ and cancel the work queue.

 CC: Russell King li...@arm.linux.org.uk
 Cc: Adrian Hunter adrian.hun...@intel.com
 Cc: Alexandre Courbot acour...@nvidia.com
 Cc: Linus Walleij linus.wall...@linaro.org
 Signed-off-by: Stephen Warren swar...@nvidia.com
 ---
 Note: This is a patch for v3.17 (and perhaps earlier); linux-next doesn't
 have this problem due to other code re-structing. However, I think those
 patches are too large to backport.

 v3: Explicitly call mmc_gpiod_request_cd_irq() from drivers that call
 mmc_gpio_request_cd() after calling mmc_add_host(), rather than modifying
 the function signature of mmc_gpio_request_cd().

 v2: Rather than completely removing mmc_gpio_request_cd()'s call to
 mmc_gpiod_request_cd_irq(), make the call conditional.

I have applied this for next and added a stable tag for 3.15+.

Thanks!

Kind regards
Uffe

 ---
  drivers/mmc/core/slot-gpio.c| 2 --
  drivers/mmc/host/mmc_spi.c  | 1 +
  drivers/mmc/host/sdhci-sirf.c   | 1 +
  drivers/mmc/host/tmio_mmc_pio.c | 1 +
  4 files changed, 3 insertions(+), 2 deletions(-)

 diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
 index 5f89cb83d5f0..187f48a5795a 100644
 --- a/drivers/mmc/core/slot-gpio.c
 +++ b/drivers/mmc/core/slot-gpio.c
 @@ -221,8 +221,6 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned 
 int gpio,
 ctx-override_cd_active_level = true;
 ctx-cd_gpio = gpio_to_desc(gpio);

 -   mmc_gpiod_request_cd_irq(host);
 -
 return 0;
  }
  EXPORT_SYMBOL(mmc_gpio_request_cd);
 diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
 index cc8d4a6099cd..e4a07546f8b6 100644
 --- a/drivers/mmc/host/mmc_spi.c
 +++ b/drivers/mmc/host/mmc_spi.c
 @@ -1436,6 +1436,7 @@ static int mmc_spi_probe(struct spi_device *spi)
  

Re: [PATCH 1/2] mmc: sdhci-msm: Make tuning block table endian agnostic

2014-09-23 Thread Ulf Hansson
On 22 September 2014 21:26, Stephen Boyd sb...@codeaurora.org wrote:
 If we're tuning on a big-endian CPU we'll never determine we properly
 tuned the device because we compare the data we received from the
 controller with a table that assumes the CPU is little-endian.
 Change the table to be an array of bytes instead of 32-bit words
 so we can use memcmp() without needing to byte-swap every word
 depending on the endianess of the CPU.

 Cc: Asutosh Das asuto...@codeaurora.org
 Cc: Venkat Gopalakrishnan venk...@codeaurora.org
 Reviewed-by: Georgi Djakov gdja...@mm-sol.com
 Fixes: 415b5a75da43 mmc: sdhci-msm: Add platform_execute_tuning 
 implementation
 Signed-off-by: Stephen Boyd sb...@codeaurora.org

Thanks! Applied for next.

Kind regards
Uffe

 ---
  drivers/mmc/host/sdhci-msm.c | 42 +++---
  1 file changed, 27 insertions(+), 15 deletions(-)

 diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
 index 40573a58486a..5aabffc15ae8 100644
 --- a/drivers/mmc/host/sdhci-msm.c
 +++ b/drivers/mmc/host/sdhci-msm.c
 @@ -47,22 +47,34 @@
  #define CMUX_SHIFT_PHASE_SHIFT 24
  #define CMUX_SHIFT_PHASE_MASK  (7  CMUX_SHIFT_PHASE_SHIFT)

 -static const u32 tuning_block_64[] = {
 -   0x00ff0fff, 0xccc3ccff, 0xffcc3cc3, 0xeffefffe,
 -   0xddffdfff, 0xfbfffbff, 0xff7fffbf, 0xefbdf777,
 -   0xf0fff0ff, 0x3cccfc0f, 0xcfcc33cc, 0xeeffefff,
 -   0xfdfffdff, 0xffbfffdf, 0xfff7ffbb, 0xde7b7ff7
 +static const u8 tuning_block_64[] = {
 +   0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
 +   0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef,
 +   0xff, 0xdf, 0xff, 0xdd, 0xff, 0xfb, 0xff, 0xfb,
 +   0xbf, 0xff, 0x7f, 0xff, 0x77, 0xf7, 0xbd, 0xef,
 +   0xff, 0xf0, 0xff, 0xf0, 0x0f, 0xfc, 0xcc, 0x3c,
 +   0xcc, 0x33, 0xcc, 0xcf, 0xff, 0xef, 0xff, 0xee,
 +   0xff, 0xfd, 0xff, 0xfd, 0xdf, 0xff, 0xbf, 0xff,
 +   0xbb, 0xff, 0xf7, 0xff, 0xf7, 0x7f, 0x7b, 0xde,
  };

 -static const u32 tuning_block_128[] = {
 -   0xff00, 0x, 0x, 0x33cc,
 -   0xcccc, 0x, 0xeeff, 0xffff,
 -   0xffdd, 0x, 0xbbff, 0xbbff,
 -   0xffbb, 0xff77, 0x77ff, 0xffeeddbb,
 -   0x00ff, 0x00ff, 0xcc00, 0xcc33,
 -   0x, 0xffcc, 0xffee, 0x,
 -   0xddff, 0xddff, 0xffdd, 0xffbb,
 -   0x, 0x77ff, 0xffff, 0xeeddbb77
 +static const u8 tuning_block_128[] = {
 +   0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
 +   0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc, 0xcc,
 +   0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff,
 +   0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, 0xff,
 +   0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, 0xdd,
 +   0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb,
 +   0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff,
 +   0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee, 0xff,
 +   0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00,
 +   0x00, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc,
 +   0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff,
 +   0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee,
 +   0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd,
 +   0xdd, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff,
 +   0xbb, 0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff,
 +   0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
  };

  struct sdhci_msm_host {
 @@ -359,7 +371,7 @@ static int sdhci_msm_execute_tuning(struct sdhci_host 
 *host, u32 opcode)
  {
 int tuning_seq_cnt = 3;
 u8 phase, *data_buf, tuned_phases[16], tuned_phase_cnt = 0;
 -   const u32 *tuning_block_pattern = tuning_block_64;
 +   const u8 *tuning_block_pattern = tuning_block_64;
 int size = sizeof(tuning_block_64); /* Pattern size in bytes */
 int rc;
 struct mmc_host *mmc = host-mmc;
 --
 The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
 hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] mmc: Consolidate emmc tuning blocks

2014-09-23 Thread Ulf Hansson
On 22 September 2014 21:26, Stephen Boyd sb...@codeaurora.org wrote:
 The same tuning block exists in the dw_mmc h.c and sdhci-msm.c
 files. Move these into mmc.c so that they can be shared across
 drivers.

 Reported-by: Jaehoon Chung jh80.ch...@samsung.com
 Signed-off-by: Stephen Boyd sb...@codeaurora.org

Thanks! Applied for next.

Kind regards
Uffe


 ---
  drivers/mmc/core/mmc.c   | 32 
  drivers/mmc/host/dw_mmc.c| 30 --
  drivers/mmc/host/sdhci-msm.c | 38 --
  include/linux/mmc/mmc.h  |  5 +
  4 files changed, 41 insertions(+), 64 deletions(-)

 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
 index 793c6f7ddb04..9608cc8a1f65 100644
 --- a/drivers/mmc/core/mmc.c
 +++ b/drivers/mmc/core/mmc.c
 @@ -1135,6 +1135,38 @@ bus_speed:
 return err;
  }

 +const u8 tuning_blk_pattern_4bit[MMC_TUNING_BLK_PATTERN_4BIT_SIZE] = {
 +   0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
 +   0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef,
 +   0xff, 0xdf, 0xff, 0xdd, 0xff, 0xfb, 0xff, 0xfb,
 +   0xbf, 0xff, 0x7f, 0xff, 0x77, 0xf7, 0xbd, 0xef,
 +   0xff, 0xf0, 0xff, 0xf0, 0x0f, 0xfc, 0xcc, 0x3c,
 +   0xcc, 0x33, 0xcc, 0xcf, 0xff, 0xef, 0xff, 0xee,
 +   0xff, 0xfd, 0xff, 0xfd, 0xdf, 0xff, 0xbf, 0xff,
 +   0xbb, 0xff, 0xf7, 0xff, 0xf7, 0x7f, 0x7b, 0xde,
 +};
 +EXPORT_SYMBOL(tuning_blk_pattern_4bit);
 +
 +const u8 tuning_blk_pattern_8bit[MMC_TUNING_BLK_PATTERN_8BIT_SIZE] = {
 +   0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
 +   0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc, 0xcc,
 +   0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff,
 +   0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, 0xff,
 +   0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, 0xdd,
 +   0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb,
 +   0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff,
 +   0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee, 0xff,
 +   0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00,
 +   0x00, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc,
 +   0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff,
 +   0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee,
 +   0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd,
 +   0xdd, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff,
 +   0xbb, 0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff,
 +   0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
 +};
 +EXPORT_SYMBOL(tuning_blk_pattern_8bit);
 +
  /*
   * Execute tuning sequence to seek the proper bus operating
   * conditions for HS200 and HS400, which sends CMD21 to the device.
 diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
 index 1ac227c603b7..f1cefdf5e2d0 100644
 --- a/drivers/mmc/host/dw_mmc.c
 +++ b/drivers/mmc/host/dw_mmc.c
 @@ -81,36 +81,6 @@ struct idmac_desc {
  };
  #endif /* CONFIG_MMC_DW_IDMAC */

 -static const u8 tuning_blk_pattern_4bit[] = {
 -   0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
 -   0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef,
 -   0xff, 0xdf, 0xff, 0xdd, 0xff, 0xfb, 0xff, 0xfb,
 -   0xbf, 0xff, 0x7f, 0xff, 0x77, 0xf7, 0xbd, 0xef,
 -   0xff, 0xf0, 0xff, 0xf0, 0x0f, 0xfc, 0xcc, 0x3c,
 -   0xcc, 0x33, 0xcc, 0xcf, 0xff, 0xef, 0xff, 0xee,
 -   0xff, 0xfd, 0xff, 0xfd, 0xdf, 0xff, 0xbf, 0xff,
 -   0xbb, 0xff, 0xf7, 0xff, 0xf7, 0x7f, 0x7b, 0xde,
 -};
 -
 -static const u8 tuning_blk_pattern_8bit[] = {
 -   0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
 -   0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc, 0xcc,
 -   0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff,
 -   0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, 0xff,
 -   0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, 0xdd,
 -   0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb,
 -   0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff,
 -   0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee, 0xff,
 -   0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00,
 -   0x00, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc,
 -   0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff,
 -   0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee,
 -   0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd,
 -   0xdd, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff,
 -   0xbb, 0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff,
 -   0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
 -};
 -
  static inline bool dw_mci_fifo_reset(struct dw_mci *host);
  static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host);

 diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
 index 5aabffc15ae8..da74c77f34cc 100644
 --- a/drivers/mmc/host/sdhci-msm.c
 +++ b/drivers/mmc/host/sdhci-msm.c
 @@ -47,36 +47,6 @@
  #define CMUX_SHIFT_PHASE_SHIFT 24
  #define CMUX_SHIFT_PHASE_MASK  (7  CMUX_SHIFT_PHASE_SHIFT)

 -static const u8 tuning_block_64[] = {
 -   0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
 -   0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef,
 -   0xff, 0xdf, 0xff, 0xdd, 

Re: [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type

2014-09-23 Thread Ulf Hansson
On 22 September 2014 11:12, Dong Aisheng b29...@freescale.com wrote:
 Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE,
 we also do not need to handle controller native card detect interrupt
 for gpio as card detect case.
 If we wrong enabled the card detect interrupt for gpio case,
 it will cause a lot of unexpected card detect interrupts during data transfer
 which should not happen.

 Signed-off-by: Dong Aisheng b29...@freescale.com
 ---
  drivers/mmc/host/sdhci.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
 index 7481bd8..85cbf45 100644
 --- a/drivers/mmc/host/sdhci.c
 +++ b/drivers/mmc/host/sdhci.c
 @@ -136,9 +136,10 @@ static void sdhci_dumpregs(struct sdhci_host *host)
  static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
  {
 u32 present;
 +   int gpio_cd = mmc_gpio_get_cd(host-mmc);

 if ((host-quirks  SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
 -   (host-mmc-caps  MMC_CAP_NONREMOVABLE))
 +   (host-mmc-caps  MMC_CAP_NONREMOVABLE) || 
 !IS_ERR_VALUE(gpio_cd))

If you have a properly working gpio_cd, then why does you also have
SDHCI_QUIRK_BROKEN_CARD_DETECTION set? Isn't that the actual problem?

Kind regards
Uffe

 return;

 if (enable) {
 --
 1.7.8

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/13] mmc: Some Braswell and misc patches

2014-09-23 Thread Ulf Hansson
On 22 September 2014 12:17, Adrian Hunter adrian.hun...@intel.com wrote:
 Hi

 Here are some patches to further support for Intel Braswell
 SoC plus some miscellaneous changes.

 The patches needed for Braswell are:

   mmc: sdhci: Add quirk for always getting TC with stop cmd
   mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host 
 controllers
   mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
   mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host 
 controllers
   mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
   mmc: sdhci: Let a driver override timeout clock frequency
   mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency


The above seems like a good argument to at least split this patchset
into two pieces, could you please do that?

Kind regards
Uffe


 Adrian Hunter (13):
   mmc: Fix use of wrong device in mmc_gpiod_free_cd()
   mmc: Fix incorrect warning when setting 0 Hz via debugfs
   mmc: It is not an error for the card to be removed while suspended
   mmc: block: Fix error recovery stop cmd timeout calculation
   mmc: block: Fix SD card stop cmd response type
   mmc: sdhci: Add quirk for always getting TC with stop cmd
   mmc: sdhci-acpi: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel host 
 controllers
   mmc: sdhci-acpi: Add a HID and UID for a SD Card host controller
   mmc: sdhci-pci: Set SDHCI_QUIRK2_STOP_WITH_TC for Intel BYT host 
 controllers
   mmc: sdhci-pci: Add Bay Trail and Braswell SD card detect
   mmc: sdhci: Let a driver override timeout clock frequency
   mmc: sdhci-pci: Fix Braswell eMMC timeout clock frequency
   mmc: sdhci: Transfer Complete has higher priority than Data Timeout 
 Error

  drivers/mmc/card/block.c  | 30 --
  drivers/mmc/core/core.c   |  2 +-
  drivers/mmc/core/mmc.c|  2 +-
  drivers/mmc/core/sd.c |  2 +-
  drivers/mmc/core/slot-gpio.c  |  2 +-
  drivers/mmc/host/sdhci-acpi.c |  6 --
  drivers/mmc/host/sdhci-pci.c  | 28 +---
  drivers/mmc/host/sdhci-pci.h  |  4 
  drivers/mmc/host/sdhci.c  | 27 +++
  include/linux/mmc/sdhci.h |  2 ++
  10 files changed, 82 insertions(+), 23 deletions(-)


 Regards
 Adrian
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type

2014-09-23 Thread Dong Aisheng
On Tue, Sep 23, 2014 at 09:27:49AM +0200, Ulf Hansson wrote:
 On 22 September 2014 11:12, Dong Aisheng b29...@freescale.com wrote:
  Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE,
  we also do not need to handle controller native card detect interrupt
  for gpio as card detect case.
  If we wrong enabled the card detect interrupt for gpio case,
  it will cause a lot of unexpected card detect interrupts during data 
  transfer
  which should not happen.
 
  Signed-off-by: Dong Aisheng b29...@freescale.com
  ---
   drivers/mmc/host/sdhci.c |3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)
 
  diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
  index 7481bd8..85cbf45 100644
  --- a/drivers/mmc/host/sdhci.c
  +++ b/drivers/mmc/host/sdhci.c
  @@ -136,9 +136,10 @@ static void sdhci_dumpregs(struct sdhci_host *host)
   static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
   {
  u32 present;
  +   int gpio_cd = mmc_gpio_get_cd(host-mmc);
 
  if ((host-quirks  SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
  -   (host-mmc-caps  MMC_CAP_NONREMOVABLE))
  +   (host-mmc-caps  MMC_CAP_NONREMOVABLE) || 
  !IS_ERR_VALUE(gpio_cd))
 
 If you have a properly working gpio_cd, then why does you also have
 SDHCI_QUIRK_BROKEN_CARD_DETECTION set? Isn't that the actual problem?
 

SDHCI_QUIRK_BROKEN_CARD_DETECTION seems only for controller CD function.
Thus even we're using gpio_cd, we still have this quirk set for controller
to avoid enable controller cd interrupts.
Does it make sense?

Regards
Dong Aisheng

 Kind regards
 Uffe
 
  return;
 
  if (enable) {
  --
  1.7.8
 
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type

2014-09-23 Thread Ulf Hansson
On 23 September 2014 09:10, Dong Aisheng b29...@freescale.com wrote:
 On Tue, Sep 23, 2014 at 09:27:49AM +0200, Ulf Hansson wrote:
 On 22 September 2014 11:12, Dong Aisheng b29...@freescale.com wrote:
  Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE,
  we also do not need to handle controller native card detect interrupt
  for gpio as card detect case.
  If we wrong enabled the card detect interrupt for gpio case,
  it will cause a lot of unexpected card detect interrupts during data 
  transfer
  which should not happen.

I see. But shouldn't you then check for MMC_CAP_NEEDS_POLL instead of
reading the current state of the gpio_cd pin?

Kind regards
Uffe

 
  Signed-off-by: Dong Aisheng b29...@freescale.com
  ---
   drivers/mmc/host/sdhci.c |3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)
 
  diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
  index 7481bd8..85cbf45 100644
  --- a/drivers/mmc/host/sdhci.c
  +++ b/drivers/mmc/host/sdhci.c
  @@ -136,9 +136,10 @@ static void sdhci_dumpregs(struct sdhci_host *host)
   static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
   {
  u32 present;
  +   int gpio_cd = mmc_gpio_get_cd(host-mmc);
 
  if ((host-quirks  SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
  -   (host-mmc-caps  MMC_CAP_NONREMOVABLE))
  +   (host-mmc-caps  MMC_CAP_NONREMOVABLE) || 
  !IS_ERR_VALUE(gpio_cd))

 If you have a properly working gpio_cd, then why does you also have
 SDHCI_QUIRK_BROKEN_CARD_DETECTION set? Isn't that the actual problem?


 SDHCI_QUIRK_BROKEN_CARD_DETECTION seems only for controller CD function.
 Thus even we're using gpio_cd, we still have this quirk set for controller
 to avoid enable controller cd interrupts.
 Does it make sense?

 Regards
 Dong Aisheng

 Kind regards
 Uffe

  return;
 
  if (enable) {
  --
  1.7.8
 
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: rtsx: add card power off during probe

2014-09-23 Thread Ulf Hansson
On 22 September 2014 12:09, Roger Tseng rogera...@realtek.com wrote:
 On Thu, 2014-09-18 at 23:14 +0200, Ulf Hansson wrote:
 [...]

 
  In that case, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE.
 
  
   if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at 
   start,
   then it will check ios.power_mode, but the state is MMC_POWER_OFF and 
   just
   return.
 
  Uhh, that's right! So, I wonder why we invokes mmc_power_off() from
  that path at all.
 
  Hmm, I think we should change the behavior in mmc_start_host(), like 
  below:
  1) Add a MMC_POWER_UNDEFINED state which is what the power state
  should be assigned to at allocation.
  2 ) From mmc_start_host(), invoke mmc_power_off() when
  MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE is set.
 
  Would that work?
  Yes. I have confirmed this by following changes. The MMC_POWER_UNDEFINED
  designation in mmc_start_host() will eventually cause a power-off
  operation.
 
  But I wonder if we need to additionally check MMC_CAP2_FULL_PWR_CYCLE
  before calling mmc_power_off()?

 The intent from my side was to keep the current behaviour for those
 that already used MMC_CAP2_NO_PRESCAN_POWERUP, but it's s not a big
 deal.


 I checked the log and found the commit that invokes mmc_power_off():
 a08b17be8b984a7c51cd5a480cd977363df353f9
 0d3e3350d5871c53464be4c92d57198744247005
 (https://www.mail-archive.com/linux-mmc@vger.kernel.org/msg19638.html )

 The proposed change might bring back some delay since invoking
 mmc_power_off() in mmc_start_host() is more than NOP now and triggers
 real power-off and re-init in sdhci.

Actually the above commits was added due to the below commit:

fa5501890d8974301042e0202d342a6cbe8609f4

But the commits you refer to, didn't bring back the old behaviour,
which I think was the intent. Instead we added a NOP call to
mmc_power_off() from mmc_start_host().

We have few options on how to go forward, but let's loop in Adrian
Hunter first, since he might be able to comment on this as well.

Kind regards
Uffe
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] mmc: atmel-mci: Switch to using managed resource in probe

2014-09-23 Thread Pramod Gurav
This change uses managed resource APIs to allocate resources such as,
clk, gpio, io in order to simplify the driver unload or failure cases.
Hence does away with release statements of the same resorces in error
lables and remove function.

Cc: Ludovic Desroches ludovic.desroc...@atmel.com
Cc: Chris Ball ch...@printf.net
Cc: Ulf Hansson ulf.hans...@linaro.org
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Pramod Gurav pramod.gu...@smartplayin.com

---
Changes since v1:
- Dropped using devm_request_irq as suggested by Ludovic Desroches
  as it seems there are race conditions seen with them.
- Added another patch to fix failure path in probe to call atmci_cleanup_slot
  after dma_alloc_coherent() fails to release mmc_host resources.
---
 drivers/mmc/host/atmel-mci.c |   41 ++---
 1 file changed, 14 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index bb585d9..36212fb 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -17,6 +17,7 @@
 #include linux/gpio.h
 #include linux/init.h
 #include linux/interrupt.h
+#include linux/io.h
 #include linux/ioport.h
 #include linux/module.h
 #include linux/of.h
@@ -2195,7 +2196,8 @@ static int __init atmci_init_slot(struct atmel_mci *host,
/* Assume card is present initially */
set_bit(ATMCI_CARD_PRESENT, slot-flags);
if (gpio_is_valid(slot-detect_pin)) {
-   if (gpio_request(slot-detect_pin, mmc_detect)) {
+   if (devm_gpio_request(host-pdev-dev, slot-detect_pin,
+ mmc_detect)) {
dev_dbg(mmc-class_dev, no detect pin available\n);
slot-detect_pin = -EBUSY;
} else if (gpio_get_value(slot-detect_pin) ^
@@ -2208,7 +2210,8 @@ static int __init atmci_init_slot(struct atmel_mci *host,
mmc-caps |= MMC_CAP_NEEDS_POLL;
 
if (gpio_is_valid(slot-wp_pin)) {
-   if (gpio_request(slot-wp_pin, mmc_wp)) {
+   if (devm_gpio_request(host-pdev-dev, slot-wp_pin,
+ mmc_wp)) {
dev_dbg(mmc-class_dev, no WP pin available\n);
slot-wp_pin = -EBUSY;
}
@@ -2232,7 +2235,6 @@ static int __init atmci_init_slot(struct atmel_mci *host,
dev_dbg(mmc-class_dev,
could not request IRQ %d for detect pin\n,
gpio_to_irq(slot-detect_pin));
-   gpio_free(slot-detect_pin);
slot-detect_pin = -EBUSY;
}
}
@@ -2257,10 +2259,7 @@ static void __exit atmci_cleanup_slot(struct 
atmel_mci_slot *slot,
 
free_irq(gpio_to_irq(pin), slot);
del_timer_sync(slot-detect_timer);
-   gpio_free(pin);
}
-   if (gpio_is_valid(slot-wp_pin))
-   gpio_free(slot-wp_pin);
 
slot-host-slot[id] = NULL;
mmc_free_host(slot-mmc);
@@ -2395,7 +2394,7 @@ static int __init atmci_probe(struct platform_device 
*pdev)
if (irq  0)
return irq;
 
-   host = kzalloc(sizeof(struct atmel_mci), GFP_KERNEL);
+   host = devm_kzalloc(pdev-dev, sizeof(*host), GFP_KERNEL);
if (!host)
return -ENOMEM;
 
@@ -2403,20 +2402,18 @@ static int __init atmci_probe(struct platform_device 
*pdev)
spin_lock_init(host-lock);
INIT_LIST_HEAD(host-queue);
 
-   host-mck = clk_get(pdev-dev, mci_clk);
-   if (IS_ERR(host-mck)) {
-   ret = PTR_ERR(host-mck);
-   goto err_clk_get;
-   }
+   host-mck = devm_clk_get(pdev-dev, mci_clk);
+   if (IS_ERR(host-mck))
+   return PTR_ERR(host-mck);
 
-   ret = -ENOMEM;
-   host-regs = ioremap(regs-start, resource_size(regs));
+   host-regs = devm_ioremap(pdev-dev, regs-start, resource_size(regs));
if (!host-regs)
-   goto err_ioremap;
+   return -ENOMEM;
 
ret = clk_prepare_enable(host-mck);
if (ret)
-   goto err_request_irq;
+   return ret;
+
atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
host-bus_hz = clk_get_rate(host-mck);
clk_disable_unprepare(host-mck);
@@ -2427,7 +2424,7 @@ static int __init atmci_probe(struct platform_device 
*pdev)
 
ret = request_irq(irq, atmci_interrupt, 0, dev_name(pdev-dev), host);
if (ret)
-   goto err_request_irq;
+   return ret;
 
/* Get MCI capabilities and set operations according to it */
atmci_get_cap(host);
@@ -2499,12 +2496,6 @@ err_init_slot:
if (host-dma.chan)
dma_release_channel(host-dma.chan);
free_irq(irq, host);
-err_request_irq:
-   iounmap(host-regs);
-err_ioremap:
-   clk_put(host-mck);
-err_clk_get:
-   kfree(host);

[PATCH v2 2/2] mmc: atmel-mci: Release mmc resources on failure in probe

2014-09-23 Thread Pramod Gurav
This change takes care of releasing mmc resources on error cases in
probe function which was missing. Also release timer in remove function.

Cc: Ludovic Desroches ludovic.desroc...@atmel.com
Cc: Chris Ball ch...@printf.net
Cc: Ulf Hansson ulf.hans...@linaro.org
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Pramod Gurav pramod.gu...@smartplayin.com
---
Changes since v1: None

 drivers/mmc/host/atmel-mci.c |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 36212fb..288bcc1 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2376,7 +2376,7 @@ static int __init atmci_probe(struct platform_device 
*pdev)
struct resource *regs;
unsigned intnr_slots;
int irq;
-   int ret;
+   int ret, i;
 
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs)
@@ -2482,7 +2482,7 @@ static int __init atmci_probe(struct platform_device 
*pdev)
if (!host-buffer) {
ret = -ENOMEM;
dev_err(pdev-dev, buffer allocation failed\n);
-   goto err_init_slot;
+   goto err_dma_alloc;
}
}
 
@@ -2492,7 +2492,13 @@ static int __init atmci_probe(struct platform_device 
*pdev)
 
return 0;
 
+err_dma_alloc:
+   for (i = 0; i  ATMCI_MAX_NR_SLOTS; i++) {
+   if (host-slot[i])
+   atmci_cleanup_slot(host-slot[i], i);
+   }
 err_init_slot:
+   del_timer_sync(host-timer);
if (host-dma.chan)
dma_release_channel(host-dma.chan);
free_irq(irq, host);
@@ -2519,6 +2525,7 @@ static int __exit atmci_remove(struct platform_device 
*pdev)
atmci_readl(host, ATMCI_SR);
clk_disable_unprepare(host-mck);
 
+   del_timer_sync(host-timer);
if (host-dma.chan)
dma_release_channel(host-dma.chan);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] mmc: atmel-mci: Switch to using managed resource in probe

2014-09-23 Thread Ludovic Desroches
On Tue, Sep 23, 2014 at 03:50:05PM +0530, Pramod Gurav wrote:
 This change uses managed resource APIs to allocate resources such as,
 clk, gpio, io in order to simplify the driver unload or failure cases.
 Hence does away with release statements of the same resorces in error
/s/resorces/resources
 lables and remove function.
/s/lables/labels

Otherwise

Acked-by: Ludovic Desroches ludovic.desroc...@atmel.com

Thanks

 
 Cc: Ludovic Desroches ludovic.desroc...@atmel.com
 Cc: Chris Ball ch...@printf.net
 Cc: Ulf Hansson ulf.hans...@linaro.org
 Cc: linux-mmc@vger.kernel.org
 Signed-off-by: Pramod Gurav pramod.gu...@smartplayin.com
 
 ---
 Changes since v1:
 - Dropped using devm_request_irq as suggested by Ludovic Desroches
   as it seems there are race conditions seen with them.
 - Added another patch to fix failure path in probe to call atmci_cleanup_slot
   after dma_alloc_coherent() fails to release mmc_host resources.
 ---
  drivers/mmc/host/atmel-mci.c |   41 ++---
  1 file changed, 14 insertions(+), 27 deletions(-)
 
 diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
 index bb585d9..36212fb 100644
 --- a/drivers/mmc/host/atmel-mci.c
 +++ b/drivers/mmc/host/atmel-mci.c
 @@ -17,6 +17,7 @@
  #include linux/gpio.h
  #include linux/init.h
  #include linux/interrupt.h
 +#include linux/io.h
  #include linux/ioport.h
  #include linux/module.h
  #include linux/of.h
 @@ -2195,7 +2196,8 @@ static int __init atmci_init_slot(struct atmel_mci 
 *host,
   /* Assume card is present initially */
   set_bit(ATMCI_CARD_PRESENT, slot-flags);
   if (gpio_is_valid(slot-detect_pin)) {
 - if (gpio_request(slot-detect_pin, mmc_detect)) {
 + if (devm_gpio_request(host-pdev-dev, slot-detect_pin,
 +   mmc_detect)) {
   dev_dbg(mmc-class_dev, no detect pin available\n);
   slot-detect_pin = -EBUSY;
   } else if (gpio_get_value(slot-detect_pin) ^
 @@ -2208,7 +2210,8 @@ static int __init atmci_init_slot(struct atmel_mci 
 *host,
   mmc-caps |= MMC_CAP_NEEDS_POLL;
  
   if (gpio_is_valid(slot-wp_pin)) {
 - if (gpio_request(slot-wp_pin, mmc_wp)) {
 + if (devm_gpio_request(host-pdev-dev, slot-wp_pin,
 +   mmc_wp)) {
   dev_dbg(mmc-class_dev, no WP pin available\n);
   slot-wp_pin = -EBUSY;
   }
 @@ -2232,7 +2235,6 @@ static int __init atmci_init_slot(struct atmel_mci 
 *host,
   dev_dbg(mmc-class_dev,
   could not request IRQ %d for detect pin\n,
   gpio_to_irq(slot-detect_pin));
 - gpio_free(slot-detect_pin);
   slot-detect_pin = -EBUSY;
   }
   }
 @@ -2257,10 +2259,7 @@ static void __exit atmci_cleanup_slot(struct 
 atmel_mci_slot *slot,
  
   free_irq(gpio_to_irq(pin), slot);
   del_timer_sync(slot-detect_timer);
 - gpio_free(pin);
   }
 - if (gpio_is_valid(slot-wp_pin))
 - gpio_free(slot-wp_pin);
  
   slot-host-slot[id] = NULL;
   mmc_free_host(slot-mmc);
 @@ -2395,7 +2394,7 @@ static int __init atmci_probe(struct platform_device 
 *pdev)
   if (irq  0)
   return irq;
  
 - host = kzalloc(sizeof(struct atmel_mci), GFP_KERNEL);
 + host = devm_kzalloc(pdev-dev, sizeof(*host), GFP_KERNEL);
   if (!host)
   return -ENOMEM;
  
 @@ -2403,20 +2402,18 @@ static int __init atmci_probe(struct platform_device 
 *pdev)
   spin_lock_init(host-lock);
   INIT_LIST_HEAD(host-queue);
  
 - host-mck = clk_get(pdev-dev, mci_clk);
 - if (IS_ERR(host-mck)) {
 - ret = PTR_ERR(host-mck);
 - goto err_clk_get;
 - }
 + host-mck = devm_clk_get(pdev-dev, mci_clk);
 + if (IS_ERR(host-mck))
 + return PTR_ERR(host-mck);
  
 - ret = -ENOMEM;
 - host-regs = ioremap(regs-start, resource_size(regs));
 + host-regs = devm_ioremap(pdev-dev, regs-start, resource_size(regs));
   if (!host-regs)
 - goto err_ioremap;
 + return -ENOMEM;
  
   ret = clk_prepare_enable(host-mck);
   if (ret)
 - goto err_request_irq;
 + return ret;
 +
   atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
   host-bus_hz = clk_get_rate(host-mck);
   clk_disable_unprepare(host-mck);
 @@ -2427,7 +2424,7 @@ static int __init atmci_probe(struct platform_device 
 *pdev)
  
   ret = request_irq(irq, atmci_interrupt, 0, dev_name(pdev-dev), host);
   if (ret)
 - goto err_request_irq;
 + return ret;
  
   /* Get MCI capabilities and set operations according to it */
   atmci_get_cap(host);
 @@ -2499,12 +2496,6 @@ err_init_slot:
   if (host-dma.chan)
   

Re: [PATCH v2 2/2] mmc: atmel-mci: Release mmc resources on failure in probe

2014-09-23 Thread Ludovic Desroches
On Tue, Sep 23, 2014 at 03:50:06PM +0530, Pramod Gurav wrote:
 This change takes care of releasing mmc resources on error cases in
 probe function which was missing. Also release timer in remove function.
 

Acked-by: Ludovic Desroches ludovic.desroc...@atmel.com

 Cc: Ludovic Desroches ludovic.desroc...@atmel.com
 Cc: Chris Ball ch...@printf.net
 Cc: Ulf Hansson ulf.hans...@linaro.org
 Cc: linux-mmc@vger.kernel.org
 Signed-off-by: Pramod Gurav pramod.gu...@smartplayin.com
 ---
 Changes since v1: None
 
  drivers/mmc/host/atmel-mci.c |   11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
 index 36212fb..288bcc1 100644
 --- a/drivers/mmc/host/atmel-mci.c
 +++ b/drivers/mmc/host/atmel-mci.c
 @@ -2376,7 +2376,7 @@ static int __init atmci_probe(struct platform_device 
 *pdev)
   struct resource *regs;
   unsigned intnr_slots;
   int irq;
 - int ret;
 + int ret, i;
  
   regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!regs)
 @@ -2482,7 +2482,7 @@ static int __init atmci_probe(struct platform_device 
 *pdev)
   if (!host-buffer) {
   ret = -ENOMEM;
   dev_err(pdev-dev, buffer allocation failed\n);
 - goto err_init_slot;
 + goto err_dma_alloc;
   }
   }
  
 @@ -2492,7 +2492,13 @@ static int __init atmci_probe(struct platform_device 
 *pdev)
  
   return 0;
  
 +err_dma_alloc:
 + for (i = 0; i  ATMCI_MAX_NR_SLOTS; i++) {
 + if (host-slot[i])
 + atmci_cleanup_slot(host-slot[i], i);
 + }
  err_init_slot:
 + del_timer_sync(host-timer);
   if (host-dma.chan)
   dma_release_channel(host-dma.chan);
   free_irq(irq, host);
 @@ -2519,6 +2525,7 @@ static int __exit atmci_remove(struct platform_device 
 *pdev)
   atmci_readl(host, ATMCI_SR);
   clk_disable_unprepare(host-mck);
  
 + del_timer_sync(host-timer);
   if (host-dma.chan)
   dma_release_channel(host-dma.chan);
  
 -- 
 1.7.9.5
 
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] mmc: atmel-mci: Switch to using managed resource in probe

2014-09-23 Thread Pramod Gurav
This change uses managed resource APIs to allocate resources such as,
clk, gpio, io in order to simplify the driver unload or failure cases.
Hence does away with release statements of the same resources in error
labels and remove function.

Acked-by: Ludovic Desroches ludovic.desroc...@atmel.com
Cc: Ludovic Desroches ludovic.desroc...@atmel.com
Cc: Chris Ball ch...@printf.net
Cc: Ulf Hansson ulf.hans...@linaro.org
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Pramod Gurav pramod.gu...@smartplayin.com

---
Changes since v1:
- Dropped using devm_request_irq as suggested by Ludovic Desroches
  as it seems there are race conditions seen with them.
- Added another patch to fix failure path in probe to call atmci_cleanup_slot
  after dma_alloc_coherent() fails to release mmc_host resources.
- Fixed typos in commit message
---
 drivers/mmc/host/atmel-mci.c |   41 ++---
 1 file changed, 14 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index bb585d9..36212fb 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -17,6 +17,7 @@
 #include linux/gpio.h
 #include linux/init.h
 #include linux/interrupt.h
+#include linux/io.h
 #include linux/ioport.h
 #include linux/module.h
 #include linux/of.h
@@ -2195,7 +2196,8 @@ static int __init atmci_init_slot(struct atmel_mci *host,
/* Assume card is present initially */
set_bit(ATMCI_CARD_PRESENT, slot-flags);
if (gpio_is_valid(slot-detect_pin)) {
-   if (gpio_request(slot-detect_pin, mmc_detect)) {
+   if (devm_gpio_request(host-pdev-dev, slot-detect_pin,
+ mmc_detect)) {
dev_dbg(mmc-class_dev, no detect pin available\n);
slot-detect_pin = -EBUSY;
} else if (gpio_get_value(slot-detect_pin) ^
@@ -2208,7 +2210,8 @@ static int __init atmci_init_slot(struct atmel_mci *host,
mmc-caps |= MMC_CAP_NEEDS_POLL;
 
if (gpio_is_valid(slot-wp_pin)) {
-   if (gpio_request(slot-wp_pin, mmc_wp)) {
+   if (devm_gpio_request(host-pdev-dev, slot-wp_pin,
+ mmc_wp)) {
dev_dbg(mmc-class_dev, no WP pin available\n);
slot-wp_pin = -EBUSY;
}
@@ -2232,7 +2235,6 @@ static int __init atmci_init_slot(struct atmel_mci *host,
dev_dbg(mmc-class_dev,
could not request IRQ %d for detect pin\n,
gpio_to_irq(slot-detect_pin));
-   gpio_free(slot-detect_pin);
slot-detect_pin = -EBUSY;
}
}
@@ -2257,10 +2259,7 @@ static void __exit atmci_cleanup_slot(struct 
atmel_mci_slot *slot,
 
free_irq(gpio_to_irq(pin), slot);
del_timer_sync(slot-detect_timer);
-   gpio_free(pin);
}
-   if (gpio_is_valid(slot-wp_pin))
-   gpio_free(slot-wp_pin);
 
slot-host-slot[id] = NULL;
mmc_free_host(slot-mmc);
@@ -2395,7 +2394,7 @@ static int __init atmci_probe(struct platform_device 
*pdev)
if (irq  0)
return irq;
 
-   host = kzalloc(sizeof(struct atmel_mci), GFP_KERNEL);
+   host = devm_kzalloc(pdev-dev, sizeof(*host), GFP_KERNEL);
if (!host)
return -ENOMEM;
 
@@ -2403,20 +2402,18 @@ static int __init atmci_probe(struct platform_device 
*pdev)
spin_lock_init(host-lock);
INIT_LIST_HEAD(host-queue);
 
-   host-mck = clk_get(pdev-dev, mci_clk);
-   if (IS_ERR(host-mck)) {
-   ret = PTR_ERR(host-mck);
-   goto err_clk_get;
-   }
+   host-mck = devm_clk_get(pdev-dev, mci_clk);
+   if (IS_ERR(host-mck))
+   return PTR_ERR(host-mck);
 
-   ret = -ENOMEM;
-   host-regs = ioremap(regs-start, resource_size(regs));
+   host-regs = devm_ioremap(pdev-dev, regs-start, resource_size(regs));
if (!host-regs)
-   goto err_ioremap;
+   return -ENOMEM;
 
ret = clk_prepare_enable(host-mck);
if (ret)
-   goto err_request_irq;
+   return ret;
+
atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
host-bus_hz = clk_get_rate(host-mck);
clk_disable_unprepare(host-mck);
@@ -2427,7 +2424,7 @@ static int __init atmci_probe(struct platform_device 
*pdev)
 
ret = request_irq(irq, atmci_interrupt, 0, dev_name(pdev-dev), host);
if (ret)
-   goto err_request_irq;
+   return ret;
 
/* Get MCI capabilities and set operations according to it */
atmci_get_cap(host);
@@ -2499,12 +2496,6 @@ err_init_slot:
if (host-dma.chan)
dma_release_channel(host-dma.chan);
free_irq(irq, host);
-err_request_irq:
-   

Re: [PATCH 0/6] unshare and simplify omap_hsmmc platform struct

2014-09-23 Thread Tony Lindgren
* Andreas Fenkart afenk...@gmail.com [140922 04:55]:
 mmci and omap_hsmmc share very little fields in the platform
 struct. unsharing significantly simplifies the omap_hsmmc driver

I think this is good to do. I was hoping we could drop omap3
legacy booting support and completely get rid of the platform_data
for omap_hsmmc. But that happens when it happens, so let's do
this meanwhile to remove some dependencies for the omap_hsmmc
clean-up work.

Some patches have missing descriptions, can you please add those?

Once the patches have proper descriptions, and assuming this
does not break the omap3 legacy booting with the board-*.c
files, please feel free to add:

Acked-by: Tony Lindgren t...@atomide.com

As it seems this is best merged via the MMC tree.

Regards,

Tony

 
 Andreas Fenkart (6):
   omap_hsmmc: unshare platform data struct with mmci driver
   omap_hsmmc: remove unused callbacks from platform data struct
   omap_hsmmc: remove unused fields in platform_data
   omap_hsmmc: remove unused get_context_loss_count callback
   omap_hsmmc: remove un-initialized callbacks from platform data
   omap_hsmmc: remove un-initialized get_cover_state callback
 
  arch/arm/mach-omap2/hsmmc.c|  61 ++
  arch/arm/mach-omap2/hsmmc.h|  10 --
  arch/arm/mach-omap2/mmc.h  |   6 +-
  .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |   6 +-
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   6 +-
  drivers/mmc/host/omap_hsmmc.c  | 133 
 +++--
  include/linux/platform_data/hsmmc-omap.h   | 103 
  7 files changed, 142 insertions(+), 183 deletions(-)
  create mode 100644 include/linux/platform_data/hsmmc-omap.h
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gpio, bcm-kona, LLVMLinux: Remove use of __initconst

2014-09-23 Thread behanw
From: Behan Webster beh...@converseincode.com

The __initconst is in the wrong place, and when moved to the correct place
it uncovers an error where the variable is used by non-init data structures.

Instead merely make them const and put the const in the right spot.

Signed-off-by: Behan Webster beh...@converseincode.com
Reviewed-by: Mark Charlebois charl...@gmail.com
Acked-by: Arnd Bergmann a...@arndb.de
---
 drivers/gpio/gpio-bcm-kona.c  | 2 +-
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
index 3f6b33c..de0801e 100644
--- a/drivers/gpio/gpio-bcm-kona.c
+++ b/drivers/gpio/gpio-bcm-kona.c
@@ -496,7 +496,7 @@ static struct irq_chip bcm_gpio_irq_chip = {
.irq_release_resources = bcm_kona_gpio_irq_relres,
 };
 
-static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
+static struct of_device_id const bcm_kona_gpio_of_match[] = {
{ .compatible = brcm,kona-gpio },
{}
 };
diff --git a/drivers/mmc/host/sdhci-bcm-kona.c 
b/drivers/mmc/host/sdhci-bcm-kona.c
index dd780c3..4bb06c8 100644
--- a/drivers/mmc/host/sdhci-bcm-kona.c
+++ b/drivers/mmc/host/sdhci-bcm-kona.c
@@ -225,7 +225,7 @@ static struct sdhci_pltfm_data sdhci_pltfm_data_kona = {
SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
 };
 
-static struct __initconst of_device_id sdhci_bcm_kona_of_match[] = {
+static struct of_device_id const sdhci_bcm_kona_of_match[] = {
{ .compatible = brcm,kona-sdhci},
{ .compatible = bcm,kona-sdhci}, /* deprecated name */
{}
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: rtsx: add card power off during probe

2014-09-23 Thread Adrian Hunter

On 23/09/2014 12:20 p.m., Ulf Hansson wrote:

On 22 September 2014 12:09, Roger Tseng rogera...@realtek.com wrote:

On Thu, 2014-09-18 at 23:14 +0200, Ulf Hansson wrote:

[...]



In that case, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE.



if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at start,
then it will check ios.power_mode, but the state is MMC_POWER_OFF and just
return.


Uhh, that's right! So, I wonder why we invokes mmc_power_off() from
that path at all.

Hmm, I think we should change the behavior in mmc_start_host(), like below:
1) Add a MMC_POWER_UNDEFINED state which is what the power state
should be assigned to at allocation.
2 ) From mmc_start_host(), invoke mmc_power_off() when
MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE is set.

Would that work?

Yes. I have confirmed this by following changes. The MMC_POWER_UNDEFINED
designation in mmc_start_host() will eventually cause a power-off
operation.

But I wonder if we need to additionally check MMC_CAP2_FULL_PWR_CYCLE
before calling mmc_power_off()?


The intent from my side was to keep the current behaviour for those
that already used MMC_CAP2_NO_PRESCAN_POWERUP, but it's s not a big
deal.



I checked the log and found the commit that invokes mmc_power_off():
a08b17be8b984a7c51cd5a480cd977363df353f9
0d3e3350d5871c53464be4c92d57198744247005
(https://www.mail-archive.com/linux-mmc@vger.kernel.org/msg19638.html )

The proposed change might bring back some delay since invoking
mmc_power_off() in mmc_start_host() is more than NOP now and triggers
real power-off and re-init in sdhci.


Actually the above commits was added due to the below commit:

fa5501890d8974301042e0202d342a6cbe8609f4

But the commits you refer to, didn't bring back the old behaviour,
which I think was the intent. Instead we added a NOP call to
mmc_power_off() from mmc_start_host().

We have few options on how to go forward, but let's loop in Adrian
Hunter first, since he might be able to comment on this as well.


Having mmc_power_off() in mmc_start_host()
actually power off should be OK.
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] mmc: sdhci: Transfer Complete has higher priority than Data Timeout Error

2014-09-23 Thread Adrian Hunter
According to the SD Host Controller Standard Specification:

...Transfer Complete has higher priority than Data Timeout
Error. If both bits are set to 1, execution of a command
can be considered to be completed.

Adjust the checking of SDHCI_INT_DATA_TIMEOUT and
SDHCI_INT_DATA_END (Transfer Complete) accordingly.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 drivers/mmc/host/sdhci.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7481bd8..7a8586f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2329,11 +2329,6 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 
intmask)
 * above in sdhci_cmd_irq().
 */
if (host-cmd  (host-cmd-flags  MMC_RSP_BUSY)) {
-   if (intmask  SDHCI_INT_DATA_TIMEOUT) {
-   host-cmd-error = -ETIMEDOUT;
-   tasklet_schedule(host-finish_tasklet);
-   return;
-   }
if (intmask  SDHCI_INT_DATA_END) {
/*
 * Some cards handle busy-end interrupt
@@ -2346,6 +2341,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 
intmask)
host-busy_handle = 1;
return;
}
+   if (intmask  SDHCI_INT_DATA_TIMEOUT) {
+   host-cmd-error = -ETIMEDOUT;
+   tasklet_schedule(host-finish_tasklet);
+   return;
+   }
}
 
pr_err(%s: Got data interrupt 0x%08x even 
@@ -2356,7 +2356,8 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 
intmask)
return;
}
 
-   if (intmask  SDHCI_INT_DATA_TIMEOUT)
+   if ((intmask  SDHCI_INT_DATA_TIMEOUT) 
+   !(intmask  SDHCI_INT_DATA_END))
host-data-error = -ETIMEDOUT;
else if (intmask  SDHCI_INT_DATA_END_BIT)
host-data-error = -EILSEQ;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] mmc: It is not an error for the card to be removed while suspended

2014-09-23 Thread Adrian Hunter
A removable card can be removed while it is runtime suspended.
Do not print an error message.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 drivers/mmc/core/mmc.c | 2 +-
 drivers/mmc/core/sd.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index ce11d89..1d827eb 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1804,7 +1804,7 @@ static int mmc_runtime_resume(struct mmc_host *host)
return 0;
 
err = _mmc_resume(host);
-   if (err)
+   if (err  (err != -ENOMEDIUM || (host-caps  MMC_CAP_NONREMOVABLE)))
pr_err(%s: error %d doing aggessive resume\n,
mmc_hostname(host), err);
 
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 2591388..28089b3 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1178,7 +1178,7 @@ static int mmc_sd_runtime_resume(struct mmc_host *host)
return 0;
 
err = _mmc_sd_resume(host);
-   if (err)
+   if (err  (err != -ENOMEDIUM || (host-caps  MMC_CAP_NONREMOVABLE)))
pr_err(%s: error %d doing aggessive resume\n,
mmc_hostname(host), err);
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] mmc: Fix incorrect warning when setting 0 Hz via debugfs

2014-09-23 Thread Adrian Hunter
It is possible to turn off the card clock by setting
the frequency to zero via debugfs e.g.

echo 0  /sys/kernel/debug/mmc0/clock

However that produces an incorrect warning that is
designed to warn if the frequency is below the minimum
operating frequency.  So correct the warning.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 drivers/mmc/core/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e2e1dd4..16aa7bd 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -995,7 +995,7 @@ void mmc_set_chip_select(struct mmc_host *host, int mode)
  */
 static void __mmc_set_clock(struct mmc_host *host, unsigned int hz)
 {
-   WARN_ON(hz  host-f_min);
+   WARN_ON(hz  hz  host-f_min);
 
if (hz  host-f_max)
hz = host-f_max;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] mmc: block: Fix SD card stop cmd response type

2014-09-23 Thread Adrian Hunter
Nowhere in the SD Association Specifications does
it state that the stop command has an R1 response
type.  It is always R1B.  Change accordingly.

Note that, for SD cards, this puts the situation back
to what it was prior to commit
bcc3e1726d827c2d6f62f0e0e7bbc99eed7ad925.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 drivers/mmc/card/block.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index c3770dd..0736efb 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -801,6 +801,9 @@ static int send_stop(struct mmc_card *card, unsigned int 
timeout_ms,
if (host-max_busy_timeout  (timeout_ms  host-max_busy_timeout))
use_r1b_resp = false;
 
+   if (!mmc_card_mmc(card))
+   use_r1b_resp = true;
+
cmd.opcode = MMC_STOP_TRANSMISSION;
if (use_r1b_resp) {
cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
@@ -1436,9 +1439,14 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req 
*mqrq,
if (rq_data_dir(req) == READ) {
brq-cmd.opcode = readcmd;
brq-data.flags |= MMC_DATA_READ;
-   if (brq-mrq.stop)
-   brq-stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 |
-   MMC_CMD_AC;
+   if (brq-mrq.stop) {
+   if (mmc_card_mmc(card))
+   brq-stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 |
+ MMC_CMD_AC;
+   else
+   brq-stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1B |
+ MMC_CMD_AC;
+   }
} else {
brq-cmd.opcode = writecmd;
brq-data.flags |= MMC_DATA_WRITE;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] mmc: Fix use of wrong device in mmc_gpiod_free_cd()

2014-09-23 Thread Adrian Hunter
mmc_gpiod_free_cd() is paired with mmc_gpiod_request_cd()
and both must reference the same device which is the
actual host controller device not the mmc_host class
device.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 drivers/mmc/core/slot-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index e3fce44..06616cd 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -392,7 +392,7 @@ void mmc_gpiod_free_cd(struct mmc_host *host)
host-slot.cd_irq = -EINVAL;
}
 
-   devm_gpiod_put(host-class_dev, ctx-cd_gpio);
+   devm_gpiod_put(host-parent, ctx-cd_gpio);
 
ctx-cd_gpio = NULL;
 }
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gpio, bcm-kona, LLVMLinux: Remove use of __initconst

2014-09-23 Thread Matt Porter
On Tue, Sep 23, 2014 at 12:30:16PM -0700, beh...@converseincode.com wrote:
 From: Behan Webster beh...@converseincode.com
 
 The __initconst is in the wrong place, and when moved to the correct place
 it uncovers an error where the variable is used by non-init data structures.
 
 Instead merely make them const and put the const in the right spot.
 
 Signed-off-by: Behan Webster beh...@converseincode.com
 Reviewed-by: Mark Charlebois charl...@gmail.com
 Acked-by: Arnd Bergmann a...@arndb.de
 ---
  drivers/gpio/gpio-bcm-kona.c  | 2 +-
  drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
 index 3f6b33c..de0801e 100644
 --- a/drivers/gpio/gpio-bcm-kona.c
 +++ b/drivers/gpio/gpio-bcm-kona.c
 @@ -496,7 +496,7 @@ static struct irq_chip bcm_gpio_irq_chip = {
   .irq_release_resources = bcm_kona_gpio_irq_relres,
  };
  
 -static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
 +static struct of_device_id const bcm_kona_gpio_of_match[] = {
   { .compatible = brcm,kona-gpio },
   {}
  };
 diff --git a/drivers/mmc/host/sdhci-bcm-kona.c 
 b/drivers/mmc/host/sdhci-bcm-kona.c
 index dd780c3..4bb06c8 100644
 --- a/drivers/mmc/host/sdhci-bcm-kona.c
 +++ b/drivers/mmc/host/sdhci-bcm-kona.c
 @@ -225,7 +225,7 @@ static struct sdhci_pltfm_data sdhci_pltfm_data_kona = {
   SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
  };
  
 -static struct __initconst of_device_id sdhci_bcm_kona_of_match[] = {
 +static struct of_device_id const sdhci_bcm_kona_of_match[] = {
   { .compatible = brcm,kona-sdhci},
   { .compatible = bcm,kona-sdhci}, /* deprecated name */
   {}

Acked-by: Matt Porter mpor...@linaro.org

-Matt
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gpio, bcm-kona, LLVMLinux: Remove use of __initconst

2014-09-23 Thread Matt Porter
On Tue, Sep 23, 2014 at 12:30:16PM -0700, beh...@converseincode.com wrote:
 From: Behan Webster beh...@converseincode.com
 
 The __initconst is in the wrong place, and when moved to the correct place
 it uncovers an error where the variable is used by non-init data structures.
 
 Instead merely make them const and put the const in the right spot.
 
 Signed-off-by: Behan Webster beh...@converseincode.com
 Reviewed-by: Mark Charlebois charl...@gmail.com
 Acked-by: Arnd Bergmann a...@arndb.de
 ---
  drivers/gpio/gpio-bcm-kona.c  | 2 +-
  drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

As mentioned on IRC, Linus, Chris, and Ulf probably would like this
split to go into each respective tree.

-Matt

 
 diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
 index 3f6b33c..de0801e 100644
 --- a/drivers/gpio/gpio-bcm-kona.c
 +++ b/drivers/gpio/gpio-bcm-kona.c
 @@ -496,7 +496,7 @@ static struct irq_chip bcm_gpio_irq_chip = {
   .irq_release_resources = bcm_kona_gpio_irq_relres,
  };
  
 -static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
 +static struct of_device_id const bcm_kona_gpio_of_match[] = {
   { .compatible = brcm,kona-gpio },
   {}
  };
 diff --git a/drivers/mmc/host/sdhci-bcm-kona.c 
 b/drivers/mmc/host/sdhci-bcm-kona.c
 index dd780c3..4bb06c8 100644
 --- a/drivers/mmc/host/sdhci-bcm-kona.c
 +++ b/drivers/mmc/host/sdhci-bcm-kona.c
 @@ -225,7 +225,7 @@ static struct sdhci_pltfm_data sdhci_pltfm_data_kona = {
   SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
  };
  
 -static struct __initconst of_device_id sdhci_bcm_kona_of_match[] = {
 +static struct of_device_id const sdhci_bcm_kona_of_match[] = {
   { .compatible = brcm,kona-sdhci},
   { .compatible = bcm,kona-sdhci}, /* deprecated name */
   {}
 -- 
 1.9.1
 
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] gpio, bcm-kona, LLVMLinux: Remove use of __initconst

2014-09-23 Thread behanw
From: Behan Webster beh...@converseincode.com

The __initconst is in the wrong place, and when moved to the correct place
it uncovers an error where the variable is used by non-init data structures.

Instead merely make them const and put the const in the right spot.

Signed-off-by: Behan Webster beh...@converseincode.com
Reviewed-by: Mark Charlebois charl...@gmail.com
Acked-by: Arnd Bergmann a...@arndb.de
Acked-by: Matt Porter mpor...@linaro.org
---
 drivers/gpio/gpio-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
index 3f6b33c..de0801e 100644
--- a/drivers/gpio/gpio-bcm-kona.c
+++ b/drivers/gpio/gpio-bcm-kona.c
@@ -496,7 +496,7 @@ static struct irq_chip bcm_gpio_irq_chip = {
.irq_release_resources = bcm_kona_gpio_irq_relres,
 };
 
-static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
+static struct of_device_id const bcm_kona_gpio_of_match[] = {
{ .compatible = brcm,kona-gpio },
{}
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/2] mmc, sdhci, bcm-kona, LLVMLinux: Remove use of __initconst

2014-09-23 Thread behanw
From: Behan Webster beh...@converseincode.com

The __initconst is in the wrong place, and when moved to the correct place
it uncovers an error where the variable is used by non-init data structures.

Instead merely make them const and put the const in the right spot.

Signed-off-by: Behan Webster beh...@converseincode.com
Reviewed-by: Mark Charlebois charl...@gmail.com
Acked-by: Arnd Bergmann a...@arndb.de
Acked-by: Matt Porter mpor...@linaro.org
---
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-bcm-kona.c 
b/drivers/mmc/host/sdhci-bcm-kona.c
index dd780c3..4bb06c8 100644
--- a/drivers/mmc/host/sdhci-bcm-kona.c
+++ b/drivers/mmc/host/sdhci-bcm-kona.c
@@ -225,7 +225,7 @@ static struct sdhci_pltfm_data sdhci_pltfm_data_kona = {
SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
 };
 
-static struct __initconst of_device_id sdhci_bcm_kona_of_match[] = {
+static struct of_device_id const sdhci_bcm_kona_of_match[] = {
{ .compatible = brcm,kona-sdhci},
{ .compatible = bcm,kona-sdhci}, /* deprecated name */
{}
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gpio, bcm-kona, LLVMLinux: Remove use of __initconst

2014-09-23 Thread Behan Webster

On 09/23/14 14:29, Matt Porter wrote:

On Tue, Sep 23, 2014 at 12:30:16PM -0700, beh...@converseincode.com wrote:

From: Behan Webster beh...@converseincode.com

The __initconst is in the wrong place, and when moved to the correct place
it uncovers an error where the variable is used by non-init data structures.

Instead merely make them const and put the const in the right spot.

Signed-off-by: Behan Webster beh...@converseincode.com
Reviewed-by: Mark Charlebois charl...@gmail.com
Acked-by: Arnd Bergmann a...@arndb.de
---
  drivers/gpio/gpio-bcm-kona.c  | 2 +-
  drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

As mentioned on IRC, Linus, Chris, and Ulf probably would like this
split to go into each respective tree.

Thanks Matt.

I reposted as a 2 patch series. Strictly speaking one patch is for each 
tree.


Behan

--
Behan Webster
beh...@converseincode.com

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html