[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201205242122.29648.marc@cpdesign.com.au>
Date: Thu, 24 May 2012 21:22:29 +1000
From: Marc Reilly <marc@...esign.com.au>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Shawn Guo <shawn.guo@...escale.com>,
"Uwe Kleine-König"
<u.kleine-koenig@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Samuel Ortiz <sameo@...ux.intel.com>,
Sascha Hauer <kernel@...gutronix.de>,
Philippe Rétornaz <philippe.retornaz@...l.ch>,
"linux-kernel" <linux-kernel@...r.kernel.org>
Subject: Re: mc13xxx-core: kernel hangs after 'regmap_read'
Hi,
On Thursday, May 24, 2012 08:37:49 PM Mark Brown wrote:
> On Thu, May 24, 2012 at 07:08:37PM +1000, Marc Reilly wrote:
> > I'm wondering about regmap_init where the buf_size is set up. I think it
> > will
> >
> > only end up being 3 bytes. I think line 249 should be something like:
> > map->format.buf_size = (config->reg_bits
> >
> > + config->val_bits
> >
> > + (config->pad_bits % 8)) / 8;
> >
> > or perhaps better:
> > 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 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.
> 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).
Cheers,
Marc
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists