[PATCH v2] fsl-rio: add support for mapping inbound windows

Gang.Liu at freescale.com Gang.Liu at freescale.com
Wed Jun 25 19:55:01 EST 2014


> Subject: [PATCH v2] fsl-rio: add support for mapping inbound windows
> 
> From: Martijn de Gouw <martijn.de.gouw at prodrive.nl>
> 
> Add support for mapping and unmapping of inbound rapidio windows.
> 
> Signed-off-by: Martijn de Gouw <martijn.de.gouw at prodrive-technologies.com>
> ---
>  arch/powerpc/sysdev/fsl_rio.c |   92 +++++++++++++++++++++++++++++++++++++++++
>  arch/powerpc/sysdev/fsl_rio.h |   12 ++++++
>  2 files changed, 104 insertions(+)

> +	/* check for conflicting ranges */
> +	for (i = 0; i < RIO_INB_ATMU_COUNT; i++) {
> +		riwar = in_be32(&priv->inb_atmu_regs[i].riwar);
> +		if ((riwar & RIWAR_ENABLE) == 0)
> +			continue;
> +		win_start = ((u64)(in_be32(&priv->inb_atmu_regs[i].riwbar) &
> RIWBAR_BADD_MASK))
> +			<< RIWBAR_BADD_VAL_SHIFT;
> +		win_end = win_start + ((1 << ((riwar & RIWAR_SIZE_MASK) + 1)) - 1);
> +		if (rstart < win_end && (rstart + size) > win_start)
> +			return -EINVAL;
> +	}

For the inbound window, the base address must be aligned based on the
size selected in the window size bits. So I think it will be better
if you can check the alignment.


> @@ -598,6 +687,8 @@ int fsl_rio_setup(struct platform_device *dev)
>  			RIO_ATMU_REGS_PORT2_OFFSET));
> 
>  		priv->maint_atmu_regs = priv->atmu_regs + 1;
> +		priv->inb_atmu_regs = (struct rio_inb_atmu_regs *)
> +			(priv->regs_win + RIO_INB_ATMU_REGS_OFFSET);

The RIO_INB_ATMU_REGS_OFFSET is just for port 1, I think the port 2
also should be supported.

Best Regards,
Liu Gang


More information about the Linuxppc-dev mailing list