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, URIBL_BLOCKED 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 91585C48BDF for ; Fri, 18 Jun 2021 12:27:10 +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 599A061248 for ; Fri, 18 Jun 2021 12:27:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 599A061248 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=hDsTTikeEUHhUVA0aDzFTUqRCHD4olYL/S8ER6KJnVE=; b=vcUfe3JXZ9g1vv 0ztTLVrn64QL2fR6JeSNGOt7F+jj61JL+wbcZ79CAR4qqjaWR7ZBdFGVv2loUpKVM4M3BIC86Ok2b YAeusjv7Av4KxcK59wbZqVU8fQcz6xF2RuPZwy5itKmcAyoOpMKICDlJr8+PFt9rDJxJu3pKk6SGI MTv6N79niO3fjCG/k5nzO2dj0Ao7+rXfyPq5ucjX+5AGVMsWu+l3AwMIpzb8XjRWtn98p8MTqo+Pk uoyQVNDg1QdqM0bEBv4hl7IdVKB+hcVUzWGlQ8/oeiw1zhaIk46lNEtmmGwUe0M3kFvXDoqiBokeR n4kMWH/f+IC0m9J4vyhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luDaS-00DzU0-Bc; Fri, 18 Jun 2021 12:27:04 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luDaF-00DzSd-S8; Fri, 18 Jun 2021 12:26:53 +0000 Received: by mail-ed1-x534.google.com with SMTP id w21so8406970edv.3; Fri, 18 Jun 2021 05:26:51 -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=VWDDLJjgn0EHJdARf/CI0iB9+tS/p4I47DaD75u4ICY=; b=MblTaNSd/oDlHFOoAUkTZGcb9VDT/teyxorP8WFhP6CuEbCDVBoLXbTjmZoIu0PSq2 EePLo/bevCZQ+IFH/Klpgweq1OH3E/+D+MBt5sy1oSUPFoShBbU9oO533vITGgCABFEy WJ5KCY5L0GfM9HMJzAI31p0RyJjDm1dYQ4dxkfkKnllaqoFJZCDQoowCV+7//KYKagfz tCLz6MD6hKdArqNrDH6LL5KaUtgK5c1N1/RsnG6YwGrvNC9ekqhb1JV5CQ1kA0YhJefr nBePSBk+IcukFpboa8RyPzkG69jPW+kUN9ZMLyg6RxzerUe7P9EaD0zCy5gLyb2xZfZX Q2sg== 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=VWDDLJjgn0EHJdARf/CI0iB9+tS/p4I47DaD75u4ICY=; b=IElIF5b8CIyqxIEt3a7x3mvUCKOPu+J2z8zKkSO8XFy3qt+uEQN21+YNUKAe86nOU0 ycrj5eK59ArdSmk4WCmmg6gxkLj7XZwzXn74HE6oMUFRVpB5Q/8RRVc0tdLx/NCckM/J n/tvYlkRzjEhKiRF4fc6OE6OUqPsooZeT9rdnUASfj8hUV1WGpgHTyDBDUkN2wvRmdgG k+FK4ZdNep0jgVNjKLpJ4KJF7/ZtxaWUxdMRdbcT0E9Vqjs8HylH4taBV3Jvfi7yF28L 6H5m17Utl55riKk9APe0VPYM+NntOGWoKABsVdmx2z1yu4AAZKGUaJyWaNKvvsxFWag6 hqjw== X-Gm-Message-State: AOAM531nrZ4ZzWWca5jk6hyzI+6jX8NqZpt/C+743LU6cgwB9h8jUrTc sW42vrmRppQDmAaWQh0CnDBES69bxaLO/7Hmi8k= X-Google-Smtp-Source: ABdhPJySmeaBFcg4YsH567Ixrpa9eygvtgUVwztI2AGOzwm6sokMOIthHKxLtCfCq/TiDMAKVEBi8VhgSQRe02cqQco= X-Received: by 2002:aa7:de1a:: with SMTP id h26mr4576399edv.176.1624019210427; Fri, 18 Jun 2021 05:26:50 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-3-linux.amoon@gmail.com> In-Reply-To: <20210617194154.2397-3-linux.amoon@gmail.com> From: Martin Blumenstingl Date: Fri, 18 Jun 2021 14:26:39 +0200 Message-ID: Subject: Re: [RFCv1 2/8] phy: amlogic: meson8b-usb2: Use phy init 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-20210618_052651_967004_04F4199C X-CRM114-Status: GOOD ( 12.73 ) 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 bulk clk_enable into .init callback function. Depending on whether changes are made to the dwc2 driver this is either fine or might cause some issues. My understanding is that drivers which are using a PHY should use the following code-flow: - phy_init - phy_power_on - phy_power_off - phy_exit dwc2's platform.c [0] however currently uses the following order: - phy_init - phy_power_on - (remaining ones omitted to keep this example short) So with this patch and the way dwc2 is currently implemented the phy_meson8b_usb2_power_on implementation might not work anymore. That is because the clocks are turned off and in this case all registers will read 0. You might be lucky that u-boot left the clocks enabled for your case - but in general I would not rely on this. In case of the phy-meson-gxl-usb2 PHY driver the ordering is different in the "consumer" driver (dwc3-meson-g12a.c). There the order is: - phy_init - phy_power_on - (remaining ones omitted to keep this example short) I don't know if the order in the dwc2 driver can be changed easily (without breaking other platforms). Until that dwc2 driver issue is resolved I suggest not applying this patch (even though in general I like the approach). The same thing also applies for patch #3 from this series (for implementing phy_ops.exit) Best regards, Martin [0] https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc2/platform.c#L157 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic 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.7 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, URIBL_BLOCKED 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 14041C48BDF for ; Fri, 18 Jun 2021 12:26:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED6D66121D for ; Fri, 18 Jun 2021 12:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234300AbhFRM3B (ORCPT ); Fri, 18 Jun 2021 08:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232155AbhFRM3B (ORCPT ); Fri, 18 Jun 2021 08:29:01 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C66E8C061574 for ; Fri, 18 Jun 2021 05:26:51 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id z12so8437512edc.1 for ; Fri, 18 Jun 2021 05:26:51 -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=VWDDLJjgn0EHJdARf/CI0iB9+tS/p4I47DaD75u4ICY=; b=MblTaNSd/oDlHFOoAUkTZGcb9VDT/teyxorP8WFhP6CuEbCDVBoLXbTjmZoIu0PSq2 EePLo/bevCZQ+IFH/Klpgweq1OH3E/+D+MBt5sy1oSUPFoShBbU9oO533vITGgCABFEy WJ5KCY5L0GfM9HMJzAI31p0RyJjDm1dYQ4dxkfkKnllaqoFJZCDQoowCV+7//KYKagfz tCLz6MD6hKdArqNrDH6LL5KaUtgK5c1N1/RsnG6YwGrvNC9ekqhb1JV5CQ1kA0YhJefr nBePSBk+IcukFpboa8RyPzkG69jPW+kUN9ZMLyg6RxzerUe7P9EaD0zCy5gLyb2xZfZX Q2sg== 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=VWDDLJjgn0EHJdARf/CI0iB9+tS/p4I47DaD75u4ICY=; b=F7Ep/fEwlzPxTL8LhZzETS6Om30epXbVnHyDQ4cw3qVS6NqGIHuUb/m6BE6R8QHXAv O8UbA3SRC2PhmwKTDS7rcb1x7jcGs5XORlepPHaQ17rZ0eUKk6WZDZ1FSWxa+ZYXKfOK aAzu2/7weTkgzecZgb4pk7o+4iUOU6rKCMbt91hwjEhHePrYstQK9HhVW3za9EOJtFAv t4zx64UlWoXFCjA3h8mFkzpuNF/eypFyhZbMvlkGHad33jzcg7vP1pQStmdT6bYu3h0u fjuPgGKW0xAKOCdUVmW0fGuPf65QHPjpN9pYXqKzshL4VN44fSo9FPVJI514wMcA1LI1 dlHw== X-Gm-Message-State: AOAM532sYqeNeTLdf02vqVPT9V++DgyhU9DNg8QTnkv6k4+hW+cOibTS hVliibpF6EhoQZ2QOu7sUjhKRz1ShaVd+f5dALCerkE5QQw= X-Google-Smtp-Source: ABdhPJySmeaBFcg4YsH567Ixrpa9eygvtgUVwztI2AGOzwm6sokMOIthHKxLtCfCq/TiDMAKVEBi8VhgSQRe02cqQco= X-Received: by 2002:aa7:de1a:: with SMTP id h26mr4576399edv.176.1624019210427; Fri, 18 Jun 2021 05:26:50 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-3-linux.amoon@gmail.com> In-Reply-To: <20210617194154.2397-3-linux.amoon@gmail.com> From: Martin Blumenstingl Date: Fri, 18 Jun 2021 14:26:39 +0200 Message-ID: Subject: Re: [RFCv1 2/8] phy: amlogic: meson8b-usb2: Use phy init 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 bulk clk_enable into .init callback function. Depending on whether changes are made to the dwc2 driver this is either fine or might cause some issues. My understanding is that drivers which are using a PHY should use the following code-flow: - phy_init - phy_power_on - phy_power_off - phy_exit dwc2's platform.c [0] however currently uses the following order: - phy_init - phy_power_on - (remaining ones omitted to keep this example short) So with this patch and the way dwc2 is currently implemented the phy_meson8b_usb2_power_on implementation might not work anymore. That is because the clocks are turned off and in this case all registers will read 0. You might be lucky that u-boot left the clocks enabled for your case - but in general I would not rely on this. In case of the phy-meson-gxl-usb2 PHY driver the ordering is different in the "consumer" driver (dwc3-meson-g12a.c). There the order is: - phy_init - phy_power_on - (remaining ones omitted to keep this example short) I don't know if the order in the dwc2 driver can be changed easily (without breaking other platforms). Until that dwc2 driver issue is resolved I suggest not applying this patch (even though in general I like the approach). The same thing also applies for patch #3 from this series (for implementing phy_ops.exit) Best regards, Martin [0] https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc2/platform.c#L157 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, URIBL_BLOCKED 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 6C35DC49361 for ; Fri, 18 Jun 2021 12:26:55 +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 258186121D for ; Fri, 18 Jun 2021 12:26:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 258186121D 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=69Pw1Vl3KheixMydTOcSR1sLdkLaX7S6oU7C9tO4sVY=; b=gneFRH5vave60E LD9ha5apTKT5cEWDxa74CJclTuKWGP5U7hwzDnOd8inOd3FPzWsbvGWG4XmBDatgGkKXIQnvQkv/+ A9TzOGR9LE5cSd3EoUD0RWz48kIsDikOvUUmxNXDi8dr26riGn9n+15Wm+Xpoc2Me5Mc22DpJecaM fH3haqoOSjPAThDGldl8bmo4wjDwDk+vNydu5BxcQhMyUOH+7lb7w+VD4QOlW70KTaSfQtXfVI2/5 dSTsNXKcXFfc6AU7EZ5b8hKTwQ8LgBSV34X8Ln5Fs80/ejb4E/A/vnZLMvTMOQ1DSkQAPXJ91Z1v5 aWnbXfIGQGfRfC0ZUnEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luDaI-00DzTN-Kr; Fri, 18 Jun 2021 12:26:54 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luDaF-00DzSd-S8; Fri, 18 Jun 2021 12:26:53 +0000 Received: by mail-ed1-x534.google.com with SMTP id w21so8406970edv.3; Fri, 18 Jun 2021 05:26:51 -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=VWDDLJjgn0EHJdARf/CI0iB9+tS/p4I47DaD75u4ICY=; b=MblTaNSd/oDlHFOoAUkTZGcb9VDT/teyxorP8WFhP6CuEbCDVBoLXbTjmZoIu0PSq2 EePLo/bevCZQ+IFH/Klpgweq1OH3E/+D+MBt5sy1oSUPFoShBbU9oO533vITGgCABFEy WJ5KCY5L0GfM9HMJzAI31p0RyJjDm1dYQ4dxkfkKnllaqoFJZCDQoowCV+7//KYKagfz tCLz6MD6hKdArqNrDH6LL5KaUtgK5c1N1/RsnG6YwGrvNC9ekqhb1JV5CQ1kA0YhJefr nBePSBk+IcukFpboa8RyPzkG69jPW+kUN9ZMLyg6RxzerUe7P9EaD0zCy5gLyb2xZfZX Q2sg== 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=VWDDLJjgn0EHJdARf/CI0iB9+tS/p4I47DaD75u4ICY=; b=IElIF5b8CIyqxIEt3a7x3mvUCKOPu+J2z8zKkSO8XFy3qt+uEQN21+YNUKAe86nOU0 ycrj5eK59ArdSmk4WCmmg6gxkLj7XZwzXn74HE6oMUFRVpB5Q/8RRVc0tdLx/NCckM/J n/tvYlkRzjEhKiRF4fc6OE6OUqPsooZeT9rdnUASfj8hUV1WGpgHTyDBDUkN2wvRmdgG k+FK4ZdNep0jgVNjKLpJ4KJF7/ZtxaWUxdMRdbcT0E9Vqjs8HylH4taBV3Jvfi7yF28L 6H5m17Utl55riKk9APe0VPYM+NntOGWoKABsVdmx2z1yu4AAZKGUaJyWaNKvvsxFWag6 hqjw== X-Gm-Message-State: AOAM531nrZ4ZzWWca5jk6hyzI+6jX8NqZpt/C+743LU6cgwB9h8jUrTc sW42vrmRppQDmAaWQh0CnDBES69bxaLO/7Hmi8k= X-Google-Smtp-Source: ABdhPJySmeaBFcg4YsH567Ixrpa9eygvtgUVwztI2AGOzwm6sokMOIthHKxLtCfCq/TiDMAKVEBi8VhgSQRe02cqQco= X-Received: by 2002:aa7:de1a:: with SMTP id h26mr4576399edv.176.1624019210427; Fri, 18 Jun 2021 05:26:50 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-3-linux.amoon@gmail.com> In-Reply-To: <20210617194154.2397-3-linux.amoon@gmail.com> From: Martin Blumenstingl Date: Fri, 18 Jun 2021 14:26:39 +0200 Message-ID: Subject: Re: [RFCv1 2/8] phy: amlogic: meson8b-usb2: Use phy init 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-20210618_052651_967004_04F4199C X-CRM114-Status: GOOD ( 12.73 ) 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 bulk clk_enable into .init callback function. Depending on whether changes are made to the dwc2 driver this is either fine or might cause some issues. My understanding is that drivers which are using a PHY should use the following code-flow: - phy_init - phy_power_on - phy_power_off - phy_exit dwc2's platform.c [0] however currently uses the following order: - phy_init - phy_power_on - (remaining ones omitted to keep this example short) So with this patch and the way dwc2 is currently implemented the phy_meson8b_usb2_power_on implementation might not work anymore. That is because the clocks are turned off and in this case all registers will read 0. You might be lucky that u-boot left the clocks enabled for your case - but in general I would not rely on this. In case of the phy-meson-gxl-usb2 PHY driver the ordering is different in the "consumer" driver (dwc3-meson-g12a.c). There the order is: - phy_init - phy_power_on - (remaining ones omitted to keep this example short) I don't know if the order in the dwc2 driver can be changed easily (without breaking other platforms). Until that dwc2 driver issue is resolved I suggest not applying this patch (even though in general I like the approach). The same thing also applies for patch #3 from this series (for implementing phy_ops.exit) Best regards, Martin [0] https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc2/platform.c#L157 -- 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,SPF_PASS, URIBL_BLOCKED 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 9E55FC48BE8 for ; Fri, 18 Jun 2021 12:28:40 +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 6B42F61248 for ; Fri, 18 Jun 2021 12:28:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B42F61248 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=CQTwYUwWI2XU8ntKAbcfJya+jOfAmgK9WzKslDk9tHg=; b=wRzmc8MUA8KXvZ jmF5n+gaRUEBJ6CcX3RliYQRJeN2plt5HM5AchsxjQ/sfVx/RvZhpj9rPy2klLNgA2U7of7VR3Bwa a8eoldV+rMA2+9Myb5L8m27O/gij1VIobSIGgmiph0tw8vYWzqqdmGNreGAktwy2S/GdIHulPRD/t K1vtMMEY/IbLjrTAdBvzKovVnY4DFootOF8sK0cSlXhWPNHlGgIl6b/ZRZ906Dma8GUj4IxtDw9Kd 8Akh3O8CI4oXfbZIbYgQjhR2O8u4adxWThhqDG50BxRzUD2ptRZGhYux+34jVircv8Qs7vMSTmHE6 7F/PsK7FPnRHi7NE05QQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luDaJ-00DzTS-Of; Fri, 18 Jun 2021 12:26:55 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luDaF-00DzSd-S8; Fri, 18 Jun 2021 12:26:53 +0000 Received: by mail-ed1-x534.google.com with SMTP id w21so8406970edv.3; Fri, 18 Jun 2021 05:26:51 -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=VWDDLJjgn0EHJdARf/CI0iB9+tS/p4I47DaD75u4ICY=; b=MblTaNSd/oDlHFOoAUkTZGcb9VDT/teyxorP8WFhP6CuEbCDVBoLXbTjmZoIu0PSq2 EePLo/bevCZQ+IFH/Klpgweq1OH3E/+D+MBt5sy1oSUPFoShBbU9oO533vITGgCABFEy WJ5KCY5L0GfM9HMJzAI31p0RyJjDm1dYQ4dxkfkKnllaqoFJZCDQoowCV+7//KYKagfz tCLz6MD6hKdArqNrDH6LL5KaUtgK5c1N1/RsnG6YwGrvNC9ekqhb1JV5CQ1kA0YhJefr nBePSBk+IcukFpboa8RyPzkG69jPW+kUN9ZMLyg6RxzerUe7P9EaD0zCy5gLyb2xZfZX Q2sg== 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=VWDDLJjgn0EHJdARf/CI0iB9+tS/p4I47DaD75u4ICY=; b=IElIF5b8CIyqxIEt3a7x3mvUCKOPu+J2z8zKkSO8XFy3qt+uEQN21+YNUKAe86nOU0 ycrj5eK59ArdSmk4WCmmg6gxkLj7XZwzXn74HE6oMUFRVpB5Q/8RRVc0tdLx/NCckM/J n/tvYlkRzjEhKiRF4fc6OE6OUqPsooZeT9rdnUASfj8hUV1WGpgHTyDBDUkN2wvRmdgG k+FK4ZdNep0jgVNjKLpJ4KJF7/ZtxaWUxdMRdbcT0E9Vqjs8HylH4taBV3Jvfi7yF28L 6H5m17Utl55riKk9APe0VPYM+NntOGWoKABsVdmx2z1yu4AAZKGUaJyWaNKvvsxFWag6 hqjw== X-Gm-Message-State: AOAM531nrZ4ZzWWca5jk6hyzI+6jX8NqZpt/C+743LU6cgwB9h8jUrTc sW42vrmRppQDmAaWQh0CnDBES69bxaLO/7Hmi8k= X-Google-Smtp-Source: ABdhPJySmeaBFcg4YsH567Ixrpa9eygvtgUVwztI2AGOzwm6sokMOIthHKxLtCfCq/TiDMAKVEBi8VhgSQRe02cqQco= X-Received: by 2002:aa7:de1a:: with SMTP id h26mr4576399edv.176.1624019210427; Fri, 18 Jun 2021 05:26:50 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-3-linux.amoon@gmail.com> In-Reply-To: <20210617194154.2397-3-linux.amoon@gmail.com> From: Martin Blumenstingl Date: Fri, 18 Jun 2021 14:26:39 +0200 Message-ID: Subject: Re: [RFCv1 2/8] phy: amlogic: meson8b-usb2: Use phy init 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-20210618_052651_967004_04F4199C X-CRM114-Status: GOOD ( 12.73 ) 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 bulk clk_enable into .init callback function. Depending on whether changes are made to the dwc2 driver this is either fine or might cause some issues. My understanding is that drivers which are using a PHY should use the following code-flow: - phy_init - phy_power_on - phy_power_off - phy_exit dwc2's platform.c [0] however currently uses the following order: - phy_init - phy_power_on - (remaining ones omitted to keep this example short) So with this patch and the way dwc2 is currently implemented the phy_meson8b_usb2_power_on implementation might not work anymore. That is because the clocks are turned off and in this case all registers will read 0. You might be lucky that u-boot left the clocks enabled for your case - but in general I would not rely on this. In case of the phy-meson-gxl-usb2 PHY driver the ordering is different in the "consumer" driver (dwc3-meson-g12a.c). There the order is: - phy_init - phy_power_on - (remaining ones omitted to keep this example short) I don't know if the order in the dwc2 driver can be changed easily (without breaking other platforms). Until that dwc2 driver issue is resolved I suggest not applying this patch (even though in general I like the approach). The same thing also applies for patch #3 from this series (for implementing phy_ops.exit) Best regards, Martin [0] https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc2/platform.c#L157 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel