[ARM] Kirkwood: rationalize NAND setup a bit

Common resource and platform device structures are moved to common.c
and only the partition table and chip delay remains a per board
parameter.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
This commit is contained in:
Nicolas Pitre 2009-06-01 15:36:36 -04:00
parent a88656553d
commit fb7b2d3f0d
6 changed files with 43 additions and 91 deletions

View File

@ -16,6 +16,7 @@
#include <linux/mv643xx_eth.h>
#include <linux/mv643xx_i2c.h>
#include <linux/ata_platform.h>
#include <linux/mtd/nand.h>
#include <linux/spi/orion_spi.h>
#include <net/dsa.h>
#include <asm/page.h>
@ -257,6 +258,42 @@ void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
}
/*****************************************************************************
* NAND flash
****************************************************************************/
static struct resource kirkwood_nand_resource = {
.flags = IORESOURCE_MEM,
.start = KIRKWOOD_NAND_MEM_PHYS_BASE,
.end = KIRKWOOD_NAND_MEM_PHYS_BASE +
KIRKWOOD_NAND_MEM_SIZE - 1,
};
static struct orion_nand_data kirkwood_nand_data = {
.cle = 0,
.ale = 1,
.width = 8,
};
static struct platform_device kirkwood_nand_flash = {
.name = "orion_nand",
.id = -1,
.dev = {
.platform_data = &kirkwood_nand_data,
},
.resource = &kirkwood_nand_resource,
.num_resources = 1,
};
void __init kirkwood_nand_init(struct mtd_partition *parts, int nr_parts,
int chip_delay)
{
kirkwood_nand_data.parts = parts;
kirkwood_nand_data.nr_parts = nr_parts;
kirkwood_nand_data.chip_delay = chip_delay;
platform_device_register(&kirkwood_nand_flash);
}
/*****************************************************************************
* SoC RTC
****************************************************************************/

View File

