Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / phy / motorola / phy-mapphone-mdm6600.c
blob5172971f4c360a1ba73c073cec3a3bb82f0b5863
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Motorola Mapphone MDM6600 modem GPIO controlled USB PHY driver
4 * Copyright (C) 2018 Tony Lindgren <tony@atomide.com>
5 */
7 #include <linux/delay.h>
8 #include <linux/err.h>
9 #include <linux/io.h>
10 #include <linux/interrupt.h>
11 #include <linux/module.h>
12 #include <linux/of.h>
13 #include <linux/platform_device.h>
14 #include <linux/slab.h>
16 #include <linux/gpio/consumer.h>
17 #include <linux/of_platform.h>
18 #include <linux/phy/phy.h>
19 #include <linux/pinctrl/consumer.h>
21 #define PHY_MDM6600_PHY_DELAY_MS 4000 /* PHY enable 2.2s to 3.5s */
22 #define PHY_MDM6600_ENABLED_DELAY_MS 8000 /* 8s more total for MDM6600 */
23 #define PHY_MDM6600_WAKE_KICK_MS 600 /* time on after GPIO toggle */
24 #define MDM6600_MODEM_IDLE_DELAY_MS 1000 /* modem after USB suspend */
25 #define MDM6600_MODEM_WAKE_DELAY_MS 200 /* modem response after idle */
27 enum phy_mdm6600_ctrl_lines {
28 PHY_MDM6600_ENABLE, /* USB PHY enable */
29 PHY_MDM6600_POWER, /* Device power */
30 PHY_MDM6600_RESET, /* Device reset */
31 PHY_MDM6600_NR_CTRL_LINES,
34 enum phy_mdm6600_bootmode_lines {
35 PHY_MDM6600_MODE0, /* out USB mode0 and OOB wake */
36 PHY_MDM6600_MODE1, /* out USB mode1, in OOB wake */
37 PHY_MDM6600_NR_MODE_LINES,
40 enum phy_mdm6600_cmd_lines {
41 PHY_MDM6600_CMD0,
42 PHY_MDM6600_CMD1,
43 PHY_MDM6600_CMD2,
44 PHY_MDM6600_NR_CMD_LINES,
47 enum phy_mdm6600_status_lines {
48 PHY_MDM6600_STATUS0,
49 PHY_MDM6600_STATUS1,
50 PHY_MDM6600_STATUS2,
51 PHY_MDM6600_NR_STATUS_LINES,
55 * MDM6600 command codes. These are based on Motorola Mapphone Linux
56 * kernel tree.
58 enum phy_mdm6600_cmd {
59 PHY_MDM6600_CMD_BP_PANIC_ACK,
60 PHY_MDM6600_CMD_DATA_ONLY_BYPASS, /* Reroute USB to CPCAP PHY */
61 PHY_MDM6600_CMD_FULL_BYPASS, /* Reroute USB to CPCAP PHY */
62 PHY_MDM6600_CMD_NO_BYPASS, /* Request normal USB mode */
63 PHY_MDM6600_CMD_BP_SHUTDOWN_REQ, /* Request device power off */
64 PHY_MDM6600_CMD_BP_UNKNOWN_5,
65 PHY_MDM6600_CMD_BP_UNKNOWN_6,
66 PHY_MDM6600_CMD_UNDEFINED,
70 * MDM6600 status codes. These are based on Motorola Mapphone Linux
71 * kernel tree.
73 enum phy_mdm6600_status {
74 PHY_MDM6600_STATUS_PANIC, /* Seems to be really off */
75 PHY_MDM6600_STATUS_PANIC_BUSY_WAIT,
76 PHY_MDM6600_STATUS_QC_DLOAD,
77 PHY_MDM6600_STATUS_RAM_DOWNLOADER, /* MDM6600 USB flashing mode */
78 PHY_MDM6600_STATUS_PHONE_CODE_AWAKE, /* MDM6600 normal USB mode */
79 PHY_MDM6600_STATUS_PHONE_CODE_ASLEEP,
80 PHY_MDM6600_STATUS_SHUTDOWN_ACK,
81 PHY_MDM6600_STATUS_UNDEFINED,
84 static const char * const
85 phy_mdm6600_status_name[] = {
86 "off", "busy", "qc_dl", "ram_dl", "awake",
87 "asleep", "shutdown", "undefined",
90 struct phy_mdm6600 {
91 struct device *dev;
92 struct phy *generic_phy;
93 struct phy_provider *phy_provider;
94 struct gpio_desc *ctrl_gpios[PHY_MDM6600_NR_CTRL_LINES];
95 struct gpio_descs *mode_gpios;
96 struct gpio_descs *status_gpios;
97 struct gpio_descs *cmd_gpios;
98 struct delayed_work bootup_work;
99 struct delayed_work status_work;
100 struct delayed_work modem_wake_work;
101 struct completion ack;
102 bool enabled; /* mdm6600 phy enabled */
103 bool running; /* mdm6600 boot done */
104 bool awake; /* mdm6600 respnds on n_gsm */
105 int status;
108 static int phy_mdm6600_init(struct phy *x)
110 struct phy_mdm6600 *ddata = phy_get_drvdata(x);
111 struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE];
113 if (!ddata->enabled)
114 return -EPROBE_DEFER;
116 gpiod_set_value_cansleep(enable_gpio, 0);
118 return 0;
121 static int phy_mdm6600_power_on(struct phy *x)
123 struct phy_mdm6600 *ddata = phy_get_drvdata(x);
124 struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE];
125 int error;
127 if (!ddata->enabled)
128 return -ENODEV;
130 error = pinctrl_pm_select_default_state(ddata->dev);
131 if (error)
132 dev_warn(ddata->dev, "%s: error with default_state: %i\n",
133 __func__, error);
135 gpiod_set_value_cansleep(enable_gpio, 1);
137 /* Allow aggressive PM for USB, it's only needed for n_gsm port */
138 if (pm_runtime_enabled(&x->dev))
139 phy_pm_runtime_put(x);
141 return 0;
144 static int phy_mdm6600_power_off(struct phy *x)
146 struct phy_mdm6600 *ddata = phy_get_drvdata(x);
147 struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE];
148 int error;
150 if (!ddata->enabled)
151 return -ENODEV;
153 /* Paired with phy_pm_runtime_put() in phy_mdm6600_power_on() */
154 if (pm_runtime_enabled(&x->dev)) {
155 error = phy_pm_runtime_get(x);
156 if (error < 0 && error != -EINPROGRESS)
157 dev_warn(ddata->dev, "%s: phy_pm_runtime_get: %i\n",
158 __func__, error);
161 gpiod_set_value_cansleep(enable_gpio, 0);
163 error = pinctrl_pm_select_sleep_state(ddata->dev);
164 if (error)
165 dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
166 __func__, error);
168 return 0;
171 static const struct phy_ops gpio_usb_ops = {
172 .init = phy_mdm6600_init,
173 .power_on = phy_mdm6600_power_on,
174 .power_off = phy_mdm6600_power_off,
175 .owner = THIS_MODULE,
179 * phy_mdm6600_cmd() - send a command request to mdm6600
180 * @ddata: device driver data
181 * @val: value of cmd to be set
183 * Configures the three command request GPIOs to the specified value.
185 static void phy_mdm6600_cmd(struct phy_mdm6600 *ddata, int val)
187 DECLARE_BITMAP(values, PHY_MDM6600_NR_CMD_LINES);
189 values[0] = val;
191 gpiod_set_array_value_cansleep(PHY_MDM6600_NR_CMD_LINES,
192 ddata->cmd_gpios->desc,
193 ddata->cmd_gpios->info, values);
197 * phy_mdm6600_status() - read mdm6600 status lines
198 * @work: work structure
200 static void phy_mdm6600_status(struct work_struct *work)
202 struct phy_mdm6600 *ddata;
203 struct device *dev;
204 DECLARE_BITMAP(values, PHY_MDM6600_NR_STATUS_LINES);
205 int error;
207 ddata = container_of(work, struct phy_mdm6600, status_work.work);
208 dev = ddata->dev;
210 error = gpiod_get_array_value_cansleep(PHY_MDM6600_NR_STATUS_LINES,
211 ddata->status_gpios->desc,
212 ddata->status_gpios->info,
213 values);
214 if (error)
215 return;
217 ddata->status = values[0] & ((1 << PHY_MDM6600_NR_STATUS_LINES) - 1);
219 dev_info(dev, "modem status: %i %s\n",
220 ddata->status,
221 phy_mdm6600_status_name[ddata->status]);
222 complete(&ddata->ack);
225 static irqreturn_t phy_mdm6600_irq_thread(int irq, void *data)
227 struct phy_mdm6600 *ddata = data;
229 schedule_delayed_work(&ddata->status_work, msecs_to_jiffies(10));
231 return IRQ_HANDLED;
235 * phy_mdm6600_wakeirq_thread - handle mode1 line OOB wake after booting
236 * @irq: interrupt
237 * @data: interrupt handler data
239 * GPIO mode1 is used initially as output to configure the USB boot
240 * mode for mdm6600. After booting it is used as input for OOB wake
241 * signal from mdm6600 to the SoC. Just use it for debug info only
242 * for now.
244 static irqreturn_t phy_mdm6600_wakeirq_thread(int irq, void *data)
246 struct phy_mdm6600 *ddata = data;
247 struct gpio_desc *mode_gpio1;
248 int error, wakeup;
250 mode_gpio1 = ddata->mode_gpios->desc[PHY_MDM6600_MODE1];
251 wakeup = gpiod_get_value(mode_gpio1);
252 if (!wakeup)
253 return IRQ_NONE;
255 dev_dbg(ddata->dev, "OOB wake on mode_gpio1: %i\n", wakeup);
256 error = pm_runtime_get_sync(ddata->dev);
257 if (error < 0) {
258 pm_runtime_put_noidle(ddata->dev);
260 return IRQ_NONE;
263 /* Just wake-up and kick the autosuspend timer */
264 pm_runtime_mark_last_busy(ddata->dev);
265 pm_runtime_put_autosuspend(ddata->dev);
267 return IRQ_HANDLED;
271 * phy_mdm6600_init_irq() - initialize mdm6600 status IRQ lines
272 * @ddata: device driver data
274 static void phy_mdm6600_init_irq(struct phy_mdm6600 *ddata)
276 struct device *dev = ddata->dev;
277 int i, error, irq;
279 for (i = PHY_MDM6600_STATUS0;
280 i <= PHY_MDM6600_STATUS2; i++) {
281 struct gpio_desc *gpio = ddata->status_gpios->desc[i];
283 irq = gpiod_to_irq(gpio);
284 if (irq <= 0)
285 continue;
287 error = devm_request_threaded_irq(dev, irq, NULL,
288 phy_mdm6600_irq_thread,
289 IRQF_TRIGGER_RISING |
290 IRQF_TRIGGER_FALLING |
291 IRQF_ONESHOT,
292 "mdm6600",
293 ddata);
294 if (error)
295 dev_warn(dev, "no modem status irq%i: %i\n",
296 irq, error);
300 struct phy_mdm6600_map {
301 const char *name;
302 int direction;
305 static const struct phy_mdm6600_map
306 phy_mdm6600_ctrl_gpio_map[PHY_MDM6600_NR_CTRL_LINES] = {
307 { "enable", GPIOD_OUT_LOW, }, /* low = phy disabled */
308 { "power", GPIOD_OUT_LOW, }, /* low = off */
309 { "reset", GPIOD_OUT_HIGH, }, /* high = reset */
313 * phy_mdm6600_init_lines() - initialize mdm6600 GPIO lines
314 * @ddata: device driver data
316 static int phy_mdm6600_init_lines(struct phy_mdm6600 *ddata)
318 struct device *dev = ddata->dev;
319 int i;
321 /* MDM6600 control lines */
322 for (i = 0; i < ARRAY_SIZE(phy_mdm6600_ctrl_gpio_map); i++) {
323 const struct phy_mdm6600_map *map =
324 &phy_mdm6600_ctrl_gpio_map[i];
325 struct gpio_desc **gpio = &ddata->ctrl_gpios[i];
327 *gpio = devm_gpiod_get(dev, map->name, map->direction);
328 if (IS_ERR(*gpio)) {
329 dev_info(dev, "gpio %s error %li\n",
330 map->name, PTR_ERR(*gpio));
331 return PTR_ERR(*gpio);
335 /* MDM6600 USB start-up mode output lines */
336 ddata->mode_gpios = devm_gpiod_get_array(dev, "motorola,mode",
337 GPIOD_OUT_LOW);
338 if (IS_ERR(ddata->mode_gpios))
339 return PTR_ERR(ddata->mode_gpios);
341 if (ddata->mode_gpios->ndescs != PHY_MDM6600_NR_MODE_LINES)
342 return -EINVAL;
344 /* MDM6600 status input lines */
345 ddata->status_gpios = devm_gpiod_get_array(dev, "motorola,status",
346 GPIOD_IN);
347 if (IS_ERR(ddata->status_gpios))
348 return PTR_ERR(ddata->status_gpios);
350 if (ddata->status_gpios->ndescs != PHY_MDM6600_NR_STATUS_LINES)
351 return -EINVAL;
353 /* MDM6600 cmd output lines */
354 ddata->cmd_gpios = devm_gpiod_get_array(dev, "motorola,cmd",
355 GPIOD_OUT_LOW);
356 if (IS_ERR(ddata->cmd_gpios))
357 return PTR_ERR(ddata->cmd_gpios);
359 if (ddata->cmd_gpios->ndescs != PHY_MDM6600_NR_CMD_LINES)
360 return -EINVAL;
362 return 0;
366 * phy_mdm6600_device_power_on() - power on mdm6600 device
367 * @ddata: device driver data
369 * To get the integrated USB phy in MDM6600 takes some hoops. We must ensure
370 * the shared USB bootmode GPIOs are configured, then request modem start-up,
371 * reset and power-up.. And then we need to recycle the shared USB bootmode
372 * GPIOs as they are also used for Out of Band (OOB) wake for the USB and
373 * TS 27.010 serial mux.
375 static int phy_mdm6600_device_power_on(struct phy_mdm6600 *ddata)
377 struct gpio_desc *mode_gpio0, *mode_gpio1, *reset_gpio, *power_gpio;
378 int error = 0, wakeirq;
380 mode_gpio0 = ddata->mode_gpios->desc[PHY_MDM6600_MODE0];
381 mode_gpio1 = ddata->mode_gpios->desc[PHY_MDM6600_MODE1];
382 reset_gpio = ddata->ctrl_gpios[PHY_MDM6600_RESET];
383 power_gpio = ddata->ctrl_gpios[PHY_MDM6600_POWER];
386 * Shared GPIOs must be low for normal USB mode. After booting
387 * they are used for OOB wake signaling. These can be also used
388 * to configure USB flashing mode later on based on a module
389 * parameter.
391 gpiod_set_value_cansleep(mode_gpio0, 0);
392 gpiod_set_value_cansleep(mode_gpio1, 0);
394 /* Request start-up mode */
395 phy_mdm6600_cmd(ddata, PHY_MDM6600_CMD_NO_BYPASS);
397 /* Request a reset first */
398 gpiod_set_value_cansleep(reset_gpio, 0);
399 msleep(100);
401 /* Toggle power GPIO to request mdm6600 to start */
402 gpiod_set_value_cansleep(power_gpio, 1);
403 msleep(100);
404 gpiod_set_value_cansleep(power_gpio, 0);
407 * Looks like the USB PHY needs between 2.2 to 4 seconds.
408 * If we try to use it before that, we will get L3 errors
409 * from omap-usb-host trying to access the PHY. See also
410 * phy_mdm6600_init() for -EPROBE_DEFER.
412 msleep(PHY_MDM6600_PHY_DELAY_MS);
413 ddata->enabled = true;
415 /* Booting up the rest of MDM6600 will take total about 8 seconds */
416 dev_info(ddata->dev, "Waiting for power up request to complete..\n");
417 if (wait_for_completion_timeout(&ddata->ack,
418 msecs_to_jiffies(PHY_MDM6600_ENABLED_DELAY_MS))) {
419 if (ddata->status > PHY_MDM6600_STATUS_PANIC &&
420 ddata->status < PHY_MDM6600_STATUS_SHUTDOWN_ACK)
421 dev_info(ddata->dev, "Powered up OK\n");
422 } else {
423 ddata->enabled = false;
424 error = -ETIMEDOUT;
425 dev_err(ddata->dev, "Timed out powering up\n");
428 /* Reconfigure mode1 GPIO as input for OOB wake */
429 gpiod_direction_input(mode_gpio1);
431 wakeirq = gpiod_to_irq(mode_gpio1);
432 if (wakeirq <= 0)
433 return wakeirq;
435 error = devm_request_threaded_irq(ddata->dev, wakeirq, NULL,
436 phy_mdm6600_wakeirq_thread,
437 IRQF_TRIGGER_RISING |
438 IRQF_TRIGGER_FALLING |
439 IRQF_ONESHOT,
440 "mdm6600-wake",
441 ddata);
442 if (error)
443 dev_warn(ddata->dev, "no modem wakeirq irq%i: %i\n",
444 wakeirq, error);
446 ddata->running = true;
448 return error;
452 * phy_mdm6600_device_power_off() - power off mdm6600 device
453 * @ddata: device driver data
455 static void phy_mdm6600_device_power_off(struct phy_mdm6600 *ddata)
457 struct gpio_desc *reset_gpio =
458 ddata->ctrl_gpios[PHY_MDM6600_RESET];
460 ddata->enabled = false;
461 phy_mdm6600_cmd(ddata, PHY_MDM6600_CMD_BP_SHUTDOWN_REQ);
462 msleep(100);
464 gpiod_set_value_cansleep(reset_gpio, 1);
466 dev_info(ddata->dev, "Waiting for power down request to complete.. ");
467 if (wait_for_completion_timeout(&ddata->ack,
468 msecs_to_jiffies(5000))) {
469 if (ddata->status == PHY_MDM6600_STATUS_PANIC)
470 dev_info(ddata->dev, "Powered down OK\n");
471 } else {
472 dev_err(ddata->dev, "Timed out powering down\n");
476 static void phy_mdm6600_deferred_power_on(struct work_struct *work)
478 struct phy_mdm6600 *ddata;
479 int error;
481 ddata = container_of(work, struct phy_mdm6600, bootup_work.work);
483 error = phy_mdm6600_device_power_on(ddata);
484 if (error)
485 dev_err(ddata->dev, "Device not functional\n");
489 * USB suspend puts mdm6600 into low power mode. For any n_gsm using apps,
490 * we need to keep the modem awake by kicking it's mode0 GPIO. This will
491 * keep the modem awake for about 1.2 seconds. When no n_gsm apps are using
492 * the modem, runtime PM auto mode can be enabled so modem can enter low
493 * power mode.
495 static void phy_mdm6600_wake_modem(struct phy_mdm6600 *ddata)
497 struct gpio_desc *mode_gpio0;
499 mode_gpio0 = ddata->mode_gpios->desc[PHY_MDM6600_MODE0];
500 gpiod_set_value_cansleep(mode_gpio0, 1);
501 usleep_range(5, 15);
502 gpiod_set_value_cansleep(mode_gpio0, 0);
503 if (ddata->awake)
504 usleep_range(5, 15);
505 else
506 msleep(MDM6600_MODEM_WAKE_DELAY_MS);
509 static void phy_mdm6600_modem_wake(struct work_struct *work)
511 struct phy_mdm6600 *ddata;
513 ddata = container_of(work, struct phy_mdm6600, modem_wake_work.work);
514 phy_mdm6600_wake_modem(ddata);
517 * The modem does not always stay awake 1.2 seconds after toggling
518 * the wake GPIO, and sometimes it idles after about some 600 ms
519 * making writes time out.
521 schedule_delayed_work(&ddata->modem_wake_work,
522 msecs_to_jiffies(PHY_MDM6600_WAKE_KICK_MS));
525 static int __maybe_unused phy_mdm6600_runtime_suspend(struct device *dev)
527 struct phy_mdm6600 *ddata = dev_get_drvdata(dev);
529 cancel_delayed_work_sync(&ddata->modem_wake_work);
530 ddata->awake = false;
532 return 0;
535 static int __maybe_unused phy_mdm6600_runtime_resume(struct device *dev)
537 struct phy_mdm6600 *ddata = dev_get_drvdata(dev);
539 phy_mdm6600_modem_wake(&ddata->modem_wake_work.work);
540 ddata->awake = true;
542 return 0;
545 static const struct dev_pm_ops phy_mdm6600_pm_ops = {
546 SET_RUNTIME_PM_OPS(phy_mdm6600_runtime_suspend,
547 phy_mdm6600_runtime_resume, NULL)
550 static const struct of_device_id phy_mdm6600_id_table[] = {
551 { .compatible = "motorola,mapphone-mdm6600", },
554 MODULE_DEVICE_TABLE(of, phy_mdm6600_id_table);
556 static int phy_mdm6600_probe(struct platform_device *pdev)
558 struct phy_mdm6600 *ddata;
559 int error;
561 ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
562 if (!ddata)
563 return -ENOMEM;
565 INIT_DELAYED_WORK(&ddata->bootup_work,
566 phy_mdm6600_deferred_power_on);
567 INIT_DELAYED_WORK(&ddata->status_work, phy_mdm6600_status);
568 INIT_DELAYED_WORK(&ddata->modem_wake_work, phy_mdm6600_modem_wake);
569 init_completion(&ddata->ack);
571 ddata->dev = &pdev->dev;
572 platform_set_drvdata(pdev, ddata);
574 /* Active state selected in phy_mdm6600_power_on() */
575 error = pinctrl_pm_select_sleep_state(ddata->dev);
576 if (error)
577 dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
578 __func__, error);
580 error = phy_mdm6600_init_lines(ddata);
581 if (error)
582 return error;
584 phy_mdm6600_init_irq(ddata);
585 schedule_delayed_work(&ddata->bootup_work, 0);
588 * See phy_mdm6600_device_power_on(). We should be able
589 * to remove this eventually when ohci-platform can deal
590 * with -EPROBE_DEFER.
592 msleep(PHY_MDM6600_PHY_DELAY_MS + 500);
595 * Enable PM runtime only after PHY has been powered up properly.
596 * It is currently only needed after USB suspends mdm6600 and n_gsm
597 * needs to access the device. We don't want to do this earlier as
598 * gpio mode0 pin doubles as mdm6600 wake-up gpio.
600 pm_runtime_use_autosuspend(ddata->dev);
601 pm_runtime_set_autosuspend_delay(ddata->dev,
602 MDM6600_MODEM_IDLE_DELAY_MS);
603 pm_runtime_enable(ddata->dev);
604 error = pm_runtime_get_sync(ddata->dev);
605 if (error < 0) {
606 dev_warn(ddata->dev, "failed to wake modem: %i\n", error);
607 pm_runtime_put_noidle(ddata->dev);
608 goto cleanup;
611 ddata->generic_phy = devm_phy_create(ddata->dev, NULL, &gpio_usb_ops);
612 if (IS_ERR(ddata->generic_phy)) {
613 error = PTR_ERR(ddata->generic_phy);
614 goto idle;
617 phy_set_drvdata(ddata->generic_phy, ddata);
619 ddata->phy_provider =
620 devm_of_phy_provider_register(ddata->dev,
621 of_phy_simple_xlate);
622 if (IS_ERR(ddata->phy_provider))
623 error = PTR_ERR(ddata->phy_provider);
625 idle:
626 pm_runtime_mark_last_busy(ddata->dev);
627 pm_runtime_put_autosuspend(ddata->dev);
629 cleanup:
630 if (error < 0)
631 phy_mdm6600_device_power_off(ddata);
633 return error;
636 static int phy_mdm6600_remove(struct platform_device *pdev)
638 struct phy_mdm6600 *ddata = platform_get_drvdata(pdev);
639 struct gpio_desc *reset_gpio = ddata->ctrl_gpios[PHY_MDM6600_RESET];
641 pm_runtime_dont_use_autosuspend(ddata->dev);
642 pm_runtime_put_sync(ddata->dev);
643 pm_runtime_disable(ddata->dev);
645 if (!ddata->running)
646 wait_for_completion_timeout(&ddata->ack,
647 msecs_to_jiffies(PHY_MDM6600_ENABLED_DELAY_MS));
649 gpiod_set_value_cansleep(reset_gpio, 1);
650 phy_mdm6600_device_power_off(ddata);
652 cancel_delayed_work_sync(&ddata->modem_wake_work);
653 cancel_delayed_work_sync(&ddata->bootup_work);
654 cancel_delayed_work_sync(&ddata->status_work);
656 return 0;
659 static struct platform_driver phy_mdm6600_driver = {
660 .probe = phy_mdm6600_probe,
661 .remove = phy_mdm6600_remove,
662 .driver = {
663 .name = "phy-mapphone-mdm6600",
664 .pm = &phy_mdm6600_pm_ops,
665 .of_match_table = of_match_ptr(phy_mdm6600_id_table),
669 module_platform_driver(phy_mdm6600_driver);
671 MODULE_ALIAS("platform:gpio_usb");
672 MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
673 MODULE_DESCRIPTION("mdm6600 gpio usb phy driver");
674 MODULE_LICENSE("GPL v2");