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.

Write spi flash err on OMAPl138

Other Parts Discussed in Thread: OMAPL138

Hi :

    My system Uboot + Linux run on OMAPl138. In Uboot step, write Linux to spi flash is ok. Uboot write command : sf probe 0, sf erase 'flashstartaddr' 'erasesize', sf write 'memorystartaddr' 'flashstartaddr' 'writesize'.

    Then linux os startup ok. Write spiflash error In my application. Source code :

    fd = open("/dev/mtdblock5", O_RDWR); 

    if (fd < 0)    

    {        

       printf("open err.\n");        

      goto ERR_LABEL;    

    }

    ret = write(fd, acwritebuf, 256);    

    if (ret != 256)    

     {        

      printf("write err, ret = %d, err = %d\n", ret, errno);        

      perror("write err");        

      goto ERR_LABEL;    

   }

close(fd);

 

Result :

write err, ret = -1, err = 1

write err: Operation not permitted

 

Flash mtd infomation :

0x000000000000-0x000000010000 : "UBL"

0x000000010000-0x000000090000 : "U-Boot"

0x000000090000-0x0000000a0000 : "U-Boot-Env"

0x0000000a0000-0x000000320000 : "Kernel"

0x000000320000-0x000000720000 : "Filesystem"

0x000000700000-0x000000780000 : "ImageData0"

0x000000780000-0x000000800000 : "ImageData1"

  • Modify  board-da850-evm.c mtdblock5 mask_flags:

    Befor modify : 

    [5] = {   .name = "ImageData",   .offset = SZ_8M - SZ_1M - SZ_512K,   .size = SZ_1M + SZ_512K,   .mask_flags = MTD_WRITEABLE,  },

    After Modify :

    [5] = {   .name = "ImageData",   .offset = SZ_8M - SZ_1M - SZ_512K,   .size = SZ_1M + SZ_512K,   .mask_flags = 0,  },

     

    When write spi flash, such as result :

    root@arago:~# flash

    mtdblock.c mtdblock_open

    flash test geteu######### do_blktrans_request 1

    id() = 0, getuid######### do_blktrans_request 2

    () = 0

    write start

    ######### do_blktrans_request 1

    ######### do_blktrans_request 2

    mtdblock.c mtdblock_writesect

    mtdblock.c do_cached_write

    kernel BUG at arch/arm/mm/dma-mapping.c:425!

    Unable to handle kernel NULL pointer dereference at virtual address 00000000

    pgd = c0004000

    [00000000] *pgd=00000000

    Internal error: Oops: 817 [#1] PREEMPT

    last sysfs file: /sys/kernel/uevent_seqnum

    Modules linked in: dm365mmap dsplinkk cmemk ipv6

    CPU: 0    Not tainted  (2.6.37 #55)

    PC is at __bug+0x20/0x2c

    LR is at schedule+0x368/0x3f0

    pc : [<c00322dc>]    lr : [<c031e80c>]    psr: 60000013

    sp : c7833e80  ip : c7833d90  fp : c7833e8c

    r10: 00000001  r9 : 00010000  r8 : c0419bb0

    r7 : 00000002  r6 : c797be50  r5 : c78a7548  r4 : 00010000

    r3 : 00000000  r2 : 00000000  r1 : c73c9d80  r0 : 00000033

    Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel