Re: [PATCH] mmc: sdhci: Fix strings broken across multiple lines

2015-11-19 Thread Marek Vasut
On Thursday, November 19, 2015 at 12:52:06 PM, Ulf Hansson wrote:
> On 18 November 2015 at 10:47, Marek Vasut <ma...@denx.de> wrote:
> > This is a trivial patch which fixes printed strings split across two
> > or more lines in the source. I tried to grep for some error output*,
> > but I couldn't find it easily because it was broken across multiple
> > lines. This patch makes my life easier.
> > 
> > * in particular "Timeout waiting for hardware interrupt."
> > 
> > Signed-off-by: Marek Vasut <ma...@denx.de>
> > Cc: Ulf Hansson <ulf.hans...@linaro.org>

Hi!

> Future wise, no need to add a Cc tag here. You should send the patch
> to me anyway.

Are CC tags now frowned upon? In case I have multiple distinct patches
(which go to distinct lists/recipients) in a queue, I use these CC tags
to track who to keep in a loop. Is there some better way to do this?

> Thanks, applied for next!

Thanks.

> FYI: There were some check patch warnings, but I decided to ignore
> them as those are related to the use of the DBG macro.

Oh yeah, the DBG() macro struck me as slightly odd. We should probably
use dev_err() or pr_err() where applicable.

> Kind regards
> Uffe

[..]

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] mmc: sdhci: Fix strings broken across multiple lines

2015-11-19 Thread Marek Vasut
On Thursday, November 19, 2015 at 01:05:15 PM, Ulf Hansson wrote:
> On 19 November 2015 at 12:58, Marek Vasut <ma...@denx.de> wrote:
> > On Thursday, November 19, 2015 at 12:52:06 PM, Ulf Hansson wrote:
> >> On 18 November 2015 at 10:47, Marek Vasut <ma...@denx.de> wrote:
> >> > This is a trivial patch which fixes printed strings split across two
> >> > or more lines in the source. I tried to grep for some error output*,
> >> > but I couldn't find it easily because it was broken across multiple
> >> > lines. This patch makes my life easier.
> >> > 
> >> > * in particular "Timeout waiting for hardware interrupt."
> >> > 
> >> > Signed-off-by: Marek Vasut <ma...@denx.de>
> >> > Cc: Ulf Hansson <ulf.hans...@linaro.org>
> > 
> > Hi!
> > 
> >> Future wise, no need to add a Cc tag here. You should send the patch
> >> to me anyway.
> > 
> > Are CC tags now frowned upon? In case I have multiple distinct patches
> > (which go to distinct lists/recipients) in a queue, I use these CC tags
> > to track who to keep in a loop. Is there some better way to do this?
> 
> As this was a separate patch I didn't quite understand the Cc.
> If the patch is a part of a patchset, it makes more sense if it
> involves different subsystems/maintainers.

It does, but the patches are orthogonal in my case, so I am sending them
using git send-email -1 or such.

> Anyway, no big deal for me! If I don't like the Cc tag, I can easily
> remove it when applying.

Thanks :-)

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


[PATCH] mmc: sdhci: Fix strings broken across multiple lines

2015-11-18 Thread Marek Vasut
This is a trivial patch which fixes printed strings split across two
or more lines in the source. I tried to grep for some error output*,
but I couldn't find it easily because it was broken across multiple
lines. This patch makes my life easier.

* in particular "Timeout waiting for hardware interrupt."

Signed-off-by: Marek Vasut <ma...@denx.de>
Cc: Ulf Hansson <ulf.hans...@linaro.org>
---
 drivers/mmc/host/sdhci.c | 57 +++-
 1 file changed, 23 insertions(+), 34 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index b48565e..2b17cc1 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -768,8 +768,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, 
struct mmc_command *cmd)
if (unlikely(broken)) {
for_each_sg(data->sg, sg, data->sg_len, i) {
if (sg->length & 0x3) {
-   DBG("Reverting to PIO because of "
-   "transfer size (%d)\n",
+   DBG("Reverting to PIO because of 
transfer size (%d)\n",
sg->length);
host->flags &= ~SDHCI_REQ_USE_DMA;
break;
@@ -803,8 +802,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, 
struct mmc_command *cmd)
if (unlikely(broken)) {
for_each_sg(data->sg, sg, data->sg_len, i) {
if (sg->offset & 0x3) {
-   DBG("Reverting to PIO because of "
-   "bad alignment\n");
+   DBG("Reverting to PIO because of bad 
alignment\n");
host->flags &= ~SDHCI_REQ_USE_DMA;
break;
}
@@ -1016,8 +1014,8 @@ void sdhci_send_command(struct sdhci_host *host, struct 
mmc_command *cmd)
 
while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
if (timeout == 0) {
-   pr_err("%s: Controller never released "
-   "inhibit bit(s).\n", mmc_hostname(host->mmc));
+   pr_err("%s: Controller never released inhibit 
bit(s).\n",
+  mmc_hostname(host->mmc));
sdhci_dumpregs(host);
cmd->error = -EIO;
tasklet_schedule(>finish_tasklet);
@@ -1254,8 +1252,8 @@ clock_set:
while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
& SDHCI_CLOCK_INT_STABLE)) {
if (timeout == 0) {
-   pr_err("%s: Internal clock never "
-   "stabilised.\n", mmc_hostname(host->mmc));
+   pr_err("%s: Internal clock never stabilised.\n",
+  mmc_hostname(host->mmc));
sdhci_dumpregs(host);
return;
}
@@ -1540,8 +1538,8 @@ static void sdhci_do_set_ios(struct sdhci_host *host, 
struct mmc_ios *ios)
else if (ios->drv_type == MMC_SET_DRIVER_TYPE_D)
ctrl_2 |= SDHCI_CTRL_DRV_TYPE_D;
else {
-   pr_warn("%s: invalid driver type, default to "
-   "driver type B\n", mmc_hostname(mmc));
+   pr_warn("%s: invalid driver type, default to 
driver type B\n",
+   mmc_hostname(mmc));
ctrl_2 |= SDHCI_CTRL_DRV_TYPE_B;
}
 
@@ -2015,10 +2013,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, 
u32 opcode)
spin_lock_irqsave(>lock, flags);
 
if (!host->tuning_done) {
-   pr_info(DRIVER_NAME ": Timeout waiting for "
-   "Buffer Read Ready interrupt during tuning "
-   "procedure, falling back to fixed sampling "
-   "clock\n");
+   pr_info(DRIVER_NAME ": Timeout waiting for Buffer Read 
Ready interrupt during tuning procedure, falling back to fixed sampling 
clock\n");
ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
ctrl &= ~SDHCI_CTRL_TUNED_CLK;
ctrl &= ~SDHCI_CTRL_EXEC_TUNING;
@@ -2046,9 +

Re: [GIT PULL 1/2] SOCFPGA updates for 3.18

2014-09-10 Thread Marek Vasut
On Tuesday, September 09, 2014 at 11:02:32 PM, Pavel Machek wrote:
 On Tue 2014-09-09 17:02:34, Arnd Bergmann wrote:
  On Tuesday 09 September 2014 16:17:56 Pavel Machek wrote:
Jaehoon Chung (1):
  ARM: dts: socfpga: unuse the slot-node and deprecate the
  supports-highspeed for dw-mmc
   
   This patch is a bad idea. It removes support for two mmc cards on a
   single controller -- configuration hardware supports and configuration
   that allows using u-SD card on mcvevk board.

This is not true, the MCVEVK does _NOT_ have two cards on a single controller.

  Your objection comes too late, and to the wrong patch, since the
  driver and all other users have already been changed. We had a long
  discussion about this when the issue first came up, and we could
  not find any example of dw-mmc actually being used in a scenario
  with one controller that has multiple devices attached.
 
 Well, this is not first time I raised this. 3.17 is not yet out, so we
 still have chance to fix regressions without major fuss.
 
  Apparently every user out there instead uses multiple controller
  instances instead. Are you sure that the socfpga implementation
  is an exception from this?
 
 Marek Vasut has the hardware. His board apprently has uSD and eMMC,
 and I believe it has just one controller. I'll try to get details.

So please go ahead with this PR, sorry for blocking it.

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] fix mmc hang during boot on socfpga

2014-09-09 Thread Marek Vasut
On Tuesday, September 09, 2014 at 07:32:14 PM, Olof Johansson wrote:
 On Tue, Sep 9, 2014 at 5:19 AM, Pavel Machek pa...@ucw.cz wrote:
  Without this patch, boot hangs when trying to mount root filesystem on
  socfpga platform in about 50% cases.
 
 I think this should have a better description than this -- this is too
 vague. Did it use to always work, is this a new failure? You enable
 some more error checking and improved stop handling, why was the
 previous one inadequate on this platform?

+1

nit: It would also be nice if this patch contained proper mmc: tag in the 
Subject line (which applies to all other socfpga patches across all MLs).

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 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 -next] mmc: mxs-mmc: fix error return code in mxs_mmc_probe()

2013-04-19 Thread Marek Vasut
Dear Wei Yongjun,

 From: Wei Yongjun yongjun_...@trendmicro.com.cn
 
 Fix to return -ENODEV in the request dma error case instead
 of 0, as done elsewhere in this function.
 
 Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn

Seems ok to me.

Reviewed-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 RFC] ARM: dts: mxs: leave card detect out of common mmc pins config

2013-04-09 Thread Marek Vasut
Dear Hector Palacios,

 Dear Marek Vasut,
 
 On 04/08/2013 06:28 PM, Marek Vasut wrote:
  Dear Shawn Guo,
  
  On Mon, Apr 08, 2013 at 03:58:05PM +0200, Hector Palacios wrote:
  On 04/08/2013 02:48 PM, Shawn Guo wrote:
  On Mon, Apr 08, 2013 at 12:12:20PM +0200, Hector Palacios wrote:
  MicroSD card sockets don't usually have card detect line. This pin
  is actually not needed for the MMC to work and it is more of a
  platform design decission to have it.
  The card detect pin already has a configuration entry of its own:
  'mmc0_cd_cfg' so we complete the iomux configuration here and let
  platforms to include it or not depending on whether the card detect
  line is routed to the SD socket.
  
  Sounds sensible.
  
  Signed-off-by: Hector Palacios hector.palac...@digi.com
  ---
  
  Hello,
  
  All imx28 based platforms except 'bluegiga,apx4devkit' and
  'schulercontrol,imx28-sps1', use 'mmc0_cd_cfg' in their mmc
  configuration so please check whether this patch would break these
  platforms.
  
  I just tested the patch on imx28-evk and card-detection still works. 
  So patches applied, thanks.
  
  The EVK and most platforms will work because they are using
  'mmc0_cd_cfg' so actually this patch does not change anything on
  them.
  Platforms 'bluegiga,apx4devkit' and 'schulercontrol,imx28-sps1'
  however are not referencing 'mmc0_cd_cfg' so after applying this
  patch they will have unconfigured CD line and they may break.
  
  Ah, yes.  I thought that any board that has CD support has to reference
  'mmc0_cd_cfg'.  That's not necessarily true.
  
  The driver will call get_cd() upon probing, which returns the status of
  the CD line. Please check these two platforms before applying.
  
  Ok, let's wait for people owning the boards to confirm.
  
  Maybe you want to use MMC_CAP_NEEDS_POLL as was noted by someone before
  on the olinuxino -- the slot is there, it's just the CD line that's
  missing.
 
 I'm not sure of what you mean. The mxs-mmc.c driver already sets the
 MMC_CAP_NEEDS_POLL flag by default in the probe() function. My platform
 does not even route the CD line because the microSD socket does not have
 it.
 So what I have done is modify the driver to parse the property
 'non-removable' from the device tree in order to set the
 MMC_CAP_NONREMOVABLE flag:

Yes, I get it. I have two remarks still:
1) The card is removable (you can pull it out from olinuxino's slot)
2) Why is the NEEDS_POLL set by default ?
3) Does the NEEDS_POLL not solve the issue with missing CD line?

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 RFC] ARM: dts: mxs: leave card detect out of common mmc pins config

2013-04-09 Thread Marek Vasut
Hi Hector,

 Dear Marek Vasut,
 
 On 04/09/2013 10:15 AM, Marek Vasut wrote:
  Dear Hector Palacios,
  
  Dear Marek Vasut,
  
  On 04/08/2013 06:28 PM, Marek Vasut wrote:
  Dear Shawn Guo,
  
  On Mon, Apr 08, 2013 at 03:58:05PM +0200, Hector Palacios wrote:
  On 04/08/2013 02:48 PM, Shawn Guo wrote:
  On Mon, Apr 08, 2013 at 12:12:20PM +0200, Hector Palacios wrote:
  MicroSD card sockets don't usually have card detect line. This pin
  is actually not needed for the MMC to work and it is more of a
  platform design decission to have it.
  The card detect pin already has a configuration entry of its own:
  'mmc0_cd_cfg' so we complete the iomux configuration here and let
  platforms to include it or not depending on whether the card detect
  line is routed to the SD socket.
  
  Sounds sensible.
  
  Signed-off-by: Hector Palacios hector.palac...@digi.com
  ---
  
  Hello,
  
  All imx28 based platforms except 'bluegiga,apx4devkit' and
  'schulercontrol,imx28-sps1', use 'mmc0_cd_cfg' in their mmc
  configuration so please check whether this patch would break these
  platforms.
  
  I just tested the patch on imx28-evk and card-detection still works.
  So patches applied, thanks.
  
  The EVK and most platforms will work because they are using
  'mmc0_cd_cfg' so actually this patch does not change anything on
  them.
  Platforms 'bluegiga,apx4devkit' and 'schulercontrol,imx28-sps1'
  however are not referencing 'mmc0_cd_cfg' so after applying this
  patch they will have unconfigured CD line and they may break.
  
  Ah, yes.  I thought that any board that has CD support has to
  reference 'mmc0_cd_cfg'.  That's not necessarily true.
  
  The driver will call get_cd() upon probing, which returns the status
  of the CD line. Please check these two platforms before applying.
  
  Ok, let's wait for people owning the boards to confirm.
  
  Maybe you want to use MMC_CAP_NEEDS_POLL as was noted by someone before
  on the olinuxino -- the slot is there, it's just the CD line that's
  missing.
  
  I'm not sure of what you mean. The mxs-mmc.c driver already sets the
  MMC_CAP_NEEDS_POLL flag by default in the probe() function. My platform
  does not even route the CD line because the microSD socket does not have
  it.
  So what I have done is modify the driver to parse the property
  'non-removable' from the device tree in order to set the
  
  MMC_CAP_NONREMOVABLE flag:
  Yes, I get it. I have two remarks still:
  1) The card is removable (you can pull it out from olinuxino's slot)
 
 True, I misunderstood the use of 'non-removable'. So I guess I could use
 'broken-cd' property instead, right?

Yep, seems ok.

  2) Why is the NEEDS_POLL set by default ?
 
 Because the CD line cannot cause an interrupt in this controller.

