Skip to contentSkip to conversation

MMC: hardware abstraction for CNF area

PATCH In review Magnus Damm 2 participants 5 messages Jan 5, 2010 – Jan 7, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MMC: hardware abstraction for CNF area

From: Ian Molton <[email protected]>

This patch abstracts out the CNF area code from tmio_mmc which is not present in all hardware that can use this driver. This is required so that we can support non-toshiba based hardware.

ASIC3 support by Philipp Zabel

[ Magnus Damm: extracted patch from git.mnementh.co.uk, tried
to apply on top of current linux-2.6 but got rejects due to -mm patch 14f1b75b1d31673d7ab6ac6d2f8fe7f23c705229, solved conflict by hand, regenerated patch and posted to lkml ]

---

See http://lkml.org/lkml/2009/12/28/38 for more information.

 drivers/mfd/Makefile        |    6 +-
 drivers/mfd/asic3.c         |   43 +++++++++++++++----
 drivers/mfd/t7l66xb.c       |   31 +++++++++++--
 drivers/mfd/tc6387xb.c      |   97 ++++++++++++++++++++++++++++++++++---------
 drivers/mfd/tc6393xb.c      |   56 ++++++++++++++++++++----
 drivers/mfd/tmio_core.c     |   62 +++++++++++++++++++++++++++
 drivers/mmc/host/tmio_mmc.c |   63 +++++++++------------------
 drivers/mmc/host/tmio_mmc.h |   46 ++------------------
 include/linux/mfd/tmio.h    |   40 +++++++++++++++++
 9 files changed, 318 insertions(+), 126 deletions(-)
drivers/mfd/Makefile +3 -3
@@ -11,9 +11,9 @@ obj-$(CONFIG_HTC_PASIC3)	+= htc-pasic3.o
 
 obj-$(CONFIG_MFD_DM355EVM_MSP)	+= dm355evm_msp.o
 
-obj-$(CONFIG_MFD_T7L66XB)	+= t7l66xb.o
-obj-$(CONFIG_MFD_TC6387XB)	+= tc6387xb.o
-obj-$(CONFIG_MFD_TC6393XB)	+= tc6393xb.o
+obj-$(CONFIG_MFD_T7L66XB)	+= t7l66xb.o tmio_core.o
+obj-$(CONFIG_MFD_TC6387XB)	+= tc6387xb.o tmio_core.o
+obj-$(CONFIG_MFD_TC6393XB)	+= tc6393xb.o tmio_core.o
 
 obj-$(CONFIG_MFD_WM8400)	+= wm8400-core.o
 wm831x-objs			:= wm831x-core.o wm831x-irq.o wm831x-otp.o
drivers/mfd/asic3.c +35 -8

93 lines not on this page · raw message

drivers/mfd/t7l66xb.c +26 -5
@@ -38,6 +38,8 @@ enum {
 	T7L66XB_CELL_MMC,
 };
 
+static const struct resource t7l66xb_mmc_resources[];
+
 #define SCR_REVID	0x08		/* b Revision ID	*/
 #define SCR_IMR		0x42		/* b Interrupt Mask	*/
 #define SCR_DEV_CTL	0xe0		/* b Device control	*/
@@ -83,6 +85,9 @@ static int t7l66xb_mmc_enable(struct pla
 
 	spin_unlock_irqrestore(&t7l66xb->lock, flags);
 
+	tmio_core_mmc_enable(t7l66xb->scr + 0x200,
+		t7l66xb_mmc_resources[0].start & 0xfffe);
+
 	return 0;
 }
 
@@ -106,10 +111,28 @@ static int t7l66xb_mmc_disable(struct pl
 	return 0;
 }
 
