9
0
Fork 0

resource: introduce add_cfi_device to register simple cfi device

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2011-07-22 12:47:45 +08:00
parent 826708d5d8
commit 166388bcf6
20 changed files with 35 additions and 140 deletions

View File

@ -50,8 +50,7 @@ static int at91rm9200ek_devices_init(void)
at91_add_device_sdram(64 * 1024 * 1024);
at91_add_device_eth(&ether_pdata);
add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 0,
IORESOURCE_MEM, NULL);
add_cfi_flash_device(0, AT91_CHIPSELECT_0, 0, 0);
#if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD)
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");

View File

@ -120,8 +120,7 @@ static int at91sam9263ek_devices_init(void)
at91_add_device_sdram(64 * 1024 * 1024);
ek_add_device_nand();
at91_add_device_eth(&macb_pdata);
add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 8 * 1024 * 1024,
IORESOURCE_MEM, NULL);
add_cfi_flash_device(0, AT91_CHIPSELECT_0, 8 * 1024 * 1024, 0);
ek_add_device_mci();
#if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD)

View File

@ -38,13 +38,6 @@
* Up to 32MiB NOR type flash, connected to
* CS line 6, data width is 16 bit
*/
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0x60000000,
.size = EDB93XX_CFI_FLASH_SIZE,
};
static struct device_d eth_dev = {
.id = -1,
.name = "ep93xx_eth",
@ -54,7 +47,7 @@ static int ep93xx_devices_init(void)
{
struct device_d *sdram_dev;
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0x60000000, EDB93XX_CFI_FLASH_SIZE, 0);
/*
* Create partitions that should be

View File

@ -48,21 +48,6 @@
#include <mach/iomux-mx27.h>
#include <mach/devices-imx27.h>
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0xC0000000,
.size = 32 * 1024 * 1024,
};
#ifdef CONFIG_EUKREA_CPUIMX27_NOR_64MB
static struct device_d cfi_dev1 = {
.id = -1,
.name = "cfi_flash",
.map_base = 0xC2000000,
.size = 32 * 1024 * 1024,
};
#endif
#if defined CONFIG_EUKREA_CPUIMX27_SDRAM_256MB
#define SDRAM0 256
#elif defined CONFIG_EUKREA_CPUIMX27_SDRAM_128MB
@ -254,9 +239,9 @@ static int eukrea_cpuimx27_devices_init(void)
for (i = 0; i < ARRAY_SIZE(mode); i++)
imx_gpio_mode(mode[i]);
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
#ifdef CONFIG_EUKREA_CPUIMX27_NOR_64MB
register_device(&cfi_dev1);
add_cfi_flash_device(-1, 0xC2000000, 32 * 1024 * 1024, 0);
#endif
imx27_add_nand(&nand_info);
sdram_dev = add_mem_device("ram0", 0xa0000000, SDRAM0 * 1024 * 1024,

View File

@ -59,13 +59,6 @@
#define MX35PDK_BOARD_REV_1 0
#define MX35PDK_BOARD_REV_2 1
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = IMX_CS0_BASE,
.size = 64 * 1024 * 1024,
};
static struct fec_platform_data fec_info = {
.xcv_type = MII100,
.phy_addr = 0x1F,
@ -170,7 +163,7 @@ static int f3s_devices_init(void)
* This platform supports NOR and NAND
*/
imx35_add_nand(&nand_info);
register_device(&cfi_dev);
add_cfi_flash_device(-1, IMX_CS0_BASE, 64 * 1024 * 1024, 0);
switch ((reg >> 25) & 0x3) {
case 0x01: /* NAND is the source */

View File

@ -41,13 +41,6 @@
#define MX21ADS_IO_REG 0xCC800000
#define MX21ADS_IO_LCDON (1 << 9)
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0xC8000000,
.size = 32 * 1024 * 1024,
};
struct imx_nand_platform_data nand_info = {
.width = 1,
.hw_ecc = 1,
@ -171,7 +164,7 @@ static int mx21ads_devices_init(void)
for (i = 0; i < ARRAY_SIZE(mode); i++)
imx_gpio_mode(mode[i]);
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0xC8000000, 32 * 1024 * 1024, 0);
sdram_dev = add_mem_device("ram0", 0xc0000000, 64 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);

View File

@ -34,13 +34,6 @@
#include <mach/iomux-mx27.h>
#include <mach/devices-imx27.h>
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0xC0000000,
.size = 32 * 1024 * 1024,
};
static struct fec_platform_data fec_info = {
.xcv_type = MII100,
.phy_addr = 1,
@ -114,7 +107,7 @@ static int mx27ads_devices_init(void)
for (i = 0; i < ARRAY_SIZE(mode); i++)
imx_gpio_mode(mode[i]);
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
sdram_dev = add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);

View File

@ -54,8 +54,7 @@ static int mmccpu_devices_init(void)
at91_add_device_sdram(128 * 1024 * 1024);
at91_add_device_eth(&macb_pdata);
add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 0,
IORESOURCE_MEM, NULL);
add_cfi_flash_device(0, AT91_CHIPSELECT_0, 0, 0);
devfs_add_partition("nor0", 0x00000, 256 * 1024, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x40000, 128 * 1024, PARTITION_FIXED, "env0");

View File

@ -30,13 +30,6 @@
#include <generated/mach-types.h>
#include <mach/netx-eth.h>
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0xC0000000,
.size = 32 * 1024 * 1024,
};
struct netx_eth_platform_data eth0_data = {
.xcno = 0,
};
@ -60,7 +53,7 @@ static struct device_d netx_eth_dev1 = {
static int netx_devices_init(void) {
struct device_d *sdram_dev;
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
sdram_dev = add_mem_device("ram0", 0x80000000, 64 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);

View File

@ -39,17 +39,6 @@
#include <mach/imx-nand.h>
#include <mach/devices-imx31.h>
/*
* Up to 32MiB NOR type flash, connected to
* CS line 0, data width is 16 bit
*/
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = IMX_CS0_BASE,
.size = 32 * 1024 * 1024, /* area size */
};
/*
* SMSC 9217 network controller
* connected to CS line 1 and interrupt line
@ -227,7 +216,11 @@ static int imx31_devices_init(void)
__REG(CSCR_L(5)) = 0x444A0301;
__REG(CSCR_A(5)) = 0x44443302;
register_device(&cfi_dev);
/*
* Up to 32MiB NOR type flash, connected to
* CS line 0, data width is 16 bit
*/
add_cfi_flash_device(-1, IMX_CS0_BASE, 32 * 1024 * 1024, 0);
/*
* Create partitions that should be

View File

@ -47,13 +47,6 @@
#include "pll.h"
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0xC0000000,
.size = 32 * 1024 * 1024,
};
static struct fec_platform_data fec_info = {
.xcv_type = MII100,
.phy_addr = 1,
@ -267,7 +260,7 @@ static int pcm038_devices_init(void)
spi_register_board_info(pcm038_spi_board_info, ARRAY_SIZE(pcm038_spi_board_info));
imx27_add_spi0(&pcm038_spi_0_data);
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
imx27_add_nand(&nand_info);
sdram_dev = add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);

View File

@ -46,17 +46,6 @@
#include <mach/iomux-mx35.h>
#include <mach/devices-imx35.h>
/*
* Up to 32MiB NOR type flash, connected to
* CS line 0, data width is 16 bit
*/
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = IMX_CS0_BASE,
.size = 32 * 1024 * 1024, /* area size */
};
static struct fec_platform_data fec_info = {
.xcv_type = MII100,
};
@ -158,7 +147,11 @@ static int imx35_devices_init(void)
* This platform supports NOR and NAND
*/
imx35_add_nand(&nand_info);
register_device(&cfi_dev);
/*
* Up to 32MiB NOR type flash, connected to
* CS line 0, data width is 16 bit
*/
add_cfi_flash_device(-1, IMX_CS0_BASE, 32 * 1024 * 1024, 0);
if ((reg & 0xc00) == 0x800) { /* reset mode: external boot */
switch ( (reg >> 25) & 0x3) {

View File

@ -151,8 +151,7 @@ static int pm9261_devices_init(void)
{
at91_add_device_sdram(64 * 1024 * 1024);
pm_add_device_nand();
add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 4 * 1024 * 1024,
IORESOURCE_MEM, NULL);
add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
devfs_add_partition("nor0", 0x40000, 0x10000, PARTITION_FIXED, "env0");

View File

@ -104,8 +104,7 @@ static int pm9263_devices_init(void)
at91_add_device_sdram(64 * 1024 * 1024);
pm_add_device_nand();
at91_add_device_eth(&macb_pdata);
add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 4 * 1024 * 1024,
IORESOURCE_MEM, NULL);
add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x40000, 0x10000, PARTITION_FIXED, "env0");

