forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/ti/wl1251/sdio.c
....@@ -1,19 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * wl12xx SDIO routines
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 as
6
- * published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful, but
9
- * WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- * General Public License for more details.
12
- *
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program; if not, write to the Free Software
15
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16
- * 02110-1301 USA
174 *
185 * Copyright (C) 2005 Texas Instruments Incorporated
196 * Copyright (C) 2008 Google Inc
....@@ -28,17 +15,10 @@
2815 #include <linux/wl12xx.h>
2916 #include <linux/irq.h>
3017 #include <linux/pm_runtime.h>
31
-#include <linux/gpio.h>
18
+#include <linux/of.h>
19
+#include <linux/of_irq.h>
3220
3321 #include "wl1251.h"
34
-
35
-#ifndef SDIO_VENDOR_ID_TI
36
-#define SDIO_VENDOR_ID_TI 0x104c
37
-#endif
38
-
39
-#ifndef SDIO_DEVICE_ID_TI_WL1251
40
-#define SDIO_DEVICE_ID_TI_WL1251 0x9066
41
-#endif
4222
4323 struct wl1251_sdio {
4424 struct sdio_func *func;
....@@ -62,7 +42,7 @@
6242 }
6343
6444 static const struct sdio_device_id wl1251_devices[] = {
65
- { SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1251) },
45
+ { SDIO_DEVICE(SDIO_VENDOR_ID_TI_WL1251, SDIO_DEVICE_ID_TI_WL1251) },
6646 {}
6747 };
6848 MODULE_DEVICE_TABLE(sdio, wl1251_devices);
....@@ -178,15 +158,6 @@
178158 int ret;
179159
180160 if (enable) {
181
- /*
182
- * Power is controlled by runtime PM, but we still call board
183
- * callback in case it wants to do any additional setup,
184
- * for example enabling clock buffer for the module.
185
- */
186
- if (gpio_is_valid(wl->power_gpio))
187
- gpio_set_value(wl->power_gpio, true);
188
-
189
-
190161 ret = pm_runtime_get_sync(&func->dev);
191162 if (ret < 0) {
192163 pm_runtime_put_sync(&func->dev);
....@@ -204,9 +175,6 @@
204175 ret = pm_runtime_put_sync(&func->dev);
205176 if (ret < 0)
206177 goto out;
207
-
208
- if (gpio_is_valid(wl->power_gpio))
209
- gpio_set_value(wl->power_gpio, false);
210178 }
211179
212180 out:
....@@ -230,6 +198,7 @@
230198 struct ieee80211_hw *hw;
231199 struct wl1251_sdio *wl_sdio;
232200 const struct wl1251_platform_data *wl1251_board_data;
201
+ struct device_node *np = func->dev.of_node;
233202
234203 hw = wl1251_alloc_hw();
235204 if (IS_ERR(hw))
....@@ -258,16 +227,13 @@
258227
259228 wl1251_board_data = wl1251_get_platform_data();
260229 if (!IS_ERR(wl1251_board_data)) {
261
- wl->power_gpio = wl1251_board_data->power_gpio;
262230 wl->irq = wl1251_board_data->irq;
263231 wl->use_eeprom = wl1251_board_data->use_eeprom;
264
- }
265
-
266
- if (gpio_is_valid(wl->power_gpio)) {
267
- ret = devm_gpio_request(&func->dev, wl->power_gpio,
268
- "wl1251 power");
269
- if (ret) {
270
- wl1251_error("Failed to request gpio: %d\n", ret);
232
+ } else if (np) {
233
+ wl->use_eeprom = of_property_read_bool(np, "ti,wl1251-has-eeprom");
234
+ wl->irq = of_irq_get(np, 0);
235
+ if (wl->irq == -EPROBE_DEFER) {
236
+ ret = -EPROBE_DEFER;
271237 goto disable;
272238 }
273239 }