[U-Boot] [PATCH 1/2] arm: sunxi: allwinner spi driver sun6i support
Minimal changes to support sun6i based Allwinner SOCs Changes are based to SPL driver arch/arm/mach-sunxi/spl_spi_sunxi.c Signed-off-by: Oskari Lemmela --- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 1 + arch/arm/include/asm/arch-sunxi/clock_sun9i.h | 1 + drivers/spi/Kconfig | 4 +- drivers/spi/sun4i_spi.c | 116 -- 4 files changed, 107 insertions(+), 15 deletions(-) diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h index ee387127f3..4aaa0932d7 100644 --- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h +++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h @@ -321,6 +321,7 @@ struct sunxi_ccm_reg { #define AHB_GATE_OFFSET_MMC(n) (AHB_GATE_OFFSET_MMC0 + (n)) #define AHB_GATE_OFFSET_DMA6 #define AHB_GATE_OFFSET_SS 5 +#define AHB_GATE_OFFSET_SPI0 20 /* ahb_gate1 offsets */ #define AHB_GATE_OFFSET_DRC0 25 diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun9i.h b/arch/arm/include/asm/arch-sunxi/clock_sun9i.h index 530e0dd73b..9bbd4d319e 100644 --- a/arch/arm/include/asm/arch-sunxi/clock_sun9i.h +++ b/arch/arm/include/asm/arch-sunxi/clock_sun9i.h @@ -194,6 +194,7 @@ struct sunxi_ccm_reg { /* ahb gate1 field */ #define AHB_GATE_OFFSET_DMA24 +#define AHB_GATE_OFFSET_SPI0 20 /* apb1_gate fields */ #define APB1_GATE_UART_SHIFT 16 diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index a7bb5b35c2..88e772cb1a 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -219,9 +219,9 @@ config STM32_QSPI this ST IP core. config SUN4I_SPI - bool "Allwinner A10 SoCs SPI controller" + bool "Allwinner SoCs SPI driver" help - SPI driver for Allwinner sun4i, sun5i and sun7i SoCs + SPI driver for Allwinner SoCs config TEGRA114_SPI bool "nVidia Tegra114 SPI driver" diff --git a/drivers/spi/sun4i_spi.c b/drivers/spi/sun4i_spi.c index 38cc743c61..7af8be15cf 100644 --- a/drivers/spi/sun4i_spi.c +++ b/drivers/spi/sun4i_spi.c @@ -37,6 +37,30 @@ #define SUN4I_TXDATA_REG 0x04 +#ifdef CONFIG_SUNXI_GEN_SUN6I +#define SUN4I_CTL_REG 0x04 +#define SUN4I_CTL_ENABLE BIT(0) +#define SUN4I_CTL_MASTER BIT(1) +#define SUN4I_CTL_TP BIT(7) +#define SUN4I_CTL_SRST BIT(31) + +#define SUN4I_CTL_CPHA BIT(0) +#define SUN4I_CTL_CPOL BIT(1) +#define SUN4I_CTL_CS_ACTIVE_LOWBIT(2) +#define SUN4I_CTL_CS_MASK 0x30 +#define SUN4I_CTL_CS(cs) (((cs) << 4) & SUN4I_CTL_CS_MASK) +#define SUN4I_CTL_CS_MANUALBIT(6) +#define SUN4I_CTL_CS_LEVEL BIT(7) +#define SUN4I_CTL_DHB BIT(8) +#define SUN4I_CTL_XCH_MASK 0x8000 +#define SUN4I_CTL_XCH BIT(31) + +#define SUN4I_CTL_RF_RST BIT(15) +#define SUN4I_CTL_TF_RST BIT(31) + +#else +#define SUN4I_CTL_SRST 0 + #define SUN4I_CTL_REG 0x08 #define SUN4I_CTL_ENABLE BIT(0) #define SUN4I_CTL_MASTER BIT(1) @@ -54,6 +78,7 @@ #define SUN4I_CTL_CS_MANUALBIT(16) #define SUN4I_CTL_CS_LEVEL BIT(17) #define SUN4I_CTL_TP BIT(18) +#endif #define SUN4I_INT_CTL_REG 0x0c #define SUN4I_INT_CTL_RF_F34 BIT(4) @@ -92,11 +117,39 @@ #define SUN4I_SPI_DEFAULT_RATE 100 #define SUN4I_SPI_TIMEOUT_US 100 +#ifdef CONFIG_SUNXI_GEN_SUN6I +/* sun6i spi register set */ +struct sun4i_spi_regs { + u32 res0; + u32 ctl;/* 0x04 */ + u32 tctl; /* 0x08 */ + u32 res1; + u32 intctl; /* 0x10 */ + u32 st; /* 0x14 */ + u32 fifo_ctl; /* 0x18 */ + u32 fifo_sta; /* 0x1c */ + u32 wait; /* 0x20 */ + u32 cctl; /* 0x24 */ + u32 res2[2]; + u32 bc; /* 0x30 */ + u32 tc; /* 0x34 */ + u32 bctl; /* 0x38 */ + u32 res3[113]; + u32 txdata; /* 0x200 */ + u32 res4[63]; + u32 rxdata; /* 0x300 */ +}; +#else /* sun4i spi register set */ struct sun4i_spi_regs { u32 rxdata; u32 txdata; - u32 ctl; + union { + u32 ctl; + u32 tctl; + u32 fifo_ctl; + u32 bctl; + }; u32 intctl; u32 st; u32 dmactl; @@ -106,6 +159,7 @@ struct sun4i_spi_regs { u32 tc; u32 fifo_sta; }; +#endif struct sun4i_spi_platdata { u32 base_addr; @@ -149,7 +203,7 @@ static void sun4i_spi_set_cs(struct udevice *bus, u8 cs, bool enable) struct sun4i_spi_priv *priv = dev_get_priv(bus); u32 reg; - reg = readl(&priv->regs->ctl); + reg = readl(&
[U-Boot] [PATCH 2/2] arm: timer: sunxi: fix spurious timeout issues
Fixes spurious timeouts which have seen during testing SPI driver. Timeouts disappear when number of bits are reduced to 10. Timer tiny backward jumps causes spurious timeouts. Signed-off-by: Oskari Lemmela --- arch/arm/cpu/armv8/generic_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c index c1706dcec1..2e06ee4ed2 100644 --- a/arch/arm/cpu/armv8/generic_timer.c +++ b/arch/arm/cpu/armv8/generic_timer.c @@ -66,7 +66,7 @@ unsigned long timer_read_counter(void) isb(); do { asm volatile("mrs %0, cntpct_el0" : "=r" (cntpct)); - } while (((cntpct + 1) & GENMASK(10, 0)) <= 1); + } while (((cntpct + 1) & GENMASK(9, 0)) <= 1); return cntpct; } -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/2] sunxi sun6i SPI support
Minimal changes to support sun6i SPI with current sun4i SPI driver. During testing I faced random spurious timeouts when reading 16MB flash device. When debugging spurious timeouts those values seems to be -1us. Because timeouts are calculated as unsigned values tiny backward timer jumps causes this kind of issues. Oskari Lemmela (2): arm: sunxi: allwinner spi driver sun6i support arm: timer: sunxi: fix spurious timeout issues arch/arm/cpu/armv8/generic_timer.c| 2 +- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 1 + arch/arm/include/asm/arch-sunxi/clock_sun9i.h | 1 + drivers/spi/Kconfig | 4 +- drivers/spi/sun4i_spi.c | 116 -- 5 files changed, 108 insertions(+), 16 deletions(-) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] env: check defines if config env is in spi flash
Check config environment defines if CONFIG_ENV_IS_IN_SPI_FLASH is defined Signed-off-by: Oskari Lemmela --- include/environment.h | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/include/environment.h b/include/environment.h index 7da1291d5b..d486c8899b 100644 --- a/include/environment.h +++ b/include/environment.h @@ -21,6 +21,19 @@ * */ +#if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_IS_IN_SPI_FLASH) +# if defined(CONFIG_ENV_SECT_SIZE) || defined(CONFIG_ENV_SIZE) +# ifndef CONFIG_ENV_SECT_SIZE +# define CONFIG_ENV_SECT_SIZECONFIG_ENV_SIZE +# endif +# ifndef CONFIG_ENV_SIZE +# define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE +# endif +# else +# error "Both CONFIG_ENV_SECT_SIZE and CONFIG_ENV_SIZE undefined" +# endif +#endif + #if defined(CONFIG_ENV_IS_IN_FLASH) # ifndef CONFIG_ENV_ADDR # define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET) @@ -32,16 +45,6 @@ # define CONFIG_ENV_ADDR_REDUND \ (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET_REDUND) # endif -# if defined(CONFIG_ENV_SECT_SIZE) || defined(CONFIG_ENV_SIZE) -# ifndef CONFIG_ENV_SECT_SIZE -# define CONFIG_ENV_SECT_SIZECONFIG_ENV_SIZE -# endif -# ifndef CONFIG_ENV_SIZE -# define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE -# endif -# else -# error "Both CONFIG_ENV_SECT_SIZE and CONFIG_ENV_SIZE undefined" -# endif # if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND) # define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE # endif -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] sunxi: add spi flash bootcmd
Enable SPI bootcmd if CONFIG_DM_SPI_FLASH is defined. Signed-off-by: Oskari Lemmela --- include/configs/sunxi-common.h | 16 1 file changed, 16 insertions(+) diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 9819d9980c..b2443ef678 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -401,6 +401,21 @@ extern int soft_i2c_gpio_scl; #define BOOT_TARGET_DEVICES_USB(func) #endif +#ifdef CONFIG_DM_SPI_FLASH +#define BOOT_TARGET_DEVICES_SPI(func) func(SPI, spi, 0) +#define BOOTENV_DEV_SPI(devtypeu, devtypel, instance) \ + "image_addr=0x10\0" \ + "image_size=0x70\0" \ + "bootcmd_" #devtypel #instance "=" \ + "if sf probe " #instance "; then " \ + "sf read ${ramdisk_addr_r} ${image_addr} ${image_size}; " \ + "bootm ${ramdisk_addr_r}; " \ + "fi\0" +#define BOOTENV_DEV_NAME_SPI(devtypeu, devtypel, instance) \ + #devtypel #instance " " +#else +#define BOOT_TARGET_DEVICES_SPI(func) +#endif /* FEL boot support, auto-execute boot.scr if a script address was provided */ #define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \ "bootcmd_fel=" \ @@ -416,6 +431,7 @@ extern int soft_i2c_gpio_scl; BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_SCSI(func) \ BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_SPI(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] arm: timer: sunxi: fix a64 spurious timeout issues
Fixes spurious timeouts which have been seen during testing SPI_SUNXI driver. The false timeouts disappear when number of bits reduced to 10 in workaround. The false timeouts are caused by timer backward jumps. Signed-off-by: Oskari Lemmela --- arch/arm/cpu/armv8/generic_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c index c1706dcec1..2e06ee4ed2 100644 --- a/arch/arm/cpu/armv8/generic_timer.c +++ b/arch/arm/cpu/armv8/generic_timer.c @@ -66,7 +66,7 @@ unsigned long timer_read_counter(void) isb(); do { asm volatile("mrs %0, cntpct_el0" : "=r" (cntpct)); - } while (((cntpct + 1) & GENMASK(10, 0)) <= 1); + } while (((cntpct + 1) & GENMASK(9, 0)) <= 1); return cntpct; } -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] env: add support to sunxi save env to spi
CONFIG_ENV_SECT_SIZE value is defined via Kconfig. Signed-off-by: Oskari Lemmela --- env/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/env/Kconfig b/env/Kconfig index c22cbbdadc..e1070187f2 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -456,9 +456,9 @@ config ENV_SIZE config ENV_SECT_SIZE hex "Environment Sector-Size" - depends on !ENV_IS_NOWHERE && (ARCH_ZYNQ || ARCH_ZYNQMP) + depends on !ENV_IS_NOWHERE && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_SUNXI ) default 0x4 if ARCH_ZYNQMP - default 0x2 if ARCH_ZYNQ + default 0x2 if ARCH_ZYNQ || ARCH_SUNXI help Size of the sector containing the environment. -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/3] env: add support to sunxi save env to spi
Changes since v1: - Rebase to current master - Added patches for testing with pine64-lts board Oskari Lemmela (3): env: add support to sunxi save env to spi flash sunxi: Pine64-LTS: enable environment in spi flash arm: dts: sunxi: add spi0 alias arch/arm/dts/sunxi-u-boot.dtsi | 1 + configs/pine64-lts_defconfig | 7 +++ env/Kconfig| 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/3] env: add support to sunxi save env to spi flash
CONFIG_ENV_SECT_SIZE value is defined via Kconfig. Signed-off-by: Oskari Lemmela Reviewed-by: Paul Kocialkowski --- env/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/env/Kconfig b/env/Kconfig index 74db2f38cc..083de650ce 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -491,9 +491,9 @@ config ENV_SIZE config ENV_SECT_SIZE hex "Environment Sector-Size" - depends on (!ENV_IS_NOWHERE && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_OMAP2PLUS || ARCH_AT91) )|| ARCH_STM32MP + depends on (!ENV_IS_NOWHERE && (ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_OMAP2PLUS || ARCH_AT91 || ARCH_SUNXI) )|| ARCH_STM32MP default 0x4 if ARCH_ZYNQMP - default 0x2 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91 + default 0x2 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91 || ARCH_SUNXI help Size of the sector containing the environment. -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/3] sunxi: Pine64-LTS: enable environment in spi flash
enable config options for spi flash device and environment in spi flash. Signed-off-by: Oskari Lemmela --- configs/pine64-lts_defconfig | 7 +++ 1 file changed, 7 insertions(+) diff --git a/configs/pine64-lts_defconfig b/configs/pine64-lts_defconfig index 0da6b70ea8..34c38cf1fd 100644 --- a/configs/pine64-lts_defconfig +++ b/configs/pine64-lts_defconfig @@ -18,3 +18,10 @@ CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_SUNXI=y -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/3] arm: dts: sunxi: add spi0 alias
spi aliases are needed for spi flash devices. Signed-off-by: Oskari Lemmela --- arch/arm/dts/sunxi-u-boot.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi index fdd4c80aa4..b6e075f785 100644 --- a/arch/arm/dts/sunxi-u-boot.dtsi +++ b/arch/arm/dts/sunxi-u-boot.dtsi @@ -3,6 +3,7 @@ / { aliases { mmc1 = &mmc2; + spi0 = &spi0; }; binman { -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 0/2] sunxi: add spi flash bootcmd
Changes since v2: - Rebase to current master - Added more information to Kconfig help text Changes since v1: - Move bootcmd to config_distro_bootcmd - Add Kconfig options to enable and configure it Oskari Lemmela (2): distro_bootcmd: add spi flash boot command sunxi: enable distro spi boot command Kconfig | 32 include/config_distro_bootcmd.h | 16 include/configs/sunxi-common.h | 1 + 3 files changed, 49 insertions(+) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 2/2] sunxi: enable distro spi boot command
Signed-off-by: Oskari Lemmela --- include/configs/sunxi-common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 7be94ee7d1..cb7b68cf72 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -414,6 +414,7 @@ extern int soft_i2c_gpio_scl; BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_SCSI(func) \ BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_SPI(func) \ BOOT_TARGET_DEVICES_PXE(func) \ BOOT_TARGET_DEVICES_DHCP(func) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/2] distro_bootcmd: add spi flash boot command
Add a boot command to distro boot to support load FIT image from SPI flash. Tested with Pine A64-LTS board to load kernel and dtb. Signed-off-by: Oskari Lemmela --- Kconfig | 32 include/config_distro_bootcmd.h | 16 2 files changed, 48 insertions(+) diff --git a/Kconfig b/Kconfig index d2eb744e70..391ce58810 100644 --- a/Kconfig +++ b/Kconfig @@ -395,6 +395,38 @@ config FIT_IMAGE_POST_PROCESS injected into the FIT creation (i.e. the blobs would have been pre- processed before being added to the FIT image). +config FIT_SPI_FLASH_BOOT + bool "Distro bootcmd from SPI Flash" + depends on DM_SPI_FLASH + imply CMD_SF + help + Enable SPI bootcmd to load FIT image from SPI flash. Command + probes for the SPI flash device. If device is found command + will try to load FIT image to memory and boot it. + +config FIT_FLASH_IMAGE_ADDR + hex "FIT image memory address" + depends on FIT_SPI_FLASH_BOOT + help + Memory address where to load FIT image. + +config FIT_FLASH_IMAGE_OFFSET + hex "FIT image flash offset" + depends on FIT_SPI_FLASH_BOOT + default 0x10 + help + Flash offset of FIT image. Default 1MB offset leaves space for u-boot + itself. + +config FIT_FLASH_IMAGE_SIZE + hex "FIT image size" + depends on FIT_SPI_FLASH_BOOT + default 0x70 + help + Maximum size of the FIT image. Default value of 7MB is enough for + small compressed kernel, dtb and ramdisk. Reducing offset and image + size allows to use smaller than 8MB flash devices. + if SPL config SPL_FIT diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 3570a32dff..8c6376ccab 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -280,6 +280,22 @@ BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB #endif +#ifdef CONFIG_FIT_SPI_FLASH_BOOT +#define BOOT_TARGET_DEVICES_SPI(func) func(SPI, spi, 0) +#define BOOTENV_DEV_SPI(devtypeu, devtypel, instance) \ + "image_addr_r=" __stringify(CONFIG_FIT_FLASH_IMAGE_ADDR) "\0" \ + "image_addr=" __stringify(CONFIG_FIT_FLASH_IMAGE_OFFSET) "\0" \ + "image_size=" __stringify(CONFIG_FIT_FLASH_IMAGE_SIZE) "\0" \ + "bootcmd_" #devtypel #instance "=" \ + "if sf probe " #instance "; then " \ + "sf read ${image_addr_r} ${image_addr} ${image_size}; " \ + "bootm ${image_addr_r}; " \ + "fi\0" +#define BOOTENV_DEV_NAME_SPI BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOT_TARGET_DEVICES_SPI(func) +#endif + #ifdef CONFIG_CMD_VIRTIO #define BOOTENV_RUN_VIRTIO_INIT "run virtio_init; " #define BOOTENV_SET_VIRTIO_NEED_INIT "virtio_need_init=; " -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC PATCH 0/1] SPI flash dependency rework
Currently TARGET_* and ARCH_* selects multiple spi related CONFIG options. If dependency order of spi related CONFIG options is reverse, they are selected as dependencies when needed. Oskari Lemmela (1): spi: Kconfig: change dependency order drivers/mtd/spi/Kconfig | 28 -- drivers/spi/Kconfig | 63 - 2 files changed, 75 insertions(+), 16 deletions(-) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC PATCH 1/1] spi: Kconfig: change dependency order
SPI Kconfig logic is changed to reverse dependencies. Dependencies are not needed to be defined in the defconfig. Signed-off-by: Oskari Lemmela --- drivers/mtd/spi/Kconfig | 28 -- drivers/spi/Kconfig | 63 - 2 files changed, 75 insertions(+), 16 deletions(-) diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig index 76d5a1d115..19ec3a9c9b 100644 --- a/drivers/mtd/spi/Kconfig +++ b/drivers/mtd/spi/Kconfig @@ -17,7 +17,8 @@ config DM_SPI_FLASH config SPI_FLASH_SANDBOX bool "Support sandbox SPI flash device" - depends on SANDBOX && DM_SPI_FLASH + depends on SANDBOX + select DM_SPI_FLASH help Since sandbox cannot access real devices, an emulation mechanism is provided instead. Drivers can be connected up to the sandbox SPI @@ -27,6 +28,8 @@ config SPI_FLASH_SANDBOX config SPI_FLASH bool "Legacy SPI Flash Interface support" + imply CMD_SF + select SPI help Enable the legacy SPI flash support. This will include basic standard support for things like probing, read / write, and @@ -36,7 +39,7 @@ config SPI_FLASH config SPI_FLASH_BAR bool "SPI flash Bank/Extended address register support" - depends on SPI_FLASH + select SPI_FLASH help Enable the SPI flash Bank/Extended address register support. Bank/Extended address registers are used to access the flash @@ -44,66 +47,72 @@ config SPI_FLASH_BAR config SF_DUAL_FLASH bool "SPI DUAL flash memory support" - depends on SPI_FLASH + select SPI_FLASH help Enable this option to support two flash memories connected to a single controller. Currently Xilinx Zynq qspi supports this. -if SPI_FLASH - config SPI_FLASH_ATMEL bool "Atmel SPI flash support" + select SPI_FLASH help Add support for various Atmel SPI flash chips (AT45xxx and AT25xxx) config SPI_FLASH_EON bool "EON SPI flash support" + select SPI_FLASH help Add support for various EON SPI flash chips (EN25xxx) config SPI_FLASH_GIGADEVICE bool "GigaDevice SPI flash support" + select SPI_FLASH help Add support for various GigaDevice SPI flash chips (GD25xxx) config SPI_FLASH_ISSI bool "ISSI SPI flash support" + select SPI_FLASH help Add support for various ISSI SPI flash chips (ISxxx) config SPI_FLASH_MACRONIX bool "Macronix SPI flash support" + select SPI_FLASH help Add support for various Macronix SPI flash chips (MX25Lxxx) config SPI_FLASH_SPANSION bool "Spansion SPI flash support" + select SPI_FLASH help Add support for various Spansion SPI flash chips (S25FLxxx) config SPI_FLASH_STMICRO bool "STMicro SPI flash support" + select SPI_FLASH help Add support for various STMicro SPI flash chips (M25Pxxx and N25Qxxx) config SPI_FLASH_SST bool "SST SPI flash support" + select SPI_FLASH help Add support for various SST SPI flash chips (SST25xxx) config SPI_FLASH_WINBOND bool "Winbond SPI flash support" + select SPI_FLASH help Add support for various Winbond SPI flash chips (W25xxx) config SPI_FLASH_XMC bool "XMC SPI flash support" + select SPI_FLASH help Add support for various XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) SPI flash chips (XM25xxx) -endif - config SPI_FLASH_USE_4K_SECTORS bool "Use small 4096 B erase sectors" depends on SPI_FLASH @@ -121,7 +130,8 @@ config SPI_FLASH_USE_4K_SECTORS config SPI_FLASH_DATAFLASH bool "AT45xxx DataFlash support" - depends on SPI_FLASH && DM_SPI_FLASH + select SPI_FLASH + select DM_SPI_FLASH help Enable the access for SPI-flash-based AT45xxx DataFlash chips. DataFlash is a kind of SPI flash. Most AT45 chips have two buffers @@ -136,7 +146,7 @@ config SPI_FLASH_DATAFLASH config SPI_FLASH_MTD bool "SPI Flash MTD support" - depends on SPI_FLASH + select SPI_FLASH help Enable the MTD support for spi flash layer, this adapter is for translating mtd_read/mtd_write commands into spi_flash_read/write diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index fa76d8c3c0..c825384edf 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -1,7 +1,7 @@ -menuconfig SPI - bool "SPI Support" +menu "SPI Support" -if SPI +config SPI + bool "SPI Support" config DM_SPI bool "Enable
[U-Boot] [PATCH v2 0/2] sunxi: add spi flash bootcmd
Patches enable booting FIT image from SPI flash device. Changes since v1: - Move bootcmd to config_distro_bootcmd - Add Kconfig options to enable and configure it Oskari Lemmela (2): distro_bootcmd: add spi flash boot command sunxi: enable distro spi boot command Kconfig | 29 + include/config_distro_bootcmd.h | 16 include/configs/sunxi-common.h | 1 + 3 files changed, 46 insertions(+) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] distro_bootcmd: add spi flash boot command
Add a boot command to distro boot to support load FIT image from SPI flash. Signed-off-by: Oskari Lemmela --- Kconfig | 29 + include/config_distro_bootcmd.h | 16 2 files changed, 45 insertions(+) diff --git a/Kconfig b/Kconfig index a078f7b1b6..f28fbf4fc0 100644 --- a/Kconfig +++ b/Kconfig @@ -342,6 +342,35 @@ config FIT_IMAGE_POST_PROCESS injected into the FIT creation (i.e. the blobs would have been pre- processed before being added to the FIT image). +config FIT_SPI_FLASH_BOOT + bool "Distro bootcmd from SPI Flash" + depends on DM_SPI_FLASH + imply CMD_SF + help + Enable SPI bootcmd to load FIT image from SPI flash. Command + probes for the SPI flash device. If device is found command + will try to load FIT image to memory and boot it. + +config FIT_FLASH_IMAGE_ADDR + hex "FIT image memory address" + depends on FIT_SPI_FLASH_BOOT + help + Memory address where to load FIT image. + +config FIT_FLASH_IMAGE_OFFSET + hex "FIT image flash offset" + depends on FIT_SPI_FLASH_BOOT + default 0x10 + help + Flash offset of FIT image. + +config FIT_FLASH_IMAGE_SIZE + hex "FIT image size" + depends on FIT_SPI_FLASH_BOOT + default 0x70 + help + Max size of the FIT image. + if SPL config SPL_FIT diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 555efb7433..75bc76c139 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -242,6 +242,22 @@ BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB #endif +#ifdef CONFIG_FIT_SPI_FLASH_BOOT +#define BOOT_TARGET_DEVICES_SPI(func) func(SPI, spi, 0) +#define BOOTENV_DEV_SPI(devtypeu, devtypel, instance) \ + "image_addr_r=" __stringify(CONFIG_FIT_FLASH_IMAGE_ADDR) "\0" \ + "image_addr=" __stringify(CONFIG_FIT_FLASH_IMAGE_OFFSET) "\0" \ + "image_size=" __stringify(CONFIG_FIT_FLASH_IMAGE_SIZE) "\0" \ + "bootcmd_" #devtypel #instance "=" \ + "if sf probe " #instance "; then " \ + "sf read ${image_addr_r} ${image_addr} ${image_size}; " \ + "bootm ${image_addr_r}; " \ + "fi\0" +#define BOOTENV_DEV_NAME_SPI BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOT_TARGET_DEVICES_SPI(func) +#endif + #ifdef CONFIG_CMD_VIRTIO #define BOOTENV_SHARED_VIRTIO BOOTENV_SHARED_BLKDEV(virtio) #define BOOTENV_DEV_VIRTIO BOOTENV_DEV_BLKDEV -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/2] sunxi: enable distro spi boot command
Signed-off-by: Oskari Lemmela --- include/configs/sunxi-common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index ed0cfc24f5..967f3e1f08 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -415,6 +415,7 @@ extern int soft_i2c_gpio_scl; BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_SCSI(func) \ BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_SPI(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot