forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/ti/wlcore/sdio.c
....@@ -1,24 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * This file is part of wl1271
34 *
45 * Copyright (C) 2009-2010 Nokia Corporation
56 *
67 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * version 2 as published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful, but
13
- * WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
- * 02110-1301 USA
21
- *
228 */
239
2410 #include <linux/irq.h>
....@@ -39,14 +25,6 @@
3925 #include "wlcore.h"
4026 #include "wl12xx_80211.h"
4127 #include "io.h"
42
-
43
-#ifndef SDIO_VENDOR_ID_TI
44
-#define SDIO_VENDOR_ID_TI 0x0097
45
-#endif
46
-
47
-#ifndef SDIO_DEVICE_ID_TI_WL1271
48
-#define SDIO_DEVICE_ID_TI_WL1271 0x4076
49
-#endif
5028
5129 static bool dump = false;
5230
....@@ -240,7 +218,7 @@
240218 { }
241219 };
242220
243
-static int wlcore_probe_of(struct device *dev, int *irq,
221
+static int wlcore_probe_of(struct device *dev, int *irq, int *wakeirq,
244222 struct wlcore_platdev_data *pdev_data)
245223 {
246224 struct device_node *np = dev->of_node;
....@@ -258,6 +236,8 @@
258236 return -EINVAL;
259237 }
260238
239
+ *wakeirq = irq_of_parse_and_map(np, 1);
240
+
261241 /* optional clock frequency params */
262242 of_property_read_u32(np, "ref-clock-frequency",
263243 &pdev_data->ref_clock_freq);
....@@ -267,7 +247,7 @@
267247 return 0;
268248 }
269249 #else
270
-static int wlcore_probe_of(struct device *dev, int *irq,
250
+static int wlcore_probe_of(struct device *dev, int *irq, int *wakeirq,
271251 struct wlcore_platdev_data *pdev_data)
272252 {
273253 return -ENODATA;
....@@ -279,10 +259,10 @@
279259 {
280260 struct wlcore_platdev_data *pdev_data;
281261 struct wl12xx_sdio_glue *glue;
282
- struct resource res[1];
262
+ struct resource res[2];
283263 mmc_pm_flag_t mmcflags;
284264 int ret = -ENOMEM;
285
- int irq;
265
+ int irq, wakeirq, num_irqs;
286266 const char *chip_family;
287267
288268 /* We are only able to handle the wlan function */
....@@ -307,7 +287,7 @@
307287 /* Use block mode for transferring over one block size of data */
308288 func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
309289
310
- ret = wlcore_probe_of(&func->dev, &irq, pdev_data);
290
+ ret = wlcore_probe_of(&func->dev, &irq, &wakeirq, pdev_data);
311291 if (ret)
312292 goto out;
313293
....@@ -350,7 +330,17 @@
350330 irqd_get_trigger_type(irq_get_irq_data(irq));
351331 res[0].name = "irq";
352332
353
- ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
333
+
334
+ if (wakeirq > 0) {
335
+ res[1].start = wakeirq;
336
+ res[1].flags = IORESOURCE_IRQ |
337
+ irqd_get_trigger_type(irq_get_irq_data(wakeirq));
338
+ res[1].name = "wakeirq";
339
+ num_irqs = 2;
340
+ } else {
341
+ num_irqs = 1;
342
+ }
343
+ ret = platform_device_add_resources(glue->core, res, num_irqs);
354344 if (ret) {
355345 dev_err(glue->dev, "can't add resources\n");
356346 goto out_dev_put;