diff options
Diffstat (limited to 'drivers/usb/phy/phy-ab8500-usb.c')
-rw-r--r-- | drivers/usb/phy/phy-ab8500-usb.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 11ab2c45e462..8cd7d193c2ca 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/usb/otg/ab8500_usb.c | ||
3 | * | ||
4 | * USB transceiver driver for AB8500 family chips | 2 | * USB transceiver driver for AB8500 family chips |
5 | * | 3 | * |
6 | * Copyright (C) 2010-2013 ST-Ericsson AB | 4 | * Copyright (C) 2010-2013 ST-Ericsson AB |
@@ -446,7 +444,8 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, | |||
446 | if (event != UX500_MUSB_RIDB) | 444 | if (event != UX500_MUSB_RIDB) |
447 | event = UX500_MUSB_NONE; | 445 | event = UX500_MUSB_NONE; |
448 | /* Fallback to default B_IDLE as nothing is connected. */ | 446 | /* Fallback to default B_IDLE as nothing is connected. */ |
449 | ab->phy.state = OTG_STATE_B_IDLE; | 447 | ab->phy.otg->state = OTG_STATE_B_IDLE; |
448 | usb_phy_set_event(&ab->phy, USB_EVENT_NONE); | ||
450 | break; | 449 | break; |
451 | 450 | ||
452 | case USB_LINK_ACA_RID_C_NM_9540: | 451 | case USB_LINK_ACA_RID_C_NM_9540: |
@@ -461,12 +460,14 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, | |||
461 | ab8500_usb_peri_phy_en(ab); | 460 | ab8500_usb_peri_phy_en(ab); |
462 | atomic_notifier_call_chain(&ab->phy.notifier, | 461 | atomic_notifier_call_chain(&ab->phy.notifier, |
463 | UX500_MUSB_PREPARE, &ab->vbus_draw); | 462 | UX500_MUSB_PREPARE, &ab->vbus_draw); |
463 | usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED); | ||
464 | } | 464 | } |
465 | if (ab->mode == USB_IDLE) { | 465 | if (ab->mode == USB_IDLE) { |
466 | ab->mode = USB_PERIPHERAL; | 466 | ab->mode = USB_PERIPHERAL; |
467 | ab8500_usb_peri_phy_en(ab); | 467 | ab8500_usb_peri_phy_en(ab); |
468 | atomic_notifier_call_chain(&ab->phy.notifier, | 468 | atomic_notifier_call_chain(&ab->phy.notifier, |
469 | UX500_MUSB_PREPARE, &ab->vbus_draw); | 469 | UX500_MUSB_PREPARE, &ab->vbus_draw); |
470 | usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED); | ||
470 | } | 471 | } |
471 | if (event != UX500_MUSB_RIDC) | 472 | if (event != UX500_MUSB_RIDC) |
472 | event = UX500_MUSB_VBUS; | 473 | event = UX500_MUSB_VBUS; |
@@ -502,6 +503,7 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, | |||
502 | event = UX500_MUSB_CHARGER; | 503 | event = UX500_MUSB_CHARGER; |
503 | atomic_notifier_call_chain(&ab->phy.notifier, | 504 | atomic_notifier_call_chain(&ab->phy.notifier, |
504 | event, &ab->vbus_draw); | 505 | event, &ab->vbus_draw); |
506 | usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER); | ||
505 | break; | 507 | break; |
506 | 508 | ||
507 | case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_9540: | 509 | case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_9540: |
@@ -526,6 +528,7 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, | |||
526 | ab->mode = USB_IDLE; | 528 | ab->mode = USB_IDLE; |
527 | ab->phy.otg->default_a = false; | 529 | ab->phy.otg->default_a = false; |
528 | ab->vbus_draw = 0; | 530 | ab->vbus_draw = 0; |
531 | usb_phy_set_event(&ab->phy, USB_EVENT_NONE); | ||
529 | } | 532 | } |
530 | } | 533 | } |
531 | break; | 534 | break; |
@@ -584,7 +587,8 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, | |||
584 | * Fallback to default B_IDLE as nothing | 587 | * Fallback to default B_IDLE as nothing |
585 | * is connected | 588 | * is connected |
586 | */ | 589 | */ |
587 | ab->phy.state = OTG_STATE_B_IDLE; | 590 | ab->phy.otg->state = OTG_STATE_B_IDLE; |
591 | usb_phy_set_event(&ab->phy, USB_EVENT_NONE); | ||
588 | break; | 592 | break; |
589 | 593 | ||
590 | case USB_LINK_ACA_RID_C_NM_8540: | 594 | case USB_LINK_ACA_RID_C_NM_8540: |
@@ -598,6 +602,7 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, | |||
598 | ab8500_usb_peri_phy_en(ab); | 602 | ab8500_usb_peri_phy_en(ab); |
599 | atomic_notifier_call_chain(&ab->phy.notifier, | 603 | atomic_notifier_call_chain(&ab->phy.notifier, |
600 | UX500_MUSB_PREPARE, &ab->vbus_draw); | 604 | UX500_MUSB_PREPARE, &ab->vbus_draw); |
605 | usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED); | ||
601 | } | 606 | } |
602 | if (event != UX500_MUSB_RIDC) | 607 | if (event != UX500_MUSB_RIDC) |
603 | event = UX500_MUSB_VBUS; | 608 | event = UX500_MUSB_VBUS; |
@@ -626,6 +631,7 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, | |||
626 | event = UX500_MUSB_CHARGER; | 631 | event = UX500_MUSB_CHARGER; |
627 | atomic_notifier_call_chain(&ab->phy.notifier, | 632 | atomic_notifier_call_chain(&ab->phy.notifier, |
628 | event, &ab->vbus_draw); | 633 | event, &ab->vbus_draw); |
634 | usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER); | ||
629 | break; | 635 | break; |
630 | 636 | ||
631 | case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_8540: | 637 | case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_8540: |
@@ -648,6 +654,7 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, | |||
648 | ab->mode = USB_IDLE; | 654 | ab->mode = USB_IDLE; |
649 | ab->phy.otg->default_a = false; | 655 | ab->phy.otg->default_a = false; |
650 | ab->vbus_draw = 0; | 656 | ab->vbus_draw = 0; |
657 | usb_phy_set_event(&ab->phy, USB_EVENT_NONE); | ||
651 | } | 658 | } |
652 | break; | 659 | break; |
653 | 660 | ||
@@ -693,7 +700,8 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, | |||
693 | * Fallback to default B_IDLE as nothing | 700 | * Fallback to default B_IDLE as nothing |
694 | * is connected | 701 | * is connected |
695 | */ | 702 | */ |
696 | ab->phy.state = OTG_STATE_B_IDLE; | 703 | ab->phy.otg->state = OTG_STATE_B_IDLE; |
704 | usb_phy_set_event(&ab->phy, USB_EVENT_NONE); | ||
697 | break; | 705 | break; |
698 | 706 | ||
699 | case USB_LINK_ACA_RID_C_NM_8505: | 707 | case USB_LINK_ACA_RID_C_NM_8505: |
@@ -707,6 +715,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, | |||
707 | ab8500_usb_peri_phy_en(ab); | 715 | ab8500_usb_peri_phy_en(ab); |
708 | atomic_notifier_call_chain(&ab->phy.notifier, | 716 | atomic_notifier_call_chain(&ab->phy.notifier, |
709 | UX500_MUSB_PREPARE, &ab->vbus_draw); | 717 | UX500_MUSB_PREPARE, &ab->vbus_draw); |
718 | usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED); | ||
710 | } | 719 | } |
711 | if (event != UX500_MUSB_RIDC) | 720 | if (event != UX500_MUSB_RIDC) |
712 | event = UX500_MUSB_VBUS; | 721 | event = UX500_MUSB_VBUS; |
@@ -734,6 +743,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, | |||
734 | event = UX500_MUSB_CHARGER; | 743 | event = UX500_MUSB_CHARGER; |
735 | atomic_notifier_call_chain(&ab->phy.notifier, | 744 | atomic_notifier_call_chain(&ab->phy.notifier, |
736 | event, &ab->vbus_draw); | 745 | event, &ab->vbus_draw); |
746 | usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER); | ||
737 | break; | 747 | break; |
738 | 748 | ||
739 | default: | 749 | default: |
@@ -776,7 +786,8 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab, | |||
776 | if (event != UX500_MUSB_RIDB) | 786 | if (event != UX500_MUSB_RIDB) |
777 | event = UX500_MUSB_NONE; | 787 | event = UX500_MUSB_NONE; |
778 | /* Fallback to default B_IDLE as nothing is connected */ | 788 | /* Fallback to default B_IDLE as nothing is connected */ |
779 | ab->phy.state = OTG_STATE_B_IDLE; | 789 | ab->phy.otg->state = OTG_STATE_B_IDLE; |
790 | usb_phy_set_event(&ab->phy, USB_EVENT_NONE); | ||
780 | break; | 791 | break; |
781 | 792 | ||
782 | case USB_LINK_ACA_RID_C_NM_8500: | 793 | case USB_LINK_ACA_RID_C_NM_8500: |
@@ -794,6 +805,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab, | |||
794 | ab8500_usb_peri_phy_en(ab); | 805 | ab8500_usb_peri_phy_en(ab); |
795 | atomic_notifier_call_chain(&ab->phy.notifier, | 806 | atomic_notifier_call_chain(&ab->phy.notifier, |
796 | UX500_MUSB_PREPARE, &ab->vbus_draw); | 807 | UX500_MUSB_PREPARE, &ab->vbus_draw); |
808 | usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED); | ||
797 | } | 809 | } |
798 | if (event != UX500_MUSB_RIDC) | 810 | if (event != UX500_MUSB_RIDC) |
799 | event = UX500_MUSB_VBUS; | 811 | event = UX500_MUSB_VBUS; |
@@ -820,6 +832,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab, | |||
820 | event = UX500_MUSB_CHARGER; | 832 | event = UX500_MUSB_CHARGER; |
821 | atomic_notifier_call_chain(&ab->phy.notifier, | 833 | atomic_notifier_call_chain(&ab->phy.notifier, |
822 | event, &ab->vbus_draw); | 834 | event, &ab->vbus_draw); |
835 | usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER); | ||
823 | break; | 836 | break; |
824 | 837 | ||
825 | case USB_LINK_RESERVED_8500: | 838 | case USB_LINK_RESERVED_8500: |
@@ -1056,7 +1069,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg, | |||
1056 | if (!otg) | 1069 | if (!otg) |
1057 | return -ENODEV; | 1070 | return -ENODEV; |
1058 | 1071 | ||
1059 | ab = phy_to_ab(otg->phy); | 1072 | ab = phy_to_ab(otg->usb_phy); |
1060 | 1073 | ||
1061 | ab->phy.otg->gadget = gadget; | 1074 | ab->phy.otg->gadget = gadget; |
1062 | 1075 | ||
@@ -1080,7 +1093,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
1080 | if (!otg) | 1093 | if (!otg) |
1081 | return -ENODEV; | 1094 | return -ENODEV; |
1082 | 1095 | ||
1083 | ab = phy_to_ab(otg->phy); | 1096 | ab = phy_to_ab(otg->usb_phy); |
1084 | 1097 | ||
1085 | ab->phy.otg->host = host; | 1098 | ab->phy.otg->host = host; |
1086 | 1099 | ||
@@ -1380,9 +1393,9 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
1380 | ab->phy.label = "ab8500"; | 1393 | ab->phy.label = "ab8500"; |
1381 | ab->phy.set_suspend = ab8500_usb_set_suspend; | 1394 | ab->phy.set_suspend = ab8500_usb_set_suspend; |
1382 | ab->phy.set_power = ab8500_usb_set_power; | 1395 | ab->phy.set_power = ab8500_usb_set_power; |
1383 | ab->phy.state = OTG_STATE_UNDEFINED; | 1396 | ab->phy.otg->state = OTG_STATE_UNDEFINED; |
1384 | 1397 | ||
1385 | otg->phy = &ab->phy; | 1398 | otg->usb_phy = &ab->phy; |
1386 | otg->set_host = ab8500_usb_set_host; | 1399 | otg->set_host = ab8500_usb_set_host; |
1387 | otg->set_peripheral = ab8500_usb_set_peripheral; | 1400 | otg->set_peripheral = ab8500_usb_set_peripheral; |
1388 | 1401 | ||