Commit ea022a3775a723a90ee91dfa100ac95a5379e93d

Authored by Simon Glass
Committed by Tom Rini
1 parent 139db7af4e

spi: Move freescale-specific code into a private header

At present there are two SPI functions only used by freescale which are
defined in the spi_flash.h header. One function name matches an existing
generic SPL function.

Move these into a private header to avoid confusion.

Arcturus looks like it does not actually support SPI, so drop the SPI code
from that board.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

Showing 12 changed files with 41 additions and 25 deletions Side-by-side Diff

board/Arcturus/ucp1020/spl.c
... ... @@ -119,8 +119,6 @@
119 119  
120 120 #ifdef CONFIG_SPL_MMC_BOOT
121 121 mmc_boot();
122   -#elif defined(CONFIG_SPL_SPI_BOOT)
123   - spi_boot();
124 122 #elif defined(CONFIG_SPL_NAND_BOOT)
125 123 nand_boot();
126 124 #endif
board/freescale/common/spl.h
  1 +/*
  2 + * Copyright 2016 Google, Inc
  3 + *
  4 + * SPDX-License-Identifier: GPL-2.0+
  5 + */
  6 +
  7 +#ifndef __FREESCALE_BOARD_SPL_H
  8 +#define __FREESCALE_BOARD_SPL_H
  9 +
  10 +void fsl_spi_spl_load_image(uint32_t offs, unsigned int size, void *vdst);
  11 +void fsl_spi_boot(void) __noreturn;
  12 +
  13 +#endif
board/freescale/p1010rdb/spl.c
... ... @@ -12,6 +12,7 @@
12 12 #include <i2c.h>
13 13 #include <fsl_esdhc.h>
14 14 #include <spi_flash.h>
  15 +#include "../common/spl.h"
15 16  
16 17 DECLARE_GLOBAL_DATA_PTR;
17 18  
... ... @@ -103,7 +104,7 @@
103 104 #ifdef CONFIG_SPL_MMC_BOOT
104 105 mmc_boot();
105 106 #elif defined(CONFIG_SPL_SPI_BOOT)
106   - spi_boot();
  107 + fsl_spi_boot();
107 108 #elif defined(CONFIG_SPL_NAND_BOOT)
108 109 nand_boot();
109 110 #endif
board/freescale/p1022ds/spl.c
... ... @@ -14,6 +14,7 @@
14 14 #include "../common/ngpixis.h"
15 15 #include <fsl_esdhc.h>
16 16 #include <spi_flash.h>
  17 +#include "../common/spl.h"
17 18  
18 19 DECLARE_GLOBAL_DATA_PTR;
19 20  
... ... @@ -120,7 +121,7 @@
120 121 #ifdef CONFIG_SPL_MMC_BOOT
121 122 mmc_boot();
122 123 #elif defined(CONFIG_SPL_SPI_BOOT)
123   - spi_boot();
  124 + fsl_spi_boot();
124 125 #elif defined(CONFIG_SPL_NAND_BOOT)
125 126 nand_boot();
126 127 #endif
board/freescale/p1_p2_rdb_pc/spl.c
... ... @@ -13,6 +13,7 @@
13 13 #include <i2c.h>
14 14 #include <fsl_esdhc.h>
15 15 #include <spi_flash.h>
  16 +#include "../common/spl.h"
16 17  
17 18 DECLARE_GLOBAL_DATA_PTR;
18 19  
... ... @@ -117,7 +118,7 @@
117 118 #ifdef CONFIG_SPL_MMC_BOOT
118 119 mmc_boot();
119 120 #elif defined(CONFIG_SPL_SPI_BOOT)
120   - spi_boot();
  121 + fsl_spi_boot();
121 122 #elif defined(CONFIG_SPL_NAND_BOOT)
122 123 nand_boot();
123 124 #endif
board/freescale/t102xqds/spl.c
... ... @@ -14,6 +14,7 @@
14 14 #include <spi_flash.h>
15 15 #include "../common/qixis.h"
16 16 #include "t102xqds_qixis.h"
  17 +#include "../common/spl.h"
17 18  
18 19 DECLARE_GLOBAL_DATA_PTR;
19 20  
... ... @@ -132,8 +133,8 @@
132 133 (uchar *)CONFIG_ENV_ADDR);
133 134 #endif
134 135 #ifdef CONFIG_SPL_SPI_BOOT
135   - spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
136   - (uchar *)CONFIG_ENV_ADDR);
  136 + fsl_spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
  137 + (uchar *)CONFIG_ENV_ADDR);
137 138 #endif
138 139  
139 140 gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
... ... @@ -146,7 +147,7 @@
146 147 #ifdef CONFIG_SPL_MMC_BOOT
147 148 mmc_boot();
148 149 #elif defined(CONFIG_SPL_SPI_BOOT)
149   - spi_boot();
  150 + fsl_spi_boot();
150 151 #elif defined(CONFIG_SPL_NAND_BOOT)
151 152 nand_boot();
152 153 #endif
board/freescale/t102xrdb/spl.c
... ... @@ -13,6 +13,7 @@
13 13 #include <fsl_esdhc.h>
14 14 #include <spi_flash.h>
15 15 #include "../common/sleep.h"
  16 +#include "../common/spl.h"
16 17  
17 18 DECLARE_GLOBAL_DATA_PTR;
18 19  
... ... @@ -119,8 +120,8 @@
119 120 (uchar *)CONFIG_ENV_ADDR);
120 121 #endif
121 122 #ifdef CONFIG_SPL_SPI_BOOT
122   - spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
123   - (uchar *)CONFIG_ENV_ADDR);
  123 + fsl_spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
  124 + (uchar *)CONFIG_ENV_ADDR);
