summaryrefslogtreecommitdiff
path: root/src/mainboard/amd/mayan/ec.c
diff options
context:
space:
mode:
authorRitul Guru <ritul.bits@gmail.com>2022-11-25 11:31:26 +0530
committerMartin L Roth <gaumless@gmail.com>2022-11-27 17:18:13 +0000
commitf123ffe78c2a519fdf0a32bcbfd1ec36733bb13a (patch)
treec55736e1ec014b52d32af70b2112915f0558638a /src/mainboard/amd/mayan/ec.c
parent21e0da31282f584a1a830c6621e0673f1d0f1b76 (diff)
mb/amd/mayan: Add framework for morgana crb mayan
mayan is the reference board for the morgana SoC. It needs to be updated to match the actual board design as well. amd/mayan is started as a copy of amd/birman. Change-Id: Id6801e6c6e706ae3878ce9e2c3d6452964235148 Signed-off-by: Ritul Guru <ritul.bits@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70010 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/amd/mayan/ec.c')
-rw-r--r--src/mainboard/amd/mayan/ec.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/mainboard/amd/mayan/ec.c b/src/mainboard/amd/mayan/ec.c
new file mode 100644
index 0000000000..1b1d09bc72
--- /dev/null
+++ b/src/mainboard/amd/mayan/ec.c
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/* TODO: Update for mayan */
+
+#include <ec/acpi/ec.h>
+#include "ec.h"
+
+#define MAYAN_EC_CMD 0x666
+#define MAYAN_EC_DATA 0x662
+
+#define EC_GPIO_3_ADDR 0xA3
+#define EC_GPIO_LOM_RESET_AUX BIT(1)
+
+#define EC_GPIO_7_ADDR 0xA7
+#define EC_GPIO_DT_PWREN BIT(2)
+#define EC_GPIO_WWAN_MODULE_RST BIT(5)
+
+#define EC_GPIO_8_ADDR 0xA8
+#define EC_GPIO_SMBUS0_EN BIT(0)
+
+#define EC_GPIO_A_ADDR 0xAA
+#define EC_GPIO_WWAN_PWREN BIT(3)
+#define EC_GPIO_M2_SSD0_PWREN BIT(6)
+#define EC_GPIO_LOM_PWREN BIT(7)
+
+#define EC_GPIO_C_ADDR 0xAC
+#define EC_GPIO_DT_N_WLAN_SW BIT(1)
+#define EC_GPIO_MP2_SEL BIT(2)
+#define EC_GPIO_WWAN_N_LOM_SW BIT(3)
+
+#define EC_SW02_ADDR 0xB7
+#define EC_SW02_MS BIT(7)
+
+static void configure_ec_gpio(void)
+{
+ uint8_t tmp;
+
+ tmp = ec_read(EC_GPIO_3_ADDR);
+ tmp |= EC_GPIO_LOM_RESET_AUX;
+ ec_write(EC_GPIO_3_ADDR, tmp);
+
+ tmp = ec_read(EC_GPIO_7_ADDR);
+ tmp |= EC_GPIO_WWAN_MODULE_RST | EC_GPIO_DT_PWREN;
+ ec_write(EC_GPIO_7_ADDR, tmp);
+
+ tmp = ec_read(EC_GPIO_8_ADDR);
+ tmp |= EC_GPIO_SMBUS0_EN;
+ ec_write(EC_GPIO_8_ADDR, tmp);
+
+ tmp = ec_read(EC_GPIO_A_ADDR);
+ tmp |= EC_GPIO_M2_SSD0_PWREN | EC_GPIO_LOM_PWREN | EC_GPIO_WWAN_PWREN;
+ ec_write(EC_GPIO_A_ADDR, tmp);
+
+ tmp = ec_read(EC_GPIO_C_ADDR);
+ tmp |= EC_GPIO_WWAN_N_LOM_SW | EC_GPIO_MP2_SEL | EC_GPIO_DT_N_WLAN_SW;
+ ec_write(EC_GPIO_C_ADDR, tmp);
+
+ tmp = ec_read(EC_SW02_ADDR);
+ tmp |= EC_SW02_MS;
+ ec_write(EC_SW02_ADDR, tmp);
+}
+
+void mayan_ec_init(void)
+{
+ ec_set_ports(MAYAN_EC_CMD, MAYAN_EC_DATA);
+ configure_ec_gpio();
+}