[coreboot-gerrit] New patch to review for coreboot: ec/google/chromeec/ec_lpc: Declare used IO ports as a resource

Alexandru Gagniuc (alexandrux.gagniuc@intel.com) gerrit at coreboot.org
Tue May 3 20:29:32 CEST 2016


Alexandru Gagniuc (alexandrux.gagniuc at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14585

-gerrit

commit 0f4efda6cf51c17b36206da9cbd6aa3243078d02
Author: Alexandru Gagniuc <alexandrux.gagniuc at intel.com>
Date:   Wed Mar 30 14:38:44 2016 -0700

    ec/google/chromeec/ec_lpc: Declare used IO ports as a resource
    
    Chrome EC uses IO ports 0x800 -> 0x9ff to communicate over LPC;
    however, those ports were not declared as a resource. This had two
    major downsides:
    * It allowed the allocator to assign said ports to other devices
    * It required manually open up an IO window in the LPC bridge.
    The LPC bridge on many chromeec boards had to be painstakingly
    adjusted to meet these constraints.
    
    The advantage of declaring the resources upfront is that the lpc
    bridge can now scan its child resources and automatically open up
    IO windows, as requested by its LPC children devices.
    
    Change-Id: I35c4e48dddb7300674d7a9858b590c1f20e3b0e3
    Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc at intel.com>
---
 src/ec/google/chromeec/ec_lpc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c
index 021735e..d70d782 100644
--- a/src/ec/google/chromeec/ec_lpc.c
+++ b/src/ec/google/chromeec/ec_lpc.c
@@ -409,7 +409,15 @@ static void lpc_ec_init(struct device *dev)
 
 static void lpc_ec_read_resources(struct device *dev)
 {
-	/* Nothing, but this function avoids an error on serial console. */
+	unsigned int idx = 0;
+	struct resource * res;
+
+	/* Declare the IO ports that we are using. */
+	res = new_resource(dev, idx++);
+	res->base = MEC_EMI_RANGE_START;
+	res->size = MEC_EMI_RANGE_END - MEC_EMI_RANGE_START + 1;
+	res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
+		     IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
 }
 
 static void lpc_ec_enable_resources(struct device *dev)



More information about the coreboot-gerrit mailing list