blob: e36ee984485bfcf3aea56f777e9f7ec4c671ed02 [file] [log] [blame]
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +05301/*
2 * Arche Platform driver to enable Unipro link.
3 *
4 * Copyright 2014-2015 Google Inc.
5 * Copyright 2014-2015 Linaro Ltd.
6 *
7 * Released under the GPLv2 only.
8 */
9
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053010#include <linux/clk.h>
Vaibhav Hirematha463fc12016-01-11 17:41:24 +053011#include <linux/delay.h>
Viresh Kumar3b858df2016-01-11 11:29:17 +053012#include <linux/gpio.h>
13#include <linux/init.h>
14#include <linux/module.h>
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053015#include <linux/of_gpio.h>
Viresh Kumar3b858df2016-01-11 11:29:17 +053016#include <linux/of_platform.h>
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053017#include <linux/pinctrl/consumer.h>
Viresh Kumar3b858df2016-01-11 11:29:17 +053018#include <linux/platform_device.h>
19#include <linux/pm.h>
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +053020#include <linux/interrupt.h>
21#include <linux/irq.h>
David Lin9160b7c2016-04-16 01:15:15 +053022#include <linux/suspend.h>
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +053023#include <linux/time.h>
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -080024#include "arche_platform.h"
Bryan O'Donoghue970dc852016-06-05 14:03:26 +010025#include "greybus.h"
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053026
Vaibhav Hiremathad4d3f92016-02-13 02:04:20 +053027#include <linux/usb/usb3613.h>
28
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +053029#define WD_COLDBOOT_PULSE_WIDTH_MS 30
30
Vaibhav Hiremath685353c2016-02-25 04:37:35 +053031enum 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 */
Bryan O'Donoghue970dc852016-06-05 14:03:26 +010038 WD_STATE_TIMESYNC,
Vaibhav Hiremath685353c2016-02-25 04:37:35 +053039};
40
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053041struct arche_platform_drvdata {
42 /* Control GPIO signals to and from AP <=> SVC */
43 int svc_reset_gpio;
44 bool is_reset_act_hi;
45 int svc_sysboot_gpio;
Vaibhav Hirematha463fc12016-01-11 17:41:24 +053046 int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053047
Vaibhav Hiremathe74d04a2016-02-13 02:04:05 +053048 enum arche_platform_state state;
49
David Lin7fe93012016-03-07 21:52:54 -080050 int svc_refclk_req;
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053051 struct clk *svc_ref_clk;
52
53 struct pinctrl *pinctrl;
54 struct pinctrl_state *pin_default;
55
56 int num_apbs;
Vaibhav Hirematha463fc12016-01-11 17:41:24 +053057
Vaibhav Hiremath685353c2016-02-25 04:37:35 +053058 enum svc_wakedetect_state wake_detect_state;
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +053059 int wake_detect_irq;
Vaibhav Hiremath886aba52016-05-05 15:34:58 +010060 spinlock_t wake_lock; /* Protect wake_detect_state */
61 struct mutex platform_state_mutex; /* Protect state */
Bryan O'Donoghue970dc852016-06-05 14:03:26 +010062 wait_queue_head_t wq; /* WQ for arche_pdata->state */
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +053063 unsigned long wake_detect_start;
David Lin9160b7c2016-04-16 01:15:15 +053064 struct notifier_block pm_notifier;
Vaibhav Hiremath685353c2016-02-25 04:37:35 +053065
Vaibhav Hirematha463fc12016-01-11 17:41:24 +053066 struct device *dev;
Bryan O'Donoghue970dc852016-06-05 14:03:26 +010067 struct gb_timesync_svc *timesync_svc_pdata;
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +053068};
69
Bryan O'Donoghue970dc852016-06-05 14:03:26 +010070static int arche_apb_bootret_assert(struct device *dev, void *data)
71{
72 apb_bootret_assert(dev);
73 return 0;
74}
75
76static int arche_apb_bootret_deassert(struct device *dev, void *data)
77{
78 apb_bootret_deassert(dev);
79 return 0;
80}
81
82/* Requires calling context to hold arche_pdata->platform_state_mutex */
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +010083static void arche_platform_set_state(struct arche_platform_drvdata *arche_pdata,
84 enum arche_platform_state state)
85{
86 arche_pdata->state = state;
87}
88
Vaibhav Hiremath886aba52016-05-05 15:34:58 +010089/*
90 * arche_platform_change_state: Change the operational state
91 *
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.
96 *
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.
101 *
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.
108 *
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.
112 */
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100113int arche_platform_change_state(enum arche_platform_state state,
114 struct gb_timesync_svc *timesync_svc_pdata)
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100115{
116 struct arche_platform_drvdata *arche_pdata;
117 struct platform_device *pdev;
118 struct device_node *np;
119 int ret = -EAGAIN;
120 unsigned long flags;
121
122 np = of_find_compatible_node(NULL, NULL, "google,arche-platform");
123 if (!np) {
124 pr_err("google,arche-platform device node not found\n");
125 return -ENODEV;
126 }
127
128 pdev = of_find_device_by_node(np);
129 if (!pdev) {
130 pr_err("arche-platform device not found\n");
131 return -ENODEV;
132 }
133
134 arche_pdata = platform_get_drvdata(pdev);
135
136 mutex_lock(&arche_pdata->platform_state_mutex);
137 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100138
139 if (arche_pdata->state == state) {
140 ret = 0;
141 goto exit;
142 }
143
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100144 switch (state) {
145 case ARCHE_PLATFORM_STATE_TIME_SYNC:
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100146 if (arche_pdata->state != ARCHE_PLATFORM_STATE_ACTIVE) {
147 ret = -EINVAL;
148 goto exit;
149 }
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");
153 goto exit;
154 }
155 device_for_each_child(arche_pdata->dev, NULL,
156 arche_apb_bootret_assert);
157 arche_pdata->wake_detect_state = WD_STATE_TIMESYNC;
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100158 break;
159 case ARCHE_PLATFORM_STATE_ACTIVE:
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100160 if (arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC) {
161 ret = -EINVAL;
162 goto exit;
163 }
164 device_for_each_child(arche_pdata->dev, NULL,
165 arche_apb_bootret_deassert);
166 arche_pdata->wake_detect_state = WD_STATE_IDLE;
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100167 break;
168 case ARCHE_PLATFORM_STATE_OFF:
169 case ARCHE_PLATFORM_STATE_STANDBY:
170 case ARCHE_PLATFORM_STATE_FW_FLASHING:
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100171 dev_err(arche_pdata->dev, "busy, request to retry later\n");
172 goto exit;
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100173 default:
174 ret = -EINVAL;
175 dev_err(arche_pdata->dev,
176 "invalid state transition request\n");
177 goto exit;
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100178 }
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100179 arche_pdata->timesync_svc_pdata = timesync_svc_pdata;
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100180 arche_platform_set_state(arche_pdata, state);
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100181 if (state == ARCHE_PLATFORM_STATE_ACTIVE)
182 wake_up(&arche_pdata->wq);
183
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100184 ret = 0;
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100185exit:
186 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
187 mutex_unlock(&arche_pdata->platform_state_mutex);
188 of_node_put(np);
189 return ret;
190}
191EXPORT_SYMBOL_GPL(arche_platform_change_state);
192
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100193/* Requires arche_pdata->wake_lock is held by calling context */
194static void arche_platform_set_wake_detect_state(
195 struct arche_platform_drvdata *arche_pdata,
196 enum svc_wakedetect_state state)
197{
198 arche_pdata->wake_detect_state = state;
199}
200
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530201static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
202{
203 gpio_set_value(gpio, onoff);
204}
205
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530206static int apb_cold_boot(struct device *dev, void *data)
207{
208 int ret;
209
210 ret = apb_ctrl_coldboot(dev);
211 if (ret)
212 dev_warn(dev, "failed to coldboot\n");
213
214 /*Child nodes are independent, so do not exit coldboot operation */
215 return 0;
216}
217
Vaibhav Hiremathfd60ac52016-02-13 02:04:17 +0530218static int apb_poweroff(struct device *dev, void *data)
219{
220 apb_ctrl_poweroff(dev);
221
Vaibhav Hiremathe915ce42016-02-25 16:45:45 +0530222 /* Enable HUB3613 into HUB mode. */
223 if (usb3613_hub_mode_ctrl(false))
224 dev_warn(dev, "failed to control hub device\n");
225
Vaibhav Hiremathfd60ac52016-02-13 02:04:17 +0530226 return 0;
227}
228
Vaibhav Hiremath7ba535e2016-05-17 22:39:47 +0530229static void arche_platform_wd_irq_en(struct arche_platform_drvdata *arche_pdata)
Vaibhav Hiremath16fe18c2016-02-25 04:37:37 +0530230{
Vaibhav Hiremath16fe18c2016-02-25 04:37:37 +0530231 /* 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);
234}
235
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530236static irqreturn_t arche_platform_wd_irq_thread(int irq, void *devid)
237{
238 struct arche_platform_drvdata *arche_pdata = devid;
239 unsigned long flags;
240
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100241 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530242 if (arche_pdata->wake_detect_state != WD_STATE_COLDBOOT_TRIG) {
243 /* Something is wrong */
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100244 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530245 return IRQ_HANDLED;
246 }
247
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100248 arche_platform_set_wake_detect_state(arche_pdata,
249 WD_STATE_COLDBOOT_START);
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100250 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530251
Vaibhav Hiremathff788de2016-02-25 16:45:44 +0530252 /* It should complete power cycle, so first make sure it is poweroff */
253 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
Vaibhav Hiremathe915ce42016-02-25 16:45:45 +0530254
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530255 /* Bring APB out of reset: cold boot sequence */
256 device_for_each_child(arche_pdata->dev, NULL, apb_cold_boot);
257
Vaibhav Hirematha7ddda12016-04-12 17:18:47 +0530258 /* Enable HUB3613 into HUB mode. */
259 if (usb3613_hub_mode_ctrl(true))
260 dev_warn(arche_pdata->dev, "failed to control hub device\n");
261
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100262 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100263 arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE);
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100264 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530265
266 return IRQ_HANDLED;
267}
268
269static irqreturn_t arche_platform_wd_irq(int irq, void *devid)
270{
271 struct arche_platform_drvdata *arche_pdata = devid;
272 unsigned long flags;
273
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100274 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530275
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100276 if (arche_pdata->wake_detect_state == WD_STATE_TIMESYNC) {
277 gb_timesync_irq(arche_pdata->timesync_svc_pdata);
278 goto exit;
279 }
280
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530281 if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
282 /* wake/detect rising */
283
284 /*
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.
288 */
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))) {
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100293 arche_platform_set_wake_detect_state(arche_pdata,
294 WD_STATE_IDLE);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530295 } else {
296 /* Check we are not in middle of irq thread already */
297 if (arche_pdata->wake_detect_state !=
298 WD_STATE_COLDBOOT_START) {
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100299 arche_platform_set_wake_detect_state(arche_pdata,
300 WD_STATE_COLDBOOT_TRIG);
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100301 spin_unlock_irqrestore(
302 &arche_pdata->wake_lock,
303 flags);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530304 return IRQ_WAKE_THREAD;
305 }
306 }
307 }
308 } else {
309 /* wake/detect falling */
310 if (arche_pdata->wake_detect_state == WD_STATE_IDLE) {
311 arche_pdata->wake_detect_start = jiffies;
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530312 /*
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.
316 */
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100317 arche_platform_set_wake_detect_state(arche_pdata,
318 WD_STATE_BOOT_INIT);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530319 }
320 }
321
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100322exit:
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100323 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530324
325 return IRQ_HANDLED;
326}
327
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100328/*
329 * Requires arche_pdata->platform_state_mutex to be held
330 */
Vaibhav Hiremath758ca992016-02-13 02:04:03 +0530331static int arche_platform_coldboot_seq(struct arche_platform_drvdata *arche_pdata)
332{
333 int ret;
334
Vaibhav Hiremath599159b2016-02-22 17:27:24 +0530335 if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
336 return 0;
337
Vaibhav Hiremath758ca992016-02-13 02:04:03 +0530338 dev_info(arche_pdata->dev, "Booting from cold boot state\n");
339
340 svc_reset_onoff(arche_pdata->svc_reset_gpio,
341 arche_pdata->is_reset_act_hi);
342
343 gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
344 usleep_range(100, 200);
345
346 ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
347 if (ret) {
348 dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
349 ret);
350 return ret;
351 }
352
353 /* bring SVC out of reset */
354 svc_reset_onoff(arche_pdata->svc_reset_gpio,
355 !arche_pdata->is_reset_act_hi);
356
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100357 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
Vaibhav Hiremathe74d04a2016-02-13 02:04:05 +0530358
Vaibhav Hiremath758ca992016-02-13 02:04:03 +0530359 return 0;
360}
361
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100362/*
363 * Requires arche_pdata->platform_state_mutex to be held
364 */
Vaibhav Hiremathc61a8b42016-05-24 18:32:02 +0530365static int arche_platform_fw_flashing_seq(struct arche_platform_drvdata *arche_pdata)
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530366{
Vaibhav Hiremath7a867d12016-05-24 18:32:04 +0530367 int ret;
368
Vaibhav Hiremath599159b2016-02-22 17:27:24 +0530369 if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
Vaibhav Hiremathc61a8b42016-05-24 18:32:02 +0530370 return 0;
Vaibhav Hiremath599159b2016-02-22 17:27:24 +0530371
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530372 dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
373
374 svc_reset_onoff(arche_pdata->svc_reset_gpio,
375 arche_pdata->is_reset_act_hi);
376
377 gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
378
379 usleep_range(100, 200);
Vaibhav Hiremath7a867d12016-05-24 18:32:04 +0530380
381 ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
382 if (ret) {
383 dev_err(arche_pdata->dev, "failed to enable svc_ref_clk: %d\n",
384 ret);
385 return ret;
386 }
387
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530388 svc_reset_onoff(arche_pdata->svc_reset_gpio,
389 !arche_pdata->is_reset_act_hi);
390
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100391 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530392
Vaibhav Hiremathc61a8b42016-05-24 18:32:02 +0530393 return 0;
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530394}
395
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100396/*
397 * Requires arche_pdata->platform_state_mutex to be held
398 */
Vaibhav Hiremath5993e2b2016-02-13 02:04:04 +0530399static void arche_platform_poweroff_seq(struct arche_platform_drvdata *arche_pdata)
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530400{
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530401 unsigned long flags;
402
Vaibhav Hiremath599159b2016-02-22 17:27:24 +0530403 if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
404 return;
405
Vaibhav Hiremath25847ee2016-02-22 17:27:25 +0530406 /* If in fw_flashing mode, then no need to repeate things again */
407 if (arche_pdata->state != ARCHE_PLATFORM_STATE_FW_FLASHING) {
Vaibhav Hiremathd2320b22016-02-25 04:37:39 +0530408 disable_irq(arche_pdata->wake_detect_irq);
Vaibhav Hiremath16fd9762016-05-17 22:39:46 +0530409
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100410 spin_lock_irqsave(&arche_pdata->wake_lock, flags);
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100411 arche_platform_set_wake_detect_state(arche_pdata,
412 WD_STATE_IDLE);
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100413 spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
Vaibhav Hiremath25847ee2016-02-22 17:27:25 +0530414 }
415
Vaibhav Hiremath7a867d12016-05-24 18:32:04 +0530416 clk_disable_unprepare(arche_pdata->svc_ref_clk);
417
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530418 /* As part of exit, put APB back in reset state */
Viresh Kumar140741e2016-01-11 11:29:06 +0530419 svc_reset_onoff(arche_pdata->svc_reset_gpio,
420 arche_pdata->is_reset_act_hi);
Vaibhav Hiremathe74d04a2016-02-13 02:04:05 +0530421
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100422 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530423}
424
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530425static ssize_t state_store(struct device *dev,
426 struct device_attribute *attr, const char *buf, size_t count)
427{
428 struct platform_device *pdev = to_platform_device(dev);
429 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
430 int ret = 0;
431
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100432retry:
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100433 mutex_lock(&arche_pdata->platform_state_mutex);
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100434 if (arche_pdata->state == ARCHE_PLATFORM_STATE_TIME_SYNC) {
435 mutex_unlock(&arche_pdata->platform_state_mutex);
436 ret = wait_event_interruptible(
437 arche_pdata->wq,
438 arche_pdata->state != ARCHE_PLATFORM_STATE_TIME_SYNC);
439 if (ret)
440 return ret;
441 goto retry;
442 }
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100443
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530444 if (sysfs_streq(buf, "off")) {
445 if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF)
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100446 goto exit;
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530447
Vaibhav Hiremathfd60ac52016-02-13 02:04:17 +0530448 /* If SVC goes down, bring down APB's as well */
449 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
450
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530451 arche_platform_poweroff_seq(arche_pdata);
Vaibhav Hiremathad4d3f92016-02-13 02:04:20 +0530452
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530453 } else if (sysfs_streq(buf, "active")) {
454 if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100455 goto exit;
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530456
Vaibhav Hiremath0b1283e2016-05-24 18:32:03 +0530457 /* 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);
461
Vaibhav Hiremath7ba535e2016-05-17 22:39:47 +0530462 arche_platform_wd_irq_en(arche_pdata);
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530463 ret = arche_platform_coldboot_seq(arche_pdata);
Vaibhav Hiremath0b1283e2016-05-24 18:32:03 +0530464 if (ret)
465 goto exit;
Vaibhav Hiremath16fe18c2016-02-25 04:37:37 +0530466
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530467 } else if (sysfs_streq(buf, "standby")) {
468 if (arche_pdata->state == ARCHE_PLATFORM_STATE_STANDBY)
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100469 goto exit;
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530470
471 dev_warn(arche_pdata->dev, "standby state not supported\n");
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530472 } else if (sysfs_streq(buf, "fw_flashing")) {
473 if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100474 goto exit;
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530475
Vaibhav Hiremath921dbe52016-07-28 13:47:37 +0530476 /*
477 * Here we only control SVC.
478 *
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.
482 */
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530483 arche_platform_poweroff_seq(arche_pdata);
Vaibhav Hiremathfd60ac52016-02-13 02:04:17 +0530484
Vaibhav Hiremathc61a8b42016-05-24 18:32:02 +0530485 ret = arche_platform_fw_flashing_seq(arche_pdata);
486 if (ret)
487 goto exit;
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530488 } else {
489 dev_err(arche_pdata->dev, "unknown state\n");
490 ret = -EINVAL;
491 }
492
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100493exit:
494 mutex_unlock(&arche_pdata->platform_state_mutex);
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530495 return ret ? ret : count;
496}
497
498static ssize_t state_show(struct device *dev,
499 struct device_attribute *attr, char *buf)
500{
501 struct arche_platform_drvdata *arche_pdata = dev_get_drvdata(dev);
502
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");
Vaibhav Hiremath7691fed2016-02-13 02:04:08 +0530510 case ARCHE_PLATFORM_STATE_FW_FLASHING:
511 return sprintf(buf, "fw_flashing\n");
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100512 case ARCHE_PLATFORM_STATE_TIME_SYNC:
513 return sprintf(buf, "time_sync\n");
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530514 default:
515 return sprintf(buf, "unknown state\n");
516 }
517}
518
519static DEVICE_ATTR_RW(state);
520
David Lin9160b7c2016-04-16 01:15:15 +0530521static int arche_platform_pm_notifier(struct notifier_block *notifier,
522 unsigned long pm_event, void *unused)
523{
524 struct arche_platform_drvdata *arche_pdata =
525 container_of(notifier, struct arche_platform_drvdata,
526 pm_notifier);
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100527 int ret = NOTIFY_DONE;
David Lin9160b7c2016-04-16 01:15:15 +0530528
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100529 mutex_lock(&arche_pdata->platform_state_mutex);
David Lin9160b7c2016-04-16 01:15:15 +0530530 switch (pm_event) {
531 case PM_SUSPEND_PREPARE:
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100532 if (arche_pdata->state != ARCHE_PLATFORM_STATE_ACTIVE) {
533 ret = NOTIFY_STOP;
534 break;
535 }
David Lin9160b7c2016-04-16 01:15:15 +0530536 device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
537 arche_platform_poweroff_seq(arche_pdata);
538 break;
539 case PM_POST_SUSPEND:
Vaibhav Hiremath8ef0b532016-08-03 17:15:38 +0530540 if (arche_pdata->state != ARCHE_PLATFORM_STATE_OFF)
541 break;
542
Vaibhav Hiremath7ba535e2016-05-17 22:39:47 +0530543 arche_platform_wd_irq_en(arche_pdata);
Vaibhav Hiremath16fd9762016-05-17 22:39:46 +0530544 arche_platform_coldboot_seq(arche_pdata);
David Lin9160b7c2016-04-16 01:15:15 +0530545 break;
546 default:
547 break;
548 }
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100549 mutex_unlock(&arche_pdata->platform_state_mutex);
David Lin9160b7c2016-04-16 01:15:15 +0530550
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100551 return ret;
David Lin9160b7c2016-04-16 01:15:15 +0530552}
553
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530554static int arche_platform_probe(struct platform_device *pdev)
555{
556 struct arche_platform_drvdata *arche_pdata;
557 struct device *dev = &pdev->dev;
558 struct device_node *np = dev->of_node;
559 int ret;
560
561 arche_pdata = devm_kzalloc(&pdev->dev, sizeof(*arche_pdata), GFP_KERNEL);
562 if (!arche_pdata)
563 return -ENOMEM;
564
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");
Viresh Kumarf1f251b2016-01-11 11:29:07 +0530571 return arche_pdata->svc_reset_gpio;
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530572 }
573 ret = devm_gpio_request(dev, arche_pdata->svc_reset_gpio, "svc-reset");
574 if (ret) {
575 dev_err(dev, "failed to request svc-reset gpio:%d\n", ret);
576 return ret;
577 }
578 ret = gpio_direction_output(arche_pdata->svc_reset_gpio,
579 arche_pdata->is_reset_act_hi);
580 if (ret) {
581 dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
582 return ret;
583 }
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100584 arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530585
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");
Viresh Kumarf1f251b2016-01-11 11:29:07 +0530590 return arche_pdata->svc_sysboot_gpio;
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530591 }
592 ret = devm_gpio_request(dev, arche_pdata->svc_sysboot_gpio, "sysboot0");
593 if (ret) {
594 dev_err(dev, "failed to request sysboot0 gpio:%d\n", ret);
595 return ret;
596 }
597 ret = gpio_direction_output(arche_pdata->svc_sysboot_gpio, 0);
598 if (ret) {
599 dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
600 return ret;
601 }
602
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");
Viresh Kumarf1f251b2016-01-11 11:29:07 +0530608 return arche_pdata->svc_refclk_req;
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530609 }
610 ret = devm_gpio_request(dev, arche_pdata->svc_refclk_req, "svc-clk-req");
611 if (ret) {
612 dev_err(dev, "failed to request svc-clk-req gpio: %d\n", ret);
613 return ret;
614 }
615 ret = gpio_direction_input(arche_pdata->svc_refclk_req);
616 if (ret) {
617 dev_err(dev, "failed to set svc-clk-req gpio dir :%d\n", ret);
618 return ret;
619 }
620
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);
626 return ret;
627 }
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530628
629 platform_set_drvdata(pdev, arche_pdata);
630
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530631 arche_pdata->num_apbs = of_get_child_count(np);
632 dev_dbg(dev, "Number of APB's available - %d\n", arche_pdata->num_apbs);
633
Vaibhav Hirematha463fc12016-01-11 17:41:24 +0530634 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");
Eva Rachel Retuya5a420d12016-09-21 13:07:04 +0800637 return arche_pdata->wake_detect_gpio;
Viresh Kumar72a8c242016-01-11 11:29:05 +0530638 }
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530639
Vaibhav Hirematha463fc12016-01-11 17:41:24 +0530640 ret = devm_gpio_request(dev, arche_pdata->wake_detect_gpio, "wake detect");
641 if (ret) {
642 dev_err(dev, "Failed requesting wake_detect gpio %d\n",
643 arche_pdata->wake_detect_gpio);
Vaibhav Hiremath758ca992016-02-13 02:04:03 +0530644 return ret;
Vaibhav Hirematha463fc12016-01-11 17:41:24 +0530645 }
Vaibhav Hiremath16fd9762016-05-17 22:39:46 +0530646
Bryan O'Donoghuec4058b72016-05-05 15:34:59 +0100647 arche_platform_set_wake_detect_state(arche_pdata, WD_STATE_IDLE);
Vaibhav Hirematha463fc12016-01-11 17:41:24 +0530648
649 arche_pdata->dev = &pdev->dev;
Vaibhav Hirematha463fc12016-01-11 17:41:24 +0530650
Vaibhav Hiremath6c1ca562016-05-05 15:34:57 +0100651 spin_lock_init(&arche_pdata->wake_lock);
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100652 mutex_init(&arche_pdata->platform_state_mutex);
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100653 init_waitqueue_head(&arche_pdata->wq);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530654 arche_pdata->wake_detect_irq =
655 gpio_to_irq(arche_pdata->wake_detect_gpio);
656
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);
662 if (ret) {
663 dev_err(dev, "failed to request wake detect IRQ %d\n", ret);
664 return ret;
665 }
Vaibhav Hiremathd29b67d2016-07-19 13:31:46 +0530666 disable_irq(arche_pdata->wake_detect_irq);
Vaibhav Hiremathf760bbf2016-02-25 04:37:36 +0530667
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530668 ret = device_create_file(dev, &dev_attr_state);
669 if (ret) {
670 dev_err(dev, "failed to create state file in sysfs\n");
671 return ret;
672 }
673
Vaibhav Hiremathfd60ac52016-02-13 02:04:17 +0530674 ret = of_platform_populate(np, NULL, NULL, dev);
675 if (ret) {
676 dev_err(dev, "failed to populate child nodes %d\n", ret);
Vaibhav Hiremathd29b67d2016-07-19 13:31:46 +0530677 goto err_device_remove;
Vaibhav Hiremathfd60ac52016-02-13 02:04:17 +0530678 }
679
David Lin9160b7c2016-04-16 01:15:15 +0530680 arche_pdata->pm_notifier.notifier_call = arche_platform_pm_notifier;
681 ret = register_pm_notifier(&arche_pdata->pm_notifier);
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100682
David Lin9160b7c2016-04-16 01:15:15 +0530683 if (ret) {
684 dev_err(dev, "failed to register pm notifier %d\n", ret);
Vaibhav Hiremathd29b67d2016-07-19 13:31:46 +0530685 goto err_device_remove;
David Lin9160b7c2016-04-16 01:15:15 +0530686 }
687
Bryan O'Donoghue970dc852016-06-05 14:03:26 +0100688 /* Register callback pointer */
689 arche_platform_change_state_cb = arche_platform_change_state;
690
Vaibhav Hiremathd29b67d2016-07-19 13:31:46 +0530691 /* 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);
695 if (ret) {
696 dev_err(dev, "Failed to cold boot svc %d\n", ret);
697 goto err_coldboot;
698 }
699 arche_platform_wd_irq_en(arche_pdata);
700 mutex_unlock(&arche_pdata->platform_state_mutex);
701 }
702
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530703 dev_info(dev, "Device registered successfully\n");
Viresh Kumar72a8c242016-01-11 11:29:05 +0530704 return 0;
Vaibhav Hiremath6743a6f2016-02-25 02:27:36 +0530705
Vaibhav Hiremath6743a6f2016-02-25 02:27:36 +0530706err_coldboot:
Vaibhav Hiremath886aba52016-05-05 15:34:58 +0100707 mutex_unlock(&arche_pdata->platform_state_mutex);
Vaibhav Hiremathd29b67d2016-07-19 13:31:46 +0530708err_device_remove:
Vaibhav Hiremath6743a6f2016-02-25 02:27:36 +0530709 device_remove_file(&pdev->dev, &dev_attr_state);
710 return ret;
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530711}
712
Vaibhav Hiremathbc142bb2015-12-28 20:06:32 +0530713static int arche_remove_child(struct device *dev, void *unused)
714{
715 struct platform_device *pdev = to_platform_device(dev);
716
717 platform_device_unregister(pdev);
718
719 return 0;
720}
721
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530722static int arche_platform_remove(struct platform_device *pdev)
723{
724 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
725
David Lin9160b7c2016-04-16 01:15:15 +0530726 unregister_pm_notifier(&arche_pdata->pm_notifier);
Vaibhav Hiremath2923c582016-02-13 02:04:07 +0530727 device_remove_file(&pdev->dev, &dev_attr_state);
Vaibhav Hiremathbc142bb2015-12-28 20:06:32 +0530728 device_for_each_child(&pdev->dev, NULL, arche_remove_child);
Vaibhav Hiremath5993e2b2016-02-13 02:04:04 +0530729 arche_platform_poweroff_seq(arche_pdata);
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530730 platform_set_drvdata(pdev, NULL);
731
Vaibhav Hiremathad4d3f92016-02-13 02:04:20 +0530732 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 ?? */
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530735 return 0;
736}
737
738static int arche_platform_suspend(struct device *dev)
739{
740 /*
741 * If timing profile premits, we may shutdown bridge
742 * completely
743 *
744 * TODO: sequence ??
745 *
746 * Also, need to make sure we meet precondition for unipro suspend
747 * Precondition: Definition ???
748 */
749 return 0;
750}
751
752static int arche_platform_resume(struct device *dev)
753{
754 /*
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.
758 *
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.
761 *
762 */
763 return 0;
764}
765
David Lin1f77b362016-07-12 17:41:21 -0700766static void arche_platform_shutdown(struct platform_device *pdev)
767{
768 struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
769
770 arche_platform_poweroff_seq(arche_pdata);
771
772 usb3613_hub_mode_ctrl(false);
773}
774
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530775static SIMPLE_DEV_PM_OPS(arche_platform_pm_ops,
776 arche_platform_suspend,
777 arche_platform_resume);
778
Eva Rachel Retuyacdcffc02016-09-22 23:33:34 +0800779static const struct of_device_id arche_platform_of_match[] = {
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530780 { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
781 { },
782};
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -0800783
Eva Rachel Retuyacdcffc02016-09-22 23:33:34 +0800784static const struct of_device_id arche_combined_id[] = {
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -0800785 { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
786 { .compatible = "usbffff,2", },
787 { },
788};
789MODULE_DEVICE_TABLE(of, arche_combined_id);
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530790
791static struct platform_driver arche_platform_device_driver = {
792 .probe = arche_platform_probe,
793 .remove = arche_platform_remove,
David Lin1f77b362016-07-12 17:41:21 -0700794 .shutdown = arche_platform_shutdown,
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530795 .driver = {
796 .name = "arche-platform-ctrl",
797 .pm = &arche_platform_pm_ops,
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -0800798 .of_match_table = arche_platform_of_match,
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530799 }
800};
801
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -0800802static int __init arche_init(void)
803{
804 int retval;
805
806 retval = platform_driver_register(&arche_platform_device_driver);
807 if (retval)
808 return retval;
809
Viresh Kumar7b62b612016-04-20 11:48:37 +0530810 retval = arche_apb_init();
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -0800811 if (retval)
812 platform_driver_unregister(&arche_platform_device_driver);
813
814 return retval;
815}
816module_init(arche_init);
817
818static void __exit arche_exit(void)
819{
Viresh Kumar7b62b612016-04-20 11:48:37 +0530820 arche_apb_exit();
Greg Kroah-Hartman1e5dd1f2015-12-30 13:38:33 -0800821 platform_driver_unregister(&arche_platform_device_driver);
822}
823module_exit(arche_exit);
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530824
Sandeep Patila974f462016-05-13 12:00:56 -0700825MODULE_LICENSE("GPL v2");
Vaibhav Hiremath7fa60652015-12-16 16:29:18 +0530826MODULE_AUTHOR("Vaibhav Hiremath <vaibhav.hiremath@linaro.org>");
827MODULE_DESCRIPTION("Arche Platform Driver");