From fa70b3a4bbc65d372d735004d9df894bd1c89c81 Mon Sep 17 00:00:00 2001 From: Christopher Hill Date: Mon, 25 May 2020 21:05:00 -0400 Subject: ath79: add Mikrotik rb4xx series drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds 3 Mikrotik rb4xx series drivers as follows: rb4xx-cpld: This is in the mfd subsystem, and is the parent CPLD device that interfaces between the SoC SPI bus and its two children below. rb4xx-gpio: This is the GPIO expander. rb4xx-nand: This is the NAND driver. The history of this code comes in three phases. 1. The first is a May 2015 attempt to push the equivalient ar71xx rb4xx drivers upstream. See https://lore.kernel.org/patchwork/patch/940880/. Module-author: Gabor Juhos Module-author: Imre Kaloz Module-author: Bert Vermeulen 2. Next several ar71xx patches were applied bringing the code current. commit 7bbf4117c6fe4b764d9d7c62fb2bcf6dd93bff2c Signed-off-by: Hauke Mehrtens commit af79fdbe4af32a287798b579141204bda056b8aa commit 889272d92db689fd9c910243635e44c9d8323095 commit e21cb649a235180563363b8af5ba8296b9ac0baa commit 7c09fa4a7492ca436f2c94bd9a465b7c5bbeed6f Signed-off-by: Felix Fietkau 3. Finally a heavy refactor to split the driver into the three new subsystems, and updated to work with the device tree configuration, plus updates and review feedback incorporated Reviewed-by: Thibaut VARĂˆNE Signed-off-by: Christopher Hill --- target/linux/ath79/files/include/mfd/rb4xx-cpld.h | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 target/linux/ath79/files/include/mfd/rb4xx-cpld.h (limited to 'target/linux/ath79/files/include/mfd/rb4xx-cpld.h') diff --git a/target/linux/ath79/files/include/mfd/rb4xx-cpld.h b/target/linux/ath79/files/include/mfd/rb4xx-cpld.h new file mode 100644 index 0000000000..d73617bfb1 --- /dev/null +++ b/target/linux/ath79/files/include/mfd/rb4xx-cpld.h @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * CPLD driver for the MikroTik RouterBoard 4xx series + * + * Copyright (C) 2008-2011 Gabor Juhos + * Copyright (C) 2008 Imre Kaloz + * Copyright (C) 2015 Bert Vermeulen + * Copyright (C) 2020 Christopher Hill + * + * This file was based on the driver for Linux 2.6.22 published by + * MikroTik for their RouterBoard 4xx series devices. + */ +#include + +struct rb4xx_cpld { + struct spi_device *spi; + + int (*write_nand)(struct rb4xx_cpld *self, const void *tx_buf, + unsigned int len); + int (*read_nand)(struct rb4xx_cpld *self, void *rx_buf, + unsigned int len); + + int (*gpio_set_0_7)(struct rb4xx_cpld *self, u8 values); + int (*gpio_set_8)(struct rb4xx_cpld *self, u8 value); +}; -- cgit v1.2.3