kahlee: Use cros_config to obtain SKU information

Kahlee uses unified builds so we should switch it to use cros_config to
obtain its SKU information.

To make this work we need to make sure that kahlee support is only built
in if we have CONFIG_CROS_CONFIG defined.

Unfortunately mosys uses an old version of kconfig so it does not seem
possible to do what we do with the kernel (make oldnconfig). I'm not sure
how to work around that other than by adjusting the Makefile.

BUG=chromium:787879
BRANCH=none
TEST=manual test on kahlee

Change-Id: Iecda9568c690f42602dd5fd2286a5db2b6cf1498
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/786134
Reviewed-by: Jason Clinton <jclinton@chromium.org>
diff --git a/platform/kahlee/kahlee.c b/platform/kahlee/kahlee.c
index fea45ab..05dc4e5 100644
--- a/platform/kahlee/kahlee.c
+++ b/platform/kahlee/kahlee.c
@@ -29,6 +29,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef CONFIG_CROS_CONFIG
+
 #include <stdlib.h>
 #include <unistd.h>
 
@@ -40,30 +42,13 @@
 
 #include "drivers/google/cros_ec.h"
 
-#include "lib/probe.h"
+#include "lib/cros_config.h"
 #include "lib/smbios.h"
 #include "lib/elog.h"
+#include "lib/sku.h"
 
 #include "kahlee.h"
 
-struct probe_ids {
-	const char *names[2];
-	const char *frids[2];
-};
-
-static const struct probe_ids probe_id_list[] = {
-	{ .names = { "Kahlee", NULL},
-	  .frids = { "Google_Kahlee", NULL},
-	},
-	{ .names = { "KAHLEE", NULL},
-	  .frids = { "Google_KAHLEE", NULL},
-	},
-	{ .names = { "kahlee", NULL},
-	  .frids = { "Google_kahlee", NULL},
-	},
-	{ { NULL } }
-};
-
 struct platform_cmd *kahlee_sub[] = {
 	&cmd_ec,
 	&cmd_eeprom,
@@ -77,31 +62,18 @@
 
 int kahlee_probe(struct platform_intf *intf)
 {
-	static int status, probed;
-	const struct probe_ids *pid;
+        static struct sku_info sku_info;
+        int ret;
 
-	if (probed)
-		return status;
-	for (pid = probe_id_list; pid && pid->names[0]; pid++) {
-		/* FRID */
-		if (probe_frid((const char **)pid->frids)) {
-			status = 1;
-			goto kahlee_probe_exit;
-		}
+        ret = cros_config_read_sku_info(intf, "Kahlee", &sku_info);
 
-		/* SMBIOS */
-		if (probe_smbios(intf, (const char **)pid->names)) {
-			status = 1;
-			goto kahlee_probe_exit;
-		}
-	}
-	return 0;
+        /* If there was no error, indicate that we found a match */
+        if (!ret) {
+                intf->sku_info = &sku_info;
+                return 1;
+        }
 
-kahlee_probe_exit:
-	probed = 1;
-	/* Update canonical platform name */
-	intf->name = pid->names[0];
-	return status;
+        return ret;
 }
 
 /* late setup routine; not critical to core functionality */
@@ -145,3 +117,4 @@
 	.setup_post	= &kahlee_setup_post,
 	.destroy	= &kahlee_destroy,
 };
+#endif /* CONFIG_CROS_CONFIG */
diff --git a/platform/kahlee/sys.c b/platform/kahlee/sys.c
old mode 100755
new mode 100644
index 74ca413..7e583a4
--- a/platform/kahlee/sys.c
+++ b/platform/kahlee/sys.c
@@ -29,6 +29,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef CONFIG_CROS_CONFIG
+
 #include "mosys/alloc.h"
 #include "mosys/platform.h"
 
@@ -57,3 +59,4 @@
 	.model			= &kahlee_get_model,
 	.signature_id           = sku_get_signature_id,
 };
+#endif /* CONFIG_CROS_CONFIG */
diff --git a/platform/platform_list.c b/platform/platform_list.c
index 095c682..b911d46 100644
--- a/platform/platform_list.c
+++ b/platform/platform_list.c
@@ -101,7 +101,7 @@
 #ifdef CONFIG_PLATFORM_GRU
 	&platform_gru,
 #endif
-#ifdef CONFIG_PLATFORM_KAHLEE
+#if defined(CONFIG_PLATFORM_KAHLEE) && defined(CONFIG_CROS_CONFIG)
 	&platform_kahlee,
 #endif
 #ifdef CONFIG_PLATFORM_LINK