This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

no /dev/mtd entry for my NOR flash

Hi All,

           I don't see "/dev/mtd" entry for my NOR device. Is this really required? or will there be someother device entry for NOR. I pass these bootargs. I'm using a ramdisk as my filesystem.

console=ttyO0,115200n8 root=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M rootfstype=ext2 mtdoops.mtddev=3 earlyprintk mtdparts=physmap-flash.0:512k(u-boot),128k(u-boot-env1),128k(u-boot-env2),5m(kernel),128k(fdt),-(rootfs)

This is my dts entry for NOR,

 norflash_pins: pinmux_norflash_pins {
172                         pinctrl-single,pins = <
173
174                                 /*Data lines*/
175                                 0x0 (INPUT_EN | MUX_MODE0)      /* gpmc_ad0.gpmc_ad0 */
176                                 0x4 (INPUT_EN | MUX_MODE0)      /* gpmc_ad1.gpmc_ad1 */
177                                 0x8 (INPUT_EN | MUX_MODE0)      /* gpmc_ad2.gpmc_ad2 */
178                                 0xc (INPUT_EN | MUX_MODE0)      /* gpmc_ad3.gpmc_ad3 */
179                                 0x10 (INPUT_EN | MUX_MODE0)     /* gpmc_ad4.gpmc_ad4 */
180                                 0x14 (INPUT_EN | MUX_MODE0)     /* gpmc_ad5.gpmc_ad5 */
181                                 0x18 (INPUT_EN | MUX_MODE0)     /* gpmc_ad6.gpmc_ad6 */
182                                 0x1c (INPUT_EN | MUX_MODE0)     /* gpmc_ad7.gpmc_ad7 */
183                                 0x20 (INPUT_EN | MUX_MODE0)     /* gpmc_ad8.gpmc_ad8 */
184                                 0x24 (INPUT_EN | MUX_MODE0)     /* gpmc_ad9.gpmc_ad9 */
185                                 0x28 (INPUT_EN | MUX_MODE0)     /* gpmc_ad10.gpmc_ad10 */
186                                 0x2c (INPUT_EN | MUX_MODE0)     /* gpmc_ad11.gpmc_ad11 */
187                                 0x30 (INPUT_EN | MUX_MODE0)     /* gpmc_ad12.gpmc_ad12 */
188                                 0x34 (INPUT_EN | MUX_MODE0)     /* gpmc_ad13.gpmc_ad13 */
189                                 0x38 (INPUT_EN | MUX_MODE0)     /* gpmc_ad14.gpmc_ad14 */
190                                 0x3c (INPUT_EN | MUX_MODE0)     /* gpmc_ad15.gpmc_ad15 */
191
192                                 /*Addr lines*/
193                                 0xA0 (PIN_INPUT | MUX_MODE7)    /* lcd_data0.gpio2[6]*/
194                                 0xA4 (PIN_INPUT | MUX_MODE1)    /* lcd_data1.gpmc_a1_mux1*/
195                                 0xA8 (PIN_INPUT | MUX_MODE1)    /* lcd_data2.gpmc_a2_mux1*/
196                                 0xAC (PIN_INPUT | MUX_MODE1)    /* lcd_data3.gpmc_a3_mux1*/
197                                 0xB0 (PIN_INPUT | MUX_MODE1)    /* lcd_data4.gpmc_a4_mux1*/
198                                 0xB4 (PIN_INPUT | MUX_MODE1)    /* lcd_data5.gpmc_a5_mux1*/
199                                 0xB8 (PIN_INPUT | MUX_MODE1)    /* lcd_data6.gpmc_a6_mux1*/
200                                 0xBC (PIN_INPUT | MUX_MODE1)    /* lcd_data7.gpmc_a7_mux1*/
201                                 0xe0 (PIN_INPUT | MUX_MODE1)    /* lcd_vsync.gpmc_a8_mux1*/
202                                 0xe4 (PIN_INPUT | MUX_MODE1)    /* lcd_hsync.gpmc_a9_mux1*/
203                                 0xe8 (PIN_INPUT | MUX_MODE1)    /* lcd_pclk.gpmc_a10_mux1*/
204                                 0xec (PIN_INPUT | MUX_MODE1)    /* lcd_ac_bias_en.gpmc_a11_mux1*/
205                                 0xC0 (PULL_DISABLE | MUX_MODE1) /* lcd_data8.gpmc_a12*/
206                                 0xC4 (PULL_DISABLE | MUX_MODE1) /* lcd_data9.gpmc_a13*/
207                                 0xC8 (PULL_DISABLE | MUX_MODE1) /* lcd_data10.gpmc_a14*/
208                                 0xCC (PULL_DISABLE | MUX_MODE1) /* lcd_data11.gpmc_a15*/
209                                 0xD0 (PULL_DISABLE | MUX_MODE1) /* lcd_data12.gpmc_a16_mux1*/
210                                 0xD4 (PULL_DISABLE | MUX_MODE1) /* lcd_data13.gpmc_a17_mux1*/
211                                 0xD8 (PULL_DISABLE | MUX_MODE1) /* lcd_data14.gpmc_a18_mux1*/
212                                 0xDC (PULL_DISABLE | MUX_MODE1) /* lcd_data15.gpmc_a19_mux1*/
213                                 0xF0 (PIN_OUTPUT_PULLUP | MUX_MODE1) /*mmc0_dat3.gpmc_a20_mux1*/
214                                 0xF4 (PIN_OUTPUT_PULLUP | MUX_MODE1) /*mmc0_dat2.gpmc_a21_mux1*/
                                                                                                                                                       214,1-8       42%
 0xF8 (PIN_OUTPUT_PULLUP | MUX_MODE1) /*mmc0_dat1.gpmc_a22_mux1*/
216                                 0xFC (PIN_OUTPUT_PULLUP | MUX_MODE1) /*mmc0_dat0.gpmc_a23_mux1*/
217                                 0x100 (PIN_OUTPUT_PULLUP | MUX_MODE1) /*mmc0_clk.gpmc_a24_mux1*/
218
219                                 /*Control lines*/
220                                 0x70 (PIN_INPUT_PULLUP | MUX_MODE0)     /* gpmc_wait0.gpmc_wait0 */
221                                 0x7c (PIN_INPUT_PULLUP | MUX_MODE0)     /* gpmc_csn0.gpmc_csn0  */
222                                 0x94 (PIN_OUTPUT_PULLUP | MUX_MODE0)    /* gpmc_oen_ren.gpmc_oen_ren */
223                                 0x98 (PIN_INPUT_PULLUP | MUX_MODE0)     /* gpmc_wen.gpmc_wen */
224                         >;
225                 };


 &gpmc{
383                 status = "okay";
384                 pinctrl-names = "default";
385                 pinctrl-0 = <&norflash_pins>;
386                 ranges = <0 0 0x08000000 0x02000000>;   /* CS0: NOR */
387                 nor@0,0 {
388                 compatible = "cfi-flash";
389                 linux,mtd-name= "amd,s29gl256s";
390                 #address-cells = <1>;
391                 #size-cells = <1>;
392                 reg = <0 0 0x02000000>;
393                 bank-width = <2>;
394
395                 gpmc,mux-add-data;
396                 gpmc,cs-on-ns = <0>;
397                 gpmc,cs-rd-off-ns = <186>;
398                 gpmc,cs-wr-off-ns = <186>;
399                 gpmc,adv-on-ns = <12>;
400                 gpmc,adv-rd-off-ns = <48>;
401                 gpmc,adv-wr-off-ns = <48>;
402                 gpmc,oe-on-ns = <54>;
403                 gpmc,oe-off-ns = <168>;
404                 gpmc,we-on-ns = <54>;
405                 gpmc,we-off-ns = <168>;
406                 gpmc,rd-cycle-ns = <186>;
407                 gpmc,wr-cycle-ns = <186>;
408                 gpmc,access-ns = <114>;
409                 gpmc,page-burst-access-ns = <6>;
410                 gpmc,bus-turnaround-ns = <12>;
411                 gpmc,cycle2cycle-delay-ns = <18>;
412                 gpmc,wr-data-mux-bus-ns = <90>;
413                 gpmc,wr-access-ns = <186>;
414                 gpmc,cycle2cycle-samecsen;
415                 gpmc,cycle2cycle-diffcsen;
416
417                 partition@0 {
418                         label = "uboot";
419                         reg = <0 0x80000>;
420                 };
421                 partition@0x80000 {
422                         label = "1st-copy-uboot-env";
423                         reg = <0x80000 0x40000>;
424                 };
425                 partition@0xA0000 {
426                         label = "2nd-copy-uboot-env";     reg = <0xA0000 0x40000>;
428                 };
429                 partition@0xC0000 {
430                         label = "linux-kernel";
431                         reg = <0xC0000 0x400000>;
432                 };
433                 partition@0x4C0000 {
434                         label = "userland";
435                         reg = <0x4C0000 0x1B40000>;
436                 };
437         };
438 };


