pxa/colibri270: Refactor board definition file
Subsystems (3)
PATCH 1/4 pxa/colibri270: Refactor board definition file
This patch just moves code around and polishes it. Also, compile in only selected pieces of hardware.
--- arch/arm/mach-pxa/colibri-pxa270.c | 69 ++++++++++++++++++------------ arch/arm/mach-pxa/include/mach/colibri.h | 9 +--- 2 files changed, 43 insertions(+), 35 deletions(-)
arch/arm/mach-pxa/colibri-pxa270.c +41 -28
@@ -3,6 +3,7 @@* * Support for Toradex PXA270 based Colibri module * Daniel Mack <[email protected]> +* Marek Vasut <[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
@@ -36,23 +37,25 @@#include "generic.h" #include "devices.h" -/* -* GPIO configuration -*/ +/****************************************************************************** +* Pin configuration +******************************************************************************/ static mfp_cfg_t colibri_pxa270_pin_config[]__initdata = { +/* Ethernet */ GPIO78_nCS_2,/* Ethernet CS */ GPIO114_GPIO ,/* Ethernet IRQ */ }; -/* -* NOR flash -*/ +/****************************************************************************** +* NOR Flash +******************************************************************************/ +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) static struct mtd_partition colibri_partitions[] = { { .name = "Bootloader", .offset = 0x00000000, .size = 0x00040000, - .mask_flags =MTD_WRITEABLE /* force read-only */ + .mask_flags = MTD_WRITEABLE /* force read-only */ }, { .name = "Kernel", .offset = 0x00040000,
@@ -90,42 +93,50 @@ static struct platform_device colibri_pxa270_flash_device = { .num_resources = 1, }; -/* -* DM9000 Ethernet -*/ -#if defined(CONFIG_DM9000 ) -static struct resource dm9000_resources[] = { +static void __init colibri_pxa270_nor_init (void ) +{ +platform_device_register (&colibri_pxa270_flash); +} +#else +static inline void colibri_pxa270_nor_init (void ) {} +#endif + +/****************************************************************************** +* Ethernet +******************************************************************************/ +#if defined(CONFIG_DM9000 ) || defined(CONFIG_DM9000_MODULE ) +static struct resource colibri_pxa270_dm9000_resources[] = { [0 ] = { - .start =COLIBRI_PXA270_ETH_PHYS , - .end =COLIBRI_PXA270_ETH_PHYS +3 , + .start =PXA_CS2_PHYS , + .end =PXA_CS2_PHYS +3 , .flags =IORESOURCE_MEM , }, [1 ] = { - .start =COLIBRI_PXA270_ETH_PHYS +4 , - .end =COLIBRI_PXA270_ETH_PHYS +4 +500 , + .start =PXA_CS2_PHYS +4 , + .end =PXA_CS2_PHYS +4 +500 , .flags =IORESOURCE_MEM , }, [2 ] = { - .start =COLIBRI_PXA270_ETH_IRQ , - .end =COLIBRI_PXA270_ETH_IRQ , + .start =gpio_to_irq (GPIO114_COLIBRI_PXA270_ETH_IRQ ), + .end =gpio_to_irq (GPIO114_COLIBRI_PXA270_ETH_IRQ ), .flags =IORESOURCE_IRQ |IRQF_TRIGGER_RISING , }, }; -static struct platform_device dm9000_device = { +static struct platform_device colibri_pxa270_dm9000_device = { .name ="dm9000" , .id =-1 , - .num_resources =ARRAY_SIZE (dm9000_resources), - .resource = dm9000_resources, + .num_resources =ARRAY_SIZE (colibri_pxa270_dm9000_resources), + .resource = colibri_pxa270_dm9000_resources, }; -#endif /* CONFIG_DM9000 */ -static struct platform_device *colibri_pxa270_devices[]__initdata = { - &colibri_pxa270_flash_device, -#if defined(CONFIG_DM9000) - &dm9000_device, +static void __init colibri_pxa270_eth_init (void ) +{ +platform_device_register (&colibri_pxa270_dm9000_device); +} +#else +static inline void colibri_pxa270_eth_init (void ) {}#endif -};static void __init colibri_pxa270_init (void ) {
@@ -133,7 +144,9 @@ static void __init colibri_pxa270_init(void)pxa_set_ffuart_info (NULL );pxa_set_btuart_info (NULL );pxa_set_stuart_info (NULL ); -platform_add_devices (ARRAY_AND_SIZE (colibri_pxa270_devices)); + +colibri_pxa270_nor_init (); +colibri_pxa270_eth_init (); }MACHINE_START (COLIBRI ,"Toradex Colibri PXA270" )
arch/arm/mach-pxa/include/mach/colibri.h +2 -7
@@ -32,13 +32,8 @@ static inline void colibri_pxa3xx_init_nand(void) {}/* physical memory regions */ #define COLIBRI_SDRAM_BASE 0xa0000000/* SDRAM region */ -/* definitions for Colibri PXA270 */ - -#define COLIBRI_PXA270_FLASH_PHYS (PXA_CS0_PHYS)/* Flash region */ -#define COLIBRI_PXA270_ETH_PHYS (PXA_CS2_PHYS)/* Ethernet */ -#define COLIBRI_PXA270_ETH_IRQ_GPIO 114 -#define COLIBRI_PXA270_ETH_IRQ \ - gpio_to_irq(mfp_to_gpio(COLIBRI_PXA270_ETH_IRQ_GPIO)) +/* GPIO definitions for Colibri PXA270 */ +#define GPIO114_COLIBRI_PXA270_ETH_IRQ 114#endif /* _COLIBRI_H_ */
Signature · 1 line
1.7.0
PATCH 2/4 pxa/colibri270: Add MMC support
--- arch/arm/mach-pxa/colibri-pxa270.c | 31 ++++++++++++++++++++++++++++++ arch/arm/mach-pxa/include/mach/colibri.h | 1 + 2 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/colibri-pxa270.c +31 -0
@@ -33,6 +33,7 @@#include <mach/pxa27x.h> #include <mach/colibri.h> +#include <mach/mmc.h> #include "generic.h" #include "devices.h"
@@ -44,6 +45,15 @@ static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {/* Ethernet */ GPIO78_nCS_2,/* Ethernet CS */ GPIO114_GPIO ,/* Ethernet IRQ */ + +/* MMC */ +GPIO32_MMC_CLK , +GPIO92_MMC_DAT_0 , +GPIO109_MMC_DAT_1 , +GPIO110_MMC_DAT_2 , +GPIO111_MMC_DAT_3 , +GPIO112_MMC_CMD , + GPIO0_GPIO, /* SD detect */ };/******************************************************************************
@@ -138,6 +148,26 @@ static void __init colibri_pxa270_eth_init(void)static inline void colibri_pxa270_eth_init (void ) {}#endif +/****************************************************************************** +* SD/MMC card controller +******************************************************************************/ +#if defined(CONFIG_MMC_PXA ) || defined(CONFIG_MMC_PXA_MODULE ) +static struct pxamci_platform_data colibri_pxa270_mci_platform_data = { + .ocr_mask =MMC_VDD_32_33 |MMC_VDD_33_34 , + .gpio_power =-1 , + .gpio_card_detect =GPIO0_COLIBRI_PXA270_SD_DETECT , + .gpio_card_ro =-1 , + .detect_delay_ms =200 , +}; + +static void __init colibri_pxa270_mmc_init (void ) +{ +pxa_set_mci_info (&colibri_pxa270_mci_platform_data); +} +#else +static inline void colibri_pxa270_mmc_init (void ) {} +#endif +static void __init colibri_pxa270_init (void ) {pxa2xx_mfp_config (ARRAY_AND_SIZE (colibri_pxa270_pin_config));
@@ -147,6 +177,7 @@ static void __init colibri_pxa270_init(void)colibri_pxa270_nor_init ();colibri_pxa270_eth_init (); +colibri_pxa270_mmc_init (); }MACHINE_START (COLIBRI ,"Toradex Colibri PXA270" )
arch/arm/mach-pxa/include/mach/colibri.h +1 -0
@@ -34,6 +34,7 @@ static inline void colibri_pxa3xx_init_nand(void) {}/* GPIO definitions for Colibri PXA270 */ #define GPIO114_COLIBRI_PXA270_ETH_IRQ 114 +#define GPIO0_COLIBRI_PXA270_SD_DETECT 0#endif /* _COLIBRI_H_ */
Signature · 1 line
1.7.0
PATCH 2/4 pxa/colibri270: Add MMC support
Quoted 1 line · Marek Vasut
Signed-off-by Marek Vasut <[email protected]>
The rest of this set also looks ok to me.
For the future, we should think about having a modularized aproach for these modules just like some mx31 boards have. We would need to split resources on the module from such on the baseboard, so peope can easily add support for a custom base board without touching the module code.
Daniel
Quoted 83 lines
--- arch/arm/mach-pxa/colibri-pxa270.c | 31 ++++++++++++++++++++++++++++++ arch/arm/mach-pxa/include/mach/colibri.h | 1 + 2 files changed, 32 insertions(+), 0 deletions(-)arch/arm/mach-pxa/colibri-pxa270.c +31
-0@@ -33,6 +33,7 @@#include <mach/pxa27x.h> #include <mach/colibri.h> +#include <mach/mmc.h> #include "generic.h" #include "devices.h" @@ -44,6 +45,15 @@ static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {/* Ethernet */ GPIO78_nCS_2,/* Ethernet CS */ GPIO114_GPIO ,/* Ethernet IRQ */ + +/* MMC */ +GPIO32_MMC_CLK , +GPIO92_MMC_DAT_0 , +GPIO109_MMC_DAT_1 , +GPIO110_MMC_DAT_2 , +GPIO111_MMC_DAT_3 , +GPIO112_MMC_CMD , + GPIO0_GPIO, /* SD detect */ };/****************************************************************************** @@ -138,6 +148,26 @@ static void __init colibri_pxa270_eth_init(void)static inline void colibri_pxa270_eth_init (void ) {}#endif +/****************************************************************************** +* SD/MMC card controller +******************************************************************************/ +#if defined(CONFIG_MMC_PXA ) || defined(CONFIG_MMC_PXA_MODULE ) +static struct pxamci_platform_data colibri_pxa270_mci_platform_data = { + .ocr_mask =MMC_VDD_32_33 |MMC_VDD_33_34 , + .gpio_power =-1 , + .gpio_card_detect =GPIO0_COLIBRI_PXA270_SD_DETECT , + .gpio_card_ro =-1 , + .detect_delay_ms =200 , +}; + +static void __init colibri_pxa270_mmc_init (void ) +{ +pxa_set_mci_info (&colibri_pxa270_mci_platform_data); +} +#else +static inline void colibri_pxa270_mmc_init (void ) {} +#endif +static void __init colibri_pxa270_init (void ) {pxa2xx_mfp_config (ARRAY_AND_SIZE (colibri_pxa270_pin_config));@@ -147,6 +177,7 @@ static void __init colibri_pxa270_init(void)colibri_pxa270_nor_init ();colibri_pxa270_eth_init (); +colibri_pxa270_mmc_init (); }MACHINE_START (COLIBRI ,"Toradex Colibri PXA270" )arch/arm/mach-pxa/include/mach/colibri.h +1
-0@@ -34,6 +34,7 @@ static inline void colibri_pxa3xx_init_nand(void) {}/* GPIO definitions for Colibri PXA270 */ #define GPIO114_COLIBRI_PXA270_ETH_IRQ 114 +#define GPIO0_COLIBRI_PXA270_SD_DETECT 0#endif /* _COLIBRI_H_ */ Signature · 1 line
1.7.0
PATCH 2/4 pxa/colibri270: Add MMC support
Quoted 10 lines · Daniel Mack
Quoted 1 line · Marek Vasut
Signed-off-by Marek Vasut <[email protected]>The rest of this set also looks ok to me.
For the future, we should think about having a modularized aproach for these modules just like some mx31 boards have. We would need to split resources on the module from such on the baseboard, so peope can easily add support for a custom base board without touching the module code.
Daniel,
So Ack for this patch or not?
PATCH 2/4 pxa/colibri270: Add MMC support
Quoted 12 lines · Eric Miao
Quoted 10 lines · Daniel Mack
Quoted 1 line · Marek Vasut
Signed-off-by Marek Vasut <[email protected]>The rest of this set also looks ok to me.
For the future, we should think about having a modularized aproach for these modules just like some mx31 boards have. We would need to split resources on the module from such on the baseboard, so peope can easily add support for a custom base board without touching the module code.
Quoted 3 lines
Daniel,
So Ack for this patch or not?
Yes, take my Ack for all of them. The idea I outlined is something TBD in the future :)
Thanks,
Daniel
PATCH 3/4 pxa/colibri270: Add FFUART MFP
In reply to Marek Vasut--- arch/arm/mach-pxa/colibri-pxa270.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/colibri-pxa270.c +4 -0
@@ -54,6 +54,10 @@ static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {GPIO111_MMC_DAT_3 ,GPIO112_MMC_CMD ,GPIO0_GPIO ,/* SD detect */ + +/* FFUART */ +GPIO39_FFUART_TXD , + GPIO34_FFUART_RXD, };/******************************************************************************
Signature · 1 line
1.7.0
PATCH 4/4 pxa/colibri270: Add UHC support
In reply to Marek Vasut--- arch/arm/mach-pxa/colibri-pxa270.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/colibri-pxa270.c +34 -0
@@ -34,6 +34,8 @@#include <mach/pxa27x.h> #include <mach/colibri.h> #include <mach/mmc.h> +#include <mach/ohci.h> +#include <mach/pxa27x-udc.h> #include "generic.h" #include "devices.h"
@@ -58,6 +60,12 @@ static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {/* FFUART */ GPIO39_FFUART_TXD ,GPIO34_FFUART_RXD , + +/* UHC */ +GPIO88_USBH1_PWR , +GPIO89_USBH1_PEN , +GPIO119_USBH2_PWR , + GPIO120_USBH2_PEN, };/******************************************************************************
@@ -172,6 +180,31 @@ static void __init colibri_pxa270_mmc_init(void)static inline void colibri_pxa270_mmc_init (void ) {}#endif +/****************************************************************************** +* USB Host +******************************************************************************/ +#if defined(CONFIG_USB_OHCI_HCD ) || defined(CONFIG_USB_OHCI_HCD_MODULE ) +static int colibri_pxa270_ohci_init (struct device *dev) +{ +UP2OCR =UP2OCR_HXS |UP2OCR_HXOE |UP2OCR_DPPDE |UP2OCR_DMPDE ; +return 0 ; +} + +static struct pxaohci_platform_data colibri_pxa270_ohci_info = { + .port_mode =PMM_PERPORT_MODE , + .flags =ENABLE_PORT1 |ENABLE_PORT2 | +POWER_CONTROL_LOW |POWER_SENSE_LOW , + .init = colibri_pxa270_ohci_init, +}; + +static void __init colibri_pxa270_uhc_init (void ) +{ +pxa_set_ohci_info (&colibri_pxa270_ohci_info); +} +#else +static inline void colibri_pxa270_uhc_init (void ) {} +#endif +static void __init colibri_pxa270_init (void ) {pxa2xx_mfp_config (ARRAY_AND_SIZE (colibri_pxa270_pin_config));
@@ -182,6 +215,7 @@ static void __init colibri_pxa270_init(void)colibri_pxa270_nor_init ();colibri_pxa270_eth_init ();colibri_pxa270_mmc_init (); +colibri_pxa270_uhc_init (); }MACHINE_START (COLIBRI ,"Toradex Colibri PXA270" )
Signature · 1 line
1.7.0
PATCH 1/4 pxa/colibri270: Refactor board definition file
In reply to Marek VasutQuoted 2 lines · Marek Vasut
This patch just moves code around and polishes it. Also, compile in only selected pieces of hardware.
I couldn't test this yet, but all changes look fine to me. Especially the removal of the header file macros which only have one user makes sense.
Quoted 1 line
Signed-off-by Marek Vasut <[email protected]>
Thanks,
Daniel
Quoted 155 lines
--- arch/arm/mach-pxa/colibri-pxa270.c | 69 ++++++++++++++++++------------ arch/arm/mach-pxa/include/mach/colibri.h | 9 +--- 2 files changed, 43 insertions(+), 35 deletions(-)arch/arm/mach-pxa/colibri-pxa270.c +41
-28@@ -3,6 +3,7 @@* * Support for Toradex PXA270 based Colibri module * Daniel Mack <[email protected]> +* Marek Vasut <[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 @@ -36,23 +37,25 @@#include "generic.h" #include "devices.h" -/* -* GPIO configuration -*/ +/****************************************************************************** +* Pin configuration +******************************************************************************/ static mfp_cfg_t colibri_pxa270_pin_config[]__initdata = { +/* Ethernet */ GPIO78_nCS_2,/* Ethernet CS */ GPIO114_GPIO ,/* Ethernet IRQ */ }; -/* -* NOR flash -*/ +/****************************************************************************** +* NOR Flash +******************************************************************************/ +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) static struct mtd_partition colibri_partitions[] = { { .name = "Bootloader", .offset = 0x00000000, .size = 0x00040000, - .mask_flags =MTD_WRITEABLE /* force read-only */ + .mask_flags = MTD_WRITEABLE /* force read-only */ }, { .name = "Kernel", .offset = 0x00040000,@@ -90,42 +93,50 @@ static struct platform_device colibri_pxa270_flash_device = { .num_resources = 1, }; -/* -* DM9000 Ethernet -*/ -#if defined(CONFIG_DM9000 ) -static struct resource dm9000_resources[] = { +static void __init colibri_pxa270_nor_init (void ) +{ +platform_device_register (&colibri_pxa270_flash); +} +#else +static inline void colibri_pxa270_nor_init (void ) {} +#endif + +/****************************************************************************** +* Ethernet +******************************************************************************/ +#if defined(CONFIG_DM9000 ) || defined(CONFIG_DM9000_MODULE ) +static struct resource colibri_pxa270_dm9000_resources[] = { [0 ] = { - .start =COLIBRI_PXA270_ETH_PHYS , - .end =COLIBRI_PXA270_ETH_PHYS +3 , + .start =PXA_CS2_PHYS , + .end =PXA_CS2_PHYS +3 , .flags =IORESOURCE_MEM , }, [1 ] = { - .start =COLIBRI_PXA270_ETH_PHYS +4 , - .end =COLIBRI_PXA270_ETH_PHYS +4 +500 , + .start =PXA_CS2_PHYS +4 , + .end =PXA_CS2_PHYS +4 +500 , .flags =IORESOURCE_MEM , }, [2 ] = { - .start =COLIBRI_PXA270_ETH_IRQ , - .end =COLIBRI_PXA270_ETH_IRQ , + .start =gpio_to_irq (GPIO114_COLIBRI_PXA270_ETH_IRQ ), + .end =gpio_to_irq (GPIO114_COLIBRI_PXA270_ETH_IRQ ), .flags =IORESOURCE_IRQ |IRQF_TRIGGER_RISING , }, }; -static struct platform_device dm9000_device = { +static struct platform_device colibri_pxa270_dm9000_device = { .name ="dm9000" , .id =-1 , - .num_resources =ARRAY_SIZE (dm9000_resources), - .resource = dm9000_resources, + .num_resources =ARRAY_SIZE (colibri_pxa270_dm9000_resources), + .resource = colibri_pxa270_dm9000_resources, }; -#endif /* CONFIG_DM9000 */ -static struct platform_device *colibri_pxa270_devices[]__initdata = { - &colibri_pxa270_flash_device, -#if defined(CONFIG_DM9000) - &dm9000_device, +static void __init colibri_pxa270_eth_init (void ) +{ +platform_device_register (&colibri_pxa270_dm9000_device); +} +#else +static inline void colibri_pxa270_eth_init (void ) {}#endif -};static void __init colibri_pxa270_init (void ) {@@ -133,7 +144,9 @@ static void __init colibri_pxa270_init(void)pxa_set_ffuart_info (NULL );pxa_set_btuart_info (NULL );pxa_set_stuart_info (NULL ); -platform_add_devices (ARRAY_AND_SIZE (colibri_pxa270_devices)); + +colibri_pxa270_nor_init (); +colibri_pxa270_eth_init (); }MACHINE_START (COLIBRI ,"Toradex Colibri PXA270" )arch/arm/mach-pxa/include/mach/colibri.h +2
-7@@ -32,13 +32,8 @@ static inline void colibri_pxa3xx_init_nand(void) {}/* physical memory regions */ #define COLIBRI_SDRAM_BASE 0xa0000000/* SDRAM region */ -/* definitions for Colibri PXA270 */ - -#define COLIBRI_PXA270_FLASH_PHYS (PXA_CS0_PHYS)/* Flash region */ -#define COLIBRI_PXA270_ETH_PHYS (PXA_CS2_PHYS)/* Ethernet */ -#define COLIBRI_PXA270_ETH_IRQ_GPIO 114 -#define COLIBRI_PXA270_ETH_IRQ \ - gpio_to_irq(mfp_to_gpio(COLIBRI_PXA270_ETH_IRQ_GPIO)) +/* GPIO definitions for Colibri PXA270 */ +#define GPIO114_COLIBRI_PXA270_ETH_IRQ 114#endif /* _COLIBRI_H_ */ Signature · 1 line
1.7.0
PATCH 1/4 pxa/colibri270: Refactor board definition file
In reply to Marek VasutOn Tue, May 11, 2010 at 04:26:55AM +0200, Marek Vasut wrote:
[...]
Quoted 19 lines
arch/arm/mach-pxa/colibri-pxa270.c +5
-4-/* -* NOR flash -*/ +/****************************************************************************** +* NOR Flash +******************************************************************************/ +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) static struct mtd_partition colibri_partitions[] = { { .name = "Bootloader", .offset = 0x00000000, .size = 0x00040000, - .mask_flags =MTD_WRITEABLE /* force read-only */ + .mask_flags = MTD_WRITEABLE /* force read-only */ }, { .name = "Kernel", .offset = 0x00040000,@@ -90,42 +93,50 @@ static struct platform_device colibri_pxa270_flash_device = { .num_resources = 1,
arch/arm/mach-pxa/colibri-pxa270.c static struct platform_device colibri_pxa270_flash_device = { · line 98
Quoted 10 lines
arch/arm/mach-pxa/colibri-pxa270.c +3
-5}; -/* -* DM9000 Ethernet -*/ -#if defined(CONFIG_DM9000 ) -static struct resource dm9000_resources[] = { +static void __init colibri_pxa270_nor_init (void ) +{ +platform_device_register (&colibri_pxa270_flash);
Erm ...
arch/arm/mach-pxa/colibri-pxa270.c: In function 'colibri_pxa270_nor_init':arch/arm/mach-pxa/colibri-pxa270.c:131: error: 'colibri_pxa270_flash' undeclared (first use in this function) arch/arm/mach-pxa/colibri-pxa270.c:131: error: (Each undeclared identifier is reported only once arch/arm/mach-pxa/colibri-pxa270.c:131: error: for each function it appears in.)
make[1]: *** [arch/arm/mach-pxa/colibri-pxa270.o] Error 1
make: *** [arch/arm/mach-pxa] Error 2
make: *** Waiting for unfinished jobs....
Eric, is that patch already queued?
I can send a trivial fix up - or should Marek send a new version of this patch?
Daniel
PATCH 1/4 pxa/colibri270: Refactor board definition file
Any update on this?
Quoted 55 lines · Daniel Mack
On Tue, May 11, 2010 at 04:26:55AM +0200, Marek Vasut wrote:
[...]
Quoted 19 lines
arch/arm/mach-pxa/colibri-pxa270.c +5
-4-/* -* NOR flash -*/ +/****************************************************************************** +* NOR Flash +******************************************************************************/ +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) static struct mtd_partition colibri_partitions[] = { { .name = "Bootloader", .offset = 0x00000000, .size = 0x00040000, - .mask_flags =MTD_WRITEABLE /* force read-only */ + .mask_flags = MTD_WRITEABLE /* force read-only */ }, { .name = "Kernel", .offset = 0x00040000,@@ -90,42 +93,50 @@ static struct platform_device colibri_pxa270_flash_device = { .num_resources = 1,arch/arm/mach-pxa/colibri-pxa270.c static struct platform_device colibri_pxa270_flash_device = { · line 98
Quoted 10 lines
arch/arm/mach-pxa/colibri-pxa270.c +3
-5}; -/* -* DM9000 Ethernet -*/ -#if defined(CONFIG_DM9000 ) -static struct resource dm9000_resources[] = { +static void __init colibri_pxa270_nor_init (void ) +{ +platform_device_register (&colibri_pxa270_flash);Erm ...
arch/arm/mach-pxa/colibri-pxa270.c: In function 'colibri_pxa270_nor_init':arch/arm/mach-pxa/colibri-pxa270.c:131: error: 'colibri_pxa270_flash' undeclared (first use in this function)arch/arm/mach-pxa/colibri-pxa270.c:131: error: (Each undeclared identifier is reported only oncearch/arm/mach-pxa/colibri-pxa270.c:131: error: for each function it appears in.)
make[1]: *** [arch/arm/mach-pxa/colibri-pxa270.o] Error 1
make: *** [arch/arm/mach-pxa] Error 2
make: *** Waiting for unfinished jobs....Eric, is that patch already queued?
I can send a trivial fix up - or should Marek send a new version of this patch?
Daniel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/4 pxa/colibri270: Refactor board definition file
Quoted 2 lines · Daniel Mack
Any update on this?
Fixed by using colibri_pxa270_flash_device instead, looks to be a typo to me.
Updated as below, and let me know if everyone is happy, thanks.
commit d206799c146a4377b99897af360395ea438e6f35
Author: Marek Vasut <[email protected]> Date: Tue May 11 04:26:55 2010 +0200
pxa/colibri270: Refactor board definition file
This patch just moves code around and polishes it. Also, compile in only selected pieces of hardware.
(quoted diff) +0 -0
b/arch/arm/mach-pxa/colibri-pxa270.c
index 061c453..f8b3bfb 100644
arch/arm/mach-pxa/colibri-pxa270.c +10 -7
@@ -3,6 +3,7 @@* * Support for Toradex PXA270 based Colibri module * Daniel Mack <[email protected]> +* Marek Vasut <[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
@@ -36,23 +37,25 @@#include "generic.h" #include "devices.h" -/* -* GPIO configuration -*/ +/****************************************************************************** +* Pin configuration +******************************************************************************/ static mfp_cfg_t colibri_pxa270_pin_config[]__initdata = { +/* Ethernet */ GPIO78_nCS_2,/* Ethernet CS */ GPIO114_GPIO ,/* Ethernet IRQ */ }; -/* -* NOR flash -*/ +/****************************************************************************** +* NOR Flash +******************************************************************************/ +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) static struct mtd_partition colibri_partitions[] = { { .name = "Bootloader", .offset = 0x00000000, .size = 0x00040000, - .mask_flags =MTD_WRITEABLE /* force read-only */ + .mask_flags = MTD_WRITEABLE /* force read-only */ }, { .name = "Kernel", .offset = 0x00040000,
@@ -90,42 +93,50 @@ static struct platform_device
colibri_pxa270_flash_device = {
.num_resources = 1,
};
-/*
- * DM9000 Ethernet
- */
-#if defined(CONFIG_DM9000)
-static struct resource dm9000_resources[] = {
+static void __init colibri_pxa270_nor_init(void)
+{
+ platform_device_register(&colibri_pxa270_flash_device);
+}
+#else
+static inline void colibri_pxa270_nor_init(void) {}
+#endif
+ +/******************************************************************************
+ * Ethernet
+ ******************************************************************************/ +#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
+static struct resource colibri_pxa270_dm9000_resources[] = {
[0] = {
- .start = COLIBRI_PXA270_ETH_PHYS,
- .end = COLIBRI_PXA270_ETH_PHYS + 3,
+ .start = PXA_CS2_PHYS,
+ .end = PXA_CS2_PHYS + 3,
.flags = IORESOURCE_MEM,
},
[1] = {
- .start = COLIBRI_PXA270_ETH_PHYS + 4,
- .end = COLIBRI_PXA270_ETH_PHYS + 4 + 500,
+ .start = PXA_CS2_PHYS + 4,
+ .end = PXA_CS2_PHYS + 4 + 500,
.flags = IORESOURCE_MEM,
},
[2] = {
- .start = COLIBRI_PXA270_ETH_IRQ,
- .end = COLIBRI_PXA270_ETH_IRQ,
+ .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
+ .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
},
};
-static struct platform_device dm9000_device = { +static struct platform_device colibri_pxa270_dm9000_device = {
.name = "dm9000",
.id = -1,
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
+ .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
+ .resource = colibri_pxa270_dm9000_resources,
};
-#endif /* CONFIG_DM9000 */
-static struct platform_device *colibri_pxa270_devices[] __initdata = {
- &colibri_pxa270_flash_device,
-#if defined(CONFIG_DM9000)
- &dm9000_device,
+static void __init colibri_pxa270_eth_init(void)
+{
+ platform_device_register(&colibri_pxa270_dm9000_device);
+}
+#else
+static inline void colibri_pxa270_eth_init(void) {}
#endif
-};
static void __init colibri_pxa270_init(void)
{
@@ -133,7 +144,9 @@ static void __init colibri_pxa270_init(void)
pxa_set_ffuart_info(NULL); pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL);
- platform_add_devices(ARRAY_AND_SIZE(colibri_pxa270_devices));
+
+ colibri_pxa270_nor_init();
+ colibri_pxa270_eth_init();
}
MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
(quoted diff) +0 -0
b/arch/arm/mach-pxa/include/mach/colibri.h
index 5f2ba8d..9e47e1f 100644
arch/arm/mach-pxa/include/mach/colibri.h +2 -7
@@ -33,13 +33,8 @@ static inline void colibri_pxa3xx_init_nand(void) {}/* physical memory regions */ #define COLIBRI_SDRAM_BASE 0xa0000000/* SDRAM region */ -/* definitions for Colibri PXA270 */ - -#define COLIBRI_PXA270_FLASH_PHYS (PXA_CS0_PHYS)/* Flash region */ -#define COLIBRI_PXA270_ETH_PHYS (PXA_CS2_PHYS)/* Ethernet */ -#define COLIBRI_PXA270_ETH_IRQ_GPIO 114 -#define COLIBRI_PXA270_ETH_IRQ \ - gpio_to_irq(mfp_to_gpio(COLIBRI_PXA270_ETH_IRQ_GPIO)) +/* GPIO definitions for Colibri PXA270 */ +#define GPIO114_COLIBRI_PXA270_ETH_IRQ 114#endif /* _COLIBRI_H_ */