@ -15,6 +15,7 @@ struct dsa_platform_data;
struct mv643xx_eth_platform_data;
struct mv_sata_platform_data;
struct mvsdio_platform_data;
struct mtd_partition;
/*
* Basic Kirkwood init functions used early by machine-setup.
@ -40,9 +41,11 @@ void kirkwood_spi_init(void);
void kirkwood_i2c_init(void);
void kirkwood_uart0_init(void);
void kirkwood_uart1_init(void);
void kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, int delay);
extern int kirkwood_tclk;
extern struct sys_timer kirkwood_timer;
#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
#endif

View File

@ -11,14 +11,12 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/ata_platform.h>
#include <linux/mv643xx_eth.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <mach/kirkwood.h>
#include <plat/orion_nand.h>
#include <plat/mvsdio.h>
#include "common.h"
#include "mpp.h"
@ -39,32 +37,6 @@ static struct mtd_partition db88f6281_nand_parts[] = {
},
};
static struct resource db88f6281_nand_resource = {
.flags = IORESOURCE_MEM,
.start = KIRKWOOD_NAND_MEM_PHYS_BASE,
.end = KIRKWOOD_NAND_MEM_PHYS_BASE +
KIRKWOOD_NAND_MEM_SIZE - 1,
};
static struct orion_nand_data db88f6281_nand_data = {
.parts = db88f6281_nand_parts,
.nr_parts = ARRAY_SIZE(db88f6281_nand_parts),
.cle = 0,
.ale = 1,
.width = 8,
.chip_delay = 25,
};
static struct platform_device db88f6281_nand_flash = {
.name = "orion_nand",
.id = -1,
.dev = {
.platform_data = &db88f6281_nand_data,
},
.resource = &db88f6281_nand_resource,
.num_resources = 1,
};
static struct mv643xx_eth_platform_data db88f6281_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(8),
};
@ -92,13 +64,12 @@ static void __init db88f6281_init(void)
kirkwood_init();
kirkwood_mpp_conf(db88f6281_mpp_config);
kirkwood_nand_init(ARRAY_AND_SIZE(db88f6281_nand_parts), 25);
kirkwood_ehci_init();
kirkwood_ge00_init(&db88f6281_ge00_data);
kirkwood_sata_init(&db88f6281_sata_data);
kirkwood_uart0_init();
kirkwood_sdio_init(&db88f6281_mvsdio_data);
platform_device_register(&db88f6281_nand_flash);
}
static int __init db88f6281_pci_init(void)

View File

@ -11,8 +11,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/ata_platform.h>
#include <linux/mv643xx_eth.h>
#include <linux/spi/flash.h>

View File

@ -12,7 +12,6 @@
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/irq.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/ata_platform.h>
#include <linux/mv643xx_eth.h>
@ -22,7 +21,6 @@
#include <asm/mach/arch.h>
#include <mach/kirkwood.h>
#include <plat/mvsdio.h>
#include <plat/orion_nand.h>
#include "common.h"
#include "mpp.h"
@ -42,32 +40,6 @@ static struct mtd_partition rd88f6281_nand_parts[] = {
},
};
static struct resource rd88f6281_nand_resource = {
.flags = IORESOURCE_MEM,
.start = KIRKWOOD_NAND_MEM_PHYS_BASE,
.end = KIRKWOOD_NAND_MEM_PHYS_BASE +
KIRKWOOD_NAND_MEM_SIZE - 1,
};
static struct orion_nand_data rd88f6281_nand_data = {
.parts = rd88f6281_nand_parts,
.nr_parts = ARRAY_SIZE(rd88f6281_nand_parts),
.cle = 0,
.ale = 1,
.width = 8,
.chip_delay = 25,
};
static struct platform_device rd88f6281_nand_flash = {
.name = "orion_nand",
.id = -1,
.dev = {
.platform_data = &rd88f6281_nand_data,
},
.resource = &rd88f6281_nand_resource,
.num_resources = 1,
};
static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_NONE,
.speed = SPEED_1000,
@ -114,6 +86,7 @@ static void __init rd88f6281_init(void)
kirkwood_init();
kirkwood_mpp_conf(rd88f6281_mpp_config);
kirkwood_nand_init(ARRAY_AND_SIZE(rd88f6281_nand_parts), 25);
kirkwood_ehci_init();
kirkwood_ge00_init(&rd88f6281_ge00_data);
@ -129,8 +102,6 @@ static void __init rd88f6281_init(void)
kirkwood_sata_init(&rd88f6281_sata_data);
kirkwood_sdio_init(&rd88f6281_mvsdio_data);
kirkwood_uart0_init();
platform_device_register(&rd88f6281_nand_flash);
}
static int __init rd88f6281_pci_init(void)

View File

@ -11,7 +11,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/mv643xx_eth.h>
#include <linux/gpio.h>
@ -20,7 +19,6 @@
#include <asm/mach/arch.h>
#include <mach/kirkwood.h>
#include <plat/mvsdio.h>
#include <plat/orion_nand.h>
#include "common.h"
#include "mpp.h"
@ -40,32 +38,6 @@ static struct mtd_partition sheevaplug_nand_parts[] = {
},
};
static struct resource sheevaplug_nand_resource = {
.flags = IORESOURCE_MEM,
.start = KIRKWOOD_NAND_MEM_PHYS_BASE,
.end = KIRKWOOD_NAND_MEM_PHYS_BASE +
KIRKWOOD_NAND_MEM_SIZE - 1,
};
static struct orion_nand_data sheevaplug_nand_data = {
.parts = sheevaplug_nand_parts,
.nr_parts = ARRAY_SIZE(sheevaplug_nand_parts),
.cle = 0,
.ale = 1,
.width = 8,
.chip_delay = 25,
};
static struct platform_device sheevaplug_nand_flash = {
.name = "orion_nand",
.id = -1,
.dev = {
.platform_data = &sheevaplug_nand_data,
},
.resource = &sheevaplug_nand_resource,
.num_resources = 1,
};
static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(0),
};
@ -111,6 +83,7 @@ static void __init sheevaplug_init(void)
kirkwood_mpp_conf(sheevaplug_mpp_config);
kirkwood_uart0_init();
kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
if (gpio_request(29, "USB Power Enable") != 0 ||
gpio_direction_output(29, 1) != 0)
@ -120,7 +93,6 @@ static void __init sheevaplug_init(void)
kirkwood_ge00_init(&sheevaplug_ge00_data);
kirkwood_sdio_init(&sheevaplug_mvsdio_data);
platform_device_register(&sheevaplug_nand_flash);
platform_device_register(&sheevaplug_leds);
}