Patchwork MTD: Refine HAS_IOMEM dependency

login
register
mail settings
Submitter Richard Weinberger
Date Jan. 25, 2012, 5:21 p.m.
Message ID <1327512102-22447-1-git-send-email-richard@nod.at>
Download mbox | patch
Permalink /patch/137813/
State New
Headers show

Comments

Richard Weinberger - Jan. 25, 2012, 5:21 p.m.
Making the entire mtd subsystem depend on HAS_IOMEM is a bit overkill.
HAS_IOMEM is only needed for real devices drivers.
nandsim and friends are perfectly usable on systems without IO memory.

I'm my case I'm using nandsim on UML to do some UBI and JFFS2 development.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/mtd/Kconfig         |    1 -
 drivers/mtd/devices/Kconfig |    1 +
 drivers/mtd/maps/Kconfig    |    1 +
 drivers/mtd/nand/Kconfig    |    2 ++
 drivers/mtd/onenand/Kconfig |    1 +
 5 files changed, 5 insertions(+), 1 deletions(-)
Richard Weinberger - Jan. 31, 2012, 10:46 p.m.
Am 25.01.2012 18:21, schrieb Richard Weinberger:
> Making the entire mtd subsystem depend on HAS_IOMEM is a bit overkill.
> HAS_IOMEM is only needed for real devices drivers.
> nandsim and friends are perfectly usable on systems without IO memory.
>
> I'm my case I'm using nandsim on UML to do some UBI and JFFS2 development.
>
> Signed-off-by: Richard Weinberger<richard@nod.at>
> ---
>   drivers/mtd/Kconfig         |    1 -
>   drivers/mtd/devices/Kconfig |    1 +
>   drivers/mtd/maps/Kconfig    |    1 +
>   drivers/mtd/nand/Kconfig    |    2 ++
>   drivers/mtd/onenand/Kconfig |    1 +
>   5 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
> index 1be6218..bfbd62c 100644
> --- a/drivers/mtd/Kconfig
> +++ b/drivers/mtd/Kconfig
> @@ -1,6 +1,5 @@
>   menuconfig MTD
>   	tristate "Memory Technology Device (MTD) support"
> -	depends on HAS_IOMEM
>   	help
>   	  Memory Technology Devices are flash, RAM and similar chips, often
>   	  used for solid state file systems on embedded devices. This option
> diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
> index 37b05c3..8d3dac4 100644
> --- a/drivers/mtd/devices/Kconfig
> +++ b/drivers/mtd/devices/Kconfig
> @@ -1,5 +1,6 @@
>   menu "Self-contained MTD device drivers"
>   	depends on MTD!=n
> +	depends on HAS_IOMEM
>
>   config MTD_PMC551
>   	tristate "Ramix PMC551 PCI Mezzanine RAM card support"
> diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
> index 6c5c431..8af67cf 100644
> --- a/drivers/mtd/maps/Kconfig
> +++ b/drivers/mtd/maps/Kconfig
> @@ -1,5 +1,6 @@
>   menu "Mapping drivers for chip access"
>   	depends on MTD!=n
> +	depends on HAS_IOMEM
>
>   config MTD_COMPLEX_MAPPINGS
>   	bool "Support non-linear mappings of flash chips"
> diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
> index 31b034b..80de7b3 100644
> --- a/drivers/mtd/nand/Kconfig
> +++ b/drivers/mtd/nand/Kconfig
> @@ -246,6 +246,7 @@ config MTD_NAND_BCM_UMI_HWCS
>   config MTD_NAND_DISKONCHIP
>   	tristate "DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplementation) (EXPERIMENTAL)"
>   	depends on EXPERIMENTAL
> +	depends on HAS_IOMEM
>   	select REED_SOLOMON
>   	select REED_SOLOMON_DEC16
>   	help
> @@ -431,6 +432,7 @@ config MTD_NAND_GPMI_NAND
>
>   config MTD_NAND_PLATFORM
>   	tristate "Support for generic platform NAND driver"
> +	depends on HAS_IOMEM
>   	help
>   	  This implements a generic NAND driver for on-SOC platform
>   	  devices. You will need to provide platform-specific functions
> diff --git a/drivers/mtd/onenand/Kconfig b/drivers/mtd/onenand/Kconfig
> index 772ad29..91467bb 100644
> --- a/drivers/mtd/onenand/Kconfig
> +++ b/drivers/mtd/onenand/Kconfig
> @@ -1,6 +1,7 @@
>   menuconfig MTD_ONENAND
>   	tristate "OneNAND Device Support"
>   	depends on MTD
> +	depends on HAS_IOMEM
>   	help
>   	  This enables support for accessing all type of OneNAND flash
>   	  devices. For further information see

Ping?

Thanks,
//richard
Artem Bityutskiy - Feb. 2, 2012, 9:07 a.m.
On Wed, 2012-01-25 at 18:21 +0100, Richard Weinberger wrote:
> Making the entire mtd subsystem depend on HAS_IOMEM is a bit overkill.
> HAS_IOMEM is only needed for real devices drivers.
> nandsim and friends are perfectly usable on systems without IO memory.
> 
> I'm my case I'm using nandsim on UML to do some UBI and JFFS2 development.
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>

Could you please work on this patch some more and make sure it does not
break s390 build (it does now).

Download the s390 cross-compiler from here:
http://kernel.org/pub/tools/crosstool/files/bin/

