[U-Boot] [PATCH 2/2] spi: ich-spi: Add DT spi-max-frequency support

Bernhard Messerklinger bernhard.messerklinger at br-automation.com
Thu Oct 25 10:47:09 UTC 2018


Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger at br-automation.com>
---

 drivers/spi/ich.c | 7 +++++++
 drivers/spi/ich.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index d84bbdb2e5..4ec107d323 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -213,6 +213,10 @@ static int ich_init_controller(struct udevice *dev,
 		return -EINVAL;
 	}
 
+	/* Check devicetree for max frequency */
+	if (plat->max_speed)
+		ctlr->max_speed = plat->max_speed;
+
 	debug("ICH SPI: Version ID %d detected at %p, speed %ld\n",
 	      plat->ich_version, ctlr->base, ctlr->max_speed);
 
@@ -784,6 +788,9 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev)
 	plat->lockdown = fdtdec_get_bool(gd->fdt_blob, node,
 					 "intel,spi-lock-down");
 
+	plat->max_speed = fdtdec_get_uint(gd->fdt_blob, node,
+					  "spi-max-frequency", 0);
+
 	return ret;
 }
 
diff --git a/drivers/spi/ich.h b/drivers/spi/ich.h
index 5e3ac2d2c2..85ddc171cc 100644
--- a/drivers/spi/ich.h
+++ b/drivers/spi/ich.h
@@ -214,6 +214,7 @@ struct ich_spi_platdata {
 	enum ich_version ich_version;	/* Controller version*/
 	bool lockdown;			/* lock down controller settings? */
 	unsigned long base;		/* PCI device BAR */
+	unsigned long max_speed;
 };
 
 struct ich_spi_priv {
-- 
2.19.1




More information about the U-Boot mailing list