i2c: i2c-au1550 updates
Subsystems (2)
v2 cover i2c: i2c-au1550 updates
The following patches remove some bit-rot from the i2c-au1550 driver. (Patch #3 supersedes the one I sent on 2011-06-12:
"i2c-au1550: increase timeout waiting for transactions to finish").
#1 gets rid of all instances of the "volatile" keyword, #2 removes an unused context member,
#3 fixes i2c on the db1300 board
#4 updates PM methods.
All run- and pm-tested on db1200 and db1300 hardware.
Changes since V1:
- updated patch #3 and its description.
Please consider for 3.2.
Manuel Lauss (4):
i2c/au1550: remove usage of volatile keyword i2c/au1550: remove unused ack_timeout i2c/au1550: increase timeout waiting for master done i2c/au1550: dev_pm_ops conversion
arch/mips/include/asm/mach-au1x00/au1xxx_psc.h | 13 - drivers/i2c/busses/i2c-au1550.c | 280 ++++++++++-------------- 2 files changed, 114 insertions(+), 179 deletions(-)
Signature · 1 line
1.7.6.1
PATCH v2 1/4 i2c/au1550: remove usage of volatile keyword
In reply to a message not in the archiveReplace the usage of "volatile"s with register accessor functions.
---
V2: no changes
arch/mips/include/asm/mach-au1x00/au1xxx_psc.h | 13 -- drivers/i2c/busses/i2c-au1550.c | 252 +++++++++-------------- 2 files changed, 99 insertions(+), 166 deletions(-)
arch/mips/include/asm/mach-au1x00/au1xxx_psc.h +0 -13
@@ -394,19 +394,6 @@ typedef struct psc_spi {#define PSC_SPITXRX_LC (1 << 29)#define PSC_SPITXRX_SR (1 << 28) -/* PSC in SMBus (I2C) Mode. */ -typedef struct psc_smb { -u32 psc_sel; -u32 psc_ctrl; -u32 psc_smbcfg; -u32 psc_smbmsk; -u32 psc_smbpcr; -u32 psc_smbstat; -u32 psc_smbevnt; -u32 psc_smbtxrx; -u32 psc_smbtmr; -}psc_smb_t ; -/* SMBus Config Register. */ #define PSC_SMBCFG_RT_MASK (3 << 30)#define PSC_SMBCFG_RT_FIFO1 (0 << 30)
drivers/i2c/busses/i2c-au1550.c +99 -153
449 lines not on this page · raw message
Signature · 1 line
1.7.6.1
PATCH v2 2/4 i2c/au1550: remove unused ack_timeout
In reply to a message not in the archiveThe ack_timeout context member is unused, get rid of it.
---
V2: no changes
drivers/i2c/busses/i2c-au1550.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-au1550.c +0 -2
@@ -52,7 +52,6 @@struct i2c_au1550_data {void __iomem *psc_base;int xfer_timeout; -int ack_timeout;struct i2c_adapter adap;struct resource *ioarea; };
@@ -346,7 +345,6 @@ i2c_au1550_probe(struct platform_device *pdev) goto out_map; } priv->xfer_timeout =200 ; - priv->ack_timeout =200 ; priv->adap.nr = pdev->id; priv->adap.algo = &au1550_algo;
Signature · 1 line
1.7.6.1
PATCH v2 3/4 i2c/au1550: increase timeout waiting for master done
In reply to a message not in the archiveDouble the timeout in the loop which busy-waits for the "master-done" bit to be set. This bit indicates whether an i2c transaction has completed; on the DB1300 board this timeout is slightly too small and causes transactions to the WM8731 codec to be falsely flagged as failed. The timeout itself is necessary since transactions to non-existant slaves never set this bit in the first place and hang e.g. i2cdetect.
With this change the WM8731 codec on the DB1300 board is correctly detected and initialized.
---
V2: changed timeout only for master done bit, updated patch description.
drivers/i2c/busses/i2c-au1550.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-au1550.c +1 -1
@@ -101,7 +101,7 @@ static int wait_master_done(struct i2c_au1550_data *adap)int i;/* Wait for Master Done. */ -for (i =0 ; i < adap->xfer_timeout; i++) { +for (i =0 ; i <2 * adap->xfer_timeout; i++) {if ((RD (adap,PSC_SMBEVNT ) &PSC_SMBEVNT_MD ) !=0 )return 0 ;udelay (1 );
Signature · 1 line
1.7.6.1
PATCH v2 4/4 i2c/au1550: dev_pm_ops conversion
In reply to a message not in the archiveuse newer dev_pm_ops for PM
---
V2: no changes
drivers/i2c/busses/i2c-au1550.c | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-)
drivers/i2c/busses/i2c-au1550.c +14 -10
@@ -387,39 +387,43 @@ static int __devexit i2c_au1550_remove(struct platform_device *pdev) }#ifdef CONFIG_PM -static int -i2c_au1550_suspend (struct platform_device *pdev,pm_message_t state) +static int i2c_au1550_suspend (struct device *dev) { -struct i2c_au1550_data *priv =platform_get_drvdata (pdev); +struct i2c_au1550_data *priv =dev_get_drvdata (dev);i2c_au1550_disable (priv);return 0 ; } -static int -i2c_au1550_resume (struct platform_device *pdev) +static int i2c_au1550_resume (struct device *dev) { -struct i2c_au1550_data *priv =platform_get_drvdata (pdev); +struct i2c_au1550_data *priv =dev_get_drvdata (dev);i2c_au1550_setup (priv);return 0 ; } + +static const struct dev_pm_ops i2c_au1550_pmops = { + .suspend = i2c_au1550_suspend, + .resume = i2c_au1550_resume, +}; + +#define AU1XPSC_SMBUS_PMOPS (&i2c_au1550_pmops) +#else -#define i2c_au1550_suspend NULL -#define i2c_au1550_resume NULL +#define AU1XPSC_SMBUS_PMOPS NULL#endif static struct platform_driver au1xpsc_smbus_driver = { .driver = { .name ="au1xpsc_smbus" , .owner =THIS_MODULE , + .pm =AU1XPSC_SMBUS_PMOPS , }, .probe = i2c_au1550_probe, .remove =__devexit_p (i2c_au1550_remove), - .suspend = i2c_au1550_suspend, - .resume = i2c_au1550_resume, };static int __init i2c_au1550_init (void )
Signature · 1 line
1.7.6.1