Hello,
I'm currently experiencing some problems with using MTD partitions in combination with S25FL128P SPI Flash from Spansion. I have defined which partitions should be created, but the don't end up in /dev/mtdblock0 and /dev/mtdblock1. I also don't get a /dev/mtd device. Could some here please point me in a direction where the source of my problem might lie?
I'm using the m25p80 SPI Flash driver and the Davinci SPI driver. Since the default Linux support package delivered with the OMAP L-137 processor only supports Winbond SPI Flash mounted on the EVM I updated the m25p80 driver since it supports the S25FL128P in the current git tree. The patches I applied can be found below.
I noticed that instead of the include/linux/spi/mtd_spi_flash.h the much simpler include/linux/spi/flash.h is used. I assume this cannot be the source of the problem. Is this assumption correct?
root@10.3.3.130:/sys/devices/platform# ls
da8xx_lcdc.0 emac_davinci.1 i2c_davinci.1 ohci.0 serial8250.0
davinci-mmc.0 eqep.0 i2c_davinci.2 rtc-da8xx.0 uevent
dm_spi.0 eqep.1 musb_hdrc serial8250 watchdog
root@10.3.3.130:/sys/devices/platform#
TCP reno registered
mxsp_spi: platform_device_register: 0
mxsp_spi: spi_register_board_info: 0
mxsp_spi: mxsp_spi_register: 0
sanity check
Well I changed some files to try en get it to work, I'll try to sum them up as complete as possible.
static struct davinci_spi_platform_data mxsp_spi_pdata0 = {
.version = DAVINCI_SPI_VERSION_2,
.num_chipselect = 1,
.clk_name = "SPI0CLK",
};
static struct resource mxsp_spi_resources0[] = {
[0] = {
.start = DA8XX_SPI0_BASE,
.end = DA8XX_SPI0_BASE + 0xfff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_DA8XX_SPINT0,
.end = IRQ_DA8XX_SPINT0,
.flags = IORESOURCE_IRQ,
[2] = {
.start = DA8XX_DMACH_SPI0_RX,
.end = DA8XX_DMACH_SPI0_RX,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_RX_CHAN,
[3] = {
.start = DA8XX_DMACH_SPI0_TX,
.end = DA8XX_DMACH_SPI0_TX,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_TX_CHAN,
[4] = {
.start = EVENTQ_1,
.end = EVENTQ_1,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_EVENT_Q,
static struct platform_device mxsp_spi_pdev0 = {
.name = "dm_spi",
.id = 0,
.resource = mxsp_spi_resources0,
.num_resources = ARRAY_SIZE(mxsp_spi_resources0),
.dev = {
.platform_data = &mxsp_spi_pdata0,
static struct mtd_partition mxsp_partitions[] = {
.name = "U-Boot Environment",
.offset = 0x100000,
.size = SZ_64K,
.mask_flags = MTD_WRITEABLE,
.name = "Firmware",
.offset = 0x200000,
.size = 0xb00000,
.mask_flags = 0,
struct davinci_spi_config_t s25fl128_spi_cfg = {
.wdelay = 0,
.odd_parity = 0,
.parity_enable = 0,
.wait_enable = 0,
.lsb_first = 0,
.timer_disable = 0,
.clk_high = 0,
.phase_in = 1,
.clk_internal = 1,
.loop_back = 0,
.cs_hold = 1,
.intr_level = 0,
.pin_op_modes = SPI_OPMODE_SPISCS_4PIN,
#ifndef CONFIG_SPI_INTERRUPT
.poll_mode = 1,
#endif
struct flash_platform_data s25fl128_spi_flash = {
.name = "Spansion SPI Flash",
.parts = mxsp_partitions,
.nr_parts = ARRAY_SIZE(mxsp_partitions),
.type = "25sl12800",
static struct spi_board_info mxsp_spi_board_info0[] = {
.modalias = "spi_flash",
.platform_data = &s25fl128_spi_flash,
.controller_data = &s25fl128_spi_cfg,
.mode = SPI_MODE_0,
.max_speed_hz = 37500000, /* max sample rate at 3V */
.bus_num = 0,
.chip_select = 0,
static int __init mxsp_spi_register(struct platform_device *pdev,
struct spi_board_info *bi,
unsigned int bi_size)
{
int ret = platform_device_register(pdev);
printk(KERN_INFO "mxsp_spi: platform_device_register: %d\n", ret);
if (ret)
return ret;
ret = spi_register_board_info(bi, bi_size);
printk(KERN_INFO "mxsp_spi: spi_register_board_info: %d\n", ret);
}
static int __init mxsp_spi_board_init(void)
int ret = mxsp_spi_register(&mxsp_spi_pdev0, mxsp_spi_board_info0,
ARRAY_SIZE(mxsp_spi_board_info0));
printk(KERN_INFO "mxsp_spi: mxsp_spi_register: %d\n", ret);
printk("sanity check\n");
I know this file is executed because the Linux serial output tells me it's all ok, see the status above.
#
# Memory Technology Devices (MTD)
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_CONCAT is not set
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_CMDLINE_PARTS is not set
# CONFIG_MTD_AFS_PARTS is not set
# User Modules And Translation Layers
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
# RAM/ROM/Flash chip drivers
# CONFIG_MTD_CFI is not set
# CONFIG_MTD_JEDECPROBE is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set
# CONFIG_MTD_OBSOLETE_CHIPS is not set
# Self-contained MTD device drivers
# CONFIG_MTD_DATAFLASH is not set
CONFIG_MTD_M25P80=y
CONFIG_M25PXX_USE_FAST_READ=y
# CONFIG_MTD_SPI_FLASH is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_MTDRAM is not set
# CONFIG_MTD_BLOCK2MTD is not set
Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=fa0a8c71f352d89c54f2d3a92f7a8a97cdb7d9a4Fast read support: Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=2230b76b3838a37167f80487c694d8691248da9fErase block operation: Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=faff37508a104e9ec5285d5adecaab7e8dde472aAddition of the S25FL128P device: Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=d0e8c47c58575b9131e786edb488fd029eba443eError fixes: Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=daa847356a4f2b2722d78b389ec4f172f24fecd5 Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a3d3f73ccbd68b3557c4aaf9f6246ea21d922835 Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9168ab861ae3eb8942da61d884a5c1980ba98a5f Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7854643a91eade84112dca9768eeb8d32463d101 Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3f33b0aaac4e208579fe5aa2964857d4e9ba10c5Change erase timeout: Normal 0 false false false MicrosoftInternetExplorer4 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=cd1a6de7d4a492bf3405a6c070075a4cb8c90262
I tried to give as much information as possible. I don't have any idea where to look or how to debug this problem. Any help is welcome!
Thank you in advance,
Best regards
Normal 0 false false false MicrosoftInternetExplorer4
Problem solved! I didn't link the drivers correctly.
struct flash_platform_data s25fl128_spi_flash = { .name = "Spansion SPI Flash", .parts = mxsp_partitions, .nr_parts = ARRAY_SIZE(mxsp_partitions), .type = "s25sl12801",};static struct spi_board_info mxsp_spi_board_info0[] = { [0] = { .modalias = "m25p80", .platform_data = &s25fl128_spi_flash, .controller_data = &s25fl128_spi_cfg, .mode = SPI_MODE_0, .max_speed_hz = 1000000, /* max sample rate at 3V */ .bus_num = 0, .chip_select = 0, },};
I could only attach one file to a post, so here is another file related to the first post
This is the board file which holds the partition configuration.
Last but not least the Linux configuration.
ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". TI AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY TI. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM TI.
Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.