linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Subject: Re: [PATCH 2/3] i2c: Add Congatec CGEB I2C driver
Date: Thu, 14 Feb 2013 11:11:30 +0100	[thread overview]
Message-ID: <20130214101130.GB12290@nekote.pengutronix.de> (raw)
In-Reply-To: <1360663374-30951-3-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Hi Sascha,

> diff --git a/drivers/i2c/busses/i2c-congatec-cgeb.c b/drivers/i2c/busses/i2c-congatec-cgeb.c
> new file mode 100644
> index 0000000..5f48ca4
> --- /dev/null
> +++ b/drivers/i2c/busses/i2c-congatec-cgeb.c
> @@ -0,0 +1,194 @@
> +/*
> + * CGEB i2c driver
> + *
> + * (c) 2011 Sascha Hauer, Pengutronix
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +#include <linux/i2c.h>
> +#include <asm/congatec-cgeb.h>

Is asm a good place? Maybe linux/platform_data?

> +
> +#define CG_I2C_FLAG_START   0x00080	/* send START condition */
> +#define CG_I2C_FLAG_STOP    0x00040	/* send STOP condition */
> +#define CG_I2C_FLAG_ALL_ACK 0x08000	/* send ACK on all read bytes */
> +#define CG_I2C_FLAG_ALL_NAK 0x04000	/* send NAK on all read bytes */
> +
> +struct cgeb_i2c_priv {
> +	struct cgeb_board_data		*board;
> +	struct i2c_adapter	adapter;
> +	int unit;
> +};
> +
> +static u32 cgeb_i2c_func(struct i2c_adapter *adapter)
> +{
> +	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
> +}

To make sure: Have you checked if the driver can do SMBUS_QUICK by using
'i2cdetect'?

...

> +static int cgeb_i2c_probe(struct platform_device *pdev)
> +{
> +	struct cgeb_i2c_priv *priv;
> +	struct cgeb_pdata *pdata = pdev->dev.platform_data;
> +	int ret;
> +
> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	strcpy(priv->adapter.name, pdev->name);
> +	priv->adapter.owner		= THIS_MODULE;
> +	priv->adapter.algo		= &cgeb_i2c_algo;
> +	priv->adapter.dev.parent	= &pdev->dev;
> +	priv->unit = pdata->unit;
> +	priv->board = pdata->board;
> +	i2c_set_adapdata(&priv->adapter, priv);
> +
> +	platform_set_drvdata(pdev, priv);
> +
> +	ret = cgeb_i2c_set_speed(priv, 400000);

Not all slaves handle 400kHz. So, this might be a bit demanding. Then
again, it is probably fix which slaves are connected and they work
currently?

...

> +MODULE_AUTHOR("Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>");
> +MODULE_DESCRIPTION("cgeb i2c driver");
> +MODULE_LICENSE("GPL");

GPLv2 is mentioned in the header.

Other than that, the driver looks fine to me. If it should go via mfd,
here is my

Acked-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>

Otherwise, let me know if and when I should pick it up.

Thanks,

   Wolfram

  parent reply	other threads:[~2013-02-14 10:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 10:02 [PATCH] Congatec CGEB base, i2c and watchdog driver support Sascha Hauer
     [not found] ` <1360663374-30951-1-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-12 10:02   ` [PATCH 1/3] x86: Add basic support for the Congatec CGEB BIOS interface Sascha Hauer
     [not found]     ` <1360663374-30951-2-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-25  8:31       ` Christian Gmeiner
2013-03-26  8:54         ` Sascha Hauer
     [not found]           ` <20130326085454.GK1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-26  9:24             ` Wolfram Sang
     [not found]               ` <20130326092435.GB8553-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-03-26  9:31                 ` Sascha Hauer
     [not found]                   ` <20130326093139.GL1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-26  9:38                     ` Christian Gmeiner
     [not found]                       ` <CAH9NwWdUqH8gF8Vz7K_2UW1X==LWbYEd5dhSTPqqYwEnDuRVuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-11  7:14                         ` Christian Gmeiner
     [not found]                           ` <CAH9NwWd-UAYG0y2R379hPvntnfPhNEwvXm-f2uO3o1AZZ+OSMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-11 11:20                             ` Wolfram Sang
2013-02-12 10:02   ` [PATCH 2/3] i2c: Add Congatec CGEB I2C driver Sascha Hauer
     [not found]     ` <1360663374-30951-3-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-14 10:11       ` Wolfram Sang [this message]
     [not found]         ` <20130214101130.GB12290-8EAEigeeuNG034pCzgS/Qg7AFbiQbgqx@public.gmane.org>
2013-03-26  9:55           ` Christian Gmeiner
2013-02-13 14:57   ` [PATCH] Congatec CGEB base, i2c and watchdog driver support Christian Gmeiner
     [not found]     ` <CAH9NwWfSQKW2c1LvLQkojPiKA_r7+_6OmgoVHrBNRHUEFNYvJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14  8:35       ` Sascha Hauer
2013-02-12 10:02 ` [PATCH 3/3] watchdog: Add Congatec CGEB watchdog driver Sascha Hauer
     [not found]   ` <1360663374-30951-4-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-26 10:16     ` Christian Gmeiner
2013-03-26 14:33       ` Guenter Roeck
     [not found]         ` <20130326143331.GA5529-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-04-03 15:09           ` Sascha Hauer
2013-04-03 15:30             ` Guenter Roeck
     [not found]               ` <20130403153000.GA30641-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-04-03 17:06                 ` Sascha Hauer
2013-04-03 15:16       ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2012-02-01 13:26 [RESEND] Congatec CGEB base, i2c and watchdog driver support Sascha Hauer
2012-02-01 13:26 ` [PATCH 2/3] i2c: Add Congatec CGEB I2C driver Sascha Hauer
2012-02-07  8:38   ` Christian Gmeiner
     [not found]   ` <1328102793-4313-3-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-02-07 10:10     ` Wolfram Sang
     [not found]       ` <20120207101016.GB2539-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-02-15 13:54         ` Sascha Hauer
2012-02-13 23:22     ` 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=20130214101130.GB12290@nekote.pengutronix.de \
    --to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@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).