msm: mpq8064: Check PCIE efuse status before adding PCIE device
If the PCIE feature is disabled in hardware, then the software
should not turn on the associated regulators and clocks. Do not
add PCIE platform device if PCIE efuse status bit is set(disabled).
Change-Id: I1b07129e43888e1e4fd3c20d794e275e713c18ef
Signed-off-by: Niranjana Vishwanathapura <nvishwan@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c
index 833a6d1..a574139 100644
--- a/arch/arm/mach-msm/board-8064.c
+++ b/arch/arm/mach-msm/board-8064.c
@@ -11,6 +11,7 @@
*
*/
#include <linux/kernel.h>
+#include <linux/bitops.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/io.h>
@@ -72,6 +73,7 @@
#include <linux/fmem.h>
#include <mach/msm_pcie.h>
#include <mach/restart.h>
+#include <mach/msm_iomap.h>
#include "msm_watchdog.h"
#include "board-8064.h"
@@ -119,6 +121,9 @@
#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
#define APQ8064_FW_START APQ8064_FIXED_AREA_START
+#define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (MSM_QFPROM_BASE + 0x23c)
+#define QFPROM_RAW_OEM_CONFIG_ROW0_LSB (MSM_QFPROM_BASE + 0x220)
+
/* PCIe power enable pmic gpio */
#define PCIE_PWR_EN_PMIC_GPIO 13
#define PCIE_RST_N_PMIC_MPP 1
@@ -2060,10 +2065,18 @@
.gpio = msm_pcie_gpio_info,
};
+static int __init mpq8064_pcie_enabled(void)
+{
+ return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
+ (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
+}
+
static void __init mpq8064_pcie_init(void)
{
- msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
- platform_device_register(&msm_device_pcie);
+ if (mpq8064_pcie_enabled()) {
+ msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
+ platform_device_register(&msm_device_pcie);
+ }
}
static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {