Re: mc13xxx-core: kernel hangs after 'regmap_read'

From: Mark Brown
Date: Wed May 23 2012 - 13:36:17 EST


On Wed, May 23, 2012 at 11:18:10AM -0300, Fabio Estevam wrote:

> #define MC13XXX_REGOFFSET_SHIFT 25
> int mc13xxx_reg_read(struct mc13xxx *mc13xxx, unsigned int offset, u32 *val)
> {
> struct spi_transfer t;
> struct spi_message m;
> int ret;
>
> BUG_ON(!mutex_is_locked(&mc13xxx->lock));
>
> if (offset > MC13XXX_NUMREGS)
> return -EINVAL;
>
> *val = offset << MC13XXX_REGOFFSET_SHIFT;

> ,would the spi regmap access take into account this
> MC13XXX_REGOFFSET_SHIFT operation?

The data sent should be however many bits of register address are
specified, followed by however many padding bits are specified, followed
by the data. The shift there will be some combination of the padding
and register address.

Though if the device is looking for everything byte swapped for some
insane reason...

Attachment: signature.asc
Description: Digital signature