Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp104120ybl; Wed, 11 Dec 2019 14:48:51 -0800 (PST) X-Google-Smtp-Source: APXvYqyjSTtySAvjfg6t6ycKyxOSUN1vQVPvFLRwekphIqaZCWdxzHtQF4S4lQ1/x6HPR5/NJEyn X-Received: by 2002:a9d:6f82:: with SMTP id h2mr4398078otq.69.1576104531503; Wed, 11 Dec 2019 14:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576104531; cv=none; d=google.com; s=arc-20160816; b=L2GLW2VdM4nAc+vopZX4pzhsrz3zID01ziY277F0b4FRVQqLjKAmTkDHhUKpRvlK3P 9GNWuqL6sI2ASuGj68NIk3iFGSXjnowZjZwo/HuhgrqmY9XvuH232vfM4OMrpehHNdoN KFtRSodMznxoMFJ8n/zdaOae1YEb76zbd6I/jHQs1MC8iibQivrImkcuV1IwZ3hWKihQ /M8EPNLe5wNI072fMbzXW5UQZ9yv6dLYwxEz9n+KY+WmWtYg0/Uofy8+XiS0WYk7toDY GXkU+qUUd0Jwx98+q8QjQS3B750PuHlKsjm3BQEHIcHRj8hffJm8Gk6CnJkauZ+lODwt qp+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1r7bbFb7oJgGBdqZ0SCWluBGjxFxUq9kfW1qtiJYFQE=; b=mFS/CTw4OSvi6jmzpSPEnXhyq8m+CHNTLfFfaL3yBRthm1sjX+2DHqfmgUrAaOjCel e+oWvSUausIRTAFlBGeUmkqtWbE5XljJfvag52i0EXGf+VJhqAL195oV1PCoaqiTrpKm XF7zUy4YqtfcRa5S+sMffOM1ftx/nNniPPHKcF05j7NZe/ZyZ8HODi7tXvxcp/AHL2cY a5b22j/0GMvs1nJukLI3jAh9E+VRjtxRtsV58A5GVdBaNeEMdb+8ZH0/Eo+2/Kq8T2fg qVUc0Qd8YgghNem/guakF83JDe3rY0R487VpemqcedVS4CtGpdFTdn74rx1XkdZrtE+D rV4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nTEeQ13N; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q124si1892579oig.228.2019.12.11.14.48.39; Wed, 11 Dec 2019 14:48:51 -0800 (PST) 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=@chromium.org header.s=google header.b=nTEeQ13N; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726949AbfLKWrv (ORCPT + 99 others); Wed, 11 Dec 2019 17:47:51 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:46938 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbfLKWru (ORCPT ); Wed, 11 Dec 2019 17:47:50 -0500 Received: by mail-io1-f65.google.com with SMTP id t26so541615ioi.13 for ; Wed, 11 Dec 2019 14:47:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1r7bbFb7oJgGBdqZ0SCWluBGjxFxUq9kfW1qtiJYFQE=; b=nTEeQ13NOraW2TRdVVr19eQqaxBh7/d5/OQfm1sl20BBJCpCBBPBGI+X9Stm5w3tD7 avT/gbZ4vjcRBZWZhwLAk9oyI5s4te+KpcyDRfSk2qUcKkaF68irXOUFaxm10Bcr6SnZ AYOlrqPwZk/O4RmIDUXvYirp675oauG3tFEc0= 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=1r7bbFb7oJgGBdqZ0SCWluBGjxFxUq9kfW1qtiJYFQE=; b=FEwr4rU+XIA+zxSUnCGgpQ5H9gmUWvFTPy3s7DtChmMtMVvJvOgn95XixZr5xfLi26 GF7lDaomya4dLLOKNzpQe4SPPHBmuXUndJQb0sVImXBkHTp6sQvyxT/cN26Vru5X0FdT coiDKrFqNyNIr4R/a3hPpJhRTEGlpnj6k981KO+nN28QWQ9GIrHBV1UJCenriBhCqKp9 HU1BQKa3LfK2uj1mDnq6HD62MWIBwbrXgZDY0m/kjoTfIJcO1EGPEuRF1TuSUj2sQ/xj +d3YLFAu3jDLZzJXzXXWrEtwD76yz5/Yy2TZViqq5NcIS/jtDTbP6QX+OmYdd2A4sIPy s+3g== X-Gm-Message-State: APjAAAV8cLDdhMT8ykJtCUBVLNDP9QKFnC3AeGrg5PTE2Nko6JUh1Tes +QAvYODeFTMIfaHCxCIy4xb4tno1CLY= X-Received: by 2002:a02:9988:: with SMTP id a8mr5503222jal.33.1576104469444; Wed, 11 Dec 2019 14:47:49 -0800 (PST) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com. [209.85.166.49]) by smtp.gmail.com with ESMTPSA id z24sm1114817ilf.31.2019.12.11.14.47.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2019 14:47:49 -0800 (PST) Received: by mail-io1-f49.google.com with SMTP id i11so547793ioi.12 for ; Wed, 11 Dec 2019 14:47:48 -0800 (PST) X-Received: by 2002:a6b:be84:: with SMTP id o126mr503493iof.269.1576104467910; Wed, 11 Dec 2019 14:47:47 -0800 (PST) MIME-Version: 1.0 References: <1575520881-31458-1-git-send-email-sanm@codeaurora.org> <1575520881-31458-2-git-send-email-sanm@codeaurora.org> In-Reply-To: <1575520881-31458-2-git-send-email-sanm@codeaurora.org> From: Doug Anderson Date: Wed, 11 Dec 2019 14:47:36 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/3] phy: qcom-qusb2: Add QUSB2 PHY support for SC7180 To: Sandeep Maheswaram Cc: Andy Gross , Bjorn Andersson , Kishon Vijay Abraham I , Rob Herring , Mark Rutland , Stephen Boyd , linux-arm-msm , LKML , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Manu Gautam Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Dec 4, 2019 at 8:43 PM Sandeep Maheswaram wrote: > > Add QUSB2 PHY config data and compatible for SC7180. > > Signed-off-by: Sandeep Maheswaram > --- > drivers/phy/qualcomm/phy-qcom-qusb2.c | 57 ++++++++++++++++++++++++++++++++++- > 1 file changed, 56 insertions(+), 1 deletion(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c > index bf94a52..32a567b 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qusb2.c > +++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c > @@ -1,6 +1,6 @@ > // SPDX-License-Identifier: GPL-2.0 > /* > - * Copyright (c) 2017, The Linux Foundation. All rights reserved. > + * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. > */ > > #include > @@ -177,6 +177,41 @@ static const struct qusb2_phy_init_tbl msm8998_init_tbl[] = { > QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_DIGITAL_TIMERS_TWO, 0x19), > }; > > +static const unsigned int sc7180_regs_layout[] = { > + [QUSB2PHY_PLL_CORE_INPUT_OVERRIDE] = 0xa8, > + [QUSB2PHY_PLL_STATUS] = 0x1a0, > + [QUSB2PHY_PORT_TUNE1] = 0x240, > + [QUSB2PHY_PORT_TUNE2] = 0x244, > + [QUSB2PHY_PORT_TUNE3] = 0x248, > + [QUSB2PHY_PORT_TUNE4] = 0x24c, > + [QUSB2PHY_PORT_TUNE5] = 0x250, > + [QUSB2PHY_PORT_TEST1] = 0x254, > + [QUSB2PHY_PORT_TEST2] = 0x258, > + [QUSB2PHY_PORT_POWERDOWN] = 0x210, > + [QUSB2PHY_INTR_CTRL] = 0x230, > +}; This table is exactly the same as "sdm845_regs_layout". Just refer to the "sdm845_regs_layout" below. This should be OK because in general the Linux convention is to name things (filenames, drivers, etc) based on the first SoC that used it, but if it really bothers you you can add a comment. ;-) > +static const struct qusb2_phy_init_tbl sc7180_init_tbl[] = { > + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_ANALOG_CONTROLS_TWO, 0x03), > + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_CLOCK_INVERTERS, 0x7c), > + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_CMODE, 0x80), > + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_LOCK_DELAY, 0x0a), > + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_DIGITAL_TIMERS_TWO, 0x19), > + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_BIAS_CONTROL_1, 0x40), > + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_BIAS_CONTROL_2, 0x22), Compared to sdm845, I see PLL_BIAS_CONTROL_2, was 0x20 and now it's 0x22. Is this really a SoC-level tuning value (should be 0x22 on 100% of all sc7180 boards and 0x20 on 100% of all sdm845 boards), or is this really a board-specific tuning parameter that we need a device tree property to control? > + QUSB2_PHY_INIT_CFG(QUSB2PHY_PWR_CTRL2, 0x21), > + QUSB2_PHY_INIT_CFG(QUSB2PHY_IMP_CTRL1, 0x08), Compared to sdm845, I see IMP_CTRL1 was 0x0 and now it's 0x8. If I understand correctly, though, this is a board-specific tuning parameter. ...and, in fact, the device tree that's been submitted for sc7180-idp has: qcom,imp-res-offset-value = <8>; ...so I think you should match sdm845 and leave this as 0x0. > + QUSB2_PHY_INIT_CFG(QUSB2PHY_IMP_CTRL2, 0x58), > + > + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0xc5), Compared to sdm845, I see PORT_TUNE1 was 0x30 and now it's 0xc5. If I understand correctly, though, this is a board-specific tuning parameter and should be controlled by: override_hstx_trim override_preemphasis override_preemphasis_width ...so you should make sure those are set right and then leave this as matching sdm845. If we truly think that (for some reason) nearly all sc7180 boards will need a value that's closer to 0xc5 then we could possibly justify this change, but I'd need a lot of convincing. > + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0x29), > + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE3, 0xca), > + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE4, 0x04), > + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE5, 0x03), > + > + QUSB2_PHY_INIT_CFG(QUSB2PHY_CHG_CTRL2, 0x30), Compared to sdm845, I see CHG_CTRL2 was 0x0 and now it's 0x30. Is this really a SoC-level tuning value (should be 0x30 on 100% of all sc7180 boards and 0x0 on 100% of all sdm845 boards), or is this really a board-specific tuning parameter that we need a device tree property to control? Overall summary is that from everything i see I think: 1. Probably the BIAS_CONTROL_2 and CHG_CTRL2 changes are really board specific and need device tree properties. 2. Once we add the device tree properties, I think we can just totally get rid of the sc7180 tables. Then in the sc7180 device tree we could probably do: "qcom,sc7180-qusb2-phy", "qcom,sdm845-qusb2-phy"; ...which says that we have a sc7180 PHY but it's (as far as we know) compatible with the sdm845 PHY driver. Then we don't need any sc7180 changes in this file at all. > +}; > + > static const unsigned int sdm845_regs_layout[] = { > [QUSB2PHY_PLL_CORE_INPUT_OVERRIDE] = 0xa8, > [QUSB2PHY_PLL_STATUS] = 0x1a0, > @@ -212,6 +247,8 @@ static const struct qusb2_phy_init_tbl sdm845_init_tbl[] = { > QUSB2_PHY_INIT_CFG(QUSB2PHY_CHG_CTRL2, 0x0), > }; > > + > + Eliminate arbitrary spacing changes from your patch. > struct qusb2_phy_cfg { > const struct qusb2_phy_init_tbl *tbl; > /* number of entries in the table */ > @@ -258,6 +295,19 @@ static const struct qusb2_phy_cfg msm8998_phy_cfg = { > .update_tune1_with_efuse = true, > }; > > +static const struct qusb2_phy_cfg sc7180_phy_cfg = { > + .tbl = sc7180_init_tbl, > + .tbl_num = ARRAY_SIZE(sc7180_init_tbl), > + .regs = sc7180_regs_layout, > + > + .disable_ctrl = (PWR_CTRL1_VREF_SUPPLY_TRIM | PWR_CTRL1_CLAMP_N_EN | > + POWER_DOWN), > + .mask_core_ready = CORE_READY_STATUS, > + .has_pll_override = true, > + .autoresume_en = BIT(0), > + .update_tune1_with_efuse = true, > +}; > + > static const struct qusb2_phy_cfg sdm845_phy_cfg = { > .tbl = sdm845_init_tbl, > .tbl_num = ARRAY_SIZE(sdm845_init_tbl), > @@ -271,6 +321,8 @@ static const struct qusb2_phy_cfg sdm845_phy_cfg = { > .update_tune1_with_efuse = true, > }; > > + > + Eliminate arbitrary spacing changes from your patch. -Doug