2 * Copyright (c) 2011 The Chromium OS Authors.
4 * SPDX-License-Identifier: GPL-2.0+
6 * This file is derived from the flashrom project.
12 struct ich7_spi_regs {
24 struct ich9_spi_regs {
25 uint32_t bfpr; /* 0x00 */
30 uint32_t fdata[16]; /* 0x10 */
31 uint32_t frap; /* 0x50 */
33 uint32_t _reserved1[3];
34 uint32_t pr[5]; /* 0x74 */
35 uint32_t _reserved2[2];
36 uint8_t ssfs; /* 0x90 */
38 uint16_t preop; /* 0x94 */
40 uint8_t opmenu[8]; /* 0x98 */
42 uint8_t _reserved3[12];
43 uint32_t fdoc; /* 0xb0 */
45 uint8_t _reserved4[8];
46 uint32_t afc; /* 0xc0 */
49 uint8_t _reserved5[4];
50 uint32_t fpb; /* 0xd0 */
51 uint8_t _reserved6[28];
52 uint32_t srdl; /* 0xf0 */
65 SPIS_RESERVED_MASK = 0x7ff0,
66 SSFS_RESERVED_MASK = 0x7fe2
76 SSFC_SCF_MASK = 0x070000,
77 SSFC_RESERVED = 0xf80000,
79 /* Mask for speed byte, biuts 23:16 of SSFC */
80 SSFC_SCF_33MHZ = 0x01,
87 HSFS_BERASE_MASK = 0x0018,
88 HSFS_BERASE_SHIFT = 3,
97 HSFC_FCYCLE_MASK = 0x0006,
98 HSFC_FCYCLE_SHIFT = 1,
99 HSFC_FDBC_MASK = 0x3f00,
105 SPI_OPCODE_TYPE_READ_NO_ADDRESS = 0,
106 SPI_OPCODE_TYPE_WRITE_NO_ADDRESS = 1,
107 SPI_OPCODE_TYPE_READ_WITH_ADDRESS = 2,
108 SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS = 3
116 uint8_t cmd[ICH_MAX_CMD_LEN];
127 #define SPI_OPCODE_WREN 0x06
128 #define SPI_OPCODE_FAST_READ 0x0b
135 struct ich_spi_platdata {
136 enum ich_version ich_version; /* Controller version, 7 or 9 */
139 struct ich_spi_priv {
144 void *base; /* Base of register set */
154 uint32_t *pr; /* only for ich9 */
155 int speed; /* pointer to speed control */
156 ulong max_speed; /* Maximum bus speed in MHz */
157 ulong cur_speed; /* Current bus speed */
158 struct spi_trans trans; /* current transaction in progress */