Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16bcf78f authored by Hartley Sweeten's avatar Hartley Sweeten Committed by Russell King
Browse files

ARM: 6168/1: ep93xx: move physmap flash registration into core.c



Create a core.c __init function to handle the physmap flash
registration for all the ep93xx platforms.  Also, modify all
the ep93xx platforms to use this new function.

This simplifies all the ep93xx platform init code and reduces
the size of the kernel when including multiple ep93xx boards.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: default avatarRyan Mallon <ryan@bluewatersys.com>
Acked-by: default avatarMartin Guy <martinwguy@gmail.com>
Acked-by: default avatarHubert Feurstein <hubert.feurstein@contec.at>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 6ea4b741
Loading
Loading
Loading
Loading
+1 −23
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/physmap.h>

#include <mach/hardware.h>

@@ -21,26 +20,6 @@
#include <asm/mach/arch.h>


static struct physmap_flash_data adssphere_flash_data = {
	.width		= 4,
};

static struct resource adssphere_flash_resource = {
	.start		= EP93XX_CS6_PHYS_BASE,
	.end		= EP93XX_CS6_PHYS_BASE + SZ_32M - 1,
	.flags		= IORESOURCE_MEM,
};

static struct platform_device adssphere_flash = {
	.name		= "physmap-flash",
	.id		= 0,
	.dev		= {
		.platform_data	= &adssphere_flash_data,
	},
	.num_resources	= 1,
	.resource	= &adssphere_flash_resource,
};

static struct ep93xx_eth_data __initdata adssphere_eth_data = {
	.phy_id		= 1,
};
@@ -48,8 +27,7 @@ static struct ep93xx_eth_data __initdata adssphere_eth_data = {
static void __init adssphere_init_machine(void)
{
	ep93xx_init_devices();
	platform_device_register(&adssphere_flash);

	ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
	ep93xx_register_eth(&adssphere_eth_data, 1);
}

+38 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <linux/termios.h>
#include <linux/amba/bus.h>
#include <linux/amba/serial.h>
#include <linux/mtd/physmap.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/spi/spi.h>
@@ -347,6 +348,43 @@ static struct platform_device ep93xx_ohci_device = {
};


/*************************************************************************
 * EP93xx physmap'ed flash
 *************************************************************************/
static struct physmap_flash_data ep93xx_flash_data;

static struct resource ep93xx_flash_resource = {
	.flags		= IORESOURCE_MEM,
};

static struct platform_device ep93xx_flash = {
	.name		= "physmap-flash",
	.id		= 0,
	.dev		= {
		.platform_data	= &ep93xx_flash_data,
	},
	.num_resources	= 1,
	.resource	= &ep93xx_flash_resource,
};

/**
 * ep93xx_register_flash() - Register the external flash device.
 * @width:	bank width in octets
 * @start:	resource start address
 * @size:	resource size
 */
void __init ep93xx_register_flash(unsigned int width,
				  resource_size_t start, resource_size_t size)
{
	ep93xx_flash_data.width		= width;

	ep93xx_flash_resource.start	= start;
	ep93xx_flash_resource.end	= start + size - 1;

	platform_device_register(&ep93xx_flash);
}


/*************************************************************************
 * EP93xx ethernet peripheral handling
 *************************************************************************/
+2 −29
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/physmap.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
@@ -38,39 +37,13 @@
#include <asm/mach/arch.h>


static struct physmap_flash_data edb93xx_flash_data;

static struct resource edb93xx_flash_resource = {
	.flags		= IORESOURCE_MEM,
};

static struct platform_device edb93xx_flash = {
	.name		= "physmap-flash",
	.id		= 0,
	.dev		= {
		.platform_data	= &edb93xx_flash_data,
	},
	.num_resources	= 1,
	.resource	= &edb93xx_flash_resource,
};

static void __init __edb93xx_register_flash(unsigned int width,
			resource_size_t start, resource_size_t size)
{
	edb93xx_flash_data.width	= width;
	edb93xx_flash_resource.start	= start;
	edb93xx_flash_resource.end	= start + size - 1;

	platform_device_register(&edb93xx_flash);
}

static void __init edb93xx_register_flash(void)
{
	if (machine_is_edb9307() || machine_is_edb9312() ||
	    machine_is_edb9315()) {
		__edb93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
		ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
	} else {
		__edb93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
		ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
	}
}

+1 −23
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/physmap.h>

#include <mach/hardware.h>

@@ -21,26 +20,6 @@
#include <asm/mach/arch.h>


static struct physmap_flash_data gesbc9312_flash_data = {
	.width		= 4,
};

static struct resource gesbc9312_flash_resource = {
	.start		= EP93XX_CS6_PHYS_BASE,
	.end		= EP93XX_CS6_PHYS_BASE + SZ_8M - 1,
	.flags		= IORESOURCE_MEM,
};

static struct platform_device gesbc9312_flash = {
	.name		= "physmap-flash",
	.id		= 0,
	.dev		= {
		.platform_data	= &gesbc9312_flash_data,
	},
	.num_resources	= 1,
	.resource	= &gesbc9312_flash_resource,
};

static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
	.phy_id		= 1,
};
@@ -48,8 +27,7 @@ static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
static void __init gesbc9312_init_machine(void)
{
	ep93xx_init_devices();
	platform_device_register(&gesbc9312_flash);

	ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_8M);
	ep93xx_register_eth(&gesbc9312_eth_data, 0);
}

+3 −0
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits)

unsigned int ep93xx_chip_revision(void);

void ep93xx_register_flash(unsigned int width,
			   resource_size_t start, resource_size_t size);

void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
void ep93xx_register_i2c(struct i2c_gpio_platform_data *data,
			 struct i2c_board_info *devices, int num);
Loading