I used this one:
http://kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.0/x86_64-gcc-4.6.0-nolibc_s390x-linux.tar.bz2

I built the kernel with arch/s390/defconfig - it is out of date a bit,
but the kernel compiles with it.

Then I applied your patch and enabled all the available MTD options and
failed to build it. I've attached this .config file. Here is the command
line I used to build the kernel for s390x:

$ make ARCH=s390 CROSS_COMPILE=s390x-linux-
O=/home/dedekind/space/kernel-builds/l2-mtd-s390 -j16

The .config was put to /home/dedekind/space/kernel-builds/l2-mtd-s390,
obviously, and the path to the s390x-linux-* tools were in my PATH
environment variable.

There many errors, here is just one example:

make[4]: *** [drivers/mtd/lpddr/lpddr_cmds.o] Error 1
/home/dedekind/git/l2-mtd/include/linux/mtd/map.h:407:3: error: implicit declaration of function 'memcpy_fromio' [-Werror=implicit-function-declaration]
make[3]: *** [drivers/mtd/lpddr] Error 2
make[3]: *** Waiting for unfinished jobs....

Note, I tested your patch with todays l2-mtd tree on top of this commit:

705e4ee mtd: add leading underscore to all mtd functions
Richard Weinberger - Feb. 2, 2012, 9:11 a.m.
On 02.02.2012 10:07, Artem Bityutskiy wrote:
> On Wed, 2012-01-25 at 18:21 +0100, Richard Weinberger wrote:
>> Making the entire mtd subsystem depend on HAS_IOMEM is a bit overkill.
>> HAS_IOMEM is only needed for real devices drivers.
>> nandsim and friends are perfectly usable on systems without IO memory.
>>
>> I'm my case I'm using nandsim on UML to do some UBI and JFFS2 development.
>>
>> Signed-off-by: Richard Weinberger<richard@nod.at>
>
> Could you please work on this patch some more and make sure it does not
> break s390 build (it does now).

Sure!

> Download the s390 cross-compiler from here:
> http://kernel.org/pub/tools/crosstool/files/bin/
>
> I used this one:
> http://kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.0/x86_64-gcc-4.6.0-nolibc_s390x-linux.tar.bz2
>
> I built the kernel with arch/s390/defconfig - it is out of date a bit,
> but the kernel compiles with it.
>
> Then I applied your patch and enabled all the available MTD options and
> failed to build it. I've attached this .config file. Here is the command
> line I used to build the kernel for s390x:
>
> $ make ARCH=s390 CROSS_COMPILE=s390x-linux-
> O=/home/dedekind/space/kernel-builds/l2-mtd-s390 -j16
>
> The .config was put to /home/dedekind/space/kernel-builds/l2-mtd-s390,
> obviously, and the path to the s390x-linux-* tools were in my PATH
> environment variable.
>
> There many errors, here is just one example:
>
> make[4]: *** [drivers/mtd/lpddr/lpddr_cmds.o] Error 1
> /home/dedekind/git/l2-mtd/include/linux/mtd/map.h:407:3: error: implicit declaration of function 'memcpy_fromio' [-Werror=implicit-function-declaration]
> make[3]: *** [drivers/mtd/lpddr] Error 2
> make[3]: *** Waiting for unfinished jobs....

Okay, S390 does not have memcpy_fromio(). :-\

Thanks,
//richard

Patch

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 1be6218..bfbd62c 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -1,6 +1,5 @@ 
 menuconfig MTD
 	tristate "Memory Technology Device (MTD) support"
-	depends on HAS_IOMEM
 	help
 	  Memory Technology Devices are flash, RAM and similar chips, often
 	  used for solid state file systems on embedded devices. This option
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 37b05c3..8d3dac4 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -1,5 +1,6 @@ 
 menu "Self-contained MTD device drivers"
 	depends on MTD!=n
+	depends on HAS_IOMEM
 
 config MTD_PMC551
 	tristate "Ramix PMC551 PCI Mezzanine RAM card support"
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 6c5c431..8af67cf 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -1,5 +1,6 @@ 
 menu "Mapping drivers for chip access"
 	depends on MTD!=n
+	depends on HAS_IOMEM
 
 config MTD_COMPLEX_MAPPINGS
 	bool "Support non-linear mappings of flash chips"
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 31b034b..80de7b3 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -246,6 +246,7 @@  config MTD_NAND_BCM_UMI_HWCS
 config MTD_NAND_DISKONCHIP
 	tristate "DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplementation) (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
+	depends on HAS_IOMEM
 	select REED_SOLOMON
 	select REED_SOLOMON_DEC16
 	help
@@ -431,6 +432,7 @@  config MTD_NAND_GPMI_NAND
 
 config MTD_NAND_PLATFORM
 	tristate "Support for generic platform NAND driver"
+	depends on HAS_IOMEM
 	help
 	  This implements a generic NAND driver for on-SOC platform
 	  devices. You will need to provide platform-specific functions
diff --git a/drivers/mtd/onenand/Kconfig b/drivers/mtd/onenand/Kconfig
index 772ad29..91467bb 100644
--- a/drivers/mtd/onenand/Kconfig
+++ b/drivers/mtd/onenand/Kconfig
@@ -1,6 +1,7 @@ 
 menuconfig MTD_ONENAND
 	tristate "OneNAND Device Support"
 	depends on MTD
+	depends on HAS_IOMEM
 	help
 	  This enables support for accessing all type of OneNAND flash
 	  devices. For further information see