summaryrefslogtreecommitdiff
path: root/src/soc/intel/baytrail
diff options
context:
space:
mode:
authorMate Kukri <kukri.mate@gmail.com>2020-07-04 11:20:07 +0200
committerAngel Pons <th3fanbus@gmail.com>2020-08-02 12:07:08 +0000
commite231949b78fee38dca823bc76467f81166e00995 (patch)
tree7491ddcfebdf48cc42895a57d1a40fd5c538fd45 /src/soc/intel/baytrail
parent32b93c94e0e1d7f4b083bc9a63cfad61c6ac870a (diff)
downloadcoreboot-e231949b78fee38dca823bc76467f81166e00995.tar.xz
soc/intel/baytrail: Add native refcode replacement
- This is a reverse engineered re-implementation of refcode.elf on Bay Trail - Tested on GBYT4, should work everywhere as it's meant to behave exactly the same as the binary refcode Signed-off-by: Mate Kukri <kukri.mate@gmail.com> Change-Id: I91977c509022b0078804dc151d27296260e24bc4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/43133 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/baytrail')
-rw-r--r--src/soc/intel/baytrail/Kconfig6
-rw-r--r--src/soc/intel/baytrail/Makefile.inc7
-rw-r--r--src/soc/intel/baytrail/include/soc/iosf.h50
-rw-r--r--src/soc/intel/baytrail/include/soc/modphy_table.h20
-rw-r--r--src/soc/intel/baytrail/include/soc/ramstage.h6
-rw-r--r--src/soc/intel/baytrail/iosf.c14
-rw-r--r--src/soc/intel/baytrail/modphy_table.c569
-rw-r--r--src/soc/intel/baytrail/refcode_native.c116
8 files changed, 756 insertions, 32 deletions
diff --git a/src/soc/intel/baytrail/Kconfig b/src/soc/intel/baytrail/Kconfig
index a436e24cb2..b23f56d149 100644
--- a/src/soc/intel/baytrail/Kconfig
+++ b/src/soc/intel/baytrail/Kconfig
@@ -133,13 +133,15 @@ config ENABLE_BUILTIN_COM1
config HAVE_REFCODE_BLOB
depends on ARCH_X86
- bool "An external reference code blob should be put into cbfs."
+ bool "Use a binary refcode blob instead of native ModPHY init"
default n
help
- The reference code blob will be placed into cbfs.
+ Use the ChromeBook refcode to intitialize high-speed PHYs instead of
+ native code.
if HAVE_REFCODE_BLOB
+# Ask for the blob if the user wants it
config REFCODE_BLOB_FILE
string "Path and filename to reference code blob."
default "refcode.elf"
diff --git a/src/soc/intel/baytrail/Makefile.inc b/src/soc/intel/baytrail/Makefile.inc
index 451f29e377..bfa1846d1a 100644
--- a/src/soc/intel/baytrail/Makefile.inc
+++ b/src/soc/intel/baytrail/Makefile.inc
@@ -49,7 +49,12 @@ ramstage-y += smm.c
ramstage-y += southcluster.c
ramstage-y += xhci.c
ramstage-$(CONFIG_ELOG) += elog.c
-ramstage-$(CONFIG_HAVE_REFCODE_BLOB) += refcode.c
+
+ifeq ($(CONFIG_HAVE_REFCODE_BLOB),y)
+ramstage-y += refcode.c
+else
+ramstage-y += modphy_table.c refcode_native.c
+endif
smm-y += iosf.c
smm-y += pmutil.c
diff --git a/src/soc/intel/baytrail/include/soc/iosf.h b/src/soc/intel/baytrail/include/soc/iosf.h
index 15d77de03d..d4fcdf3f7b 100644
--- a/src/soc/intel/baytrail/include/soc/iosf.h
+++ b/src/soc/intel/baytrail/include/soc/iosf.h
@@ -9,34 +9,33 @@
/*
* The Bay Trail SoC has a message network called IOSF Sideband. The access
* routines are through 3 registers in PCI config space of 00:00.0:
- * MCR - control register
- * MDR - data register
+ * MCR - control register
+ * MDR - data register
* MCRX - control register extension
* The extension register is only used for addresses that don't fit
* into the 8 bit register address.
*/
-#ifndef PCI_DEV
-#define PCI_DEV(SEGBUS, DEV, FN) ( \
- (((SEGBUS) & 0xFFF) << 20) | \
- (((DEV) & 0x1F) << 15) | \
- (((FN) & 0x07) << 12))
-#endif
#define IOSF_PCI_DEV PCI_DEV(0, SOC_DEV, SOC_FUNC)
-#define MCR_REG 0xd0
-#define IOSF_OPCODE(x) ((x) << 24)
-#define IOSF_PORT(x) ((0xff & (x)) << 16)
-#define IOSF_REG(x) ((0xff & (x)) << 8)
-#define IOSF_REG_UPPER(x) (((~0xff) & (x)))
-#define IOSF_BYTE_EN_0 0x10
-#define IOSF_BYTE_EN_1 0x20
-#define IOSF_BYTE_EN_2 0x40
-#define IOSF_BYTE_EN_3 0x80
-#define IOSF_BYTE_EN \
- (IOSF_BYTE_EN_0 | IOSF_BYTE_EN_1 | IOSF_BYTE_EN_2 | IOSF_BYTE_EN_3)
-#define MDR_REG 0xd4
-#define MCRX_REG 0xd8
+#define IOSF_OPCODE(x) ((x) << 24)
+#define IOSF_PORT(x) ((0xff & (x)) << 16)
+#define IOSF_REG(x) ((0xff & (x)) << 8)
+#define IOSF_REG_UPPER(x) ((~0xff) & (x))
+
+#define IOSF_BYTE_EN_0 0x10
+#define IOSF_BYTE_EN_1 0x20
+#define IOSF_BYTE_EN_2 0x40
+#define IOSF_BYTE_EN_3 0x80
+#define IOSF_BYTE_EN \
+ (IOSF_BYTE_EN_0 | IOSF_BYTE_EN_1 | IOSF_BYTE_EN_2 | IOSF_BYTE_EN_3)
+
+#define MCR_REG 0xd0
+#define MDR_REG 0xd4
+#define MCRX_REG 0xd8
+
+uint32_t iosf_read_port(uint32_t cr, int reg);
+void iosf_write_port(uint32_t cr, int reg, uint32_t val);
uint32_t iosf_aunit_read(int reg);
void iosf_aunit_write(int reg, uint32_t val);
@@ -49,6 +48,8 @@ void iosf_dunit_write(int reg, uint32_t val);
/* Some registers are per channel while the globals live in dunit 0 */
uint32_t iosf_dunit_ch0_read(int reg);
uint32_t iosf_dunit_ch1_read(int reg);
+uint32_t iosf_cunit_read(int reg);
+void iosf_cunit_write(int reg, uint32_t val);
uint32_t iosf_punit_read(int reg);
void iosf_punit_write(int reg, uint32_t val);
uint32_t iosf_usbphy_read(int reg);
@@ -87,12 +88,13 @@ void iosf_ssus_write(int reg, uint32_t val);
/* IOSF ports. */
#define IOSF_PORT_AUNIT 0x00 /* IO Arbiter unit */
#define IOSF_PORT_SYSMEMC 0x01 /* System Memory Controller */
-#define IOSF_PORT_DUNIT_CH0 0x07 /* DUNIT Channel 0 */
#define IOSF_PORT_CPU_BUS 0x02 /* CPU Bus Interface Controller */
#define IOSF_PORT_BUNIT 0x03 /* System Memory Arbiter/Bunit */
#define IOSF_PORT_PMC 0x04 /* Power Management Controller */
#define IOSF_PORT_GFX 0x06 /* Graphics Adapter */
+#define IOSF_PORT_DUNIT_CH0 0x07 /* DUNIT Channel 0 */
#define IOSF_PORT_DUNIT_CH1 0x07 /* DUNIT Channel 1 */
+#define IOSF_PORT_CUNIT 0x08
#define IOSF_PORT_SYSMEMIO 0x0c /* System Memory IO */
#define IOSF_PORT_USBPHY 0x43 /* USB PHY */
#define IOSF_PORT_SEC 0x44 /* SEC */
@@ -109,7 +111,7 @@ void iosf_ssus_write(int reg, uint32_t val);
#define IOSF_PORT_LPSS 0xa0 /* LPSS - Low Power Subsystem */
#define IOSF_PORT_0xa2 0xa2
#define IOSF_PORT_SATAPHY 0xa3 /* SATA PHY */
-#define IOSF_PORT_PCIEPHY 0xa3 /* PCIE PHY */
+#define IOSF_PORT_PCIEPHY 0xa6 /* PCIE PHY */
#define IOSF_PORT_SSUS 0xa8 /* SUS */
#define IOSF_PORT_CCU 0xa9 /* Clock control unit. */
@@ -122,6 +124,8 @@ void iosf_ssus_write(int reg, uint32_t val);
#define IOSF_OP_WRITE_CPU_BUS (IOSF_OP_READ_CPU_BUS | 1)
#define IOSF_OP_READ_BUNIT 0x10
#define IOSF_OP_WRITE_BUNIT (IOSF_OP_READ_BUNIT | 1)
+#define IOSF_OP_READ_CUNIT 0x10
+#define IOSF_OP_WRITE_CUNIT (IOSF_OP_READ_CUNIT | 1)
#define IOSF_OP_READ_PMC 0x06
#define IOSF_OP_WRITE_PMC (IOSF_OP_READ_PMC | 1)
#define IOSF_OP_READ_GFX 0x00
diff --git a/src/soc/intel/baytrail/include/soc/modphy_table.h b/src/soc/intel/baytrail/include/soc/modphy_table.h
new file mode 100644
index 0000000000..9a483c4a6a
--- /dev/null
+++ b/src/soc/intel/baytrail/include/soc/modphy_table.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _BAYTRAIL_MODPHY_TABLE_H_
+#define _BAYTRAIL_MODPHY_TABLE_H_
+
+struct modphy_entry {
+ u8 port;
+ u32 reg;
+ u32 mask;
+ u32 value;
+ u8 op_read;
+ u8 op_write;
+};
+
+#define MODPHY_ENTRY_END ((struct modphy_entry) { 0, 0, 0, 0, 0, 0 })
+
+extern struct modphy_entry reva0_modphy_table[]; /* SOC stepping A0/A1 */
+extern struct modphy_entry revb0_modphy_table[]; /* SOC stepping B0 or later */
+
+#endif
diff --git a/src/soc/intel/baytrail/include/soc/ramstage.h b/src/soc/intel/baytrail/include/soc/ramstage.h
index 8f303313dc..51189cfd46 100644
--- a/src/soc/intel/baytrail/include/soc/ramstage.h
+++ b/src/soc/intel/baytrail/include/soc/ramstage.h
@@ -11,11 +11,9 @@
void baytrail_init_pre_device(struct soc_intel_baytrail_config *config);
void baytrail_init_cpus(struct device *dev);
void southcluster_enable_dev(struct device *dev);
-#if CONFIG(HAVE_REFCODE_BLOB)
+/* The baytrail_run_reference_code() function is provided by either
+ * native refcode or the ChromeBook refcode wrapper */
void baytrail_run_reference_code(void);
-#else
-static inline void baytrail_run_reference_code(void) {}
-#endif
void baytrail_init_scc(void);
void scc_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index);
diff --git a/src/soc/intel/baytrail/iosf.c b/src/soc/intel/baytrail/iosf.c
index 5a8331057e..21060eee1a 100644
--- a/src/soc/intel/baytrail/iosf.c
+++ b/src/soc/intel/baytrail/iosf.c
@@ -15,7 +15,7 @@ static inline uint32_t read_iosf_reg(int reg)
}
/* Common sequences for all the port accesses. */
-static uint32_t iosf_read_port(uint32_t cr, int reg)
+uint32_t iosf_read_port(uint32_t cr, int reg)
{
cr |= IOSF_REG(reg) | IOSF_BYTE_EN;
write_iosf_reg(MCRX_REG, IOSF_REG_UPPER(reg));
@@ -23,7 +23,7 @@ static uint32_t iosf_read_port(uint32_t cr, int reg)
return read_iosf_reg(MDR_REG);
}
-static void iosf_write_port(uint32_t cr, int reg, uint32_t val)
+void iosf_write_port(uint32_t cr, int reg, uint32_t val)
{
cr |= IOSF_REG(reg) | IOSF_BYTE_EN;
write_iosf_reg(MDR_REG, val);
@@ -68,6 +68,16 @@ void iosf_dunit_write(int reg, uint32_t val)
iosf_write_port(IOSF_WRITE(SYSMEMC), reg, val);
}
+uint32_t iosf_cunit_read(int reg)
+{
+ return iosf_read_port(IOSF_READ(CUNIT), reg);
+}
+
+void iosf_cunit_write(int reg, uint32_t val)
+{
+ iosf_write_port(IOSF_WRITE(CUNIT), reg, val);
+}
+
uint32_t iosf_punit_read(int reg)
{
return iosf_read_port(IOSF_READ(PMC), reg);
diff --git a/src/soc/intel/baytrail/modphy_table.c b/src/soc/intel/baytrail/modphy_table.c
new file mode 100644
index 0000000000..f028c8f3de
--- /dev/null
+++ b/src/soc/intel/baytrail/modphy_table.c
@@ -0,0 +1,569 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <stdint.h>
+#include <soc/modphy_table.h>
+
+struct modphy_entry reva0_modphy_table[] = { /* SOC stepping A0/A1 */
+ { 0xa6, 0x0000804c, 0x0000ffff, 0xebeb0000, 0x00, 0x01 },
+ { 0xa6, 0x0000806c, 0x0000ffff, 0xebeb0000, 0x00, 0x01 },
+ { 0xa6, 0x000080ec, 0x0000ffff, 0xebeb0000, 0x00, 0x01 },
+ { 0xa3, 0x00002208, 0xfffffff3, 0x00000008, 0x00, 0x01 },
+ { 0xa3, 0x00002408, 0xfffffff3, 0x00000008, 0x00, 0x01 },
+ { 0xa3, 0x00002238, 0xfffffff8, 0x00000006, 0x00, 0x01 },
+ { 0xa3, 0x00002438, 0xfffffff8, 0x00000006, 0x00, 0x01 },
+ { 0xa3, 0x0000800c, 0xffffff00, 0x0000001e, 0x00, 0x01 },
+ { 0xa3, 0x0000802c, 0xffffff00, 0x0000001e, 0x00, 0x01 },
+ { 0xa3, 0x0000808c, 0xffffff00, 0x0000001e, 0x00, 0x01 },
+ { 0xa3, 0x0000804c, 0x0000ffff, 0x22220000, 0x00, 0x01 },
+ { 0xa3, 0x0000806c, 0x0000ffff, 0x22220000, 0x00, 0x01 },
+ { 0xa3, 0x000080ec, 0x0000ffff, 0x22220000, 0x00, 0x01 },
+ { 0xa3, 0x0000810c, 0x3fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x000080e0, 0xffff00ff, 0x00005000, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x00002254, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x000080c0, 0xffffdfff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x00000288, 0xffff00ff, 0x00009800, 0x00, 0x01 },
+ { 0xa6, 0x00000488, 0xffff00ff, 0x00009800, 0x00, 0x01 },
+ { 0xa6, 0x00000688, 0xffff00ff, 0x00009800, 0x00, 0x01 },
+ { 0xa6, 0x00000888, 0xffff00ff, 0x00009800, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x00000288, 0xff00ffff, 0x00800000, 0x00, 0x01 },
+ { 0xa6, 0x00000488, 0xff00ffff, 0x00800000, 0x00, 0x01 },
+ { 0xa6, 0x00000688, 0xff00ffff, 0x00800000, 0x00, 0x01 },
+ { 0xa6, 0x00000888, 0xff00ffff, 0x00800000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xf3ffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xf3ffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xf3ffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xf3ffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xcfffffff, 0x30000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xcfffffff, 0x30000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xcfffffff, 0x30000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xcfffffff, 0x30000000, 0x00, 0x01 },
+ { 0xa6, 0x00000294, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000294, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000494, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000494, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000694, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000694, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000894, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000894, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x00000288, 0x00ffffff, 0x55000000, 0x00, 0x01 },
+ { 0xa6, 0x00000488, 0x00ffffff, 0x55000000, 0x00, 0x01 },
+ { 0xa6, 0x00000688, 0x00ffffff, 0x55000000, 0x00, 0x01 },
+ { 0xa6, 0x00000888, 0x00ffffff, 0x55000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xffffff00, 0x00000046, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xffffff00, 0x00000046, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xffffff00, 0x00000046, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xffffff00, 0x00000046, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xffff00ff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xffff00ff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xffff00ff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xffff00ff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xff00ffff, 0x00780000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xff00ffff, 0x00780000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xff00ffff, 0x00780000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xff00ffff, 0x00780000, 0x00, 0x01 },
+ { 0xa6, 0x00000290, 0x00ffffff, 0xc0000000, 0x00, 0x01 },
+ { 0xa6, 0x00000490, 0x00ffffff, 0xc0000000, 0x00, 0x01 },
+ { 0xa6, 0x00000690, 0x00ffffff, 0xc0000000, 0x00, 0x01 },
+ { 0xa6, 0x00000890, 0x00ffffff, 0xc0000000, 0x00, 0x01 },
+ { 0xa6, 0x00000294, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000294, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000494, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000494, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000694, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000694, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000894, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000894, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x000080a4, 0xffff0000, 0x0000f487, 0x00, 0x01 },
+ { 0xa6, 0x00000314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000514, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000714, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000914, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00002314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa3, 0x00002314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa3, 0x00002514, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00008094, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa6, 0x00008034, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa6, 0x00008014, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa3, 0x00008094, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa3, 0x00008034, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa3, 0x00008014, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa6, 0x000080e8, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x00008068, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x00008048, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x000080e8, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x00008068, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x00008048, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x000080e8, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa6, 0x00008068, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa6, 0x00008048, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa3, 0x000080e8, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa3, 0x00008068, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa3, 0x00008048, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa6, 0x000080e8, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00008068, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00008048, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x000080e8, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008068, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008048, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000801c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x0000803c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x0000809c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x0000801c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x0000803c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x0000809c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x00008040, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00008060, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x000080e0, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008040, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008060, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x000080e0, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008100, 0xfffffffc, 0x00000003, 0x00, 0x01 },
+ { 0xa6, 0x0000804c, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa6, 0x0000806c, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa6, 0x000080ec, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa3, 0x0000804c, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa3, 0x0000806c, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa3, 0x000080ec, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa6, 0x0000804c, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa6, 0x0000806c, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa6, 0x000080ec, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa3, 0x0000804c, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa3, 0x0000806c, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa3, 0x000080ec, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa3, 0x00002300, 0xfffffff0, 0x00000009, 0x00, 0x01 },
+ { 0xa3, 0x00002500, 0xfffffff0, 0x00000009, 0x00, 0x01 },
+ { 0xa6, 0x00000314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000514, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000714, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000914, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00002314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa3, 0x00002314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa3, 0x00002514, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x000080c0, 0xfffff3ff, 0x00000c00, 0x00, 0x01 },
+ { 0xa3, 0x000080c0, 0xfffff3ff, 0x00000c00, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00002254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00000254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00000454, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00000654, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00000854, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00002254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00002454, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00002254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00000254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00000454, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00000654, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00000854, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00002254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00002454, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x000080c0, 0xffffdfff, 0x00002000, 0x00, 0x01 },
+ { 0xa3, 0x000080c0, 0xffffdfff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x000080c0, 0xfffff3ff, 0x00000400, 0x00, 0x01 },
+ { 0xa3, 0x000080c0, 0xfffff3ff, 0x00000400, 0x00, 0x01 },
+ { 0xa6, 0x000080c0, 0xffffdfff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x000080c0, 0xffffdfff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00002244, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00002244, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00002444, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00002244, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00002244, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00002444, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00002318, 0x0000ffff, 0x45140000, 0x00, 0x01 },
+ { 0xa3, 0x00002300, 0x80ffffff, 0x02000000, 0x00, 0x01 },
+ { 0xa3, 0x00002304, 0xff80ffff, 0x00020000, 0x00, 0x01 },
+ { 0xa3, 0x0000231c, 0xffffff00, 0x0000000d, 0x00, 0x01 },
+ { 0xa3, 0x00002518, 0x0000ffff, 0x47140000, 0x00, 0x01 },
+ { 0xa3, 0x00002500, 0x80ffffff, 0x04000000, 0x00, 0x01 },
+ { 0xa3, 0x00002504, 0xff80ffff, 0x00040000, 0x00, 0x01 },
+ { 0xa3, 0x0000251c, 0xffffff00, 0x0000000d, 0x00, 0x01 },
+ /* Workaround for #4376904, #4682850, #4753319 */
+ { 0x43, 0x00007f04, 0xffff0000, 0x00004700, 0x06, 0x07 },
+ { 0x43, 0x00004100, 0xfff00000, 0x0004fa01, 0x06, 0x07 },
+ { 0x43, 0x00004200, 0xfff00000, 0x0004ea01, 0x06, 0x07 },
+ { 0x43, 0x00004300, 0xfff00000, 0x00049209, 0x06, 0x07 },
+ { 0x43, 0x00004400, 0xfff00000, 0x00049209, 0x06, 0x07 },
+ { 0x43, 0x00004122, 0x00000000, 0x00004011, 0x06, 0x07 },
+ { 0x43, 0x00004222, 0x00000000, 0x06004015, 0x06, 0x07 },
+ { 0x43, 0x00004500, 0xffff7fff, 0x00000000, 0x06, 0x07 },
+ { 0x43, 0x00004600, 0xffff7fff, 0x00000000, 0x06, 0x07 },
+ { 0x43, 0x00004700, 0xffff7fff, 0x00000000, 0x06, 0x07 },
+ { 0x43, 0x00004800, 0xffff7fff, 0x00000000, 0x06, 0x07 },
+ MODPHY_ENTRY_END
+};
+
+struct modphy_entry revb0_modphy_table[] = { /* SOC stepping B0 or later */
+ { 0xa6, 0x00008014, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa6, 0x00008048, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x00008048, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa6, 0x00008048, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000801c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x00008040, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000804c, 0x0000ffff, 0xebeb0000, 0x00, 0x01 },
+ { 0xa6, 0x0000806c, 0x0000ffff, 0xebeb0000, 0x00, 0x01 },
+ { 0xa6, 0x000080ec, 0x0000ffff, 0xebeb0000, 0x00, 0x01 },
+ { 0xa3, 0x00002208, 0xfffffff3, 0x00000008, 0x00, 0x01 },
+ { 0xa3, 0x00002408, 0xfffffff3, 0x00000008, 0x00, 0x01 },
+ { 0xa3, 0x00002238, 0xfffffff8, 0x00000006, 0x00, 0x01 },
+ { 0xa3, 0x00002438, 0xfffffff8, 0x00000006, 0x00, 0x01 },
+ { 0xa3, 0x0000800c, 0xffffff00, 0x0000001e, 0x00, 0x01 },
+ { 0xa3, 0x0000802c, 0xffffff00, 0x0000001e, 0x00, 0x01 },
+ { 0xa3, 0x0000808c, 0xffffff00, 0x0000001e, 0x00, 0x01 },
+ { 0xa3, 0x0000804c, 0x0000ffff, 0x22220000, 0x00, 0x01 },
+ { 0xa3, 0x0000806c, 0x0000ffff, 0x22220000, 0x00, 0x01 },
+ { 0xa3, 0x000080ec, 0x0000ffff, 0x22220000, 0x00, 0x01 },
+ { 0xa3, 0x0000810c, 0x3fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x000080e0, 0xffff00ff, 0x00005000, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x00002254, 0xffff00ff, 0x00008000, 0x00, 0x01 },
+ { 0xa6, 0x000080c0, 0xffffdfff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x00000288, 0xffff00ff, 0x00009800, 0x00, 0x01 },
+ { 0xa6, 0x00000488, 0xffff00ff, 0x00009800, 0x00, 0x01 },
+ { 0xa6, 0x00000688, 0xffff00ff, 0x00009800, 0x00, 0x01 },
+ { 0xa6, 0x00000888, 0xffff00ff, 0x00009800, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x00000288, 0xff00ffff, 0x00800000, 0x00, 0x01 },
+ { 0xa6, 0x00000488, 0xff00ffff, 0x00800000, 0x00, 0x01 },
+ { 0xa6, 0x00000688, 0xff00ffff, 0x00800000, 0x00, 0x01 },
+ { 0xa6, 0x00000888, 0xff00ffff, 0x00800000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xf3ffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xf3ffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xf3ffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xf3ffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xcfffffff, 0x30000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xcfffffff, 0x30000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xcfffffff, 0x30000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xcfffffff, 0x30000000, 0x00, 0x01 },
+ { 0xa6, 0x00000294, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000294, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000494, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000494, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000694, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000694, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000894, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000894, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xcfffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xf3ffffff, 0x0c000000, 0x00, 0x01 },
+ { 0xa6, 0x00000288, 0x00ffffff, 0x55000000, 0x00, 0x01 },
+ { 0xa6, 0x00000488, 0x00ffffff, 0x55000000, 0x00, 0x01 },
+ { 0xa6, 0x00000688, 0x00ffffff, 0x55000000, 0x00, 0x01 },
+ { 0xa6, 0x00000888, 0x00ffffff, 0x55000000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xffffff00, 0x00000046, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xffffff00, 0x00000046, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xffffff00, 0x00000046, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xffffff00, 0x00000046, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xffff00ff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xffff00ff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xffff00ff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xffff00ff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x0000028c, 0xff00ffff, 0x00780000, 0x00, 0x01 },
+ { 0xa6, 0x0000048c, 0xff00ffff, 0x00780000, 0x00, 0x01 },
+ { 0xa6, 0x0000068c, 0xff00ffff, 0x00780000, 0x00, 0x01 },
+ { 0xa6, 0x0000088c, 0xff00ffff, 0x00780000, 0x00, 0x01 },
+ { 0xa6, 0x00000290, 0x00ffffff, 0xc0000000, 0x00, 0x01 },
+ { 0xa6, 0x00000490, 0x00ffffff, 0xc0000000, 0x00, 0x01 },
+ { 0xa6, 0x00000690, 0x00ffffff, 0xc0000000, 0x00, 0x01 },
+ { 0xa6, 0x00000890, 0x00ffffff, 0xc0000000, 0x00, 0x01 },
+ { 0xa6, 0x00000294, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000294, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000494, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000494, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000694, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000694, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x00000894, 0x7fffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000894, 0x7fffffff, 0x80000000, 0x00, 0x01 },
+ { 0xa6, 0x000080a4, 0xffff0000, 0x0000f487, 0x00, 0x01 },
+ { 0xa6, 0x00000314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000514, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000714, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000914, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00002314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa3, 0x00002314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa3, 0x00002514, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00008094, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa6, 0x00008034, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa3, 0x00008094, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa3, 0x00008034, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa3, 0x00008014, 0xf8ffffff, 0x05000000, 0x00, 0x01 },
+ { 0xa6, 0x000080e8, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x00008068, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x000080e8, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x00008068, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x00008048, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x000080e8, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa6, 0x00008068, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa3, 0x000080e8, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa3, 0x00008068, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa3, 0x00008048, 0xffe0ffff, 0x00100000, 0x00, 0x01 },
+ { 0xa6, 0x000080e8, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00008068, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x000080e8, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008068, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008048, 0xffffff0f, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x0000803c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x0000809c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x0000801c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x0000803c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa3, 0x0000809c, 0xff3fffff, 0x00c00000, 0x00, 0x01 },
+ { 0xa6, 0x00008060, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x000080e0, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008040, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008060, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x000080e0, 0xefffffff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00008100, 0xfffffffc, 0x00000003, 0x00, 0x01 },
+ { 0xa6, 0x0000804c, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa6, 0x0000806c, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa6, 0x000080ec, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa3, 0x0000804c, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa3, 0x0000806c, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa3, 0x000080ec, 0x00ffffff, 0x43000000, 0x00, 0x01 },
+ { 0xa6, 0x0000804c, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa6, 0x0000806c, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa6, 0x000080ec, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa3, 0x0000804c, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa3, 0x0000806c, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa3, 0x000080ec, 0xff00ffff, 0x00220000, 0x00, 0x01 },
+ { 0xa3, 0x00002300, 0xfffffff0, 0x00000009, 0x00, 0x01 },
+ { 0xa3, 0x00002500, 0xfffffff0, 0x00000009, 0x00, 0x01 },
+ { 0xa6, 0x00000314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000514, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000714, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000914, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00002314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa3, 0x00002314, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa3, 0x00002514, 0xfffffff8, 0x00000007, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00002254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00000254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00000454, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00000654, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00000854, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00002254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00002454, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00002254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00000254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00000454, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00000654, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00000854, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00002254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00002454, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x000080c0, 0xffffdfff, 0x00002000, 0x00, 0x01 },
+ { 0xa3, 0x000080c0, 0xffffdfff, 0x00002000, 0x00, 0x01 },
+ { 0xa6, 0x000080c0, 0xffffdfff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x000080c0, 0xffffdfff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00002244, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00002244, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00002444, 0xfffff7ff, 0x00000800, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00002244, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00002244, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00002444, 0xfffff7ff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00002318, 0x0000ffff, 0x45140000, 0x00, 0x01 },
+ { 0xa3, 0x00002300, 0x80ffffff, 0x02000000, 0x00, 0x01 },
+ { 0xa3, 0x00002304, 0xff80ffff, 0x00020000, 0x00, 0x01 },
+ { 0xa3, 0x0000231c, 0xffffff00, 0x0000000d, 0x00, 0x01 },
+ { 0xa3, 0x00002518, 0x0000ffff, 0x47140000, 0x00, 0x01 },
+ { 0xa3, 0x00002500, 0x80ffffff, 0x04000000, 0x00, 0x01 },
+ { 0xa3, 0x00002504, 0xff80ffff, 0x00040000, 0x00, 0x01 },
+ { 0xa3, 0x0000251c, 0xffffff00, 0x0000000d, 0x00, 0x01 },
+ /* Workaround for #4376904, #4682850, #4753319 */
+ { 0x43, 0x00007f04, 0xffff0000, 0x00004700, 0x06, 0x07 },
+ { 0x43, 0x00004100, 0xfff00000, 0x00049209, 0x06, 0x07 },
+ { 0x43, 0x00004200, 0xfff00000, 0x00049209, 0x06, 0x07 },
+ { 0x43, 0x00004300, 0xfff00000, 0x00049209, 0x06, 0x07 },
+ { 0x43, 0x00004400, 0xfff00000, 0x00049209, 0x06, 0x07 },
+ { 0x43, 0x00004500, 0xffff7fff, 0x00000000, 0x06, 0x07 },
+ { 0x43, 0x00004600, 0xffff7fff, 0x00000000, 0x06, 0x07 },
+ { 0x43, 0x00004700, 0xffff7fff, 0x00000000, 0x06, 0x07 },
+ { 0x43, 0x00004800, 0xffff7fff, 0x00000000, 0x06, 0x07 },
+ { 0xa3, 0x00008100, 0xfffffcff, 0x00000300, 0x00, 0x01 },
+ { 0xa3, 0x0000804c, 0x0000ffff, 0x85850000, 0x00, 0x01 },
+ { 0xa3, 0x00002290, 0x00ffffff, 0x00600000, 0x00, 0x01 },
+ { 0xa3, 0x00002490, 0x00ffffff, 0x00600000, 0x00, 0x01 },
+ { 0xa3, 0x0000230c, 0xff00ffff, 0x00020000, 0x00, 0x01 },
+ { 0xa3, 0x0000250c, 0xff00ffff, 0x00020000, 0x00, 0x01 },
+ { 0xa3, 0x000080d0, 0xffffff0f, 0x00000050, 0x00, 0x01 },
+ { 0xa6, 0x00000288, 0xffff00ff, 0x0000a000, 0x00, 0x01 },
+ { 0xa6, 0x00000488, 0xffff00ff, 0x0000a000, 0x00, 0x01 },
+ { 0xa6, 0x00000688, 0xffff00ff, 0x0000a000, 0x00, 0x01 },
+ { 0xa6, 0x00000888, 0xffff00ff, 0x0000a000, 0x00, 0x01 },
+ { 0xa6, 0x00000290, 0xffff00ff, 0x00005500, 0x00, 0x01 },
+ { 0xa6, 0x00000290, 0xff00ffff, 0x003b0000, 0x00, 0x01 },
+ { 0xa6, 0x00000490, 0xffff00ff, 0x00005500, 0x00, 0x01 },
+ { 0xa6, 0x00000490, 0xff00ffff, 0x003b0000, 0x00, 0x01 },
+ { 0xa6, 0x00000690, 0xffff00ff, 0x00005500, 0x00, 0x01 },
+ { 0xa6, 0x00000690, 0xff00ffff, 0x003b0000, 0x00, 0x01 },
+ { 0xa6, 0x00000890, 0xffff00ff, 0x00005500, 0x00, 0x01 },
+ { 0xa6, 0x00000890, 0xff00ffff, 0x003b0000, 0x00, 0x01 },
+ { 0xa6, 0x0000030c, 0xffffff00, 0x0000009c, 0x00, 0x01 },
+ { 0xa6, 0x0000030c, 0xffff00ff, 0x00004b00, 0x00, 0x01 },
+ { 0xa6, 0x00000318, 0xff00ffff, 0x009c0000, 0x00, 0x01 },
+ { 0xa6, 0x00000318, 0x00ffffff, 0x4b000000, 0x00, 0x01 },
+ { 0xa6, 0x0000050c, 0xffffff00, 0x0000009c, 0x00, 0x01 },
+ { 0xa6, 0x0000050c, 0xffff00ff, 0x00004b00, 0x00, 0x01 },
+ { 0xa6, 0x00000518, 0xff00ffff, 0x009c0000, 0x00, 0x01 },
+ { 0xa6, 0x00000518, 0x00ffffff, 0x4b000000, 0x00, 0x01 },
+ { 0xa6, 0x0000070c, 0xffffff00, 0x0000009c, 0x00, 0x01 },
+ { 0xa6, 0x0000070c, 0xffff00ff, 0x00004b00, 0x00, 0x01 },
+ { 0xa6, 0x00000718, 0xff00ffff, 0x009c0000, 0x00, 0x01 },
+ { 0xa6, 0x00000718, 0x00ffffff, 0x4b000000, 0x00, 0x01 },
+ { 0xa6, 0x0000090c, 0xffffff00, 0x0000009c, 0x00, 0x01 },
+ { 0xa6, 0x0000090c, 0xffff00ff, 0x00004b00, 0x00, 0x01 },
+ { 0xa6, 0x00000918, 0xff00ffff, 0x009c0000, 0x00, 0x01 },
+ { 0xa6, 0x00000918, 0x00ffffff, 0x4b000000, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffff7, 0x00000008, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffff7, 0x00000008, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffff7, 0x00000008, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffff7, 0x00000008, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffffb, 0x00000004, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffffb, 0x00000004, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffffb, 0x00000004, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffffb, 0x00000004, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffffd, 0x00000002, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffffd, 0x00000002, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffffd, 0x00000002, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffffd, 0x00000002, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffff9ff, 0x00000200, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffff9ff, 0x00000200, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffff9ff, 0x00000200, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffff9ff, 0x00000200, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffff9ff, 0x00000400, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffff9ff, 0x00000400, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffff9ff, 0x00000400, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffff9ff, 0x00000400, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffff9ff, 0x00000600, 0x00, 0x01 },
+ { 0xa6, 0x00000254, 0x00ffffff, 0x95000000, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000244, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffff9ff, 0x00000600, 0x00, 0x01 },
+ { 0xa6, 0x00000454, 0x00ffffff, 0x95000000, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000444, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffff9ff, 0x00000600, 0x00, 0x01 },
+ { 0xa6, 0x00000654, 0x00ffffff, 0x95000000, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000644, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffff9ff, 0x00000600, 0x00, 0x01 },
+ { 0xa6, 0x00000854, 0x00ffffff, 0x95000000, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa6, 0x00000844, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffff7, 0x00000008, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffff7, 0x00000008, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffffb, 0x00000004, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffffb, 0x00000004, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffffd, 0x00000002, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffffd, 0x00000002, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffff9ff, 0x00000200, 0x00, 0x01 },
+ { 0xa3, 0x00002254, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffff9ff, 0x00000200, 0x00, 0x01 },
+ { 0xa3, 0x00002454, 0xffff00ff, 0x00009500, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffff9ff, 0x00000400, 0x00, 0x01 },
+ { 0xa3, 0x00002254, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffff9ff, 0x00000400, 0x00, 0x01 },
+ { 0xa3, 0x00002454, 0xff00ffff, 0x00950000, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffff9ff, 0x00000600, 0x00, 0x01 },
+ { 0xa3, 0x00002254, 0x00ffffff, 0x95000000, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa3, 0x00002244, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffff9ff, 0x00000600, 0x00, 0x01 },
+ { 0xa3, 0x00002454, 0x00ffffff, 0x95000000, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffeff, 0x00000100, 0x00, 0x01 },
+ { 0xa3, 0x00002444, 0xfffffeff, 0x00000000, 0x00, 0x01 },
+ MODPHY_ENTRY_END
+};
diff --git a/src/soc/intel/baytrail/refcode_native.c b/src/soc/intel/baytrail/refcode_native.c
new file mode 100644
index 0000000000..a9976fb409
--- /dev/null
+++ b/src/soc/intel/baytrail/refcode_native.c
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <device/mmio.h>
+#include <console/console.h>
+#include <cpu/x86/tsc.h>
+#include <device/pci.h>
+#include <delay.h>
+#include <soc/pci_devs.h>
+#include <soc/lpc.h>
+#include <soc/iosf.h>
+#include <soc/iomap.h>
+#include <soc/ramstage.h>
+#include <soc/modphy_table.h>
+
+#define IOSF_READ(op_read, port) \
+ (IOSF_OPCODE(op_read) | IOSF_PORT(port))
+#define IOSF_WRITE(op_write, port) \
+ (IOSF_OPCODE(op_write) | IOSF_PORT(port))
+
+static void program_modphy_table(struct modphy_entry *table)
+{
+ u32 tmp;
+
+ for (; table->port; ++table) {
+ tmp = iosf_read_port(IOSF_READ(table->op_read, table->port), table->reg);
+ iosf_write_port(IOSF_WRITE(table->op_write, table->port), table->reg,
+ (tmp & table->mask) | table->value);
+ }
+}
+
+static void gpio_sc_sdcard_workaround(void)
+{
+ setbits32((char *) IO_BASE_ADDRESS + 0x698, (1 << 0));
+ setbits32((char *) IO_BASE_ADDRESS + 0x698, (1 << 2));
+ clrbits32((char *) IO_BASE_ADDRESS + 0x698, (1 << 1));
+ clrbits32((char *) IO_BASE_ADDRESS + 0x690, (1 << 3));
+ udelay(100);
+ clrbits32((char *) IO_BASE_ADDRESS + 0x698, (1 << 0));
+ udelay(100);
+ write32((char *) IO_BASE_ADDRESS + 0x830, 0x78480);
+ udelay(40);
+ write32((char *) IO_BASE_ADDRESS + 0x830, 0x78080);
+ setbits32((char *) IO_BASE_ADDRESS + 0x698, (1 << 0));
+ udelay(100);
+ setbits32((char *) IO_BASE_ADDRESS + 0x698, (1 << 1));
+ clrbits32((char *) IO_BASE_ADDRESS + 0x698, (1 << 2));
+ clrsetbits32((char *) IO_BASE_ADDRESS + 0x690, 7, (1 << 0));
+}
+
+#define BUNIT_BALIMIT0 0x0b
+#define AUNIT_AVCCTL 0x21
+#define AUNIT_ACFCACV 0x60
+#define CUNIT_ACCESS_CTRL_VIOL 0x41
+#define CUINT_SSA_REGIONAL_TRUNKGATE_CTL 0x43
+#define TUNIT_CTL 0x03
+#define TUNIT_MISC_CTL 0x04
+
+static void ssa_safe_config(void)
+{
+ u32 tmp;
+
+ tmp = iosf_bunit_read(BUNIT_BALIMIT0);
+ iosf_bunit_write(BUNIT_BALIMIT0, (tmp & 0xC0D0D0D0) | 0x1F2F2F2F);
+
+ tmp = iosf_aunit_read(AUNIT_AVCCTL);
+ iosf_aunit_write(AUNIT_AVCCTL, tmp | 0x80000100);
+
+ tmp = iosf_aunit_read(AUNIT_ACFCACV);
+ iosf_aunit_write(AUNIT_ACFCACV, tmp & 0x7FFFFFFF);
+
+ tmp = iosf_cunit_read(CUNIT_ACCESS_CTRL_VIOL);
+ iosf_cunit_write(CUNIT_ACCESS_CTRL_VIOL, tmp & 0x7FFFFFFF);
+
+ iosf_cunit_write(CUINT_SSA_REGIONAL_TRUNKGATE_CTL, 0x70008);
+
+ tmp = iosf_cpu_bus_read(TUNIT_CTL);
+ iosf_cpu_bus_write(TUNIT_CTL, tmp | 0x110430);
+
+ tmp = iosf_cpu_bus_read(TUNIT_MISC_CTL);
+ iosf_cpu_bus_write(TUNIT_MISC_CTL, tmp | 0x40010);
+}
+
+#define R_PCH_PMC_MTPMC1 0xb0
+
+/*
+ * Replacement for refcode.elf
+ */
+void baytrail_run_reference_code(void)
+{
+ u32 tmp;
+ size_t pollcnt;
+
+ printk(BIOS_DEBUG, "ModPHY init entry\n");
+
+ if (pci_read_config8(pcidev_on_root(LPC_DEV, LPC_FUNC), REVID) < RID_B_STEPPING_START) {
+ printk(BIOS_DEBUG, "SOC A0/A1 ModPhy Table programming\n");
+ program_modphy_table(reva0_modphy_table);
+ } else {
+ printk(BIOS_DEBUG, "SOC B0 and later ModPhy Table programming\n");
+ program_modphy_table(revb0_modphy_table);
+ }
+
+ setbits32((char *) PMC_BASE_ADDRESS + R_PCH_PMC_MTPMC1, 8);
+
+ for (pollcnt = 0; pollcnt < 10; ++pollcnt) {
+ tmp = read32((char *) PMC_BASE_ADDRESS + R_PCH_PMC_MTPMC1);
+ printk(BIOS_DEBUG, "Polling bit3 of R_PCH_PMC_MTPMC1 = %x\n", tmp);
+ if (!(tmp & 8))
+ break;
+ }
+
+ gpio_sc_sdcard_workaround();
+ ssa_safe_config();
+
+ printk(BIOS_DEBUG, "ModPHY init done\n");
+}