* [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation
@ 2011-03-07 18:47 Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH/RFC 1/5] mmc: tmio: fix power-mode interpretation Guennadi Liakhovetski
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-07 18:47 UTC (permalink / raw)
To: linux-sh; +Cc: linux-mmc, Chris Ball, Ian Molton
Hi
5 more patches, that fix high register access on sh-mobile in a correct
way and implement aggressive clock gating. Marked as RFC because testing
on non-SDHI platforms is required! The next step would be to add
runtime-pm to clock gating, but I'm refraining from this for now, because
similar patches for SDHCI have still not been committed and it seems,
there are still doubts about the right way to do that.
Patches apply on top of my previous 2 patches from earlier today.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH/RFC 1/5] mmc: tmio: fix power-mode interpretation
2011-03-07 18:47 [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Guennadi Liakhovetski
@ 2011-03-07 18:47 ` Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH 2/5] mmc: tmio: add a flag to prohibit access to registers above 0xff Guennadi Liakhovetski
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-07 18:47 UTC (permalink / raw)
To: linux-sh; +Cc: linux-mmc, Chris Ball, Ian Molton
The power-mode sequence on MMC is MMC_POWER_OFF -> MMC_POWER_UP ->
MMC_POWER_ON and not MMC_POWER_ON -> MMC_POWER_UP, as the driver currently
is implying.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
Should be tested on non-SDHI systems
drivers/mmc/host/tmio_mmc.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index f5ec5e6..91a31d2 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -1162,20 +1162,20 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (ios->clock)
tmio_mmc_set_clock(host, ios->clock);
- /* Power sequence - OFF -> ON -> UP */
+ /* Power sequence - OFF -> UP -> ON */
switch (ios->power_mode) {
case MMC_POWER_OFF: /* power down SD bus */
if (host->set_pwr)
host->set_pwr(host->pdev, 0);
tmio_mmc_clk_stop(host);
break;
- case MMC_POWER_ON: /* power up SD bus */
+ case MMC_POWER_ON: /* start bus clock */
+ tmio_mmc_clk_start(host);
+ break;
+ case MMC_POWER_UP: /* power up SD bus */
if (host->set_pwr)
host->set_pwr(host->pdev, 1);
break;
- case MMC_POWER_UP: /* start bus clock */
- tmio_mmc_clk_start(host);
- break;
}
switch (ios->bus_width) {
--
1.7.2.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/5] mmc: tmio: add a flag to prohibit access to registers above 0xff
2011-03-07 18:47 [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH/RFC 1/5] mmc: tmio: fix power-mode interpretation Guennadi Liakhovetski
@ 2011-03-07 18:47 ` Guennadi Liakhovetski
2011-03-08 3:35 ` Magnus Damm
2011-03-08 7:34 ` Paul Mundt
2011-03-07 18:47 ` [PATCH 3/5] ARM: mach-shmobile: use the new TMIO_MMC_HI_REGS_MISSING flag for SDHI Guennadi Liakhovetski
` (3 subsequent siblings)
5 siblings, 2 replies; 10+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-07 18:47 UTC (permalink / raw)
To: linux-sh; +Cc: linux-mmc, Chris Ball, Ian Molton
On some implementations there are no registers above 0xff and any
access to them mirrors to registers at addresses with bit 8 masked
out, which leads to malfunction. Add a flag to prevent such accesses.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/mmc/host/tmio_mmc.c | 38 +++++++++++++++-----------------------
include/linux/mfd/tmio.h | 6 ++++++
2 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 91a31d2..5e880c06 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -306,19 +306,9 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
struct mfd_cell *cell = host->pdev->dev.platform_data;
struct tmio_mmc_data *pdata = cell->driver_data;
- /*
- * Testing on sh-mobile showed that SDIO IRQs are unmasked when
- * CTL_CLK_AND_WAIT_CTL gets written, so we have to disable the
- * device IRQ here and restore the SDIO IRQ mask before
- * re-enabling the device IRQ.
- */
- if (pdata->flags & TMIO_MMC_SDIO_IRQ)
- disable_irq(host->irq);
- sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);
- msleep(10);
- if (pdata->flags & TMIO_MMC_SDIO_IRQ) {
- tmio_mmc_enable_sdio_irq(host->mmc, host->sdio_irq_enabled);
- enable_irq(host->irq);
+ if (!(pdata->flags & TMIO_MMC_HI_REGS_MISSING)) {
+ sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);
+ msleep(10);
}
sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 &
sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
@@ -333,25 +323,27 @@ static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |
sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
msleep(10);
- /* see comment in tmio_mmc_clk_stop above */
- if (pdata->flags & TMIO_MMC_SDIO_IRQ)
- disable_irq(host->irq);
- sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
- msleep(10);
- if (pdata->flags & TMIO_MMC_SDIO_IRQ) {
- tmio_mmc_enable_sdio_irq(host->mmc, host->sdio_irq_enabled);
- enable_irq(host->irq);
+ if (!(pdata->flags & TMIO_MMC_HI_REGS_MISSING)) {
+ if (pdata->flags & TMIO_MMC_SDIO_IRQ)
+ disable_irq(host->irq);
+ sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
+ msleep(10);
}
}
static void reset(struct tmio_mmc_host *host)
{
+ struct mfd_cell *cell = host->pdev->dev.platform_data;
+ struct tmio_mmc_data *pdata = cell->driver_data;
+
/* FIXME - should we set stop clock reg here */
sd_ctrl_write16(host, CTL_RESET_SD, 0x0000);
- sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);
+ if (!(pdata->flags & TMIO_MMC_HI_REGS_MISSING))
+ sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);
msleep(10);
sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
- sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
+ if (!(pdata->flags & TMIO_MMC_HI_REGS_MISSING))
+ sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
msleep(10);
}
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 8e70310..243ad58 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -61,6 +61,12 @@
* Some controllers can support SDIO IRQ signalling.
*/
#define TMIO_MMC_SDIO_IRQ (1 << 2)
+/*
+ * Some controllers are missing all registers in the 0x100-0x1ff address range,
+ * on them accesses to the CTL_CLK_AND_WAIT_CTL (0x138) register end up in 0x38,
+ * which breaks the SDIO functionality.
+ */
+#define TMIO_MMC_HI_REGS_MISSING (1 << 3)
int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/5] ARM: mach-shmobile: use the new TMIO_MMC_HI_REGS_MISSING flag for SDHI
2011-03-07 18:47 [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH/RFC 1/5] mmc: tmio: fix power-mode interpretation Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH 2/5] mmc: tmio: add a flag to prohibit access to registers above 0xff Guennadi Liakhovetski
@ 2011-03-07 18:47 ` Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH 4/5] sh: " Guennadi Liakhovetski
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-07 18:47 UTC (permalink / raw)
To: linux-sh; +Cc: linux-mmc, Chris Ball, Ian Molton
Prevent access to addresses above 0xff on SDHI instances on sh-mobile SoCs.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
arch/arm/mach-shmobile/board-ap4evb.c | 3 ++-
arch/arm/mach-shmobile/board-mackerel.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 3cf0951..7a7b472 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -305,6 +305,7 @@ static struct platform_device sh_mmcif_device = {
static struct sh_mobile_sdhi_info sdhi0_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
@@ -336,7 +337,7 @@ static struct sh_mobile_sdhi_info sdhi1_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
.tmio_ocr_mask = MMC_VDD_165_195,
- .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
+ .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_NEEDS_POLL | MMC_CAP_SDIO_IRQ,
.get_cd = slot_cn7_get_cd,
};
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 6c9d8b8..2e81352 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -663,6 +663,7 @@ static int slot_cn7_get_cd(struct platform_device *pdev)
static struct sh_mobile_sdhi_info sdhi0_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
};
@@ -695,7 +696,7 @@ static struct sh_mobile_sdhi_info sdhi1_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
.tmio_ocr_mask = MMC_VDD_165_195,
- .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
+ .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
MMC_CAP_NEEDS_POLL,
.get_cd = slot_cn7_get_cd,
@@ -738,7 +739,7 @@ static int slot_cn23_get_cd(struct platform_device *pdev)
static struct sh_mobile_sdhi_info sdhi2_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI2_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI2_RX,
- .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
+ .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
MMC_CAP_NEEDS_POLL,
.get_cd = slot_cn23_get_cd,
--
1.7.2.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/5] sh: use the new TMIO_MMC_HI_REGS_MISSING flag for SDHI
2011-03-07 18:47 [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Guennadi Liakhovetski
` (2 preceding siblings ...)
2011-03-07 18:47 ` [PATCH 3/5] ARM: mach-shmobile: use the new TMIO_MMC_HI_REGS_MISSING flag for SDHI Guennadi Liakhovetski
@ 2011-03-07 18:47 ` Guennadi Liakhovetski
2011-03-07 18:48 ` [PATCH/RFC 5/5] mmc: tmio: support aggressive clock gating Guennadi Liakhovetski
2011-03-08 8:42 ` [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Paul Mundt
5 siblings, 0 replies; 10+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-07 18:47 UTC (permalink / raw)
To: linux-sh; +Cc: linux-mmc, Chris Ball, Ian Molton
Prevent access to addresses above 0xff on SDHI instances on sh-mobile SoCs.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
arch/sh/boards/mach-ap325rxa/setup.c | 3 +++
arch/sh/boards/mach-ecovec24/setup.c | 3 +++
arch/sh/boards/mach-kfr2r09/setup.c | 2 +-
arch/sh/boards/mach-migor/setup.c | 2 ++
arch/sh/boards/mach-se/7724/setup.c | 3 +++
5 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 33bfebc..ea1f1a3 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -15,6 +15,7 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/sh_mobile_sdhi.h>
+#include <linux/mfd/tmio.h>
#include <linux/mmc/host.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/sh_flctl.h>
@@ -427,6 +428,7 @@ static struct resource sdhi0_cn3_resources[] = {
};
static struct sh_mobile_sdhi_info sdhi0_cn3_data = {
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
@@ -457,6 +459,7 @@ static struct resource sdhi1_cn7_resources[] = {
};
static struct sh_mobile_sdhi_info sdhi1_cn7_data = {
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index aa620fd..0cc86a4 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -12,6 +12,7 @@
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/mfd/sh_mobile_sdhi.h>
+#include <linux/mfd/tmio.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mmcif.h>
#include <linux/mtd/physmap.h>
@@ -473,6 +474,7 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
.set_pwr = sdhi0_set_pwr,
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD,
};
@@ -512,6 +514,7 @@ static void sdhi1_set_pwr(struct platform_device *pdev, int state)
static struct sh_mobile_sdhi_info sdhi1_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD,
.set_pwr = sdhi1_set_pwr,
};
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 7504daa..fa473d4 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -366,7 +366,7 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = {
static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
- .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
+ .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 03a7ffe..20e641e 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -13,6 +13,7 @@
#include <linux/input.h>
#include <linux/input/sh_keysc.h>
#include <linux/mfd/sh_mobile_sdhi.h>
+#include <linux/mfd/tmio.h>
#include <linux/mmc/host.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/nand.h>
@@ -411,6 +412,7 @@ static struct resource sdhi_cn9_resources[] = {
static struct sh_mobile_sdhi_info sh7724_sdhi_data = {
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 5276793..2ca3253 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -15,6 +15,7 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/sh_mobile_sdhi.h>
+#include <linux/mfd/tmio.h>
#include <linux/mmc/host.h>
#include <linux/mtd/physmap.h>
#include <linux/delay.h>
@@ -472,6 +473,7 @@ static struct resource sdhi0_cn7_resources[] = {
static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
@@ -504,6 +506,7 @@ static struct resource sdhi1_cn8_resources[] = {
static struct sh_mobile_sdhi_info sh7724_sdhi1_data = {
.dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
+ .tmio_flags = TMIO_MMC_HI_REGS_MISSING,
.tmio_caps = MMC_CAP_SDIO_IRQ,
};
--
1.7.2.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH/RFC 5/5] mmc: tmio: support aggressive clock gating
2011-03-07 18:47 [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Guennadi Liakhovetski
` (3 preceding siblings ...)
2011-03-07 18:47 ` [PATCH 4/5] sh: " Guennadi Liakhovetski
@ 2011-03-07 18:48 ` Guennadi Liakhovetski
2011-03-08 8:42 ` [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Paul Mundt
5 siblings, 0 replies; 10+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-07 18:48 UTC (permalink / raw)
To: linux-sh; +Cc: linux-mmc, Chris Ball, Ian Molton
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
_Must_ be tested on non-SDHI systems with and without aggressive clock
gating enabled.
drivers/mmc/host/tmio_mmc.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 5e880c06..13e447a 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -1155,19 +1155,18 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
tmio_mmc_set_clock(host, ios->clock);
/* Power sequence - OFF -> UP -> ON */
- switch (ios->power_mode) {
- case MMC_POWER_OFF: /* power down SD bus */
- if (host->set_pwr)
+ if (ios->power_mode == MMC_POWER_OFF || !ios->clock) {
+ /* power down SD bus */
+ if (ios->power_mode == MMC_POWER_OFF && host->set_pwr)
host->set_pwr(host->pdev, 0);
tmio_mmc_clk_stop(host);
- break;
- case MMC_POWER_ON: /* start bus clock */
- tmio_mmc_clk_start(host);
- break;
- case MMC_POWER_UP: /* power up SD bus */
+ } else if (ios->power_mode == MMC_POWER_UP) {
+ /* power up SD bus */
if (host->set_pwr)
host->set_pwr(host->pdev, 1);
- break;
+ } else {
+ /* start bus clock */
+ tmio_mmc_clk_start(host);
}
switch (ios->bus_width) {
--
1.7.2.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/5] mmc: tmio: add a flag to prohibit access to registers above 0xff
2011-03-07 18:47 ` [PATCH 2/5] mmc: tmio: add a flag to prohibit access to registers above 0xff Guennadi Liakhovetski
@ 2011-03-08 3:35 ` Magnus Damm
2011-03-08 7:34 ` Paul Mundt
1 sibling, 0 replies; 10+ messages in thread
From: Magnus Damm @ 2011-03-08 3:35 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-sh, linux-mmc, Chris Ball, Ian Molton
On Tue, Mar 8, 2011 at 3:47 AM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> On some implementations there are no registers above 0xff and any
> access to them mirrors to registers at addresses with bit 8 masked
> out, which leads to malfunction. Add a flag to prevent such accesses.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Yes, this is correct for SDHI. Thanks for your help!
Acked-by: Magnus Damm <damm@opensource.se>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/5] mmc: tmio: add a flag to prohibit access to registers above 0xff
2011-03-07 18:47 ` [PATCH 2/5] mmc: tmio: add a flag to prohibit access to registers above 0xff Guennadi Liakhovetski
2011-03-08 3:35 ` Magnus Damm
@ 2011-03-08 7:34 ` Paul Mundt
1 sibling, 0 replies; 10+ messages in thread
From: Paul Mundt @ 2011-03-08 7:34 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-sh, linux-mmc, Chris Ball, Ian Molton
On Mon, Mar 07, 2011 at 07:47:51PM +0100, Guennadi Liakhovetski wrote:
> On some implementations there are no registers above 0xff and any
> access to them mirrors to registers at addresses with bit 8 masked
> out, which leads to malfunction. Add a flag to prevent such accesses.
I'm not sure I really see what the point of the flag is, surely you can
derive all of this information already from the I/O resource for the
register window in question?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation
2011-03-07 18:47 [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Guennadi Liakhovetski
` (4 preceding siblings ...)
2011-03-07 18:48 ` [PATCH/RFC 5/5] mmc: tmio: support aggressive clock gating Guennadi Liakhovetski
@ 2011-03-08 8:42 ` Paul Mundt
2011-03-08 9:29 ` Guennadi Liakhovetski
5 siblings, 1 reply; 10+ messages in thread
From: Paul Mundt @ 2011-03-08 8:42 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-sh, linux-mmc, Chris Ball, Ian Molton
On Mon, Mar 07, 2011 at 07:47:45PM +0100, Guennadi Liakhovetski wrote:
> 5 more patches, that fix high register access on sh-mobile in a correct
> way and implement aggressive clock gating. Marked as RFC because testing
> on non-SDHI platforms is required! The next step would be to add
> runtime-pm to clock gating, but I'm refraining from this for now, because
> similar patches for SDHCI have still not been committed and it seems,
> there are still doubts about the right way to do that.
>
> Patches apply on top of my previous 2 patches from earlier today.
>
I'm a bit confused about this series in general. Patch 1 and 5 are both
marked RFC but 2/3/4 seem to be unrelated and intended for merging,
despite the fact I find the approach itself to be rather suspect. So why
exactly are these all lumped together?
Please do not create patch series that are intentionally muddled. Since
you have two distinct things here with completely different intentions
and you've not explicitly stated whether there's any dependencies between
the two it simply creates a giant mess.
A patch series should be logically structured in some way other than
"here's a bunch of random patches I have pending for this particular
driver", particularly if only parts of it are intended to be merged.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation
2011-03-08 8:42 ` [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Paul Mundt
@ 2011-03-08 9:29 ` Guennadi Liakhovetski
0 siblings, 0 replies; 10+ messages in thread
From: Guennadi Liakhovetski @ 2011-03-08 9:29 UTC (permalink / raw)
To: Paul Mundt; +Cc: linux-sh, linux-mmc, Chris Ball, Ian Molton
On Tue, 8 Mar 2011, Paul Mundt wrote:
> On Mon, Mar 07, 2011 at 07:47:45PM +0100, Guennadi Liakhovetski wrote:
> > 5 more patches, that fix high register access on sh-mobile in a correct
> > way and implement aggressive clock gating. Marked as RFC because testing
> > on non-SDHI platforms is required! The next step would be to add
> > runtime-pm to clock gating, but I'm refraining from this for now, because
> > similar patches for SDHCI have still not been committed and it seems,
> > there are still doubts about the right way to do that.
> >
> > Patches apply on top of my previous 2 patches from earlier today.
> >
> I'm a bit confused about this series in general. Patch 1 and 5 are both
> marked RFC but 2/3/4 seem to be unrelated and intended for merging,
> despite the fact I find the approach itself to be rather suspect. So why
> exactly are these all lumped together?
They all affect the clocking behaviour, but yes, you're certainly right,
they could and should be separated into two patch-series. Following your
idea from a previous mail, patches 2, 3, and 4 should be using resource
sizes.
It might, probably, be better to redo all these patches in a completely
different way. Since none of them is a fix, I propose to drop the complete
series for now. The previous series "tmio_mmc: improve DMA reliability" is
anaffected.
Thanks
Guennadi
> Please do not create patch series that are intentionally muddled. Since
> you have two distinct things here with completely different intentions
> and you've not explicitly stated whether there's any dependencies between
> the two it simply creates a giant mess.
>
> A patch series should be logically structured in some way other than
> "here's a bunch of random patches I have pending for this particular
> driver", particularly if only parts of it are intended to be merged.
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-03-08 9:29 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-07 18:47 [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH/RFC 1/5] mmc: tmio: fix power-mode interpretation Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH 2/5] mmc: tmio: add a flag to prohibit access to registers above 0xff Guennadi Liakhovetski
2011-03-08 3:35 ` Magnus Damm
2011-03-08 7:34 ` Paul Mundt
2011-03-07 18:47 ` [PATCH 3/5] ARM: mach-shmobile: use the new TMIO_MMC_HI_REGS_MISSING flag for SDHI Guennadi Liakhovetski
2011-03-07 18:47 ` [PATCH 4/5] sh: " Guennadi Liakhovetski
2011-03-07 18:48 ` [PATCH/RFC 5/5] mmc: tmio: support aggressive clock gating Guennadi Liakhovetski
2011-03-08 8:42 ` [PATCH 0/5] tmio PM: aggressive clock gating, register layout limitation Paul Mundt
2011-03-08 9:29 ` Guennadi Liakhovetski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox