]> asedeno.scripts.mit.edu Git - linux.git/commit
platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec
authorNick Crews <ncrews@chromium.org>
Sat, 9 Feb 2019 00:37:16 +0000 (17:37 -0700)
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>
Mon, 11 Feb 2019 09:07:40 +0000 (10:07 +0100)
commit6b7cb2227d4d833aaccb3e98214015f2162d5bb0
tree34bdd23657ac1f8d7c56e03d864950daa21ec17a
parent67e9ac8c565a095b8614b54d9305ba90232c662b
platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec

In order to allow this code to be re-used, remove the dependency
on the rest of the cros_ec code from the cros_ec_lpc_mec functions.

Instead of using a hardcoded register base address of 0x800 have
this be passed in to cros_ec_lpc_mec_init().  The existing cros_ec
use case now passes in the 0x800 base address this way.

There are some error checks that happen in cros_ec_lpc_mec_in_range()
that probably shouldn't be there, as they are checking kernel-space
callers and not user-space input. However, we'll just do the refactor in
this patch, and in a future patch might remove this error checking and
fix all the instances of code that calls this.

There's a similar problem in cros_ec_lpc_read_bytes(), where we return a
checksum, but on error just return 0. This should probably be changed so
that it returns int, but we don't want to have to mess with all the
calling code for this fix. Maybe we'll come back through later and fix
this.

Signed-off-by: Duncan Laurie <dlaurie@google.com>
Signed-off-by: Nick Crews <ncrews@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
drivers/platform/chrome/cros_ec_lpc_mec.c
drivers/platform/chrome/cros_ec_lpc_mec.h
drivers/platform/chrome/cros_ec_lpc_reg.c