* [PATCH 1/5] mmc: cb710: partially demystify clock selection
2010-10-12 22:22 [PATCH 0/5] CB710 driver updates Michał Mirosław
@ 2010-03-21 6:33 ` Michał Mirosław
2010-03-21 6:39 ` [PATCH 2/5] mmc: cb710: implement get_cd() callback Michał Mirosław
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2010-03-21 6:33 UTC (permalink / raw)
To: Chris Ball, linux-mmc
Clock divider selection in partially verified, so document known facts
in code.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/mmc/host/cb710-mmc.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index ca3bdc8..ad61c4c 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -25,7 +25,7 @@ static const u8 cb710_src_freq_mhz[16] = {
50, 55, 60, 65, 70, 75, 80, 85
};
-static void cb710_mmc_set_clock(struct mmc_host *mmc, int hz)
+static void cb710_mmc_select_clock_divider(struct mmc_host *mmc, int hz)
{
struct cb710_slot *slot = cb710_mmc_to_slot(mmc);
struct pci_dev *pdev = cb710_slot_to_chip(slot)->pdev;
@@ -33,8 +33,11 @@ static void cb710_mmc_set_clock(struct mmc_host *mmc, int hz)
u32 divider_idx;
int src_hz;
- /* this is magic, unverifiable for me, unless I get
- * MMC card with cables connected to bus signals */
+ /* on CB710 in HP nx9500:
+ * src_freq_idx == 0
+ * indexes 1-7 work as written in the table
+ * indexes 0,8-15 give no clock output
+ */
pci_read_config_dword(pdev, 0x48, &src_freq_idx);
src_freq_idx = (src_freq_idx >> 16) & 0xF;
src_hz = cb710_src_freq_mhz[src_freq_idx] * 1000000;
@@ -46,13 +49,15 @@ static void cb710_mmc_set_clock(struct mmc_host *mmc, int hz)
if (src_freq_idx)
divider_idx |= 0x8;
+ else if (divider_idx == 0)
+ divider_idx = 1;
cb710_pci_update_config_reg(pdev, 0x40, ~0xF0000000, divider_idx << 28);
dev_dbg(cb710_slot_dev(slot),
- "clock set to %d Hz, wanted %d Hz; flag = %d\n",
+ "clock set to %d Hz, wanted %d Hz; src_freq_idx = %d, divider_idx = %d|%d\n",
src_hz >> cb710_clock_divider_log2[divider_idx & 7],
- hz, (divider_idx & 8) != 0);
+ hz, src_freq_idx, divider_idx & 7, divider_idx & 8);
}
static void __cb710_mmc_enable_irq(struct cb710_slot *slot,
@@ -512,7 +517,7 @@ static int cb710_mmc_powerup(struct cb710_slot *slot)
#endif
int err;
- /* a lot of magic; see comment in cb710_mmc_set_clock() */
+ /* a lot of magic for now */
dev_dbg(cb710_slot_dev(slot), "bus powerup\n");
cb710_dump_regs(chip, CB710_DUMP_REGS_MMC);
err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20);
@@ -572,7 +577,7 @@ static void cb710_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
struct cb710_mmc_reader *reader = mmc_priv(mmc);
int err;
- cb710_mmc_set_clock(mmc, ios->clock);
+ cb710_mmc_select_clock_divider(mmc, ios->clock);
if (!cb710_mmc_is_card_inserted(slot)) {
dev_dbg(cb710_slot_dev(slot),
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/5] mmc: cb710: implement get_cd() callback
2010-10-12 22:22 [PATCH 0/5] CB710 driver updates Michał Mirosław
2010-03-21 6:33 ` [PATCH 1/5] mmc: cb710: partially demystify clock selection Michał Mirosław
@ 2010-03-21 6:39 ` Michał Mirosław
2010-03-21 6:41 ` [PATCH 3/5] mmc: cb710: remove unnecessary msleep() Michał Mirosław
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2010-03-21 6:39 UTC (permalink / raw)
To: Chris Ball, linux-mmc
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/mmc/host/cb710-mmc.c | 33 +++++++++++++--------------------
1 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index ad61c4c..7a176b4 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -100,12 +100,6 @@ static void cb710_mmc_reset_events(struct cb710_slot *slot)
cb710_write_port_8(slot, CB710_MMC_STATUS2_PORT, 0xFF);
}
-static int cb710_mmc_is_card_inserted(struct cb710_slot *slot)
-{
- return cb710_read_port_8(slot, CB710_MMC_STATUS3_PORT)
- & CB710_MMC_S3_CARD_DETECTED;
-}
-
static void cb710_mmc_enable_4bit_data(struct cb710_slot *slot, int enable)
{
dev_dbg(cb710_slot_dev(slot), "configuring %d-data-line%s mode\n",
@@ -499,13 +493,9 @@ static void cb710_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
reader->mrq = mrq;
cb710_mmc_enable_irq(slot, CB710_MMC_IE_TEST_MASK, 0);
- if (cb710_mmc_is_card_inserted(slot)) {
- if (!cb710_mmc_command(mmc, mrq->cmd) && mrq->stop)
- cb710_mmc_command(mmc, mrq->stop);
- mdelay(1);
- } else {
- mrq->cmd->error = -ENOMEDIUM;
- }
+ if (!cb710_mmc_command(mmc, mrq->cmd) && mrq->stop)
+ cb710_mmc_command(mmc, mrq->stop);
+ mdelay(1);
tasklet_schedule(&reader->finish_req_tasklet);
}
@@ -579,12 +569,6 @@ static void cb710_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
cb710_mmc_select_clock_divider(mmc, ios->clock);
- if (!cb710_mmc_is_card_inserted(slot)) {
- dev_dbg(cb710_slot_dev(slot),
- "no card inserted - ignoring bus powerup request\n");
- ios->power_mode = MMC_POWER_OFF;
- }
-
if (ios->power_mode != reader->last_power_mode)
switch (ios->power_mode) {
case MMC_POWER_ON:
@@ -624,6 +608,14 @@ static int cb710_mmc_get_ro(struct mmc_host *mmc)
& CB710_MMC_S3_WRITE_PROTECTED;
}
+static int cb710_mmc_get_cd(struct mmc_host *mmc)
+{
+ struct cb710_slot *slot = cb710_mmc_to_slot(mmc);
+
+ return cb710_read_port_8(slot, CB710_MMC_STATUS3_PORT)
+ & CB710_MMC_S3_CARD_DETECTED;
+}
+
static int cb710_mmc_irq_handler(struct cb710_slot *slot)
{
struct mmc_host *mmc = cb710_slot_to_mmc(slot);
@@ -669,7 +661,8 @@ static void cb710_mmc_finish_request_tasklet(unsigned long data)
static const struct mmc_host_ops cb710_mmc_host = {
.request = cb710_mmc_request,
.set_ios = cb710_mmc_set_ios,
- .get_ro = cb710_mmc_get_ro
+ .get_ro = cb710_mmc_get_ro,
+ .get_cd = cb710_mmc_get_cd,
};
#ifdef CONFIG_PM
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/5] mmc: cb710: remove unnecessary msleep()
2010-10-12 22:22 [PATCH 0/5] CB710 driver updates Michał Mirosław
2010-03-21 6:33 ` [PATCH 1/5] mmc: cb710: partially demystify clock selection Michał Mirosław
2010-03-21 6:39 ` [PATCH 2/5] mmc: cb710: implement get_cd() callback Michał Mirosław
@ 2010-03-21 6:41 ` Michał Mirosław
2010-03-21 6:44 ` [PATCH 4/5] mmc: cb710: clear irq handler on init() error path Michał Mirosław
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2010-03-21 6:41 UTC (permalink / raw)
To: Chris Ball, linux-mmc
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/mmc/host/cb710-mmc.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index 7a176b4..5374b6b 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -495,7 +495,6 @@ static void cb710_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
if (!cb710_mmc_command(mmc, mrq->cmd) && mrq->stop)
cb710_mmc_command(mmc, mrq->stop);
- mdelay(1);
tasklet_schedule(&reader->finish_req_tasklet);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/5] mmc: cb710: clear irq handler on init() error path
2010-10-12 22:22 [PATCH 0/5] CB710 driver updates Michał Mirosław
` (2 preceding siblings ...)
2010-03-21 6:41 ` [PATCH 3/5] mmc: cb710: remove unnecessary msleep() Michał Mirosław
@ 2010-03-21 6:44 ` Michał Mirosław
2010-03-21 7:30 ` [PATCH 5/5] mmc: cb710: remove debugging printk (info duplicated from mmc-core) Michał Mirosław
2010-10-14 2:03 ` [PATCH 0/5] CB710 driver updates Chris Ball
5 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2010-03-21 6:44 UTC (permalink / raw)
To: Chris Ball, linux-mmc
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/mmc/host/cb710-mmc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index 5374b6b..2299afc 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -743,6 +743,7 @@ static int __devinit cb710_mmc_init(struct platform_device *pdev)
err_free_mmc:
dev_dbg(cb710_slot_dev(slot), "mmc_add_host() failed: %d\n", err);
+ cb710_set_irq_handler(slot, NULL);
mmc_free_host(mmc);
return err;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/5] mmc: cb710: remove debugging printk (info duplicated from mmc-core)
2010-10-12 22:22 [PATCH 0/5] CB710 driver updates Michał Mirosław
` (3 preceding siblings ...)
2010-03-21 6:44 ` [PATCH 4/5] mmc: cb710: clear irq handler on init() error path Michał Mirosław
@ 2010-03-21 7:30 ` Michał Mirosław
2010-10-14 2:03 ` [PATCH 0/5] CB710 driver updates Chris Ball
5 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2010-03-21 7:30 UTC (permalink / raw)
To: Chris Ball, linux-mmc
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/mmc/host/cb710-mmc.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index 2299afc..66b4ce5 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -102,8 +102,6 @@ static void cb710_mmc_reset_events(struct cb710_slot *slot)
static void cb710_mmc_enable_4bit_data(struct cb710_slot *slot, int enable)
{
- dev_dbg(cb710_slot_dev(slot), "configuring %d-data-line%s mode\n",
- enable ? 4 : 1, enable ? "s" : "");
if (enable)
cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT,
CB710_MMC_C1_4BIT_DATA_BUS, 0);
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/5] CB710 driver updates
2010-10-12 22:22 [PATCH 0/5] CB710 driver updates Michał Mirosław
` (4 preceding siblings ...)
2010-03-21 7:30 ` [PATCH 5/5] mmc: cb710: remove debugging printk (info duplicated from mmc-core) Michał Mirosław
@ 2010-10-14 2:03 ` Chris Ball
5 siblings, 0 replies; 7+ messages in thread
From: Chris Ball @ 2010-10-14 2:03 UTC (permalink / raw)
To: Michał Mirosław; +Cc: Chris Ball, linux-mmc
Hi Michał,
On Wed, Oct 13, 2010 at 12:22:13AM +0200, Michał Mirosław wrote:
> This series consists of some updates for CB710 MMC host driver.
>
> Michał Mirosław (5):
> mmc: cb710: partially demystify clock selection
> mmc: cb710: implement get_cd() callback
> mmc: cb710: remove unnecessary msleep()
> mmc: cb710: clear irq handler on init() error path
> mmc: cb710: remove debugging printk (info duplicated from mmc-core)
>
> drivers/mmc/host/cb710-mmc.c | 54 +++++++++++++++++++----------------------
> 1 files changed, 25 insertions(+), 29 deletions(-)
Thanks, all applied to mmc-next.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 7+ messages in thread