aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/s3c-otg/s3c-otg-roothub.c
blob: 7d9d2897fd54e59801483f1ca41df31314e1f143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
/* for* ==========================================================================
 * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
 * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
 * otherwise expressly agreed to in writing between Synopsys and you.
 *
 * The Software IS NOT an item of Licensed Software or Licensed Product under
 * any End User Software License Agreement or Agreement for Licensed Product
 * with Synopsys or any supplement thereto. You are permitted to use and
 * redistribute this Software in source and binary forms, with or without
 * modification, provided that redistributions of source code must retain this
 * notice. You may not view, use, disclose, copy or distribute this file or
 * any information contained herein except pursuant to this license grant from
 * Synopsys. If you do not agree with this notice, including the disclaimer
 * below, then you are not authorized to use the Software.
 *
 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 * ========================================================================== */
/****************************************************************************
 *  (C) Copyright 2008 Samsung Electronics Co., Ltd., All rights reserved
 *
 *  [File Name]   : RootHub.c
 *  [Description] : The file implement the external and internal functions of RootHub
 *  [Author]      : Jang Kyu Hyeok { kyuhyeok.jang@samsung.com }
 *  [Department]  : System LSI Division/Embedded S/W Platform
 *  [Created Date]: 2009/02/10
 *  [Revision History]
 *	  (1) 2008/06/13   by Jang Kyu Hyeok { kyuhyeok.jang@samsung.com }
 *          - Created this file and implements functions of RootHub
 *
 ****************************************************************************/
/****************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ****************************************************************************/

#include "s3c-otg-roothub.h"

static void setPortPower(bool on)
{
#ifdef CONFIG_USB_S3C_OTG_HOST_DTGDRVVBUS
	hprt_t hprt = {.d32 = 0};

	if(on) {
		hprt.d32 = read_reg_32(HPRT);
		if(!hprt.b.prtpwr) {
			/*hprt.d32 = 0;*/
			hprt.b.prtpwr = 1;
			write_reg_32(HPRT, hprt.d32);
		}
	}
	else {
		hprt.b.prtpwr = 1;
		clear_reg_32(HPRT, hprt.d32);
	}
#else
	otg_dbg(true, "turn %s Vbus\n", on ? "on" : "off");
#endif
}

/**
 * int get_otg_port_status(const u8 port, char* status)
 *
 * @brief Get port change bitmap information
 *
 * @param [IN] port : port number
 *	   [OUT] status : buffer to store bitmap information
 *
 * @returnUSB_ERR_SUCCESS : If success \n
 *         USB_ERR_FAIL : If call fail \n
 *
 * @remark
 *
 */
__inline__ int get_otg_port_status(
		struct usb_hcd *hcd, const u8 port, char *status)
{

	struct sec_otghost *otghost = hcd_to_sec_otghost(hcd);
	/* return root_hub_feature(port, GetPortStatus, NULL, status); */
#if 0
 /* for debug */
	hprt_t hprt;

	hprt.d32 = read_reg_32(HPRT);

	otg_dbg(OTG_DBG_ROOTHUB,
		"HPRT:spd=%d,pwr=%d,lnsts=%d,rst=%d,susp=%d,res=%d,ovrcurract=%d,ena=%d,connsts=%d\n",
		    hprt.b.prtspd,
		    hprt.b.prtpwr,
		    hprt.b.prtlnsts,
		    hprt.b.prtrst,
		    hprt.b.prtsusp,
		    hprt.b.prtres,
		    hprt.b.prtovrcurract,
		    hprt.b.prtena,
		    hprt.b.prtconnsts);

#endif
	status[port] = 0;
	status[port] |= (otghost->port_flag.b.port_connect_status_change ||
		    	otghost->port_flag.b.port_reset_change ||
		    	otghost->port_flag.b.port_enable_change ||
		    	otghost->port_flag.b.port_suspend_change ||
		    	otghost->port_flag.b.port_over_current_change) << 1;

#if 0
 //* for debug */
	otg_dbg(OTG_DBG_ROOTHUB,
		"connect:%d,reset:%d,enable:%d,suspend:%d,over_current:%d\n",
		    otghost->port_flag.b.port_connect_status_change,
		    otghost->port_flag.b.port_reset_change,
		    otghost->port_flag.b.port_enable_change,
		    otghost->port_flag.b.port_suspend_change,
		    otghost->port_flag.b.port_over_current_change);
#endif

