hostapd: bump to 2024-09-06 (wip)
[openwrt/staging/xback.git] / target / linux / lantiq / patches-6.1 / 0200-MIPS-lantiq-xway-vmmc-use-platform_get_irq-to-get-ir.patch
1 From 2b873c59fd313aee57864f96d64a228f2ea7c208 Mon Sep 17 00:00:00 2001
2 From: Martin Schiller <ms@dev.tdt.de>
3 Date: Mon, 13 May 2024 10:42:24 +0200
4 Subject: [PATCH] MIPS: lantiq: xway: vmmc: use platform_get_irq to get irqs
5 from dts
6
7 Let's fetch the irqs from the dts here and expose them to the voice
8 driver like it is done for the cp1 base memory.
9
10 ToDo:
11 Maybe it is possible to drop this driver completely and merge this
12 handling to the voice driver.
13
14 Signed-off-by: Martin Schiller <ms@dev.tdt.de>
15 ---
16 arch/mips/lantiq/xway/vmmc.c | 53 ++++++++++++++++++++++++++++++++++++
17 1 file changed, 53 insertions(+)
18
19 --- a/arch/mips/lantiq/xway/vmmc.c
20 +++ b/arch/mips/lantiq/xway/vmmc.c
21 @@ -14,6 +14,10 @@
22
23 static unsigned int *cp1_base;
24
25 +static int ad0_irq;
26 +static int ad1_irq;
27 +static int vc_irq[4];
28 +
29 unsigned int *ltq_get_cp1_base(void)
30 {
31 if (!cp1_base)
32 @@ -23,6 +27,33 @@ unsigned int *ltq_get_cp1_base(void)
33 }
34 EXPORT_SYMBOL(ltq_get_cp1_base);
35
36 +unsigned int ltq_get_mps_ad0_irq(void)
37 +{
38 + if (!ad0_irq)
39 + panic("no ad0 irq was set\n");
40 +
41 + return ad0_irq;
42 +}
43 +EXPORT_SYMBOL(ltq_get_mps_ad0_irq);
44 +
45 +unsigned int ltq_get_mps_ad1_irq(void)
46 +{
47 + if (!ad1_irq)
48 + panic("no ad1 irq was set\n");
49 +
50 + return ad1_irq;
51 +}
52 +EXPORT_SYMBOL(ltq_get_mps_ad1_irq);
53 +
54 +unsigned int ltq_get_mps_vc_irq(int idx)
55 +{
56 + if (!vc_irq[idx])
57 + panic("no vc%d irq was set\n", idx);
58 +
59 + return vc_irq[idx];
60 +}
61 +EXPORT_SYMBOL(ltq_get_mps_vc_irq);
62 +
63 static int vmmc_probe(struct platform_device *pdev)
64 {
65 #define CP1_SIZE (1 << 20)
66 @@ -30,11 +61,33 @@ static int vmmc_probe(struct platform_de
67 int gpio_count;
68 dma_addr_t dma;
69 int error;
70 + int i;
71
72 cp1_base =
73 (void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE,
74 &dma, GFP_KERNEL));
75
76 + ad0_irq = platform_get_irq(pdev, 4);
77 + if (ad0_irq < 0) {
78 + dev_err(&pdev->dev, "failed to get MPS AD0 irq: %d\n", ad0_irq);
79 + return ad0_irq;
80 + }
81 +
82 + ad1_irq = platform_get_irq(pdev, 5);
83 + if (ad1_irq < 0) {
84 + dev_err(&pdev->dev, "failed to get MPS AD1 irq: %d\n", ad1_irq);
85 + return ad1_irq;
86 + }
87 +
88 + for (i = 0; i < 4; i++) {
89 + vc_irq[i] = platform_get_irq(pdev, i);
90 + if (vc_irq[i] < 0) {
91 + dev_err(&pdev->dev, "failed to get MPS VC%d irq: %d\n",
92 + i, vc_irq[i]);
93 + return vc_irq[i];
94 + }
95 + }
96 +
97 gpio_count = gpiod_count(&pdev->dev, NULL);
98 while (gpio_count > 0) {
99 gpio = devm_gpiod_get_index(&pdev->dev,