lkml.org 
[lkml]   [2012]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: mc13xxx-core: kernel hangs after 'regmap_read'
    On Thu, May 24, 2012 at 09:22:29PM +1000, Marc Reilly wrote:

    > > > map->reg_shift = config->pad_bits % 8;
    > > > map->format.buf_size = (config->reg_bits
    > > >
    > > > + config->val_bits
    > > >
    > > > + map->reg_shift) / 8;

    > > Yes, that's been missed in the addition of padding. We should also be
    > > using DIV_ROUND_UP() which we aren't at the minute.

    > That would break, in _regmap_read_raw():

    > ret = map->bus->read(map->bus_context, map->work_buf,
    > map->format.reg_bytes + map->format.pad_bytes,
    > val, val_len);

    > If pad_bytes was 1 here, then the register size would end up being 2 bytes.

    The above is about buf_size... pad_bytes isn't in the quoted text which
    is the issue.

    > The way I understood the pad_bytes field was it was the number of _complete_
    > padding bytes (ie, full 8 bits) between the register address and value. Any
    > remainder of padding bits is incorporated into the register and shifted by
    > shift bits.

    Yes.

    > > We could also do
    > > reg_bytes + pad_bytes + val_bytes which should cover everything I think?

    > If we want to cover everything, we could do reg_bytes + pad_bytes + val_bytes
    > + 3 ... :) (I'm not seriously suggesting that).

    Yes, but the above should be the total that goes onto the wire.


    \
     
     \ /
      Last update: 2012-05-24 15:01    [W:0.104 / U:89.740 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site