From: Vinod Koul <vkoul@kernel.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>,
linuxarm@huawei.com, mauro.chehab@huawei.com,
John Stultz <john.stultz@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Alex Dewar <alex.dewar90@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kishon Vijay Abraham I <kishon@ti.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Yu Chen <chenyu56@huawei.com>,
devel@driverdev.osuosl.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/8] phy: phy-hi3670-usb3: move driver from staging into phy
Date: Mon, 30 Nov 2020 16:00:23 +0530 [thread overview]
Message-ID: <20201130103023.GM8403@vkoul-mobl> (raw)
In-Reply-To: <420faf39bb03d07f8823b03bc55a429e975e23a0.1605530560.git.mchehab+huawei@kernel.org>
On 16-11-20, 13:59, Mauro Carvalho Chehab wrote:
> +#define CTRL7_USB2_REFCLKSEL_MASK (3 << 3)
> +#define CTRL7_USB2_REFCLKSEL_ABB (3 << 3)
> +#define CTRL7_USB2_REFCLKSEL_PAD (2 << 3)
This should use GENMASK()
> +
> +#define CFG50_USB3_PHY_TEST_POWERDOWN BIT(23)
> +
> +#define CFG54_USB31PHY_CR_ADDR_MASK (0xFFFF)
> +#define CFG54_USB31PHY_CR_ADDR_SHIFT (16)
We can skip this by using FIELD_GET/FIELD_SET macros and only define
register fields.
> +static int hi3670_phy_cr_start(struct regmap *usb31misc, int direction)
> +{
> + int ret;
> +
> + if (direction)
> + ret = regmap_update_bits(usb31misc, USB_MISC_CFG54,
> + CFG54_USB31PHY_CR_WR_EN,
> + CFG54_USB31PHY_CR_WR_EN);
> + else
> + ret = regmap_update_bits(usb31misc, USB_MISC_CFG54,
> + CFG54_USB31PHY_CR_RD_EN,
> + CFG54_USB31PHY_CR_RD_EN);
how about:
if direction
reg = CFG54_USB31PHY_CR_WR_EN;
else
reg = CFG54_USB31PHY_CR_RD_EN;
regmap_update_bits(usb31misc, USB_MISC_CFG54, reg, reg);
> +
> + if (ret)
> + return ret;
> +
> + ret = hi3670_phy_cr_clk(usb31misc);
> + if (ret)
> + return ret;
> +
> + ret = regmap_update_bits(usb31misc, USB_MISC_CFG54,
> + CFG54_USB31PHY_CR_RD_EN | CFG54_USB31PHY_CR_WR_EN, 0);
> +
> + return ret;
return regmap_update_bits()
> +static int hi3670_phy_cr_wait_ack(struct regmap *usb31misc)
> +{
> + u32 reg;
> + int retry = 100000;
> + int ret;
> +
> + while (retry-- > 0) {
> + ret = regmap_read(usb31misc, USB_MISC_CFG54, ®);
> + if (ret)
> + return ret;
> + if ((reg & CFG54_USB31PHY_CR_ACK) == CFG54_USB31PHY_CR_ACK)
> + return 0;
> +
> + ret = hi3670_phy_cr_clk(usb31misc);
> + if (ret)
> + return ret;
No delay in between reads..? maybe add a small delay and reduce the
retries?
> +static int hi3670_phy_cr_set_addr(struct regmap *usb31misc, u32 addr)
> +{
> + u32 reg;
> + int ret;
> +
> + ret = regmap_read(usb31misc, USB_MISC_CFG54, ®);
> + if (ret)
> + return ret;
> +
> + reg &= ~(CFG54_USB31PHY_CR_ADDR_MASK << CFG54_USB31PHY_CR_ADDR_SHIFT);
> + reg |= ((addr & CFG54_USB31PHY_CR_ADDR_MASK) << CFG54_USB31PHY_CR_ADDR_SHIFT);
> + ret = regmap_write(usb31misc, USB_MISC_CFG54, reg);
regmap_update_bits() ?
> +static int hi3670_is_abbclk_seleted(struct hi3670_priv *priv)
> +{
> + u32 reg;
> +
> + if (!priv->sctrl) {
> + dev_err(priv->dev, "priv->sctrl is null!\n");
> + return 1;
> + }
> +
> + if (regmap_read(priv->sctrl, SCTRL_SCDEEPSLEEPED, ®)) {
> + dev_err(priv->dev, "SCTRL_SCDEEPSLEEPED read failed!\n");
> + return 1;
Not a -ve error code?
--
~Vinod
next prev parent reply other threads:[~2020-11-30 10:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 12:59 [PATCH 0/8] Move Hikey 970 USB support out of staging and add DT Mauro Carvalho Chehab
2020-11-16 12:59 ` [PATCH 1/8] phy: phy-hi3670-usb3: move driver from staging into phy Mauro Carvalho Chehab
2020-11-16 15:31 ` Rob Herring
2020-11-17 6:55 ` Mauro Carvalho Chehab
2020-11-17 9:51 ` Vinod Koul
2020-11-16 15:31 ` Rob Herring
2020-11-30 10:30 ` Vinod Koul [this message]
2020-11-16 12:59 ` [PATCH 2/8] spmi: hi6421-spmi-pmic: move driver from staging Mauro Carvalho Chehab
2020-11-16 15:32 ` Rob Herring
2020-11-16 12:59 ` [PATCH 3/8] mfd: " Mauro Carvalho Chehab
2020-11-16 15:32 ` Rob Herring
2020-11-16 12:59 ` [PATCH 4/8] regulator: hi6421v600-regulator: move it " Mauro Carvalho Chehab
2020-11-16 18:38 ` Mark Brown
2020-11-17 8:08 ` Mauro Carvalho Chehab
2020-11-17 14:25 ` Mark Brown
2020-11-17 8:38 ` Mauro Carvalho Chehab
2020-11-17 15:10 ` Mark Brown
2020-11-16 12:59 ` [PATCH 5/8] arm64: dts: hisilicon: hi3670.dtsi: add I2C settings Mauro Carvalho Chehab
2020-11-16 12:59 ` [PATCH 6/8] arm64: dts: hikey970-pinctrl.dtsi: add missing pinctrl settings Mauro Carvalho Chehab
2020-11-16 12:59 ` [PATCH 7/8] dts: hisilicon: add support for USB3 on Hikey 970 Mauro Carvalho Chehab
2020-11-16 12:59 ` [PATCH 8/8] dts: hisilicon: add support for the PMIC found " Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201130103023.GM8403@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=alex.dewar90@gmail.com \
--cc=chenyu56@huawei.com \
--cc=devel@driverdev.osuosl.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=kishon@ti.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mani@kernel.org \
--cc=mauro.chehab@huawei.com \
--cc=mchehab+huawei@kernel.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).