	if (status[port]) {
		otg_dbg(OTG_DBG_ROOTHUB,
			" Root port status changed\n");
		otg_dbg(OTG_DBG_ROOTHUB,
			"  port_connect_status_change: %d\n",
			    otghost->port_flag.b.port_connect_status_change);
		otg_dbg(OTG_DBG_ROOTHUB,
			"  port_reset_change: %d\n",
			    otghost->port_flag.b.port_reset_change);
		otg_dbg(OTG_DBG_ROOTHUB,
			"  port_enable_change: %d\n",
			    otghost->port_flag.b.port_enable_change);
		otg_dbg(OTG_DBG_ROOTHUB,
			"  port_suspend_change: %d\n",
			    otghost->port_flag.b.port_suspend_change);
		otg_dbg(OTG_DBG_ROOTHUB,
			"  port_over_current_change: %d\n",
			    otghost->port_flag.b.port_over_current_change);
	}

	return (status[port] !=0);
}

/**
 * int reset_and_enable_port(struct usb_hcd *hcd, const u8 port)
 *
 * @brief Reset port and make enable status the specific port
 *
 * @param [IN] port : port number
 *
 * @return USB_ERR_SUCCESS : If success \n
 *         USB_ERR_FAIL : If call fail \n
 *
 * @remark
 *
 */
int reset_and_enable_port(struct usb_hcd *hcd, const u8 port)
{
	hprt_t hprt;
	u32 count = 0;
	u32 max_error_count = 10000;
	struct sec_otghost *otghost = hcd_to_sec_otghost(hcd);

	hprt.d32 = read_reg_32(HPRT);

	otg_dbg(OTG_DBG_ROOTHUB,
		" reset_and_enable_port\n");

	if(hprt.b.prtconnsts==0) {
		otg_dbg(OTG_DBG_ROOTHUB,
		     	"No Attached Device, HPRT = 0x%x\n", hprt.d32);

		otghost->port_flag.b.port_connect_status_change = 1;
		otghost->port_flag.b.port_connect_status = 0;

		return USB_ERR_FAIL;
	}

	if(!hprt.b.prtena) {
		hprt.b.prtrst = 1; /* drive reset */
		write_reg_32(HPRT, hprt.d32);

		mdelay(60);
		hprt.b.prtrst = 0;
		write_reg_32(HPRT, hprt.d32);

		do {
			hprt.d32 = read_reg_32(HPRT);

			if(count > max_error_count) {
				otg_dbg(OTG_DBG_ROOTHUB,
				"Port Reset Fail : HPRT : 0x%x\n", hprt.d32);
				return USB_ERR_FAIL;
			}
			count++;

		} while(!hprt.b.prtena);

	}
	return USB_ERR_SUCCESS;
}

/**
 * int root_hub_feature(
 * 		struct usb_hcd *hcd,
 * 		const u8 port,
 *		const u16 type_req,
 *		const u16 feature,
 *		void* buf)
 *
 * @brief Get port change bitmap information
 *
 * @param [IN] port : port number
 *	   [IN] type_req : request type of hub feature as usb 2.0 spec
 *	   [IN] feature : hub feature as usb 2.0 spec
 *	   [OUT] status : buffer to store results
 *
 * @return USB_ERR_SUCCESS : If success \n
 *         USB_ERR_FAIL : If call fail \n
 *
 * @remark
 *
 */
__inline__ int root_hub_feature( 
		struct usb_hcd *hcd,
		const u8 port,
		const u16 type_req,
		const u16 feature,
		void *buf)
{
	int retval = USB_ERR_SUCCESS;
	usb_hub_descriptor_t *desc = NULL;
	u32 port_status = 0;
	hprt_t hprt = {.d32 = 0};
	struct sec_otghost *otghost = hcd_to_sec_otghost(hcd);

	otg_dbg(OTG_DBG_ROOTHUB, " root_hub_feature\n");

	switch (type_req) {
	case ClearHubFeature:
		otg_dbg(OTG_DBG_ROOTHUB, "case ClearHubFeature\n");
		switch (feature) {
		case C_HUB_LOCAL_POWER:
			otg_dbg(OTG_DBG_ROOTHUB,
				"case ClearHubFeature -C_HUB_LOCAL_POWER\n");
			break;
		case C_HUB_OVER_CURRENT:
			otg_dbg(OTG_DBG_ROOTHUB,
				"case ClearHubFeature -C_HUB_OVER_CURRENT\n");
			/* Nothing required here */
			break;
		default:
			retval = USB_ERR_FAIL;
		}
		break;

	case ClearPortFeature:
		otg_dbg(OTG_DBG_ROOTHUB, "case ClearPortFeature\n");
		switch (feature) {
		case USB_PORT_FEAT_ENABLE:
			otg_dbg(OTG_DBG_ROOTHUB,
			"case ClearPortFeature -USB_PORT_FEAT_ENABLE\n");
			hprt.b.prtena = 1;
			update_reg_32(HPRT, hprt.d32);
			break;

		case USB_PORT_FEAT_SUSPEND:
			otg_dbg(OTG_DBG_ROOTHUB,
			"case ClearPortFeature -USB_PORT_FEAT_SUSPEND\n");
			bus_resume(otghost);
			break;

		case USB_PORT_FEAT_POWER:
			otg_dbg(OTG_DBG_ROOTHUB,
			"case ClearPortFeature -USB_PORT_FEAT_POWER\n");
			setPortPower(false);
			break;

		case USB_PORT_FEAT_INDICATOR:
			otg_dbg(OTG_DBG_ROOTHUB,
			"case ClearPortFeature -USB_PORT_FEAT_INDICATOR\n");
			/* Port inidicator not supported */
			break;

		case USB_PORT_FEAT_C_CONNECTION:
			otg_dbg(OTG_DBG_ROOTHUB,
			"case ClearPortFeature -USB_PORT_FEAT_C_CONNECTION\n");
			/* Clears drivers internal connect status change flag */
			otghost->port_flag.b.port_connect_status_change = 0;
			break;

		case USB_PORT_FEAT_C_RESET:
			otg_dbg(OTG_DBG_ROOTHUB,
			"case ClearPortFeature -USB_PORT_FEAT_C_RESET\n");
			/* Clears the driver's internal Port Reset Change flag*/
			otghost->port_flag.b.port_reset_change = 0;
			break;

		case USB_PORT_FEAT_C_ENABLE:
			otg_dbg(OTG_DBG_ROOTHUB,
			"case ClearPortFeature -USB_PORT_FEAT_C_ENABLE\n");
			/* Clears the driver's internal Port Enable/Disable Change flag */
			otghost->port_flag.b.port_enable_change = 0;
			break;

		case USB_PORT_FEAT_C_SUSPEND:
			otg_dbg(OTG_DBG_ROOTHUB,
			"case ClearPortFeature -USB_PORT_FEAT_C_SUSPEND\n");
			/* Clears the driver's internal Port Suspend
			 * Change flag, which is set when resume signaling on
			 * the host port is complete */
			otghost->port_flag.b.port_suspend_change = 0;
			break;

		case USB_PORT_FEAT_C_OVER_CURRENT:
			otg_dbg(OTG_DBG_ROOTHUB, "case ClearPortFeature - \
					USB_PORT_FEAT_C_OVER_CURRENT\n");
			otghost->port_flag.b.port_over_current_change = 0;
			break;

		default:
			retval = USB_ERR_FAIL;
			otg_dbg(OTG_DBG_ROOTHUB,
				"case ClearPortFeature - FAIL\n");
		}
		break;

	case GetHubDescriptor:
		otg_dbg(OTG_DBG_ROOTHUB, "case GetHubDescriptor\n");
		desc = (usb_hub_descriptor_t *)buf;
		desc->desc_length = 9;
		desc->desc_type = 0x29;
		desc->port_number = 1;
		desc->hub_characteristics = 0x08;
		desc->power_on_to_power_good = 1;
		desc->hub_control_current = 0;
		desc->DeviceRemovable[0] = 0;
		desc->DeviceRemovable[1] = 0xff;
		break;

	case GetHubStatus:
		otg_dbg(OTG_DBG_ROOTHUB, "case GetHubStatus\n");
		otg_mem_set(buf, 0, 4);
		break;

	case GetPortStatus:
		otg_dbg(OTG_DBG_ROOTHUB, "case GetPortStatus\n");

		if (otghost->port_flag.b.port_connect_status_change) {
			port_status |= (1 << USB_PORT_FEAT_C_CONNECTION);
			otg_dbg(OTG_DBG_ROOTHUB,
			"case GetPortStatus - USB_PORT_FEAT_C_CONNECTION\n");
		}

		if (otghost->port_flag.b.port_enable_change) {
			port_status |= (1 << USB_PORT_FEAT_C_ENABLE);
			otg_dbg(OTG_DBG_ROOTHUB,
			"case GetPortStatus - USB_PORT_FEAT_C_ENABLE\n");
		}

		if (otghost->port_flag.b.port_suspend_change) {
			port_status |= (1 << USB_PORT_FEAT_C_SUSPEND);
			otg_dbg(OTG_DBG_ROOTHUB,
			"case GetPortStatus - USB_PORT_FEAT_C_SUSPEND\n");
		}

		if (otghost->port_flag.b.port_reset_change) {
			port_status|= (1 << USB_PORT_FEAT_C_RESET);
			otg_dbg(OTG_DBG_ROOTHUB,
			"case GetPortStatus - USB_PORT_FEAT_C_RESET\n");
		}

		if (otghost->port_flag.b.port_over_current_change) {
			port_status |= (1 << USB_PORT_FEAT_C_OVER_CURRENT);
			otg_dbg(OTG_DBG_ROOTHUB,
			"case GetPortStatus - USB_PORT_FEAT_C_OVER_CURRENT\n");
		}

		if (!otghost->port_flag.b.port_connect_status) {
			/*
			 * The port is disconnected, which means the core is
			 * either in device mode or it soon will be. Just
			 * return 0's for the remainder of the port status
			 * since the port register can't be read if the core
			 * is in device mode.
			 */
			otg_dbg(OTG_DBG_ROOTHUB,
					"case GetPortStatus - disconnected\n");

			*((__le32*)buf) = cpu_to_le32(port_status);
			/*break;*/
		}

		hprt.d32 = read_reg_32(HPRT);

		if (hprt.b.prtconnsts)
			port_status|= (1 << USB_PORT_FEAT_CONNECTION);

		if (hprt.b.prtena)
			port_status |= (1 << USB_PORT_FEAT_ENABLE);

		if (hprt.b.prtsusp)
			port_status |= (1 << USB_PORT_FEAT_SUSPEND);

		if (hprt.b.prtovrcurract)
			port_status |= (1 << USB_PORT_FEAT_OVER_CURRENT);

		if (hprt.b.prtrst)
			port_status |= (1 << USB_PORT_FEAT_RESET);

		if (hprt.b.prtpwr)
			port_status |= (1 << USB_PORT_FEAT_POWER);

		if (hprt.b.prtspd == 0) {
			port_status |=  USB_PORT_STAT_HIGH_SPEED;
		}
		else {
			if (hprt.b.prtspd == 2)
				port_status |= USB_PORT_STAT_LOW_SPEED;
		}

		if (hprt.b.prttstctl)
			port_status |= (1 << USB_PORT_FEAT_TEST);

		*((__le32*)buf) = cpu_to_le32(port_status);

		otg_dbg(OTG_DBG_ROOTHUB, "port_status=0x%x.\n", port_status);
		break;

	case SetHubFeature:
		otg_dbg(OTG_DBG_ROOTHUB, "case SetHubFeature\n");
		/* No HUB features supported */
		break;

	case SetPortFeature:
		otg_dbg(OTG_DBG_ROOTHUB, "case SetPortFeature\n");
		if (!otghost->port_flag.b.port_connect_status) {
			/*
			 * The port is disconnected, which means the core is
			 * either in device mode or it soon will be. Just
			 * return without doing anything since the port
			 * register can't be written if the core is in device
			 * mode.
			 */
			otg_dbg(OTG_DBG_ROOTHUB,
				"case SetPortFeature - disconnected\n");

			/*break;*/
		}

		switch (feature) {
		case USB_PORT_FEAT_SUSPEND:
			otg_dbg(true,
			"case SetPortFeature -USB_PORT_FEAT_SUSPEND\n");
			bus_suspend();
			break;

		case USB_PORT_FEAT_POWER:
			otg_dbg(true,
			"case SetPortFeature -USB_PORT_FEAT_POWER\n");
			setPortPower(true);
			break;

		case USB_PORT_FEAT_RESET:
			otg_dbg(true,
			"case SetPortFeature -USB_PORT_FEAT_RESET\n");
			retval = reset_and_enable_port(hcd, port);
			/*
			if(retval == USB_ERR_SUCCESS)
				wake_lock(&otghost->wake_lock);
			*/
			break;

		case USB_PORT_FEAT_INDICATOR:
			otg_dbg(true,
			"case SetPortFeature -USB_PORT_FEAT_INDICATOR\n");
			break;

		default :
			otg_dbg(true, "case SetPortFeature -USB_ERR_FAIL\n");
			retval = USB_ERR_FAIL;
			break;
		}
		break;

	default:
		retval = USB_ERR_FAIL;
		otg_err(true, "root_hub_feature() Function Error\n");
		break;
	}

	if(retval != USB_ERR_SUCCESS)
		retval = USB_ERR_FAIL;

	return retval;
}

