From: Sven Eckelmann <sven@narfation.org>
To: Ansuel Smith <ansuelsmth@gmail.com>
Cc: Michael Walle <michael@walle.cc>,
openwrt-devel@lists.openwrt.org,
Adrian Schmutzler <dev@schmutzler.it>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
linux-mtd@lists.infradead.org,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
linux-kernel@vger.kernel.org
Subject: nvmem: Defining cells on mtd created by mtdparts
Date: Sun, 10 Oct 2021 14:53:13 +0200 [thread overview]
Message-ID: <18728084.NGlc0Rocea@sven-desktop> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2047 bytes --]
Hi,
OpenWrt switched [1] their MAC address (from flash) retrieval code from their
mtd-mac-address based solution [2] to nvmem-cells. The mtd-mac-address based
solution had the benefit that it could find the correct partition by using
get_mtd_device_nm - which was label based. So a lookup for a partition which
was defined via mtdparts was absolutely no problem. This doesn't seem to be
the case for nvmem - at least not how it is integrated at the moment in
OpenWrt.
This means that the performed switch broke the vendor defined MAC addresses
when the u-boot must dynamically define the partitions via mtdpart - and where
fixed-partitions are not possible in the DT. The bootloaders used by the ath79
usually have no devicetree support and cannot modify the device tree (beside
the problem to get the sources for these bootloaders). These devices will now
only have random mac addresses.
Since there are most likely more devices out there which use mtdparts, I would
guess that there might already be a strategy out there which can be used to
define the nvmem-provider for mtdparts defined partitions. At least I saw that
Bartosz Golaszewski added all the mtd devices automatically as nvmem provider
in c4dfa25ab307 ("mtd: add support for reading MTD devices via the nvmem
API"). So there might also be something for nvmem-cells to find the correct
mtd instead of relying on the fixed-partitions registration + of_node (which
doesn't exist because it comes from mtdparts and not devicetree).
Right now nvmem_cell_get (actually __nvmem_device_get) in
nvmem_get_mac_address just return -517 (EPROBE_DEFER). So the nvmem_device is
not yet registered - which absolutely makes sense when mtdparts is used.
of_nvmem_find will just not be able to find the of_node for this partition
via bus_find_device_by_of_node because there is no such of_node for mtdparts
partitions.
Kind regards,
Sven
[1] https://github.com/openwrt/openwrt/pull/4041
[2] https://github.com/openwrt/openwrt/commit/5ae2e786395c7f9db0167ebe875be5df9502d8d8
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 144 bytes --]
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next reply other threads:[~2021-10-10 12:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-10 12:53 Sven Eckelmann [this message]
2021-10-11 7:06 ` nvmem: Defining cells on mtd created by mtdparts Sven Eckelmann
2021-10-12 18:24 ` Pratyush Yadav
2021-10-12 18:59 ` Sven Eckelmann
2021-10-15 8:20 ` Rafał Miłecki
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=18728084.NGlc0Rocea@sven-desktop \
--to=sven@narfation.org \
--cc=ansuelsmth@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=dev@schmutzler.it \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=michael@walle.cc \
--cc=openwrt-devel@lists.openwrt.org \
--cc=srinivas.kandagatla@linaro.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