From: Greg Meiste Date: Wed, 16 Feb 2011 16:52:47 +0000 (-0600) Subject: [ARM] tegra: stingray: Add support for product_type X-Git-Tag: firefly_0821_release~9834^2~108 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0518b282b5c1e25aa9d2acc33adad1b34661df32;p=firefly-linux-kernel-4.4.55.git [ARM] tegra: stingray: Add support for product_type 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 --- diff --git a/arch/arm/mach-tegra/board-stingray.c b/arch/arm/mach-tegra/board-stingray.c index dc46ee5f89fd..8bfcfb0aeda1 100644 --- a/arch/arm/mach-tegra/board-stingray.c +++ b/arch/arm/mach-tegra/board-stingray.c @@ -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; diff --git a/arch/arm/mach-tegra/board-stingray.h b/arch/arm/mach-tegra/board-stingray.h index 0c1b790935dc..74c4641d3294 100644 --- a/arch/arm/mach-tegra/board-stingray.h +++ b/arch/arm/mach-tegra/board-stingray.h @@ -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)