Ok, understood.

NOTE: Here is an idea -- we can solve this the same way it's solved with the 
MXC 
SDHCI, configure the CD pin(s) as GPIO(s) and then they'll be able to generate 
interrupt. On the other hand, this shall definitelly be done in a separate 
patch.

  3) Does the NEEDS_POLL not solve the issue with missing CD line?
 
 No. CD polling relies on the status register. The field CARD_DETECT in
 HW_SSP_STATUS register directly reflects the state of the SSP_DETECT input
 pin. If the pin is not connected it can have any value, so I guess we need
 a custom flag on the driver:

Understood!

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] mmc: mxs-mmc: Add broken-cd devicetree property

2013-04-06 Thread Marek Vasut
Dear Alexandre Pereira da Silva,

 On Sat, Apr 6, 2013 at 10:58 AM, Marc Kleine-Budde m...@pengutronix.de 
 wrote:
  According to the documentation broken card detect is something different
  
  than non-removable:
 - broken-cd: There is no card detection available; polling must be
 used. - non-removable: non-removable slot (like eMMC); assume always
 present.
  
  But mxs-mmc set MMC_CAP_NEEDS_POLL unconditionally.
 
 I will work on a better way to fix this.

NEEDS_POLL looks nice and seems to fit this case.

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] mmc: mxs-mmc: Add support for non-removable cards

2013-04-05 Thread Marek Vasut
Dear Alexandre Pereira da Silva,

 Some boards and card slots doesn't have card detect feature available.
 In that case allow to mark the cards as non-removable, via devicetree.
 
 Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com

Looks good,

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

btw. did you know you can let git send-email automatically handle CC for you so 
you don't have to type it into the command line by simply sticking

Cc: Us Er e...@ma.il

in the commit message? Preferably under the SoB line.

 ---
  drivers/mmc/host/mxs-mmc.c |6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 4efe302..7d2cd74 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -95,6 +95,9 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
   struct mxs_mmc_host *host = mmc_priv(mmc);
   struct mxs_ssp *ssp = host-ssp;
 
 + if (mmc-caps  MMC_CAP_NONREMOVABLE)
 + return 1;
 +
   return !(readl(ssp-base + HW_SSP_STATUS(ssp)) 
BM_SSP_STATUS_CARD_DETECT);
  }
 @@ -691,6 +694,9 @@ static int mxs_mmc_probe(struct platform_device *pdev)
   if (flags  OF_GPIO_ACTIVE_LOW)
   host-wp_inverted = 1;
 
 + if (of_find_property(np, non-removable, NULL))
 + mmc-caps |= MMC_CAP_NONREMOVABLE;
 +
   mmc-f_min = 40;
   mmc-f_max = 28800;
   mmc-ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;

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] mmc: mxs-mmc: Add support for non-removable cards

2013-04-05 Thread Marek Vasut
Dear Mark Brown,

 On Fri, Apr 05, 2013 at 08:37:39AM +0200, Marek Vasut wrote:
  btw. did you know you can let git send-email automatically handle CC for
  you so you don't have to type it into the command line by simply
  sticking
  
  Cc: Us Er e...@ma.il
  
  in the commit message? Preferably under the SoB line.
 
 Though not everyone likes seeing things like that end up in the commit
 log (or having to edit them out of commit logs).

Ah, all right.

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] mmc: mxs-mmc: Add MODULE_ALIAS()

2013-01-07 Thread Marek Vasut
Dear Fabio Estevam,

 From: Fabio Estevam fabio.este...@freescale.com
 
 Add an entry for MODULE_ALIAS().
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com

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

 ---
  drivers/mmc/host/mxs-mmc.c |1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 206fe49..b9a9ca0 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -804,3 +804,4 @@ module_platform_driver(mxs_mmc_driver);
  MODULE_DESCRIPTION(FREESCALE MXS MMC peripheral);
  MODULE_AUTHOR(Freescale Semiconductor);
  MODULE_LICENSE(GPL);
 +MODULE_ALIAS(platform: DRIVER_NAME);

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] mmc: mxs-mmc: Fix warning due to incorrect type

2013-01-07 Thread Marek Vasut
Dear Fabio Estevam,

 From: Fabio Estevam fabio.este...@freescale.com
 
 Fixes the following warning when building with W=1 option:
 
 drivers/mmc/host/mxs-mmc.c: In function 'mxs_mmc_adtc':
 drivers/mmc/host/mxs-mmc.c:401:2: warning: comparison between signed and
 unsigned integer expressions [-Wsign-compare]
 
 The warning happens because 'i' is used in 'for_each_sg(sgl, sg, sg_len,
 i)' and should be made unsigned.
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com

Nice

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

 ---
  drivers/mmc/host/mxs-mmc.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 206fe49..eb33cb1 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -354,7 +354,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
   struct dma_async_tx_descriptor *desc;
   struct scatterlist *sgl = data-sg, *sg;
   unsigned int sg_len = data-sg_len;
 - int i;
 + unsigned int i;
 
   unsigned short dma_data_dir, timeout;
   enum dma_transfer_direction slave_dirn;

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 v2] mmc: mxs-mmc: Remove platform data

2012-10-31 Thread Marek Vasut
Dear Fabio Estevam,

 From: Fabio Estevam fabio.este...@freescale.com
 
 All MXS users have been converted to device tree and the board files have
 been removed.
 
 No need to keep platform data in the driver.
 
 Also move bus_width declaration in the beggining of mxs_mmc_probe() to
 avoid: 'warning: ISO C90 forbids mixed declarations and code'.
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
[...]

You might want to do the same for MXS SPI driver.

Acked-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] dma: add new DMA control commands

2012-10-18 Thread Marek Vasut
Dear Huang Shijie,

Why such massive CC ?

 于 2012年10月18日 14:18, Vinod Koul 写道:
  Why cant you do start (prepare clock etc) when you submit the descriptor
  to dmaengine. Can be done in tx_submit callback.
  Similarly remove the clock when dma transaction gets completed.
 
 I ever thought this method too.
 
 But it will become low efficient in the following case:
 
Assuming the gpmi-nand driver has to read out 1024 pages in one
 _SINGLE_ read operation.
 The gpmi-nand will submit the descriptor to dmaengine per page.

It will? Then GPMI NAND is flat our broken ... again.

 So with
 your method,
 the system will repeat the enable/disable dma clock 1024 time.

Yes, it is the driver that's wrong.

 At every
 enable/disable dma clock,
 the system has to enable the clock chain and it's parents ...
 
 But with this patch, we only need to enable/disable dma clock one time,
 just at we select the nand chip.

You are fixing a driver problem at a framework level, wrong.

So, check how the MXS SPI driver handles descriptor chaining. Indeed, the 
Sigmatel screwed the DMA stuff good. But if you analyze the SPI driver, you'll 
notice a few important points that might come handy when you fix the GPMI NAND 
driver properly.

The direction to take here is:
1) Implement DMA chaining into the GPMI NAND driver
2) You might need to do one PIO transfer to reconfigure the IP registers 
between 
each segment of the DMA chain (just as MXS SPI does it)
3) You might run out of DMA descriptors when doing too long chains -- so you 
might need to fix that part of the mxs DMA driver.

 thanks
 Huang Shijie

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] dma: add new DMA control commands

2012-10-18 Thread Marek Vasut
Dear Huang Shijie,

 于 2012年10月18日 15:14, Marek Vasut 写道:
  Dear Huang Shijie,
  
  Why such massive CC ?
  
  于 2012年10月18日 14:18, Vinod Koul 写道:
  Why cant you do start (prepare clock etc) when you submit the
  descriptor to dmaengine. Can be done in tx_submit callback.
  Similarly remove the clock when dma transaction gets completed.
  
  I ever thought this method too.
  
  But it will become low efficient in the following case:
  Assuming the gpmi-nand driver has to read out 1024 pages in one
  
  _SINGLE_ read operation.
  The gpmi-nand will submit the descriptor to dmaengine per page.
  
  It will? Then GPMI NAND is flat our broken ... again.
 
 yes.
 
 Please read the NAND chip spec about the comand READ PAGE(00h-30h) and
 the code
 nand_do_read_ops(). The nand chip limits us only read one page out one
 time. So the driver will submit the descriptor to dmaengine per page.

