summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-kernel/linux
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2019-07-31 20:43:37 +0300
committerEd Tanous <ed.tanous@intel.com>2019-08-01 18:19:38 +0300
commitd0f63ef62c76c932a2003eaa42c0b250065ae06f (patch)
tree4c0e3cb32dc80f80460bdbf82ff6d401d4ff194f /meta-openbmc-mods/meta-common/recipes-kernel/linux
parentb4f66bacb1b8e661d794fa7a189e2f66f5092e2e (diff)
downloadopenbmc-d0f63ef62c76c932a2003eaa42c0b250065ae06f.tar.xz
Update to internal 7-31-19
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-kernel/linux')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-set-idle-disconnect-to-true-in-all-cases.patch34
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-arm-dts-aspeed-g5-add-espi.patch10
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-New-flash-map-for-intel.patch33
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Add-ASPEED-SGPIO-driver.patch8
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-SGPIO-DT-and-pinctrl-fixup.patch32
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch14
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0019-Add-I2C-IPMB-support.patch15
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0020-misc-aspeed-add-lpc-mbox-driver.patch475
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch81
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch46
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch297
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0028-Add-AST2500-JTAG-driver.patch6
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch73
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch16
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch36
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch10
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0035-Implement-a-memory-driver-share-memory.patch78
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch30
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch131
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0041-Enable-passthrough-based-gpio-character-device.patch287
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch12
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch14
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch32
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch16
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0046-misc-Add-clock-control-logic-into-Aspeed-LPC-MBOX-dr.patch166
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0047-misc-Block-error-printing-on-probe-defer-case-in-Asp.patch16
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0048-ARM-dts-aspeed-Set-default-status-of-LPC-BT-as-disab.patch40
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch10
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch30
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0055-Documentation-jtag-Add-ABI-documentation.patch17
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch8
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0058-i2c-aspeed-add-general-call-support.patch42
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0065-i2c-aspeed-fix-master-pending-state-handling.patch8
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0066-i2c-aspeed-add-buffer-mode-transfer-support.patch462
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0067-i2c-aspeed-add-DMA-mode-transfer-support.patch442
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch181
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend7
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-libc-headers/0001-Enable-passthrough-based-gpio-character-device.patch26
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-libc-headers_%.bbappend5
39 files changed, 2078 insertions, 1168 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-set-idle-disconnect-to-true-in-all-cases.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-set-idle-disconnect-to-true-in-all-cases.patch
new file mode 100644
index 000000000..925880eff
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-set-idle-disconnect-to-true-in-all-cases.patch
@@ -0,0 +1,34 @@
+From 7854a5e094ac49bebf9b2bfdd44db2f8cdd37543 Mon Sep 17 00:00:00 2001
+From: James Feist <james.feist@linux.intel.com>
+Date: Fri, 31 May 2019 15:05:13 -0700
+Subject: [PATCH] set idle-disconnect to true in all cases
+
+From sysfs this parameter can't be set. We want the
+muxes to clean themselves up if possible. Set this to
+true.
+
+Signed-off-by: James Feist <james.feist@linux.intel.com>
+---
+ drivers/i2c/muxes/i2c-mux-pca954x.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
+index 923aa3a5a3dc..084c10951890 100644
+--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
++++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
+@@ -474,8 +474,12 @@ static int pca954x_probe(struct i2c_client *client,
+ data->last_chan = 0; /* force the first selection */
+ data->idle_state = MUX_IDLE_AS_IS;
+
++#if 1 /* Forcibly set the self-disconnect flag */
++ idle_disconnect_dt = true;
++#else
+ idle_disconnect_dt = np &&
+ of_property_read_bool(np, "i2c-mux-idle-disconnect");
++#endif
+ if (idle_disconnect_dt)
+ data->idle_state = MUX_IDLE_DISCONNECT;
+
+--
+2.7.4
+
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-arm-dts-aspeed-g5-add-espi.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-arm-dts-aspeed-g5-add-espi.patch
index 08498cd01..165596f25 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-arm-dts-aspeed-g5-add-espi.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0005-arm-dts-aspeed-g5-add-espi.patch
@@ -1,4 +1,4 @@
-From 536b09695117440ed428ff27023cd9167fcf4dfe Mon Sep 17 00:00:00 2001
+From f72d4767835e530ce6bc4673ff30cc1099c88af5 Mon Sep 17 00:00:00 2001
From: Juston Li <juston.li@intel.com>
Date: Mon, 27 Mar 2017 11:16:00 -0700
Subject: [PATCH] arm: dts: aspeed-g5: add espi
@@ -9,10 +9,10 @@ Signed-off-by: Juston Li <juston.li@intel.com>
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index a79e01ffe9d4..0c74adf739d2 100644
+index dc58eb8c6969..db82f47339aa 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -261,7 +261,7 @@
+@@ -283,7 +283,7 @@
#gpio-cells = <2>;
gpio-controller;
compatible = "aspeed,ast2500-gpio";
@@ -21,7 +21,7 @@ index a79e01ffe9d4..0c74adf739d2 100644
interrupts = <20>;
gpio-ranges = <&pinctrl 0 0 220>;
clocks = <&syscon ASPEED_CLK_APB>;
-@@ -269,6 +269,15 @@
+@@ -291,6 +291,15 @@
#interrupt-cells = <2>;
};
@@ -37,7 +37,7 @@ index a79e01ffe9d4..0c74adf739d2 100644
rtc: rtc@1e781000 {
compatible = "aspeed,ast2500-rtc";
reg = <0x1e781000 0x18>;
-@@ -344,6 +353,13 @@
+@@ -366,6 +375,13 @@
status = "disabled";
};
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-New-flash-map-for-intel.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-New-flash-map-for-intel.patch
index 11663c503..695491d28 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-New-flash-map-for-intel.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0007-New-flash-map-for-intel.patch
@@ -1,4 +1,4 @@
-From 3eabb52efdecfc0da896476ac5567060a6b3788a Mon Sep 17 00:00:00 2001
+From f57d473a30f208754457bdb63512c307f7499ac8 Mon Sep 17 00:00:00 2001
From: Vernon Mauery <vernon.mauery@intel.com>
Date: Mon, 4 Jun 2018 13:45:42 -0700
Subject: [PATCH] New flash map for Intel
@@ -6,18 +6,18 @@ Subject: [PATCH] New flash map for Intel
Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com>
---
- .../boot/dts/openbmc-flash-layout-intel-128MB.dtsi | 52 ++++++++++++++++++++++
- .../boot/dts/openbmc-flash-layout-intel-64MB.dtsi | 39 ++++++++++++++++
- 2 files changed, 91 insertions(+)
+ .../boot/dts/openbmc-flash-layout-intel-128MB.dtsi | 50 ++++++++++++++++++++++
+ .../boot/dts/openbmc-flash-layout-intel-64MB.dtsi | 38 ++++++++++++++++
+ 2 files changed, 88 insertions(+)
create mode 100644 arch/arm/boot/dts/openbmc-flash-layout-intel-128MB.dtsi
create mode 100644 arch/arm/boot/dts/openbmc-flash-layout-intel-64MB.dtsi
diff --git a/arch/arm/boot/dts/openbmc-flash-layout-intel-128MB.dtsi b/arch/arm/boot/dts/openbmc-flash-layout-intel-128MB.dtsi
new file mode 100644
-index 000000000000..23426acc30c7
+index 000000000000..0d3794423aed
--- /dev/null
+++ b/arch/arm/boot/dts/openbmc-flash-layout-intel-128MB.dtsi
-@@ -0,0 +1,52 @@
+@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0+
+// 128MB flash layout: PFR (active + tmp1/tmp2 + extra)
+// image with common RW partition
@@ -48,34 +48,32 @@ index 000000000000..23426acc30c7
+ };
+
+ rwfs@2c0000 {
-+ reg = <0x2c0000 0xe40000>;
++ reg = <0x2c0000 0x840000>;
+ label = "rwfs";
+ };
+
-+ fit-image-a@1100000 {
-+ reg = <0x1100000 0x2500000>;
++ fit-image-a@b00000 {
++ reg = <0xb00000 0x1f00000>;
+ label = "image-a";
+ };
+
-+ rc-image@3600000 {
-+ reg = <0x3600000 0x2500000>;
++ rc-image@2a00000 {
++ reg = <0x2a00000 0x2000000>;
+ label = "rc-image";
+ };
+
-+ image-staging@5b00000 {
-+ reg = <0x5b00000 0x2500000>;
++ image-staging@4a00000 {
++ reg = <0x4a00000 0x3600000>;
+ label = "image-stg";
+ };
+
+};
-+
-+
diff --git a/arch/arm/boot/dts/openbmc-flash-layout-intel-64MB.dtsi b/arch/arm/boot/dts/openbmc-flash-layout-intel-64MB.dtsi
new file mode 100644
-index 000000000000..6ae8e57087e2
+index 000000000000..092708f5021f
--- /dev/null
+++ b/arch/arm/boot/dts/openbmc-flash-layout-intel-64MB.dtsi
-@@ -0,0 +1,39 @@
+@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+// 64MB flash layout: redundant image with common RW partition
+
@@ -114,7 +112,6 @@ index 000000000000..6ae8e57087e2
+ label = "image-b";
+ };
+};
-+
--
2.7.4
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Add-ASPEED-SGPIO-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Add-ASPEED-SGPIO-driver.patch
index beb5087f5..08be45ff7 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Add-ASPEED-SGPIO-driver.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0008-Add-ASPEED-SGPIO-driver.patch
@@ -1,4 +1,4 @@
-From 58adbd18074fbf8005d5d7a5ec116c326252f606 Mon Sep 17 00:00:00 2001
+From 323066b26f02f043e694463a8e0cd4ada465984b Mon Sep 17 00:00:00 2001
From: "Feist, James" <james.feist@intel.com>
Date: Mon, 5 Jun 2017 11:13:52 -0700
Subject: [PATCH] Add ASPEED SGPIO driver.
@@ -16,7 +16,7 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
create mode 100644 drivers/gpio/sgpio-aspeed.c
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
-index b5a2845347ec..e3ce2b68a1fc 100644
+index acd40eb51c46..20808e48229a 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -124,6 +124,14 @@ config GPIO_ASPEED
@@ -35,10 +35,10 @@ index b5a2845347ec..e3ce2b68a1fc 100644
tristate "Atheros AR71XX/AR724X/AR913X GPIO support"
default y if ATH79
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
-index 37628f8dbf70..069155f1db9e 100644
+index 6700eee860b7..77c6ec0ee98f 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
-@@ -32,6 +32,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o
+@@ -33,6 +33,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o
obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o
obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o
obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-SGPIO-DT-and-pinctrl-fixup.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-SGPIO-DT-and-pinctrl-fixup.patch
index 1c5d9ab53..8083ead0b 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-SGPIO-DT-and-pinctrl-fixup.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0009-SGPIO-DT-and-pinctrl-fixup.patch
@@ -1,4 +1,4 @@
-From 2f895fe17cd72124b2a04af306f9349e5da90a6c Mon Sep 17 00:00:00 2001
+From 1059e64f4fc5af65f2afdc209761342fe44e3498 Mon Sep 17 00:00:00 2001
From: Vernon Mauery <vernon.mauery@intel.com>
Date: Wed, 16 May 2018 10:03:14 -0700
Subject: [PATCH] SGPIO DT and pinctrl fixup
@@ -15,10 +15,10 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
4 files changed, 54 insertions(+), 60 deletions(-)
diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index 3990aed25ee6..19f721118b52 100644
+index fd857be397bf..00848693f455 100644
--- a/arch/arm/boot/dts/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
-@@ -203,6 +203,18 @@
+@@ -207,6 +207,18 @@
#interrupt-cells = <2>;
};
@@ -37,7 +37,7 @@ index 3990aed25ee6..19f721118b52 100644
timer: timer@1e782000 {
/* This timer is a Faraday FTTMR010 derivative */
compatible = "aspeed,ast2400-timer";
-@@ -1183,44 +1195,14 @@
+@@ -1180,44 +1192,14 @@
groups = "SD2";
};
@@ -89,10 +89,10 @@ index 3990aed25ee6..19f721118b52 100644
pinctrl_sioonctrl_default: sioonctrl_default {
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index 0c74adf739d2..d4c99b82f7bd 100644
+index db82f47339aa..8406da6f62a5 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -276,6 +276,9 @@
+@@ -298,6 +298,9 @@
reg = <0x1e780200 0x0100>;
interrupts = <40>;
interrupt-controller;
@@ -102,7 +102,7 @@ index 0c74adf739d2..d4c99b82f7bd 100644
};
rtc: rtc@1e781000 {
-@@ -1388,6 +1391,11 @@
+@@ -1403,6 +1406,11 @@
groups = "SDA2";
};
@@ -115,10 +115,10 @@ index 0c74adf739d2..d4c99b82f7bd 100644
function = "SGPS1";
groups = "SGPS1";
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c
-index 05b153034517..353af05b8602 100644
+index 384396cbb22d..a78ed8c33e96 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c
-@@ -401,16 +401,22 @@ SSSF_PIN_DECL(E16, GPIOF6, TXD4, SIG_DESC_SET(SCU80, 30));
+@@ -423,16 +423,22 @@ SSSF_PIN_DECL(E16, GPIOF6, TXD4, SIG_DESC_SET(SCU80, 30));
SSSF_PIN_DECL(C17, GPIOF7, RXD4, SIG_DESC_SET(SCU80, 31));
#define A14 48
@@ -145,7 +145,7 @@ index 05b153034517..353af05b8602 100644
#define B13 52
SIG_EXPR_LIST_DECL_SINGLE(OSCCLK, OSCCLK, SIG_DESC_SET(SCU2C, 1));
-@@ -576,16 +582,22 @@ FUNC_GROUP_DECL(SPI1PASSTHRU, C22, G18, D19, C20, B22, G19, C18, E20);
+@@ -598,16 +604,22 @@ FUNC_GROUP_DECL(SPI1PASSTHRU, C22, G18, D19, C20, B22, G19, C18, E20);
FUNC_GROUP_DECL(VGABIOS_ROM, B22, G19, C18, E20);
#define J5 72
@@ -172,7 +172,7 @@ index 05b153034517..353af05b8602 100644
#define T4 76
SSSF_PIN_DECL(T4, GPIOJ4, VGAHS, SIG_DESC_SET(SCU84, 12));
-@@ -2083,14 +2095,8 @@ static const struct aspeed_pin_group aspeed_g4_groups[] = {
+@@ -2105,14 +2117,8 @@ static const struct aspeed_pin_group aspeed_g4_groups[] = {
ASPEED_PINCTRL_GROUP(SALT4),
ASPEED_PINCTRL_GROUP(SD1),
ASPEED_PINCTRL_GROUP(SD2),
@@ -189,7 +189,7 @@ index 05b153034517..353af05b8602 100644
ASPEED_PINCTRL_GROUP(SIOONCTRL),
ASPEED_PINCTRL_GROUP(SIOPBI),
ASPEED_PINCTRL_GROUP(SIOPBO),
-@@ -2238,14 +2244,8 @@ static const struct aspeed_pin_function aspeed_g4_functions[] = {
+@@ -2260,14 +2266,8 @@ static const struct aspeed_pin_function aspeed_g4_functions[] = {
ASPEED_PINCTRL_FUNC(SALT4),
ASPEED_PINCTRL_FUNC(SD1),
ASPEED_PINCTRL_FUNC(SD2),
@@ -207,10 +207,10 @@ index 05b153034517..353af05b8602 100644
ASPEED_PINCTRL_FUNC(SIOPBI),
ASPEED_PINCTRL_FUNC(SIOPBO),
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
-index 4230e1038a88..13f749e35001 100644
+index 6f151e7c8d81..c088f010c554 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
-@@ -577,6 +577,8 @@ SS_PIN_DECL(N3, GPIOJ2, SGPMO);
+@@ -599,6 +599,8 @@ SS_PIN_DECL(N3, GPIOJ2, SGPMO);
SIG_EXPR_LIST_DECL_SINGLE(SGPMI, SGPM, SIG_DESC_SET(SCU84, 11));
SS_PIN_DECL(N4, GPIOJ3, SGPMI);
@@ -219,7 +219,7 @@ index 4230e1038a88..13f749e35001 100644
#define N5 76
SIG_EXPR_LIST_DECL_SINGLE(VGAHS, VGAHS, SIG_DESC_SET(SCU84, 12));
SIG_EXPR_LIST_DECL_SINGLE(DASHN5, DASHN5, SIG_DESC_SET(SCU94, 8));
-@@ -2127,6 +2129,7 @@ static const struct aspeed_pin_group aspeed_g5_groups[] = {
+@@ -2149,6 +2151,7 @@ static const struct aspeed_pin_group aspeed_g5_groups[] = {
ASPEED_PINCTRL_GROUP(SD2),
ASPEED_PINCTRL_GROUP(SDA1),
ASPEED_PINCTRL_GROUP(SDA2),
@@ -227,7 +227,7 @@ index 4230e1038a88..13f749e35001 100644
ASPEED_PINCTRL_GROUP(SGPS1),
ASPEED_PINCTRL_GROUP(SGPS2),
ASPEED_PINCTRL_GROUP(SIOONCTRL),
-@@ -2296,6 +2299,7 @@ static const struct aspeed_pin_function aspeed_g5_functions[] = {
+@@ -2318,6 +2321,7 @@ static const struct aspeed_pin_function aspeed_g5_functions[] = {
ASPEED_PINCTRL_FUNC(SD2),
ASPEED_PINCTRL_FUNC(SDA1),
ASPEED_PINCTRL_FUNC(SDA2),
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch
index d2ecdfd72..86dd2e68c 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch
@@ -1,4 +1,4 @@
-From 9c27803dd432c7a9fc57dd3e16f0fd724919575e Mon Sep 17 00:00:00 2001
+From 2dec2c142e48a35e6c7de00c6a35e963de7447e0 Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Mon, 7 Jan 2019 09:56:10 -0800
Subject: [PATCH] Update PECI drivers to sync with linux upstreaming version
@@ -93,10 +93,10 @@ index 821a9258f2e6..a3a3e465c888 100644
+temp[6-*]_crit_hyst Provides the hysteresis value from Tcontrol to Tjmax of
the core.
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
-index 18cd3b17f660..0bd06a938526 100644
+index c0623fa5ba41..7399c3cef30c 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
-@@ -1321,7 +1321,7 @@ config SENSORS_PECI_CPUTEMP
+@@ -1333,7 +1333,7 @@ config SENSORS_PECI_CPUTEMP
the PECI Client Command Suite via the processor PECI client.
Check Documentation/hwmon/peci-cputemp for details.
@@ -105,7 +105,7 @@ index 18cd3b17f660..0bd06a938526 100644
will be called peci-cputemp.
config SENSORS_PECI_DIMMTEMP
-@@ -1335,7 +1335,7 @@ config SENSORS_PECI_DIMMTEMP
+@@ -1347,7 +1347,7 @@ config SENSORS_PECI_DIMMTEMP
Suite via the processor PECI client.
Check Documentation/hwmon/peci-dimmtemp for details.
@@ -673,10 +673,10 @@ index 6ca1855a86bb..ce6b470eae63 100644
/**
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
-index 9af5730ad7ba..28087e9cd4da 100644
+index 75dbcc7da87c..6f7ee4dd08f6 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
-@@ -606,7 +606,7 @@ config MFD_INTEL_MSIC
+@@ -616,7 +616,7 @@ config MFD_INTEL_MSIC
devices used in Intel Medfield platforms.
config MFD_INTEL_PECI_CLIENT
@@ -685,7 +685,7 @@ index 9af5730ad7ba..28087e9cd4da 100644
depends on (PECI || COMPILE_TEST)
select MFD_CORE
help
-@@ -619,6 +619,9 @@ config MFD_INTEL_PECI_CLIENT
+@@ -629,6 +629,9 @@ config MFD_INTEL_PECI_CLIENT
Additional drivers must be enabled in order to use the functionality
of the device.
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0019-Add-I2C-IPMB-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0019-Add-I2C-IPMB-support.patch
index 391d6f816..675125322 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0019-Add-I2C-IPMB-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0019-Add-I2C-IPMB-support.patch
@@ -1,4 +1,4 @@
-From 59e2471d9bf64fa7d539520ef66cf5f33c0b0e55 Mon Sep 17 00:00:00 2001
+From f588865f8180a6370ac639bdfc186ffc5b926246 Mon Sep 17 00:00:00 2001
From: Haiyue Wang <haiyue.wang@linux.intel.com>
Date: Tue, 13 Feb 2018 14:28:12 +0800
Subject: [PATCH] i2c: slave-mqueue: add mqueue driver to receive ipmi message
@@ -14,20 +14,20 @@ will exposes these messages to userspace by sysfs bin file.
Signed-off-by: Haiyue Wang <haiyue.wang@linux.intel.com>
---
- Documentation/i2c/slave-mqueue-backend.rst | 125 +++++++++++++++++
+ Documentation/i2c/slave-mqueue-backend.rst | 124 +++++++++++++++++
drivers/i2c/Kconfig | 23 +++
drivers/i2c/Makefile | 1 +
drivers/i2c/i2c-slave-mqueue.c | 217 +++++++++++++++++++++++++++++
- 4 files changed, 366 insertions(+)
+ 4 files changed, 365 insertions(+)
create mode 100644 Documentation/i2c/slave-mqueue-backend.rst
create mode 100644 drivers/i2c/i2c-slave-mqueue.c
diff --git a/Documentation/i2c/slave-mqueue-backend.rst b/Documentation/i2c/slave-mqueue-backend.rst
new file mode 100644
-index 000000000000..3966cf0ab8da
+index 000000000000..2d0d06d8df9d
--- /dev/null
+++ b/Documentation/i2c/slave-mqueue-backend.rst
-@@ -0,0 +1,125 @@
+@@ -0,0 +1,124 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=====================================
@@ -152,12 +152,11 @@ index 000000000000..3966cf0ab8da
+ [10203.974044856] : 20 18 c8 2c 80 01 53
+ [10204.220734634] : 20 18 c8 2c 80 01 53
+ [10204.468461664] : 20 18 c8 2c 80 01 53
-+
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
-index efc3354d60ae..04fb851f2c82 100644
+index abedd55a1264..49a2379876c6 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
-@@ -118,6 +118,29 @@ if I2C_SLAVE
+@@ -119,6 +119,29 @@ if I2C_SLAVE
config I2C_SLAVE_EEPROM
tristate "I2C eeprom slave driver"
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0020-misc-aspeed-add-lpc-mbox-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0020-misc-aspeed-add-lpc-mbox-driver.patch
new file mode 100644
index 000000000..884a7018c
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0020-misc-aspeed-add-lpc-mbox-driver.patch
@@ -0,0 +1,475 @@
+From efa7ad95db45494b2c3685c0688f00174e517e34 Mon Sep 17 00:00:00 2001
+From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+Date: Wed, 10 Jul 2019 16:19:33 -0700
+Subject: [PATCH] misc: aspeed: add lpc mbox driver
+
+This commit adds back the lpc mbox driver which was removed from
+the openbmc linux dev-5.2 tree.
+
+This driver should be rewritten later.
+
+Signed-off-by: Cyril Bur <cyrilbur@gmail.com>"
+Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+---
+ arch/arm/boot/dts/aspeed-g4.dtsi | 9 +
+ arch/arm/boot/dts/aspeed-g5.dtsi | 9 +
+ drivers/soc/aspeed/Kconfig | 7 +
+ drivers/soc/aspeed/Makefile | 1 +
+ drivers/soc/aspeed/aspeed-lpc-mbox.c | 376 +++++++++++++++++++++++++++++++++++
+ 5 files changed, 402 insertions(+)
+ create mode 100644 drivers/soc/aspeed/aspeed-lpc-mbox.c
+
+diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
+index 00848693f455..4b8b0be22cd4 100644
+--- a/arch/arm/boot/dts/aspeed-g4.dtsi
++++ b/arch/arm/boot/dts/aspeed-g4.dtsi
+@@ -344,6 +344,15 @@
+ sio_regs: regs {
+ compatible = "aspeed,bmc-misc";
+ };
++
++ mbox: mbox@180 {
++ compatible = "aspeed,ast2400-mbox";
++ reg = <0x180 0x5c>;
++ interrupts = <46>;
++ #mbox-cells = <1>;
++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
++ status = "disabled";
++ };
+ };
+ };
+
+diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
+index 8406da6f62a5..9f3bd5bafab5 100644
+--- a/arch/arm/boot/dts/aspeed-g5.dtsi
++++ b/arch/arm/boot/dts/aspeed-g5.dtsi
+@@ -473,6 +473,15 @@
+ sio_regs: regs {
+ compatible = "aspeed,bmc-misc";
+ };
++
++ mbox: mbox@180 {
++ compatible = "aspeed,ast2500-mbox";
++ reg = <0x180 0x5c>;
++ interrupts = <46>;
++ #mbox-cells = <1>;
++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
++ status = "disabled";
++ };
+ };
+ };
+
+diff --git a/drivers/soc/aspeed/Kconfig b/drivers/soc/aspeed/Kconfig
+index 78dd74c49ddb..a4be8e566bc7 100644
+--- a/drivers/soc/aspeed/Kconfig
++++ b/drivers/soc/aspeed/Kconfig
+@@ -21,6 +21,13 @@ config ASPEED_LPC_CTRL
+ ioctl()s, the driver also provides a read/write interface to a BMC ram
+ region where the host LPC read/write region can be buffered.
+
++config ASPEED_LPC_MBOX
++ tristate "Aspeed LPC Mailbox Controller"
++ depends on SOC_ASPEED && REGMAP && MFD_SYSCON
++ ---help---
++ Expose the ASPEED LPC MBOX registers found on Aspeed SOCs (AST2400
++ and AST2500) to userspace.
++
+ config ASPEED_LPC_SNOOP
+ tristate "Aspeed ast2500 HOST LPC snoop support"
+ depends on SOC_ASPEED && REGMAP && MFD_SYSCON
+diff --git a/drivers/soc/aspeed/Makefile b/drivers/soc/aspeed/Makefile
+index e631b23d519b..f3ff29b874ed 100644
+--- a/drivers/soc/aspeed/Makefile
++++ b/drivers/soc/aspeed/Makefile
+@@ -1,5 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0-only
+ obj-$(CONFIG_ASPEED_BMC_MISC) += aspeed-bmc-misc.o
+ obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o
++obj-$(CONFIG_ASPEED_LPC_MBOX) += aspeed-lpc-mbox.o
+ obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
+ obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o
+diff --git a/drivers/soc/aspeed/aspeed-lpc-mbox.c b/drivers/soc/aspeed/aspeed-lpc-mbox.c
+new file mode 100644
+index 000000000000..795107206022
+--- /dev/null
++++ b/drivers/soc/aspeed/aspeed-lpc-mbox.c
+@@ -0,0 +1,376 @@
++// SPDX-License-Identifier: GPL-2.0-or-later
++// Copyright 2017 IBM Corporation
++// TODO: Rewrite this driver
++
++#include <linux/clk.h>
++#include <linux/interrupt.h>
++#include <linux/mfd/syscon.h>
++#include <linux/miscdevice.h>
++#include <linux/module.h>
++#include <linux/of_irq.h>
++#include <linux/platform_device.h>
++#include <linux/poll.h>
++#include <linux/regmap.h>
++#include <linux/slab.h>
++
++#define DEVICE_NAME "aspeed-mbox"
++
++#define MBX_USE_INTERRUPT 0
++
++#define ASPEED_MBOX_NUM_REGS 16
++
++#define ASPEED_MBOX_DATA_0 0x00
++#define ASPEED_MBOX_STATUS_0 0x40
++#define ASPEED_MBOX_STATUS_1 0x44
++#define ASPEED_MBOX_BMC_CTRL 0x48
++#define ASPEED_MBOX_CTRL_RECV BIT(7)
++#define ASPEED_MBOX_CTRL_MASK BIT(1)
++#define ASPEED_MBOX_CTRL_SEND BIT(0)
++#define ASPEED_MBOX_HOST_CTRL 0x4c
++#define ASPEED_MBOX_INTERRUPT_0 0x50
++#define ASPEED_MBOX_INTERRUPT_1 0x54
++
++struct aspeed_mbox {
++ struct miscdevice miscdev;
++ struct regmap *regmap;
++ struct clk *clk;
++ unsigned int base;
++ int irq;
++ wait_queue_head_t queue;
++ struct mutex mutex;
++};
++
++static atomic_t aspeed_mbox_open_count = ATOMIC_INIT(0);
++
++static u8 aspeed_mbox_inb(struct aspeed_mbox *mbox, int reg)
++{
++ /*
++ * The mbox registers are actually only one byte but are addressed
++ * four bytes apart. The other three bytes are marked 'reserved',
++ * they *should* be zero but lets not rely on it.
++ * I am going to rely on the fact we can casually read/write to them...
++ */
++ unsigned int val = 0xff; /* If regmap throws an error return 0xff */
++ int rc = regmap_read(mbox->regmap, mbox->base + reg, &val);
++
++ if (rc)
++ dev_err(mbox->miscdev.parent, "regmap_read() failed with "
++ "%d (reg: 0x%08x)\n", rc, reg);
++
++ return val & 0xff;
++}
++
++static void aspeed_mbox_outb(struct aspeed_mbox *mbox, u8 data, int reg)
++{
++ int rc = regmap_write(mbox->regmap, mbox->base + reg, data);
++
++ if (rc)
++ dev_err(mbox->miscdev.parent, "regmap_write() failed with "
++ "%d (data: %u reg: 0x%08x)\n", rc, data, reg);
++}
++
++static struct aspeed_mbox *file_mbox(struct file *file)
++{
++ return container_of(file->private_data, struct aspeed_mbox, miscdev);
++}
++
++static int aspeed_mbox_open(struct inode *inode, struct file *file)
++{
++#if MBX_USE_INTERRUPT
++ struct aspeed_mbox *mbox = file_mbox(file);
++#endif
++
++ if (atomic_inc_return(&aspeed_mbox_open_count) == 1) {
++#if MBX_USE_INTERRUPT
++ /*
++ * Clear the interrupt status bit if it was left on and unmask
++ * interrupts.
++ * ASPEED_MBOX_CTRL_RECV bit is W1C, this also unmasks in 1 step
++ */
++ aspeed_mbox_outb(mbox, ASPEED_MBOX_CTRL_RECV, ASPEED_MBOX_BMC_CTRL);
++#endif
++ return 0;
++ }
++
++ atomic_dec(&aspeed_mbox_open_count);
++ return -EBUSY;
++}
++
++static ssize_t aspeed_mbox_read(struct file *file, char __user *buf,
++ size_t count, loff_t *ppos)
++{
++ struct aspeed_mbox *mbox = file_mbox(file);
++ char __user *p = buf;
++ ssize_t ret;
++ int i;
++
++ if (!access_ok(buf, count))
++ return -EFAULT;
++
++ if (count + *ppos > ASPEED_MBOX_NUM_REGS)
++ return -EINVAL;
++
++#if MBX_USE_INTERRUPT
++ if (file->f_flags & O_NONBLOCK) {
++ if (!(aspeed_mbox_inb(mbox, ASPEED_MBOX_BMC_CTRL) &
++ ASPEED_MBOX_CTRL_RECV))
++ return -EAGAIN;
++ } else if (wait_event_interruptible(mbox->queue,
++ aspeed_mbox_inb(mbox, ASPEED_MBOX_BMC_CTRL) &
++ ASPEED_MBOX_CTRL_RECV)) {
++ return -ERESTARTSYS;
++ }
++#endif
++
++ mutex_lock(&mbox->mutex);
++
++ for (i = *ppos; count > 0 && i < ASPEED_MBOX_NUM_REGS; i++) {
++ uint8_t reg = aspeed_mbox_inb(mbox, ASPEED_MBOX_DATA_0 + (i * 4));
++
++ ret = __put_user(reg, p);
++ if (ret)
++ goto out_unlock;
++
++ p++;
++ count--;
++ }
++
++#if MBX_USE_INTERRUPT
++ /* ASPEED_MBOX_CTRL_RECV bit is write to clear, this also unmasks in 1 step */
++ aspeed_mbox_outb(mbox, ASPEED_MBOX_CTRL_RECV, ASPEED_MBOX_BMC_CTRL);
++#endif
++ ret = p - buf;
++
++out_unlock:
++ mutex_unlock(&mbox->mutex);
++ return ret;
++}
++
++static ssize_t aspeed_mbox_write(struct file *file, const char __user *buf,
++ size_t count, loff_t *ppos)
++{
++ struct aspeed_mbox *mbox = file_mbox(file);
++ const char __user *p = buf;
++ ssize_t ret;
++ char c;
++ int i;
++
++ if (!access_ok(buf, count))
++ return -EFAULT;
++
++ if (count + *ppos > ASPEED_MBOX_NUM_REGS)
++ return -EINVAL;
++
++ mutex_lock(&mbox->mutex);
++
++ for (i = *ppos; count > 0 && i < ASPEED_MBOX_NUM_REGS; i++) {
++ ret = __get_user(c, p);
++ if (ret)
++ goto out_unlock;
++
++ aspeed_mbox_outb(mbox, c, ASPEED_MBOX_DATA_0 + (i * 4));
++ p++;
++ count--;
++ }
++
++ aspeed_mbox_outb(mbox, 0xff, ASPEED_MBOX_STATUS_0);
++ aspeed_mbox_outb(mbox, 0xff, ASPEED_MBOX_STATUS_1);
++ aspeed_mbox_outb(mbox, ASPEED_MBOX_CTRL_RECV | ASPEED_MBOX_CTRL_MASK | ASPEED_MBOX_CTRL_SEND, ASPEED_MBOX_BMC_CTRL);
++ ret = p - buf;
++
++out_unlock:
++ mutex_unlock(&mbox->mutex);
++ return ret;
++}
++
++static unsigned int aspeed_mbox_poll(struct file *file, poll_table *wait)
++{
++ struct aspeed_mbox *mbox = file_mbox(file);
++ unsigned int mask = 0;
++
++ poll_wait(file, &mbox->queue, wait);
++
++#if MBX_USE_INTERRUPT
++ if (aspeed_mbox_inb(mbox, ASPEED_MBOX_BMC_CTRL) & ASPEED_MBOX_CTRL_RECV)
++#endif
++ mask |= POLLIN;
++
++ return mask;
++}
++
++static int aspeed_mbox_release(struct inode *inode, struct file *file)
++{
++ atomic_dec(&aspeed_mbox_open_count);
++ return 0;
++}
++
++static const struct file_operations aspeed_mbox_fops = {
++ .owner = THIS_MODULE,
++ .llseek = no_seek_end_llseek,
++ .read = aspeed_mbox_read,
++ .write = aspeed_mbox_write,
++ .open = aspeed_mbox_open,
++ .release = aspeed_mbox_release,
++ .poll = aspeed_mbox_poll,
++};
++
++static irqreturn_t aspeed_mbox_irq(int irq, void *arg)
++{
++ struct aspeed_mbox *mbox = arg;
++#if MBX_USE_INTERRUPT
++ int i;
++
++// if (!(aspeed_mbox_inb(mbox, ASPEED_MBOX_BMC_CTRL) & ASPEED_MBOX_CTRL_RECV))
++// return IRQ_NONE;
++
++ printk(KERN_ERR "BMC_CTRL: 0x%02x\n",
++ aspeed_mbox_inb(mbox, ASPEED_MBOX_BMC_CTRL));
++ printk(KERN_ERR "STATUS_0: 0x%02x\n",
++ aspeed_mbox_inb(mbox, ASPEED_MBOX_STATUS_0));
++ printk(KERN_ERR "STATUS_1: 0x%02x\n",
++ aspeed_mbox_inb(mbox, ASPEED_MBOX_STATUS_1));
++ for (i = 0; i < ASPEED_MBOX_NUM_REGS; i++) {
++ printk(KERN_ERR "DATA_%d: 0x%02x\n", i,
++ aspeed_mbox_inb(mbox, ASPEED_MBOX_DATA_0 + (i * 4)));
++ }
++#endif
++
++ /* Clear interrupt status */
++ aspeed_mbox_outb(mbox, 0xff, ASPEED_MBOX_STATUS_0);
++ aspeed_mbox_outb(mbox, 0xff, ASPEED_MBOX_STATUS_1);
++ aspeed_mbox_outb(mbox, ASPEED_MBOX_CTRL_RECV, ASPEED_MBOX_BMC_CTRL);
++
++ wake_up(&mbox->queue);
++ return IRQ_HANDLED;
++}
++
++static int aspeed_mbox_config_irq(struct aspeed_mbox *mbox,
++ struct platform_device *pdev)
++{
++ struct device *dev = &pdev->dev;
++ int rc;
++
++ mbox->irq = platform_get_irq(pdev, 0);
++ if (!mbox->irq)
++ return -ENODEV;
++
++ rc = devm_request_irq(dev, mbox->irq, aspeed_mbox_irq,
++ IRQF_SHARED, DEVICE_NAME, mbox);
++ if (rc < 0) {
++ dev_err(dev, "Unable to request IRQ %d\n", mbox->irq);
++ return rc;
++ }
++
++ /* Disable all register based interrupts. */
++ aspeed_mbox_outb(mbox, 0xff, ASPEED_MBOX_INTERRUPT_0); /* regs 0 - 7 */
++ aspeed_mbox_outb(mbox, 0xff, ASPEED_MBOX_INTERRUPT_1); /* regs 8 - 15 */
++
++ /* These registers are write one to clear. Clear them. */
++ aspeed_mbox_outb(mbox, 0xff, ASPEED_MBOX_STATUS_0);
++ aspeed_mbox_outb(mbox, 0xff, ASPEED_MBOX_STATUS_1);
++
++ aspeed_mbox_outb(mbox, ASPEED_MBOX_CTRL_RECV, ASPEED_MBOX_BMC_CTRL);
++ return 0;
++}
++
++static int aspeed_mbox_probe(struct platform_device *pdev)
++{
++ struct aspeed_mbox *mbox;
++ struct device *dev;
++ int rc;
++
++ dev = &pdev->dev;
++
++ mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL);
++ if (!mbox)
++ return -ENOMEM;
++
++ dev_set_drvdata(&pdev->dev, mbox);
++
++ rc = of_property_read_u32(dev->of_node, "reg", &mbox->base);
++ if (rc) {
++ dev_err(dev, "Couldn't read reg device-tree property\n");
++ return rc;
++ }
++
++ mbox->regmap = syscon_node_to_regmap(
++ pdev->dev.parent->of_node);
++ if (IS_ERR(mbox->regmap)) {
++ dev_err(dev, "Couldn't get regmap\n");
++ return -ENODEV;
++ }
++
++ mutex_init(&mbox->mutex);
++ init_waitqueue_head(&mbox->queue);
++
++ mbox->clk = devm_clk_get(dev, NULL);
++ if (IS_ERR(mbox->clk)) {
++ rc = PTR_ERR(mbox->clk);
++ if (rc != -EPROBE_DEFER)
++ dev_err(dev, "couldn't get clock\n");
++ return rc;
++ }
++ rc = clk_prepare_enable(mbox->clk);
++ if (rc) {
++ dev_err(dev, "couldn't enable clock\n");
++ return rc;
++ }
++
++ mbox->miscdev.minor = MISC_DYNAMIC_MINOR;
++ mbox->miscdev.name = DEVICE_NAME;
++ mbox->miscdev.fops = &aspeed_mbox_fops;
++ mbox->miscdev.parent = dev;
++ rc = misc_register(&mbox->miscdev);
++ if (rc) {
++ dev_err(dev, "Unable to register device\n");
++ goto err;
++ }
++
++ rc = aspeed_mbox_config_irq(mbox, pdev);
++ if (rc) {
++ dev_err(dev, "Failed to configure IRQ\n");
++ misc_deregister(&mbox->miscdev);
++ goto err;
++ }
++
++ dev_info(&pdev->dev, "LPC mbox registered, irq %d\n", mbox->irq);
++
++ return 0;
++
++err:
++ clk_disable_unprepare(mbox->clk);
++
++ return rc;
++}
++
++static int aspeed_mbox_remove(struct platform_device *pdev)
++{
++ struct aspeed_mbox *mbox = dev_get_drvdata(&pdev->dev);
++
++ misc_deregister(&mbox->miscdev);
++ clk_disable_unprepare(mbox->clk);
++
++ return 0;
++}
++
++static const struct of_device_id aspeed_mbox_match[] = {
++ { .compatible = "aspeed,ast2400-mbox" },
++ { .compatible = "aspeed,ast2500-mbox" },
++ { },
++};
++MODULE_DEVICE_TABLE(of, aspeed_mbox_match);
++
++static struct platform_driver aspeed_mbox_driver = {
++ .driver = {
++ .name = DEVICE_NAME,
++ .of_match_table = aspeed_mbox_match,
++ },
++ .probe = aspeed_mbox_probe,
++ .remove = aspeed_mbox_remove,
++};
++
++module_platform_driver(aspeed_mbox_driver);
++
++MODULE_LICENSE("GPL");
++MODULE_AUTHOR("Cyril Bur <cyrilbur@gmail.com>");
++MODULE_DESCRIPTION("Aspeed mailbox device driver");
+--
+2.7.4
+
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch
index d1745ce5f..b347894be 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch
@@ -1,4 +1,4 @@
-From 7d5cd323d3b05a00f8b8a6eb38a5a1ec7925660a Mon Sep 17 00:00:00 2001
+From 3d1ddeb903f6eaeb06ddc1d6cfbed6374ef31f36 Mon Sep 17 00:00:00 2001
From: Yong Li <yong.b.li@intel.com>
Date: Mon, 13 Nov 2017 16:29:44 +0800
Subject: [PATCH] Aspeed LPC SIO driver
@@ -8,24 +8,24 @@ Add lpc sio device driver for AST2500/2400
Signed-off-by: Yong Li <yong.b.li@intel.com>
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
- .../devicetree/bindings/misc/aspeed-sio.txt | 18 +
+ .../bindings/soc/aspeed/aspeed-lpc-sio.txt | 17 +
arch/arm/boot/dts/aspeed-g4.dtsi | 7 +
arch/arm/boot/dts/aspeed-g5.dtsi | 7 +
- drivers/misc/Kconfig | 9 +
- drivers/misc/Makefile | 1 +
- drivers/misc/aspeed-lpc-sio.c | 450 +++++++++++++++++++++
+ drivers/soc/aspeed/Kconfig | 7 +
+ drivers/soc/aspeed/Makefile | 1 +
+ drivers/soc/aspeed/aspeed-lpc-sio.c | 450 +++++++++++++++++++++
include/uapi/linux/aspeed-lpc-sio.h | 44 ++
- 7 files changed, 536 insertions(+)
- create mode 100644 Documentation/devicetree/bindings/misc/aspeed-sio.txt
- create mode 100644 drivers/misc/aspeed-lpc-sio.c
+ 7 files changed, 533 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/soc/aspeed/aspeed-lpc-sio.txt
+ create mode 100644 drivers/soc/aspeed/aspeed-lpc-sio.c
create mode 100644 include/uapi/linux/aspeed-lpc-sio.h
-diff --git a/Documentation/devicetree/bindings/misc/aspeed-sio.txt b/Documentation/devicetree/bindings/misc/aspeed-sio.txt
+diff --git a/Documentation/devicetree/bindings/soc/aspeed/aspeed-lpc-sio.txt b/Documentation/devicetree/bindings/soc/aspeed/aspeed-lpc-sio.txt
new file mode 100644
-index 000000000000..3530c2b02f5c
+index 000000000000..c74ea3a4e5ac
--- /dev/null
-+++ b/Documentation/devicetree/bindings/misc/aspeed-sio.txt
-@@ -0,0 +1,18 @@
++++ b/Documentation/devicetree/bindings/soc/aspeed/aspeed-lpc-sio.txt
+@@ -0,0 +1,17 @@
+* Aspeed LPC SIO driver.
+
+Required properties:
@@ -43,12 +43,11 @@ index 000000000000..3530c2b02f5c
+ clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
+ status = "disabled";
+};
-+
diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index e8bcfc90bf7c..a87fd5ee1c84 100644
+index 07758c9b900b..3df43f925848 100644
--- a/arch/arm/boot/dts/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
-@@ -340,6 +340,13 @@
+@@ -345,6 +345,13 @@
compatible = "aspeed,bmc-misc";
};
@@ -63,10 +62,10 @@ index e8bcfc90bf7c..a87fd5ee1c84 100644
compatible = "aspeed,ast2400-mbox";
reg = <0x180 0x5c>;
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index e5c0ba0f87c8..a568699c28f4 100644
+index 2387e2d1ff9e..2d6f730a7101 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -451,6 +451,13 @@
+@@ -474,6 +474,13 @@
compatible = "aspeed,bmc-misc";
};
@@ -80,40 +79,40 @@ index e5c0ba0f87c8..a568699c28f4 100644
mbox: mbox@180 {
compatible = "aspeed,ast2500-mbox";
reg = <0x180 0x5c>;
-diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
-index 00d1c547ece7..3ffb18f915e8 100644
---- a/drivers/misc/Kconfig
-+++ b/drivers/misc/Kconfig
-@@ -493,6 +493,15 @@ config ASPEED_LPC_CTRL
- ioctl()s, the driver also provides a read/write interface to a BMC ram
- region where the host LPC read/write region can be buffered.
+diff --git a/drivers/soc/aspeed/Kconfig b/drivers/soc/aspeed/Kconfig
+index a4be8e566bc7..285c19042c65 100644
+--- a/drivers/soc/aspeed/Kconfig
++++ b/drivers/soc/aspeed/Kconfig
+@@ -28,6 +28,13 @@ config ASPEED_LPC_MBOX
+ Expose the ASPEED LPC MBOX registers found on Aspeed SOCs (AST2400
+ and AST2500) to userspace.
+config ASPEED_LPC_SIO
-+ depends on (ARCH_ASPEED || COMPILE_TEST) && REGMAP && MFD_SYSCON
+ tristate "Aspeed ast2400/2500 HOST LPC SIO support"
++ depends on SOC_ASPEED && REGMAP && MFD_SYSCON
+ help
-+ Provides a driver to control the LPC SIO interface
-+ on ASPEED platform
-+ through
-+ ioctl()s.
++ Provides a driver to control the LPC SIO interface on ASPEED platform
++ through ioctl()s.
+
config ASPEED_LPC_SNOOP
tristate "Aspeed ast2500 HOST LPC snoop support"
- depends on (ARCH_ASPEED || COMPILE_TEST) && REGMAP && MFD_SYSCON
-diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
-index 768278b059c3..de2d5c6d186c 100644
---- a/drivers/misc/Makefile
-+++ b/drivers/misc/Makefile
-@@ -53,6 +53,7 @@ obj-$(CONFIG_GENWQE) += genwqe/
- obj-$(CONFIG_ECHO) += echo/
- obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o
- obj-$(CONFIG_CXL_BASE) += cxl/
-+obj-$(CONFIG_ASPEED_LPC_SIO) += aspeed-lpc-sio.o
+ depends on SOC_ASPEED && REGMAP && MFD_SYSCON
+diff --git a/drivers/soc/aspeed/Makefile b/drivers/soc/aspeed/Makefile
+index f3ff29b874ed..2e547cc47e62 100644
+--- a/drivers/soc/aspeed/Makefile
++++ b/drivers/soc/aspeed/Makefile
+@@ -2,5 +2,6 @@
+ obj-$(CONFIG_ASPEED_BMC_MISC) += aspeed-bmc-misc.o
obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o
- obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
obj-$(CONFIG_ASPEED_LPC_MBOX) += aspeed-lpc-mbox.o
++obj-$(CONFIG_ASPEED_LPC_SIO) += aspeed-lpc-sio.o
+ obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
+ obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o
+diff --git a/drivers/soc/aspeed/aspeed-lpc-sio.c b/drivers/soc/aspeed/aspeed-lpc-sio.c
+new file mode 100644
+index 000000000000..c717a3182320
--- /dev/null
-+++ b/drivers/misc/aspeed-lpc-sio.c
++++ b/drivers/soc/aspeed/aspeed-lpc-sio.c
@@ -0,0 +1,450 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2012-2017 ASPEED Technology Inc.
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch
index 303bff0b1..a44667436 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0022-Add-AST2500-eSPI-driver.patch
@@ -1,4 +1,4 @@
-From 3437db37b2f39a69505338546d9f846338de6c88 Mon Sep 17 00:00:00 2001
+From 0f0e0a03218f6a7bdcdd78d319959e6bb974502c Mon Sep 17 00:00:00 2001
From: Haiyue Wang <haiyue.wang@linux.intel.com>
Date: Sat, 24 Feb 2018 11:12:32 +0800
Subject: [PATCH] eSPI: add ASPEED AST2500 eSPI driver to boot a host with PCH
@@ -18,23 +18,23 @@ Also for the host power on / off actions, from BMC side, the following VW
Signed-off-by: Haiyue Wang <haiyue.wang@linux.intel.com>
---
- .../devicetree/bindings/misc/aspeed,espi-slave.txt | 20 ++
- Documentation/misc-devices/espi-slave.rst | 119 +++++++
+ .../devicetree/bindings/misc/aspeed,espi-slave.txt | 19 ++
+ Documentation/misc-devices/espi-slave.rst | 118 +++++++
arch/arm/boot/dts/aspeed-g5.dtsi | 4 +
drivers/misc/Kconfig | 8 +
drivers/misc/Makefile | 1 +
drivers/misc/aspeed-espi-slave.c | 353 +++++++++++++++++++++
- 6 files changed, 505 insertions(+)
+ 6 files changed, 503 insertions(+)
create mode 100644 Documentation/devicetree/bindings/misc/aspeed,espi-slave.txt
create mode 100644 Documentation/misc-devices/espi-slave.rst
create mode 100644 drivers/misc/aspeed-espi-slave.c
diff --git a/Documentation/devicetree/bindings/misc/aspeed,espi-slave.txt b/Documentation/devicetree/bindings/misc/aspeed,espi-slave.txt
new file mode 100644
-index 000000000000..4f5d47ecc882
+index 000000000000..8660e2ffbb89
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/aspeed,espi-slave.txt
-@@ -0,0 +1,20 @@
+@@ -0,0 +1,19 @@
+ASPEED eSPI Slave Controller
+
+Required properties:
@@ -54,13 +54,12 @@ index 000000000000..4f5d47ecc882
+ interrupts = <23>;
+ status = "disabled";
+};
-+
diff --git a/Documentation/misc-devices/espi-slave.rst b/Documentation/misc-devices/espi-slave.rst
new file mode 100644
-index 000000000000..185acd71bd26
+index 000000000000..887a69a7130a
--- /dev/null
+++ b/Documentation/misc-devices/espi-slave.rst
-@@ -0,0 +1,119 @@
+@@ -0,0 +1,118 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+==========
@@ -179,12 +178,11 @@ index 000000000000..185acd71bd26
+`Enhanced Serial Peripheral Interface (eSPI)
+- Interface Base Specification (for Client and Server Platforms)
+<https://www.intel.com/content/dam/support/us/en/documents/software/chipset-software/327432-004_espi_base_specification_rev1.0.pdf>`_
-+
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index da9e903808bc..01d27e845982 100644
+index 2d6f730a7101..0e7f1d2fa08e 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -267,6 +267,7 @@
+@@ -289,6 +289,7 @@
clocks = <&syscon ASPEED_CLK_APB>;
interrupt-controller;
#interrupt-cells = <2>;
@@ -192,7 +190,7 @@ index da9e903808bc..01d27e845982 100644
};
sgpio: sgpio@1e780200 {
-@@ -361,6 +362,9 @@
+@@ -383,6 +384,9 @@
reg = <0x1e6ee000 0x100>;
interrupts = <23>;
status = "disabled";
@@ -203,10 +201,10 @@ index da9e903808bc..01d27e845982 100644
lpc: lpc@1e789000 {
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
-index d4ed3777462a..8b1fcf741411 100644
+index 9d96469fb41c..b6acddaa9421 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
-@@ -485,6 +485,14 @@ config VEXPRESS_SYSCFG
+@@ -473,6 +473,14 @@ config VEXPRESS_SYSCFG
bus. System Configuration interface is one of the possible means
of generating transactions on this bus.
@@ -218,21 +216,21 @@ index d4ed3777462a..8b1fcf741411 100644
+ Control Aspeed ast2500 eSPI slave controller to handle event
+ which needs the firmware's processing.
+
- config ASPEED_LPC_CTRL
- depends on (ARCH_ASPEED || COMPILE_TEST) && REGMAP && MFD_SYSCON
- tristate "Aspeed ast2400/2500 HOST LPC to BMC bridge control"
+ config PCI_ENDPOINT_TEST
+ depends on PCI
+ select CRC32
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
-index 7b018962cad3..89b051f82391 100644
+index e13de4f0798f..f91f66a15484 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
-@@ -54,6 +54,7 @@ obj-$(CONFIG_ECHO) += echo/
+@@ -54,6 +54,7 @@ obj-$(CONFIG_GENWQE) += genwqe/
+ obj-$(CONFIG_ECHO) += echo/
obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o
obj-$(CONFIG_CXL_BASE) += cxl/
- obj-$(CONFIG_ASPEED_LPC_SIO) += aspeed-lpc-sio.o
+obj-$(CONFIG_ASPEED_ESPI_SLAVE) += aspeed-espi-slave.o
- obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o
- obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
- obj-$(CONFIG_ASPEED_LPC_MBOX) += aspeed-lpc-mbox.o
+ obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o
+ obj-$(CONFIG_OCXL) += ocxl/
+ obj-y += cardreader/
diff --git a/drivers/misc/aspeed-espi-slave.c b/drivers/misc/aspeed-espi-slave.c
new file mode 100644
index 000000000000..36ae867ca6f9
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch
index 1532a5642..0e11e1c3e 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0026-Add-support-for-new-PECI-commands.patch
@@ -1,29 +1,33 @@
-From d1d221aedb9b366e3477f253386b1cf829c56193 Mon Sep 17 00:00:00 2001
+From 8d5f080b38d1b652eb5fdd3a7b74164906680ab7 Mon Sep 17 00:00:00 2001
From: "Jason M. Bills" <jason.m.bills@intel.com>
Date: Wed, 4 Apr 2018 13:52:39 -0700
Subject: [PATCH] Add support for new PECI commands
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
+Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
- drivers/peci/peci-core.c | 226 ++++++++++++++++++++++++++++++++++++++++
- include/uapi/linux/peci-ioctl.h | 104 ++++++++++++++++++
- 2 files changed, 330 insertions(+)
+ drivers/peci/peci-core.c | 396 ++++++++++++++++++++++++++++++++++++++++
+ include/uapi/linux/peci-ioctl.h | 146 +++++++++++++++
+ 2 files changed, 542 insertions(+)
diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c
-index e282f9ef383b..9af11accc1d4 100644
+index d1f0df8b139a..b99ba788a032 100644
--- a/drivers/peci/peci-core.c
+++ b/drivers/peci/peci-core.c
-@@ -345,6 +345,9 @@ static int peci_scan_cmd_mask(struct peci_adapter *adapter)
- adapter->cmd_mask |= BIT(PECI_CMD_GET_TEMP);
- adapter->cmd_mask |= BIT(PECI_CMD_GET_DIB);
- adapter->cmd_mask |= BIT(PECI_CMD_PING);
-+ adapter->cmd_mask |= BIT(PECI_CMD_RD_END_PT_CFG);
-+ adapter->cmd_mask |= BIT(PECI_CMD_CRASHDUMP_DISC);
-+ adapter->cmd_mask |= BIT(PECI_CMD_CRASHDUMP_GET_FRAME);
-
- out:
- peci_put_xfer_msg(msg);
-@@ -693,6 +696,226 @@ static int peci_cmd_wr_pci_cfg_local(struct peci_adapter *adapter, void *vmsg)
+@@ -318,6 +318,12 @@ static int peci_scan_cmd_mask(struct peci_adapter *adapter)
+ * See PECI Spec Table 3-1.
+ */
+ revision = FIELD_GET(REVISION_NUM_MASK, dib);
++ if (revision >= 0x40) { /* Rev. 4.0 */
++ adapter->cmd_mask |= BIT(PECI_CMD_RD_END_PT_CFG);
++ adapter->cmd_mask |= BIT(PECI_CMD_WR_END_PT_CFG);
++ adapter->cmd_mask |= BIT(PECI_CMD_CRASHDUMP_DISC);
++ adapter->cmd_mask |= BIT(PECI_CMD_CRASHDUMP_GET_FRAME);
++ }
+ if (revision >= 0x36) /* Rev. 3.6 */
+ adapter->cmd_mask |= BIT(PECI_CMD_WR_IA_MSR);
+ if (revision >= 0x35) /* Rev. 3.5 */
+@@ -687,6 +693,392 @@ static int peci_cmd_wr_pci_cfg_local(struct peci_adapter *adapter, void *vmsg)
return ret;
}
@@ -32,11 +36,12 @@ index e282f9ef383b..9af11accc1d4 100644
+ struct peci_rd_end_pt_cfg_msg *umsg = vmsg;
+ struct peci_xfer_msg *msg = NULL;
+ u32 address;
++ u8 tx_size;
+ int ret;
+
+ switch (umsg->msg_type) {
-+ case PECI_RDENDPTCFG_TYPE_LOCAL_PCI:
-+ case PECI_RDENDPTCFG_TYPE_PCI:
++ case PECI_ENDPTCFG_TYPE_LOCAL_PCI:
++ case PECI_ENDPTCFG_TYPE_PCI:
+ /*
+ * Per the PECI spec, the read length must be a byte, word,
+ * or dword
@@ -55,7 +60,7 @@ index e282f9ef383b..9af11accc1d4 100644
+ if (!msg)
+ return -ENOMEM;
+
-+ address = umsg->params.pci_cfg.reg; /* [11:0] - Register */
++ address = umsg->params.pci_cfg.reg; /* [11:0] - Register */
+ address |= (u32)umsg->params.pci_cfg.function
+ << 12; /* [14:12] - Function */
+ address |= (u32)umsg->params.pci_cfg.device
@@ -70,7 +75,7 @@ index e282f9ef383b..9af11accc1d4 100644
+ msg->tx_buf[3] = 0x00; /* Endpoint ID */
+ msg->tx_buf[4] = 0x00; /* Reserved */
+ msg->tx_buf[5] = 0x00; /* Reserved */
-+ msg->tx_buf[6] = PECI_RDENDPTCFG_ADDR_TYPE_PCI; /* Addr Type */
++ msg->tx_buf[6] = PECI_ENDPTCFG_ADDR_TYPE_PCI; /* Addr Type */
+ msg->tx_buf[7] = umsg->params.pci_cfg.seg; /* PCI Segment */
+ msg->tx_buf[8] = (u8)address; /* LSB - PCI Config Address */
+ msg->tx_buf[9] = (u8)(address >> 8); /* PCI Config Address */
@@ -79,7 +84,7 @@ index e282f9ef383b..9af11accc1d4 100644
+ (u8)(address >> 24); /* MSB - PCI Config Address */
+ break;
+
-+ case PECI_RDENDPTCFG_TYPE_MMIO:
++ case PECI_ENDPTCFG_TYPE_MMIO:
+ /*
+ * Per the PECI spec, the read length must be a byte, word,
+ * dword, or qword
@@ -96,22 +101,27 @@ index e282f9ef383b..9af11accc1d4 100644
+ * or QWORD
+ */
+ if (umsg->params.mmio.addr_type !=
-+ PECI_RDENDPTCFG_ADDR_TYPE_MMIO_D &&
++ PECI_ENDPTCFG_ADDR_TYPE_MMIO_D &&
+ umsg->params.mmio.addr_type !=
-+ PECI_RDENDPTCFG_ADDR_TYPE_MMIO_Q) {
++ PECI_ENDPTCFG_ADDR_TYPE_MMIO_Q) {
+ dev_dbg(&adapter->dev,
+ "Invalid address type, addr_type: %d\n",
+ umsg->params.mmio.addr_type);
+ return -EINVAL;
+ }
+
-+ msg = peci_get_xfer_msg(PECI_RDENDPTCFG_MMIO_D_WRITE_LEN,
++ if (umsg->params.mmio.addr_type ==
++ PECI_ENDPTCFG_ADDR_TYPE_MMIO_D)
++ tx_size = PECI_RDENDPTCFG_MMIO_D_WRITE_LEN;
++ else
++ tx_size = PECI_RDENDPTCFG_MMIO_Q_WRITE_LEN;
++ msg = peci_get_xfer_msg(tx_size,
+ PECI_RDENDPTCFG_READ_LEN_BASE +
+ umsg->rx_len);
+ if (!msg)
+ return -ENOMEM;
+
-+ address = umsg->params.mmio.function; /* [2:0] - Function */
++ address = umsg->params.mmio.function; /* [2:0] - Function */
+ address |= (u32)umsg->params.mmio.device
+ << 3; /* [7:3] - Device */
+
@@ -135,8 +145,7 @@ index e282f9ef383b..9af11accc1d4 100644
+ msg->tx_buf[13] = (u8)(umsg->params.mmio.offset
+ >> 24); /* MSB - DWORD Register Offset */
+ if (umsg->params.mmio.addr_type ==
-+ PECI_RDENDPTCFG_ADDR_TYPE_MMIO_Q) {
-+ msg->tx_len = PECI_RDENDPTCFG_MMIO_Q_WRITE_LEN;
++ PECI_ENDPTCFG_ADDR_TYPE_MMIO_Q) {
+ msg->tx_buf[14] = (u8)(umsg->params.mmio.offset
+ >> 32); /* Register Offset */
+ msg->tx_buf[15] = (u8)(umsg->params.mmio.offset
@@ -163,6 +172,167 @@ index e282f9ef383b..9af11accc1d4 100644
+ return ret;
+}
+
++static int peci_cmd_wr_end_pt_cfg(struct peci_adapter *adapter, void *vmsg)
++{
++ struct peci_wr_end_pt_cfg_msg *umsg = vmsg;
++ struct peci_xfer_msg *msg = NULL;
++ u8 tx_size, aw_fcs;
++ int ret, i, idx;
++ u32 address;
++
++ switch (umsg->msg_type) {
++ case PECI_ENDPTCFG_TYPE_LOCAL_PCI:
++ case PECI_ENDPTCFG_TYPE_PCI:
++ /*
++ * Per the PECI spec, the write length must be a byte, word,
++ * or dword
++ */
++ if (umsg->tx_len != 1 && umsg->tx_len != 2 &&
++ umsg->tx_len != 4) {
++ dev_dbg(&adapter->dev,
++ "Invalid write length, tx_len: %d\n",
++ umsg->tx_len);
++ return -EINVAL;
++ }
++
++ msg = peci_get_xfer_msg(PECI_WRENDPTCFG_PCI_WRITE_LEN_BASE +
++ umsg->tx_len, PECI_WRENDPTCFG_READ_LEN);
++ if (!msg)
++ return -ENOMEM;
++
++ address = umsg->params.pci_cfg.reg; /* [11:0] - Register */
++ address |= (u32)umsg->params.pci_cfg.function
++ << 12; /* [14:12] - Function */
++ address |= (u32)umsg->params.pci_cfg.device
++ << 15; /* [19:15] - Device */
++ address |= (u32)umsg->params.pci_cfg.bus
++ << 20; /* [27:20] - Bus */
++ /* [31:28] - Reserved */
++ msg->addr = umsg->addr;
++ msg->tx_buf[0] = PECI_WRENDPTCFG_CMD;
++ msg->tx_buf[1] = 0x00; /* request byte for Host ID|Retry bit */
++ msg->tx_buf[2] = umsg->msg_type; /* Message Type */
++ msg->tx_buf[3] = 0x00; /* Endpoint ID */
++ msg->tx_buf[4] = 0x00; /* Reserved */
++ msg->tx_buf[5] = 0x00; /* Reserved */
++ msg->tx_buf[6] = PECI_ENDPTCFG_ADDR_TYPE_PCI; /* Addr Type */
++ msg->tx_buf[7] = umsg->params.pci_cfg.seg; /* PCI Segment */
++ msg->tx_buf[8] = (u8)address; /* LSB - PCI Config Address */
++ msg->tx_buf[9] = (u8)(address >> 8); /* PCI Config Address */
++ msg->tx_buf[10] = (u8)(address >> 16); /* PCI Config Address */
++ msg->tx_buf[11] =
++ (u8)(address >> 24); /* MSB - PCI Config Address */
++ for (i = 0; i < umsg->tx_len; i++)
++ msg->tx_buf[12 + i] = (u8)(umsg->value >> (i << 3));
++
++ /* Add an Assured Write Frame Check Sequence byte */
++ ret = peci_aw_fcs(msg, 15 + umsg->tx_len, &aw_fcs);
++ if (ret)
++ goto out;
++
++ msg->tx_buf[12 + i] = 0x80 ^ aw_fcs;
++ break;
++
++ case PECI_ENDPTCFG_TYPE_MMIO:
++ /*
++ * Per the PECI spec, the write length must be a byte, word,
++ * dword, or qword
++ */
++ if (umsg->tx_len != 1 && umsg->tx_len != 2 &&
++ umsg->tx_len != 4 && umsg->tx_len != 8) {
++ dev_dbg(&adapter->dev,
++ "Invalid write length, tx_len: %d\n",
++ umsg->tx_len);
++ return -EINVAL;
++ }
++ /*
++ * Per the PECI spec, the address type must specify either DWORD
++ * or QWORD
++ */
++ if (umsg->params.mmio.addr_type !=
++ PECI_ENDPTCFG_ADDR_TYPE_MMIO_D &&
++ umsg->params.mmio.addr_type !=
++ PECI_ENDPTCFG_ADDR_TYPE_MMIO_Q) {
++ dev_dbg(&adapter->dev,
++ "Invalid address type, addr_type: %d\n",
++ umsg->params.mmio.addr_type);
++ return -EINVAL;
++ }
++
++ if (umsg->params.mmio.addr_type ==
++ PECI_ENDPTCFG_ADDR_TYPE_MMIO_D)
++ tx_size = PECI_WRENDPTCFG_MMIO_D_WRITE_LEN_BASE +
++ umsg->tx_len;
++ else
++ tx_size = PECI_WRENDPTCFG_MMIO_Q_WRITE_LEN_BASE +
++ umsg->tx_len;
++ msg = peci_get_xfer_msg(tx_size, PECI_WRENDPTCFG_READ_LEN);
++ if (!msg)
++ return -ENOMEM;
++
++ address = umsg->params.mmio.function; /* [2:0] - Function */
++ address |= (u32)umsg->params.mmio.device
++ << 3; /* [7:3] - Device */
++
++ msg->addr = umsg->addr;
++ msg->tx_buf[0] = PECI_WRENDPTCFG_CMD;
++ msg->tx_buf[1] = 0x00; /* request byte for Host ID|Retry bit */
++ msg->tx_buf[2] = umsg->msg_type; /* Message Type */
++ msg->tx_buf[3] = 0x00; /* Endpoint ID */
++ msg->tx_buf[4] = 0x00; /* Reserved */
++ msg->tx_buf[5] = umsg->params.mmio.bar; /* BAR # */
++ msg->tx_buf[6] = umsg->params.mmio.addr_type; /* Address Type */
++ msg->tx_buf[7] = umsg->params.mmio.seg; /* PCI Segment */
++ msg->tx_buf[8] = (u8)address; /* Function/Device */
++ msg->tx_buf[9] = umsg->params.mmio.bus; /* PCI Bus */
++ msg->tx_buf[10] = (u8)umsg->params.mmio
++ .offset; /* LSB - Register Offset */
++ msg->tx_buf[11] = (u8)(umsg->params.mmio.offset
++ >> 8); /* Register Offset */
++ msg->tx_buf[12] = (u8)(umsg->params.mmio.offset
++ >> 16); /* Register Offset */
++ msg->tx_buf[13] = (u8)(umsg->params.mmio.offset
++ >> 24); /* MSB - DWORD Register Offset */
++ if (umsg->params.mmio.addr_type ==
++ PECI_ENDPTCFG_ADDR_TYPE_MMIO_Q) {
++ msg->tx_len = PECI_WRENDPTCFG_MMIO_Q_WRITE_LEN_BASE;
++ msg->tx_buf[14] = (u8)(umsg->params.mmio.offset
++ >> 32); /* Register Offset */
++ msg->tx_buf[15] = (u8)(umsg->params.mmio.offset
++ >> 40); /* Register Offset */
++ msg->tx_buf[16] = (u8)(umsg->params.mmio.offset
++ >> 48); /* Register Offset */
++ msg->tx_buf[17] =
++ (u8)(umsg->params.mmio.offset
++ >> 56); /* MSB - QWORD Register Offset */
++ idx = 18;
++ } else {
++ idx = 14;
++ }
++ for (i = 0; i < umsg->tx_len; i++)
++ msg->tx_buf[idx + i] = (u8)(umsg->value >> (i << 3));
++
++ /* Add an Assured Write Frame Check Sequence byte */
++ ret = peci_aw_fcs(msg, idx + 3 + umsg->tx_len, &aw_fcs);
++ if (ret)
++ goto out;
++
++ msg->tx_buf[idx + i] = 0x80 ^ aw_fcs;
++ break;
++
++ default:
++ return -EINVAL;
++ }
++
++ ret = peci_xfer_with_retries(adapter, msg, false);
++
++out:
++ umsg->cc = msg->rx_buf[0];
++ peci_put_xfer_msg(msg);
++
++ return ret;
++}
++
+static int peci_cmd_crashdump_disc(struct peci_adapter *adapter, void *vmsg)
+{
+ struct peci_crashdump_disc_msg *umsg = vmsg;
@@ -250,46 +420,48 @@ index e282f9ef383b..9af11accc1d4 100644
typedef int (*peci_cmd_fn_type)(struct peci_adapter *, void *);
static const peci_cmd_fn_type peci_cmd_fn[PECI_CMD_MAX] = {
-@@ -708,6 +931,9 @@ static const peci_cmd_fn_type peci_cmd_fn[PECI_CMD_MAX] = {
+@@ -702,6 +1094,10 @@ static const peci_cmd_fn_type peci_cmd_fn[PECI_CMD_MAX] = {
peci_cmd_wr_pci_cfg,
peci_cmd_rd_pci_cfg_local,
peci_cmd_wr_pci_cfg_local,
+ peci_cmd_rd_end_pt_cfg,
++ peci_cmd_wr_end_pt_cfg,
+ peci_cmd_crashdump_disc,
+ peci_cmd_crashdump_get_frame,
};
/**
diff --git a/include/uapi/linux/peci-ioctl.h b/include/uapi/linux/peci-ioctl.h
-index 4c28abe2c17a..e67b0735f606 100644
+index 253fb42e38b7..405cd8edbcbf 100644
--- a/include/uapi/linux/peci-ioctl.h
+++ b/include/uapi/linux/peci-ioctl.h
-@@ -72,6 +72,9 @@ enum peci_cmd {
+@@ -71,6 +71,10 @@ enum peci_cmd {
PECI_CMD_WR_PCI_CFG,
PECI_CMD_RD_PCI_CFG_LOCAL,
PECI_CMD_WR_PCI_CFG_LOCAL,
+ PECI_CMD_RD_END_PT_CFG,
++ PECI_CMD_WR_END_PT_CFG,
+ PECI_CMD_CRASHDUMP_DISC,
+ PECI_CMD_CRASHDUMP_GET_FRAME,
PECI_CMD_MAX
};
-@@ -439,6 +442,95 @@ struct peci_wr_pci_cfg_local_msg {
+@@ -438,6 +442,132 @@ struct peci_wr_pci_cfg_local_msg {
__u32 value;
} __attribute__((__packed__));
+struct peci_rd_end_pt_cfg_msg {
-+#define PECI_RDENDPTCFG_PCI_WRITE_LEN 0x0C
-+#define PECI_RDENDPTCFG_MMIO_D_WRITE_LEN 0x0E
-+#define PECI_RDENDPTCFG_MMIO_Q_WRITE_LEN 0x12
++#define PECI_RDENDPTCFG_PCI_WRITE_LEN 12
++#define PECI_RDENDPTCFG_MMIO_D_WRITE_LEN 14
++#define PECI_RDENDPTCFG_MMIO_Q_WRITE_LEN 18
+#define PECI_RDENDPTCFG_READ_LEN_BASE 1
-+#define PECI_RDENDPTCFG_CMD 0xC1
++#define PECI_RDENDPTCFG_CMD 0xc1
+
+ __u8 addr;
+ __u8 msg_type;
-+#define PECI_RDENDPTCFG_TYPE_LOCAL_PCI 0x03
-+#define PECI_RDENDPTCFG_TYPE_PCI 0x04
-+#define PECI_RDENDPTCFG_TYPE_MMIO 0x05
++#define PECI_ENDPTCFG_TYPE_LOCAL_PCI 0x03
++#define PECI_ENDPTCFG_TYPE_PCI 0x04
++#define PECI_ENDPTCFG_TYPE_MMIO 0x05
+
+ union {
+ struct {
@@ -306,9 +478,9 @@ index 4c28abe2c17a..e67b0735f606 100644
+ __u8 function;
+ __u8 bar;
+ __u8 addr_type;
-+#define PECI_RDENDPTCFG_ADDR_TYPE_PCI 0x04
-+#define PECI_RDENDPTCFG_ADDR_TYPE_MMIO_D 0x05
-+#define PECI_RDENDPTCFG_ADDR_TYPE_MMIO_Q 0x06
++#define PECI_ENDPTCFG_ADDR_TYPE_PCI 0x04
++#define PECI_ENDPTCFG_ADDR_TYPE_MMIO_D 0x05
++#define PECI_ENDPTCFG_ADDR_TYPE_MMIO_Q 0x06
+
+ __u64 offset;
+ } mmio;
@@ -319,6 +491,43 @@ index 4c28abe2c17a..e67b0735f606 100644
+ __u8 data[8];
+} __attribute__((__packed__));
+
++struct peci_wr_end_pt_cfg_msg {
++#define PECI_WRENDPTCFG_PCI_WRITE_LEN_BASE 13
++#define PECI_WRENDPTCFG_MMIO_D_WRITE_LEN_BASE 15
++#define PECI_WRENDPTCFG_MMIO_Q_WRITE_LEN_BASE 19
++#define PECI_WRENDPTCFG_READ_LEN 1
++#define PECI_WRENDPTCFG_CMD 0xc5
++
++ __u8 addr;
++ __u8 msg_type;
++ /* See msg_type in struct peci_rd_end_pt_cfg_msg */
++
++ union {
++ struct {
++ __u8 seg;
++ __u8 bus;
++ __u8 device;
++ __u8 function;
++ __u16 reg;
++ } pci_cfg;
++ struct {
++ __u8 seg;
++ __u8 bus;
++ __u8 device;
++ __u8 function;
++ __u8 bar;
++ __u8 addr_type;
++ /* See addr_type in struct peci_rd_end_pt_cfg_msg */
++
++ __u64 offset;
++ } mmio;
++ } params;
++ __u8 tx_len;
++ __u8 cc;
++ __u8 padding[2];
++ __u64 value;
++} __attribute__((__packed__));
++
+/* Crashdump Agent */
+#define PECI_CRASHDUMP_CORE 0x00
+#define PECI_CRASHDUMP_TOR 0x01
@@ -370,7 +579,7 @@ index 4c28abe2c17a..e67b0735f606 100644
#define PECI_IOC_BASE 0xb7
#define PECI_IOC_XFER \
-@@ -479,4 +571,16 @@ struct peci_wr_pci_cfg_local_msg {
+@@ -478,4 +608,20 @@ struct peci_wr_pci_cfg_local_msg {
_IOWR(PECI_IOC_BASE, PECI_CMD_WR_PCI_CFG_LOCAL, \
struct peci_wr_pci_cfg_local_msg)
@@ -378,6 +587,10 @@ index 4c28abe2c17a..e67b0735f606 100644
+ _IOWR(PECI_IOC_BASE, PECI_CMD_RD_END_PT_CFG, \
+ struct peci_rd_end_pt_cfg_msg)
+
++#define PECI_IOC_WR_END_PT_CFG \
++ _IOWR(PECI_IOC_BASE, PECI_IOC_WR_END_PT_CFG, \
++ struct peci_wr_end_pt_cfg_msg)
++
+#define PECI_IOC_CRASHDUMP_DISC \
+ _IOWR(PECI_IOC_BASE, PECI_CMD_CRASHDUMP_DISC, \
+ struct peci_crashdump_disc_msg)
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0028-Add-AST2500-JTAG-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0028-Add-AST2500-JTAG-driver.patch
index 56dca7345..28bc8d36c 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0028-Add-AST2500-JTAG-driver.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0028-Add-AST2500-JTAG-driver.patch
@@ -1,12 +1,14 @@
-From 43470f186979483ba6c1e6374c7ea3a129622862 Mon Sep 17 00:00:00 2001
+From a4413fe3ba94906243b632e0b9e0e9a91620dd22 Mon Sep 17 00:00:00 2001
From: "Corona, Ernesto" <ernesto.corona@intel.com>
-Date: Mon, 1 Mar 2019 11:46:09 -0700
+Date: Fri, 1 Mar 2019 11:46:09 -0700
Subject: [PATCH] Update AST2500d JTAG driver. Step 1
Update AST2500d JTAG driver. Remove Legacy driver but keep headers.
Signed-off-by: Corona, Ernesto <ernesto.corona@intel.com>
---
+ include/uapi/linux/jtag_drv.h | 73 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 73 insertions(+)
create mode 100644 include/uapi/linux/jtag_drv.h
diff --git a/include/uapi/linux/jtag_drv.h b/include/uapi/linux/jtag_drv.h
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch
index e984623ba..d828233fe 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0030-Add-dump-debug-code-into-I2C-drivers.patch
@@ -1,4 +1,4 @@
-From f4c13be7b95899d6eca3fa7ae38224bc9c7d7902 Mon Sep 17 00:00:00 2001
+From 38c04788647a95e3951674eb802f1f99ecdde164 Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Fri, 29 Jun 2018 11:00:02 -0700
Subject: [PATCH] Add dump debug code into I2C drivers
@@ -15,15 +15,15 @@ echo 1 > /sys/module/i2c_slave_mqueue/parameters/dump_debug
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
- drivers/i2c/busses/i2c-aspeed.c | 25 +++++++++++++++++++++++++
- drivers/i2c/i2c-slave-mqueue.c | 22 ++++++++++++++++++++++
- 2 files changed, 47 insertions(+)
+ drivers/i2c/busses/i2c-aspeed.c | 26 ++++++++++++++++++++++++++
+ drivers/i2c/i2c-slave-mqueue.c | 24 ++++++++++++++++++++++++
+ 2 files changed, 50 insertions(+)
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
-index 6c8b38fd6e64..77dbd37b7b51 100644
+index fa66951b05d0..434b753def3b 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
-@@ -166,6 +166,19 @@ struct aspeed_i2c_bus {
+@@ -163,6 +163,21 @@ struct aspeed_i2c_bus {
#endif /* CONFIG_I2C_SLAVE */
};
@@ -31,19 +31,21 @@ index 6c8b38fd6e64..77dbd37b7b51 100644
+static int dump_debug_bus_id __read_mostly;
+
+#define I2C_HEX_DUMP(bus, addr, flags, buf, len) \
-+ if (dump_debug && bus->adap.nr == dump_debug_bus_id) { \
-+ char dump_info[100] = {0,}; \
-+ snprintf(dump_info, sizeof(dump_info), \
-+ "%s (bus_id:%d, addr:0x%02x, flags:0x%02x): ", \
-+ __func__, bus->adap.nr, addr, flags); \
-+ print_hex_dump(KERN_ERR, dump_info, DUMP_PREFIX_NONE, 16, 1, \
-+ buf, len, true); \
-+ }
++ do { \
++ if (dump_debug && (bus)->adap.nr == dump_debug_bus_id) { \
++ char dump_info[100] = {0,}; \
++ snprintf(dump_info, sizeof(dump_info), \
++ "bus_id:%d, addr:0x%02x, flags:0x%02x: ", \
++ (bus)->adap.nr, addr, flags); \
++ print_hex_dump(KERN_ERR, dump_info, DUMP_PREFIX_NONE, \
++ 16, 1, buf, len, true); \
++ } \
++ } while (0)
+
static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus);
static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus)
-@@ -655,6 +668,7 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
+@@ -652,6 +667,7 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
{
struct aspeed_i2c_bus *bus = i2c_get_adapdata(adap);
unsigned long time_left, flags;
@@ -51,7 +53,7 @@ index 6c8b38fd6e64..77dbd37b7b51 100644
spin_lock_irqsave(&bus->lock, flags);
bus->cmd_err = 0;
-@@ -697,6 +711,11 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
+@@ -694,6 +710,11 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
return -ETIMEDOUT;
}
@@ -63,21 +65,20 @@ index 6c8b38fd6e64..77dbd37b7b51 100644
return bus->master_xfer_result;
}
-@@ -1064,6 +1083,12 @@ static struct platform_driver aspeed_i2c_bus_driver = {
+@@ -1061,6 +1082,11 @@ static struct platform_driver aspeed_i2c_bus_driver = {
};
module_platform_driver(aspeed_i2c_bus_driver);
-+module_param_named(dump_debug, dump_debug, bool, S_IRUGO | S_IWUSR);
++module_param_named(dump_debug, dump_debug, bool, 0644);
+MODULE_PARM_DESC(dump_debug, "debug flag for dump printing");
-+module_param_named(dump_debug_bus_id, dump_debug_bus_id, int,
-+ S_IRUGO | S_IWUSR);
++module_param_named(dump_debug_bus_id, dump_debug_bus_id, int, 0644);
+MODULE_PARM_DESC(dump_debug_bus_id, "bus id for dump debug printing");
+
MODULE_AUTHOR("Brendan Higgins <brendanhiggins@google.com>");
MODULE_DESCRIPTION("Aspeed I2C Bus Driver");
MODULE_LICENSE("GPL v2");
diff --git a/drivers/i2c/i2c-slave-mqueue.c b/drivers/i2c/i2c-slave-mqueue.c
-index 6014bca0ff2a..4548088e1922 100644
+index 6014bca0ff2a..2c7a6038409c 100644
--- a/drivers/i2c/i2c-slave-mqueue.c
+++ b/drivers/i2c/i2c-slave-mqueue.c
@@ -21,6 +21,7 @@ struct mq_msg {
@@ -88,7 +89,7 @@ index 6014bca0ff2a..4548088e1922 100644
spinlock_t lock; /* spinlock for queue index handling */
int in;
-@@ -31,6 +32,18 @@ struct mq_queue {
+@@ -31,6 +32,21 @@ struct mq_queue {
struct mq_msg *queue;
};
@@ -96,18 +97,21 @@ index 6014bca0ff2a..4548088e1922 100644
+static int dump_debug_bus_id __read_mostly;
+
+#define I2C_HEX_DUMP(client, buf, len) \
-+ if (dump_debug && client->adapter->nr == dump_debug_bus_id) { \
-+ char dump_info[100] = {0,}; \
-+ snprintf(dump_info, sizeof(dump_info), \
-+ "%s (bus_id:%d): ", __func__, client->adapter->nr); \
-+ print_hex_dump(KERN_ERR, dump_info, DUMP_PREFIX_NONE, 16, 1, \
-+ buf, len, true); \
-+ }
++ do { \
++ if (dump_debug && \
++ (client)->adapter->nr == dump_debug_bus_id) { \
++ char dump_info[100] = {0,}; \
++ snprintf(dump_info, sizeof(dump_info), \
++ "bus_id:%d: ", (client)->adapter->nr); \
++ print_hex_dump(KERN_ERR, dump_info, DUMP_PREFIX_NONE, \
++ 16, 1, buf, len, true); \
++ } \
++ } while (0)
+
static int i2c_slave_mqueue_callback(struct i2c_client *client,
enum i2c_slave_event event, u8 *val)
{
-@@ -101,6 +114,7 @@ static ssize_t i2c_slave_mqueue_bin_read(struct file *filp,
+@@ -101,6 +117,7 @@ static ssize_t i2c_slave_mqueue_bin_read(struct file *filp,
if (msg->len <= count) {
ret = msg->len;
memcpy(buf, msg->buf, ret);
@@ -115,7 +119,7 @@ index 6014bca0ff2a..4548088e1922 100644
} else {
ret = -EOVERFLOW; /* Drop this HUGE one. */
}
-@@ -131,6 +145,8 @@ static int i2c_slave_mqueue_probe(struct i2c_client *client,
+@@ -131,6 +148,8 @@ static int i2c_slave_mqueue_probe(struct i2c_client *client,
BUILD_BUG_ON(!is_power_of_2(MQ_QUEUE_SIZE));
@@ -124,14 +128,13 @@ index 6014bca0ff2a..4548088e1922 100644
buf = devm_kmalloc_array(dev, MQ_QUEUE_SIZE, MQ_MSGBUF_SIZE,
GFP_KERNEL);
if (!buf)
-@@ -212,6 +228,12 @@ static struct i2c_driver i2c_slave_mqueue_driver = {
+@@ -212,6 +231,11 @@ static struct i2c_driver i2c_slave_mqueue_driver = {
};
module_i2c_driver(i2c_slave_mqueue_driver);
-+module_param_named(dump_debug, dump_debug, bool, S_IRUGO | S_IWUSR);
++module_param_named(dump_debug, dump_debug, bool, 0644);
+MODULE_PARM_DESC(dump_debug, "debug flag for dump printing");
-+module_param_named(dump_debug_bus_id, dump_debug_bus_id, int,
-+ S_IRUGO | S_IWUSR);
++module_param_named(dump_debug_bus_id, dump_debug_bus_id, int, 0644);
+MODULE_PARM_DESC(dump_debug_bus_id, "bus id for dump debug printing");
+
MODULE_LICENSE("GPL v2");
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch
index 8c9d2dce0..803701286 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0031-Add-high-speed-baud-rate-support-for-UART.patch
@@ -1,4 +1,4 @@
-From 7baa65c9bf638265874838401e27a7b6179559ff Mon Sep 17 00:00:00 2001
+From 01c8d6a5146cd39c2286f659e21f1a1042aa741a Mon Sep 17 00:00:00 2001
From: Yong Li <yong.b.li@linux.intel.com>
Date: Wed, 2 Jan 2019 15:06:43 +0800
Subject: [PATCH] Add high speed baud rate support for UART
@@ -19,7 +19,7 @@ Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c
-index 5961367..3bbb4fb 100644
+index 42b4df6ba249..97c27820db3e 100644
--- a/drivers/clk/clk-aspeed.c
+++ b/drivers/clk/clk-aspeed.c
@@ -14,7 +14,9 @@
@@ -46,7 +46,7 @@ index 5961367..3bbb4fb 100644
#define ASPEED_STRAP 0x70
#define CLKIN_25MHZ_EN BIT(23)
#define AST2400_CLK_SOURCE_SEL BIT(18)
-@@ -425,7 +433,7 @@ static int aspeed_clk_probe(struct platform_device *pdev)
+@@ -446,7 +454,7 @@ static int aspeed_clk_probe(struct platform_device *pdev)
struct aspeed_reset *ar;
struct regmap *map;
struct clk_hw *hw;
@@ -55,7 +55,7 @@ index 5961367..3bbb4fb 100644
int i, ret;
map = syscon_node_to_regmap(dev->of_node);
-@@ -460,15 +468,23 @@ static int aspeed_clk_probe(struct platform_device *pdev)
+@@ -481,15 +489,23 @@ static int aspeed_clk_probe(struct platform_device *pdev)
/* UART clock div13 setting */
regmap_read(map, ASPEED_MISC_CTRL, &val);
if (val & UART_DIV13_EN)
@@ -82,8 +82,8 @@ index 5961367..3bbb4fb 100644
/*
* Memory controller (M-PLL) PLL. This clock is configured by the
* bootloader, and is exposed to Linux as a read-only clock rate.
-@@ -534,9 +550,22 @@ static int aspeed_clk_probe(struct platform_device *pdev)
- * Video Engine (ECLK) mux and clock divider
+@@ -570,9 +586,22 @@ static int aspeed_clk_probe(struct platform_device *pdev)
+ * UART[1..5] clock source mux
*/
+ /* Get the uart clock source configuration from SCU4C*/
@@ -105,7 +105,7 @@ index 5961367..3bbb4fb 100644
/* Special case: the USB port 1 clock (bit 14) is always
* working the opposite way from the other ones.
-@@ -544,7 +573,7 @@ static int aspeed_clk_probe(struct platform_device *pdev)
+@@ -580,7 +609,7 @@ static int aspeed_clk_probe(struct platform_device *pdev)
gate_flags = (gd->clock_idx == 14) ? 0 : CLK_GATE_SET_TO_DISABLE;
hw = aspeed_clk_hw_register_gate(dev,
gd->name,
@@ -115,7 +115,7 @@ index 5961367..3bbb4fb 100644
map,
gd->clock_idx,
diff --git a/include/dt-bindings/clock/aspeed-clock.h b/include/dt-bindings/clock/aspeed-clock.h
-index f437386..3358795 100644
+index f43738607d77..335879505a72 100644
--- a/include/dt-bindings/clock/aspeed-clock.h
+++ b/include/dt-bindings/clock/aspeed-clock.h
@@ -39,6 +39,8 @@
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch
index e015f2fd9..8c18e87ef 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0032-misc-aspeed-Add-Aspeed-UART-routing-control-driver.patch
@@ -1,4 +1,4 @@
-From 37b192b278d5ea5da62b2fcff4fce7cf372e4fe6 Mon Sep 17 00:00:00 2001
+From 0928704f3b593217662f980221406fcf6db39377 Mon Sep 17 00:00:00 2001
From: Oskar Senft <osk@google.com>
Date: Wed, 8 Aug 2018 10:15:05 -0400
Subject: [PATCH] misc: aspeed: Add Aspeed UART routing control driver.
@@ -102,10 +102,10 @@ index 000000000000..afaf17cb7eda
+$ cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1
+io1 io2 io3 io4 uart2 [uart3] uart4 io6
diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts
-index 8aba46cdce46..d184fdf6dda6 100644
+index 4815104459f1..3094e90c9def 100644
--- a/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-intel-purley.dts
-@@ -227,6 +227,10 @@
+@@ -233,6 +233,10 @@
status = "okay";
};
@@ -117,10 +117,10 @@ index 8aba46cdce46..d184fdf6dda6 100644
status = "okay";
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index adde826ac1d9..5606ac1d96d5 100644
+index 0e7f1d2fa08e..6e0b40eb939f 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -479,6 +479,12 @@
+@@ -493,6 +493,12 @@
status = "disabled";
};
};
@@ -134,12 +134,12 @@ index adde826ac1d9..5606ac1d96d5 100644
peci: bus@1e78b000 {
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
-index 8b1fcf741411..60f203c04b9b 100644
+index b6acddaa9421..78e8fc892209 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
-@@ -560,6 +560,12 @@ config NPCM7XX_PCI_MBOX
- Expose the NPCM750/730/715/705 PCI MBOX registers found on
- Nuvoton SOCs to userspace.
+@@ -481,6 +481,12 @@ config ASPEED_ESPI_SLAVE
+ Control Aspeed ast2500 eSPI slave controller to handle event
+ which needs the firmware's processing.
+config ASPEED_UART_ROUTING
+ tristate "Aspeed ast2500 UART routing control"
@@ -147,21 +147,21 @@ index 8b1fcf741411..60f203c04b9b 100644
+ If you want to configure UART routing on Aspeed BMC platforms, enable
+ this option.
+
- source "drivers/misc/c2port/Kconfig"
- source "drivers/misc/eeprom/Kconfig"
- source "drivers/misc/cb710/Kconfig"
+ config PCI_ENDPOINT_TEST
+ depends on PCI
+ select CRC32
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
-index 89b051f82391..8f70b888a9ca 100644
+index f91f66a15484..7337b8bcd0a3 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
-@@ -56,6 +56,7 @@ obj-$(CONFIG_CXL_BASE) += cxl/
+@@ -55,6 +55,7 @@ obj-$(CONFIG_ECHO) += echo/
+ obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o
+ obj-$(CONFIG_CXL_BASE) += cxl/
obj-$(CONFIG_ASPEED_ESPI_SLAVE) += aspeed-espi-slave.o
- obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o
- obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
+obj-$(CONFIG_ASPEED_UART_ROUTING) += aspeed-uart-routing.o
- obj-$(CONFIG_ASPEED_LPC_MBOX) += aspeed-lpc-mbox.o
- obj-$(CONFIG_ASPEED_LPC_SIO) += aspeed-lpc-sio.o
obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o
+ obj-$(CONFIG_OCXL) += ocxl/
+ obj-y += cardreader/
diff --git a/drivers/misc/aspeed-uart-routing.c b/drivers/misc/aspeed-uart-routing.c
new file mode 100644
index 000000000000..21ef5d98c317
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch
index b819be69b..7f556de64 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0034-arm-dts-aspeed-Swap-the-mac-nodes-numbering.patch
@@ -1,4 +1,4 @@
-From 9c509b9450f641c169ee3aeb60e398c43810dcb2 Mon Sep 17 00:00:00 2001
+From fcea191a6e0eb869c62b5d1ea8a6e914a540fcfb Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Wed, 3 Oct 2018 10:17:58 -0700
Subject: [PATCH] arm: dts: aspeed: Swap the mac nodes numbering
@@ -13,7 +13,7 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index 22eab8a952ed..004bbb08dd4a 100644
+index 3df43f925848..618abeab539b 100644
--- a/arch/arm/boot/dts/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
@@ -101,14 +101,6 @@
@@ -47,10 +47,10 @@ index 22eab8a952ed..004bbb08dd4a 100644
compatible = "aspeed,ast2400-ehci", "generic-ehci";
reg = <0x1e6a1000 0x100>;
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index 92843cc1a8f4..30a7f349feeb 100644
+index 6e0b40eb939f..b8c85fad2a39 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -142,14 +142,6 @@
+@@ -149,14 +149,6 @@
reg = <0x1e6c2000 0x80>;
};
@@ -65,7 +65,7 @@ index 92843cc1a8f4..30a7f349feeb 100644
mac1: ethernet@1e680000 {
compatible = "aspeed,ast2500-mac", "faraday,ftgmac100";
reg = <0x1e680000 0x180>;
-@@ -158,6 +150,14 @@
+@@ -165,6 +157,14 @@
status = "disabled";
};
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0035-Implement-a-memory-driver-share-memory.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0035-Implement-a-memory-driver-share-memory.patch
index bb6465023..798038a8e 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0035-Implement-a-memory-driver-share-memory.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0035-Implement-a-memory-driver-share-memory.patch
@@ -1,4 +1,4 @@
-From dae410353f8681b58907c61eb2eb056513d86f6d Mon Sep 17 00:00:00 2001
+From 5ccf8e3e397edf195aa65e91af6e9ea16ed88882 Mon Sep 17 00:00:00 2001
From: Cheng C Yang <cheng.c.yang@intel.com>
Date: Fri, 9 Nov 2018 10:24:37 +0800
Subject: [PATCH] Implement a memory driver share memory
@@ -10,19 +10,19 @@ memory through this driver.
Signed-off-by: Cheng C Yang <cheng.c.yang@intel.com>
---
- .../devicetree/bindings/misc/vga-shared-memory.txt | 20 +++
- drivers/misc/Kconfig | 10 ++
- drivers/misc/Makefile | 1 +
- drivers/misc/aspeed-vga-sharedmem.c | 164 +++++++++++++++++++++
- 4 files changed, 195 insertions(+)
- create mode 100644 Documentation/devicetree/bindings/misc/vga-shared-memory.txt
- create mode 100644 drivers/misc/aspeed-vga-sharedmem.c
+ .../bindings/soc/aspeed/aspeed-vga-sharedmem.txt | 20 +++
+ drivers/soc/aspeed/Kconfig | 9 ++
+ drivers/soc/aspeed/Makefile | 1 +
+ drivers/soc/aspeed/aspeed-vga-sharedmem.c | 163 +++++++++++++++++++++
+ 4 files changed, 193 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/soc/aspeed/aspeed-vga-sharedmem.txt
+ create mode 100644 drivers/soc/aspeed/aspeed-vga-sharedmem.c
-diff --git a/Documentation/devicetree/bindings/misc/vga-shared-memory.txt b/Documentation/devicetree/bindings/misc/vga-shared-memory.txt
+diff --git a/Documentation/devicetree/bindings/soc/aspeed/aspeed-vga-sharedmem.txt b/Documentation/devicetree/bindings/soc/aspeed/aspeed-vga-sharedmem.txt
new file mode 100644
index 000000000000..03f57c53e844
--- /dev/null
-+++ b/Documentation/devicetree/bindings/misc/vga-shared-memory.txt
++++ b/Documentation/devicetree/bindings/soc/aspeed/aspeed-vga-sharedmem.txt
@@ -0,0 +1,20 @@
+* Aspeed VGA shared memory driver
+
@@ -44,45 +44,40 @@ index 000000000000..03f57c53e844
+ compatible = "aspeed,ast2500-vga-sharedmem";
+ reg = <0x9ff00000 0x100000>;
+};
-diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
-index 60f203c04b9b..2d4c6ba87e70 100644
---- a/drivers/misc/Kconfig
-+++ b/drivers/misc/Kconfig
-@@ -566,6 +566,16 @@ config ASPEED_UART_ROUTING
- If you want to configure UART routing on Aspeed BMC platforms, enable
- this option.
+diff --git a/drivers/soc/aspeed/Kconfig b/drivers/soc/aspeed/Kconfig
+index 285c19042c65..59f25d16d6e7 100644
+--- a/drivers/soc/aspeed/Kconfig
++++ b/drivers/soc/aspeed/Kconfig
+@@ -51,4 +51,13 @@ config ASPEED_P2A_CTRL
+ ioctl()s, the driver also provides an interface for userspace mappings to
+ a pre-defined region.
+config ASPEED_VGA_SHAREDMEM
+ tristate "Aspeed VGA Shared memory"
-+ depends on (ARCH_ASPEED || COMPILE_TEST)
++ depends on SOC_ASPEED
+ help
+ To access VGA shared memory on Aspeed BMC, enable this option.
+ This driver used by ManagedDataRegionlV2 specification. In the
-+ specification, BIOS will transfer whole SMBIOS table to VGA
-+ memory, and BMC can get the table from VGA memory through this
-+ driver.
-+
- source "drivers/misc/c2port/Kconfig"
- source "drivers/misc/eeprom/Kconfig"
- source "drivers/misc/cb710/Kconfig"
-diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
-index 8f70b888a9ca..30ee065491ef 100644
---- a/drivers/misc/Makefile
-+++ b/drivers/misc/Makefile
-@@ -55,6 +55,7 @@ obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpres
- obj-$(CONFIG_CXL_BASE) += cxl/
++ specification, BIOS will transfer whole SMBIOS table to VGA memory,
++ and BMC can get the table from VGA memory through this driver.
++
+ endmenu
+diff --git a/drivers/soc/aspeed/Makefile b/drivers/soc/aspeed/Makefile
+index 2e547cc47e62..ae4ef10914be 100644
+--- a/drivers/soc/aspeed/Makefile
++++ b/drivers/soc/aspeed/Makefile
+@@ -5,3 +5,4 @@ obj-$(CONFIG_ASPEED_LPC_MBOX) += aspeed-lpc-mbox.o
obj-$(CONFIG_ASPEED_LPC_SIO) += aspeed-lpc-sio.o
- obj-$(CONFIG_ASPEED_ESPI_SLAVE) += aspeed-espi-slave.o
-+obj-$(CONFIG_ASPEED_VGA_SHAREDMEM) += aspeed-vga-sharedmem.o
- obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o
obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
- obj-$(CONFIG_ASPEED_UART_ROUTING) += aspeed-uart-routing.o
-diff --git a/drivers/misc/aspeed-vga-sharedmem.c b/drivers/misc/aspeed-vga-sharedmem.c
+ obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o
++obj-$(CONFIG_ASPEED_VGA_SHAREDMEM) += aspeed-vga-sharedmem.o
+\ No newline at end of file
+diff --git a/drivers/soc/aspeed/aspeed-vga-sharedmem.c b/drivers/soc/aspeed/aspeed-vga-sharedmem.c
new file mode 100644
-index 000000000000..76f60cd67d3a
+index 000000000000..cd1f5431378c
--- /dev/null
-+++ b/drivers/misc/aspeed-vga-sharedmem.c
-@@ -0,0 +1,164 @@
++++ b/drivers/soc/aspeed/aspeed-vga-sharedmem.c
+@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018 Intel Corporation
@@ -112,11 +107,11 @@ index 000000000000..76f60cd67d3a
+
+static int vga_open(struct inode *inode, struct file *file)
+{
++ struct aspeed_vga_sharedmem *vga_sharedmem = file_sharemem(file);
++
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
-+ struct aspeed_vga_sharedmem *vga_sharedmem = file_sharemem(file);
-+
+ if (!vga_sharedmem->mmap_enable)
+ return -EPERM;
+
@@ -193,7 +188,6 @@ index 000000000000..76f60cd67d3a
+{
+ struct aspeed_vga_sharedmem *vga_sharedmem;
+ struct device *dev = &pdev->dev;
-+ u32 reg[2];
+ struct resource *rc;
+
+ vga_sharedmem = devm_kzalloc(dev, sizeof(*vga_sharedmem), GFP_KERNEL);
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch
index 3e8f86666..c115d23d0 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch
@@ -1,4 +1,4 @@
-From ef2e1d9d2e8c97daf806f4da74738a84de054116 Mon Sep 17 00:00:00 2001
+From 7ac4709dd92c608ca4c8ff0046a434c8f465a80c Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Mon, 11 Feb 2019 17:02:35 -0800
Subject: [PATCH] Add Aspeed PWM driver which uses FTTMR010 timer IP
@@ -13,15 +13,15 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
arch/arm/boot/dts/aspeed-g5.dtsi | 2 +-
drivers/pwm/Kconfig | 9 +
drivers/pwm/Makefile | 1 +
- drivers/pwm/pwm-fttmr010.c | 437 +++++++++++++++++++++++++++++++++++++++
- 4 files changed, 448 insertions(+), 1 deletion(-)
+ drivers/pwm/pwm-fttmr010.c | 441 +++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 452 insertions(+), 1 deletion(-)
create mode 100644 drivers/pwm/pwm-fttmr010.c
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index 8a7c4257b917..c24197232385 100644
+index b8c85fad2a39..88ac8e08b6ae 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -300,7 +300,7 @@
+@@ -312,7 +312,7 @@
timer: timer@1e782000 {
/* This timer is a Faraday FTTMR010 derivative */
@@ -31,10 +31,10 @@ index 8a7c4257b917..c24197232385 100644
interrupts = <16 17 18 35 36 37 38 39>;
clocks = <&syscon ASPEED_CLK_APB>;
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
-index a8f47df0655a..92a8fbebe2d9 100644
+index dff5a93f7daa..5759439a3947 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
-@@ -170,6 +170,15 @@ config PWM_FSL_FTM
+@@ -171,6 +171,15 @@ config PWM_FSL_FTM
To compile this driver as a module, choose M here: the module
will be called pwm-fsl-ftm.
@@ -51,7 +51,7 @@ index a8f47df0655a..92a8fbebe2d9 100644
tristate "HiSilicon BVT PWM support"
depends on ARCH_HISI || COMPILE_TEST
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
-index 9c676a0dadf5..13b7b20ad5ab 100644
+index c368599d36c0..937d212bb02a 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_PWM_CRC) += pwm-crc.o
@@ -61,13 +61,13 @@ index 9c676a0dadf5..13b7b20ad5ab 100644
+obj-$(CONFIG_PWM_FTTMR010) += pwm-fttmr010.o
obj-$(CONFIG_PWM_HIBVT) += pwm-hibvt.o
obj-$(CONFIG_PWM_IMG) += pwm-img.o
- obj-$(CONFIG_PWM_IMX) += pwm-imx.o
+ obj-$(CONFIG_PWM_IMX1) += pwm-imx1.o
diff --git a/drivers/pwm/pwm-fttmr010.c b/drivers/pwm/pwm-fttmr010.c
new file mode 100644
-index 000000000000..32e508c962dc
+index 000000000000..4c929a25e27c
--- /dev/null
+++ b/drivers/pwm/pwm-fttmr010.c
-@@ -0,0 +1,437 @@
+@@ -0,0 +1,441 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2019 Intel Corporation
+
@@ -192,7 +192,6 @@ index 000000000000..32e508c962dc
+static int pwm_fttmr010_enable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+ struct pwm_fttmr010 *priv = to_pwm_fttmr010(chip);
-+ ulong flags;
+ u32 cr;
+
+ cr = readl(priv->base + TIMER_CR);
@@ -210,6 +209,8 @@ index 000000000000..32e508c962dc
+ case 8:
+ cr |= (TIMER_8_CR_ASPEED_ENABLE | TIMER_8_CR_ASPEED_PULSE_OUT);
+ break;
++ default:
++ return -ERANGE;
+ }
+
+ writel(cr, priv->base + TIMER_CR);
@@ -221,7 +222,6 @@ index 000000000000..32e508c962dc
+static void pwm_fttmr010_disable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+ struct pwm_fttmr010 *priv = to_pwm_fttmr010(chip);
-+ ulong flags;
+ u32 cr;
+
+ cr = readl(priv->base + TIMER_CR);
@@ -239,6 +239,8 @@ index 000000000000..32e508c962dc
+ case 8:
+ cr &= ~(TIMER_8_CR_ASPEED_ENABLE | TIMER_8_CR_ASPEED_PULSE_OUT);
+ break;
++ default:
++ return;
+ }
+
+ writel(cr, priv->base + TIMER_CR);
@@ -309,6 +311,8 @@ index 000000000000..32e508c962dc
+ lreg_offset = TIMER8_ASPEED_LOAD;
+ mreg_offset = TIMER8_ASPEED_MATCH1;
+ break;
++ default:
++ return -ERANGE;
+ }
+
+ writel(tload, priv->base + creg_offset);
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch
index 1b86e9c04..b2057d247 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0040-i2c-Add-mux-hold-unhold-msg-types.patch
@@ -1,4 +1,4 @@
-From 80ea6461d77e5b415d9f83fa2f4708fc21eab09b Mon Sep 17 00:00:00 2001
+From ed13e7eb07e6cb8bdc1eb4563de30b469a9beb26 Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Fri, 15 Feb 2019 16:05:09 -0800
Subject: [PATCH] i2c: Add mux hold/unhold msg types
@@ -39,19 +39,19 @@ in downstream only.
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
- drivers/i2c/i2c-core-base.c | 99 ++++++++++++++++++++++++++++++++++-----
- drivers/i2c/i2c-core-smbus.c | 17 ++++++-
+ drivers/i2c/i2c-core-base.c | 70 +++++++++++++++++++++++++--
+ drivers/i2c/i2c-core-smbus.c | 22 +++++++--
drivers/i2c/i2c-mux.c | 109 +++++++++++++++++++++++++++++++++++++++----
include/linux/i2c-mux.h | 3 ++
include/linux/i2c.h | 25 ++++++++++
include/uapi/linux/i2c.h | 1 +
- 6 files changed, 233 insertions(+), 21 deletions(-)
+ 6 files changed, 214 insertions(+), 16 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
-index 28460f6a60cc..009b0507768e 100644
+index 9e43508d4567..8a480d269542 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
-@@ -1210,6 +1210,25 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr)
+@@ -1299,6 +1299,25 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr)
}
EXPORT_SYMBOL_GPL(i2c_handle_smbus_host_notify);
@@ -77,7 +77,7 @@ index 28460f6a60cc..009b0507768e 100644
static int i2c_register_adapter(struct i2c_adapter *adap)
{
int res = -EINVAL;
-@@ -1291,6 +1310,9 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
+@@ -1381,6 +1400,9 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter);
mutex_unlock(&core_lock);
@@ -87,7 +87,7 @@ index 28460f6a60cc..009b0507768e 100644
return 0;
out_reg:
-@@ -1511,6 +1533,8 @@ void i2c_del_adapter(struct i2c_adapter *adap)
+@@ -1601,6 +1623,8 @@ void i2c_del_adapter(struct i2c_adapter *adap)
idr_remove(&i2c_adapter_idr, adap->nr);
mutex_unlock(&core_lock);
@@ -96,7 +96,7 @@ index 28460f6a60cc..009b0507768e 100644
/* Clear the device structure in case this adapter is ever going to be
added again */
memset(&adap->dev, 0, sizeof(adap->dev));
-@@ -1860,7 +1884,9 @@ static int i2c_check_for_quirks(struct i2c_adapter *adap, struct i2c_msg *msgs,
+@@ -1950,7 +1974,9 @@ static int i2c_check_for_quirks(struct i2c_adapter *adap, struct i2c_msg *msgs,
*/
int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
{
@@ -106,7 +106,7 @@ index 28460f6a60cc..009b0507768e 100644
int ret, try;
if (WARN_ON(!msgs || num < 1))
-@@ -1869,6 +1895,25 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+@@ -1963,6 +1989,25 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
if (adap->quirks && i2c_check_for_quirks(adap, msgs, num))
return -EOPNOTSUPP;
@@ -132,7 +132,7 @@ index 28460f6a60cc..009b0507768e 100644
/*
* i2c_trace_msg_key gets enabled when tracepoint i2c_transfer gets
* enabled. This is an efficient way of keeping the for-loop from
-@@ -1901,6 +1946,9 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+@@ -1999,6 +2044,9 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
trace_i2c_result(adap, num, ret);
}
@@ -142,7 +142,7 @@ index 28460f6a60cc..009b0507768e 100644
return ret;
}
EXPORT_SYMBOL(__i2c_transfer);
-@@ -1919,6 +1967,7 @@ EXPORT_SYMBOL(__i2c_transfer);
+@@ -2017,6 +2065,7 @@ EXPORT_SYMBOL(__i2c_transfer);
*/
int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
{
@@ -150,77 +150,50 @@ index 28460f6a60cc..009b0507768e 100644
int ret;
if (!adap->algo->master_xfer) {
-@@ -1942,19 +1991,47 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+@@ -2040,12 +2089,25 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
* one (discarding status on the second message) or errno
* (discarding status on the first one).
*/
-- if (in_atomic() || irqs_disabled()) {
-- ret = i2c_trylock_bus(adap, I2C_LOCK_SEGMENT);
-- if (!ret)
-- /* I2C activity is ongoing. */
-- return -EAGAIN;
-- } else {
-- i2c_lock_bus(adap, I2C_LOCK_SEGMENT);
-- }
-
-- ret = __i2c_transfer(adap, msgs, num);
-- i2c_unlock_bus(adap, I2C_LOCK_SEGMENT);
-+ if (adap->algo->master_xfer) {
-+#ifdef DEBUG
-+ for (ret = 0; ret < num; ret++) {
-+ dev_dbg(&adap->dev,
-+ "master_xfer[%d] %c, addr=0x%02x, len=%d%s\n",
-+ ret, (msgs[ret].flags & I2C_M_RD) ? 'R' : 'W',
-+ msgs[ret].addr, msgs[ret].len,
-+ (msgs[ret].flags & I2C_M_RECV_LEN) ? "+" : "");
-+ }
-+#endif
-+ /*
-+ * Do not lock a bus for delivering an unhold msg to a mux
-+ * adpater. This is just for a single length unhold msg case.
-+ */
-+ if (num == 1 && i2c_parent_is_i2c_adapter(adap) &&
-+ i2c_check_hold_msg(msgs[0].flags, msgs[0].len,
-+ (u16 *)msgs[0].buf) ==
-+ I2C_HOLD_MSG_RESET)
-+ do_bus_lock = false;
-+
-+ if (do_bus_lock) {
-+ if (in_atomic() || irqs_disabled()) {
-+ ret = i2c_trylock_bus(adap, I2C_LOCK_SEGMENT);
-+ if (!ret)
-+ /* I2C activity is ongoing. */
-+ return -EAGAIN;
-+ } else {
-+ i2c_lock_bus(adap, I2C_LOCK_SEGMENT);
-+ }
-+ }
-
-- return ret;
-+ ret = __i2c_transfer(adap, msgs, num);
-+ if (do_bus_lock)
-+ i2c_unlock_bus(adap, I2C_LOCK_SEGMENT);
+- ret = __i2c_lock_bus_helper(adap);
+- if (ret)
+- return ret;
++ /*
++ * Do not lock a bus for delivering an unhold msg to a mux
++ * adpater. This is just for a single length unhold msg case.
++ */
++ if (num == 1 && i2c_parent_is_i2c_adapter(adap) &&
++ i2c_check_hold_msg(msgs[0].flags, msgs[0].len,
++ (u16 *)msgs[0].buf) ==
++ I2C_HOLD_MSG_RESET)
++ do_bus_lock = false;
+
-+ return ret;
-+ } else {
-+ dev_dbg(&adap->dev, "I2C level transfers not supported\n");
-+ return -EOPNOTSUPP;
++ if (do_bus_lock) {
++ ret = __i2c_lock_bus_helper(adap);
++ if (ret)
++ return ret;
+ }
- }
- EXPORT_SYMBOL(i2c_transfer);
+ ret = __i2c_transfer(adap, msgs, num);
+- i2c_unlock_bus(adap, I2C_LOCK_SEGMENT);
++ if (do_bus_lock)
++ i2c_unlock_bus(adap, I2C_LOCK_SEGMENT);
+
+ return ret;
+ }
diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c
-index 9cd66cabb84f..64c58911bf21 100644
+index 3ac426a8ab5a..f7bf95101e34 100644
--- a/drivers/i2c/i2c-core-smbus.c
+++ b/drivers/i2c/i2c-core-smbus.c
-@@ -528,12 +528,25 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
+@@ -526,15 +526,29 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
unsigned short flags, char read_write,
u8 command, int protocol, union i2c_smbus_data *data)
{
+ bool do_bus_lock = true;
s32 res;
-- i2c_lock_bus(adapter, I2C_LOCK_SEGMENT);
+- res = __i2c_lock_bus_helper(adapter);
+- if (res)
+- return res;
+ /*
+ * Do not lock a bus for delivering an unhold msg to a mux adpater.
+ * This is just for a single length unhold msg case.
@@ -231,8 +204,12 @@ index 9cd66cabb84f..64c58911bf21 100644
+ &data->word) == I2C_HOLD_MSG_RESET)
+ do_bus_lock = false;
+
-+ if (do_bus_lock)
-+ i2c_lock_bus(adapter, I2C_LOCK_SEGMENT);
++ if (do_bus_lock) {
++ res = __i2c_lock_bus_helper(adapter);
++ if (res)
++ return res;
++ }
+
res = __i2c_smbus_xfer(adapter, addr, flags, read_write,
command, protocol, data);
- i2c_unlock_bus(adapter, I2C_LOCK_SEGMENT);
@@ -242,7 +219,7 @@ index 9cd66cabb84f..64c58911bf21 100644
return res;
}
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
-index f330690b4125..4d8909a0f90a 100644
+index 603252fa1284..d3f55243e701 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -26,6 +26,7 @@
@@ -430,7 +407,7 @@ index f330690b4125..4d8909a0f90a 100644
return muxc;
}
EXPORT_SYMBOL_GPL(i2c_mux_alloc);
-@@ -435,6 +526,8 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc)
+@@ -441,6 +532,8 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc)
{
char symlink_name[20];
@@ -440,10 +417,10 @@ index f330690b4125..4d8909a0f90a 100644
struct i2c_adapter *adap = muxc->adapter[--muxc->num_adapters];
struct i2c_mux_priv *priv = adap->algo_data;
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
-index bd74d5706f3b..bc6f778eaf9d 100644
+index c5a977320f82..47f8763d6ed2 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
-@@ -41,6 +41,9 @@ struct i2c_mux_core {
+@@ -27,6 +27,9 @@ struct i2c_mux_core {
int (*select)(struct i2c_mux_core *, u32 chan_id);
int (*deselect)(struct i2c_mux_core *, u32 chan_id);
@@ -454,10 +431,10 @@ index bd74d5706f3b..bc6f778eaf9d 100644
int max_adapters;
struct i2c_adapter *adapter[0];
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
-index 65b4eaed1d96..eadde70c0d4a 100644
+index 1308126fc384..3ee92c6a442d 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
-@@ -692,6 +692,13 @@ struct i2c_adapter {
+@@ -699,6 +699,13 @@ struct i2c_adapter {
const struct i2c_adapter_quirks *quirks;
struct irq_domain *host_notify_domain;
@@ -471,7 +448,7 @@ index 65b4eaed1d96..eadde70c0d4a 100644
};
#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
-@@ -949,4 +956,22 @@ static inline struct i2c_client *i2c_acpi_new_device(struct device *dev,
+@@ -998,4 +1005,22 @@ static inline struct i2c_client *i2c_acpi_new_device(struct device *dev,
}
#endif /* CONFIG_ACPI */
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0041-Enable-passthrough-based-gpio-character-device.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0041-Enable-passthrough-based-gpio-character-device.patch
deleted file mode 100644
index 7a4b090ec..000000000
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0041-Enable-passthrough-based-gpio-character-device.patch
+++ /dev/null
@@ -1,287 +0,0 @@
-From 554bc7a7c7aa6e0c0ec49a24063102e17954d06c Mon Sep 17 00:00:00 2001
-From: Kuiying Wang <kuiying.wang@intel.com>
-Date: Thu, 31 Jan 2019 17:47:39 +0800
-Subject: [PATCH] Enable passthrough based gpio character device.
-
-Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
----
- drivers/gpio/gpio-aspeed.c | 47 ++++++++++++++++++++++++++++--
- drivers/gpio/gpiolib.c | 51 +++++++++++++++++++++++++++++++--
- drivers/gpio/gpiolib.h | 1 +
- include/linux/gpio/consumer.h | 9 ++++++
- include/linux/pinctrl/pinconf-generic.h | 2 ++
- include/uapi/linux/gpio.h | 1 +
- 6 files changed, 106 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
-index 854bce4fb9e7..5f1bce3a9274 100644
---- a/drivers/gpio/gpio-aspeed.c
-+++ b/drivers/gpio/gpio-aspeed.c
-@@ -17,9 +17,11 @@
- #include <linux/init.h>
- #include <linux/io.h>
- #include <linux/kernel.h>
-+#include <linux/mfd/syscon.h>
- #include <linux/module.h>
- #include <linux/pinctrl/consumer.h>
- #include <linux/platform_device.h>
-+#include <linux/regmap.h>
- #include <linux/spinlock.h>
- #include <linux/string.h>
-
-@@ -58,6 +60,7 @@ struct aspeed_gpio {
- struct gpio_chip chip;
- spinlock_t lock;
- void __iomem *base;
-+ struct regmap *scu;
- int irq;
- const struct aspeed_gpio_config *config;
-
-@@ -91,6 +94,13 @@ struct aspeed_gpio_bank {
- * and thus can be used to read back what was last written
- * reliably.
- */
-+#define SCU8C 0x8C /* Multi-function Pin Control #4 */
-+#define PASS_THROUGH1 32
-+#define PASS_THROUGH2 34
-+#define PASS_THROUGH2_MASK 0x2000
-+#define PASS_THROUGH1_MASK 0x1000
-+#define PASS_THROUGH2_ON 0x2000
-+#define PASS_THROUGH1_ON 0x1000
-
- static const int debounce_timers[4] = { 0x00, 0x50, 0x54, 0x58 };
-
-@@ -988,12 +998,38 @@ static int set_debounce(struct gpio_chip *chip, unsigned int offset,
- return disable_debounce(chip, offset);
- }
-
-+static int aspeed_gpio_pass_through(struct gpio_chip *chip, unsigned int offset,
-+ unsigned long param)
-+{
-+ struct aspeed_gpio *gpio = gpiochip_get_data(chip);
-+ u32 value;
-+
-+ if (!gpio->scu)
-+ return -ENOTSUPP;
-+ if (param == PIN_CONFIG_PASS_THROUGH_ENABLE){
-+ if (offset == PASS_THROUGH2){
-+ regmap_update_bits(gpio->scu, SCU8C, PASS_THROUGH2_MASK, PASS_THROUGH2_ON);
-+ } else if (offset == PASS_THROUGH1){
-+ regmap_update_bits(gpio->scu, SCU8C, PASS_THROUGH1_MASK, PASS_THROUGH1_ON);
-+ }
-+ } else if (param == PIN_CONFIG_PASS_THROUGH_DISABLE){
-+ if (offset == PASS_THROUGH2){
-+ regmap_update_bits(gpio->scu, SCU8C, PASS_THROUGH2_MASK, ~(PASS_THROUGH2_ON));
-+ } else if (offset == PASS_THROUGH1){
-+ regmap_update_bits(gpio->scu, SCU8C, PASS_THROUGH1_MASK, ~(PASS_THROUGH1_ON));
-+ }
-+ } else {
-+ return -ENOTSUPP;
-+ }
-+
-+ return 0;
-+}
-+
- static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
- unsigned long config)
- {
- unsigned long param = pinconf_to_config_param(config);
- u32 arg = pinconf_to_config_argument(config);
--
- if (param == PIN_CONFIG_INPUT_DEBOUNCE)
- return set_debounce(chip, offset, arg);
- else if (param == PIN_CONFIG_BIAS_DISABLE ||
-@@ -1006,6 +1042,9 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
- return -ENOTSUPP;
- else if (param == PIN_CONFIG_PERSIST_STATE)
- return aspeed_gpio_reset_tolerance(chip, offset, arg);
-+ else if (param == PIN_CONFIG_PASS_THROUGH_ENABLE ||
-+ param == PIN_CONFIG_PASS_THROUGH_DISABLE)
-+ return aspeed_gpio_pass_through(chip, offset, param);
-
- return -ENOTSUPP;
- }
-@@ -1167,7 +1206,11 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
- gpio->base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(gpio->base))
- return PTR_ERR(gpio->base);
--
-+ gpio->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2500-scu");
-+ if (IS_ERR(gpio->scu)) {
-+ dev_err(&pdev->dev, "Failed to find SCU regmap\n");
-+ gpio->scu = NULL;
-+ }
- spin_lock_init(&gpio->lock);
-
- gpio_id = of_match_node(aspeed_gpio_of_table, pdev->dev.of_node);
-diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
-index d1adfdf50fb3..4f9fdd25c6d7 100644
---- a/drivers/gpio/gpiolib.c
-+++ b/drivers/gpio/gpiolib.c
-@@ -428,6 +428,7 @@ struct linehandle_state {
- GPIOHANDLE_REQUEST_OUTPUT | \
- GPIOHANDLE_REQUEST_ACTIVE_LOW | \
- GPIOHANDLE_REQUEST_OPEN_DRAIN | \
-+ GPIOHANDLE_REQUEST_PASS_THROUGH | \
- GPIOHANDLE_REQUEST_OPEN_SOURCE)
-
- static long linehandle_ioctl(struct file *filep, unsigned int cmd,
-@@ -530,7 +531,6 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
- return -EINVAL;
-
- lflags = handlereq.flags;
--
- /* Return an error if an unknown flag is set */
- if (lflags & ~GPIOHANDLE_REQUEST_VALID_FLAGS)
- return -EINVAL;
-@@ -590,6 +590,8 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
- set_bit(FLAG_OPEN_DRAIN, &desc->flags);
- if (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE)
- set_bit(FLAG_OPEN_SOURCE, &desc->flags);
-+ if (lflags & GPIOHANDLE_REQUEST_PASS_THROUGH)
-+ set_bit(FLAG_PASS_THROUGH, &desc->flags);
-
- ret = gpiod_set_transitory(desc, false);
- if (ret < 0)
-@@ -609,6 +611,11 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
- ret = gpiod_direction_input(desc);
- if (ret)
- goto out_free_descs;
-+ } else if (lflags & GPIOHANDLE_REQUEST_PASS_THROUGH) {
-+ int val = !!handlereq.default_values[i];
-+ ret = gpiod_direction_pass_through(desc, val);
-+ if (ret)
-+ goto out_free_descs;
- }
- dev_dbg(&gdev->dev, "registered chardev handle for line %d\n",
- offset);
-@@ -1027,7 +1034,6 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
- struct gpio_device *gdev = filp->private_data;
- struct gpio_chip *chip = gdev->chip;
- void __user *ip = (void __user *)arg;
--
- /* We fail any subsequent ioctl():s when the chip is gone */
- if (!chip)
- return -ENODEV;
-@@ -1035,7 +1041,6 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
- /* Fill in the struct and pass to userspace */
- if (cmd == GPIO_GET_CHIPINFO_IOCTL) {
- struct gpiochip_info chipinfo;
--
- memset(&chipinfo, 0, sizeof(chipinfo));
-
- strncpy(chipinfo.name, dev_name(&gdev->dev),
-@@ -2709,6 +2714,46 @@ int gpiod_direction_output(struct gpio_desc *desc, int value)
- EXPORT_SYMBOL_GPL(gpiod_direction_output);
-
- /**
-+ * gpiod_direction_pass_through - set the GPIO direction to pass-through
-+ * @desc: GPIO to set to pass-through
-+ *
-+ * Set the direction of the passed GPIO to passthrough.
-+ *
-+ * Return 0 in case of success, else an error code.
-+ */
-+int gpiod_direction_pass_through(struct gpio_desc *desc, int val)
-+{
-+ struct gpio_chip *gc;
-+
-+ VALIDATE_DESC(desc);
-+ /* GPIOs used for IRQs shall not be set as pass-through */
-+ if (test_bit(FLAG_USED_AS_IRQ, &desc->flags)) {
-+ gpiod_err(desc,
-+ "%s: tried to set a GPIO tied to an IRQ as pass-through\n",
-+ __func__);
-+ return -EIO;
-+ }
-+ gc = desc->gdev->chip;
-+ val = !!val;
-+ if (test_bit(FLAG_PASS_THROUGH, &desc->flags)) {
-+ if (val)
-+ gpio_set_config(gc, gpio_chip_hwgpio(desc),
-+ PIN_CONFIG_PASS_THROUGH_ENABLE);
-+ else
-+ gpio_set_config(gc, gpio_chip_hwgpio(desc),
-+ PIN_CONFIG_PASS_THROUGH_DISABLE);
-+ } else {
-+ gpiod_err(desc,
-+ "%s: desc->flags is not set to FLAG_PASS_THROUGH\n",
-+ __func__);
-+ return -EIO;
-+ }
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(gpiod_direction_pass_through);
-+
-+/**
- * gpiod_set_debounce - sets @debounce time for a GPIO
- * @desc: descriptor of the GPIO for which to set debounce time
- * @debounce: debounce time in microseconds
-diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
-index bc57f0dc5953..a821a04fc04b 100644
---- a/drivers/gpio/gpiolib.h
-+++ b/drivers/gpio/gpiolib.h
-@@ -212,6 +212,7 @@ struct gpio_desc {
- #define FLAG_IS_OUT 1
- #define FLAG_EXPORT 2 /* protected by sysfs_lock */
- #define FLAG_SYSFS 3 /* exported via /sys/class/gpio/control */
-+#define FLAG_PASS_THROUGH 4 /*Gpio is passthrough type*/
- #define FLAG_ACTIVE_LOW 6 /* value has active low */
- #define FLAG_OPEN_DRAIN 7 /* Gpio is open drain type */
- #define FLAG_OPEN_SOURCE 8 /* Gpio is open source type */
-diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
-index 9ddcf50a3c59..f9775be5a46a 100644
---- a/include/linux/gpio/consumer.h
-+++ b/include/linux/gpio/consumer.h
-@@ -110,6 +110,7 @@ void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs);
- int gpiod_get_direction(struct gpio_desc *desc);
- int gpiod_direction_input(struct gpio_desc *desc);
- int gpiod_direction_output(struct gpio_desc *desc, int value);
-+int gpiod_direction_pass_through(struct gpio_desc *desc, int val);
- int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
-
- /* Value get/set from non-sleeping context */
-@@ -348,6 +349,14 @@ static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
- WARN_ON(1);
- return -ENOSYS;
- }
-+
-+static inline int gpiod_direction_pass_through(struct gpio_desc *desc, int val)
-+{
-+ /* GPIO can never have been requested */
-+ WARN_ON(1);
-+ return -ENOSYS;
-+}
-+
- static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
- {
- /* GPIO can never have been requested */
-diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
-index 6c0680641108..59f0cbabb685 100644
---- a/include/linux/pinctrl/pinconf-generic.h
-+++ b/include/linux/pinctrl/pinconf-generic.h
-@@ -124,6 +124,8 @@ enum pin_config_param {
- PIN_CONFIG_SLEW_RATE,
- PIN_CONFIG_SKEW_DELAY,
- PIN_CONFIG_PERSIST_STATE,
-+ PIN_CONFIG_PASS_THROUGH_ENABLE,
-+ PIN_CONFIG_PASS_THROUGH_DISABLE,
- PIN_CONFIG_END = 0x7F,
- PIN_CONFIG_MAX = 0xFF,
- };
-diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h
-index 4ebfe0ac6c5b..99864572b7d9 100644
---- a/include/uapi/linux/gpio.h
-+++ b/include/uapi/linux/gpio.h
-@@ -62,6 +62,7 @@ struct gpioline_info {
- #define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2)
- #define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3)
- #define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4)
-+#define GPIOHANDLE_REQUEST_PASS_THROUGH (1UL << 5)
-
- /**
- * struct gpiohandle_request - Information about a GPIO handle request
---
-2.7.4
-
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch
index 3588d62d9..25f494652 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch
@@ -1,4 +1,4 @@
-From 6515a2134f90f33dbbea8ede5de598d17bb00c12 Mon Sep 17 00:00:00 2001
+From c55d6bb49cfbd39a7c0848076c84166def65936e Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Thu, 7 Mar 2019 15:17:40 -0800
Subject: [PATCH] Add bus-timeout-ms and #retries device tree properties
@@ -59,10 +59,10 @@ index 44efafdfd7f5..e382931cf3d6 100644
used by the device. I2C core will assign "irq" interrupt (or the very first
interrupt if not using interrupt names) as primary interrupt for the slave.
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
-index 506d867b43d9..84237c5d0aca 100644
+index 434b753def3b..99bd30953531 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
-@@ -1012,7 +1012,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
+@@ -1014,7 +1014,6 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
spin_lock_init(&bus->lock);
init_completion(&bus->cmd_complete);
bus->adap.owner = THIS_MODULE;
@@ -71,10 +71,10 @@ index 506d867b43d9..84237c5d0aca 100644
bus->adap.dev.parent = &pdev->dev;
bus->adap.dev.of_node = pdev->dev.of_node;
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
-index 009b0507768e..386aa2dad908 100644
+index 8a480d269542..69b798a2d31e 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
-@@ -1231,6 +1231,7 @@ static void i2c_adapter_hold_timer_callback(struct timer_list *t)
+@@ -1320,6 +1320,7 @@ static void i2c_adapter_hold_timer_callback(struct timer_list *t)
static int i2c_register_adapter(struct i2c_adapter *adap)
{
@@ -82,7 +82,7 @@ index 009b0507768e..386aa2dad908 100644
int res = -EINVAL;
/* Can't register until after driver model init */
-@@ -1257,8 +1258,15 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
+@@ -1347,8 +1348,15 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
INIT_LIST_HEAD(&adap->userspace_clients);
/* Set default timeout to 1 second if not already set */
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch
index f04824c0e..035945cf3 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch
@@ -1,4 +1,4 @@
-From d82aacea62f2cc3f5c4f6654bd8920255edf24fd Mon Sep 17 00:00:00 2001
+From c4e7b89ee20dc28e10fae7eb0859e4fa9d3e8643 Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Wed, 13 Mar 2019 15:04:16 -0700
Subject: [PATCH] char: ipmi: Add clock control logic into Aspeed LPC BT driver
@@ -42,29 +42,29 @@ index 028268fd99ee..d13887d60f19 100644
+ clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
};
diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index 6e6f50a0fbab..3a7e31f3de07 100644
+index 618abeab539b..c2388bb7c678 100644
--- a/arch/arm/boot/dts/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
-@@ -333,6 +333,7 @@
+@@ -337,6 +337,7 @@
ibt: ibt@c0 {
compatible = "aspeed,ast2400-ibt-bmc";
reg = <0xc0 0x18>;
+ clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
interrupts = <8>;
+ status = "disabled";
};
-
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index 4cd4a8258e42..a6720bc952b0 100644
+index 88ac8e08b6ae..88b318fd287b 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -468,6 +468,7 @@
+@@ -470,6 +470,7 @@
ibt: ibt@c0 {
compatible = "aspeed,ast2500-ibt-bmc";
reg = <0xc0 0x18>;
+ clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
interrupts = <8>;
+ status = "disabled";
};
-
diff --git a/drivers/char/ipmi/bt-bmc.c b/drivers/char/ipmi/bt-bmc.c
index 40b9927c072c..a4ec9d1743d7 100644
--- a/drivers/char/ipmi/bt-bmc.c
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch
index 0559ef5be..c335fb3ec 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch
@@ -1,4 +1,4 @@
-From 1ebca05f5cb04162e124e59cac701291f23d9091 Mon Sep 17 00:00:00 2001
+From a5bbf0f5943d3a6be6e58a4b78d6d18694ceb859 Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Wed, 13 Mar 2019 15:27:48 -0700
Subject: [PATCH] misc: Add clock control logic into Aspeed LPC SNOOP driver
@@ -16,16 +16,16 @@ SNOOP driver.
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
- arch/arm/boot/dts/aspeed-g4.dtsi | 1 +
- arch/arm/boot/dts/aspeed-g5.dtsi | 1 +
- drivers/misc/aspeed-lpc-snoop.c | 30 +++++++++++++++++++++++++++---
+ arch/arm/boot/dts/aspeed-g4.dtsi | 1 +
+ arch/arm/boot/dts/aspeed-g5.dtsi | 1 +
+ drivers/soc/aspeed/aspeed-lpc-snoop.c | 30 +++++++++++++++++++++++++++---
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index 3a7e31f3de07..bedfb77c0158 100644
+index c2388bb7c678..70aca75d65e0 100644
--- a/arch/arm/boot/dts/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
-@@ -316,6 +316,7 @@
+@@ -320,6 +320,7 @@
compatible = "aspeed,ast2400-lpc-snoop";
reg = <0x0 0x80>;
interrupts = <8>;
@@ -34,10 +34,10 @@ index 3a7e31f3de07..bedfb77c0158 100644
};
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index a6720bc952b0..a26e8b3c09bf 100644
+index 88b318fd287b..f4a5d06f1000 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -451,6 +451,7 @@
+@@ -453,6 +453,7 @@
compatible = "aspeed,ast2500-lpc-snoop";
reg = <0x0 0x80>;
interrupts = <8>;
@@ -45,11 +45,11 @@ index a6720bc952b0..a26e8b3c09bf 100644
status = "disabled";
};
-diff --git a/drivers/misc/aspeed-lpc-snoop.c b/drivers/misc/aspeed-lpc-snoop.c
-index 2feb4347d67f..39a0471f0b8f 100644
---- a/drivers/misc/aspeed-lpc-snoop.c
-+++ b/drivers/misc/aspeed-lpc-snoop.c
-@@ -15,6 +15,7 @@
+diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c
+index 48f7ac238861..96ea52db25be 100644
+--- a/drivers/soc/aspeed/aspeed-lpc-snoop.c
++++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
+@@ -11,6 +11,7 @@
*/
#include <linux/bitops.h>
@@ -57,7 +57,7 @@ index 2feb4347d67f..39a0471f0b8f 100644
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/kfifo.h>
-@@ -71,6 +72,7 @@ struct aspeed_lpc_snoop_channel {
+@@ -67,6 +68,7 @@ struct aspeed_lpc_snoop_channel {
struct aspeed_lpc_snoop {
struct regmap *regmap;
int irq;
@@ -65,7 +65,7 @@ index 2feb4347d67f..39a0471f0b8f 100644
struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS];
};
-@@ -286,22 +288,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
+@@ -282,22 +284,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
return -ENODEV;
}
@@ -111,7 +111,7 @@ index 2feb4347d67f..39a0471f0b8f 100644
return rc;
}
-@@ -313,6 +335,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev)
+@@ -309,6 +331,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev)
aspeed_lpc_disable_snoop(lpc_snoop, 0);
aspeed_lpc_disable_snoop(lpc_snoop, 1);
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch
index d9b6d05f9..499662ac3 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch
@@ -1,4 +1,4 @@
-From 1326920183042bb91583eb56dabd29ec921f8f65 Mon Sep 17 00:00:00 2001
+From 27675470115548612cee9153903aaffffb68177b Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Wed, 13 Mar 2019 15:36:34 -0700
Subject: [PATCH] char: ipmi: Add clock control logic into Aspeed LPC KCS
@@ -45,10 +45,10 @@ index d98a9bf45d6c..3453eb0bf8f2 100644
kcs_addr = <0xCA2>;
status = "okay";
diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index bedfb77c0158..a5072ed1f823 100644
+index 1c00828da913..f04006f4cd27 100644
--- a/arch/arm/boot/dts/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
-@@ -294,6 +294,33 @@
+@@ -298,6 +298,33 @@
lpc_bmc: lpc-bmc@0 {
compatible = "aspeed,ast2400-lpc-bmc";
reg = <0x0 0x80>;
@@ -82,7 +82,7 @@ index bedfb77c0158..a5072ed1f823 100644
};
lpc_host: lpc-host@80 {
-@@ -305,6 +332,14 @@
+@@ -309,6 +336,14 @@
#size-cells = <1>;
ranges = <0x0 0x80 0x1e0>;
@@ -98,10 +98,10 @@ index bedfb77c0158..a5072ed1f823 100644
compatible = "aspeed,ast2400-lpc-ctrl";
reg = <0x0 0x80>;
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index a26e8b3c09bf..6a2f161e7548 100644
+index f2292bdfef91..d46b9ffc79de 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -128,7 +128,7 @@
+@@ -135,7 +135,7 @@
};
vic: interrupt-controller@1e6c0080 {
@@ -110,7 +110,7 @@ index a26e8b3c09bf..6a2f161e7548 100644
interrupt-controller;
#interrupt-cells = <1>;
valid-sources = <0xfefff7ff 0x0807ffff>;
-@@ -408,18 +408,21 @@
+@@ -410,18 +410,21 @@
compatible = "aspeed,ast2500-kcs-bmc";
interrupts = <8>;
kcs_chan = <1>;
@@ -132,7 +132,7 @@ index a26e8b3c09bf..6a2f161e7548 100644
status = "disabled";
};
};
-@@ -437,6 +440,7 @@
+@@ -439,6 +442,7 @@
compatible = "aspeed,ast2500-kcs-bmc";
interrupts = <8>;
kcs_chan = <4>;
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0046-misc-Add-clock-control-logic-into-Aspeed-LPC-MBOX-dr.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0046-misc-Add-clock-control-logic-into-Aspeed-LPC-MBOX-dr.patch
deleted file mode 100644
index 220283e24..000000000
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0046-misc-Add-clock-control-logic-into-Aspeed-LPC-MBOX-dr.patch
+++ /dev/null
@@ -1,166 +0,0 @@
-From db310b43e5b444a4e2854f3d69d002c2f0d0605c Mon Sep 17 00:00:00 2001
-From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
-Date: Wed, 13 Mar 2019 15:53:24 -0700
-Subject: [PATCH] misc: Add clock control logic into Aspeed LPC MBOX driver
-
-If LPC MBOX driver is registered ahead of lpc-ctrl module, LPC
-MBOX block will be enabled without heart beating of LCLK until
-lpc-ctrl enables the LCLK. This issue causes improper handling on
-host interrupts when the host sends interrupt in that time frame.
-Then kernel eventually forcibly disables the interrupt with dumping
-stack and printing a 'nobody cared this irq' message out.
-
-To prevent this issue, all LPC sub-nodes should enable LCLK
-individually so this patch adds clock control logic into the LPC
-MBOX driver.
-
-Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
----
- arch/arm/boot/dts/aspeed-g4.dtsi | 1 +
- arch/arm/boot/dts/aspeed-g5.dtsi | 1 +
- drivers/misc/aspeed-lpc-mbox.c | 42 +++++++++++++++++++++++++++++++---------
- 3 files changed, 35 insertions(+), 9 deletions(-)
-
-diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index a5072ed1f823..729245b74c13 100644
---- a/arch/arm/boot/dts/aspeed-g4.dtsi
-+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
-@@ -389,6 +389,7 @@
- reg = <0x180 0x5c>;
- interrupts = <46>;
- #mbox-cells = <1>;
-+ clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
- status = "disabled";
- };
- };
-diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index 6a2f161e7548..df9d63a94264 100644
---- a/arch/arm/boot/dts/aspeed-g5.dtsi
-+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -493,6 +493,7 @@
- reg = <0x180 0x5c>;
- interrupts = <46>;
- #mbox-cells = <1>;
-+ clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
- status = "disabled";
- };
- };
-diff --git a/drivers/misc/aspeed-lpc-mbox.c b/drivers/misc/aspeed-lpc-mbox.c
-index 0933e0553953..f105d27786ac 100644
---- a/drivers/misc/aspeed-lpc-mbox.c
-+++ b/drivers/misc/aspeed-lpc-mbox.c
-@@ -7,6 +7,7 @@
- * 2 of the License, or (at your option) any later version.
- */
-
-+#include <linux/clk.h>
- #include <linux/interrupt.h>
- #include <linux/mfd/syscon.h>
- #include <linux/miscdevice.h>
-@@ -37,7 +38,9 @@
- struct aspeed_mbox {
- struct miscdevice miscdev;
- struct regmap *regmap;
-+ struct clk *clk;
- unsigned int base;
-+ int irq;
- wait_queue_head_t queue;
- struct mutex mutex;
- };
-@@ -237,16 +240,16 @@ static int aspeed_mbox_config_irq(struct aspeed_mbox *mbox,
- struct platform_device *pdev)
- {
- struct device *dev = &pdev->dev;
-- int rc, irq;
-+ int rc;
-
-- irq = irq_of_parse_and_map(dev->of_node, 0);
-- if (!irq)
-+ mbox->irq = platform_get_irq(pdev, 0);
-+ if (!mbox->irq)
- return -ENODEV;
-
-- rc = devm_request_irq(dev, irq, aspeed_mbox_irq,
-- IRQF_SHARED, DEVICE_NAME, mbox);
-+ rc = devm_request_irq(dev, mbox->irq, aspeed_mbox_irq,
-+ IRQF_SHARED, DEVICE_NAME, mbox);
- if (rc < 0) {
-- dev_err(dev, "Unable to request IRQ %d\n", irq);
-+ dev_err(dev, "Unable to request IRQ %d\n", mbox->irq);
- return rc;
- }
-
-@@ -301,6 +304,19 @@ static int aspeed_mbox_probe(struct platform_device *pdev)
- mutex_init(&mbox->mutex);
- init_waitqueue_head(&mbox->queue);
-
-+ mbox->clk = devm_clk_get(dev, NULL);
-+ if (IS_ERR(mbox->clk)) {
-+ rc = PTR_ERR(mbox->clk);
-+ if (rc != -EPROBE_DEFER)
-+ dev_err(dev, "couldn't get clock\n");
-+ return rc;
-+ }
-+ rc = clk_prepare_enable(mbox->clk);
-+ if (rc) {
-+ dev_err(dev, "couldn't enable clock\n");
-+ return rc;
-+ }
-+
- mbox->miscdev.minor = MISC_DYNAMIC_MINOR;
- mbox->miscdev.name = DEVICE_NAME;
- mbox->miscdev.fops = &aspeed_mbox_fops;
-@@ -308,17 +324,24 @@ static int aspeed_mbox_probe(struct platform_device *pdev)
- rc = misc_register(&mbox->miscdev);
- if (rc) {
- dev_err(dev, "Unable to register device\n");
-- return rc;
-+ goto err;
- }
-
- rc = aspeed_mbox_config_irq(mbox, pdev);
- if (rc) {
- dev_err(dev, "Failed to configure IRQ\n");
- misc_deregister(&mbox->miscdev);
-- return rc;
-+ goto err;
- }
-
-+ dev_info(&pdev->dev, "LPC mbox registered, irq %d\n", mbox->irq);
-+
- return 0;
-+
-+err:
-+ clk_disable_unprepare(mbox->clk);
-+
-+ return rc;
- }
-
- static int aspeed_mbox_remove(struct platform_device *pdev)
-@@ -326,6 +349,7 @@ static int aspeed_mbox_remove(struct platform_device *pdev)
- struct aspeed_mbox *mbox = dev_get_drvdata(&pdev->dev);
-
- misc_deregister(&mbox->miscdev);
-+ clk_disable_unprepare(mbox->clk);
-
- return 0;
- }
-@@ -335,6 +359,7 @@ static const struct of_device_id aspeed_mbox_match[] = {
- { .compatible = "aspeed,ast2500-mbox" },
- { },
- };
-+MODULE_DEVICE_TABLE(of, aspeed_mbox_match);
-
- static struct platform_driver aspeed_mbox_driver = {
- .driver = {
-@@ -347,7 +372,6 @@ static struct platform_driver aspeed_mbox_driver = {
-
- module_platform_driver(aspeed_mbox_driver);
-
--MODULE_DEVICE_TABLE(of, aspeed_mbox_match);
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Cyril Bur <cyrilbur@gmail.com>");
- MODULE_DESCRIPTION("Aspeed mailbox device driver");
---
-2.7.4
-
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0047-misc-Block-error-printing-on-probe-defer-case-in-Asp.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0047-misc-Block-error-printing-on-probe-defer-case-in-Asp.patch
index 40c26e31b..c3d1f4e8d 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0047-misc-Block-error-printing-on-probe-defer-case-in-Asp.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0047-misc-Block-error-printing-on-probe-defer-case-in-Asp.patch
@@ -1,4 +1,4 @@
-From 4762687044ec864719ca14d8efa3dccdc3807e70 Mon Sep 17 00:00:00 2001
+From 108b39883e73f822b8f03e0d3fe3818b85b29b41 Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Wed, 13 Mar 2019 15:57:08 -0700
Subject: [PATCH] misc: Block error printing on probe defer case in Aspeed LPC
@@ -10,14 +10,14 @@ out an error message because the probing will be re-visited.
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
- drivers/misc/aspeed-lpc-ctrl.c | 7 +++++--
+ drivers/soc/aspeed/aspeed-lpc-ctrl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
-diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c
-index a024f8042259..c0818c7b0ffb 100644
---- a/drivers/misc/aspeed-lpc-ctrl.c
-+++ b/drivers/misc/aspeed-lpc-ctrl.c
-@@ -239,8 +239,10 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
+diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
+index 01ed21e8bfee..ae08419834a3 100644
+--- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c
++++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
+@@ -252,8 +252,10 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
lpc_ctrl->clk = devm_clk_get(dev, NULL);
if (IS_ERR(lpc_ctrl->clk)) {
@@ -30,7 +30,7 @@ index a024f8042259..c0818c7b0ffb 100644
}
rc = clk_prepare_enable(lpc_ctrl->clk);
if (rc) {
-@@ -264,6 +266,7 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
+@@ -275,6 +277,7 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
err:
clk_disable_unprepare(lpc_ctrl->clk);
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0048-ARM-dts-aspeed-Set-default-status-of-LPC-BT-as-disab.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0048-ARM-dts-aspeed-Set-default-status-of-LPC-BT-as-disab.patch
deleted file mode 100644
index efbea1be8..000000000
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0048-ARM-dts-aspeed-Set-default-status-of-LPC-BT-as-disab.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From abf63c03805bf7df31133b720e165eab759ea702 Mon Sep 17 00:00:00 2001
-From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
-Date: Thu, 14 Mar 2019 13:11:49 -0700
-Subject: [PATCH] ARM: dts: aspeed: Set default status of LPC BT as 'disabled'
-
-LPC BT is not widely used so set its default status as 'disabled'.
-
-Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
----
- arch/arm/boot/dts/aspeed-g4.dtsi | 1 +
- arch/arm/boot/dts/aspeed-g5.dtsi | 1 +
- 2 files changed, 2 insertions(+)
-
-diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index 729245b74c13..d4e1e29c6ed2 100644
---- a/arch/arm/boot/dts/aspeed-g4.dtsi
-+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
-@@ -371,6 +371,7 @@
- reg = <0xc0 0x18>;
- clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
- interrupts = <8>;
-+ status = "disabled";
- };
-
- sio_regs: regs {
-diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index df9d63a94264..a3850644b10e 100644
---- a/arch/arm/boot/dts/aspeed-g5.dtsi
-+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -475,6 +475,7 @@
- reg = <0xc0 0x18>;
- clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
- interrupts = <8>;
-+ status = "disabled";
- };
-
- sio_regs: regs {
---
-2.7.4
-
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch
index d66facdfa..d9379f565 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0051-Add-AST2500-JTAG-device.patch
@@ -1,4 +1,4 @@
-From a2e0020ef6e03abde6819fb7fc328dcf23d0bd71 Mon Sep 17 00:00:00 2001
+From 278740d23c1eac792c64608af4bfa3fae640965f Mon Sep 17 00:00:00 2001
From: "Hunt, Bryan" <bryan.hunt@intel.com>
Date: Mon, 6 May 2019 10:02:14 -0700
Subject: [PATCH] Add AST2500d JTAG driver
@@ -7,14 +7,14 @@ Adding aspeed jtag device
Signed-off-by: Hunt, Bryan <bryan.hunt@intel.com>
---
- arch/arm/boot/dts/aspeed-g5.dtsi | 9 +
- 1 files changed, 15 insertions(+)
+ arch/arm/boot/dts/aspeed-g5.dtsi | 9 +++++++++
+ 1 file changed, 9 insertions(+)
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index bf7ae631a458..2c9f287759ce 100644
+index ed0b7217f55f..89a9febf6f14 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -366,6 +366,15 @@
+@@ -389,6 +389,15 @@
pinctrl-0 = <&pinctrl_espi_default>;
};
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch
index 6c9d46d9d..3047746ca 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0052-drivers-jtag-Add-JTAG-core-driver.patch
@@ -1,4 +1,4 @@
-From 0b8b93851bb79e70e91159f310afd4b56084977f Mon Sep 17 00:00:00 2001
+From 520416545a47cffe66815f31bc1465eab8864554 Mon Sep 17 00:00:00 2001
From: "Corona, Ernesto" <ernesto.corona@intel.com>
Date: Fri, 7 Jun 2019 07:37:39 -0800
Subject: [PATCH v29 1/6] drivers: jtag: Add JTAG core driver
@@ -258,7 +258,7 @@ Comments pointed by Tobias Klauser <tklauser@distanz.ch>
drivers/jtag/Makefile | 1 +
drivers/jtag/jtag.c | 321 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/jtag.h | 47 +++++++
- include/uapi/linux/jtag.h | 214 ++++++++++++++++++++++++++++++
+ include/uapi/linux/jtag.h | 214 +++++++++++++++++++++++++++++++
7 files changed, 602 insertions(+)
create mode 100644 drivers/jtag/Kconfig
create mode 100644 drivers/jtag/Makefile
@@ -267,27 +267,27 @@ Comments pointed by Tobias Klauser <tklauser@distanz.ch>
create mode 100644 include/uapi/linux/jtag.h
diff --git a/drivers/Kconfig b/drivers/Kconfig
-index 4f9f990..0102bae 100644
+index 339ac306ded6..fb970bbe6b03 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
-@@ -228,4 +228,5 @@ source "drivers/siox/Kconfig"
+@@ -234,4 +234,5 @@ source "drivers/counter/Kconfig"
- source "drivers/slimbus/Kconfig"
+ source "drivers/peci/Kconfig"
+source "drivers/jtag/Kconfig"
endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
-index e1ce029..6d756c2 100644
+index 18d91cd5ac0f..b4d21c963923 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
-@@ -186,3 +186,4 @@ obj-$(CONFIG_MULTIPLEXER) += mux/
- obj-$(CONFIG_SIOX) += siox/
- obj-$(CONFIG_GNSS) += gnss/
+@@ -189,3 +189,4 @@ obj-$(CONFIG_GNSS) += gnss/
+ obj-$(CONFIG_INTERCONNECT) += interconnect/
+ obj-$(CONFIG_COUNTER) += counter/
obj-$(CONFIG_PECI) += peci/
-+obj-$(CONFIG_JTAG) += jtag/
++obj-$(CONFIG_JTAG_ASPEED) += jtag/
diff --git a/drivers/jtag/Kconfig b/drivers/jtag/Kconfig
new file mode 100644
-index 0000000..47771fc
+index 000000000000..47771fcd3c5b
--- /dev/null
+++ b/drivers/jtag/Kconfig
@@ -0,0 +1,17 @@
@@ -310,14 +310,14 @@ index 0000000..47771fc
+ be called jtag.
diff --git a/drivers/jtag/Makefile b/drivers/jtag/Makefile
new file mode 100644
-index 0000000..af37493
+index 000000000000..af374939a9e6
--- /dev/null
+++ b/drivers/jtag/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_JTAG) += jtag.o
diff --git a/drivers/jtag/jtag.c b/drivers/jtag/jtag.c
new file mode 100644
-index 0000000..47503a1
+index 000000000000..39a4d88a9c21
--- /dev/null
+++ b/drivers/jtag/jtag.c
@@ -0,0 +1,321 @@
@@ -644,7 +644,7 @@ index 0000000..47503a1
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/jtag.h b/include/linux/jtag.h
new file mode 100644
-index 0000000..4153c90
+index 000000000000..fab12dc4fc5e
--- /dev/null
+++ b/include/linux/jtag.h
@@ -0,0 +1,47 @@
@@ -697,7 +697,7 @@ index 0000000..4153c90
+#endif /* __LINUX_JTAG_H */
diff --git a/include/uapi/linux/jtag.h b/include/uapi/linux/jtag.h
new file mode 100644
-index 0000000..3f9e195
+index 000000000000..315e59577a17
--- /dev/null
+++ b/include/uapi/linux/jtag.h
@@ -0,0 +1,214 @@
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0055-Documentation-jtag-Add-ABI-documentation.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0055-Documentation-jtag-Add-ABI-documentation.patch
index b91311d94..1e4142035 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0055-Documentation-jtag-Add-ABI-documentation.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0055-Documentation-jtag-Add-ABI-documentation.patch
@@ -1,6 +1,6 @@
-From c2d57900820475b50affd171f4dc423a278887ae Mon Sep 17 00:00:00 2001
+From d4c55bd4eeb6d9290025fa353d1787f18bca6ade Mon Sep 17 00:00:00 2001
From: "Corona, Ernesto" <ernesto.corona@intel.com>
-Date: Wed, 10 Mar 2019 11:47:40 -0800
+Date: Sun, 10 Mar 2019 11:47:40 -0800
Subject: [PATCH v29 4/6] Documentation: jtag: Add ABI documentation
Added document that describe the ABI for JTAG class driver
@@ -84,8 +84,8 @@ v6->v7
Comments pointed by Pavel Machek <pavel@ucw.cz>
- Added jtag-cdev documentation to Documentation/ABI/testing folder
---
- Documentation/ABI/testing/jtag-dev | 23 +++++++
- Documentation/jtag/overview | 27 ++++++++
+ Documentation/ABI/testing/jtag-dev | 23 ++++++
+ Documentation/jtag/overview | 27 +++++++
Documentation/jtag/transactions | 145 +++++++++++++++++++++++++++++++++++++
3 files changed, 195 insertions(+)
create mode 100644 Documentation/ABI/testing/jtag-dev
@@ -94,7 +94,7 @@ Comments pointed by Pavel Machek <pavel@ucw.cz>
diff --git a/Documentation/ABI/testing/jtag-dev b/Documentation/ABI/testing/jtag-dev
new file mode 100644
-index 0000000..423baab
+index 000000000000..423baab18761
--- /dev/null
+++ b/Documentation/ABI/testing/jtag-dev
@@ -0,0 +1,23 @@
@@ -123,7 +123,7 @@ index 0000000..423baab
+ userspace tools which wants to access to JTAG bus
diff --git a/Documentation/jtag/overview b/Documentation/jtag/overview
new file mode 100644
-index 0000000..6a5ec33
+index 000000000000..6a5ec335e313
--- /dev/null
+++ b/Documentation/jtag/overview
@@ -0,0 +1,27 @@
@@ -156,7 +156,7 @@ index 0000000..6a5ec33
+User: close -> /dev/jatgX -> JTAG core driver -> JTAG hardware specific driver
diff --git a/Documentation/jtag/transactions b/Documentation/jtag/transactions
new file mode 100644
-index 0000000..76fd0b1
+index 000000000000..f5d4a1ded6cf
--- /dev/null
+++ b/Documentation/jtag/transactions
@@ -0,0 +1,145 @@
@@ -254,7 +254,7 @@ index 0000000..76fd0b1
+length: xfer data length in bits
+tdio : xfer data array
+from: xfer from state can be current JTAG tap state saved by the driver
-+ JTAG_STATE_CURRENT or in a multichain environment any state listed in
++ JTAG_STATE_CURRENT or in a multichain environment any state listed in
+ jtag_tapstate struct saved by your multichain controller software.
+endstate: xfer end state after transaction finish
+ can be: any state listed in jtag_tapstate struct
@@ -307,3 +307,4 @@ index 0000000..76fd0b1
+ tdo1 = bitbang_data[1].tdo;
--
2.7.4
+
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch
index 8ab4615f0..47a532590 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0057-drivers-jtag-Add-JTAG-core-driver-Maintainers.patch
@@ -1,6 +1,6 @@
-From 0a563429bc3c34a951db92600681e799b606a01f Mon Sep 17 00:00:00 2001
+From 8598b57423967f5851484533a1b09a04bafa235b Mon Sep 17 00:00:00 2001
From: "Corona, Ernesto" <ernesto.corona@intel.com>
-Date: Wed, 10 Mar 2019 11:49:37 -0800
+Date: Sun, 10 Mar 2019 11:49:37 -0800
Subject: [PATCH v29 6/6] drivers: jtag: Add JTAG core driver Maintainers
JTAG class driver provide infrastructure to support hardware/software
@@ -24,10 +24,10 @@ Cc: Bryan Hunt <bryan.hunt@intel.com>
1 file changed, 11 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
-index dce5c09..eb710a6 100644
+index e0925f221e25..2cd0a46f9a1a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -8173,6 +8173,17 @@ L: linux-serial@vger.kernel.org
+@@ -8521,6 +8521,17 @@ L: linux-serial@vger.kernel.org
S: Orphan
F: drivers/tty/serial/jsm/
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0058-i2c-aspeed-add-general-call-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0058-i2c-aspeed-add-general-call-support.patch
index de8bf2355..7d5e006d1 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0058-i2c-aspeed-add-general-call-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0058-i2c-aspeed-add-general-call-support.patch
@@ -1,4 +1,4 @@
-From 551b5192b1074679ca9411cdedb9137d38f7de3d Mon Sep 17 00:00:00 2001
+From f5b6d42c1710a4c1314bc0160f904aa01f501e96 Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Wed, 1 May 2019 13:27:34 -0700
Subject: [PATCH] i2c: aspeed: add general call support
@@ -28,10 +28,10 @@ index 7da7e813b2b0..724ee9f35c10 100644
specified.
- #retries : Number of retries for master transfer.
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
-index 0060193e1aa4..f96160e01a69 100644
+index 99bd30953531..8f26060bd685 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
-@@ -50,6 +50,7 @@
+@@ -47,6 +47,7 @@
#define ASPEED_I2CD_SDA_DRIVE_1T_EN BIT(8)
#define ASPEED_I2CD_M_SDA_DRIVE_1T_EN BIT(7)
#define ASPEED_I2CD_M_HIGH_SPEED_EN BIT(6)
@@ -39,7 +39,7 @@ index 0060193e1aa4..f96160e01a69 100644
#define ASPEED_I2CD_SLAVE_EN BIT(1)
#define ASPEED_I2CD_MASTER_EN BIT(0)
-@@ -74,6 +75,7 @@
+@@ -71,6 +72,7 @@
*/
#define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14)
#define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13)
@@ -47,7 +47,7 @@ index 0060193e1aa4..f96160e01a69 100644
#define ASPEED_I2CD_INTR_SLAVE_MATCH BIT(7)
#define ASPEED_I2CD_INTR_SCL_TIMEOUT BIT(6)
#define ASPEED_I2CD_INTR_ABNORMAL BIT(5)
-@@ -133,6 +135,8 @@ enum aspeed_i2c_slave_state {
+@@ -130,6 +132,8 @@ enum aspeed_i2c_slave_state {
ASPEED_I2C_SLAVE_READ_PROCESSED,
ASPEED_I2C_SLAVE_WRITE_REQUESTED,
ASPEED_I2C_SLAVE_WRITE_RECEIVED,
@@ -56,7 +56,7 @@ index 0060193e1aa4..f96160e01a69 100644
ASPEED_I2C_SLAVE_STOP,
};
-@@ -163,6 +167,8 @@ struct aspeed_i2c_bus {
+@@ -160,6 +164,8 @@ struct aspeed_i2c_bus {
#if IS_ENABLED(CONFIG_I2C_SLAVE)
struct i2c_client *slave;
enum aspeed_i2c_slave_state slave_state;
@@ -65,7 +65,7 @@ index 0060193e1aa4..f96160e01a69 100644
#endif /* CONFIG_I2C_SLAVE */
};
-@@ -267,6 +273,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -266,6 +272,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
bus->slave_state = ASPEED_I2C_SLAVE_START;
}
@@ -78,7 +78,7 @@ index 0060193e1aa4..f96160e01a69 100644
/* Slave is not currently active, irq was for someone else. */
if (bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE)
return irq_handled;
-@@ -285,6 +297,21 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -284,6 +296,21 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
else
bus->slave_state =
ASPEED_I2C_SLAVE_WRITE_REQUESTED;
@@ -100,18 +100,16 @@ index 0060193e1aa4..f96160e01a69 100644
}
irq_handled |= ASPEED_I2CD_INTR_RX_DONE;
}
-@@ -324,6 +351,10 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
- bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED;
- i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
+@@ -326,11 +353,16 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ case ASPEED_I2C_SLAVE_WRITE_RECEIVED:
+ i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value);
break;
+ case ASPEED_I2C_SLAVE_GCALL_REQUESTED:
+ bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED;
+ i2c_slave_event(slave, I2C_SLAVE_GCALL_REQUESTED, &value);
+ break;
- case ASPEED_I2C_SLAVE_WRITE_RECEIVED:
- i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value);
- break;
-@@ -332,6 +363,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ case ASPEED_I2C_SLAVE_STOP:
+ i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE;
break;
case ASPEED_I2C_SLAVE_START:
@@ -119,7 +117,7 @@ index 0060193e1aa4..f96160e01a69 100644
/* Slave was just started. Waiting for the next event. */;
break;
default:
-@@ -739,6 +771,8 @@ static void __aspeed_i2c_reg_slave(struct aspeed_i2c_bus *bus, u16 slave_addr)
+@@ -738,6 +770,8 @@ static void __aspeed_i2c_reg_slave(struct aspeed_i2c_bus *bus, u16 slave_addr)
/* Turn on slave mode. */
func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG);
func_ctrl_reg_val |= ASPEED_I2CD_SLAVE_EN;
@@ -128,7 +126,7 @@ index 0060193e1aa4..f96160e01a69 100644
writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG);
}
-@@ -777,6 +811,8 @@ static int aspeed_i2c_unreg_slave(struct i2c_client *client)
+@@ -776,6 +810,8 @@ static int aspeed_i2c_unreg_slave(struct i2c_client *client)
/* Turn off slave mode. */
func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG);
func_ctrl_reg_val &= ~ASPEED_I2CD_SLAVE_EN;
@@ -137,7 +135,7 @@ index 0060193e1aa4..f96160e01a69 100644
writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG);
bus->slave = NULL;
-@@ -921,6 +957,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus,
+@@ -920,6 +956,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus,
bus->base + ASPEED_I2C_FUN_CTRL_REG);
#if IS_ENABLED(CONFIG_I2C_SLAVE)
@@ -148,10 +146,10 @@ index 0060193e1aa4..f96160e01a69 100644
if (bus->slave)
__aspeed_i2c_reg_slave(bus, bus->slave->addr);
diff --git a/drivers/i2c/i2c-slave-mqueue.c b/drivers/i2c/i2c-slave-mqueue.c
-index 4548088e1922..a608846cb1db 100644
+index 2c7a6038409c..1d4db584b393 100644
--- a/drivers/i2c/i2c-slave-mqueue.c
+++ b/drivers/i2c/i2c-slave-mqueue.c
-@@ -53,10 +53,12 @@ static int i2c_slave_mqueue_callback(struct i2c_client *client,
+@@ -56,10 +56,12 @@ static int i2c_slave_mqueue_callback(struct i2c_client *client,
switch (event) {
case I2C_SLAVE_WRITE_REQUESTED:
@@ -166,10 +164,10 @@ index 4548088e1922..a608846cb1db 100644
case I2C_SLAVE_WRITE_RECEIVED:
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
-index e1c6b78bdaf1..03ffb70d75f2 100644
+index 3ee92c6a442d..dfdccb2acb24 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
-@@ -371,6 +371,7 @@ enum i2c_slave_event {
+@@ -359,6 +359,7 @@ enum i2c_slave_event {
I2C_SLAVE_WRITE_REQUESTED,
I2C_SLAVE_READ_PROCESSED,
I2C_SLAVE_WRITE_RECEIVED,
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0065-i2c-aspeed-fix-master-pending-state-handling.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0065-i2c-aspeed-fix-master-pending-state-handling.patch
index 3a86d5b25..003a96c8d 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0065-i2c-aspeed-fix-master-pending-state-handling.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0065-i2c-aspeed-fix-master-pending-state-handling.patch
@@ -1,4 +1,4 @@
-From 50221ac92816333efcf961c5f22f8b9ffdccb31b Mon Sep 17 00:00:00 2001
+From 4a05d2506e7cb7fb3ad323a16861f09279b4da39 Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Tue, 11 Jun 2019 14:59:53 -0700
Subject: [PATCH] i2c: aspeed: fix master pending state handling
@@ -15,10 +15,10 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
-index f96160e01a69..64bc68eaa88f 100644
+index 8f26060bd685..d8143c24d3a7 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
-@@ -384,18 +384,19 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
+@@ -383,18 +383,19 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
struct i2c_msg *msg = &bus->msgs[bus->msgs_index];
u8 slave_addr = i2c_8bit_addr_from_msg(msg);
@@ -41,7 +41,7 @@ index f96160e01a69..64bc68eaa88f 100644
bus->buf_index = 0;
if (msg->flags & I2C_M_RD) {
-@@ -480,7 +481,7 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -479,7 +480,7 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE)
goto out_no_complete;
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0066-i2c-aspeed-add-buffer-mode-transfer-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0066-i2c-aspeed-add-buffer-mode-transfer-support.patch
index 9480daeff..9b96b400b 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0066-i2c-aspeed-add-buffer-mode-transfer-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0066-i2c-aspeed-add-buffer-mode-transfer-support.patch
@@ -1,4 +1,4 @@
-From efb710a6b3a39f28b988af717eefc1b72c4c43bd Mon Sep 17 00:00:00 2001
+From 36128aacdc8b642b9ee080e493abbc00de345f1d Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Tue, 11 Jun 2019 15:07:08 -0700
Subject: [PATCH] i2c: aspeed: add buffer mode transfer support
@@ -15,7 +15,7 @@ It has 2 KBytes (256 Bytes x 8 pages) of I2C SRAM buffer pool from
buffer pool manipulation. To simplify implementation for supporting
both AST2400 and AST2500, it assigns each 128 Bytes per bus without
using buffer pool manipulation so total 1792 Bytes of I2C SRAM
-buffer will used.
+buffer will be used.
AST2500:
It has 16 Bytes of individual I2C SRAM buffer per each bus and its
@@ -30,329 +30,452 @@ It provides buffer based master and slave data transfer.
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
- arch/arm/boot/dts/aspeed-g4.dtsi | 42 ++++--
- arch/arm/boot/dts/aspeed-g5.dtsi | 42 ++++--
- drivers/i2c/busses/i2c-aspeed.c | 262 ++++++++++++++++++++++++++++++++----
- drivers/irqchip/irq-aspeed-i2c-ic.c | 8 ++
- 4 files changed, 301 insertions(+), 53 deletions(-)
+ .../devicetree/bindings/i2c/i2c-aspeed.txt | 40 ++-
+ arch/arm/boot/dts/aspeed-g4.dtsi | 47 ++--
+ arch/arm/boot/dts/aspeed-g5.dtsi | 47 ++--
+ drivers/i2c/busses/i2c-aspeed.c | 294 ++++++++++++++++++---
+ 4 files changed, 349 insertions(+), 79 deletions(-)
+diff --git a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt
+index 724ee9f35c10..e1a0ae7a8c08 100644
+--- a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt
++++ b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt
+@@ -3,7 +3,10 @@ Device tree configuration for the I2C busses on the AST24XX and AST25XX SoCs.
+ Required Properties:
+ - #address-cells : should be 1
+ - #size-cells : should be 0
+-- reg : address offset and range of bus
++- reg : Address offset and range of bus registers.
++ An additional SRAM buffer address offset and range is
++ optional in case of enabling I2C dedicated SRAM for
++ buffer mode transfer support.
+ - compatible : should be "aspeed,ast2400-i2c-bus"
+ or "aspeed,ast2500-i2c-bus"
+ - clocks : root clock of bus, should reference the APB
+@@ -29,12 +32,21 @@ i2c {
+ #size-cells = <1>;
+ ranges = <0 0x1e78a000 0x1000>;
+
+- i2c_ic: interrupt-controller@0 {
+- #interrupt-cells = <1>;
+- compatible = "aspeed,ast2400-i2c-ic";
++ i2c_gr: i2c-global-regs@0 {
++ compatible = "aspeed,ast2500-i2c-gr", "syscon";
+ reg = <0x0 0x40>;
+- interrupts = <12>;
+- interrupt-controller;
++
++ #address-cells = <1>;
++ #size-cells = <1>;
++ ranges = <0x0 0x0 0x40>;
++
++ i2c_ic: interrupt-controller@0 {
++ #interrupt-cells = <1>;
++ compatible = "aspeed,ast2500-i2c-ic";
++ reg = <0x0 0x4>;
++ interrupts = <12>;
++ interrupt-controller;
++ };
+ };
+
+ i2c0: i2c-bus@40 {
+@@ -42,11 +54,25 @@ i2c {
+ #size-cells = <0>;
+ #interrupt-cells = <1>;
+ reg = <0x40 0x40>;
+- compatible = "aspeed,ast2400-i2c-bus";
++ compatible = "aspeed,ast2500-i2c-bus";
+ clocks = <&syscon ASPEED_CLK_APB>;
+ resets = <&syscon ASPEED_RESET_I2C>;
+ bus-frequency = <100000>;
+ interrupts = <0>;
+ interrupt-parent = <&i2c_ic>;
+ };
++
++ /* buffer mode transfer enabled */
++ i2c1: i2c-bus@80 {
++ #address-cells = <1>;
++ #size-cells = <0>;
++ #interrupt-cells = <1>;
++ reg = <0x80 0x40>, <0x210 0x10>;
++ compatible = "aspeed,ast2500-i2c-bus";
++ clocks = <&syscon ASPEED_CLK_APB>;
++ resets = <&syscon ASPEED_RESET_I2C>;
++ bus-frequency = <100000>;
++ interrupts = <1>;
++ interrupt-parent = <&i2c_ic>;
++ };
+ };
diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi
-index 47a5029f5bdb..c1c125add9fa 100644
+index 47a5029f5bdb..052b1b6b4dc7 100644
--- a/arch/arm/boot/dts/aspeed-g4.dtsi
+++ b/arch/arm/boot/dts/aspeed-g4.dtsi
-@@ -482,7 +482,8 @@
+@@ -469,12 +469,21 @@
+ };
+
+ &i2c {
+- i2c_ic: interrupt-controller@0 {
+- #interrupt-cells = <1>;
+- compatible = "aspeed,ast2400-i2c-ic";
++ i2c_gr: i2c-global-regs@0 {
++ compatible = "aspeed,ast2400-i2c-gr", "syscon";
+ reg = <0x0 0x40>;
+- interrupts = <12>;
+- interrupt-controller;
++
++ #address-cells = <1>;
++ #size-cells = <1>;
++ ranges = <0x0 0x0 0x40>;
++
++ i2c_ic: interrupt-controller@0 {
++ #interrupt-cells = <1>;
++ compatible = "aspeed,ast2400-i2c-ic";
++ reg = <0x0 0x4>;
++ interrupts = <12>;
++ interrupt-controller;
++ };
+ };
+
+ i2c0: i2c-bus@40 {
+@@ -482,7 +491,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x40 0x40>;
+ reg = <0x40 0x40>, <0x800 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -498,7 +499,8 @@
+@@ -498,7 +507,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x80 0x40>;
+ reg = <0x80 0x40>, <0x880 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -514,7 +516,8 @@
+@@ -514,7 +523,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0xc0 0x40>;
+ reg = <0xc0 0x40>, <0x900 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -531,7 +534,8 @@
+@@ -531,7 +540,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x100 0x40>;
+ reg = <0x100 0x40>, <0x980 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -548,7 +552,8 @@
+@@ -548,7 +557,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x140 0x40>;
+ reg = <0x140 0x40>, <0xa00 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -565,7 +570,8 @@
+@@ -565,7 +574,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x180 0x40>;
+ reg = <0x180 0x40>, <0xa80 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -582,7 +588,8 @@
+@@ -582,7 +591,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x1c0 0x40>;
+ reg = <0x1c0 0x40>, <0xb00 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -599,7 +606,8 @@
+@@ -599,7 +608,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x300 0x40>;
+ reg = <0x300 0x40>, <0xb80 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -616,7 +624,8 @@
+@@ -616,7 +625,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x340 0x40>;
+ reg = <0x340 0x40>, <0xc00 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -633,7 +642,8 @@
+@@ -633,7 +642,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x380 0x40>;
+ reg = <0x380 0x40>, <0xc80 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -650,7 +660,8 @@
+@@ -650,7 +659,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x3c0 0x40>;
+ reg = <0x3c0 0x40>, <0xd00 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -667,7 +678,8 @@
+@@ -667,7 +676,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x400 0x40>;
+ reg = <0x400 0x40>, <0xd80 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -684,7 +696,8 @@
+@@ -684,7 +693,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x440 0x40>;
+ reg = <0x440 0x40>, <0xe00 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -701,7 +714,8 @@
+@@ -701,7 +710,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x480 0x40>;
+ reg = <0x480 0x40>, <0xe80 0x80>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2400-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
-index 9d5ed9499b1f..662249bc15f9 100644
+index 89a9febf6f14..2d2173d598e4 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
-@@ -599,7 +599,8 @@
+@@ -586,12 +586,21 @@
+ };
+
+ &i2c {
+- i2c_ic: interrupt-controller@0 {
+- #interrupt-cells = <1>;
+- compatible = "aspeed,ast2500-i2c-ic";
++ i2c_gr: i2c-global-regs@0 {
++ compatible = "aspeed,ast2500-i2c-gr", "syscon";
+ reg = <0x0 0x40>;
+- interrupts = <12>;
+- interrupt-controller;
++
++ #address-cells = <1>;
++ #size-cells = <1>;
++ ranges = <0x0 0x0 0x40>;
++
++ i2c_ic: interrupt-controller@0 {
++ #interrupt-cells = <1>;
++ compatible = "aspeed,ast2500-i2c-ic";
++ reg = <0x0 0x4>;
++ interrupts = <12>;
++ interrupt-controller;
++ };
+ };
+
+ i2c0: i2c-bus@40 {
+@@ -599,7 +608,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x40 0x40>;
+ reg = <0x40 0x40>, <0x200 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -615,7 +616,8 @@
+@@ -615,7 +624,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x80 0x40>;
+ reg = <0x80 0x40>, <0x210 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -631,7 +633,8 @@
+@@ -631,7 +640,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0xc0 0x40>;
+ reg = <0xc0 0x40>, <0x220 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -648,7 +651,8 @@
+@@ -648,7 +657,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x100 0x40>;
+ reg = <0x100 0x40>, <0x230 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -665,7 +669,8 @@
+@@ -665,7 +674,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x140 0x40>;
+ reg = <0x140 0x40>, <0x240 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -682,7 +687,8 @@
+@@ -682,7 +691,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x180 0x40>;
+ reg = <0x180 0x40>, <0x250 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -699,7 +705,8 @@
+@@ -699,7 +708,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x1c0 0x40>;
+ reg = <0x1c0 0x40>, <0x260 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -716,7 +723,8 @@
+@@ -716,7 +725,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x300 0x40>;
+ reg = <0x300 0x40>, <0x270 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -733,7 +741,8 @@
+@@ -733,7 +742,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x340 0x40>;
+ reg = <0x340 0x40>, <0x280 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -750,7 +759,8 @@
+@@ -750,7 +759,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x380 0x40>;
+ reg = <0x380 0x40>, <0x290 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -767,7 +777,8 @@
+@@ -767,7 +776,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x3c0 0x40>;
+ reg = <0x3c0 0x40>, <0x2a0 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -784,7 +795,8 @@
+@@ -784,7 +793,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x400 0x40>;
+ reg = <0x400 0x40>, <0x2b0 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -801,7 +813,8 @@
+@@ -801,7 +810,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x440 0x40>;
+ reg = <0x440 0x40>, <0x2c0 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
-@@ -818,7 +831,8 @@
+@@ -818,7 +827,7 @@
#size-cells = <0>;
#interrupt-cells = <1>;
- reg = <0x480 0x40>;
+ reg = <0x480 0x40>, <0x2d0 0x10>;
-+ reg-names = "bus-regs", "buf";
compatible = "aspeed,ast2500-i2c-bus";
clocks = <&syscon ASPEED_CLK_APB>;
resets = <&syscon ASPEED_RESET_I2C>;
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
-index 64bc68eaa88f..b21a4c87853e 100644
+index d8143c24d3a7..b721fb1d6d4c 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
-@@ -10,6 +10,7 @@
- * published by the Free Software Foundation.
+@@ -7,6 +7,7 @@
+ * Copyright 2017 Google, Inc.
*/
+#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/err.h>
-@@ -38,6 +39,7 @@
+@@ -19,15 +20,24 @@
+ #include <linux/irqchip/chained_irq.h>
+ #include <linux/irqdomain.h>
+ #include <linux/kernel.h>
++#include <linux/mfd/syscon.h>
+ #include <linux/module.h>
+ #include <linux/of_address.h>
+ #include <linux/of_irq.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_device.h>
++#include <linux/regmap.h>
+ #include <linux/reset.h>
+ #include <linux/slab.h>
+
+-/* I2C Register */
++/* I2C Global Registers */
++/* 0x00 : I2CG Interrupt Status Register */
++/* 0x08 : I2CG Interrupt Target Assignment */
++/* 0x0c : I2CG Global Control Register (AST2500) */
++#define ASPEED_I2CG_GLOBAL_CTRL_REG 0x0c
++#define ASPEED_I2CG_SRAM_BUFFER_EN BIT(0)
++
++/* I2C Bus Registers */
+ #define ASPEED_I2C_FUN_CTRL_REG 0x00
+ #define ASPEED_I2C_AC_TIMING_REG1 0x04
+ #define ASPEED_I2C_AC_TIMING_REG2 0x08
+@@ -35,14 +45,12 @@
#define ASPEED_I2C_INTR_STS_REG 0x10
#define ASPEED_I2C_CMD_REG 0x14
#define ASPEED_I2C_DEV_ADDR_REG 0x18
+#define ASPEED_I2C_BUF_CTRL_REG 0x1c
#define ASPEED_I2C_BYTE_BUF_REG 0x20
- /* Global Register Definition */
-@@ -46,6 +48,7 @@
-
+-/* Global Register Definition */
+-/* 0x00 : I2C Interrupt Status Register */
+-/* 0x08 : I2C Interrupt Target Assignment */
+-
/* Device Register Definition */
/* 0x00 : I2CD Function Control Register */
+#define ASPEED_I2CD_BUFFER_PAGE_SEL_MASK GENMASK(22, 20)
#define ASPEED_I2CD_MULTI_MASTER_DIS BIT(15)
#define ASPEED_I2CD_SDA_DRIVE_1T_EN BIT(8)
#define ASPEED_I2CD_M_SDA_DRIVE_1T_EN BIT(7)
-@@ -107,6 +110,8 @@
+@@ -104,6 +112,8 @@
#define ASPEED_I2CD_BUS_RECOVER_CMD BIT(11)
/* Command Bit */
@@ -361,7 +484,7 @@ index 64bc68eaa88f..b21a4c87853e 100644
#define ASPEED_I2CD_M_STOP_CMD BIT(5)
#define ASPEED_I2CD_M_S_RX_CMD_LAST BIT(4)
#define ASPEED_I2CD_M_RX_CMD BIT(3)
-@@ -117,6 +122,13 @@
+@@ -114,6 +124,13 @@
/* 0x18 : I2CD Slave Device Address Register */
#define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0)
@@ -375,11 +498,11 @@ index 64bc68eaa88f..b21a4c87853e 100644
enum aspeed_i2c_master_state {
ASPEED_I2C_MASTER_INACTIVE,
ASPEED_I2C_MASTER_PENDING,
-@@ -164,6 +176,11 @@ struct aspeed_i2c_bus {
+@@ -161,6 +178,11 @@ struct aspeed_i2c_bus {
int master_xfer_result;
/* Multi-master */
bool multi_master;
-+ /* Buffer/DMA mode */
++ /* Buffer mode */
+ void __iomem *buf_base;
+ size_t buf_size;
+ u8 buf_offset;
@@ -387,7 +510,7 @@ index 64bc68eaa88f..b21a4c87853e 100644
#if IS_ENABLED(CONFIG_I2C_SLAVE)
struct i2c_client *slave;
enum aspeed_i2c_slave_state slave_state;
-@@ -260,6 +277,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -259,6 +281,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
{
u32 command, irq_handled = 0;
struct i2c_client *slave = bus->slave;
@@ -395,39 +518,42 @@ index 64bc68eaa88f..b21a4c87853e 100644
u8 value;
if (!slave)
-@@ -288,7 +306,11 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -287,7 +310,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
/* Slave was sent something. */
if (irq_status & ASPEED_I2CD_INTR_RX_DONE) {
- value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8;
+ if (bus->buf_base &&
-+ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED)
++ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED &&
++ !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP))
+ value = readb(bus->buf_base);
+ else
+ value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8;
/* Handle address frame. */
if (bus->slave_state == ASPEED_I2C_SLAVE_START) {
if (value & 0x1)
-@@ -318,6 +340,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -317,6 +345,20 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
/* Slave was asked to stop. */
if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP) {
-+ if (bus->buf_base &&
-+ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED) {
-+ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK,
-+ readl(bus->base +
-+ ASPEED_I2C_BUF_CTRL_REG));
-+ for (i = 0; i < len; i++) {
-+ value = readb(bus->buf_base + i);
-+ i2c_slave_event(slave,
-+ I2C_SLAVE_WRITE_RECEIVED,
-+ &value);
++ if (bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED &&
++ irq_status & ASPEED_I2CD_INTR_RX_DONE) {
++ if (bus->buf_base) {
++ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK,
++ readl(bus->base +
++ ASPEED_I2C_BUF_CTRL_REG));
++ for (i = 0; i < len; i++) {
++ value = readb(bus->buf_base + i);
++ i2c_slave_event(slave,
++ I2C_SLAVE_WRITE_RECEIVED,
++ &value);
++ }
+ }
+ }
irq_handled |= ASPEED_I2CD_INTR_NORMAL_STOP;
bus->slave_state = ASPEED_I2C_SLAVE_STOP;
}
-@@ -350,6 +384,15 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -349,9 +391,36 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
case ASPEED_I2C_SLAVE_WRITE_REQUESTED:
bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED;
i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
@@ -441,10 +567,6 @@ index 64bc68eaa88f..b21a4c87853e 100644
+ bus->base + ASPEED_I2C_CMD_REG);
+ }
break;
- case ASPEED_I2C_SLAVE_GCALL_REQUESTED:
- bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED;
-@@ -357,6 +400,24 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
- break;
case ASPEED_I2C_SLAVE_WRITE_RECEIVED:
i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value);
+ if (bus->buf_base) {
@@ -466,9 +588,9 @@ index 64bc68eaa88f..b21a4c87853e 100644
+ bus->base + ASPEED_I2C_CMD_REG);
+ }
break;
- case ASPEED_I2C_SLAVE_STOP:
- i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
-@@ -383,6 +444,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
+ case ASPEED_I2C_SLAVE_GCALL_REQUESTED:
+ bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED;
+@@ -382,6 +451,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
u32 command = ASPEED_I2CD_M_START_CMD | ASPEED_I2CD_M_TX_CMD;
struct i2c_msg *msg = &bus->msgs[bus->msgs_index];
u8 slave_addr = i2c_8bit_addr_from_msg(msg);
@@ -477,7 +599,7 @@ index 64bc68eaa88f..b21a4c87853e 100644
#if IS_ENABLED(CONFIG_I2C_SLAVE)
/*
-@@ -401,12 +464,66 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
+@@ -400,12 +471,66 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
if (msg->flags & I2C_M_RD) {
command |= ASPEED_I2CD_M_RX_CMD;
@@ -486,11 +608,7 @@ index 64bc68eaa88f..b21a4c87853e 100644
- command |= ASPEED_I2CD_M_S_RX_CMD_LAST;
+
+ if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) {
-+ command |= ASPEED_I2CD_TX_BUFF_ENABLE |
-+ ASPEED_I2CD_RX_BUFF_ENABLE;
-+
-+ wbuf[0] = slave_addr;
-+ writel(*(u32 *)wbuf, bus->buf_base);
++ command |= ASPEED_I2CD_RX_BUFF_ENABLE;
+
+ if (msg->len > bus->buf_size) {
+ len = bus->buf_size;
@@ -501,7 +619,6 @@ index 64bc68eaa88f..b21a4c87853e 100644
+
+ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK,
+ len - 1) |
-+ FIELD_PREP(ASPEED_I2CD_BUF_TX_COUNT_MASK, 0) |
+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK,
+ bus->buf_offset),
+ bus->base + ASPEED_I2C_BUF_CTRL_REG);
@@ -521,6 +638,11 @@ index 64bc68eaa88f..b21a4c87853e 100644
+ else
+ len = msg->len + 1;
+
++ /*
++ * Yeah, it looks clumsy but byte writings on a remapped
++ * I2C SRAM cause corruptions so use this way to make
++ * dword writings.
++ */
+ wbuf[0] = slave_addr;
+ for (i = 1; i < len; i++) {
+ wbuf[i % 4] = msg->buf[i - 1];
@@ -548,22 +670,7 @@ index 64bc68eaa88f..b21a4c87853e 100644
writel(command, bus->base + ASPEED_I2C_CMD_REG);
}
-@@ -441,12 +558,22 @@ static int aspeed_i2c_is_irq_error(u32 irq_status)
- return 0;
- }
-
-+static inline int aspeed_i2c_is_tx_error(struct aspeed_i2c_bus *bus)
-+{
-+ if (FIELD_GET(ASPEED_I2CD_BUF_TX_COUNT_MASK,
-+ readl(bus->base + ASPEED_I2C_BUF_CTRL_REG)) !=
-+ bus->buf_size - 1)
-+ return -EIO;
-+
-+ return 0;
-+}
-+
- static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
- {
+@@ -445,7 +570,7 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
u32 irq_handled = 0, command = 0;
struct i2c_msg *msg;
u8 recv_byte;
@@ -572,16 +679,17 @@ index 64bc68eaa88f..b21a4c87853e 100644
if (irq_status & ASPEED_I2CD_INTR_BUS_RECOVER_DONE) {
bus->master_state = ASPEED_I2C_MASTER_INACTIVE;
-@@ -559,11 +686,46 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -558,11 +683,43 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
/* fall through */
case ASPEED_I2C_MASTER_TX_FIRST:
if (bus->buf_index < msg->len) {
++ command = ASPEED_I2CD_M_TX_CMD;
++
+ if (bus->buf_base) {
+ u8 wbuf[4];
+ int i;
+
-+ if (unlikely(aspeed_i2c_is_tx_error(bus)))
-+ goto error_and_stop;
++ command |= ASPEED_I2CD_TX_BUFF_ENABLE;
+
+ if (msg->len - bus->buf_index > bus->buf_size)
+ len = bus->buf_size;
@@ -606,15 +714,11 @@ index 64bc68eaa88f..b21a4c87853e 100644
+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK,
+ bus->buf_offset),
+ bus->base + ASPEED_I2C_BUF_CTRL_REG);
-+ writel(ASPEED_I2CD_TX_BUFF_ENABLE |
-+ ASPEED_I2CD_M_TX_CMD,
-+ bus->base + ASPEED_I2C_CMD_REG);
+ } else {
+ writel(msg->buf[bus->buf_index++],
+ bus->base + ASPEED_I2C_BYTE_BUF_REG);
-+ writel(ASPEED_I2CD_M_TX_CMD,
-+ bus->base + ASPEED_I2C_CMD_REG);
+ }
++ writel(command, bus->base + ASPEED_I2C_CMD_REG);
bus->master_state = ASPEED_I2C_MASTER_TX;
- writel(msg->buf[bus->buf_index++],
- bus->base + ASPEED_I2C_BYTE_BUF_REG);
@@ -623,7 +727,7 @@ index 64bc68eaa88f..b21a4c87853e 100644
} else {
aspeed_i2c_next_msg_or_stop(bus);
}
-@@ -580,25 +742,57 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -579,25 +736,56 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
}
irq_handled |= ASPEED_I2CD_INTR_RX_DONE;
@@ -687,7 +791,6 @@ index 64bc68eaa88f..b21a4c87853e 100644
+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK,
+ bus->buf_offset),
+ bus->base + ASPEED_I2C_BUF_CTRL_REG);
-+
+ } else {
+ if (bus->buf_index + 1 == msg->len)
+ command |= ASPEED_I2CD_M_S_RX_CMD_LAST;
@@ -695,7 +798,7 @@ index 64bc68eaa88f..b21a4c87853e 100644
writel(command, bus->base + ASPEED_I2C_CMD_REG);
} else {
aspeed_i2c_next_msg_or_stop(bus);
-@@ -948,6 +1142,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus,
+@@ -947,6 +1135,9 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus,
if (ret < 0)
return ret;
@@ -705,11 +808,13 @@ index 64bc68eaa88f..b21a4c87853e 100644
if (of_property_read_bool(pdev->dev.of_node, "multi-master"))
bus->multi_master = true;
else
-@@ -1010,17 +1207,32 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
+@@ -1007,16 +1198,15 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
+ {
+ const struct of_device_id *match;
struct aspeed_i2c_bus *bus;
++ bool sram_enabled = true;
struct clk *parent_clk;
- struct resource *res;
-+ void __iomem *gc_reg;
+- struct resource *res;
int irq, ret;
bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL);
@@ -717,54 +822,65 @@ index 64bc68eaa88f..b21a4c87853e 100644
return -ENOMEM;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "bus-regs");
- bus->base = devm_ioremap_resource(&pdev->dev, res);
+- bus->base = devm_ioremap_resource(&pdev->dev, res);
++ bus->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(bus->base))
return PTR_ERR(bus->base);
-+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "buf");
-+ bus->buf_base = devm_ioremap_resource(&pdev->dev, res);
-+ if (IS_ERR(bus->buf_base) || resource_size(res) < 2) {
-+ bus->buf_base = NULL;
-+ } else {
-+ bus->buf_size = resource_size(res);
-+ if (of_device_is_compatible(pdev->dev.of_node,
-+ "aspeed,ast2400-i2c-bus")) {
-+ bus->buf_page = (res->start >> 8) & GENMASK(3, 0) - 8;
-+ bus->buf_offset = (res->start >> 2) &
-+ ASPEED_I2CD_BUF_OFFSET_MASK;
+@@ -1050,6 +1240,42 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
+ bus->get_clk_reg_val = (u32 (*)(struct device *, u32))
+ match->data;
+
++ /* Enable I2C SRAM in case of AST2500 */
++ if (of_device_is_compatible(pdev->dev.of_node,
++ "aspeed,ast2500-i2c-bus")) {
++ struct regmap *gr_regmap = syscon_regmap_lookup_by_compatible(
++ "aspeed,ast2500-i2c-gr");
++ if (IS_ERR(gr_regmap))
++ ret = PTR_ERR(gr_regmap);
++ else
++ ret = regmap_update_bits(gr_regmap,
++ ASPEED_I2CG_GLOBAL_CTRL_REG,
++ ASPEED_I2CG_SRAM_BUFFER_EN,
++ ASPEED_I2CG_SRAM_BUFFER_EN);
++
++ if (ret)
++ sram_enabled = false;
++ }
++
++ if (sram_enabled) {
++ struct resource *res = platform_get_resource(pdev,
++ IORESOURCE_MEM, 1);
++
++ bus->buf_base = devm_ioremap_resource(&pdev->dev, res);
++ if (IS_ERR(bus->buf_base) || resource_size(res) < 2) {
++ bus->buf_base = NULL;
++ } else {
++ bus->buf_size = resource_size(res);
++ if (of_device_is_compatible(pdev->dev.of_node,
++ "aspeed,ast2400-i2c-bus")) {
++ bus->buf_page = ((res->start >> 8) &
++ GENMASK(3, 0)) - 8;
++ bus->buf_offset = (res->start >> 2) &
++ ASPEED_I2CD_BUF_OFFSET_MASK;
++ }
+ }
+ }
+
- parent_clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(parent_clk))
- return PTR_ERR(parent_clk);
-diff --git a/drivers/irqchip/irq-aspeed-i2c-ic.c b/drivers/irqchip/irq-aspeed-i2c-ic.c
-index f20200af0992..99985b22a9fa 100644
---- a/drivers/irqchip/irq-aspeed-i2c-ic.c
-+++ b/drivers/irqchip/irq-aspeed-i2c-ic.c
-@@ -18,6 +18,9 @@
- #include <linux/of_irq.h>
- #include <linux/io.h>
-
-+/* I2C Global Control Register (AST2500) */
-+#define ASPEED_I2C_GLOBAL_CTRL_REG 0xc
-+#define ASPEED_I2C_SRAM_BUFFER_EN BIT(0)
+ /* Initialize the I2C adapter */
+ spin_lock_init(&bus->lock);
+ init_completion(&bus->cmd_complete);
+@@ -1085,8 +1311,8 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
- #define ASPEED_I2C_IC_NUM_BUS 14
+ platform_set_drvdata(pdev, bus);
-@@ -100,6 +103,11 @@ static int __init aspeed_i2c_ic_of_init(struct device_node *node,
- irq_set_chained_handler_and_data(i2c_ic->parent_irq,
- aspeed_i2c_ic_irq_handler, i2c_ic);
-
-+ /* Enable I2C SRAM buffer in case of AST2500 */
-+ if (of_device_is_compatible(node, "aspeed,ast2500-i2c-ic"))
-+ writel(ASPEED_I2C_SRAM_BUFFER_EN,
-+ i2c_ic->base + ASPEED_I2C_GLOBAL_CTRL_REG);
-+
- pr_info("i2c controller registered, irq %d\n", i2c_ic->parent_irq);
+- dev_info(bus->dev, "i2c bus %d registered, irq %d\n",
+- bus->adap.nr, irq);
++ dev_info(bus->dev, "i2c bus %d registered (%s mode), irq %d\n",
++ bus->adap.nr, bus->buf_base ? "buffer" : "byte", irq);
return 0;
+ }
--
2.7.4
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0067-i2c-aspeed-add-DMA-mode-transfer-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0067-i2c-aspeed-add-DMA-mode-transfer-support.patch
new file mode 100644
index 000000000..a051dbc4d
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0067-i2c-aspeed-add-DMA-mode-transfer-support.patch
@@ -0,0 +1,442 @@
+From 7defe387ea07af3d48feb4daec78d54a284105f1 Mon Sep 17 00:00:00 2001
+From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+Date: Tue, 18 Jun 2019 08:47:50 -0700
+Subject: [PATCH] i2c: aspeed: add DMA mode transfer support
+
+This commit adds DMA mode transfer support.
+
+Only AST2500 supports DMA mode under some limitations:
+I2C is sharing the DMA H/W with UHCI host controller and MCTP
+controller. Since those controllers operate with DMA mode only, I2C
+has to use buffer mode or byte mode instead if one of those
+controllers is enabled. Also make sure that if SD/eMMC or Port80
+snoop uses DMA mode instead of PIO or FIFO respectively, I2C can't
+use DMA mode.
+
+Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+---
+ .../devicetree/bindings/i2c/i2c-aspeed.txt | 25 +++
+ drivers/i2c/busses/i2c-aspeed.c | 231 +++++++++++++++++++--
+ 2 files changed, 241 insertions(+), 15 deletions(-)
+
+diff --git a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt
+index e1a0ae7a8c08..97142516399a 100644
+--- a/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt
++++ b/Documentation/devicetree/bindings/i2c/i2c-aspeed.txt
+@@ -19,6 +19,16 @@ Optional Properties:
+ - bus-frequency : frequency of the bus clock in Hz defaults to 100 kHz when not
+ specified
+ - multi-master : states that there is another master active on this bus.
++- aspeed,dma-buf-size : size of DMA buffer (from 2 to 4095 in case of AST2500).
++ Only AST2500 supports DMA mode under some limitations:
++ I2C is sharing the DMA H/W with UHCI host controller
++ and MCTP controller. Since those controllers operate
++ with DMA mode only, I2C has to use buffer mode or byte
++ mode instead if one of those controllers is enabled.
++ Also make sure that if SD/eMMC or Port80 snoop uses
++ DMA mode instead of PIO or FIFO respectively, I2C
++ can't use DMA mode. IF both DMA and buffer modes are
++ enabled, DMA mode will be selected.
+ - general-call : enables general call receiving.
+ - bus-timeout-ms: bus timeout in milliseconds defaults to 1 second when not
+ specified.
+@@ -75,4 +85,19 @@ i2c {
+ interrupts = <1>;
+ interrupt-parent = <&i2c_ic>;
+ };
++
++ /* DMA mode transfer enabled */
++ i2c2: i2c-bus@c0 {
++ #address-cells = <1>;
++ #size-cells = <0>;
++ #interrupt-cells = <1>;
++ reg = <0xc0 0x40>;
++ aspeed,dma-buf-size = <4095>;
++ compatible = "aspeed,ast2500-i2c-bus";
++ clocks = <&syscon ASPEED_CLK_APB>;
++ resets = <&syscon ASPEED_RESET_I2C>;
++ bus-frequency = <100000>;
++ interrupts = <2>;
++ interrupt-parent = <&i2c_ic>;
++ };
+ };
+diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
+index b721fb1d6d4c..127bc69952ca 100644
+--- a/drivers/i2c/busses/i2c-aspeed.c
++++ b/drivers/i2c/busses/i2c-aspeed.c
+@@ -10,6 +10,8 @@
+ #include <linux/bitfield.h>
+ #include <linux/clk.h>
+ #include <linux/completion.h>
++#include <linux/dma-mapping.h>
++#include <linux/dmapool.h>
+ #include <linux/err.h>
+ #include <linux/errno.h>
+ #include <linux/i2c.h>
+@@ -47,6 +49,8 @@
+ #define ASPEED_I2C_DEV_ADDR_REG 0x18
+ #define ASPEED_I2C_BUF_CTRL_REG 0x1c
+ #define ASPEED_I2C_BYTE_BUF_REG 0x20
++#define ASPEED_I2C_DMA_ADDR_REG 0x24
++#define ASPEED_I2C_DMA_LEN_REG 0x28
+
+ /* Device Register Definition */
+ /* 0x00 : I2CD Function Control Register */
+@@ -112,6 +116,8 @@
+ #define ASPEED_I2CD_BUS_RECOVER_CMD BIT(11)
+
+ /* Command Bit */
++#define ASPEED_I2CD_RX_DMA_ENABLE BIT(9)
++#define ASPEED_I2CD_TX_DMA_ENABLE BIT(8)
+ #define ASPEED_I2CD_RX_BUFF_ENABLE BIT(7)
+ #define ASPEED_I2CD_TX_BUFF_ENABLE BIT(6)
+ #define ASPEED_I2CD_M_STOP_CMD BIT(5)
+@@ -131,6 +137,14 @@
+ #define ASPEED_I2CD_BUF_TX_COUNT_MASK GENMASK(15, 8)
+ #define ASPEED_I2CD_BUF_OFFSET_MASK GENMASK(5, 0)
+
++/* 0x24 : I2CD DMA Mode Buffer Address Register */
++#define ASPEED_I2CD_DMA_ADDR_MASK GENMASK(31, 2)
++#define ASPEED_I2CD_DMA_ALIGN 4
++
++/* 0x28 : I2CD DMA Transfer Length Register */
++#define ASPEED_I2CD_DMA_LEN_SHIFT 0
++#define ASPEED_I2CD_DMA_LEN_MASK GENMASK(11, 0)
++
+ enum aspeed_i2c_master_state {
+ ASPEED_I2C_MASTER_INACTIVE,
+ ASPEED_I2C_MASTER_PENDING,
+@@ -183,6 +197,12 @@ struct aspeed_i2c_bus {
+ size_t buf_size;
+ u8 buf_offset;
+ u8 buf_page;
++ /* DMA mode */
++ struct dma_pool *dma_pool;
++ dma_addr_t dma_handle;
++ u8 *dma_buf;
++ size_t dma_buf_size;
++ size_t dma_len;
+ #if IS_ENABLED(CONFIG_I2C_SLAVE)
+ struct i2c_client *slave;
+ enum aspeed_i2c_slave_state slave_state;
+@@ -310,9 +330,13 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+
+ /* Slave was sent something. */
+ if (irq_status & ASPEED_I2CD_INTR_RX_DONE) {
+- if (bus->buf_base &&
++ if (bus->dma_buf &&
+ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED &&
+ !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP))
++ value = bus->dma_buf[0];
++ else if (bus->buf_base &&
++ bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED &&
++ !(irq_status & ASPEED_I2CD_INTR_NORMAL_STOP))
+ value = readb(bus->buf_base);
+ else
+ value = readl(bus->base + ASPEED_I2C_BYTE_BUF_REG) >> 8;
+@@ -347,7 +371,18 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP) {
+ if (bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED &&
+ irq_status & ASPEED_I2CD_INTR_RX_DONE) {
+- if (bus->buf_base) {
++ if (bus->dma_buf) {
++ len = bus->dma_buf_size -
++ FIELD_GET(ASPEED_I2CD_DMA_LEN_MASK,
++ readl(bus->base +
++ ASPEED_I2C_DMA_LEN_REG));
++ for (i = 0; i < len; i++) {
++ value = bus->dma_buf[i];
++ i2c_slave_event(slave,
++ I2C_SLAVE_WRITE_RECEIVED,
++ &value);
++ }
++ } else if (bus->buf_base) {
+ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK,
+ readl(bus->base +
+ ASPEED_I2C_BUF_CTRL_REG));
+@@ -391,7 +426,15 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ case ASPEED_I2C_SLAVE_WRITE_REQUESTED:
+ bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED;
+ i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
+- if (bus->buf_base) {
++ if (bus->dma_buf) {
++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK,
++ bus->base + ASPEED_I2C_DMA_ADDR_REG);
++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK,
++ bus->dma_buf_size),
++ bus->base + ASPEED_I2C_DMA_LEN_REG);
++ writel(ASPEED_I2CD_RX_DMA_ENABLE,
++ bus->base + ASPEED_I2C_CMD_REG);
++ } else if (bus->buf_base) {
+ writel(FIELD_PREP(ASPEED_I2CD_BUF_RX_SIZE_MASK,
+ bus->buf_size - 1) |
+ FIELD_PREP(ASPEED_I2CD_BUF_OFFSET_MASK,
+@@ -403,7 +446,25 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ break;
+ case ASPEED_I2C_SLAVE_WRITE_RECEIVED:
+ i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value);
+- if (bus->buf_base) {
++ if (bus->dma_buf) {
++ len = bus->dma_buf_size -
++ FIELD_GET(ASPEED_I2CD_DMA_LEN_MASK,
++ readl(bus->base +
++ ASPEED_I2C_DMA_LEN_REG));
++ for (i = 1; i < len; i++) {
++ value = bus->dma_buf[i];
++ i2c_slave_event(slave,
++ I2C_SLAVE_WRITE_RECEIVED,
++ &value);
++ }
++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK,
++ bus->base + ASPEED_I2C_DMA_ADDR_REG);
++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK,
++ bus->dma_buf_size),
++ bus->base + ASPEED_I2C_DMA_LEN_REG);
++ writel(ASPEED_I2CD_RX_DMA_ENABLE,
++ bus->base + ASPEED_I2C_CMD_REG);
++ } else if (bus->buf_base) {
+ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK,
+ readl(bus->base +
+ ASPEED_I2C_BUF_CTRL_REG));
+@@ -472,7 +533,23 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
+ if (msg->flags & I2C_M_RD) {
+ command |= ASPEED_I2CD_M_RX_CMD;
+
+- if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) {
++ if (bus->dma_buf && !(msg->flags & I2C_M_RECV_LEN)) {
++ command |= ASPEED_I2CD_RX_DMA_ENABLE;
++
++ if (msg->len > bus->dma_buf_size) {
++ len = bus->dma_buf_size;
++ } else {
++ len = msg->len;
++ command |= ASPEED_I2CD_M_S_RX_CMD_LAST;
++ }
++
++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK,
++ bus->base + ASPEED_I2C_DMA_ADDR_REG);
++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK,
++ len),
++ bus->base + ASPEED_I2C_DMA_LEN_REG);
++ bus->dma_len = len;
++ } else if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) {
+ command |= ASPEED_I2CD_RX_BUFF_ENABLE;
+
+ if (msg->len > bus->buf_size) {
+@@ -493,7 +570,26 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
+ command |= ASPEED_I2CD_M_S_RX_CMD_LAST;
+ }
+ } else {
+- if (bus->buf_base) {
++ if (bus->dma_buf) {
++ command |= ASPEED_I2CD_TX_DMA_ENABLE;
++
++ if (msg->len + 1 > bus->dma_buf_size)
++ len = bus->dma_buf_size;
++ else
++ len = msg->len + 1;
++
++ bus->dma_buf[0] = slave_addr;
++ memcpy(bus->dma_buf + 1, msg->buf, len);
++
++ bus->buf_index = len - 1;
++
++ writel(bus->dma_handle & ASPEED_I2CD_DMA_ADDR_MASK,
++ bus->base + ASPEED_I2C_DMA_ADDR_REG);
++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK,
++ len),
++ bus->base + ASPEED_I2C_DMA_LEN_REG);
++ bus->dma_len = len;
++ } else if (bus->buf_base) {
+ int i;
+
+ command |= ASPEED_I2CD_TX_BUFF_ENABLE;
+@@ -529,7 +625,8 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
+ }
+ }
+
+- if (!(command & ASPEED_I2CD_TX_BUFF_ENABLE))
++ if (!(command & (ASPEED_I2CD_TX_BUFF_ENABLE |
++ ASPEED_I2CD_TX_DMA_ENABLE)))
+ writel(slave_addr, bus->base + ASPEED_I2C_BYTE_BUF_REG);
+ writel(command, bus->base + ASPEED_I2C_CMD_REG);
+ }
+@@ -685,7 +782,28 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ if (bus->buf_index < msg->len) {
+ command = ASPEED_I2CD_M_TX_CMD;
+
+- if (bus->buf_base) {
++ if (bus->dma_buf) {
++ command |= ASPEED_I2CD_TX_DMA_ENABLE;
++
++ if (msg->len - bus->buf_index >
++ bus->dma_buf_size)
++ len = bus->dma_buf_size;
++ else
++ len = msg->len - bus->buf_index;
++
++ memcpy(bus->dma_buf, msg->buf + bus->buf_index,
++ len);
++
++ bus->buf_index += len;
++
++ writel(bus->dma_handle &
++ ASPEED_I2CD_DMA_ADDR_MASK,
++ bus->base + ASPEED_I2C_DMA_ADDR_REG);
++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK,
++ len),
++ bus->base + ASPEED_I2C_DMA_LEN_REG);
++ bus->dma_len = len;
++ } else if (bus->buf_base) {
+ u8 wbuf[4];
+ int i;
+
+@@ -736,7 +854,15 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ }
+ irq_handled |= ASPEED_I2CD_INTR_RX_DONE;
+
+- if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) {
++ if (bus->dma_buf && !(msg->flags & I2C_M_RECV_LEN)) {
++ len = bus->dma_len -
++ FIELD_GET(ASPEED_I2CD_DMA_LEN_MASK,
++ readl(bus->base +
++ ASPEED_I2C_DMA_LEN_REG));
++
++ memcpy(msg->buf + bus->buf_index, bus->dma_buf, len);
++ bus->buf_index += len;
++ } else if (bus->buf_base && !(msg->flags & I2C_M_RECV_LEN)) {
+ len = FIELD_GET(ASPEED_I2CD_BUF_RX_COUNT_MASK,
+ readl(bus->base +
+ ASPEED_I2C_BUF_CTRL_REG));
+@@ -764,7 +890,25 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ if (bus->buf_index < msg->len) {
+ command = ASPEED_I2CD_M_RX_CMD;
+ bus->master_state = ASPEED_I2C_MASTER_RX;
+- if (bus->buf_base) {
++ if (bus->dma_buf) {
++ command |= ASPEED_I2CD_RX_DMA_ENABLE;
++
++ if (msg->len - bus->buf_index >
++ bus->dma_buf_size) {
++ len = bus->dma_buf_size;
++ } else {
++ len = msg->len - bus->buf_index;
++ command |= ASPEED_I2CD_M_S_RX_CMD_LAST;
++ }
++
++ writel(bus->dma_handle &
++ ASPEED_I2CD_DMA_ADDR_MASK,
++ bus->base + ASPEED_I2C_DMA_ADDR_REG);
++ writel(FIELD_PREP(ASPEED_I2CD_DMA_LEN_MASK,
++ len),
++ bus->base + ASPEED_I2C_DMA_LEN_REG);
++ bus->dma_len = len;
++ } else if (bus->buf_base) {
+ command |= ASPEED_I2CD_RX_BUFF_ENABLE;
+
+ if (msg->len - bus->buf_index >
+@@ -1257,7 +1401,51 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
+ sram_enabled = false;
+ }
+
+- if (sram_enabled) {
++ /*
++ * Only AST2500 supports DMA mode under some limitations:
++ * I2C is sharing the DMA H/W with UHCI host controller and MCTP
++ * controller. Since those controllers operate with DMA mode only, I2C
++ * has to use buffer mode or byte mode instead if one of those
++ * controllers is enabled. Also make sure that if SD/eMMC or Port80
++ * snoop uses DMA mode instead of PIO or FIFO respectively, I2C can't
++ * use DMA mode.
++ */
++ if (sram_enabled && !IS_ENABLED(CONFIG_USB_UHCI_ASPEED) &&
++ of_device_is_compatible(pdev->dev.of_node,
++ "aspeed,ast2500-i2c-bus")) {
++ u32 dma_len_max = ASPEED_I2CD_DMA_LEN_MASK >>
++ ASPEED_I2CD_DMA_LEN_SHIFT;
++
++ ret = device_property_read_u32(&pdev->dev,
++ "aspeed,dma-buf-size",
++ &bus->dma_buf_size);
++ if (!ret && bus->dma_buf_size > dma_len_max)
++ bus->dma_buf_size = dma_len_max;
++ }
++
++ if (bus->dma_buf_size) {
++ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
++ dev_warn(&pdev->dev, "No suitable DMA available\n");
++ } else {
++ bus->dma_pool = dma_pool_create("i2c-aspeed",
++ &pdev->dev,
++ bus->dma_buf_size,
++ ASPEED_I2CD_DMA_ALIGN,
++ 0);
++ if (bus->dma_pool)
++ bus->dma_buf = dma_pool_alloc(bus->dma_pool,
++ GFP_KERNEL,
++ &bus->dma_handle);
++
++ if (!bus->dma_buf) {
++ dev_warn(&pdev->dev,
++ "Cannot allocate DMA buffer\n");
++ dma_pool_destroy(bus->dma_pool);
++ }
++ }
++ }
++
++ if (!bus->dma_buf && sram_enabled) {
+ struct resource *res = platform_get_resource(pdev,
+ IORESOURCE_MEM, 1);
+
+@@ -1297,24 +1485,33 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
+ */
+ ret = aspeed_i2c_init(bus, pdev);
+ if (ret < 0)
+- return ret;
++ goto out_free_dma_buf;
+
+ irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+ ret = devm_request_irq(&pdev->dev, irq, aspeed_i2c_bus_irq,
+ 0, dev_name(&pdev->dev), bus);
+ if (ret < 0)
+- return ret;
++ goto out_free_dma_buf;
+
+ ret = i2c_add_adapter(&bus->adap);
+ if (ret < 0)
+- return ret;
++ goto out_free_dma_buf;
+
+ platform_set_drvdata(pdev, bus);
+
+ dev_info(bus->dev, "i2c bus %d registered (%s mode), irq %d\n",
+- bus->adap.nr, bus->buf_base ? "buffer" : "byte", irq);
++ bus->adap.nr, bus->dma_buf ? "dma" :
++ bus->buf_base ? "buffer" : "byte",
++ irq);
+
+ return 0;
++
++out_free_dma_buf:
++ if (bus->dma_buf)
++ dma_pool_free(bus->dma_pool, bus->dma_buf, bus->dma_handle);
++ dma_pool_destroy(bus->dma_pool);
++
++ return ret;
+ }
+
+ static int aspeed_i2c_remove_bus(struct platform_device *pdev)
+@@ -1332,6 +1529,10 @@ static int aspeed_i2c_remove_bus(struct platform_device *pdev)
+
+ reset_control_assert(bus->rst);
+
++ if (bus->dma_buf)
++ dma_pool_free(bus->dma_pool, bus->dma_buf, bus->dma_handle);
++ dma_pool_destroy(bus->dma_pool);
++
+ i2c_del_adapter(&bus->adap);
+
+ return 0;
+--
+2.7.4
+
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch
new file mode 100644
index 000000000..f4dfd6cfa
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch
@@ -0,0 +1,181 @@
+From 9a43b47fb794fd195912c6956783b021a46307f8 Mon Sep 17 00:00:00 2001
+From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+Date: Thu, 11 Jul 2019 13:53:34 -0700
+Subject: [PATCH] i2c: aspeed: add H/W timeout support
+
+This commit adds I2C H/W timeout support.
+
+Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+---
+ drivers/i2c/busses/i2c-aspeed.c | 79 +++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 73 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
+index 0ed9a27850e6..ecb5793036cc 100644
+--- a/drivers/i2c/busses/i2c-aspeed.c
++++ b/drivers/i2c/busses/i2c-aspeed.c
+@@ -71,10 +71,14 @@
+ #define ASPEED_I2CD_TIME_SCL_HIGH_MASK GENMASK(19, 16)
+ #define ASPEED_I2CD_TIME_SCL_LOW_SHIFT 12
+ #define ASPEED_I2CD_TIME_SCL_LOW_MASK GENMASK(15, 12)
++#define ASPEED_I2CD_TIME_TIMEOUT_BASE_DIVISOR_SHIFT 8
++#define ASPEED_I2CD_TIME_TIMEOUT_BASE_DIVISOR_MASK GENMASK(9, 8)
+ #define ASPEED_I2CD_TIME_BASE_DIVISOR_MASK GENMASK(3, 0)
+ #define ASPEED_I2CD_TIME_SCL_REG_MAX GENMASK(3, 0)
++
+ /* 0x08 : I2CD Clock and AC Timing Control Register #2 */
+-#define ASPEED_NO_TIMEOUT_CTRL 0
++#define ASPEED_I2CD_TIMEOUT_CYCLES_SHIFT 0
++#define ASPEED_I2CD_TIMEOUT_CYCLES_MASK GENMASK(4, 0)
+
+ /* 0x0c : I2CD Interrupt Control Register &
+ * 0x10 : I2CD Interrupt Status Register
+@@ -82,6 +86,7 @@
+ * These share bit definitions, so use the same values for the enable &
+ * status bits.
+ */
++#define ASPEED_I2CD_INTR_SLAVE_INACTIVE_TIMEOUT BIT(15)
+ #define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14)
+ #define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13)
+ #define ASPEED_I2CD_INTR_GCALL_ADDR BIT(8)
+@@ -98,8 +103,11 @@
+ ASPEED_I2CD_INTR_SCL_TIMEOUT | \
+ ASPEED_I2CD_INTR_ABNORMAL | \
+ ASPEED_I2CD_INTR_ARBIT_LOSS)
++#define ASPEED_I2CD_INTR_SLAVE_ERRORS \
++ ASPEED_I2CD_INTR_SLAVE_INACTIVE_TIMEOUT
+ #define ASPEED_I2CD_INTR_ALL \
+- (ASPEED_I2CD_INTR_SDA_DL_TIMEOUT | \
++ (ASPEED_I2CD_INTR_SLAVE_INACTIVE_TIMEOUT | \
++ ASPEED_I2CD_INTR_SDA_DL_TIMEOUT | \
+ ASPEED_I2CD_INTR_BUS_RECOVER_DONE | \
+ ASPEED_I2CD_INTR_SCL_TIMEOUT | \
+ ASPEED_I2CD_INTR_ABNORMAL | \
+@@ -180,6 +188,7 @@ struct aspeed_i2c_bus {
+ u32 divisor);
+ unsigned long parent_clk_frequency;
+ u32 bus_frequency;
++ u32 hw_timeout_ms;
+ /* Transaction state. */
+ enum aspeed_i2c_master_state master_state;
+ struct i2c_msg *msgs;
+@@ -297,6 +306,14 @@ static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus)
+ }
+
+ #if IS_ENABLED(CONFIG_I2C_SLAVE)
++static int aspeed_i2c_check_slave_error(u32 irq_status)
++{
++ if (irq_status & ASPEED_I2CD_INTR_SLAVE_INACTIVE_TIMEOUT)
++ return -EIO;
++
++ return 0;
++}
++
+ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ {
+ u32 command, irq_handled = 0;
+@@ -307,6 +324,14 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ if (!slave)
+ return 0;
+
++ if (aspeed_i2c_check_slave_error(irq_status)) {
++ dev_dbg(bus->dev, "received slave error interrupt: 0x%08x\n",
++ irq_status);
++ irq_handled |= (irq_status & ASPEED_I2CD_INTR_SLAVE_ERRORS);
++ bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE;
++ return irq_handled;
++ }
++
+ command = readl(bus->base + ASPEED_I2C_CMD_REG);
+
+ /* Slave was requested, restart state machine. */
+@@ -649,7 +674,7 @@ static void aspeed_i2c_next_msg_or_stop(struct aspeed_i2c_bus *bus)
+ }
+ }
+
+-static int aspeed_i2c_is_irq_error(u32 irq_status)
++static int aspeed_i2c_check_master_error(u32 irq_status)
+ {
+ if (irq_status & ASPEED_I2CD_INTR_ARBIT_LOSS)
+ return -EAGAIN;
+@@ -680,9 +705,9 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ * should clear the command queue effectively taking us back to the
+ * INACTIVE state.
+ */
+- ret = aspeed_i2c_is_irq_error(irq_status);
++ ret = aspeed_i2c_check_master_error(irq_status);
+ if (ret) {
+- dev_dbg(bus->dev, "received error interrupt: 0x%08x\n",
++ dev_dbg(bus->dev, "received master error interrupt: 0x%08x\n",
+ irq_status);
+ irq_handled |= (irq_status & ASPEED_I2CD_INTR_MASTER_ERRORS);
+ if (bus->master_state != ASPEED_I2C_MASTER_INACTIVE) {
+@@ -1251,6 +1276,7 @@ static u32 aspeed_i2c_25xx_get_clk_reg_val(struct device *dev, u32 divisor)
+ /* precondition: bus.lock has been acquired. */
+ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus)
+ {
++ u32 timeout_base_divisor, timeout_tick_us, timeout_cycles;
+ u32 divisor, clk_reg_val;
+
+ divisor = DIV_ROUND_UP(bus->parent_clk_frequency, bus->bus_frequency);
+@@ -1259,8 +1285,46 @@ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus)
+ ASPEED_I2CD_TIME_THDSTA_MASK |
+ ASPEED_I2CD_TIME_TACST_MASK);
+ clk_reg_val |= bus->get_clk_reg_val(bus->dev, divisor);
++
++ if (bus->hw_timeout_ms) {
++ u8 div_max = ASPEED_I2CD_TIME_TIMEOUT_BASE_DIVISOR_MASK >>
++ ASPEED_I2CD_TIME_TIMEOUT_BASE_DIVISOR_SHIFT;
++ u8 cycles_max = ASPEED_I2CD_TIMEOUT_CYCLES_MASK >>
++ ASPEED_I2CD_TIMEOUT_CYCLES_SHIFT;
++
++ timeout_base_divisor = 0;
++
++ do {
++ timeout_tick_us = 1000 * (16384 <<
++ (timeout_base_divisor << 1)) /
++ (bus->parent_clk_frequency / 1000);
++
++ if (timeout_base_divisor == div_max ||
++ timeout_tick_us * ASPEED_I2CD_TIMEOUT_CYCLES_MASK >=
++ bus->hw_timeout_ms * 1000)
++ break;
++ } while (timeout_base_divisor++ < div_max);
++
++ if (timeout_tick_us) {
++ timeout_cycles = DIV_ROUND_UP(bus->hw_timeout_ms * 1000,
++ timeout_tick_us);
++ if (timeout_cycles == 0)
++ timeout_cycles = 1;
++ else if (timeout_cycles > cycles_max)
++ timeout_cycles = cycles_max;
++ } else {
++ timeout_cycles = 0;
++ }
++ } else {
++ timeout_base_divisor = 0;
++ timeout_cycles = 0;
++ }
++
++ clk_reg_val |= FIELD_PREP(ASPEED_I2CD_TIME_TIMEOUT_BASE_DIVISOR_MASK,
++ timeout_base_divisor);
++
+ writel(clk_reg_val, bus->base + ASPEED_I2C_AC_TIMING_REG1);
+- writel(ASPEED_NO_TIMEOUT_CTRL, bus->base + ASPEED_I2C_AC_TIMING_REG2);
++ writel(timeout_cycles, bus->base + ASPEED_I2C_AC_TIMING_REG2);
+
+ return 0;
+ }
+@@ -1464,6 +1528,9 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
+ }
+ }
+
++ device_property_read_u32(&pdev->dev, "aspeed,hw-timeout-ms",
++ &bus->hw_timeout_ms);
++
+ /* Initialize the I2C adapter */
+ spin_lock_init(&bus->lock);
+ init_completion(&bus->cmd_complete);
+--
+2.7.4
+
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend
index ed5be3455..999c8d17c 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend
@@ -13,6 +13,7 @@ SRC_URI += " \
file://0009-SGPIO-DT-and-pinctrl-fixup.patch \
file://0010-Update-PECI-drivers-to-sync-with-linux-upstreaming-v.patch \
file://0019-Add-I2C-IPMB-support.patch \
+ file://0020-misc-aspeed-add-lpc-mbox-driver.patch \
file://0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch \
file://0022-Add-AST2500-eSPI-driver.patch \
file://0026-Add-support-for-new-PECI-commands.patch \
@@ -24,14 +25,11 @@ SRC_URI += " \
file://0035-Implement-a-memory-driver-share-memory.patch \
file://0039-Add-Aspeed-PWM-driver-which-uses-FTTMR010-timer-IP.patch \
file://0040-i2c-Add-mux-hold-unhold-msg-types.patch \
- file://0041-Enable-passthrough-based-gpio-character-device.patch \
file://0042-Add-bus-timeout-ms-and-retries-device-tree-propertie.patch \
file://0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch \
file://0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch \
file://0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch \
- file://0046-misc-Add-clock-control-logic-into-Aspeed-LPC-MBOX-dr.patch \
file://0047-misc-Block-error-printing-on-probe-defer-case-in-Asp.patch \
- file://0048-ARM-dts-aspeed-Set-default-status-of-LPC-BT-as-disab.patch \
file://0049-Suppress-excessive-HID-gadget-error-logs.patch \
file://0051-Add-AST2500-JTAG-device.patch \
file://0052-drivers-jtag-Add-JTAG-core-driver.patch \
@@ -43,4 +41,7 @@ SRC_URI += " \
file://0058-i2c-aspeed-add-general-call-support.patch \
file://0065-i2c-aspeed-fix-master-pending-state-handling.patch \
file://0066-i2c-aspeed-add-buffer-mode-transfer-support.patch \
+ file://0067-i2c-aspeed-add-DMA-mode-transfer-support.patch \
+ file://0001-set-idle-disconnect-to-true-in-all-cases.patch \
+ file://0068-i2c-aspeed-add-H-W-timeout-support.patch \
"
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-libc-headers/0001-Enable-passthrough-based-gpio-character-device.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-libc-headers/0001-Enable-passthrough-based-gpio-character-device.patch
deleted file mode 100644
index 15e845ebc..000000000
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-libc-headers/0001-Enable-passthrough-based-gpio-character-device.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 61a5796d151337fd537d1aeb3fb072dcdf96abbe Mon Sep 17 00:00:00 2001
-From: Kuiying Wang <kuiying.wang@intel.com>
-Date: Sun, 3 Feb 2019 16:08:11 +0800
-Subject: [PATCH] Enable passthrough based gpio character device.
-
-Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
----
- include/uapi/linux/gpio.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h
-index 1bf6e6df..8883ca90 100644
---- a/include/uapi/linux/gpio.h
-+++ b/include/uapi/linux/gpio.h
-@@ -62,7 +62,7 @@ struct gpioline_info {
- #define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2)
- #define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3)
- #define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4)
--
-+#define GPIOHANDLE_REQUEST_PASS_THROUGH (1UL << 5)
- /**
- * struct gpiohandle_request - Information about a GPIO handle request
- * @lineoffsets: an array desired lines, specified by offset index for the
---
-2.16.2
-
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-libc-headers_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-libc-headers_%.bbappend
deleted file mode 100644
index 703af71df..000000000
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-libc-headers_%.bbappend
+++ /dev/null
@@ -1,5 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-
-SRC_URI += " \
- file://0001-Enable-passthrough-based-gpio-character-device.patch \
- "