| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This file is part of wl1271 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009-2010 Nokia Corporation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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 | | - * |
|---|
| 22 | 8 | */ |
|---|
| 23 | 9 | |
|---|
| 24 | 10 | #include <linux/irq.h> |
|---|
| .. | .. |
|---|
| 39 | 25 | #include "wlcore.h" |
|---|
| 40 | 26 | #include "wl12xx_80211.h" |
|---|
| 41 | 27 | #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 |
|---|
| 50 | 28 | |
|---|
| 51 | 29 | static bool dump = false; |
|---|
| 52 | 30 | |
|---|
| .. | .. |
|---|
| 240 | 218 | { } |
|---|
| 241 | 219 | }; |
|---|
| 242 | 220 | |
|---|
| 243 | | -static int wlcore_probe_of(struct device *dev, int *irq, |
|---|
| 221 | +static int wlcore_probe_of(struct device *dev, int *irq, int *wakeirq, |
|---|
| 244 | 222 | struct wlcore_platdev_data *pdev_data) |
|---|
| 245 | 223 | { |
|---|
| 246 | 224 | struct device_node *np = dev->of_node; |
|---|
| .. | .. |
|---|
| 258 | 236 | return -EINVAL; |
|---|
| 259 | 237 | } |
|---|
| 260 | 238 | |
|---|
| 239 | + *wakeirq = irq_of_parse_and_map(np, 1); |
|---|
| 240 | + |
|---|
| 261 | 241 | /* optional clock frequency params */ |
|---|
| 262 | 242 | of_property_read_u32(np, "ref-clock-frequency", |
|---|
| 263 | 243 | &pdev_data->ref_clock_freq); |
|---|
| .. | .. |
|---|
| 267 | 247 | return 0; |
|---|
| 268 | 248 | } |
|---|
| 269 | 249 | #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, |
|---|
| 271 | 251 | struct wlcore_platdev_data *pdev_data) |
|---|
| 272 | 252 | { |
|---|
| 273 | 253 | return -ENODATA; |
|---|
| .. | .. |
|---|
| 279 | 259 | { |
|---|
| 280 | 260 | struct wlcore_platdev_data *pdev_data; |
|---|
| 281 | 261 | struct wl12xx_sdio_glue *glue; |
|---|
| 282 | | - struct resource res[1]; |
|---|
| 262 | + struct resource res[2]; |
|---|
| 283 | 263 | mmc_pm_flag_t mmcflags; |
|---|
| 284 | 264 | int ret = -ENOMEM; |
|---|
| 285 | | - int irq; |
|---|
| 265 | + int irq, wakeirq, num_irqs; |
|---|
| 286 | 266 | const char *chip_family; |
|---|
| 287 | 267 | |
|---|
| 288 | 268 | /* We are only able to handle the wlan function */ |
|---|
| .. | .. |
|---|
| 307 | 287 | /* Use block mode for transferring over one block size of data */ |
|---|
| 308 | 288 | func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; |
|---|
| 309 | 289 | |
|---|
| 310 | | - ret = wlcore_probe_of(&func->dev, &irq, pdev_data); |
|---|
| 290 | + ret = wlcore_probe_of(&func->dev, &irq, &wakeirq, pdev_data); |
|---|
| 311 | 291 | if (ret) |
|---|
| 312 | 292 | goto out; |
|---|
| 313 | 293 | |
|---|
| .. | .. |
|---|
| 350 | 330 | irqd_get_trigger_type(irq_get_irq_data(irq)); |
|---|
| 351 | 331 | res[0].name = "irq"; |
|---|
| 352 | 332 | |
|---|
| 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); |
|---|
| 354 | 344 | if (ret) { |
|---|
| 355 | 345 | dev_err(glue->dev, "can't add resources\n"); |
|---|
| 356 | 346 | goto out_dev_put; |
|---|