]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: ich: Use compatible strings to distinguish controller version
authorBin Meng <bmeng.cn@gmail.com>
Mon, 1 Feb 2016 09:40:37 +0000 (01:40 -0800)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 5 Feb 2016 04:47:20 +0000 (12:47 +0800)
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>
arch/x86/dts/bayleybay.dts
arch/x86/dts/broadwell_som-6896.dts
arch/x86/dts/chromebook_link.dts
arch/x86/dts/chromebox_panther.dts
arch/x86/dts/crownbay.dts
arch/x86/dts/galileo.dts
arch/x86/dts/minnowmax.dts
drivers/spi/ich.c

index fbca46762c55149ae601e41fc4edadbd4f3d37b8..cdd51215c1d2be68e7de5e62cebb9c984b90b00d 100644 (file)
                        spi: spi {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "intel,ich-spi";
+                               compatible = "intel,ich9-spi";
                                spi-flash@0 {
                                        #address-cells = <1>;
                                        #size-cells = <1>;
index 7b2c51504b1a9694289359c94a94414a42799af9..4bb0a34b5f2bf814bc2b9e6580b91118f6ac5411 100644 (file)
@@ -37,7 +37,7 @@
                        spi: spi {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "intel,ich-spi";
+                               compatible = "intel,ich9-spi";
                                spi-flash@0 {
                                        reg = <0>;
                                        compatible = "winbond,w25q128", "spi-flash";
index 58072031df88e7c2fd536b1bb6fa6ac686d84d72..e5d77b6e25210504ab46bef8c0ed9449ce6a518a 100644 (file)
                        spi: spi {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "intel,ich-spi";
+                               compatible = "intel,ich9-spi";
                                spi-flash@0 {
                                        #size-cells = <1>;
                                        #address-cells = <1>;
index 48f0c77d45894b3efc2d7e3111426c62a11e574c..ce8825fc879f83645b3da61af422c9239ee27c7a 100644 (file)
@@ -59,7 +59,7 @@
                        spi: spi {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "intel,ich-spi";
+                               compatible = "intel,ich9-spi";
                                spi-flash@0 {
                                        #size-cells = <1>;
                                        #address-cells = <1>;
index 47fab0fda6758710d0cba172268f10a93c2790de..ee8302cf7ecf775b3ef170032c9129de4c7970a8 100644 (file)
                        spi: spi {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "intel,ich-spi";
+                               compatible = "intel,ich7-spi";
                                spi-flash@0 {
                                        reg = <0>;
                                        compatible = "sst,25vf016b",
index dd75fc4dc968725f627b7a89efa3d6cde77ce11f..a9b2994016461add8dce0f1908ed164baf96f2b5 100644 (file)
                        spi: spi {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "intel,ich-spi";
+                               compatible = "intel,ich7-spi";
                                spi-flash@0 {
                                        #size-cells = <1>;
                                        #address-cells = <1>;
index 7afdf6c30ba015f134a12a55b0784daf0f188d19..5b4da6c0032b6b7e6a966721e33386f8fa2f0381 100644 (file)
                        spi: spi {
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               compatible = "intel,ich-spi";
+                               compatible = "intel,ich9-spi";
                                spi-flash@0 {
                                        #address-cells = <1>;
                                        #size-cells = <1>;
index 22b5419368f74000d5a5ced0f13bc2be262e32fc..b863539e1bc0e879f991469843e963b66538c6f3 100644 (file)
@@ -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,