[PATCH] i2c: pxa: fix the clock APIs
From: Chao Xie Signed-off-by: Chao Xie --- drivers/i2c/busses/i2c-pxa.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index a997c7d..0a57f3e 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -44,8 +44,8 @@ #ifndef CONFIG_HAVE_CLK #define clk_get(dev, id) NULL #define clk_put(clk) do { } while (0) -#define clk_disable(clk) do { } while (0) -#define clk_enable(clk)do { } while (0) +#define clk_disable_unprepare(clk) do { } while (0) +#define clk_prepare_enable(clk)do { } while (0) #endif struct pxa_reg_layout { @@ -1169,7 +1169,7 @@ static int i2c_pxa_probe(struct platform_device *dev) i2c->adap.class = plat->class; } - clk_enable(i2c->clk); + clk_prepare_enable(i2c->clk); if (i2c->use_pio) { i2c->adap.algo = &i2c_pxa_pio_algorithm; @@ -1211,7 +1211,7 @@ eadapt: if (!i2c->use_pio) free_irq(irq, i2c); ereqirq: - clk_disable(i2c->clk); + clk_disable_unprepare(i2c->clk); iounmap(i2c->reg_base); eremap: clk_put(i2c->clk); @@ -1232,7 +1232,7 @@ static int __exit i2c_pxa_remove(struct platform_device *dev) if (!i2c->use_pio) free_irq(i2c->irq, i2c); - clk_disable(i2c->clk); + clk_disable_unprepare(i2c->clk); clk_put(i2c->clk); iounmap(i2c->reg_base); @@ -1248,7 +1248,7 @@ static int i2c_pxa_suspend_noirq(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct pxa_i2c *i2c = platform_get_drvdata(pdev); - clk_disable(i2c->clk); + clk_disable_unprepare(i2c->clk); return 0; } @@ -1258,7 +1258,7 @@ static int i2c_pxa_resume_noirq(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct pxa_i2c *i2c = platform_get_drvdata(pdev); - clk_enable(i2c->clk); + clk_prepare_enable(i2c->clk); i2c_pxa_reset(i2c); return 0; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] i2c: Adding support for Intel iSMT SMBus 2.0 host controller
The iSMT (Intel SMBus Message Transport) supports multi-master I2C/SMBus, as well as IPMI. It's operation is DMA-based and utilizes descriptors to initiate transactions on the bus. The iSMT hardware can act as both a master and a target, although this driver only supports being a master. Signed-off-by: Bill Brown --- drivers/i2c/busses/Kconfig| 10 + drivers/i2c/busses/Makefile |1 + drivers/i2c/busses/i2c-ismt.c | 862 + drivers/i2c/busses/i2c-ismt.h | 111 ++ 4 files changed, 984 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/busses/i2c-ismt.c create mode 100644 drivers/i2c/busses/i2c-ismt.h diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index d2c5095..2b5ffa3 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -119,6 +119,16 @@ config I2C_ISCH This driver can also be built as a module. If so, the module will be called i2c-isch. +config I2C_ISMT + tristate "Intel iSMT SMBus Controller" + depends on PCI + help + If you say yes to this option, support will be included for the Intel + iSMT SMBus host controller interface. + + This driver can also be built as a module. If so, the module will be + called i2c-ismt. + config I2C_PIIX4 tristate "Intel PIIX4 and compatible (ATI/AMD/Serverworks/Broadcom/SMSC)" depends on PCI diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 569567b..8a05c80 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o obj-$(CONFIG_I2C_VIA) += i2c-via.o obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o +obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o # Mac SMBus host controller drivers obj-$(CONFIG_I2C_HYDRA)+= i2c-hydra.o diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c new file mode 100644 index 000..dd107dd --- /dev/null +++ b/drivers/i2c/busses/i2c-ismt.c @@ -0,0 +1,862 @@ +/* + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2012 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * The full GNU General Public License is included in this distribution + * in the file called LICENSE.GPL. + * + * BSD LICENSE + * + * Copyright(c) 2012 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + Supports the SMBus Message Transport (SMT) on the following Intel SOCs: + BWD + CTN + + Features supported by this driver: + Software PEC
i2c: imx: could not read data
Hi ! I have the following environment : - Kernel based on 3.2.21 with custom changes and with commit (bb79a07) "i2c: imx: fix imx driver to work though signal is pending" applied - board based on imx35 derived from Freescale i.MX35 3-stack eval board I try to read some data from I2C by following userspace application, but I get some error: #include #include #include #include #include #include #include int main() { int file, i; char filename[20]; char buf[3]; int adapter_nr = 0; /* I2C-0 */ int addr = 0x08; /* The I2C address */ char reg = 0x07; /* Device register to access */ snprintf(filename, 19, "/dev/i2c-%d", adapter_nr); file = open(filename, O_RDWR); if (file < 0) { printf("%s: open failed: %s\n",file, strerror(errno)); exit(1); } if (ioctl(file, I2C_SLAVE, addr) < 0) { printf("%s: set slave address failed: %s\n",file, strerror(errno)); exit(1); } buf[0] = reg; buf[1] = 0; buf[2] = 0; if (write(file, buf, 1) != 1) { printf("%s: write failed: %s\n",file, strerror(errno)); exit(1); } if (read(file, buf, 2) != 2) { printf("%s: read failed: %s\n",filename, strerror(errno)); exit(1); } else { printf("Read bytes\n"); /* buf contains the ID bytes */ printf("ID: "); for (i=0; i<2; i++) { printf("%02x ",buf[i]); } } return 0; } Here is the debug log with the error that I get when i run the program from above: i2c i2c-0: ioctl, cmd=0x703, arg=0x08 i2c-dev: i2c-0 writing 1 bytes. i2c i2c-0: master_xfer[0] W, addr=0x08, len=1 i2c i2c-0: i2c i2c-0: i2c i2c-0: i2c i2c-0: transfer message: 0 i2c i2c-0: CONTROL: IEN=1, IIEN=1, MSTA=1, MTX=1, TXAK=1, RSTA=0 i2c i2c-0: STATUS: ICF=1, IAAS=0, IBB=1, IAL=0, SRW=0, IIF=0, RXAK=1 i2c i2c-0: write slave address: addr=0x10 i2c i2c-0: TRX complete i2c i2c-0: ACK received i2c i2c-0: write data i2c i2c-0: write byte: B0=0x7 i2c i2c-0: TRX complete i2c i2c-0: ACK received i2c i2c-0: i2c i2c-0: i2c i2c-0: exit with: success msg: 1 i2c-dev: i2c-0 reading 2 bytes. i2c i2c-0: master_xfer[0] R, addr=0x08, len=2 i2c i2c-0: i2c i2c-0: i2c i2c-0: i2c i2c-0: transfer message: 0 i2c i2c-0: CONTROL: IEN=1, IIEN=1, MSTA=1, MTX=1, TXAK=1, RSTA=0 i2c i2c-0: STATUS: ICF=1, IAAS=0, IBB=1, IAL=0, SRW=0, IIF=0, RXAK=1 i2c i2c-0: write slave address: addr=0x11 i2c i2c-0: TRX complete i2c i2c-0: No ACK i2c i2c-0: i2c i2c-0: i2c i2c-0: exit with: error: -5 Using i2ctools it seems that with i2c everything is fine: # i2cdetect -l i2c-0i2c imx-i2c I2C adapter i2c-1i2c imx-i2c I2C adapter i2c-2i2c imx-i2c I2C adapter # i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- 08 -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- # i2cget -y 0 0x08 07 w 0x4100 How you can see using i2ctools I can read without any errors from register 07 of slave device 08 found on i2c-0. On the same board using an old kernel 2.6.32.16 I can read data from i2c-0 using my userspace app. Has anybody some suggestions what could I try to go forward ? Best regards, Gabriel -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] i2c: tegra: Fix ifdefs for suspend mode
CONFIG_PM covers runtime only PM. Signed-off-by: Laxman Dewangan --- This patch will remove the compilation warning if CONFIG_PM_SLEEP is not enabled. drivers/i2c/busses/i2c-tegra.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 66eb53f..9a08c57 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -712,7 +712,7 @@ static int __devexit tegra_i2c_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int tegra_i2c_suspend(struct device *dev) { struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); -- 1.7.1.1 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7] ARM: davinci: i2c: add OF support
Hello Shubhrajyoti, On 30.07.2012 10:42, Shubhrajyoti Datta wrote: On Mon, Jul 30, 2012 at 12:51 PM, Heiko Schocher wrote: add of support for the davinci i2c driver. [...] diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 79b4bcb..b6185dc 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c [...] @@ -635,6 +633,12 @@ static struct i2c_algorithm i2c_davinci_algo = { .functionality = i2c_davinci_func, }; +static const struct of_device_id davinci_i2c_of_match[] = { + {.compatible = "ti,davinci-i2c", }, + {}, +}; +MODULE_DEVICE_TABLE(of, davinci_i2c_of_match); + Should this be protected under OF flag? No, as I know, this is not needed. bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7] ARM: davinci: i2c: add OF support
On Mon, Jul 30, 2012 at 12:51 PM, Heiko Schocher wrote: > add of support for the davinci i2c driver. > > Signed-off-by: Heiko Schocher > Signed-off-by: Sekhar Nori > Cc: davinci-linux-open-sou...@linux.davincidsp.com > Cc: linux-arm-ker...@lists.infradead.org > Cc: devicetree-disc...@lists.ozlabs.org > Cc: linux-i2c@vger.kernel.org > Cc: Ben Dooks > Cc: Wolfram Sang > Cc: Grant Likely > Cc: Sekhar Nori > Cc: Wolfgang Denk > Cc: Sylwester Nawrocki > > --- > - changes for v2: > - add comments from Sylwester Nawrocki : > - use "cell-index" instead "id" > - OF_DEV_AUXDATA in the machine code, instead pre-define platform > device name > - add comment from Grant Likely: > - removed "id" resp. "cell-index" completely > - fixed documentation > - use of_match_ptr() > - use devm_kzalloc() for allocating plattform data mem > - fixed a whitespace issue > - no changes for v3 > - changes for v4 > remove "pinmux-handle" property as discussed here: > http://www.spinics.net/lists/arm-kernel/msg175701.html > with Nori Sekhar > > - changes for v5 > add comments from Grant Likely: > - do not change value of dev->dev->platform_data, instead > hold a copy in davinci_i2c_dev. > > - changes for v6: > add comments from Sekhar Nori: > - removed unneccessary include > - merge patch from Sekhar Nori: > setup the newly introduced dev->pdata member correctly once in > probe -> i2c_get_plattformdata(() not needed, remove a lot of > checks for pdata in code > - add Signed-off-by: Sekhar Nori > - patch no longer in patchserie, as it has no dependencies. > > - changes for v7: > add comments from Wolfram Sang: > - move Documentation/devicetree/bindings/arm/davinci/i2c.txt > to Documentation/devicetree/bindings/i2c/davinci.txt > - remove bus-delay property > > Documentation/devicetree/bindings/i2c/davinci.txt | 28 > drivers/i2c/busses/i2c-davinci.c | 48 > - > 2 files changed, 65 insertions(+), 11 deletions(-) > create mode 100644 Documentation/devicetree/bindings/i2c/davinci.txt > > diff --git a/Documentation/devicetree/bindings/i2c/davinci.txt > b/Documentation/devicetree/bindings/i2c/davinci.txt > new file mode 100644 > index 000..c79078e > --- /dev/null > +++ b/Documentation/devicetree/bindings/i2c/davinci.txt > @@ -0,0 +1,28 @@ > +* Texas Instruments Davinci I2C > + > +This file provides information, what the device node for the > +davinci i2c interface contain. > + > +Required properties: > +- compatible: "ti,davinci-i2c"; > +- reg : Offset and length of the register set for the device > + > +Recommended properties : > +- interrupts : standard interrupt property. > +- clock-frequency : desired I2C bus clock frequency in Hz. > + > +Example (enbw_cmc board): > + i2c@1c22000 { > + compatible = "ti,davinci-i2c"; > + reg = <0x22000 0x1000>; > + clock-frequency = <10>; > + interrupts = <15>; > + interrupt-parent = <&intc>; > + #address-cells = <1>; > + #size-cells = <0>; > + > + dtt@48 { > + compatible = "national,lm75"; > + reg = <0x48>; > + }; > + }; > diff --git a/drivers/i2c/busses/i2c-davinci.c > b/drivers/i2c/busses/i2c-davinci.c > index 79b4bcb..b6185dc 100644 > --- a/drivers/i2c/busses/i2c-davinci.c > +++ b/drivers/i2c/busses/i2c-davinci.c > @@ -38,6 +38,8 @@ > #include > #include > #include > +#include > +#include > > #include > #include > @@ -114,6 +116,7 @@ struct davinci_i2c_dev { > struct completion xfr_complete; > struct notifier_block freq_transition; > #endif > + struct davinci_i2c_platform_data *pdata; > }; > > /* default platform data to use if not supplied in the platform_device */ > @@ -155,7 +158,7 @@ static void generic_i2c_clock_pulse(unsigned int scl_pin) > static void i2c_recover_bus(struct davinci_i2c_dev *dev) > { > u32 flag = 0; > - struct davinci_i2c_platform_data *pdata = dev->dev->platform_data; > + struct davinci_i2c_platform_data *pdata = dev->pdata; > > dev_err(dev->dev, "initiating i2c bus recovery\n"); > /* Send NACK to the slave */ > @@ -163,8 +166,7 @@ static void i2c_recover_bus(struct davinci_i2c_dev *dev) > flag |= DAVINCI_I2C_MDR_NACK; > /* write the data into mode register */ > davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); > - if (pdata) > - generic_i2c_clock_pulse(pdata->scl_pin); > + generic_i2c_clock_pulse(pdata->scl_pin); > /* Send STOP */ > flag = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG); > flag |= DAVINCI_I2C_MDR_STP; > @@ -187,7 +189,7 @@ static inline void davinci_i2c_reset_ctrl(struct > davinci_i2c_dev *i2c_dev, > > static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_
[PATCH v7] ARM: davinci: i2c: add OF support
add of support for the davinci i2c driver. Signed-off-by: Heiko Schocher Signed-off-by: Sekhar Nori Cc: davinci-linux-open-sou...@linux.davincidsp.com Cc: linux-arm-ker...@lists.infradead.org Cc: devicetree-disc...@lists.ozlabs.org Cc: linux-i2c@vger.kernel.org Cc: Ben Dooks Cc: Wolfram Sang Cc: Grant Likely Cc: Sekhar Nori Cc: Wolfgang Denk Cc: Sylwester Nawrocki --- - changes for v2: - add comments from Sylwester Nawrocki : - use "cell-index" instead "id" - OF_DEV_AUXDATA in the machine code, instead pre-define platform device name - add comment from Grant Likely: - removed "id" resp. "cell-index" completely - fixed documentation - use of_match_ptr() - use devm_kzalloc() for allocating plattform data mem - fixed a whitespace issue - no changes for v3 - changes for v4 remove "pinmux-handle" property as discussed here: http://www.spinics.net/lists/arm-kernel/msg175701.html with Nori Sekhar - changes for v5 add comments from Grant Likely: - do not change value of dev->dev->platform_data, instead hold a copy in davinci_i2c_dev. - changes for v6: add comments from Sekhar Nori: - removed unneccessary include - merge patch from Sekhar Nori: setup the newly introduced dev->pdata member correctly once in probe -> i2c_get_plattformdata(() not needed, remove a lot of checks for pdata in code - add Signed-off-by: Sekhar Nori - patch no longer in patchserie, as it has no dependencies. - changes for v7: add comments from Wolfram Sang: - move Documentation/devicetree/bindings/arm/davinci/i2c.txt to Documentation/devicetree/bindings/i2c/davinci.txt - remove bus-delay property Documentation/devicetree/bindings/i2c/davinci.txt | 28 drivers/i2c/busses/i2c-davinci.c | 48 - 2 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/davinci.txt diff --git a/Documentation/devicetree/bindings/i2c/davinci.txt b/Documentation/devicetree/bindings/i2c/davinci.txt new file mode 100644 index 000..c79078e --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/davinci.txt @@ -0,0 +1,28 @@ +* Texas Instruments Davinci I2C + +This file provides information, what the device node for the +davinci i2c interface contain. + +Required properties: +- compatible: "ti,davinci-i2c"; +- reg : Offset and length of the register set for the device + +Recommended properties : +- interrupts : standard interrupt property. +- clock-frequency : desired I2C bus clock frequency in Hz. + +Example (enbw_cmc board): + i2c@1c22000 { + compatible = "ti,davinci-i2c"; + reg = <0x22000 0x1000>; + clock-frequency = <10>; + interrupts = <15>; + interrupt-parent = <&intc>; + #address-cells = <1>; + #size-cells = <0>; + + dtt@48 { + compatible = "national,lm75"; + reg = <0x48>; + }; + }; diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 79b4bcb..b6185dc 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include @@ -114,6 +116,7 @@ struct davinci_i2c_dev { struct completion xfr_complete; struct notifier_block freq_transition; #endif + struct davinci_i2c_platform_data *pdata; }; /* default platform data to use if not supplied in the platform_device */ @@ -155,7 +158,7 @@ static void generic_i2c_clock_pulse(unsigned int scl_pin) static void i2c_recover_bus(struct davinci_i2c_dev *dev) { u32 flag = 0; - struct davinci_i2c_platform_data *pdata = dev->dev->platform_data; + struct davinci_i2c_platform_data *pdata = dev->pdata; dev_err(dev->dev, "initiating i2c bus recovery\n"); /* Send NACK to the slave */ @@ -163,8 +166,7 @@ static void i2c_recover_bus(struct davinci_i2c_dev *dev) flag |= DAVINCI_I2C_MDR_NACK; /* write the data into mode register */ davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); - if (pdata) - generic_i2c_clock_pulse(pdata->scl_pin); + generic_i2c_clock_pulse(pdata->scl_pin); /* Send STOP */ flag = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG); flag |= DAVINCI_I2C_MDR_STP; @@ -187,7 +189,7 @@ static inline void davinci_i2c_reset_ctrl(struct davinci_i2c_dev *i2c_dev, static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) { - struct davinci_i2c_platform_data *pdata = dev->dev->platform_data; + struct davinci_i2c_platform_data *pdata = dev->pdata; u16 psc; u32 clk; u32 d; @@ -235,10 +237,7 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) */ static int i2c_davinci_ini
Re: [PATCH v6] ARM: davinci: i2c: add OF support
Hello Wolfram, On 20.07.2012 12:52, Wolfram Sang wrote: Hi, On Tue, Jul 17, 2012 at 10:40:47AM +0200, Heiko Schocher wrote: add of support for the davinci i2c driver. Signed-off-by: Heiko Schocher Signed-off-by: Sekhar Nori Cc: davinci-linux-open-sou...@linux.davincidsp.com Cc: linux-arm-ker...@lists.infradead.org Cc: devicetree-disc...@lists.ozlabs.org Cc: linux-i2c@vger.kernel.org Cc: Ben Dooks Cc: Wolfram Sang Cc: Grant Likely Cc: Sekhar Nori Cc: Wolfgang Denk Cc: Sylwester Nawrocki --- - changes for v2: - add comments from Sylwester Nawrocki: - use "cell-index" instead "id" - OF_DEV_AUXDATA in the machine code, instead pre-define platform device name - add comment from Grant Likely: - removed "id" resp. "cell-index" completely - fixed documentation - use of_match_ptr() - use devm_kzalloc() for allocating plattform data mem - fixed a whitespace issue - no changes for v3 - changes for v4 remove "pinmux-handle" property as discussed here: http://www.spinics.net/lists/arm-kernel/msg175701.html with Nori Sekhar - changes for v5 add comments from Grant Likely: - do not change value of dev->dev->platform_data, instead hold a copy in davinci_i2c_dev. - changes for v6: add comments from Sekhar Nori: - removed unneccessary include - merge patch from Sekhar Nori: setup the newly introduced dev->pdata member correctly once in probe -> i2c_get_plattformdata(() not needed, remove a lot of checks for pdata in code - add Signed-off-by: Sekhar Nori - patch no longer in patchserie, as it has no dependencies. --- .../devicetree/bindings/arm/davinci/i2c.txt| 31 drivers/i2c/busses/i2c-davinci.c | 50 +++ 2 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/davinci/i2c.txt diff --git a/Documentation/devicetree/bindings/arm/davinci/i2c.txt b/Documentation/devicetree/bindings/arm/davinci/i2c.txt new file mode 100644 index 000..e98a025 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/davinci/i2c.txt This should go bindings/i2c/... Ok, done. @@ -0,0 +1,31 @@ +* Texas Instruments Davinci I2C + +This file provides information, what the device node for the +davinci i2c interface contain. + +Required properties: +- compatible: "ti,davinci-i2c"; +- reg : Offset and length of the register set for the device + +Recommended properties : +- interrupts : standard interrupt property. +- clock-frequency : desired I2C bus clock frequency in Hz. + +Optional properties: +- bus-delay: bus delay in usec See my mail to Andrew regarding the timeout property in the mv64xxx driver. I'd like to skip the binding discussion for now in order to make it into 3.6. Is it okay for you to drop this binding and use a sane default? Hmm.. current none of code uses 0 as default. This works for the enbw_cmc board. So I use 0 as default, and remove this property. Rest looks good (from a visual review), Thanks for the review. bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html