[PATCH 1/4 V2] powerpc/85xx: Add support for 85xx cpu type detection

2013-07-10 Thread Haijun Zhang
Add this file to help detect cpu type in runtime.
These macros will be more favorable for driver
to apply errata and workaround to specified cpu type.

Signed-off-by: Haijun Zhang haijun.zh...@freescale.com
Signed-off-by: Zhao Chenhui chenhui.z...@freescale.com
---
changes v2:
- Remove inline function
- Ignore E bit of SOC
- Add Macro to get current soc version

 arch/powerpc/include/asm/mpc85xx.h | 53 ++
 1 file changed, 53 insertions(+)
 create mode 100644 arch/powerpc/include/asm/mpc85xx.h

diff --git a/arch/powerpc/include/asm/mpc85xx.h 
b/arch/powerpc/include/asm/mpc85xx.h
new file mode 100644
index 000..20af5e8
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc85xx.h
@@ -0,0 +1,53 @@
+/*
+ * MPC85xx cpu type detection
+ *
+ * Copyright 2011-2012 Freescale Semiconductor, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __ASM_PPC_MPC85XX_H
+#define __ASM_PPC_MPC85XX_H
+
+#define SVR_REV(svr)   ((svr)  0xFF)  /* SOC design resision */
+#define SVR_MAJ(svr)   (((svr)   4)  0xF)   /* Major revision field*/
+#define SVR_MIN(svr)   (((svr)   0)  0xF)   /* Minor revision field*/
+
+/* Some parts define SVR[0:23] as the SOC version */
+#define SVR_SOC_VER(svr) (((svr)  8)  0xFFF7FF) /* SOC Version fields */
+
+/* Get current SOC Version */
+#define GET_SVR()  (mfspr(SPRN_SVR))
+
+#define IS_SVR_REV(svr, maj, min) \
+   ((SVR_MAJ(svr) == (maj))  (SVR_MIN(svr) == (min)))
+
+#define SVR_8533   0x803400
+#define SVR_8535   0x803701
+#define SVR_8536   0x803700
+#define SVR_8540   0x803000
+#define SVR_8541   0x807200
+#define SVR_8543   0x803200
+#define SVR_8544   0x803401
+#define SVR_8545   0x803102
+#define SVR_8547   0x803101
+#define SVR_8548   0x803100
+#define SVR_8555   0x807100
+#define SVR_8560   0x807000
+#define SVR_8567   0x807501
+#define SVR_8568   0x807500
+#define SVR_8569   0x808000
+#define SVR_8572   0x80E000
+#define SVR_P1010  0x80f900
+#define SVR_P2041  0x821001
+#define SVR_P3041  0x821103
+#define SVR_P5010  0x822100
+#define SVR_P5020  0x822000
+#define SVR_P5040  0x820400
+#define SVR_T4240  0x824800
+#define SVR_B4860  0x868800
+
+#endif
-- 
1.8.0


--
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 2/5] mmc: dw_mmc: Add suspend_noirq/resume_noirq callbacks for dw_mmc-pltfm

2013-07-10 Thread James Hogan
Hi Doug,

On 10/07/13 00:19, Doug Anderson wrote:
 On some devices (like exynos5420) the dw_mmc controller may be in a
 strange state after we wake up from sleep.  Add callbacks to allow for
 dealing with these quirks.  We use the _noirq versions of the
 callbacks since in the case of exynos5420 the strange state caused
 interrupts to fire so we need to deal with it while interrupts are
 still off.
 
 At the moment this support is only added to dw_mmc-pltfm which calls
 straight to the callback, since nobody but exynos needs it.  We can
 add some levels of indirection (a call into the generic dw_mmc code)
 when someone finds a need.
 
 Signed-off-by: Doug Anderson diand...@chromium.org

Reviewed-by: James Hogan james.ho...@imgtec.com

snip

  
 -SIMPLE_DEV_PM_OPS(dw_mci_pltfm_pmops, dw_mci_pltfm_suspend, 
 dw_mci_pltfm_resume);
 +const struct dev_pm_ops dw_mci_pltfm_pmops = {
 + SET_SYSTEM_SLEEP_PM_OPS(dw_mci_pltfm_suspend, dw_mci_pltfm_resume)
 + .suspend_noirq = dw_mci_pltfm_suspend_noirq,
 + .resume_noirq = dw_mci_pltfm_resume_noirq,
 +};

Does Exynos support hibernation? I see that SET_SYSTEM_SLEEP_PM_OPS sets
freeze, thaw, poweroff, and restore callbacks too. You may not need the
hibernation specific _noirq callbacks though in which case it's probably
fine as it is.

Cheers
James

--
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] mmc: sdhci-moxart: Add MOXA ART SDHCI driver

2013-07-10 Thread Jonas Jensen
Add SDHCI driver for MOXA ART SoCs.

Signed-off-by: Jonas Jensen jonas.jen...@gmail.com
---

Notes:
Applies to next-20130703

I know this is a large chunk and there are many pitfalls with
the controller. I give you my word it does work / seem to be stable,
with or without DMA. Any feedback is appreciated.

Tested by creating multiple directories/files and moving the card
back and forth to different reader.

IRQF_DISABLED is now pointless, remove it from request_irq?

 drivers/mmc/host/Kconfig|   9 +
 drivers/mmc/host/Makefile   |   1 +
 drivers/mmc/host/sdhci-moxart.c | 786 
 drivers/mmc/host/sdhci-moxart.h | 155 
 4 files changed, 951 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-moxart.c
 create mode 100644 drivers/mmc/host/sdhci-moxart.h

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 1be2289..fb401c4 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -260,6 +260,15 @@ config MMC_SDHCI_BCM2835
 
  If unsure, say N.
 
+config MMC_SDHCI_MOXART
+   tristate MOXART SD Host Controller Interface support
+   depends on ARCH_MOXART  MMC
+   help
+ This selects the MOXART SD Host Controller Interface.
+ MOXA provides one multi-functional card reader which can
+ be found on some embedded hardware such as UC-7112-LX.
+ If you have a controller with this interface, say Y here.
+
 config MMC_OMAP
