arm: tegra: cardhu: board SKU and fab cleanup
Laxman Dewangan [Tue, 21 Jun 2011 11:47:48 +0000 (16:47 +0530)]
Remove the hardcoding of the numerical value for different
sku bit and fab definition and using macro for better readability.

Original-Change-Id: Idf70c7a063b5416e170b3b7e61e896250c9ad70c
Reviewed-on: http://git-master/r/37644
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Rd7e2bfcf6780b6b73a8438b904b8a13b0297b59d

arch/arm/mach-tegra/board-cardhu-pinmux.c
arch/arm/mach-tegra/board-cardhu-power.c
arch/arm/mach-tegra/board-cardhu.h

index 3fc317b..3038ee1 100644 (file)
@@ -503,7 +503,7 @@ int __init cardhu_pinmux_init(void)
                                        ARRAY_SIZE(unused_pins_lowpower));
                break;
        case BOARD_E1291:
-               if (board_info.fab < 0x3) {
+               if (board_info.fab < BOARD_FAB_A03) {
                        tegra_pinmux_config_table(cardhu_pinmux_cardhu,
                                        ARRAY_SIZE(cardhu_pinmux_cardhu));
                        tegra_pinmux_config_table(unused_pins_lowpower,
index 08478c1..d15f732 100644 (file)
@@ -374,7 +374,7 @@ int __init cardhu_regulator_init(void)
 
        if ((board_info.board_id == BOARD_E1198) ||
                (board_info.board_id == BOARD_E1291)) {
-               if ((board_info.sku & 1) == 1) {
+               if (board_info.sku & SKU_DCDC_TPS62361_SUPPORT) {
                        tps_platform.num_subdevs =
                                        ARRAY_SIZE(tps_devs_e1198_skubit0_1);
                        tps_platform.subdevs = tps_devs_e1198_skubit0_1;
@@ -384,7 +384,7 @@ int __init cardhu_regulator_init(void)
                        tps_platform.subdevs = tps_devs_e1198_skubit0_0;
                }
        } else {
-               if ((pmu_board_info.sku & 1) == 1) {
+               if (pmu_board_info.sku & SKU_DCDC_TPS62361_SUPPORT) {
                        tps_platform.num_subdevs = ARRAY_SIZE(tps_devs_e118x_skubit0_1);
                        tps_platform.subdevs = tps_devs_e118x_skubit0_1;
                } else {
@@ -394,7 +394,7 @@ int __init cardhu_regulator_init(void)
        }
 
        /* E1291-A04: Enable DEV_SLP and enable sleep on GPIO2 */
-       if ((board_info.board_id == BOARD_E1291) && (board_info.fab == 0x4)) {
+       if ((board_info.board_id == BOARD_E1291) && (board_info.fab == BOARD_FAB_A04)) {
                tps_platform.dev_slp_en = true;
                tps_platform.gpio_init_data = tps_gpio_pdata_e1291_a04;
                tps_platform.num_gpioinit_data =
@@ -404,7 +404,8 @@ int __init cardhu_regulator_init(void)
        i2c_register_board_info(4, cardhu_regulators, 1);
 
        /* Resgister the TPS6236x for all boards whose sku bit 0 is set. */
-       if (((board_info.sku & 1) == 1) || ((pmu_board_info.sku & 1) == 1)) {
+       if ((board_info.sku & SKU_DCDC_TPS62361_SUPPORT) ||
+                       (pmu_board_info.sku & SKU_DCDC_TPS62361_SUPPORT)) {
                pr_info("Registering the device TPS62361B\n");
                i2c_register_board_info(4, tps6236x_boardinfo, 1);
        }
@@ -865,11 +866,11 @@ int __init cardhu_gpio_switch_regulator_init(void)
                gswitch_pdata.subdevs = gswitch_subdevs_e1198;
                break;
        case BOARD_E1291:
-               if (board_info.fab == 0x3) {
+               if (board_info.fab == BOARD_FAB_A03) {
                        gswitch_pdata.num_subdevs =
                                        ARRAY_SIZE(gswitch_subdevs_e1291_a03);
                        gswitch_pdata.subdevs = gswitch_subdevs_e1291_a03;
-               } else if (board_info.fab == 0x4) {
+               } else if (board_info.fab == BOARD_FAB_A04) {
                        gswitch_pdata.num_subdevs =
                                        ARRAY_SIZE(gswitch_subdevs_e1291_a04);
                        gswitch_pdata.subdevs = gswitch_subdevs_e1291_a04;
@@ -918,18 +919,18 @@ int __init cardhu_suspend_init(void)
        tegra_get_pmu_board_info(&pmu_board_info);
 
        /* For PMU Fab A03 and A04 make core_pwr_req to high */
-       if ((pmu_board_info.fab == 0x3) || (pmu_board_info.fab == 0x4))
+       if ((pmu_board_info.fab == BOARD_FAB_A03) || (pmu_board_info.fab == BOARD_FAB_A04))
                cardhu_suspend_data.corereq_high = true;
 
        /* CORE_PWR_REQ to be high for all processor/pmu board whose sku bit 0
         * is set. This is require to enable the dc-dc converter tps62361x */
-       if (((board_info.sku & 1) == 1) || ((pmu_board_info.sku & 1) == 1))
+       if ((board_info.sku & SKU_DCDC_TPS62361_SUPPORT) || (pmu_board_info.sku & SKU_DCDC_TPS62361_SUPPORT))
                cardhu_suspend_data.corereq_high = true;
 
        switch (board_info.board_id) {
        case BOARD_E1291:
                /* CORE_PWR_REQ to be high for E1291-A03 */
-               if (board_info.fab == 0x3)
+               if (board_info.fab == BOARD_FAB_A03)
                        cardhu_suspend_data.corereq_high = true;
                break;
        case BOARD_E1198:
index e1c4b0b..a46a6df 100644 (file)
 #define SKU_SLT_ULPI_SUPPORT           0x2
 #define SKU_T30S_SUPPORT               0x4
 
+#define SKU_MEMORY_TYPE_BIT            0x4
+#define SKU_MEMORY_TYPE_MASK           0x3
+#define SKU_MEMORY_SAMSUNG_EC          0x0
+#define SKU_MEMORY_ELPIDA              0x1
+#define SKU_MEMORY_SAMSUNG_EB          0x2
+#define MEMORY_TYPE(sku) (((sku) >> SKU_MEMORY_TYPE_BIT) & SKU_MEMORY_TYPE_MASK)
+
+/* Board Fab version */
+#define BOARD_FAB_A00                  0x0
+#define BOARD_FAB_A01                  0x1
+#define BOARD_FAB_A02                  0x2
+#define BOARD_FAB_A03                  0x3
+#define BOARD_FAB_A04                  0x4
+
+
 /* External peripheral act as gpio */
 /* TPS6591x GPIOs */
 #define TPS6591X_GPIO_BASE     TEGRA_NR_GPIOS