m68knommu: clean up and merge common ColdFire QSPI code
cover m68knommu: clean up and merge common ColdFire QSPI code
The code to init and platform setup the ColdFire QSPI devices is duplicated throughout the CPU specific config.c files. It is all common, this is the same QSPI hardware block, just with different base addresses and IRQ numbers used.
Cleanup and merge the common QSPI platform code.
arch/m68k/include/asm/mcfqspi.h | 15 - arch/m68k/platform/520x/config.c | 146 --------------- arch/m68k/platform/523x/config.c | 317 ++++++++------------------------- arch/m68k/platform/5249/config.c | 162 ---------------- arch/m68k/platform/527x/config.c | 165 ----------------- arch/m68k/platform/528x/config.c | 130 ------------- arch/m68k/platform/532x/config.c | 117 ------------ b/arch/m68k/include/asm/m520xsim.h | 12 + b/arch/m68k/include/asm/m523xsim.h | 13 + b/arch/m68k/include/asm/m5249sim.h | 11 + b/arch/m68k/include/asm/m527xsim.h | 24 ++ b/arch/m68k/include/asm/m528xsim.h | 13 + b/arch/m68k/include/asm/m532xsim.h | 12 + b/arch/m68k/include/asm/mcfqspi.h | 2 b/arch/m68k/platform/520x/config.c | 12 - b/arch/m68k/platform/523x/config.c | 13 - b/arch/m68k/platform/5249/config.c | 9 b/arch/m68k/platform/527x/config.c | 20 -- b/arch/m68k/platform/528x/config.c | 13 - b/arch/m68k/platform/532x/config.c | 12 - b/arch/m68k/platform/coldfire/device.c | 162 ++++++++++++++++ 21 files changed, 375 insertions(+), 1005 deletions(-)
PATCH 1/7 m68knommu: make 520x QSPI platform addressing consistent
From: Greg Ungerer <[email protected]>
If we make all QSPI (SPI protocol) addressing consistent across all ColdFire family members then we will be able to remove the duplicated plaform data and code and use a single setup for all.
So modify the ColdFire 520x QSPI addressing so that:
. base addresses are absolute (not relative to MBAR peripheral register) . use a common name for IRQs used
. move chip select definitions (CS) to appropriate header
--- arch/m68k/include/asm/m520xsim.h | 12 ++++++++++++ arch/m68k/include/asm/mcfqspi.h | 2 -- arch/m68k/platform/520x/config.c | 12 ++++-------- 3 files changed, 16 insertions(+), 10 deletions(-)
arch/m68k/include/asm/m520xsim.h +12 -0
@@ -61,6 +61,8 @@#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) +#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) +/* * SDRAM configuration registers. */
@@ -166,6 +168,16 @@#define MCFFEC_SIZE0 0x800/* Register set size */ /* +* QSPI module. +*/ +#define MCFQSPI_BASE 0xFC05C000/* Base of QSPI module */ +#define MCFQSPI_SIZE 0x40/* Register set size */ + +#define MCFQSPI_CS0 46 +#define MCFQSPI_CS1 47 +#define MCFQSPI_CS2 27 + +/* * Reset Control Unit. */ #define MCF_RCR 0xFC0A0000
arch/m68k/include/asm/mcfqspi.h +0 -2
@@ -25,8 +25,6 @@#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)#elif defined(CONFIG_M5249 )#define MCFQSPI_IOBASE (MCF_MBAR + 0x300) -#elif defined(CONFIG_M520x) -#define MCFQSPI_IOBASE 0xFC05C000#elif defined(CONFIG_M532x)#define MCFQSPI_IOBASE 0xFC058000#endif
arch/m68k/platform/520x/config.c +4 -8
@@ -28,21 +28,17 @@#if defined(CONFIG_SPI_COLDFIRE_QSPI ) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE )static struct resource m520x_qspi_resources[] = { { - .start =MCFQSPI_IOBASE , - .end =MCFQSPI_IOBASE +MCFQSPI_IOSIZE -1 , + .start =MCFQSPI_BASE , + .end =MCFQSPI_BASE +MCFQSPI_SIZE -1 , .flags =IORESOURCE_MEM , }, { - .start =MCFINT_VECBASE +MCFINT_QSPI , - .end =MCFINT_VECBASE +MCFINT_QSPI , + .start =MCF_IRQ_QSPI , + .end =MCF_IRQ_QSPI , .flags =IORESOURCE_IRQ , }, }; -#define MCFQSPI_CS0 46 -#define MCFQSPI_CS1 47 -#define MCFQSPI_CS2 27 -static int m520x_cs_setup (struct mcfqspi_cs_control *cs_control) {int status;
Signature · 1 line
1.7.0.4
PATCH 2/7 m68knommu: make 523x QSPI platform addressing consistent
In reply to [email protected]From: Greg Ungerer <[email protected]>
If we make all QSPI (SPI protocol) addressing consistent across all ColdFire family members then we will be able to remove the duplicated plaform data and code and use a single setup for all.
So modify the ColdFire 523x QSPI addressing so that:
. base addresses are absolute (not relative to MBAR peripheral register) . use a common name for IRQs used
. move chip select definitions (CS) to appropriate header
--- arch/m68k/include/asm/m523xsim.h | 13 +++++++++++++ arch/m68k/include/asm/mcfqspi.h | 2 +- arch/m68k/platform/523x/config.c | 13 ++++--------- 3 files changed, 18 insertions(+), 10 deletions(-)
arch/m68k/include/asm/m523xsim.h +13 -0
@@ -51,6 +51,8 @@#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) +#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) +/* * SDRAM configuration registers. */
@@ -83,6 +85,17 @@#define MCFFEC_SIZE0 0x800/* +* QSPI module. +*/ +#define MCFQSPI_BASE (MCF_IPSBAR + 0x340) +#define MCFQSPI_SIZE 0x40 + +#define MCFQSPI_CS0 91 +#define MCFQSPI_CS1 92 +#define MCFQSPI_CS2 103 +#define MCFQSPI_CS3 99 + +/* * GPIO module. */ #define MCFGPIO_PODR_ADDR (MCF_IPSBAR + 0x100000)
arch/m68k/include/asm/mcfqspi.h +1 -1
@@ -21,7 +21,7 @@#ifndef mcfqspi_h#define mcfqspi_h -#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) +#if defined(CONFIG_M527x) || defined(CONFIG_M528x)#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)#elif defined(CONFIG_M5249 )#define MCFQSPI_IOBASE (MCF_MBAR + 0x300)
arch/m68k/platform/523x/config.c +4 -9
@@ -29,22 +29,17 @@#if defined(CONFIG_SPI_COLDFIRE_QSPI ) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE )static struct resource m523x_qspi_resources[] = { { - .start =MCFQSPI_IOBASE , - .end =MCFQSPI_IOBASE +MCFQSPI_IOSIZE -1 , + .start =MCFQSPI_BASE , + .end =MCFQSPI_BASE +MCFQSPI_SIZE -1 , .flags =IORESOURCE_MEM , }, { - .start =MCFINT_VECBASE +MCFINT_QSPI , - .end =MCFINT_VECBASE +MCFINT_QSPI , + .start =MCF_IRQ_QSPI , + .end =MCF_IRQ_QSPI , .flags =IORESOURCE_IRQ , }, }; -#define MCFQSPI_CS0 91 -#define MCFQSPI_CS1 92 -#define MCFQSPI_CS2 103 -#define MCFQSPI_CS3 99 -static int m523x_cs_setup (struct mcfqspi_cs_control *cs_control) {int status;
Signature · 1 line
1.7.0.4
PATCH 3/7 m68knommu: make 5249 QSPI platform addressing consistent
In reply to [email protected]From: Greg Ungerer <[email protected]>
If we make all QSPI (SPI protocol) addressing consistent across all ColdFire family members then we will be able to remove the duplicated plaform data and code and use a single setup for all.
So modify the ColdFire 5249 QSPI addressing so that:
. base addresses are absolute (not relative to MBAR peripheral register) . use a common name for IRQs used
. move chip select definitions (CS) to appropriate header
--- arch/m68k/include/asm/m5249sim.h | 11 +++++++++++ arch/m68k/include/asm/mcfqspi.h | 2 -- arch/m68k/platform/5249/config.c | 9 ++------- 3 files changed, 13 insertions(+), 9 deletions(-)
arch/m68k/include/asm/m5249sim.h +11 -0
@@ -80,6 +80,17 @@#define MCFUART_BASE1 (MCF_MBAR + 0x200)/* Base address UART1 */ /* +* QSPI module. +*/ +#define MCFQSPI_BASE (MCF_MBAR + 0x300)/* Base address QSPI */ +#define MCFQSPI_SIZE 0x40/* Register set size */ + +#define MCFQSPI_CS0 29 +#define MCFQSPI_CS1 24 +#define MCFQSPI_CS2 21 +#define MCFQSPI_CS3 22 + +/* * DMA unit base addresses. */ #define MCFDMA_BASE0 (MCF_MBAR + 0x300)/* Base address DMA 0 */
arch/m68k/include/asm/mcfqspi.h +0 -2
@@ -23,8 +23,6 @@#if defined(CONFIG_M527x) || defined(CONFIG_M528x)#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340) -#elif defined(CONFIG_M5249 ) -#define MCFQSPI_IOBASE (MCF_MBAR + 0x300)#elif defined(CONFIG_M532x)#define MCFQSPI_IOBASE 0xFC058000#endif
arch/m68k/platform/5249/config.c +2 -7
@@ -48,8 +48,8 @@ static struct platform_device m5249_smc91x = { #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) static struct resource m5249_qspi_resources[] = { { - .start = MCFQSPI_IOBASE, - .end = MCFQSPI_IOBASE + MCFQSPI_IOSIZE - 1, + .start = MCFQSPI_BASE, + .end = MCFQSPI_BASE + MCFQSPI_SIZE - 1, .flags = IORESOURCE_MEM, }, {
@@ -59,11 +59,6 @@ static struct resource m5249_qspi_resources[] = { }, }; -#define MCFQSPI_CS0 29 -#define MCFQSPI_CS1 24 -#define MCFQSPI_CS2 21 -#define MCFQSPI_CS3 22 -static int m5249_cs_setup (struct mcfqspi_cs_control *cs_control) {int status;
Signature · 1 line
1.7.0.4
PATCH 4/7 m68knommu: make 527x QSPI platform addressing consistent
In reply to [email protected]From: Greg Ungerer <[email protected]>
If we make all QSPI (SPI protocol) addressing consistent across all ColdFire family members then we will be able to remove the duplicated plaform data and code and use a single setup for all.
So modify the ColdFire 527x QSPI addressing so that:
. base addresses are absolute (not relative to MBAR peripheral register) . use a common name for IRQs used
. move chip select definitions (CS) to appropriate header
--- arch/m68k/include/asm/m527xsim.h | 24 ++++++++++++++++++++++++ arch/m68k/include/asm/mcfqspi.h | 2 +- arch/m68k/platform/527x/config.c | 20 ++++---------------- 3 files changed, 29 insertions(+), 17 deletions(-)
arch/m68k/include/asm/m527xsim.h +24 -0
@@ -59,6 +59,8 @@#define MCF_IRQ_FECTX1 (MCFINT2_VECBASE + MCFINT2_FECTX1)#define MCF_IRQ_FECENTC1 (MCFINT2_VECBASE + MCFINT2_FECENTC1) +#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) +/* * SDRAM configuration registers. */
@@ -103,6 +105,28 @@#define MCFFEC_BASE1 (MCF_IPSBAR + 0x1800)#define MCFFEC_SIZE1 0x800 +/* +* QSPI module. +*/ +#define MCFQSPI_BASE (MCF_IPSBAR + 0x340) +#define MCFQSPI_SIZE 0x40 + +#ifdef CONFIG_M5271 +#define MCFQSPI_CS0 91 +#define MCFQSPI_CS1 92 +#define MCFQSPI_CS2 99 +#define MCFQSPI_CS3 103 +#endif +#ifdef CONFIG_M5275 +#define MCFQSPI_CS0 59 +#define MCFQSPI_CS1 60 +#define MCFQSPI_CS2 61 +#define MCFQSPI_CS3 62 +#endif + +/* +* GPIO module. +*/ #ifdef CONFIG_M5271 #define MCFGPIO_PODR_ADDR (MCF_IPSBAR + 0x100000)#define MCFGPIO_PODR_DATAH (MCF_IPSBAR + 0x100001)
arch/m68k/include/asm/mcfqspi.h +1 -1
@@ -21,7 +21,7 @@#ifndef mcfqspi_h#define mcfqspi_h -#if defined(CONFIG_M527x) || defined(CONFIG_M528x) +#if defined(CONFIG_M528x)#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)#elif defined(CONFIG_M532x)#define MCFQSPI_IOBASE 0xFC058000
arch/m68k/platform/527x/config.c +4 -16
@@ -29,29 +29,17 @@#if defined(CONFIG_SPI_COLDFIRE_QSPI ) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE )static struct resource m527x_qspi_resources[] = { { - .start =MCFQSPI_IOBASE , - .end =MCFQSPI_IOBASE +MCFQSPI_IOSIZE -1 , + .start =MCFQSPI_BASE , + .end =MCFQSPI_BASE +MCFQSPI_SIZE -1 , .flags =IORESOURCE_MEM , }, { - .start =MCFINT_VECBASE +MCFINT_QSPI , - .end =MCFINT_VECBASE +MCFINT_QSPI , + .start =MCF_IRQ_QSPI , + .end =MCF_IRQ_QSPI , .flags =IORESOURCE_IRQ , }, }; -#if defined(CONFIG_M5271 ) -#define MCFQSPI_CS0 91 -#define MCFQSPI_CS1 92 -#define MCFQSPI_CS2 99 -#define MCFQSPI_CS3 103 -#elif defined(CONFIG_M5275 ) -#define MCFQSPI_CS0 59 -#define MCFQSPI_CS1 60 -#define MCFQSPI_CS2 61 -#define MCFQSPI_CS3 62 -#endif -static int m527x_cs_setup (struct mcfqspi_cs_control *cs_control) {int status;
Signature · 1 line
1.7.0.4
PATCH 5/7 m68knommu: make 528x QSPI platform addressing consistent
In reply to [email protected]From: Greg Ungerer <[email protected]>
If we make all QSPI (SPI protocol) addressing consistent across all ColdFire family members then we will be able to remove the duplicated plaform data and code and use a single setup for all.
So modify the ColdFire 528x QSPI addressing so that:
. base addresses are absolute (not relative to MBAR peripheral register) . use a common name for IRQs used
. move chip select definitions (CS) to appropriate header
--- arch/m68k/include/asm/m528xsim.h | 13 +++++++++++++ arch/m68k/include/asm/mcfqspi.h | 4 +--- arch/m68k/platform/528x/config.c | 13 ++++--------- 3 files changed, 18 insertions(+), 12 deletions(-)
arch/m68k/include/asm/m528xsim.h +13 -0
@@ -51,6 +51,8 @@#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) +#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) +/* * SDRAM configuration registers. */
@@ -82,6 +84,17 @@#define MCFFEC_SIZE0 0x800/* +* QSPI module. +*/ +#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340) +#define MCFQSPI_SIZE 0x40 + +#define MCFQSPI_CS0 147 +#define MCFQSPI_CS1 148 +#define MCFQSPI_CS2 149 +#define MCFQSPI_CS3 150 + +/* * GPIO registers */ #define MCFGPIO_PORTA (MCF_IPSBAR + 0x00100000)
arch/m68k/include/asm/mcfqspi.h +1 -3
@@ -21,9 +21,7 @@#ifndef mcfqspi_h#define mcfqspi_h -#if defined(CONFIG_M528x) -#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340) -#elif defined(CONFIG_M532x) +#if defined(CONFIG_M532x)#define MCFQSPI_IOBASE 0xFC058000#endif #define MCFQSPI_IOSIZE 0x40
arch/m68k/platform/528x/config.c +4 -9
@@ -30,22 +30,17 @@#if defined(CONFIG_SPI_COLDFIRE_QSPI ) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE )static struct resource m528x_qspi_resources[] = { { - .start =MCFQSPI_IOBASE , - .end =MCFQSPI_IOBASE +MCFQSPI_IOSIZE -1 , + .start =MCFQSPI_BASE , + .end =MCFQSPI_BASE +MCFQSPI_SIZE -1 , .flags =IORESOURCE_MEM , }, { - .start =MCFINT_VECBASE +MCFINT_QSPI , - .end =MCFINT_VECBASE +MCFINT_QSPI , + .start =MCF_IRQ_QSPI , + .end =MCF_IRQ_QSPI , .flags =IORESOURCE_IRQ , }, }; -#define MCFQSPI_CS0 147 -#define MCFQSPI_CS1 148 -#define MCFQSPI_CS2 149 -#define MCFQSPI_CS3 150 -static int m528x_cs_setup (struct mcfqspi_cs_control *cs_control) {int status;
Signature · 1 line
1.7.0.4
PATCH 6/7 m68knommu: make 532x QSPI platform addressing consistent
In reply to [email protected]From: Greg Ungerer <[email protected]>
If we make all QSPI (SPI protocol) addressing consistent across all ColdFire family members then we will be able to remove the duplicated plaform data and code and use a single setup for all.
So modify the ColdFire 532x QSPI addressing so that:
. base addresses are absolute (not relative to MBAR peripheral register) . use a common name for IRQs used
. move chip select definitions (CS) to appropriate header
--- arch/m68k/include/asm/m532xsim.h | 12 ++++++++++++ arch/m68k/include/asm/mcfqspi.h | 5 ----- arch/m68k/platform/532x/config.c | 12 ++++-------- 3 files changed, 16 insertions(+), 13 deletions(-)
arch/m68k/include/asm/m532xsim.h +12 -0
@@ -36,6 +36,8 @@#define MCF_IRQ_FECTX0 (MCFINT_VECBASE + MCFINT_FECTX0)#define MCF_IRQ_FECENTC0 (MCFINT_VECBASE + MCFINT_FECENTC0) +#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) +#define MCF_WTM_WCR MCF_REG16(0xFC098000)/*
@@ -104,6 +106,16 @@#define MCFFEC_SIZE0 0x800/* Size of FEC0 region */ /* +* QSPI module. +*/ +#define MCFQSPI_BASE 0xFC058000/* Base address of QSPI */ +#define MCFQSPI_SIZE 0x40/* Size of QSPI region */ + +#define MCFQSPI_CS0 84 +#define MCFQSPI_CS1 85 +#define MCFQSPI_CS2 86 + +/* * Timer module. */ #define MCFTIMER_BASE1 0xFC070000/* Base address of TIMER1 */
arch/m68k/include/asm/mcfqspi.h +0 -5
@@ -21,11 +21,6 @@#ifndef mcfqspi_h#define mcfqspi_h -#if defined(CONFIG_M532x) -#define MCFQSPI_IOBASE 0xFC058000 -#endif -#define MCFQSPI_IOSIZE 0x40 -/** * struct mcfqspi_cs_control - chip select control for the coldfire qspi driver * @setup: setup the control; allocate gpio's, etc. May be NULL.
arch/m68k/platform/532x/config.c +4 -8
@@ -36,21 +36,17 @@#if defined(CONFIG_SPI_COLDFIRE_QSPI ) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE )static struct resource m532x_qspi_resources[] = { { - .start =MCFQSPI_IOBASE , - .end =MCFQSPI_IOBASE +MCFQSPI_IOSIZE -1 , + .start =MCFQSPI_BASE , + .end =MCFQSPI_BASE +MCFQSPI_SIZE -1 , .flags =IORESOURCE_MEM , }, { - .start =MCFINT_VECBASE +MCFINT_QSPI , - .end =MCFINT_VECBASE +MCFINT_QSPI , + .start =MCF_IRQ_QSPI , + .end =MCF_IRQ_QSPI , .flags =IORESOURCE_IRQ , }, }; -#define MCFQSPI_CS0 84 -#define MCFQSPI_CS1 85 -#define MCFQSPI_CS2 86 -static int m532x_cs_setup (struct mcfqspi_cs_control *cs_control) {int status;
Signature · 1 line
1.7.0.4
PATCH 7/7 m68knommu: merge common ColdFire QSPI platform setup code
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire QSPI is common to quite a few ColdFire CPUs. No need to duplicate its platform setup code for every CPU family member that has it. Merge all the setup code into a single shared file.
This also results in few platforms no longer needing any local platform setup code. In those cases remove the empty devices array and initcall code as well.
--- arch/m68k/platform/520x/config.c | 146 +--------------- arch/m68k/platform/523x/config.c | 317 +++++++++------------------------- arch/m68k/platform/5249/config.c | 162 +---------------- arch/m68k/platform/527x/config.c | 165 +----------------- arch/m68k/platform/528x/config.c | 130 +-------------- arch/m68k/platform/532x/config.c | 117 +------------ arch/m68k/platform/coldfire/device.c | 162 +++++++++++++++++- 7 files changed, 265 insertions(+), 934 deletions(-)
rewrite arch/m68k/platform/523x/config.c (65%)
arch/m68k/platform/520x/config.c +3 -143
@@ -15,138 +15,14 @@#include <linux/param.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/spi/spi.h> -#include <linux/gpio.h> #include <asm/machdep.h> #include <asm/coldfire.h> #include <asm/mcfsim.h> #include <asm/mcfuart.h> -#include <asm/mcfqspi.h> /***************************************************************************/ -#if defined(CONFIG_SPI_COLDFIRE_QSPI ) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE ) -static struct resource m520x_qspi_resources[] = { - { - .start =MCFQSPI_BASE , - .end =MCFQSPI_BASE +MCFQSPI_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =MCF_IRQ_QSPI , - .end =MCF_IRQ_QSPI , - .flags =IORESOURCE_IRQ , - }, -}; - -static int m520x_cs_setup (struct mcfqspi_cs_control *cs_control) -{ -int status; - - status =gpio_request (MCFQSPI_CS0 ,"MCFQSPI_CS0" ); -if (status) { -pr_debug ("gpio_request for MCFQSPI_CS0 failed\n" ); - goto fail0; - } - status =gpio_direction_output (MCFQSPI_CS0 ,1 ); -if (status) { -pr_debug ("gpio_direction_output for MCFQSPI_CS0 failed\n" ); - goto fail1; - } - - status =gpio_request (MCFQSPI_CS1 ,"MCFQSPI_CS1" ); -if (status) { -pr_debug ("gpio_request for MCFQSPI_CS1 failed\n" ); - goto fail1; - } - status =gpio_direction_output (MCFQSPI_CS1 ,1 ); -if (status) { -pr_debug ("gpio_direction_output for MCFQSPI_CS1 failed\n" ); - goto fail2; - } - - status =gpio_request (MCFQSPI_CS2 ,"MCFQSPI_CS2" ); -if (status) { -pr_debug ("gpio_request for MCFQSPI_CS2 failed\n" ); - goto fail2; - } - status =gpio_direction_output (MCFQSPI_CS2 ,1 ); -if (status) { -pr_debug ("gpio_direction_output for MCFQSPI_CS2 failed\n" ); - goto fail3; - } - -return 0 ; - -fail3: -gpio_free (MCFQSPI_CS2 ); -fail2: -gpio_free (MCFQSPI_CS1 ); -fail1: -gpio_free (MCFQSPI_CS0 ); -fail0: -return status; -} - -static void m520x_cs_teardown (struct mcfqspi_cs_control *cs_control) -{ -gpio_free (MCFQSPI_CS2 ); -gpio_free (MCFQSPI_CS1 ); -gpio_free (MCFQSPI_CS0 ); -} - -static void m520x_cs_select (struct mcfqspi_cs_control *cs_control, -u8 chip_select,bool cs_high) -{ -switch (chip_select) { -case 0 : -gpio_set_value (MCFQSPI_CS0 , cs_high); -break ; -case 1 : -gpio_set_value (MCFQSPI_CS1 , cs_high); -break ; -case 2 : -gpio_set_value (MCFQSPI_CS2 , cs_high); -break ; - } -} - -static void m520x_cs_deselect (struct mcfqspi_cs_control *cs_control, -u8 chip_select,bool cs_high) -{ -switch (chip_select) { -case 0 : -gpio_set_value (MCFQSPI_CS0 , !cs_high); -break ; -case 1 : -gpio_set_value (MCFQSPI_CS1 , !cs_high); -break ; -case 2 : -gpio_set_value (MCFQSPI_CS2 , !cs_high); -break ; - } -} - -static struct mcfqspi_cs_control m520x_cs_control = { - .setup = m520x_cs_setup, - .teardown = m520x_cs_teardown, - .select = m520x_cs_select, - .deselect = m520x_cs_deselect, -}; - -static struct mcfqspi_platform_data m520x_qspi_data = { - .bus_num =0 , - .num_chipselect =3 , - .cs_control = &m520x_cs_control, -}; - -static struct platform_device m520x_qspi = { - .name ="mcfqspi" , - .id =0 , - .num_resources =ARRAY_SIZE (m520x_qspi_resources), - .resource = m520x_qspi_resources, - .dev.platform_data = &m520x_qspi_data, -}; +#ifdef CONFIG_SPI_COLDFIRE_QSPI static void __init m520x_qspi_init (void ) {
@@ -158,14 +34,8 @@ static void __init m520x_qspi_init(void) par &=0x00ff ; writew(par, MCF_GPIO_PAR_UART); } -#endif /* defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) */ - -static struct platform_device *m520x_devices[] __initdata = { -#if defined(CONFIG_SPI_COLDFIRE_QSPI ) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE ) - &m520x_qspi, -#endif -}; +#endif /* CONFIG_SPI_COLDFIRE_QSPI */ /***************************************************************************/
@@ -217,19 +87,9 @@ void __init config_BSP(char *commandp, int size) mach_reset = m520x_cpu_reset;m520x_uarts_init ();m520x_fec_init (); -#if defined(CONFIG_SPI_COLDFIRE_QSPI ) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE ) +#ifdef CONFIG_SPI_COLDFIRE_QSPI m520x_qspi_init ();#endif }/***************************************************************************/ - -static int __init init_BSP (void ) -{ -platform_add_devices (m520x_devices,ARRAY_SIZE (m520x_devices)); -return 0 ; -} - -arch_initcall (init_BSP); - -/***************************************************************************/
arch/m68k/platform/523x/config.c +83 -234
317 lines not on this page · raw message
arch/m68k/platform/5249/config.c +9 -153
193 lines not on this page · raw message
arch/m68k/platform/527x/config.c +3 -162
193 lines not on this page · raw message
arch/m68k/platform/528x/config.c +3 -127
158 lines not on this page · raw message
arch/m68k/platform/532x/config.c +3 -114
147 lines not on this page · raw message
arch/m68k/platform/coldfire/device.c +161 -1
186 lines not on this page · raw message
Signature · 1 line
1.7.0.4