+static void t7l66xb_mmc_pwr(struct platform_device *mmc, int state)
+{
+	struct platform_device *dev = to_platform_device(mmc->dev.parent);
+	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+
+	tmio_core_mmc_pwr(t7l66xb->scr + 0x200, state);
+}
+
+static void t7l66xb_mmc_clk_div(struct platform_device *mmc, int state)
+{
+	struct platform_device *dev = to_platform_device(mmc->dev.parent);
+	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+
+	tmio_core_mmc_clk_div(t7l66xb->scr + 0x200, state);
+}
+
 /*--------------------------------------------------------------------------*/
 
 static struct tmio_mmc_data t7166xb_mmc_data = {
 	.hclk = 24000000,
+	.set_pwr = t7l66xb_mmc_pwr,
+	.set_no_clk_div = t7l66xb_mmc_clk_div,
 };
 
 static const struct resource t7l66xb_mmc_resources[] = {
@@ -119,11 +142,6 @@ static const struct resource t7l66xb_mmc
 		.flags = IORESOURCE_MEM,
 	},
 	{
-		.start = 0x200,
-		.end	= 0x2ff,
-		.flags = IORESOURCE_MEM,
-	},
-	{
 		.start = IRQ_T7L66XB_MMC,
 		.end	= IRQ_T7L66XB_MMC,
 		.flags = IORESOURCE_IRQ,
@@ -282,6 +300,9 @@ static int t7l66xb_resume(struct platfor
 	if (pdata && pdata->resume)
 		pdata->resume(dev);
 
+	tmio_core_mmc_enable(t7l66xb->scr + 0x200,
+		t7l66xb_mmc_resources[0].start & 0xfffe);
+
 	return 0;
 }
 #else
drivers/mfd/tc6387xb.c +78 -19

185 lines not on this page · raw message

drivers/mfd/tc6393xb.c +47 -9

83 lines not on this page · raw message

drivers/mfd/tmio_core.c new file +62 -0

62 lines not on this page · raw message

drivers/mmc/host/tmio_mmc.c +21 -42

156 lines not on this page · raw message

drivers/mmc/host/tmio_mmc.h +6 -40

74 lines not on this page · raw message

include/linux/mfd/tmio.h +40 -0
@@ -2,6 +2,8 @@
 #define MFD_TMIO_H
 
 #include <linux/fb.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
 
 #define tmio_ioread8(addr) readb(addr)
 #define tmio_ioread16(addr) readw(addr)
@@ -18,11 +20,49 @@
 	writew((val) >> 16, (addr) + 2); \
 	} while (0)
 
