summaryrefslogtreecommitdiff
path: root/drivers/spi/ich.c
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2016-02-01 09:40:37 (GMT)
committerBin Meng <bmeng.cn@gmail.com>2016-02-05 04:47:20 (GMT)
commit1f9eb59d273983ba8c65368120285ac6425476f7 (patch)
tree00992dcbc6c9247cdddd4d3abee40b4bc4160d0d /drivers/spi/ich.c
parent9eb4339ba45fc7147b013c8e8d579ebc6d8d1bdb (diff)
downloadu-boot-fsl-qoriq-1f9eb59d273983ba8c65368120285ac6425476f7.tar.xz
spi: ich: Use compatible strings to distinguish controller version
At present ich spi driver gets the controller version information via pch, but this can be simply retrieved via spi node's compatible string. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jteki@openedev.com> Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/spi/ich.c')
-rw-r--r--drivers/spi/ich.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 22b5419..b863539 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -18,6 +18,8 @@
#include "ich.h"
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef DEBUG_TRACE
#define debug_trace(fmt, args...) debug(fmt, ##args)
#else
@@ -594,9 +596,6 @@ static int ich_spi_probe(struct udevice *dev)
uint8_t bios_cntl;
int ret;
- /* Check the ICH version */
- plat->ich_version = pch_get_version(dev->parent);
-
ret = ich_init_controller(dev, plat, priv);
if (ret)
return ret;
@@ -658,6 +657,25 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
return 0;
}
+static int ich_spi_ofdata_to_platdata(struct udevice *dev)
+{
+ struct ich_spi_platdata *plat = dev_get_platdata(dev);
+ int ret;
+
+ ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset,
+ "intel,ich7-spi");
+ if (ret == 0) {
+ plat->ich_version = PCHV_7;
+ } else {
+ ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset,
+ "intel,ich9-spi");
+ if (ret == 0)
+ plat->ich_version = PCHV_9;
+ }
+
+ return ret;
+}
+
static const struct dm_spi_ops ich_spi_ops = {
.xfer = ich_spi_xfer,
.set_speed = ich_spi_set_speed,
@@ -669,7 +687,8 @@ static const struct dm_spi_ops ich_spi_ops = {
};
static const struct udevice_id ich_spi_ids[] = {
- { .compatible = "intel,ich-spi" },
+ { .compatible = "intel,ich7-spi" },
+ { .compatible = "intel,ich9-spi" },
{ }
};
@@ -678,6 +697,7 @@ U_BOOT_DRIVER(ich_spi) = {
.id = UCLASS_SPI,
.of_match = ich_spi_ids,
.ops = &ich_spi_ops,
+ .ofdata_to_platdata = ich_spi_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct ich_spi_platdata),
.priv_auto_alloc_size = sizeof(struct ich_spi_priv),
.child_pre_probe = ich_spi_child_pre_probe,