All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: "Pali Rohár" <pali@kernel.org>
Cc: Luka Kovacic <luka.kovacic@sartura.hr>,
	Robert Marko <robert.marko@sartura.hr>,
	u-boot@lists.denx.de, Stefan Roese <sr@denx.de>,
	Luka Perkov <luka.perkov@sartura.hr>
Subject: Re: [PATCH 1/2] arm: mvebu: Implement the mac command (Marvell hw_info)
Date: Sat, 9 Oct 2021 11:42:38 +0200	[thread overview]
Message-ID: <20211009114238.749090e8@thinkpad> (raw)
In-Reply-To: <20211008180629.vw2azj7k7ydg67sr@pali>

> > > > +config MVEBU_MAC_HW_INFO_OFFSET
> > > > +     hex "Marvell hw_info (mac) SPI flash offset"
> > > > +     depends on MVEBU_MAC_HW_INFO
> > > > +     default 0x3E0000
> > > > +     help
> > > > +       This option defines the SPI flash offset of the Marvell
> > > > +       hw_info area. This defaults to 0x3E0000 on most Armada
> > > > +       A3720 platforms.  
> > >
> > > Have you tried to specify this offset directly into DTS file? Because
> > > in DTS file is already specified this hw info partition and it seems
> > > like that this kind of information belongs to DTS.  
> > 
> > I haven't encountered a board, which has a different offset so far.
> > This can be treated as a nicer way of defining this offset, rather
> > than just hard-coding it in the source code itself.
> > 
> > In case there are more boards with this partition, a way of defining
> > the offset in the DTS can be added later and this value can then
> > be used as a default.  
> 
> +Marek
> 
> My understanding is that all these definitions, like memory address
> spaces, partitions, etc... belong to DTS file (or plat structures for
> boards which do not use DT) and not into source code or config options
> as they are describing hw layout.
> 
> There is ongoing process to move / convert SPI partitions from source
> files and config defines into DTS files, so for me this looks like a
> step backward...
> 
> But I would like to hear opinion also from other people.

This should be done in device tree. Device tree has bindings for such
things. You should be able to do something like this:

spi-flash@1 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		board_info: board-info@3E0000 {
			compatible = "nvmem-cells";
			label = "board-info";
			reg = <0x3E0000 0x1000>;
			read-only;
			#address-cells = <1>;
			#size-cells = <1>;

			mac_addr_eth0: mac-addr1@0 {
				reg = <0x0 0x6>;
			};

			mac_addr_eth1: mac-addr2@1 {
				reg = <0x6 0x6>;
			};
		};
	};
};

ethernet@30000 {
	nvmem-cells = <&mac_addr_eth0>;
	nvmem-cell-names = "mac-address";
};

Look at
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml

Also we need to add nvmem API into U-Boot and get rid of the ad-hoc
efuse/mac/hw_mac nonsense.

Marek

  reply	other threads:[~2021-10-09  9:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 12:09 [PATCH 1/2] arm: mvebu: Implement the mac command (Marvell hw_info) Robert Marko
2021-10-08 12:09 ` [PATCH 2/2] arm: mvebu: add Globalscale MOCHAbin support Robert Marko
2021-10-08 12:53 ` [PATCH 1/2] arm: mvebu: Implement the mac command (Marvell hw_info) Pali Rohár
2021-10-08 13:28   ` Luka Kovacic
2021-10-08 18:06     ` Pali Rohár
2021-10-09  9:42       ` Marek Behún [this message]
2021-10-09 10:09         ` Robert Marko
2021-10-09 10:29           ` Pali Rohár
2021-10-11 10:19             ` Luka Kovacic
2021-10-11 10:56               ` Marek Behún
2021-10-11 16:16                 ` Luka Kovacic
2021-10-13 14:44                   ` Marek Behún
2021-10-13 15:35                     ` Luka Kovacic

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=20211009114238.749090e8@thinkpad \
    --to=kabel@kernel.org \
    --cc=luka.kovacic@sartura.hr \
    --cc=luka.perkov@sartura.hr \
    --cc=pali@kernel.org \
    --cc=robert.marko@sartura.hr \
    --cc=sr@denx.de \
    --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.