50 lines · c
1/* SPDX-License-Identifier: GPL-2.0 OR MIT */2/* Copyright 2021, 2022 Innovative Advantage Inc. */3 4#ifndef _MFD_OCELOT_H5#define _MFD_OCELOT_H6 7#include <linux/kconfig.h>8 9struct device;10struct regmap;11struct resource;12 13/**14 * struct ocelot_ddata - Private data for an external Ocelot chip15 * @gcb_regmap: General Configuration Block regmap. Used for16 * operations like chip reset.17 * @cpuorg_regmap: CPU Device Origin Block regmap. Used for operations18 * like SPI bus configuration.19 * @spi_padding_bytes: Number of padding bytes that must be thrown out before20 * read data gets returned. This is calculated during21 * initialization based on bus speed.22 * @dummy_buf: Zero-filled buffer of spi_padding_bytes size. The dummy23 * bytes that will be sent out between the address and24 * data of a SPI read operation.25 */26struct ocelot_ddata {27 struct regmap *gcb_regmap;28 struct regmap *cpuorg_regmap;29 int spi_padding_bytes;30 void *dummy_buf;31};32 33int ocelot_chip_reset(struct device *dev);34int ocelot_core_init(struct device *dev);35 36/* SPI-specific routines that won't be necessary for other interfaces */37struct regmap *ocelot_spi_init_regmap(struct device *dev,38 const struct resource *res);39 40#define OCELOT_SPI_BYTE_ORDER_LE 0x0000000041#define OCELOT_SPI_BYTE_ORDER_BE 0x8181818142 43#ifdef __LITTLE_ENDIAN44#define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_LE45#else46#define OCELOT_SPI_BYTE_ORDER OCELOT_SPI_BYTE_ORDER_BE47#endif48 49#endif50