public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Manojkiran Eda <manojkiran.eda@gmail.com>
To: linux-mtd@lists.infradead.org
Subject: mtd0 device is missing in /sys/class/mtd
Date: Thu, 28 Dec 2023 22:08:51 +0530	[thread overview]
Message-ID: <5AF66848-442A-460B-BAD8-31818FDC9DAC@gmail.com> (raw)

Hi All,

I was as beginner in linux device driver development, and recently I was working on a device driver for espi protocol and was stuck with a problem.

I have an mtd device driver through which one could access the NOR flash connected to the other end of  espi bus. The driver seems to have probed successfully , I see an entry for my mtd device in /proc/mtd but , I dont see an entry for my mtd device in the /sys/class/mtd.

Here are few logs of interest :

root@mybox:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 04000000 00001000 "aspeed-espi-flash” <<<<<—— This is my mtd device
mtd1: 04000000 00010000 "bmc"
mtd2: 000e0000 00010000 "u-boot"
mtd3: 00020000 00010000 "u-boot-env"
mtd4: 00900000 00010000 "kernel"
mtd5: 02000000 00010000 "rofs"
mtd6: 01600000 00010000 "rwfs"
mtd7: 04000000 00010000 "alt-bmc"
mtd8: 000e0000 00010000 "alt-u-boot"
mtd9: 00020000 00010000 "alt-u-boot-env"
mtd10: 00900000 00010000 "alt-kernel"
mtd11: 02000000 00010000 "alt-rofs"
mtd12: 01600000 00010000 "alt-rwfs”


root@mybox:/sys/class/mtd# ls
mtd1     mtd10ro  mtd11ro  mtd12ro  mtd2     mtd3     mtd4     mtd5     mtd6     mtd7     mtd8     mtd9
mtd10    mtd11    mtd12    mtd1ro   mtd2ro   mtd3ro   mtd4ro   mtd5ro   mtd6ro   mtd7ro   mtd8ro   mtd9ro

I was expecting mtd0 to be present in the /sys/class/mtd, but its not there.

Looking at dmesg:

root@mybox:/sys/class/mtd# dmesg | grep -ie mtd -A5 -ie espi
[    0.685006] Entered the aspeed_espi_ctrl_probe function
[    0.690990] device matched :  1
[    0.699225] espi alloc started
[    0.704726] espi read from device tree, flash size :  67108864
[    0.712416] espi flash enabled
[    0.716572] espi flash channel is ready
[    0.720940] espi flash allocation completed
[    0.725259] aspeed-espi-ctrl 1e6ee000.espi-ctrl: module loaded
--
[    0.962764] 5 fixed-partitions partitions found on MTD device bmc
[    0.969675] Creating 5 MTD partitions on "bmc":
[    0.974776] 0x000000000000-0x0000000e0000 : "u-boot"
[    0.981982] 0x0000000e0000-0x000000100000 : "u-boot-env"
[    0.989557] 0x000000100000-0x000000a00000 : "kernel"
[    0.996772] 0x000000a00000-0x000002a00000 : "rofs"
[    1.003759] 0x000002a00000-0x000004000000 : "rwfs"
--
[    1.048304] 5 fixed-partitions partitions found on MTD device alt-bmc
[    1.055563] Creating 5 MTD partitions on "alt-bmc":
[    1.061096] 0x000000000000-0x0000000e0000 : "alt-u-boot"
[    1.068672] 0x0000000e0000-0x000000100000 : "alt-u-boot-env"
[    1.076607] 0x000000100000-0x000000a00000 : "alt-kernel"
[    1.084211] 0x000000a00000-0x000002a00000 : "alt-rofs"
[    1.091594] 0x000002a00000-0x000004000000 : "alt-rwfs”

and the mtd devices listed in /sys/class/mtd from mtd1 through mtd12 are basically from the partitions list above.

root@mybox:/sys/class/mtd# for dir in *; do cat $dir/name; done
bmc
alt-kernel
alt-rofs
alt-rwfs
u-boot
u-boot-env
kernel
rofs
rwfs
alt-bmc
alt-u-boot
alt-u-boot-env

Does anyone know what could be the possible reason for the problem ? Any hints/help would be appreciated.

Thanks,
Manoj


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

             reply	other threads:[~2023-12-28 16:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 16:38 Manojkiran Eda [this message]
2023-12-31 13:16 ` mtd0 device is missing in /sys/class/mtd Joakim Tjernlund
     [not found]   ` <F86A353E-FFA9-4C8A-88D4-C726029CB27B@gmail.com>
2024-01-02 11:54     ` Manojkiran Eda
2024-01-02 17:21     ` Manojkiran Eda

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=5AF66848-442A-460B-BAD8-31818FDC9DAC@gmail.com \
    --to=manojkiran.eda@gmail.com \
    --cc=linux-mtd@lists.infradead.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