From patchwork Sun Feb 13 13:05:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 542493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90AAEC433EF for ; Sun, 13 Feb 2022 13:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236147AbiBMNFv (ORCPT ); Sun, 13 Feb 2022 08:05:51 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236131AbiBMNFt (ORCPT ); Sun, 13 Feb 2022 08:05:49 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A074F5B88F for ; Sun, 13 Feb 2022 05:05:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644757543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nmLcUjV7eYLFr1F8KP78rlJmhm+grEJSmd+ucmwkdOE=; b=QqncjKM1OvK5IAPYW3UyjjchsgrK6zewVKbRHoeqzs+DGpaOlFAdPeerfFSNDsbpbj96G+ D7e3aAE0l6IwZTZUSFGr0A1bHAhsksMThiih8/fntfMfl9WmZ7WAKGbmbvRmvlnipjiRdl 8UNdAnRQGEYQCvv/zzblhvCYngxBCLc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-322-9VXGfzlmNN-KxSyVcsh1CQ-1; Sun, 13 Feb 2022 08:05:38 -0500 X-MC-Unique: 9VXGfzlmNN-KxSyVcsh1CQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31DDD2F25; Sun, 13 Feb 2022 13:05:37 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BD5E7CAD1; Sun, 13 Feb 2022 13:05:35 +0000 (UTC) From: Hans de Goede To: Felipe Balbi , Greg Kroah-Hartman , Kishon Vijay Abraham I , Vinod Koul Cc: Hans de Goede , Stephan Gerhold , linux-usb@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v2 2/9] usb: dwc3: pci: Fix Bay Trail phy GPIO mappings Date: Sun, 13 Feb 2022 14:05:17 +0100 Message-Id: <20220213130524.18748-3-hdegoede@redhat.com> In-Reply-To: <20220213130524.18748-1-hdegoede@redhat.com> References: <20220213130524.18748-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org When the Bay Trail phy GPIO mappings where added cs and reset were swapped, this did not cause any issues sofar, because sofar they were always driven high/low at the same time. Note the new mapping has been verified both in /sys/kernel/debug/gpio output on Android factory images on multiple devices, as well as in the schematics for some devices. Fixes: 5741022cbdf3 ("usb: dwc3: pci: Add GPIO lookup table on platforms without ACPI GPIO resources") Signed-off-by: Hans de Goede --- drivers/usb/dwc3/dwc3-pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 022341aef400..1ecedbb1684c 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -85,8 +85,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = { static struct gpiod_lookup_table platform_bytcr_gpios = { .dev_id = "0000:00:16.0", .table = { - GPIO_LOOKUP("INT33FC:00", 54, "reset", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("INT33FC:02", 14, "cs", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("INT33FC:00", 54, "cs", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("INT33FC:02", 14, "reset", GPIO_ACTIVE_HIGH), {} }, }; From patchwork Sun Feb 13 13:05:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 542492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9ADEC433EF for ; Sun, 13 Feb 2022 13:05:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236160AbiBMNFx (ORCPT ); Sun, 13 Feb 2022 08:05:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236145AbiBMNFx (ORCPT ); Sun, 13 Feb 2022 08:05:53 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1100D5B88E for ; Sun, 13 Feb 2022 05:05:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644757547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ExCn8bXEYj3Fheat2o3eV3w8opytI1zAavJnEA3goSo=; b=T8eAbNCvCZMo9vEEgC6woNy55GY3V2gJzYWEXbwLjDoPDzXHaiAISTaDdJ4VzxF7LRRFyS UuQ7/gn6SyawuvVjNl9SL6efrRY6THShZDfHOibhsy4v2pLjAJxyojc7UBXqgkNJx3dkCr sa+TnetFfZWCsDk0VmtinpeCY1ecoFU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-492-tyvfqWU1NcitPoG9rrM_9g-1; Sun, 13 Feb 2022 08:05:44 -0500 X-MC-Unique: tyvfqWU1NcitPoG9rrM_9g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF1A7184608A; Sun, 13 Feb 2022 13:05:42 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37E2D7B9DD; Sun, 13 Feb 2022 13:05:41 +0000 (UTC) From: Hans de Goede To: Felipe Balbi , Greg Kroah-Hartman , Kishon Vijay Abraham I , Vinod Koul Cc: Hans de Goede , Stephan Gerhold , linux-usb@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v2 5/9] usb: dwc3: pci: Also apply Bay Trail GPIO mappings to ulpi-device Date: Sun, 13 Feb 2022 14:05:20 +0100 Message-Id: <20220213130524.18748-6-hdegoede@redhat.com> In-Reply-To: <20220213130524.18748-1-hdegoede@redhat.com> References: <20220213130524.18748-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In order for the phy driver to be able to actually get and control the cs and reset GPIOs the dev_id member of the gpiod_lookup table must be set to point to the dev_name() of the ulpi-device instantiated by dwc3_ulpi_init(). Signed-off-by: Hans de Goede --- drivers/usb/dwc3/dwc3-pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 8deccf0aa5e7..fdcf552a6365 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -252,6 +252,14 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc, usleep_range(10000, 11000); } + /* + * Make the pdev name predictable (only 1 DWC3 on BYT) + * and patch the phy dev-name into the lookup table so + * that the phy-driver can get the GPIOs. + */ + dwc->dwc3->id = PLATFORM_DEVID_NONE; + platform_bytcr_gpios.dev_id = "dwc3.ulpi"; + /* * Some Android tablets with a Crystal Cove PMIC * (INT33FD), rely on the TUSB1211 phy for charger From patchwork Sun Feb 13 13:05:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 542491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3834C433F5 for ; Sun, 13 Feb 2022 13:05:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236165AbiBMNF5 (ORCPT ); Sun, 13 Feb 2022 08:05:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236154AbiBMNF5 (ORCPT ); Sun, 13 Feb 2022 08:05:57 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EFD665B88F for ; Sun, 13 Feb 2022 05:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644757551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nyxGUa1m1eMnb06QI5BCHdATsTFJoIUizeBAHNCds5E=; b=EpSFf4TCiEphDM7fYxcBCR8LmIkXsAxvv6n+KvLPRkJLfpYLfs8BTjKi7Va1ZxG58OQkQw HYoqX4U+qVmOZ1gAm70Eke6eoJvxazLh/yEg0lmdmBGBVf3d+WBPnN5t1v9s9oZb016KCX Sb88NgJDDD75sv3pZpYxgJaFaDZLbL8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-548-mXCl9Se7NH--KKeDbFlwxQ-1; Sun, 13 Feb 2022 08:05:48 -0500 X-MC-Unique: mXCl9Se7NH--KKeDbFlwxQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A313F1091DA0; Sun, 13 Feb 2022 13:05:46 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB85A7B9DD; Sun, 13 Feb 2022 13:05:44 +0000 (UTC) From: Hans de Goede To: Felipe Balbi , Greg Kroah-Hartman , Kishon Vijay Abraham I , Vinod Koul Cc: Hans de Goede , Stephan Gerhold , linux-usb@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v2 7/9] phy: ti: tusb1210: Drop tusb->vendor_specific2 != 0 check from tusb1210_power_on() Date: Sun, 13 Feb 2022 14:05:22 +0100 Message-Id: <20220213130524.18748-8-hdegoede@redhat.com> In-Reply-To: <20220213130524.18748-1-hdegoede@redhat.com> References: <20220213130524.18748-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Since commit eb445a15fa69 ("phy: tusb1210: use bitmasks to set VENDOR_SPECIFIC2") tusb->vendor_specific2 always contains a valid value so there no need to check that it is set. Signed-off-by: Hans de Goede --- drivers/phy/ti/phy-tusb1210.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/phy/ti/phy-tusb1210.c b/drivers/phy/ti/phy-tusb1210.c index bf7793afdc84..04baed24469f 100644 --- a/drivers/phy/ti/phy-tusb1210.c +++ b/drivers/phy/ti/phy-tusb1210.c @@ -61,11 +61,8 @@ static int tusb1210_power_on(struct phy *phy) gpiod_set_value_cansleep(tusb->gpio_cs, 1); /* Restore the optional eye diagram optimization value */ - if (tusb->vendor_specific2) - return tusb1210_ulpi_write(tusb, TUSB1210_VENDOR_SPECIFIC2, - tusb->vendor_specific2); - - return 0; + return tusb1210_ulpi_write(tusb, TUSB1210_VENDOR_SPECIFIC2, + tusb->vendor_specific2); } static int tusb1210_power_off(struct phy *phy) From patchwork Sun Feb 13 13:05:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 542490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 334A7C4332F for ; Sun, 13 Feb 2022 13:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236175AbiBMNGA (ORCPT ); Sun, 13 Feb 2022 08:06:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236161AbiBMNF7 (ORCPT ); Sun, 13 Feb 2022 08:05:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72A2E5B890 for ; Sun, 13 Feb 2022 05:05:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644757553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oubBtTGlA5uh6It3RfAlzAI69zaV5D9sEzGpMWX75XU=; b=MkfWq4uL8mDmOJ2JLv5dNO6UDwMsaX9tNbPCJ9skrbIS9+YohxiS5yzhDpYkk/1h8bQcV2 QZPP0PcDQT1VFozxjJok3DTco4rxezwbkinXz+QCghKAKTGEWpGO6w/nMj/61pWAFn2k8h WF3EGW86dKklzMA9uEEvH7vUAYkFeGY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-Q9vnycTZP9WlwCxvU9Bftg-1; Sun, 13 Feb 2022 08:05:49 -0500 X-MC-Unique: Q9vnycTZP9WlwCxvU9Bftg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E4D8814245; Sun, 13 Feb 2022 13:05:48 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBC837B9DD; Sun, 13 Feb 2022 13:05:46 +0000 (UTC) From: Hans de Goede To: Felipe Balbi , Greg Kroah-Hartman , Kishon Vijay Abraham I , Vinod Koul Cc: Hans de Goede , Stephan Gerhold , linux-usb@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v2 8/9] phy: ti: tusb1210: Add a delay between power-on and restoring the phy-parameters Date: Sun, 13 Feb 2022 14:05:23 +0100 Message-Id: <20220213130524.18748-9-hdegoede@redhat.com> In-Reply-To: <20220213130524.18748-1-hdegoede@redhat.com> References: <20220213130524.18748-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Now that we actually log errors on ulpi_write failures it becomes clear that the ulpi_write() restoring the phy-parameters on power-on is failing after a suspend/resume add a short delay after driving the cs line high to fix this. Signed-off-by: Hans de Goede --- drivers/phy/ti/phy-tusb1210.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/phy/ti/phy-tusb1210.c b/drivers/phy/ti/phy-tusb1210.c index 04baed24469f..9ef4c5f79b75 100644 --- a/drivers/phy/ti/phy-tusb1210.c +++ b/drivers/phy/ti/phy-tusb1210.c @@ -8,6 +8,7 @@ */ #include #include +#include #include #include #include @@ -18,6 +19,8 @@ #define TUSB1210_VENDOR_SPECIFIC2_ZHSDRV_MASK GENMASK(5, 4) #define TUSB1210_VENDOR_SPECIFIC2_DP_MASK BIT(6) +#define TUSB1210_RESET_TIME_MS 30 + struct tusb1210 { struct ulpi *ulpi; struct phy *phy; @@ -60,6 +63,8 @@ static int tusb1210_power_on(struct phy *phy) gpiod_set_value_cansleep(tusb->gpio_reset, 1); gpiod_set_value_cansleep(tusb->gpio_cs, 1); + msleep(TUSB1210_RESET_TIME_MS); + /* Restore the optional eye diagram optimization value */ return tusb1210_ulpi_write(tusb, TUSB1210_VENDOR_SPECIFIC2, tusb->vendor_specific2);