All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH V2 07/14] ARM: dts: stm32: Use DT alias for the configuration EEPROM
Date: Tue, 31 Mar 2020 08:34:28 +0000	[thread overview]
Message-ID: <e977b5ed-3b06-76a4-d17e-f9d8ebb38b79@st.com> (raw)
In-Reply-To: <20200331004851.282583-8-marex@denx.de>

Hi Marek

On 3/31/20 2:48 AM, Marek Vasut wrote:
> Use DT /aliases node to establish a stable phandle to the configuration
> EEPROM. This permits the configuration EEPROM to be moved e.g. to a
> different address or a different bus. Adjust the board code to handle
> new phandle lookup.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Patrick Delaunay <patrick.delaunay@st.com>
> Cc: Patrice Chotard <patrice.chotard@st.com>

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks


> ---
> V2: No change
> ---
>  arch/arm/dts/stm32mp15xx-dhcom.dtsi     |  6 +++++-
>  board/dhelectronics/dh_stm32mp1/board.c | 15 +++++++--------
>  2 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/dts/stm32mp15xx-dhcom.dtsi b/arch/arm/dts/stm32mp15xx-dhcom.dtsi
> index bed69c97b6..e5be0a79ac 100644
> --- a/arch/arm/dts/stm32mp15xx-dhcom.dtsi
> +++ b/arch/arm/dts/stm32mp15xx-dhcom.dtsi
> @@ -10,6 +10,10 @@
>  #include <dt-bindings/mfd/st,stpmic1.h>
>  
>  / {
> +	aliases {
> +		eeprom0 = &eeprom0;
> +	};
> +
>  	memory at c0000000 {
>  		device_type = "memory";
>  		reg = <0xC0000000 0x40000000>;
> @@ -187,7 +191,7 @@
>  		};
>  	};
>  
> -	eeprom at 50 {
> +	eeprom0: eeprom at 50 {
>  		compatible = "atmel,24c02";
>  		reg = <0x50>;
>  		pagesize = <16>;
> diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c
> index 109d9ec935..a3458a2623 100644
> --- a/board/dhelectronics/dh_stm32mp1/board.c
> +++ b/board/dhelectronics/dh_stm32mp1/board.c
> @@ -78,22 +78,21 @@ DECLARE_GLOBAL_DATA_PTR;
>  
>  int setup_mac_address(void)
>  {
> -	struct udevice *dev;
> -	ofnode eeprom;
>  	unsigned char enetaddr[6];
> -	int ret;
> +	struct udevice *dev;
> +	int off, ret;
>  
>  	ret = eth_env_get_enetaddr("ethaddr", enetaddr);
>  	if (ret)	/* ethaddr is already set */
>  		return 0;
>  
> -	eeprom = ofnode_path("/soc/i2c at 5c002000/eeprom at 50");
> -	if (!ofnode_valid(eeprom)) {
> -		printf("Invalid hardware path to EEPROM!\n");
> -		return -ENODEV;
> +	off = fdt_path_offset(gd->fdt_blob, "eeprom0");
> +	if (off < 0) {
> +		printf("%s: No eeprom0 path offset\n", __func__);
> +		return off;
>  	}
>  
> -	ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, eeprom, &dev);
> +	ret = uclass_get_device_by_of_offset(UCLASS_I2C_EEPROM, off, &dev);
>  	if (ret) {
>  		printf("Cannot find EEPROM!\n");
>  		return ret;

  reply	other threads:[~2020-03-31  8:34 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31  0:48 [PATCH V2 00/14] ARM: stm32: Fix Avenger96 Marek Vasut
2020-03-31  0:48 ` [PATCH V2 01/14] ARM: dts: stm32: Repair SD1 pre-reloc pinmux DT node on AV96 Marek Vasut
2020-03-31  8:25   ` Patrice CHOTARD
2020-03-31 12:31   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 02/14] ARM: dts: stm32: Add alternate pinmux for SDMMC1 direction pins Marek Vasut
2020-03-31  8:26   ` Patrice CHOTARD
2020-03-31 12:34   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 03/14] ARM: dts: stm32: Repair SDMMC1 operation on AV96 Marek Vasut
2020-03-31  8:33   ` Patrice CHOTARD
2020-03-31 12:41   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 04/14] ARM: dts: stm32: Add alternate pinmux for SDMMC2 pins 4-7 Marek Vasut
2020-03-31  8:27   ` Patrice CHOTARD
2020-03-31 12:42   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 05/14] ARM: dts: stm32: Repair SDMMC2 operation Marek Vasut
2020-03-31  8:28   ` Patrice CHOTARD
2020-03-31 12:44   ` Patrick DELAUNAY
2020-03-31 13:41   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 06/14] ARM: dts: stm32: Add QSPI NOR on AV96 Marek Vasut
2020-03-31  8:33   ` Patrice CHOTARD
2020-03-31 13:39   ` Patrick DELAUNAY
2020-03-31 16:38     ` Marek Vasut
2020-03-31  0:48 ` [PATCH V2 07/14] ARM: dts: stm32: Use DT alias for the configuration EEPROM Marek Vasut
2020-03-31  8:34   ` Patrice CHOTARD [this message]
2020-03-31 13:56   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 08/14] ARM: dts: stm32: Add configuration EEPROM on AV96 Marek Vasut
2020-03-31  8:34   ` Patrice CHOTARD
2020-03-31 13:57   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 09/14] ARM: dts: stm32: Add alternate pinmux for ethernet RGMII Marek Vasut
2020-03-31  8:35   ` Patrice CHOTARD
2020-03-31 13:58   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 10/14] ARM: dts: stm32: Repair ethernet operation on AV96 Marek Vasut
2020-03-31  8:35   ` Patrice CHOTARD
2020-03-31 13:59   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 11/14] ARM: dts: stm32: Add missing ethernet PHY reset " Marek Vasut
2020-03-31  8:35   ` Patrice CHOTARD
2020-03-31 14:06   ` Patrick DELAUNAY
2020-03-31 17:06     ` Marek Vasut
2020-04-01  8:57       ` Patrick DELAUNAY
2020-04-01 10:52         ` Marek Vasut
2020-03-31  0:48 ` [PATCH V2 12/14] ARM: dts: stm32: Repair PMIC configuration " Marek Vasut
2020-03-31  8:37   ` Patrice CHOTARD
2020-03-31  0:48 ` [PATCH V2 13/14] ARM: dts: stm32: Adjust PLL4 settings " Marek Vasut
2020-03-31  8:41   ` Patrice CHOTARD
2020-03-31 14:25   ` Patrick DELAUNAY
2020-03-31  0:48 ` [PATCH V2 14/14] ARM: dts: stm32: Split AV96 into DHCOR SoM and AV96 board Marek Vasut
2020-03-31  8:38   ` Patrice CHOTARD
2020-03-31 14:59   ` Patrick DELAUNAY
2020-03-31 16:37     ` Marek Vasut
2020-04-01  8:37       ` Patrick DELAUNAY
2020-04-01 10:53         ` Marek Vasut
2020-03-31 15:22 ` [PATCH V2 00/14] ARM: stm32: Fix Avenger96 Patrick DELAUNAY
2020-03-31 16:58   ` Marek Vasut
2020-04-01  9:15     ` Patrick DELAUNAY
2020-04-01 10:55       ` Marek Vasut

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=e977b5ed-3b06-76a4-d17e-f9d8ebb38b79@st.com \
    --to=patrice.chotard@st.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.