Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2403649ybp; Thu, 10 Oct 2019 06:59:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfExWq17X+G1NEGdtZgAwT0JjVGfeOAOx1J8xEcKntlLELKAiTTnpthzP0D4T7PR9mW5bK X-Received: by 2002:a17:906:7202:: with SMTP id m2mr8116831ejk.138.1570715987637; Thu, 10 Oct 2019 06:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570715987; cv=none; d=google.com; s=arc-20160816; b=lsbqrJW9Vw5sk0NLBSH12GFtR6rhOn2iqr6LdUR+yg7/yOp1n73hNlWmePcV9KgKFf DPQd69T+Pk6vf5jZ8hQj+tffLSapQ7FrT2rTvGSc9CgDDbEUcSxB93bUCtNYbjPikMZQ sfgAVOoZwCT3vu5wK3sXsbe6A7SxbfQ8/Q/S5hDixyCSvQqSIVdSFlUwGYUZUdrymdO4 u0NstGhbCgbEB7CKJ0C8ao7RwHe4OzOW/daCeqZnp20iEMkRk+YObWJ3aVIVeGoX4/yI HHvxWtfB6Xg4CoU3eA1/GYrz21r/auBqKx8nICLBM7D5eGtXM74NJWZyo7kI0VUHKklI rq8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=yJGdOYILL8kJ5SPdZdHmvJP7tXBLkUNJvrUzb6ANFWI=; b=MHY5IHKgI20ebHVgWmhsEJrhaCPbxVOpA1kl024CJcK0hQn2RzP8ty1nE2B0XuMWLr XqKz+/0SkN3oAq7H+RQcKGH5O0SixUuCM742YvS/RKWpV44UPSl8EF7m62MfRrC6xc8h 8fT+Soz0M30mjzOL92svujeQeZ5zsDVl5TfSkQ0aqh9gcX8+W8xBPWTE8lr/UtpCo/wc hWG7OZSg9UzqZ6cpcjUacmaW9ONkK+1Pv5fkxlNS6yDAHTaKEDwqIPg/VyDRumWWFjc7 2TglbisBBgPeWm7fVrlkRDYdQv+ZjBQWxUOGnLvIoC75gviKvZgy/oKraYtPgc4gMhJx 8m5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="u8Ng/a9d"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11si3184862ejr.383.2019.10.10.06.59.24; Thu, 10 Oct 2019 06:59:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="u8Ng/a9d"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726205AbfJJN5M (ORCPT + 99 others); Thu, 10 Oct 2019 09:57:12 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:56145 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbfJJN5L (ORCPT ); Thu, 10 Oct 2019 09:57:11 -0400 Received: by mail-wm1-f68.google.com with SMTP id a6so7052543wma.5; Thu, 10 Oct 2019 06:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yJGdOYILL8kJ5SPdZdHmvJP7tXBLkUNJvrUzb6ANFWI=; b=u8Ng/a9dlF4zJDy3XWXa92ikk0qVSsuwM0N7MmOzC2RZes/uwN3t3j+e3pvzC1mdPm u7B31QUxyUx15DTYeTmifwIZGa7I0tVDGnQMOrXyLSFTsPnyPVlhbwwUofUcFrJ+tcuP Ns28G+4nKopaVXFz3SrgXEUMjFW7kqg0h5yrfCKtTNmOLEdTn6GJoO4cyJ+8n7cXZDlh /DKe29n9JbSZNqGH3KdQfZ/2JlEWU1LlcU020avuf1wwZuCl6jChuV54xZU0vrkkCt9f a8VN80sHKOB6UyWkeH0BLaOAIwv6p92f3qJs7Y9mWw8VB6X+pCLdvmVKSEd5aUetXx8f naEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yJGdOYILL8kJ5SPdZdHmvJP7tXBLkUNJvrUzb6ANFWI=; b=FFREntuLHKIcnr6smYaooAaSuErRUrMVaE/cCnmqyS18bXdeJiTsdd4icDRzZ7KKvm p7Y2nzK1oJxboVpLGgUcME970bivM5Vy5g0YSXJ7YkBP7Z+zNpF2pteoDG2ds31dvNaI 3lAK5ZD2i2CEj54e6CcyMBBr4+oPx4IIITsvWkvbJQcuLjwpNhMB2reMRenXL3h2t7pY aSQ9FfyziYMBWUIwmnogsTfb5Nf0ZwETOAItAb/28NqiZdQFuEbWLiA7EEk13sA6mfGg Qs1ILs+6KErhg06p0U83nqDTCizbnDRuP7aeleQrg8Whi6vZRG1ls4kzuJpFhaFLBigB pCPw== X-Gm-Message-State: APjAAAWGcGU+CDZKdwBnW1wzxFJ2e8LwRhObW+XxRDvu7fx+7TMS7UWk 47+IbMniDGQ0szvk8eVb7PNWcnpXZqI= X-Received: by 2002:a1c:1bc5:: with SMTP id b188mr8104321wmb.88.1570715829333; Thu, 10 Oct 2019 06:57:09 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id h125sm9024318wmf.31.2019.10.10.06.57.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Oct 2019 06:57:08 -0700 (PDT) From: Igor Opaniuk To: linux-usb@vger.kernel.org Cc: Marcel Ziswiler , Philippe Schenker , Stefan Agner , Max Krummenacher , Oleksandr Suvorov , Li Jun , Igor Opaniuk , Greg Kroah-Hartman , Peter Chen , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] usb: chipidea: set mode for usb phy driver Date: Thu, 10 Oct 2019 16:56:55 +0300 Message-Id: <20191010135656.3264-2-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191010135656.3264-1-igor.opaniuk@gmail.com> References: <20191010135656.3264-1-igor.opaniuk@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Li Jun After enters one specific role, notify usb phy driver. Signed-off-by: Li Jun Signed-off-by: Igor Opaniuk --- v2: - restored original commit author - fixed build for multi_v7 drivers/usb/chipidea/ci.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 6911aef500e9..cf9cc9402826 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -275,9 +275,21 @@ static inline int ci_role_start(struct ci_hdrc *ci, enum ci_role role) return -ENXIO; ret = ci->roles[role]->start(ci); - if (!ret) - ci->role = role; - return ret; + if (ret) + return ret; + + ci->role = role; + + if (ci->usb_phy) { + if (role == CI_ROLE_HOST) + usb_phy_set_mode(ci->usb_phy, + USB_CURRENT_MODE_HOST); + else + usb_phy_set_mode(ci->usb_phy, + USB_CURRENT_MODE_DEVICE); + } + + return 0; } static inline void ci_role_stop(struct ci_hdrc *ci) @@ -290,6 +302,9 @@ static inline void ci_role_stop(struct ci_hdrc *ci) ci->role = CI_ROLE_END; ci->roles[role]->stop(ci); + + if (ci->usb_phy) + usb_phy_set_mode(ci->usb_phy, USB_CURRENT_MODE_NONE); } static inline enum usb_role ci_role_to_usb_role(struct ci_hdrc *ci) -- 2.17.1