Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4092592ybl; Tue, 20 Aug 2019 06:57:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9cKWsngO8NoQnziDxaN5I/kGkB4Jt2OTw/le8MOGcD8M+6y4m6+LLOJshOQM8ZMr0mdx4 X-Received: by 2002:a17:902:2bc8:: with SMTP id l66mr28844684plb.222.1566309432545; Tue, 20 Aug 2019 06:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566309432; cv=none; d=google.com; s=arc-20160816; b=HwnVI5NFBmRo4736LdHFkqzlhkPFPXijA74nE8eBINhIkuY4K3V9u2qPYP9/cdskoQ tKy48iF3YdQ6wixJa23CHA7/n2ucQaE+LWAmC49aASfV3lv6fqanwTzLm8AEovtto2lw HCTT7VSghhe7n2b6ziloZbHCoFkvTVgCqNzpRPXBPl/im7xNPLgymbK6EiiysjXJpFGM Rw+PhE6a/Hk5is6+SGDj058gUeiiI9i4DCOmxqHfzMqZDX9AZgfYPy1C5EXqp1CncEBW edC2cifDsbD6vyexyB/ZBH0UBHiD7JyY6ZZzTCK2PstDPkxy81RhuI9YEUyBXIVdVfMf dMNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8dP0okt0Vjiq2vjRtyREfutnEZsi87HpiBdtkGJVTbw=; b=w4ZHEpCtpj2NhWHLSyO2F7S7h7bMgc8wOSDbS8YmCRcHPlZa2V7IPoxDYmr8cabMqz PMqw8UOETDSKYJyEgot9gylkQYBQzxIkCj1c/Oqxt7eByYH8UuSMevqZMuO/lJJ2PpFT /XevFlpkoP/s/ixCMlv0xPcYUcObYMnqQO/MMk83mBh8mBABFcsZpUvkLEYaA+A1ZKwC XR+ujvRQwP9mLhopc14p7ZRfY1D+wmcqVyh/brS58ePiEX11bTWQgzpISvPdjdYktF+M dNfxTo8Jo+Jueowt/tld3Uz5q866Wx2mdRBX7S/NwhHOfFnX8x/B9Wfv5KX3l6fuJEmZ yjbA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a63si5557337pla.54.2019.08.20.06.56.57; Tue, 20 Aug 2019 06:57:12 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729991AbfHTN4G (ORCPT + 99 others); Tue, 20 Aug 2019 09:56:06 -0400 Received: from mga01.intel.com ([192.55.52.88]:56683 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728248AbfHTN4G (ORCPT ); Tue, 20 Aug 2019 09:56:06 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Aug 2019 06:56:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,408,1559545200"; d="scan'208";a="195775716" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by fmsmga001.fm.intel.com with ESMTP; 20 Aug 2019 06:56:04 -0700 Received: from andy by smile with local (Exim 4.92.1) (envelope-from ) id 1i04cE-0003zo-6B; Tue, 20 Aug 2019 16:56:02 +0300 Date: Tue, 20 Aug 2019 16:56:02 +0300 From: Andy Shevchenko To: "Ramuthevar,Vadivel MuruganX" Cc: kishon@ti.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, cheol.yong.kim@intel.com, qi-ming.wu@intel.com, peter.harliman.liem@intel.com Subject: Re: [PATCH v2 2/2] phy: intel-lgm-emmc: Add support for eMMC PHY Message-ID: <20190820135602.GN30120@smile.fi.intel.com> References: <20190820103133.53776-1-vadivel.muruganx.ramuthevar@linux.intel.com> <20190820103133.53776-2-vadivel.muruganx.ramuthevar@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190820103133.53776-2-vadivel.muruganx.ramuthevar@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 20, 2019 at 06:31:33PM +0800, Ramuthevar,Vadivel MuruganX wrote: > From: Ramuthevar Vadivel Murugan > > Add support for eMMC PHY on Intel's Lightning Mountain SoC. Thanks for an update. Looks better though several minor comments below. > +/* eMMC phy register definitions */ > +#define EMMC_PHYCTRL0_REG 0xa8 > +#define DR_TY_MASK GENMASK(30, 28) > +#define DR_TY_50OHM(x) ((~(x) << 28) & DR_TY_MASK) For consistency it should be #define DR_TY_SHIFT(x) (((x) << 28) & DR_TY_MASK) with explanation about 50 Ohm in the code below. > +#define OTAPDLYENA BIT(14) > +#define OTAPDLYSEL_MASK GENMASK(13, 10) > +#define OTAPDLYSEL_SHIFT(x) (((x) << 10) & OTAPDLYSEL_MASK) > + > +#define EMMC_PHYCTRL1_REG 0xac > +#define PDB_MASK BIT(0) > +#define ENDLL_MASK BIT(7) > +#define ENDLL_VAL BIT(7) Again, inconsistency here, #define ENDLL_SHIFT(x) (((x) << 7) & ENDLL_MASK) > +#define EMMC_PHYCTRL2_REG 0xb0 > +#define FRQSEL_25M 0 > +#define FRQSEL_150M 3 > +#define FRQSEL_MASK GENMASK(24, 22) > +#define FRQSEL_SHIFT(x) ((x) << 22) And here #define FRQSEL_SHIFT(x) (((x) << 22) & FRQSEL_MASK) > + /* > + * According to the user manual, calpad calibration > + * cycle takes more than 2us without the minimal recommended > + * value, so we may need a little margin here > + */ > + usleep_range(3, 6); Actually for this low values it's recommended to use udelay() disregard to context. udelay(5); > + regmap_update_bits(priv->syscfg, EMMC_PHYCTRL1_REG, PDB_MASK, 1); 1 looks like a magic that has to be changed in the same way as for the rest, i.e. #define PDB_SHIFT(x) (((x) << 0) & PDB_MASK) ..., PDB_MASK, PDB_SHIFT(1)... > +static int intel_emmc_phy_power_on(struct phy *phy) > +{ > + struct intel_emmc_phy *priv = phy_get_drvdata(phy); > + int ret; > + > + /* Drive impedance: 50 Ohm */ Nice, you have already a comment here. Just use DR_TY_SHIFT(1) > + ret = regmap_update_bits(priv->syscfg, EMMC_PHYCTRL0_REG, DR_TY_MASK, > + DR_TY_50OHM(1)); > + ret = regmap_update_bits(priv->syscfg, EMMC_PHYCTRL0_REG, OTAPDLYENA, > + 0x0); 0x0 -> 0 > +static int intel_emmc_phy_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct intel_emmc_phy *priv; > + struct phy *generic_phy; > + struct phy_provider *phy_provider; > + > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + /* Get eMMC phy (accessed via chiptop) regmap */ > + priv->syscfg = syscon_regmap_lookup_by_phandle(dev->of_node, > + "intel,syscon"); Perhaps struct device_node *np = dev->of_node; ... priv->syscfg = syscon_regmap_lookup_by_phandle(np, "intel,syscon"); > + generic_phy = devm_phy_create(dev, dev->of_node, &ops); And here. -- With Best Regards, Andy Shevchenko