Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[linux-stable.git] / drivers / mfd / ocelot.h
blobb8bc2f1486e2480d1bfe47563c85013975cee69d
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /* Copyright 2021, 2022 Innovative Advantage Inc. */
4 #ifndef _MFD_OCELOT_H
5 #define _MFD_OCELOT_H
7 #include <linux/kconfig.h>
9 struct device;
10 struct regmap;
11 struct resource;
13 /**
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.
26 struct ocelot_ddata {
27 struct regmap *gcb_regmap;
28 struct regmap *cpuorg_regmap;
29 int spi_padding_bytes;
30 void *dummy_buf;
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
45 #else
46 #define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_BE
47 #endif
49 #endif