Re: [PATCH] mmc-omap: Add support for 16-bit and 32-bit registers

2010-05-13 Thread Tony Lindgren
Hi Andrew,

* Cory Maccarrone darkstar6...@gmail.com [100307 09:44]:
 From: Marek Belisko marek.beli...@open-nandra.com
 
 The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
 a modification of the register addresses in the mmc-omap driver.  To resolve
 this, a bit shift is performed on base register addresses, either by 1 or 2
 bits depending on the CPU in use.  This yields the correct registers for
 each CPU.
 
 Signed-off-by: Marek Belisko marek.beli...@open-nandra.com
 Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
 Signed-off-by: Tony Lindgren t...@atomide.com

Can you please queue this patch too? Ben's comments in this thread
were for the i2c-omap, not for this MMC patch. We've had this patch
in the omap tree for testing for quite a while now.

The patch is also available in at:

https://patchwork.kernel.org/patch/83971/

with the direct link to the mbox being:

https://patchwork.kernel.org/patch/83971/mbox/

Regards,

Tony


  drivers/mmc/host/omap.c |   62 
 +--
  1 files changed, 33 insertions(+), 29 deletions(-)
 
 This is a resubmit of a patch I sent in several months ago.  Tony Lindgren 
 merged
 this into linux-omap's master and testing branches but has stated that he 
 will not
 merge it further as linux-mmc needs to approve this.  There hasn't been any 
 comments
 raised on either of the linux-omap or linux-mmc mailing lists about problems. 
  Due to
 the unique nature of the omap7xx platform, this patch is required for MMC 
 card access.
 Is there any chance this can be included into the next -rc cycle, as it is a 
 fix for
 devices that have 16-bit registers?
 
 diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
 index c6d7e8e..53362c4 100644
 --- a/drivers/mmc/host/omap.c
 +++ b/drivers/mmc/host/omap.c
 @@ -38,30 +38,30 @@
  #include plat/fpga.h
  
  #define  OMAP_MMC_REG_CMD0x00
 -#define  OMAP_MMC_REG_ARGL   0x04
 -#define  OMAP_MMC_REG_ARGH   0x08
 -#define  OMAP_MMC_REG_CON0x0c
 -#define  OMAP_MMC_REG_STAT   0x10
 -#define  OMAP_MMC_REG_IE 0x14
 -#define  OMAP_MMC_REG_CTO0x18
 -#define  OMAP_MMC_REG_DTO0x1c
 -#define  OMAP_MMC_REG_DATA   0x20
 -#define  OMAP_MMC_REG_BLEN   0x24
 -#define  OMAP_MMC_REG_NBLK   0x28
 -#define  OMAP_MMC_REG_BUF0x2c
 -#define OMAP_MMC_REG_SDIO0x34
 -#define  OMAP_MMC_REG_REV0x3c
 -#define  OMAP_MMC_REG_RSP0   0x40
 -#define  OMAP_MMC_REG_RSP1   0x44
 -#define  OMAP_MMC_REG_RSP2   0x48
 -#define  OMAP_MMC_REG_RSP3   0x4c
 -#define  OMAP_MMC_REG_RSP4   0x50
 -#define  OMAP_MMC_REG_RSP5   0x54
 -#define  OMAP_MMC_REG_RSP6   0x58
 -#define  OMAP_MMC_REG_RSP7   0x5c
 -#define  OMAP_MMC_REG_IOSR   0x60
 -#define  OMAP_MMC_REG_SYSC   0x64
 -#define  OMAP_MMC_REG_SYSS   0x68
 +#define  OMAP_MMC_REG_ARGL   0x01
 +#define  OMAP_MMC_REG_ARGH   0x02
 +#define  OMAP_MMC_REG_CON0x03
 +#define  OMAP_MMC_REG_STAT   0x04
 +#define  OMAP_MMC_REG_IE 0x05
 +#define  OMAP_MMC_REG_CTO0x06
 +#define  OMAP_MMC_REG_DTO0x07
 +#define  OMAP_MMC_REG_DATA   0x08
 +#define  OMAP_MMC_REG_BLEN   0x09
 +#define  OMAP_MMC_REG_NBLK   0x0a
 +#define  OMAP_MMC_REG_BUF0x0b
 +#define  OMAP_MMC_REG_SDIO   0x0d
 +#define  OMAP_MMC_REG_REV0x0f
 +#define  OMAP_MMC_REG_RSP0   0x10
 +#define  OMAP_MMC_REG_RSP1   0x11
 +#define  OMAP_MMC_REG_RSP2   0x12
 +#define  OMAP_MMC_REG_RSP3   0x13
 +#define  OMAP_MMC_REG_RSP4   0x14
 +#define  OMAP_MMC_REG_RSP5   0x15
 +#define  OMAP_MMC_REG_RSP6   0x16
 +#define  OMAP_MMC_REG_RSP7   0x17
 +#define  OMAP_MMC_REG_IOSR   0x18
 +#define  OMAP_MMC_REG_SYSC   0x19
 +#define  OMAP_MMC_REG_SYSS   0x1a
  
  #define  OMAP_MMC_STAT_CARD_ERR  (1  14)
  #define  OMAP_MMC_STAT_CARD_IRQ  (1  13)
 @@ -77,8 +77,9 @@
  #define  OMAP_MMC_STAT_CARD_BUSY (1   2)
  #define  OMAP_MMC_STAT_END_OF_CMD(1   0)
  
 -#define OMAP_MMC_READ(host, reg) __raw_readw((host)-virt_base + 
 OMAP_MMC_REG_##reg)
 -#define OMAP_MMC_WRITE(host, reg, val)   __raw_writew((val), 
 (host)-virt_base + OMAP_MMC_REG_##reg)
 +#define OMAP_MMC_REG(host, reg)  (OMAP_MMC_REG_##reg  
 (host)-reg_shift)
 +#define OMAP_MMC_READ(host, reg) __raw_readw((host)-virt_base + 
 OMAP_MMC_REG(host, reg))
 +#define OMAP_MMC_WRITE(host, reg, val)   __raw_writew((val), 
 (host)-virt_base + OMAP_MMC_REG(host, reg))
  
  /*
   * Command types
 @@ -132,6 +133,7 @@ struct mmc_omap_host {
   int irq;
   unsigned char   bus_mode;
   unsigned char   hw_bus_mode;
 + unsigned int

Re: [PATCH] mmc-omap: Add support for 16-bit and 32-bit registers

2010-05-13 Thread Andrew Morton
On Thu, 13 May 2010 12:29:35 -0700
Tony Lindgren t...@atomide.com wrote:

 * Cory Maccarrone darkstar6...@gmail.com [100307 09:44]:
  From: Marek Belisko marek.beli...@open-nandra.com
  
  The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
  a modification of the register addresses in the mmc-omap driver.  To resolve
  this, a bit shift is performed on base register addresses, either by 1 or 2
  bits depending on the CPU in use.  This yields the correct registers for
  each CPU.
  
  Signed-off-by: Marek Belisko marek.beli...@open-nandra.com
  Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
  Signed-off-by: Tony Lindgren t...@atomide.com
 
 Can you please queue this patch too? Ben's comments in this thread
 were for the i2c-omap, not for this MMC patch. We've had this patch
 in the omap tree for testing for quite a while now.
 
 The patch is also available in at:
 
 https://patchwork.kernel.org/patch/83971/
 
 with the direct link to the mbox being:
 
 https://patchwork.kernel.org/patch/83971/mbox/

I already have that, as 
mmc-omap-add-support-for-16-bit-and-32-bit-registers.patch
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc-omap: Add support for 16-bit and 32-bit registers

2010-05-13 Thread Tony Lindgren
* Andrew Morton a...@linux-foundation.org [100513 12:36]:
 On Thu, 13 May 2010 12:29:35 -0700
 Tony Lindgren t...@atomide.com wrote:
 
  * Cory Maccarrone darkstar6...@gmail.com [100307 09:44]:
   From: Marek Belisko marek.beli...@open-nandra.com
   
   The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
   a modification of the register addresses in the mmc-omap driver.  To 
   resolve
   this, a bit shift is performed on base register addresses, either by 1 or 
   2
   bits depending on the CPU in use.  This yields the correct registers for
   each CPU.
   
   Signed-off-by: Marek Belisko marek.beli...@open-nandra.com
   Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
   Signed-off-by: Tony Lindgren t...@atomide.com
  
  Can you please queue this patch too? Ben's comments in this thread
  were for the i2c-omap, not for this MMC patch. We've had this patch
  in the omap tree for testing for quite a while now.
  
  The patch is also available in at:
  
  https://patchwork.kernel.org/patch/83971/
  
  with the direct link to the mbox being:
  
  https://patchwork.kernel.org/patch/83971/mbox/
 
 I already have that, as 
 mmc-omap-add-support-for-16-bit-and-32-bit-registers.patch

OK, thanks. I should have checked your queue first.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc-omap: Add support for 16-bit and 32-bit registers

2010-03-08 Thread Ben Dooks
On Sun, Mar 07, 2010 at 10:59:01PM +, Ben Dooks wrote:
 On Sun, Mar 07, 2010 at 09:47:58AM -0800, Cory Maccarrone wrote:
  From: Marek Belisko marek.beli...@open-nandra.com
  
  The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
  a modification of the register addresses in the mmc-omap driver.  To resolve
  this, a bit shift is performed on base register addresses, either by 1 or 2
  bits depending on the CPU in use.  This yields the correct registers for
  each CPU.
 
 merged the previous one into my tree earlier today.

ignore this, didn't read the message properly and thought it was the i2c
patch.
  
  Signed-off-by: Marek Belisko marek.beli...@open-nandra.com
  Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
  Signed-off-by: Tony Lindgren t...@atomide.com
  ---
   drivers/mmc/host/omap.c |   62 
  +--
   1 files changed, 33 insertions(+), 29 deletions(-)
  
  This is a resubmit of a patch I sent in several months ago.  Tony Lindgren 
  merged
  this into linux-omap's master and testing branches but has stated that he 
  will not
  merge it further as linux-mmc needs to approve this.  There hasn't been any 
  comments
  raised on either of the linux-omap or linux-mmc mailing lists about 
  problems.  Due to
  the unique nature of the omap7xx platform, this patch is required for MMC 
  card access.
  Is there any chance this can be included into the next -rc cycle, as it is 
  a fix for
  devices that have 16-bit registers?
  
  diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
  index c6d7e8e..53362c4 100644
  --- a/drivers/mmc/host/omap.c
  +++ b/drivers/mmc/host/omap.c
  @@ -38,30 +38,30 @@
   #include plat/fpga.h
   
   #defineOMAP_MMC_REG_CMD0x00
  -#defineOMAP_MMC_REG_ARGL   0x04
  -#defineOMAP_MMC_REG_ARGH   0x08
  -#defineOMAP_MMC_REG_CON0x0c
  -#defineOMAP_MMC_REG_STAT   0x10
  -#defineOMAP_MMC_REG_IE 0x14
  -#defineOMAP_MMC_REG_CTO0x18
  -#defineOMAP_MMC_REG_DTO0x1c
  -#defineOMAP_MMC_REG_DATA   0x20
  -#defineOMAP_MMC_REG_BLEN   0x24
  -#defineOMAP_MMC_REG_NBLK   0x28
  -#defineOMAP_MMC_REG_BUF0x2c
  -#define OMAP_MMC_REG_SDIO  0x34
  -#defineOMAP_MMC_REG_REV0x3c
  -#defineOMAP_MMC_REG_RSP0   0x40
  -#defineOMAP_MMC_REG_RSP1   0x44
  -#defineOMAP_MMC_REG_RSP2   0x48
  -#defineOMAP_MMC_REG_RSP3   0x4c
  -#defineOMAP_MMC_REG_RSP4   0x50
  -#defineOMAP_MMC_REG_RSP5   0x54
  -#defineOMAP_MMC_REG_RSP6   0x58
  -#defineOMAP_MMC_REG_RSP7   0x5c
  -#defineOMAP_MMC_REG_IOSR   0x60
  -#defineOMAP_MMC_REG_SYSC   0x64
  -#defineOMAP_MMC_REG_SYSS   0x68
  +#defineOMAP_MMC_REG_ARGL   0x01
  +#defineOMAP_MMC_REG_ARGH   0x02
  +#defineOMAP_MMC_REG_CON0x03
  +#defineOMAP_MMC_REG_STAT   0x04
  +#defineOMAP_MMC_REG_IE 0x05
  +#defineOMAP_MMC_REG_CTO0x06
  +#defineOMAP_MMC_REG_DTO0x07
  +#defineOMAP_MMC_REG_DATA   0x08
  +#defineOMAP_MMC_REG_BLEN   0x09
  +#defineOMAP_MMC_REG_NBLK   0x0a
  +#defineOMAP_MMC_REG_BUF0x0b
  +#defineOMAP_MMC_REG_SDIO   0x0d
  +#defineOMAP_MMC_REG_REV0x0f
  +#defineOMAP_MMC_REG_RSP0   0x10
  +#defineOMAP_MMC_REG_RSP1   0x11
  +#defineOMAP_MMC_REG_RSP2   0x12
  +#defineOMAP_MMC_REG_RSP3   0x13
  +#defineOMAP_MMC_REG_RSP4   0x14
  +#defineOMAP_MMC_REG_RSP5   0x15
  +#defineOMAP_MMC_REG_RSP6   0x16
  +#defineOMAP_MMC_REG_RSP7   0x17
  +#defineOMAP_MMC_REG_IOSR   0x18
  +#defineOMAP_MMC_REG_SYSC   0x19
  +#defineOMAP_MMC_REG_SYSS   0x1a
   
   #defineOMAP_MMC_STAT_CARD_ERR  (1  14)
   #defineOMAP_MMC_STAT_CARD_IRQ  (1  13)
  @@ -77,8 +77,9 @@
   #defineOMAP_MMC_STAT_CARD_BUSY (1   2)
   #defineOMAP_MMC_STAT_END_OF_CMD(1   0)
   
  -#define OMAP_MMC_READ(host, reg)   __raw_readw((host)-virt_base + 
  OMAP_MMC_REG_##reg)
  -#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), 
  (host)-virt_base + OMAP_MMC_REG_##reg)
  +#define OMAP_MMC_REG(host, reg)(OMAP_MMC_REG_##reg  
  (host)-reg_shift)
  +#define OMAP_MMC_READ(host, reg)   __raw_readw((host)-virt_base + 
  OMAP_MMC_REG(host, reg))
  +#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), 
  (host)-virt_base + OMAP_MMC_REG(host, reg))
   
   /*
* Command types
  @@ -132,6 +133,7 @@ struct mmc_omap_host {
  int irq;
  unsigned char   bus_mode;
  unsigned char   hw_bus_mode;
  +   unsigned intreg_shift;
   
  struct work_struct  cmd_abort_work;
  unsignedabort:1;
  @@ -679,9 +681,9 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int 
  write)
  

[PATCH] mmc-omap: Add support for 16-bit and 32-bit registers

2010-03-07 Thread Cory Maccarrone
From: Marek Belisko marek.beli...@open-nandra.com

The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
a modification of the register addresses in the mmc-omap driver.  To resolve
this, a bit shift is performed on base register addresses, either by 1 or 2
bits depending on the CPU in use.  This yields the correct registers for
each CPU.

Signed-off-by: Marek Belisko marek.beli...@open-nandra.com
Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 drivers/mmc/host/omap.c |   62 +--
 1 files changed, 33 insertions(+), 29 deletions(-)

This is a resubmit of a patch I sent in several months ago.  Tony Lindgren 
merged
this into linux-omap's master and testing branches but has stated that he will 
not
merge it further as linux-mmc needs to approve this.  There hasn't been any 
comments
raised on either of the linux-omap or linux-mmc mailing lists about problems.  
Due to
the unique nature of the omap7xx platform, this patch is required for MMC card 
access.
Is there any chance this can be included into the next -rc cycle, as it is a 
fix for
devices that have 16-bit registers?

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index c6d7e8e..53362c4 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -38,30 +38,30 @@
 #include plat/fpga.h
 
 #defineOMAP_MMC_REG_CMD0x00
-#defineOMAP_MMC_REG_ARGL   0x04
-#defineOMAP_MMC_REG_ARGH   0x08
-#defineOMAP_MMC_REG_CON0x0c
-#defineOMAP_MMC_REG_STAT   0x10
-#defineOMAP_MMC_REG_IE 0x14
-#defineOMAP_MMC_REG_CTO0x18
-#defineOMAP_MMC_REG_DTO0x1c
-#defineOMAP_MMC_REG_DATA   0x20
-#defineOMAP_MMC_REG_BLEN   0x24
-#defineOMAP_MMC_REG_NBLK   0x28
-#defineOMAP_MMC_REG_BUF0x2c
-#define OMAP_MMC_REG_SDIO  0x34
-#defineOMAP_MMC_REG_REV0x3c
-#defineOMAP_MMC_REG_RSP0   0x40
-#defineOMAP_MMC_REG_RSP1   0x44
-#defineOMAP_MMC_REG_RSP2   0x48
-#defineOMAP_MMC_REG_RSP3   0x4c
-#defineOMAP_MMC_REG_RSP4   0x50
-#defineOMAP_MMC_REG_RSP5   0x54
-#defineOMAP_MMC_REG_RSP6   0x58
-#defineOMAP_MMC_REG_RSP7   0x5c
-#defineOMAP_MMC_REG_IOSR   0x60
-#defineOMAP_MMC_REG_SYSC   0x64
-#defineOMAP_MMC_REG_SYSS   0x68
+#defineOMAP_MMC_REG_ARGL   0x01
+#defineOMAP_MMC_REG_ARGH   0x02
+#defineOMAP_MMC_REG_CON0x03
+#defineOMAP_MMC_REG_STAT   0x04
+#defineOMAP_MMC_REG_IE 0x05
+#defineOMAP_MMC_REG_CTO0x06
+#defineOMAP_MMC_REG_DTO0x07
+#defineOMAP_MMC_REG_DATA   0x08
+#defineOMAP_MMC_REG_BLEN   0x09
+#defineOMAP_MMC_REG_NBLK   0x0a
+#defineOMAP_MMC_REG_BUF0x0b
+#defineOMAP_MMC_REG_SDIO   0x0d
+#defineOMAP_MMC_REG_REV0x0f
+#defineOMAP_MMC_REG_RSP0   0x10
+#defineOMAP_MMC_REG_RSP1   0x11
+#defineOMAP_MMC_REG_RSP2   0x12
+#defineOMAP_MMC_REG_RSP3   0x13
+#defineOMAP_MMC_REG_RSP4   0x14
+#defineOMAP_MMC_REG_RSP5   0x15
+#defineOMAP_MMC_REG_RSP6   0x16
+#defineOMAP_MMC_REG_RSP7   0x17
+#defineOMAP_MMC_REG_IOSR   0x18
+#defineOMAP_MMC_REG_SYSC   0x19
+#defineOMAP_MMC_REG_SYSS   0x1a
 
 #defineOMAP_MMC_STAT_CARD_ERR  (1  14)
 #defineOMAP_MMC_STAT_CARD_IRQ  (1  13)
@@ -77,8 +77,9 @@
 #defineOMAP_MMC_STAT_CARD_BUSY (1   2)
 #defineOMAP_MMC_STAT_END_OF_CMD(1   0)
 
-#define OMAP_MMC_READ(host, reg)   __raw_readw((host)-virt_base + 
OMAP_MMC_REG_##reg)
-#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)-virt_base + 
OMAP_MMC_REG_##reg)
+#define OMAP_MMC_REG(host, reg)(OMAP_MMC_REG_##reg  
(host)-reg_shift)
+#define OMAP_MMC_READ(host, reg)   __raw_readw((host)-virt_base + 
OMAP_MMC_REG(host, reg))
+#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)-virt_base + 
OMAP_MMC_REG(host, reg))
 
 /*
  * Command types
@@ -132,6 +133,7 @@ struct mmc_omap_host {
int irq;
unsigned char   bus_mode;
unsigned char   hw_bus_mode;
+   unsigned intreg_shift;
 
struct work_struct  cmd_abort_work;
unsignedabort:1;
@@ -679,9 +681,9 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
host-data-bytes_xfered += n;
 
if (write) {
-   __raw_writesw(host-virt_base + OMAP_MMC_REG_DATA, 
host-buffer, n);
+   __raw_writesw(host-virt_base + OMAP_MMC_REG(host, DATA), 
host-buffer, n);
} else {
-

Re: [PATCH] mmc-omap: Add support for 16-bit and 32-bit registers

2010-03-07 Thread Ben Dooks
On Sun, Mar 07, 2010 at 09:47:58AM -0800, Cory Maccarrone wrote:
 From: Marek Belisko marek.beli...@open-nandra.com
 
 The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
 a modification of the register addresses in the mmc-omap driver.  To resolve
 this, a bit shift is performed on base register addresses, either by 1 or 2
 bits depending on the CPU in use.  This yields the correct registers for
 each CPU.

merged the previous one into my tree earlier today.
 
 Signed-off-by: Marek Belisko marek.beli...@open-nandra.com
 Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
 Signed-off-by: Tony Lindgren t...@atomide.com
 ---
  drivers/mmc/host/omap.c |   62 
 +--
  1 files changed, 33 insertions(+), 29 deletions(-)
 
 This is a resubmit of a patch I sent in several months ago.  Tony Lindgren 
 merged
 this into linux-omap's master and testing branches but has stated that he 
 will not
 merge it further as linux-mmc needs to approve this.  There hasn't been any 
 comments
 raised on either of the linux-omap or linux-mmc mailing lists about problems. 
  Due to
 the unique nature of the omap7xx platform, this patch is required for MMC 
 card access.
 Is there any chance this can be included into the next -rc cycle, as it is a 
 fix for
 devices that have 16-bit registers?
 
 diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
 index c6d7e8e..53362c4 100644
 --- a/drivers/mmc/host/omap.c
 +++ b/drivers/mmc/host/omap.c
 @@ -38,30 +38,30 @@
  #include plat/fpga.h
  
  #define  OMAP_MMC_REG_CMD0x00
 -#define  OMAP_MMC_REG_ARGL   0x04
 -#define  OMAP_MMC_REG_ARGH   0x08
 -#define  OMAP_MMC_REG_CON0x0c
 -#define  OMAP_MMC_REG_STAT   0x10
 -#define  OMAP_MMC_REG_IE 0x14
 -#define  OMAP_MMC_REG_CTO0x18
 -#define  OMAP_MMC_REG_DTO0x1c
 -#define  OMAP_MMC_REG_DATA   0x20
 -#define  OMAP_MMC_REG_BLEN   0x24
 -#define  OMAP_MMC_REG_NBLK   0x28
 -#define  OMAP_MMC_REG_BUF0x2c
 -#define OMAP_MMC_REG_SDIO0x34
 -#define  OMAP_MMC_REG_REV0x3c
 -#define  OMAP_MMC_REG_RSP0   0x40
 -#define  OMAP_MMC_REG_RSP1   0x44
 -#define  OMAP_MMC_REG_RSP2   0x48
 -#define  OMAP_MMC_REG_RSP3   0x4c
 -#define  OMAP_MMC_REG_RSP4   0x50
 -#define  OMAP_MMC_REG_RSP5   0x54
 -#define  OMAP_MMC_REG_RSP6   0x58
 -#define  OMAP_MMC_REG_RSP7   0x5c
 -#define  OMAP_MMC_REG_IOSR   0x60
 -#define  OMAP_MMC_REG_SYSC   0x64
 -#define  OMAP_MMC_REG_SYSS   0x68
 +#define  OMAP_MMC_REG_ARGL   0x01
 +#define  OMAP_MMC_REG_ARGH   0x02
 +#define  OMAP_MMC_REG_CON0x03
 +#define  OMAP_MMC_REG_STAT   0x04
 +#define  OMAP_MMC_REG_IE 0x05
 +#define  OMAP_MMC_REG_CTO0x06
 +#define  OMAP_MMC_REG_DTO0x07
 +#define  OMAP_MMC_REG_DATA   0x08
 +#define  OMAP_MMC_REG_BLEN   0x09
 +#define  OMAP_MMC_REG_NBLK   0x0a
 +#define  OMAP_MMC_REG_BUF0x0b
 +#define  OMAP_MMC_REG_SDIO   0x0d
 +#define  OMAP_MMC_REG_REV0x0f
 +#define  OMAP_MMC_REG_RSP0   0x10
 +#define  OMAP_MMC_REG_RSP1   0x11
 +#define  OMAP_MMC_REG_RSP2   0x12
 +#define  OMAP_MMC_REG_RSP3   0x13
 +#define  OMAP_MMC_REG_RSP4   0x14
 +#define  OMAP_MMC_REG_RSP5   0x15
 +#define  OMAP_MMC_REG_RSP6   0x16
 +#define  OMAP_MMC_REG_RSP7   0x17
 +#define  OMAP_MMC_REG_IOSR   0x18
 +#define  OMAP_MMC_REG_SYSC   0x19
 +#define  OMAP_MMC_REG_SYSS   0x1a
  
  #define  OMAP_MMC_STAT_CARD_ERR  (1  14)
  #define  OMAP_MMC_STAT_CARD_IRQ  (1  13)
 @@ -77,8 +77,9 @@
  #define  OMAP_MMC_STAT_CARD_BUSY (1   2)
  #define  OMAP_MMC_STAT_END_OF_CMD(1   0)
  
 -#define OMAP_MMC_READ(host, reg) __raw_readw((host)-virt_base + 
 OMAP_MMC_REG_##reg)
 -#define OMAP_MMC_WRITE(host, reg, val)   __raw_writew((val), 
 (host)-virt_base + OMAP_MMC_REG_##reg)
 +#define OMAP_MMC_REG(host, reg)  (OMAP_MMC_REG_##reg  
 (host)-reg_shift)
 +#define OMAP_MMC_READ(host, reg) __raw_readw((host)-virt_base + 
 OMAP_MMC_REG(host, reg))
 +#define OMAP_MMC_WRITE(host, reg, val)   __raw_writew((val), 
 (host)-virt_base + OMAP_MMC_REG(host, reg))
  
  /*
   * Command types
 @@ -132,6 +133,7 @@ struct mmc_omap_host {
   int irq;
   unsigned char   bus_mode;
   unsigned char   hw_bus_mode;
 + unsigned intreg_shift;
  
   struct work_struct  cmd_abort_work;
   unsignedabort:1;
 @@ -679,9 +681,9 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
   host-data-bytes_xfered += n;
  
   if (write) {
 - __raw_writesw(host-virt_base + OMAP_MMC_REG_DATA, 
 host-buffer, n);

Re: [PATCH] mmc-omap: Add support for 16-bit and 32-bit registers

2010-03-07 Thread Cory Maccarrone
On Sun, Mar 7, 2010 at 2:59 PM, Ben Dooks b...@fluff.org wrote:
 On Sun, Mar 07, 2010 at 09:47:58AM -0800, Cory Maccarrone wrote:
 From: Marek Belisko marek.beli...@open-nandra.com

 The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
 a modification of the register addresses in the mmc-omap driver.  To resolve
 this, a bit shift is performed on base register addresses, either by 1 or 2
 bits depending on the CPU in use.  This yields the correct registers for
 each CPU.

 merged the previous one into my tree earlier today.

 Signed-off-by: Marek Belisko marek.beli...@open-nandra.com
 Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
 Signed-off-by: Tony Lindgren t...@atomide.com
 ---
  drivers/mmc/host/omap.c |   62 
 +--
  1 files changed, 33 insertions(+), 29 deletions(-)

 This is a resubmit of a patch I sent in several months ago.  Tony Lindgren 
 merged
 this into linux-omap's master and testing branches but has stated that he 
 will not
 merge it further as linux-mmc needs to approve this.  There hasn't been any 
 comments
 raised on either of the linux-omap or linux-mmc mailing lists about 
 problems.  Due to
 the unique nature of the omap7xx platform, this patch is required for MMC 
 card access.
 Is there any chance this can be included into the next -rc cycle, as it is a 
 fix for
 devices that have 16-bit registers?

 diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
 index c6d7e8e..53362c4 100644
 --- a/drivers/mmc/host/omap.c
 +++ b/drivers/mmc/host/omap.c
 @@ -38,30 +38,30 @@
  #include plat/fpga.h

  #define      OMAP_MMC_REG_CMD        0x00
 -#define      OMAP_MMC_REG_ARGL       0x04
 -#define      OMAP_MMC_REG_ARGH       0x08
 -#define      OMAP_MMC_REG_CON        0x0c
 -#define      OMAP_MMC_REG_STAT       0x10
 -#define      OMAP_MMC_REG_IE         0x14
 -#define      OMAP_MMC_REG_CTO        0x18
 -#define      OMAP_MMC_REG_DTO        0x1c
 -#define      OMAP_MMC_REG_DATA       0x20
 -#define      OMAP_MMC_REG_BLEN       0x24
 -#define      OMAP_MMC_REG_NBLK       0x28
 -#define      OMAP_MMC_REG_BUF        0x2c
 -#define OMAP_MMC_REG_SDIO    0x34
 -#define      OMAP_MMC_REG_REV        0x3c
 -#define      OMAP_MMC_REG_RSP0       0x40
 -#define      OMAP_MMC_REG_RSP1       0x44
 -#define      OMAP_MMC_REG_RSP2       0x48
 -#define      OMAP_MMC_REG_RSP3       0x4c
 -#define      OMAP_MMC_REG_RSP4       0x50
 -#define      OMAP_MMC_REG_RSP5       0x54
 -#define      OMAP_MMC_REG_RSP6       0x58
 -#define      OMAP_MMC_REG_RSP7       0x5c
 -#define      OMAP_MMC_REG_IOSR       0x60
 -#define      OMAP_MMC_REG_SYSC       0x64
 -#define      OMAP_MMC_REG_SYSS       0x68
 +#define      OMAP_MMC_REG_ARGL       0x01
 +#define      OMAP_MMC_REG_ARGH       0x02
 +#define      OMAP_MMC_REG_CON        0x03
 +#define      OMAP_MMC_REG_STAT       0x04
 +#define      OMAP_MMC_REG_IE         0x05
 +#define      OMAP_MMC_REG_CTO        0x06
 +#define      OMAP_MMC_REG_DTO        0x07
 +#define      OMAP_MMC_REG_DATA       0x08
 +#define      OMAP_MMC_REG_BLEN       0x09
 +#define      OMAP_MMC_REG_NBLK       0x0a
 +#define      OMAP_MMC_REG_BUF        0x0b
 +#define      OMAP_MMC_REG_SDIO       0x0d
 +#define      OMAP_MMC_REG_REV        0x0f
 +#define      OMAP_MMC_REG_RSP0       0x10
 +#define      OMAP_MMC_REG_RSP1       0x11
 +#define      OMAP_MMC_REG_RSP2       0x12
 +#define      OMAP_MMC_REG_RSP3       0x13
 +#define      OMAP_MMC_REG_RSP4       0x14
 +#define      OMAP_MMC_REG_RSP5       0x15
 +#define      OMAP_MMC_REG_RSP6       0x16
 +#define      OMAP_MMC_REG_RSP7       0x17
 +#define      OMAP_MMC_REG_IOSR       0x18
 +#define      OMAP_MMC_REG_SYSC       0x19
 +#define      OMAP_MMC_REG_SYSS       0x1a

  #define      OMAP_MMC_STAT_CARD_ERR          (1  14)
  #define      OMAP_MMC_STAT_CARD_IRQ          (1  13)
 @@ -77,8 +77,9 @@
  #define      OMAP_MMC_STAT_CARD_BUSY         (1   2)
  #define      OMAP_MMC_STAT_END_OF_CMD        (1   0)

 -#define OMAP_MMC_READ(host, reg)     __raw_readw((host)-virt_base + 
 OMAP_MMC_REG_##reg)
 -#define OMAP_MMC_WRITE(host, reg, val)       __raw_writew((val), 
 (host)-virt_base + OMAP_MMC_REG_##reg)
 +#define OMAP_MMC_REG(host, reg)              (OMAP_MMC_REG_##reg  
 (host)-reg_shift)
 +#define OMAP_MMC_READ(host, reg)     __raw_readw((host)-virt_base + 
 OMAP_MMC_REG(host, reg))
 +#define OMAP_MMC_WRITE(host, reg, val)       __raw_writew((val), 
 (host)-virt_base + OMAP_MMC_REG(host, reg))

  /*
   * Command types
 @@ -132,6 +133,7 @@ struct mmc_omap_host {
       int                     irq;
       unsigned char           bus_mode;
       unsigned char           hw_bus_mode;
 +     unsigned int            reg_shift;

       struct work_struct      cmd_abort_work;
       unsigned                abort:1;
 @@ -679,9 +681,9 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
       host-data-bytes_xfered += n;

       if (write) {
 -             

Re: [PATCH] [mmc-omap] Add support for 16-bit and 32-bit registers

2009-11-18 Thread Ladislav Michl
On Sat, Nov 14, 2009 at 07:24:55PM -0800, Cory Maccarrone wrote:
 The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
 a modification of the register addresses in the mmc-omap driver.  To
 make this as portable as possible, I made the following changes:

Hmm, I would not trade portability anyone currently needs for complexity...

 * Moved register address offsets from drivers/mmc/host/omap.c to
   drivers/mmc/host/omap.h
 * Implemented a lookup table for 16-bit and 32-bit register offsets
 * Added a reg_size field in the mmc_omap_host structure
 * Added code in mmc_omap_probe() to populate the reg_size
   field based on processor in use
 * Added inline function to return the register offset based on
   the register size and register name
 * Modified mmc-omap driver to use the new inline function to call out
   register names

All this could be probably done by making register definition an index and
shifting it left by one or two depending on CPU. No lookup table needed.

 This change should allow the omap7xx-series of processors to correctly
 utilize the MMC driver.

Did you test it? It does not work on 5910, see here:
http://thread.gmane.org/gmane.linux.kernel.mmc/649

Best regards,
ladis
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [mmc-omap] Add support for 16-bit and 32-bit registers

2009-11-18 Thread Cory Maccarrone
On Wed, Nov 18, 2009 at 10:41 AM, Ladislav Michl
ladislav.mi...@seznam.cz wrote:
 On Sat, Nov 14, 2009 at 07:24:55PM -0800, Cory Maccarrone wrote:
 The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
 a modification of the register addresses in the mmc-omap driver.  To
 make this as portable as possible, I made the following changes:

 Hmm, I would not trade portability anyone currently needs for complexity...

Agreed, this solution is more complicated than it probably needs to be.


 * Moved register address offsets from drivers/mmc/host/omap.c to
   drivers/mmc/host/omap.h
 * Implemented a lookup table for 16-bit and 32-bit register offsets
 * Added a reg_size field in the mmc_omap_host structure
 * Added code in mmc_omap_probe() to populate the reg_size
   field based on processor in use
 * Added inline function to return the register offset based on
   the register size and register name
 * Modified mmc-omap driver to use the new inline function to call out
   register names

 All this could be probably done by making register definition an index and
 shifting it left by one or two depending on CPU. No lookup table needed.

Ah, good point, I hadn't considered that.  I'll rework my
implementation to do that and resubmit.


 This change should allow the omap7xx-series of processors to correctly
 utilize the MMC driver.

 Did you test it? It does not work on 5910, see here:
 http://thread.gmane.org/gmane.linux.kernel.mmc/649

Not sure why it wouldn't work on the 5910.  I tested it on my device,
and it works properly for me, but then I don't have an omap-based
device that uses 32-bit register definitions.  I'm confused at the
post you have above though...Is that with my patch, or is that with
something else?  It seems to reference the status of current git,
which I don't think this patch shouldn't be in.

- Cory
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [mmc-omap] Add support for 16-bit and 32-bit registers

2009-11-18 Thread Ladislav Michl
On Wed, Nov 18, 2009 at 01:09:22PM -0800, Cory Maccarrone wrote:
 On Wed, Nov 18, 2009 at 10:41 AM, Ladislav Michl
 ladislav.mi...@seznam.cz wrote:
  Did you test it? It does not work on 5910, see here:
  http://thread.gmane.org/gmane.linux.kernel.mmc/649
 
 Not sure why it wouldn't work on the 5910.  I tested it on my device,
 and it works properly for me, but then I don't have an omap-based
 device that uses 32-bit register definitions.  I'm confused at the
 post you have above though...Is that with my patch, or is that with
 something else?  It seems to reference the status of current git,
 which I don't think this patch shouldn't be in.

To put it clear, current git does not work and it is unrelated to your patch.
If driver works for you with your patch, then either your MMC card or
controller in your SoC survives multiple init sequences or it has something
to do with clock settings or... You can find two more people confirming
this here: http://www.spinics.net/lists/linux-omap/msg09547.html
I'll probably need to find some time to read MMC spec.

ladis
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [mmc-omap] Add support for 16-bit and 32-bit registers

2009-11-14 Thread Cory Maccarrone
The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
a modification of the register addresses in the mmc-omap driver.  To
make this as portable as possible, I made the following changes:

* Moved register address offsets from drivers/mmc/host/omap.c to
  drivers/mmc/host/omap.h
* Implemented a lookup table for 16-bit and 32-bit register offsets
* Added a reg_size field in the mmc_omap_host structure
* Added code in mmc_omap_probe() to populate the reg_size
  field based on processor in use
* Added inline function to return the register offset based on
  the register size and register name
* Modified mmc-omap driver to use the new inline function to call out
  register names

This change should allow the omap7xx-series of processors to correctly
utilize the MMC driver.

Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
---
 drivers/mmc/host/omap.c |   42 +
 drivers/mmc/host/omap.h |  115 +++
 2 files changed, 127 insertions(+), 30 deletions(-)
 create mode 100644 drivers/mmc/host/omap.h

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 5f970e2..c0071b3 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -37,31 +37,7 @@
 #include plat/mux.h
 #include plat/fpga.h
 
-#defineOMAP_MMC_REG_CMD0x00
-#defineOMAP_MMC_REG_ARGL   0x04
-#defineOMAP_MMC_REG_ARGH   0x08
-#defineOMAP_MMC_REG_CON0x0c
-#defineOMAP_MMC_REG_STAT   0x10
-#defineOMAP_MMC_REG_IE 0x14
-#defineOMAP_MMC_REG_CTO0x18
-#defineOMAP_MMC_REG_DTO0x1c
-#defineOMAP_MMC_REG_DATA   0x20
-#defineOMAP_MMC_REG_BLEN   0x24
-#defineOMAP_MMC_REG_NBLK   0x28
-#defineOMAP_MMC_REG_BUF0x2c
-#define OMAP_MMC_REG_SDIO  0x34
-#defineOMAP_MMC_REG_REV0x3c
-#defineOMAP_MMC_REG_RSP0   0x40
-#defineOMAP_MMC_REG_RSP1   0x44
-#defineOMAP_MMC_REG_RSP2   0x48
-#defineOMAP_MMC_REG_RSP3   0x4c
-#defineOMAP_MMC_REG_RSP4   0x50
-#defineOMAP_MMC_REG_RSP5   0x54
-#defineOMAP_MMC_REG_RSP6   0x58
-#defineOMAP_MMC_REG_RSP7   0x5c
-#defineOMAP_MMC_REG_IOSR   0x60
-#defineOMAP_MMC_REG_SYSC   0x64
-#defineOMAP_MMC_REG_SYSS   0x68
+#include omap.h
 
 #defineOMAP_MMC_STAT_CARD_ERR  (1  14)
 #defineOMAP_MMC_STAT_CARD_IRQ  (1  13)
@@ -77,8 +53,10 @@
 #defineOMAP_MMC_STAT_CARD_BUSY (1   2)
 #defineOMAP_MMC_STAT_END_OF_CMD(1   0)
 
-#define OMAP_MMC_READ(host, reg)   __raw_readw((host)-virt_base + 
OMAP_MMC_REG_##reg)
-#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)-virt_base + 
OMAP_MMC_REG_##reg)
+#define OMAP_MMC_REG(host, reg)
mmc_omap_get_register(host-reg_size, OMAP_MMC_REG_##reg)
+
+#define OMAP_MMC_READ(host, reg)   __raw_readw((host)-virt_base + 
OMAP_MMC_REG(host, reg))
+#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val), (host)-virt_base + 
OMAP_MMC_REG(host, reg))
 
 /*
  * Command types
@@ -167,6 +145,8 @@ struct mmc_omap_host {
spinlock_t  clk_lock; /* for changing enabled state */
unsigned intfclk_enabled:1;
 
