[PATCH 1/1] arm/dts: Tegra30: Add device tree support for SMMU

Thierry Reding thierry.reding at avionic-design.de
Wed Apr 18 19:26:13 EST 2012


* Hiroshi Doyu wrote:
> diff --git a/drivers/of/of_dma.c b/drivers/of/of_dma.c
> new file mode 100644
> index 0000000..1db1ccd
> --- /dev/null
> +++ b/drivers/of/of_dma.c
> @@ -0,0 +1,35 @@
> +/*
> + * Stealed from:

"Stolen from"

> + *	"arch/microblaze/kernel/prom_parse.c"
> + *	"arch/powerpc/kernel/prom_parse.c"
> + */
> +
> +#include <linux/of_address.h>
> +
> +void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
> +		unsigned long *busno, unsigned long *phys, unsigned long *size)
> +{
> +	const u32 *dma_window;

Should be __be32.

> +	u32 cells;
> +	const unsigned char *prop;
> +
> +	dma_window = dma_window_prop;
> +
> +	/* busno is always one cell */
> +	if (busno)
> +		*busno = *(dma_window++);

This needs endianness conversion:

	*busno = be32_to_cpup(dma_window++);

> +
> +	prop = of_get_property(dn, "#dma-address-cells", NULL);
> +	if (!prop)
> +		prop = of_get_property(dn, "#address-cells", NULL);
> +
> +	cells = prop ? *(u32 *)prop : of_n_addr_cells(dn);

Same here.

> +	*phys = of_read_number(dma_window, cells);
> +
> +	dma_window += cells;
> +
> +	prop = of_get_property(dn, "#dma-size-cells", NULL);
> +	cells = prop ? *(u32 *)prop : of_n_size_cells(dn);

And here.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20120418/e02078d4/attachment.sig>


More information about the devicetree-discuss mailing list