Re: Adding aliases to mmc

2013-09-22 Thread Dirk Behme

Hi Fabio,

Am 18.09.2013 02:06, schrieb Fabio Estevam:

Hi Dirk,

On Tue, Sep 17, 2013 at 3:04 PM, Fabio Estevam feste...@gmail.com wrote:

Hi Dirk,

I have adapted your patch at:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/111022.html

and tested it on 3.12-rc1 on a mx6qsabresd board.

Do you have plans to submit it? Maybe as a RFC?

It solves the mmcblkX order issue on my tests and it would be nice we
could have this problem addressed.


I simplied your patch a bit:

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 1a3163f..94f842b 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2026,7 +2026,7 @@ static struct mmc_blk_data
*mmc_blk_alloc_req(struct mmc_card *card,
  struct mmc_blk_data *md;
  int devidx, ret;

-devidx = find_first_zero_bit(dev_use, max_devices);
+devidx = find_next_zero_bit(dev_use, max_devices, card-host-devidx);
  if (devidx = max_devices)
  return ERR_PTR(-ENOSPC);
  __set_bit(devidx, dev_use);
@@ -2044,7 +2044,8 @@ static struct mmc_blk_data
*mmc_blk_alloc_req(struct mmc_card *card,
   * index anymore so we keep track of a name index.
   */
  if (!subname) {
-md-name_idx = find_first_zero_bit(name_use, max_devices);
+md-name_idx = find_next_zero_bit(name_use, max_devices,
+card-host-devidx);
  __set_bit(md-name_idx, name_use);
  } else
  md-name_idx = ((struct mmc_blk_data *)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
b/drivers/mmc/host/sdhci-esdhc-imx.c
index abc8cf0..e11a6af 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -524,8 +524,9 @@ static int sdhci_esdhc_imx_probe(struct
platform_device *pdev)
  struct sdhci_pltfm_host *pltfm_host;
  struct sdhci_host *host;
  struct esdhc_platform_data *boarddata;
-int err;
+int err, ret;
  struct pltfm_imx_data *imx_data;
+struct device_node *np = pdev-dev.of_node;

  host = sdhci_pltfm_init(pdev, sdhci_esdhc_imx_pdata, 0);
  if (IS_ERR(host))
@@ -602,6 +603,13 @@ static int sdhci_esdhc_imx_probe(struct
platform_device *pdev)
  host-mmc-parent-platform_data);
  }

+
+if (np) {
+ret = of_alias_get_id(np, mmcblk);
+if (ret = 0)
+host-mmc-devidx = ret;
+}
+
  /* write_protect */
  if (boarddata-wp_type == ESDHC_WP_GPIO) {
  err = mmc_gpio_request_ro(host-mmc, boarddata-wp_gpio);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3b0c33a..8209f72 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -362,6 +362,8 @@ struct mmc_host {

  unsigned intslotno;/* used for sdio acpi binding */

+/* preferred mmc block device index (mmcblkX) */
+unsigned intdevidx;
  unsigned longprivate[0] cacheline_aligned;
  };

What do you think?


Do you like to send this as a proper patch? Following the recent 
discussion it sounds to me that there is really some need for 
something like this. Then we could discuss the technical details.


Best regards

Dirk

--
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 22/51] DMA-API: amba: get rid of separate dma_mask

2013-09-22 Thread Grant Likely
On Thu, 19 Sep 2013 22:47:01 +0100, Russell King rmk+ker...@arm.linux.org.uk 
wrote:
 AMBA Primecell devices always treat streaming and coherent DMA exactly
 the same, so there's no point in having the masks separated.
 
 Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk

for the drivers/of/platform.c portion:
Acked-by: Grant Likely grant.lik...@linaro.org

g.
--
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: Adding aliases to mmc

2013-09-22 Thread Fabio Estevam
Hi Dirk,

On Sun, Sep 22, 2013 at 3:48 AM, Dirk Behme dirk.be...@gmail.com wrote:

 Do you like to send this as a proper patch? Following the recent discussion
 it sounds to me that there is really some need for something like this. Then
 we could discuss the technical details.

Please do so.

Thanks,

Fabio Estevam
--
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-pci: remove unnecessary pci_set_drvdata()

2013-09-22 Thread Jingoo Han
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han jg1@samsung.com
---
 drivers/mmc/host/sdhci-pci.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index d7d6bc8..f0d20f0 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -1533,7 +1533,6 @@ static int sdhci_pci_probe(struct pci_dev *pdev,
return 0;
 
 free:
-   pci_set_drvdata(pdev, NULL);
kfree(chip);
 
 err:
@@ -1555,7 +1554,6 @@ static void sdhci_pci_remove(struct pci_dev *pdev)
for (i = 0; i  chip-num_slots; i++)
sdhci_pci_remove_slot(chip-slots[i]);
 
-   pci_set_drvdata(pdev, NULL);
kfree(chip);
}
 
-- 
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: Adding aliases to mmc

2013-09-22 Thread Fabio Estevam
Hi Dirk,

On Sun, Sep 22, 2013 at 12:24 PM, Fabio Estevam feste...@gmail.com wrote:
 Hi Dirk,

 On Sun, Sep 22, 2013 at 3:48 AM, Dirk Behme dirk.be...@gmail.com wrote:

 Do you like to send this as a proper patch? Following the recent discussion
 it sounds to me that there is really some need for something like this. Then
 we could discuss the technical details.

 Please do so.

Sorry, I misread your email. I can submit it to the list.

Regards,

Fabio Estevam
--
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-esdhc-imx: Allow the usage of mmc aliases

2013-09-22 Thread Fabio Estevam
From: Fabio Estevam fabio.este...@freescale.com

On embedded devices, there is often a combination of removable mmc
devices (e.g. MMC/SD cards) and hard wired ones (e.g. eMMC).
Depending on the hardware configuration, the 'mmcblkN' node might
change if the removable device is available or not at boot time.

E.g. if the removable device is attached at boot time, it might
become mmxblk0. And the hard wired one mmcblk1. But if the removable
device isn't there at boot time, the hard wired one will become
mmcblk0. This makes it somehow difficult to hard code the root device
to the non-removable device and boot fast.

Allow the sdhci-esdhc-imx driver to retrieve the mmc aliases, so that we can 
map via the device tree which mmcblk corresponds to the rootfs.

Signed-off-by: Dirk Behme dirk.be...@de.bosch.com
Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
 drivers/mmc/card/block.c   |  5 +++--
 drivers/mmc/host/sdhci-esdhc-imx.c | 10 +-
 include/linux/mmc/host.h   |  2 ++
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 1a3163f..94f842b 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2026,7 +2026,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct 
mmc_card *card,
struct mmc_blk_data *md;
int devidx, ret;
 
-   devidx = find_first_zero_bit(dev_use, max_devices);
+   devidx = find_next_zero_bit(dev_use, max_devices, card-host-devidx);
if (devidx = max_devices)
return ERR_PTR(-ENOSPC);
__set_bit(devidx, dev_use);
@@ -2044,7 +2044,8 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct 
mmc_card *card,
 * index anymore so we keep track of a name index.
 */
if (!subname) {
-   md-name_idx = find_first_zero_bit(name_use, max_devices);
+   md-name_idx = find_next_zero_bit(name_use, max_devices,
+ card-host-devidx);
__set_bit(md-name_idx, name_use);
} else
md-name_idx = ((struct mmc_blk_data *)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c 
b/drivers/mmc/host/sdhci-esdhc-imx.c
index abc8cf0..e11a6af 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -524,8 +524,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device 
*pdev)
struct sdhci_pltfm_host *pltfm_host;
struct sdhci_host *host;
struct esdhc_platform_data *boarddata;
-   int err;
+   int err, ret;
struct pltfm_imx_data *imx_data;
+   struct device_node *np = pdev-dev.of_node;
 
host = sdhci_pltfm_init(pdev, sdhci_esdhc_imx_pdata, 0);
if (IS_ERR(host))
@@ -602,6 +603,13 @@ static int sdhci_esdhc_imx_probe(struct platform_device 
*pdev)
host-mmc-parent-platform_data);
}
 
+
+   if (np) {
+   ret = of_alias_get_id(np, mmcblk);
+   if (ret = 0)
+   host-mmc-devidx = ret;
+   }
+
/* write_protect */
if (boarddata-wp_type == ESDHC_WP_GPIO) {
err = mmc_gpio_request_ro(host-mmc, boarddata-wp_gpio);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3b0c33a..8209f72 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -362,6 +362,8 @@ struct mmc_host {
 
unsigned intslotno; /* used for sdio acpi binding */
 
+   /* preferred mmc block device index (mmcblkX) */
+   unsigned intdevidx;
unsigned long   private[0] cacheline_aligned;
 };
 
-- 
1.8.1.2

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