<div dir="ltr"><div><div>Do you not forget to call rtems_blkdev_request_done in read routine of block device driver? <br></div>Also try to increase CONFIGURE_MAXIMUM_TASKS - bdbuf need some worker tasks.<br><br>>> <a href="https://github.com/jncronin/rpi-boot/blob/master/emmc.c" target="_blank">https://github.com/jncronin/rpi-boot/blob/master/emmc.c</a><br>
<br></div><div>Hmm. Implementation specific to Raspberry Pi is not good idea. It is better to separate MMC/SD protocol implementation and hardware support like in FreeBSD or Linux.<br></div><div><br>>> 
    Not sure how to approach this problem, as the logic seems right.
    Will do more testing in the meanwhile.<br></div><br>If you get stuck share your sources and let me know.<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-13 14:03 GMT+04:00 Andre Marques <span dir="ltr"><<a href="mailto:andre.lousa.marques@gmail.com" target="_blank">andre.lousa.marques@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="">
    <div>On 05/12/14 19:25, Andrey Mozzhuhin
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>I think you need start with simple tests without file
          systems and block device driver.<br>
        </div>
        <div>
          <div>Try read and write blocks with known patterns and check
            it on PC and Raspberry Pi.<br>
            <br>
          </div>
        </div>
      </div>
    </blockquote>
    <br></div>
    I have checked the data read by my emmc driver from the first two
    blocks (the ones it reads) on the RPi, and compared with an hexdump
    of those same two blocks on Linux, and there is a small mismatch at
    the middle of the first block.<br>
    <br>
    Not sure how to approach this problem, as the logic seems right.
    Will do more testing in the meanwhile.<div class=""><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>What are you use for MMC/SD protocol? Can I see it and
            block device driver somewhere?<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br></div>
    I'm porting the following code<br>
    <br>
    <a href="https://github.com/jncronin/rpi-boot/blob/master/emmc.c" target="_blank">https://github.com/jncronin/rpi-boot/blob/master/emmc.c</a><br>
    <br>
    and using the following SD card documentation<br>
    <br>
    Physical Layer Simplified Specification (3.01)  -
<a href="https://www.sdcard.org/downloads/pls/simplified_specs/archive/part1_301.pdf" target="_blank">https://www.sdcard.org/downloads/pls/simplified_specs/archive/part1_301.pdf</a><br>
    <br>
    Host Controller Simplified Specification (2.00) -
