Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13981
-gerrit
commit d86cbde8db6750a557c9eb9cb7f244954d83befa
Author: Jitao Shi <jitao.shi(a)mediatek.com>
Date: Fri Jan 8 15:59:46 2016 +0800
Add a driver for the parade ps8640
BRANCH=none
BUG=none
TEST=none
Change-Id: Icf397ce2ffdaed5048367daf2086c067984fea0a
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: b5a88793ccfc46af196300791a300be67b70f5b1
Original-Change-Id: I75adf2688c9c8b9a2338f7dee5d0ac10e7181529
Original-Signed-off-by: Jitao Shi <jitao.shi(a)mediatek.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/321056
Original-Commit-Ready: Yidi Lin <yidi.lin(a)mediatek.com>
Original-Tested-by: Yidi Lin <yidi.lin(a)mediatek.com>
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
src/drivers/parade/Kconfig | 1 +
src/drivers/parade/Makefile.inc | 1 +
src/drivers/parade/ps8640/Kconfig | 24 ++++++++++
src/drivers/parade/ps8640/Makefile.inc | 20 ++++++++
src/drivers/parade/ps8640/ps8640.c | 83 ++++++++++++++++++++++++++++++++++
src/drivers/parade/ps8640/ps8640.h | 49 ++++++++++++++++++++
6 files changed, 178 insertions(+)
diff --git a/src/drivers/parade/Kconfig b/src/drivers/parade/Kconfig
index be80bb8..7fe74df 100644
--- a/src/drivers/parade/Kconfig
+++ b/src/drivers/parade/Kconfig
@@ -14,3 +14,4 @@
##
source src/drivers/parade/ps8625/Kconfig
+source src/drivers/parade/ps8640/Kconfig
diff --git a/src/drivers/parade/Makefile.inc b/src/drivers/parade/Makefile.inc
index 0470763..06367c1 100644
--- a/src/drivers/parade/Makefile.inc
+++ b/src/drivers/parade/Makefile.inc
@@ -14,3 +14,4 @@
##
subdirs-$(CONFIG_DRIVER_PARADE_PS8625) += ps8625/
+subdirs-$(CONFIG_DRIVER_PARADE_PS8640) += ps8640/
diff --git a/src/drivers/parade/ps8640/Kconfig b/src/drivers/parade/ps8640/Kconfig
new file mode 100644
index 0000000..0a6e931
--- /dev/null
+++ b/src/drivers/parade/ps8640/Kconfig
@@ -0,0 +1,24 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright 2015 MediaTek Inc.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc.
+##
+
+config DRIVER_PARADE_PS8640
+ bool
+ default n
+ help
+ Parade PS8640 MIPI DSI to eDP Converter
diff --git a/src/drivers/parade/ps8640/Makefile.inc b/src/drivers/parade/ps8640/Makefile.inc
new file mode 100644
index 0000000..27d491f
--- /dev/null
+++ b/src/drivers/parade/ps8640/Makefile.inc
@@ -0,0 +1,20 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright 2015 MediaTek Inc.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc.
+##
+
+ramstage-$(CONFIG_DRIVER_PARADE_PS8640) += ps8640.c
diff --git a/src/drivers/parade/ps8640/ps8640.c b/src/drivers/parade/ps8640/ps8640.c
new file mode 100644
index 0000000..5737923
--- /dev/null
+++ b/src/drivers/parade/ps8640/ps8640.c
@@ -0,0 +1,83 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <delay.h>
+#include <device/i2c.h>
+#include <edid.h>
+#include <console/console.h>
+#include <timer.h>
+
+#include "ps8640.h"
+
+int ps8640_get_edid(uint8_t bus, uint8_t chip, struct edid *out)
+{
+ int ret;
+ u8 edid[EDID_LENGTH * 2];
+ u32 edid_size;
+
+ i2c_writeb(bus, chip + 2, PAGE2_I2C_BYPASS,
+ EDID_I2C_ADDR | I2C_BYPASS_EN);
+ ret = i2c_read_bytes(bus, EDID_I2C_ADDR, 0, edid, EDID_LENGTH);
+
+ if (ret != 0) {
+ printk(BIOS_INFO, "Failed to read EDID.\n");
+ return -1;
+ }
+
+ /* check if edid have extension flag, and read additional EDID data */
+ if (edid[EDID_EXTENSION_FLAG]) {
+ edid_size += EDID_LENGTH;
+ ret = i2c_read_bytes(bus, EDID_I2C_ADDR, EDID_LENGTH,
+ &edid[EDID_LENGTH], EDID_LENGTH);
+ if (ret != 0) {
+ printk(BIOS_INFO, "Failed to read EDID ext block.\n");
+ return -1;
+ }
+ }
+
+ if (decode_edid(edid, edid_size, out)) {
+ printk(BIOS_INFO, "Failed to decode EDID.\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+int ps8640_init(uint8_t bus, uint8_t chip)
+{
+ u8 set_vdo_done;
+ struct stopwatch sw;
+
+ stopwatch_init_msecs_expire(&sw, 350);
+
+ do {
+ i2c_readb(bus, chip + 2, PAGE2_GPIO_H, &set_vdo_done);
+ if (stopwatch_expired(&sw)) {
+ printk(BIOS_INFO, "Failed to init ps8640.\n");
+ return -1;
+ }
+ } while ((set_vdo_done & PS_GPIO9) != PS_GPIO9);
+
+ i2c_writeb(bus, chip + 3, PAGE3_SET_ADD, VDO_CTL_ADD);
+ i2c_writeb(bus, chip + 3, PAGE3_SET_VAL, VDO_DIS);
+ i2c_writeb(bus, chip + 3, PAGE3_SET_ADD, VDO_CTL_ADD);
+ i2c_writeb(bus, chip + 3, PAGE3_SET_VAL, VDO_EN);
+
+ return 0;
+}
diff --git a/src/drivers/parade/ps8640/ps8640.h b/src/drivers/parade/ps8640/ps8640.h
new file mode 100644
index 0000000..ab617a7
--- /dev/null
+++ b/src/drivers/parade/ps8640/ps8640.h
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <edid.h>
+#include <types.h>
+
+#ifndef _PS8640_H_
+#define _PS8640_H_
+
+enum {
+ PAGE2_GPIO_L = 0xa6,
+ PAGE2_GPIO_H = 0xa7,
+ PAGE2_I2C_BYPASS = 0xea,
+ PS_GPIO9 = BIT(1),
+ I2C_BYPASS_EN = BIT(7),
+
+ PAGE3_SET_ADD = 0xfe,
+ PAGE3_SET_VAL = 0xff,
+ VDO_CTL_ADD = 0x13,
+ VDO_DIS = 0x18,
+ VDO_EN = 0x1c,
+};
+
+enum {
+ EDID_LENGTH = 128,
+ EDID_I2C_ADDR = 0x50,
+ EDID_EXTENSION_FLAG = 0x7e,
+};
+
+int ps8640_init(uint8_t bus, uint8_t chip);
+int ps8640_get_edid(uint8_t bus, uint8_t chip, struct edid *out);
+#endif
+
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13977
-gerrit
commit 599d2cc0fca42cdac2f1949568d61bdd404375de
Author: Yidi Lin <yidi.lin(a)mediatek.com>
Date: Mon Jan 11 10:05:46 2016 +0800
google/oak: Configure USB OC pins
BRANCH=none
BUG=none
TEST=none
Change-Id: If7244d0050833c676de72106d1c8473dd8f290a8
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: 89356785e66eb6d5b52fdf09933d2d28d9f67a90
Original-Change-Id: I94dda9834da6553795e7f3f65ff267fdcb6b7d47
Original-Signed-off-by: Yidi Lin <yidi.lin(a)mediatek.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/321055
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
src/mainboard/google/oak/mainboard.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/mainboard/google/oak/mainboard.c b/src/mainboard/google/oak/mainboard.c
index df0945b..192f4b3 100644
--- a/src/mainboard/google/oak/mainboard.c
+++ b/src/mainboard/google/oak/mainboard.c
@@ -135,8 +135,21 @@ static void configure_usb(void)
{
setup_usb_host();
- if (board_id() > 3)
+ if (board_id() > 3) {
+ /* Enable current limit */
gpio_output(PAD_CM2MCLK, 1);
+ /* Configure USB OC pins*/
+ gpio_input_pullup(PAD_MSDC3_DSL);
+ gpio_input_pullup(PAD_CMPCLK);
+ gpio_input_pullup(PAD_PCM_SYNC);
+ }
+
+ if (board_id() > 4) {
+ /* USB 2.0 type A port over current interrupt pin(low active) */
+ gpio_input_pullup(PAD_UCTS2);
+ /* USB 2.0 type A port BC1.2 STATUS(low active) */
+ gpio_input_pullup(PAD_AUD_DAT_MISO);
+ }
}
static void configure_usb_hub(void)
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13976
-gerrit
commit 29d8f29591da2cf4ba3e944a75134dbbe745a25d
Author: Ben Lok <ben.lok(a)mediatek.com>
Date: Fri Jan 8 13:10:34 2016 +0800
google/oak: Config USB Hub for rev5
Reset pin of USB Hub is connected to GPIO118, it is low active.
Config GPIO118 as GPO and output high.
BRANCH=none
BUG=none
TEST=emerge-oak coreboot
Change-Id: I630cfd1c1019447736e7e5b286790fead4bdcfb6
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: b4b5cd98d0b3c5d2bab408ecebebc924d1f2b7df
Original-Change-Id: I1ea0e1baac3da4d13301307f01bbe51e108298dd
Original-Signed-off-by: Ben Lok <ben.lok(a)mediatek.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/321054
Original-Commit-Ready: Yidi Lin <yidi.lin(a)mediatek.com>
Original-Tested-by: Yidi Lin <yidi.lin(a)mediatek.com>
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
src/mainboard/google/oak/mainboard.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/mainboard/google/oak/mainboard.c b/src/mainboard/google/oak/mainboard.c
index 289aa32..df0945b 100644
--- a/src/mainboard/google/oak/mainboard.c
+++ b/src/mainboard/google/oak/mainboard.c
@@ -139,6 +139,13 @@ static void configure_usb(void)
gpio_output(PAD_CM2MCLK, 1);
}
+static void configure_usb_hub(void)
+{
+ /* set usb hub reset pin (low active) to high */
+ if (board_id() > 4)
+ gpio_output(PAD_UTXD3, 1);
+}
+
/* Setup backlight control pins as output pin and power-off by default */
static void configure_backlight(void)
{
@@ -176,6 +183,7 @@ static void mainboard_init(device_t dev)
configure_audio();
configure_backlight();
configure_usb();
+ configure_usb_hub();
configure_bl31();
elog_init();
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13973
-gerrit
commit 8ee164ee5145feb581b725b91ebf619a0647777a
Author: Yidi Lin <yidi.lin(a)mediatek.com>
Date: Mon Dec 28 17:22:33 2015 +0800
google/oak: Enable TP_SHIFT_EN for the revisons before 5 only
BRANCH=none
BUG=none
TEST=emerge coreboot
Change-Id: Ic46490a56a6a8146b91a055b9ce5d5bb23bc7a49
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: 082ce1848bf37bba369fd0dccc4cf3fc83a8a018
Original-Change-Id: I58f009d2fc03cf5a52b4dbd042a92973cde4d035
Original-Signed-off-by: Yidi Lin <yidi.lin(a)mediatek.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/320029
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
---
src/mainboard/google/oak/mainboard.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/mainboard/google/oak/mainboard.c b/src/mainboard/google/oak/mainboard.c
index b09703e..e58d168 100644
--- a/src/mainboard/google/oak/mainboard.c
+++ b/src/mainboard/google/oak/mainboard.c
@@ -176,7 +176,8 @@ static void mainboard_init(device_t dev)
/* TP_SHIFT_EN: Enables the level shifter for I2C bus 4 (TPAD), which
* also contains the PS8640 eDP brige and the USB hub.
*/
- mt6391_gpio_output(MT6391_KP_ROW2, 1);
+ if (board_id() < 5)
+ mt6391_gpio_output(MT6391_KP_ROW2, 1);
/* Config SD card detection pin */
gpio_input(PAD_EINT1); /* SD_DET */