So we can't stream data from the chip? About time to adjust the MTD framework 
to 
allow that. Maybe implement a command queue?

  So with
  your method,
  the system will repeat the enable/disable dma clock 1024 time.
  
  Yes, it is the driver that's wrong.
 
 not the driver.
 
  At every
  enable/disable dma clock,
  the system has to enable the clock chain and it's parents ...
  
  But with this patch, we only need to enable/disable dma clock one time,
  just at we select the nand chip.
  
  You are fixing a driver problem at a framework level, wrong.
  
  So, check how the MXS SPI driver handles descriptor chaining. Indeed, the
  Sigmatel screwed the DMA stuff good. But if you analyze the SPI driver,
  you'll notice a few important points that might come handy when you fix
  the GPMI NAND driver properly.
  
  The direction to take here is:
  1) Implement DMA chaining into the GPMI NAND driver
 
 How can i implement the DMA chain if the nand chip READ-PAGE command
 gives us the one page limit?

This smells like a time to extend the MTD api ?

 thanks
 Huang Shijie
 
  2) You might need to do one PIO transfer to reconfigure the IP registers
  between each segment of the DMA chain (just as MXS SPI does it)
  3) You might run out of DMA descriptors when doing too long chains -- so
  you might need to fix that part of the mxs DMA driver.

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] dma: add new DMA control commands

2012-10-18 Thread Marek Vasut
Dear Huang Shijie,

 于 2012年10月18日 16:49, Marek Vasut 写道:
  Dear Huang Shijie,
  
  于 2012年10月18日 16:16, Marek Vasut 写道:
  So we can't stream data from the chip? About time to adjust the MTD
  framework to allow that. Maybe implement a command queue?
  
  IMHO, it's not possible. Because the READ-PAGE(00h-30h) command needs to
  check the busy status
  which means we have to stop in the middle, so we can not chain the all
  the read-pages DMA commands.
  
  Can the DMA not branch?
 
 it's too complicated to the MTD layer, as well as the gpmi driver.

Can you please elaborate ?

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] mmc: mxs: fix build regression from mismerge

2012-10-09 Thread Marek Vasut
Dear Chris Ball,

 Hi,
 
 On Tue, Oct 09 2012, Arnd Bergmann wrote:
  From all I can tell, the patches
  
  fc108d24 mmc: mxs-mmc: fix deadlock caused by recursion loop
  829c1bf4 mmc: spi: Pull out parts shared between MMC and SPI
  
  came in through separate branches and cause this build error when
  combined.
[...]

 
 I'll send Marek's change to Linus once the main MMC merge has been pulled.
 Thanks,
 
 - Chris.

Thanks! Sorry from my previous reply from Android phone, I just saw what 
horrible email it generated :-(

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] mmc: mxs-mmc: Fix merge issue causing build error

2012-10-06 Thread Marek Vasut
Dear Shawn Guo,

 Copy Chris who should be able to help send this fix for 3.7-rc.
 
 Shawn

Ok, thanks.

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


[PATCH] mmc: mxs-mmc: Fix merge issue causing build error

2012-10-01 Thread Marek Vasut
The following error appeared due to trivial merge problem:

drivers/mmc/host/mxs-mmc.c: In function 'mxs_mmc_enable_sdio_irq':
drivers/mmc/host/mxs-mmc.c:527:3: error: 'struct mxs_mmc_host' has no member 
named 'base'
drivers/mmc/host/mxs-mmc.c:527:3: error: 'struct mxs_mmc_host' has no member 
named 'devid'
make[3]: *** [drivers/mmc/host/mxs-mmc.o] Error 1

This patches corrects the issue.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Shawn Guo shawn@linaro.org
---
 drivers/mmc/host/mxs-mmc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index bb4c2bf..80d1e6d 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -525,7 +525,7 @@ static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, 
int enable)
writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK,
   ssp-base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET);
writel(BM_SSP_CTRL1_SDIO_IRQ_EN,
-  host-base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_SET);
+  ssp-base + HW_SSP_CTRL1(ssp) + STMP_OFFSET_REG_SET);
} else {
writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK,
   ssp-base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR);
-- 
1.7.10.4

--
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 4/4] drivers/mmc/host/mxs-mmc.c: fix error return code

2012-09-17 Thread Marek Vasut
Dear Peter Senna Tschudin,

 From: Peter Senna Tschudin peter.se...@gmail.com

The patch description is a bit crap, but otherwise

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

 Convert a nonnegative error return code to a negative one, as returned
 elsewhere in the function.
 
 A simplified version of the semantic match that finds this problem is as
 follows: (http://coccinelle.lip6.fr/)
 
 // smpl
 (
 if@p1 (\(ret  0\|ret != 0\))
  { ... return ret; }
 
 ret@p1 = 0
 )
 ... when != ret = e1
 when != ret
 *if(...)
 {
   ... when != ret = e2
   when forall
  return ret;
 }
 // /smpl
 
 Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
 ---
  drivers/mmc/host/mxs-mmc.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 80d1e6d..afd8fdd 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -674,6 +674,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
   if (!ssp-dmach) {
   dev_err(mmc_dev(host-mmc),
   %s: failed to request dma\n, __func__);
 + ret = -ENODEV;
   goto out_clk_put;
   }

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] mmc: mxs-mmc: Add wp-inverted property

2012-07-19 Thread Marek Vasut
Hi,

 The write-protect GPIO is inverted on some boards. Handle such case.
 
 Signed-off-by: Marek Vasut ma...@denx.de
 Cc: Shawn Guo shawn@linaro.org
 Cc: Fabio Estevam fabio.este...@freescale.com
 Cc: linux-mmc@vger.kernel.org
 Cc: Chris Ball c...@laptop.org
 Cc: Lothar Waßmann l...@karo-electronics.de

[...]

I don't see this in -next yet, was this applied please? Or maybe it is stuck in 
some tree that wasn't pulled yet?

Thanks!

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] mmc: mxs-mmc: Add wp-inverted property

2012-07-19 Thread Marek Vasut
Dear Chris Ball,

 Hi Marek,
 
 On Fri, Jun 08 2012, Marek Vasut wrote:
  The write-protect GPIO is inverted on some boards. Handle such case.
  
  Signed-off-by: Marek Vasut ma...@denx.de
  Cc: Shawn Guo shawn@linaro.org
  Cc: Fabio Estevam fabio.este...@freescale.com
  Cc: linux-mmc@vger.kernel.org
  Cc: Chris Ball c...@laptop.org
  Cc: Lothar Waßmann l...@karo-electronics.de
  ---
  
   drivers/mmc/host/mxs-mmc.c |   15 +--
   1 file changed, 13 insertions(+), 2 deletions(-)
  
  diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
  index 34a9026..c6964e1 100644
  --- a/drivers/mmc/host/mxs-mmc.c
  +++ b/drivers/mmc/host/mxs-mmc.c
  @@ -164,16 +164,23 @@ struct mxs_mmc_host {
  
  spinlock_t  lock;
  int sdio_irq_en;
  int wp_gpio;
  
  +   int wp_inverted:1;
 
 Mind if I change this to bool wp_inverted;?  Other than that, looks
 fine and I'll merge it for 3.6.

That should be fine. Thanks!

 Thanks,
 
 - Chris.

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: mmc: mxs: DEADLOCK

2012-07-10 Thread Marek Vasut
Dear Lauri Hintsala,

[...]

 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -278,11 +278,11 @@ static irqreturn_t mxs_mmc_irq_handler(int irq,
 void *dev_id)
   writel(stat  MXS_MMC_IRQ_BITS,
  host-base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_CLR);
 
 + spin_unlock(host-lock);
 +
   if ((stat  BM_SSP_CTRL1_SDIO_IRQ)  (stat  BM_SSP_CTRL1_SDIO_IRQ_EN))
   mmc_signal_sdio_irq(host-mmc);
 
 - spin_unlock(host-lock);
 -

Spinlock in irq handler is interesting too ;-)

   if (stat  BM_SSP_CTRL1_RESP_TIMEOUT_IRQ)
   cmd-error = -ETIMEDOUT;
   else if (stat  BM_SSP_CTRL1_RESP_ERR_IRQ)
 
 
 Is there any reason to keep mmc_signal_sdio_irq inside the spinlock?
 mmc_signal_sdio_irq calls mxs_mmc_enable_sdio_irq and it tries to
 acquire lock while it is already acquired.
 
 
 Best regards,
 Lauri Hintsala

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


[PATCH] mmc: mxs-mmc: Add wp-inverted property

2012-06-08 Thread Marek Vasut
The write-protect GPIO is inverted on some boards. Handle such case.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Shawn Guo shawn@linaro.org
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: linux-mmc@vger.kernel.org
Cc: Chris Ball c...@laptop.org
Cc: Lothar Waßmann l...@karo-electronics.de
---
 drivers/mmc/host/mxs-mmc.c |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 34a9026..c6964e1 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -164,16 +164,23 @@ struct mxs_mmc_host {
spinlock_t  lock;
int sdio_irq_en;
int wp_gpio;
+   int wp_inverted:1;
 };
 
 static int mxs_mmc_get_ro(struct mmc_host *mmc)
 {
struct mxs_mmc_host *host = mmc_priv(mmc);
+   int ret;
 
if (!gpio_is_valid(host-wp_gpio))
return -EINVAL;
 
-   return gpio_get_value(host-wp_gpio);
+   ret = gpio_get_value(host-wp_gpio);
+
+   if (host-wp_inverted)
+   ret = !ret;
+
+   return ret;
 }
 
 static int mxs_mmc_get_cd(struct mmc_host *mmc)
@@ -707,6 +714,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
struct pinctrl *pinctrl;
int ret = 0, irq_err, irq_dma;
dma_cap_mask_t mask;
+   enum of_gpio_flags flags;
 
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -785,7 +793,10 @@ static int mxs_mmc_probe(struct platform_device *pdev)
mmc-caps |= MMC_CAP_4_BIT_DATA;
else if (bus_width == 8)
mmc-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-   host-wp_gpio = of_get_named_gpio(np, wp-gpios, 0);
+   host-wp_gpio = of_get_named_gpio_flags(np, wp-gpios, 0,
+   flags);
+   if (flags  OF_GPIO_ACTIVE_LOW)
+   host-wp_inverted = 1;
} else {
if (pdata-flags  SLOTF_8_BIT_CAPABLE)
mmc-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-- 
1.7.10

--
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: mxs-mmc: Move of_match_table out of CONFIG_PM

2012-06-06 Thread Marek Vasut
Dear Chris Ball,

 Hi,
 
 On Mon, May 21 2012, Marek Vasut wrote:
  Signed-off-by: Marek Vasut ma...@denx.de
  Cc: Shawn Guo shawn@linaro.org
  Cc: Fabio Estevam fabio.este...@freescale.com
  Cc: linux-mmc@vger.kernel.org
  Cc: Chris Ball c...@laptop.org
  Acked-by: Shawn Guo shawn@linaro.org
  ---
  
   drivers/mmc/host/mxs-mmc.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
  
  diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
  index 34a9026..277161d 100644
  --- a/drivers/mmc/host/mxs-mmc.c
  +++ b/drivers/mmc/host/mxs-mmc.c
  @@ -894,8 +894,8 @@ static struct platform_driver mxs_mmc_driver = {
  
  .owner  = THIS_MODULE,
   
   #ifdef CONFIG_PM
   
  .pm = mxs_mmc_pm_ops,
  
  -   .of_match_table = mxs_mmc_dt_ids,
  
   #endif
  
  +   .of_match_table = mxs_mmc_dt_ids,
  
  },
   
   };
 
 Thanks, pushed to mmc-next for 3.5.

