diff options
author | Jason Liu <r64343@freescale.com> | 2010-07-07 05:34:55 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2010-07-07 05:35:42 +0800 |
commit | 65d7ce607bd4a831c3da00884d7bf00fc412928f (patch) | |
tree | c47fa5a2c954f9cfcd15120164745954035c71e3 | |
parent | c6433f273a5b05472cc412148355bdefb252808e (diff) | |
download | u-boot-imx-65d7ce607bd4a831c3da00884d7bf00fc412928f.zip u-boot-imx-65d7ce607bd4a831c3da00884d7bf00fc412928f.tar.gz u-boot-imx-65d7ce607bd4a831c3da00884d7bf00fc412928f.tar.bz2 |
ENGR00124908 CSPI: make spi_get_cfg platform specific
CSPI: make spi_get_cfg platform specific
move the spi_get_cfg out of the cspi/ecspi driver
Signed-off-by:Jason Liu <r64343@freescale.com>
-rw-r--r-- | board/freescale/mx25_3stack/mx25_3stack.c | 20 | ||||
-rw-r--r-- | board/freescale/mx51_bbg/config.mk | 6 | ||||
-rw-r--r-- | board/freescale/mx51_bbg/mx51_bbg.c | 31 | ||||
-rw-r--r-- | drivers/spi/imx_cspi.c | 24 | ||||
-rw-r--r-- | drivers/spi/imx_ecspi.c | 33 |
5 files changed, 62 insertions, 52 deletions
diff --git a/board/freescale/mx25_3stack/mx25_3stack.c b/board/freescale/mx25_3stack/mx25_3stack.c index db16c32..b8bb256 100644 --- a/board/freescale/mx25_3stack/mx25_3stack.c +++ b/board/freescale/mx25_3stack/mx25_3stack.c @@ -186,6 +186,26 @@ int board_mmc_init(bd_t *bis) } #endif +s32 spi_get_cfg(struct imx_spi_dev_t *dev) +{ + switch (dev->slave.cs) { + case 0: + /* cpld */ + dev->base = CSPI1_BASE; + dev->freq = 25000000; + dev->ss_pol = IMX_SPI_ACTIVE_LOW; + dev->ss = 0; + dev->fifo_sz = 32; + dev->us_delay = 0; + break; + default: + printf("Invalid Bus ID! \n"); + break; + } + + return 0; +} + void spi_io_init(struct imx_spi_dev_t *dev) { switch (dev->base) { diff --git a/board/freescale/mx51_bbg/config.mk b/board/freescale/mx51_bbg/config.mk index 705aa34..97e8856 100644 --- a/board/freescale/mx51_bbg/config.mk +++ b/board/freescale/mx51_bbg/config.mk @@ -1,3 +1,7 @@ LDSCRIPT := $(SRCTREE)/board/$(VENDOR)/$(BOARD)/u-boot.lds -TEXT_BASE = 0x97800000 +sinclude $(OBJTREE)/board/$(VENDOR)/$(BOARD)/config.tmp + +ifndef TEXT_BASE + TEXT_BASE = 0x97800000 +endif diff --git a/board/freescale/mx51_bbg/mx51_bbg.c b/board/freescale/mx51_bbg/mx51_bbg.c index 43fe121..dadc4e9 100644 --- a/board/freescale/mx51_bbg/mx51_bbg.c +++ b/board/freescale/mx51_bbg/mx51_bbg.c @@ -31,8 +31,10 @@ #include <i2c.h> #include <asm/arch/keypad.h> #include "board-imx51.h" +#ifdef #ifdef CONFIG_IMX_ECSPI #include <imx_spi.h> #include <asm/arch/imx_spi_pmic.h> +#endif #include <asm/errno.h> @@ -307,6 +309,35 @@ static void setup_expio(void) } #ifdef CONFIG_IMX_ECSPI +s32 spi_get_cfg(struct imx_spi_dev_t *dev) +{ + switch (dev->slave.cs) { + case 0: + /* pmic */ + dev->base = CSPI1_BASE_ADDR; + dev->freq = 2500000; + dev->ss_pol = IMX_SPI_ACTIVE_HIGH; + dev->ss = 0; + dev->fifo_sz = 64 * 4; + dev->us_delay = 0; + break; + case 1: + /* spi_nor */ + dev->base = CSPI1_BASE_ADDR; + dev->freq = 2500000; + dev->ss_pol = IMX_SPI_ACTIVE_LOW; + dev->ss = 1; + dev->fifo_sz = 64 * 4; + dev->us_delay = 0; + break; + default: + printf("Invalid Bus ID! \n"); + break; + } + + return 0; +} + void spi_io_init(struct imx_spi_dev_t *dev) { switch (dev->base) { diff --git a/drivers/spi/imx_cspi.c b/drivers/spi/imx_cspi.c index a4a3049..438ab8d 100644 --- a/drivers/spi/imx_cspi.c +++ b/drivers/spi/imx_cspi.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2008-2009 Freescale Semiconductor, Inc. + * (C) Copyright 2008-2010 Freescale Semiconductor, Inc. * * See file CREDITS for list of people who contributed to this * project. @@ -30,31 +30,13 @@ #include <imx_spi.h> +extern s32 spi_get_cfg(struct imx_spi_dev_t *dev); + static inline struct imx_spi_dev_t *to_imx_spi_slave(struct spi_slave *slave) { return container_of(slave, struct imx_spi_dev_t, slave); } -static s32 spi_get_cfg(struct imx_spi_dev_t *dev) -{ - switch (dev->slave.cs) { - case 0: - /* cpld */ - dev->base = CSPI1_BASE; - dev->freq = 25000000; - dev->ss_pol = IMX_SPI_ACTIVE_LOW; - dev->ss = 0; - dev->fifo_sz = 32; - dev->us_delay = 0; - break; - default: - printf("Invalid Bus ID! \n"); - break; - } - - return 0; -} - static s32 spi_reset(struct spi_slave *slave) { u32 clk_src = mxc_get_clock(MXC_CSPI_CLK); diff --git a/drivers/spi/imx_ecspi.c b/drivers/spi/imx_ecspi.c index d9345da..1e86cf1 100644 --- a/drivers/spi/imx_ecspi.c +++ b/drivers/spi/imx_ecspi.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2008-2009 Freescale Semiconductor, Inc. + * (C) Copyright 2008-2010 Freescale Semiconductor, Inc. * * See file CREDITS for list of people who contributed to this * project. @@ -53,40 +53,13 @@ static void memdump(const void *pv, int num) #endif /* DEBUG */ +extern s32 spi_get_cfg(struct imx_spi_dev_t *dev); + static inline struct imx_spi_dev_t *to_imx_spi_slave(struct spi_slave *slave) { return container_of(slave, struct imx_spi_dev_t, slave); } -static s32 spi_get_cfg(struct imx_spi_dev_t *dev) -{ - switch (dev->slave.cs) { - case 0: - /* pmic */ - dev->base = CSPI1_BASE_ADDR; - dev->freq = 2500000; - dev->ss_pol = IMX_SPI_ACTIVE_HIGH; - dev->ss = 0; - dev->fifo_sz = 64 * 4; - dev->us_delay = 0; - break; - case 1: - /* spi_nor */ - dev->base = CSPI1_BASE_ADDR; - dev->freq = 2500000; - dev->ss_pol = IMX_SPI_ACTIVE_LOW; - dev->ss = 1; - dev->fifo_sz = 64 * 4; - dev->us_delay = 0; - break; - default: - printf("Invalid Bus ID! \n"); - break; - } - - return 0; -} - static s32 spi_reset(struct spi_slave *slave) { u32 clk_src = mxc_get_clock(MXC_CSPI_CLK); |