+   unsignedreg_size:1;
+
struct omap_mmc_platform_data *pdata;
 };
 
@@ -679,9 +659,9 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
host-data-bytes_xfered += n;
 
if (write) {
-   __raw_writesw(host-virt_base + OMAP_MMC_REG_DATA, 
host-buffer, n);
+   __raw_writesw(host-virt_base + OMAP_MMC_REG(host, DATA), 
host-buffer, n);
} else {
-   __raw_readsw(host-virt_base + OMAP_MMC_REG_DATA, host-buffer, 
n);
+   __raw_readsw(host-virt_base + OMAP_MMC_REG(host, DATA), 
host-buffer, n);
}
 }
 
@@ -899,7 +879,7 @@ mmc_omap_prepare_dma(struct mmc_omap_host *host, struct 
mmc_data *data)
int dst_port = 0;
int sync_dev = 0;
 
-   data_addr = host-phys_base + OMAP_MMC_REG_DATA;
+   data_addr = host-phys_base + OMAP_MMC_REG(host, DATA);
frame = data-blksz;
count = sg_dma_len(sg);
 
@@ -1490,6 +1470,8 @@ static int __init mmc_omap_probe(struct platform_device 
*pdev)
}
}
 
+   host-reg_size = (cpu_is_omap7xx() ? OMAP_MMC_REG_SIZE_2 : 
OMAP_MMC_REG_SIZE_4);
+
return 0;
 
 err_plat_cleanup:
diff --git a/drivers/mmc/host/omap.h b/drivers/mmc/host/omap.h
new file mode 100644
index 000..9a52203
--- /dev/null
+++ b/drivers/mmc/host/omap.h
@@ -0,0 +1,115 @@
+/*
+ *  linux/drivers/mmc/host/omap.h
+ *
+ *  Copyright (C) 2009 Cory Maccarrone darkstar6...@gmail.com
+ *
+ * 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
+ * 

[PATCH] [mmc-omap] Add support for 16-bit and 32-bit registers

2009-10-03 Thread Cory Maccarrone
The omap850 and omap730 use 16-bit registers instead of 32-bit, requiring
a modification of the register addresses in the mmc-omap driver.  To
make this as portable as possible, I made the following changes:

* Moved register address offsets from drivers/mmc/host/omap.c to
  drivers/mmc/host/omap.h
* Implemented a lookup table for 16-bit and 32-bit register offsets
* Added a reg_size field in the mmc_omap_host structure
* Added code in mmc_omap_probe() to populate the reg_size
  field based on processor in use
* Added inline function to return the register offset based on
  the register size and register name
* Modified mmc-omap driver to use the new inline function to call out
  register names

This change should allow the omap7xx-series of processors to correctly
utilize the MMC driver.

Signed-off-by: Cory Maccarrone darkstar6...@gmail.com
---
 drivers/mmc/host/omap.c |   42 +
 drivers/mmc/host/omap.h |  115 +++
 2 files changed, 127 insertions(+), 30 deletions(-)
 create mode 100644 drivers/mmc/host/omap.h

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index e7a331d..b82f935 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -37,31 +37,7 @@
 #include mach/mux.h
 #include mach/fpga.h

-#defineOMAP_MMC_REG_CMD0x00
-#defineOMAP_MMC_REG_ARGL   0x04
-#defineOMAP_MMC_REG_ARGH   0x08
-#defineOMAP_MMC_REG_CON0x0c
-#defineOMAP_MMC_REG_STAT   0x10
-#defineOMAP_MMC_REG_IE 0x14
-#defineOMAP_MMC_REG_CTO0x18
-#defineOMAP_MMC_REG_DTO0x1c
-#defineOMAP_MMC_REG_DATA   0x20
-#defineOMAP_MMC_REG_BLEN   0x24
-#defineOMAP_MMC_REG_NBLK   0x28
-#defineOMAP_MMC_REG_BUF0x2c
-#define OMAP_MMC_REG_SDIO  0x34
-#defineOMAP_MMC_REG_REV0x3c
-#defineOMAP_MMC_REG_RSP0   0x40
-#defineOMAP_MMC_REG_RSP1   0x44
-#defineOMAP_MMC_REG_RSP2   0x48
-#defineOMAP_MMC_REG_RSP3   0x4c
-#defineOMAP_MMC_REG_RSP4   0x50
-#defineOMAP_MMC_REG_RSP5   0x54
-#defineOMAP_MMC_REG_RSP6   0x58
-#defineOMAP_MMC_REG_RSP7   0x5c
-#defineOMAP_MMC_REG_IOSR   0x60
-#defineOMAP_MMC_REG_SYSC   0x64
-#defineOMAP_MMC_REG_SYSS   0x68
+#include omap.h

 #defineOMAP_MMC_STAT_CARD_ERR  (1  14)
 #defineOMAP_MMC_STAT_CARD_IRQ  (1  13)
@@ -77,8 +53,10 @@
 #defineOMAP_MMC_STAT_CARD_BUSY (1   2)
 #defineOMAP_MMC_STAT_END_OF_CMD(1   0)

-#define OMAP_MMC_READ(host, reg)   __raw_readw((host)-virt_base +
OMAP_MMC_REG_##reg)
-#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val),
(host)-virt_base + OMAP_MMC_REG_##reg)
+#define OMAP_MMC_REG(host,
reg)mmc_omap_get_register(host-reg_size, OMAP_MMC_REG_##reg)
+
+#define OMAP_MMC_READ(host, reg)   __raw_readw((host)-virt_base +
OMAP_MMC_REG(host, reg))
+#define OMAP_MMC_WRITE(host, reg, val) __raw_writew((val),
(host)-virt_base + OMAP_MMC_REG(host, reg))

 /*
  * Command types
@@ -167,6 +145,8 @@ struct mmc_omap_host {
spinlock_t  clk_lock; /* for changing enabled state */
unsigned intfclk_enabled:1;

