2 * Arche Platform driver to enable Unipro link.
4 * Copyright 2014-2015 Google Inc.
5 * Copyright 2014-2015 Linaro Ltd.
7 * Released under the GPLv2 only.
10 #include <linux/clk.h>
11 #include <linux/delay.h>
12 #include <linux/gpio.h>
13 #include <linux/init.h>
14 #include <linux/module.h>
15 #include <linux/of_gpio.h>
16 #include <linux/of_platform.h>
17 #include <linux/pinctrl/consumer.h>
18 #include <linux/platform_device.h>
20 #include <linux/interrupt.h>
21 #include <linux/irq.h>
22 #include <linux/suspend.h>
23 #include <linux/time.h>
24 #include "arche_platform.h"
27 #include <linux/usb/usb3613.h>
29 #define WD_COLDBOOT_PULSE_WIDTH_MS 30
31 enum svc_wakedetect_state {
32 WD_STATE_IDLE, /* Default state = pulled high/low */
33 WD_STATE_BOOT_INIT, /* WD = falling edge (low) */
34 WD_STATE_COLDBOOT_TRIG, /* WD = rising edge (high), > 30msec */
35 WD_STATE_STANDBYBOOT_TRIG, /* As of now not used ?? */
36 WD_STATE_COLDBOOT_START, /* Cold boot process started */
37 WD_STATE_STANDBYBOOT_START, /* Not used */
41 struct arche_platform_drvdata {
42 /* Control GPIO signals to and from AP <=> SVC */
46 int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
48 enum arche_platform_state state;
51 struct clk *svc_ref_clk;
53 struct pinctrl *pinctrl;
54 struct pinctrl_state *pin_default;
58 enum svc_wakedetect_state wake_detect_state;
60 spinlock_t wake_lock; /* Protect wake_detect_state */
61 struct mutex platform_state_mutex; /* Protect state */
62 wait_queue_head_t wq; /* WQ for arche_pdata->state */
63 unsigned long wake_detect_start;
64 struct notifier_block pm_notifier;
67 struct gb_timesync_svc *timesync_svc_pdata;
70 static int arche_apb_bootret_assert(struct device *dev, void *data)
72 apb_bootret_assert(dev);
76 static int arche_apb_bootret_deassert(struct device *dev, void *data)
78 apb_bootret_deassert(dev);
82 /* Requires calling context to hold arche_pdata->platform_state_mutex */
83 static void arche_platform_set_state(struct arche_platform_drvdata *arche_pdata,
84 enum arche_platform_state state)
86 arche_pdata->state = state;
90 * arche_platform_change_state: Change the operational state
92 * This exported function allows external drivers to change the state
93 * of the arche-platform driver.
94 * Note that this function only supports transitions between two states
95 * with limited functionality.
97 * - ARCHE_PLATFORM_STATE_TIME_SYNC:
98 * Once set, allows timesync operations between SVC <=> AP and makes
99 * sure that arche-platform driver ignores any subsequent events/pulses
100 * from SVC over wake/detect.
102 * - ARCHE_PLATFORM_STATE_ACTIVE:
103 * Puts back driver to active state, where any pulse from SVC on wake/detect
104 * line would trigger either cold/standby boot.
105 * Note: Transition request from this function does not trigger cold/standby
106 * boot. It just puts back driver book keeping variable back to ACTIVE
107 * state and restores the interrupt.
109 * Returns -ENODEV if device not found, -EAGAIN if the driver cannot currently
110 * satisfy the requested state-transition or -EINVAL for all other
111 * state-transition requests.
113 int arche_platform_change_state(enum arche_platform_state state,
114 struct gb_timesync_svc *timesync_svc_pdata)
116 struct arche_platform_drvdata *arche_pdata;
117 struct platform_device *pdev;
118 struct device_node *np;
122 np = of_find_compatible_node(NULL, NULL, "google,arche-platform");
124 pr_err("google,arche-platform device node not found\n");
128 pdev = of_find_device_by_node(np);
130 pr_err("arche-platform device not found\n");
135 arche_pdata = platform_get_drvdata(pdev);
137 mutex_lock(&arche_pdata->platform_state_mutex);
138 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
140 if (arche_pdata->state == state) {
146 case ARCHE_PLATFORM_STATE_TIME_SYNC:
147 if (arche_pdata->state != ARCHE_PLATFORM_STATE_ACTIVE) {
151 if (arche_pdata->wake_detect_state != WD_STATE_IDLE) {
152 dev_err(arche_pdata->dev,
153 "driver busy with wake/detect line ops\n");
156 device_for_each_child(arche_pdata->dev, NULL,
157 arche_apb_bootret_assert);
158 arche_pdata->wake_detect_state = WD_STATE_TIMESYNC;
160 case ARCHE_PLATFORM_STATE_ACTIVE:
161 if (arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC) {
165 device_for_each_child(arche_pdata->dev, NULL,
166 arche_apb_bootret_deassert);
167 arche_pdata->wake_detect_state = WD_STATE_IDLE;
169 case ARCHE_PLATFORM_STATE_OFF:
170 case ARCHE_PLATFORM_STATE_STANDBY:
171 case ARCHE_PLATFORM_STATE_FW_FLASHING:
172 dev_err(arche_pdata->dev, "busy, request to retry later\n");
176 dev_err(arche_pdata->dev,
177 "invalid state transition request\n");
180 arche_pdata->timesync_svc_pdata = timesync_svc_pdata;
181 arche_platform_set_state(arche_pdata, state);
182 if (state == ARCHE_PLATFORM_STATE_ACTIVE)
183 wake_up(&arche_pdata->wq);
187 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
188 mutex_unlock(&arche_pdata->platform_state_mutex);
192 EXPORT_SYMBOL_GPL(arche_platform_change_state);
194 /* Requires arche_pdata->wake_lock is held by calling context */
195 static void arche_platform_set_wake_detect_state(
196 struct arche_platform_drvdata *arche_pdata,
197 enum svc_wakedetect_state state)
199 arche_pdata->wake_detect_state = state;
202 static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
204 gpio_set_value(gpio, onoff);
207 static int apb_cold_boot(struct device *dev, void *data)
211 ret = apb_ctrl_coldboot(dev);
213 dev_warn(dev, "failed to coldboot\n");
215 /*Child nodes are independent, so do not exit coldboot operation */
219 static int apb_poweroff(struct device *dev, void *data)
221 apb_ctrl_poweroff(dev);
223 /* Enable HUB3613 into HUB mode. */
224 if (usb3613_hub_mode_ctrl(false))
225 dev_warn(dev, "failed to control hub device\n");
230 static void arche_platform_wd_irq_en(struct arche_platform_drvdata *arche_pdata)
232 /* Enable interrupt here, to read event back from SVC */
233 gpio_direction_input(arche_pdata->wake_detect_gpio);
234 enable_irq(arche_pdata->wake_detect_irq);
237 static irqreturn_t arche_platform_wd_irq_thread(int irq, void *devid)
239 struct arche_platform_drvdata *arche_pdata = devid;
242 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
243 if (arche_pdata->wake_detect_state != WD_STATE_COLDBOOT_TRIG) {
244 /* Something is wrong */
245 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
249 arche_platform_set_wake_detect_state(arche_pdata,
250 WD_STATE_COLDBOOT_START);
251 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
253 /* It should complete power cycle, so first make sure it is poweroff */
254 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
256 /* Bring APB out of reset: cold boot sequence */
257 device_for_each_child(arche_pdata->dev, NULL, apb_cold_boot);
259 /* Enable HUB3613 into HUB mode. */
260 if (usb3613_hub_mode_ctrl(true))
261 dev_warn(arche_pdata->dev, "failed to control hub device\n");
263 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
264 arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE);
265 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
270 static irqreturn_t arche_platform_wd_irq(int irq, void *devid)
272 struct arche_platform_drvdata *arche_pdata = devid;
275 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
277 if (arche_pdata->wake_detect_state == WD_STATE_TIMESYNC) {
278 gb_timesync_irq(arche_pdata->timesync_svc_pdata);
282 if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
283 /* wake/detect rising */
286 * If wake/detect line goes high after low, within less than
287 * 30msec, then standby boot sequence is initiated, which is not
288 * supported/implemented as of now. So ignore it.
290 if (arche_pdata->wake_detect_state == WD_STATE_BOOT_INIT) {
291 if (time_before(jiffies,
292 arche_pdata->wake_detect_start +
293 msecs_to_jiffies(WD_COLDBOOT_PULSE_WIDTH_MS))) {
294 arche_platform_set_wake_detect_state(arche_pdata,
297 /* Check we are not in middle of irq thread already */
298 if (arche_pdata->wake_detect_state !=
299 WD_STATE_COLDBOOT_START) {
300 arche_platform_set_wake_detect_state(arche_pdata,
301 WD_STATE_COLDBOOT_TRIG);
302 spin_unlock_irqrestore(
303 &arche_pdata->wake_lock,
305 return IRQ_WAKE_THREAD;
310 /* wake/detect falling */
311 if (arche_pdata->wake_detect_state == WD_STATE_IDLE) {
312 arche_pdata->wake_detect_start = jiffies;
314 * In the begining, when wake/detect goes low (first time), we assume
315 * it is meant for coldboot and set the flag. If wake/detect line stays low
316 * beyond 30msec, then it is coldboot else fallback to standby boot.
318 arche_platform_set_wake_detect_state(arche_pdata,
324 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
330 * Requires arche_pdata->platform_state_mutex to be held
332 static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdata)
336 if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
339 dev_info(arche_pdata->dev, "Booting from cold boot state\n");
341 svc_reset_onoff(arche_pdata->svc_reset_gpio,
342 arche_pdata->is_reset_act_hi);
344 gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
345 usleep_range(100, 200);
347 ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
349 dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
354 /* bring SVC out of reset */
355 svc_reset_onoff(arche_pdata->svc_reset_gpio,
356 !arche_pdata->is_reset_act_hi);
358 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
364 * Requires arche_pdata->platform_state_mutex to be held
366 static int arche_platform_fw_flashing_seq(struct arche_platform_drvdata *arche_pdata)
370 if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
373 dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
375 svc_reset_onoff(arche_pdata->svc_reset_gpio,
376 arche_pdata->is_reset_act_hi);
378 gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
380 usleep_range(100, 200);
382 ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
384 dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
389 svc_reset_onoff(arche_pdata->svc_reset_gpio,
390 !arche_pdata->is_reset_act_hi);
392 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
398 * Requires arche_pdata->platform_state_mutex to be held
400 static void arche_platform_poweroff_seq(struct arche_platform_drvdata *arche_pdata)
404 if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
407 /* If in fw_flashing mode, then no need to repeate things again */
408 if (arche_pdata->state != ARCHE_PLATFORM_STATE_FW_FLASHING) {
409 disable_irq(arche_pdata->wake_detect_irq);
411 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
412 arche_platform_set_wake_detect_state(arche_pdata,
414 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
417 clk_disable_unprepare(arche_pdata->svc_ref_clk);
419 /* As part of exit, put APB back in reset state */
420 svc_reset_onoff(arche_pdata->svc_reset_gpio,
421 arche_pdata->is_reset_act_hi);
423 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
426 static ssize_t state_store(struct device *dev,
427 struct device_attribute *attr, const char *buf, size_t count)
429 struct platform_device *pdev = to_platform_device(dev);
430 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
434 mutex_lock(&arche_pdata->platform_state_mutex);
435 if (arche_pdata->state == ARCHE_PLATFORM_STATE_TIME_SYNC) {
436 mutex_unlock(&arche_pdata->platform_state_mutex);
437 ret = wait_event_interruptible(
439 arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC);
445 if (sysfs_streq(buf, "off")) {
446 if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
449 /* If SVC goes down, bring down APB's as well */
450 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
452 arche_platform_poweroff_seq(arche_pdata);
454 } else if (sysfs_streq(buf, "active")) {
455 if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
458 /* First we want to make sure we power off everything
459 * and then activate back again */
460 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
461 arche_platform_poweroff_seq(arche_pdata);
463 arche_platform_wd_irq_en(arche_pdata);
464 ret = arche_platform_coldboot_seq(arche_pdata);
468 } else if (sysfs_streq(buf, "standby")) {
469 if (arche_pdata->state == ARCHE_PLATFORM_STATE_STANDBY)
472 dev_warn(arche_pdata->dev, "standby state not supported\n");
473 } else if (sysfs_streq(buf, "fw_flashing")) {
474 if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
478 * Here we only control SVC.
480 * In case of FW_FLASHING mode we do not want to control
481 * APBs, as in case of V2, SPI bus is shared between both
482 * the APBs. So let user chose which APB he wants to flash.
484 arche_platform_poweroff_seq(arche_pdata);
486 ret = arche_platform_fw_flashing_seq(arche_pdata);
490 dev_err(arche_pdata->dev, "unknown state\n");
495 mutex_unlock(&arche_pdata->platform_state_mutex);
496 return ret ? ret : count;
499 static ssize_t state_show(struct device *dev,
500 struct device_attribute *attr, char *buf)
502 struct arche_platform_drvdata *arche_pdata = dev_get_drvdata(dev);
504 switch (arche_pdata->state) {
505 case ARCHE_PLATFORM_STATE_OFF:
506 return sprintf(buf, "off\n");
507 case ARCHE_PLATFORM_STATE_ACTIVE:
508 return sprintf(buf, "active\n");
509 case ARCHE_PLATFORM_STATE_STANDBY:
510 return sprintf(buf, "standby\n");
511 case ARCHE_PLATFORM_STATE_FW_FLASHING:
512 return sprintf(buf, "fw_flashing\n");
513 case ARCHE_PLATFORM_STATE_TIME_SYNC:
514 return sprintf(buf, "time_sync\n");
516 return sprintf(buf, "unknown state\n");
520 static DEVICE_ATTR_RW(state);
522 static int arche_platform_pm_notifier(struct notifier_block *notifier,
523 unsigned long pm_event, void *unused)
525 struct arche_platform_drvdata *arche_pdata =
526 container_of(notifier, struct arche_platform_drvdata,
528 int ret = NOTIFY_DONE;
530 mutex_lock(&arche_pdata->platform_state_mutex);
532 case PM_SUSPEND_PREPARE:
533 if (arche_pdata->state != ARCHE_PLATFORM_STATE_ACTIVE) {
537 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
538 arche_platform_poweroff_seq(arche_pdata);
540 case PM_POST_SUSPEND:
541 if (arche_pdata->state != ARCHE_PLATFORM_STATE_OFF)
544 arche_platform_wd_irq_en(arche_pdata);
545 arche_platform_coldboot_seq(arche_pdata);
550 mutex_unlock(&arche_pdata->platform_state_mutex);
555 static int arche_platform_probe(struct platform_device *pdev)
557 struct arche_platform_drvdata *arche_pdata;
558 struct device *dev = &pdev->dev;
559 struct device_node *np = dev->of_node;
562 arche_pdata = devm_kzalloc(&pdev->dev, sizeof(*arche_pdata), GFP_KERNEL);
566 /* setup svc reset gpio */
567 arche_pdata->is_reset_act_hi = of_property_read_bool(np,
568 "svc,reset-active-high");
569 arche_pdata->svc_reset_gpio = of_get_named_gpio(np, "svc,reset-gpio", 0);
570 if (arche_pdata->svc_reset_gpio < 0) {
571 dev_err(dev, "failed to get reset-gpio\n");
572 return arche_pdata->svc_reset_gpio;
574 ret = devm_gpio_request(dev, arche_pdata->svc_reset_gpio, "svc-reset");
576 dev_err(dev, "failed to request svc-reset gpio:%d\n", ret);
579 ret = gpio_direction_output(arche_pdata->svc_reset_gpio,
580 arche_pdata->is_reset_act_hi);
582 dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
585 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
587 arche_pdata->svc_sysboot_gpio = of_get_named_gpio(np,
588 "svc,sysboot-gpio", 0);
589 if (arche_pdata->svc_sysboot_gpio < 0) {
590 dev_err(dev, "failed to get sysboot gpio\n");
591 return arche_pdata->svc_sysboot_gpio;
593 ret = devm_gpio_request(dev, arche_pdata->svc_sysboot_gpio, "sysboot0");
595 dev_err(dev, "failed to request sysboot0 gpio:%d\n", ret);
598 ret = gpio_direction_output(arche_pdata->svc_sysboot_gpio, 0);
600 dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
604 /* setup the clock request gpio first */
605 arche_pdata->svc_refclk_req = of_get_named_gpio(np,
606 "svc,refclk-req-gpio", 0);
607 if (arche_pdata->svc_refclk_req < 0) {
608 dev_err(dev, "failed to get svc clock-req gpio\n");
609 return arche_pdata->svc_refclk_req;
611 ret = devm_gpio_request(dev, arche_pdata->svc_refclk_req, "svc-clk-req");
613 dev_err(dev, "failed to request svc-clk-req gpio: %d\n", ret);
616 ret = gpio_direction_input(arche_pdata->svc_refclk_req);
618 dev_err(dev, "failed to set svc-clk-req gpio dir :%d\n", ret);
622 /* setup refclk2 to follow the pin */
623 arche_pdata->svc_ref_clk = devm_clk_get(dev, "svc_ref_clk");
624 if (IS_ERR(arche_pdata->svc_ref_clk)) {
625 ret = PTR_ERR(arche_pdata->svc_ref_clk);
626 dev_err(dev, "failed to get svc_ref_clk: %d\n", ret);
630 platform_set_drvdata(pdev, arche_pdata);
632 arche_pdata->num_apbs = of_get_child_count(np);
633 dev_dbg(dev, "Number of APB's available - %d\n", arche_pdata->num_apbs);
635 arche_pdata->wake_detect_gpio = of_get_named_gpio(np, "svc,wake-detect-gpio", 0);
636 if (arche_pdata->wake_detect_gpio < 0) {
637 dev_err(dev, "failed to get wake detect gpio\n");
638 return arche_pdata->wake_detect_gpio;
641 ret = devm_gpio_request(dev, arche_pdata->wake_detect_gpio, "wake detect");
643 dev_err(dev, "Failed requesting wake_detect gpio %d\n",
644 arche_pdata->wake_detect_gpio);
648 arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE);
650 arche_pdata->dev = &pdev->dev;
652 spin_lock_init(&arche_pdata->wake_lock);
653 mutex_init(&arche_pdata->platform_state_mutex);
654 init_waitqueue_head(&arche_pdata->wq);
655 arche_pdata->wake_detect_irq =
656 gpio_to_irq(arche_pdata->wake_detect_gpio);
658 ret = devm_request_threaded_irq(dev, arche_pdata->wake_detect_irq,
659 arche_platform_wd_irq,
660 arche_platform_wd_irq_thread,
661 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT,
662 dev_name(dev), arche_pdata);
664 dev_err(dev, "failed to request wake detect IRQ %d\n", ret);
667 disable_irq(arche_pdata->wake_detect_irq);
669 ret = device_create_file(dev, &dev_attr_state);
671 dev_err(dev, "failed to create state file in sysfs\n");
675 ret = of_platform_populate(np, NULL, NULL, dev);
677 dev_err(dev, "failed to populate child nodes %d\n", ret);
678 goto err_device_remove;
681 arche_pdata->pm_notifier.notifier_call = arche_platform_pm_notifier;
682 ret = register_pm_notifier(&arche_pdata->pm_notifier);
685 dev_err(dev, "failed to register pm notifier %d\n", ret);
686 goto err_device_remove;
689 /* Register callback pointer */
690 arche_platform_change_state_cb = arche_platform_change_state;
692 /* Explicitly power off if requested */
693 if (!of_property_read_bool(pdev->dev.of_node, "arche,init-off")) {
694 mutex_lock(&arche_pdata->platform_state_mutex);
695 ret = arche_platform_coldboot_seq(arche_pdata);
697 dev_err(dev, "Failed to cold boot svc %d\n", ret);
700 arche_platform_wd_irq_en(arche_pdata);
701 mutex_unlock(&arche_pdata->platform_state_mutex);
704 dev_info(dev, "Device registered successfully\n");
708 mutex_unlock(&arche_pdata->platform_state_mutex);
710 device_remove_file(&pdev->dev, &dev_attr_state);
714 static int arche_remove_child(struct device *dev, void *unused)
716 struct platform_device *pdev = to_platform_device(dev);
718 platform_device_unregister(pdev);
723 static int arche_platform_remove(struct platform_device *pdev)
725 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
727 unregister_pm_notifier(&arche_pdata->pm_notifier);
728 device_remove_file(&pdev->dev, &dev_attr_state);
729 device_for_each_child(&pdev->dev, NULL, arche_remove_child);
730 arche_platform_poweroff_seq(arche_pdata);
731 platform_set_drvdata(pdev, NULL);
733 if (usb3613_hub_mode_ctrl(false))
734 dev_warn(arche_pdata->dev, "failed to control hub device\n");
735 /* TODO: Should we do anything more here ?? */
739 static int arche_platform_suspend(struct device *dev)
742 * If timing profile premits, we may shutdown bridge
747 * Also, need to make sure we meet precondition for unipro suspend
748 * Precondition: Definition ???
753 static int arche_platform_resume(struct device *dev)
756 * Atleast for ES2 we have to meet the delay requirement between
757 * unipro switch and AP bridge init, depending on whether bridge is in
758 * OFF state or standby state.
760 * Based on whether bridge is in standby or OFF state we may have to
761 * assert multiple signals. Please refer to WDM spec, for more info.
767 static void arche_platform_shutdown(struct platform_device *pdev)
769 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
771 arche_platform_poweroff_seq(arche_pdata);
773 usb3613_hub_mode_ctrl(false);
776 static SIMPLE_DEV_PM_OPS(arche_platform_pm_ops,
777 arche_platform_suspend,
778 arche_platform_resume);
780 static const struct of_device_id arche_platform_of_match[] = {
781 { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
785 static const struct of_device_id arche_combined_id[] = {
786 { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
787 { .compatible = "usbffff,2", },
790 MODULE_DEVICE_TABLE(of, arche_combined_id);
792 static struct platform_driver arche_platform_device_driver = {
793 .probe = arche_platform_probe,
794 .remove = arche_platform_remove,
795 .shutdown = arche_platform_shutdown,
797 .name = "arche-platform-ctrl",
798 .pm = &arche_platform_pm_ops,
799 .of_match_table = arche_platform_of_match,
803 static int __init arche_init(void)
807 retval = platform_driver_register(&arche_platform_device_driver);
811 retval = arche_apb_init();
813 platform_driver_unregister(&arche_platform_device_driver);
817 module_init(arche_init);
819 static void __exit arche_exit(void)
822 platform_driver_unregister(&arche_platform_device_driver);
824 module_exit(arche_exit);
826 MODULE_LICENSE("GPL v2");
827 MODULE_AUTHOR("Vaibhav Hiremath <vaibhav.hiremath@linaro.org>");
828 MODULE_DESCRIPTION("Arche Platform Driver");