MLK-9638-3 usb: chipidea: udc: test: handle otg_hnp_req set feature request
authorLi Jun <B47624@freescale.com>
Sat, 27 Sep 2014 13:03:55 +0000 (21:03 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:12 +0000 (14:47 -0500)
This patch adds otg_hnp_reqd set feature request from A host for chipidea udc
driver.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 450d4a1eb40ec4284661c1130bdcc4f4d2e6c527)
(cherry picked from commit 03f3f886029fa8f25dde34fcfeb28589ead0064f)

drivers/usb/chipidea/udc.c

index 9491dbe..da7f8ba 100644 (file)
@@ -750,8 +750,10 @@ __acquires(ci->lock)
 {
        int retval;
 
-       if (ci_otg_is_fsm_mode(ci))
+       if (ci_otg_is_fsm_mode(ci)) {
                ci->fsm.otg_srp_reqd = 0;
+               ci->fsm.otg_hnp_reqd = 0;
+       }
 
        spin_unlock(&ci->lock);
        if (ci->gadget.speed != USB_SPEED_UNKNOWN)
@@ -1031,6 +1033,18 @@ static int otg_srp_reqd(struct ci_hdrc *ci)
        }
 }
 
+static int otg_hnp_reqd(struct ci_hdrc *ci)
+{
+       if (ci_otg_is_fsm_mode(ci)) {
+               ci->fsm.otg_hnp_reqd = 1;
+               ci->fsm.b_bus_req = 1;
+               ci->gadget.host_request_flag = 1;
+               return isr_setup_status_phase(ci);
+       } else {
+               return -ENOTSUPP;
+       }
+}
+
 /**
  * isr_setup_packet_handler: setup packet handler
  * @ci: UDC descriptor
@@ -1157,6 +1171,9 @@ __acquires(ci->lock)
                                case TEST_OTG_SRP_REQD:
                                        err = otg_srp_reqd(ci);
                                        break;
+                               case TEST_OTG_HNP_REQD:
+                                       err = otg_hnp_reqd(ci);
+                                       break;
                                default:
                                        break;
                                }