[linux-yocto] [PATCH 1/3] drivers/misc: Axxia MTC Driver Memory Initialization Check

Winkler, Tomas tomas.winkler at intel.com
Mon Aug 22 02:52:40 PDT 2016


> 
> Axxia MTC driver changes:
>  - Memory initialization completion check added
>  - ECC error status clearing added
> 
> Signed-off-by: Sreedevi Joshi <sreedevi.joshi at intel.com>
> ---
>  drivers/misc/lsi-mtc.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/misc/lsi-mtc.c b/drivers/misc/lsi-mtc.c index
> 55c3403..f4fbe6f 100644
> --- a/drivers/misc/lsi-mtc.c
> +++ b/drivers/misc/lsi-mtc.c
> @@ -31,6 +31,7 @@
>  #include <linux/string.h>
>  #include "linux/lsi_mtc_ioctl.h"
> 
> +#define MTC_POLL_TIMEOUT (msecs_to_jiffies(1000))
> 
>  /*
>     device tree node:
> @@ -4114,6 +4115,8 @@ static long _mtc_config(struct mtc_device *dev,
> struct lsi_mtc_cfg_t *pMTCCfg)
>  	struct ncp_axis_mtc_MTC_CONFIG0_REG_ADDR_r_t cfg0 = { 0 };
>  	struct ncp_axis_mtc_MTC_CONFIG1_REG_ADDR_r_t cfg1 = { 0 };
>  	struct ncp_axis_mtc_MTC_EXECUTE1_REG_ADDR_r_t exec1 = { 0 };
> +	u32	init_reg = { 0 };
> +	unsigned long tmo = 0;
> 
>  	if ((!pMTCCfg) || (!dev))
>  		return -EINVAL;
> @@ -4129,6 +4132,21 @@ static long _mtc_config(struct mtc_device *dev,
> struct lsi_mtc_cfg_t *pMTCCfg)
>  	exec1.sw_reset = 1;
>  	dev->regs->execute = *((u32 *) &exec1);
>  	dev->regs->mem_init = 0x202;
> +	/* wait for the init to complete */
> +	tmo = jiffies + MTC_POLL_TIMEOUT;
> +	do {
> +		init_reg = *(&(dev->regs->mem_init));
I'm not familiar with this code but I don't think this is the way to read a register , why not using readl(), you are at least missing memory barrier here. 
> +		if ((init_reg & 0x101) == 0x101)
> +			break;
> +	} while (time_before(jiffies, tmo));
This is busy loop, how fast is that going to settle ? 
> +
> +	if ((init_reg & 0x101) != 0x101) {
> +		pr_debug("warning: mem_init failed value=0x%x
> (expected:0x101)\n",
> +			       init_reg);
> +	}
> +
> +	/* clear ECC interrupt status */
> +	dev->regs->ecc_int_status = 0xF;
> 
>  	/* 3. config MTC */
>  	cfg0 =
> --
> 2.7.4
> 
> --
> _______________________________________________
> linux-yocto mailing list
> linux-yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/linux-yocto


More information about the linux-yocto mailing list