building mmc_core.ko - invalid module format

2011-01-13 Thread Mark Thurlow
Hi,

I'm trying to build mmc_core.ko with a modified sdio_cis.c  in order to
add more debug to see what our card is doing.

I have the following setup:
1.  Ubuntu 10.04 - 2.6.32-27-generic.
2.  I have downloaded the source for this via 
a.  sudo apt-get build-dep --no-install-recommends
linux-image-$(uname -r)
b.  apt-get source linux-image-$(uname -r)

In the top level source directory I run make menuconfig.  Under the
device driver option I set MMC/SDIO to M - produce modules. So
MMC_CONFIG=m in the .config file.

I then run make modules

All builds OK. I get a mmc_core.ko produced. However, if I then insmod
this .ko then I see the invalid module format.

Any ideas of what I'm doing wrong ?

Thanks,

Mark


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


[PATCH v2 1/1]mmc: implemented eMMC4.4 enhanced area feature

2011-01-13 Thread Chuanxiao Dong
Enhanced area feature is a new feature defined in eMMC4.4 standard. This
kind of area can help to improve the performance.

MMC driver will read out the enhanced area offset and size and add them
to be device attributes. The feature enabling should be done in manufactory.
To use this feature, bit ERASE_GRP_DEF should also be set.

Documentation/ABI/testing/sysfs-devices-mmc described the two new attributes

Signed-off-by: Chuanxiao Dong chuanxiao.d...@intel.com
---
 Documentation/ABI/testing/sysfs-devices-mmc |   19 +++
 drivers/mmc/core/mmc.c  |   73 +++
 include/linux/mmc/card.h|3 +
 include/linux/mmc/mmc.h |3 +
 4 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-devices-mmc

diff --git a/Documentation/ABI/testing/sysfs-devices-mmc 
b/Documentation/ABI/testing/sysfs-devices-mmc
new file mode 100644
index 000..f0fb053
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-devices-mmc
@@ -0,0 +1,19 @@
+What:  /sys/devices/.../mmc_host/mmcX/mmcX:/enhanced_area_offset
+Date:  January 2011
+Contact:   Chuanxiao Dong chuanxiao.d...@intel.com
+Description:
+   Enhanced area is a new feature defined in eMMC4.4 standard.
+   eMMC4.4 or later card can support such feature. This kind of 
area
+   can help to improve the card performance. If the feature is 
enabled,
+   this attribute will indicate the start address of enhanced data
+   area. If not, this attribute will be 0. Unit Byte.
+
+What:  /sys/devices/.../mmc_host/mmcX/mmcX:/enhanced_area_size
+Date:  January 2011
+Contact:   Chuanxiao Dong chuanxiao.d...@intel.com
+Description:
+   Enhanced area is a new feature defined in eMMC4.4 standard.
+   eMMC4.4 or later card can support such feature. This kind of 
area
+   can help to improve the card performance. If the feature is 
enabled,
+   this attribute will indicate the size of enhanced data area. If 
not,
+   this attribute will be 0. Unit KBytes.
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 16006ef..c8b5b3b 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -302,6 +302,41 @@ static int mmc_read_ext_csd(struct mmc_card *card)
}
 
if (card-ext_csd.rev = 4) {
+   /*
+* Enhanced area feature support
+* check whether eMMC card is enabled enhanced area,
+* if so, export enhanced area offset and size to
+* user by adding sysfs interface
+*/
+   if ((ext_csd[EXT_CSD_PARTITION_SUPPORT]  0x2) 
+   (ext_csd[EXT_CSD_PARTITION_ATTRIBUTE]  0x1)) {
+   u8 hc_erase_grp_sz =
+   ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE];
+   u8 hc_wp_grp_sz =
+   ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
+   /*
+* set a flag to identify whether the enhanced
+* user data are enabled
+*/
+   card-ext_csd.enhanced_area_en = 1;
+   /*
+* caculate the enhanced data area offset, unit B
+*/
+   card-ext_csd.enhanced_area_offset =
+   (ext_csd[139]  24) + (ext_csd[138]  16) +
+   (ext_csd[137]  8) + ext_csd[136];
+   if (mmc_card_blockaddr(card))
+   card-ext_csd.enhanced_area_offset = 9;
+   /*
+* caculate the enhanced data area size, unit KB
+*/
+   card-ext_csd.enhanced_area_size =
+   (ext_csd[142]  16) + (ext_csd[141]  8) +
+   ext_csd[140];
+   card-ext_csd.enhanced_area_size *=
+   (size_t)(hc_erase_grp_sz * hc_wp_grp_sz);
+   card-ext_csd.enhanced_area_size = 9;
+   }
card-ext_csd.sec_trim_mult =
ext_csd[EXT_CSD_SEC_TRIM_MULT];
card-ext_csd.sec_erase_mult =
@@ -336,6 +371,9 @@ MMC_DEV_ATTR(manfid, 0x%06x\n, card-cid.manfid);
 MMC_DEV_ATTR(name, %s\n, card-cid.prod_name);
 MMC_DEV_ATTR(oemid, 0x%04x\n, card-cid.oemid);
 MMC_DEV_ATTR(serial, 0x%08x\n, card-cid.serial);
