• Nick Crews's avatar
    platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec · 6b7cb222
    Nick Crews authored
    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: default avatarDuncan Laurie <dlaurie@google.com>
    Signed-off-by: default avatarNick Crews <ncrews@chromium.org>
    Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
    6b7cb222
cros_ec_lpc_mec.h 2.17 KB