public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: u-boot@lists.denx.de
Cc: Chris Packham <judge.packham@gmail.com>,
	Chris Packham <chris.packham@alliedtelesis.co.nz>,
	Stefan Roese <sr@denx.de>, Tom Rini <trini@konsulko.com>
Subject: [PATCH 2/6] ARM: kirkwood: SBx81LIFKW: update for DM_GPIO
Date: Thu,  4 Aug 2022 21:06:24 +1200	[thread overview]
Message-ID: <20220804090629.75183-3-judge.packham@gmail.com> (raw)
In-Reply-To: <20220804090629.75183-1-judge.packham@gmail.com>

Update mv88e61xx_hw_reset() to use the DM_GPIO API to toggle the reset
line for the linkstreet switch.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---

 board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c b/board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c
index feb8b6b83f00..e0a7f3fa89f0 100644
--- a/board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c
+++ b/board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c
@@ -17,7 +17,8 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
-#include <asm/arch/gpio.h>
+#include <asm-generic/gpio.h>
+#include <dm.h>
 
 /* Note: GPIO differences between specific boards
  *
@@ -37,8 +38,6 @@
 #define SBX81LIFKW_OE_VAL_LOW	 (BIT(31) | BIT(30) | BIT(28) | BIT(27))
 #define SBX81LIFKW_OE_VAL_HIGH	 (BIT(0) | BIT(1))
 
-#define MV88E6097_RESET		27
-
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_early_init_f(void)
@@ -143,11 +142,23 @@ void reset_phy(void)
 #ifdef CONFIG_MV88E61XX_SWITCH
 int mv88e61xx_hw_reset(struct phy_device *phydev)
 {
+	struct gpio_desc desc;
+	int ret;
+
+	ret = dm_gpio_lookup_name("mvebu0_27", &desc);
+	if (ret)
+		return ret;
+
+	ret = dm_gpio_request(&desc, "linkstreet_rst");
+	if (ret)
+		return ret;
+
 	/* Ensure the 88e6097 gets at least 10ms Reset
 	 */
-	kw_gpio_set_value(MV88E6097_RESET, 0);
+	dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
+	dm_gpio_set_value(&desc, 0);
 	mdelay(20);
-	kw_gpio_set_value(MV88E6097_RESET, 1);
+	dm_gpio_set_value(&desc, 1);
 	mdelay(20);
 
 	phydev->advertising = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
-- 
2.37.1


  parent reply	other threads:[~2022-08-04  9:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04  9:06 [PATCH 0/6] SBx81LIFKW/SBx81LIFXCAT disable KIRKWOOD_GPIO Chris Packham
2022-08-04  9:06 ` [PATCH 1/6] ARM: kirkwood: SBx81LIFKW: remove direct access of GPIO registers Chris Packham
2022-08-05 10:47   ` Stefan Roese
2022-08-04  9:06 ` Chris Packham [this message]
2022-08-05 10:47   ` [PATCH 2/6] ARM: kirkwood: SBx81LIFKW: update for DM_GPIO Stefan Roese
2022-08-04  9:06 ` [PATCH 3/6] ARM: kirkwood: SBx81LIFKW: enable CMD_GPIO Chris Packham
2022-08-05 10:48   ` Stefan Roese
2022-08-04  9:06 ` [PATCH 4/6] ARM: kirkwood: SBx81LIFKW: disable KIRKWOOD_GPIO Chris Packham
2022-08-05 10:48   ` Stefan Roese
2022-08-04  9:06 ` [PATCH 5/6] ARM: kirkwood: SBx81LIFKW: enable CONFIG_NET_RANDOM_ETHADDR Chris Packham
2022-08-05 10:48   ` Stefan Roese
2022-08-04  9:06 ` [PATCH 6/6] ARM: kirkwood: SBx81LIFXCAT: disable KIRKWOOD_GPIO Chris Packham
2022-08-05 10:49   ` Stefan Roese
2022-08-09 11:35 ` [PATCH 0/6] SBx81LIFKW/SBx81LIFXCAT " Stefan Roese

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=20220804090629.75183-3-judge.packham@gmail.com \
    --to=judge.packham@gmail.com \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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