<div dir="ltr"><div><div><div>Hi,<br><br>Yes Sebastian, that change was not required. I have rebased, removing that change and have pushed the same. <a href="https://github.com/spark1729/rtems-libbsd/commits/rpi_sd_card" target="_blank">Link</a><br><br></div>Andre, as per your feedback, I have removed the ofw bus. <br><br></div>In the latest commit I have followed the FreeBSD port guidelines given libbsd.txt using the tools to port the code. <br><br>Github Link : <a href="https://github.com/spark1729/rtems-libbsd/commits/rpi_sd_card" target="_blank">Link</a><br><br><a href="https://github.com/spark1729/rtems-libbsd/commits/rpi_sd_card" target="_blank"> </a></div><div>These files have been added to libbsd.py that were ported to the rtems-libbsd tree from the FreeBSD one using freebsd-to-rtems.py<br></div><div><div>       sys/arm/broadcom/bcm2835/bcm2835_dma.c<br>       sys/arm/broadcom/bcm2835/bcm2835_dma.h<br>       sys/arm/broadcom/bcm2835/bcm2835_mbox.c<br>       sys/arm/broadcom/bcm2835/bcm2835_mbox.h<br>       sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h<br>       sys/arm/broadcom/bcm2835/bcm2835_sdhci.c<br>       sys/arm/broadcom/bcm2835/bcm2835_vcbus.h<br><br></div><div>Changes have been done on top of this to<br>>>remove the dependency on the ofw bus<br></div><div>>>make it compatible with RTEMS <br></div><div><br></div><div>The corresponding changes are done to libbsd_waf.py and waf build completes successfully. <br></div><div><br></div><div>Presently I have ported the mailbox code as well. As per Andre's suggestion I will be looking at the mailbox support that was added by Yang Quiao last year<br></div><div><br>Reasons for replacing the files - sdhci.c & sdhci.h : <br></div><div>1. The previous sdhci.c had the bsp specific logics and generic sd driver code together. Presently it is more modular in nature such that bcm_sdhci.c uses the generic functions <br></div><div>defined in sdhci.c and implements the driver specific functions.  <br></div><div>2. The structures namely <i>bcm_sdhci_softc and sdhci_slot </i>have changed which are extensively used by bcm specific code. <br><br></div><div>Thanks <br></div><div><a href="https://github.com/spark1729/rtems-libbsd/commits/rpi_sd_card" target="_blank"></a>Mudit<br></div><div><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 1, 2016 at 1:56 PM, André Marques <span dir="ltr"><<a href="mailto:andre.lousa.marques@gmail.com" target="_blank">andre.lousa.marques@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Hello mudit,<div><div class="h5"><br>
    <br>
    <div>Às 09:13 de 30-05-2016, Mudit Jain
      escreveu:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>Hi all,<br>
            <br>
          </div>
          <div>I have ported the code from the present FreeBSD. <br>
            <br>
          </div>
          <div>Link : <a href="https://github.com/spark1729/rtems-libbsd/commits/rpi_sd_card" target="_blank">https://github.com/spark1729/rtems-libbsd/commits/rpi_sd_card</a><br>
            <br>
          </div>
          <div>Kindly review the same and suggest changes. <br>
          </div>
          <div><br>
          </div>
          <div>The commits are a bit unstructured, the second last one
            being a huge one. I will be breaking it down into smaller
            and logical patches while submitting. <br>
          </div>
          <div><br>
          </div>
          <div>Files changed/added in the three commits are as follows :
            <br>
            <br>
            freebsd/sys/dev/ofw/ofw_bus.h<br>
            freebsd/sys/dev/ofw/ofw_bus_if.c<br>
            freebsd/sys/dev/ofw/ofw_bus_if.h<br>
            freebsd/sys/dev/ofw/ofw_bus_subr.c<br>
            freebsd/sys/dev/ofw/ofw_bus_subr.h<br>
            <br>
          </div>
          <div>freebsd/sys/sys/queue.h<br>
            <br>
            freebsd/sys/contrib/libfdt/libfdt_env.h<br>
            freebsd/sys/dev/fdt/fdt_common.c<br>
            freebsd/sys/dev/fdt/fdt_common.h<br>
            freebsd/sys/dev/ofw/ofw_bus_subr.c<br>
            freebsd/sys/sys/slicer.h<br>
            <br>
            freebsd/sys/dev/mbox/mbox_if.c<br>
            freebsd/sys/dev/mbox/mbox_if.h<br>
            freebsd/sys/dev/ofw/ofw_if.c<br>
            freebsd/sys/dev/ofw/ofw_if.h<br>
            freebsd/sys/dev/ofw/ofwvar.h<br>
            freebsd/sys/dev/ofw/openfirm.c<br>
            freebsd/sys/dev/ofw/openfirm.h<br>
            freebsd/sys/dev/sdhci/bcm2835_dma.c<br>
            freebsd/sys/dev/sdhci/bcm2835_dma.h<br>
            freebsd/sys/dev/sdhci/bcm2835_mbox.c<br>
            freebsd/sys/dev/sdhci/bcm2835_mbox.h<br>
            freebsd/sys/dev/sdhci/bcm2835_mbox_prop.h<br>
            freebsd/sys/dev/sdhci/bcm2835_sdhci.c<br>
            freebsd/sys/dev/sdhci/bcm2835_vcbus.h<br>
            freebsd/sys/dev/sdhci/sdhci.c<br>
            freebsd/sys/dev/sdhci/sdhci.h<br>
            freebsd/sys/dev/sdhci/sdhci_if.c<br>
            freebsd/sys/dev/sdhci/sdhci_if.h<br>
            <br>
          </div>
          <div>Files added to the build process [ libbsd_waf.py ] <br>
            <br>
            freebsd/sys/dev/ofw/ofw_bus_if.c<br>
            freebsd/sys/dev/ofw/ofw_bus_subr.c<br>
            freebsd/sys/dev/fdt/fdt_common.c<br>
            freebsd/sys/dev/ofw/ofw_bus_subr.c<br>
            freebsd/sys/dev/mbox/mbox_if.c<br>
            freebsd/sys/dev/ofw/ofw_if.c<br>
            freebsd/sys/dev/ofw/openfirm.c<br>
            freebsd/sys/dev/sdhci/bcm2835_dma.c<br>
            freebsd/sys/dev/sdhci/bcm2835_mbox.c<br>
            freebsd/sys/dev/sdhci/bcm2835_sdhci.c<br>
            freebsd/sys/dev/sdhci/sdhci.c<br>
            freebsd/sys/dev/sdhci/sdhci_if.c<br>
            <br>
          </div>
          <div>Errors and how they were resolved :<br>
          </div>
          <div>1.  The *_if.m files were converted into *_if.c and
            *_if.h using the following script : <a href="http://opensource.apple.com//source/smb/smb-66/kernel/sys5/kern/makeobjops.pl?txt" target="_blank">Link
            </a><br>
          </div>
          2.  fdt and ofw support was added as the driver had
          dependencies on that.<br>
        </div>
        3.  <i>taskqueue_swi_giant</i> global is not provided by RTEMS.
        That was solved by adding a new field to the <i>sdhci slot</i>
        structure - <i>sdhci_tq</i>. <br>
        <div>
          <div>
            <div>4.  BUS_PHYSADDR used in bcm_sdhci.c is a macro defined
              in arm/include/bus.h. This macro is copied bcm_sdhci.c. <i><br>
                <br>
              </i></div>
            <div>Presently the SD driver module is built from 
              bcm_sdhci.c using the generic and other functions defined
              in sdhci.c. However for modularity a different<br>
              <br>
            </div>
            <div>Question : <br>
            </div>
            <div>1. Presently I have just kept the bcm2835 specific code
              in /dev/sdhci/ directory. I don't think that would be
              ideal, I wanted to discuss the positioning of the bcm2835
              specific files.<br>
            </div>
            <div>2. Presently the SD driver module is built from 
              bcm_sdhci.c using the generic and other functions defined
              in sdhci.c. Is this fine ? <br>
            </div>
            <div>3. I have used the <i>.start_actual </i>in
              nexus-devices.h for <i>rpi_dma_res </i>as<i> 0x7e007000.
              </i>Is this the correct value ?<a href="https://www.kernel.org/doc/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt" target="_blank">
                Link</a><br>
            </div>
            <div>Note : I have not added the macro
              LIBBSP_ARM_RASPBERRYPI_BSP_H to bcm2835 specific code. I
              will be doing that.  </div>
            <div><br>
            </div>
            <div>waf builds everything that was added successfully. <br>
            </div>
            <div><i><br>
              </i></div>
            <div>Thanks <br>
            </div>
            <div>Mudit<br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></div></div>
    Hello Mudit,<br>
    <br>
    My feedback from a quick skim through your code:<br>
    <br>
    There is already some mailbox support from Yang Quiao's last year
    GSOC, so if anything is missing from his work please improve it.<br>
    <br>
    The ofw bus is not necessary for the sdhci driver in RTEMS, so that
    can be left out. <br>
    <br>
    As Sebastian suggested, you need to follow the FreeBSD port
    guidelines, and also do not replace entire files (e.g..: sdhci.c and
    sdhci.h).<span class="HOEnZb"><font color="#888888"><br>
    <br>
    --André Marques<br>
    <br>
  </font></span></div>

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