From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 060AFC2B9F4 for ; Thu, 17 Jun 2021 22:16:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E083F61369 for ; Thu, 17 Jun 2021 22:16:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231948AbhFQWS2 (ORCPT ); Thu, 17 Jun 2021 18:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbhFQWS1 (ORCPT ); Thu, 17 Jun 2021 18:18:27 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A61E1C061574 for ; Thu, 17 Jun 2021 15:16:18 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id ho18so12481574ejc.8 for ; Thu, 17 Jun 2021 15:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AwVsJszErVtiyw5bOlSHdlACIUbk2leEVGsI22Nm16c=; b=kJNfxLLxB72H4z5568lAYK6FwqUG64zbFQZGgHu0rNw3JSMmfIYJbli8QZgaHLkqwN dqGNlVi2B663P/UJFyPxXHsOhsML6veC9Sd2PIGMz+hwSi5aFjrSo3GNcjioZsymEJUA Xhw6CnEwgNZYNP8zdNaBu9ylCoLnUsO5jungvWWNorKlZiHs1kgXoMFXvdFI1r7NaBvB RiG6cxxfC+TpLGLP/RjArtcTWQvjExLFct8del+j85LN7oAyvABr2nfvp7j0pfgPYSCq xkmpWB1uJFj/dGkh35bZJSCxegWSck8lfgZIDsnyTimeTZJqygEl2DagMKzgWpmXb54G LfDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AwVsJszErVtiyw5bOlSHdlACIUbk2leEVGsI22Nm16c=; b=U8+6ABi3zTwK6+KV126YqkIkXf+9fPI7XZ0VSh1kHnQjuh36XxZnMSkecJ0Y+bOYgP XUsmL/emF8OeqU1NbHXjLWUiemUUgjZSGEDAyZ4FyVbumDXZ9VVPQqkmdGYmPnM7Glvc P8/+QUBypK//MwGl/VY39Xphf295xpVLh99qUJnYYWkwhABtb81pZwfoaF+muFs2Qlv0 iSnzuW8hSrULmv8fY5IuZQWqBgimhHy9b7zft1HJK8jmHQ7SLlGM9H7BcjHT2epVsjZO b/SsXDYgxcBITcG2M+uCYMv5fgsY+fykJZT3nUCNrwKg5ebxCWUOLfUsXMQ8nGFTgRs4 xbpQ== X-Gm-Message-State: AOAM530WEiWm8PtcDvb4XBGkf1OF0Ff7Ev7/A4/qh9LOpJ9D66dsyIcu Pjq+Rp4mUdGy8y44g0Rv4ZaScT/N65j18EkYzpQ= X-Google-Smtp-Source: ABdhPJwq5lDCttRtdcLtp8xWWsEyuZqDh41mR0y7tmleLZioJ3kdB5nIgDKCGPjdhNhzugBo1SrbqHNC/5oB4qsNROA= X-Received: by 2002:a17:907:9607:: with SMTP id gb7mr7735421ejc.208.1623968177208; Thu, 17 Jun 2021 15:16:17 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-5-linux.amoon@gmail.com> In-Reply-To: <20210617194154.2397-5-linux.amoon@gmail.com> From: Martin Blumenstingl Date: Fri, 18 Jun 2021 00:16:06 +0200 Message-ID: Subject: Re: [RFCv1 4/8] phy: amlogic: meson8b-usb2: Use phy set_mode callback function To: Anand Moon Cc: Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anand, On Thu, Jun 17, 2021 at 9:43 PM Anand Moon wrote: > > Reorder the code for phy set_mode in .set_mode callback function. > For now configure the phy in host mode. as mentioned in the cover-letter: to my knowledge these register bits are "static" The settings for dr_mode == USB_DR_MODE_HOST mainly apply to the second PHY (usb1_phy) [...] > +static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode, > + int submode) > { > struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); > u32 reg; > > + switch (mode) { > + case PHY_MODE_USB_HOST: > + if (priv->match->host_enable_aca) { > + regmap_update_bits(priv->regmap, REG_ADP_BC, > + REG_ADP_BC_ACA_ENABLE, > + REG_ADP_BC_ACA_ENABLE); > + > + udelay(ACA_ENABLE_COMPLETE_TIME); > + > + regmap_read(priv->regmap, REG_ADP_BC, ®); > + if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { > + dev_warn(&phy->dev, "USB ID detect failed!\n"); > + return -EINVAL; > + } > + } > + break; > + default: > + dev_warn(&phy->dev, "USB ID detect failed to setnode! %d\n", mode); > + return -EINVAL; I have tested this driver already with PHY_MODE_USB_DEVICE (on my Odroid-C1) so I don't see why we should drop support for this Also if we want runtime mode switching in this driver then we would need to undo the changes from "case PHY_MODE_USB_HOST" above I suggest dropping this patch until we know for sure if and which registers need to be updated based on the DR mode. Best regards, Martin From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E3E5C49361 for ; Thu, 17 Jun 2021 22:17:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1930361369 for ; Thu, 17 Jun 2021 22:17:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1930361369 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DY79dgJtQi9uso0ztEjCRaNOlKG7pDzO/uy5Yka40ZA=; b=3WkSy59OYBDbra 0Qt+z3vKkdwRPEVG8cVlJvXvIRBf7UPH7T0ji5W3FUGDOL7xUV5+uqp8e7xUbkI+0Tp3BuGT0Fg3M igkQD2/2IE8piVfsadvsuT1tW+XFC/wf8mC4jWYLBe7I85FznW1ND6xdkMao8uDV+Z1K6+9z4hQOi LAHyG2o5JS8EGkulGmiXL9yiFIcRujGT89NnVbhIy6Bn+rUI/nEPefpcvvDrn+hoGX0DejLLza8x5 CnancgYGMRLtWYTJBDUnCPrY4Bzl2/OB1smQdljatqvjrys8P5yPYYBNKxUnSaMOI9mkRdpgWWYbR R/36jbKuXXV4l/yjZdeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lu0JD-00BvdE-7R; Thu, 17 Jun 2021 22:16:23 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lu0J9-00BvcA-2y; Thu, 17 Jun 2021 22:16:20 +0000 Received: by mail-ej1-x634.google.com with SMTP id og14so12504205ejc.5; Thu, 17 Jun 2021 15:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AwVsJszErVtiyw5bOlSHdlACIUbk2leEVGsI22Nm16c=; b=kJNfxLLxB72H4z5568lAYK6FwqUG64zbFQZGgHu0rNw3JSMmfIYJbli8QZgaHLkqwN dqGNlVi2B663P/UJFyPxXHsOhsML6veC9Sd2PIGMz+hwSi5aFjrSo3GNcjioZsymEJUA Xhw6CnEwgNZYNP8zdNaBu9ylCoLnUsO5jungvWWNorKlZiHs1kgXoMFXvdFI1r7NaBvB RiG6cxxfC+TpLGLP/RjArtcTWQvjExLFct8del+j85LN7oAyvABr2nfvp7j0pfgPYSCq xkmpWB1uJFj/dGkh35bZJSCxegWSck8lfgZIDsnyTimeTZJqygEl2DagMKzgWpmXb54G LfDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AwVsJszErVtiyw5bOlSHdlACIUbk2leEVGsI22Nm16c=; b=ZtyFVIjkl4lZrnd+L33kaLU9j80F6bUlCwyqaKYPqLlMxhKeo14nmHL0GR6WnjTFzB 6RZvL6eFAMBayWA4FWKYBr0sWpw117/OpCHNV7BcPJOuKX1L/VoxX/MbgoRARKiLOfCL z/xPPFv7Q/Eo9OnrxsxMCP+HPxTOcVcLd/VGKHUl1Ss2dAEw3+zrG2t9eZMRrfy74DBT RJZwu0ivg6ChMtuDoWPsBnHEKjquYZYrTPlebReM6Uyvmo56FkvCaBFd8MJUiOU4kyr7 vd2m0RY0SiEotitG1frMi4HpyJzaaii9MBQimNnkr23KRv6WRPyVZZWAvtyLeOh4SQaf liaA== X-Gm-Message-State: AOAM5314lZ3MNquNFpgQ7u29EI1OoHs794GQWY2ylOoYObYSeviPPcWY 6fRZvIWbGapb2e42Y20YKj5XhirxCdZVopKqvvk= X-Google-Smtp-Source: ABdhPJwq5lDCttRtdcLtp8xWWsEyuZqDh41mR0y7tmleLZioJ3kdB5nIgDKCGPjdhNhzugBo1SrbqHNC/5oB4qsNROA= X-Received: by 2002:a17:907:9607:: with SMTP id gb7mr7735421ejc.208.1623968177208; Thu, 17 Jun 2021 15:16:17 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-5-linux.amoon@gmail.com> In-Reply-To: <20210617194154.2397-5-linux.amoon@gmail.com> From: Martin Blumenstingl Date: Fri, 18 Jun 2021 00:16:06 +0200 Message-ID: Subject: Re: [RFCv1 4/8] phy: amlogic: meson8b-usb2: Use phy set_mode callback function To: Anand Moon Cc: Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_151619_195863_93AAD17B X-CRM114-Status: GOOD ( 13.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Anand, On Thu, Jun 17, 2021 at 9:43 PM Anand Moon wrote: > > Reorder the code for phy set_mode in .set_mode callback function. > For now configure the phy in host mode. as mentioned in the cover-letter: to my knowledge these register bits are "static" The settings for dr_mode == USB_DR_MODE_HOST mainly apply to the second PHY (usb1_phy) [...] > +static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode, > + int submode) > { > struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); > u32 reg; > > + switch (mode) { > + case PHY_MODE_USB_HOST: > + if (priv->match->host_enable_aca) { > + regmap_update_bits(priv->regmap, REG_ADP_BC, > + REG_ADP_BC_ACA_ENABLE, > + REG_ADP_BC_ACA_ENABLE); > + > + udelay(ACA_ENABLE_COMPLETE_TIME); > + > + regmap_read(priv->regmap, REG_ADP_BC, ®); > + if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { > + dev_warn(&phy->dev, "USB ID detect failed!\n"); > + return -EINVAL; > + } > + } > + break; > + default: > + dev_warn(&phy->dev, "USB ID detect failed to setnode! %d\n", mode); > + return -EINVAL; I have tested this driver already with PHY_MODE_USB_DEVICE (on my Odroid-C1) so I don't see why we should drop support for this Also if we want runtime mode switching in this driver then we would need to undo the changes from "case PHY_MODE_USB_HOST" above I suggest dropping this patch until we know for sure if and which registers need to be updated based on the DR mode. Best regards, Martin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89647C49361 for ; Thu, 17 Jun 2021 22:16:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4573E61369 for ; Thu, 17 Jun 2021 22:16:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4573E61369 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pI9ffMAHe2J20QhDebGijQr+W0GDkuVjIwP7MK6TNTA=; b=podbyJsDBf47pe AS/mlrgBZ6tgqDqichYokNAQlqZhfNPtfpxILLDXcXV8Tw0E4H4Di+Y6AollTopCySMOB6jK/ppN+ 6ObT/2UqZyGPzFL1FBBQAIPSer1D3XM0b5jed3XFSNcBTWDfJ5k8jxPLuRAvu6CDi/5alKKOhFey7 nN86ejENrgmQIF2q297WgOtRO5VNid+3vxhN4agc7iqwVKcU+Y3wzcJVDV/a5CKnIySbQu4NIcXKT QxGHzYN/KdlAdRwFbfPgtTRKE0PMzzLZdaYxdkHymiEu7CcxO/nHyGLJK0gYnu+qkwuJ1pRpLY8k/ eATzHGwskkFFAOX2o+Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lu0JB-00Bvd5-Ok; Thu, 17 Jun 2021 22:16:21 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lu0J9-00BvcA-2y; Thu, 17 Jun 2021 22:16:20 +0000 Received: by mail-ej1-x634.google.com with SMTP id og14so12504205ejc.5; Thu, 17 Jun 2021 15:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AwVsJszErVtiyw5bOlSHdlACIUbk2leEVGsI22Nm16c=; b=kJNfxLLxB72H4z5568lAYK6FwqUG64zbFQZGgHu0rNw3JSMmfIYJbli8QZgaHLkqwN dqGNlVi2B663P/UJFyPxXHsOhsML6veC9Sd2PIGMz+hwSi5aFjrSo3GNcjioZsymEJUA Xhw6CnEwgNZYNP8zdNaBu9ylCoLnUsO5jungvWWNorKlZiHs1kgXoMFXvdFI1r7NaBvB RiG6cxxfC+TpLGLP/RjArtcTWQvjExLFct8del+j85LN7oAyvABr2nfvp7j0pfgPYSCq xkmpWB1uJFj/dGkh35bZJSCxegWSck8lfgZIDsnyTimeTZJqygEl2DagMKzgWpmXb54G LfDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AwVsJszErVtiyw5bOlSHdlACIUbk2leEVGsI22Nm16c=; b=ZtyFVIjkl4lZrnd+L33kaLU9j80F6bUlCwyqaKYPqLlMxhKeo14nmHL0GR6WnjTFzB 6RZvL6eFAMBayWA4FWKYBr0sWpw117/OpCHNV7BcPJOuKX1L/VoxX/MbgoRARKiLOfCL z/xPPFv7Q/Eo9OnrxsxMCP+HPxTOcVcLd/VGKHUl1Ss2dAEw3+zrG2t9eZMRrfy74DBT RJZwu0ivg6ChMtuDoWPsBnHEKjquYZYrTPlebReM6Uyvmo56FkvCaBFd8MJUiOU4kyr7 vd2m0RY0SiEotitG1frMi4HpyJzaaii9MBQimNnkr23KRv6WRPyVZZWAvtyLeOh4SQaf liaA== X-Gm-Message-State: AOAM5314lZ3MNquNFpgQ7u29EI1OoHs794GQWY2ylOoYObYSeviPPcWY 6fRZvIWbGapb2e42Y20YKj5XhirxCdZVopKqvvk= X-Google-Smtp-Source: ABdhPJwq5lDCttRtdcLtp8xWWsEyuZqDh41mR0y7tmleLZioJ3kdB5nIgDKCGPjdhNhzugBo1SrbqHNC/5oB4qsNROA= X-Received: by 2002:a17:907:9607:: with SMTP id gb7mr7735421ejc.208.1623968177208; Thu, 17 Jun 2021 15:16:17 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-5-linux.amoon@gmail.com> In-Reply-To: <20210617194154.2397-5-linux.amoon@gmail.com> From: Martin Blumenstingl Date: Fri, 18 Jun 2021 00:16:06 +0200 Message-ID: Subject: Re: [RFCv1 4/8] phy: amlogic: meson8b-usb2: Use phy set_mode callback function To: Anand Moon Cc: Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_151619_195863_93AAD17B X-CRM114-Status: GOOD ( 13.24 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Hi Anand, On Thu, Jun 17, 2021 at 9:43 PM Anand Moon wrote: > > Reorder the code for phy set_mode in .set_mode callback function. > For now configure the phy in host mode. as mentioned in the cover-letter: to my knowledge these register bits are "static" The settings for dr_mode == USB_DR_MODE_HOST mainly apply to the second PHY (usb1_phy) [...] > +static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode, > + int submode) > { > struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); > u32 reg; > > + switch (mode) { > + case PHY_MODE_USB_HOST: > + if (priv->match->host_enable_aca) { > + regmap_update_bits(priv->regmap, REG_ADP_BC, > + REG_ADP_BC_ACA_ENABLE, > + REG_ADP_BC_ACA_ENABLE); > + > + udelay(ACA_ENABLE_COMPLETE_TIME); > + > + regmap_read(priv->regmap, REG_ADP_BC, ®); > + if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { > + dev_warn(&phy->dev, "USB ID detect failed!\n"); > + return -EINVAL; > + } > + } > + break; > + default: > + dev_warn(&phy->dev, "USB ID detect failed to setnode! %d\n", mode); > + return -EINVAL; I have tested this driver already with PHY_MODE_USB_DEVICE (on my Odroid-C1) so I don't see why we should drop support for this Also if we want runtime mode switching in this driver then we would need to undo the changes from "case PHY_MODE_USB_HOST" above I suggest dropping this patch until we know for sure if and which registers need to be updated based on the DR mode. Best regards, Martin -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 760DEC49361 for ; Thu, 17 Jun 2021 22:16:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 346BE61004 for ; Thu, 17 Jun 2021 22:16:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 346BE61004 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QSQheGKUUbg7AGc+lcGZz/PA8YdWqj8Fnpurz4CzSCI=; b=3OAIKxEIHkjiS8 ETL2oSmUkTIApiSNMOVrWlv8GgIyIXds+FTYcY+GBMp5RZNshHaWPpQjhyZ3IAdcWgYoFcIqzAugK zQwA5riXyhF2026mH4GsBP3rKJ3FCCbVrMsBtjw6XwWrx7lDGcb4Q/sw7rMm/gTSeV83j7uLIrLyH 5p41BokUOS7ch6IW9uLeaqW2BqQfuXRXJNM/yiVbyZyj6Q330dNivBD2f4OHWTVKHcssGQqypDTtD Bz76sGjm49NJ42W5iio3STDac1uKerG1CaY3Eqhguc1uxQ4UOf/z1sgYZyD16Me6t87lS1aRrES5p IW0WXGKjzRmBtzk8uCJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lu0JM-00BvfC-V8; Thu, 17 Jun 2021 22:16:32 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lu0J9-00BvcA-2y; Thu, 17 Jun 2021 22:16:20 +0000 Received: by mail-ej1-x634.google.com with SMTP id og14so12504205ejc.5; Thu, 17 Jun 2021 15:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AwVsJszErVtiyw5bOlSHdlACIUbk2leEVGsI22Nm16c=; b=kJNfxLLxB72H4z5568lAYK6FwqUG64zbFQZGgHu0rNw3JSMmfIYJbli8QZgaHLkqwN dqGNlVi2B663P/UJFyPxXHsOhsML6veC9Sd2PIGMz+hwSi5aFjrSo3GNcjioZsymEJUA Xhw6CnEwgNZYNP8zdNaBu9ylCoLnUsO5jungvWWNorKlZiHs1kgXoMFXvdFI1r7NaBvB RiG6cxxfC+TpLGLP/RjArtcTWQvjExLFct8del+j85LN7oAyvABr2nfvp7j0pfgPYSCq xkmpWB1uJFj/dGkh35bZJSCxegWSck8lfgZIDsnyTimeTZJqygEl2DagMKzgWpmXb54G LfDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AwVsJszErVtiyw5bOlSHdlACIUbk2leEVGsI22Nm16c=; b=ZtyFVIjkl4lZrnd+L33kaLU9j80F6bUlCwyqaKYPqLlMxhKeo14nmHL0GR6WnjTFzB 6RZvL6eFAMBayWA4FWKYBr0sWpw117/OpCHNV7BcPJOuKX1L/VoxX/MbgoRARKiLOfCL z/xPPFv7Q/Eo9OnrxsxMCP+HPxTOcVcLd/VGKHUl1Ss2dAEw3+zrG2t9eZMRrfy74DBT RJZwu0ivg6ChMtuDoWPsBnHEKjquYZYrTPlebReM6Uyvmo56FkvCaBFd8MJUiOU4kyr7 vd2m0RY0SiEotitG1frMi4HpyJzaaii9MBQimNnkr23KRv6WRPyVZZWAvtyLeOh4SQaf liaA== X-Gm-Message-State: AOAM5314lZ3MNquNFpgQ7u29EI1OoHs794GQWY2ylOoYObYSeviPPcWY 6fRZvIWbGapb2e42Y20YKj5XhirxCdZVopKqvvk= X-Google-Smtp-Source: ABdhPJwq5lDCttRtdcLtp8xWWsEyuZqDh41mR0y7tmleLZioJ3kdB5nIgDKCGPjdhNhzugBo1SrbqHNC/5oB4qsNROA= X-Received: by 2002:a17:907:9607:: with SMTP id gb7mr7735421ejc.208.1623968177208; Thu, 17 Jun 2021 15:16:17 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-5-linux.amoon@gmail.com> In-Reply-To: <20210617194154.2397-5-linux.amoon@gmail.com> From: Martin Blumenstingl Date: Fri, 18 Jun 2021 00:16:06 +0200 Message-ID: Subject: Re: [RFCv1 4/8] phy: amlogic: meson8b-usb2: Use phy set_mode callback function To: Anand Moon Cc: Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210617_151619_195863_93AAD17B X-CRM114-Status: GOOD ( 13.24 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Hi Anand, On Thu, Jun 17, 2021 at 9:43 PM Anand Moon wrote: > > Reorder the code for phy set_mode in .set_mode callback function. > For now configure the phy in host mode. as mentioned in the cover-letter: to my knowledge these register bits are "static" The settings for dr_mode == USB_DR_MODE_HOST mainly apply to the second PHY (usb1_phy) [...] > +static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode, > + int submode) > { > struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); > u32 reg; > > + switch (mode) { > + case PHY_MODE_USB_HOST: > + if (priv->match->host_enable_aca) { > + regmap_update_bits(priv->regmap, REG_ADP_BC, > + REG_ADP_BC_ACA_ENABLE, > + REG_ADP_BC_ACA_ENABLE); > + > + udelay(ACA_ENABLE_COMPLETE_TIME); > + > + regmap_read(priv->regmap, REG_ADP_BC, ®); > + if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { > + dev_warn(&phy->dev, "USB ID detect failed!\n"); > + return -EINVAL; > + } > + } > + break; > + default: > + dev_warn(&phy->dev, "USB ID detect failed to setnode! %d\n", mode); > + return -EINVAL; I have tested this driver already with PHY_MODE_USB_DEVICE (on my Odroid-C1) so I don't see why we should drop support for this Also if we want runtime mode switching in this driver then we would need to undo the changes from "case PHY_MODE_USB_HOST" above I suggest dropping this patch until we know for sure if and which registers need to be updated based on the DR mode. Best regards, Martin _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic