linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] phy: rockchip: set pulldown for strobe line in dts
@ 2020-11-29  5:44 Chris Ruehl
  2020-11-29  5:44 ` [PATCH v2 1/2] " Chris Ruehl
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Ruehl @ 2020-11-29  5:44 UTC (permalink / raw)
  Cc: devicetree, Chris Ruehl, Kishon Vijay Abraham I, Vinod Koul,
	Heiko Stuebner, linux-kernel, linux-arm-kernel, linux-rockchip

This patchset add support to set the strobe line pulldown via dt property

2 files modified:
drivers/phy/rockchip/phy-rockchip-emmc.c
Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt

Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk>
---
v2:
- Fix issues show with checkpatch --strict
- Add patch to update the Documentation

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] phy: rockchip: set pulldown for strobe line in dts
  2020-11-29  5:44 [PATCH v2] phy: rockchip: set pulldown for strobe line in dts Chris Ruehl
@ 2020-11-29  5:44 ` Chris Ruehl
  2020-11-29  5:44 ` [PATCH v2 2/2] devicetree: phy: rockchip-emmc: pulldown property Chris Ruehl
  2020-12-05  8:08 ` [PATCH v2] phy: rockchip: set pulldown for strobe line in dts Vinod Koul
  2 siblings, 0 replies; 5+ messages in thread
From: Chris Ruehl @ 2020-11-29  5:44 UTC (permalink / raw)
  Cc: devicetree, Chris Ruehl, Kishon Vijay Abraham I, Vinod Koul,
	Heiko Stuebner, linux-kernel, linux-arm-kernel, linux-rockchip

This patch add support to set the internal pulldown via dt property
and allow simplify the board design for the trace from emmc-phy to
the eMMC chipset.
Default to not set the pull-down.

This patch was inspired from the 4.4 tree of the
Rockchip SDK, where it is enabled unconditional.
The patch had been tested with our rk3399 customized board.

Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk>
---
 drivers/phy/rockchip/phy-rockchip-emmc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c
index 2dc19ddd120f..48e2d75b1004 100644
--- a/drivers/phy/rockchip/phy-rockchip-emmc.c
+++ b/drivers/phy/rockchip/phy-rockchip-emmc.c
@@ -67,6 +67,10 @@
 #define PHYCTRL_OTAPDLYENA_SHIFT	0xb
 #define PHYCTRL_OTAPDLYSEL_MASK		0xf
 #define PHYCTRL_OTAPDLYSEL_SHIFT	0x7
+#define PHYCTRL_REN_STRB_DISABLE	0x0
+#define PHYCTRL_REN_STRB_ENABLE		0x1
+#define PHYCTRL_REN_STRB_MASK		0x1
+#define PHYCTRL_REN_STRB_SHIFT		0x9
 
 #define PHYCTRL_IS_CALDONE(x) \
 	((((x) >> PHYCTRL_CALDONE_SHIFT) & \
@@ -80,6 +84,7 @@ struct rockchip_emmc_phy {
 	struct regmap	*reg_base;
 	struct clk	*emmcclk;
 	unsigned int drive_impedance;
+	unsigned int enable_strobe_pulldown;
 };
 
 static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
@@ -295,6 +300,13 @@ static int rockchip_emmc_phy_power_on(struct phy *phy)
 				   PHYCTRL_OTAPDLYSEL_MASK,
 				   PHYCTRL_OTAPDLYSEL_SHIFT));
 
+	/* Internal pull-down for strobe line */
+	regmap_write(rk_phy->reg_base,
+		     rk_phy->reg_offset + GRF_EMMCPHY_CON2,
+		     HIWORD_UPDATE(rk_phy->enable_strobe_pulldown,
+				   PHYCTRL_REN_STRB_MASK,
+				   PHYCTRL_REN_STRB_SHIFT));
+
 	/* Power up emmc phy analog blocks */
 	return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_ON);
 }
@@ -359,10 +371,14 @@ static int rockchip_emmc_phy_probe(struct platform_device *pdev)
 	rk_phy->reg_offset = reg_offset;
 	rk_phy->reg_base = grf;
 	rk_phy->drive_impedance = PHYCTRL_DR_50OHM;
+	rk_phy->enable_strobe_pulldown = PHYCTRL_REN_STRB_DISABLE;
 
 	if (!of_property_read_u32(dev->of_node, "drive-impedance-ohm", &val))
 		rk_phy->drive_impedance = convert_drive_impedance_ohm(pdev, val);
 
