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");
134 arche_pdata = platform_get_drvdata(pdev);
136 mutex_lock(&arche_pdata->platform_state_mutex);
137 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
139 if (arche_pdata->state == state) {
145 case ARCHE_PLATFORM_STATE_TIME_SYNC:
146 if (arche_pdata->state != ARCHE_PLATFORM_STATE_ACTIVE) {
150 if (arche_pdata->wake_detect_state != WD_STATE_IDLE) {
151 dev_err(arche_pdata->dev,
152 "driver busy with wake/detect line ops\n");
155 device_for_each_child(arche_pdata->dev, NULL,
156 arche_apb_bootret_assert);
157 arche_pdata->wake_detect_state = WD_STATE_TIMESYNC;
159 case ARCHE_PLATFORM_STATE_ACTIVE:
160 if (arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC) {
164 device_for_each_child(arche_pdata->dev, NULL,
165 arche_apb_bootret_deassert);
166 arche_pdata->wake_detect_state = WD_STATE_IDLE;
168 case ARCHE_PLATFORM_STATE_OFF:
169 case ARCHE_PLATFORM_STATE_STANDBY:
170 case ARCHE_PLATFORM_STATE_FW_FLASHING:
171 dev_err(arche_pdata->dev, "busy, request to retry later\n");
175 dev_err(arche_pdata->dev,
176 "invalid state transition request\n");
179 arche_pdata->timesync_svc_pdata = timesync_svc_pdata;
180 arche_platform_set_state(arche_pdata, state);
181 if (state == ARCHE_PLATFORM_STATE_ACTIVE)
182 wake_up(&arche_pdata->wq);
186 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
187 mutex_unlock(&arche_pdata->platform_state_mutex);
191 EXPORT_SYMBOL_GPL(arche_platform_change_state);
193 /* Requires arche_pdata->wake_lock is held by calling context */
194 static void arche_platform_set_wake_detect_state(
195 struct arche_platform_drvdata *arche_pdata,
196 enum svc_wakedetect_state state)
198 arche_pdata->wake_detect_state = state;
201 static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
203 gpio_set_value(gpio, onoff);
206 static int apb_cold_boot(struct device *dev, void *data)
210 ret = apb_ctrl_coldboot(dev);
212 dev_warn(dev, "failed to coldboot\n");
214 /*Child nodes are independent, so do not exit coldboot operation */
218 static int apb_poweroff(struct device *dev, void *data)
220 apb_ctrl_poweroff(dev);
222 /* Enable HUB3613 into HUB mode. */
223 if (usb3613_hub_mode_ctrl(false))
224 dev_warn(dev, "failed to control hub device\n");
229 static void arche_platform_wd_irq_en(struct arche_platform_drvdata *arche_pdata)
231 /* Enable interrupt here, to read event back from SVC */
232 gpio_direction_input(arche_pdata->wake_detect_gpio);
233 enable_irq(arche_pdata->wake_detect_irq);
236 static irqreturn_t arche_platform_wd_irq_thread(int irq, void *devid)
238 struct arche_platform_drvdata *arche_pdata = devid;
241 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
242 if (arche_pdata->wake_detect_state != WD_STATE_COLDBOOT_TRIG) {
243 /* Something is wrong */
244 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
248 arche_platform_set_wake_detect_state(arche_pdata,
249 WD_STATE_COLDBOOT_START);
250 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
252 /* It should complete power cycle, so first make sure it is poweroff */
253 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
255 /* Bring APB out of reset: cold boot sequence */
256 device_for_each_child(arche_pdata->dev, NULL, apb_cold_boot);
258 /* Enable HUB3613 into HUB mode. */
259 if (usb3613_hub_mode_ctrl(true))
260 dev_warn(arche_pdata->dev, "failed to control hub device\n");
262 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
263 arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE);
264 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
269 static irqreturn_t arche_platform_wd_irq(int irq, void *devid)
271 struct arche_platform_drvdata *arche_pdata = devid;
274 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
276 if (arche_pdata->wake_detect_state == WD_STATE_TIMESYNC) {
277 gb_timesync_irq(arche_pdata->timesync_svc_pdata);
281 if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
282 /* wake/detect rising */
285 * If wake/detect line goes high after low, within less than
286 * 30msec, then standby boot sequence is initiated, which is not
287 * supported/implemented as of now. So ignore it.
289 if (arche_pdata->wake_detect_state == WD_STATE_BOOT_INIT) {
290 if (time_before(jiffies,
291 arche_pdata->wake_detect_start +
292 msecs_to_jiffies(WD_COLDBOOT_PULSE_WIDTH_MS))) {
293 arche_platform_set_wake_detect_state(arche_pdata,
296 /* Check we are not in middle of irq thread already */
297 if (arche_pdata->wake_detect_state !=
298 WD_STATE_COLDBOOT_START) {
299 arche_platform_set_wake_detect_state(arche_pdata,
300 WD_STATE_COLDBOOT_TRIG);
301 spin_unlock_irqrestore(
302 &arche_pdata->wake_lock,
304 return IRQ_WAKE_THREAD;
309 /* wake/detect falling */
310 if (arche_pdata->wake_detect_state == WD_STATE_IDLE) {
311 arche_pdata->wake_detect_start = jiffies;
313 * In the begining, when wake/detect goes low (first time), we assume
314 * it is meant for coldboot and set the flag. If wake/detect line stays low
315 * beyond 30msec, then it is coldboot else fallback to standby boot.
317 arche_platform_set_wake_detect_state(arche_pdata,
323 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
329 * Requires arche_pdata->platform_state_mutex to be held
331 static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdata)
335 if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
338 dev_info(arche_pdata->dev, "Booting from cold boot state\n");
340 svc_reset_onoff(arche_pdata->svc_reset_gpio,
341 arche_pdata->is_reset_act_hi);
343 gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
344 usleep_range(100, 200);
346 ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
348 dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
353 /* bring SVC out of reset */
354 svc_reset_onoff(arche_pdata->svc_reset_gpio,
355 !arche_pdata->is_reset_act_hi);
357 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
363 * Requires arche_pdata->platform_state_mutex to be held
365 static int arche_platform_fw_flashing_seq(struct arche_platform_drvdata *arche_pdata)
369 if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
372 dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
374 svc_reset_onoff(arche_pdata->svc_reset_gpio,
375 arche_pdata->is_reset_act_hi);
377 gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
379 usleep_range(100, 200);
381 ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
383 dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
388 svc_reset_onoff(arche_pdata->svc_reset_gpio,
389 !arche_pdata->is_reset_act_hi);
391 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
397 * Requires arche_pdata->platform_state_mutex to be held
399 static void arche_platform_poweroff_seq(struct arche_platform_drvdata *arche_pdata)
403 if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
406 /* If in fw_flashing mode, then no need to repeate things again */
407 if (arche_pdata->state != ARCHE_PLATFORM_STATE_FW_FLASHING) {
408 disable_irq(arche_pdata->wake_detect_irq);
410 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
411 arche_platform_set_wake_detect_state(arche_pdata,
413 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
416 clk_disable_unprepare(arche_pdata->svc_ref_clk);
418 /* As part of exit, put APB back in reset state */
419 svc_reset_onoff(arche_pdata->svc_reset_gpio,
420 arche_pdata->is_reset_act_hi);
422 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
425 static ssize_t state_store(struct device *dev,
426 struct device_attribute *attr, const char *buf, size_t count)
428 struct platform_device *pdev = to_platform_device(dev);
429 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
433 mutex_lock(&arche_pdata->platform_state_mutex);
434 if (arche_pdata->state == ARCHE_PLATFORM_STATE_TIME_SYNC) {
435 mutex_unlock(&arche_pdata->platform_state_mutex);
436 ret = wait_event_interruptible(
438 arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC);
444 if (sysfs_streq(buf, "off")) {
445 if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
448 /* If SVC goes down, bring down APB's as well */
449 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
451 arche_platform_poweroff_seq(arche_pdata);
453 } else if (sysfs_streq(buf, "active")) {
454 if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
457 /* First we want to make sure we power off everything
458 * and then activate back again */
459 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
460 arche_platform_poweroff_seq(arche_pdata);
462 arche_platform_wd_irq_en(arche_pdata);
463 ret = arche_platform_coldboot_seq(arche_pdata);
467 } else if (sysfs_streq(buf, "standby")) {
468 if (arche_pdata->state == ARCHE_PLATFORM_STATE_STANDBY)
471 dev_warn(arche_pdata->dev, "standby state not supported\n");
472 } else if (sysfs_streq(buf, "fw_flashing")) {
473 if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
477 * Here we only control SVC.
479 * In case of FW_FLASHING mode we do not want to control
480 * APBs, as in case of V2, SPI bus is shared between both
481 * the APBs. So let user chose which APB he wants to flash.
483 arche_platform_poweroff_seq(arche_pdata);
485 ret = arche_platform_fw_flashing_seq(arche_pdata);
489 dev_err(arche_pdata->dev, "unknown state\n");
494 mutex_unlock(&arche_pdata->platform_state_mutex);
495 return ret ? ret : count;
498 static ssize_t state_show(struct device *dev,
499 struct device_attribute *attr, char *buf)
501 struct arche_platform_drvdata *arche_pdata = dev_get_drvdata(dev);
503 switch (arche_pdata->state) {
504 case ARCHE_PLATFORM_STATE_OFF:
505 return sprintf(buf, "off\n");
506 case ARCHE_PLATFORM_STATE_ACTIVE:
507 return sprintf(buf, "active\n");
508 case ARCHE_PLATFORM_STATE_STANDBY:
509 return sprintf(buf, "standby\n");
510 case ARCHE_PLATFORM_STATE_FW_FLASHING:
511 return sprintf(buf, "fw_flashing\n");
512 case ARCHE_PLATFORM_STATE_TIME_SYNC:
513 return sprintf(buf, "time_sync\n");
515 return sprintf(buf, "unknown state\n");
519 static DEVICE_ATTR_RW(state);
521 static int arche_platform_pm_notifier(struct notifier_block *notifier,
522 unsigned long pm_event, void *unused)
524 struct arche_platform_drvdata *arche_pdata =
525 container_of(notifier, struct arche_platform_drvdata,
527 int ret = NOTIFY_DONE;
529 mutex_lock(&arche_pdata->platform_state_mutex);
531 case PM_SUSPEND_PREPARE:
532 if (arche_pdata->state != ARCHE_PLATFORM_STATE_ACTIVE) {
536 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
537 arche_platform_poweroff_seq(arche_pdata);
539 case PM_POST_SUSPEND:
540 if (arche_pdata->state != ARCHE_PLATFORM_STATE_OFF)
543 arche_platform_wd_irq_en(arche_pdata);
544 arche_platform_coldboot_seq(arche_pdata);
549 mutex_unlock(&arche_pdata->platform_state_mutex);
554 static int arche_platform_probe(struct platform_device *pdev)
556 struct arche_platform_drvdata *arche_pdata;
557 struct device *dev = &pdev->dev;
558 struct device_node *np = dev->of_node;
561 arche_pdata = devm_kzalloc(&pdev->dev, sizeof(*arche_pdata), GFP_KERNEL);
565 /* setup svc reset gpio */
566 arche_pdata->is_reset_act_hi = of_property_read_bool(np,
567 "svc,reset-active-high");
568 arche_pdata->svc_reset_gpio = of_get_named_gpio(np, "svc,reset-gpio", 0);
569 if (arche_pdata->svc_reset_gpio < 0) {
570 dev_err(dev, "failed to get reset-gpio\n");
571 return arche_pdata->svc_reset_gpio;
573 ret = devm_gpio_request(dev, arche_pdata->svc_reset_gpio, "svc-reset");
575 dev_err(dev, "failed to request svc-reset gpio:%d\n", ret);
578 ret = gpio_direction_output(arche_pdata->svc_reset_gpio,
579 arche_pdata->is_reset_act_hi);
581 dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
584 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
586 arche_pdata->svc_sysboot_gpio = of_get_named_gpio(np,
587 "svc,sysboot-gpio", 0);
588 if (arche_pdata->svc_sysboot_gpio < 0) {
589 dev_err(dev, "failed to get sysboot gpio\n");
590 return arche_pdata->svc_sysboot_gpio;
592 ret = devm_gpio_request(dev, arche_pdata->svc_sysboot_gpio, "sysboot0");
594 dev_err(dev, "failed to request sysboot0 gpio:%d\n", ret);
597 ret = gpio_direction_output(arche_pdata->svc_sysboot_gpio, 0);
599 dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
603 /* setup the clock request gpio first */
604 arche_pdata->svc_refclk_req = of_get_named_gpio(np,
605 "svc,refclk-req-gpio", 0);
606 if (arche_pdata->svc_refclk_req < 0) {
607 dev_err(dev, "failed to get svc clock-req gpio\n");
608 return arche_pdata->svc_refclk_req;
610 ret = devm_gpio_request(dev, arche_pdata->svc_refclk_req, "svc-clk-req");
612 dev_err(dev, "failed to request svc-clk-req gpio: %d\n", ret);
615 ret = gpio_direction_input(arche_pdata->svc_refclk_req);
617 dev_err(dev, "failed to set svc-clk-req gpio dir :%d\n", ret);
621 /* setup refclk2 to follow the pin */
622 arche_pdata->svc_ref_clk = devm_clk_get(dev, "svc_ref_clk");
623 if (IS_ERR(arche_pdata->svc_ref_clk)) {
624 ret = PTR_ERR(arche_pdata->svc_ref_clk);
625 dev_err(dev, "failed to get svc_ref_clk: %d\n", ret);
629 platform_set_drvdata(pdev, arche_pdata);
631 arche_pdata->num_apbs = of_get_child_count(np);
632 dev_dbg(dev, "Number of APB's available - %d\n", arche_pdata->num_apbs);
634 arche_pdata->wake_detect_gpio = of_get_named_gpio(np, "svc,wake-detect-gpio", 0);
635 if (arche_pdata->wake_detect_gpio < 0) {
636 dev_err(dev, "failed to get wake detect gpio\n");
637 return arche_pdata->wake_detect_gpio;
640 ret = devm_gpio_request(dev, arche_pdata->wake_detect_gpio, "wake detect");
642 dev_err(dev, "Failed requesting wake_detect gpio %d\n",
643 arche_pdata->wake_detect_gpio);
647 arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE);
649 arche_pdata->dev = &pdev->dev;
651 spin_lock_init(&arche_pdata->wake_lock);
652 mutex_init(&arche_pdata->platform_state_mutex);
653 init_waitqueue_head(&arche_pdata->wq);
654 arche_pdata->wake_detect_irq =
655 gpio_to_irq(arche_pdata->wake_detect_gpio);
657 ret = devm_request_threaded_irq(dev, arche_pdata->wake_detect_irq,
658 arche_platform_wd_irq,
659 arche_platform_wd_irq_thread,
660 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT,
661 dev_name(dev), arche_pdata);
663 dev_err(dev, "failed to request wake detect IRQ %d\n", ret);
666 disable_irq(arche_pdata->wake_detect_irq);
668 ret = device_create_file(dev, &dev_attr_state);
670 dev_err(dev, "failed to create state file in sysfs\n");
674 ret = of_platform_populate(np, NULL, NULL, dev);
676 dev_err(dev, "failed to populate child nodes %d\n", ret);
677 goto err_device_remove;
680 arche_pdata->pm_notifier.notifier_call = arche_platform_pm_notifier;
681 ret = register_pm_notifier(&arche_pdata->pm_notifier);
684 dev_err(dev, "failed to register pm notifier %d\n", ret);
685 goto err_device_remove;
688 /* Register callback pointer */
689 arche_platform_change_state_cb = arche_platform_change_state;
691 /* Explicitly power off if requested */
692 if (!of_property_read_bool(pdev->dev.of_node, "arche,init-off")) {
693 mutex_lock(&arche_pdata->platform_state_mutex);
694 ret = arche_platform_coldboot_seq(arche_pdata);
696 dev_err(dev, "Failed to cold boot svc %d\n", ret);
699 arche_platform_wd_irq_en(arche_pdata);
700 mutex_unlock(&arche_pdata->platform_state_mutex);
703 dev_info(dev, "Device registered successfully\n");
707 mutex_unlock(&arche_pdata->platform_state_mutex);
709 device_remove_file(&pdev->dev, &dev_attr_state);
713 static int arche_remove_child(struct device *dev, void *unused)
715 struct platform_device *pdev = to_platform_device(dev);
717 platform_device_unregister(pdev);
722 static int arche_platform_remove(struct platform_device *pdev)
724 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
726 unregister_pm_notifier(&arche_pdata->pm_notifier);
727 device_remove_file(&pdev->dev, &dev_attr_state);
728 device_for_each_child(&pdev->dev, NULL, arche_remove_child);
729 arche_platform_poweroff_seq(arche_pdata);
730 platform_set_drvdata(pdev, NULL);
732 if (usb3613_hub_mode_ctrl(false))
733 dev_warn(arche_pdata->dev, "failed to control hub device\n");
734 /* TODO: Should we do anything more here ?? */
738 static int arche_platform_suspend(struct device *dev)
741 * If timing profile premits, we may shutdown bridge
746 * Also, need to make sure we meet precondition for unipro suspend
747 * Precondition: Definition ???
752 static int arche_platform_resume(struct device *dev)
755 * Atleast for ES2 we have to meet the delay requirement between
756 * unipro switch and AP bridge init, depending on whether bridge is in
757 * OFF state or standby state.
759 * Based on whether bridge is in standby or OFF state we may have to
760 * assert multiple signals. Please refer to WDM spec, for more info.
766 static void arche_platform_shutdown(struct platform_device *pdev)
768 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
770 arche_platform_poweroff_seq(arche_pdata);
772 usb3613_hub_mode_ctrl(false);
775 static SIMPLE_DEV_PM_OPS(arche_platform_pm_ops,
776 arche_platform_suspend,
777 arche_platform_resume);
779 static const struct of_device_id arche_platform_of_match[] = {
780 { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
784 static const struct of_device_id arche_combined_id[] = {
785 { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
786 { .compatible = "usbffff,2", },
789 MODULE_DEVICE_TABLE(of, arche_combined_id);
791 static struct platform_driver arche_platform_device_driver = {
792 .probe = arche_platform_probe,
793 .remove = arche_platform_remove,
794 .shutdown = arche_platform_shutdown,
796 .name = "arche-platform-ctrl",
797 .pm = &arche_platform_pm_ops,
798 .of_match_table = arche_platform_of_match,
802 static int __init arche_init(void)
806 retval = platform_driver_register(&arche_platform_device_driver);
810 retval = arche_apb_init();
812 platform_driver_unregister(&arche_platform_device_driver);
816 module_init(arche_init);
818 static void __exit arche_exit(void)
821 platform_driver_unregister(&arche_platform_device_driver);
823 module_exit(arche_exit);
825 MODULE_LICENSE("GPL v2");
826 MODULE_AUTHOR("Vaibhav Hiremath <vaibhav.hiremath@linaro.org>");
827 MODULE_DESCRIPTION("Arche Platform Driver");