Skip to content

Commit

Permalink
ARM: orion: Consolidate SPI initialization.
Browse files Browse the repository at this point in the history
This change removes the interrupt resource. The driver does not use
it.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
  • Loading branch information
Andrew Lunn authored and Nicolas Pitre committed May 16, 2011
1 parent aac7ffa commit 980f9f6
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 114 deletions.
65 changes: 3 additions & 62 deletions arch/arm/mach-dove/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <linux/mbus.h>
#include <linux/ata_platform.h>
#include <linux/serial_8250.h>
#include <linux/spi/orion_spi.h>
#include <linux/gpio.h>
#include <asm/page.h>
#include <asm/setup.h>
Expand Down Expand Up @@ -234,71 +233,16 @@ void __init dove_uart3_init(void)
}

/*****************************************************************************
* SPI0
* SPI
****************************************************************************/
static struct orion_spi_info dove_spi0_data = {
.tclk = 0,
};

static struct resource dove_spi0_resources[] = {
{
.start = DOVE_SPI0_PHYS_BASE,
.end = DOVE_SPI0_PHYS_BASE + SZ_512 - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_DOVE_SPI0,
.end = IRQ_DOVE_SPI0,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device dove_spi0 = {
.name = "orion_spi",
.id = 0,
.resource = dove_spi0_resources,
.dev = {
.platform_data = &dove_spi0_data,
},
.num_resources = ARRAY_SIZE(dove_spi0_resources),
};

void __init dove_spi0_init(void)
{
platform_device_register(&dove_spi0);
orion_spi_init(DOVE_SPI0_PHYS_BASE, get_tclk());
}

/*****************************************************************************
* SPI1
****************************************************************************/
static struct orion_spi_info dove_spi1_data = {
.tclk = 0,
};

static struct resource dove_spi1_resources[] = {
{
.start = DOVE_SPI1_PHYS_BASE,
.end = DOVE_SPI1_PHYS_BASE + SZ_512 - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_DOVE_SPI1,
.end = IRQ_DOVE_SPI1,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device dove_spi1 = {
.name = "orion_spi",
.id = 1,
.resource = dove_spi1_resources,
.dev = {
.platform_data = &dove_spi1_data,
},
.num_resources = ARRAY_SIZE(dove_spi1_resources),
};

void __init dove_spi1_init(void)
{
platform_device_register(&dove_spi1);
orion_spi_init(DOVE_SPI1_PHYS_BASE, get_tclk());
}

/*****************************************************************************
Expand Down Expand Up @@ -613,9 +557,6 @@ void __init dove_init(void)
#endif
dove_setup_cpu_mbus();

dove_spi0_data.tclk = tclk;
dove_spi1_data.tclk = tclk;

/* internal devices that every board has */
dove_rtc_init();
dove_xor0_init();
Expand Down
25 changes: 1 addition & 24 deletions arch/arm/mach-kirkwood/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/mbus.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>
#include <asm/timex.h>
Expand Down Expand Up @@ -292,31 +291,10 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
/*****************************************************************************
* SPI
****************************************************************************/
static struct orion_spi_info kirkwood_spi_plat_data = {
};

static struct resource kirkwood_spi_resources[] = {
{
.start = SPI_PHYS_BASE,
.end = SPI_PHYS_BASE + SZ_512 - 1,
.flags = IORESOURCE_MEM,
},
};

static struct platform_device kirkwood_spi = {
.name = "orion_spi",
.id = 0,
.resource = kirkwood_spi_resources,
.dev = {
.platform_data = &kirkwood_spi_plat_data,
},
.num_resources = ARRAY_SIZE(kirkwood_spi_resources),
};

void __init kirkwood_spi_init()
{
kirkwood_clk_ctrl |= CGC_RUNIT;
platform_device_register(&kirkwood_spi);
orion_spi_init(SPI_PHYS_BASE, kirkwood_tclk);
}


Expand Down Expand Up @@ -757,7 +735,6 @@ void __init kirkwood_init(void)
{
printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
kirkwood_id(), kirkwood_tclk);
kirkwood_spi_plat_data.tclk = kirkwood_tclk;
kirkwood_i2s_data.tclk = kirkwood_tclk;

/*
Expand Down
29 changes: 1 addition & 28 deletions arch/arm/mach-orion5x/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <linux/mbus.h>
#include <linux/mv643xx_i2c.h>
#include <linux/ata_platform.h>
#include <linux/spi/orion_spi.h>
#include <net/dsa.h>
#include <asm/page.h>
#include <asm/setup.h>
Expand Down Expand Up @@ -214,33 +213,9 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
/*****************************************************************************
* SPI
****************************************************************************/
static struct orion_spi_info orion5x_spi_plat_data = {
.tclk = 0,
.enable_clock_fix = 1,
};

static struct resource orion5x_spi_resources[] = {
{
.name = "spi base",
.start = SPI_PHYS_BASE,
.end = SPI_PHYS_BASE + 0x1f,
.flags = IORESOURCE_MEM,
},
};

static struct platform_device orion5x_spi = {
.name = "orion_spi",
.id = 0,
.dev = {
.platform_data = &orion5x_spi_plat_data,
},
.num_resources = ARRAY_SIZE(orion5x_spi_resources),
.resource = orion5x_spi_resources,
};

void __init orion5x_spi_init()
{
platform_device_register(&orion5x_spi);
orion_spi_init(SPI_PHYS_BASE, orion5x_tclk);
}


Expand Down Expand Up @@ -513,8 +488,6 @@ void __init orion5x_init(void)
orion5x_id(&dev, &rev, &dev_name);
printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);

orion5x_spi_plat_data.tclk = orion5x_tclk;

/*
* Setup Orion address map
*/
Expand Down
47 changes: 47 additions & 0 deletions arch/arm/plat-orion/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/mv643xx_eth.h>
#include <linux/mv643xx_i2c.h>
#include <net/dsa.h>
#include <linux/spi/orion_spi.h>

/* Fill in the resources structure and link it into the platform
device structure. There is always a memory region, and nearly
Expand Down Expand Up @@ -517,3 +518,49 @@ void __init orion_i2c_1_init(unsigned long mapbase,
SZ_32 - 1, irq);
platform_device_register(&orion_i2c_1);
}

/*****************************************************************************
* SPI
****************************************************************************/
static struct orion_spi_info orion_spi_plat_data;
static struct resource orion_spi_resources;

static struct platform_device orion_spi = {
.name = "orion_spi",
.id = 0,
.dev = {
.platform_data = &orion_spi_plat_data,
},
};

static struct orion_spi_info orion_spi_1_plat_data;
static struct resource orion_spi_1_resources;

static struct platform_device orion_spi_1 = {
.name = "orion_spi",
.id = 1,
.dev = {
.platform_data = &orion_spi_1_plat_data,
},
};

/* Note: The SPI silicon core does have interrupts. However the
* current Linux software driver does not use interrupts. */

void __init orion_spi_init(unsigned long mapbase,
unsigned long tclk)
{
orion_spi_plat_data.tclk = tclk;
fill_resources(&orion_spi, &orion_spi_resources,
mapbase, SZ_512 - 1, NO_IRQ);
platform_device_register(&orion_spi);
}

void __init orion_spi_1_init(unsigned long mapbase,
unsigned long tclk)
{
orion_spi_1_plat_data.tclk = tclk;
fill_resources(&orion_spi_1, &orion_spi_1_resources,
mapbase, SZ_512 - 1, NO_IRQ);
platform_device_register(&orion_spi_1);
}
6 changes: 6 additions & 0 deletions arch/arm/plat-orion/include/plat/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,10 @@ void __init orion_i2c_init(unsigned long mapbase,
void __init orion_i2c_1_init(unsigned long mapbase,
unsigned long irq,
unsigned long freq_m);

void __init orion_spi_init(unsigned long mapbase,
unsigned long tclk);

void __init orion_spi_1_init(unsigned long mapbase,
unsigned long tclk);
#endif

0 comments on commit 980f9f6

Please sign in to comment.