+	if (of_property_read_bool(dev->of_node, "enable-strobe-pulldown"))
+		rk_phy->enable_strobe_pulldown = PHYCTRL_REN_STRB_ENABLE;
+
 	generic_phy = devm_phy_create(dev, dev->of_node, &ops);
 	if (IS_ERR(generic_phy)) {
 		dev_err(dev, "failed to create PHY\n");
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] devicetree: phy: rockchip-emmc: pulldown property
  2020-11-29  5:44 [PATCH v2] phy: rockchip: set pulldown for strobe line in dts Chris Ruehl
  2020-11-29  5:44 ` [PATCH v2 1/2] " Chris Ruehl
@ 2020-11-29  5:44 ` Chris Ruehl
  2020-12-07 18:01   ` Rob Herring
  2020-12-05  8:08 ` [PATCH v2] phy: rockchip: set pulldown for strobe line in dts Vinod Koul
  2 siblings, 1 reply; 5+ messages in thread
From: Chris Ruehl @ 2020-11-29  5:44 UTC (permalink / raw)
  Cc: devicetree, Chris Ruehl, Kishon Vijay Abraham I, Vinod Koul,
	Rob Herring, Heiko Stuebner, linux-kernel, linux-arm-kernel,
	linux-rockchip

Update the documentation and add the bool property
enable-strobe-pulldown used to enable the internal pull-down for the
strobe line.

Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk>
---
 Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
index e728786f21e0..3e4d2d79a65d 100644
--- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
+++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
@@ -16,6 +16,8 @@ Optional properties:
  - drive-impedance-ohm: Specifies the drive impedance in Ohm.
                         Possible values are 33, 40, 50, 66 and 100.
                         If not set, the default value of 50 will be applied.
+ - enable-strobe-pulldown: Enable internal pull-down for the strobe line.
+                           If not set, pull-down is not used.
 
 Example:
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] phy: rockchip: set pulldown for strobe line in dts
  2020-11-29  5:44 [PATCH v2] phy: rockchip: set pulldown for strobe line in dts Chris Ruehl
  2020-11-29  5:44 ` [PATCH v2 1/2] " Chris Ruehl
  2020-11-29  5:44 ` [PATCH v2 2/2] devicetree: phy: rockchip-emmc: pulldown property Chris Ruehl
@ 2020-12-05  8:08 ` Vinod Koul
  2 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2020-12-05  8:08 UTC (permalink / raw)
  To: Chris Ruehl
  Cc: devicetree, Kishon Vijay Abraham I, Heiko Stuebner, linux-kernel,
	linux-arm-kernel, linux-rockchip

On 29-11-20, 13:44, Chris Ruehl wrote:
> This patchset add support to set the strobe line pulldown via dt property

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] devicetree: phy: rockchip-emmc: pulldown property
  2020-11-29  5:44 ` [PATCH v2 2/2] devicetree: phy: rockchip-emmc: pulldown property Chris Ruehl
@ 2020-12-07 18:01   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2020-12-07 18:01 UTC (permalink / raw)
  To: Chris Ruehl
  Cc: devicetree, Kishon Vijay Abraham I, Vinod Koul, Heiko Stuebner,
	linux-kernel, linux-arm-kernel, linux-rockchip

On Sun, Nov 29, 2020 at 01:44:15PM +0800, Chris Ruehl wrote:
> Update the documentation and add the bool property
> enable-strobe-pulldown used to enable the internal pull-down for the
> strobe line.
> 
> Signed-off-by: Chris Ruehl <chris.ruehl@gtsys.com.hk>
> ---
>  Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> index e728786f21e0..3e4d2d79a65d 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> @@ -16,6 +16,8 @@ Optional properties:
>   - drive-impedance-ohm: Specifies the drive impedance in Ohm.
>                          Possible values are 33, 40, 50, 66 and 100.
>                          If not set, the default value of 50 will be applied.
> + - enable-strobe-pulldown: Enable internal pull-down for the strobe line.
> +                           If not set, pull-down is not used.

Needs a vendor prefix.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-07 18:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-29  5:44 [PATCH v2] phy: rockchip: set pulldown for strobe line in dts Chris Ruehl
2020-11-29  5:44 ` [PATCH v2 1/2] " Chris Ruehl
2020-11-29  5:44 ` [PATCH v2 2/2] devicetree: phy: rockchip-emmc: pulldown property Chris Ruehl
2020-12-07 18:01   ` Rob Herring
2020-12-05  8:08 ` [PATCH v2] phy: rockchip: set pulldown for strobe line in dts Vinod Koul

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).