tristate TI OMAP Multimedia Card Interface support
depends on ARCH_OMAP
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 67718c1..274199a 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o
 obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)   += sdhci-of-esdhc.o
 obj-$(CONFIG_MMC_SDHCI_OF_HLWD)+= sdhci-of-hlwd.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)+= sdhci-bcm2835.o
+obj-$(CONFIG_MMC_SDHCI_MOXART) += sdhci-moxart.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
CFLAGS-cb710-mmc+= -DDEBUG
diff --git a/drivers/mmc/host/sdhci-moxart.c b/drivers/mmc/host/sdhci-moxart.c
new file mode 100644
index 000..f5aaea6
--- /dev/null
+++ b/drivers/mmc/host/sdhci-moxart.c
@@ -0,0 +1,786 @@
+/*
+ * MOXA ART MMC host driver.
+ *
+ * Copyright (C) 2013 Jonas Jensen
+ *
+ * Jonas Jensen jonas.jen...@gmail.com
+ *
+ * Based on code from
+ * Moxa Technology Co., Ltd. www.moxa.com
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed as is without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include linux/version.h
+#include linux/module.h
+#include linux/init.h
+#include linux/ioport.h
+#include linux/platform_device.h
+#include linux/delay.h
+#include linux/interrupt.h
+#include linux/blkdev.h
+#include linux/dma-mapping.h
+#include linux/dmaengine.h
+#include linux/mmc/host.h
+#include linux/mmc/sd.h
+#include linux/mmc/mmc.h
+#include linux/sched.h
+#include linux/io.h
+#include linux/gpio.h
+#include linux/sizes.h
+#include linux/of_address.h
+#include linux/of_irq.h
+#include linux/clk.h
+
+#include asm/dma.h
+#include asm/irq.h
+
+#include sdhci-moxart.h
+
+#define DMA_FIFO_LEN_FORCE 0
+#define APB_DMA_SD_REQ_NO  5
+#define MIN_POWER (MMC_VDD_360 - MSD_SD_POWER_MASK)
+
+static inline void moxart_init_sg(struct moxart_host *host,
+ struct mmc_data *data)
+{
+   host-cur_sg = data-sg;
+   host-num_sg = data-sg_len;
+   host-remain = host-cur_sg-length;
+
+   if (host-remain  host-size)
+   host-remain = host-size;
+
+   data-error = MMC_ERR_NONE;
+}
+
+static inline int moxart_next_sg(struct moxart_host *host)
+{
+   int remain;
+   struct mmc_data *data = host-mrq-cmd-data;
+
+   host-cur_sg++;
+   host-num_sg--;
+
+   if (host-num_sg  0) {
+   host-remain = host-cur_sg-length;
+   remain = host-size - data-bytes_xfered;
+   if (remain  0  remain  host-remain)
+   host-remain = remain;
+   }
+
+   return host-num_sg;
+}
+
+static void moxart_send_command(struct moxart_host *host,
+   struct mmc_command *cmd)
+{
+   unsigned int status, cmdctrl;
+   int retry = 0;
+
+   dev_dbg(mmc_dev(host-mmc), %s: cmd-opcode=%d\n,
+   __func__, cmd-opcode);
+
+   cmd-error = MMC_ERR_TIMEOUT;
+
+   writel(MSD_RSP_TIMEOUT | MSD_RSP_CRC_OK |
+  MSD_RSP_CRC_FAIL | MSD_CMD_SENT, host-reg-clear);
+   writel(cmd-arg, host-reg-argument);
+
+   cmdctrl = cmd-opcode  MSD_CMD_IDX_MASK;
+   if (cmdctrl == SD_APP_SET_BUS_WIDTH || cmdctrl == SD_APP_OP_COND ||
+   cmdctrl == SD_APP_SEND_SCR || cmdctrl == SD_APP_SD_STATUS ||
+   cmdctrl == SD_APP_SEND_NUM_WR_BLKS)
+ 

RE: [PATCH v2 5/5] mmc: dw_mmc: Set timeout to max upon resume

2013-07-10 Thread Seungwon Jeon
On Wed, July 10, 2013, Doug Anderson wrote:
 The TMOUT register is initted to 0x at probe time but isn't
 initted after suspend/resume.  Add an init of this value.
 
 No problems were observed without this (it will also get initted in
 __dw_mci_start_request if there is data to send), but it makes the
 register dump before and after suspend clean.
 
 Signed-off-by: Doug Anderson diand...@chromium.org

Acked-by: Seungwon Jeon tgih@samsung.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


RE: [PATCH v2 3/5] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT

2013-07-10 Thread Seungwon Jeon
On Wed, July 10, 2013, Doug Anderson wrote:
 If the WAKEUP_INT is asserted at wakeup and not cleared, we'll end up
 looping around forever.  This has been seen to happen on exynos5420
 silicon despite the fact that we haven't enabled any wakeup events.
 
 Signed-off-by: Doug Anderson diand...@chromium.org
 ---
 Changes in v2:
 - Use suspend_noirq as per James Hogan.
 
  drivers/mmc/host/dw_mmc-exynos.c | 23 +++
  1 file changed, 23 insertions(+)
 
 diff --git a/drivers/mmc/host/dw_mmc-exynos.c 
 b/drivers/mmc/host/dw_mmc-exynos.c
 index f013e7e..36b9620 100644
 --- a/drivers/mmc/host/dw_mmc-exynos.c
 +++ b/drivers/mmc/host/dw_mmc-exynos.c
 @@ -30,6 +30,7 @@
  #define SDMMC_CLKSEL_TIMING(x, y, z) (SDMMC_CLKSEL_CCLK_SAMPLE(x) |  \
   SDMMC_CLKSEL_CCLK_DRIVE(y) |\
   SDMMC_CLKSEL_CCLK_DIVIDER(z))
 +#define SDMMC_CLKSEL_WAKEUP_INT  BIT(11)
 
  #define SDMMC_CMD_USE_HOLD_REG   BIT(29)
 
 @@ -102,6 +103,27 @@ static int dw_mci_exynos_setup_clock(struct dw_mci *host)
   return 0;
  }
 
 +/**
 + * dw_mci_exynos_resume_noirq - Exynos-specific resume code
 + *
 + * We have seen cases (at least on the exynos5420) where turning off the INT
 + * power rail during suspend will leave the WAKEUP_INT bit in the CLKSEL
 + * register asserted.  This bit is 1 to indicate that it fired and we can
 + * clear it by writing a 1 back.  Clear it to prevent interrupts from going 
 off
 + * constantly.
 + */