+#define CNF_CMD     0x04
+#define CNF_CTL_BASE   0x10
+#define CNF_INT_PIN  0x3d
+#define CNF_STOP_CLK_CTL 0x40
+#define CNF_GCLK_CTL 0x41
+#define CNF_SD_CLK_MODE 0x42
+#define CNF_PIN_STATUS 0x44
+#define CNF_PWR_CTL_1 0x48
+#define CNF_PWR_CTL_2 0x49
+#define CNF_PWR_CTL_3 0x4a
+#define CNF_CARD_DETECT_MODE 0x4c
+#define CNF_SD_SLOT 0x50
+#define CNF_EXT_GCLK_CTL_1 0xf0
+#define CNF_EXT_GCLK_CTL_2 0xf1
+#define CNF_EXT_GCLK_CTL_3 0xf9
+#define CNF_SD_LED_EN_1 0xfa
+#define CNF_SD_LED_EN_2 0xfe
+
+#define   SDCREN 0x2   /* Enable access to MMC CTL regs. (flag in COMMAND_REG)*/
+
+#define sd_config_write8(base, shift, reg, val) \
+	tmio_iowrite8((val), (base) + ((reg) << (shift)))
+#define sd_config_write16(base, shift, reg, val) \
+	tmio_iowrite16((val), (base) + ((reg) << (shift)))
+#define sd_config_write32(base, shift, reg, val) \
+	do { \
+	tmio_iowrite16((val), (base) + ((reg) << (shift))); \
+	tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
+	} while (0)
+
+int tmio_core_mmc_enable(void __iomem *cnf, unsigned long base);
+int tmio_core_mmc_resume(void __iomem *cnf, unsigned long base);
+void tmio_core_mmc_pwr(void __iomem *cnf, int state);
+void tmio_core_mmc_clk_div(void __iomem *cnf, int state);
+void tmio_core_set_bus_shift(int bus_shift);
+
 /*
  * data for the MMC controller
  */
 struct tmio_mmc_data {
 	const unsigned int		hclk;
+	void (*set_pwr)(struct platform_device *host, int state);
+	void (*set_no_clk_div)(struct platform_device *host, int state);
 };
 
 /*
#1 lore raw

Hi Magnus,

Quoted 6 lines · Magnus Damm

From: Ian Molton <[email protected]>

This patch abstracts out the CNF area code from tmio_mmc which is not present in all hardware that can use this driver. This is required so that we can support non-toshiba based hardware.

Quoted 6 lines

ASIC3 support by Philipp Zabel

[ Magnus Damm: extracted patch from git.mnementh.co.uk, tried
to apply on top of current linux-2.6 but got rejects due to -mm patch 14f1b75b1d31673d7ab6ac6d2f8fe7f23c705229, solved conflict by hand, regenerated patch and posted to lkml ]

Thanks for taking care of that.
I wish I could take this patch straight away, but I have some objections, see below:

drivers/mfd/asic3.c static struct mfd_cell asic3_cell_mmc = · line 785

Quoted 2 lines
drivers/mfd/asic3.c +2 -0
+	.suspend       = asic3_mmc_disable,
+	.resume        = asic3_mmc_enable,

Why are we moving from enable/disable to resume/suspend ?
It makes sense from a naming point of view, but that should be in a separate patch.

Quoted 1 line

+static const struct resource t7l66xb_mmc_resources[];

Could we simply move the t7l66xb_mmc_resources[] definition here instead ?

drivers/mfd/tc6387xb.c enum { · line 31

Quoted 13 lines
drivers/mfd/tc6387xb.c +7 -0
@@ -22,28 +22,41 @@ enum {
 	TC6387XB_CELL_MMC,
 };
 
+struct tc6387xb {
+	void __iomem *scr;
+	struct clk *clk32k;
+	struct resource rscr;
+};
+
+static struct resource tc6387xb_mmc_resources[];

Same here.

drivers/mfd/tmio_core.c line 2

Quoted 5 lines
drivers/mfd/tmio_core.c new file +2 -0
@@ -0,0 +1,62 @@
+/*
+ * Toshiba TC6393XB SoC support

Bogus comment.

drivers/mfd/tmio_core.c line 13

Quoted 10 lines
drivers/mfd/tmio_core.c new file +10 -0
+ * Copyright(c) 2009 Ian Molton <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/mfd/tmio.h>
+
+static int shift;

That I dont like. Carry the shift as a function argument, because there is no reason to have a static variable here.
In fact, we could even move this code to tmio_mmc.c and export the symbols from there. The tmio_mmc code know the bus shift, doesnt it ?

drivers/mmc/host/tmio_mmc.c static void tmio_mmc_set_clock(struct tm · line 51

Quoted 10 lines
drivers/mmc/host/tmio_mmc.c +3 -1
@@ -46,7 +46,9 @@ static void tmio_mmc_set_clock(struct tm
 		clk |= 0x100;
 	}
 
-	sd_config_write8(host, CNF_SD_CLK_MODE, clk >> 22);
+	if (host->set_no_clk_div)
+		host->set_no_clk_div(host->pdev, (clk>>22) & 1);
+

You either need a backup path or make the set_no_clk_div() implementation mandatory. IOW, we should at least call tmio_core_mmc_clk_div() if set_no_clk_div() is not defined. Or then if you assume that all tmio drivers must implement those hooks, then return if it's not there. I would prefer the former option though as that would allow me to split this patch into what I see as .33 material (tmio_mmc.[ch], tmio_core.c [that I would rather see moved to tmio_mmc.c], and tmio.h)

drivers/mmc/host/tmio_mmc.c static void tmio_mmc_set_ios(struct mmc_ · line 433

Quoted 3 lines
drivers/mmc/host/tmio_mmc.c +2 -1
-		sd_config_write8(host, CNF_PWR_CTL_2, 0x00);
+		if (host->set_pwr)
+			host->set_pwr(host->pdev, 0);

Ditto.

drivers/mmc/host/tmio_mmc.c static void tmio_mmc_set_ios(struct mmc_ · line 438

Quoted 7 lines
drivers/mmc/host/tmio_mmc.c +2 -2
 		tmio_mmc_clk_stop(host);
 		break;
 	case MMC_POWER_ON: /* power up SD bus */
