linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
To: Jean-Hugues Deschenes
	<jean-hugues.deschenes-YGVykHU+fedBDgjK7y7TUQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>,
	Shinya Kuribayashi
	<shinya.kuribayashi-jaWZhaxaiAMAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v2 2/3] i2c-designware: Check component type register
Date: Sun, 24 Jan 2010 15:40:26 +0000	[thread overview]
Message-ID: <20100124154026.GC28675@fluff.org.uk> (raw)
In-Reply-To: <20100119140234.870830000-YGVykHU+fedBDgjK7y7TUQ@public.gmane.org>

On Tue, Jan 19, 2010 at 09:02:36AM -0500, Jean-Hugues Deschenes wrote:
> Designware component type register is checked before attaching to the device.
> 
> Signed-off-by: Jean-Hugues Deschenes <jean-hugues.deschenes-YGVykHU+fedBDgjK7y7TUQ@public.gmane.org>
> 
> ---
>  drivers/i2c/busses/i2c-designware.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> Index: linux-2.6_i2c/drivers/i2c/busses/i2c-designware.c
> ===================================================================
> --- linux-2.6_i2c.orig/drivers/i2c/busses/i2c-designware.c
> +++ linux-2.6_i2c/drivers/i2c/busses/i2c-designware.c
> @@ -68,6 +68,7 @@
>  #define DW_IC_TXFLR		0x74
>  #define DW_IC_RXFLR		0x78
>  #define DW_IC_COMP_PARAM_1	0xf4
> +#define DW_IC_COMP_TYPE		0xfc
>  #define DW_IC_TX_ABRT_SOURCE	0x80
>  
>  #define DW_IC_CON_MASTER		0x1
> @@ -756,6 +757,16 @@ static int __devinit dw_i2c_probe(struct
>  		goto err_unuse_clocks;
>  	}
>  	{
> +		u32 comp_type = dw_readl(dev, DW_IC_COMP_TYPE);
> +
> +		if (comp_type != 0x44570140) {
> +			dev_err(&pdev->dev, "Unknown Synopsys component type: "
> +					"0x%08x\n",	comp_type);
> +			r = -ENODEV;
> +			goto err_iounmap;
> +		}
> +	}

having looked at the code around here, let's just use a single
u32 reg or u32 val field at the top of dw_i2c_probe and avoid the
need for the {} blocks in the probe.

Would like to see a patch fixing this added to the series.

> +	{
>  		u32 param1 = dw_readl(dev, DW_IC_COMP_PARAM_1);
>  
>  		dev->tx_fifo_depth = ((param1 >> 16) & 0xff) + 1;
> 
> -- 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

  parent reply	other threads:[~2010-01-24 15:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19 14:02 [PATCH v2 0/3] i2c-designware: Allow mixed endianness Jean-Hugues Deschenes
2010-01-19 14:02 ` [PATCH v2 1/3] i2c-designware: Use local version of readl & writel Jean-Hugues Deschenes
2010-01-19 14:02 ` [PATCH v2 2/3] i2c-designware: Check component type register Jean-Hugues Deschenes
     [not found]   ` <20100119140234.870830000-YGVykHU+fedBDgjK7y7TUQ@public.gmane.org>
2010-01-24 15:40     ` Ben Dooks [this message]
2010-01-19 14:02 ` [PATCH v2 3/3] i2c-designware: Allow mixed endianness accesses Jean-Hugues Deschenes
     [not found] ` <20100119140234.689304000-YGVykHU+fedBDgjK7y7TUQ@public.gmane.org>
2010-01-21  5:25   ` [PATCH v2 0/3] i2c-designware: Allow mixed endianness Shinya Kuribayashi
     [not found]     ` <4B57E54D.8020909-jaWZhaxaiAMAvxtiuMwx3w@public.gmane.org>
2010-01-21  5:46       ` Shinya Kuribayashi
2010-01-24 15:41   ` Ben Dooks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100124154026.GC28675@fluff.org.uk \
    --to=ben-linux-elnmno+kys3ytjvyw6ydsg@public.gmane.org \
    --cc=baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org \
    --cc=jean-hugues.deschenes-YGVykHU+fedBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shinya.kuribayashi-jaWZhaxaiAMAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).