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.

Defining the SPI flash MTD block partition

Hello,

I am working on a DM8148 and am booting with SPI. I am working with the uboot and the linux kernel that came with EZSDK 5.05.02.

The instructions both in the EZSDK docs folder as well as here both state clearly that the filesystem needs to be burned to address 0x2E2000, and expects that flash location to be mounted to partition /dev/mtdblock4. 

From TI documentation referenced in link above:


|             |-->0x002E2000-> Filesystem start
+-------------+-->0x00400000-> Filesystem end 
...
console=ttyO0,115200n8 root=/dev/mtdblock<partion_id> [ro|rw] rootfstype=jffs2 mem=100M earlyprintk
rootfs on NAND ==> partion_id should be 4 
rootfs on SPI ==> partion_id should be 4 
rootfs on NOR ==> partion_id should be 3
NOTE: If the kernel is compiled with both SPI and NAND support then /dev/mtdblock9 should be used for NAND. 
If the kernel is compiled with both SPI and NOR support then /dev/mtdblock7 should be used for SPI
...
In case if you want readonly filesystem, 
setenv bootargs 'console=ttyO0,115200n8 root=/dev/mtdblock4 ro rootfstype=jffs2 mem=100M earlyprintk'


Where in the linux kernel or uboot source do I configure the mtdblock partition locations within the SPI flash? To reword this question, if I wanted to move the location of mtdblock4 from 0x2e2000 to something else, where in the code do I make this change?

  • Jose,

    Refer to the below wiki page:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_McSPI_Driver_User_Guide#Supporting_SPI_Flashes

    Regards,
    Pavel

  • Pavel Botev said:

    Jose,

    Refer to the below wiki page:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_McSPI_Driver_User_Guide#Supporting_SPI_Flashes

    Regards,
    Pavel

    Thank you for your reply Pavel. While looking at the link you provided it suggests modifying the file "arch/arm/mach-omap2/board-ti8168evm.c". Within this file I also noticed the string "m25p80" is the modalias they are using. I am using an n25p128a.

    I already had to make a mod to uboot in order for it to talk to my SPI device. Do I need to make updates to this file to account for the different SPI device here as well or is this sort of change not necessary?

  • Jose,

    Jose E Rodriguez said:
    Thank you for your reply Pavel. While looking at the link you provided it suggests modifying the file "arch/arm/mach-omap2/board-ti8168evm.c"

    This wiki page is common for the TI81xx devices (ti816x and ti814x). We have there:

    To modify partition layout on SPI flash following structure has to be modified in arch/arm/mach-omap2/board-ti8168evm.c and arch/arm/mach-omap2/board-ti8148evm.c

    As you are using the DM8148 device, you should use file arch/arm/mach-omap2/board-ti8148evm.c.

    When you have different SPI device than what is used on the DM814x EVM, then you should port it:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_McSPI_Driver_User_Guide#Porting_to_custom_hardware

    Regards,
    Pavel

  • Pavel,

    Pavel Botev said:
    As you are using the DM8148 device, you should use file arch/arm/mach-omap2/board-ti8148evm.c.

    This is the file I have been looking at and editing. I had made a copy and paste error when creating my previous post. 

    Pavel Botev said:
    When you have different SPI device than what is used on the DM814x EVM, then you should port it:

    This documentation although very useful has some gaps, if at least with thought progression and perhaps some clarity.

    I have modified drivers/mtd/devices/m25p80.c and added my device to the m25p_ids list.

    I have modified arch/arm/mach-omap2/board-ti8148evm.c to look like this:

    my modified version of arch/arm/mach-omap2/board-ti8148evm.c said:

    const struct flash_platform_data ti8148_spi_flash = {

    .type = "n25p128a",
    .name = "spi_flash",
    .parts = ti8148_spi_partitions,
    .nr_parts = ARRAY_SIZE(ti8148_spi_partitions),
    };

    struct spi_board_info __initdata ti8148_spi_slave_info[] = {
    {
    .modalias = "m25p80",
    .platform_data = &ti8148_spi_flash,
    .irq = -1,
    .max_speed_hz = 75000000,
    .bus_num = 1,
    .chip_select = 0,
    },
    };

    I made assumptions on a couple things here. I added my device to the m25p list under the m25p80.c file. I made the assumption that the .modalias had to be set to "m25p80" so that it would use the contents in m25p80.c. Following this assumption, I changed the .type to be equal to the device I have, which is the n25p128a.

    Another thing that confused me a bit was this

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_McSPI_Driver_User_Guide said:
    Enable W25X32 SPI flash support. This step is mandatory if for using root file-system on SPI flash.

    It sounds like I need w25x32 for something in order to mount a filesystem from flash, which what I am trying to do. This made me hesitant to want to change the .type from w25x32 (originally value) to n25p128a (my device id). 

    Did I do this right? or am I not following the directions on the wiki correctly?

  • Jose,

    The DM814x EVM has W25X32VSFIG SPI flash hardware/chip and is using the m25p80 SPI slave MTD flash driver/software. Thus we have .type="w25x32" and .modalias="m25p80" into the board-ti8148evm.c file. And the W25X32 SPI flash is supported from the m25p80 driver (m25p80.c):

    static const struct spi_device_id m25p_ids[] = {

    /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */

    { "w25x32", INFO(0xef3016, 0, 64 * 1024,  64, SECT_4K) },

    };

     

    Jose E Rodriguez said:
    I made assumptions on a couple things here. I added my device to the m25p list under the m25p80.c file. I made the assumption that the .modalias had to be set to "m25p80" so that it would use the contents in m25p80.c. Following this assumption, I changed the .type to be equal to the device I have, which is the n25p128a.

    I think this is the correct approach. But I can not find N25P128A SPI flash hardware/chip, can you provide me a link to it (datasheet)?

    Regards,
    Pavel

  • Jose,

    Jose E Rodriguez said:

    It sounds like I need w25x32 for something in order to mount a filesystem from flash, which what I am trying to do. This made me hesitant to want to change the .type from w25x32 (originally value) to n25p128a (my device id). 

    Did I do this right? or am I not following the directions on the wiki correctly?

    I think you should change the .type from the default (w25x32) to your specific SPI chip. This is stated in the wiki:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_McSPI_Driver_User_Guide

    The .type string here selects W25X32 SPI flash, which has to be modified in case of new SPI flash.

    We have the same direction for the AM335x EVM, which has W25Q64 SPI chip and uses the M25P80 driver:

    http://processors.wiki.ti.com/index.php/AM335x_McSPI_Driver%27s_Guide

    Regards,
    Pavel

  • Jose,

    Jose E Rodriguez said:

    Another thing that confused me a bit was this

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_McSPI_Driver_User_Guide said:
    Enable W25X32 SPI flash support. This step is mandatory if for using root file-system on SPI flash.

    I think this step is valid not only for W25X32 chip, but for most SPI flash chips.

    In DM814x EVM we have W25X32 chip, and we have:

    Enable W25X32 SPI flash support. This step is mandatory if for using root file-system on SPI flash.

     <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)


    In AM335x EVM we have W25Q64 chip, and we have:

    Enable W25Q64 SPI flash support. This step is mandatory if for using root file-system on SPI flash.
    <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)

    So, this steps should be also valid for your specific flash device.

    Regards,
    Pavel
  • Pavel,

    Thanks you for your replies. 

    Pavel Botev said:
    I think this is the correct approach. But I can not find N25P128A SPI flash hardware/chip, can you provide me a link to it (datasheet)?

    http://www.micron.com/parts/nor-flash/serial-nor-flash/n25q128a11ese40f?pc=%7bC773B16B-1EB4-4A60-B273-EB701612E90D%7d

    This is my addition to the m25p80.c file:

     

    my modified m25p80.c file said:

    ...

    /* ST Microelectronics -- newer production may have feature updates */
    { "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) },
    { "m25p10", INFO(0x202011, 0, 32 * 1024, 4, 0) },
    { "m25p20", INFO(0x202012, 0, 64 * 1024, 4, 0) },
    { "m25p40", INFO(0x202013, 0, 64 * 1024, 8, 0) },
    { "m25p80", INFO(0x202014, 0, 64 * 1024, 16, 0) },
    { "m25p16", INFO(0x202015, 0, 64 * 1024, 32, 0) },
    { "m25p32", INFO(0x202016, 0, 64 * 1024, 64, 0) },
    { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) },
    { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) },
    { "n25p128a", INFO(0x203018, 0, 64 * 1024, 256, 0) }, // ADDED THIS LINE

    ...

    Jose

  • Jose,

    Jose E Rodriguez said:

    I think this is the correct approach. But I can not find N25P128A SPI flash hardware/chip, can you provide me a link to it (datasheet)?

    http://www.micron.com/parts/nor-flash/serial-nor-flash/n25q128a11ese40f?pc=%7bC773B16B-1EB4-4A60-B273-EB701612E90D%7d

    [/quote]

    So this is N25Q128A11 SPI flash chip.

    Jose E Rodriguez said:
    { "n25p128a", INFO(0x203018, 0, 64 * 1024, 256, 0) }, // ADDED THIS LINE

    Please note that DM814x PSP linux kernel (linux-2.6.37-psp04.04.00.01) is based on 2.6.37. While in the latest 3.15 linux kernel, we have that N25Q128A11 SPI flash chip supported in the m25p80.c file:

    http://lxr.free-electrons.com/source/drivers/mtd/devices/m25p80.c

    static const struct spi_device_id m25p_ids[] = {

            /* Micron */
           { "n25q064",     INFO(0x20ba17, 0, 64 * 1024,  128, 0) },
           { "n25q128a11",  INFO(0x20bb18, 0, 64 * 1024,  256, 0) },
    { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, 0) }, { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K) }, { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K) },

    Regards,
    Pavel