Message ID | 1300097775-15602-1-git-send-email-leiwen@marvell.com |
---|---|
State | Superseded |
Headers | show |
> -----Original Message----- > From: Lei Wen [mailto:leiwen@marvell.com] > Sent: Monday, March 14, 2011 3:46 PM > To: u-boot@lists.denx.de; Marek Vasut; Prafulla Wadaskar; Lei Wen > Subject: [PATCH 1/8] pxa: move i2c driver to the common place > > For better sharing with other platform other than pxa's, > it is more convenient to put the driver to the common place. > > Signed-off-by: Lei Wen <leiwen@marvell.com> > --- > arch/arm/cpu/pxa/Makefile | 1 - > arch/arm/cpu/pxa/i2c.c | 469 -------------------------------------- > ------- > drivers/i2c/Makefile | 1 + > drivers/i2c/pxa_i2c.c | 469 > +++++++++++++++++++++++++++++++++++++++++++++ Hi Lei It looks like this is cut-paste, have you done git-mv? Pls confirm Secondly Since this will be supported by multiple Marvell SoC cores. How about renaming new moved i2c driver as mvi2c.c? Regards.. Prafulla . .
Hi Prafulla, On Mon, Mar 14, 2011 at 8:03 PM, Prafulla Wadaskar <prafulla@marvell.com> wrote: > > >> -----Original Message----- >> From: Lei Wen [mailto:leiwen@marvell.com] >> Sent: Monday, March 14, 2011 3:46 PM >> To: u-boot@lists.denx.de; Marek Vasut; Prafulla Wadaskar; Lei Wen >> Subject: [PATCH 1/8] pxa: move i2c driver to the common place >> >> For better sharing with other platform other than pxa's, >> it is more convenient to put the driver to the common place. >> >> Signed-off-by: Lei Wen <leiwen@marvell.com> >> --- >> arch/arm/cpu/pxa/Makefile | 1 - >> arch/arm/cpu/pxa/i2c.c | 469 -------------------------------------- >> ------- >> drivers/i2c/Makefile | 1 + >> drivers/i2c/pxa_i2c.c | 469 >> +++++++++++++++++++++++++++++++++++++++++++++ > > Hi Lei > It looks like this is cut-paste, have you done git-mv? Pls confirm Good catch. :) I would use the git-mv to redo the patch. > > Secondly > Since this will be supported by multiple Marvell SoC cores. > How about renaming new moved i2c driver as mvi2c.c? Yep, I'm ok with this change. I would post modified patch later. Thanks, Lei
V2: rename the previous pxa_i2c to mvi2c, since this driver would be shared by many other Marvell platforms. Lei Wen (5): pxa: move i2c driver to the common place mvi2c: use structure to replace the direclty define I2C: add i2c support for Pantheon platform I2C: mvi2c: add multi bus support I2C: add i2c support for Armada100 platform arch/arm/cpu/arm926ejs/armada100/cpu.c | 14 + arch/arm/cpu/arm926ejs/pantheon/cpu.c | 10 + arch/arm/cpu/pxa/Makefile | 1 - arch/arm/cpu/pxa/cpu.c | 11 + arch/arm/cpu/pxa/i2c.c | 469 ------------------------ arch/arm/include/asm/arch-armada100/mfp.h | 4 + arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- arch/arm/include/asm/arch-pantheon/mfp.h | 2 + arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 --- board/Marvell/aspenite/aspenite.c | 5 + board/Marvell/dkb/dkb.c | 4 + board/innokom/innokom.c | 9 +- drivers/i2c/Makefile | 1 + drivers/i2c/mvi2c.c | 559 +++++++++++++++++++++++++++++ include/configs/aspenite.h | 12 + include/configs/dkb.h | 11 + include/configs/innokom.h | 2 + include/configs/xm250.h | 2 + 18 files changed, 641 insertions(+), 535 deletions(-) delete mode 100644 arch/arm/cpu/pxa/i2c.c create mode 100644 drivers/i2c/mvi2c.c
Dear Lei Wen, In message <1300160443-12552-1-git-send-email-leiwen@marvell.com> you wrote: > V2: > rename the previous pxa_i2c to mvi2c, since this driver would be shared > by many other Marvell platforms. > > Lei Wen (5): > pxa: move i2c driver to the common place > mvi2c: use structure to replace the direclty define > I2C: add i2c support for Pantheon platform > I2C: mvi2c: add multi bus support > I2C: add i2c support for Armada100 platform Checkpatch says: [U-Boot] [PATCH V2 1/5] pxa: move i2c driver to the common place total: 57 errors, 7 warnings, 497 lines checked [U-Boot] [PATCH v2 2/5] mvi2c: use structure to replace the total: 2 errors, 1 warnings, 333 lines checked [U-Boot] [PATCH v2 3/5] I2C: add i2c support for Pantheon platform total: 2 errors, 1 warnings, 64 lines checked [U-Boot] [PATCH v2 4/5] I2C: mvi2c: add multi bus support total: 2 errors, 0 warnings, 51 lines checked [U-Boot] [PATCH v2 5/5] I2C: add i2c support for Armada100 platform total: 2 errors, 1 warnings, 65 lines checked Please cleanup! and next time please run checkpatch _before_ submitting! Thanks. Best regards, Wolfgang Denk
Hi Wolfgang, On Tue, Mar 15, 2011 at 4:12 PM, Wolfgang Denk <wd@denx.de> wrote: > Dear Lei Wen, > > In message <1300160443-12552-1-git-send-email-leiwen@marvell.com> you wrote: >> V2: >> rename the previous pxa_i2c to mvi2c, since this driver would be shared >> by many other Marvell platforms. >> >> Lei Wen (5): >> pxa: move i2c driver to the common place >> mvi2c: use structure to replace the direclty define >> I2C: add i2c support for Pantheon platform >> I2C: mvi2c: add multi bus support >> I2C: add i2c support for Armada100 platform > > Checkpatch says: > > [U-Boot] [PATCH V2 1/5] pxa: move i2c driver to the common place > total: 57 errors, 7 warnings, 497 lines checked > [U-Boot] [PATCH v2 2/5] mvi2c: use structure to replace the > total: 2 errors, 1 warnings, 333 lines checked > [U-Boot] [PATCH v2 3/5] I2C: add i2c support for Pantheon platform > total: 2 errors, 1 warnings, 64 lines checked > [U-Boot] [PATCH v2 4/5] I2C: mvi2c: add multi bus support > total: 2 errors, 0 warnings, 51 lines checked > [U-Boot] [PATCH v2 5/5] I2C: add i2c support for Armada100 platform > total: 2 errors, 1 warnings, 65 lines checked > > Please cleanup! > > and next time please run checkpatch _before_ submitting! > Thanks for reminding this. V3 patch to come. :) Best regards, Lei
V2: rename the previous pxa_i2c to mvi2c, since this driver would be shared by many other Marvell platforms. V3: Clean the code sytle issue Lei Wen (5): pxa: move i2c driver to the common place mv_i2c: use structure to replace the direclty define I2C: add i2c support for Pantheon platform I2C: mv_i2c: add multi bus support I2C: add i2c support for Armada100 platform arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + arch/arm/cpu/pxa/Makefile | 1 - arch/arm/cpu/pxa/cpu.c | 11 + arch/arm/cpu/pxa/i2c.c | 469 ---------------------------- arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 ---- board/Marvell/aspenite/aspenite.c | 5 + board/Marvell/dkb/dkb.c | 4 + board/innokom/innokom.c | 9 +- drivers/i2c/Makefile | 1 + drivers/i2c/mv_i2c.c | 481 +++++++++++++++++++++++++++++ drivers/i2c/mv_i2c.h | 83 +++++ include/configs/aspenite.h | 12 + include/configs/dkb.h | 11 + include/configs/innokom.h | 2 + include/configs/xm250.h | 2 + 19 files changed, 670 insertions(+), 555 deletions(-) delete mode 100644 arch/arm/cpu/pxa/i2c.c create mode 100644 drivers/i2c/mv_i2c.c create mode 100644 drivers/i2c/mv_i2c.h
V2: rename the previous pxa_i2c to mvi2c, since this driver would be shared by many other Marvell platforms. V3: Clean the code sytle issue V4: add and* and or* to make set bit operation generic Also make i2c definition included in the ifdef Lei Wen (6): io: add and* and or* operation api to set and clear bit pxa: move i2c driver to the common place mv_i2c: use structure to replace the direclty define I2C: add i2c support for Pantheon platform I2C: mv_i2c: add multi bus support I2C: add i2c support for Armada100 platform arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + arch/arm/cpu/pxa/Makefile | 1 - arch/arm/cpu/pxa/cpu.c | 11 + arch/arm/cpu/pxa/i2c.c | 469 ---------------------------- arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 ---- arch/arm/include/asm/io.h | 8 + board/Marvell/aspenite/aspenite.c | 5 + board/Marvell/dkb/dkb.c | 4 + board/innokom/innokom.c | 9 +- drivers/i2c/Makefile | 1 + drivers/i2c/mv_i2c.c | 479 +++++++++++++++++++++++++++++ drivers/i2c/mv_i2c.h | 83 +++++ include/configs/aspenite.h | 14 + include/configs/dkb.h | 13 + include/configs/innokom.h | 2 + include/configs/xm250.h | 2 + 20 files changed, 680 insertions(+), 555 deletions(-) delete mode 100644 arch/arm/cpu/pxa/i2c.c create mode 100644 drivers/i2c/mv_i2c.c create mode 100644 drivers/i2c/mv_i2c.h
V2: rename the previous pxa_i2c to mvi2c, since this driver would be shared by many other Marvell platforms. V3: Clean the code sytle issue V4: add and* and or* to make set bit operation generic Also make i2c definition included in the ifdef V5: Fix code style issue of the first patch Lei Wen (6): io: add and* and or* operation api to set and clear bit pxa: move i2c driver to the common place mv_i2c: use structure to replace the direclty define I2C: add i2c support for Pantheon platform I2C: mv_i2c: add multi bus support I2C: add i2c support for Armada100 platform arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + arch/arm/cpu/pxa/Makefile | 1 - arch/arm/cpu/pxa/cpu.c | 11 + arch/arm/cpu/pxa/i2c.c | 469 ---------------------------- arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 ---- arch/arm/include/asm/io.h | 8 + board/Marvell/aspenite/aspenite.c | 5 + board/Marvell/dkb/dkb.c | 4 + board/innokom/innokom.c | 9 +- drivers/i2c/Makefile | 1 + drivers/i2c/mv_i2c.c | 479 +++++++++++++++++++++++++++++ drivers/i2c/mv_i2c.h | 83 +++++ include/configs/aspenite.h | 14 + include/configs/dkb.h | 13 + include/configs/innokom.h | 2 + include/configs/xm250.h | 2 + 20 files changed, 680 insertions(+), 555 deletions(-) delete mode 100644 arch/arm/cpu/pxa/i2c.c create mode 100644 drivers/i2c/mv_i2c.c create mode 100644 drivers/i2c/mv_i2c.h
V2: rename the previous pxa_i2c to mvi2c, since this driver would be shared by many other Marvell platforms. V3: Clean the code sytle issue V4: add and* and or* to make set bit operation generic Also make i2c definition included in the ifdef V5: Fix code style issue of the first patch V6: Seperate the and* and or* patch out of the patch set Move CONFIG_CMD_I2C define place Lei Wen (5): pxa: move i2c driver to the common place mv_i2c: use structure to replace the direclty define I2C: add i2c support for Pantheon platform I2C: mv_i2c: add multi bus support I2C: add i2c support for Armada100 platform arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + arch/arm/cpu/pxa/Makefile | 1 - arch/arm/cpu/pxa/cpu.c | 11 + arch/arm/cpu/pxa/i2c.c | 469 ---------------------------- arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 ---- board/Marvell/aspenite/aspenite.c | 5 + board/Marvell/dkb/dkb.c | 4 + board/innokom/innokom.c | 9 +- drivers/i2c/Makefile | 1 + drivers/i2c/mv_i2c.c | 479 +++++++++++++++++++++++++++++ drivers/i2c/mv_i2c.h | 83 +++++ include/configs/aspenite.h | 14 + include/configs/dkb.h | 13 + include/configs/innokom.h | 2 + include/configs/xm250.h | 2 + 19 files changed, 672 insertions(+), 555 deletions(-) delete mode 100644 arch/arm/cpu/pxa/i2c.c create mode 100644 drivers/i2c/mv_i2c.c create mode 100644 drivers/i2c/mv_i2c.h
V2: rename the previous pxa_i2c to mvi2c, since this driver would be shared by many other Marvell platforms. V3: Clean the code sytle issue V4: add and* and or* to make set bit operation generic Also make i2c definition included in the ifdef V5: Fix code style issue of the first patch V6: Seperate the and* and or* patch out of the patch set Move CONFIG_CMD_I2C define place V7: Fix comments style Make global change from PXA to MV Move i2c config setting to <arch/config> Lei Wen (5): pxa: move i2c driver to the common place mv_i2c: use structure to replace the direclty define I2C: add i2c support for Pantheon platform I2C: mv_i2c: add multi bus support I2C: add i2c support for Armada100 platform arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + arch/arm/cpu/pxa/Makefile | 1 - arch/arm/cpu/pxa/cpu.c | 10 + arch/arm/cpu/pxa/i2c.c | 469 ------------------------- arch/arm/include/asm/arch-armada100/config.h | 12 + arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- arch/arm/include/asm/arch-pantheon/config.h | 10 + arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 --- board/Marvell/aspenite/aspenite.c | 5 + board/Marvell/dkb/dkb.c | 4 + board/innokom/innokom.c | 9 +- drivers/i2c/Makefile | 1 + drivers/i2c/mv_i2c.c | 481 ++++++++++++++++++++++++++ drivers/i2c/mv_i2c.h | 83 +++++ include/configs/aspenite.h | 1 + include/configs/dkb.h | 2 + include/configs/innokom.h | 2 + include/configs/xm250.h | 2 + 21 files changed, 671 insertions(+), 555 deletions(-) delete mode 100644 arch/arm/cpu/pxa/i2c.c create mode 100644 drivers/i2c/mv_i2c.c create mode 100644 drivers/i2c/mv_i2c.h
V2: rename the previous pxa_i2c to mvi2c, since this driver would be shared by many other Marvell platforms. V3: Clean the code sytle issue V4: add and* and or* to make set bit operation generic Also make i2c definition included in the ifdef V5: Fix code style issue of the first patch V6: Seperate the and* and or* patch out of the patch set Move CONFIG_CMD_I2C define place V7: Fix comments style Make global change from PXA to MV Move i2c config setting to <arch/config> V8: Seperate timeout fix patch out Lei Wen (6): pxa: move i2c driver to the common place mv_i2c: fix timeout value to be consistent with comments mv_i2c: use structure to replace the direclty define I2C: add i2c support for Pantheon platform I2C: mv_i2c: add multi bus support I2C: add i2c support for Armada100 platform arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + arch/arm/cpu/pxa/Makefile | 1 - arch/arm/cpu/pxa/cpu.c | 10 + arch/arm/cpu/pxa/i2c.c | 469 ------------------------- arch/arm/include/asm/arch-armada100/config.h | 12 + arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- arch/arm/include/asm/arch-pantheon/config.h | 10 + arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 --- board/Marvell/aspenite/aspenite.c | 5 + board/Marvell/dkb/dkb.c | 4 + board/innokom/innokom.c | 9 +- drivers/i2c/Makefile | 1 + drivers/i2c/mv_i2c.c | 481 ++++++++++++++++++++++++++ drivers/i2c/mv_i2c.h | 83 +++++ include/configs/aspenite.h | 1 + include/configs/dkb.h | 2 + include/configs/innokom.h | 2 + include/configs/xm250.h | 2 + 21 files changed, 671 insertions(+), 555 deletions(-) delete mode 100644 arch/arm/cpu/pxa/i2c.c create mode 100644 drivers/i2c/mv_i2c.c create mode 100644 drivers/i2c/mv_i2c.h
> -----Original Message----- > From: Lei Wen [mailto:leiwen@marvell.com] > Sent: Tuesday, April 05, 2011 1:31 PM > To: Heiko Schocher; Prafulla Wadaskar; Wolfgang Denk; u- > boot@lists.denx.de; Marek Vasut; Ashish Karkare; Prabhanjan Sarnaik; Yu > Tang; adrian.wenl@gmail.com > Subject: [PATCH V8 0/6] add i2c support to pantheon and aramada100 > > V2: > rename the previous pxa_i2c to mvi2c, since this driver would be shared > by many other Marvell platforms. > > V3: > Clean the code sytle issue > > V4: > add and* and or* to make set bit operation generic > Also make i2c definition included in the ifdef > > V5: > Fix code style issue of the first patch > > V6: > Seperate the and* and or* patch out of the patch set > Move CONFIG_CMD_I2C define place > > V7: > Fix comments style > Make global change from PXA to MV > Move i2c config setting to <arch/config> > > V8: > Seperate timeout fix patch out > > Lei Wen (6): > pxa: move i2c driver to the common place > mv_i2c: fix timeout value to be consistent with comments > mv_i2c: use structure to replace the direclty define > I2C: add i2c support for Pantheon platform > I2C: mv_i2c: add multi bus support > I2C: add i2c support for Armada100 platform I am okay with this patch series. I will pull them on this week end. Meanwhile further comments if any are welcomed. Regards.. Prafulla . .
Hello Prafulle, Prafulla Wadaskar wrote: > >> -----Original Message----- >> From: Lei Wen [mailto:leiwen@marvell.com] >> Sent: Tuesday, April 05, 2011 1:31 PM >> To: Heiko Schocher; Prafulla Wadaskar; Wolfgang Denk; u- >> boot@lists.denx.de; Marek Vasut; Ashish Karkare; Prabhanjan Sarnaik; Yu >> Tang; adrian.wenl@gmail.com >> Subject: [PATCH V8 0/6] add i2c support to pantheon and aramada100 >> >> V2: >> rename the previous pxa_i2c to mvi2c, since this driver would be shared >> by many other Marvell platforms. >> >> V3: >> Clean the code sytle issue >> >> V4: >> add and* and or* to make set bit operation generic >> Also make i2c definition included in the ifdef >> >> V5: >> Fix code style issue of the first patch >> >> V6: >> Seperate the and* and or* patch out of the patch set >> Move CONFIG_CMD_I2C define place >> >> V7: >> Fix comments style >> Make global change from PXA to MV >> Move i2c config setting to <arch/config> >> >> V8: >> Seperate timeout fix patch out >> >> Lei Wen (6): >> pxa: move i2c driver to the common place >> mv_i2c: fix timeout value to be consistent with comments >> mv_i2c: use structure to replace the direclty define >> I2C: add i2c support for Pantheon platform >> I2C: mv_i2c: add multi bus support >> I2C: add i2c support for Armada100 platform > > I am okay with this patch series. > I will pull them on this week end. > Meanwhile further comments if any are welcomed. Ah, Ok, so you can add my: Acked-by: Heiko Schocher <hs@denx.de> bye, Heiko
> -----Original Message----- > From: Lei Wen [mailto:leiwen@marvell.com] > Sent: Tuesday, April 05, 2011 1:31 PM > To: Heiko Schocher; Prafulla Wadaskar; Wolfgang Denk; u- > boot@lists.denx.de; Marek Vasut; Ashish Karkare; Prabhanjan Sarnaik; Yu > Tang; adrian.wenl@gmail.com > Subject: [PATCH V8 0/6] add i2c support to pantheon and aramada100 > > V2: > rename the previous pxa_i2c to mvi2c, since this driver would be shared > by many other Marvell platforms. > > V3: > Clean the code sytle issue > > V4: > add and* and or* to make set bit operation generic > Also make i2c definition included in the ifdef > > V5: > Fix code style issue of the first patch > > V6: > Seperate the and* and or* patch out of the patch set > Move CONFIG_CMD_I2C define place > > V7: > Fix comments style > Make global change from PXA to MV > Move i2c config setting to <arch/config> > > V8: > Seperate timeout fix patch out > > Lei Wen (6): > pxa: move i2c driver to the common place > mv_i2c: fix timeout value to be consistent with comments > mv_i2c: use structure to replace the direclty define > I2C: add i2c support for Pantheon platform > I2C: mv_i2c: add multi bus support > I2C: add i2c support for Armada100 platform > > arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + > arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + > arch/arm/cpu/pxa/Makefile | 1 - > arch/arm/cpu/pxa/cpu.c | 10 + > arch/arm/cpu/pxa/i2c.c | 469 ------------------- > ------ > arch/arm/include/asm/arch-armada100/config.h | 12 + > arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- > arch/arm/include/asm/arch-pantheon/config.h | 10 + > arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- > arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- > arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 --- > board/Marvell/aspenite/aspenite.c | 5 + > board/Marvell/dkb/dkb.c | 4 + > board/innokom/innokom.c | 9 +- > drivers/i2c/Makefile | 1 + > drivers/i2c/mv_i2c.c | 481 > ++++++++++++++++++++++++++ > drivers/i2c/mv_i2c.h | 83 +++++ > include/configs/aspenite.h | 1 + > include/configs/dkb.h | 2 + > include/configs/innokom.h | 2 + > include/configs/xm250.h | 2 + > 21 files changed, 671 insertions(+), 555 deletions(-) > delete mode 100644 arch/arm/cpu/pxa/i2c.c > create mode 100644 drivers/i2c/mv_i2c.c > create mode 100644 drivers/i2c/mv_i2c.h Dear Lei I have trying to apply this patch series to u-boot-marvell.git master branch. Since I have rebased this branch to latest u-boot-arm.git master. This patch series cannot be cleanly applied. Can you pls provide new one in sync with latest pull from u-boot-marvell.git master branch? Regards.. Prafulla . .
Hi Prafulla, On Wed, Apr 13, 2011 at 10:01 PM, Prafulla Wadaskar <prafulla@marvell.com> wrote: > > >> -----Original Message----- >> From: Lei Wen [mailto:leiwen@marvell.com] >> Sent: Tuesday, April 05, 2011 1:31 PM >> To: Heiko Schocher; Prafulla Wadaskar; Wolfgang Denk; u- >> boot@lists.denx.de; Marek Vasut; Ashish Karkare; Prabhanjan Sarnaik; Yu >> Tang; adrian.wenl@gmail.com >> Subject: [PATCH V8 0/6] add i2c support to pantheon and aramada100 >> >> V2: >> rename the previous pxa_i2c to mvi2c, since this driver would be shared >> by many other Marvell platforms. >> >> V3: >> Clean the code sytle issue >> >> V4: >> add and* and or* to make set bit operation generic >> Also make i2c definition included in the ifdef >> >> V5: >> Fix code style issue of the first patch >> >> V6: >> Seperate the and* and or* patch out of the patch set >> Move CONFIG_CMD_I2C define place >> >> V7: >> Fix comments style >> Make global change from PXA to MV >> Move i2c config setting to <arch/config> >> >> V8: >> Seperate timeout fix patch out >> >> Lei Wen (6): >> pxa: move i2c driver to the common place >> mv_i2c: fix timeout value to be consistent with comments >> mv_i2c: use structure to replace the direclty define >> I2C: add i2c support for Pantheon platform >> I2C: mv_i2c: add multi bus support >> I2C: add i2c support for Armada100 platform >> >> arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + >> arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + >> arch/arm/cpu/pxa/Makefile | 1 - >> arch/arm/cpu/pxa/cpu.c | 10 + >> arch/arm/cpu/pxa/i2c.c | 469 ------------------- >> ------ >> arch/arm/include/asm/arch-armada100/config.h | 12 + >> arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- >> arch/arm/include/asm/arch-pantheon/config.h | 10 + >> arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- >> arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- >> arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 --- >> board/Marvell/aspenite/aspenite.c | 5 + >> board/Marvell/dkb/dkb.c | 4 + >> board/innokom/innokom.c | 9 +- >> drivers/i2c/Makefile | 1 + >> drivers/i2c/mv_i2c.c | 481 >> ++++++++++++++++++++++++++ >> drivers/i2c/mv_i2c.h | 83 +++++ >> include/configs/aspenite.h | 1 + >> include/configs/dkb.h | 2 + >> include/configs/innokom.h | 2 + >> include/configs/xm250.h | 2 + >> 21 files changed, 671 insertions(+), 555 deletions(-) >> delete mode 100644 arch/arm/cpu/pxa/i2c.c >> create mode 100644 drivers/i2c/mv_i2c.c >> create mode 100644 drivers/i2c/mv_i2c.h > > Dear Lei > I have trying to apply this patch series to u-boot-marvell.git master branch. > Since I have rebased this branch to latest u-boot-arm.git master. > > This patch series cannot be cleanly applied. > > Can you pls provide new one in sync with latest pull from u-boot-marvell.git master branch? > I just apply those patch on master branch without any warning. Are you apply the V8 series? leiwen@ubuntu:~/reps/works/u-boot-marvell$ git am ~/reps/works/u-boot/20110411/0001-pxa-move-i2c-driver-to-the-common-place.patch Applying: pxa: move i2c driver to the common place leiwen@ubuntu:~/reps/works/u-boot-marvell$ git am ~/reps/works/u-boot/20110411/0002-mv_i2c-fix-timeout-value-to-be-consistent-with-comme.patch Applying: mv_i2c: fix timeout value to be consistent with comments leiwen@ubuntu:~/reps/works/u-boot-marvell$ git am ~/reps/works/u-boot/20110411/0003-mv_i2c-use-structure-to-replace-the-direclty-define.patch Applying: mv_i2c: use structure to replace the direclty define leiwen@ubuntu:~/reps/works/u-boot-marvell$ git am ~/reps/works/u-boot/20110411/0004-I2C-add-i2c-support-for-Pantheon-platform.patch Applying: I2C: add i2c support for Pantheon platform leiwen@ubuntu:~/reps/works/u-boot-marvell$ git am ~/reps/works/u-boot/20110411/0005-I2C-mv_i2c-add-multi-bus-support.patch Applying: I2C: mv_i2c: add multi bus support leiwen@ubuntu:~/reps/works/u-boot-marvell$ git am ~/reps/works/u-boot/20110411/0006-I2C-add-i2c-support-for-Armada100-platform.patch Applying: I2C: add i2c support for Armada100 platform 7ad84a1ad5fb2d55efcf87a5b37d1e013283191e I2C: add i2c support for Armada100 platform 7fe7e01ca592e978b18ec37bd4ac36cfb13b7538 I2C: mv_i2c: add multi bus support 89f9b6a3714fd898f46370b3729040b29b820681 I2C: add i2c support for Pantheon platform 8bb0300e9de3d45959282fa0ddcd06e48f3edfaf mv_i2c: use structure to replace the direclty define 04390287c9101169fbf6f7015290f2f73cf6b193 mv_i2c: fix timeout value to be consistent with comments 84e1db708ade04ab014b72bcdc8e657bc9ae5b1c pxa: move i2c driver to the common place 162987fcf760ed54df5fb95018036ade636b5cd3 MX25: tx25: Add _end section on nand_spl feb28e18dab7c583b6d0d20e89256271ef1ac6ad MX31: mx31pdk: fix nand_spl Best regards, Lei
> -----Original Message----- > From: Lei Wen [mailto:adrian.wenl@gmail.com] > Sent: Wednesday, April 13, 2011 7:44 PM > To: Prafulla Wadaskar > Cc: Lei Wen; Heiko Schocher; Wolfgang Denk; u-boot@lists.denx.de; Marek > Vasut; Ashish Karkare; Prabhanjan Sarnaik; Yu Tang > Subject: Re: [PATCH V8 0/6] add i2c support to pantheon and aramada100 > > Hi Prafulla, > > On Wed, Apr 13, 2011 at 10:01 PM, Prafulla Wadaskar > <prafulla@marvell.com> wrote: > > > > > >> -----Original Message----- > >> From: Lei Wen [mailto:leiwen@marvell.com] > >> Sent: Tuesday, April 05, 2011 1:31 PM > >> To: Heiko Schocher; Prafulla Wadaskar; Wolfgang Denk; u- > >> boot@lists.denx.de; Marek Vasut; Ashish Karkare; Prabhanjan Sarnaik; > Yu > >> Tang; adrian.wenl@gmail.com > >> Subject: [PATCH V8 0/6] add i2c support to pantheon and aramada100 > >> > >> V2: > >> rename the previous pxa_i2c to mvi2c, since this driver would be > shared > >> by many other Marvell platforms. > >> > >> V3: > >> Clean the code sytle issue > >> > >> V4: > >> add and* and or* to make set bit operation generic > >> Also make i2c definition included in the ifdef > >> > >> V5: > >> Fix code style issue of the first patch > >> > >> V6: > >> Seperate the and* and or* patch out of the patch set > >> Move CONFIG_CMD_I2C define place > >> > >> V7: > >> Fix comments style > >> Make global change from PXA to MV > >> Move i2c config setting to <arch/config> > >> > >> V8: > >> Seperate timeout fix patch out > >> > >> Lei Wen (6): > >> pxa: move i2c driver to the common place > >> mv_i2c: fix timeout value to be consistent with comments > >> mv_i2c: use structure to replace the direclty define > >> I2C: add i2c support for Pantheon platform > >> I2C: mv_i2c: add multi bus support > >> I2C: add i2c support for Armada100 platform > >> > >> arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + > >> arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + > >> arch/arm/cpu/pxa/Makefile | 1 - > >> arch/arm/cpu/pxa/cpu.c | 10 + > >> arch/arm/cpu/pxa/i2c.c | 469 ---------------- > --- > >> ------ > >> arch/arm/include/asm/arch-armada100/config.h | 12 + > >> arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- > >> arch/arm/include/asm/arch-pantheon/config.h | 10 + > >> arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- > >> arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- > >> arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 --- > >> board/Marvell/aspenite/aspenite.c | 5 + > >> board/Marvell/dkb/dkb.c | 4 + > >> board/innokom/innokom.c | 9 +- > >> drivers/i2c/Makefile | 1 + > >> drivers/i2c/mv_i2c.c | 481 > >> ++++++++++++++++++++++++++ > >> drivers/i2c/mv_i2c.h | 83 +++++ > >> include/configs/aspenite.h | 1 + > >> include/configs/dkb.h | 2 + > >> include/configs/innokom.h | 2 + > >> include/configs/xm250.h | 2 + > >> 21 files changed, 671 insertions(+), 555 deletions(-) > >> delete mode 100644 arch/arm/cpu/pxa/i2c.c > >> create mode 100644 drivers/i2c/mv_i2c.c > >> create mode 100644 drivers/i2c/mv_i2c.h > > > > Dear Lei > > I have trying to apply this patch series to u-boot-marvell.git master > branch. > > Since I have rebased this branch to latest u-boot-arm.git master. > > > > This patch series cannot be cleanly applied. > > > > Can you pls provide new one in sync with latest pull from u-boot- > marvell.git master branch? > > > > I just apply those patch on master branch without any warning. > Are you apply the V8 series? Yes, I am using V8 patches. Have you done git pull before that? What is your latest git log? (before applying patches) Regards.. Prafulla . .
On Wed, Apr 13, 2011 at 10:26 PM, Prafulla Wadaskar <prafulla@marvell.com> wrote: > > >> -----Original Message----- >> From: Lei Wen [mailto:adrian.wenl@gmail.com] >> Sent: Wednesday, April 13, 2011 7:44 PM >> To: Prafulla Wadaskar >> Cc: Lei Wen; Heiko Schocher; Wolfgang Denk; u-boot@lists.denx.de; Marek >> Vasut; Ashish Karkare; Prabhanjan Sarnaik; Yu Tang >> Subject: Re: [PATCH V8 0/6] add i2c support to pantheon and aramada100 >> >> Hi Prafulla, >> >> On Wed, Apr 13, 2011 at 10:01 PM, Prafulla Wadaskar >> <prafulla@marvell.com> wrote: >> > >> > >> >> -----Original Message----- >> >> From: Lei Wen [mailto:leiwen@marvell.com] >> >> Sent: Tuesday, April 05, 2011 1:31 PM >> >> To: Heiko Schocher; Prafulla Wadaskar; Wolfgang Denk; u- >> >> boot@lists.denx.de; Marek Vasut; Ashish Karkare; Prabhanjan Sarnaik; >> Yu >> >> Tang; adrian.wenl@gmail.com >> >> Subject: [PATCH V8 0/6] add i2c support to pantheon and aramada100 >> >> >> >> V2: >> >> rename the previous pxa_i2c to mvi2c, since this driver would be >> shared >> >> by many other Marvell platforms. >> >> >> >> V3: >> >> Clean the code sytle issue >> >> >> >> V4: >> >> add and* and or* to make set bit operation generic >> >> Also make i2c definition included in the ifdef >> >> >> >> V5: >> >> Fix code style issue of the first patch >> >> >> >> V6: >> >> Seperate the and* and or* patch out of the patch set >> >> Move CONFIG_CMD_I2C define place >> >> >> >> V7: >> >> Fix comments style >> >> Make global change from PXA to MV >> >> Move i2c config setting to <arch/config> >> >> >> >> V8: >> >> Seperate timeout fix patch out >> >> >> >> Lei Wen (6): >> >> pxa: move i2c driver to the common place >> >> mv_i2c: fix timeout value to be consistent with comments >> >> mv_i2c: use structure to replace the direclty define >> >> I2C: add i2c support for Pantheon platform >> >> I2C: mv_i2c: add multi bus support >> >> I2C: add i2c support for Armada100 platform >> >> >> >> arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + >> >> arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + >> >> arch/arm/cpu/pxa/Makefile | 1 - >> >> arch/arm/cpu/pxa/cpu.c | 10 + >> >> arch/arm/cpu/pxa/i2c.c | 469 ---------------- >> --- >> >> ------ >> >> arch/arm/include/asm/arch-armada100/config.h | 12 + >> >> arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- >> >> arch/arm/include/asm/arch-pantheon/config.h | 10 + >> >> arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- >> >> arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- >> >> arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 --- >> >> board/Marvell/aspenite/aspenite.c | 5 + >> >> board/Marvell/dkb/dkb.c | 4 + >> >> board/innokom/innokom.c | 9 +- >> >> drivers/i2c/Makefile | 1 + >> >> drivers/i2c/mv_i2c.c | 481 >> >> ++++++++++++++++++++++++++ >> >> drivers/i2c/mv_i2c.h | 83 +++++ >> >> include/configs/aspenite.h | 1 + >> >> include/configs/dkb.h | 2 + >> >> include/configs/innokom.h | 2 + >> >> include/configs/xm250.h | 2 + >> >> 21 files changed, 671 insertions(+), 555 deletions(-) >> >> delete mode 100644 arch/arm/cpu/pxa/i2c.c >> >> create mode 100644 drivers/i2c/mv_i2c.c >> >> create mode 100644 drivers/i2c/mv_i2c.h >> > >> > Dear Lei >> > I have trying to apply this patch series to u-boot-marvell.git master >> branch. >> > Since I have rebased this branch to latest u-boot-arm.git master. >> > >> > This patch series cannot be cleanly applied. >> > >> > Can you pls provide new one in sync with latest pull from u-boot- >> marvell.git master branch? >> > >> >> I just apply those patch on master branch without any warning. >> Are you apply the V8 series? > > Yes, I am using V8 patches. > Have you done git pull before that? > What is your latest git log? (before applying patches) > The commit apply is based on: commit 162987fcf760ed54df5fb95018036ade636b5cd3 Author: Fabio Estevam <festevam@gmail.com> Date: Sun Apr 3 12:17:19 2011 +0000 MX25: tx25: Add _end section on nand_spl Isn't it the latest? Best regards, Lei
> -----Original Message----- > From: Lei Wen [mailto:leiwen@marvell.com] > Sent: Tuesday, April 05, 2011 1:31 PM > To: Heiko Schocher; Prafulla Wadaskar; Wolfgang Denk; u- > boot@lists.denx.de; Marek Vasut; Ashish Karkare; Prabhanjan Sarnaik; Yu > Tang; adrian.wenl@gmail.com > Subject: [PATCH V8 0/6] add i2c support to pantheon and aramada100 > > V2: > rename the previous pxa_i2c to mvi2c, since this driver would be shared > by many other Marvell platforms. > > V3: > Clean the code sytle issue > > V4: > add and* and or* to make set bit operation generic > Also make i2c definition included in the ifdef > > V5: > Fix code style issue of the first patch > > V6: > Seperate the and* and or* patch out of the patch set > Move CONFIG_CMD_I2C define place > > V7: > Fix comments style > Make global change from PXA to MV > Move i2c config setting to <arch/config> > > V8: > Seperate timeout fix patch out > > Lei Wen (6): > pxa: move i2c driver to the common place > mv_i2c: fix timeout value to be consistent with comments > mv_i2c: use structure to replace the direclty define > I2C: add i2c support for Pantheon platform > I2C: mv_i2c: add multi bus support > I2C: add i2c support for Armada100 platform > > arch/arm/cpu/arm926ejs/armada100/cpu.c | 16 + > arch/arm/cpu/arm926ejs/pantheon/cpu.c | 12 + > arch/arm/cpu/pxa/Makefile | 1 - > arch/arm/cpu/pxa/cpu.c | 10 + > arch/arm/cpu/pxa/i2c.c | 469 ------------------- > ------ > arch/arm/include/asm/arch-armada100/config.h | 12 + > arch/arm/include/asm/arch-armada100/mfp.h | 40 ++- > arch/arm/include/asm/arch-pantheon/config.h | 10 + > arch/arm/include/asm/arch-pantheon/cpu.h | 4 +- > arch/arm/include/asm/arch-pantheon/mfp.h | 6 +- > arch/arm/include/asm/arch-pxa/pxa-regs.h | 56 --- > board/Marvell/aspenite/aspenite.c | 5 + > board/Marvell/dkb/dkb.c | 4 + > board/innokom/innokom.c | 9 +- > drivers/i2c/Makefile | 1 + > drivers/i2c/mv_i2c.c | 481 > ++++++++++++++++++++++++++ > drivers/i2c/mv_i2c.h | 83 +++++ > include/configs/aspenite.h | 1 + > include/configs/dkb.h | 2 + > include/configs/innokom.h | 2 + > include/configs/xm250.h | 2 + > 21 files changed, 671 insertions(+), 555 deletions(-) > delete mode 100644 arch/arm/cpu/pxa/i2c.c > create mode 100644 drivers/i2c/mv_i2c.c > create mode 100644 drivers/i2c/mv_i2c.h Applied this patch series to u-boot-marvell.git master branch Regards.. Prafulla . .
diff --git a/arch/arm/cpu/pxa/Makefile b/arch/arm/cpu/pxa/Makefile index 49a6ed3..e8b59a3 100644 --- a/arch/arm/cpu/pxa/Makefile +++ b/arch/arm/cpu/pxa/Makefile @@ -28,7 +28,6 @@ LIB = $(obj)lib$(CPU).o START = start.o COBJS += cpu.o -COBJS += i2c.o COBJS += pxafb.o COBJS += timer.o COBJS += usb.o diff --git a/arch/arm/cpu/pxa/i2c.c b/arch/arm/cpu/pxa/i2c.c deleted file mode 100644 index 7aa49ae..0000000 --- a/arch/arm/cpu/pxa/i2c.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * (C) Copyright 2000 - * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it - * - * (C) Copyright 2000 Sysgo Real-Time Solutions, GmbH <www.elinos.com> - * Marius Groeger <mgroeger@sysgo.de> - * - * (C) Copyright 2003 Pengutronix e.K. - * Robert Schwebel <r.schwebel@pengutronix.de> - * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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; either version 2 of - * the License, or (at your option) any later version. - * - * 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., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * Back ported to the 8xx platform (from the 8260 platform) by - * Murray.Jensen@cmst.csiro.au, 27-Jan-01. - */ - -/* FIXME: this file is PXA255 specific! What about other XScales? */ - -#include <common.h> -#include <asm/io.h> - -#ifdef CONFIG_HARD_I2C - -/* - * - CONFIG_SYS_I2C_SPEED - * - I2C_PXA_SLAVE_ADDR - */ - -#include <asm/arch/hardware.h> -#include <asm/arch/pxa-regs.h> -#include <i2c.h> - -/*#define DEBUG_I2C 1 /###* activate local debugging output */ -#define I2C_PXA_SLAVE_ADDR 0x1 /* slave pxa unit address */ - -#if (CONFIG_SYS_I2C_SPEED == 400000) -#define I2C_ICR_INIT (ICR_FM | ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) -#else -#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) -#endif - -#define I2C_ISR_INIT 0x7FF - -#ifdef DEBUG_I2C -#define PRINTD(x) printf x -#else -#define PRINTD(x) -#endif - - -/* Shall the current transfer have a start/stop condition? */ -#define I2C_COND_NORMAL 0 -#define I2C_COND_START 1 -#define I2C_COND_STOP 2 - -/* Shall the current transfer be ack/nacked or being waited for it? */ -#define I2C_ACKNAK_WAITACK 1 -#define I2C_ACKNAK_SENDACK 2 -#define I2C_ACKNAK_SENDNAK 4 - -/* Specify who shall transfer the data (master or slave) */ -#define I2C_READ 0 -#define I2C_WRITE 1 - -/* All transfers are described by this data structure */ -struct i2c_msg { - u8 condition; - u8 acknack; - u8 direction; - u8 data; -}; - - -/** - * i2c_pxa_reset: - reset the host controller - * - */ - -static void i2c_reset( void ) -{ - writel(readl(ICR) & ~ICR_IUE, ICR); /* disable unit */ - writel(readl(ICR) | ICR_UR, ICR); /* reset the unit */ - udelay(100); - writel(readl(ICR) & ~ICR_IUE, ICR); /* disable unit */ -#ifdef CONFIG_CPU_MONAHANS - /* | CKENB_1_PWM1 | CKENB_0_PWM0); */ - writel(readl(CKENB) | (CKENB_4_I2C), CKENB); -#else /* CONFIG_CPU_MONAHANS */ - /* set the global I2C clock on */ - writel(readl(CKEN) | CKEN14_I2C, CKEN); -#endif - writel(I2C_PXA_SLAVE_ADDR, ISAR); /* set our slave address */ - writel(I2C_ICR_INIT, ICR); /* set control reg values */ - writel(I2C_ISR_INIT, ISR); /* set clear interrupt bits */ - writel(readl(ICR) | ICR_IUE, ICR); /* enable unit */ - udelay(100); -} - - -/** - * i2c_isr_set_cleared: - wait until certain bits of the I2C status register - * are set and cleared - * - * @return: 1 in case of success, 0 means timeout (no match within 10 ms). - */ -static int i2c_isr_set_cleared( unsigned long set_mask, unsigned long cleared_mask ) -{ - int timeout = 10000; - - while( ((ISR & set_mask)!=set_mask) || ((ISR & cleared_mask)!=0) ){ - udelay( 10 ); - if( timeout-- < 0 ) return 0; - } - - return 1; -} - - -/** - * i2c_transfer: - Transfer one byte over the i2c bus - * - * This function can tranfer a byte over the i2c bus in both directions. - * It is used by the public API functions. - * - * @return: 0: transfer successful - * -1: message is empty - * -2: transmit timeout - * -3: ACK missing - * -4: receive timeout - * -5: illegal parameters - * -6: bus is busy and couldn't be aquired - */ -int i2c_transfer(struct i2c_msg *msg) -{ - int ret; - - if (!msg) - goto transfer_error_msg_empty; - - switch(msg->direction) { - - case I2C_WRITE: - - /* check if bus is not busy */ - if (!i2c_isr_set_cleared(0,ISR_IBB)) - goto transfer_error_bus_busy; - - /* start transmission */ - writel(readl(ICR) & ~ICR_START, ICR); - writel(readl(ICR) & ~ICR_STOP, ICR); - writel(msg->data, IDBR); - if (msg->condition == I2C_COND_START) - writel(readl(ICR) | ICR_START, ICR); - if (msg->condition == I2C_COND_STOP) - writel(readl(ICR) | ICR_STOP, ICR); - if (msg->acknack == I2C_ACKNAK_SENDNAK) - writel(readl(ICR) | ICR_ACKNAK, ICR); - if (msg->acknack == I2C_ACKNAK_SENDACK) - writel(readl(ICR) & ~ICR_ACKNAK, ICR); - writel(readl(ICR) & ~ICR_ALDIE, ICR); - writel(readl(ICR) | ICR_TB, ICR); - - /* transmit register empty? */ - if (!i2c_isr_set_cleared(ISR_ITE,0)) - goto transfer_error_transmit_timeout; - - /* clear 'transmit empty' state */ - writel(readl(ISR) | ISR_ITE, ISR); - - /* wait for ACK from slave */ - if (msg->acknack == I2C_ACKNAK_WAITACK) - if (!i2c_isr_set_cleared(0,ISR_ACKNAK)) - goto transfer_error_ack_missing; - break; - - case I2C_READ: - - /* check if bus is not busy */ - if (!i2c_isr_set_cleared(0,ISR_IBB)) - goto transfer_error_bus_busy; - - /* start receive */ - writel(readl(ICR) & ~ICR_START, ICR); - writel(readl(ICR) & ~ICR_STOP, ICR); - if (msg->condition == I2C_COND_START) - writel(readl(ICR) | ICR_START, ICR); - if (msg->condition == I2C_COND_STOP) - writel(readl(ICR) | ICR_STOP, ICR); - if (msg->acknack == I2C_ACKNAK_SENDNAK) - writel(readl(ICR) | ICR_ACKNAK, ICR); - if (msg->acknack == I2C_ACKNAK_SENDACK) - writel(readl(ICR) & ~ICR_ACKNAK, ICR); - writel(readl(ICR) & ~ICR_ALDIE, ICR); - writel(readl(ICR) | ICR_TB, ICR); - - /* receive register full? */ - if (!i2c_isr_set_cleared(ISR_IRF,0)) - goto transfer_error_receive_timeout; - - msg->data = readl(IDBR); - - /* clear 'receive empty' state */ - writel(readl(ISR) | ISR_IRF, ISR); - - break; - - default: - - goto transfer_error_illegal_param; - - } - - return 0; - -transfer_error_msg_empty: - PRINTD(("i2c_transfer: error: 'msg' is empty\n")); - ret = -1; goto i2c_transfer_finish; - -transfer_error_transmit_timeout: - PRINTD(("i2c_transfer: error: transmit timeout\n")); - ret = -2; goto i2c_transfer_finish; - -transfer_error_ack_missing: - PRINTD(("i2c_transfer: error: ACK missing\n")); - ret = -3; goto i2c_transfer_finish; - -transfer_error_receive_timeout: - PRINTD(("i2c_transfer: error: receive timeout\n")); - ret = -4; goto i2c_transfer_finish; - -transfer_error_illegal_param: - PRINTD(("i2c_transfer: error: illegal parameters\n")); - ret = -5; goto i2c_transfer_finish; - -transfer_error_bus_busy: - PRINTD(("i2c_transfer: error: bus is busy\n")); - ret = -6; goto i2c_transfer_finish; - -i2c_transfer_finish: - PRINTD(("i2c_transfer: ISR: 0x%04x\n",ISR)); - i2c_reset(); - return ret; - -} - -/* ------------------------------------------------------------------------ */ -/* API Functions */ -/* ------------------------------------------------------------------------ */ - -void i2c_init(int speed, int slaveaddr) -{ -#ifdef CONFIG_SYS_I2C_INIT_BOARD - /* call board specific i2c bus reset routine before accessing the */ - /* environment, which might be in a chip on that bus. For details */ - /* about this problem see doc/I2C_Edge_Conditions. */ - i2c_init_board(); -#endif -} - - -/** - * i2c_probe: - Test if a chip answers for a given i2c address - * - * @chip: address of the chip which is searched for - * @return: 0 if a chip was found, -1 otherwhise - */ - -int i2c_probe(uchar chip) -{ - struct i2c_msg msg; - - i2c_reset(); - - msg.condition = I2C_COND_START; - msg.acknack = I2C_ACKNAK_WAITACK; - msg.direction = I2C_WRITE; - msg.data = (chip << 1) + 1; - if (i2c_transfer(&msg)) return -1; - - msg.condition = I2C_COND_STOP; - msg.acknack = I2C_ACKNAK_SENDNAK; - msg.direction = I2C_READ; - msg.data = 0x00; - if (i2c_transfer(&msg)) return -1; - - return 0; -} - - -/** - * i2c_read: - Read multiple bytes from an i2c device - * - * The higher level routines take into account that this function is only - * called with len < page length of the device (see configuration file) - * - * @chip: address of the chip which is to be read - * @addr: i2c data address within the chip - * @alen: length of the i2c data address (1..2 bytes) - * @buffer: where to write the data - * @len: how much byte do we want to read - * @return: 0 in case of success - */ - -int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) -{ - struct i2c_msg msg; - u8 addr_bytes[3]; /* lowest...highest byte of data address */ - int ret; - - PRINTD(("i2c_read(chip=0x%02x, addr=0x%02x, alen=0x%02x, len=0x%02x)\n",chip,addr,alen,len)); - - i2c_reset(); - - /* dummy chip address write */ - PRINTD(("i2c_read: dummy chip address write\n")); - msg.condition = I2C_COND_START; - msg.acknack = I2C_ACKNAK_WAITACK; - msg.direction = I2C_WRITE; - msg.data = (chip << 1); - msg.data &= 0xFE; - if ((ret=i2c_transfer(&msg))) return -1; - - /* - * send memory address bytes; - * alen defines how much bytes we have to send. - */ - /*addr &= ((1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)-1); */ - addr_bytes[0] = (u8)((addr >> 0) & 0x000000FF); - addr_bytes[1] = (u8)((addr >> 8) & 0x000000FF); - addr_bytes[2] = (u8)((addr >> 16) & 0x000000FF); - - while (--alen >= 0) { - - PRINTD(("i2c_read: send memory word address byte %1d\n",alen)); - msg.condition = I2C_COND_NORMAL; - msg.acknack = I2C_ACKNAK_WAITACK; - msg.direction = I2C_WRITE; - msg.data = addr_bytes[alen]; - if ((ret=i2c_transfer(&msg))) return -1; - } - - - /* start read sequence */ - PRINTD(("i2c_read: start read sequence\n")); - msg.condition = I2C_COND_START; - msg.acknack = I2C_ACKNAK_WAITACK; - msg.direction = I2C_WRITE; - msg.data = (chip << 1); - msg.data |= 0x01; - if ((ret=i2c_transfer(&msg))) return -1; - - /* read bytes; send NACK at last byte */ - while (len--) { - - if (len==0) { - msg.condition = I2C_COND_STOP; - msg.acknack = I2C_ACKNAK_SENDNAK; - } else { - msg.condition = I2C_COND_NORMAL; - msg.acknack = I2C_ACKNAK_SENDACK; - } - - msg.direction = I2C_READ; - msg.data = 0x00; - if ((ret=i2c_transfer(&msg))) return -1; - - *buffer = msg.data; - PRINTD(("i2c_read: reading byte (0x%08x)=0x%02x\n",(unsigned int)buffer,*buffer)); - buffer++; - - } - - i2c_reset(); - - return 0; -} - - -/** - * i2c_write: - Write multiple bytes to an i2c device - * - * The higher level routines take into account that this function is only - * called with len < page length of the device (see configuration file) - * - * @chip: address of the chip which is to be written - * @addr: i2c data address within the chip - * @alen: length of the i2c data address (1..2 bytes) - * @buffer: where to find the data to be written - * @len: how much byte do we want to read - * @return: 0 in case of success - */ - -int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) -{ - struct i2c_msg msg; - u8 addr_bytes[3]; /* lowest...highest byte of data address */ - - PRINTD(("i2c_write(chip=0x%02x, addr=0x%02x, alen=0x%02x, len=0x%02x)\n",chip,addr,alen,len)); - - i2c_reset(); - - /* chip address write */ - PRINTD(("i2c_write: chip address write\n")); - msg.condition = I2C_COND_START; - msg.acknack = I2C_ACKNAK_WAITACK; - msg.direction = I2C_WRITE; - msg.data = (chip << 1); - msg.data &= 0xFE; - if (i2c_transfer(&msg)) return -1; - - /* - * send memory address bytes; - * alen defines how much bytes we have to send. - */ - addr_bytes[0] = (u8)((addr >> 0) & 0x000000FF); - addr_bytes[1] = (u8)((addr >> 8) & 0x000000FF); - addr_bytes[2] = (u8)((addr >> 16) & 0x000000FF); - - while (--alen >= 0) { - - PRINTD(("i2c_write: send memory word address\n")); - msg.condition = I2C_COND_NORMAL; - msg.acknack = I2C_ACKNAK_WAITACK; - msg.direction = I2C_WRITE; - msg.data = addr_bytes[alen]; - if (i2c_transfer(&msg)) return -1; - } - - /* write bytes; send NACK at last byte */ - while (len--) { - - PRINTD(("i2c_write: writing byte (0x%08x)=0x%02x\n",(unsigned int)buffer,*buffer)); - - if (len==0) - msg.condition = I2C_COND_STOP; - else - msg.condition = I2C_COND_NORMAL; - - msg.acknack = I2C_ACKNAK_WAITACK; - msg.direction = I2C_WRITE; - msg.data = *(buffer++); - - if (i2c_transfer(&msg)) return -1; - - } - - i2c_reset(); - - return 0; - -} - -#endif /* CONFIG_HARD_I2C */ diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 052fe36..16308ac 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -35,6 +35,7 @@ COBJS-$(CONFIG_DRIVER_OMAP24XX_I2C) += omap24xx_i2c.o COBJS-$(CONFIG_DRIVER_OMAP34XX_I2C) += omap24xx_i2c.o COBJS-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o COBJS-$(CONFIG_PPC4XX_I2C) += ppc4xx_i2c.o +COBJS-$(CONFIG_PXA_I2C) += pxa_i2c.o COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o COBJS-$(CONFIG_S3C44B0_I2C) += s3c44b0_i2c.o COBJS-$(CONFIG_SOFT_I2C) += soft_i2c.o diff --git a/drivers/i2c/pxa_i2c.c b/drivers/i2c/pxa_i2c.c new file mode 100644 index 0000000..7aa49ae --- /dev/null +++ b/drivers/i2c/pxa_i2c.c @@ -0,0 +1,469 @@ +/* + * (C) Copyright 2000 + * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it + * + * (C) Copyright 2000 Sysgo Real-Time Solutions, GmbH <www.elinos.com> + * Marius Groeger <mgroeger@sysgo.de> + * + * (C) Copyright 2003 Pengutronix e.K. + * Robert Schwebel <r.schwebel@pengutronix.de> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Back ported to the 8xx platform (from the 8260 platform) by + * Murray.Jensen@cmst.csiro.au, 27-Jan-01. + */ + +/* FIXME: this file is PXA255 specific! What about other XScales? */ + +#include <common.h> +#include <asm/io.h> + +#ifdef CONFIG_HARD_I2C + +/* + * - CONFIG_SYS_I2C_SPEED + * - I2C_PXA_SLAVE_ADDR + */ + +#include <asm/arch/hardware.h> +#include <asm/arch/pxa-regs.h> +#include <i2c.h> + +/*#define DEBUG_I2C 1 /###* activate local debugging output */ +#define I2C_PXA_SLAVE_ADDR 0x1 /* slave pxa unit address */ + +#if (CONFIG_SYS_I2C_SPEED == 400000) +#define I2C_ICR_INIT (ICR_FM | ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) +#else +#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) +#endif + +#define I2C_ISR_INIT 0x7FF + +#ifdef DEBUG_I2C +#define PRINTD(x) printf x +#else +#define PRINTD(x) +#endif + + +/* Shall the current transfer have a start/stop condition? */ +#define I2C_COND_NORMAL 0 +#define I2C_COND_START 1 +#define I2C_COND_STOP 2 + +/* Shall the current transfer be ack/nacked or being waited for it? */ +#define I2C_ACKNAK_WAITACK 1 +#define I2C_ACKNAK_SENDACK 2 +#define I2C_ACKNAK_SENDNAK 4 + +/* Specify who shall transfer the data (master or slave) */ +#define I2C_READ 0 +#define I2C_WRITE 1 + +/* All transfers are described by this data structure */ +struct i2c_msg { + u8 condition; + u8 acknack; + u8 direction; + u8 data; +}; + + +/** + * i2c_pxa_reset: - reset the host controller + * + */ + +static void i2c_reset( void ) +{ + writel(readl(ICR) & ~ICR_IUE, ICR); /* disable unit */ + writel(readl(ICR) | ICR_UR, ICR); /* reset the unit */ + udelay(100); + writel(readl(ICR) & ~ICR_IUE, ICR); /* disable unit */ +#ifdef CONFIG_CPU_MONAHANS + /* | CKENB_1_PWM1 | CKENB_0_PWM0); */ + writel(readl(CKENB) | (CKENB_4_I2C), CKENB); +#else /* CONFIG_CPU_MONAHANS */ + /* set the global I2C clock on */ + writel(readl(CKEN) | CKEN14_I2C, CKEN); +#endif + writel(I2C_PXA_SLAVE_ADDR, ISAR); /* set our slave address */ + writel(I2C_ICR_INIT, ICR); /* set control reg values */ + writel(I2C_ISR_INIT, ISR); /* set clear interrupt bits */ + writel(readl(ICR) | ICR_IUE, ICR); /* enable unit */ + udelay(100); +} + + +/** + * i2c_isr_set_cleared: - wait until certain bits of the I2C status register + * are set and cleared + * + * @return: 1 in case of success, 0 means timeout (no match within 10 ms). + */ +static int i2c_isr_set_cleared( unsigned long set_mask, unsigned long cleared_mask ) +{ + int timeout = 10000; + + while( ((ISR & set_mask)!=set_mask) || ((ISR & cleared_mask)!=0) ){ + udelay( 10 ); + if( timeout-- < 0 ) return 0; + } + + return 1; +} + + +/** + * i2c_transfer: - Transfer one byte over the i2c bus + * + * This function can tranfer a byte over the i2c bus in both directions. + * It is used by the public API functions. + * + * @return: 0: transfer successful + * -1: message is empty + * -2: transmit timeout + * -3: ACK missing + * -4: receive timeout + * -5: illegal parameters + * -6: bus is busy and couldn't be aquired + */ +int i2c_transfer(struct i2c_msg *msg) +{ + int ret; + + if (!msg) + goto transfer_error_msg_empty; + + switch(msg->direction) { + + case I2C_WRITE: + + /* check if bus is not busy */ + if (!i2c_isr_set_cleared(0,ISR_IBB)) + goto transfer_error_bus_busy; + + /* start transmission */ + writel(readl(ICR) & ~ICR_START, ICR); + writel(readl(ICR) & ~ICR_STOP, ICR); + writel(msg->data, IDBR); + if (msg->condition == I2C_COND_START) + writel(readl(ICR) | ICR_START, ICR); + if (msg->condition == I2C_COND_STOP) + writel(readl(ICR) | ICR_STOP, ICR); + if (msg->acknack == I2C_ACKNAK_SENDNAK) + writel(readl(ICR) | ICR_ACKNAK, ICR); + if (msg->acknack == I2C_ACKNAK_SENDACK) + writel(readl(ICR) & ~ICR_ACKNAK, ICR); + writel(readl(ICR) & ~ICR_ALDIE, ICR); + writel(readl(ICR) | ICR_TB, ICR); + + /* transmit register empty? */ + if (!i2c_isr_set_cleared(ISR_ITE,0)) + goto transfer_error_transmit_timeout; + + /* clear 'transmit empty' state */ + writel(readl(ISR) | ISR_ITE, ISR); + + /* wait for ACK from slave */ + if (msg->acknack == I2C_ACKNAK_WAITACK) + if (!i2c_isr_set_cleared(0,ISR_ACKNAK)) + goto transfer_error_ack_missing; + break; + + case I2C_READ: + + /* check if bus is not busy */ + if (!i2c_isr_set_cleared(0,ISR_IBB)) + goto transfer_error_bus_busy; + + /* start receive */ + writel(readl(ICR) & ~ICR_START, ICR); + writel(readl(ICR) & ~ICR_STOP, ICR); + if (msg->condition == I2C_COND_START) + writel(readl(ICR) | ICR_START, ICR); + if (msg->condition == I2C_COND_STOP) + writel(readl(ICR) | ICR_STOP, ICR); + if (msg->acknack == I2C_ACKNAK_SENDNAK) + writel(readl(ICR) | ICR_ACKNAK, ICR); + if (msg->acknack == I2C_ACKNAK_SENDACK) + writel(readl(ICR) & ~ICR_ACKNAK, ICR); + writel(readl(ICR) & ~ICR_ALDIE, ICR); + writel(readl(ICR) | ICR_TB, ICR); + + /* receive register full? */ + if (!i2c_isr_set_cleared(ISR_IRF,0)) + goto transfer_error_receive_timeout; + + msg->data = readl(IDBR); + + /* clear 'receive empty' state */ + writel(readl(ISR) | ISR_IRF, ISR); + + break; + + default: + + goto transfer_error_illegal_param; + + } + + return 0; + +transfer_error_msg_empty: + PRINTD(("i2c_transfer: error: 'msg' is empty\n")); + ret = -1; goto i2c_transfer_finish; + +transfer_error_transmit_timeout: + PRINTD(("i2c_transfer: error: transmit timeout\n")); + ret = -2; goto i2c_transfer_finish; + +transfer_error_ack_missing: + PRINTD(("i2c_transfer: error: ACK missing\n")); + ret = -3; goto i2c_transfer_finish; + +transfer_error_receive_timeout: + PRINTD(("i2c_transfer: error: receive timeout\n")); + ret = -4; goto i2c_transfer_finish; + +transfer_error_illegal_param: + PRINTD(("i2c_transfer: error: illegal parameters\n")); + ret = -5; goto i2c_transfer_finish; + +transfer_error_bus_busy: + PRINTD(("i2c_transfer: error: bus is busy\n")); + ret = -6; goto i2c_transfer_finish; + +i2c_transfer_finish: + PRINTD(("i2c_transfer: ISR: 0x%04x\n",ISR)); + i2c_reset(); + return ret; + +} + +/* ------------------------------------------------------------------------ */ +/* API Functions */ +/* ------------------------------------------------------------------------ */ + +void i2c_init(int speed, int slaveaddr) +{ +#ifdef CONFIG_SYS_I2C_INIT_BOARD + /* call board specific i2c bus reset routine before accessing the */ + /* environment, which might be in a chip on that bus. For details */ + /* about this problem see doc/I2C_Edge_Conditions. */ + i2c_init_board(); +#endif +} + + +/** + * i2c_probe: - Test if a chip answers for a given i2c address + * + * @chip: address of the chip which is searched for + * @return: 0 if a chip was found, -1 otherwhise + */ + +int i2c_probe(uchar chip) +{ + struct i2c_msg msg; + + i2c_reset(); + + msg.condition = I2C_COND_START; + msg.acknack = I2C_ACKNAK_WAITACK; + msg.direction = I2C_WRITE; + msg.data = (chip << 1) + 1; + if (i2c_transfer(&msg)) return -1; + + msg.condition = I2C_COND_STOP; + msg.acknack = I2C_ACKNAK_SENDNAK; + msg.direction = I2C_READ; + msg.data = 0x00; + if (i2c_transfer(&msg)) return -1; + + return 0; +} + + +/** + * i2c_read: - Read multiple bytes from an i2c device + * + * The higher level routines take into account that this function is only + * called with len < page length of the device (see configuration file) + * + * @chip: address of the chip which is to be read + * @addr: i2c data address within the chip + * @alen: length of the i2c data address (1..2 bytes) + * @buffer: where to write the data + * @len: how much byte do we want to read + * @return: 0 in case of success + */ + +int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) +{ + struct i2c_msg msg; + u8 addr_bytes[3]; /* lowest...highest byte of data address */ + int ret; + + PRINTD(("i2c_read(chip=0x%02x, addr=0x%02x, alen=0x%02x, len=0x%02x)\n",chip,addr,alen,len)); + + i2c_reset(); + + /* dummy chip address write */ + PRINTD(("i2c_read: dummy chip address write\n")); + msg.condition = I2C_COND_START; + msg.acknack = I2C_ACKNAK_WAITACK; + msg.direction = I2C_WRITE; + msg.data = (chip << 1); + msg.data &= 0xFE; + if ((ret=i2c_transfer(&msg))) return -1; + + /* + * send memory address bytes; + * alen defines how much bytes we have to send. + */ + /*addr &= ((1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)-1); */ + addr_bytes[0] = (u8)((addr >> 0) & 0x000000FF); + addr_bytes[1] = (u8)((addr >> 8) & 0x000000FF); + addr_bytes[2] = (u8)((addr >> 16) & 0x000000FF); + + while (--alen >= 0) { + + PRINTD(("i2c_read: send memory word address byte %1d\n",alen)); + msg.condition = I2C_COND_NORMAL; + msg.acknack = I2C_ACKNAK_WAITACK; + msg.direction = I2C_WRITE; + msg.data = addr_bytes[alen]; + if ((ret=i2c_transfer(&msg))) return -1; + } + + + /* start read sequence */ + PRINTD(("i2c_read: start read sequence\n")); + msg.condition = I2C_COND_START; + msg.acknack = I2C_ACKNAK_WAITACK; + msg.direction = I2C_WRITE; + msg.data = (chip << 1); + msg.data |= 0x01; + if ((ret=i2c_transfer(&msg))) return -1; + + /* read bytes; send NACK at last byte */ + while (len--) { + + if (len==0) { + msg.condition = I2C_COND_STOP; + msg.acknack = I2C_ACKNAK_SENDNAK; + } else { + msg.condition = I2C_COND_NORMAL; + msg.acknack = I2C_ACKNAK_SENDACK; + } + + msg.direction = I2C_READ; + msg.data = 0x00; + if ((ret=i2c_transfer(&msg))) return -1; + + *buffer = msg.data; + PRINTD(("i2c_read: reading byte (0x%08x)=0x%02x\n",(unsigned int)buffer,*buffer)); + buffer++; + + } + + i2c_reset(); + + return 0; +} + + +/** + * i2c_write: - Write multiple bytes to an i2c device + * + * The higher level routines take into account that this function is only + * called with len < page length of the device (see configuration file) + * + * @chip: address of the chip which is to be written + * @addr: i2c data address within the chip + * @alen: length of the i2c data address (1..2 bytes) + * @buffer: where to find the data to be written + * @len: how much byte do we want to read + * @return: 0 in case of success + */ + +int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) +{ + struct i2c_msg msg; + u8 addr_bytes[3]; /* lowest...highest byte of data address */ + + PRINTD(("i2c_write(chip=0x%02x, addr=0x%02x, alen=0x%02x, len=0x%02x)\n",chip,addr,alen,len)); + + i2c_reset(); + + /* chip address write */ + PRINTD(("i2c_write: chip address write\n")); + msg.condition = I2C_COND_START; + msg.acknack = I2C_ACKNAK_WAITACK; + msg.direction = I2C_WRITE; + msg.data = (chip << 1); + msg.data &= 0xFE; + if (i2c_transfer(&msg)) return -1; + + /* + * send memory address bytes; + * alen defines how much bytes we have to send. + */ + addr_bytes[0] = (u8)((addr >> 0) & 0x000000FF); + addr_bytes[1] = (u8)((addr >> 8) & 0x000000FF); + addr_bytes[2] = (u8)((addr >> 16) & 0x000000FF); + + while (--alen >= 0) { + + PRINTD(("i2c_write: send memory word address\n")); + msg.condition = I2C_COND_NORMAL; + msg.acknack = I2C_ACKNAK_WAITACK; + msg.direction = I2C_WRITE; + msg.data = addr_bytes[alen]; + if (i2c_transfer(&msg)) return -1; + } + + /* write bytes; send NACK at last byte */ + while (len--) { + + PRINTD(("i2c_write: writing byte (0x%08x)=0x%02x\n",(unsigned int)buffer,*buffer)); + + if (len==0) + msg.condition = I2C_COND_STOP; + else + msg.condition = I2C_COND_NORMAL; + + msg.acknack = I2C_ACKNAK_WAITACK; + msg.direction = I2C_WRITE; + msg.data = *(buffer++); + + if (i2c_transfer(&msg)) return -1; + + } + + i2c_reset(); + + return 0; + +} + +#endif /* CONFIG_HARD_I2C */ diff --git a/include/configs/innokom.h b/include/configs/innokom.h index d8fcbdb..57d633c 100644 --- a/include/configs/innokom.h +++ b/include/configs/innokom.h @@ -140,6 +140,7 @@ /* * I2C bus */ +#define CONFIG_PXA_I2C 1 #define CONFIG_HARD_I2C 1 #define CONFIG_SYS_I2C_SPEED 50000 #define CONFIG_SYS_I2C_SLAVE 0xfe diff --git a/include/configs/xm250.h b/include/configs/xm250.h index 497cb91..7a7c539 100644 --- a/include/configs/xm250.h +++ b/include/configs/xm250.h @@ -61,6 +61,7 @@ /* * I2C bus */ +#define CONFIG_PXA_I2C 1 #define CONFIG_HARD_I2C 1 #define CONFIG_SYS_I2C_SPEED 50000 #define CONFIG_SYS_I2C_SLAVE 0xfe
For better sharing with other platform other than pxa's, it is more convenient to put the driver to the common place. Signed-off-by: Lei Wen <leiwen@marvell.com> --- arch/arm/cpu/pxa/Makefile | 1 - arch/arm/cpu/pxa/i2c.c | 469 --------------------------------------------- drivers/i2c/Makefile | 1 + drivers/i2c/pxa_i2c.c | 469 +++++++++++++++++++++++++++++++++++++++++++++ include/configs/innokom.h | 1 + include/configs/xm250.h | 1 + 6 files changed, 472 insertions(+), 470 deletions(-) delete mode 100644 arch/arm/cpu/pxa/i2c.c create mode 100644 drivers/i2c/pxa_i2c.c