ath79: add Mikrotik rb4xx series drivers
[oweals/openwrt.git] / target / linux / ath79 / files / include / mfd / rb4xx-cpld.h
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * CPLD driver for the MikroTik RouterBoard 4xx series
4  *
5  * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
6  * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7  * Copyright (C) 2015 Bert Vermeulen <bert@biot.com>
8  * Copyright (C) 2020 Christopher Hill <ch6574@gmail.com>
9  *
10  * This file was based on the driver for Linux 2.6.22 published by
11  * MikroTik for their RouterBoard 4xx series devices.
12  */
13 #include <linux/spi/spi.h>
14
15 struct rb4xx_cpld {
16         struct spi_device *spi;
17
18         int (*write_nand)(struct rb4xx_cpld *self, const void *tx_buf,
19                           unsigned int len);
20         int (*read_nand)(struct rb4xx_cpld *self, void *rx_buf,
21                          unsigned int len);
22
23         int (*gpio_set_0_7)(struct rb4xx_cpld *self, u8 values);
24         int (*gpio_set_8)(struct rb4xx_cpld *self, u8 value);
25 };