From: Ben Dooks <ben-i2c-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
To: Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
Cc: Ben Dooks <ben-i2c-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org
Subject: Re: [PATCH] i2c: tegra: Add i2c support
Date: Wed, 23 Feb 2011 00:16:42 +0000 [thread overview]
Message-ID: <20110223001642.GU15795@trinity.fluff.org> (raw)
In-Reply-To: <AANLkTim0X=gUwYJmR+EAYjGamiJb7tgiVEjwqCEF0-L0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Sun, Feb 20, 2011 at 04:28:46PM -0800, Colin Cross wrote:
> On Sun, Feb 20, 2011 at 3:57 PM, Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
> > On Sun, Feb 20, 2011 at 3:38 PM, Ben Dooks <ben-i2c-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org> wrote:
> > <snip>
> >
> >>> > you know, there's a readsl() function that does this.
> >>> I think readsl can't handle the possibly unaligned buf pointer.
> >>
> >> it does. see arch/arm/lib/io-writesl.S for proof.
> > You're right, I traced the wrong definition of readsl/writesl
> >
> >>> > this whole function gives me the creeps, is there any reason why
> >>> > we can't use the readsl or similar functions for this?
> >>> Same here - readsl can't handle the alignment requirements, readsb
> >>> can't handle the required 32 bit register read, and the bytes in the
> >>> same word but after the end buf may not be part of buf, so byte writes
> >>> to buf are required.
> >>
> >> You'll find it can, too. arch/arm/lib/io-readsl.S.
> > I still think readsl doesn't work here. It may need to read 7 bytes,
> > requiring 2 calls to readl, but 1 word write and 3 byte writes to buf.
> > Using readsl for the whole buffer would overwrite the 8th byte. I
> > can use readsl for the main loop, but I will still need to write the
> > last 1-3 bytes separately. I could use readl and memcpy to do the
> > last writes.
>
> Actually, the same problem applies to writesl. If the buffer is not
> aligned, reading an entire word to get the partial word at the end of
> the buffer may cross a page boundary and fault. I'll have to use
> writesl for the whole words and then handle the last partial word with
> memcpy and writel.
Hmm, that's an interesting one, however I suspect this is something
that will never happen as the kernel over-allocates (rounds up) buffers
when allocating memory blocks.
--
Ben Dooks, ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/ben/
Large Hadron Colada: A large Pina Colada that makes the universe disappear.
prev parent reply other threads:[~2011-02-23 0:16 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-08 12:44 [PATCH] i2c: tegra: Add i2c support Mark Brown
[not found] ` <1297169061-17689-1-git-send-email-broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-02-15 23:48 ` Ben Dooks
[not found] ` <4D5B10E3.5030208-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
2011-02-16 17:37 ` Stephen Warren
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF03112A5345-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-02-20 19:51 ` Colin Cross
2011-02-20 23:42 ` Ben Dooks
2011-02-20 19:49 ` Colin Cross
[not found] ` <AANLkTinZffOGSfOoNY4=8UzRDEVHHDdGXE26V3mbHm93-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-20 23:38 ` Ben Dooks
[not found] ` <20110220233829.GM15795-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2011-02-20 23:57 ` Colin Cross
[not found] ` <AANLkTikx0HbBaPeRi3o69wicVCEE-KgOBiw1F8tWi7AW-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-21 0:28 ` Colin Cross
[not found] ` <AANLkTim0X=gUwYJmR+EAYjGamiJb7tgiVEjwqCEF0-L0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-21 1:14 ` [PATCH v2] " Colin Cross
2011-02-21 1:14 ` Colin Cross
2011-02-21 1:14 ` Colin Cross
[not found] ` <1298250861-27094-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2011-02-21 4:37 ` Olof Johansson
2011-02-21 4:37 ` Olof Johansson
2011-02-21 4:37 ` Olof Johansson
2011-02-22 19:59 ` Colin Cross
2011-02-22 19:59 ` Colin Cross
2011-02-22 19:59 ` Colin Cross
2011-02-23 0:20 ` Ben Dooks
2011-02-23 0:20 ` Ben Dooks
2011-02-23 0:20 ` Ben Dooks
[not found] ` <20110223002059.GV15795-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2011-02-23 19:26 ` Colin Cross
2011-02-23 19:26 ` Colin Cross
2011-02-23 19:26 ` Colin Cross
2011-02-23 0:16 ` Ben Dooks [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110223001642.GU15795@trinity.fluff.org \
--to=ben-i2c-elnmno+kys3ytjvyw6ydsg@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.