summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch45
1 files changed, 19 insertions, 26 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch
index 79028d2a1..c79b2f2dc 100644
--- a/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch
+++ b/meta-openbmc-mods/meta-common/recipes-bsp/u-boot/files/0022-KCS-driver-support-in-uBoot.patch
@@ -1,4 +1,4 @@
-From 16209364c27a0cb7e2b7fdd445942f68e9180263 Mon Sep 17 00:00:00 2001
+From b11377c73c85bdee1975402084c3760b70cc99c4 Mon Sep 17 00:00:00 2001
From: AppaRao Puli <apparao.puli@linux.intel.com>
Date: Wed, 13 Mar 2019 14:28:05 +0530
Subject: [PATCH] KCS driver support in uBoot
@@ -28,9 +28,9 @@ Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
---
board/aspeed/ast-g5/Makefile | 1 +
board/aspeed/ast-g5/ast-g5-intel.c | 3 +
- board/aspeed/ast-g5/ast-g5-kcs.c | 425 +++++++++++++++++++++++++++++++++++++
- board/aspeed/ast-g5/ast-g5-kcs.h | 114 ++++++++++
- 4 files changed, 543 insertions(+)
+ board/aspeed/ast-g5/ast-g5-kcs.c | 420 +++++++++++++++++++++++++++++++++++++
+ board/aspeed/ast-g5/ast-g5-kcs.h | 112 ++++++++++
+ 4 files changed, 536 insertions(+)
create mode 100644 board/aspeed/ast-g5/ast-g5-kcs.c
create mode 100644 board/aspeed/ast-g5/ast-g5-kcs.h
@@ -44,7 +44,7 @@ index 9022433..05972b9 100644
obj-y += ast-g5-timer.o
+obj-y += ast-g5-kcs.o
diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c
-index f810a40..f9955c7 100644
+index 409b1a7..41d41ea 100644
--- a/board/aspeed/ast-g5/ast-g5-intel.c
+++ b/board/aspeed/ast-g5/ast-g5-intel.c
@@ -437,6 +437,7 @@ static void pwm_init(void)
@@ -66,16 +66,15 @@ index f810a40..f9955c7 100644
}
diff --git a/board/aspeed/ast-g5/ast-g5-kcs.c b/board/aspeed/ast-g5/ast-g5-kcs.c
new file mode 100644
-index 0000000..f983b4a
+index 0000000..7bff26f
--- /dev/null
+++ b/board/aspeed/ast-g5/ast-g5-kcs.c
-@@ -0,0 +1,425 @@
+@@ -0,0 +1,420 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018-2019 Intel Corporation
+
+#include "ast-g5-kcs.h"
+
-+#define DEBUG_KCS_ENABLED 0
+#ifdef DEBUG_KCS_ENABLED
+#define DBG_KCS printf
+#else
@@ -139,7 +138,7 @@ index 0000000..f983b4a
+ }
+
+ /* very unlike code hits here. */
-+ printf("ERROR: %s error. ChannelNo: %d\n", __func__, channel_num);
++ DBG_KCS("ERROR: %s error. ChannelNo: %d\n", __func__, channel_num);
+ BUG();
+}
+
@@ -148,7 +147,7 @@ index 0000000..f983b4a
+ struct kcs_packet *kcs_pkt = NULL;
+
+ kcs_pkt = get_kcs_packet(channel_num);
-+ printf("ERROR: KCS communication aborted (Channel:%d, Error:%d)\n",
++ DBG_KCS("ERROR: KCS communication aborted (Channel:%d, Error:%d)\n",
+ channel_num, kcs_pkt->error);
+ set_kcs_state(channel_num, KCS_STATE_ERROR);
+ read_data(channel_num);
@@ -176,6 +175,7 @@ index 0000000..f983b4a
+static void process_kcs_request(u16 channel_num)
+{
+ struct kcs_packet *kcs_pkt = NULL;
++ int i;
+
+ kcs_pkt = get_kcs_packet(channel_num);
+ if (!kcs_pkt->read_req_done)
@@ -184,8 +184,6 @@ index 0000000..f983b4a
+ DBG_KCS("%s:- chan:%d\n", __func__, channel_num);
+
+#ifdef DEBUG_KCS_ENABLED
-+ int i;
-+
+ DBG_KCS("Request data(Len:%d): ", kcs_pkt->data_in_idx);
+ for (i = 0; i < kcs_pkt->data_in_idx; i++)
+ DBG_KCS(" 0x%02x", kcs_pkt->data_in[i]);
@@ -240,8 +238,6 @@ index 0000000..f983b4a
+ struct kcs_packet *kcs_pkt = NULL;
+
+ kcs_pkt = get_kcs_packet(channel_num);
-+ DBG_KCS("%s:- chan:%d, kcs_pkt->phase:%d\n", __func__, channel_num,
-+ kcs_pkt->phase);
+
+ switch (kcs_pkt->phase) {
+ case KCS_PHASE_WRITE_START:
@@ -326,7 +322,6 @@ index 0000000..f983b4a
+ write_data(channel_num, ZERO_DATA);
+
+ u16 cmd = read_data(channel_num);
-+ DBG_KCS("%s:- chan:%d, cmd:0x%02x\n", __func__, channel_num, cmd);
+ switch (cmd) {
+ case KCS_CTRL_CODE_WRITE_START:
+ init_kcs_packet(channel_num);
@@ -497,10 +492,10 @@ index 0000000..f983b4a
+}
diff --git a/board/aspeed/ast-g5/ast-g5-kcs.h b/board/aspeed/ast-g5/ast-g5-kcs.h
new file mode 100644
-index 0000000..52b5097
+index 0000000..bb697c4
--- /dev/null
+++ b/board/aspeed/ast-g5/ast-g5-kcs.h
-@@ -0,0 +1,114 @@
+@@ -0,0 +1,112 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2018-2019 Intel Corporation */
+
@@ -515,8 +510,8 @@ index 0000000..52b5097
+/* KCS channel addresses */
+#define KCS_CHANNEL1_ADDR 0xCA0
+#define KCS_CHANNEL2_ADDR 0xCA8
-+#define KCS_CHANNEL3_ADDR 0xCA2
-+#define KCS_CHANNEL4_ADDR 0xCB2
++#define KCS_CHANNEL3_ADDR 0xCA2 /* KCS SMS */
++#define KCS_CHANNEL4_ADDR 0xCA4 /* KCS SMM */
+
+#define ZERO_DATA 0x00
+
@@ -539,6 +534,11 @@ index 0000000..52b5097
+#define LPC_STR1 0x3C /* Status Register 1 */
+#define LPC_STR2 0x40 /* Status Register 2 */
+#define LPC_STR3 0x44 /* Status Register 3 */
++#define LPC_HICRB 0x100 /* Host Interface Control Register B */
++#define LPC_LADR4 0x110 /* LPC channel #4 Address Register */
++#define LPC_IDR4 0x114 /* Input Data Register 4 */
++#define LPC_ODR4 0x118 /* Output Data Register 4 */
++#define LPC_STR4 0x11C /* Status Data Register 4 */
+
+/* LPC Bits */
+#define BIT_LADR12AS BIT(7) /* Channel Address selection */
@@ -549,15 +549,8 @@ index 0000000..52b5097
+#define BIT_LPC2E BIT(6) /* Enable LPC channel #2 */
+#define BIT_LPC3E BIT(7) /* Enable LPC channel #2 */
+#define BIT_KCSENBL BIT(2) /* Enable KCS interface in Channel #3 */
-+
-+/* mapped to lpc-host@80 IO space */
-+#define LPC_HICRB 0x080
+#define BIT_IBFIE4 BIT(1)
+#define BIT_LPC4E BIT(0)
-+#define LPC_LADR4 0x090
-+#define LPC_IDR4 0x094 /* Input Data Register 4 */
-+#define LPC_ODR4 0x098 /* Output Data Register 4 */
-+#define LPC_STR4 0x09c /* Status Data Register 4 */
+
+#define BIT_STATUS_OBF BIT(0) /* Output Data Register full #1/#2/#3 */
+#define BIT_STATUS_IBF BIT(1) /* Input Data Register full #1/#2/#3 */