* [PATCH 0/4] Minor MMC fixes
@ 2011-06-23 10:40 Adrian Hunter
2011-06-23 10:40 ` [PATCH 1/4] mmc: block: switch card to User Data Area when removing the block driver Adrian Hunter
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Adrian Hunter @ 2011-06-23 10:40 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter
Hi
Here are 4 minor fixes:
Adrian Hunter (4):
mmc: block: switch card to User Data Area when removing the block driver
mmc: core: make erase timeout calculation allow for gated clock
mmc: queue: append partition subname to queue thread name
mmc: queue: bring discard_granularity/alignment into line with SCSI definitions
drivers/mmc/card/block.c | 5 ++++-
drivers/mmc/card/queue.c | 15 ++++++---------
drivers/mmc/card/queue.h | 3 ++-
drivers/mmc/core/core.c | 2 +-
4 files changed, 13 insertions(+), 12 deletions(-)
Regards
Adrian Hunter
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] mmc: block: switch card to User Data Area when removing the block driver
2011-06-23 10:40 [PATCH 0/4] Minor MMC fixes Adrian Hunter
@ 2011-06-23 10:40 ` Adrian Hunter
2011-06-23 10:40 ` [PATCH 2/4] mmc: core: make erase timeout calculation allow for gated clock Adrian Hunter
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Adrian Hunter @ 2011-06-23 10:40 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter, Andrei Warkentin
The MMC block driver and other drivers (e.g. mmc-test) will expect
the card to be switched to the User Data Area eMMC partition when
they start. Hence the MMC block driver should ensure it is that
way when it is removed.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andrei Warkentin <andreiw@motorola.com>
---
drivers/mmc/card/block.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index e5d1c8a..d36b7ea 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1440,6 +1440,9 @@ static void mmc_blk_remove(struct mmc_card *card)
struct mmc_blk_data *md = mmc_get_drvdata(card);
mmc_blk_remove_parts(card, md);
+ mmc_claim_host(card->host);
+ mmc_blk_part_switch(card, md);
+ mmc_release_host(card->host);
mmc_blk_remove_req(md);
mmc_set_drvdata(card, NULL);
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] mmc: core: make erase timeout calculation allow for gated clock
2011-06-23 10:40 [PATCH 0/4] Minor MMC fixes Adrian Hunter
2011-06-23 10:40 ` [PATCH 1/4] mmc: block: switch card to User Data Area when removing the block driver Adrian Hunter
@ 2011-06-23 10:40 ` Adrian Hunter
2011-06-23 10:40 ` [PATCH 3/4] mmc: queue: append partition subname to queue thread name Adrian Hunter
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Adrian Hunter @ 2011-06-23 10:40 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter
The erase timeout calculation may depend on clock rate
which is zero if the clock is gated, so use
mmc_host_clk_rate() which allows for that case.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/core/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 68091dd..7843efe 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1245,7 +1245,7 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
*/
timeout_clks <<= 1;
timeout_us += (timeout_clks * 1000) /
- (card->host->ios.clock / 1000);
+ (mmc_host_clk_rate(card->host) / 1000);
erase_timeout = timeout_us / 1000;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] mmc: queue: append partition subname to queue thread name
2011-06-23 10:40 [PATCH 0/4] Minor MMC fixes Adrian Hunter
2011-06-23 10:40 ` [PATCH 1/4] mmc: block: switch card to User Data Area when removing the block driver Adrian Hunter
2011-06-23 10:40 ` [PATCH 2/4] mmc: core: make erase timeout calculation allow for gated clock Adrian Hunter
@ 2011-06-23 10:40 ` Adrian Hunter
2011-06-24 2:44 ` Jaehoon Chung
2011-06-23 10:40 ` [PATCH 4/4] mmc: queue: bring discard_granularity/alignment into line with SCSI definitions Adrian Hunter
2011-06-25 22:54 ` [PATCH 0/4] Minor MMC fixes Chris Ball
4 siblings, 1 reply; 7+ messages in thread
From: Adrian Hunter @ 2011-06-23 10:40 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter, Andrei Warkentin
For example, an eMMC with 2 boot partitions will have 3 threads.
The names change from:
40 ? 00:00:00 mmcqd/0
41 ? 00:00:00 mmcqd/0
42 ? 00:00:00 mmcqd/0
to:
40 ? 00:00:00 mmcqd/0
41 ? 00:00:00 mmcqd/0boot0
42 ? 00:00:00 mmcqd/0boot1
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andrei Warkentin <andreiw@motorola.com>
---
drivers/mmc/card/block.c | 2 +-
drivers/mmc/card/queue.c | 8 +++++---
drivers/mmc/card/queue.h | 3 ++-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index d36b7ea..bee2106 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1167,7 +1167,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
INIT_LIST_HEAD(&md->part);
md->usage = 1;
- ret = mmc_init_queue(&md->queue, card, &md->lock);
+ ret = mmc_init_queue(&md->queue, card, &md->lock, subname);
if (ret)
goto err_putdisk;
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index c07322c..3e2db1c 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -106,10 +106,12 @@ static void mmc_request(struct request_queue *q)
* @mq: mmc queue
* @card: mmc card to attach this queue
* @lock: queue lock
+ * @subname: partition subname
*
* Initialise a MMC card request queue.
*/
-int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock)
+int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
+ spinlock_t *lock, const char *subname)
{
struct mmc_host *host = card->host;
u64 limit = BLK_BOUNCE_HIGH;
@@ -209,8 +211,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
sema_init(&mq->thread_sem, 1);
- mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d",
- host->index);
+ mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d%s",
+ host->index, subname ? subname : "");
if (IS_ERR(mq->thread)) {
ret = PTR_ERR(mq->thread);
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h
index 64e66e0..6223ef8 100644
--- a/drivers/mmc/card/queue.h
+++ b/drivers/mmc/card/queue.h
@@ -19,7 +19,8 @@ struct mmc_queue {
unsigned int bounce_sg_len;
};
-extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *);
+extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
+ const char *);
extern void mmc_cleanup_queue(struct mmc_queue *);
extern void mmc_queue_suspend(struct mmc_queue *);
extern void mmc_queue_resume(struct mmc_queue *);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] mmc: queue: bring discard_granularity/alignment into line with SCSI definitions
2011-06-23 10:40 [PATCH 0/4] Minor MMC fixes Adrian Hunter
` (2 preceding siblings ...)
2011-06-23 10:40 ` [PATCH 3/4] mmc: queue: append partition subname to queue thread name Adrian Hunter
@ 2011-06-23 10:40 ` Adrian Hunter
2011-06-25 22:54 ` [PATCH 0/4] Minor MMC fixes Chris Ball
4 siblings, 0 replies; 7+ messages in thread
From: Adrian Hunter @ 2011-06-23 10:40 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Adrian Hunter
SCSI defines discard alignment as the offset to the first
optimal discard. In the case of SD/MMC, that is always zero
which is the default.
SCSI defines discard granularity as a hint of a optimal
discard size. That is much better expressed by the MMC
"preferred erase size" (pref_erase) field.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/card/queue.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 3e2db1c..6413afa 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -135,12 +135,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
mq->queue->limits.max_discard_sectors = UINT_MAX;
if (card->erased_byte == 0)
mq->queue->limits.discard_zeroes_data = 1;
- if (!mmc_can_trim(card) && is_power_of_2(card->erase_size)) {
- mq->queue->limits.discard_granularity =
- card->erase_size << 9;
- mq->queue->limits.discard_alignment =
- card->erase_size << 9;
- }
+ mq->queue->limits.discard_granularity = card->pref_erase << 9;
if (mmc_can_secure_erase_trim(card))
queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD,
mq->queue);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] mmc: queue: append partition subname to queue thread name
2011-06-23 10:40 ` [PATCH 3/4] mmc: queue: append partition subname to queue thread name Adrian Hunter
@ 2011-06-24 2:44 ` Jaehoon Chung
0 siblings, 0 replies; 7+ messages in thread
From: Jaehoon Chung @ 2011-06-24 2:44 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Chris Ball, linux-mmc, Andrei Warkentin
Hi Adrian..
I also found this problem..
So i confused the same mmcdq name.
Thanks for fixed the mmcqd name.
Regards,
Jaehoon Chung
Adrian Hunter wrote:
> For example, an eMMC with 2 boot partitions will have 3 threads.
> The names change from:
>
> 40 ? 00:00:00 mmcqd/0
> 41 ? 00:00:00 mmcqd/0
> 42 ? 00:00:00 mmcqd/0
>
> to:
>
> 40 ? 00:00:00 mmcqd/0
> 41 ? 00:00:00 mmcqd/0boot0
> 42 ? 00:00:00 mmcqd/0boot1
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Andrei Warkentin <andreiw@motorola.com>
> ---
> drivers/mmc/card/block.c | 2 +-
> drivers/mmc/card/queue.c | 8 +++++---
> drivers/mmc/card/queue.h | 3 ++-
> 3 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index d36b7ea..bee2106 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1167,7 +1167,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
> INIT_LIST_HEAD(&md->part);
> md->usage = 1;
>
> - ret = mmc_init_queue(&md->queue, card, &md->lock);
> + ret = mmc_init_queue(&md->queue, card, &md->lock, subname);
> if (ret)
> goto err_putdisk;
>
> diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
> index c07322c..3e2db1c 100644
> --- a/drivers/mmc/card/queue.c
> +++ b/drivers/mmc/card/queue.c
> @@ -106,10 +106,12 @@ static void mmc_request(struct request_queue *q)
> * @mq: mmc queue
> * @card: mmc card to attach this queue
> * @lock: queue lock
> + * @subname: partition subname
> *
> * Initialise a MMC card request queue.
> */
> -int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock)
> +int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
> + spinlock_t *lock, const char *subname)
> {
> struct mmc_host *host = card->host;
> u64 limit = BLK_BOUNCE_HIGH;
> @@ -209,8 +211,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
>
> sema_init(&mq->thread_sem, 1);
>
> - mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d",
> - host->index);
> + mq->thread = kthread_run(mmc_queue_thread, mq, "mmcqd/%d%s",
> + host->index, subname ? subname : "");
>
> if (IS_ERR(mq->thread)) {
> ret = PTR_ERR(mq->thread);
> diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h
> index 64e66e0..6223ef8 100644
> --- a/drivers/mmc/card/queue.h
> +++ b/drivers/mmc/card/queue.h
> @@ -19,7 +19,8 @@ struct mmc_queue {
> unsigned int bounce_sg_len;
> };
>
> -extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *);
> +extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
> + const char *);
> extern void mmc_cleanup_queue(struct mmc_queue *);
> extern void mmc_queue_suspend(struct mmc_queue *);
> extern void mmc_queue_resume(struct mmc_queue *);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] Minor MMC fixes
2011-06-23 10:40 [PATCH 0/4] Minor MMC fixes Adrian Hunter
` (3 preceding siblings ...)
2011-06-23 10:40 ` [PATCH 4/4] mmc: queue: bring discard_granularity/alignment into line with SCSI definitions Adrian Hunter
@ 2011-06-25 22:54 ` Chris Ball
4 siblings, 0 replies; 7+ messages in thread
From: Chris Ball @ 2011-06-25 22:54 UTC (permalink / raw)
To: Adrian Hunter; +Cc: linux-mmc
Hi Adrian,
On Thu, Jun 23 2011, Adrian Hunter wrote:
> Here are 4 minor fixes:
>
> Adrian Hunter (4):
> mmc: block: switch card to User Data Area when removing the block driver
> mmc: core: make erase timeout calculation allow for gated clock
> mmc: queue: append partition subname to queue thread name
> mmc: queue: bring discard_granularity/alignment into line with SCSI definitions
Thanks, will push these for 3.0.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-06-25 22:55 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 10:40 [PATCH 0/4] Minor MMC fixes Adrian Hunter
2011-06-23 10:40 ` [PATCH 1/4] mmc: block: switch card to User Data Area when removing the block driver Adrian Hunter
2011-06-23 10:40 ` [PATCH 2/4] mmc: core: make erase timeout calculation allow for gated clock Adrian Hunter
2011-06-23 10:40 ` [PATCH 3/4] mmc: queue: append partition subname to queue thread name Adrian Hunter
2011-06-24 2:44 ` Jaehoon Chung
2011-06-23 10:40 ` [PATCH 4/4] mmc: queue: bring discard_granularity/alignment into line with SCSI definitions Adrian Hunter
2011-06-25 22:54 ` [PATCH 0/4] Minor MMC fixes Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox