blob: f760e935e059dc6158bba3aa11459bc91858bcb1 [file] [log] [blame]
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +01001/*
2 * drivers/usb/otg/ab8500_usb.c
3 *
4 * USB transceiver driver for AB8500 chip
5 *
6 * Copyright (C) 2010 ST-Ericsson AB
7 * Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#include <linux/module.h>
26#include <linux/platform_device.h>
27#include <linux/usb/otg.h>
28#include <linux/slab.h>
29#include <linux/notifier.h>
30#include <linux/interrupt.h>
31#include <linux/delay.h>
32#include <linux/mfd/abx500.h>
Linus Walleijee66e652011-12-02 14:16:33 +010033#include <linux/mfd/abx500/ab8500.h>
Fabio Baltieriaf6882b2013-03-08 10:27:09 +080034#include <linux/usb/musb-ux500.h>
Fabio Baltierie65b36c2013-04-03 10:45:06 +020035#include <linux/regulator/consumer.h>
Patrice Chotard899f0f52013-04-03 10:45:11 +020036#include <linux/pinctrl/consumer.h>
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +010037
Sakethram Bommisetti71246312013-04-03 10:45:04 +020038/* Bank AB8500_SYS_CTRL2_BLOCK */
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +010039#define AB8500_MAIN_WD_CTRL_REG 0x01
Sakethram Bommisetti71246312013-04-03 10:45:04 +020040
41/* Bank AB8500_USB */
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +010042#define AB8500_USB_LINE_STAT_REG 0x80
Fabio Baltieriaf6882b2013-03-08 10:27:09 +080043#define AB8505_USB_LINE_STAT_REG 0x94
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +010044#define AB8500_USB_PHY_CTRL_REG 0x8A
45
Sakethram Bommisetti71246312013-04-03 10:45:04 +020046/* Bank AB8500_DEVELOPMENT */
47#define AB8500_BANK12_ACCESS 0x00
48
49/* Bank AB8500_DEBUG */
50#define AB8500_USB_PHY_TUNE1 0x05
51#define AB8500_USB_PHY_TUNE2 0x06
52#define AB8500_USB_PHY_TUNE3 0x07
53
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +010054#define AB8500_BIT_OTG_STAT_ID (1 << 0)
55#define AB8500_BIT_PHY_CTRL_HOST_EN (1 << 0)
56#define AB8500_BIT_PHY_CTRL_DEVICE_EN (1 << 1)
57#define AB8500_BIT_WD_CTRL_ENABLE (1 << 0)
58#define AB8500_BIT_WD_CTRL_KICK (1 << 1)
59
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +010060#define AB8500_WD_KICK_DELAY_US 100 /* usec */
61#define AB8500_WD_V11_DISABLE_DELAY_US 100 /* usec */
Fabio Baltieriaf6882b2013-03-08 10:27:09 +080062#define AB8500_V20_31952_DISABLE_DELAY_US 100 /* usec */
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +010063
64/* Usb line status register */
65enum ab8500_usb_link_status {
Fabio Baltieriaf6882b2013-03-08 10:27:09 +080066 USB_LINK_NOT_CONFIGURED_8500 = 0,
67 USB_LINK_STD_HOST_NC_8500,
68 USB_LINK_STD_HOST_C_NS_8500,
69 USB_LINK_STD_HOST_C_S_8500,
70 USB_LINK_HOST_CHG_NM_8500,
71 USB_LINK_HOST_CHG_HS_8500,
72 USB_LINK_HOST_CHG_HS_CHIRP_8500,
73 USB_LINK_DEDICATED_CHG_8500,
74 USB_LINK_ACA_RID_A_8500,
75 USB_LINK_ACA_RID_B_8500,
76 USB_LINK_ACA_RID_C_NM_8500,
77 USB_LINK_ACA_RID_C_HS_8500,
78 USB_LINK_ACA_RID_C_HS_CHIRP_8500,
79 USB_LINK_HM_IDGND_8500,
80 USB_LINK_RESERVED_8500,
81 USB_LINK_NOT_VALID_LINK_8500,
82};
83
84enum ab8505_usb_link_status {
85 USB_LINK_NOT_CONFIGURED_8505 = 0,
86 USB_LINK_STD_HOST_NC_8505,
87 USB_LINK_STD_HOST_C_NS_8505,
88 USB_LINK_STD_HOST_C_S_8505,
89 USB_LINK_CDP_8505,
90 USB_LINK_RESERVED0_8505,
91 USB_LINK_RESERVED1_8505,
92 USB_LINK_DEDICATED_CHG_8505,
93 USB_LINK_ACA_RID_A_8505,
94 USB_LINK_ACA_RID_B_8505,
95 USB_LINK_ACA_RID_C_NM_8505,
96 USB_LINK_RESERVED2_8505,
97 USB_LINK_RESERVED3_8505,
98 USB_LINK_HM_IDGND_8505,
99 USB_LINK_CHARGERPORT_NOT_OK_8505,
100 USB_LINK_CHARGER_DM_HIGH_8505,
101 USB_LINK_PHYEN_NO_VBUS_NO_IDGND_8505,
102 USB_LINK_STD_UPSTREAM_NO_IDGNG_NO_VBUS_8505,
103 USB_LINK_STD_UPSTREAM_8505,
104 USB_LINK_CHARGER_SE1_8505,
105 USB_LINK_CARKIT_CHGR_1_8505,
106 USB_LINK_CARKIT_CHGR_2_8505,
107 USB_LINK_ACA_DOCK_CHGR_8505,
108 USB_LINK_SAMSUNG_BOOT_CBL_PHY_EN_8505,
109 USB_LINK_SAMSUNG_BOOT_CBL_PHY_DISB_8505,
110 USB_LINK_SAMSUNG_UART_CBL_PHY_EN_8505,
111 USB_LINK_SAMSUNG_UART_CBL_PHY_DISB_8505,
112 USB_LINK_MOTOROLA_FACTORY_CBL_PHY_EN_8505,
113};
114
115enum ab8500_usb_mode {
116 USB_IDLE = 0,
117 USB_PERIPHERAL,
118 USB_HOST,
119 USB_DEDICATED_CHG
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100120};
121
122struct ab8500_usb {
Heikki Krogerus144713f2012-02-13 13:24:05 +0200123 struct usb_phy phy;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100124 struct device *dev;
Fabio Baltieri73f226c2013-03-08 10:27:08 +0800125 struct ab8500 *ab8500;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100126 unsigned vbus_draw;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100127 struct work_struct phy_dis_work;
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800128 enum ab8500_usb_mode mode;
Fabio Baltierie65b36c2013-04-03 10:45:06 +0200129 struct regulator *v_ape;
130 struct regulator *v_musb;
131 struct regulator *v_ulpi;
Fabio Baltieri54dfbb02013-04-03 10:45:08 +0200132 int saved_v_ulpi;
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800133 int previous_link_status_state;
Patrice Chotard899f0f52013-04-03 10:45:11 +0200134 struct pinctrl *pinctrl;
135 struct pinctrl_state *pins_sleep;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100136};
137
Heikki Krogerus144713f2012-02-13 13:24:05 +0200138static inline struct ab8500_usb *phy_to_ab(struct usb_phy *x)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100139{
Heikki Krogerus144713f2012-02-13 13:24:05 +0200140 return container_of(x, struct ab8500_usb, phy);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100141}
142
143static void ab8500_usb_wd_workaround(struct ab8500_usb *ab)
144{
145 abx500_set_register_interruptible(ab->dev,
146 AB8500_SYS_CTRL2_BLOCK,
147 AB8500_MAIN_WD_CTRL_REG,
148 AB8500_BIT_WD_CTRL_ENABLE);
149
150 udelay(AB8500_WD_KICK_DELAY_US);
151
152 abx500_set_register_interruptible(ab->dev,
153 AB8500_SYS_CTRL2_BLOCK,
154 AB8500_MAIN_WD_CTRL_REG,
155 (AB8500_BIT_WD_CTRL_ENABLE
156 | AB8500_BIT_WD_CTRL_KICK));
157
Fabio Baltieri73f226c2013-03-08 10:27:08 +0800158 udelay(AB8500_WD_V11_DISABLE_DELAY_US);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100159
160 abx500_set_register_interruptible(ab->dev,
161 AB8500_SYS_CTRL2_BLOCK,
162 AB8500_MAIN_WD_CTRL_REG,
163 0);
164}
165
Fabio Baltieri54dfbb02013-04-03 10:45:08 +0200166static void ab8500_usb_regulator_enable(struct ab8500_usb *ab)
167{
168 int ret, volt;
169
Fabio Baltieri88b1c782013-04-03 16:02:25 +0200170 ret = regulator_enable(ab->v_ape);
171 if (ret)
172 dev_err(ab->dev, "Failed to enable v-ape\n");
Fabio Baltieri54dfbb02013-04-03 10:45:08 +0200173
174 if (!is_ab8500_2p0_or_earlier(ab->ab8500)) {
175 ab->saved_v_ulpi = regulator_get_voltage(ab->v_ulpi);
176 if (ab->saved_v_ulpi < 0)
177 dev_err(ab->dev, "Failed to get v_ulpi voltage\n");
178
179 ret = regulator_set_voltage(ab->v_ulpi, 1300000, 1350000);
180 if (ret < 0)
181 dev_err(ab->dev, "Failed to set the Vintcore to 1.3V, ret=%d\n",
182 ret);
183
184 ret = regulator_set_optimum_mode(ab->v_ulpi, 28000);
185 if (ret < 0)
186 dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n",
187 ret);
188 }
189
Fabio Baltieri88b1c782013-04-03 16:02:25 +0200190 ret = regulator_enable(ab->v_ulpi);
191 if (ret)
192 dev_err(ab->dev, "Failed to enable vddulpivio18\n");
Fabio Baltieri54dfbb02013-04-03 10:45:08 +0200193
194 if (!is_ab8500_2p0_or_earlier(ab->ab8500)) {
195 volt = regulator_get_voltage(ab->v_ulpi);
196 if ((volt != 1300000) && (volt != 1350000))
197 dev_err(ab->dev, "Vintcore is not set to 1.3V volt=%d\n",
198 volt);
199 }
200
Fabio Baltieri88b1c782013-04-03 16:02:25 +0200201 ret = regulator_enable(ab->v_musb);
202 if (ret)
203 dev_err(ab->dev, "Failed to enable musb_1v8\n");
Fabio Baltieri54dfbb02013-04-03 10:45:08 +0200204}
205
206static void ab8500_usb_regulator_disable(struct ab8500_usb *ab)
207{
208 int ret;
209
210 regulator_disable(ab->v_musb);
211
212 regulator_disable(ab->v_ulpi);
213
214 /* USB is not the only consumer of Vintcore, restore old settings */
215 if (!is_ab8500_2p0_or_earlier(ab->ab8500)) {
216 if (ab->saved_v_ulpi > 0) {
217 ret = regulator_set_voltage(ab->v_ulpi,
218 ab->saved_v_ulpi, ab->saved_v_ulpi);
219 if (ret < 0)
220 dev_err(ab->dev, "Failed to set the Vintcore to %duV, ret=%d\n",
221 ab->saved_v_ulpi, ret);
222 }
223
224 ret = regulator_set_optimum_mode(ab->v_ulpi, 0);
225 if (ret < 0)
226 dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n",
227 ret);
228 }
229
230 regulator_disable(ab->v_ape);
231}
232
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800233static void ab8500_usb_wd_linkstatus(struct ab8500_usb *ab, u8 bit)
234{
235 /* Workaround for v2.0 bug # 31952 */
236 if (is_ab8500_2p0(ab->ab8500)) {
237 abx500_mask_and_set_register_interruptible(ab->dev,
238 AB8500_USB, AB8500_USB_PHY_CTRL_REG,
239 bit, bit);
240 udelay(AB8500_V20_31952_DISABLE_DELAY_US);
241 }
242}
243
Fabio Baltieric0ea7062013-04-03 10:45:07 +0200244static void ab8500_usb_phy_enable(struct ab8500_usb *ab, bool sel_host)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100245{
Fabio Baltieric0ea7062013-04-03 10:45:07 +0200246 u8 bit;
247 bit = sel_host ? AB8500_BIT_PHY_CTRL_HOST_EN :
248 AB8500_BIT_PHY_CTRL_DEVICE_EN;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100249
Patrice Chotard899f0f52013-04-03 10:45:11 +0200250 /* mux and configure USB pins to DEFAULT state */
251 ab->pinctrl = pinctrl_get_select(ab->dev, PINCTRL_STATE_DEFAULT);
252 if (IS_ERR(ab->pinctrl))
253 dev_err(ab->dev, "could not get/set default pinstate\n");
254
Fabio Baltieri54dfbb02013-04-03 10:45:08 +0200255 ab8500_usb_regulator_enable(ab);
256
Fabio Baltieric0ea7062013-04-03 10:45:07 +0200257 abx500_mask_and_set_register_interruptible(ab->dev,
258 AB8500_USB, AB8500_USB_PHY_CTRL_REG,
259 bit, bit);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100260}
261
Fabio Baltieric0ea7062013-04-03 10:45:07 +0200262static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host)
263{
264 u8 bit;
265 bit = sel_host ? AB8500_BIT_PHY_CTRL_HOST_EN :
266 AB8500_BIT_PHY_CTRL_DEVICE_EN;
267
268 ab8500_usb_wd_linkstatus(ab, bit);
269
270 abx500_mask_and_set_register_interruptible(ab->dev,
271 AB8500_USB, AB8500_USB_PHY_CTRL_REG,
272 bit, 0);
273
274 /* Needed to disable the phy.*/
275 ab8500_usb_wd_workaround(ab);
Fabio Baltieri54dfbb02013-04-03 10:45:08 +0200276
277 ab8500_usb_regulator_disable(ab);
Patrice Chotard899f0f52013-04-03 10:45:11 +0200278
279 if (!IS_ERR(ab->pinctrl)) {
280 /* configure USB pins to SLEEP state */
281 ab->pins_sleep = pinctrl_lookup_state(ab->pinctrl,
282 PINCTRL_STATE_SLEEP);
283
284 if (IS_ERR(ab->pins_sleep))
285 dev_dbg(ab->dev, "could not get sleep pinstate\n");
286 else if (pinctrl_select_state(ab->pinctrl, ab->pins_sleep))
287 dev_err(ab->dev, "could not set pins to sleep state\n");
288
Fabio Baltieri3147dad2013-05-15 14:03:25 +0200289 /*
290 * as USB pins are shared with iddet, release them to allow
Patrice Chotard899f0f52013-04-03 10:45:11 +0200291 * iddet to request them
292 */
293 pinctrl_put(ab->pinctrl);
294 }
Fabio Baltieric0ea7062013-04-03 10:45:07 +0200295}
296
297#define ab8500_usb_host_phy_en(ab) ab8500_usb_phy_enable(ab, true)
298#define ab8500_usb_host_phy_dis(ab) ab8500_usb_phy_disable(ab, true)
299#define ab8500_usb_peri_phy_en(ab) ab8500_usb_phy_enable(ab, false)
300#define ab8500_usb_peri_phy_dis(ab) ab8500_usb_phy_disable(ab, false)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100301
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800302static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
303 enum ab8505_usb_link_status lsts)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100304{
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800305 enum ux500_musb_vbus_id_status event = 0;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100306
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800307 dev_dbg(ab->dev, "ab8505_usb_link_status_update %d\n", lsts);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100308
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800309 /*
310 * Spurious link_status interrupts are seen at the time of
311 * disconnection of a device in RIDA state
312 */
313 if (ab->previous_link_status_state == USB_LINK_ACA_RID_A_8505 &&
314 (lsts == USB_LINK_STD_HOST_NC_8505))
315 return 0;
316
317 ab->previous_link_status_state = lsts;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100318
319 switch (lsts) {
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800320 case USB_LINK_ACA_RID_B_8505:
321 event = UX500_MUSB_RIDB;
322 case USB_LINK_NOT_CONFIGURED_8505:
323 case USB_LINK_RESERVED0_8505:
324 case USB_LINK_RESERVED1_8505:
325 case USB_LINK_RESERVED2_8505:
326 case USB_LINK_RESERVED3_8505:
327 ab->mode = USB_IDLE;
Heikki Krogerus144713f2012-02-13 13:24:05 +0200328 ab->phy.otg->default_a = false;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100329 ab->vbus_draw = 0;
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800330 if (event != UX500_MUSB_RIDB)
331 event = UX500_MUSB_NONE;
332 /*
333 * Fallback to default B_IDLE as nothing
334 * is connected
335 */
336 ab->phy.state = OTG_STATE_B_IDLE;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100337 break;
338
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800339 case USB_LINK_ACA_RID_C_NM_8505:
340 event = UX500_MUSB_RIDC;
341 case USB_LINK_STD_HOST_NC_8505:
342 case USB_LINK_STD_HOST_C_NS_8505:
343 case USB_LINK_STD_HOST_C_S_8505:
344 case USB_LINK_CDP_8505:
345 if (ab->mode == USB_IDLE) {
346 ab->mode = USB_PERIPHERAL;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100347 ab8500_usb_peri_phy_en(ab);
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800348 atomic_notifier_call_chain(&ab->phy.notifier,
349 UX500_MUSB_PREPARE, &ab->vbus_draw);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100350 }
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800351 if (event != UX500_MUSB_RIDC)
352 event = UX500_MUSB_VBUS;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100353 break;
354
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800355 case USB_LINK_ACA_RID_A_8505:
356 case USB_LINK_ACA_DOCK_CHGR_8505:
357 event = UX500_MUSB_RIDA;
358 case USB_LINK_HM_IDGND_8505:
359 if (ab->mode == USB_IDLE) {
360 ab->mode = USB_HOST;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100361 ab8500_usb_host_phy_en(ab);
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800362 atomic_notifier_call_chain(&ab->phy.notifier,
363 UX500_MUSB_PREPARE, &ab->vbus_draw);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100364 }
Heikki Krogerus144713f2012-02-13 13:24:05 +0200365 ab->phy.otg->default_a = true;
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800366 if (event != UX500_MUSB_RIDA)
367 event = UX500_MUSB_ID;
368 atomic_notifier_call_chain(&ab->phy.notifier,
369 event, &ab->vbus_draw);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100370 break;
371
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800372 case USB_LINK_DEDICATED_CHG_8505:
373 ab->mode = USB_DEDICATED_CHG;
374 event = UX500_MUSB_CHARGER;
375 atomic_notifier_call_chain(&ab->phy.notifier,
376 event, &ab->vbus_draw);
377 break;
378
379 default:
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100380 break;
381 }
382
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800383 return 0;
384}
385
386static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
387 enum ab8500_usb_link_status lsts)
388{
389 enum ux500_musb_vbus_id_status event = 0;
390
391 dev_dbg(ab->dev, "ab8500_usb_link_status_update %d\n", lsts);
392
393 /*
394 * Spurious link_status interrupts are seen in case of a
395 * disconnection of a device in IDGND and RIDA stage
396 */
397 if (ab->previous_link_status_state == USB_LINK_HM_IDGND_8500 &&
398 (lsts == USB_LINK_STD_HOST_C_NS_8500 ||
399 lsts == USB_LINK_STD_HOST_NC_8500))
400 return 0;
401
402 if (ab->previous_link_status_state == USB_LINK_ACA_RID_A_8500 &&
403 lsts == USB_LINK_STD_HOST_NC_8500)
404 return 0;
405
406 ab->previous_link_status_state = lsts;
407
408 switch (lsts) {
409 case USB_LINK_ACA_RID_B_8500:
410 event = UX500_MUSB_RIDB;
411 case USB_LINK_NOT_CONFIGURED_8500:
412 case USB_LINK_NOT_VALID_LINK_8500:
413 ab->mode = USB_IDLE;
414 ab->phy.otg->default_a = false;
415 ab->vbus_draw = 0;
416 if (event != UX500_MUSB_RIDB)
417 event = UX500_MUSB_NONE;
418 /* Fallback to default B_IDLE as nothing is connected */
419 ab->phy.state = OTG_STATE_B_IDLE;
420 break;
421
422 case USB_LINK_ACA_RID_C_NM_8500:
423 case USB_LINK_ACA_RID_C_HS_8500:
424 case USB_LINK_ACA_RID_C_HS_CHIRP_8500:
425 event = UX500_MUSB_RIDC;
426 case USB_LINK_STD_HOST_NC_8500:
427 case USB_LINK_STD_HOST_C_NS_8500:
428 case USB_LINK_STD_HOST_C_S_8500:
429 case USB_LINK_HOST_CHG_NM_8500:
430 case USB_LINK_HOST_CHG_HS_8500:
431 case USB_LINK_HOST_CHG_HS_CHIRP_8500:
432 if (ab->mode == USB_IDLE) {
433 ab->mode = USB_PERIPHERAL;
434 ab8500_usb_peri_phy_en(ab);
435 atomic_notifier_call_chain(&ab->phy.notifier,
436 UX500_MUSB_PREPARE, &ab->vbus_draw);
437 }
438 if (event != UX500_MUSB_RIDC)
439 event = UX500_MUSB_VBUS;
440 break;
441
442 case USB_LINK_ACA_RID_A_8500:
443 event = UX500_MUSB_RIDA;
444 case USB_LINK_HM_IDGND_8500:
445 if (ab->mode == USB_IDLE) {
446 ab->mode = USB_HOST;
447 ab8500_usb_host_phy_en(ab);
448 atomic_notifier_call_chain(&ab->phy.notifier,
449 UX500_MUSB_PREPARE, &ab->vbus_draw);
450 }
451 ab->phy.otg->default_a = true;
452 if (event != UX500_MUSB_RIDA)
453 event = UX500_MUSB_ID;
454 atomic_notifier_call_chain(&ab->phy.notifier,
455 event, &ab->vbus_draw);
456 break;
457
458 case USB_LINK_DEDICATED_CHG_8500:
459 ab->mode = USB_DEDICATED_CHG;
460 event = UX500_MUSB_CHARGER;
461 atomic_notifier_call_chain(&ab->phy.notifier,
462 event, &ab->vbus_draw);
463 break;
464
465 case USB_LINK_RESERVED_8500:
466 break;
467 }
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100468
469 return 0;
470}
471
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800472/*
473 * Connection Sequence:
474 * 1. Link Status Interrupt
475 * 2. Enable AB clock
476 * 3. Enable AB regulators
477 * 4. Enable USB phy
478 * 5. Reset the musb controller
479 * 6. Switch the ULPI GPIO pins to fucntion mode
480 * 7. Enable the musb Peripheral5 clock
481 * 8. Restore MUSB context
482 */
483static int abx500_usb_link_status_update(struct ab8500_usb *ab)
484{
485 u8 reg;
486 int ret = 0;
487
488 if (is_ab8500(ab->ab8500)) {
489 enum ab8500_usb_link_status lsts;
490
491 abx500_get_register_interruptible(ab->dev,
492 AB8500_USB, AB8500_USB_LINE_STAT_REG, &reg);
493 lsts = (reg >> 3) & 0x0F;
494 ret = ab8500_usb_link_status_update(ab, lsts);
495 } else if (is_ab8505(ab->ab8500)) {
496 enum ab8505_usb_link_status lsts;
497
498 abx500_get_register_interruptible(ab->dev,
499 AB8500_USB, AB8505_USB_LINE_STAT_REG, &reg);
500 lsts = (reg >> 3) & 0x1F;
501 ret = ab8505_usb_link_status_update(ab, lsts);
502 }
503
504 return ret;
505}
506
507/*
508 * Disconnection Sequence:
509 * 1. Disconect Interrupt
510 * 2. Disable regulators
511 * 3. Disable AB clock
512 * 4. Disable the Phy
513 * 5. Link Status Interrupt
514 * 6. Disable Musb Clock
515 */
516static irqreturn_t ab8500_usb_disconnect_irq(int irq, void *data)
517{
518 struct ab8500_usb *ab = (struct ab8500_usb *) data;
519 enum usb_phy_events event = UX500_MUSB_NONE;
520
521 /* Link status will not be updated till phy is disabled. */
522 if (ab->mode == USB_HOST) {
523 ab->phy.otg->default_a = false;
524 ab->vbus_draw = 0;
525 atomic_notifier_call_chain(&ab->phy.notifier,
526 event, &ab->vbus_draw);
527 ab8500_usb_host_phy_dis(ab);
528 ab->mode = USB_IDLE;
529 }
530
531 if (ab->mode == USB_PERIPHERAL) {
532 atomic_notifier_call_chain(&ab->phy.notifier,
533 event, &ab->vbus_draw);
534 ab8500_usb_peri_phy_dis(ab);
535 atomic_notifier_call_chain(&ab->phy.notifier,
536 UX500_MUSB_CLEAN, &ab->vbus_draw);
537 ab->mode = USB_IDLE;
538 ab->phy.otg->default_a = false;
539 ab->vbus_draw = 0;
540 }
541
542 if (is_ab8500_2p0(ab->ab8500)) {
543 if (ab->mode == USB_DEDICATED_CHG) {
544 ab8500_usb_wd_linkstatus(ab,
545 AB8500_BIT_PHY_CTRL_DEVICE_EN);
546 abx500_mask_and_set_register_interruptible(ab->dev,
547 AB8500_USB, AB8500_USB_PHY_CTRL_REG,
548 AB8500_BIT_PHY_CTRL_DEVICE_EN, 0);
549 }
550 }
551
552 return IRQ_HANDLED;
553}
554
555static irqreturn_t ab8500_usb_link_status_irq(int irq, void *data)
556{
Fabio Baltieri3147dad2013-05-15 14:03:25 +0200557 struct ab8500_usb *ab = (struct ab8500_usb *)data;
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800558
559 abx500_usb_link_status_update(ab);
560
561 return IRQ_HANDLED;
562}
563
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100564static void ab8500_usb_phy_disable_work(struct work_struct *work)
565{
566 struct ab8500_usb *ab = container_of(work, struct ab8500_usb,
567 phy_dis_work);
568
Heikki Krogerus144713f2012-02-13 13:24:05 +0200569 if (!ab->phy.otg->host)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100570 ab8500_usb_host_phy_dis(ab);
571
Heikki Krogerus144713f2012-02-13 13:24:05 +0200572 if (!ab->phy.otg->gadget)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100573 ab8500_usb_peri_phy_dis(ab);
574}
575
Sakethram Bommisettic2a0ab62013-04-03 10:45:05 +0200576static unsigned ab8500_eyediagram_workaroud(struct ab8500_usb *ab, unsigned mA)
577{
578 /*
579 * AB8500 V2 has eye diagram issues when drawing more than 100mA from
580 * VBUS. Set charging current to 100mA in case of standard host
581 */
582 if (is_ab8500_2p0_or_earlier(ab->ab8500))
583 if (mA > 100)
584 mA = 100;
585
586 return mA;
587}
588
Heikki Krogerus144713f2012-02-13 13:24:05 +0200589static int ab8500_usb_set_power(struct usb_phy *phy, unsigned mA)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100590{
591 struct ab8500_usb *ab;
592
Heikki Krogerus144713f2012-02-13 13:24:05 +0200593 if (!phy)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100594 return -ENODEV;
595
Heikki Krogerus144713f2012-02-13 13:24:05 +0200596 ab = phy_to_ab(phy);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100597
Sakethram Bommisettic2a0ab62013-04-03 10:45:05 +0200598 mA = ab8500_eyediagram_workaroud(ab, mA);
599
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100600 ab->vbus_draw = mA;
601
Fabio Baltieri77f43962013-04-03 10:45:10 +0200602 atomic_notifier_call_chain(&ab->phy.notifier,
603 UX500_MUSB_VBUS, &ab->vbus_draw);
604
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100605 return 0;
606}
607
Heikki Krogerus86753812012-02-13 13:24:02 +0200608static int ab8500_usb_set_suspend(struct usb_phy *x, int suspend)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100609{
610 /* TODO */
611 return 0;
612}
613
Heikki Krogerus144713f2012-02-13 13:24:05 +0200614static int ab8500_usb_set_peripheral(struct usb_otg *otg,
615 struct usb_gadget *gadget)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100616{
617 struct ab8500_usb *ab;
618
619 if (!otg)
620 return -ENODEV;
621
Heikki Krogerus144713f2012-02-13 13:24:05 +0200622 ab = phy_to_ab(otg->phy);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100623
Sakethram Bommisetti58823372013-04-03 10:45:13 +0200624 ab->phy.otg->gadget = gadget;
625
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100626 /* Some drivers call this function in atomic context.
627 * Do not update ab8500 registers directly till this
628 * is fixed.
629 */
630
Fabio Baltieri3147dad2013-05-15 14:03:25 +0200631 if ((ab->mode != USB_IDLE) && !gadget) {
Sakethram Bommisetti58823372013-04-03 10:45:13 +0200632 ab->mode = USB_IDLE;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100633 schedule_work(&ab->phy_dis_work);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100634 }
635
636 return 0;
637}
638
Heikki Krogerus144713f2012-02-13 13:24:05 +0200639static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100640{
641 struct ab8500_usb *ab;
642
643 if (!otg)
644 return -ENODEV;
645
Heikki Krogerus144713f2012-02-13 13:24:05 +0200646 ab = phy_to_ab(otg->phy);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100647
Sakethram Bommisetti58823372013-04-03 10:45:13 +0200648 ab->phy.otg->host = host;
649
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100650 /* Some drivers call this function in atomic context.
651 * Do not update ab8500 registers directly till this
652 * is fixed.
653 */
654
Fabio Baltieri3147dad2013-05-15 14:03:25 +0200655 if ((ab->mode != USB_IDLE) && !host) {
Sakethram Bommisetti58823372013-04-03 10:45:13 +0200656 ab->mode = USB_IDLE;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100657 schedule_work(&ab->phy_dis_work);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100658 }
659
660 return 0;
661}
662
Fabio Baltierie65b36c2013-04-03 10:45:06 +0200663static int ab8500_usb_regulator_get(struct ab8500_usb *ab)
664{
665 int err;
666
667 ab->v_ape = devm_regulator_get(ab->dev, "v-ape");
668 if (IS_ERR(ab->v_ape)) {
669 dev_err(ab->dev, "Could not get v-ape supply\n");
670 err = PTR_ERR(ab->v_ape);
671 return err;
672 }
673
674 ab->v_ulpi = devm_regulator_get(ab->dev, "vddulpivio18");
675 if (IS_ERR(ab->v_ulpi)) {
676 dev_err(ab->dev, "Could not get vddulpivio18 supply\n");
677 err = PTR_ERR(ab->v_ulpi);
678 return err;
679 }
680
681 ab->v_musb = devm_regulator_get(ab->dev, "musb_1v8");
682 if (IS_ERR(ab->v_musb)) {
683 dev_err(ab->dev, "Could not get musb_1v8 supply\n");
684 err = PTR_ERR(ab->v_musb);
685 return err;
686 }
687
688 return 0;
689}
690
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800691static int ab8500_usb_irq_setup(struct platform_device *pdev,
692 struct ab8500_usb *ab)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100693{
694 int err;
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800695 int irq;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100696
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800697 irq = platform_get_irq_byname(pdev, "USB_LINK_STATUS");
698 if (irq < 0) {
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100699 dev_err(&pdev->dev, "Link status irq not found\n");
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800700 return irq;
701 }
702 err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
703 ab8500_usb_link_status_irq,
704 IRQF_NO_SUSPEND | IRQF_SHARED, "usb-link-status", ab);
705 if (err < 0) {
706 dev_err(ab->dev, "request_irq failed for link status irq\n");
707 return err;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100708 }
709
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800710 irq = platform_get_irq_byname(pdev, "ID_WAKEUP_F");
711 if (irq < 0) {
712 dev_err(&pdev->dev, "ID fall irq not found\n");
713 return irq;
714 }
715 err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
716 ab8500_usb_disconnect_irq,
717 IRQF_NO_SUSPEND | IRQF_SHARED, "usb-id-fall", ab);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100718 if (err < 0) {
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800719 dev_err(ab->dev, "request_irq failed for ID fall irq\n");
720 return err;
721 }
722
723 irq = platform_get_irq_byname(pdev, "VBUS_DET_F");
724 if (irq < 0) {
725 dev_err(&pdev->dev, "VBUS fall irq not found\n");
726 return irq;
727 }
728 err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
729 ab8500_usb_disconnect_irq,
730 IRQF_NO_SUSPEND | IRQF_SHARED, "usb-vbus-fall", ab);
731 if (err < 0) {
732 dev_err(ab->dev, "request_irq failed for Vbus fall irq\n");
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100733 return err;
734 }
735
736 return 0;
737}
738
Bill Pemberton41ac7b32012-11-19 13:21:48 -0500739static int ab8500_usb_probe(struct platform_device *pdev)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100740{
741 struct ab8500_usb *ab;
Fabio Baltieri73f226c2013-03-08 10:27:08 +0800742 struct ab8500 *ab8500;
Heikki Krogerus144713f2012-02-13 13:24:05 +0200743 struct usb_otg *otg;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100744 int err;
745 int rev;
746
Fabio Baltieri73f226c2013-03-08 10:27:08 +0800747 ab8500 = dev_get_drvdata(pdev->dev.parent);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100748 rev = abx500_get_chip_id(&pdev->dev);
Fabio Baltieri73f226c2013-03-08 10:27:08 +0800749
750 if (is_ab8500_1p1_or_earlier(ab8500)) {
751 dev_err(&pdev->dev, "Unsupported AB8500 chip rev=%d\n", rev);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100752 return -ENODEV;
753 }
754
Fabio Baltieri81ef6722013-04-03 10:45:03 +0200755 ab = devm_kzalloc(&pdev->dev, sizeof(*ab), GFP_KERNEL);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100756 if (!ab)
757 return -ENOMEM;
758
Fabio Baltieri81ef6722013-04-03 10:45:03 +0200759 otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL);
760 if (!otg)
Heikki Krogerus144713f2012-02-13 13:24:05 +0200761 return -ENOMEM;
Heikki Krogerus144713f2012-02-13 13:24:05 +0200762
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100763 ab->dev = &pdev->dev;
Fabio Baltieri73f226c2013-03-08 10:27:08 +0800764 ab->ab8500 = ab8500;
Heikki Krogerus144713f2012-02-13 13:24:05 +0200765 ab->phy.dev = ab->dev;
766 ab->phy.otg = otg;
767 ab->phy.label = "ab8500";
768 ab->phy.set_suspend = ab8500_usb_set_suspend;
769 ab->phy.set_power = ab8500_usb_set_power;
770 ab->phy.state = OTG_STATE_UNDEFINED;
771
772 otg->phy = &ab->phy;
773 otg->set_host = ab8500_usb_set_host;
774 otg->set_peripheral = ab8500_usb_set_peripheral;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100775
776 platform_set_drvdata(pdev, ab);
777
Heikki Krogerus144713f2012-02-13 13:24:05 +0200778 ATOMIC_INIT_NOTIFIER_HEAD(&ab->phy.notifier);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100779
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100780 /* all: Disable phy when called from set_host and set_peripheral */
781 INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work);
782
Fabio Baltierie65b36c2013-04-03 10:45:06 +0200783 err = ab8500_usb_regulator_get(ab);
784 if (err)
785 return err;
786
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800787 err = ab8500_usb_irq_setup(pdev, ab);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100788 if (err < 0)
Fabio Baltieri81ef6722013-04-03 10:45:03 +0200789 return err;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100790
Kishon Vijay Abraham I662dca52012-06-22 17:02:46 +0530791 err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100792 if (err) {
793 dev_err(&pdev->dev, "Can't register transceiver\n");
Fabio Baltieri81ef6722013-04-03 10:45:03 +0200794 return err;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100795 }
796
Sakethram Bommisetti71246312013-04-03 10:45:04 +0200797 /* Phy tuning values for AB8500 */
798 if (!is_ab8500_2p0_or_earlier(ab->ab8500)) {
799 /* Enable the PBT/Bank 0x12 access */
800 err = abx500_set_register_interruptible(ab->dev,
801 AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x01);
802 if (err < 0)
803 dev_err(ab->dev, "Failed to enable bank12 access err=%d\n",
804 err);
805
806 err = abx500_set_register_interruptible(ab->dev,
807 AB8500_DEBUG, AB8500_USB_PHY_TUNE1, 0xC8);
808 if (err < 0)
809 dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n",
810 err);
811
812 err = abx500_set_register_interruptible(ab->dev,
813 AB8500_DEBUG, AB8500_USB_PHY_TUNE2, 0x00);
814 if (err < 0)
815 dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n",
816 err);
817
818 err = abx500_set_register_interruptible(ab->dev,
819 AB8500_DEBUG, AB8500_USB_PHY_TUNE3, 0x78);
820 if (err < 0)
821 dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n",
822 err);
823
824 /* Switch to normal mode/disable Bank 0x12 access */
825 err = abx500_set_register_interruptible(ab->dev,
826 AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x00);
827 if (err < 0)
828 dev_err(ab->dev, "Failed to switch bank12 access err=%d\n",
829 err);
830 }
831
832 /* Phy tuning values for AB8505 */
833 if (is_ab8505(ab->ab8500)) {
834 /* Enable the PBT/Bank 0x12 access */
835 err = abx500_mask_and_set_register_interruptible(ab->dev,
836 AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS,
837 0x01, 0x01);
838 if (err < 0)
839 dev_err(ab->dev, "Failed to enable bank12 access err=%d\n",
840 err);
841
842 err = abx500_mask_and_set_register_interruptible(ab->dev,
843 AB8500_DEBUG, AB8500_USB_PHY_TUNE1,
844 0xC8, 0xC8);
845 if (err < 0)
846 dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n",
847 err);
848
849 err = abx500_mask_and_set_register_interruptible(ab->dev,
850 AB8500_DEBUG, AB8500_USB_PHY_TUNE2,
851 0x60, 0x60);
852 if (err < 0)
853 dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n",
854 err);
855
856 err = abx500_mask_and_set_register_interruptible(ab->dev,
857 AB8500_DEBUG, AB8500_USB_PHY_TUNE3,
858 0xFC, 0x80);
859
860 if (err < 0)
861 dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n",
862 err);
863
864 /* Switch to normal mode/disable Bank 0x12 access */
865 err = abx500_mask_and_set_register_interruptible(ab->dev,
866 AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS,
867 0x00, 0x00);
868 if (err < 0)
869 dev_err(ab->dev, "Failed to switch bank12 access err=%d\n",
870 err);
871 }
872
Fabio Baltieriaf6882b2013-03-08 10:27:09 +0800873 /* Needed to enable ID detection. */
874 ab8500_usb_wd_workaround(ab);
875
Sakethram Bommisetti8db12232013-04-03 10:45:12 +0200876 abx500_usb_link_status_update(ab);
877
Fabio Baltieri73f226c2013-03-08 10:27:08 +0800878 dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100879
880 return 0;
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100881}
882
Bill Pembertonfb4e98a2012-11-19 13:26:20 -0500883static int ab8500_usb_remove(struct platform_device *pdev)
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100884{
885 struct ab8500_usb *ab = platform_get_drvdata(pdev);
886
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100887 cancel_work_sync(&ab->phy_dis_work);
888
Kishon Vijay Abraham I662dca52012-06-22 17:02:46 +0530889 usb_remove_phy(&ab->phy);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100890
Mian Yousaf Kaukabf5ef7b42013-04-03 10:45:09 +0200891 if (ab->mode == USB_HOST)
892 ab8500_usb_host_phy_dis(ab);
893 else if (ab->mode == USB_PERIPHERAL)
894 ab8500_usb_peri_phy_dis(ab);
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100895
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100896 return 0;
897}
898
899static struct platform_driver ab8500_usb_driver = {
900 .probe = ab8500_usb_probe,
Bill Pemberton76904172012-11-19 13:21:08 -0500901 .remove = ab8500_usb_remove,
Mian Yousaf Kaukab96915232010-12-07 15:00:09 +0100902 .driver = {
903 .name = "ab8500-usb",
904 .owner = THIS_MODULE,
905 },
906};
907
908static int __init ab8500_usb_init(void)
909{
910 return platform_driver_register(&ab8500_usb_driver);
911}
912subsys_initcall(ab8500_usb_init);
913
914static void __exit ab8500_usb_exit(void)
915{
916 platform_driver_unregister(&ab8500_usb_driver);
917}
918module_exit(ab8500_usb_exit);
919
920MODULE_ALIAS("platform:ab8500_usb");
921MODULE_AUTHOR("ST-Ericsson AB");
922MODULE_DESCRIPTION("AB8500 usb transceiver driver");
923MODULE_LICENSE("GPL");