From: Domen Puncer <domen.puncer@telargo.com>
To: Jean Delvare <khali@linux-fr.org>
Cc: Manuel Lauss <mano@roarinelk.homelinux.net>,
i2c@lm-sensors.org, linux-mips@linux-mips.org
Subject: Re: [PATCH 2/2] i2c-au1550: convert to platform driver
Date: Fri, 18 May 2007 09:24:27 +0200 [thread overview]
Message-ID: <20070518072427.GC20713@moe.telargo.com> (raw)
In-Reply-To: <20070517123853.4ae91d25@hyperion.delvare>
On 17/05/07 12:38 +0200, Jean Delvare wrote:
> Hi Manuel,
>
> On Wed, 16 May 2007 07:34:40 +0200, Manuel Lauss wrote:
> > Convert the i2c-au1550 driver to platform_driver.
> >
> > * Convert the core i2c-au1550 driver to platform_driver, get rid of
> > the i2c-au1550.h file, and remove the unused pb1550_wm_codec_write().
The "unused" pb1550_wm_codec_write, is used by out-of-tree cim driver,
which never really worked for me. I guess it (or a nicer solution)
can be a part of cim driver.
> > * register the platform device for Alchemy boards which previously
> > defined the i2c psc base address in their headers.
> > * update au1x psc header for the new driver style.
It's much easier to review split patches (patch per logical change).
...
> > diff -Naurp linux-2.6.21-a/drivers/i2c/busses/i2c-au1550.c linux-2.6.21-au/drivers/i2c/busses/i2c-au1550.c
> > --- linux-2.6.21-a/drivers/i2c/busses/i2c-au1550.c 2007-05-15 20:32:44.000000000 +0200
> > +++ linux-2.6.21-au/drivers/i2c/busses/i2c-au1550.c 2007-05-15 21:39:34.000000000 +0200
...
> > @@ -110,24 +103,18 @@ wait_master_done(struct i2c_au1550_data
> > static int
> > do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd)
> > {
> > - volatile psc_smb_t *sp;
> > - u32 stat;
> > -
> > - sp = (volatile psc_smb_t *)(adap->psc_base);
> > + u32 stat, base = adap->psc_base;
> >
> > /* Reset the FIFOs, clear events.
> > */
> > - stat = sp->psc_smbstat;
> > - sp->psc_smbevnt = PSC_SMBEVNT_ALLCLR;
> > + stat = au_readl(base + PSC_SMBSTAT);
> > + au_writel(PSC_SMBEVNT_ALLCLR, base + PSC_SMBEVNT);
> > au_sync();
> > -
> > if (!(stat & PSC_SMBSTAT_TE) || !(stat & PSC_SMBSTAT_RE)) {
> > - sp->psc_smbpcr = PSC_SMBPCR_DC;
> > + au_writel(PSC_SMBPCR_DC, base + PSC_SMBPCR);
> > au_sync();
> > - do {
> > - stat = sp->psc_smbpcr;
> > - au_sync();
> > - } while ((stat & PSC_SMBPCR_DC) != 0);
> > + while (au_readl(base + PSC_SMBPCR) & PSC_SMBPCR_DC)
> > + msleep(0);
>
> You are changing the behavior here, while this patch is supposed to
> only convert the driver to the new device driver model.
Well... since msleep(0) is nothing, it's the same, but it does
look weird.
...
> > /* Now, set up the PSC for SMBus PIO mode.
> > */
> > - sp = (volatile psc_smb_t *)(adap->psc_base);
> > - sp->psc_ctrl = PSC_CTRL_DISABLE;
> > + au_writel(PSC_CTRL_DISABLE, base + PSC_CTRL_OFFSET);
> > au_sync();
> > - sp->psc_sel = PSC_SEL_PS_SMBUSMODE;
> > - sp->psc_smbcfg = 0;
> > + au_writel(PSC_SEL_PS_SMBUSMODE, base + PSC_SEL_OFFSET);
au_sync();?
...
> > + while (!(au_readl(base + PSC_SMBSTAT) & PSC_SMBSTAT_DR))
> > au_sync();
> > - } while ((stat & PSC_SMBSTAT_DR) == 0);
> >
> > - return i2c_add_adapter(i2c_adap);
> > -}
> > + ret = i2c_add_adapter(&priv->adap);
> > + if (ret == 0) {
> > + platform_set_drvdata(pdev, priv);
> > + return 0;
> > + }
> >
> > + au_writel(0, base + PSC_SMBCFG);
au_sync();?
> > + au_writel(PSC_CTRL_DISABLE, base + PSC_CTRL_OFFSET);
> > + au_sync();
> >
> > -int
> > -i2c_au1550_del_bus(struct i2c_adapter *adap)
> > -{
> > - return i2c_del_adapter(adap);
> > + kfree(priv);
> > +out: return ret;
>
> Label should be on its own line.
>
> > }
> >
> > static int
> > -pb1550_reg(struct i2c_client *client)
> > +i2c_au1550_remove(struct platform_device *pdev)
> > {
> > - return 0;
> > + struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
> > + u32 base;
> > +
> > + if (priv) {
>
> This test doesn't seem needed, there's no way this function can be
> called if i2c_au1550_probe() didn't succeed, so the driver data must
> have been set.
>
> > + platform_set_drvdata(pdev, NULL);
> > + base = priv->psc_base;
> > + i2c_del_adapter(&priv->adap);
> > + au_writel(0, base + PSC_SMBCFG);
au_sync();?
> > + au_writel(PSC_CTRL_DISABLE, base + PSC_CTRL_OFFSET);
> > + au_sync();
> > + kfree(priv);
> > + }
> > + return 0;
> > }
> >
> > static int
> > -pb1550_unreg(struct i2c_client *client)
> > +i2c_au1550_suspend(struct platform_device *pdev, pm_message_t state)
> > {
> > + struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
> > + u32 base = priv->psc_base;
> > +
> > + au_writel(PSC_CTRL_SUSPEND, base + PSC_CTRL_OFFSET);
> > + au_sync();
> > return 0;
> > }
I don't think this will work for "hibernate".
Clocks and other settings should be saved and restored on resume, but
maybe board code already does that.
...
> Other than these minor comments, the patch looks really good. Thanks
> for your work. Domen, feel free to add you own comments.
Unfortunately I don't have au1200 based board set-up anymore, so I can't
test this.
It looks OK to me.
Domen
next prev parent reply other threads:[~2007-05-18 7:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-16 5:34 [PATCH 2/2] i2c-au1550: convert to platform driver Manuel Lauss
2007-05-17 10:38 ` Jean Delvare
2007-05-18 7:24 ` Domen Puncer [this message]
2007-05-18 12:38 ` Jean Delvare
-- strict thread matches above, loose matches on Subject: below --
2007-05-15 18:09 Manuel Lauss
2007-05-15 18:27 ` Manuel Lauss
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=20070518072427.GC20713@moe.telargo.com \
--to=domen.puncer@telargo.com \
--cc=i2c@lm-sensors.org \
--cc=khali@linux-fr.org \
--cc=linux-mips@linux-mips.org \
--cc=mano@roarinelk.homelinux.net \
/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