Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp913987pxk; Thu, 3 Sep 2020 16:28:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx71V4gaT7vbLNo6q+cwRa+7ed2Q2DF97i1IFNqXFc05ZCWnXXwGIlzHOdB72P6VSqz0hFj X-Received: by 2002:a17:906:1f43:: with SMTP id d3mr4430228ejk.295.1599175698444; Thu, 03 Sep 2020 16:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599175698; cv=none; d=google.com; s=arc-20160816; b=mqHOX7Y9OEUgGuJMjr1GN9L/IbWIoXEY8Fkqq5s/jXiZ7woy6AnfJog8hLgSJq0cEJ 2Jg87NNSuQwibuRDZZ3EV1b7ZEeclGn+GVNvnCBdphOlyuHMJAC2c2H+MOd+XmhF8LDV E+tbZnxrQV5CXw3GvmPBHpNrt/zgyxz6Y5IcecqWRzus7er/VET+qyBW50uInYJG2Xpl f1rwE3cKIei+gWZDezUmc53vVoswnG1agYtTmj8nWr/0qbqYRxC+mjmZU4CL999ghSzP 0d+7vw9HQArk+IKZXz4tNwW7cjIAYexW2x+hwz4DdnlKryevJmkpTEWk5F5mAiX92bPp eOZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=lG+5k/ucCXHZk2lezM5uaUGaROvX5Yi5cBSwHgAwezI=; b=dn0bkMpEoEhiWhRUUK2rk8u7b5vyYGrHcq27eYYKllowi23ph4GXdDFH/excBdcznc G3/cdSupTmvMhYFZk8oLhpzQipk9rYN1g+k9iSQFFWb3D0Edka/8z/1OUWIn1O0Untq2 JMLJ5gHBVZXfh1GIzJoZ45RfZmnbh7lmMtiVaNato0cX4SvEdQIGbvgC5nDu+9xwQo2/ ETRMhj7x0LIGhCmwk8k+kbsJpElt0WxcKnTBpXOjtJaMUzn6Y0vGFBxLlwrDtmiVwRNl ja01y2AQ7s6nEA6ZspOR9Ea5rGLXLTPcookrZ59xwxQBX5ujbvSOh+yJFuSAMRoA5zpp 7+eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marek-ca.20150623.gappssmtp.com header.s=20150623 header.b=PQpRbvDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ov22si2881869ejb.112.2020.09.03.16.27.56; Thu, 03 Sep 2020 16:28:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@marek-ca.20150623.gappssmtp.com header.s=20150623 header.b=PQpRbvDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729306AbgICX10 (ORCPT + 99 others); Thu, 3 Sep 2020 19:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728015AbgICX1Y (ORCPT ); Thu, 3 Sep 2020 19:27:24 -0400 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70699C061244 for ; Thu, 3 Sep 2020 16:27:24 -0700 (PDT) Received: by mail-qv1-xf2b.google.com with SMTP id di5so2169436qvb.13 for ; Thu, 03 Sep 2020 16:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marek-ca.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lG+5k/ucCXHZk2lezM5uaUGaROvX5Yi5cBSwHgAwezI=; b=PQpRbvDvCw6/6duT1k5F2LBbPEblSaAM1LCTUSjl6fYNEkEEfm96DoJjo7MsP7t3wG 3gkBIJ8UJdvVLF6atkgTzMh4D+phD7L/BbuvzEQNL2aWCfziXrIBRZjp9z9zhDkq5mlL T8sIlnaSMEplmvaznRvvdEyey4nAnD5xT7Iqm2Reh6nULNq5KuYrx4wB2or6Q6adk2no EuaAdoYHGulrSYWEnpfo32guu/uURVkJYTM4W9E8X5osHi+w7EWCgGTnZJRoRGhDpPn7 rytYFjUt+dOX8W9qrwGxnnc4i1DOW1FbxQW7sggvBQ0AjCPo0dfAFyqd9B+D9LrFCio0 2X9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lG+5k/ucCXHZk2lezM5uaUGaROvX5Yi5cBSwHgAwezI=; b=Lq8tAdcTVWZiVP6TnS0eIe5klt9FkIj/uMPReXskQ+f2Cr79eSTyvA9YN2Q+UD9cAL 1I+aEonPlkTWz13O0evLoC6JxZQ0m6DHuch/L+U00PSPqsFC9OxUCTlXxPqM14T4NDbg f9GK0acT4wWsjQEcFI2uOg+pCqgLmtFgT7R1iArK7DuG0VmLP1wYav3xiBRD8OIJrELP OjlWFE09lFDTRFdkCbXkDLE19VhhRpYkG6v/GCYM6FfmlKGaO53R+UFYVFmUy4Y11exx g0DCVLl35CvOZl1TYX4Gi08CT6sbg6tmkbi/s9kVD8H9rXv8onCRTs5WF6q2aNRalO++ 3KsQ== X-Gm-Message-State: AOAM533FCzc5P5AeRKPSxgIi2/JhIoGfEDbmC6of9ixclr9458/A81oy F0H+4XW/lBSxXYrrWFe10Fp/tENfspVTQqC2pSLvPA== X-Received: by 2002:a0c:eac5:: with SMTP id y5mr4335692qvp.2.1599175643564; Thu, 03 Sep 2020 16:27:23 -0700 (PDT) Received: from [192.168.0.189] ([147.253.86.153]) by smtp.gmail.com with ESMTPSA id j8sm3253090qth.90.2020.09.03.16.27.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 16:27:23 -0700 (PDT) Subject: Re: [PATCH v2 07/10] phy: qcom-qmp: Add support for DP in USB3+DP combo phy To: Stephen Boyd , Kishon Vijay Abraham I , Vinod Koul Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Jeykumar Sankaran , Chandan Uddaraju , Vara Reddy , Tanmay Shah , Bjorn Andersson , Manu Gautam , Sandeep Maheswaram , Douglas Anderson , Sean Paul , Stephen Boyd , Dmitry Baryshkov , Rob Clark References: <20200902230215.3452712-1-swboyd@chromium.org> <20200902230215.3452712-8-swboyd@chromium.org> From: Jonathan Marek Message-ID: <990b9edf-055d-6ecf-ee39-5a252b4c8859@marek.ca> Date: Thu, 3 Sep 2020 19:26:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200902230215.3452712-8-swboyd@chromium.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/2/20 7:02 PM, Stephen Boyd wrote: ... > +static int qcom_qmp_phy_configure_dp_phy(struct qmp_phy *qphy) > +{ > + const struct qmp_phy_dp_clks *dp_clks = qphy->dp_clks; > + const struct phy_configure_opts_dp *dp_opts = &qphy->dp_opts; > + u32 val, phy_vco_div, status; > + unsigned long pixel_freq; > + > + val = DP_PHY_PD_CTL_PWRDN | DP_PHY_PD_CTL_AUX_PWRDN | > + DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN; > + > + /* > + if (lane_cnt == 4 || orientation == ORIENTATION_CC2) > + val |= DP_PHY_PD_CTL_LANE_0_1_PWRDN; > + if (lane_cnt == 4 || orientation == ORIENTATION_CC1) > + val |= DP_PHY_PD_CTL_LANE_2_3_PWRDN; > + */ > + /* > + * TODO: Assume orientation is CC1 for now and two lanes, need to > + * use type-c connector to understand orientation and lanes > + */ > + val |= DP_PHY_PD_CTL_LANE_2_3_PWRDN; > + > + writel(val, qphy->pcs + QSERDES_V3_DP_PHY_PD_CTL); > + > + /* > + if (orientation == ORIENTATION_CC2) > + writel(0x4c, qphy->pcs + QSERDES_V3_DP_PHY_MODE); > + else > + */ > + /* does this do anything? link_clock_sel_mux isn't set (bit 5) */ > + writel(0x5c, qphy->pcs + QSERDES_V3_DP_PHY_MODE); > + > + writel(0x05, qphy->pcs + QSERDES_V3_DP_PHY_TX0_TX1_LANE_CTL); > + writel(0x05, qphy->pcs + QSERDES_V3_DP_PHY_TX2_TX3_LANE_CTL); > + > + switch (dp_opts->link_rate) { > + case 1620: > + phy_vco_div = 0x1; > + pixel_freq = 1620000000UL / 2; > + break; > + case 2700: > + phy_vco_div = 0x1; > + pixel_freq = 2700000000UL / 2; > + break; > + case 5400: > + phy_vco_div = 0x2; > + pixel_freq = 5400000000UL / 4; > + break; > + case 8100: > + phy_vco_div = 0x0; > + pixel_freq = 8100000000UL / 6; > + break; > + default: > + /* Other link rates aren't supported */ > + return -EINVAL; > + } > + writel(phy_vco_div, qphy->pcs + QSERDES_V3_DP_PHY_VCO_DIV); > + > + clk_set_rate(dp_clks->dp_link_hw.clk, dp_opts->link_rate * 100000); > + clk_set_rate(dp_clks->dp_pixel_hw.clk, pixel_freq); > + > + writel(0x04, qphy->pcs + QSERDES_V3_DP_PHY_AUX_CFG2); > + writel(0x01, qphy->pcs + QSERDES_V3_DP_PHY_CFG); > + writel(0x05, qphy->pcs + QSERDES_V3_DP_PHY_CFG); > + writel(0x01, qphy->pcs + QSERDES_V3_DP_PHY_CFG); > + writel(0x09, qphy->pcs + QSERDES_V3_DP_PHY_CFG); > + > + writel(0x20, qphy->serdes + QSERDES_COM_RESETSM_CNTRL); Should be QSERDES_V3_COM_RESETSM_CNTRL and not QSERDES_COM_RESETSM_CNTRL, which is for older PHY versions. > + > + if (readl_poll_timeout(qphy->serdes + QSERDES_V3_COM_C_READY_STATUS, > + status, > + ((status & BIT(0)) > 0), > + 500, > + 10000)) > + return -ETIMEDOUT; > + > + writel(0x19, qphy->pcs + QSERDES_V3_DP_PHY_CFG); > + > + if (readl_poll_timeout(qphy->pcs + QSERDES_V3_DP_PHY_STATUS, > + status, > + ((status & BIT(1)) > 0), > + 500, > + 10000)) > + return -ETIMEDOUT; > + > + writel(0x18, qphy->pcs + QSERDES_V3_DP_PHY_CFG); > + udelay(2000); > + writel(0x19, qphy->pcs + QSERDES_V3_DP_PHY_CFG); > + > + return readl_poll_timeout(qphy->pcs + QSERDES_V3_DP_PHY_STATUS, > + status, > + ((status & BIT(1)) > 0), > + 500, > + 10000); > +} ...