arm: mvebu: Add some SPI CS attributes
Subsystems (3)
PATCH 1/3 arm: mvebu: Add some SPI CS attributes
These attribute defines may be used to map an area of memory for direct access to the specific SPI devices. See SPI Direct Access Mode for further information.
--- arch/arm/mach-mvebu/include/mach/cpu.h | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mach-mvebu/include/mach/cpu.h +3 -0
@@ -47,6 +47,9 @@ enum cpu_attrib {CPU_ATTR_DRAM_CS3 =0x07 ,CPU_ATTR_NANDFLASH =0x2f ,CPU_ATTR_SPIFLASH =0x1e , +CPU_ATTR_SPI0_CS0 =0x1e , +CPU_ATTR_SPI0_CS1 =0x5e , +CPU_ATTR_SPI1_CS2 =0x9a ,CPU_ATTR_BOOTROM =0x1d ,CPU_ATTR_PCIE_IO =0xe0 , CPU_ATTR_PCIE_MEM = 0xe8,
Signature · 1 line
2.7.1
PATCH 1/3 arm: mvebu: Add some SPI CS attributes
Quoted 6 lines · Stefan Roese
These attribute defines may be used to map an area of memory for direct access to the specific SPI devices. See SPI Direct Access Mode for further information.
Signed-off-by Stefan Roese <[email protected]>Cc Luka Perkov <[email protected]>
Applied to u-boot-marvell/master.
Thanks,
Stefan
PATCH 2/3 arm: mvebu: spi.h: Add registers for direct write access
In reply to Stefan RoeseThe direct write config register is needed for SPI direct write mode configuration.
--- arch/arm/include/asm/arch-mvebu/spi.h | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/include/asm/arch-mvebu/spi.h +3 -0
@@ -19,6 +19,9 @@ struct kwspi_registers {u32 din;/* 0x1060c */ u32 irq_cause;/* 0x10610 */ u32 irq_mask;/* 0x10614 */ +u32 timing1;/* 0x10618 */ +u32 timing2;/* 0x1061c */ +u32 dw_cfg;/* 0x10620 - Direct Write Configuration */ };/* They are used to define CONFIG_SYS_KW_SPI_MPP
Signature · 1 line
2.7.1
PATCH 2/3 arm: mvebu: spi.h: Add registers for direct write access
Quoted 5 lines · Stefan Roese
The direct write config register is needed for SPI direct write mode configuration.
Signed-off-by Stefan Roese <[email protected]>Cc Luka Perkov <[email protected]>
Applied to u-boot-marvell/master.
Thanks,
Stefan
PATCH v2 3/3 arm: mvebu: theadorable: Add StratixV FPGA programming support
In reply to Stefan RoeseThis patch adds support for Altera StratixV bitstream programming. 2 FPGAs are connected to the SPI busses. This patch uses board specific write code to program the bitstream via SPI direct write mode.
---
v2:
- Add missing mbus mapping for the SPI devices (direct access mode)
arch/arm/dts/armada-xp-theadorable.dts | 21 ++++ board/theadorable/Makefile | 1 + board/theadorable/fpga.c | 179 +++++++++++++++++++++++++++++++++ board/theadorable/theadorable.c | 13 +++ board/theadorable/theadorable.h | 12 +++ configs/theadorable_debug_defconfig | 3 +- configs/theadorable_defconfig | 2 +- include/configs/theadorable.h | 5 + 8 files changed, 234 insertions(+), 2 deletions(-) create mode 100644 board/theadorable/fpga.c create mode 100644 board/theadorable/theadorable.h
arch/arm/dts/armada-xp-theadorable.dts +21 -0
@@ -69,6 +69,7 @@ aliases { spi0 = &spi0; + spi1 = &spi1; ethernet0 = ð0; };
@@ -137,6 +138,26 @@ reg = <0>; /* Chip select 0 */ spi-max-frequency = <27777777>; }; + + fpga at 1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-generic-device"; + reg = <1>; /* Chip select 1 */ + spi-max-frequency = <27777777>; + }; + }; + + spi1: spi at 10680 { + status = "okay"; + + fpga at 2 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-generic-device"; + reg = <2>; /* Chip select 2 */ + spi-max-frequency = <27777777>; + }; }; }; };
board/theadorable/Makefile +1 -0
@@ -5,3 +5,4 @@ # obj-y := theadorable.o +obj-y += fpga.o
board/theadorable/fpga.c new file +179 -0
179 lines not on this page · raw message
board/theadorable/theadorable.c +13 -0
@@ -8,9 +8,11 @@#include <asm/io.h> #include <asm/arch/cpu.h> #include <asm/arch/soc.h> +#include <linux/mbus.h> #ifdef CONFIG_NET #include <netdev.h> #endif +#include "theadorable.h" #include "../drivers/ddr/marvell/axp/ddr3_hw_training.h" #include "../arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h"
@@ -136,6 +138,15 @@ int board_init(void)/* adress of boot parameters */ gd->bd->bi_boot_params =mvebu_sdram_bar (0 ) +0x100 ; +/* +* Map SPI devices via MBUS so that they can be accessed via +* the SPI direct access mode +*/ +mbus_dt_setup_win (&mbus_state,SPI_BUS0_DEV1_BASE ,SPI_BUS0_DEV1_SIZE , +CPU_TARGET_DEVICEBUS_BOOTROM_SPI ,CPU_ATTR_SPI0_CS1 ); +mbus_dt_setup_win (&mbus_state,SPI_BUS1_DEV2_BASE ,SPI_BUS0_DEV1_SIZE , +CPU_TARGET_DEVICEBUS_BOOTROM_SPI ,CPU_ATTR_SPI1_CS2 ); +return 0 ; }
@@ -143,6 +154,8 @@ int checkboard(void) {puts ("Board: theadorable\n" ); +board_fpga_add (); +return 0 ; }
board/theadorable/theadorable.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* Copyright (C) 2016 Stefan Roese <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/* Base addresses for the SPI direct access mode */ +#define SPI_BUS0_DEV1_BASE 0xe0000000 +#define SPI_BUS0_DEV1_SIZE (1 << 20) +#define SPI_BUS1_DEV2_BASE (SPI_BUS0_DEV1_BASE + SPI_BUS0_DEV1_SIZE) + +void board_fpga_add (void );
configs/theadorable_debug_defconfig +2 -1
@@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_THEADORABLE=y +CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="armada-xp-theadorable" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL=y
@@ -9,7 +10,7 @@ CONFIG_SPL=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_SF=y CONFIG_CMD_USB=y -# CONFIG_CMD_FPGA is not set +CONFIG_CMD_GPIO=y # CONFIG_CMD_SETEXPR is not set CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y
configs/theadorable_defconfig +1 -1
@@ -2,13 +2,13 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_THEADORABLE=y +CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="armada-xp-theadorable" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL=y # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set CONFIG_CMD_SF=y -# CONFIG_CMD_FPGA is not set # CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set
include/configs/theadorable.h +5 -0
@@ -115,6 +115,11 @@#define CONFIG_VGA_AS_SINGLE_DEVICE #define CONFIG_CMD_BMP +/* FPGA programming support */ +#define CONFIG_FPGA +#define CONFIG_FPGA_ALTERA +#define CONFIG_FPGA_STRATIX_V +/* * mv-common.h should be defined after CMD configs since it used them * to enable certain macros
Signature · 1 line
2.7.1
PATCH v2 3/3 arm: mvebu: theadorable: Add StratixV FPGA programming support
Quoted 9 lines · Stefan Roese
This patch adds support for Altera StratixV bitstream programming. 2 FPGAs are connected to the SPI busses. This patch uses board specific write code to program the bitstream via SPI direct write mode.
Signed-off-by Stefan Roese <[email protected]>Cc Luka Perkov <[email protected]>---
v2:
- Add missing mbus mapping for the SPI devices (direct access mode)
Applied to u-boot-marvell/master.
Thanks,
Stefan
PATCH 3/3 arm: mvebu: theadorable: Add StratixV FPGA programming support
In reply to Stefan RoeseThis patch adds support for Altera StratixV bitstream programming. 2 FPGAs are connected to the SPI busses. This patch uses board specific write code to program the bitstream via SPI direct write mode.
--- arch/arm/dts/armada-xp-theadorable.dts | 21 ++++ board/theadorable/Makefile | 1 + board/theadorable/fpga.c | 179 +++++++++++++++++++++++++++++++++ board/theadorable/theadorable.c | 3 + board/theadorable/theadorable.h | 12 +++ configs/theadorable_debug_defconfig | 3 +- configs/theadorable_defconfig | 2 +- include/configs/theadorable.h | 5 + 8 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 board/theadorable/fpga.c create mode 100644 board/theadorable/theadorable.h
arch/arm/dts/armada-xp-theadorable.dts +21 -0
@@ -69,6 +69,7 @@ aliases { spi0 = &spi0; + spi1 = &spi1; ethernet0 = ð0; };
@@ -137,6 +138,26 @@ reg = <0>; /* Chip select 0 */ spi-max-frequency = <27777777>; }; + + fpga at 1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-generic-device"; + reg = <1>; /* Chip select 1 */ + spi-max-frequency = <27777777>; + }; + }; + + spi1: spi at 10680 { + status = "okay"; + + fpga at 2 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-generic-device"; + reg = <2>; /* Chip select 2 */ + spi-max-frequency = <27777777>; + }; }; }; };
board/theadorable/Makefile +1 -0
@@ -5,3 +5,4 @@ # obj-y := theadorable.o +obj-y += fpga.o
board/theadorable/fpga.c new file +179 -0
179 lines not on this page · raw message
board/theadorable/theadorable.c +3 -0
@@ -11,6 +11,7 @@#ifdef CONFIG_NET #include <netdev.h> #endif +#include "theadorable.h" #include "../drivers/ddr/marvell/axp/ddr3_hw_training.h" #include "../arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h"
@@ -143,6 +144,8 @@ int checkboard(void) {puts ("Board: theadorable\n" ); +board_fpga_add (); +return 0 ; }
board/theadorable/theadorable.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* Copyright (C) 2016 Stefan Roese <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/* Base addresses for the SPI direct access mode */ +#define SPI_BUS0_DEV1_BASE 0xe0000000 +#define SPI_BUS0_DEV1_SIZE (1 << 20) +#define SPI_BUS1_DEV2_BASE (SPI_BUS0_DEV1_BASE + SPI_BUS0_DEV1_SIZE) + +void board_fpga_add (void );
configs/theadorable_debug_defconfig +2 -1
@@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_THEADORABLE=y +CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="armada-xp-theadorable" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL=y
@@ -9,7 +10,7 @@ CONFIG_SPL=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_SF=y CONFIG_CMD_USB=y -# CONFIG_CMD_FPGA is not set +CONFIG_CMD_GPIO=y # CONFIG_CMD_SETEXPR is not set CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y
configs/theadorable_defconfig +1 -1
@@ -2,13 +2,13 @@ CONFIG_ARM=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_THEADORABLE=y +CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="armada-xp-theadorable" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL=y # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set CONFIG_CMD_SF=y -# CONFIG_CMD_FPGA is not set # CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set
include/configs/theadorable.h +5 -0
@@ -115,6 +115,11 @@#define CONFIG_VGA_AS_SINGLE_DEVICE #define CONFIG_CMD_BMP +/* FPGA programming support */ +#define CONFIG_FPGA +#define CONFIG_FPGA_ALTERA +#define CONFIG_FPGA_STRATIX_V +/* * mv-common.h should be defined after CMD configs since it used them * to enable certain macros
Signature · 1 line
2.7.1