Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4251843ybp; Mon, 7 Oct 2019 05:48:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsujQGCCTfXWIqh7z87Jg8U285MBsIRjYGzCJlDmOw8d35dZ7CqEUHX55kaTO+sSnIcprb X-Received: by 2002:a50:934c:: with SMTP id n12mr29181383eda.12.1570452499060; Mon, 07 Oct 2019 05:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570452499; cv=none; d=google.com; s=arc-20160816; b=fqjTIh3YAoeoX4xeXTSKI+bijm8B9ys5GqSrbkEyKZyEaRGkkxQvjYFvufY19iiJSz /TIuqEMVTmCZ24Q3fDtb9XOevn0X0N1nM4UUWcydbymhSfq0Ez1BfcDarXlEYxy+MX02 40U9NbUWyHxA+TSYAdX5Ctgfssb1GMA4EciTsRf/1zCRqF71+agWvxKAJV2NcNoKm9KK O75kvtZnpdLejHLIZ0BdQhD76/nvxnrqLdwa4oTAed1MzQz20PJl3xShEjf6utwcW/ax CZZN7cFHhp+qaDnDwuh9c/i29GNDKuDAX/0p5vb4xF158/1hJ7PrUZs4gycZCsyYEXU8 F0Zg== 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=3+0xNKANMoqD2LM7Jb0KxrBIYqLeJsaQlJrD1LYqzho=; b=qr48Ui1O81gn0dCWUKRegkZUotWsJxoMkP6VqkY4uFr5S/mxzM4w9Ubf3NAQLA9ZeV NfRduqVfk6sxpaLD488c4kQQ1WOE8EHSQjzAV3UeHoKDwz/HsEZMGVw7/4LoRUDmfwqe hGFAqAKCphBr/CzsyCbPK1Hwe4LBgjPm/JIWDRCVA/nBnvAuzCDlJ9iiLCS7IMdbM7LT Tt8UNzLnhFuROuygFZHX8At7SDYXRe0XW2km5mYYz7o4eIge/DI5MyqY6HQGWU9V3PP8 KnCHtnvUeBamhRQENpjGrGAxWICpgZL7u/jPrsjdmkklSFgwsH6vKoKl6/d4JuvFxvBh mnLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BArA0duk; 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 y26si7541887edu.176.2019.10.07.05.47.55; Mon, 07 Oct 2019 05:48:19 -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=BArA0duk; 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 S1727998AbfJGMrk (ORCPT + 99 others); Mon, 7 Oct 2019 08:47:40 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33688 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727904AbfJGMrj (ORCPT ); Mon, 7 Oct 2019 08:47:39 -0400 Received: by mail-wr1-f66.google.com with SMTP id b9so15174324wrs.0; Mon, 07 Oct 2019 05:47:37 -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=3+0xNKANMoqD2LM7Jb0KxrBIYqLeJsaQlJrD1LYqzho=; b=BArA0dukyOOQG0I91sTg+fEwZnhirpCntvT3S6t7//3e8XVIJPzesiuad/8zoZ9Myb BEvJFtw6zOUSdgz5WMyYito5s9Az/NqjCIRTp+dicUAyEKaJk2uxnD+sAcaN8L65nd0P iF6GD/vKVquAZcBNyStWpWjkhxEWykw0/WJCW2hoO+uUEWVvPbmhHvtby0pA9SJmNtjj 81xsfkn2lnxP73Vjd2ZqVXmuHugrrpnHsEwjmgRdFLDXawGhcin1bN/hpEdfOjCBkJyt DOkuekKS8VGEKl4z/e+V51A/r99OBNtBOJctwPp2lFx4jU31ffrFUc59tD5UCR9MWQbo KZmw== 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=3+0xNKANMoqD2LM7Jb0KxrBIYqLeJsaQlJrD1LYqzho=; b=RfkK66wgNfRgRLtLchOu5i1LVTMvo3DsTGVm/i4E6ZhCLkICgK1Uo4d6JXVDGRQjxl 8nZE0zRcr3w3WPKVKKs4xtYGTElzbeeD8raP7aYTZHRuTbe9sStKRRQ43SPylNwCafvk VuSfRlGdyRoBE1GGTSFtQpLh0uQjn7Ho/sThYQE84O9ftBHUiSG2s5AO6V27kgkWLDF/ czDjHV7iCGs3TRAmZGKt99f+kjYnkiHxESxghMIPo57tKh7y2Xo3VRRVXjhKqLtpAU2a R5LIfp6hyxxWbTZteqJLvWD16VFtJXfBpv1khBiR21tGJDwpwDlHwOyVAH5CRT4mRGwP kFsQ== X-Gm-Message-State: APjAAAWJdAzU1xOXRsy/MbrO5rxX1hzrlasX6IO1j3hyMp7RitWLHuZw SOnGgUDoZXJtiOw4yeTmUtoyH2Zf2Ec= X-Received: by 2002:adf:f7c3:: with SMTP id a3mr9788540wrq.275.1570452456841; Mon, 07 Oct 2019 05:47:36 -0700 (PDT) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id b15sm18454390wmb.28.2019.10.07.05.47.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Oct 2019 05:47:36 -0700 (PDT) From: Igor Opaniuk To: linux-usb@vger.kernel.org Cc: Marcel Ziswiler , Philippe Schenker , Stefan Agner , Max Krummenacher , Oleksandr Suvorov , Igor Opaniuk , Li Jun , Greg Kroah-Hartman , Peter Chen , linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 2/3] usb: chipidea: set mode for usb phy driver Date: Mon, 7 Oct 2019 15:46:06 +0300 Message-Id: <20191007124607.20618-2-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191007124607.20618-1-igor.opaniuk@gmail.com> References: <20191007124607.20618-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: Igor Opaniuk After enters one specific role, notify usb phy driver. Signed-off-by: Li Jun Signed-off-by: Igor Opaniuk --- 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..a11d23910b12 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_MODE_HOST); + else + usb_phy_set_mode(ci->usb_phy, + USB_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_MODE_NONE); } static inline enum usb_role ci_role_to_usb_role(struct ci_hdrc *ci) -- 2.17.1