From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Kuninori Morimoto
<kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Cc: Shubhrajyoti Datta
<omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
Simon <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>,
Magnus <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Linux-I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Kuninori Morimoto
<kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH v3] i2c: add Renesas R-Car I2C driver
Date: Mon, 8 Oct 2012 11:47:48 +0200 [thread overview]
Message-ID: <20121008094748.GB22051@pengutronix.de> (raw)
In-Reply-To: <877gred4u1.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2701 bytes --]
On Thu, Sep 27, 2012 at 11:44:25PM -0700, Kuninori Morimoto wrote:
> R-Car I2C is similar with SH7760 I2C.
> But the SH7760 I2C driver had many workaround operations, since H/W had bugs.
> Thus, it was pointless to keep compatible between SH7760 and R-Car I2C drivers.
> This patch creates new Renesas R-Car I2C driver.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Only minor issues which might be fixed later. Applied to -next.
> +static void rcar_i2c_write(struct rcar_i2c_priv *priv, int reg, u32 val)
> +{
> + writel(val, priv->io + reg);
> +}
> +
> +static u32 rcar_i2c_read(struct rcar_i2c_priv *priv, int reg)
> +{
> + return readl(priv->io + reg);
> +}
Not sure if those needed encapsulation.
...
> +static int rcar_i2c_irq_send(struct rcar_i2c_priv *priv, u32 msr)
> +{
> + struct i2c_msg *msg = priv->msg;
> +
> + /*
> + * FIXME
> + * sometimes, unknown interrupt happened.
> + * Do nothing
> + */
> + if (!(msr & MDE))
> + return 0;
Uh, is this a known hardware flaw?
...
> +static int __devinit rcar_i2c_probe(struct platform_device *pdev)
> +{
> + struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data;
> + struct rcar_i2c_priv *priv;
> + struct i2c_adapter *adap;
> + struct resource *res;
> + struct device *dev = &pdev->dev;
> + u32 bus_speed;
> + int ret;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
> + dev_err(dev, "no mmio resources\n");
> + return -ENODEV;
> + }
> +
> + priv = devm_kzalloc(dev, sizeof(struct rcar_i2c_priv), GFP_KERNEL);
> + if (!priv) {
> + dev_err(dev, "no mem for private data\n");
> + return -ENOMEM;
> + }
> +
> + bus_speed = 100000; /* default 100 kHz */
> + if (pdata && pdata->bus_speed)
> + bus_speed = pdata->bus_speed;
> + ret = rcar_i2c_clock_calculate(priv, bus_speed, dev);
> + if (ret < 0)
> + return ret;
> +
> + priv->io = devm_ioremap(dev, res->start, resource_size(res));
devm_request_mem_region is missing. Or use the helper
devm_request_and_ioremap.
> + if (!priv->io) {
> + dev_err(dev, "cannot ioremap\n");
> + return -ENODEV;
> + }
> +
> + priv->irq = platform_get_irq(pdev, 0);
> + init_waitqueue_head(&priv->wait);
> + spin_lock_init(&priv->lock);
> +
> + adap = &priv->adap;
> + adap->nr = pdev->id;
> + adap->algo = &rcar_i2c_algo;
> + adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
> + adap->retries = 3;
Do you really need the class?
Rest looks good.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-10-08 9:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 6:36 [PATCH] i2c: add Renesas R-Car I2C driver Kuninori Morimoto
[not found] ` <871uk04aa2.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-08-28 0:19 ` Kuninori Morimoto
2012-08-28 4:48 ` Shubhrajyoti Datta
[not found] ` <CAM=Q2ctETiVdyKBd_MxY2Ts=1XMPa_cdEJRkQpEySL6du9oLmw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-28 5:33 ` Kuninori Morimoto
[not found] ` <878vczd1hw.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-08-28 5:39 ` Shubhrajyoti Datta
[not found] ` <CAM=Q2cs5pFpVjqa_MFCLTFqdCo6SSm-1Ep=WtJ7fpABzWEGD9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-28 7:56 ` Kuninori Morimoto
2012-08-28 8:12 ` Jean Delvare
[not found] ` <20120828101259.409b410b-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-08-28 8:37 ` [PATCH v2] " Kuninori Morimoto
[not found] ` <874nnnct03.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-09-28 1:57 ` Kuninori Morimoto
[not found] ` <878vbudi3v.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-09-28 3:49 ` Simon Horman
2012-09-28 5:21 ` Shubhrajyoti Datta
[not found] ` <CAM=Q2cuGiNnduVa+nnNV_02dYwfrSJoFGesiFBm6Q5U3SGQXpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-28 5:56 ` Kuninori Morimoto
[not found] ` <w3pmx0an11d.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-09-28 6:25 ` Shubhrajyoti Datta
2012-09-28 6:44 ` [PATCH v3] " Kuninori Morimoto
[not found] ` <877gred4u1.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-10-08 9:47 ` Wolfram Sang [this message]
2012-10-31 6:21 ` Simon Horman
[not found] ` <20121031062128.GA31555-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2012-10-31 6:44 ` [PATCH] i2c: rcar: fixup section mismatch on rcar_i2c_probe/remove() Kuninori Morimoto
[not found] ` <877gq7m97r.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-11-01 0:22 ` Simon Horman
2012-11-13 10:23 ` Wolfram Sang
2012-08-28 6:26 ` [PATCH] i2c: add Renesas R-Car I2C driver phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ
[not found] ` <OF0AA2687D.3C2F6EFC-ON80257A56.003BB6CC-80257A68.0023665F-mWMTcI9IYFFWk0Htik3J/w@public.gmane.org>
2012-08-28 7:00 ` Kuninori Morimoto
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=20121008094748.GB22051@pengutronix.de \
--to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ@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).