+MMC_DEV_ATTR(enhanced_area_offset, 0x%llxB\n,
+   card-ext_csd.enhanced_area_offset);
+MMC_DEV_ATTR(enhanced_area_size, 0x%xKB\n, card-ext_csd.enhanced_area_size);
 
 static struct attribute *mmc_std_attrs[] = {
dev_attr_cid.attr,
@@ -349,6 +387,8 @@ static struct attribute *mmc_std_attrs[] = {

drivers/mmc/host/sdhci-of-core.c on sparc64

2011-01-13 Thread Andrew Morton
drivers/mmc/host/sdhci-of-core.c:24:25: asm/machdep.h: No such file or directory
drivers/mmc/host/sdhci-of-core.c: In function `sdhci_of_wp_inverted':
drivers/mmc/host/sdhci-of-core.c:115: error: implicit declaration of function 
`machine_is'

That code's been there for a while.  Did someone change Kconfig?
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: drivers/mmc/host/sdhci-of-core.c on sparc64

2011-01-13 Thread Chris Ball
On Thu, Jan 13, 2011 at 03:10:33PM -0800, Andrew Morton wrote:
 drivers/mmc/host/sdhci-of-core.c:24:25: asm/machdep.h: No such file or 
 directory
 drivers/mmc/host/sdhci-of-core.c: In function `sdhci_of_wp_inverted':
 drivers/mmc/host/sdhci-of-core.c:115: error: implicit declaration of function 
 `machine_is'
 
 That code's been there for a while.  Did someone change Kconfig?

Can you attach a .config?  asm/machdep.h is arch-specific, so I'd
suggest that you're building on an unsupported arch.

Thanks,

-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: drivers/mmc/host/sdhci-of-core.c on sparc64

2011-01-13 Thread Andrew Morton
On Thu, 13 Jan 2011 23:38:28 +
Chris Ball c...@laptop.org wrote:

 On Thu, Jan 13, 2011 at 03:10:33PM -0800, Andrew Morton wrote:
  drivers/mmc/host/sdhci-of-core.c:24:25: asm/machdep.h: No such file or 
  directory
  drivers/mmc/host/sdhci-of-core.c: In function `sdhci_of_wp_inverted':
  drivers/mmc/host/sdhci-of-core.c:115: error: implicit declaration of 
  function `machine_is'
  
  That code's been there for a while.  Did someone change Kconfig?
 
 Can you attach a .config?  asm/machdep.h is arch-specific, so I'd
 suggest that you're building on an unsupported arch.
 

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


Re: drivers/mmc/host/sdhci-of-core.c on sparc64

2011-01-13 Thread Chris Ball
Hi,

On Thu, Jan 13, 2011 at 03:41:40PM -0800, Andrew Morton wrote:
   drivers/mmc/host/sdhci-of-core.c:24:25: asm/machdep.h: No such file or 
   directory
   drivers/mmc/host/sdhci-of-core.c: In function `sdhci_of_wp_inverted':
   drivers/mmc/host/sdhci-of-core.c:115: error: implicit declaration of 
   function `machine_is'
   
   That code's been there for a while.  Did someone change Kconfig?
  
  Can you attach a .config?  asm/machdep.h is arch-specific, so I'd
  suggest that you're building on an unsupported arch.
  
 
 sparc64 allmodconfig.

You're right, Andrew -- Rob (CC'd) changed the MMC Kconfig to build this
driver on Sparc.  Mainline commit 236cdc7bc71 (of: make drivers depend
on CONFIG_OF instead of CONFIG_PPC_OF).

Rob also posted a patch to devicetree-discuss@, on top of the one above
(mmc: sdhci-of: fix build on non-powerpc platforms), to fix up the
Sparc build by ifdef'ing for PPC inside the driver.  Grant merged the
first patch but not the second, hence sparc64 allmodconfig is broken
now.  The reason Grant didn't merge the second patch may be that Wolfram
objected to #ifdef proliferation inside the driver.

Options, as I see it:
 * revert the commit such that MMC_SDHCI_OF once again depends on PPC_OF
 * take the second patch as-is
 * come up with a less-#ifdeffy second patch

Wolfram, would appreciate your input on what we should do here.  Thanks,

-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: drivers/mmc/host/sdhci-of-core.c on sparc64

2011-01-13 Thread Grant Likely
On Thu, Jan 13, 2011 at 6:12 PM, Chris Ball c...@laptop.org wrote:
 Hi,

 On Thu, Jan 13, 2011 at 03:41:40PM -0800, Andrew Morton wrote:
   drivers/mmc/host/sdhci-of-core.c:24:25: asm/machdep.h: No such file or 
   directory
   drivers/mmc/host/sdhci-of-core.c: In function `sdhci_of_wp_inverted':
   drivers/mmc/host/sdhci-of-core.c:115: error: implicit declaration of 
   function `machine_is'
  
   That code's been there for a while.  Did someone change Kconfig?
 
  Can you attach a .config?  asm/machdep.h is arch-specific, so I'd
  suggest that you're building on an unsupported arch.
 

 sparc64 allmodconfig.

 You're right, Andrew -- Rob (CC'd) changed the MMC Kconfig to build this
 driver on Sparc.  Mainline commit 236cdc7bc71 (of: make drivers depend
 on CONFIG_OF instead of CONFIG_PPC_OF).

 Rob also posted a patch to devicetree-discuss@, on top of the one above
 (mmc: sdhci-of: fix build on non-powerpc platforms), to fix up the
 Sparc build by ifdef'ing for PPC inside the driver.  Grant merged the
 first patch but not the second, hence sparc64 allmodconfig is broken
 now.  The reason Grant didn't merge the second patch may be that Wolfram
 objected to #ifdef proliferation inside the driver.

 Options, as I see it:
  * revert the commit such that MMC_SDHCI_OF once again depends on PPC_OF
  * take the second patch as-is
  * come up with a less-#ifdeffy second patch

 Wolfram, would appreciate your input on what we should do here.  Thanks,

I've applied the 2nd patch.  I had applied it to my test tree, and
indeed I replied saying I did, but I had a corrupt git tree event
shortly after applying it to my test branch and evidently lost track
of it.

It's been pushed out to my next-devicetree branch:

git://git.secretlab.ca/git/linux-2.6.git next-devicetree

I'll ask Linus to pull after doing some sanity testing.

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