Thanks!

 - Chris.

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


[PATCH] mmc: mxs-mmc: Add wp-inverted property

2012-05-21 Thread Marek Vasut
The write-protect GPIO is inverted on some boards. Handle such case.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Shawn Guo shawn@linaro.org
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: linux-mmc@vger.kernel.org
Cc: Chris Ball c...@laptop.org
Cc: Lothar Waßmann l...@karo-electronics.de
---
 drivers/mmc/host/mxs-mmc.c |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 277161d..9bfd08e 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -164,16 +164,23 @@ struct mxs_mmc_host {
spinlock_t  lock;
int sdio_irq_en;
int wp_gpio;
+   int wp_inverted:1;
 };
 
 static int mxs_mmc_get_ro(struct mmc_host *mmc)
 {
struct mxs_mmc_host *host = mmc_priv(mmc);
+   int ret;
 
if (!gpio_is_valid(host-wp_gpio))
return -EINVAL;
 
-   return gpio_get_value(host-wp_gpio);
+   ret = gpio_get_value(host-wp_gpio);
+
+   if (host-wp_inverted)
+   ret = !ret;
+
+   return ret;
 }
 
 static int mxs_mmc_get_cd(struct mmc_host *mmc)
@@ -707,6 +714,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
struct pinctrl *pinctrl;
int ret = 0, irq_err, irq_dma;
dma_cap_mask_t mask;
+   enum of_gpio_flags flags;
 
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -785,7 +793,10 @@ static int mxs_mmc_probe(struct platform_device *pdev)
mmc-caps |= MMC_CAP_4_BIT_DATA;
else if (bus_width == 8)
mmc-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-   host-wp_gpio = of_get_named_gpio(np, wp-gpios, 0);
+   host-wp_gpio = of_get_named_gpio_flags(np, wp-gpios, 0,
+   flags);
+   if (flags  OF_GPIO_ACTIVE_LOW)
+   host-wp_inverted = 1;
} else {
if (pdata-flags  SLOTF_8_BIT_CAPABLE)
mmc-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-- 
1.7.10

--
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 4/4] MXS-MMC: Add wp-inverted property

2012-05-20 Thread Marek Vasut
Dear Shawn Guo,

 Copy Chris and linux-mmc, as I assume that the patch should go via mmc
 tree after the merge window.
 
 On Mon, May 21, 2012 at 03:02:20AM +0200, Marek Vasut wrote:
  The write-protect GPIO is inverted on some boards. Handle such case.
  
  Signed-off-by: Marek Vasut ma...@denx.de
  Cc: Shawn Guo shawn@linaro.org
  Cc: Fabio Estevam fabio.este...@freescale.com
 
 Acked-by: Shawn Guo shawn@linaro.org
 
 A coupe of nits though:
 
 The subject prefix can better be mmc: mxs-mmc: .

Want me to resend it ?

 
  ---
  
   Documentation/devicetree/bindings/mmc/mxs-mmc.txt |1 +
   drivers/mmc/host/mxs-mmc.c|   11 ++-
   2 files changed, 11 insertions(+), 1 deletion(-)
  
  diff --git a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
  b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt index
  14d870a..0a7d2cd 100644
  --- a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
  +++ b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
  
  @@ -13,6 +13,7 @@ Required properties:
   Optional properties:
   - wp-gpios: Specify GPIOs for write protection
  
  +- wp-inverted: Set if the write protection GPIO is inverted
  
   Examples:
  diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
  index 277161d..119beb9 100644
  --- a/drivers/mmc/host/mxs-mmc.c
  +++ b/drivers/mmc/host/mxs-mmc.c
  @@ -164,16 +164,23 @@ struct mxs_mmc_host {
  
  spinlock_t  lock;
  int sdio_irq_en;
  int wp_gpio;
  
  +   int wp_inverted:1;
  
   };
   
   static int mxs_mmc_get_ro(struct mmc_host *mmc)
   {
   
  struct mxs_mmc_host *host = mmc_priv(mmc);
  
  +   int ret;
  
  if (!gpio_is_valid(host-wp_gpio))
  
  return -EINVAL;
  
  -   return gpio_get_value(host-wp_gpio);
  +   ret = gpio_get_value(host-wp_gpio);
  +
  +   if (host-wp_inverted)
  +   ret = !ret;
  +
  +   return ret;
 
 The above lines can just be the one below?
 
   return (host-wp_inverted) ? !ret : ret;

I'd prefer to avoid the ternary operator, it's more readable as it is.

 
   }

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


[PATCH] mmc: mxs-mmc: Add wp-inverted property

2012-05-20 Thread Marek Vasut
The write-protect GPIO is inverted on some boards. Handle such case.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Shawn Guo shawn@linaro.org
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: linux-mmc@vger.kernel.org
Cc: Chris Ball c...@laptop.org
---
 Documentation/devicetree/bindings/mmc/mxs-mmc.txt |1 +
 drivers/mmc/host/mxs-mmc.c|   11 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

V2: Adjust the subject, Cc linux-mmc

diff --git a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt 
b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
index 14d870a..0a7d2cd 100644
--- a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
@@ -13,6 +13,7 @@ Required properties:
 
 Optional properties:
 - wp-gpios: Specify GPIOs for write protection
+- wp-inverted: Set if the write protection GPIO is inverted
 
 Examples:
 
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 277161d..119beb9 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -164,16 +164,23 @@ struct mxs_mmc_host {
spinlock_t  lock;
int sdio_irq_en;
int wp_gpio;
+   int wp_inverted:1;
 };
 
 static int mxs_mmc_get_ro(struct mmc_host *mmc)
 {
struct mxs_mmc_host *host = mmc_priv(mmc);
+   int ret;
 
if (!gpio_is_valid(host-wp_gpio))
return -EINVAL;
 
-   return gpio_get_value(host-wp_gpio);
+   ret = gpio_get_value(host-wp_gpio);
+
+   if (host-wp_inverted)
+   ret = !ret;
+
+   return ret;
 }
 
 static int mxs_mmc_get_cd(struct mmc_host *mmc)
@@ -786,6 +793,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
else if (bus_width == 8)
mmc-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
host-wp_gpio = of_get_named_gpio(np, wp-gpios, 0);
+   if (of_find_property(np, wp-inverted, NULL))
+   host-wp_inverted = 1;
} else {
if (pdata-flags  SLOTF_8_BIT_CAPABLE)
mmc-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-- 
1.7.10

--
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 4/4] MXS-MMC: Add wp-inverted property

2012-05-20 Thread Marek Vasut
Dear Chris Ball,

 Hi,
 
 On Sun, May 20 2012, Shawn Guo wrote:
  On 21 May 2012 10:38, Marek Vasut ma...@denx.de wrote:
  The subject prefix can better be mmc: mxs-mmc: .
  
  Want me to resend it ?
  
  It's Chris' call.
 
 Yes, please -- actually not just because of the subject prefix, which I
 wouldn't mind fixing myself, but because I like having patches posted to
 linux-mmc@ before they're applied.

Fixed now

 
 Thanks!

You're welcome :)

 
 - Chris.

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] mmc: mxs-mmc: Add wp-inverted property

2012-05-20 Thread Marek Vasut
Dear Chris Ball,

 Hi Marek,
 
 On Sun, May 20 2012, Marek Vasut wrote:
  The write-protect GPIO is inverted on some boards. Handle such case.
  
  Signed-off-by: Marek Vasut ma...@denx.de
  Cc: Shawn Guo shawn@linaro.org
  Cc: Fabio Estevam fabio.este...@freescale.com
  Cc: linux-mmc@vger.kernel.org
  Cc: Chris Ball c...@laptop.org
  ---
  
   Documentation/devicetree/bindings/mmc/mxs-mmc.txt |1 +
   drivers/mmc/host/mxs-mmc.c|   11 ++-
   2 files changed, 11 insertions(+), 1 deletion(-)
  
  V2: Adjust the subject, Cc linux-mmc
 
 Thanks, looks good.  Since this depends on patches that are going via
 arm-soc, I'm going to wait until that's in Linus master before merging.

Roger that, thanks!

 
 - Chris.

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


[PATCH] mmc: mxs-mmc: Move of_match_table out of CONFIG_PM

2012-05-20 Thread Marek Vasut
Signed-off-by: Marek Vasut ma...@denx.de
Cc: Shawn Guo shawn@linaro.org
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: linux-mmc@vger.kernel.org
Cc: Chris Ball c...@laptop.org
Acked-by: Shawn Guo shawn@linaro.org
---
 drivers/mmc/host/mxs-mmc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 34a9026..277161d 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -894,8 +894,8 @@ static struct platform_driver mxs_mmc_driver = {
.owner  = THIS_MODULE,
 #ifdef CONFIG_PM
.pm = mxs_mmc_pm_ops,
-   .of_match_table = mxs_mmc_dt_ids,
 #endif
+   .of_match_table = mxs_mmc_dt_ids,
},
 };
 
-- 
1.7.10

--
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 01/10] mmc: mxs-mmc: use global stmp_device functionality

2012-05-07 Thread Marek Vasut
Dear Shawn Guo,

 Use global stmp_device functionality to reduce mach-dependency.
 
 Signed-off-by: Shawn Guo shawn@linaro.org

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

 ---
  drivers/mmc/host/mxs-mmc.c |   14 +++---
  1 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index bb03ddd..2ea5361 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -40,9 +40,9 @@
  #include linux/module.h
  #include linux/fsl/mxs-dma.h
  #include linux/pinctrl/consumer.h
 +#include linux/stmp_device.h
 
  #include mach/mxs.h
 -#include mach/common.h
  #include mach/mmc.h
 
  #define DRIVER_NAME  mxs-mmc
 @@ -191,7 +191,7 @@ static void mxs_mmc_reset(struct mxs_mmc_host *host)
  {
   u32 ctrl0, ctrl1;
 
 - mxs_reset_block(host-base);
 + stmp_reset_block(host-base);
 
   ctrl0 = BM_SSP_CTRL0_IGNORE_CRC;
   ctrl1 = BF_SSP(0x3, CTRL1_SSP_MODE) |
 @@ -279,7 +279,7 @@ static irqreturn_t mxs_mmc_irq_handler(int irq, void
 *dev_id)
 
   stat = readl(host-base + HW_SSP_CTRL1);
   writel(stat  MXS_MMC_IRQ_BITS,
 -host-base + HW_SSP_CTRL1 + MXS_CLR_ADDR);
 +host-base + HW_SSP_CTRL1 + STMP_OFFSET_REG_CLR);
 
   if ((stat  BM_SSP_CTRL1_SDIO_IRQ)  (stat  BM_SSP_CTRL1_SDIO_IRQ_EN))
   mmc_signal_sdio_irq(host-mmc);
 @@ -637,18 +637,18 @@ static void mxs_mmc_enable_sdio_irq(struct mmc_host
 *mmc, int enable)
 
   if (enable) {
   writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK,
 -host-base + HW_SSP_CTRL0 + MXS_SET_ADDR);
 +host-base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET);
   writel(BM_SSP_CTRL1_SDIO_IRQ_EN,
 -host-base + HW_SSP_CTRL1 + MXS_SET_ADDR);
 +host-base + HW_SSP_CTRL1 + STMP_OFFSET_REG_SET);
 
   if (readl(host-base + HW_SSP_STATUS)  BM_SSP_STATUS_SDIO_IRQ)
   mmc_signal_sdio_irq(host-mmc);
 
   } else {
   writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK,
 -host-base + HW_SSP_CTRL0 + MXS_CLR_ADDR);
 +host-base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR);
   writel(BM_SSP_CTRL1_SDIO_IRQ_EN,
 -host-base + HW_SSP_CTRL1 + MXS_CLR_ADDR);
 +host-base + HW_SSP_CTRL1 + STMP_OFFSET_REG_CLR);
   }
 
   spin_unlock_irqrestore(host-lock, flags);

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 03/10] mmc: mxs-mmc: get rid of the use of cpu_is_xxx

2012-05-07 Thread Marek Vasut
Dear Shawn Guo,

 The register HW_SSP_VERSION is broken for ssp version detection,
 as the address of the register is different between imx23 and imx28.
 Let's use platform_device_id to detect the device, so that the use
 of cpu_is_xxx can be removed.
 
 Signed-off-by: Shawn Guo shawn@linaro.org

[...]

 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 13907e4..54bbb8b 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -42,7 +42,6 @@
  #include linux/pinctrl/consumer.h
  #include linux/stmp_device.h
 
 -#include mach/mxs.h
  #include mach/mmc.h
 
  #define DRIVER_NAME  mxs-mmc
 @@ -50,8 +49,7 @@
  /* card detect polling timeout */
  #define MXS_MMC_DETECT_TIMEOUT   (HZ/2)
 
 -#define SSP_VERSION_LATEST   4
 -#define ssp_is_old(host) (host-version  SSP_VERSION_LATEST)
 +#define ssp_is_old(host) (host-devid == IMX23_MMC)

(host)-devid ...

 
  /* SSP registers */
  #define HW_SSP_CTRL0 0x000
 @@ -123,8 +121,6 @@
  #define HW_SSP_STATUS(h) (ssp_is_old(h) ? 0x0c0 : 0x100)
  #define  BM_SSP_STATUS_CARD_DETECT   (1  28)
  #define  BM_SSP_STATUS_SDIO_IRQ  (1  17)
 -#define HW_SSP_VERSION   (cpu_is_mx23() ? 0x110 
 : 
0x130)
 -#define  BP_SSP_VERSION_MAJOR(24)
 
  #define BF_SSP(value, field) (((value)  BP_SSP_##field) 
 BM_SSP_##field)
 
 @@ -139,6 +135,11 @@
 
  #define SSP_PIO_NUM  3
 
 +enum mxs_mmc_id {
 + IMX23_MMC,
 + IMX28_MMC,
 +};
 +
  struct mxs_mmc_host {
   struct mmc_host *mmc;
   struct mmc_request  *mrq;
 @@ -158,7 +159,7 @@ struct mxs_mmc_host {
   enum dma_transfer_direction slave_dirn;
   u32 ssp_pio_words[SSP_PIO_NUM];
 
 - unsigned intversion;
 + enum mxs_mmc_id devid;
   unsigned char   bus_width;
   spinlock_t  lock;
   int sdio_irq_en;
 @@ -678,6 +679,19 @@ static bool mxs_mmc_dma_filter(struct dma_chan *chan,
 void *param) return true;
  }
 
 +static struct platform_device_id mxs_mmc_ids[] = {
 + {
 + .name = imx23-mmc,
 + .driver_data = IMX23_MMC,
 + }, {
 + .name = imx28-mmc,
 + .driver_data = IMX28_MMC,
 + }, {
 + /* sentinel */
 + }
 +};
 +MODULE_DEVICE_TABLE(platform, mxs_mmc_ids);
 +
  static int mxs_mmc_probe(struct platform_device *pdev)
  {
   struct mxs_mmc_host *host;
 @@ -712,10 +726,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
   goto out_mmc_free;
   }
 
 - /* only major verion does matter */
 - host-version = readl(host-base + HW_SSP_VERSION) 
 - BP_SSP_VERSION_MAJOR;
 -
 + host-devid = pdev-id_entry-driver_data;
   host-mmc = mmc;
   host-res = r;
   host-dma_res = dmares;
 @@ -866,6 +877,7 @@ static const struct dev_pm_ops mxs_mmc_pm_ops = {
  static struct platform_driver mxs_mmc_driver = {
   .probe  = mxs_mmc_probe,
   .remove = mxs_mmc_remove,
 + .id_table   = mxs_mmc_ids,
   .driver = {
   .name   = DRIVER_NAME,
   .owner  = THIS_MODULE,
--
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/10] mmc: mxs-mmc: move header from mach into linux folder

2012-05-07 Thread Marek Vasut
Dear Shawn Guo,

 Rename arch/arm/mach-mxs/include/mach/mmc.h to
 include/linux/mmc/mxs-mmc.h, so that mxs-mmc driver becomes
 mach/* inclusion free.

Good :-)

Acked-by: Marek Vasut ma...@denx.de
 
 Signed-off-by: Shawn Guo shawn@linaro.org
 ---
  arch/arm/mach-mxs/include/mach/devices-common.h|2 +-
  drivers/mmc/host/mxs-mmc.c |3 +--
  .../mach/mmc.h = include/linux/mmc/mxs-mmc.h  |7 ---
  3 files changed, 6 insertions(+), 6 deletions(-)
  rename arch/arm/mach-mxs/include/mach/mmc.h = include/linux/mmc/mxs-mmc.h
 (81%)
 
 diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h
 b/arch/arm/mach-mxs/include/mach/devices-common.h index 2b37689..6fc0601
 100644
 --- a/arch/arm/mach-mxs/include/mach/devices-common.h
 +++ b/arch/arm/mach-mxs/include/mach/devices-common.h
 @@ -87,7 +87,7 @@ struct platform_device * __init mxs_add_mxs_i2c(
   const struct mxs_mxs_i2c_data *data);
 
  /* mmc */
 -#include mach/mmc.h
 +#include linux/mmc/mxs-mmc.h
  struct mxs_mxs_mmc_data {
   const char *devid;
   int id;
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 54bbb8b..c70c7c7 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -41,8 +41,7 @@
  #include linux/fsl/mxs-dma.h
  #include linux/pinctrl/consumer.h
  #include linux/stmp_device.h
 -
 -#include mach/mmc.h
 +#include linux/mmc/mxs-mmc.h
 
  #define DRIVER_NAME  mxs-mmc
 
 diff --git a/arch/arm/mach-mxs/include/mach/mmc.h
 b/include/linux/mmc/mxs-mmc.h similarity index 81%
 rename from arch/arm/mach-mxs/include/mach/mmc.h
 rename to include/linux/mmc/mxs-mmc.h
 index 211547a..7c2ad3a 100644
 --- a/arch/arm/mach-mxs/include/mach/mmc.h
 +++ b/include/linux/mmc/mxs-mmc.h
 @@ -6,8 +6,8 @@
   * published by the Free Software Foundation.
   */
 
 -#ifndef __MACH_MXS_MMC_H__
 -#define __MACH_MXS_MMC_H__
 +#ifndef __LINUX_MMC_MXS_MMC_H__
 +#define __LINUX_MMC_MXS_MMC_H__
 
  struct mxs_mmc_platform_data {
   int wp_gpio;/* write protect pin */
 @@ -15,4 +15,5 @@ struct mxs_mmc_platform_data {
  #define SLOTF_4_BIT_CAPABLE  (1  0)
  #define SLOTF_8_BIT_CAPABLE  (1  1)
  };
 -#endif /* __MACH_MXS_MMC_H__ */
 +
 +#endif /* __LINUX_MMC_MXS_MMC_H__ */

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 05/10] mmc: mxs-mmc: use devm_* helper to make cleanup simpler

2012-05-07 Thread Marek Vasut
Dear Shawn Guo,

 Use devm_request_and_ioremap and devm_request_irq helpers to clean up
 the code a little bit.

Nice :)

btw do we have i2c dt bindings ?

Acked-by: Marek Vasut ma...@denx.de
 
 Signed-off-by: Shawn Guo shawn@linaro.org
 ---
  drivers/mmc/host/mxs-mmc.c |   40 +---
  1 files changed, 9 insertions(+), 31 deletions(-)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index c70c7c7..1a8ba314 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -146,8 +146,6 @@ struct mxs_mmc_host {
   struct mmc_data *data;
 
   void __iomem*base;
 - int irq;
 - struct resource *res;
   struct resource *dma_res;
   struct clk  *clk;
   unsigned intclk_rate;
 @@ -695,7 +693,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
  {
   struct mxs_mmc_host *host;
   struct mmc_host *mmc;
 - struct resource *iores, *dmares, *r;
 + struct resource *iores, *dmares;
   struct mxs_mmc_platform_data *pdata;
   struct pinctrl *pinctrl;
   int ret = 0, irq_err, irq_dma;
 @@ -708,28 +706,20 @@ static int mxs_mmc_probe(struct platform_device
 *pdev) if (!iores || !dmares || irq_err  0 || irq_dma  0)
   return -EINVAL;
 
 - r = request_mem_region(iores-start, resource_size(iores), pdev-name);
 - if (!r)
 - return -EBUSY;
 -
   mmc = mmc_alloc_host(sizeof(struct mxs_mmc_host), pdev-dev);
 - if (!mmc) {
 - ret = -ENOMEM;
 - goto out_release_mem;
 - }
 + if (!mmc)
 + return -ENOMEM;
 
   host = mmc_priv(mmc);
 - host-base = ioremap(r-start, resource_size(r));
 + host-base = devm_request_and_ioremap(pdev-dev, iores);
   if (!host-base) {
 - ret = -ENOMEM;
 + ret = -EADDRNOTAVAIL;
   goto out_mmc_free;
   }
 
   host-devid = pdev-id_entry-driver_data;
   host-mmc = mmc;
 - host-res = r;
   host-dma_res = dmares;
 - host-irq = irq_err;
   host-sdio_irq_en = 0;
 
   pinctrl = devm_pinctrl_get_select_default(pdev-dev);
 @@ -741,7 +731,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
   host-clk = clk_get(pdev-dev, NULL);
   if (IS_ERR(host-clk)) {
   ret = PTR_ERR(host-clk);
 - goto out_iounmap;
 + goto out_mmc_free;
   }
   clk_prepare_enable(host-clk);
 
 @@ -782,7 +772,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 
   platform_set_drvdata(pdev, mmc);
 
 - ret = request_irq(host-irq, mxs_mmc_irq_handler, 0, DRIVER_NAME, host);
 + ret = devm_request_irq(pdev-dev, irq_err, mxs_mmc_irq_handler, 0,
 +DRIVER_NAME, host);
   if (ret)
   goto out_free_dma;
 
 @@ -790,26 +781,20 @@ static int mxs_mmc_probe(struct platform_device
 *pdev)
 
   ret = mmc_add_host(mmc);
   if (ret)
 - goto out_free_irq;
 + goto out_free_dma;
 
   dev_info(mmc_dev(host-mmc), initialized\n);
 
   return 0;
 
 -out_free_irq:
 - free_irq(host-irq, host);
  out_free_dma:
   if (host-dmach)
   dma_release_channel(host-dmach);
  out_clk_put:
   clk_disable_unprepare(host-clk);
   clk_put(host-clk);
 -out_iounmap:
 - iounmap(host-base);
  out_mmc_free:
   mmc_free_host(mmc);
 -out_release_mem:
 - release_mem_region(iores-start, resource_size(iores));
   return ret;
  }
 
 @@ -817,12 +802,9 @@ static int mxs_mmc_remove(struct platform_device
 *pdev) {
   struct mmc_host *mmc = platform_get_drvdata(pdev);
   struct mxs_mmc_host *host = mmc_priv(mmc);
 - struct resource *res = host-res;
 
   mmc_remove_host(mmc);
 
 - free_irq(host-irq, host);
 -
   platform_set_drvdata(pdev, NULL);
 
   if (host-dmach)
 @@ -831,12 +813,8 @@ static int mxs_mmc_remove(struct platform_device
 *pdev) clk_disable_unprepare(host-clk);
   clk_put(host-clk);
 
 - iounmap(host-base);
 -
   mmc_free_host(mmc);
 
 - release_mem_region(res-start, resource_size(res));
 -
   return 0;
  }

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 06/10] mmc: mxs-mmc: have dma_channel than dma_res in mxs_mmc_host

2012-05-07 Thread Marek Vasut
Dear Shawn Guo,

 It replaces dma_res with dma_channel in struct mxs_mmc_host, so that
 the device tree support will be a little easier, since dma channel
 can not be retrieved from struct resource *dma_res.
 
 Signed-off-by: Shawn Guo shawn@linaro.org

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

 ---
  drivers/mmc/host/mxs-mmc.c |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 1a8ba314..e905721 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -146,7 +146,7 @@ struct mxs_mmc_host {
   struct mmc_data *data;
 
   void __iomem*base;
 - struct resource *dma_res;
 + int dma_channel;
   struct clk  *clk;
   unsigned intclk_rate;
 
 @@ -668,7 +668,7 @@ static bool mxs_mmc_dma_filter(struct dma_chan *chan,
 void *param) if (!mxs_dma_is_apbh(chan))
   return false;
 
 - if (chan-chan_id != host-dma_res-start)
 + if (chan-chan_id != host-dma_channel)
   return false;
 
   chan-private = host-dma_data;
 @@ -719,7 +719,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 
   host-devid = pdev-id_entry-driver_data;
   host-mmc = mmc;
 - host-dma_res = dmares;
 + host-dma_channel = dmares-start;
   host-sdio_irq_en = 0;
 
   pinctrl = devm_pinctrl_get_select_default(pdev-dev);

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 02/10] mmc: mxs-mmc: let ssp_is_old take host as parameter

2012-05-07 Thread Marek Vasut
Dear Shawn Guo,

 Let macro ssp_is_old take host as parameter to make the code easy
 to read.
 
 Signed-off-by: Shawn Guo shawn@linaro.org
 ---
  drivers/mmc/host/mxs-mmc.c |   59
 ++- 1 files changed, 30
 insertions(+), 29 deletions(-)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 2ea5361..13907e4 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -51,7 +51,7 @@
  #define MXS_MMC_DETECT_TIMEOUT   (HZ/2)
 
  #define SSP_VERSION_LATEST   4
 -#define ssp_is_old() (host-version  SSP_VERSION_LATEST)
 +#define ssp_is_old(host) (host-version  SSP_VERSION_LATEST)

(host)-version ... to make the macro safer.

 
  /* SSP registers */
  #define HW_SSP_CTRL0 0x000
 @@ -86,14 +86,14 @@
  #define  BM_SSP_BLOCK_SIZE_BLOCK_COUNT   (0xff  4)
  #define  BP_SSP_BLOCK_SIZE_BLOCK_SIZE(0)
  #define  BM_SSP_BLOCK_SIZE_BLOCK_SIZE(0xf)
 -#define HW_SSP_TIMING(ssp_is_old() ? 0x050 : 
0x070)
 +#define HW_SSP_TIMING(h) (ssp_is_old(h) ? 0x050 : 0x070)
  #define  BP_SSP_TIMING_TIMEOUT   (16)
  #define  BM_SSP_TIMING_TIMEOUT   (0x  16)
  #define  BP_SSP_TIMING_CLOCK_DIVIDE  (8)
  #define  BM_SSP_TIMING_CLOCK_DIVIDE  (0xff  8)
  #define  BP_SSP_TIMING_CLOCK_RATE(0)
  #define  BM_SSP_TIMING_CLOCK_RATE(0xff)
 -#define HW_SSP_CTRL1 (ssp_is_old() ? 0x060 : 0x080)
 +#define HW_SSP_CTRL1(h)  (ssp_is_old(h) ? 0x060 
 : 
0x080)
  #define  BM_SSP_CTRL1_SDIO_IRQ   (1  31)
  #define  BM_SSP_CTRL1_SDIO_IRQ_EN(1  30)
  #define  BM_SSP_CTRL1_RESP_ERR_IRQ   (1  29)
 @@ -116,11 +116,11 @@
  #define  BM_SSP_CTRL1_WORD_LENGTH(0xf  4)
  #define  BP_SSP_CTRL1_SSP_MODE   (0)
  #define  BM_SSP_CTRL1_SSP_MODE   (0xf)
 -#define HW_SSP_SDRESP0   (ssp_is_old() ? 0x080 : 
0x0a0)
 -#define HW_SSP_SDRESP1   (ssp_is_old() ? 0x090 : 
0x0b0)
 -#define HW_SSP_SDRESP2   (ssp_is_old() ? 0x0a0 : 
0x0c0)
 -#define HW_SSP_SDRESP3   (ssp_is_old() ? 0x0b0 : 
0x0d0)
 -#define HW_SSP_STATUS(ssp_is_old() ? 0x0c0 : 
0x100)
 +#define HW_SSP_SDRESP0(h)(ssp_is_old(h) ? 0x080 : 0x0a0)
 +#define HW_SSP_SDRESP1(h)(ssp_is_old(h) ? 0x090 : 0x0b0)
 +#define HW_SSP_SDRESP2(h)(ssp_is_old(h) ? 0x0a0 : 0x0c0)
 +#define HW_SSP_SDRESP3(h)(ssp_is_old(h) ? 0x0b0 : 0x0d0)
 +#define HW_SSP_STATUS(h) (ssp_is_old(h) ? 0x0c0 : 0x100)
  #define  BM_SSP_STATUS_CARD_DETECT   (1  28)
  #define  BM_SSP_STATUS_SDIO_IRQ  (1  17)
  #define HW_SSP_VERSION   (cpu_is_mx23() ? 0x110 
 : 
0x130)
 @@ -183,7 +183,7 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
  {
   struct mxs_mmc_host *host = mmc_priv(mmc);
 
 - return !(readl(host-base + HW_SSP_STATUS) 
 + return !(readl(host-base + HW_SSP_STATUS(host)) 
BM_SSP_STATUS_CARD_DETECT);
  }
 
 @@ -207,7 +207,7 @@ static void mxs_mmc_reset(struct mxs_mmc_host *host)
   writel(BF_SSP(0x, TIMING_TIMEOUT) |
  BF_SSP(2, TIMING_CLOCK_DIVIDE) |
  BF_SSP(0, TIMING_CLOCK_RATE),
 -host-base + HW_SSP_TIMING);
 +host-base + HW_SSP_TIMING(host));
 
   if (host-sdio_irq_en) {
   ctrl0 |= BM_SSP_CTRL0_SDIO_IRQ_CHECK;
 @@ -215,7 +215,7 @@ static void mxs_mmc_reset(struct mxs_mmc_host *host)
   }
 
   writel(ctrl0, host-base + HW_SSP_CTRL0);
 - writel(ctrl1, host-base + HW_SSP_CTRL1);
 + writel(ctrl1, host-base + HW_SSP_CTRL1(host));
  }
 
  static void mxs_mmc_start_cmd(struct mxs_mmc_host *host,
 @@ -229,12 +229,12 @@ static void mxs_mmc_request_done(struct mxs_mmc_host
 *host)
 
   if (mmc_resp_type(cmd)  MMC_RSP_PRESENT) {
   if (mmc_resp_type(cmd)  MMC_RSP_136) {
 - cmd-resp[3] = readl(host-base + HW_SSP_SDRESP0);
 - cmd-resp[2] = readl(host-base + HW_SSP_SDRESP1);
 - cmd-resp[1] = readl(host-base + HW_SSP_SDRESP2);
 - cmd-resp[0] = readl(host-base + HW_SSP_SDRESP3);
 + cmd-resp[3] = readl(host-base + HW_SSP_SDRESP0(host));
 + cmd-resp[2] = readl(host-base + HW_SSP_SDRESP1(host));
 + cmd-resp[1] = readl(host-base + HW_SSP_SDRESP2(host));
 + cmd-resp[0] = readl(host-base + HW_SSP_SDRESP3(host));
   } else {
 - cmd-resp[0] = readl(host-base + HW_SSP_SDRESP0);
 + 

Re: [PATCH 07/10] mmc: mxs-mmc: copy wp_gpio in struct mxs_mmc_host

2012-05-07 Thread Marek Vasut
Dear Shawn Guo,

 It has wp_gpio copied in struct mxs_mmc_host from platform_data,

Copy wp_gpio into struct ...

 so that the use of platform_data can be limited in probe function,
 which will ease the device tree probe.
 
 Signed-off-by: Shawn Guo shawn@linaro.org

Otherwise
Acked-by: Marek Vasut ma...@denx.de

 ---
  drivers/mmc/host/mxs-mmc.c |   11 ---
  1 files changed, 4 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index e905721..66f792a 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -160,21 +160,17 @@ struct mxs_mmc_host {
   unsigned char   bus_width;
   spinlock_t  lock;
   int sdio_irq_en;
 + int wp_gpio;
  };
 
  static int mxs_mmc_get_ro(struct mmc_host *mmc)
  {
   struct mxs_mmc_host *host = mmc_priv(mmc);
 - struct mxs_mmc_platform_data *pdata =
 - mmc_dev(host-mmc)-platform_data;
 
 - if (!pdata)
 - return -EFAULT;
 -
 - if (!gpio_is_valid(pdata-wp_gpio))
 + if (!gpio_is_valid(host-wp_gpio))
   return -EINVAL;
 
 - return gpio_get_value(pdata-wp_gpio);
 + return gpio_get_value(host-wp_gpio);
  }
 
  static int mxs_mmc_get_cd(struct mmc_host *mmc)
 @@ -758,6 +754,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
   mmc-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
   if (pdata-flags  SLOTF_4_BIT_CAPABLE)
   mmc-caps |= MMC_CAP_4_BIT_DATA;
 + host-wp_gpio = pdata-wp_gpio;
   }
 
   mmc-f_min = 40;

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 08/10] mmc: mxs-mmc: add device tree support

2012-05-07 Thread Marek Vasut
-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
   if (pdata-flags  SLOTF_4_BIT_CAPABLE)
 @@ -857,6 +894,7 @@ static struct platform_driver mxs_mmc_driver = {
   .owner  = THIS_MODULE,
  #ifdef CONFIG_PM
   .pm = mxs_mmc_pm_ops,
 + .of_match_table = mxs_mmc_dt_ids,
  #endif
   },
  };

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 v1 1/5] ARM: imx28: add basic dt support

2012-03-14 Thread Marek Vasut
Dear Shawn Guo,

 On Tue, Mar 13, 2012 at 11:23:51AM -0600, Grant Likely wrote:
 ...
 
   + apb@8000 {
   + compatible = simple-bus;
   + #address-cells = 1;
   + #size-cells = 1;
   + reg = 0x8000 0x8;
   + ranges;
   +
   + apbh@8000 {
   + compatible = simple-bus;
   + #address-cells = 1;
   + #size-cells = 1;
   + reg = 0x8000 0x3c900;
   + ranges;
   +
   + icoll: interrupt-controller@8000 {
   + compatible = fsl,imx28-icoll;
   + interrupt-controller;
   + #interrupt-cells = 1;
   + reg = 0x8000 0x2000;
   + };
   + };
   +
   + apbx@8004 {
   + compatible = simple-bus;
   + #address-cells = 1;
   + #size-cells = 1;
   + reg = 0x8004 0x4;
   + ranges;
   +
   + uart1: uart@80074000 {
   + compatible = arm,pl011, arm,primecell;
   + reg = 0x80074000 0x2000;
   + interrupts = 47;
   + };
   + };
  
  What is the purpose of the apbh and apbx busses?  Will more device nodes
  get added to them later, or does each only contain a single device?
 
 Since our ultimate goal is to convert mach-mxs over to device tree,
 I would also suggest we have all the hardware blocks defined in dts
 from the beginning.

Agreed.

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 v1 0/5] dt: add basic imx28 support

2012-03-14 Thread Marek Vasut
Dear Dong Aisheng,

 This patch series adds basic imx28 dt support including fec, mmc and dma.
 
 Tested on mx28evk.
 
 TODO:
 Convert the remaining devices to support dt.
 mxs-auart, mxs-gpio, i2c, flexcan, saif, rtc, pwm, fb.
 
 Dong Aisheng (5):
   ARM: imx28: add basic dt support
   mmc: mxs-mmc: add dt probe support
   ARM: imx28evk: add mmc dt support
   dma: mxs-dma: add dt probe support
   ARM: mxs: add mxs dma dt support
 
Can you keep me in Cc on new versions of these patches? Thanks!

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 v1 2/5] mmc: mxs-mmc: add dt probe support

2012-03-14 Thread Marek Vasut
Dear Dong Aisheng,

 From: Dong Aisheng dong.aish...@linaro.org
 
 Signed-off-by: Dong Aisheng dong.aish...@linaro.org
 
 ---
 The patch is still using a private way for dma part binding
 since the common dma binding is still under discussion.
 http://www.spinics.net/lists/linux-omap/msg65528.html
 
 Will update to use common dma binding when it hits mainline.
 ---
  .../devicetree/bindings/mmc/fsl-mxs-mmc.txt|   23 ++
  drivers/mmc/host/mxs-mmc.c |   82
 +++- 2 files changed, 102 insertions(+), 3 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/mmc/fsl-mxs-mmc.txt
 b/Documentation/devicetree/bindings/mmc/fsl-mxs-mmc.txt new file mode
 100644
 index 000..adc1142
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/fsl-mxs-mmc.txt
 @@ -0,0 +1,23 @@
 +* FREESCALE MXS MMC peripheral
 +
 +Required properties:
 +- compatible : Should be fsl,chip-mmc
 +- reg : Should contain registers location and length
 +- interrupts : Should contain interrupt.
 +  The format is irq_err irq_dma.
 +- dma_channel: Should contain the dma channel it uses
 +
 +Optional properties:
 +- wp-gpios : Specify GPIOs for write protection
 +- slot-4bit: Specify 4 bit mode support
 +- slot-8bit: Specify 8 bit and 4 bit mode support
 +
 +Examples:
 +mmc1: ssp@8001 {
 + compatible = fsl,imx28-mmc;
 + reg = 0x8001 2000;
 + /* irq_err irq_dma */
 + interrupts = 96 82;
 + dma_channel = 0;
 + slot-8bit;
 +};
 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index 382c835..6cf2d17 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -38,6 +38,10 @@
  #include linux/gpio.h
  #include linux/regulator/consumer.h
  #include linux/module.h
 +#include linux/of.h
 +#include linux/of_device.h
 +#include linux/of_gpio.h
 +#include linux/slab.h
 
  #include mach/mxs.h
  #include mach/common.h
 @@ -673,17 +677,79 @@ static bool mxs_mmc_dma_filter(struct dma_chan *chan,
 void *param) return true;
  }
 
 +#ifdef CONFIG_OF
 +static struct resource * __devinit mxs_mmc_get_of_dmares(
 + struct platform_device *pdev)
 +{
 + struct device_node *np = pdev-dev.of_node;
 + struct resource *dmares;
 + int ret;
 +
 + if (!np)
 + return NULL;
 +
 + dmares = kzalloc(sizeof(*dmares), GFP_KERNEL);
 + dmares-flags = IORESOURCE_DMA;
 + ret = of_property_read_u32(np, dma_channel, dmares-start);
 + if (ret) {
 + dev_err(pdev-dev, unable to get dmares from dt\n);
 + return NULL;
 + }
 + dmares-end = dmares-start;
 +
 + return dmares;
 +}
 +
 +static int __devinit mxs_mmc_get_of_property(struct platform_device *pdev,
 + struct mxs_mmc_platform_data **ppdata)
 +{
 + struct device_node *np = pdev-dev.of_node;
 + struct mxs_mmc_platform_data *pdata = *ppdata;
 +
 + if (!np)
 + return -ENODEV;
 +
 + pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
 +
 + if (of_get_property(np, slot-8bit, NULL))
 + pdata-flags |= SLOTF_8_BIT_CAPABLE;
 +
 + if (of_get_property(np, slot-4bit, NULL))
 + pdata-flags |= SLOTF_4_BIT_CAPABLE;
 +
 + pdata-wp_gpio = of_get_named_gpio(np, wp-gpios, 0);
 +
 + dev_dbg(pdev-dev, wp-gpios %d flags %d\n, pdata-wp_gpio,
 + pdata-flags);
 +
 + return 0;
 +}
 +#else
 +static struct resource * __devinit mxs_mmc_get_of_dmares(
 + struct platform_device *pdev)
 +{
 + return NULL;
 +}
 +static inline int mxs_mmc_get_of_property(struct platform_device *pdev,
 + struct mxs_mmc_platform_data *pdata)
 +{
 + return -ENODEV;
 +}
 +#endif
 +
  static int mxs_mmc_probe(struct platform_device *pdev)
  {
   struct mxs_mmc_host *host;
   struct mmc_host *mmc;
   struct resource *iores, *dmares, *r;
 - struct mxs_mmc_platform_data *pdata;
 + struct mxs_mmc_platform_data *pdata = NULL;
   int ret = 0, irq_err, irq_dma;
   dma_cap_mask_t mask;
 
   iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 - dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 + dmares = mxs_mmc_get_of_dmares(pdev);
 + if (dmares == NULL)
 + dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
   irq_err = platform_get_irq(pdev, 0);
   irq_dma = platform_get_irq(pdev, 1);
   if (!iores || !dmares || irq_err  0 || irq_dma  0)
 @@ -740,7 +806,9 @@ static int mxs_mmc_probe(struct platform_device *pdev)
   mmc-caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED |
   MMC_CAP_SDIO_IRQ | MMC_CAP_NEEDS_POLL;
 
 - pdata = mmc_dev(host-mmc)-platform_data;
 + mxs_mmc_get_of_property(pdev, pdata);
 + if (pdata == NULL)
 + pdata = mmc_dev(host-mmc)-platform_data;
   if (pdata) {
   if (pdata-flags  SLOTF_8_BIT_CAPABLE)
   mmc-caps |= 

Re: [PATCH v1 1/5] ARM: imx28: add basic dt support

2012-03-14 Thread Marek Vasut
Dear Dong Aisheng,

 On Tue, Mar 13, 2012 at 09:35:43AM -0500, Rob Herring wrote:
  On 03/13/2012 03:47 AM, Dong Aisheng wrote:
   From: Dong Aisheng dong.aish...@linaro.org
   
   This patch includes basic dt support which can boot via nfs rootfs.
   
   Signed-off-by: Dong Aisheng dong.aish...@linaro.org
   ---
   
Documentation/devicetree/bindings/arm/fsl.txt |4 +
arch/arm/boot/dts/imx28-evk.dts   |   31 +
arch/arm/boot/dts/imx28.dtsi  |   88
+ arch/arm/mach-mxs/Kconfig  
  |9 +++
arch/arm/mach-mxs/Makefile|1 +
arch/arm/mach-mxs/imx28-dt.c  |   67
+++ 6 files changed, 200 insertions(+), 0
deletions(-)
 
 
 
   + interrupts = 47;
   + };
   + };
   + };
   +
   + ahb@8008 {
   + compatible = simple-bus;
   + #address-cells = 1;
   + #size-cells = 1;
   + reg = 0x8008 0x8;
   + ranges;
   +
   + fec@800f {
   + compatible = fsl,imx28-fec;
   + reg = 0x800f 0x4000;
  
  This too IIRC.
 
 The size is 16KB/0x4000 in iMX28 spec. :)

Agreed, the memory map is slightly non-standard.

 
   + interrupts = 101;
   + status = disabled;
   + };
   +
   + fec@800f4000 {
   + compatible = fsl,imx28-fec;
   + reg = 0x800f4000 0x4000;
   + interrupts = 102;
   + status = disabled;
   + };
   +
   + };
   +};
   diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
   index c57f996..6ab66af 100644
   --- a/arch/arm/mach-mxs/Kconfig
   +++ b/arch/arm/mach-mxs/Kconfig
   @@ -17,6 +17,15 @@ config SOC_IMX28
   
comment MXS platforms:
   
   +config MACH_IMX28_DT
  
  Perhaps this should be more generic like MACH_MXS_DT to eventually
  support MX23 as well?
 
 I just did like the imx ways.
 But yes if we see the need when do imx23 dt support.

Let's do it all in one swipe, there's not so much difference between these two 
chips.
 
   + bool Support i.MX28 platforms from device tree
   + select SOC_IMX28
   + select USE_OF
   + select MACH_MX28EVK
  
  This should not be selected here.
 
 Like other imx soc dt board files, the imx28-dt.c may need to use some bits
 like pinmux in mx28evk.c board file.
 
 Yes, currently i can remove it since it is using uboot pinmux setting.
 But when add other devices support which is not covered in u-boot like
 flexcan, i may need to use non-dt board's pinmux setting.
 So maybe we can keep it first and remove it when totally not dependent
 on non-dt files.

I'd be all in for the decremental approach -- keep in whatever is needed and 
remove is as it becomes redundant.

 
   + * The code contained herein is licensed under the GNU General Public
   + * License. You may obtain a copy of the GNU General Public License
   + * Version 2 or later at the following locations:
   + *
   + * http://www.opensource.org/licenses/gpl-license.html
   + * http://www.gnu.org/copyleft/gpl.html
   + */
   +
   +#include linux/init.h
   +#include linux/irqdomain.h
   +#include linux/of_irq.h
   +#include linux/of_platform.h
   +#include asm/mach/arch.h
   +#include asm/mach/time.h
   +#include mach/common.h
   +#include mach/mx28.h
   +
   +static const struct of_dev_auxdata imx28_auxdata_lookup[] __initconst
   = { + OF_DEV_AUXDATA(arm,pl011, MX28_DUART_BASE_ADDR, duart,
   NULL), +  OF_DEV_AUXDATA(fsl,imx28-fec, MX28_ENET_MAC0_BASE_ADDR,
   imx28-fec.0, NULL), +   OF_DEV_AUXDATA(fsl,imx28-fec,
   MX28_ENET_MAC1_BASE_ADDR, imx28-fec.1, NULL),
  
  Why do you need the old names?
 
 To keep align with the old clocks.
 See arch/arm/mach-mxs/clock-mx28.c:
 _REGISTER_CLOCK(imx28-fec.0, NULL, fec_clk)
 _REGISTER_CLOCK(imx28-fec.1, NULL, fec_clk)
 Is there any better way to avoid this?
 
   + { /* sentinel */ }
   +};
   +
   +static void __init imx28_init(void)
   +{
   + of_platform_populate(NULL, of_default_bus_match_table,
   +  imx28_auxdata_lookup, NULL);
   +}
   +
   +static const struct of_device_id icoll_of_match[] __initconst = {
   + { .compatible = fsl,imx28-icoll, },
   + {},
   +};
   +
   +static void __init imx28_dt_init_irq(void)
   +{
   + irq_domain_generate_simple(icoll_of_match, MX28_ICOLL_BASE_ADDR, 0);
  
  Please do proper domain support for the interrupt controller and use
  of_irq_init.
 
 Ok, i will see it.
 
 For others, will fix them all.
 Thanks for the review.
 
 Regards
 Dong Aisheng


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 v1 2/5] mmc: mxs-mmc: add dt probe support

2012-03-14 Thread Marek Vasut
Dear Dong Aisheng,

 On Wed, Mar 14, 2012 at 01:58:25PM +0800, Marek Vasut wrote:
  Dear Dong Aisheng,
  
   Signed-off-by: Dong Aisheng dong.aish...@linaro.org
 
 
 
   +static const struct of_device_id mxs_mmc_dt_ids[] = {
   + { .compatible = fsl,imx23-mmc, .data = NULL, },
   + { .compatible = fsl,imx28-mmc, .data = NULL, },
  
  Do you really need two distinct ones here?
 
 Hmm, my original purpose is to put soc difference data in .data
 to remove cpu_is_* function calls in the driver later.
 Do you think if any issue?
 

Well, what's the difference between the interfaces on mx233 and mx28? Is it 
something that can't be encoded otherwise? I think they're not so different.

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 v1 2/5] mmc: mxs-mmc: add dt probe support

2012-03-14 Thread Marek Vasut
Dear Dong Aisheng,

 On Wed, Mar 14, 2012 at 08:09:22AM +0100, Marek Vasut wrote:
  Dear Dong Aisheng,
  
   On Wed, Mar 14, 2012 at 01:58:25PM +0800, Marek Vasut wrote:
Dear Dong Aisheng,

 Signed-off-by: Dong Aisheng dong.aish...@linaro.org
   
   
   
 +static const struct of_device_id mxs_mmc_dt_ids[] = {
 + { .compatible = fsl,imx23-mmc, .data = NULL, },
 + { .compatible = fsl,imx28-mmc, .data = NULL, },

Do you really need two distinct ones here?
   
   Hmm, my original purpose is to put soc difference data in .data
   to remove cpu_is_* function calls in the driver later.
   Do you think if any issue?
  
  Well, what's the difference between the interfaces on mx233 and mx28? Is
  it something that can't be encoded otherwise? I think they're not so
  different.
 
 Not much difference except the one register offset and ip version.
 See:
 #define SSP_VERSION_LATEST  4
 #define ssp_is_old()(host-version  SSP_VERSION_LATEST)
 ..
 #define HW_SSP_VERSION (cpu_is_mx23() ? 0x110 : 0x130)
 The ip version can be handled in driver, but for offset...
 it depends on cpu_is_* macro.
 Putting the HW_SSP_VERSION offset difference in .data can eliminate the
 need of cpu_is_*.
 
 Despite of that, since they're two devices,
 i guess it's ok to put two compatible string there, right?
 Or you thought just put one as below?
 { .compatible = fsl,mxs-mmc, .data = NULL, },
 
No, I understand now /wrt the register layout.

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 V3 1/1]MMC: add support of sdhci-pxa driver

2010-10-23 Thread Marek Vasut
Dne Pá 22. října 2010 16:09:03 zhangfei gao napsal(a):
 On Fri, Oct 22, 2010 at 7:04 AM, Chris Ball c...@laptop.org wrote:
  Hi,
  
  On Fri, Oct 22, 2010 at 10:58:14AM +0100, Chris Ball wrote:
  [...]
  
  +#ifdef CONFIG_PM
  +static int sdhci_pxa_suspend(struct platform_device *dev)
  +{
  + struct sdhci_host *host =
  platform_get_drvdata(to_platform_device(dev)); +
  + return sdhci_suspend_host(host, state);
  +}
  +
  +static int sdhci_pxa_resume(struct platform_device *dev)
  +{
  
  These prototypes are not correct, leading to:
  
   CC [M]  drivers/mmc/host/sdhci-pxa.o
  drivers/mmc/host/sdhci-pxa.c: In function ‘sdhci_pxa_suspend’:
  drivers/mmc/host/sdhci-pxa.c:205: warning: initialization from
  incompatible pointer type drivers/mmc/host/sdhci-pxa.c:207: error:
  ‘state’ undeclared (first use in this function)
  drivers/mmc/host/sdhci-pxa.c:207: error: (Each undeclared identifier is
  reported only once drivers/mmc/host/sdhci-pxa.c:207: error: for each
  function it appears in.) drivers/mmc/host/sdhci-pxa.c: In function
  ‘sdhci_pxa_resume’:
  drivers/mmc/host/sdhci-pxa.c:212: warning: initialization from
  incompatible pointer type drivers/mmc/host/sdhci-pxa.c: At top level:
  drivers/mmc/host/sdhci-pxa.c:222: warning: initialization from
  incompatible pointer type drivers/mmc/host/sdhci-pxa.c:223: warning:
  initialization from incompatible pointer type
  
  when compiled with CONFIG_PM=y.
  
  --
  Chris Ball   c...@laptop.org   http://printf.net/
  One Laptop Per Child
 
 Sorry, forgot open CONFIG_PM.
 Updated patch, thanks
 
 From 88e7f028433fe87b211bf3d75b54261979d0d176 Mon Sep 17 00:00:00 2001
 From: Zhangfei Gao zhangfei@marvell.com
 Date: Mon, 20 Sep 2010 10:51:28 -0400
 Subject: [PATCH] mmc: add support of sdhci-pxa driver
 
   Support Marvell PXA168/PXA910/MMP2 SD Host Controller
 
 Signed-off-by: Zhangfei Gao zhangfei@marvell.com
 Acked-by: Haojian Zhuang haojian.zhu...@marvell.com
 ---
  arch/arm/plat-pxa/include/plat/sdhci.h |   32 
  drivers/mmc/host/Kconfig   |   12 ++
  drivers/mmc/host/Makefile  |1 +
  drivers/mmc/host/sdhci-pxa.c   |  254
  4 files changed, 299 insertions(+), 0
 deletions(-)
  create mode 100644 arch/arm/plat-pxa/include/plat/sdhci.h
  create mode 100644 drivers/mmc/host/sdhci-pxa.c
 
 diff --git a/arch/arm/plat-pxa/include/plat/sdhci.h
 b/arch/arm/plat-pxa/include/plat/sdhci.h
 new file mode 100644
 index 000..38e86ad
 --- /dev/null
 +++ b/arch/arm/plat-pxa/include/plat/sdhci.h
 @@ -0,0 +1,32 @@
 +/* linux/arch/arm/plat-pxa/include/plat/sdhci.h
 + *
 + * Copyright 2010 Marvell
 + *   Zhangfei Gao zhangfei@marvell.com
 + *
 + * PXA Platform - SDHCI platform data definitions
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 +*/
 +
 +#ifndef __PLAT_PXA_SDHCI_H
 +#define __PLAT_PXA_SDHCI_H
 +
 +/* pxa specific flag */
 +/* Require clock free running */
 +#define  PXA_FLAG_DISABLE_CLOCK_GATING (10)
 +
 +/**
 + * struct pxa_sdhci_platdata() - Platform device data for PXA SDHCI
 + * @max_speed: The maximum speed supported.
 + * @quirks: quirks of specific device
 + * @flags: flags for platfrom requirement
 +*/
 +struct sdhci_pxa_platdata {
 + unsigned intmax_speed;
 + unsigned intquirks;
 + unsigned intflags;
 +};
 +
 +#endif /* __PLAT_PXA_SDHCI_H */
 diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
 index c9c2520..c387402 100644
 --- a/drivers/mmc/host/Kconfig
 +++ b/drivers/mmc/host/Kconfig
 @@ -155,6 +155,18 @@ config MMC_SDHCI_S3C
 
 If unsure, say N.
 
 +config MMC_SDHCI_PXA
 + tristate Marvell PXA168/PXA910/MMP2 SD Host Controller support
 + depends on ARCH_PXA || ARCH_MMP
 + select MMC_SDHCI
 + select MMC_SDHCI_IO_ACCESSORS
 + help
 +   This selects the Marvell(R) PXA168/PXA910/MMP2 SD Host Controller.
 +   If you have a PXA168/PXA910/MMP2 platform with SD Host Controller and 
 a
 +   card slot,say Y or M here.
 +
 +   If unsure, say N.
 +
  config MMC_SDHCI_SPEAR
   tristate SDHCI support on ST SPEAr platform
   depends on MMC_SDHCI  PLAT_SPEAR
 diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
 index 6c4ac67..7b645ff 100644
 --- a/drivers/mmc/host/Makefile
 +++ b/drivers/mmc/host/Makefile
 @@ -8,6 +8,7 @@ obj-$(CONFIG_MMC_IMX) += imxmmc.o
  obj-$(CONFIG_MMC_MXC)+= mxcmmc.o
  obj-$(CONFIG_MMC_SDHCI)  += sdhci.o
  obj-$(CONFIG_MMC_SDHCI_PCI)  += sdhci-pci.o
 +obj-$(CONFIG_MMC_SDHCI_PXA)  += sdhci-pxa.o
  obj-$(CONFIG_MMC_SDHCI_S3C)  += sdhci-s3c.o
  obj-$(CONFIG_MMC_SDHCI_SPEAR)+= sdhci-spear.o
  obj-$(CONFIG_MMC_WBSD)   += wbsd.o
 diff --git a/drivers/mmc/host/sdhci-pxa.c b/drivers/mmc/host/sdhci-pxa.c
 new file mode 100644
 index 

Re: [PATCH V3 1/1]MMC: add support of sdhci-pxa driver

2010-10-21 Thread Marek Vasut
Dne Čt 21. října 2010 16:52:49 Chris Ball napsal(a):
 Hi,
 
 On Thu, Oct 21, 2010 at 03:13:02PM +0100, Chris Ball wrote:
  On Mon, Oct 18, 2010 at 08:32:46AM -0400, zhangfei gao wrote:
   Update with comments from Matt and Eric.
   Test with sd and emmc.
   
   From e5dd554ed4d3488a83d9a4888d68d1d85482f747 Mon Sep 17 00:00:00 2001
   
   From: Zhangfei Gao zhangfei@marvell.com
   Date: Mon, 20 Sep 2010 10:51:28 -0400
   Subject: [PATCH] mmc: add support of sdhci-pxa driver
   
 Support Marvell PXA168/PXA910/MMP2 SD Host Controller
   
   Signed-off-by: Zhangfei Gao zhangfei@marvell.com
   ---
   
arch/arm/plat-pxa/include/plat/sdhci.h |   32 
drivers/mmc/host/Kconfig   |   12 ++
drivers/mmc/host/Makefile  |1 +
drivers/mmc/host/sdhci-pxa.c   |  259
 4 files changed, 304 insertions(+),
0 deletions(-)
create mode 100644 arch/arm/plat-pxa/include/plat/sdhci.h
create mode 100644 drivers/mmc/host/sdhci-pxa.c
  
  I'll take the drivers/mmc/ hunks, but you should send the plat-pxa/
  patch through the ARM tree.
 
 Oh.  If we do that then the driver won't compile until everything's
 together, because it #includes plat/sdhci.h.  Haojian/Eric, what do
 you prefer here?  Should I take the arch/arm/ hunk via the MMC tree?
 (If so, please provide ACKs.)
 
 Thanks,

Hi, where can I find the whole driver so I can take a look? It didn't crash 
into 
linux-arm-kernel for some reason.

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