View File

@ -33,14 +33,6 @@
#include <dm9000.h>
#include <led.h>
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0x10000000,
.size = 16 * 1024 * 1024,
};
static struct dm9000_platform_data dm9000_data = {
.buswidth = DM9000_WIDTH_16,
.srom = 1,
@ -110,7 +102,7 @@ static int scb9328_devices_init(void)
CS5U = 0x00008400;
CS5L = 0x00000D03;
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0x10000000, 16 * 1024 * 1024, 0);
sdram_dev = add_mem_device("ram0", 0x08000000, 16 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);

View File

@ -33,13 +33,6 @@
#include <partition.h>
#include <sizes.h>
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = VERSATILE_FLASH_BASE,
.size = VERSATILE_FLASH_SIZE,
};
static int vpb_console_init(void)
{
versatile_register_uart(0);
@ -58,7 +51,7 @@ static int vpb_devices_init(void)
{
versatile_add_sdram(64 * 1024 *1024);
register_device(&cfi_dev);
add_cfi_flash_device(-1, VERSATILE_FLASH_BASE, VERSATILE_FLASH_SIZE, 0);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");

View File

@ -5,13 +5,6 @@
#include <partition.h>
#include <fs.h>
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0x20000000,
.size = 32 * 1024 * 1024,
};
static struct device_d smc911x_dev = {
.id = -1,
.name = "smc911x",
@ -20,7 +13,7 @@ static struct device_d smc911x_dev = {
};
static int ipe337_devices_init(void) {
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0x20000000, 32 * 1024 * 1024, 0);
add_mem_device("ram0", 0x0, 128 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);

View File

@ -4,13 +4,6 @@
#include <partition.h>
#include <fs.h>
static struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = NIOS_SOPC_FLASH_BASE,
.size = NIOS_SOPC_FLASH_SIZE,
};
static int phy_address = 1;
static struct device_d mac_dev = {
@ -37,7 +30,7 @@ static struct device_d epcs_flash_device = {
static int generic_devices_init(void)
{
register_device(&cfi_dev);
add_cfi_flash_device(-1, NIOS_SOPC_FLASH_BASE, NIOS_SOPC_FLASH_SIZE, 0);
add_mem_device("ram0", NIOS_SOPC_MEMORY_BASE, NIOS_SOPC_MEMORY_SIZE,
IORESOURCE_MEM_WRITEABLE);
register_device(&mac_dev);

View File

@ -37,13 +37,6 @@
#include <mem_malloc.h>
#include <reloc.h>
struct device_d cfi_dev = {
.id = -1,
.name = "cfi_flash",
.map_base = 0xff000000,
.size = 16 * 1024 * 1024,
};
static struct mpc5xxx_fec_platform_data fec_info = {
.xcv_type = MII100,
};
@ -57,7 +50,7 @@ struct device_d eth_dev = {
static int devices_init (void)
{
register_device(&cfi_dev);
add_cfi_flash_device(-1, 0xff000000, 16 * 1024 * 1024, 0);
add_mem_device("ram0", 0x0, 64 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
register_device(&eth_dev);

View File

@ -220,6 +220,13 @@ static inline struct device_d *add_mem_device(const char *name, resource_size_t
IORESOURCE_MEM | flags, NULL);
}
static inline struct device_d *add_cfi_flash_device(int id, resource_size_t start,
resource_size_t size, unsigned int flags)
{
return add_generic_device("cfi_flash", id, NULL, start, size,
IORESOURCE_MEM | flags, NULL);
}
/* linear list over all available devices
*/
extern struct list_head device_list;