<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-IN" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<div id="mail-editor-reference-message-container">
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt">Hi All,<br>
<br>
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.<br>
<br>
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.<br>
<br>
Here are few logs of interest :<br>
<br>
<b>root@mybox:~# cat /proc/mtd<br>
dev: size erasesize name<br>
mtd0: 04000000 00001000 "aspeed-espi-flash” <<<<<—— This is my mtd device<br>
mtd1: 04000000 00010000 "bmc"<br>
mtd2: 000e0000 00010000 "u-boot"<br>
mtd3: 00020000 00010000 "u-boot-env"<br>
mtd4: 00900000 00010000 "kernel"<br>
mtd5: 02000000 00010000 "rofs"<br>
mtd6: 01600000 00010000 "rwfs"<br>
mtd7: 04000000 00010000 "alt-bmc"<br>
mtd8: 000e0000 00010000 "alt-u-boot"<br>
mtd9: 00020000 00010000 "alt-u-boot-env"<br>
mtd10: 00900000 00010000 "alt-kernel"<br>
mtd11: 02000000 00010000 "alt-rofs"<br>
mtd12: 01600000 00010000 "alt-rwfs”</b><br>
<br>
<br>
<b>root@mybox:/sys/class/mtd# ls<br>
mtd1 mtd10ro mtd11ro mtd12ro mtd2 mtd3 mtd4 mtd5 mtd6 mtd7 mtd8 mtd9<br>
mtd10 mtd11 mtd12 mtd1ro mtd2ro mtd3ro mtd4ro mtd5ro mtd6ro mtd7ro mtd8ro</b> mtd9ro<br>
<br>
I was expecting mtd0 to be present in the /sys/class/mtd, but its not there.<br>
<br>
Looking at dmesg:<br>
<br>
<b>root@mybox:/sys/class/mtd# dmesg | grep -ie mtd -A5 -ie espi<br>
[ 0.685006] Entered the aspeed_espi_ctrl_probe function<br>
[ 0.690990] device matched : 1<br>
[ 0.699225] espi alloc started<br>
[ 0.704726] espi read from device tree, flash size : 67108864<br>
[ 0.712416] espi flash enabled<br>
[ 0.716572] espi flash channel is ready<br>
[ 0.720940] espi flash allocation completed<br>
[ 0.725259] aspeed-espi-ctrl 1e6ee000.espi-ctrl: module loaded<br>
--<br>
[ 0.962764] 5 fixed-partitions partitions found on MTD device bmc<br>
[ 0.969675] Creating 5 MTD partitions on "bmc":<br>
[ 0.974776] 0x000000000000-0x0000000e0000 : "u-boot"<br>
[ 0.981982] 0x0000000e0000-0x000000100000 : "u-boot-env"<br>
[ 0.989557] 0x000000100000-0x000000a00000 : "kernel"<br>
[ 0.996772] 0x000000a00000-0x000002a00000 : "rofs"<br>
[ 1.003759] 0x000002a00000-0x000004000000 : "rwfs"<br>
--<br>
[ 1.048304] 5 fixed-partitions partitions found on MTD device alt-bmc<br>
[ 1.055563] Creating 5 MTD partitions on "alt-bmc":<br>
[ 1.061096] 0x000000000000-0x0000000e0000 : "alt-u-boot"<br>
[ 1.068672] 0x0000000e0000-0x000000100000 : "alt-u-boot-env"<br>
[ 1.076607] 0x000000100000-0x000000a00000 : "alt-kernel"<br>
[ 1.084211] 0x000000a00000-0x000002a00000 : "alt-rofs"<br>
[ 1.091594] 0x000002a00000-0x000004000000 : "alt-rwfs”</b><br>
<br>
and the mtd devices listed in /sys/class/mtd from mtd1 through mtd12 are basically from the partitions list above.<br>
<br>
<b>root@mybox:/sys/class/mtd# for dir in *; do cat $dir/name; done<br>
bmc<br>
alt-kernel<br>
alt-rofs<br>
alt-rwfs<br>
u-boot<br>
u-boot-env<br>
kernel<br>
rofs<br>
rwfs<br>
alt-bmc<br>
alt-u-boot<br>
alt-u-boot-env</b><br>
<br>
Does anyone know what could be the possible reason for the problem ? Any hints/help would be appreciated.<br>
<br>
Thanks,<br>
Manoj<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>