<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello mudit,<br>
<br>
<div class="moz-cite-prefix">Às 09:13 de 30-05-2016, Mudit Jain
escreveu:<br>
</div>
<blockquote
cite="mid:CAHK86NgTSLvrWfSsNJV3_=YMDAj-iWqfxscrvJDoY1uzChZeeA@mail.gmail.com"
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 moz-do-not-send="true"
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
moz-do-not-send="true"
href="http://opensource.apple.com//source/smb/smb-66/kernel/sys5/kern/makeobjops.pl?txt">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 moz-do-not-send="true"
href="https://www.kernel.org/doc/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt">
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>
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).<br>
<br>
--André Marques<br>
<br>
</body>
</html>