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);
189 put_device(&pdev->dev);
193 EXPORT_SYMBOL_GPL(arche_platform_change_state);
195 /* Requires arche_pdata->wake_lock is held by calling context */
196 static void arche_platform_set_wake_detect_state(
197 struct arche_platform_drvdata *arche_pdata,
198 enum svc_wakedetect_state state)
200 arche_pdata->wake_detect_state = state;
203 static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
205 gpio_set_value(gpio, onoff);
208 static int apb_cold_boot(struct device *dev, void *data)
212 ret = apb_ctrl_coldboot(dev);
214 dev_warn(dev, "failed to coldboot\n");
216 /*Child nodes are independent, so do not exit coldboot operation */
220 static int apb_poweroff(struct device *dev, void *data)
222 apb_ctrl_poweroff(dev);
224 /* Enable HUB3613 into HUB mode. */
225 if (usb3613_hub_mode_ctrl(false))
226 dev_warn(dev, "failed to control hub device\n");
231 static void arche_platform_wd_irq_en(struct arche_platform_drvdata *arche_pdata)
233 /* Enable interrupt here, to read event back from SVC */
234 gpio_direction_input(arche_pdata->wake_detect_gpio);
235 enable_irq(arche_pdata->wake_detect_irq);
238 static irqreturn_t arche_platform_wd_irq_thread(int irq, void *devid)
240 struct arche_platform_drvdata *arche_pdata = devid;
243 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
244 if (arche_pdata->wake_detect_state != WD_STATE_COLDBOOT_TRIG) {
245 /* Something is wrong */
246 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
250 arche_platform_set_wake_detect_state(arche_pdata,
251 WD_STATE_COLDBOOT_START);
252 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
254 /* It should complete power cycle, so first make sure it is poweroff */
255 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
257 /* Bring APB out of reset: cold boot sequence */
258 device_for_each_child(arche_pdata->dev, NULL, apb_cold_boot);
260 /* Enable HUB3613 into HUB mode. */
261 if (usb3613_hub_mode_ctrl(true))
262 dev_warn(arche_pdata->dev, "failed to control hub device\n");
264 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
265 arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE);
266 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
271 static irqreturn_t arche_platform_wd_irq(int irq, void *devid)
273 struct arche_platform_drvdata *arche_pdata = devid;
276 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
278 if (arche_pdata->wake_detect_state == WD_STATE_TIMESYNC) {
279 gb_timesync_irq(arche_pdata->timesync_svc_pdata);
283 if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
284 /* wake/detect rising */
287 * If wake/detect line goes high after low, within less than
288 * 30msec, then standby boot sequence is initiated, which is not
289 * supported/implemented as of now. So ignore it.
291 if (arche_pdata->wake_detect_state == WD_STATE_BOOT_INIT) {
292 if (time_before(jiffies,
293 arche_pdata->wake_detect_start +
294 msecs_to_jiffies(WD_COLDBOOT_PULSE_WIDTH_MS))) {
295 arche_platform_set_wake_detect_state(arche_pdata,
298 /* Check we are not in middle of irq thread already */
299 if (arche_pdata->wake_detect_state !=
300 WD_STATE_COLDBOOT_START) {
301 arche_platform_set_wake_detect_state(arche_pdata,
302 WD_STATE_COLDBOOT_TRIG);
303 spin_unlock_irqrestore(
304 &arche_pdata->wake_lock,
306 return IRQ_WAKE_THREAD;
311 /* wake/detect falling */
312 if (arche_pdata->wake_detect_state == WD_STATE_IDLE) {
313 arche_pdata->wake_detect_start = jiffies;
315 * In the begining, when wake/detect goes low (first time), we assume
316 * it is meant for coldboot and set the flag. If wake/detect line stays low
317 * beyond 30msec, then it is coldboot else fallback to standby boot.
319 arche_platform_set_wake_detect_state(arche_pdata,
325 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
331 * Requires arche_pdata->platform_state_mutex to be held
333 static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdata)
337 if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
340 dev_info(arche_pdata->dev, "Booting from cold boot state\n");
342 svc_reset_onoff(arche_pdata->svc_reset_gpio,
343 arche_pdata->is_reset_act_hi);
345 gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
346 usleep_range(100, 200);
348 ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
350 dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
355 /* bring SVC out of reset */
356 svc_reset_onoff(arche_pdata->svc_reset_gpio,
357 !arche_pdata->is_reset_act_hi);
359 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
365 * Requires arche_pdata->platform_state_mutex to be held
367 static int arche_platform_fw_flashing_seq(struct arche_platform_drvdata *arche_pdata)
371 if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
374 dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
376 svc_reset_onoff(arche_pdata->svc_reset_gpio,
377 arche_pdata->is_reset_act_hi);
379 gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
381 usleep_range(100, 200);
383 ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
385 dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
390 svc_reset_onoff(arche_pdata->svc_reset_gpio,
391 !arche_pdata->is_reset_act_hi);
393 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
399 * Requires arche_pdata->platform_state_mutex to be held
401 static void arche_platform_poweroff_seq(struct arche_platform_drvdata *arche_pdata)
405 if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
408 /* If in fw_flashing mode, then no need to repeate things again */
409 if (arche_pdata->state != ARCHE_PLATFORM_STATE_FW_FLASHING) {
410 disable_irq(arche_pdata->wake_detect_irq);
412 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
413 arche_platform_set_wake_detect_state(arche_pdata,
415 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
418 clk_disable_unprepare(arche_pdata->svc_ref_clk);
420 /* As part of exit, put APB back in reset state */
421 svc_reset_onoff(arche_pdata->svc_reset_gpio,
422 arche_pdata->is_reset_act_hi);
424 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
427 static ssize_t state_store(struct device *dev,
428 struct device_attribute *attr, const char *buf, size_t count)
430 struct platform_device *pdev = to_platform_device(dev);
431 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
435 mutex_lock(&arche_pdata->platform_state_mutex);
436 if (arche_pdata->state == ARCHE_PLATFORM_STATE_TIME_SYNC) {
437 mutex_unlock(&arche_pdata->platform_state_mutex);
438 ret = wait_event_interruptible(
440 arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC);
446 if (sysfs_streq(buf, "off")) {
447 if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
450 /* If SVC goes down, bring down APB's as well */
451 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
453 arche_platform_poweroff_seq(arche_pdata);
455 } else if (sysfs_streq(buf, "active")) {
456 if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
459 /* First we want to make sure we power off everything
460 * and then activate back again */
461 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
462 arche_platform_poweroff_seq(arche_pdata);
464 arche_platform_wd_irq_en(arche_pdata);
465 ret = arche_platform_coldboot_seq(arche_pdata);
469 } else if (sysfs_streq(buf, "standby")) {
470 if (arche_pdata->state == ARCHE_PLATFORM_STATE_STANDBY)
473 dev_warn(arche_pdata->dev, "standby state not supported\n");
474 } else if (sysfs_streq(buf, "fw_flashing")) {
475 if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
479 * Here we only control SVC.
481 * In case of FW_FLASHING mode we do not want to control
482 * APBs, as in case of V2, SPI bus is shared between both
483 * the APBs. So let user chose which APB he wants to flash.
485 arche_platform_poweroff_seq(arche_pdata);
487 ret = arche_platform_fw_flashing_seq(arche_pdata);
491 dev_err(arche_pdata->dev, "unknown state\n");
496 mutex_unlock(&arche_pdata->platform_state_mutex);
497 return ret ? ret : count;
500 static ssize_t state_show(struct device *dev,
501 struct device_attribute *attr, char *buf)
503 struct arche_platform_drvdata *arche_pdata = dev_get_drvdata(dev);
505 switch (arche_pdata->state) {
506 case ARCHE_PLATFORM_STATE_OFF:
507 return sprintf(buf, "off\n");
508 case ARCHE_PLATFORM_STATE_ACTIVE:
509 return sprintf(buf, "active\n");
510 case ARCHE_PLATFORM_STATE_STANDBY:
511 return sprintf(buf, "standby\n");
512 case ARCHE_PLATFORM_STATE_FW_FLASHING:
513 return sprintf(buf, "fw_flashing\n");
514 case ARCHE_PLATFORM_STATE_TIME_SYNC:
515 return sprintf(buf, "time_sync\n");
517 return sprintf(buf, "unknown state\n");
521 static DEVICE_ATTR_RW(state);
523 static int arche_platform_pm_notifier(struct notifier_block *notifier,
524 unsigned long pm_event, void *unused)
526 struct arche_platform_drvdata *arche_pdata =
527 container_of(notifier, struct arche_platform_drvdata,
529 int ret = NOTIFY_DONE;
531 mutex_lock(&arche_pdata->platform_state_mutex);
533 case PM_SUSPEND_PREPARE:
534 if (arche_pdata->state != ARCHE_PLATFORM_STATE_ACTIVE) {
538 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
539 arche_platform_poweroff_seq(arche_pdata);
541 case PM_POST_SUSPEND:
542 if (arche_pdata->state != ARCHE_PLATFORM_STATE_OFF)
545 arche_platform_wd_irq_en(arche_pdata);
546 arche_platform_coldboot_seq(arche_pdata);
551 mutex_unlock(&arche_pdata->platform_state_mutex);
556 static int arche_platform_probe(struct platform_device *pdev)
558 struct arche_platform_drvdata *arche_pdata;
559 struct device *dev = &pdev->dev;
560 struct device_node *np = dev->of_node;
563 arche_pdata = devm_kzalloc(&pdev->dev, sizeof(*arche_pdata), GFP_KERNEL);
567 /* setup svc reset gpio */
568 arche_pdata->is_reset_act_hi = of_property_read_bool(np,
569 "svc,reset-active-high");
570 arche_pdata->svc_reset_gpio = of_get_named_gpio(np, "svc,reset-gpio", 0);
571 if (arche_pdata->svc_reset_gpio < 0) {
572 dev_err(dev, "failed to get reset-gpio\n");
573 return arche_pdata->svc_reset_gpio;
575 ret = devm_gpio_request(dev, arche_pdata->svc_reset_gpio, "svc-reset");
577 dev_err(dev, "failed to request svc-reset gpio:%d\n", ret);
580 ret = gpio_direction_output(arche_pdata->svc_reset_gpio,
581 arche_pdata->is_reset_act_hi);
583 dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
586 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
588 arche_pdata->svc_sysboot_gpio = of_get_named_gpio(np,
589 "svc,sysboot-gpio", 0);
590 if (arche_pdata->svc_sysboot_gpio < 0) {
591 dev_err(dev, "failed to get sysboot gpio\n");
592 return arche_pdata->svc_sysboot_gpio;
594 ret = devm_gpio_request(dev, arche_pdata->svc_sysboot_gpio, "sysboot0");
596 dev_err(dev, "failed to request sysboot0 gpio:%d\n", ret);
599 ret = gpio_direction_output(arche_pdata->svc_sysboot_gpio, 0);
601 dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
605 /* setup the clock request gpio first */
606 arche_pdata->svc_refclk_req = of_get_named_gpio(np,
607 "svc,refclk-req-gpio", 0);
608 if (arche_pdata->svc_refclk_req < 0) {
609 dev_err(dev, "failed to get svc clock-req gpio\n");
610 return arche_pdata->svc_refclk_req;
612 ret = devm_gpio_request(dev, arche_pdata->svc_refclk_req, "svc-clk-req");
614 dev_err(dev, "failed to request svc-clk-req gpio: %d\n", ret);
617 ret = gpio_direction_input(arche_pdata->svc_refclk_req);
619 dev_err(dev, "failed to set svc-clk-req gpio dir :%d\n", ret);
623 /* setup refclk2 to follow the pin */
624 arche_pdata->svc_ref_clk = devm_clk_get(dev, "svc_ref_clk");
625 if (IS_ERR(arche_pdata->svc_ref_clk)) {
626 ret = PTR_ERR(arche_pdata->svc_ref_clk);
627 dev_err(dev, "failed to get svc_ref_clk: %d\n", ret);
631 platform_set_drvdata(pdev, arche_pdata);
633 arche_pdata->num_apbs = of_get_child_count(np);
634 dev_dbg(dev, "Number of APB's available - %d\n", arche_pdata->num_apbs);
636 arche_pdata->wake_detect_gpio = of_get_named_gpio(np, "svc,wake-detect-gpio", 0);
637 if (arche_pdata->wake_detect_gpio < 0) {
638 dev_err(dev, "failed to get wake detect gpio\n");
639 return arche_pdata->wake_detect_gpio;
642 ret = devm_gpio_request(dev, arche_pdata->wake_detect_gpio, "wake detect");
644 dev_err(dev, "Failed requesting wake_detect gpio %d\n",
645 arche_pdata->wake_detect_gpio);
649 arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE);
651 arche_pdata->dev = &pdev->dev;
653 spin_lock_init(&arche_pdata->wake_lock);
654 mutex_init(&arche_pdata->platform_state_mutex);
655 init_waitqueue_head(&arche_pdata->wq);
656 arche_pdata->wake_detect_irq =
657 gpio_to_irq(arche_pdata->wake_detect_gpio);
659 ret = devm_request_threaded_irq(dev, arche_pdata->wake_detect_irq,
660 arche_platform_wd_irq,
661 arche_platform_wd_irq_thread,
662 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT,
663 dev_name(dev), arche_pdata);
665 dev_err(dev, "failed to request wake detect IRQ %d\n", ret);
668 disable_irq(arche_pdata->wake_detect_irq);
670 ret = device_create_file(dev, &dev_attr_state);
672 dev_err(dev, "failed to create state file in sysfs\n");
676 ret = of_platform_populate(np, NULL, NULL, dev);
678 dev_err(dev, "failed to populate child nodes %d\n", ret);
679 goto err_device_remove;
682 arche_pdata->pm_notifier.notifier_call = arche_platform_pm_notifier;
683 ret = register_pm_notifier(&arche_pdata->pm_notifier);
686 dev_err(dev, "failed to register pm notifier %d\n", ret);
687 goto err_device_remove;
690 /* Register callback pointer */
691 arche_platform_change_state_cb = arche_platform_change_state;
693 /* Explicitly power off if requested */
694 if (!of_property_read_bool(pdev->dev.of_node, "arche,init-off")) {
695 mutex_lock(&arche_pdata->platform_state_mutex);
696 ret = arche_platform_coldboot_seq(arche_pdata);
698 dev_err(dev, "Failed to cold boot svc %d\n", ret);
701 arche_platform_wd_irq_en(arche_pdata);
702 mutex_unlock(&arche_pdata->platform_state_mutex);
705 dev_info(dev, "Device registered successfully\n");
709 mutex_unlock(&arche_pdata->platform_state_mutex);
711 device_remove_file(&pdev->dev, &dev_attr_state);
715 static int arche_remove_child(struct device *dev, void *unused)
717 struct platform_device *pdev = to_platform_device(dev);
719 platform_device_unregister(pdev);
724 static int arche_platform_remove(struct platform_device *pdev)
726 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
728 unregister_pm_notifier(&arche_pdata->pm_notifier);
729 device_remove_file(&pdev->dev, &dev_attr_state);
730 device_for_each_child(&pdev->dev, NULL, arche_remove_child);
731 arche_platform_poweroff_seq(arche_pdata);
732 platform_set_drvdata(pdev, NULL);
734 if (usb3613_hub_mode_ctrl(false))
735 dev_warn(arche_pdata->dev, "failed to control hub device\n");
736 /* TODO: Should we do anything more here ?? */
740 static int arche_platform_suspend(struct device *dev)
743 * If timing profile premits, we may shutdown bridge
748 * Also, need to make sure we meet precondition for unipro suspend
749 * Precondition: Definition ???
754 static int arche_platform_resume(struct device *dev)
757 * Atleast for ES2 we have to meet the delay requirement between
758 * unipro switch and AP bridge init, depending on whether bridge is in
759 * OFF state or standby state.
761 * Based on whether bridge is in standby or OFF state we may have to
762 * assert multiple signals. Please refer to WDM spec, for more info.
768 static void arche_platform_shutdown(struct platform_device *pdev)
770 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
772 arche_platform_poweroff_seq(arche_pdata);
774 usb3613_hub_mode_ctrl(false);
777 static SIMPLE_DEV_PM_OPS(arche_platform_pm_ops,
778 arche_platform_suspend,
779 arche_platform_resume);
781 static const struct of_device_id arche_platform_of_match[] = {
782 { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
786 static const struct of_device_id arche_combined_id[] = {
787 { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
788 { .compatible = "usbffff,2", },
791 MODULE_DEVICE_TABLE(of, arche_combined_id);
793 static struct platform_driver arche_platform_device_driver = {
794 .probe = arche_platform_probe,
795 .remove = arche_platform_remove,
796 .shutdown = arche_platform_shutdown,
798 .name = "arche-platform-ctrl",
799 .pm = &arche_platform_pm_ops,
800 .of_match_table = arche_platform_of_match,
804 static int __init arche_init(void)
808 retval = platform_driver_register(&arche_platform_device_driver);
812 retval = arche_apb_init();
814 platform_driver_unregister(&arche_platform_device_driver);
818 module_init(arche_init);
820 static void __exit arche_exit(void)
823 platform_driver_unregister(&arche_platform_device_driver);
825 module_exit(arche_exit);
827 MODULE_LICENSE("GPL v2");
828 MODULE_AUTHOR("Vaibhav Hiremath <vaibhav.hiremath@linaro.org>");
829 MODULE_DESCRIPTION("Arche Platform Driver");