As I know this bit is auto-cleared.
Did you find the cause of this problem?
How about your GPIO setting in sleep?
Currently, we don't know why the problem is happened.
At least, we should make it clear.

Thanks,
Seungwon Jeon

 +
 +static int dw_mci_exynos_resume_noirq(struct dw_mci *host)
 +{
 + u32 clksel;
 +
 + clksel = mci_readl(host, CLKSEL);
 + if (clksel  SDMMC_CLKSEL_WAKEUP_INT)
 + mci_writel(host, CLKSEL, clksel);
 +
 + return 0;
 +}
 +
  static void dw_mci_exynos_prepare_command(struct dw_mci *host, u32 *cmdr)
  {
   /*
 @@ -165,6 +187,7 @@ static const struct dw_mci_drv_data exynos_drv_data = {
   .caps   = exynos_dwmmc_caps,
   .init   = dw_mci_exynos_priv_init,
   .setup_clock= dw_mci_exynos_setup_clock,
 + .resume_noirq   = dw_mci_exynos_resume_noirq,
   .prepare_command= dw_mci_exynos_prepare_command,
   .set_ios= dw_mci_exynos_set_ios,
   .parse_dt   = dw_mci_exynos_parse_dt,
 --
 1.8.3
 
 --
 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

--
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 2/5] mmc: dw_mmc: Add suspend_noirq/resume_noirq callbacks for dw_mmc-pltfm

2013-07-10 Thread Doug Anderson
James,

On Wed, Jul 10, 2013 at 1:37 AM, James Hogan james.ho...@imgtec.com wrote:
 -SIMPLE_DEV_PM_OPS(dw_mci_pltfm_pmops, dw_mci_pltfm_suspend, 
 dw_mci_pltfm_resume);
 +const struct dev_pm_ops dw_mci_pltfm_pmops = {
 + SET_SYSTEM_SLEEP_PM_OPS(dw_mci_pltfm_suspend, dw_mci_pltfm_resume)
 + .suspend_noirq = dw_mci_pltfm_suspend_noirq,
 + .resume_noirq = dw_mci_pltfm_resume_noirq,
 +};

 Does Exynos support hibernation? I see that SET_SYSTEM_SLEEP_PM_OPS sets
 freeze, thaw, poweroff, and restore callbacks too. You may not need the
 hibernation specific _noirq callbacks though in which case it's probably
 fine as it is.

Thank you for your review and good suggestions.  You're right that I
should add the other noirq variants in here.  Even if hibernation
isn't supported now that's the right thing to do.  I will fix that and
send v3 with your Reviewed-by.


-Doug
--
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 v3 1/5] mmc: dw_mmc: Invalidate cache of current_speed after suspend/resume

2013-07-10 Thread Doug Anderson
The dw_mmc driver keeps a cache of the current slot-clock in order to
avoid doing a whole lot of work every time set_ios() is called.
However, after suspend/resume the register values are bogus so we need
to ensure that the cached value is invalidated.

In many cases we got by without this since the core mmc code fiddles
with the clock a lot.  If we've got a card present we're probably
running it at something like 50MHz and the core will temporarily
switch us to 400kHz after resume.  One case that didn't work (for me)
is the case of having no card in the slot.  The slot is initted to
400kHz at boot time.  After suspend/resume the slot thinks it's still
at 400kHz (due to the cache) so doesn't adjust timing.  When it tries
to send the command at probe time it just times out and gets left in a
bad state.

Invalidating the current_speed also means that we don't need to call:
  dw_mci_setup_bus(slot, true);
...to force an update of the clock in the case when the slot was left
powered.

Signed-off-by: Doug Anderson diand...@chromium.org
---
Changes in v3: None
Changes in v2:
- Fix typo (some - come)
- Use ~0 instead of 0x; add comment about value

 drivers/mmc/host/dw_mmc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index bc3a1bc..7a5ce6a 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2488,13 +2488,19 @@ int dw_mci_resume(struct dw_mci *host)
   DW_MCI_ERROR_FLAGS | SDMMC_INT_CD);
mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE);
 
+   /*
+* Invalidate the 'current_speed' value since CLKDIV has come up in
+* default state and our cache is incorrect; set to something we know
+* slot-clock won't be.
+*/
+   host-current_speed = ~0;
+
for (i = 0; i  host-num_slots; i++) {
struct dw_mci_slot *slot = host-slot[i];
if (!slot)
continue;
if (slot-mmc-pm_flags  MMC_PM_KEEP_POWER) {
dw_mci_set_ios(slot-mmc, slot-mmc-ios);
-   dw_mci_setup_bus(slot, true);
}
 
ret = mmc_resume_host(host-slot[i]-mmc);
-- 
1.8.3

--
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 v3 3/5] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT

2013-07-10 Thread Doug Anderson
If the WAKEUP_INT is asserted at wakeup and not cleared, we'll end up
looping around forever.  This has been seen to happen on exynos5420
silicon despite the fact that we haven't enabled any wakeup events.

Signed-off-by: Doug Anderson diand...@chromium.org
---
Changes in v3: None
Changes in v2:
- Use suspend_noirq as per James Hogan.

 drivers/mmc/host/dw_mmc-exynos.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index f013e7e..36b9620 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -30,6 +30,7 @@
 #define SDMMC_CLKSEL_TIMING(x, y, z)   (SDMMC_CLKSEL_CCLK_SAMPLE(x) |  \
SDMMC_CLKSEL_CCLK_DRIVE(y) |\
SDMMC_CLKSEL_CCLK_DIVIDER(z))
+#define SDMMC_CLKSEL_WAKEUP_INTBIT(11)
 
 #define SDMMC_CMD_USE_HOLD_REG BIT(29)
 
@@ -102,6 +103,27 @@ static int dw_mci_exynos_setup_clock(struct dw_mci *host)
return 0;
 }
 
+/**
+ * dw_mci_exynos_resume_noirq - Exynos-specific resume code
+ *
+ * We have seen cases (at least on the exynos5420) where turning off the INT
+ * power rail during suspend will leave the WAKEUP_INT bit in the CLKSEL
+ * register asserted.  This bit is 1 to indicate that it fired and we can
+ * clear it by writing a 1 back.  Clear it to prevent interrupts from going off
+ * constantly.
+ */
+
+static int dw_mci_exynos_resume_noirq(struct dw_mci *host)
+{
+   u32 clksel;
+
+   clksel = mci_readl(host, CLKSEL);
+   if (clksel  SDMMC_CLKSEL_WAKEUP_INT)
+   mci_writel(host, CLKSEL, clksel);
+
+   return 0;
+}
+
 static void dw_mci_exynos_prepare_command(struct dw_mci *host, u32 *cmdr)
 {
/*
@@ -165,6 +187,7 @@ static const struct dw_mci_drv_data exynos_drv_data = {
.caps   = exynos_dwmmc_caps,
.init   = dw_mci_exynos_priv_init,
.setup_clock= dw_mci_exynos_setup_clock,
+   .resume_noirq   = dw_mci_exynos_resume_noirq,
.prepare_command= dw_mci_exynos_prepare_command,
.set_ios= dw_mci_exynos_set_ios,
.parse_dt   = dw_mci_exynos_parse_dt,
-- 
1.8.3

--
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 v3 5/5] mmc: dw_mmc: Set timeout to max upon resume

2013-07-10 Thread Doug Anderson
The TMOUT register is initted to 0x at probe time but isn't
initted after suspend/resume.  Add an init of this value.

No problems were observed without this (it will also get initted in
__dw_mci_start_request if there is data to send), but it makes the
register dump before and after suspend clean.

Signed-off-by: Doug Anderson diand...@chromium.org
Acked-by: Seungwon Jeon tgih@samsung.com
---
Changes in v3: None
Changes in v2: None

 drivers/mmc/host/dw_mmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index be095b7..d2c5db3 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2482,6 +2482,9 @@ int dw_mci_resume(struct dw_mci *host)
/* Restore the old value at FIFOTH register */
mci_writel(host, FIFOTH, host-fifoth_val);
 
+   /* Put in max timeout */
+   mci_writel(host, TMOUT, 0x);
+
mci_writel(host, RINTSTS, 0x);
mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER |
   SDMMC_INT_TXDR | SDMMC_INT_RXDR |
-- 
1.8.3

--
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 v3 2/5] mmc: dw_mmc: Add suspend_noirq/resume_noirq callbacks for dw_mmc-pltfm

2013-07-10 Thread Doug Anderson
On some devices (like exynos5420) the dw_mmc controller may be in a
strange state after we wake up from sleep.  Add callbacks to allow for
dealing with these quirks.  We use the _noirq versions of the
callbacks since in the case of exynos5420 the strange state caused
interrupts to fire so we need to deal with it while interrupts are
still off.

At the moment this support is only added to dw_mmc-pltfm which calls
straight to the callback, since nobody but exynos needs it.  We can
add some levels of indirection (a call into the generic dw_mmc code)
when someone finds a need.

Signed-off-by: Doug Anderson diand...@chromium.org
Reviewed-by: James Hogan james.ho...@imgtec.com
---
Changes in v3:
- Add freeze/thaw and poweroff/restore noirq entries.

Changes in v2:
- Use suspend_noirq as per James Hogan.

 drivers/mmc/host/dw_mmc-pltfm.c | 41 ++---
 drivers/mmc/host/dw_mmc.h   |  4 
 2 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index 41c27b7..742ef76 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -105,12 +105,47 @@ static int dw_mci_pltfm_resume(struct device *dev)
 
return 0;
 }
+
+static int dw_mci_pltfm_suspend_noirq(struct device *dev)
+{
+   struct dw_mci *host = dev_get_drvdata(dev);
+   const struct dw_mci_drv_data *drv_data = host-drv_data;
+
+   if (drv_data  drv_data-suspend_noirq)
+   return drv_data-suspend_noirq(host);
+
+   return 0;
+}
+
+static int dw_mci_pltfm_resume_noirq(struct device *dev)
+{
+   struct dw_mci *host = dev_get_drvdata(dev);
+   const struct dw_mci_drv_data *drv_data = host-drv_data;
+
+   if (drv_data  drv_data-resume_noirq)
+   return drv_data-resume_noirq(host);
+
+   return 0;
+}
+
+
 #else
-#define dw_mci_pltfm_suspend   NULL
-#define dw_mci_pltfm_resumeNULL
+#define dw_mci_pltfm_suspend   NULL
+#define dw_mci_pltfm_resumeNULL
+#define dw_mci_pltfm_suspend_noirq NULL
+#define dw_mci_pltfm_resume_noirq  NULL
 #endif /* CONFIG_PM_SLEEP */
 
