From 66d082174669a8c7f311572e8922d2ba396cc07f Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Tue, 26 Mar 2019 10:20:25 -0700 Subject: Update to internal Signed-off-by: Ed Tanous --- ...-drivers-to-sync-with-linux-upstreaming-v.patch | 6 +- ...021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch | 122 ++++++++--- .../0025-dts-add-AST2500-LPC-SIO-tree-node.patch | 32 --- .../0038-media-aspeed-backport-ikvm-patches.patch | 49 +++-- ...dd-clock-control-logic-into-Aspeed-LPC-BT.patch | 140 ++++++++++++ ...ock-control-logic-into-Aspeed-LPC-SNOOP-d.patch | 125 +++++++++++ ...dd-clock-control-logic-into-Aspeed-LPC-KC.patch | 235 +++++++++++++++++++++ ...ock-control-logic-into-Aspeed-LPC-MBOX-dr.patch | 166 +++++++++++++++ ...error-printing-on-probe-defer-case-in-Asp.patch | 43 ++++ ...eed-Set-default-status-of-LPC-BT-as-disab.patch | 40 ++++ .../recipes-kernel/linux/linux-aspeed_%.bbappend | 7 +- 11 files changed, 879 insertions(+), 86 deletions(-) delete mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0025-dts-add-AST2500-LPC-SIO-tree-node.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0046-misc-Add-clock-control-logic-into-Aspeed-LPC-MBOX-dr.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0047-misc-Block-error-printing-on-probe-defer-case-in-Asp.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0048-ARM-dts-aspeed-Set-default-status-of-LPC-BT-as-disab.patch (limited to 'meta-openbmc-mods/meta-common/recipes-kernel/linux') 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 31faf9608..3cd1d9e84 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 23f9b7808eab57957fa3bcb37974a1fdb22e7b64 Mon Sep 17 00:00:00 2001 +From ce7a88017fb2124100c4e5481a205034f34da23c Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Mon, 7 Jan 2019 09:56:10 -0800 Subject: [PATCH] Update PECI drivers to sync with linux upstreaming version @@ -1940,7 +1940,7 @@ index 51cb2563ceb6..000000000000 -MODULE_DESCRIPTION("ASPEED PECI driver"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c -index fac8c72dcda8..3ebdb46613b9 100644 +index fac8c72dcda8..e2ef013e5002 100644 --- a/drivers/peci/peci-core.c +++ b/drivers/peci/peci-core.c @@ -1,38 +1,31 @@ @@ -2109,7 +2109,7 @@ index fac8c72dcda8..3ebdb46613b9 100644 + tmp_buf[0] = msg->addr; + tmp_buf[1] = msg->tx_len; + tmp_buf[2] = msg->rx_len; -+ memcpy(&tmp_buf[2], &msg->tx_buf[0], len - 3); ++ memcpy(&tmp_buf[3], msg->tx_buf, len - 3); + + *aw_fcs = crc8(peci_crc8_table, tmp_buf, (size_t)len, 0); + 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 fe50c0aea..95302aae8 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 4084484a57d9a81b6581455ff144fc4f9c603075 Mon Sep 17 00:00:00 2001 +From 7d5cd323d3b05a00f8b8a6eb38a5a1ec7925660a Mon Sep 17 00:00:00 2001 From: Yong Li Date: Mon, 13 Nov 2017 16:29:44 +0800 Subject: [PATCH] Aspeed LPC SIO driver @@ -6,39 +6,82 @@ Subject: [PATCH] Aspeed LPC SIO driver Add lpc sio device driver for AST2500/2400 Signed-off-by: Yong Li +Signed-off-by: Jae Hyun Yoo --- - .../devicetree/bindings/misc/aspeed-sio.txt | 14 + + .../devicetree/bindings/misc/aspeed-sio.txt | 18 + + 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 | 435 +++++++++++++++++++++ - include/uapi/linux/aspeed-lpc-sio.h | 44 +++ - 5 files changed, 503 insertions(+) + drivers/misc/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 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 new file mode 100644 -index 000000000000..7953cd3367df +index 000000000000..3530c2b02f5c --- /dev/null +++ b/Documentation/devicetree/bindings/misc/aspeed-sio.txt -@@ -0,0 +1,14 @@ +@@ -0,0 +1,18 @@ +* Aspeed LPC SIO driver. + +Required properties: -+- compatible: "aspeed,ast2500-lpc-sio" -+ - aspeed,ast2500-lpc-sio: Aspeed AST2500 family -+- reg: Should contain lpc-sio registers location and length ++- compatible : Should be one of: ++ "aspeed,ast2400-lpc-sio" ++ "aspeed,ast2500-lpc-sio" ++- reg : Should contain lpc-sio registers location and length ++- clocks: contains a phandle to the syscon node describing the clocks. ++ There should then be one cell representing the clock to use. + +Example: +lpc_sio: lpc-sio@100 { + compatible = "aspeed,ast2500-lpc-sio"; + reg = <0x100 0x20>; ++ 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 +--- a/arch/arm/boot/dts/aspeed-g4.dtsi ++++ b/arch/arm/boot/dts/aspeed-g4.dtsi +@@ -340,6 +340,13 @@ + compatible = "aspeed,bmc-misc"; + }; + ++ lpc_sio: lpc-sio@100 { ++ compatible = "aspeed,ast2400-lpc-sio"; ++ reg = <0x100 0x20>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; ++ status = "disabled"; ++ }; ++ + mbox: mbox@180 { + 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 +--- a/arch/arm/boot/dts/aspeed-g5.dtsi ++++ b/arch/arm/boot/dts/aspeed-g5.dtsi +@@ -451,6 +451,13 @@ + compatible = "aspeed,bmc-misc"; + }; + ++ lpc_sio: lpc-sio@100 { ++ compatible = "aspeed,ast2500-lpc-sio"; ++ reg = <0x100 0x20>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; ++ status = "disabled"; ++ }; ++ + mbox: mbox@180 { + compatible = "aspeed,ast2500-mbox"; + reg = <0x180 0x5c>; diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index 689d07ea7ded..fe1e2a4072a8 100644 +index 00d1c547ece7..3ffb18f915e8 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -493,6 +493,15 @@ config ASPEED_LPC_CTRL @@ -58,7 +101,7 @@ index 689d07ea7ded..fe1e2a4072a8 100644 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 e4170f62ab98..a2b85ec21d09 100644 +index 768278b059c3..de2d5c6d186c 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -56,6 +56,7 @@ obj-$(CONFIG_CXL_BASE) += cxl/ @@ -71,21 +114,15 @@ index e4170f62ab98..a2b85ec21d09 100644 obj-$(CONFIG_MISC_RTSX) += cardreader/ diff --git a/drivers/misc/aspeed-lpc-sio.c b/drivers/misc/aspeed-lpc-sio.c new file mode 100644 -index 000000000000..fd9a83bd66d7 +index 000000000000..c717a3182320 --- /dev/null +++ b/drivers/misc/aspeed-lpc-sio.c -@@ -0,0 +1,435 @@ -+/* -+ * Copyright (C) 2012-2020 ASPEED Technology Inc. -+ * Copyright (c) 2017 Intel Corporation -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version -+ * 2 of the License, or (at your option) any later version. -+ * -+ */ +@@ -0,0 +1,450 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// Copyright (C) 2012-2017 ASPEED Technology Inc. ++// Copyright (c) 2017-2019 Intel Corporation + ++#include +#include +#include +#include @@ -142,8 +179,9 @@ index 000000000000..fd9a83bd66d7 +struct aspeed_lpc_sio { + struct miscdevice miscdev; + struct regmap *regmap; -+ struct semaphore lock; -+ unsigned int reg_base; ++ struct clk *clk; ++ struct semaphore lock; ++ unsigned int reg_base; +}; + +static struct aspeed_lpc_sio *file_aspeed_lpc_sio(struct file *file) @@ -466,16 +504,36 @@ index 000000000000..fd9a83bd66d7 + + sema_init(&lpc_sio->lock, 1); + ++ lpc_sio->clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(lpc_sio->clk)) { ++ rc = PTR_ERR(lpc_sio->clk); ++ if (rc != -EPROBE_DEFER) ++ dev_err(dev, "couldn't get clock\n"); ++ return rc; ++ } ++ rc = clk_prepare_enable(lpc_sio->clk); ++ if (rc) { ++ dev_err(dev, "couldn't enable clock\n"); ++ return rc; ++ } ++ + lpc_sio->miscdev.minor = MISC_DYNAMIC_MINOR; + lpc_sio->miscdev.name = DEVICE_NAME; + lpc_sio->miscdev.fops = &aspeed_lpc_sio_fops; + lpc_sio->miscdev.parent = dev; + rc = misc_register(&lpc_sio->miscdev); -+ if (rc) ++ if (rc) { + dev_err(dev, "Unable to register device\n"); -+ else -+ dev_info(dev, "Loaded at %pap (0x%08x)\n", -+ &lpc_sio->regmap, lpc_sio->reg_base); ++ goto err; ++ } ++ ++ dev_info(dev, "Loaded at %pap (0x%08x)\n", &lpc_sio->regmap, ++ lpc_sio->reg_base); ++ ++ return 0; ++ ++err: ++ clk_disable_unprepare(lpc_sio->clk); + + return rc; +} @@ -485,6 +543,7 @@ index 000000000000..fd9a83bd66d7 + struct aspeed_lpc_sio *lpc_sio = dev_get_drvdata(&pdev->dev); + + misc_deregister(&lpc_sio->miscdev); ++ clk_disable_unprepare(lpc_sio->clk); + + return 0; +} @@ -493,6 +552,7 @@ index 000000000000..fd9a83bd66d7 + { .compatible = "aspeed,ast2500-lpc-sio" }, + { }, +}; ++MODULE_DEVICE_TABLE(of, aspeed_lpc_sio_match); + +static struct platform_driver aspeed_lpc_sio_driver = { + .driver = { @@ -502,10 +562,8 @@ index 000000000000..fd9a83bd66d7 + .probe = aspeed_lpc_sio_probe, + .remove = aspeed_lpc_sio_remove, +}; -+ +module_platform_driver(aspeed_lpc_sio_driver); + -+MODULE_DEVICE_TABLE(of, aspeed_lpc_sio_match); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Ryan Chen "); +MODULE_AUTHOR("Yong Li "); diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0025-dts-add-AST2500-LPC-SIO-tree-node.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0025-dts-add-AST2500-LPC-SIO-tree-node.patch deleted file mode 100644 index 73bd68f21..000000000 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0025-dts-add-AST2500-LPC-SIO-tree-node.patch +++ /dev/null @@ -1,32 +0,0 @@ -From ba357b37e1041b6fe0e5012cf09571381207aa9b Mon Sep 17 00:00:00 2001 -From: Haiyue Wang -Date: Sat, 24 Feb 2018 11:23:46 +0800 -Subject: [PATCH] dts: add AST2500 LPC SIO tree node - -Add the AST2500 LPC SIO tree node. - -Signed-off-by: Haiyue Wang ---- - arch/arm/boot/dts/aspeed-g5.dtsi | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index baf230034480..f7e812d36641 100644 ---- a/arch/arm/boot/dts/aspeed-g5.dtsi -+++ b/arch/arm/boot/dts/aspeed-g5.dtsi -@@ -464,6 +464,12 @@ - compatible = "aspeed,bmc-misc"; - }; - -+ lpc_sio: lpc-sio@100 { -+ compatible = "aspeed,ast2500-lpc-sio"; -+ reg = <0x100 0x20>; -+ status = "disabled"; -+ }; -+ - mbox: mbox@180 { - compatible = "aspeed,ast2500-mbox"; - reg = <0x180 0x5c>; --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0038-media-aspeed-backport-ikvm-patches.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0038-media-aspeed-backport-ikvm-patches.patch index b618c49da..02e423057 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0038-media-aspeed-backport-ikvm-patches.patch +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0038-media-aspeed-backport-ikvm-patches.patch @@ -1,4 +1,4 @@ -From ba52b9e7f76879f888afce1f8e7e5ff180b7849b Mon Sep 17 00:00:00 2001 +From feb75b023dfd0ebe3e8ca46f0e74603f07542c29 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo Date: Fri, 9 Nov 2018 11:32:27 -0800 Subject: [PATCH] Add Aspeed Video Engine Driver @@ -11,8 +11,20 @@ the host processor graphics output. Add a V4L2 driver to capture video data and compress it to JPEG images. Make the video frames available through the V4L2 streaming interface. +media: platform: Fix missing spin_lock_init() + +The driver allocates the spinlock but not initialize it. +Use spin_lock_init() on it to initialize it correctly. + +This is detected by Coccinelle semantic patch. + +Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") + Signed-off-by: Eddie James +Signed-off-by: Wei Yongjun Reviewed-by: Rob Herring +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jae Hyun Yoo --- .../devicetree/bindings/media/aspeed-video.txt | 26 + @@ -21,9 +33,9 @@ Signed-off-by: Jae Hyun Yoo drivers/clk/clk-aspeed.c | 41 +- drivers/media/platform/Kconfig | 9 + drivers/media/platform/Makefile | 1 + - drivers/media/platform/aspeed-video.c | 1729 ++++++++++++++++++++ + drivers/media/platform/aspeed-video.c | 1730 ++++++++++++++++++++ include/dt-bindings/clock/aspeed-clock.h | 1 + - 8 files changed, 1824 insertions(+), 2 deletions(-) + 8 files changed, 1825 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/aspeed-video.txt create mode 100644 drivers/media/platform/aspeed-video.c @@ -60,10 +72,10 @@ index 000000000000..78b464ae2672 + interrupts = <7>; +}; diff --git a/MAINTAINERS b/MAINTAINERS -index 9e9b19ecf6f7..fd4fdb3e6474 100644 +index b98a5763f6c1..cdd8f824b6da 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -2350,6 +2350,14 @@ S: Maintained +@@ -2358,6 +2358,14 @@ S: Maintained F: Documentation/hwmon/asc7621 F: drivers/hwmon/asc7621.c @@ -79,7 +91,7 @@ index 9e9b19ecf6f7..fd4fdb3e6474 100644 M: Corentin Chary L: acpi4asus-user@lists.sourceforge.net diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi -index 0144d8bfa3fb..e55da933a70b 100644 +index 69330ae2efd3..946c13eaa1d4 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -243,6 +243,17 @@ @@ -101,10 +113,10 @@ index 0144d8bfa3fb..e55da933a70b 100644 compatible = "aspeed,ast2500-adc"; reg = <0x1e6e9000 0xb0>; diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c -index 61d41645e4fe..2429a2464556 100644 +index 3bbb4fbf00c9..6cea55de485f 100644 --- a/drivers/clk/clk-aspeed.c +++ b/drivers/clk/clk-aspeed.c -@@ -96,7 +96,7 @@ struct aspeed_clk_gate { +@@ -95,7 +95,7 @@ struct aspeed_clk_gate { /* TODO: ask Aspeed about the actual parent data */ static const struct aspeed_gate_data aspeed_gates[] = { /* clk rst name parent flags */ @@ -113,7 +125,7 @@ index 61d41645e4fe..2429a2464556 100644 [ASPEED_CLK_GATE_GCLK] = { 1, 7, "gclk-gate", NULL, 0 }, /* 2D engine */ [ASPEED_CLK_GATE_MCLK] = { 2, -1, "mclk-gate", "mpll", CLK_IS_CRITICAL }, /* SDRAM */ [ASPEED_CLK_GATE_VCLK] = { 3, 6, "vclk-gate", NULL, 0 }, /* Video Capture */ -@@ -122,6 +122,24 @@ static const struct aspeed_gate_data aspeed_gates[] = { +@@ -121,6 +121,24 @@ static const struct aspeed_gate_data aspeed_gates[] = { [ASPEED_CLK_GATE_LHCCLK] = { 28, -1, "lhclk-gate", "lhclk", 0 }, /* LPC master/LPC+ */ }; @@ -138,7 +150,7 @@ index 61d41645e4fe..2429a2464556 100644 static const struct clk_div_table ast2500_mac_div_table[] = { { 0x0, 4 }, /* Yep, really. Aspeed confirmed this is correct */ { 0x1, 4 }, -@@ -201,18 +219,21 @@ static struct clk_hw *aspeed_ast2500_calc_pll(const char *name, u32 val) +@@ -200,18 +218,21 @@ static struct clk_hw *aspeed_ast2500_calc_pll(const char *name, u32 val) struct aspeed_clk_soc_data { const struct clk_div_table *div_table; @@ -160,7 +172,7 @@ index 61d41645e4fe..2429a2464556 100644 .mac_div_table = ast2400_div_table, .calc_pll = aspeed_ast2400_calc_pll, }; -@@ -326,6 +347,7 @@ static const u8 aspeed_resets[] = { +@@ -325,6 +346,7 @@ static const u8 aspeed_resets[] = { [ASPEED_RESET_PECI] = 10, [ASPEED_RESET_I2C] = 2, [ASPEED_RESET_AHB] = 1, @@ -168,7 +180,7 @@ index 61d41645e4fe..2429a2464556 100644 /* * SCUD4 resets start at an offset to separate them from -@@ -548,6 +570,22 @@ static int aspeed_clk_probe(struct platform_device *pdev) +@@ -538,6 +560,22 @@ static int aspeed_clk_probe(struct platform_device *pdev) return PTR_ERR(hw); aspeed_clk_data->hws[ASPEED_CLK_24M] = hw; @@ -191,14 +203,14 @@ index 61d41645e4fe..2429a2464556 100644 /* * TODO: There are a number of clocks that not included in this driver * as more information is required: -@@ -557,7 +595,6 @@ static int aspeed_clk_probe(struct platform_device *pdev) +@@ -547,7 +585,6 @@ static int aspeed_clk_probe(struct platform_device *pdev) * RGMII * RMII * UART[1..5] clock source mux - * Video Engine (ECLK) mux and clock divider */ - for (i = 0; i < ARRAY_SIZE(aspeed_gates); i++) { + /* Get the uart clock source configuration from SCU4C*/ diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 54fe90acb5b2..d6edf2d28f9b 100644 --- a/drivers/media/platform/Kconfig @@ -233,10 +245,10 @@ index 41322ab65802..205c33a004fc 100644 obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/ diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c new file mode 100644 -index 000000000000..dfec813f50a9 +index 000000000000..692e08ef38c0 --- /dev/null +++ b/drivers/media/platform/aspeed-video.c -@@ -0,0 +1,1729 @@ +@@ -0,0 +1,1730 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include @@ -1900,6 +1912,7 @@ index 000000000000..dfec813f50a9 + + video->frame_rate = 30; + video->dev = &pdev->dev; ++ spin_lock_init(&video->lock); + mutex_init(&video->video_lock); + init_waitqueue_head(&video->wait); + INIT_DELAYED_WORK(&video->res_work, aspeed_video_resolution_work); @@ -1967,10 +1980,10 @@ index 000000000000..dfec813f50a9 +MODULE_AUTHOR("Eddie James"); +MODULE_LICENSE("GPL v2"); diff --git a/include/dt-bindings/clock/aspeed-clock.h b/include/dt-bindings/clock/aspeed-clock.h -index f43738607d77..15a9059d0303 100644 +index 335879505a72..0b0f3a0ebe9b 100644 --- a/include/dt-bindings/clock/aspeed-clock.h +++ b/include/dt-bindings/clock/aspeed-clock.h -@@ -50,5 +50,6 @@ +@@ -52,5 +52,6 @@ #define ASPEED_RESET_I2C 7 #define ASPEED_RESET_AHB 8 #define ASPEED_RESET_CRT1 9 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 new file mode 100644 index 000000000..f04824c0e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0043-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-BT.patch @@ -0,0 +1,140 @@ +From d82aacea62f2cc3f5c4f6654bd8920255edf24fd Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Wed, 13 Mar 2019 15:04:16 -0700 +Subject: [PATCH] char: ipmi: Add clock control logic into Aspeed LPC BT driver + +If LPC BT driver is registered ahead of lpc-ctrl module, LPC BT +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 +BT driver. + +Signed-off-by: Jae Hyun Yoo +--- + .../bindings/ipmi/aspeed,ast2400-ibt-bmc.txt | 3 +++ + arch/arm/boot/dts/aspeed-g4.dtsi | 1 + + arch/arm/boot/dts/aspeed-g5.dtsi | 1 + + drivers/char/ipmi/bt-bmc.c | 24 +++++++++++++++++++++- + 4 files changed, 28 insertions(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt b/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt +index 028268fd99ee..d13887d60f19 100644 +--- a/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt ++++ b/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt +@@ -10,6 +10,8 @@ Required properties: + "aspeed,ast2400-ibt-bmc" + "aspeed,ast2500-ibt-bmc" + - reg: physical address and size of the registers ++- clocks: contains a phandle to the syscon node describing the clocks. ++ There should then be one cell representing the clock to use. + + Optional properties: + +@@ -22,4 +24,5 @@ Example: + compatible = "aspeed,ast2400-ibt-bmc"; + reg = <0x1e789140 0x18>; + interrupts = <8>; ++ 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 +--- a/arch/arm/boot/dts/aspeed-g4.dtsi ++++ b/arch/arm/boot/dts/aspeed-g4.dtsi +@@ -333,6 +333,7 @@ + ibt: ibt@c0 { + compatible = "aspeed,ast2400-ibt-bmc"; + reg = <0xc0 0x18>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + interrupts = <8>; + }; + +diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi +index 4cd4a8258e42..a6720bc952b0 100644 +--- a/arch/arm/boot/dts/aspeed-g5.dtsi ++++ b/arch/arm/boot/dts/aspeed-g5.dtsi +@@ -468,6 +468,7 @@ + ibt: ibt@c0 { + compatible = "aspeed,ast2500-ibt-bmc"; + reg = <0xc0 0x18>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + interrupts = <8>; + }; + +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 ++++ b/drivers/char/ipmi/bt-bmc.c +@@ -5,6 +5,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -60,6 +61,7 @@ struct bt_bmc { + struct device dev; + struct miscdevice miscdev; + struct regmap *map; ++ struct clk *clk; + int offset; + int irq; + wait_queue_head_t queue; +@@ -467,6 +469,19 @@ static int bt_bmc_probe(struct platform_device *pdev) + mutex_init(&bt_bmc->mutex); + init_waitqueue_head(&bt_bmc->queue); + ++ bt_bmc->clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(bt_bmc->clk)) { ++ rc = PTR_ERR(bt_bmc->clk); ++ if (rc != -EPROBE_DEFER) ++ dev_err(dev, "couldn't get clock\n"); ++ return rc; ++ } ++ rc = clk_prepare_enable(bt_bmc->clk); ++ if (rc) { ++ dev_err(dev, "couldn't enable clock\n"); ++ return rc; ++ } ++ + bt_bmc->miscdev.minor = MISC_DYNAMIC_MINOR, + bt_bmc->miscdev.name = DEVICE_NAME, + bt_bmc->miscdev.fops = &bt_bmc_fops, +@@ -474,7 +489,7 @@ static int bt_bmc_probe(struct platform_device *pdev) + rc = misc_register(&bt_bmc->miscdev); + if (rc) { + dev_err(dev, "Unable to register misc device\n"); +- return rc; ++ goto err; + } + + bt_bmc_config_irq(bt_bmc, pdev); +@@ -498,6 +513,11 @@ static int bt_bmc_probe(struct platform_device *pdev) + clr_b_busy(bt_bmc); + + return 0; ++ ++err: ++ clk_disable_unprepare(bt_bmc->clk); ++ ++ return rc; + } + + static int bt_bmc_remove(struct platform_device *pdev) +@@ -507,6 +527,8 @@ static int bt_bmc_remove(struct platform_device *pdev) + misc_deregister(&bt_bmc->miscdev); + if (!bt_bmc->irq) + del_timer_sync(&bt_bmc->poll_timer); ++ clk_disable_unprepare(bt_bmc->clk); ++ + return 0; + } + +-- +2.7.4 + 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 new file mode 100644 index 000000000..0559ef5be --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0044-misc-Add-clock-control-logic-into-Aspeed-LPC-SNOOP-d.patch @@ -0,0 +1,125 @@ +From 1ebca05f5cb04162e124e59cac701291f23d9091 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Wed, 13 Mar 2019 15:27:48 -0700 +Subject: [PATCH] misc: Add clock control logic into Aspeed LPC SNOOP driver + +If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC +SNOOP 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 +SNOOP driver. + +Signed-off-by: Jae Hyun Yoo +--- + arch/arm/boot/dts/aspeed-g4.dtsi | 1 + + arch/arm/boot/dts/aspeed-g5.dtsi | 1 + + drivers/misc/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 +--- a/arch/arm/boot/dts/aspeed-g4.dtsi ++++ b/arch/arm/boot/dts/aspeed-g4.dtsi +@@ -316,6 +316,7 @@ + compatible = "aspeed,ast2400-lpc-snoop"; + reg = <0x0 0x80>; + interrupts = <8>; ++ 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 a6720bc952b0..a26e8b3c09bf 100644 +--- a/arch/arm/boot/dts/aspeed-g5.dtsi ++++ b/arch/arm/boot/dts/aspeed-g5.dtsi +@@ -451,6 +451,7 @@ + compatible = "aspeed,ast2500-lpc-snoop"; + reg = <0x0 0x80>; + interrupts = <8>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + 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 @@ + */ + + #include ++#include + #include + #include + #include +@@ -71,6 +72,7 @@ struct aspeed_lpc_snoop_channel { + struct aspeed_lpc_snoop { + struct regmap *regmap; + int irq; ++ struct clk *clk; + struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS]; + }; + +@@ -286,22 +288,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev) + return -ENODEV; + } + ++ lpc_snoop->clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(lpc_snoop->clk)) { ++ rc = PTR_ERR(lpc_snoop->clk); ++ if (rc != -EPROBE_DEFER) ++ dev_err(dev, "couldn't get clock\n"); ++ return rc; ++ } ++ rc = clk_prepare_enable(lpc_snoop->clk); ++ if (rc) { ++ dev_err(dev, "couldn't enable clock\n"); ++ return rc; ++ } ++ + rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev); + if (rc) +- return rc; ++ goto err; + + rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port); + if (rc) +- return rc; ++ goto err; + + /* Configuration of 2nd snoop channel port is optional */ + if (of_property_read_u32_index(dev->of_node, "snoop-ports", + 1, &port) == 0) { + rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port); +- if (rc) ++ if (rc) { + aspeed_lpc_disable_snoop(lpc_snoop, 0); ++ goto err; ++ } + } + ++ return 0; ++ ++err: ++ clk_disable_unprepare(lpc_snoop->clk); ++ + return rc; + } + +@@ -313,6 +335,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); + ++ clk_disable_unprepare(lpc_snoop->clk); ++ + return 0; + } + +-- +2.7.4 + 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 new file mode 100644 index 000000000..d9b6d05f9 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0045-char-ipmi-Add-clock-control-logic-into-Aspeed-LPC-KC.patch @@ -0,0 +1,235 @@ +From 1326920183042bb91583eb56dabd29ec921f8f65 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Wed, 13 Mar 2019 15:36:34 -0700 +Subject: [PATCH] char: ipmi: Add clock control logic into Aspeed LPC KCS + driver + +If LPC KCS driver is registered ahead of lpc-ctrl module, LPC KCS +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 +KCS driver. + +Signed-off-by: Jae Hyun Yoo +--- + .../devicetree/bindings/ipmi/aspeed-kcs-bmc.txt | 3 ++ + arch/arm/boot/dts/aspeed-g4.dtsi | 35 ++++++++++++++++++++ + arch/arm/boot/dts/aspeed-g5.dtsi | 6 +++- + drivers/char/ipmi/kcs_bmc_aspeed.c | 37 ++++++++++++++++++---- + 4 files changed, 73 insertions(+), 8 deletions(-) + +diff --git a/Documentation/devicetree/bindings/ipmi/aspeed-kcs-bmc.txt b/Documentation/devicetree/bindings/ipmi/aspeed-kcs-bmc.txt +index d98a9bf45d6c..3453eb0bf8f2 100644 +--- a/Documentation/devicetree/bindings/ipmi/aspeed-kcs-bmc.txt ++++ b/Documentation/devicetree/bindings/ipmi/aspeed-kcs-bmc.txt +@@ -9,6 +9,8 @@ Required properties: + "aspeed,ast2400-kcs-bmc" + "aspeed,ast2500-kcs-bmc" + - interrupts : interrupt generated by the controller ++- clocks: contains a phandle to the syscon node describing the clocks. ++ There should then be one cell representing the clock to use. + - kcs_chan : The LPC channel number in the controller + - kcs_addr : The host CPU IO map address + +@@ -19,6 +21,7 @@ Example: + compatible = "aspeed,ast2500-kcs-bmc"; + reg = <0x0 0x80>; + interrupts = <8>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + kcs_chan = <3>; + 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 +--- a/arch/arm/boot/dts/aspeed-g4.dtsi ++++ b/arch/arm/boot/dts/aspeed-g4.dtsi +@@ -294,6 +294,33 @@ + lpc_bmc: lpc-bmc@0 { + compatible = "aspeed,ast2400-lpc-bmc"; + reg = <0x0 0x80>; ++ reg-io-width = <4>; ++ ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0x0 0x0 0x80>; ++ ++ kcs1: kcs1@0 { ++ compatible = "aspeed,ast2400-kcs-bmc"; ++ interrupts = <8>; ++ kcs_chan = <1>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; ++ status = "disabled"; ++ }; ++ kcs2: kcs2@0 { ++ compatible = "aspeed,ast2400-kcs-bmc"; ++ interrupts = <8>; ++ kcs_chan = <2>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; ++ status = "disabled"; ++ }; ++ kcs3: kcs3@0 { ++ compatible = "aspeed,ast2400-kcs-bmc"; ++ interrupts = <8>; ++ kcs_chan = <3>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; ++ status = "disabled"; ++ }; + }; + + lpc_host: lpc-host@80 { +@@ -305,6 +332,14 @@ + #size-cells = <1>; + ranges = <0x0 0x80 0x1e0>; + ++ kcs4: kcs4@0 { ++ compatible = "aspeed,ast2400-kcs-bmc"; ++ interrupts = <8>; ++ kcs_chan = <4>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; ++ status = "disabled"; ++ }; ++ + lpc_ctrl: lpc-ctrl@0 { + 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 +--- a/arch/arm/boot/dts/aspeed-g5.dtsi ++++ b/arch/arm/boot/dts/aspeed-g5.dtsi +@@ -128,7 +128,7 @@ + }; + + vic: interrupt-controller@1e6c0080 { +- compatible = "aspeed,ast2400-vic"; ++ compatible = "aspeed,ast2500-vic"; + interrupt-controller; + #interrupt-cells = <1>; + valid-sources = <0xfefff7ff 0x0807ffff>; +@@ -408,18 +408,21 @@ + compatible = "aspeed,ast2500-kcs-bmc"; + interrupts = <8>; + kcs_chan = <1>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + status = "disabled"; + }; + kcs2: kcs2@0 { + compatible = "aspeed,ast2500-kcs-bmc"; + interrupts = <8>; + kcs_chan = <2>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + status = "disabled"; + }; + kcs3: kcs3@0 { + compatible = "aspeed,ast2500-kcs-bmc"; + interrupts = <8>; + kcs_chan = <3>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + status = "disabled"; + }; + }; +@@ -437,6 +440,7 @@ + compatible = "aspeed,ast2500-kcs-bmc"; + interrupts = <8>; + kcs_chan = <4>; ++ clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + status = "disabled"; + }; + +diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c +index 3c955946e647..bd1912dc5a21 100644 +--- a/drivers/char/ipmi/kcs_bmc_aspeed.c ++++ b/drivers/char/ipmi/kcs_bmc_aspeed.c +@@ -1,11 +1,10 @@ + // SPDX-License-Identifier: GPL-2.0 +-/* +- * Copyright (c) 2015-2018, Intel Corporation. +- */ ++// Copyright (c) 2015-2019, Intel Corporation. + + #define pr_fmt(fmt) "aspeed-kcs-bmc: " fmt + + #include ++#include + #include + #include + #include +@@ -63,6 +62,7 @@ + + struct aspeed_kcs_bmc { + struct regmap *map; ++ struct clk *clk; + }; + + +@@ -264,36 +264,59 @@ static int aspeed_kcs_probe(struct platform_device *pdev) + return -ENODEV; + } + ++ priv->clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(priv->clk)) { ++ rc = PTR_ERR(priv->clk); ++ if (rc != -EPROBE_DEFER) ++ dev_err(dev, "couldn't get clock\n"); ++ return rc; ++ } ++ rc = clk_prepare_enable(priv->clk); ++ if (rc) { ++ dev_err(dev, "couldn't enable clock\n"); ++ return rc; ++ } ++ + kcs_bmc->ioreg = ast_kcs_bmc_ioregs[chan - 1]; + kcs_bmc->io_inputb = aspeed_kcs_inb; + kcs_bmc->io_outputb = aspeed_kcs_outb; + + dev_set_drvdata(dev, kcs_bmc); + +- aspeed_kcs_set_address(kcs_bmc, addr); +- aspeed_kcs_enable_channel(kcs_bmc, true); + rc = aspeed_kcs_config_irq(kcs_bmc, pdev); + if (rc) +- return rc; ++ goto err; + + rc = misc_register(&kcs_bmc->miscdev); + if (rc) { + dev_err(dev, "Unable to register device\n"); +- return rc; ++ goto err; + } + ++ aspeed_kcs_set_address(kcs_bmc, addr); ++ aspeed_kcs_enable_channel(kcs_bmc, true); ++ + pr_info("channel=%u addr=0x%x idr=0x%x odr=0x%x str=0x%x\n", + chan, addr, + kcs_bmc->ioreg.idr, kcs_bmc->ioreg.odr, kcs_bmc->ioreg.str); + + return 0; ++ ++err: ++ aspeed_kcs_enable_channel(kcs_bmc, false); ++ clk_disable_unprepare(priv->clk); ++ ++ return rc; + } + + static int aspeed_kcs_remove(struct platform_device *pdev) + { + struct kcs_bmc *kcs_bmc = dev_get_drvdata(&pdev->dev); ++ struct aspeed_kcs_bmc *priv = kcs_bmc_priv(kcs_bmc); + + misc_deregister(&kcs_bmc->miscdev); ++ aspeed_kcs_enable_channel(kcs_bmc, false); ++ clk_disable_unprepare(priv->clk); + + return 0; + } +-- +2.7.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 new file mode 100644 index 000000000..220283e24 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0046-misc-Add-clock-control-logic-into-Aspeed-LPC-MBOX-dr.patch @@ -0,0 +1,166 @@ +From db310b43e5b444a4e2854f3d69d002c2f0d0605c Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +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 +--- + 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 + #include + #include + #include +@@ -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 "); + 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 new file mode 100644 index 000000000..40c26e31b --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0047-misc-Block-error-printing-on-probe-defer-case-in-Asp.patch @@ -0,0 +1,43 @@ +From 4762687044ec864719ca14d8efa3dccdc3807e70 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +Date: Wed, 13 Mar 2019 15:57:08 -0700 +Subject: [PATCH] misc: Block error printing on probe defer case in Aspeed LPC + ctrl + +This commit adds a checking code when it gets -EPROBE_DEFER while +getting a clock resource. In this case it doesn't need to print +out an error message because the probing will be re-visited. + +Signed-off-by: Jae Hyun Yoo +--- + drivers/misc/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) + + lpc_ctrl->clk = devm_clk_get(dev, NULL); + if (IS_ERR(lpc_ctrl->clk)) { +- dev_err(dev, "couldn't get clock\n"); +- return PTR_ERR(lpc_ctrl->clk); ++ rc = PTR_ERR(lpc_ctrl->clk); ++ if (rc != -EPROBE_DEFER) ++ dev_err(dev, "couldn't get clock\n"); ++ return rc; + } + rc = clk_prepare_enable(lpc_ctrl->clk); + if (rc) { +@@ -264,6 +266,7 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) + + err: + clk_disable_unprepare(lpc_ctrl->clk); ++ + return rc; + } + +-- +2.7.4 + 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 new file mode 100644 index 000000000..efbea1be8 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0048-ARM-dts-aspeed-Set-default-status-of-LPC-BT-as-disab.patch @@ -0,0 +1,40 @@ +From abf63c03805bf7df31133b720e165eab759ea702 Mon Sep 17 00:00:00 2001 +From: Jae Hyun Yoo +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 +--- + 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_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend index e08672d2d..1e25709a9 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 @@ -15,7 +15,6 @@ SRC_URI += " \ file://0019-Add-I2C-IPMB-support.patch \ file://0021-Initial-Port-of-Aspeed-LPC-SIO-driver.patch \ file://0022-Add-AST2500-eSPI-driver.patch \ - file://0025-dts-add-AST2500-LPC-SIO-tree-node.patch \ file://0026-Add-support-for-new-PECI-commands.patch \ file://0028-Add-AST2500-JTAG-driver.patch \ file://0029-i2c-aspeed-Improve-driver-to-support-multi-master-us.patch \ @@ -30,4 +29,10 @@ SRC_URI += " \ 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 \ " -- cgit v1.2.3