Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp876214imm; Fri, 11 May 2018 07:43:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpbZB7NPnqoMQ/2L/yWSx/7yh9tvC4Arbds9MpBTvP5BjibPgfB9Nh8A1XRuWMZ6D1rXRee X-Received: by 2002:a17:902:8f95:: with SMTP id z21-v6mr5862379plo.259.1526049801329; Fri, 11 May 2018 07:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526049801; cv=none; d=google.com; s=arc-20160816; b=Q/Fpts37JnGsUJtQuUfBIrY/HEvDrVA+Y3S5JIQvry29kGGlgZdfFId3Zg0lR0TXLU ggSbnvW4pV8bW3RI9HgA/e1dH3NJQsH1FKKJA+7pUp1pzIrU93KFUeBubDdjlSqLVpyO zclFcIRpPQK9zmcQvE8Vs49CLIcV6eEO8FEr+Uh3PTLA08/bTtCmyPUMAl7xmCYfOMCa PC4v/75OofRFFe1PEIHF7qM2VVh/iiaVYWHAOx5agQ/TzQCVBelb30HttS5VcStsqY9u MXSpUTJNP86jcO4QVo+Sz0Ixj/imzf7k3IQV1cgNws2G9byY6PSWmkbNc6IlkpRImlD/ dalQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=stdmQon0AuLErOPx+khqrM3lJ3EVTFN+aVgSeZJ4Ezc=; b=NpFWmnDvKgnqDWcbuDfCAw8JJ256rFJ8PeIAEPPX2rp8SJsgF+dvKCiBOjpor7owqj qJdKcy2BuocmEW2f/8BoFaLY1taj+jyReCIlCNLsUeXJuR5F6wbiVg/lF5idgDRaizqy wSSFQNxlerGnBy9JHFiJWSriu5O80hLkQ1OXwD85bQi9HBPkwCFN5QqoL9CmEqFPv5Ff p05vvU/4VJoH7R8c4TrPxQCNFMARTHj/ZJcSyR/LclF7GOs6Ql1ESWVYIszfrCmqsTcv w8LaohtPE9HJ8+6nnVdVkfQ1CXdzXxa/ZfgRGoJDP78PK/QwGhgv8dlfZ+PDUlxF/9gR yXYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f5Y/9CXm; 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 q2-v6si2773160pgr.458.2018.05.11.07.43.06; Fri, 11 May 2018 07:43:21 -0700 (PDT) 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=f5Y/9CXm; 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 S1753145AbeEKOln (ORCPT + 99 others); Fri, 11 May 2018 10:41:43 -0400 Received: from mail-yb0-f195.google.com ([209.85.213.195]:37729 "EHLO mail-yb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752997AbeEKOlm (ORCPT ); Fri, 11 May 2018 10:41:42 -0400 Received: by mail-yb0-f195.google.com with SMTP id i13-v6so1899900ybl.4 for ; Fri, 11 May 2018 07:41:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=stdmQon0AuLErOPx+khqrM3lJ3EVTFN+aVgSeZJ4Ezc=; b=f5Y/9CXmd5nJ9d1YDuei8LNtVOy4e5Yse5qPAQgX0vMw2vpdLfDr7MWvB6Bn7PKgt7 3zFeHtQ+hXbcyMmdgTmSZ9ujzsAcQ9dwjqBmX4fWdjU0duzL1pxI6QT+tTKfo+TrbN3L Bb2OEjGdx66BLWqkx3mc9tnDSdx1es88oS+N4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=stdmQon0AuLErOPx+khqrM3lJ3EVTFN+aVgSeZJ4Ezc=; b=m53+Z7zxt7ihDo0D/1huf+zgBG9tJ+cBK/u0dEYMcV8st0Ccs4zXnNv98MeXyE7TFk V063edecf8riixlpDBYMfCXO9n2TrOtgtWyvofXgidUepFC2/2+AZcdBhGcAvJxdSi2l c+rhLuKZoRbWfsbIAY8CzMrNRVvfe/waxfuPVBkxxNuW7NPVSi80l4fK7Y29ALg2BQYY yYZFa4Onj7uNPmxW0qEi44yyfSHDn4kRgvbY+KeYxauyfF8DFVlpfWEfmF+YwqfsOU+3 rGhmIE6XpgH/Thvu60BXZaZk1IUm7It8aHhykiuqcChb4352NzBtFOMYbdxw1oAaxV9F IKRQ== X-Gm-Message-State: ALKqPwdDRo/QCO5YURRB25QtCQH7sOt53UWqFrvXOoccfzlvZ4UeRFOO JGkIsiRBgaB6/iAegfRcba8aMQ== X-Received: by 2002:a5b:64f:: with SMTP id o15-v6mr1272858ybq.5.1526049701794; Fri, 11 May 2018 07:41:41 -0700 (PDT) Received: from localhost ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id v125-v6sm1354282ywg.75.2018.05.11.07.41.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 07:41:41 -0700 (PDT) Date: Fri, 11 May 2018 10:41:40 -0400 From: Sean Paul To: Lin Huang Cc: seanpaul@chromium.org, airlied@linux.ie, zyw@rock-chips.com, dianders@chromium.org, briannorris@chromium.org, linux-rockchip@lists.infradead.org, heiko@sntech.de, daniel.vetter@intel.com, jani.nikula@linux.intel.com, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, eballetbo@gmail.com Subject: Re: [PATCH v2 2/4] phy: rockchip-typec: support variable phy config value Message-ID: <20180511144140.GO33053@art_vandelay> References: <1525861364-26323-1-git-send-email-hl@rock-chips.com> <1525861364-26323-2-git-send-email-hl@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1525861364-26323-2-git-send-email-hl@rock-chips.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 09, 2018 at 06:22:42PM +0800, Lin Huang wrote: > the phy config values used to fix in dp firmware, but some boards > need change these values to do training and get the better eye diagram > result. So support that in phy driver. > FTR, I've previously reviewed this at https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/985573 This patch should come _after_ the dt binding addition. > Signed-off-by: Chris Zhong > Signed-off-by: Lin Huang > --- > Changes in v2: > - update patch following Enric suggest > > drivers/phy/rockchip/phy-rockchip-typec.c | 284 +++++++++++++++++++----------- > include/soc/rockchip/rockchip_phy_typec.h | 64 +++++++ > 2 files changed, 250 insertions(+), 98 deletions(-) > create mode 100644 include/soc/rockchip/rockchip_phy_typec.h > /snip > diff --git a/include/soc/rockchip/rockchip_phy_typec.h b/include/soc/rockchip/rockchip_phy_typec.h > new file mode 100644 > index 0000000..4a328221 > --- /dev/null > +++ b/include/soc/rockchip/rockchip_phy_typec.h > @@ -0,0 +1,64 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd > + * Author: Lin Huang > + */ > + > +#ifndef __SOC_ROCKCHIP_PHY_TYPEC_H > +#define __SOC_ROCKCHIP_PHY_TYPEC_H > + > +struct usb3phy_reg { > + u32 offset; > + u32 enable_bit; > + u32 write_enable; > +}; > + > +/** > + * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. > + * @reg: the base address for usb3-phy config. > + * @typec_conn_dir: the register of type-c connector direction. > + * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. > + * @external_psm: the register of type-c phy external psm clock. > + * @pipe_status: the register of type-c phy pipe status. > + * @usb3_host_disable: the register of type-c usb3 host disable. > + * @usb3_host_port: the register of type-c usb3 host port. > + * @uphy_dp_sel: the register of type-c phy DP select control. > + */ > +struct rockchip_usb3phy_port_cfg { > + unsigned int reg; > + struct usb3phy_reg typec_conn_dir; > + struct usb3phy_reg usb3tousb2_en; > + struct usb3phy_reg external_psm; > + struct usb3phy_reg pipe_status; > + struct usb3phy_reg usb3_host_disable; > + struct usb3phy_reg usb3_host_port; > + struct usb3phy_reg uphy_dp_sel; > +}; > + > +struct phy_config { > + int swing; > + int pe; > +}; > + > +struct rockchip_typec_phy { > + struct device *dev; > + void __iomem *base; > + struct extcon_dev *extcon; > + struct regmap *grf_regs; > + struct clk *clk_core; > + struct clk *clk_ref; > + struct reset_control *uphy_rst; > + struct reset_control *pipe_rst; > + struct reset_control *tcphy_rst; > + const struct rockchip_usb3phy_port_cfg *port_cfgs; > + /* mutex to protect access to individual PHYs */ > + struct mutex lock; > + struct phy_config config[3][4]; > + u8 need_software_training; I thought we decided to always do sw training and then fallback to fw training. If so, we don't need this. Sean > + bool flip; > + u8 mode; > + int (*typec_phy_config)(struct phy *phy, int link_rate, > + int lanes, u8 swing, u8 pre_emp); > +}; > + > +#endif > -- > 2.7.4 > -- Sean Paul, Software Engineer, Google / Chromium OS