1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /* Copyright 2021, 2022 Innovative Advantage Inc. */
7 #include <linux/kconfig.h>
14 * struct ocelot_ddata - Private data for an external Ocelot chip
15 * @gcb_regmap: General Configuration Block regmap. Used for
16 * operations like chip reset.
17 * @cpuorg_regmap: CPU Device Origin Block regmap. Used for operations
18 * like SPI bus configuration.
19 * @spi_padding_bytes: Number of padding bytes that must be thrown out before
20 * read data gets returned. This is calculated during
21 * initialization based on bus speed.
22 * @dummy_buf: Zero-filled buffer of spi_padding_bytes size. The dummy
23 * bytes that will be sent out between the address and
24 * data of a SPI read operation.
27 struct regmap *gcb_regmap;
28 struct regmap *cpuorg_regmap;
29 int spi_padding_bytes;
33 int ocelot_chip_reset(struct device *dev);
34 int ocelot_core_init(struct device *dev);
36 /* SPI-specific routines that won't be necessary for other interfaces */
37 struct regmap *ocelot_spi_init_regmap(struct device *dev,
38 const struct resource *res);
40 #define OCELOT_SPI_BYTE_ORDER_LE 0x00000000
41 #define OCELOT_SPI_BYTE_ORDER_BE 0x81818181
43 #ifdef __LITTLE_ENDIAN
44 #define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_LE
46 #define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_BE