diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-kernel')
8 files changed, 436 insertions, 42 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2600-platforms.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2600-platforms.patch index dcc4b887e..885e15e4c 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2600-platforms.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-arm-dts-add-DTS-for-Intel-ast2600-platforms.patch @@ -1,11 +1,10 @@ -From a25d8478847866e823aed2ecd1e360d5685410bf Mon Sep 17 00:00:00 2001 +From c8c8503401e8593860b4b78340a50d55a1a780b3 Mon Sep 17 00:00:00 2001 From: Vernon Mauery <vernon.mauery@linux.intel.com> Date: Tue, 19 Sep 2017 15:55:39 +0800 Subject: [PATCH] arm: dts: add DTS for Intel ast2600 platforms Add the DTS file for Intel ast2600-based systems. -Change-Id: Ib0b5358570a967c255a370bf2503cc2f448039bb Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> Signed-off-by: Chen Yugang <yugang.chen@linux.intel.com> @@ -13,16 +12,16 @@ Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> Signed-off-by: arun-pm <arun.p.m@linux.intel.com> Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> --- - .../arm/boot/dts/aspeed-bmc-intel-ast2600.dts | 502 ++++++++++++++++++ - 1 file changed, 502 insertions(+) + arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts | 498 +++++++++++++++++++++++++ + 1 file changed, 498 insertions(+) create mode 100644 arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts new file mode 100644 -index 000000000000..d32b0390cd87 +index 000000000000..c51ed3c57f3e --- /dev/null +++ b/arch/arm/boot/dts/aspeed-bmc-intel-ast2600.dts -@@ -0,0 +1,502 @@ +@@ -0,0 +1,498 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + @@ -320,8 +319,6 @@ index 000000000000..d32b0390cd87 + +&uart1 { + status = "okay"; -+ // Workaround for A0 -+ compatible = "snps,dw-apb-uart"; + pinctrl-0 = <&pinctrl_txd1_default + &pinctrl_rxd1_default + &pinctrl_nrts1_default @@ -334,8 +331,6 @@ index 000000000000..d32b0390cd87 + +&uart2 { + status = "okay"; -+ // Workaround for A0 -+ compatible = "snps,dw-apb-uart"; + pinctrl-0 = <&pinctrl_txd2_default + &pinctrl_rxd2_default + &pinctrl_nrts2_default @@ -348,15 +343,11 @@ index 000000000000..d32b0390cd87 + +&uart3 { + status = "okay"; -+ // Workaround for A0 -+ compatible = "snps,dw-apb-uart"; + pinctrl-0 = <>; +}; + +&uart4 { + status = "okay"; -+ // Workaround for A0 -+ compatible = "snps,dw-apb-uart"; + pinctrl-0 = <>; +}; + @@ -462,7 +453,7 @@ index 000000000000..d32b0390cd87 +}; + +&pwm_tacho { -+ status = "okay"; ++ status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pwm0_default &pinctrl_tach0_default + &pinctrl_pwm1_default &pinctrl_tach1_default @@ -525,6 +516,10 @@ index 000000000000..d32b0390cd87 +&vhub { + status = "okay"; +}; ++ ++&jtag { ++ status = "okay"; ++}; -- -2.17.1 +2.7.4 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 64059b1da..c409dec50 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 34308f4078361987adfb854bdc6876abdaf323cb Mon Sep 17 00:00:00 2001 +From e6e186acacc16fd95251b2d0fb024993a66ffa0a 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] Add AST2500 eSPI driver @@ -187,10 +187,10 @@ index 000000000000..887a69a7130a +- 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 c15be82c3a9d..bd2037e52a94 100644 +index 26d885d2bd8a..7b798c49cb95 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -316,6 +316,7 @@ +@@ -336,6 +336,7 @@ clocks = <&syscon ASPEED_CLK_APB>; interrupt-controller; #interrupt-cells = <2>; @@ -198,7 +198,7 @@ index c15be82c3a9d..bd2037e52a94 100644 }; sgpio: sgpio@1e780200 { -@@ -412,6 +413,9 @@ +@@ -432,6 +433,9 @@ reg = <0x1e6ee000 0x100>; interrupts = <23>; status = "disabled"; @@ -209,18 +209,18 @@ index c15be82c3a9d..bd2037e52a94 100644 lpc: lpc@1e789000 { diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi -index 62d101dc6926..753770912f0a 100644 +index 825e64ce317a..315d35c15208 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi -@@ -3,6 +3,7 @@ - +@@ -4,6 +4,7 @@ #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/clock/ast2600-clock.h> + #include <dt-bindings/interrupt-controller/aspeed-scu-ic.h> +#include <dt-bindings/gpio/aspeed-gpio.h> / { model = "Aspeed BMC"; -@@ -674,6 +675,19 @@ +@@ -708,6 +709,19 @@ 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 798038a8e..741b44462 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 5ccf8e3e397edf195aa65e91af6e9ea16ed88882 Mon Sep 17 00:00:00 2001 +From 9be0e8ccde0e096cc494aad6f15e7d7d3de3e46f 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 @@ -45,12 +45,12 @@ index 000000000000..03f57c53e844 + reg = <0x9ff00000 0x100000>; +}; diff --git a/drivers/soc/aspeed/Kconfig b/drivers/soc/aspeed/Kconfig -index 285c19042c65..59f25d16d6e7 100644 +index cb85917b8c6f..13cd9fbabbf1 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. +@@ -59,4 +59,13 @@ config ASPEED_XDMA + SOCs. The XDMA engine can perform automatic PCI DMA operations + between the AST2XXX (acting as a BMC) and a host processor. +config ASPEED_VGA_SHAREDMEM + tristate "Aspeed VGA Shared memory" @@ -63,15 +63,14 @@ index 285c19042c65..59f25d16d6e7 100644 + endmenu diff --git a/drivers/soc/aspeed/Makefile b/drivers/soc/aspeed/Makefile -index 2e547cc47e62..ae4ef10914be 100644 +index 56c5de5eeabe..875f0d9e7866 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 +@@ -6,3 +6,4 @@ 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 + obj-$(CONFIG_ASPEED_XDMA) += aspeed-xdma.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..cd1f5431378c 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 c3c1eb509..4230c077b 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 fe860284fb5e062b430dc7b882144f69cb605353 Mon Sep 17 00:00:00 2001 +From 1bf4e5a8cd7ca069092bfe7ac3fd3d1879b7a87d 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 AST2500 JTAG device @@ -8,7 +8,8 @@ Adding aspeed jtag device Signed-off-by: Hunt, Bryan <bryan.hunt@intel.com> --- arch/arm/boot/dts/aspeed-g5.dtsi | 9 +++++++++ - 1 file changed, 9 insertions(+) + arch/arm/boot/dts/aspeed-g6.dtsi | 9 +++++++++ + 2 files changed, 18 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi index 751a8f0316d6..eb1f9c9d9cca 100644 @@ -30,6 +31,26 @@ index 751a8f0316d6..eb1f9c9d9cca 100644 lpc: lpc@1e789000 { compatible = "aspeed,ast2500-lpc", "simple-mfd"; reg = <0x1e789000 0x1000>; +diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi +index bc2ce43827fc..31903b08e731 100644 +--- a/arch/arm/boot/dts/aspeed-g6.dtsi ++++ b/arch/arm/boot/dts/aspeed-g6.dtsi +@@ -333,6 +333,15 @@ + quality = <100>; + }; + ++ jtag: jtag@1e6e4000 { ++ compatible = "aspeed,ast2600-jtag"; ++ reg = <0x1e6e4000 0x40>; ++ clocks = <&syscon ASPEED_CLK_APB1>; ++ resets = <&syscon ASPEED_RESET_JTAG_MASTER>; ++ interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>; ++ status = "disabled"; ++ }; ++ + adc: adc@1e6e9000 { + compatible = "aspeed,ast2500-adc"; + reg = <0x1e6e9000 0x100>; -- 2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0053-Add-Aspeed-SoC-24xx-and-25xx-families-JTAG.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0053-Add-Aspeed-SoC-24xx-and-25xx-families-JTAG.patch index 1ffaf7646..69c993d86 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0053-Add-Aspeed-SoC-24xx-and-25xx-families-JTAG.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0053-Add-Aspeed-SoC-24xx-and-25xx-families-JTAG.patch @@ -1,4 +1,4 @@ -From 817a43d1b1e197e7eff43492599469bbc23bf0fd Mon Sep 17 00:00:00 2001 +From 3b7175753cafcee67cfc13eefc30438a518ad348 Mon Sep 17 00:00:00 2001 From: "Corona, Ernesto" <ernesto.corona@intel.com> Date: Mon, 3 Jun 2019 08:22:09 -0800 Subject: [PATCH] Add Aspeed SoC 24xx and 25xx families JTAG @@ -199,12 +199,12 @@ Comments pointed by kbuild test robot <lkp@intel.com> --- drivers/jtag/Kconfig | 14 + drivers/jtag/Makefile | 1 + - drivers/jtag/jtag-aspeed.c | 1050 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 1065 insertions(+) + drivers/jtag/jtag-aspeed.c | 1051 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 1066 insertions(+) create mode 100644 drivers/jtag/jtag-aspeed.c diff --git a/drivers/jtag/Kconfig b/drivers/jtag/Kconfig -index 47771fc..0cc163f 100644 +index 47771fcd3c5b..0cc163f9ad44 100644 --- a/drivers/jtag/Kconfig +++ b/drivers/jtag/Kconfig @@ -15,3 +15,17 @@ menuconfig JTAG @@ -226,7 +226,7 @@ index 47771fc..0cc163f 100644 + To compile this driver as a module, choose M here: the module will + be called jtag-aspeed. diff --git a/drivers/jtag/Makefile b/drivers/jtag/Makefile -index af37493..04a855e 100644 +index af374939a9e6..04a855e2df28 100644 --- a/drivers/jtag/Makefile +++ b/drivers/jtag/Makefile @@ -1 +1,2 @@ @@ -234,10 +234,10 @@ index af37493..04a855e 100644 +obj-$(CONFIG_JTAG_ASPEED) += jtag-aspeed.o diff --git a/drivers/jtag/jtag-aspeed.c b/drivers/jtag/jtag-aspeed.c new file mode 100644 -index 0000000..1d41a66 +index 000000000000..0c9da1b8986c --- /dev/null +++ b/drivers/jtag/jtag-aspeed.c -@@ -0,0 +1,1050 @@ +@@ -0,0 +1,1051 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2018 Mellanox Technologies. All rights reserved. +// Copyright (c) 2018 Oleksandr Shamray <oleksandrs@mellanox.com> @@ -1272,6 +1272,7 @@ index 0000000..1d41a66 +static const struct of_device_id aspeed_jtag_of_match[] = { + { .compatible = "aspeed,ast2400-jtag", }, + { .compatible = "aspeed,ast2500-jtag", }, ++ { .compatible = "aspeed,ast2600-jtag", }, + {} +}; + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0100-Mailbox-Enabling-interrupt-based-mailbox.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0100-Mailbox-Enabling-interrupt-based-mailbox.patch new file mode 100644 index 000000000..e67adb729 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0100-Mailbox-Enabling-interrupt-based-mailbox.patch @@ -0,0 +1,234 @@ +From 7094f4d8efea8e059c965ba70c73d5226af392cb Mon Sep 17 00:00:00 2001 +From: "Arun P. Mohanan" <arun.p.m@linux.intel.com> +Date: Wed, 11 Mar 2020 17:23:49 +0530 +Subject: [PATCH] [Mailbox] Enabling interrupt based mailbox + +Modifying the mailbox driver to use FIFO queue while using interrupt. + +Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com> +--- + drivers/soc/aspeed/aspeed-lpc-mbox.c | 101 ++++++++++++++++++--------- + 1 file changed, 68 insertions(+), 33 deletions(-) + +diff --git a/drivers/soc/aspeed/aspeed-lpc-mbox.c b/drivers/soc/aspeed/aspeed-lpc-mbox.c +index 795107206022..99f38a4e4550 100644 +--- a/drivers/soc/aspeed/aspeed-lpc-mbox.c ++++ b/drivers/soc/aspeed/aspeed-lpc-mbox.c +@@ -12,10 +12,11 @@ + #include <linux/poll.h> + #include <linux/regmap.h> + #include <linux/slab.h> ++#include <linux/kfifo.h> + + #define DEVICE_NAME "aspeed-mbox" + +-#define MBX_USE_INTERRUPT 0 ++#define MBX_USE_INTERRUPT 1 + + #define ASPEED_MBOX_NUM_REGS 16 + +@@ -29,6 +30,7 @@ + #define ASPEED_MBOX_HOST_CTRL 0x4c + #define ASPEED_MBOX_INTERRUPT_0 0x50 + #define ASPEED_MBOX_INTERRUPT_1 0x54 ++#define MBOX_FIFO_SIZE 64 + + struct aspeed_mbox { + struct miscdevice miscdev; +@@ -38,6 +40,8 @@ struct aspeed_mbox { + int irq; + wait_queue_head_t queue; + struct mutex mutex; ++ struct kfifo fifo; ++ spinlock_t lock; + }; + + static atomic_t aspeed_mbox_open_count = ATOMIC_INIT(0); +@@ -74,20 +78,37 @@ static struct aspeed_mbox *file_mbox(struct file *file) + return container_of(file->private_data, struct aspeed_mbox, miscdev); + } + ++/* Save a byte to a FIFO and discard the oldest byte if FIFO is full */ ++static void put_fifo_with_discard(struct aspeed_mbox *mbox, u8 val) ++{ ++ if (!kfifo_initialized(&mbox->fifo)) ++ return; ++ if (kfifo_is_full(&mbox->fifo)) ++ kfifo_skip(&mbox->fifo); ++ kfifo_put(&mbox->fifo, val); ++} ++ + static int aspeed_mbox_open(struct inode *inode, struct file *file) + { + #if MBX_USE_INTERRUPT + struct aspeed_mbox *mbox = file_mbox(file); ++ int i; + #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 ++ * Reset the FIFO while opening to clear the old cached data ++ * and load the FIFO with latest mailbox register values. + */ +- aspeed_mbox_outb(mbox, ASPEED_MBOX_CTRL_RECV, ASPEED_MBOX_BMC_CTRL); ++ kfifo_reset(&mbox->fifo); ++ spin_lock_irq(&mbox->lock); ++ for (i = 0; i < ASPEED_MBOX_NUM_REGS; i++) { ++ put_fifo_with_discard(mbox, ++ aspeed_mbox_inb(mbox, ASPEED_MBOX_DATA_0 + (i * 4))); ++ } ++ spin_unlock_irq(&mbox->lock); ++ + #endif + return 0; + } +@@ -102,6 +123,8 @@ static ssize_t aspeed_mbox_read(struct file *file, char __user *buf, + struct aspeed_mbox *mbox = file_mbox(file); + char __user *p = buf; + ssize_t ret; ++ unsigned int copied; ++ unsigned long flags; + int i; + + if (!access_ok(buf, count)) +@@ -111,15 +134,29 @@ static ssize_t aspeed_mbox_read(struct file *file, char __user *buf, + 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)) ++ /* ++ * Restrict count as per the number of mailbox registers ++ * if interrupt is enabled. ++ */ ++ if (count != ASPEED_MBOX_NUM_REGS) ++ return -EINVAL; ++ ++ if (kfifo_is_empty(&mbox->fifo)) { ++ if (file->f_flags & O_NONBLOCK){ + return -EAGAIN; +- } else if (wait_event_interruptible(mbox->queue, +- aspeed_mbox_inb(mbox, ASPEED_MBOX_BMC_CTRL) & +- ASPEED_MBOX_CTRL_RECV)) { +- return -ERESTARTSYS; ++ } ++ ret = wait_event_interruptible(mbox->queue, ++ !kfifo_is_empty(&mbox->fifo)); ++ if (ret == -ERESTARTSYS){ ++ return -EINTR; ++ } + } ++ ++ spin_lock_irqsave(&mbox->lock, flags); ++ ret = kfifo_to_user(&mbox->fifo, buf, count, &copied); ++ spin_unlock_irqrestore(&mbox->lock, flags); ++ return ret ? ret : copied; ++ + #endif + + mutex_lock(&mbox->mutex); +@@ -134,11 +171,6 @@ static ssize_t aspeed_mbox_read(struct file *file, char __user *buf, + 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: +@@ -186,16 +218,9 @@ static ssize_t aspeed_mbox_write(struct file *file, const char __user *buf, + 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; ++ return !kfifo_is_empty(&mbox->fifo) ? POLLIN : 0; + } + + static int aspeed_mbox_release(struct inode *inode, struct file *file) +@@ -220,19 +245,23 @@ static irqreturn_t aspeed_mbox_irq(int irq, void *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", ++ dev_dbg(mbox->miscdev.parent, "BMC_CTRL11: 0x%02x\n", + aspeed_mbox_inb(mbox, ASPEED_MBOX_BMC_CTRL)); +- printk(KERN_ERR "STATUS_0: 0x%02x\n", ++ dev_dbg(mbox->miscdev.parent, "STATUS_0: 0x%02x\n", + aspeed_mbox_inb(mbox, ASPEED_MBOX_STATUS_0)); +- printk(KERN_ERR "STATUS_1: 0x%02x\n", ++ dev_dbg(mbox->miscdev.parent, "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, ++ dev_dbg(mbox->miscdev.parent, "DATA_%d: 0x%02x\n", i, + aspeed_mbox_inb(mbox, ASPEED_MBOX_DATA_0 + (i * 4))); + } ++ ++ spin_lock(&mbox->lock); ++ for (i = 0; i < ASPEED_MBOX_NUM_REGS; i++) { ++ put_fifo_with_discard(mbox, ++ aspeed_mbox_inb(mbox, ASPEED_MBOX_DATA_0 + (i * 4))); ++ } ++ spin_unlock(&mbox->lock); + #endif + + /* Clear interrupt status */ +@@ -249,7 +278,6 @@ static int aspeed_mbox_config_irq(struct aspeed_mbox *mbox, + { + struct device *dev = &pdev->dev; + int rc; +- + mbox->irq = platform_get_irq(pdev, 0); + if (!mbox->irq) + return -ENODEV; +@@ -300,6 +328,7 @@ static int aspeed_mbox_probe(struct platform_device *pdev) + return -ENODEV; + } + ++ spin_lock_init(&mbox->lock); + mutex_init(&mbox->mutex); + init_waitqueue_head(&mbox->queue); + +@@ -316,6 +345,11 @@ static int aspeed_mbox_probe(struct platform_device *pdev) + return rc; + } + ++ /* Create FIFO data structure */ ++ rc = kfifo_alloc(&mbox->fifo, MBOX_FIFO_SIZE, GFP_KERNEL); ++ if (rc) ++ return rc; ++ + mbox->miscdev.minor = MISC_DYNAMIC_MINOR; + mbox->miscdev.name = DEVICE_NAME; + mbox->miscdev.fops = &aspeed_mbox_fops; +@@ -349,6 +383,7 @@ static int aspeed_mbox_remove(struct platform_device *pdev) + + misc_deregister(&mbox->miscdev); + clk_disable_unprepare(mbox->clk); ++ kfifo_free(&mbox->fifo); + + return 0; + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0101-Add-poll-fops-in-eSPI-driver.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0101-Add-poll-fops-in-eSPI-driver.patch new file mode 100644 index 000000000..9c9704eff --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0101-Add-poll-fops-in-eSPI-driver.patch @@ -0,0 +1,142 @@ +From 56ea1fc793c97232c12ddc3b4936081fe14c962f Mon Sep 17 00:00:00 2001 +From: "Arun P. Mohanan" <arun.p.m@linux.intel.com> +Date: Wed, 18 Mar 2020 08:34:43 +0530 +Subject: [PATCH] Add poll fops in eSPI driver + +Modify eSPI driver to support poll fops. + +Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com> +--- + drivers/misc/aspeed-espi-slave.c | 83 +++++++++++++++++++++++--------- + 1 file changed, 59 insertions(+), 24 deletions(-) + +diff --git a/drivers/misc/aspeed-espi-slave.c b/drivers/misc/aspeed-espi-slave.c +index 87bc81948694..f4a0d7528414 100644 +--- a/drivers/misc/aspeed-espi-slave.c ++++ b/drivers/misc/aspeed-espi-slave.c +@@ -9,6 +9,7 @@ + #include <linux/module.h> + #include <linux/of.h> + #include <linux/platform_device.h> ++#include <linux/poll.h> + #include <linux/regmap.h> + #include <linux/reset.h> + #include <linux/sched/signal.h> +@@ -95,6 +96,7 @@ struct aspeed_espi { + spinlock_t pltrstn_lock; /* for PLTRST_N signal sampling */ + wait_queue_head_t pltrstn_waitq; + char pltrstn; ++ bool pltrstn_in_avail; + }; + + static void aspeed_espi_sys_event(struct aspeed_espi *priv) +@@ -127,7 +129,10 @@ static void aspeed_espi_sys_event(struct aspeed_espi *priv) + dev_dbg(priv->dev, "SYSEVT_OOB_RST_WARN: acked\n"); + } + if (sts & ASPEED_ESPI_SYSEVT_PLTRSTN || priv->pltrstn == 'U') { ++ spin_lock(&priv->pltrstn_lock); + priv->pltrstn = (evt & ASPEED_ESPI_SYSEVT_PLTRSTN) ? '1' : '0'; ++ priv->pltrstn_in_avail = true; ++ spin_unlock(&priv->pltrstn_lock); + wake_up_interruptible(&priv->pltrstn_waitq); + dev_dbg(priv->dev, "SYSEVT_PLTRSTN: %c\n", priv->pltrstn); + } +@@ -284,41 +289,71 @@ static ssize_t aspeed_espi_pltrstn_read(struct file *filp, char __user *buf, + + spin_lock_irqsave(&priv->pltrstn_lock, flags); + +- add_wait_queue(&priv->pltrstn_waitq, &wait); +- set_current_state(TASK_INTERRUPTIBLE); +- +- old_sample = priv->pltrstn; +- +- do { +- char new_sample = priv->pltrstn; +- +- if (filp->f_flags & O_NONBLOCK || old_sample != new_sample) { +- ret = put_user(new_sample, (unsigned long __user *)buf); +- if (!ret) +- ret = sizeof(new_sample); +- } else if (signal_pending(current)) { +- ret = -ERESTARTSYS; ++ if (filp->f_flags & O_NONBLOCK) { ++ if (!priv->pltrstn_in_avail) { ++ ret = -EAGAIN; ++ goto out_unlock; + } +- +- if (!ret) { +- spin_unlock_irqrestore(&priv->pltrstn_lock, flags); +- schedule(); +- spin_lock_irqsave(&priv->pltrstn_lock, flags); ++ char data = priv->pltrstn; ++ ret = put_user(data, (unsigned long __user *)buf); ++ if (!ret){ ++ ret = sizeof(data); ++ } else{ ++ ret = -EAGAIN; + } +- } while (!ret); +- +- remove_wait_queue(&priv->pltrstn_waitq, &wait); +- set_current_state(TASK_RUNNING); +- ++ priv->pltrstn_in_avail = false; ++ } else { ++ add_wait_queue(&priv->pltrstn_waitq, &wait); ++ set_current_state(TASK_INTERRUPTIBLE); ++ ++ old_sample = priv->pltrstn; ++ ++ do { ++ char new_sample = priv->pltrstn; ++ ++ if (old_sample != new_sample) { ++ ret = put_user(new_sample, ++ (unsigned long __user *)buf); ++ if (!ret) ++ ret = sizeof(new_sample); ++ } else if (signal_pending(current)) { ++ ret = -ERESTARTSYS; ++ } ++ ++ if (!ret) { ++ spin_unlock_irqrestore(&priv->pltrstn_lock, ++ flags); ++ schedule(); ++ spin_lock_irqsave(&priv->pltrstn_lock, flags); ++ } ++ } while (!ret); ++ ++ remove_wait_queue(&priv->pltrstn_waitq, &wait); ++ set_current_state(TASK_RUNNING); ++ } ++out_unlock: + spin_unlock_irqrestore(&priv->pltrstn_lock, flags); + + return ret; + } + ++static unsigned int aspeed_espi_pltrstn_poll(struct file *file, ++ poll_table *wait) ++{ ++ struct aspeed_espi *priv = to_aspeed_espi(file); ++ unsigned int mask = 0; ++ poll_wait(file, &priv->pltrstn_waitq, wait); ++ ++ if (priv->pltrstn_in_avail) ++ mask |= POLLIN; ++ return mask; ++} ++ + static const struct file_operations aspeed_espi_pltrstn_fops = { + .owner = THIS_MODULE, + .open = aspeed_espi_pltrstn_open, + .read = aspeed_espi_pltrstn_read, ++ .poll = aspeed_espi_pltrstn_poll, + }; + + static const struct regmap_config aspeed_espi_regmap_cfg = { +-- +2.17.1 + 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 57df89699..a829e544b 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 @@ -70,6 +70,8 @@ SRC_URI += " \ file://0094-Return-link-speed-and-duplex-settings-for-the-NCSI-c.patch \ file://0095-pwm-and-tach-driver-changes-for-ast2600.patch \ file://0096-Fix-truncated-WrEndPointConfig-MMIO-command.patch \ + file://0100-Mailbox-Enabling-interrupt-based-mailbox.patch \ + file://0101-Add-poll-fops-in-eSPI-driver.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://0005-128MB-flashmap-for-PFR.patch', '', d)}" |