-
-		sd_config_write8(host, CNF_PWR_CTL_2, 0x02);
+		if (host->set_pwr)
+			host->set_pwr(host->pdev, 1);

Ditto.

drivers/mmc/host/tmio_mmc.c static int tmio_mmc_suspend(struct platf · line 482

Quoted 11 lines
drivers/mmc/host/tmio_mmc.c +2 -2
 		break;
 	case MMC_POWER_UP: /* start bus clock */
 		tmio_mmc_clk_start(host);
@@ -475,8 +478,8 @@ static int tmio_mmc_suspend(struct platf
 	ret = mmc_suspend_host(mmc, state);
 
 	/* Tell MFD core it can disable us now.*/
-	if (!ret && cell->disable)
-		cell->disable(dev);
+	if (!ret && cell->suspend)
+		cell->suspend(dev);

That sort of change doesnt belong to that patch, unless I'm missing something.

drivers/mmc/host/tmio_mmc.c static int tmio_mmc_suspend(struct platf · line 485

Quoted 3 lines
drivers/mmc/host/tmio_mmc.c +3 -0
+	/* Callbacks for clock / power control */
+	void (*set_pwr)(struct platform_device *host, int state);
+	void (*set_no_clk_div)(struct platform_device *host, int state);

The name is a bit misleading, imo. Wouldn't set_clk_div() be more appropriate?

Quoted 70 lines
drivers/mmc/host/tmio_mmc.c +3 -19
+
 	/* pio related stuff */
 	struct scatterlist      *sg_ptr;
 	unsigned int            sg_len;
 	unsigned int            sg_off;
+
+	struct platform_device *pdev;
 };
 
 #include <linux/io.h>
@@ -163,25 +148,6 @@ static inline void sd_ctrl_write32(struc
 	writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
 }
 
-static inline void sd_config_write8(struct tmio_mmc_host *host, int addr,
-		u8 val)
-{
-	writeb(val, host->cnf + (addr << host->bus_shift));
-}
-
-static inline void sd_config_write16(struct tmio_mmc_host *host, int addr,
-		u16 val)
-{
-	writew(val, host->cnf + (addr << host->bus_shift));
-}
-
-static inline void sd_config_write32(struct tmio_mmc_host *host, int addr,
-		u32 val)
-{
-	writew(val, host->cnf + (addr << host->bus_shift));
-	writew(val >> 16, host->cnf + ((addr + 2) << host->bus_shift));
-}
-
 #include <linux/scatterlist.h>
 #include <linux/blkdev.h>
 
include/linux/mfd/tmio.h +21 -0
@@ -2,6 +2,8 @@
 #define MFD_TMIO_H
 
 #include <linux/fb.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
 
 #define tmio_ioread8(addr) readb(addr)
 #define tmio_ioread16(addr) readw(addr)
@@ -18,11 +20,49 @@
 	writew((val) >> 16, (addr) + 2); \
 	} while (0)
 
+#define CNF_CMD     0x04
+#define CNF_CTL_BASE   0x10
+#define CNF_INT_PIN  0x3d
+#define CNF_STOP_CLK_CTL 0x40
+#define CNF_GCLK_CTL 0x41
+#define CNF_SD_CLK_MODE 0x42
+#define CNF_PIN_STATUS 0x44
+#define CNF_PWR_CTL_1 0x48
+#define CNF_PWR_CTL_2 0x49
+#define CNF_PWR_CTL_3 0x4a
+#define CNF_CARD_DETECT_MODE 0x4c
+#define CNF_SD_SLOT 0x50
+#define CNF_EXT_GCLK_CTL_1 0xf0
+#define CNF_EXT_GCLK_CTL_2 0xf1
+#define CNF_EXT_GCLK_CTL_3 0xf9
+#define CNF_SD_LED_EN_1 0xfa
+#define CNF_SD_LED_EN_2 0xfe
+
+#define   SDCREN 0x2   /* Enable access to MMC CTL regs. (flag in COMMAND_REG)*/

include/linux/mfd/tmio.h line 51

Quoted 10 lines
include/linux/mfd/tmio.h +10 -0
+
+#define sd_config_write8(base, shift, reg, val) \
+	tmio_iowrite8((val), (base) + ((reg) << (shift)))
+#define sd_config_write16(base, shift, reg, val) \
+	tmio_iowrite16((val), (base) + ((reg) << (shift)))
+#define sd_config_write32(base, shift, reg, val) \
+	do { \
+	tmio_iowrite16((val), (base) + ((reg) << (shift))); \
+	tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
+	} while (0)

By implementing the tmio_core API in tmio_mmc.c, you wouldnt need to redefine those.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#2 lore raw

Hi Samuel,

Quoted 7 lines · Samuel Ortiz
Quoted 6 lines · Magnus Damm

From: Ian Molton <[email protected]>

This patch abstracts out the CNF area code from tmio_mmc which is not present in all hardware that can use this driver. This is required so that we can support non-toshiba based hardware.

Quoted 7 lines
Quoted 6 lines

ASIC3 support by Philipp Zabel

[ Magnus Damm: extracted patch from git.mnementh.co.uk, tried to apply on top of current linux-2.6 but got rejects due to -mm patch 14f1b75b1d31673d7ab6ac6d2f8fe7f23c705229, solved conflict by hand, regenerated patch and posted to lkml ]

Thanks for taking care of that.

No worries!

Quoted 8 lines

I wish I could take this patch straight away, but I have some objections, see below:

Quoted 2 lines

+     .suspend       = asic3_mmc_disable,
+     .resume        = asic3_mmc_enable,

Why are we moving from enable/disable to resume/suspend ?
It makes sense from a naming point of view, but that should be in a separate patch.

I agree.

Quoted 2 lines
Quoted 1 line

+static const struct resource t7l66xb_mmc_resources[];

Could we simply move the t7l66xb_mmc_resources[] definition here instead ?

Yep, makes sense.

Quoted 6 lines

drivers/mfd/tmio_core.c      2010-01-05 13:27:31.000000000 +0900 line 2

Quoted 5 lines
drivers/mfd/tmio_core.c      2010-01-05 13:27:31.000000000 +0900 new file +2 -0
@@ -0,0 +1,62 @@
+/*
+ * Toshiba TC6393XB SoC support

Bogus comment.

Yes.

Quoted 4 lines
Quoted 4 lines
drivers/mfd/tmio_core.c      2010-01-05 13:27:31.000000000 +0900 new file +4 -0
+ * Copyright(c) 2009 Ian Molton <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
Quoted 8 lines

drivers/mfd/tmio_core.c      2010-01-05 13:27:31.000000000 +0900 line 12

Quoted 6 lines
drivers/mfd/tmio_core.c      2010-01-05 13:27:31.000000000 +0900 new file +6 -0
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/mfd/tmio.h>
+
+static int shift;

That I dont like. Carry the shift as a function argument, because there is no reason to have a static variable here.

Yeah, this part of the code is pretty darn ugly. Will fix.

Quoted 2 lines

In fact, we could even move this code to tmio_mmc.c and export the symbols from there. The tmio_mmc code know the bus shift, doesnt it ?

The purpose of this patch is to make tmio_mmc work with a single I/O memory window. So this code was intentionally moved out of tmio_mmc. I don't care so much though, my original patch kept support for two windows in tmio_mmc but Ian preferred to make the tmio_mmc driver work with a single window only. Perhaps Ian has something to say?

I'll just pass the shift as a function argument for now.

Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/tmio_mmc.c  2010-01-05 13:28:07.000000000 +0900 renamed from drivers/mmc/host/tmio_mmc.c +0 -0
@@ -46,7 +46,9 @@ static void tmio_mmc_set_clock(struct tm
               clk |= 0x100;
       }
 
Quoted 11 lines

drivers/mmc/host/tmio_mmc.c  2010-01-05 13:28:07.000000000 +0900 static void tmio_mmc_set_clock(struct tm · line 51

Quoted 4 lines
drivers/mmc/host/tmio_mmc.c  2010-01-05 13:28:07.000000000 +0900 renamed from drivers/mmc/host/tmio_mmc.c +3 -1
-     sd_config_write8(host, CNF_SD_CLK_MODE, clk >> 22);
+     if (host->set_no_clk_div)
+             host->set_no_clk_div(host->pdev, (clk>>22) & 1);
+

You either need a backup path or make the set_no_clk_div() implementation mandatory. IOW, we should at least call tmio_core_mmc_clk_div() if set_no_clk_div() is not defined. Or then if you assume that all tmio drivers must implement those hooks, then return if it's not there. I would prefer the former option though as that would allow me to split this patch into what I see as .33 material (tmio_mmc.[ch], tmio_core.c [that I would rather see moved to tmio_mmc.c], and tmio.h)

The hardware driven by the SuperH SDHI driver lacks support for the second memory window, so ->set_no_clk_div() is set to NULL in that case. And falling back on tmio_core_mmc_clk_div() will only work on hardware with two memory windows, so that idea will break SuperH SDHI. It may be a good idea with dummy nop functions to avoid the if case, but none of these functions are called in any hot path so from my point of view it's ok as is.

I agree that a lot of code in a single patch is far from optimal. Feel free to break out the patch in any way you'd like. My original patches were broken out, but for some reason this all-in-one approach was chosen.

I don't have access to any hardware except SuperH SDHI boards, but I'm pretty sure Ian and Phillip has tested this patch on whatever hardware they have available. So it may make sense to keep the code as is to avoid breakage.

Quoted 9 lines

drivers/mmc/host/tmio_mmc.c  2010-01-05 13:28:07.000000000 +0900 static int tmio_mmc_suspend(struct platf · line 482

Quoted 8 lines
drivers/mmc/host/tmio_mmc.c  2010-01-05 13:28:07.000000000 +0900 renamed from drivers/mmc/host/tmio_mmc.c +2 -2
@@ -475,8 +478,8 @@ static int tmio_mmc_suspend(struct platf
       ret = mmc_suspend_host(mmc, state);
 
       /* Tell MFD core it can disable us now.*/
-     if (!ret && cell->disable)
-             cell->disable(dev);
+     if (!ret && cell->suspend)
+             cell->suspend(dev);

That sort of change doesnt belong to that patch, unless I'm missing something.

I agree.

Quoted 4 lines

drivers/mmc/host/tmio_mmc.c  2010-01-05 13:28:07.000000000 +0900 static int tmio_mmc_suspend(struct platf · line 485

Quoted 3 lines
drivers/mmc/host/tmio_mmc.c  2010-01-05 13:28:07.000000000 +0900 renamed from drivers/mmc/host/tmio_mmc.c +3 -0
+     /* Callbacks for clock / power control */
+     void (*set_pwr)(struct platform_device *host, int state);
+     void (*set_no_clk_div)(struct platform_device *host, int state);

The name is a bit misleading, imo. Wouldn't set_clk_div() be more appropriate?

Yep, will go with ->set_clk_div().

Quoted 23 lines
Quoted 23 lines
drivers/mmc/host/tmio_mmc.c  2010-01-05 13:28:07.000000000 +0900 renamed from drivers/mmc/host/tmio_mmc.c +23 -0
+#define CNF_CMD     0x04
+#define CNF_CTL_BASE   0x10
+#define CNF_INT_PIN  0x3d
+#define CNF_STOP_CLK_CTL 0x40
+#define CNF_GCLK_CTL 0x41
+#define CNF_SD_CLK_MODE 0x42
+#define CNF_PIN_STATUS 0x44
+#define CNF_PWR_CTL_1 0x48
+#define CNF_PWR_CTL_2 0x49
+#define CNF_PWR_CTL_3 0x4a
+#define CNF_CARD_DETECT_MODE 0x4c
+#define CNF_SD_SLOT 0x50
+#define CNF_EXT_GCLK_CTL_1 0xf0
+#define CNF_EXT_GCLK_CTL_2 0xf1
+#define CNF_EXT_GCLK_CTL_3 0xf9
+#define CNF_SD_LED_EN_1 0xfa
+#define CNF_SD_LED_EN_2 0xfe
+
+#define   SDCREN 0x2   /* Enable access to MMC CTL regs. (flag in COMMAND_REG)*/
+
+#define sd_config_write8(base, shift, reg, val) \
+     tmio_iowrite8((val), (base) + ((reg) << (shift)))
+#define sd_config_write16(base, shift, reg, val) \
Quoted 8 lines
Quoted 6 lines

+     tmio_iowrite16((val), (base) + ((reg) << (shift))) +#define sd_config_write32(base, shift, reg, val) \
+     do { \
+     tmio_iowrite16((val), (base) + ((reg) << (shift))); \
+     tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
+     } while (0)

By implementing the tmio_core API in tmio_mmc.c, you wouldnt need to redefine those.

Right, but we want to code to be broken out of tmio_mmc so putting it back does not make sense.

Thanks a lot for your help. I'll submit a patch on top of this one with fixes. Feel free to apply it on top or roll it in.

Cheers,

/ magnus

#3 lore raw

Hi Magnus,

Quoted 3 lines · Magnus Damm

Thanks a lot for your help. I'll submit a patch on top of this one with fixes. Feel free to apply it on top or roll it in.

I rolled it into Ian's patch, and added an additional fix for one of the toshiba mfd driver.
I applied the resulting patch to my tree, and will leave it there for at least a couple days so that linux-next can pick it up.
Meanwhile, I'd really appreciate if Ian could make sure it works for him as well. Ian, this is the patch I'm talking about:

http://git.kernel.org/?p=linux/kernel/git/sameo/mfd-2.6.git;a=commit;h=b3df6513659704ece28da3b80cc36c2a8de315ce

Cheers,
Samuel.

Quoted 3 lines

Cheers,

/ magnus

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#4 lore raw

Hi Samuel,

Quoted 6 lines · Samuel Ortiz

I applied the resulting patch to my tree, and will leave it there for at least a couple days so that linux-next can pick it up.
Meanwhile, I'd really appreciate if Ian could make sure it works for him as well. Ian, this is the patch I'm talking about:

http://git.kernel.org/?p=linux/kernel/git/sameo/mfd-2.6.git;a=commit;h³df6513659704ece28da3b80cc36c2a8de315ce

Thanks a lot for your help. I took the patch pointed out above and applied it on top of latest linux-2.6 git and my kfr2r09 platform now compiles and works as expected.

Cheers,

/ magnus