<a href="https://www.sdcard.org/downloads/pls/simplified_specs/archive/partA2_200.pdf" target="_blank">https://www.sdcard.org/downloads/pls/simplified_specs/archive/partA2_200.pdf</a><br>
    <br>
    and the raspberry soc datasheet: Broadcom BCM2835 Peripherals Guide
    (Chapter 5 - EMMC)
    <br><div><div class="h5">
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2014-05-12 20:23 GMT+04:00 Andre
          Marques <span dir="ltr"><<a href="mailto:andre.lousa.marques@gmail.com" target="_blank">andre.lousa.marques@gmail.com</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>Hello,<br>
                <br>
                I have used the pc386 BSP to mount the card (before your
                suggestions) using the fileio sample and it could read
                the card contents perfectly.<br>
                <br>
                Then I filled the card with zeros using dd on Linux,
                modified the fileio sample to format the card with
                msdos_format(dev, NULL) and then mounted it on the pc
                386 BSP fileio sample and I could write and read the
                card.<br>
                <br>
                On Linux I set the card with the necessary files for
                Raspberry, and when my driver tries to mount the card on
                the Raspberry Pi it reads the first 2 blocks (now 0 and
                1, because the card has no partition table) and hangs,
                just as before.<br>
                <br>
                I guess my driver is having some reading problems.
                <div>
                  <div><br>
                    <br>
                    On 05/05/14 19:30, Andrey Mozzhuhin wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div>
                  <blockquote type="cite">
                    <div dir="ltr">You can try to use SD Card in <span lang="en"><span>opposite</span></span>
                      direction:<br>
                      <div>0) fill SD Card with zeroes;<br>
                      </div>
                      1) format partition under RTEMS with
                      msdos_format() function;<br>
                      2) check that PC can read/write this SD Card;<br>
                      3) if PC fails to mount this partition - dump SD
                      Card and check that all data is on right sectors.<br>
                      <div><br>
                      </div>
                      <div class="gmail_extra"><br>
                        <br>
                        <div class="gmail_quote">2014-05-05 22:28
                          GMT+04:00 Andrey Mozzhuhin <span dir="ltr"><<a href="mailto:nopscmn@gmail.com" target="_blank">nopscmn@gmail.com</a>></span>:<br>
                          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                            <div dir="ltr">
                              <div>
                                <div>
                                  <div>
                                    <div>Hi, Andre<br>
                                      <br>
                                    </div>
                                    You can try to use SD Card in <span lang="en"><span>opposite</span></span>
                                    direction:<br>
                                  </div>
                                  <div>0) fill SD Card with zeroes;<br>
                                  </div>
                                  1) format partition under RTEMS with
                                  msdos_format() function;<br>
                                </div>
                                2) check that PC can read/write this SD
                                Card;<br>
                              </div>
                              3) if PC fails to mount this partition -
                              dump SD Card and check that all data is on
                              right sectors.<br>
                              <div><br>
                              </div>
                            </div>
                            <div class="gmail_extra"><br>
                              <br>
                              <div class="gmail_quote">2014-05-05 13:52
                                GMT+04:00 Andre Marques <span dir="ltr"><<a href="mailto:andre.lousa.marques@gmail.com" target="_blank">andre.lousa.marques@gmail.com</a>></span>:
                                <div>
                                  <div><br>
                                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
                                      <br>
                                      Following the problem in<br>
                                      <br>
                                      <a href="http://www.rtems.org/pipermail/rtems-devel/2014-April/006585.html" target="_blank">http://www.rtems.org/pipermail/rtems-devel/2014-April/006585.html</a><br>
                                      <br>
                                      I am now trying to mount the SD
                                      card partitions on RTEMS.<br>
                                      <br>
                                      Summarizing the process:<br>
                                      <br>
                                      1. rtems_io_register_driver (by
                                      calling my driver with
                                      CONFIGURE_APPLICATION_EXTRA_DRIVERS
                                      on hello sample)<br>
                                      <br>
                                      2. rtems_filesystem_make_dev_t (to
                                      get the device file)<br>
                                      <br>
                                      3.  rtems_disk_io_initialize<br>
                                      <br>
                                      4. rtems_disk_create_phys (to
                                      create the disk, at /dev/sdc0)<br>
                                      <br>
                                      5. rtems_bdpart_register_from_disk
                                      (to read and register the
                                      partitions)<br>
                                      <br>
                                      6. rtems_fsmount (to mount the
                                      partitions)<br>
                                      <br>
                                      For rtems_fsmount I am providing
                                      the following fs_table:<br>
                                      <br>
                                      rtems_fstab_entry fs_table [] = {<br>
                                         {<br>
                                           .source = "/dev/sdc0",<br>
                                           .target = "/mnt/p1",<br>
                                           .type = "dosfs",<br>
                                           .options =
                                      RTEMS_FILESYSTEM_READ_WRITE,<br>
                                           .report_reasons =
                                       RTEMS_FSTAB_ANY,<br>
                                           .abort_reasons =
                                      RTEMS_FSTAB_OK<br>
                                         },{<br>
                                           .source = "/dev/sdc01",<br>
                                           .target = "/mnt/p2",<br>
                                           .type = "dosfs",<br>
                                           .options =
                                      RTEMS_FILESYSTEM_READ_WRITE,<br>
                                           .report_reasons =
                                      RTEMS_FSTAB_ANY,<br>
                                           .abort_reasons =
                                      RTEMS_FSTAB_NONE<br>
                                         }<br>
                                       };<br>
                                      <br>
                                      The SD card has only one partition
                                      starting at block number 8192.<br>
                                      <br>
                                      After I call rtems_fsmount it
                                      calls my driver to read block 8192
                                      and 8193 and then hangs.<br>
                                      <br>
                                      I have tested the driver and It
                                      seems to have no problem reading
                                      single or multiple blocks.<br>
                                      <br>
                                      Any tips?<br>
                                      <br>
                                      Also I am using the following
                                      confdefs configuration (some
                                      values are exaggerated):<br>
                                      <br>
                                      #define
                                      CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>
                                      #define
                                      CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br>
                                      #define
                                      CONFIGURE_APPLICATION_NEEDS_LIBBLOCK<br>
                                      <br>
                                      #define CONFIGURE_FILESYSTEM_DOSFS<br>
                                      #define
                                      CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM<br>
                                      <br>
                                      #define
                                      CONFIGURE_APPLICATION_EXTRA_DRIVERS
                                      SD_CARD_DRIVER_TABLE_ENTRY<br>
                                      <br>
                                      #define
                                      CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
                                      20<br>
                                      <br>
                                      #define CONFIGURE_MAXIMUM_TASKS 2<br>
                                      #define CONFIGURE_MAXIMUM_DRIVERS
                                      10<br>
                                      <br>
                                      #define
                                      CONFIGURE_RTEMS_INIT_TASKS_TABLE<br>
                                      <br>
                                       #define
                                      CONFIGURE_INIT_TASK_STACK_SIZE (32
                                      * 1024)<br>
                                      <br>
                                      #define
                                      CONFIGURE_INITIAL_EXTENSIONS
                                      RTEMS_TEST_INITIAL_EXTENSION<br>
                                      <br>
                                      #define CONFIGURE_INIT<br>
                                      <br>
                                      --André Marques<br>
                                      <br>
_______________________________________________<br>
                                      rtems-devel mailing list<br>
                                      <a href="mailto:rtems-devel@rtems.org" target="_blank">rtems-devel@rtems.org</a><br>
                                      <a href="http://www.rtems.org/mailman/listinfo/rtems-devel" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br>
                                    </blockquote>
                                  </div>
                                </div>
                              </div>
                              <br>
                            </div>
                          </blockquote>
                        </div>
                        <br>
                      </div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
rtems-devel mailing list
<a href="mailto:rtems-devel@rtems.org" target="_blank">rtems-devel@rtems.org</a>
<a href="http://www.rtems.org/mailman/listinfo/rtems-devel" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-devel</a>
</pre>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>