Commit 8d7d97e2d1a340ddc2ebe2286bb212ae3f54da62
Committed by
Stefan Roese
1 parent
16b6aefafd
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
arm: mvebu: helios4: Enable SPI flash support
Enable SPI flash support under U-Boot and SPL. The ENV size and offset, ported from U-Boot 2013.01 Marvell version: 2015_T1.0p16 To create U-Boot image for SPI flash, user would need to replace * CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC with CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI * CONFIG_ENV_IS_IN_MMC with CONFIG_ENV_IS_IN_SPI_FLASH Signed-off-by: Aditya Prayoga <aditya@kobol.io> Reviewed-by: Stefan Roese <sr@denx.de> Tested-By: Dennis Gilmore <dgilmore@redhat.com> Reviewed-By: Dennis Gilmore <dgilmore@redhat.com> Signed-off-by: Stefan Roese <sr@denx.de>
Showing 3 changed files with 41 additions and 1 deletions Side-by-side Diff
arch/arm/dts/armada-388-helios4-u-boot.dtsi
configs/helios4_defconfig
include/configs/helios4.h
... | ... | @@ -6,6 +6,8 @@ |
6 | 6 | #ifndef _CONFIG_HELIOS4_H |
7 | 7 | #define _CONFIG_HELIOS4_H |
8 | 8 | |
9 | +#include <linux/sizes.h> | |
10 | + | |
9 | 11 | /* |
10 | 12 | * High Level Configuration Options (easy to change) |
11 | 13 | */ |
... | ... | @@ -23,6 +25,9 @@ |
23 | 25 | |
24 | 26 | /* SPI NOR flash default params, used by sf commands */ |
25 | 27 | #define CONFIG_SF_DEFAULT_BUS 1 |
28 | +#define CONFIG_SF_DEFAULT_CS 0 | |
29 | +#define CONFIG_SF_DEFAULT_SPEED 104000000 | |
30 | +#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3 | |
26 | 31 | |
27 | 32 | /* |
28 | 33 | * SDIO/MMC Card Configuration |
... | ... | @@ -43,6 +48,21 @@ |
43 | 48 | #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ |
44 | 49 | CONFIG_SYS_SCSI_MAX_LUN) |
45 | 50 | |
51 | +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI | |
52 | +/* | |
53 | + * SPI Flash configuration for the environment access | |
54 | + */ | |
55 | +#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS | |
56 | +#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS | |
57 | +#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED | |
58 | + | |
59 | +/* Environment in SPI NOR flash */ | |
60 | +#define CONFIG_ENV_SECT_SIZE SZ_64K | |
61 | +#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE | |
62 | +#define CONFIG_ENV_OFFSET SZ_1M | |
63 | +#endif | |
64 | + | |
65 | +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC | |
46 | 66 | /* Environment in MMC */ |
47 | 67 | #define CONFIG_SYS_MMC_ENV_DEV 0 |
48 | 68 | #define CONFIG_ENV_SECT_SIZE 0x200 |
... | ... | @@ -50,6 +70,7 @@ |
50 | 70 | /* stay within first 1M */ |
51 | 71 | #define CONFIG_ENV_OFFSET (SZ_1M - CONFIG_ENV_SIZE) |
52 | 72 | #define CONFIG_ENV_ADDR CONFIG_ENV_OFFSET |
73 | +#endif | |
53 | 74 | |
54 | 75 | #define CONFIG_PHY_MARVELL /* there is a marvell phy */ |
55 | 76 | #define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */ |
56 | 77 | |
... | ... | @@ -69,7 +90,13 @@ |
69 | 90 | */ |
70 | 91 | #define SPL_BOOT_SPI_NOR_FLASH 1 |
71 | 92 | #define SPL_BOOT_SDIO_MMC_CARD 2 |
93 | + | |
94 | +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI | |
95 | +#define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SPI_NOR_FLASH | |
96 | +#endif | |
97 | +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC | |
72 | 98 | #define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SDIO_MMC_CARD |
99 | +#endif | |
73 | 100 | |
74 | 101 | /* Defines for SPL */ |
75 | 102 | #define CONFIG_SPL_SIZE (140 << 10) |
76 | 103 | |
... | ... | @@ -88,12 +115,16 @@ |
88 | 115 | |
89 | 116 | #if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH |
90 | 117 | /* SPL related SPI defines */ |
118 | +#define CONFIG_SPL_SPI_FLASH_SUPPORT | |
119 | +#define CONFIG_SPL_SPI_LOAD | |
120 | +#define CONFIG_SPL_SPI_SUPPORT | |
91 | 121 | #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 |
92 | 122 | #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_SPI_U_BOOT_OFFS |
93 | 123 | #endif |
94 | 124 | |
95 | 125 | #if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD |
96 | 126 | /* SPL related MMC defines */ |
127 | +#define CONFIG_SPL_MMC_SUPPORT | |
97 | 128 | #define CONFIG_SYS_MMC_U_BOOT_OFFS (160 << 10) |
98 | 129 | #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_MMC_U_BOOT_OFFS |
99 | 130 | #ifdef CONFIG_SPL_BUILD |