Skip to content
Snippets Groups Projects
Commit 7b1a50b7 authored by rick's avatar rick Committed by Andes
Browse files

nds32: board: Support SPI driver.


Add spi dts node and enable spi dm flash config.

Signed-off-by: default avatarrick <rick@andestech.com>
parent 6d3cb0fd
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
aliases { aliases {
uart0 = &serial0; uart0 = &serial0;
ethernet0 = &mac0; ethernet0 = &mac0;
spi0 = &spi;
} ; } ;
chosen { chosen {
...@@ -22,6 +23,12 @@ ...@@ -22,6 +23,12 @@
reg = <0x00000000 0x40000000>; reg = <0x00000000 0x40000000>;
}; };
spiclk: virt_100mhz {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <100000000>;
};
cpus { cpus {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
...@@ -69,4 +76,20 @@ ...@@ -69,4 +76,20 @@
device-width = <1>; device-width = <1>;
}; };
spi: spi@f0b00000 {
compatible = "andestech,atcspi200";
reg = <0xf0b00000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
num-cs = <1>;
clocks = <&spiclk>;
interrupts = <3 4>;
flash@0 {
compatible = "spi-flash";
spi-max-frequency = <50000000>;
reg = <0>;
spi-cpol;
spi-cpha;
};
};
}; };
...@@ -5,6 +5,8 @@ CONFIG_FIT=y ...@@ -5,6 +5,8 @@ CONFIG_FIT=y
CONFIG_BOOTDELAY=3 CONFIG_BOOTDELAY=3
CONFIG_SYS_PROMPT="NDS32 # " CONFIG_SYS_PROMPT="NDS32 # "
CONFIG_CMD_MMC=y CONFIG_CMD_MMC=y
CONFIG_CMD_SF=y
CONFIG_CMD_SF_TEST=y
# CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_DHCP=y CONFIG_CMD_DHCP=y
CONFIG_CMD_PING=y CONFIG_CMD_PING=y
...@@ -13,17 +15,23 @@ CONFIG_CMD_DATE=y ...@@ -13,17 +15,23 @@ CONFIG_CMD_DATE=y
CONFIG_CMD_EXT2=y CONFIG_CMD_EXT2=y
CONFIG_CMD_FAT=y CONFIG_CMD_FAT=y
CONFIG_OF_CONTROL=y CONFIG_OF_CONTROL=y
CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_DM=y CONFIG_DM=y
CONFIG_CLK=y
CONFIG_MMC=y CONFIG_MMC=y
CONFIG_MTD=y CONFIG_MTD=y
CONFIG_MTD_NOR_FLASH=y CONFIG_MTD_NOR_FLASH=y
CONFIG_CFI_FLASH=y CONFIG_CFI_FLASH=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_DM_ETH=y CONFIG_DM_ETH=y
CONFIG_FTMAC100=y CONFIG_FTMAC100=y
CONFIG_BAUDRATE=38400 CONFIG_BAUDRATE=38400
CONFIG_DM_SERIAL=y CONFIG_DM_SERIAL=y
CONFIG_SYS_NS16550=y CONFIG_SYS_NS16550=y
CONFIG_DM_SPI=y
CONFIG_NDS_AE3XX_SPI=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_AE3XX_TIMER=y CONFIG_AE3XX_TIMER=y
...@@ -220,14 +220,25 @@ ...@@ -220,14 +220,25 @@
/* max number of sectors on one chip */ /* max number of sectors on one chip */
#define CONFIG_FLASH_SECTOR_SIZE (0x10000*2) #define CONFIG_FLASH_SECTOR_SIZE (0x10000*2)
#define CONFIG_ENV_SECT_SIZE CONFIG_FLASH_SECTOR_SIZE
#define CONFIG_SYS_MAX_FLASH_SECT 512 #define CONFIG_SYS_MAX_FLASH_SECT 512
/* environments */ /* environments */
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + 0x140000) #define CONFIG_ENV_SPI_BUS 0
#define CONFIG_ENV_SPI_CS 0
#define CONFIG_ENV_SPI_MAX_HZ 50000000
#define CONFIG_ENV_SPI_MODE 0
#define CONFIG_ENV_SECT_SIZE 0x1000
#define CONFIG_ENV_OFFSET 0x140000
#define CONFIG_ENV_SIZE 8192 #define CONFIG_ENV_SIZE 8192
#define CONFIG_ENV_OVERWRITE #define CONFIG_ENV_OVERWRITE
/* SPI FLASH */
#define CONFIG_SF_DEFAULT_BUS 0
#define CONFIG_SF_DEFAULT_CS 0
#define CONFIG_SF_DEFAULT_SPEED 1000000
#define CONFIG_SF_DEFAULT_MODE 0
/* /*
* For booting Linux, the board info and command line data * For booting Linux, the board info and command line data
* have to be in the first 16 MB of memory, since this is * have to be in the first 16 MB of memory, since this is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment