omap kernel does 32 bit writes to 16 bit I2C_SYSC register

Bug #727781 reported by Peter Maydell
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro Linux
Fix Released
Medium
Unassigned

Bug Description

The linux-image-linaro-omap kernels (I tested 2.6.37-1003.6 and 2.6.38-1000.1) write to the I2C controller's I2C_SYSC register with a 32 bit wide write. However the OMAP36xx TRM says:

"The HS I2Ci registers are limited to 16 bit and 8 bit data accesses; 32–bit data access is not allowed and can corrupt register content."

QEMU complains about these accesses:
omap_badwidth_read16: 16-bit register 0x00000020
omap_badwidth_write16: 16-bit register 0x00000020

Here's a backtrace of one of the writes (for 2.6.37-1003.6):
#0 0xc0070764 in omap_hwmod_write (v=21, oh=<value optimised out>)
    at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/omap_hwmod.c:1504
#1 _write_sysconfig (v=21, oh=<value optimised out>) at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/omap_hwmod.c:215
#2 0xc0070a78 in _enable_sysc (oh=0xc07b2d08) at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/omap_hwmod.c:807
#3 0xc0070ff0 in _enable (oh=0xc07b2d08) at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/omap_hwmod.c:1247
#4 0xc00712c0 in _setup (oh=0xc07b2d08, data=<value optimised out>)
    at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/omap_hwmod.c:1395
#5 0xc00715c4 in omap_hwmod_for_each (fn=0xc0071238 <_setup>, data=0x0)
    at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/omap_hwmod.c:1580
#6 0xc0071638 in omap_hwmod_late_init () at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/omap_hwmod.c:1643
#7 0xc0010458 in omap2_init_common_devices (sdrc_cs0=0xc07b635c, sdrc_cs1=0xc07b635c)
    at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/io.c:405
#8 0xc0016364 in omap3_beagle_init_irq () at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/mach-omap2/board-omap3beagle.c:536
#9 0xc000c278 in init_IRQ () at /build/buildd/linux-linaro-omap-2.6.37/arch/arm/kernel/irq.c:169
#10 0xc0008a64 in start_kernel () at /build/buildd/linux-linaro-omap-2.6.37/init/main.c:629

My guess is that the I2C omap_hwmod structs in arch/arm/mach-omap2/omap_hwmod_3xxx_data.c need to have the HWMOD_16BIT_REG flag added, to stop omap_hwmod_read/omap_hwmod_write attempting these illegal 32 bit accesses.

Revision history for this message
warmcat (andy-warmcat) wrote :

This is caused by the problem Peter identified, the attached patch solves it for OMAP3 and OMAP4, and has been sent upstream

Changed in linux-linaro:
assignee: nobody → warmcat (andy-warmcat)
Changed in linux-linaro:
status: New → Confirmed
status: Confirmed → In Progress
Revision history for this message
Mounir Bsaibes (mounir-bsaibes) wrote :

I am setting the priority to Medium, as patch exists per comment#1.

Changed in linux-linaro:
importance: Undecided → Medium
Revision history for this message
Nicolas Pitre (npitre) wrote :

Patch was merged in linaro-2.6.38 a while ago.

Changed in linux-linaro:
status: In Progress → Fix Committed
Revision history for this message
Peter Maydell (pmaydell) wrote :

This bug seems to have regressed as of linaro-omap=3.0.0.1002.2. Looking at the source linux-linaro-omap_3.0.0-1003.4~ppa~natty the patch seems to have disappeared and the omap_hwmod structs aren't marked as HWMOD_16BIT_REG.

Can the fix be reinstated, please?

Revision history for this message
Peter Maydell (pmaydell) wrote :

Pushing back to 'confirmed' because this has regressed. Apologies if that's not the right bug workflow...

Changed in linux-linaro:
status: Fix Committed → Confirmed
Revision history for this message
Loïc Minier (lool) wrote :

Confirmed is fine, but consider opening a new bug report for regressions (e.g. a patch which used to be there isn't anymore) -- reopening should definitely be used when the bug fix didn't work or never applied

Linus Walleij (triad)
Changed in linux-linaro:
status: Confirmed → Fix Committed
assignee: warmcat (andy-warmcat) → nobody
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.