From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfram Sang Subject: Re: [PATCH 2/8] i2c: i2c-bfin-twi: Stop receiving operation immediately in last rx interrupt. Date: Mon, 11 Jun 2012 18:28:07 +0200 Message-ID: <20120611162807.GC3887@pengutronix.de> References: <1337152826-9850-1-git-send-email-sonic.zhang@analog.com> <1337152826-9850-2-git-send-email-sonic.zhang@analog.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Fig2xvG2VGoz8o/s" Return-path: Content-Disposition: inline In-Reply-To: <1337152826-9850-2-git-send-email-sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org Cc: Ben Dooks , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, LKML , uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org List-Id: linux-i2c@vger.kernel.org --Fig2xvG2VGoz8o/s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 16, 2012 at 03:20:20PM +0800, sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org wrote: > From: Sonic Zhang >=20 > Also wake up waiting process when transfer completes. The description says what you do, but not why it is needed. What bug was experienced and why is this change proper? Patch 5/8 does that quite good. >=20 > Signed-off-by: Sonic Zhang >=20 > git-svn-id: svn://localhost/svn/linux-kernel/trunk@9105 526b6c2d-f592-453= 2-a319-5dd88ccb003d Please remove this line. > --- > drivers/i2c/busses/i2c-bfin-twi.c | 43 ++++++++++++++++++++-----------= ----- > 1 files changed, 24 insertions(+), 19 deletions(-) >=20 > diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-b= fin-twi.c > index e6dd3c9..376e331 100644 > --- a/drivers/i2c/busses/i2c-bfin-twi.c > +++ b/drivers/i2c/busses/i2c-bfin-twi.c > @@ -130,21 +130,25 @@ static void bfin_twi_handle_interrupt(struct bfin_t= wi_iface *iface, > } > iface->transPtr++; > iface->readNum--; > - } else if (iface->manual_stop) { > - /* Avoid possible bus stall - > - * Flush FIFO before issuing the STOP condition > - */ > - read_RCV_DATA16(iface); > - write_MASTER_CTL(iface, > - read_MASTER_CTL(iface) | STOP); > - } else if (iface->cur_mode =3D=3D TWI_I2C_MODE_REPEAT && > - iface->cur_msg + 1 < iface->msg_num) { > - if (iface->pmsg[iface->cur_msg + 1].flags & I2C_M_RD) > - write_MASTER_CTL(iface, > - read_MASTER_CTL(iface) | RSTART | MDIR); > - else > + } > + > + if (iface->readNum =3D=3D 0) { > + if (iface->manual_stop) { > + /* Avoid possible bus stall - > + * Flush FIFO before issuing the STOP condition > + */ > + read_RCV_DATA16(iface); > write_MASTER_CTL(iface, > - (read_MASTER_CTL(iface) | RSTART) & ~MDIR); > + read_MASTER_CTL(iface) | STOP); > + } else if (iface->cur_mode =3D=3D TWI_I2C_MODE_REPEAT && > + iface->cur_msg + 1 < iface->msg_num) { > + if (iface->pmsg[iface->cur_msg + 1].flags & I2C_M_RD) > + write_MASTER_CTL(iface, > + read_MASTER_CTL(iface) | RSTART | MDIR); > + else > + write_MASTER_CTL(iface, > + (read_MASTER_CTL(iface) | RSTART) & ~MDIR); > + } > } > } > if (twi_int_status & MERR) { > @@ -245,12 +249,13 @@ static void bfin_twi_handle_interrupt(struct bfin_t= wi_iface *iface, > } > } > =20 > - if (iface->pmsg[iface->cur_msg].len <=3D 255) > - write_MASTER_CTL(iface, > + if (iface->pmsg[iface->cur_msg].len <=3D 255) { > + write_MASTER_CTL(iface, > (read_MASTER_CTL(iface) & > (~(0xff << 6))) | > - (iface->pmsg[iface->cur_msg].len << 6)); > - else { > + (iface->pmsg[iface->cur_msg].len << 6)); > + iface->manual_stop =3D 0; > + } else { > write_MASTER_CTL(iface, > (read_MASTER_CTL(iface) | > (0xff << 6))); > @@ -264,8 +269,8 @@ static void bfin_twi_handle_interrupt(struct bfin_twi= _iface *iface, > write_INT_MASK(iface, 0); > write_MASTER_CTL(iface, 0); > } > + complete(&iface->complete); > } > - complete(&iface->complete); > } > =20 > /* Interrupt handler */ > --=20 > 1.7.0.4 >=20 >=20 > -- > To unsubscribe from this list: send the line "unsubscribe linux-i2c" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --=20 Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | --Fig2xvG2VGoz8o/s Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAk/WHJcACgkQD27XaX1/VRtkOwCgviKToQ+wjUNtXEDIfk7a2Q1m HtMAoMtDb3eB8mISunlJnxUx5pkO87kQ =WqQA -----END PGP SIGNATURE----- --Fig2xvG2VGoz8o/s--