coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spi.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef CPU_SAMSUNG_EXYNOS5420_SPI_H
4 #define CPU_SAMSUNG_EXYNOS5420_SPI_H
5 
6 #include <boot_device.h>
7 
8 /* SPI peripheral register map; padded to 64KB */
9 struct exynos_spi {
10  unsigned int ch_cfg; /* 0x00 */
11  unsigned char reserved0[4];
12  unsigned int mode_cfg; /* 0x08 */
13  unsigned int cs_reg; /* 0x0c */
14  unsigned char reserved1[4];
15  unsigned int spi_sts; /* 0x14 */
16  unsigned int tx_data; /* 0x18 */
17  unsigned int rx_data; /* 0x1c */
18  unsigned int pkt_cnt; /* 0x20 */
19  unsigned char reserved2[4];
20  unsigned int swap_cfg; /* 0x28 */
21  unsigned int fb_clk; /* 0x2c */
22  unsigned char padding[0xffd0];
23 };
24 check_member(exynos_spi, fb_clk, 0x2c);
25 
26 #define EXYNOS_SPI_MAX_FREQ 50000000
27 
28 #define SPI_TIMEOUT_MS 10
29 
30 #define SF_READ_DATA_CMD 0x3
31 
32 /* SPI_CHCFG */
33 #define SPI_CH_HS_EN (1 << 6)
34 #define SPI_CH_RST (1 << 5)
35 #define SPI_SLAVE_MODE (1 << 4)
36 #define SPI_CH_CPOL_L (1 << 3)
37 #define SPI_CH_CPHA_B (1 << 2)
38 #define SPI_RX_CH_ON (1 << 1)
39 #define SPI_TX_CH_ON (1 << 0)
40 
41 /* SPI_MODECFG */
42 #define SPI_MODE_BUS_WIDTH_BYTE (0x0 << 17)
43 #define SPI_MODE_BUS_WIDTH_WORD (0x2 << 17)
44 #define SPI_MODE_BUS_WIDTH_MASK (0x3 << 17)
45 #define SPI_MODE_CH_WIDTH_BYTE (0x0 << 29)
46 #define SPI_MODE_CH_WIDTH_WORD (0x2 << 29)
47 #define SPI_MODE_CH_WIDTH_MASK (0x3 << 29)
48 
49 /* SPI_CSREG */
50 #define SPI_SLAVE_SIG_INACT (1 << 0)
51 
52 /* SPI_STS */
53 #define SPI_ST_TX_DONE (1 << 25)
54 #define SPI_FIFO_LVL_MASK 0x1ff
55 #define SPI_TX_LVL_OFFSET 6
56 #define SPI_RX_LVL_OFFSET 15
57 
58 /* Feedback Delay */
59 #define SPI_CLK_BYPASS (0 << 0)
60 #define SPI_FB_DELAY_90 (1 << 0)
61 #define SPI_FB_DELAY_180 (2 << 0)
62 #define SPI_FB_DELAY_270 (3 << 0)
63 
64 /* Packet Count */
65 #define SPI_PACKET_CNT_EN (1 << 16)
66 
67 /* Swap config */
68 #define SPI_TX_SWAP_EN (1 << 0)
69 #define SPI_TX_BYTE_SWAP (1 << 2)
70 #define SPI_TX_HWORD_SWAP (1 << 3)
71 #define SPI_TX_BYTE_SWAP (1 << 2)
72 #define SPI_RX_SWAP_EN (1 << 4)
73 #define SPI_RX_BYTE_SWAP (1 << 6)
74 #define SPI_RX_HWORD_SWAP (1 << 7)
75 
77 const struct region_device *exynos_spi_boot_device(void);
78 #endif
check_member(tegra_spi_regs, spare_ctl, 0x18c)
void exynos_init_spi_boot_device(void)
Definition: spi.c:167
const struct region_device * exynos_spi_boot_device(void)
Definition: spi.c:172
Definition: spi.h:9
unsigned int tx_data
Definition: spi.h:16
unsigned int swap_cfg
Definition: spi.h:20
unsigned int cs_reg
Definition: spi.h:13
unsigned int mode_cfg
Definition: spi.h:12
unsigned char reserved2[4]
Definition: spi.h:19
unsigned char reserved0[4]
Definition: spi.h:11
unsigned int pkt_cnt
Definition: spi.h:18
unsigned int fb_clk
Definition: spi.h:21
unsigned int ch_cfg
Definition: spi.h:10
unsigned char reserved1[4]
Definition: spi.h:14
unsigned char padding[0xffd0]
Definition: spi.h:22
unsigned int spi_sts
Definition: spi.h:15
unsigned int rx_data
Definition: spi.h:17