-SIMPLE_DEV_PM_OPS(dw_mci_pltfm_pmops, dw_mci_pltfm_suspend, 
dw_mci_pltfm_resume);
+const struct dev_pm_ops dw_mci_pltfm_pmops = {
+   SET_SYSTEM_SLEEP_PM_OPS(dw_mci_pltfm_suspend, dw_mci_pltfm_resume)
+   .suspend_noirq = dw_mci_pltfm_suspend_noirq,
+   .resume_noirq = dw_mci_pltfm_resume_noirq,
+   .freeze_noirq = dw_mci_pltfm_suspend_noirq,
+   .thaw_noirq = dw_mci_pltfm_resume_noirq,
+   .poweroff_noirq = dw_mci_pltfm_suspend_noirq,
+   .restore_noirq = dw_mci_pltfm_resume_noirq,
+};
+
 EXPORT_SYMBOL_GPL(dw_mci_pltfm_pmops);
 
 static const struct of_device_id dw_mci_pltfm_match[] = {
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 0b74189..5d0398f 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -190,6 +190,8 @@ extern int dw_mci_resume(struct dw_mci *host);
  * @prepare_command: handle CMD register extensions.
  * @set_ios: handle bus specific extensions.
  * @parse_dt: parse implementation specific device tree properties.
+ * @suspend_noirq: called late in the suspend process
+ * @resume_noirq: called early in the resume process
  *
  * Provide controller implementation specific extensions. The usage of this
  * data structure is fully optional and usage of each member in this structure
@@ -202,5 +204,7 @@ struct dw_mci_drv_data {
void(*prepare_command)(struct dw_mci *host, u32 *cmdr);
void(*set_ios)(struct dw_mci *host, struct mmc_ios *ios);
int (*parse_dt)(struct dw_mci *host);
+   int (*suspend_noirq)(struct dw_mci *host);
+   int (*resume_noirq)(struct dw_mci *host);
 };
 #endif /* _DW_MMC_H_ */
-- 
1.8.3

--
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 v3 4/5] mmc: dw_mmc: Always setup the bus after suspend/resume

2013-07-10 Thread Doug Anderson
After suspend/resume all of the dw_mmc registers are reset to
defaults.  We restore most of them, but specifically don't setup the
clock registers after resume unless we've got a powered card.  Things
still work because the core will eventually call set_ios() and we'll
set things up.

There doesn't seem to be any reason that I can see _not_ to set things
up after resume.  Restoring this state makes the code easier to reason
about and should help prevent bugs.  It also allows us to do a
register dump before and after suspend/resume to confirm that we've
set things up OK.

I examined the state of the dw_mmc instance before and after suspend
after this patch.  I had no card inserted in an SD card slot.

Before this patch, differences were:
* CLKDIV (0x08)
* CLKENA (0x10)
* TMOUT (0x14)
* CMD (0x2C) - difference is not important
* CLKSEL (0x9C - exynos specific)

After this patch, only TMOUT was different.  I have a separate patch
for that.

Signed-off-by: Doug Anderson diand...@chromium.org
---
Changes in v3: None
Changes in v2: None

 drivers/mmc/host/dw_mmc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 7a5ce6a..be095b7 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2499,9 +2499,7 @@ int dw_mci_resume(struct dw_mci *host)
struct dw_mci_slot *slot = host-slot[i];
if (!slot)
continue;
-   if (slot-mmc-pm_flags  MMC_PM_KEEP_POWER) {
-   dw_mci_set_ios(slot-mmc, slot-mmc-ios);
-   }
+   dw_mci_set_ios(slot-mmc, slot-mmc-ios);
 
ret = mmc_resume_host(host-slot[i]-mmc);
if (ret  0)
-- 
1.8.3

--
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] mmc: omap_hsmmc: use the generic config for omap2plus devices

2013-07-10 Thread a-bindra
From: Amarinder Bindra a-bin...@ti.com

OMAP's hs_mmc driver is used for MMC controller operation on many
omap2plus SoCs (OMAP2430, OMAP3, 4, 5 and AM335x).

Considering that the device tree entries are already present for these,
allow the driver to be built using the config ARCH_OMAP2PLUS rather
than individually adding a config for each SoC to enable the
support.

Use COMPILE_TEST to enable the build for other platforms.

Signed-off-by: Amarinder Bindra a-bin...@ti.com
Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com
Cc: Felipe Balbi ba...@ti.com
Cc: Nishanth Menon n...@ti.com
---
Changes in v2:
- Use the config ARCH_OMAP2PLUS to enable the driver
- Use COMPILE_TEST
- Update the commit message

v1: https://patchwork.kernel.org/patch/2824632/ 

 drivers/mmc/host/Kconfig |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 009dabd..48f6fe7 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -254,11 +254,11 @@ config MMC_OMAP
 
 config MMC_OMAP_HS
tristate TI OMAP High Speed Multimedia Card Interface support
-   depends on SOC_OMAP2430 || ARCH_OMAP3 || ARCH_OMAP4
+   depends on ARCH_OMAP2PLUS || COMPILE_TEST
help
  This selects the TI OMAP High Speed Multimedia card Interface.
- If you have an OMAP2430 or OMAP3 board or OMAP4 board with a
- Multimedia Card slot, say Y or M here.
+ If you have an omap2plus board with a Multimedia Card slot,
+ say Y or M here.
 
  If unsure, say N.
 
-- 
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 6/6] ARM: shmobile: lager: disable MMCIF Command Completion Signal, add CLK_CTRL2

2013-07-10 Thread Guennadi Liakhovetski
MMCIF on r8a7790 doesn't support Command Completion Signal, but it does
implement a CE_CLK_CTRL2 register. Platform parameters have to be added to
account for these features on lager.

Signed-off-by: Guennadi Liakhovetski g.liakhovetski+rene...@gmail.com
---
 arch/arm/mach-shmobile/board-lager.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c 
b/arch/arm/mach-shmobile/board-lager.c
index 3c67b2a..9b3085f 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -84,6 +84,8 @@ static struct regulator_consumer_supply 
fixed3v3_power_consumers[] =
 /* MMCIF */
 static struct sh_mmcif_plat_data mmcif1_pdata = {
.caps   = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
+   .clk_ctrl2_present = true,
+   .ccs_unsupported = true,
 };
 
 static struct resource mmcif1_resources[] = {
-- 
1.7.2.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 0/6] mmc: sh_mmcif: revision-specific CCS and CLK_CTRL2 handling

2013-07-10 Thread Guennadi Liakhovetski
This patch series adds version-specific support for Command Completion 
Signal and the CE_CLK_CTRL2 register. Presumably, the first two patches 
will go via the MMC tree, the rest should be applied after them.

Cc: Guennadi Liakhovetski g.liakhovetski+rene...@gmail.com

Guennadi Liakhovetski (6):
  mmc: sh_mmcif: revision-specific Command Completion Signal handling
  mmc: sh_mmcif: revision-specific CLK_CTRL2 handling
  ARM: shmobile: armadillo800eva: disable MMCIF Command Completion
