1 /* SPDX-License-Identifier: GPL-2.0 */
7 #define OCTEON_SPI_MAX_BYTES 9
8 #define OCTEON_SPI_MAX_CLOCK_HZ 16000000
10 struct octeon_spi_regs
{
18 void __iomem
*register_base
;
22 struct octeon_spi_regs regs
;
26 #define OCTEON_SPI_CFG(x) (x->regs.config)
27 #define OCTEON_SPI_STS(x) (x->regs.status)
28 #define OCTEON_SPI_TX(x) (x->regs.tx)
29 #define OCTEON_SPI_DAT0(x) (x->regs.data)
31 int octeon_spi_transfer_one_message(struct spi_master
*master
,
32 struct spi_message
*msg
);
34 /* MPI register descriptions */
36 #define CVMX_MPI_CFG (CVMX_ADD_IO_SEG(0x0001070000001000ull))
37 #define CVMX_MPI_DATX(offset) (CVMX_ADD_IO_SEG(0x0001070000001080ull) + ((offset) & 15) * 8)
38 #define CVMX_MPI_STS (CVMX_ADD_IO_SEG(0x0001070000001008ull))
39 #define CVMX_MPI_TX (CVMX_ADD_IO_SEG(0x0001070000001010ull))
43 struct cvmx_mpi_cfg_s
{
44 #ifdef __BIG_ENDIAN_BITFIELD
45 uint64_t reserved_29_63
:35;
79 uint64_t reserved_29_63
:35;
82 struct cvmx_mpi_cfg_cn30xx
{
83 #ifdef __BIG_ENDIAN_BITFIELD
84 uint64_t reserved_29_63
:35;
86 uint64_t reserved_12_15
:4;
110 uint64_t reserved_12_15
:4;
112 uint64_t reserved_29_63
:35;
115 struct cvmx_mpi_cfg_cn31xx
{
116 #ifdef __BIG_ENDIAN_BITFIELD
117 uint64_t reserved_29_63
:35;
119 uint64_t reserved_11_15
:5;
141 uint64_t reserved_11_15
:5;
143 uint64_t reserved_29_63
:35;
146 struct cvmx_mpi_cfg_cn30xx cn50xx
;
147 struct cvmx_mpi_cfg_cn61xx
{
148 #ifdef __BIG_ENDIAN_BITFIELD
149 uint64_t reserved_29_63
:35;
151 uint64_t reserved_14_15
:2;
158 uint64_t reserved_6_6
:1;
172 uint64_t reserved_6_6
:1;
179 uint64_t reserved_14_15
:2;
181 uint64_t reserved_29_63
:35;
184 struct cvmx_mpi_cfg_cn66xx
{
185 #ifdef __BIG_ENDIAN_BITFIELD
186 uint64_t reserved_29_63
:35;
190 uint64_t reserved_12_13
:2;
195 uint64_t reserved_6_6
:1;
209 uint64_t reserved_6_6
:1;
214 uint64_t reserved_12_13
:2;
218 uint64_t reserved_29_63
:35;
221 struct cvmx_mpi_cfg_cn61xx cnf71xx
;
224 union cvmx_mpi_datx
{
226 struct cvmx_mpi_datx_s
{
227 #ifdef __BIG_ENDIAN_BITFIELD
228 uint64_t reserved_8_63
:56;
232 uint64_t reserved_8_63
:56;
235 struct cvmx_mpi_datx_s cn30xx
;
236 struct cvmx_mpi_datx_s cn31xx
;
237 struct cvmx_mpi_datx_s cn50xx
;
238 struct cvmx_mpi_datx_s cn61xx
;
239 struct cvmx_mpi_datx_s cn66xx
;
240 struct cvmx_mpi_datx_s cnf71xx
;
245 struct cvmx_mpi_sts_s
{
246 #ifdef __BIG_ENDIAN_BITFIELD
247 uint64_t reserved_13_63
:51;
249 uint64_t reserved_1_7
:7;
253 uint64_t reserved_1_7
:7;
255 uint64_t reserved_13_63
:51;
258 struct cvmx_mpi_sts_s cn30xx
;
259 struct cvmx_mpi_sts_s cn31xx
;
260 struct cvmx_mpi_sts_s cn50xx
;
261 struct cvmx_mpi_sts_s cn61xx
;
262 struct cvmx_mpi_sts_s cn66xx
;
263 struct cvmx_mpi_sts_s cnf71xx
;
268 struct cvmx_mpi_tx_s
{
269 #ifdef __BIG_ENDIAN_BITFIELD
270 uint64_t reserved_22_63
:42;
272 uint64_t reserved_17_19
:3;
274 uint64_t reserved_13_15
:3;
276 uint64_t reserved_5_7
:3;
280 uint64_t reserved_5_7
:3;
282 uint64_t reserved_13_15
:3;
284 uint64_t reserved_17_19
:3;
286 uint64_t reserved_22_63
:42;
289 struct cvmx_mpi_tx_cn30xx
{
290 #ifdef __BIG_ENDIAN_BITFIELD
291 uint64_t reserved_17_63
:47;
293 uint64_t reserved_13_15
:3;
295 uint64_t reserved_5_7
:3;
299 uint64_t reserved_5_7
:3;
301 uint64_t reserved_13_15
:3;
303 uint64_t reserved_17_63
:47;
306 struct cvmx_mpi_tx_cn30xx cn31xx
;
307 struct cvmx_mpi_tx_cn30xx cn50xx
;
308 struct cvmx_mpi_tx_cn61xx
{
309 #ifdef __BIG_ENDIAN_BITFIELD
310 uint64_t reserved_21_63
:43;
312 uint64_t reserved_17_19
:3;
314 uint64_t reserved_13_15
:3;
316 uint64_t reserved_5_7
:3;
320 uint64_t reserved_5_7
:3;
322 uint64_t reserved_13_15
:3;
324 uint64_t reserved_17_19
:3;
326 uint64_t reserved_21_63
:43;
329 struct cvmx_mpi_tx_s cn66xx
;
330 struct cvmx_mpi_tx_cn61xx cnf71xx
;
333 #endif /* __SPI_CAVIUM_H */