Regards,

Gangadhar│

  • You need the "/dev/mtd" entries to access the NOR from user space. I think you should define your partition using one method only, ie cmdline or DTS but not both. Uncertain which method takes precedence. Note that your cmdline and DTS partition sizes do not match.

    Your kernel config might need  CONFIG_DEVTMPFS=y and CONFIG_DEVTMPFS_MOUNT=y. Those are required for auto-creation of device nodes.

    The pinmux settings are not involved with the device file creation. They do matter in the functionality. I assume you are on one of the AM335x or DM81xx processors. No experience with those. I can't comment on that.

  • was using tisdk_defconfig for linux where they had not enable NOR flash.

    Selected,

    RAM/ROM/Flash chip drivers
    ---->Support for AMD/Fujitsu/Spansion flash chips in kernel config and got the prints,

    amd,s29gl256s: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000001 Chip ID 0x002201
    [    1.778916] Amd/Fujitsu Extended Query Table at 0x0040
    [    1.784664]   Amd/Fujitsu Extended Query version 1.5.
    [    1.790063] number of CFI chips: 1
    [    1.794405] 7 ofpart partitions found on MTD device amd,s29gl256s
    [    1.800890] Creating 7 MTD partitions on "amd,s29gl256s":
    [    1.806712] 0x000000000000-0x000000080000 : "uboot"
    [    1.815149] 0x000000080000-0x0000000c0000 : "1st-copy-uboot-env"
    [    1.824601] 0x0000000a0000-0x0000000e0000 : "2nd-copy-uboot-env"
    [    1.832890] mtdoops: Attached to MTD device 2
    [    1.839275] 0x0000000c0000-0x0000005c0000 : "linux-kernel"
    [    1.848116] 0x0000005c0000-0x0000005e0000 : "fdt"
    [    1.856224] 0x0000005e0000-0x000000be0000 : "uramdisk"
    [    1.864845] 0x000000c20000-0x000002c1ffff : "userland"

    and /dev had entries,

    mtd0, .... mtd6
    mtd0ro .... mtd6ro
    mtdblock0 .... mtdblock6

    Regards,

    Gangadhar