Signal
  ARM: shmobile: kzm9g: disable MMCIF Command Completion Signal
  ARM: shmobile: ape6evm: disable MMCIF Command Completion Signal
  ARM: shmobile: lager: disable MMCIF Command Completion Signal, add
CLK_CTRL2

 arch/arm/mach-shmobile/board-ape6evm.c |1 +
 arch/arm/mach-shmobile/board-armadillo800eva.c |1 +
 arch/arm/mach-shmobile/board-kzm9g.c   |1 +
 arch/arm/mach-shmobile/board-lager.c   |2 +
 drivers/mmc/host/sh_mmcif.c|   31 +++
 include/linux/mmc/sh_mmcif.h   |3 ++
 6 files changed, 33 insertions(+), 6 deletions(-)

-- 
1.7.2.5

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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: sh_mmcif: revision-specific CLK_CTRL2 handling

2013-07-10 Thread Guennadi Liakhovetski
Some newer MMCIF IP revisions contain a CE_CLK_CTRL2 register, that has to
be set for proper operation. Support for this feature is added in a way to
preserve the current behaviour by default, i.e. when it is not enabled
in platform data. Patch is based on work by Nobuyuki HIRAI.

Signed-off-by: Guennadi Liakhovetski g.liakhovetski+rene...@gmail.com
---
 drivers/mmc/host/sh_mmcif.c  |4 
 include/linux/mmc/sh_mmcif.h |2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 7be20c9..dc3ce52 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -246,6 +246,7 @@ struct sh_mmcif_host {
bool power;
bool card_present;
bool ccs_enable;/* Command Completion Signal support */
+   bool clk_ctrl2_enable;
struct mutex thread_lock;
 
/* DMA support */
@@ -490,6 +491,8 @@ static void sh_mmcif_sync_reset(struct sh_mmcif_host *host)
sh_mmcif_writel(host-addr, MMCIF_CE_VERSION, SOFT_RST_OFF);
if (host-ccs_enable)
tmp |= SCCSTO_29;
+   if (host-clk_ctrl2_enable)
+   sh_mmcif_writel(host-addr, MMCIF_CE_CLK_CTRL2, 0x0F0F);
sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp |
SRSPTO_256 | SRBSYTO_29 | SRWDTO_29);
/* byte swap on */
@@ -1390,6 +1393,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
host-addr  = reg;
host-timeout   = msecs_to_jiffies(1000);
host-ccs_enable = !pd || !pd-ccs_unsupported;
+   host-clk_ctrl2_enable = pd  pd-clk_ctrl2_present;
 
host-pd = pdev;
 
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index b2a22b6..d4277d9 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -40,6 +40,7 @@ struct sh_mmcif_plat_data {
unsigned intslave_id_rx;
booluse_cd_gpio : 1;
boolccs_unsupported : 1;
+   boolclk_ctrl2_present : 1;
unsigned intcd_gpio;
u8  sup_pclk;   /* 1 :SH7757, 0: SH7724/SH7372 
*/
unsigned long   caps;
@@ -63,6 +64,7 @@ struct sh_mmcif_plat_data {
 #define MMCIF_CE_INT_MASK  0x0044
 #define MMCIF_CE_HOST_STS1 0x0048
 #define MMCIF_CE_HOST_STS2 0x004C
+#define MMCIF_CE_CLK_CTRL2 0x0070
 #define MMCIF_CE_VERSION   0x007C
 
 /* CE_BUF_ACC */
-- 
1.7.2.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 4/6] ARM: shmobile: kzm9g: disable MMCIF Command Completion Signal

2013-07-10 Thread Guennadi Liakhovetski
MMCIF on sh73a0 doesn't support Command Completion Signal, a platform
parameter has to be added to disable it on kzm9g.

Signed-off-by: Guennadi Liakhovetski g.liakhovetski+rene...@gmail.com
---
 arch/arm/mach-shmobile/board-kzm9g.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-kzm9g.c 
b/arch/arm/mach-shmobile/board-kzm9g.c
index 165483c..7ec26a5 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -365,6 +365,7 @@ static struct resource sh_mmcif_resources[] = {
 static struct sh_mmcif_plat_data sh_mmcif_platdata = {
.ocr= MMC_VDD_165_195,
.caps   = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
+   .ccs_unsupported = true,
.slave_id_tx= SHDMA_SLAVE_MMCIF_TX,
.slave_id_rx= SHDMA_SLAVE_MMCIF_RX,
 };
-- 
1.7.2.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 1/6] mmc: sh_mmcif: revision-specific Command Completion Signal handling

2013-07-10 Thread Guennadi Liakhovetski
Some earlier MMCIF IP revisions contained Command Completion Signal
support, which has been dropped again in modern versions. Sopport for
this feature is added in a way to preserve the current behaviour by
default, i.e. when it is not enabled in platform data. Patch is based
on work by Nobuyuki HIRAI.

Signed-off-by: Guennadi Liakhovetski g.liakhovetski+rene...@gmail.com
---
 drivers/mmc/host/sh_mmcif.c  |   27 +--
 include/linux/mmc/sh_mmcif.h |1 +
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 06caaae..7be20c9 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -133,6 +133,8 @@
 INT_BUFWEN | INT_CMD12DRE | INT_BUFRE | \
 INT_DTRANE | INT_CMD12RBE | INT_CMD12CRE)
 
+#define INT_CCS(INT_CCSTO | INT_CCSRCV | INT_CCSDE)
+
 /* CE_INT_MASK */
 #define MASK_ALL   0x
 #define MASK_MCCSDE(1  29)
@@ -161,7 +163,7 @@
 
 #define MASK_START_CMD (MASK_MCMDVIO | MASK_MBUFVIO | MASK_MWDATERR | \
 MASK_MRDATERR | MASK_MRIDXERR | MASK_MRSPERR | 
\
-MASK_MCCSTO | MASK_MCRCSTO | MASK_MWDATTO | \
+MASK_MCRCSTO | MASK_MWDATTO | \
 MASK_MRDATTO | MASK_MRBSYTO | MASK_MRSPTO)
 
 #define MASK_CLEAN (INT_ERR_STS | MASK_MRBSYE | MASK_MCRSPE |  
