25 #include <linux/module.h>
42 #ifndef SDIO_VENDOR_ID_TI
43 #define SDIO_VENDOR_ID_TI 0x0097
46 #ifndef SDIO_DEVICE_ID_TI_WL1271
47 #define SDIO_DEVICE_ID_TI_WL1271 0x4076
50 static bool dump =
false;
63 static void wl1271_sdio_set_block_size(
struct device *
child,
85 print_hex_dump(
KERN_DEBUG,
"wlcore_sdio: READ ",
92 dev_dbg(child->
parent,
"sdio read 52 addr 0x%x, byte 0x%02x\n",
93 addr, ((
u8 *)buf)[0]);
100 dev_dbg(child->
parent,
"sdio read 53 addr 0x%x, %zu bytes\n",
113 void *buf,
size_t len,
bool fixed)
123 print_hex_dump(
KERN_DEBUG,
"wlcore_sdio: WRITE ",
130 dev_dbg(child->
parent,
"sdio write 52 addr 0x%x, byte 0x%02x\n",
131 addr, ((
u8 *)buf)[0]);
133 dev_dbg(child->
parent,
"sdio write 53 addr 0x%x, %zu bytes\n",
156 ret = pm_runtime_get_sync(&card->
dev);
165 pm_runtime_put_sync(&card->
dev);
194 pm_runtime_put_sync(&card->
dev);
200 static int wl12xx_sdio_set_power(
struct device *child,
bool enable)
205 return wl12xx_sdio_power_on(glue);
207 return wl12xx_sdio_power_off(glue);
211 .read = wl12xx_sdio_raw_read,
212 .write = wl12xx_sdio_raw_write,
213 .power = wl12xx_sdio_set_power,
214 .set_block_size = wl1271_sdio_set_block_size,
225 const char *chip_family;
228 if (func->
num != 0x02)
246 if (IS_ERR(wlan_data)) {
247 ret = PTR_ERR(wlan_data);
248 dev_err(glue->
dev,
"missing wlan platform data: %d\n", ret);
254 dev_dbg(glue->
dev,
"sdio PM caps = 0x%x\n", mmcflags);
259 wlan_data->
ops = &sdio_ops;
264 pm_runtime_put_noidle(&func->
dev);
273 chip_family =
"wl18xx";
275 chip_family =
"wl12xx";
279 dev_err(glue->
dev,
"can't allocate platform_device");
284 glue->
core->dev.parent = &func->
dev;
288 res[0].start = wlan_data->
irq;
301 dev_err(glue->
dev,
"can't add platform data\n");
307 dev_err(glue->
dev,
"can't add platform device\n");
327 pm_runtime_get_noresume(&func->
dev);
335 static int wl1271_suspend(
struct device *
dev)
341 struct wl1271 *wl = platform_get_drvdata(glue->
core);
345 dev_dbg(dev,
"wl1271 suspend. wow_enabled: %d\n",
352 if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
353 dev_err(dev,
"can't keep power while host "
362 dev_err(dev,
"error while trying to keep power\n");
370 static int wl1271_resume(
struct device *dev)
372 dev_dbg(dev,
"wl1271 resume\n");
377 static const struct dev_pm_ops wl1271_sdio_pm_ops = {
379 .resume = wl1271_resume,
384 .name =
"wl1271_sdio",
385 .id_table = wl1271_devices,
386 .probe = wl1271_probe,
390 .pm = &wl1271_sdio_pm_ops,
395 static int __init wl1271_init(
void)
400 static void __exit wl1271_exit(
void)