Re: [PATCH v3] platform/chrome: Add cros_ec_readmem() helpers for I2C/SPI based ECs

From: Enric Balletbo Serra
Date: Mon Jan 21 2019 - 17:19:48 EST


Hi Moritz,

Missatge de Moritz Fischer <mdf@xxxxxxxxxx> del dia dl., 21 de gen.
2019 a les 19:40:
>
> Hi Enrico,
>
> On Mon, Jan 21, 2019 at 06:32:48PM +0100, Enric Balletbo Serra wrote:
> > Hi Moritz,
> >
> > Missatge de Moritz Fischer <mdf@xxxxxxxxxx> del dia dj., 10 de gen.
> > 2019 a les 5:40:
> > >
> > > Add cros_ec_readmem() helpers for I2C/SPI based ECs.
> > > Unlike the LPC based ECs the I2C/SPI based ones cannot just directly
> > > read the mapped region, but have to resort to EC_CMD_READ_MEMMAP.
> > >
> > > This is useful for things like accessing fan speeds or temperatures.
> > >
> > > Signed-off-by: Moritz Fischer <mdf@xxxxxxxxxx>
> > > ---
> > >
> > > Hi all,
> > >
> > > This can be used for a hwmon or thermal driver such as [1], but also
> > > alone can be used with 'ectool' via the ioctl() interface.
> > >
> >
> > ooi, did you try this with a Chromebook? Or only with your device?
>
> Nope, mine has a dead battery (and no fans ... :-/)
> >
> > I was a bit worried on the side effects to expose this command to
> > userspace, so I did a quick test, and to be honest I didn't like the
> > result. Issuing the ioctl resulted on a reboot on the Chromebook I
> > tested, which is not good. I didn't investigate more but I can say
> > that this change, at least, will need some rework. I'll try to
> > investigate a bit more on what is happening.
>
> That sounds bad :-/
>
> What chromebook did you run this on (so I can look at the EC code it is
> running and figure out what's the difference). Maybe it has a different
> configuration. It wasn't an x86 chromebook, right?
>

I tried with a Samsung Chromebook Plus (arm64 Chromebook)

> What was the ioctl you ran?
>

The code that I ran is this: https://hastebin.com/cupecuvowi.py
No guarantee :) I'll try to look deeper tomorrow.

Thanks,
Enric

> Thanks for testing,
> Moritz