\
@@ -243,6 +245,7 @@ struct sh_mmcif_host {
int sg_blkidx;
bool power;
bool card_present;
+   bool ccs_enable;/* Command Completion Signal support */
struct mutex thread_lock;
 
/* DMA support */
@@ -485,8 +488,10 @@ static void sh_mmcif_sync_reset(struct sh_mmcif_host *host)
 
sh_mmcif_writel(host-addr, MMCIF_CE_VERSION, SOFT_RST_ON);
sh_mmcif_writel(host-addr, MMCIF_CE_VERSION, SOFT_RST_OFF);
+   if (host-ccs_enable)
+   tmp |= SCCSTO_29;
sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp |
-   SRSPTO_256 | SRBSYTO_29 | SRWDTO_29 | SCCSTO_29);
+   SRSPTO_256 | SRBSYTO_29 | SRWDTO_29);
/* byte swap on */
sh_mmcif_bitset(host, MMCIF_CE_BUF_ACC, BUF_ACC_ATYP);
 }
@@ -866,6 +871,9 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host,
break;
}
 
+   if (host-ccs_enable)
+   mask |= MASK_MCCSTO;
+
if (mrq-data) {
sh_mmcif_writel(host-addr, MMCIF_CE_BLOCK_SET, 0);
sh_mmcif_writel(host-addr, MMCIF_CE_BLOCK_SET,
@@ -873,7 +881,10 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host,
}
opc = sh_mmcif_set_cmd(host, mrq);
 
-   sh_mmcif_writel(host-addr, MMCIF_CE_INT, 0xD80430C0);
+   if (host-ccs_enable)
+   sh_mmcif_writel(host-addr, MMCIF_CE_INT, 0xD80430C0);
+   else
+   sh_mmcif_writel(host-addr, MMCIF_CE_INT, 0xD80430C0 | INT_CCS);
sh_mmcif_writel(host-addr, MMCIF_CE_INT_MASK, mask);
/* set arg */
sh_mmcif_writel(host-addr, MMCIF_CE_ARG, cmd-arg);
@@ -1241,11 +1252,14 @@ static irqreturn_t sh_mmcif_irqt(int irq, void *dev_id)
 static irqreturn_t sh_mmcif_intr(int irq, void *dev_id)
 {
struct sh_mmcif_host *host = dev_id;
-   u32 state;
+   u32 state, mask;
 
state = sh_mmcif_readl(host-addr, MMCIF_CE_INT);
-   sh_mmcif_writel(host-addr, MMCIF_CE_INT,
-   ~(state  sh_mmcif_readl(host-addr, 
MMCIF_CE_INT_MASK)));
+   mask = sh_mmcif_readl(host-addr, MMCIF_CE_INT_MASK);
+   if (host-ccs_enable)
+   sh_mmcif_writel(host-addr, MMCIF_CE_INT, ~(state  mask));
+   else
+   sh_mmcif_writel(host-addr, MMCIF_CE_INT, INT_CCS | ~(state  
mask));
sh_mmcif_bitclr(host, MMCIF_CE_INT_MASK, state  MASK_CLEAN);
 
if (state  ~MASK_CLEAN)
@@ -1375,6 +1389,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
host-mmc   = mmc;
host-addr  = reg;
host-timeout   = msecs_to_jiffies(1000);
+   host-ccs_enable = !pd || !pd-ccs_unsupported;
 
host-pd = pdev;
 
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index e7d5dd6..b2a22b6 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -39,6 +39,7 @@ struct sh_mmcif_plat_data {
unsigned intslave_id_tx;/* embedded slave_id_[tr]x */
unsigned intslave_id_rx;
booluse_cd_gpio : 1;
+   boolccs_unsupported : 1;
unsigned intcd_gpio;
u8  sup_pclk;   /* 1 :SH7757, 0: SH7724/SH7372 
*/
unsigned long   caps;
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to 

[PATCH 5/6] ARM: shmobile: ape6evm: disable MMCIF Command Completion Signal

2013-07-10 Thread Guennadi Liakhovetski
MMCIF on r8a73a4 doesn't support Command Completion Signal, a platform
parameter has to be added to disable it on ape6evm.

Signed-off-by: Guennadi Liakhovetski g.liakhovetski+rene...@gmail.com
---
 arch/arm/mach-shmobile/board-ape6evm.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-ape6evm.c 
b/arch/arm/mach-shmobile/board-ape6evm.c
index e9e2108e..96a6994 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -77,6 +77,7 @@ static struct sh_mmcif_plat_data mmcif0_pdata = {
.caps   = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
.slave_id_tx= SHDMA_SLAVE_MMCIF0_TX,
.slave_id_rx= SHDMA_SLAVE_MMCIF0_RX,
+   .ccs_unsupported = true,
 };
 
 static struct resource mmcif0_resources[] = {
-- 
1.7.2.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 04/12] drivers/mmc/host: don't use devm_pinctrl_get_select_default() in probe

2013-07-10 Thread Marek Vasut
Dear Wolfram Sang,

 Since commit ab78029 (drivers/pinctrl: grab default handles from device
 core), we can rely on device core for setting the default pins. Compile
 tested only.
 
 Acked-by: Linus Walleij linus.wall...@linaro.org (personally at LCE13)
 Signed-off-by: Wolfram Sang w...@the-dreams.de

Something like that is already in -next:

mmc: mxs-mmc: Let device core handle pinctrl

Otherwise

Tested-by: Marek Vasut ma...@denx.de

Best regards,
Marek Vasut
--
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] Powerpc/t4240: change the compatible flags for t4240qds board

2013-07-10 Thread Scott Wood

On 07/09/2013 10:41:22 PM, Zhang Haijun-B42677 wrote:
 No.  It's still supposed to be describing the sdhc block itself,  
not the
 board -- and any workarounds that key off of this will still fail  
to work

 with existing device trees.
[Haijun Wrote:] So, leave dts unchanged and to check compitable for  
board in sdhci-pltfm.c

e.g.:
unsigned long root = of_get_flat_dt_root();

if (of_flat_dt_is_compatible(root, fsl,T4240QDS))
host-quirks |= XXX;


Why are you looking at the flat tree at this point?  Use the normal OF  
accessors.  The flat stuff is only for early boot.


Also make sure that you only do this for quirks that are actually  
board-specific.  In your last patch you had two quirks keyed off of the  
board, one of which is keyed off of the SoC for other chips.


-SCott
--
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 1/4 V2] powerpc/85xx: Add support for 85xx cpu type detection

2013-07-10 Thread Scott Wood

On 07/10/2013 02:39:01 AM, Haijun Zhang wrote:

+/* Get current SOC Version */
+#define GET_SVR()  (mfspr(SPRN_SVR))


Unnecessary parens.  Why do we need GET_SVR(), versus opencoding it?   
Note that U-Boot (which this is patterned after) doesn't have  
GET_SVR(), so code that wants to work on both can't use it anyway.



+#define IS_SVR_REV(svr, maj, min) \
+   ((SVR_MAJ(svr) == (maj))  (SVR_MIN(svr) == (min)))


I don't think IS_SVR_REV is needed.  Callers can just do if  
(SVR_REV(svr) == 0x30) or whatever, especially since we're relying on  
them to do this for greater/less than comparisons.


-Scott
--
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] mmc: omap_hsmmc: use the generic config for omap2plus devices

2013-07-10 Thread Ezequiel Garcia
On Wed, Jul 10, 2013 at 09:36:24PM +0530, a-bin...@ti.com wrote:
 From: Amarinder Bindra a-bin...@ti.com
 
 OMAP's hs_mmc driver is used for MMC controller operation on many
 omap2plus SoCs (OMAP2430, OMAP3, 4, 5 and AM335x).
 
 Considering that the device tree entries are already present for these,
 allow the driver to be built using the config ARCH_OMAP2PLUS rather
 than individually adding a config for each SoC to enable the
 support.
 
 Use COMPILE_TEST to enable the build for other platforms.
 
 Signed-off-by: Amarinder Bindra a-bin...@ti.com
 Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com
 Cc: Felipe Balbi ba...@ti.com
 Cc: Nishanth Menon n...@ti.com

Acked-by: Ezequiel Garcia ezequiel.gar...@free-electrons.com

-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.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


Re: [PATCH 3/5] mmc: dw_mmc: Add exynos resume callback to clear WAKEUP_INT

2013-07-10 Thread Grant Grundler
On Tue, Jul 9, 2013 at 12:09 PM, Doug Anderson diand...@chromium.org wrote:
 Hi,

 On Tue, Jul 9, 2013 at 10:31 AM, Doug Anderson diand...@chromium.org wrote:
 If the WAKEUP_INT is asserted at wakeup and not cleared, we'll end up
 looping around forever.

 Signed-off-by: Doug Anderson diand...@chromium.org
 ---
  drivers/mmc/host/dw_mmc-exynos.c | 23 +++
  1 file changed, 23 insertions(+)

 Grant just pointed out that the WAKEUP_INT is supposed to only be
 enabled if bits 8, 9, or 10 are 1.  Our driver never sets those so we
 _should_ never get a WAKEUP_INT.  Bits 8-10 are marked as RESERVED on
 the exynos5420 manual, so the current guess is that they're broken on
 that silicon but that sometimes the interrupt fires anyway.

 In any case, it is still a reasonable thing to clear this interrupt at
 wakeup if it has fired, even if we're on an exynos device without any
 problems.

I agree. Can add:
  Reviewed-by: Grant Grundler grund...@chromium.org

thanks,
grant


 -Doug
--
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 V3] powerpc/85xx: Add support for 85xx cpu type detection

2013-07-10 Thread Haijun Zhang
Add this file to help detect cpu type in runtime.
These macros will be more favorable for driver
to apply errata and workaround to specified cpu type.

Signed-off-by: Haijun Zhang haijun.zh...@freescale.com
Signed-off-by: Zhao Chenhui chenhui.z...@freescale.com
---
changes for v3:
- remove get_svr and is_svr_rev

 arch/powerpc/include/asm/mpc85xx.h | 47 ++
 1 file changed, 47 insertions(+)
 create mode 100644 arch/powerpc/include/asm/mpc85xx.h

diff --git a/arch/powerpc/include/asm/mpc85xx.h 
b/arch/powerpc/include/asm/mpc85xx.h
new file mode 100644
index 000..824b619
--- /dev/null
+++ b/arch/powerpc/include/asm/mpc85xx.h
@@ -0,0 +1,47 @@
+/*
+ * MPC85xx cpu type detection
+ *
+ * Copyright 2011-2012 Freescale Semiconductor, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __ASM_PPC_MPC85XX_H
+#define __ASM_PPC_MPC85XX_H
+
+#define SVR_REV(svr)   ((svr)  0xFF)  /* SOC design resision */
+#define SVR_MAJ(svr)   (((svr)   4)  0xF)   /* Major revision field*/
+#define SVR_MIN(svr)   (((svr)   0)  0xF)   /* Minor revision field*/
+
+/* Some parts define SVR[0:23] as the SOC version */
+#define SVR_SOC_VER(svr) (((svr)  8)  0xFFF7FF) /* SOC Version fields */
+
+#define SVR_8533   0x803400
+#define SVR_8535   0x803701
+#define SVR_8536   0x803700
+#define SVR_8540   0x803000
+#define SVR_8541   0x807200
+#define SVR_8543   0x803200
+#define SVR_8544   0x803401
+#define SVR_8545   0x803102
+#define SVR_8547   0x803101
+#define SVR_8548   0x803100
+#define SVR_8555   0x807100
+#define SVR_8560   0x807000
+#define SVR_8567   0x807501
+#define SVR_8568   0x807500
+#define SVR_8569   0x808000
+#define SVR_8572   0x80E000
+#define SVR_P1010  0x80f900
+#define SVR_P2041  0x821001
+#define SVR_P3041  0x821103
+#define SVR_P5010  0x822100
+#define SVR_P5020  0x822000
+#define SVR_P5040  0x820400
+#define SVR_T4240  0x824800
+#define SVR_B4860  0x868800
+
+#endif
-- 
1.8.0


--
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