* [PATCH 1/5] mci: Add STUFF_BITS and use it
@ 2012-11-29 19:02 Sascha Hauer
2012-11-29 19:02 ` [PATCH 2/5] mci: Fix capacity calculation for high capacity MMC cards Sascha Hauer
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Sascha Hauer @ 2012-11-29 19:02 UTC (permalink / raw)
To: barebox
This adds the STUFF_BITS macro from the kernel to extract numbers
from the csd. This also fixes several places where the csd fields
in SD cards differ from MMC cards.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/mci-core.c | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index bf2b0f8..0d601e3 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -37,6 +37,20 @@
#define MAX_BUFFER_NUMBER 0xffffffff
+#define UNSTUFF_BITS(resp,start,size) \
+ ({ \
+ const int __size = size; \
+ const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
+ const int __off = 3 - ((start) / 32); \
+ const int __shft = (start) & 31; \
+ u32 __res; \
+ \
+ __res = resp[__off] >> __shft; \
+ if (__size + __shft > 32) \
+ __res |= resp[__off-1] << ((32 - __shft) % 32); \
+ __res & __mask; \
+ })
+
/**
* @file
* @brief Memory Card framework
@@ -724,7 +738,7 @@ static void mci_extract_max_tran_speed_from_csd(struct mci *mci)
*/
static void mci_extract_block_lengths_from_csd(struct mci *mci)
{
- mci->read_bl_len = 1 << ((mci->csd[1] >> 16) & 0xf);
+ mci->read_bl_len = 1 << UNSTUFF_BITS(mci->csd, 80, 4);
if (IS_SD(mci))
mci->write_bl_len = mci->read_bl_len; /* FIXME why? */
@@ -1165,7 +1179,10 @@ static int mci_sd_read(struct block_device *blk, void *buffer, int block,
*/
static unsigned extract_mid(struct mci *mci)
{
- return mci->cid[0] >> 24;
+ if (!IS_SD(mci) && mci->version <= MMC_VERSION_1_4)
+ return UNSTUFF_BITS(mci->cid, 104, 24);
+ else
+ return UNSTUFF_BITS(mci->cid, 120, 8);
}
/**
@@ -1198,7 +1215,15 @@ static unsigned extract_prv(struct mci *mci)
*/
static unsigned extract_psn(struct mci *mci)
{
- return (mci->cid[2] << 8) | (mci->cid[3] >> 24);
+ if (IS_SD(mci)) {
+ return UNSTUFF_BITS(mci->csd, 24, 32);
+ } else {
+ if (mci->version > MMC_VERSION_1_4)
+ return UNSTUFF_BITS(mci->cid, 16, 32);
+ else
+ return UNSTUFF_BITS(mci->cid, 16, 24);
+ }
+
}
/**
@@ -1209,7 +1234,10 @@ static unsigned extract_psn(struct mci *mci)
*/
static unsigned extract_mtd_month(struct mci *mci)
{
- return (mci->cid[3] >> 8) & 0xf;
+ if (IS_SD(mci))
+ return UNSTUFF_BITS(mci->cid, 8, 4);
+ else
+ return UNSTUFF_BITS(mci->cid, 12, 4);
}
/**
@@ -1221,7 +1249,10 @@ static unsigned extract_mtd_month(struct mci *mci)
*/
static unsigned extract_mtd_year(struct mci *mci)
{
- return ((mci->cid[3] >> 12) & 0xff) + 2000U;
+ if (IS_SD(mci))
+ return UNSTUFF_BITS(mci->cid, 12, 8) + 2000;
+ else
+ return UNSTUFF_BITS(mci->cid, 8, 4) + 1997;
}
/**
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/5] mci: Fix capacity calculation for high capacity MMC cards
2012-11-29 19:02 [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
@ 2012-11-29 19:02 ` Sascha Hauer
2012-12-03 8:38 ` Sascha Hauer
2012-11-29 19:02 ` [PATCH 3/5] mci: Allow to specify device name Sascha Hauer
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2012-11-29 19:02 UTC (permalink / raw)
To: barebox
For these cards we have to calculate the size using the ext csd
sector count fields.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/mci-core.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 0d601e3..942d126 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -758,14 +758,21 @@ static void mci_extract_card_capacity_from_csd(struct mci *mci)
uint64_t csize, cmult;
if (mci->high_capacity) {
- csize = (mci->csd[1] & 0x3f) << 16 | (mci->csd[2] & 0xffff0000) >> 16;
- cmult = 8;
+ if (IS_SD(mci)) {
+ csize = UNSTUFF_BITS(mci->csd, 48, 22);
+ mci->capacity = (1 + csize) << 10;
+ } else {
+ mci->capacity = mci->ext_csd[EXT_CSD_SEC_CNT] << 0 |
+ mci->ext_csd[EXT_CSD_SEC_CNT + 1] << 8 |
+ mci->ext_csd[EXT_CSD_SEC_CNT + 2] << 16 |
+ mci->ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
+ }
} else {
- csize = (mci->csd[1] & 0x3ff) << 2 | (mci->csd[2] & 0xc0000000) >> 30;
- cmult = (mci->csd[2] & 0x00038000) >> 15;
+ cmult = UNSTUFF_BITS(mci->csd, 47, 3);
+ csize = UNSTUFF_BITS(mci->csd, 62, 12);
+ mci->capacity = (csize + 1) << (cmult + 2);
}
- mci->capacity = (csize + 1) << (cmult + 2);
mci->capacity *= mci->read_bl_len;
dev_dbg(mci->mci_dev, "Capacity: %u MiB\n", (unsigned)(mci->capacity >> 20));
}
@@ -996,7 +1003,6 @@ static int mci_startup(struct mci *mci)
mci_detect_version_from_csd(mci);
mci_extract_max_tran_speed_from_csd(mci);
mci_extract_block_lengths_from_csd(mci);
- mci_extract_card_capacity_from_csd(mci);
/* sanitiy? */
if (mci->read_bl_len > SECTOR_SIZE) {
@@ -1032,6 +1038,8 @@ static int mci_startup(struct mci *mci)
if (err)
return err;
+ mci_extract_card_capacity_from_csd(mci);
+
/* Restrict card's capabilities by what the host can do */
mci->card_caps &= host->host_caps;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/5] mci: Fix capacity calculation for high capacity MMC cards
2012-11-29 19:02 ` [PATCH 2/5] mci: Fix capacity calculation for high capacity MMC cards Sascha Hauer
@ 2012-12-03 8:38 ` Sascha Hauer
0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2012-12-03 8:38 UTC (permalink / raw)
To: barebox
On Thu, Nov 29, 2012 at 08:02:25PM +0100, Sascha Hauer wrote:
> For these cards we have to calculate the size using the ext csd
> sector count fields.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/mci/mci-core.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 0d601e3..942d126 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -758,14 +758,21 @@ static void mci_extract_card_capacity_from_csd(struct mci *mci)
> uint64_t csize, cmult;
>
> if (mci->high_capacity) {
> - csize = (mci->csd[1] & 0x3f) << 16 | (mci->csd[2] & 0xffff0000) >> 16;
> - cmult = 8;
> + if (IS_SD(mci)) {
> + csize = UNSTUFF_BITS(mci->csd, 48, 22);
> + mci->capacity = (1 + csize) << 10;
> + } else {
> + mci->capacity = mci->ext_csd[EXT_CSD_SEC_CNT] << 0 |
> + mci->ext_csd[EXT_CSD_SEC_CNT + 1] << 8 |
> + mci->ext_csd[EXT_CSD_SEC_CNT + 2] << 16 |
> + mci->ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
> + }
> } else {
> - csize = (mci->csd[1] & 0x3ff) << 2 | (mci->csd[2] & 0xc0000000) >> 30;
> - cmult = (mci->csd[2] & 0x00038000) >> 15;
> + cmult = UNSTUFF_BITS(mci->csd, 47, 3);
> + csize = UNSTUFF_BITS(mci->csd, 62, 12);
> + mci->capacity = (csize + 1) << (cmult + 2);
> }
>
> - mci->capacity = (csize + 1) << (cmult + 2);
> mci->capacity *= mci->read_bl_len;
> dev_dbg(mci->mci_dev, "Capacity: %u MiB\n", (unsigned)(mci->capacity >> 20));
> }
> @@ -996,7 +1003,6 @@ static int mci_startup(struct mci *mci)
> mci_detect_version_from_csd(mci);
> mci_extract_max_tran_speed_from_csd(mci);
> mci_extract_block_lengths_from_csd(mci);
> - mci_extract_card_capacity_from_csd(mci);
>
> /* sanitiy? */
> if (mci->read_bl_len > SECTOR_SIZE) {
> @@ -1032,6 +1038,8 @@ static int mci_startup(struct mci *mci)
> if (err)
> return err;
>
> + mci_extract_card_capacity_from_csd(mci);
> +
> /* Restrict card's capabilities by what the host can do */
> mci->card_caps &= host->host_caps;
Here's a fixup patch for this one:
--
From 67947f2d47a752e3c96bc6e29f92459e19e2eab2 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Thu, 29 Nov 2012 16:46:19 +0100
Subject: [PATCH] fixup! mci: Fix capacity calculation for high capacity MMC
cards
commit bbcf96113 moved the size calculation further down, but this
has the effect that the size of cards with block sizes > 512 bytes
is no longer correct. This is because barebox limits the blocksize
to 512 bytes. To fix this use the blocksize value from the csd, not
the barebox one.
This is broken since:
| commit bbcf961133e0d8ddf016ed698724d0ec8d7fd6b8
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date: Thu Nov 29 16:48:19 2012 +0100
|
| mci: Fix capacity calculation for high capacity MMC cards
|
| For these cards we have to calculate the size using the ext csd
| sector count fields.
|
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/mci-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 6e556a8..4957256 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -773,7 +773,7 @@ static void mci_extract_card_capacity_from_csd(struct mci *mci)
mci->capacity = (csize + 1) << (cmult + 2);
}
- mci->capacity *= mci->read_bl_len;
+ mci->capacity *= 1 << UNSTUFF_BITS(mci->csd, 80, 4);;
dev_dbg(mci->mci_dev, "Capacity: %u MiB\n", (unsigned)(mci->capacity >> 20));
}
--
1.7.10.4
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/5] mci: Allow to specify device name
2012-11-29 19:02 [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
2012-11-29 19:02 ` [PATCH 2/5] mci: Fix capacity calculation for high capacity MMC cards Sascha Hauer
@ 2012-11-29 19:02 ` Sascha Hauer
2012-11-30 4:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-29 19:02 ` [PATCH 4/5] mci i.MX esdhc: Allow to specify devicename from platformdata Sascha Hauer
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2012-11-29 19:02 UTC (permalink / raw)
To: barebox
When multiple MMC/SD cards are present in the system we often
have to have persistent names to identify them during runtime.
This patch allows to overwrite the devicename which is used.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/mci-core.c | 10 +++++++---
include/mci.h | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 942d126..6e556a8 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1397,9 +1397,13 @@ static int mci_card_probe(struct mci *mci)
mci->blk.dev = mci->mci_dev;
mci->blk.ops = &mci_ops;
- disknum = cdev_find_free_index("disk");
+ if (host->devname) {
+ mci->blk.cdev.name = strdup(host->devname);
+ } else {
+ disknum = cdev_find_free_index("disk");
+ mci->blk.cdev.name = asprintf("disk%d", disknum);
+ }
- mci->blk.cdev.name = asprintf("disk%d", disknum);
mci->blk.blockbits = SECTOR_SHIFT;
mci->blk.num_blocks = mci_calc_blk_cnt(mci->capacity, mci->blk.blockbits);
@@ -1409,7 +1413,7 @@ static int mci_card_probe(struct mci *mci)
goto on_error;
}
- dev_info(mci->mci_dev, "registered disk%d\n", disknum);
+ dev_info(mci->mci_dev, "registered %s\n", mci->blk.cdev.name);
/* create partitions on demand */
rc = parse_partition_table(&mci->blk);
diff --git a/include/mci.h b/include/mci.h
index db78b9c..0041e27 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -286,6 +286,7 @@ struct mci_ios {
/** host information */
struct mci_host {
struct device_d *hw_dev; /**< the host MCI hardware device */
+ char *devname; /**< the devicename for the card, defaults to disk%d */
unsigned voltages;
unsigned host_caps; /**< Host's interface capabilities, refer MMC_VDD_* */
unsigned f_min; /**< host interface lower limit */
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/5] mci: Allow to specify device name
2012-11-29 19:02 ` [PATCH 3/5] mci: Allow to specify device name Sascha Hauer
@ 2012-11-30 4:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-30 8:06 ` Sascha Hauer
0 siblings, 1 reply; 11+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-30 4:57 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 20:02 Thu 29 Nov , Sascha Hauer wrote:
> When multiple MMC/SD cards are present in the system we often
> have to have persistent names to identify them during runtime.
> This patch allows to overwrite the devicename which is used.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/mci/mci-core.c | 10 +++++++---
> include/mci.h | 1 +
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 942d126..6e556a8 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1397,9 +1397,13 @@ static int mci_card_probe(struct mci *mci)
> mci->blk.dev = mci->mci_dev;
> mci->blk.ops = &mci_ops;
>
> - disknum = cdev_find_free_index("disk");
> + if (host->devname) {
> + mci->blk.cdev.name = strdup(host->devname);
can you use is a based name not the name
> + } else {
> + disknum = cdev_find_free_index("disk");
> + mci->blk.cdev.name = asprintf("disk%d", disknum);
> + }
>
> - mci->blk.cdev.name = asprintf("disk%d", disknum);
> mci->blk.blockbits = SECTOR_SHIFT;
> mci->blk.num_blocks = mci_calc_blk_cnt(mci->capacity, mci->blk.blockbits);
>
> @@ -1409,7 +1413,7 @@ static int mci_card_probe(struct mci *mci)
> goto on_error;
> }
>
> - dev_info(mci->mci_dev, "registered disk%d\n", disknum);
> + dev_info(mci->mci_dev, "registered %s\n", mci->blk.cdev.name);
>
> /* create partitions on demand */
> rc = parse_partition_table(&mci->blk);
> diff --git a/include/mci.h b/include/mci.h
> index db78b9c..0041e27 100644
> --- a/include/mci.h
> +++ b/include/mci.h
> @@ -286,6 +286,7 @@ struct mci_ios {
> /** host information */
> struct mci_host {
> struct device_d *hw_dev; /**< the host MCI hardware device */
> + char *devname; /**< the devicename for the card, defaults to disk%d */
> unsigned voltages;
> unsigned host_caps; /**< Host's interface capabilities, refer MMC_VDD_* */
> unsigned f_min; /**< host interface lower limit */
> --
> 1.7.10.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/5] mci: Allow to specify device name
2012-11-30 4:57 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-30 8:06 ` Sascha Hauer
2012-11-30 10:10 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2012-11-30 8:06 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Fri, Nov 30, 2012 at 05:57:32AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 20:02 Thu 29 Nov , Sascha Hauer wrote:
> > When multiple MMC/SD cards are present in the system we often
> > have to have persistent names to identify them during runtime.
> > This patch allows to overwrite the devicename which is used.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/mci/mci-core.c | 10 +++++++---
> > include/mci.h | 1 +
> > 2 files changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > index 942d126..6e556a8 100644
> > --- a/drivers/mci/mci-core.c
> > +++ b/drivers/mci/mci-core.c
> > @@ -1397,9 +1397,13 @@ static int mci_card_probe(struct mci *mci)
> > mci->blk.dev = mci->mci_dev;
> > mci->blk.ops = &mci_ops;
> >
> > - disknum = cdev_find_free_index("disk");
> > + if (host->devname) {
> > + mci->blk.cdev.name = strdup(host->devname);
> can you use is a based name not the name
I don't understand this. What do you mean?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/5] mci: Allow to specify device name
2012-11-30 8:06 ` Sascha Hauer
@ 2012-11-30 10:10 ` Jean-Christophe PLAGNIOL-VILLARD
2012-12-03 8:33 ` Sascha Hauer
0 siblings, 1 reply; 11+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-30 10:10 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 09:06 Fri 30 Nov , Sascha Hauer wrote:
> On Fri, Nov 30, 2012 at 05:57:32AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 20:02 Thu 29 Nov , Sascha Hauer wrote:
> > > When multiple MMC/SD cards are present in the system we often
> > > have to have persistent names to identify them during runtime.
> > > This patch allows to overwrite the devicename which is used.
> > >
> > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > ---
> > > drivers/mci/mci-core.c | 10 +++++++---
> > > include/mci.h | 1 +
> > > 2 files changed, 8 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > > index 942d126..6e556a8 100644
> > > --- a/drivers/mci/mci-core.c
> > > +++ b/drivers/mci/mci-core.c
> > > @@ -1397,9 +1397,13 @@ static int mci_card_probe(struct mci *mci)
> > > mci->blk.dev = mci->mci_dev;
> > > mci->blk.ops = &mci_ops;
> > >
> > > - disknum = cdev_find_free_index("disk");
> > > + if (host->devname) {
> > > + mci->blk.cdev.name = strdup(host->devname);
> > can you use is a based name not the name
>
> I don't understand this. What do you mean?
<name><id>
instead of disk0 mmc0 as exmaple
Best Regards,
J.
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/5] mci: Allow to specify device name
2012-11-30 10:10 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-12-03 8:33 ` Sascha Hauer
0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2012-12-03 8:33 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Fri, Nov 30, 2012 at 11:10:30AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:06 Fri 30 Nov , Sascha Hauer wrote:
> > On Fri, Nov 30, 2012 at 05:57:32AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 20:02 Thu 29 Nov , Sascha Hauer wrote:
> > > > When multiple MMC/SD cards are present in the system we often
> > > > have to have persistent names to identify them during runtime.
> > > > This patch allows to overwrite the devicename which is used.
> > > >
> > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > > ---
> > > > drivers/mci/mci-core.c | 10 +++++++---
> > > > include/mci.h | 1 +
> > > > 2 files changed, 8 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > > > index 942d126..6e556a8 100644
> > > > --- a/drivers/mci/mci-core.c
> > > > +++ b/drivers/mci/mci-core.c
> > > > @@ -1397,9 +1397,13 @@ static int mci_card_probe(struct mci *mci)
> > > > mci->blk.dev = mci->mci_dev;
> > > > mci->blk.ops = &mci_ops;
> > > >
> > > > - disknum = cdev_find_free_index("disk");
> > > > + if (host->devname) {
> > > > + mci->blk.cdev.name = strdup(host->devname);
> > > can you use is a based name not the name
> >
> > I don't understand this. What do you mean?
> <name><id>
>
> instead of disk0 mmc0 as exmaple
You can pass "mmc0" directly as string if you want this. Either you want
persistent names or not, passing a fixed name and then adding an index
afterwards does not make sense IMO.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/5] mci i.MX esdhc: Allow to specify devicename from platformdata
2012-11-29 19:02 [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
2012-11-29 19:02 ` [PATCH 2/5] mci: Fix capacity calculation for high capacity MMC cards Sascha Hauer
2012-11-29 19:02 ` [PATCH 3/5] mci: Allow to specify device name Sascha Hauer
@ 2012-11-29 19:02 ` Sascha Hauer
2012-11-29 19:02 ` [PATCH 5/5] mci i.MX esdhc: turn error message into debug message Sascha Hauer
2012-12-05 19:02 ` [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
4 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2012-11-29 19:02 UTC (permalink / raw)
To: barebox
For boards which need to have persistent names for the device file.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/include/mach/esdhc.h | 1 +
drivers/mci/imx-esdhc.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/arch/arm/mach-imx/include/mach/esdhc.h b/arch/arm/mach-imx/include/mach/esdhc.h
index b4c1aa9..06863c8 100644
--- a/arch/arm/mach-imx/include/mach/esdhc.h
+++ b/arch/arm/mach-imx/include/mach/esdhc.h
@@ -41,5 +41,6 @@ struct esdhc_platform_data {
enum wp_types wp_type;
enum cd_types cd_type;
unsigned caps;
+ char *devname;
};
#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index dccffc6..eced162 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -552,6 +552,9 @@ static int fsl_esdhc_probe(struct device_d *dev)
else
mci->host_caps = MMC_MODE_4BIT;
+ if (pdata && pdata->devname)
+ mci->devname = pdata->devname;
+
if (caps & ESDHC_HOSTCAPBLT_HSS)
mci->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/5] mci i.MX esdhc: turn error message into debug message
2012-11-29 19:02 [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
` (2 preceding siblings ...)
2012-11-29 19:02 ` [PATCH 4/5] mci i.MX esdhc: Allow to specify devicename from platformdata Sascha Hauer
@ 2012-11-29 19:02 ` Sascha Hauer
2012-12-05 19:02 ` [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
4 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2012-11-29 19:02 UTC (permalink / raw)
To: barebox
During card probe the mci core may send commands to the card
which the card doesn't understand. This is intended, so do not
print an error message here.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/imx-esdhc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index eced162..dfeb509 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -279,7 +279,7 @@ esdhc_send_cmd(struct mci_host *mci, struct mci_cmd *cmd, struct mci_data *data)
ret = wait_on_timeout(100 * MSECOND,
esdhc_read32(®s->irqstat) & IRQSTAT_CC);
if (ret) {
- dev_err(host->dev, "timeout 1\n");
+ dev_dbg(host->dev, "timeout 1\n");
return -ETIMEDOUT;
}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/5] mci: Add STUFF_BITS and use it
2012-11-29 19:02 [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
` (3 preceding siblings ...)
2012-11-29 19:02 ` [PATCH 5/5] mci i.MX esdhc: turn error message into debug message Sascha Hauer
@ 2012-12-05 19:02 ` Sascha Hauer
4 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2012-12-05 19:02 UTC (permalink / raw)
To: barebox
I applied this series without the patches which allow to pass the /dev/
filename for the mci device for now. I still have the hope to find a
better solution for this. Being able to have persistent names, or at
least a way to specify 'load from this slot' is a worthwile goal, but
what I suggested requires changes for all drivers/board files wishing to
have a persistent name.
I'm now thinking more into the direction that the hardware devicename
(imx-esdhc0) could be used to refer to a device filename, but currently
I do not know how this can be best solved.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-12-05 19:02 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-29 19:02 [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
2012-11-29 19:02 ` [PATCH 2/5] mci: Fix capacity calculation for high capacity MMC cards Sascha Hauer
2012-12-03 8:38 ` Sascha Hauer
2012-11-29 19:02 ` [PATCH 3/5] mci: Allow to specify device name Sascha Hauer
2012-11-30 4:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-30 8:06 ` Sascha Hauer
2012-11-30 10:10 ` Jean-Christophe PLAGNIOL-VILLARD
2012-12-03 8:33 ` Sascha Hauer
2012-11-29 19:02 ` [PATCH 4/5] mci i.MX esdhc: Allow to specify devicename from platformdata Sascha Hauer
2012-11-29 19:02 ` [PATCH 5/5] mci i.MX esdhc: turn error message into debug message Sascha Hauer
2012-12-05 19:02 ` [PATCH 1/5] mci: Add STUFF_BITS and use it Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox