@@ -40,13 +40,24 @@ static const char ohci_name[] = SUNXI_OHCI_NAME;
4040#define SUNXI_OHCI0_OF_MATCH "null"
4141#endif
4242
43-
4443#if defined CONFIG_USB_SUNXI_OHCI1 && !defined SUNXI_USB_FPGA
4544#define SUNXI_OHCI1_OF_MATCH "allwinner,sunxi-ohci1"
4645#else
4746#define SUNXI_OHCI1_OF_MATCH "null"
4847#endif
4948
49+ #if defined CONFIG_USB_SUNXI_OHCI2 && !defined SUNXI_USB_FPGA
50+ #define SUNXI_OHCI2_OF_MATCH "allwinner,sunxi-ohci2"
51+ #else
52+ #define SUNXI_OHCI2_OF_MATCH "null"
53+ #endif
54+
55+ #if defined CONFIG_USB_SUNXI_OHCI3 && !defined SUNXI_USB_FPGA
56+ #define SUNXI_OHCI3_OF_MATCH "allwinner,sunxi-ohci3"
57+ #else
58+ #define SUNXI_OHCI3_OF_MATCH "null"
59+ #endif
60+
5061static struct sunxi_hci_hcd * g_sunxi_ohci [4 ];
5162static u32 ohci_first_probe [4 ] = {1 , 1 , 1 , 1 };
5263static u32 ohci_enable [4 ] = {1 , 1 , 1 , 1 };
@@ -359,12 +370,11 @@ static int sunxi_ohci_hcd_probe(struct platform_device *pdev)
359370 ret = init_sunxi_hci (pdev , SUNXI_USB_OHCI );
360371 if (ret != 0 ){
361372 dev_err (& pdev -> dev , "init_sunxi_hci is fail\n" );
362- return 0 ;
373+ return -1 ;
363374 }
364375
365376 sunxi_insmod_ohci (pdev );
366377
367-
368378 sunxi_ohci = pdev -> dev .platform_data ;
369379 if (sunxi_ohci == NULL ){
370380 DMSG_PANIC ("ERR: %s, sunxi_ohci is null\n" , __func__ );
@@ -406,26 +416,32 @@ static void sunxi_ohci_hcd_shutdown(struct platform_device* pdev)
406416
407417 sunxi_ohci = pdev -> dev .platform_data ;
408418 if (sunxi_ohci == NULL ){
409- DMSG_PANIC ("ERR: sunxi_ohci is null\n" );
419+ DMSG_PANIC ("ERR: %s sunxi_ohci is null\n" , __func__ );
410420 return ;
411421 }
412422
413423 if (sunxi_ohci -> probe == 0 ){
414- DMSG_PANIC ( "ERR: %s, %s is disable, need not shutdown\n" , __func__ , sunxi_ohci -> hci_name );
424+ DMSG_INFO ( " %s, %s is disable, need not shutdown\n" , __func__ , sunxi_ohci -> hci_name );
415425 return ;
416426 }
417427
418- DMSG_INFO ("[%s]: ohci shutdown start\n" , sunxi_ohci -> hci_name );
428+ pr_debug ("[%s]: ohci shutdown start\n" , sunxi_ohci -> hci_name );
419429
420430#ifdef CONFIG_PM
421431 if (sunxi_ohci -> wakeup_suspend ){
422432 scene_lock_destroy (& ohci_standby_lock [sunxi_ohci -> usbc_no ]);
423433 }
424434#endif
425435 usb_hcd_platform_shutdown (pdev );
426- sunxi_stop_ohci (sunxi_ohci );
427436
428- DMSG_INFO ("[%s]: ohci shutdown end\n" , sunxi_ohci -> hci_name );
437+ /* disable usb otg INTUSBE, To solve usb0 device mode catch audio udev on reboot system is fail*/
438+ if (sunxi_ohci -> usbc_no == 0 )
439+ if (sunxi_ohci -> otg_vbase ) {
440+ writel (0 , (sunxi_ohci -> otg_vbase
441+ + SUNXI_USBC_REG_INTUSBE ));
442+ }
443+
444+ pr_debug ("[%s]: ohci shutdown end\n" , sunxi_ohci -> hci_name );
429445
430446 return ;
431447}
@@ -457,7 +473,8 @@ static int sunxi_ohci_hcd_suspend(struct device *dev)
457473 }
458474
459475 if (sunxi_ohci -> probe == 0 ){
460- DMSG_PANIC ("[%s]: is disable, can not suspend\n" , sunxi_ohci -> hci_name );
476+ DMSG_INFO ("[%s]: is disable, can not suspend\n" ,
477+ sunxi_ohci -> hci_name );
461478 return 0 ;
462479 }
463480
@@ -480,6 +497,11 @@ static int sunxi_ohci_hcd_suspend(struct device *dev)
480497 val |= OHCI_INTR_RD ;
481498 val |= OHCI_INTR_MIE ;
482499 ohci_writel (ohci , val , & ohci -> regs -> intrenable );
500+
501+ if (sunxi_ohci -> clk_usbohci12m && sunxi_ohci -> clk_losc ){
502+ clk_set_parent (sunxi_ohci -> clk_usbohci12m , sunxi_ohci -> clk_losc );
503+ }
504+
483505 }else {
484506 DMSG_INFO ("[%s]: sunxi_ohci_hcd_suspend\n" , sunxi_ohci -> hci_name );
485507
@@ -522,13 +544,18 @@ static int sunxi_ohci_hcd_resume(struct device *dev)
522544 }
523545
524546 if (sunxi_ohci -> probe == 0 ){
525- DMSG_PANIC ("[%s]: is disable, can not resume\n" , sunxi_ohci -> hci_name );
547+ DMSG_INFO ("[%s]: is disable, can not resume\n" ,
548+ sunxi_ohci -> hci_name );
526549 return 0 ;
527550 }
528551
529552 if (sunxi_ohci -> wakeup_suspend ){
530553 DMSG_INFO ("[%s]: controller not suspend, need not resume\n" , sunxi_ohci -> hci_name );
531554
555+ if (sunxi_ohci -> clk_usbohci12m && sunxi_ohci -> clk_hoscx2 ){
556+ clk_set_parent (sunxi_ohci -> clk_usbohci12m , sunxi_ohci -> clk_hoscx2 );
557+ }
558+
532559 scene_unlock (& ohci_standby_lock [sunxi_ohci -> usbc_no ]);
533560 disable_wakeup_src (CPUS_USBMOUSE_SRC , 0 );
534561
@@ -563,6 +590,8 @@ static const struct dev_pm_ops sunxi_ohci_pmops = {
563590static const struct of_device_id sunxi_ohci_match [] = {
564591 {.compatible = SUNXI_OHCI0_OF_MATCH , },
565592 {.compatible = SUNXI_OHCI1_OF_MATCH , },
593+ {.compatible = SUNXI_OHCI2_OF_MATCH , },
594+ {.compatible = SUNXI_OHCI3_OF_MATCH , },
566595 {},
567596};
568597MODULE_DEVICE_TABLE (of , sunxi_ohci_match );
@@ -629,4 +658,3 @@ int sunxi_usb_enable_ohci(__u32 usbc_no)
629658 return 0 ;
630659}
631660EXPORT_SYMBOL (sunxi_usb_enable_ohci );
632-
0 commit comments