public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: enrico.scholz@sigma-chemnitz.de (Enrico Scholz)
To: linux-arm-kernel@lists.infradead.org
Subject: [i2c-mxs] Broken DMA operations from within a module
Date: Wed, 13 Feb 2013 13:00:50 +0100	[thread overview]
Message-ID: <lyehgkift9.fsf@ensc-virt.intern.sigma-chemnitz.de> (raw)

Hi,

the i2c-mxs driver does not work when transmit buffers are located
within module memory.

E.g. when doing something like

	struct i2c_msg xfer = {
               .buf = "something",
               ...
        };

        ret = i2c_transfer(client->adapter, &xfer, 1);

random data will be sent because buf is not DMA mapable ("something" is
located in the .strtab section within module memory). MXS has a memory
layout like

    vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc04b1e8c   (4776 kB)
      .init : 0xc04b2000 - 0xc04e61ac   ( 209 kB)
      .data : 0xc04e8000 - 0xc051b578   ( 206 kB)
       .bss : 0xc051b578 - 0xc05eba44   ( 834 kB)

and is CONFIG_FLATMEM.  Buffers above are e.g. at 0xbf0cdaf0.

You can verify the problem e.g. with the edt-ft5x06.c touch driver;
dumping 'sg->dma_address' in mxs_dma_prep_slave_sg() shows physical
addresses like 0x3f0cdaf0 for such strings, which are outside of valid
memory (0x40000000-0x7fffffff).

Does the i2c layer require DMA mapable buffers in its xfer structures
(e.g. like usb), or is the problem in the generic ARM/MXS layer or in
the mxs i2c driver?



Enrico

             reply	other threads:[~2013-02-13 12:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 12:00 Enrico Scholz [this message]
2013-02-13 12:14 ` [i2c-mxs] Broken DMA operations from within a module Russell King - ARM Linux
2013-02-13 12:28   ` Enrico Scholz

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=lyehgkift9.fsf@ensc-virt.intern.sigma-chemnitz.de \
    --to=enrico.scholz@sigma-chemnitz.de \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox