ath79: Convert incorrect 5.10 and 5.15 patches
[openwrt/openwrt.git] / target / linux / ath79 / patches-5.15 / 939-mikrotik-rb91x.patch
1 From: Denis Kalashnikov <denis281089@gmail.com>
2 Subject: [PATCH] ath79: add support for reset key on MikroTik RB912UAG-2HPnD
3
4 On MikroTik RB91x board series a reset key shares SoC gpio
5 line #15 with NAND ALE and NAND IO7. So we need a custom
6 gpio driver to manage this non-trivial connection schema.
7 Also rb91x-nand needs to have an ability to disable a polling
8 of the key while it works with NAND.
9
10 While we've been integrating rb91x-key into a firmware, we've
11 figured out that:
12 * In the gpio-latch driver we need to add a "cansleep" suffix to
13 several gpiolib calls,
14 * When gpio-latch and rb91x-nand fail to get a gpio and an error
15 is -EPROBE_DEFER, they shouldn't report about this, since this
16 actually is not an error and occurs when the gpio-latch probe
17 function is called before the rb91x-key probe.
18 We fix these related things here too.
19
20 Submitted-by: Denis Kalashnikov <denis281089@gmail.com>
21 Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
22 Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
23 ---
24 drivers/gpio/Kconfig | 11 +++++++++++
25 drivers/gpio/Makefile | 2 ++
26 drivers/mtd/nand/raw/Kconfig | 6 ++++++
27 drivers/mtd/nand/raw/Makefile | 1 +
28 7 files changed, 20 insertions(+)
29
30 --- a/drivers/gpio/Kconfig
31 +++ b/drivers/gpio/Kconfig
32 @@ -353,6 +353,13 @@ config GPIO_IXP4XX
33 IXP4xx series of chips.
34
35 If unsure, say N.
36 +
37 +config GPIO_LATCH
38 + tristate "MikroTik RouterBOARD GPIO latch support"
39 + depends on ATH79
40 + help
41 + GPIO driver for latch on some MikroTik RouterBOARDs.
42 +
43 config GPIO_LOGICVC
44 tristate "Xylon LogiCVC GPIO support"
45 depends on MFD_SYSCON && OF
46 @@ -529,6 +536,10 @@ config GPIO_ROCKCHIP
47 help
48 Say yes here to support GPIO on Rockchip SoCs.
49
50 +config GPIO_RB91X_KEY
51 + tristate "MikroTik RB91x board series reset key support"
52 + depends on ATH79
53 +
54 config GPIO_SAMA5D2_PIOBU
55 tristate "SAMA5D2 PIOBU GPIO support"
56 depends on MFD_SYSCON
57 --- a/drivers/gpio/Makefile
58 +++ b/drivers/gpio/Makefile
59 @@ -75,6 +75,7 @@ obj-$(CONFIG_GPIO_IT87) += gpio-it87.o
60 obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o
61 obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o
62 obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o
63 +obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o
64 obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o
65 obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o
66 obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o
67 @@ -123,6 +124,7 @@ obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio
68 obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
69 obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o
70 obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o
71 +obj-$(CONFIG_GPIO_RB91X_KEY) += gpio-rb91x-key.o
72 obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o
73 obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o
74 obj-$(CONFIG_GPIO_RDA) += gpio-rda.o
75 --- a/drivers/mtd/nand/raw/Kconfig
76 +++ b/drivers/mtd/nand/raw/Kconfig
77 @@ -570,4 +570,10 @@ config MTD_NAND_RB4XX
78 Enables support for the NAND flash chip on Mikrotik Routerboard
79 RB4xx series.
80
81 +config MTD_NAND_RB91X
82 + tristate "MikroTik RB91x NAND driver support"
83 + depends on ATH79 && MTD_RAW_NAND
84 + help
85 + Enables support for the NAND flash chip on MikroTik RB91x series.
86 +
87 endif # MTD_RAW_NAND
88 --- a/drivers/mtd/nand/raw/Makefile
89 +++ b/drivers/mtd/nand/raw/Makefile
90 @@ -60,6 +60,7 @@ obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rock
91 obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o
92 obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o
93 obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o
94 +obj-$(CONFIG_MTD_NAND_RB91X) += rb91x_nand.o
95
96 nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o
97 nand-objs += nand_onfi.o