/**
 * void bus_suspend(void)
 *
 * @brief Make suspend status when this platform support PM Mode
 *
 * @param None
 *
 * @return None
 *
 * @remark
 *
 */
void bus_suspend(void)
{
	hprt_t	hprt;
	pcgcctl_t	pcgcctl;

	otg_dbg(OTG_DBG_ROOTHUB, " bus_suspend\n");

	hprt.d32 = 0;
	pcgcctl.d32 = 0;

	hprt.b.prtsusp = 1;
	update_reg_32(HPRT, hprt.d32);

	pcgcctl.b.pwrclmp = 1;
	update_reg_32(PCGCCTL,pcgcctl.d32);
	udelay(1);

	pcgcctl.b.rstpdwnmodule = 1;
	update_reg_32(PCGCCTL,pcgcctl.d32);
	udelay(1);

	pcgcctl.b.stoppclk = 1;
	update_reg_32(PCGCCTL,pcgcctl.d32);
	udelay(1);
}

/**
 * int bus_resume(struct sec_otghost *otghost)
 *
 * @brief Make resume status when this platform support PM Mode
 *
 * @param None
 *
 * @return USB_ERR_SUCCESS : If success \n
 *         USB_ERR_FAIL : If call fail \n
 *
 * @remark
 *
 */
