[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency |
Date: |
Tue, 05 Feb 2013 18:31:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 |
Am 05.02.2013 17:58, schrieb Anthony Liguori:
> Andreas Färber <address@hidden> writes:
>
>> memread(s->addr + OMAP_I2C_DATA, &data, 2);
>>
>> - memread(s->addr + OMAP_I2C_STAT, &stat, 2);
>> + omap_i2c_read16(s->addr + OMAP_I2C_STAT, &stat);
>> if (unlikely(len == 1)) {
>> - *buf = data & 0xf;
>> + *buf = le16_to_cpu(data) & 0xf;
>
> I don't really get this part. You're effectively unswapping the bytes,
> right?
No. I am reading into "data" unswapped above. This line swaps "data"
when only half of the register is used for the 0xF mask, which assumes
host endianness - I can re-test tonight to verify whether it breaks without.
Probably I should insert a white line to make the "data" vs. "stat"
distinction more clear.
I was using a broken STAT register bit before, if you check the
libi2c-omap patch history, where we couldn't agree on how to fix
properly without spec. Thus I changed the condition to not rely on stat;
reading the register seemed necessary though.
Alternatively the I2C device has a Big Endian bit that we could enable -
but I would rather not have the tests run different device code paths
based on host.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Andreas Färber, 2013/02/02
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Peter Maydell, 2013/02/02
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Andreas Färber, 2013/02/02
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Peter Maydell, 2013/02/02
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Andreas Färber, 2013/02/02
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Blue Swirl, 2013/02/02
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Peter Maydell, 2013/02/02
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Blue Swirl, 2013/02/02
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Anthony Liguori, 2013/02/04
Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Anthony Liguori, 2013/02/05
- Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency,
Andreas Färber <=
Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency, Anthony Liguori, 2013/02/12