[ARM] tegra: stingray: Add support for product_type
authorGreg Meiste <w30289@motorola.com>
Wed, 16 Feb 2011 16:52:47 +0000 (10:52 -0600)
committerBenoit Goby <benoit@android.com>
Fri, 18 Feb 2011 21:52:14 +0000 (13:52 -0800)
Stingray bootloader 1036 adds product_type to the kernel command
line to tell the kernel what hardware is present. For example, if
a CDMA modem and wifi were both present, the bootloader would pass
product_type=cw. If a LTE datacard was added, it would change to
product_type=clw.

Change-Id: I1f5663bb1a72e0b6cc7d0dcb65b6036140fbf777
Signed-off-by: Greg Meiste <w30289@motorola.com>
arch/arm/mach-tegra/board-stingray.c
arch/arm/mach-tegra/board-stingray.h

index dc46ee5f89fd5482fc384f46d677eb96fb6baea3..8bfcfb0aeda163f725bc4eb7bf66c7010d6a5d2f 100644 (file)
@@ -718,6 +718,38 @@ static int __init mot_bm_recovery_setup(char *options)
 }
 __setup("rec", mot_bm_recovery_setup);
 
+#define PRODUCT_TYPE_MAX_LEN 4
+static char product_type[PRODUCT_TYPE_MAX_LEN + 1] = "cw";
+static int __init stingray_product_type_parse(char *s)
+{
+       strncpy(product_type, s, PRODUCT_TYPE_MAX_LEN);
+       product_type[PRODUCT_TYPE_MAX_LEN] = '\0';
+       printk(KERN_INFO "product_type=%s\n", product_type);
+
+       return 1;
+}
+__setup("product_type=", stingray_product_type_parse);
+
+bool stingray_hw_has_cdma(void)
+{
+       return strstr(product_type, "c") != NULL;
+}
+
+bool stingray_hw_has_lte(void)
+{
+       return strstr(product_type, "l") != NULL;
+}
+
+bool stingray_hw_has_wifi(void)
+{
+       return strstr(product_type, "w") != NULL;
+}
+
+bool stingray_hw_has_umts(void)
+{
+       return strstr(product_type, "u") != NULL;
+}
+
 static void stingray_usb_init(void)
 {
        char *src;
index 0c1b790935dc79e1d6e355abb4b2bb8569301a39..74c4641d329409bed527746fcd5e31919a1722eb 100644 (file)
@@ -33,6 +33,11 @@ int stingray_qbp_usb_hw_bypass_enabled(void);
 void stingray_init_emc(void);
 void change_power_brcm_4329(bool);
 
+bool stingray_hw_has_cdma(void);
+bool stingray_hw_has_lte(void);
+bool stingray_hw_has_wifi(void);
+bool stingray_hw_has_umts(void);
+
 /* as defined in the bootloader*/
 #define HWREV(x)    (((x)>>16) & 0xFFFF)
 #define INSTANCE(x) ((x) & 0xFFFF)