int bus_resume(struct sec_otghost *otghost)
{
	/*
	hprt_t	hprt;
	pcgcctl_t	pcgcctl;
	hprt.d32 = 0;
	pcgcctl.d32 = 0;

	pcgcctl.b.stoppclk = 1;
	clear_reg_32(PCGCCTL,pcgcctl.d32);
	udelay(1);

	pcgcctl.b.pwrclmp = 1;
	clear_reg_32(PCGCCTL,pcgcctl.d32);
	udelay(1);

	pcgcctl.b.rstpdwnmodule = 1;
	clear_reg_32(PCGCCTL,pcgcctl.d32);
	udelay(1);

	hprt.b.prtres = 1;
	update_reg_32(HPRT, hprt.d32);
	mdelay(20);

	clear_reg_32(HPRT, hprt.d32);
	*/
	otg_dbg(OTG_DBG_ROOTHUB, "bus_resume()......\n");

	otg_dbg(OTG_DBG_ROOTHUB, "wait for 50 ms...\n");

	mdelay(50);
	if(oci_init(otghost) == USB_ERR_SUCCESS) {
		if(oci_start(otghost) == USB_ERR_SUCCESS) {
			otg_dbg(OTG_DBG_ROOTHUB, "OTG Init Success\n");
			return USB_ERR_SUCCESS;
		}
	}

	return USB_ERR_FAIL;
}