Merge "dev: gcdb: Set panel tearing scanline for QRD8905 GC9305 panel"
diff --git a/platform/init.c b/platform/init.c
index 9044bac..1dc96d7 100644
--- a/platform/init.c
+++ b/platform/init.c
@@ -155,6 +155,11 @@
return 0;
}
+__WEAK int platform_partial_goods_val ()
+{
+ return -1;
+}
+
__WEAK uint32_t check_alarm_boot()
{
return 0;
diff --git a/platform/msm8909/include/platform/partial_goods.h b/platform/msm8909/include/platform/partial_goods.h
new file mode 100644
index 0000000..b655526
--- /dev/null
+++ b/platform/msm8909/include/platform/partial_goods.h
@@ -0,0 +1,33 @@
+/* Copyright (c) 2014, 2018, The Linux Foundation. All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <partial_goods.h>
+
+#define QFPROM_RAW_PART_ADDR 0x00058000
+
+int platform_partial_goods_val ();
diff --git a/platform/msm8909/platform.c b/platform/msm8909/platform.c
index 7003275..de9581d 100644
--- a/platform/msm8909/platform.c
+++ b/platform/msm8909/platform.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2015, 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, 2017, 2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -35,6 +35,7 @@
#include <arch/arm/mmu.h>
#include <smem.h>
#include <target/display.h>
+#include <platform/partial_goods.h>
#define MB (1024*1024)
@@ -204,6 +205,7 @@
case MSM8208:
case APQ8009:
case MSM8609:
+ case MSM8905:
ret = 1;
break;
default:
@@ -218,6 +220,23 @@
return ((val & 0x0E) >> 1);
}
+int platform_partial_goods_val ()
+{
+ uint32_t platform = board_platform_id();
+ int reg = -1;
+
+ if (platform == MSM8905) {
+ /*
+ * The register bits 20 to 27 have the feature id info:
+ * Value: 0x0/0x1 - Dual core
+ * Value: 0x2 - Quad core
+ */
+ reg = readl(QFPROM_RAW_PART_ADDR);
+ reg = (reg & 0xff00000) >> 20;
+ }
+ return reg;
+}
+
uint32_t platform_detect_panel()
{
uint32_t panel;
diff --git a/platform/msm_shared/partial_goods.c b/platform/msm_shared/partial_goods.c
index d2c3ab6..544b542 100644
--- a/platform/msm_shared/partial_goods.c
+++ b/platform/msm_shared/partial_goods.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, 2020 The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -30,6 +30,19 @@
#include <libfdt.h>
#include <reg.h>
#include <debug.h>
+#include <board.h>
+#include <smem.h>
+
+#ifdef QFPROM_RAW_PART_ADDR
+/* Look up table for partial goods */
+struct partial_goods table[] =
+{
+ {0x0, "/cpus", {{"cpu@2", "device_type"},
+ {"cpu@3","device_type"},}},
+ {0x1, "/cpus", {{"cpu@2", "device_type"},
+ {"cpu@3","device_type"},}},
+};
+#endif
void update_partial_goods_dtb_nodes(void *fdt)
{
@@ -39,21 +52,28 @@
int subnode_offset = 0;
int ret = 0;
int prop_len = 0;
- uint32_t reg = readl(QFPROM_PTE_PART_ADDR);
+ int reg = -1;
uint32_t prop_type = 0;
struct subnode_list *subnode_lst = NULL;
const struct fdt_property *prop = NULL;
const char *replace_str = NULL;
+#ifdef QFPROM_PTE_PART_ADDR
/*
- * The PTE register bits 23 to 27 have the partial goods
- * info, extract the partial goods value before using
- */
+ * The PTE register bits 23 to 27 have the partial goods
+ * info, extract the partial goods value before using
+ */
+ reg = readl(QFPROM_PTE_PART_ADDR);
reg = (reg & 0x0f800000) >> 23;
+#else
+ reg = platform_partial_goods_val ();
+#endif
/* If none of the DTB needs update */
- if (!reg)
+ if (reg < 0) {
+ dprintf(SPEW, "Partial goods not support!!!\n");
return;
+ }
ret = fdt_open_into(fdt, fdt, fdt_totalsize(fdt));
if (ret != 0)
@@ -64,7 +84,7 @@
for (i = 0; i < tbl_sz; i++)
{
- if (reg == table[i].val)
+ if ((uint32_t)reg == table[i].val)
{
/* Find the Parent node */
ret = fdt_path_offset(fdt, table[i].parent_node);
diff --git a/platform/msm_shared/qpic_nand.c b/platform/msm_shared/qpic_nand.c
index 7fe25f9..27ba0b3 100644
--- a/platform/msm_shared/qpic_nand.c
+++ b/platform/msm_shared/qpic_nand.c
@@ -1434,9 +1434,10 @@
for (i = 0; i < ecc_bytes; i++)
{
val = ecc_buf[i];
+ val = ~val;
while (val)
{
- if ((val & 1) == 0)
+ if ((val & 1) == 1)
num_zeros++;
if (num_zeros > THRESHOLD_BIT_FLIPS)
goto out;
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index f6d58d9..807493c 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -2,7 +2,7 @@
* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -467,6 +467,7 @@
APQ8009W = 301,
SDM450 = 338,
MDM9206 = 322,
+ MSM8905 = 331,
SDA450 = 351,
SDM632 = 349,
SDA632 = 350,
diff --git a/project/msm8909.mk b/project/msm8909.mk
index 3f74902..940f600 100755
--- a/project/msm8909.mk
+++ b/project/msm8909.mk
@@ -72,6 +72,8 @@
#Disable thumb mode
ENABLE_THUMB := false
+ENABLE_PARTIAL_GOODS_SUPPORT := 1
+
ENABLE_SDHCI_SUPPORT := 1
ifeq ($(ENABLE_SDHCI_SUPPORT),1)
@@ -89,6 +91,10 @@
DEFINES += _EMMC_BOOT=1
endif
+ifeq ($(ENABLE_PARTIAL_GOODS_SUPPORT),1)
+DEFINES += ENABLE_PARTIAL_GOODS_SUPPORT=1
+endif
+
ifeq ($(ENABLE_PON_VIB_SUPPORT),true)
DEFINES += PON_VIB_SUPPORT=1
endif
diff --git a/target/msm8909/init.c b/target/msm8909/init.c
index 4a5ebe1..e00a5c8 100644
--- a/target/msm8909/init.c
+++ b/target/msm8909/init.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2018, 2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -472,6 +472,7 @@
case MSM8208:
case MSM8609:
case MSM8909W:
+ case MSM8905:
board->baseband = BASEBAND_MSM;
break;