124 125 #endif
125 126  
126 127 gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
... ... @@ -133,7 +134,7 @@
133 134 #ifdef CONFIG_SPL_MMC_BOOT
134 135 mmc_boot();
135 136 #elif defined(CONFIG_SPL_SPI_BOOT)
136   - spi_boot();
  137 + fsl_spi_boot();
137 138 #elif defined(CONFIG_SPL_NAND_BOOT)
138 139 nand_boot();
139 140 #endif
board/freescale/t104xrdb/spl.c
... ... @@ -13,6 +13,7 @@
13 13 #include <fsl_esdhc.h>
14 14 #include <spi_flash.h>
15 15 #include "../common/sleep.h"
  16 +#include "../common/spl.h"
16 17  
17 18 DECLARE_GLOBAL_DATA_PTR;
18 19  
... ... @@ -114,8 +115,8 @@
114 115 (uchar *)CONFIG_ENV_ADDR);
115 116 #endif
116 117 #ifdef CONFIG_SPL_SPI_BOOT
117   - spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
118   - (uchar *)CONFIG_ENV_ADDR);
  118 + fsl_spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
  119 + (uchar *)CONFIG_ENV_ADDR);
119 120 #endif
120 121 gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
121 122 gd->env_valid = 1;
... ... @@ -129,7 +130,7 @@
129 130 #ifdef CONFIG_SPL_MMC_BOOT
130 131 mmc_boot();
131 132 #elif defined(CONFIG_SPL_SPI_BOOT)
132   - spi_boot();
  133 + fsl_spi_boot();
133 134 #elif defined(CONFIG_SPL_NAND_BOOT)
134 135 nand_boot();
135 136 #endif
board/freescale/t208xqds/spl.c
... ... @@ -14,6 +14,7 @@
14 14 #include <spi_flash.h>
15 15 #include "../common/qixis.h"
16 16 #include "t208xqds_qixis.h"
  17 +#include "../common/spl.h"
17 18  
18 19 DECLARE_GLOBAL_DATA_PTR;
19 20  
... ... @@ -118,8 +119,8 @@
118 119 (uchar *)CONFIG_ENV_ADDR);
119 120 #endif
120 121 #ifdef CONFIG_SPL_SPI_BOOT
121   - spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
122   - (uchar *)CONFIG_ENV_ADDR);
  122 + fsl_spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
  123 + (uchar *)CONFIG_ENV_ADDR);
123 124 #endif
124 125  
125 126 gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
... ... @@ -132,7 +133,7 @@
132 133 #ifdef CONFIG_SPL_MMC_BOOT
133 134 mmc_boot();
134 135 #elif defined(CONFIG_SPL_SPI_BOOT)
135   - spi_boot();
  136 + fsl_spi_boot();
136 137 #elif defined(CONFIG_SPL_NAND_BOOT)
137 138 nand_boot();
138 139 #endif
board/freescale/t208xrdb/spl.c
... ... @@ -12,6 +12,7 @@
12 12 #include <mmc.h>
13 13 #include <fsl_esdhc.h>
14 14 #include <spi_flash.h>
  15 +#include "../common/spl.h"
15 16  
16 17 DECLARE_GLOBAL_DATA_PTR;
17 18  
... ... @@ -88,8 +89,8 @@
88 89 (uchar *)CONFIG_ENV_ADDR);
89 90 #endif
90 91 #ifdef CONFIG_SPL_SPI_BOOT
91   - spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
92   - (uchar *)CONFIG_ENV_ADDR);
  92 + fsl_spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
  93 + (uchar *)CONFIG_ENV_ADDR);
93 94 #endif
94 95  
95 96 gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
... ... @@ -102,7 +103,7 @@
102 103 #ifdef CONFIG_SPL_MMC_BOOT
103 104 mmc_boot();
104 105 #elif defined(CONFIG_SPL_SPI_BOOT)
105   - spi_boot();
  106 + fsl_spi_boot();
106 107 #elif defined(CONFIG_SPL_NAND_BOOT)
107 108 nand_boot();
108 109 #endif
drivers/mtd/spi/fsl_espi_spl.c
... ... @@ -12,7 +12,7 @@
12 12 #define ESPI_BOOT_IMAGE_ADDR 0x50
13 13 #define CONFIG_CFG_DATA_SECTOR 0
14 14  
15   -void spi_spl_load_image(uint32_t offs, unsigned int size, void *vdst)
  15 +void fsl_spi_spl_load_image(uint32_t offs, unsigned int size, void *vdst)
16 16 {
17 17 struct spi_flash *flash;
18 18  
... ... @@ -31,7 +31,7 @@
31 31 * configured and available since this code loads the main U-Boot image
32 32 * from SPI into SDRAM and starts it from there.
33 33 */
34   -void spi_boot(void)
  34 +void fsl_spi_boot(void)
35 35 {
36 36 void (*uboot)(void) __noreturn;
37 37 u32 offset, code_len, copy_len = 0;
... ... @@ -239,8 +239,5 @@
239 239 return flash->flash_unlock(flash, ofs, len);
240 240 }
241 241  
242   -void spi_boot(void) __noreturn;
243   -void spi_spl_load_image(uint32_t offs, unsigned int size, void *vdst);
244   -
245 242 #endif /* _SPI_FLASH_H_ */