+   unsignedreg_size:1;
+
struct omap_mmc_platform_data *pdata;
 };

@@ -679,9 +659,9 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
host-data-bytes_xfered += n;

if (write) {
-   __raw_writesw(host-virt_base + OMAP_MMC_REG_DATA, 
host-buffer, n);
+   __raw_writesw(host-virt_base + OMAP_MMC_REG(host, DATA), 
host-buffer, n);
} else {
-   __raw_readsw(host-virt_base + OMAP_MMC_REG_DATA, host-buffer, 
n);
+   __raw_readsw(host-virt_base + OMAP_MMC_REG(host, DATA), 
host-buffer, n);
}
 }

@@ -899,7 +879,7 @@ mmc_omap_prepare_dma(struct mmc_omap_host *host,
struct mmc_data *data)
int dst_port = 0;
int sync_dev = 0;

-   data_addr = host-phys_base + OMAP_MMC_REG_DATA;
+   data_addr = host-phys_base + OMAP_MMC_REG(host, DATA);
frame = data-blksz;
count = sg_dma_len(sg);

@@ -1490,6 +1470,8 @@ static int __init mmc_omap_probe(struct
platform_device *pdev)
}
}

+   host-reg_size = (cpu_is_omap7xx() ? OMAP_MMC_REG_SIZE_2 :
OMAP_MMC_REG_SIZE_4);
+
return 0;

 err_plat_cleanup:
diff --git a/drivers/mmc/host/omap.h b/drivers/mmc/host/omap.h
new file mode 100644
index 000..9a52203
--- /dev/null
+++ b/drivers/mmc/host/omap.h
@@ -0,0 +1,115 @@
+/*
+ *  linux/drivers/mmc/host/omap.h
+ *
+ *  Copyright (C) 2009 Cory Maccarrone darkstar6...@gmail.com
+ *
+ * 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