From patchwork Mon Feb 12 07:08:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 127940 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2942248ljc; Sun, 11 Feb 2018 23:09:12 -0800 (PST) X-Google-Smtp-Source: AH8x224Hwk2IzDvDU2OhNk+jUcBXmdANLf6sk8UCbQcmFApdStfoAAwfiA2iVmRDnb/d7IVz745P X-Received: by 10.98.152.208 with SMTP id d77mr10748306pfk.108.1518419352756; Sun, 11 Feb 2018 23:09:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518419352; cv=none; d=google.com; s=arc-20160816; b=oXnnD4khSjCBhi8LwxC95lLY5t0i5NsKksSi+W2pO6ByyEFpXua5trp1hCtbU58zep JapBBwwwJZCy4ioWzmcq9ridk2G9vs3UJeZ4jcr02ist5o6qT3ShCDrPZuD8mWNqFcPW kRPvcvc7N7xxxqbZdn85/R7lZ22bOA5htBHyD1XhumfKsMKGcpD6SBNpExRkjEUh7VzT nvPvW9l1BJc4Q288bCVjfaqgeKVhp+C7/Any0s1nhE4CC5Tu3pd1Jh7Ka2Mvfb8sDwib 9t3ehEV+q9qOw3Kj0q4729j14FEseYYIboRu0XN6xWhAJXvEfafFsbaemxHldaAE4gJN fz3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=eNpEXsIVrxsQO6RsHiKZUBXRoHWgwzXkOWOw6UdhmSA=; b=rrj+6gI4uRVZMBuKZMXmfd69r2inAut+JOAK3WR1UYHVydoos4WTaGSmXx4Scv7G9h sg8RArI1r1KjmjG4ZQut4R2QwrcNMYjHkHjSepRs18hb+RrSGD1SiRS94dLUHIznvzHA GCS8KnoZlP/WqN9Gyixyj7Opjm5DhHgBFH52ZGvcZjshIBWdFYyE/RfreoZySsXh0GaD JLYi/s6Zsz5lXspKBEAtizseOiZLyNB390AhvdqVKdYFIo4A13+gJ1y89iRDYQqPYzGV /0S6wVMnsZ1K0c3kcop5ey+6Sn/LalwZFg0iqBFppLglPfbYRs3jbF36/TltlyIizs1r Mmfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=eyEtR+oW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h68si2361484pfc.35.2018.02.11.23.09.12; Sun, 11 Feb 2018 23:09:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=eyEtR+oW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932945AbeBLHJK (ORCPT + 13 others); Mon, 12 Feb 2018 02:09:10 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:42055 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932568AbeBLHJH (ORCPT ); Mon, 12 Feb 2018 02:09:07 -0500 Received: by mail-pl0-f66.google.com with SMTP id 11so4627427plc.9; Sun, 11 Feb 2018 23:09:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=eNpEXsIVrxsQO6RsHiKZUBXRoHWgwzXkOWOw6UdhmSA=; b=eyEtR+oWhEzwXEIGTjzIA+zxXaGSVjHMRuOKZHEZ7n6Ju+Vs4JiT0aXghZQ1oB+9Z9 1kz79ML+LcBeKPNIvkXeloFz/IkX7gdvxT9y1zazN+EBJfIhSqJNh9e19SJ/XJCeAAxY bcNJkcZ48/ZmQEaFkWe4Ktdqv8XXHdSHZJnNqqcMqE0jNFfUk0Lamub1VsqROrudbQjl B7kmmtyQKCJPoz+2hau0mBD/5Nci74hjnSL6MKYSeOFt6h0w3vShwPq4sfctApMPB8P5 KRaRHW0/MYjaWDEsUAH/igQksTkAHPd68YLTUhWYCXLqK7k0okKBvZ4u9M1EXyPtpslx pacg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=eNpEXsIVrxsQO6RsHiKZUBXRoHWgwzXkOWOw6UdhmSA=; b=j2qS1/rt4bzmbqvr72R/G59e7GB3rz6KoUxIpM8oMW/lf5lAXrIw9lF9zzcxGyVvN5 qmyPly0kJ0fkBDyaow7S8HKliE4r++Ny6q0/sn2yUagAufGf1cx/BoL2PEpYNmKDMJ4F 7Z/c1pvimm00IdRq1nWNRBi0SAW+TLreO67lqH86T4ZkzITVK6+jK0ii+YNd5qJlxfot WfcK/4wolfGz+qkOSS1GD9REIJkyt9SrzsRS+J2cBS/OWXYq65EYpds3P2um5N6Drzoe 8K+qf0BABAwfLWzo7g0DufV8GDG2XTVQLfA4/kfmmbj4bPciqFrpxfgo5GQImEUN1Ujo RKYQ== X-Gm-Message-State: APf1xPDfCfPIq7CkDdr/+BV6DTFqRyZfNwYySBDljG9hsHmdt0DQCrS5 kS7g2+MHbQRalytpJOS9UsQ= X-Received: by 2002:a17:902:57d8:: with SMTP id g24-v6mr3782753plj.381.1518419347075; Sun, 11 Feb 2018 23:09:07 -0800 (PST) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id w15sm26239015pfj.32.2018.02.11.23.09.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Feb 2018 23:09:06 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 12 Feb 2018 17:38:58 +1030 From: Joel Stanley To: Lee Jones , Rob Herring , Mark Rutland Cc: Arnd Bergmann , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Cyril Bur , Benjamin Herrenschmidt , Ryan Chen , Lei YU Subject: [PATCH 1/3] dt-bindings: aspeed-lpc: Document LPC Host Interface Controller Date: Mon, 12 Feb 2018 17:38:45 +1030 Message-Id: <20180212070847.32387-2-joel@jms.id.au> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180212070847.32387-1-joel@jms.id.au> References: <20180212070847.32387-1-joel@jms.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The LPC Host Interface Controller is part of a BMC SoC that is used for communication with the host. Signed-off-by: Joel Stanley --- .../devicetree/bindings/mfd/aspeed-lpc.txt | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) -- 2.15.1 diff --git a/Documentation/devicetree/bindings/mfd/aspeed-lpc.txt b/Documentation/devicetree/bindings/mfd/aspeed-lpc.txt index 514d82ced95b..94a31de109c4 100644 --- a/Documentation/devicetree/bindings/mfd/aspeed-lpc.txt +++ b/Documentation/devicetree/bindings/mfd/aspeed-lpc.txt @@ -109,6 +109,46 @@ lpc: lpc@1e789000 { }; }; +BMC Node Children +================== + +LPC Host Interface Controller +------------------- + +The LPC Host Interface Controller manages functions exposed to the host such as +LPC firmware hub cycles, configuration of the LPC-to-AHB mapping, UART +management and bus snoop configuration. + +Required properties: + +- compatible: One of: + "aspeed,ast2400-lpc-ctrl"; + "aspeed,ast2500-lpc-ctrl"; + +- reg: contains offset/length values of the host interface controller + memory regions + +- clocks: contains a phandle to the syscon node describing the clocks. + There should then be one cell representing the clock to use + +- memory-region: A phandle to a reserved_memory region to be used for the LPC + to AHB mapping + +- flash: A phandle to the SPI flash controller containing the flash to + be exposed over the LPC to AHB mapping + +Example: + +lpc-host@80 { + lpc_ctrl: lpc-ctrl@0 { + compatible = "aspeed,ast2500-lpc-ctrl"; + reg = <0x0 0x80>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + memory-region = <&flash_memory>; + flash = <&spi>; + }; +}; + Host Node Children ================== From patchwork Mon Feb 12 07:08:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 127941 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2942342ljc; Sun, 11 Feb 2018 23:09:22 -0800 (PST) X-Google-Smtp-Source: AH8x225bu3dA0meUb3Fn7TNz37QvN19WO9+ahpjc3IpZ+I40l4rrShXbd/miYpieYo8fd/iLSeGL X-Received: by 2002:a17:902:b410:: with SMTP id x16-v6mr10230014plr.157.1518419362557; Sun, 11 Feb 2018 23:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518419362; cv=none; d=google.com; s=arc-20160816; b=HItUn9jJ+hNf2o66zx07raulHnqrc+AqVz+T0zNMVqbP0mVOxVVOHthvzi0i3NJq97 jmcBXn+bHrxWh0lH29i+QDyfBYBbNzDraN5YebHECisI9L7WQQqg3pMesgMAAGR4ZsuC rk/lAs0omKKAYefM9ax76OKD5ZXPp1/eowaiRqQNW7jEFkGz1evg00HEsES5dUCF3KZl ffjsDaThQ+xj0jyXgLlpWUBBX3JrqsMCPttNBeFCIex7G/vbqirqrIsYcEcmXlMr71+j v6D8eZ8xfjsr8wleSpjGuIuhbzsu4c/hXWSjEPrbOe/N7MKQPKgknq0PQEinDzjc8fkK vbZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=NwL7A4hTUadKcUHHkqCgS88GiYok4oil6lnWHhgTt2o=; b=rmabwDYF9iLCedhb5ZlDOtRo6jn1KqvVA8B1rMV+4fMDY4BhNUEaAWoJyQLfszYe1x 935kiwXbPpgjMjG25PXj84vRHrjz4wAVmJEj1aa47syU4aOchIgeHJpJyCP6NXKSh/iw R22wpv9r8nulDwVJbDZBi63awoqd77u5uNXR+qoVZF5MpsG+YfWjW894BEDcRTFiZ9fs ki/+/ew7nyz0kV0wK4t2Gr93dkpQJRJbI7fNDZOwUQGXwOA50QGjQSVz+frNGov5YP44 aNvL6RoIhf1REk2r1TAUz/PTLx0HxGFsbIP/Cbqv8LMhLlrdzP8bYtTlr5OFyrPQfhiv xpCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RzFA6AUh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h68si2361484pfc.35.2018.02.11.23.09.22; Sun, 11 Feb 2018 23:09:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RzFA6AUh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932961AbeBLHJS (ORCPT + 13 others); Mon, 12 Feb 2018 02:09:18 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:36267 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932568AbeBLHJQ (ORCPT ); Mon, 12 Feb 2018 02:09:16 -0500 Received: by mail-pl0-f66.google.com with SMTP id v3so4636516plg.3; Sun, 11 Feb 2018 23:09:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=NwL7A4hTUadKcUHHkqCgS88GiYok4oil6lnWHhgTt2o=; b=RzFA6AUhHiq8OkWJZcN4oQDjqLfKJBwRZ1Cy5uOWUZNvxKX46zuY27DONXD2M+p3ZN qz6iSqaWJrz4bMu6sI0fJ0AFhCJBZ8mUqXFL1XZ4Bs5kLB/GkOpNGvw7ewkDLB2t7kbs gazVj4Z7kM8X8ZWasnK+UsUEFGZFB8czYq6e15w4otmrS+3jMoa3EFfw3GJzqy2CXBCU 6++g3ceVUYa3LplG+z5ZiSdTkdjUQPqzZRV8v/7x5WkMR/9ufvyR8ELCcSHTtCCLs6Uy B+Q9etMo9xqbc6Lq2Bf6L2lQUFo3cfmhShuPu2P3wsaGxeDen1WjDix83n3RcM+ZZD5Z ST2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=NwL7A4hTUadKcUHHkqCgS88GiYok4oil6lnWHhgTt2o=; b=QiqDsrLClNs2q+o1L5CpmfNKJxNcrYX/wY0ZPqQm8NxUGDHgnFaG7Weim48cPUMnHO kkEhduJj2hs1lSf17JFDXqEc7EpxlUWT0izp+/I8RFipxkae4HlYp5pvx/i/CLHs2py0 UxqEHkVOvBvEpv89la541/TxmM7Ws3yPAUreRLbumCsv6yj6XjC5kPjTKOEC40cTP0Se gcPRyCO1grK0ag8+1HYH/rimD9dqKNPEvSRg9a8c62ishr9EPT6AIiKfChTkQrC48PC2 32ssgj43xhcApmw9XVeFKMOBSzTwAJ661RuyxVGu42bK7N5zL5jurSmu7g+WusySO5cW vTEA== X-Gm-Message-State: APf1xPC5oB/CstmHAaUvTmBEjBlW8yDWH5NSqGdCk2rZAOw2ddJFwlhm p436eQMr0V6SW+80mkzyoM4= X-Received: by 2002:a17:902:868f:: with SMTP id g15-v6mr10064341plo.137.1518419355709; Sun, 11 Feb 2018 23:09:15 -0800 (PST) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id l10sm27934066pfc.133.2018.02.11.23.09.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Feb 2018 23:09:15 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 12 Feb 2018 17:39:07 +1030 From: Joel Stanley To: Lee Jones , Rob Herring , Mark Rutland Cc: Arnd Bergmann , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Cyril Bur , Benjamin Herrenschmidt , Ryan Chen , Lei YU Subject: [PATCH 2/3] misc: aspeed-lpc: Request and enable LPC clock Date: Mon, 12 Feb 2018 17:38:46 +1030 Message-Id: <20180212070847.32387-3-joel@jms.id.au> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180212070847.32387-1-joel@jms.id.au> References: <20180212070847.32387-1-joel@jms.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The LPC device needs to ensure it's clock is enabled before it can do anything. In the past the clock was enabled and left running by u-boot, however Linux now has an upstream clock driver that disables unused clocks. Tested-by: Lei YU Reviewed-by: Andrew Jeffery Signed-off-by: Joel Stanley --- drivers/misc/aspeed-lpc-ctrl.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) -- 2.15.1 diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c index b5439643f54b..1827b7aa6674 100644 --- a/drivers/misc/aspeed-lpc-ctrl.c +++ b/drivers/misc/aspeed-lpc-ctrl.c @@ -7,6 +7,7 @@ * 2 of the License, or (at your option) any later version. */ +#include #include #include #include @@ -26,6 +27,7 @@ struct aspeed_lpc_ctrl { struct miscdevice miscdev; struct regmap *regmap; + struct clk *clk; phys_addr_t mem_base; resource_size_t mem_size; u32 pnor_size; @@ -221,16 +223,33 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) return -ENODEV; } + 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 = clk_prepare_enable(lpc_ctrl->clk); + if (rc) { + dev_err(dev, "couldn't enable clock\n"); + return rc; + } + lpc_ctrl->miscdev.minor = MISC_DYNAMIC_MINOR; lpc_ctrl->miscdev.name = DEVICE_NAME; lpc_ctrl->miscdev.fops = &aspeed_lpc_ctrl_fops; lpc_ctrl->miscdev.parent = dev; rc = misc_register(&lpc_ctrl->miscdev); - if (rc) + if (rc) { dev_err(dev, "Unable to register device\n"); - else - dev_info(dev, "Loaded at %pr\n", &resm); + goto err; + } + + dev_info(dev, "Loaded at %pr\n", &resm); + + return 0; +err: + clk_disable_unprepare(lpc_ctrl->clk); return rc; } @@ -239,6 +258,7 @@ static int aspeed_lpc_ctrl_remove(struct platform_device *pdev) struct aspeed_lpc_ctrl *lpc_ctrl = dev_get_drvdata(&pdev->dev); misc_deregister(&lpc_ctrl->miscdev); + clk_disable_unprepare(lpc_ctrl->clk); return 0; } From patchwork Mon Feb 12 07:08:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 127942 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2942450ljc; Sun, 11 Feb 2018 23:09:32 -0800 (PST) X-Google-Smtp-Source: AH8x22542MO9Bw0gUgMgQnINhuh58X9ufPvFo2kY04L4X50YufrmSnVEpDzzHWdOF/YjQS95uhtD X-Received: by 10.101.96.42 with SMTP id p10mr4892325pgu.364.1518419372769; Sun, 11 Feb 2018 23:09:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518419372; cv=none; d=google.com; s=arc-20160816; b=ffBpLzQpblhaBytwty7Xir+9m2gq+Pr3KpxogyPk1LXghrEpLs4oanYHMGm9a/Sa2y mP8MYGcAArevRYAHJshTi5NLi6gY3gtVizSBDG4QmsvoIYbWVOkk3WmpW1s1lbV2mvR8 R9bdL1vgUsk8HlxR0D1qv1pLkm3vMFE0d0yKDNlnDXlJBwIFCWmwB4ZvIHhGaUYn+PC4 OScSdWSQxrCXXVYKgGf57gm9ykpcVyY8yVkwge6EywKTmq796s5i+7nmA6oEqprnkXyG zPcHElsDS39pLFjpXZw6rTfE+ZLt8DhqqSlhb71fVkjClgsHVA3S03XkEAliM6a8gD5d WEng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=+UnUovVBeP3OPX99eGGjysHXPyKEeVfZbA2KOoeGXvQ=; b=tDKhb/WCGiw9vjp5wvVCe0SA/5Oevd1eTJzo2ytZRloglpOZFUDdUNSncFp8stNfxs xTmiZlF9RF9kPNaYc8vDbZRHacTS//M8Izxk8dCZTCuiJjGkEmk3dmd6QKkHeXYDViuR DQxmPeBZdptC//RZMxC06XW8PqL9tnXOaeEWukK4IYZem0hIxhUBwg0FEqxdkLprdd1w JicoRWy/zY9xL/e6cx60Y/VMaqKSQCZjQbsTkO0UqmjbpzZPuRb+ieAwOC0ya7bHbx7O 9y5NLf511n3RFw7EG5pGotvjtXny8M+B+2UoMhrMT2NvkzbUzfNGbUx3F7a9pTIzvgeC /dOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=bWwEXbfD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h68si2361484pfc.35.2018.02.11.23.09.32; Sun, 11 Feb 2018 23:09:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=bWwEXbfD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753897AbeBLHJ3 (ORCPT + 13 others); Mon, 12 Feb 2018 02:09:29 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:47026 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932568AbeBLHJZ (ORCPT ); Mon, 12 Feb 2018 02:09:25 -0500 Received: by mail-pg0-f67.google.com with SMTP id a11so6947317pgu.13; Sun, 11 Feb 2018 23:09:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+UnUovVBeP3OPX99eGGjysHXPyKEeVfZbA2KOoeGXvQ=; b=bWwEXbfDvS3+6bDhQVgGCFg6hcDIItiCQUJ7cRq9GDSvBczTuRbQf2mVi+lH4+WOk1 bodhlHdXc9KYgyojXGBOijxOJEOZgI9kA3AEqsTevMjidhQCfoKX3fQr6uGO8dRkUsYN xrf+miDJVgMistwUbSCb2ZjXwY4Joz3CeegX47RdFfmYqKsgs1G9H/coHEXrx+vk8F28 O8AHldJCIIa/46H+vxL7D62dfVe2ICk2LA/3n7Zu020vbLzB58XgaA/Mxd4yatJ1E3sJ za2nObr4pJXVKVH57EOy/tuALr9dmJqVS7q2iwQ2ZK9j8fQO8NIDGsQgORLmbjlIxDpq O6Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+UnUovVBeP3OPX99eGGjysHXPyKEeVfZbA2KOoeGXvQ=; b=sFCBw8Lg7ZSp0QViwaNndvQ1lIvIsqH1D9e7hPrZJ5/SXm+Z7lVwRkBKeOsJGHMwhr 4V4kw4pr6t+pqAegKN1MFqlH1H4G0cunr7iuQ0QU7J8/o+ATW1Rb6Xm3YKZfyW9MvsxU l9rIJsJHjRDBOHf4degkWGAe9I5LnBHU9EcdqHJgqcWRivTQki2JoCwgE6+0wpwbaw9I MUEEMNli5Ra4B46zolvvU2bgUegjY9oShXOmdwNBdF+J/S0qC1+b1dnPvLhEpJiO+paZ q9pZP5uso778f4oeWA2ZpRX+WuwcCsLAPkYMVDg+ER4U4MHlEPpUuaV3qma0KtQzXC8W LBEA== X-Gm-Message-State: APf1xPBd3DJTcmVSBEFZEIGn2h/x3zinNwWmGWrpveBs63G463QUk+NJ SrbY/vEQd/Bj/47pzA8ykh8= X-Received: by 10.101.64.4 with SMTP id f4mr8408379pgp.171.1518419364598; Sun, 11 Feb 2018 23:09:24 -0800 (PST) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id k3sm19164170pff.41.2018.02.11.23.09.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Feb 2018 23:09:23 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 12 Feb 2018 17:39:16 +1030 From: Joel Stanley To: Lee Jones , Rob Herring , Mark Rutland Cc: Arnd Bergmann , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Cyril Bur , Benjamin Herrenschmidt , Ryan Chen , Lei YU Subject: [PATCH 3/3] misc: aspeed-lpc-ctrl: Enable FWH and A2H bridge cycles Date: Mon, 12 Feb 2018 17:38:47 +1030 Message-Id: <20180212070847.32387-4-joel@jms.id.au> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180212070847.32387-1-joel@jms.id.au> References: <20180212070847.32387-1-joel@jms.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To date this driver has relied on prevous state from out of tree hacks and vendor u-boot trees in order to have the host be able to access data over the LPC bus. Now we explicitly enable the AHB to LPC bridge and FWH cycles from when the user first configures the address to map. We chose to do this then, as before that time there is no way for the kernel to know where it is safe to point the LPC window. Tested-by: Lei YU Reviewed-by: Andrew Jeffery Signed-off-by: Joel Stanley --- drivers/misc/aspeed-lpc-ctrl.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) -- 2.15.1 diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c index 1827b7aa6674..a024f8042259 100644 --- a/drivers/misc/aspeed-lpc-ctrl.c +++ b/drivers/misc/aspeed-lpc-ctrl.c @@ -21,6 +21,10 @@ #define DEVICE_NAME "aspeed-lpc-ctrl" +#define HICR5 0x0 +#define HICR5_ENL2H BIT(8) +#define HICR5_ENFWH BIT(10) + #define HICR7 0x8 #define HICR8 0xc @@ -155,8 +159,18 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd, if (rc) return rc; - return regmap_write(lpc_ctrl->regmap, HICR8, - (~(map.size - 1)) | ((map.size >> 16) - 1)); + rc = regmap_write(lpc_ctrl->regmap, HICR8, + (~(map.size - 1)) | ((map.size >> 16) - 1)); + if (rc) + return rc; + + /* + * Enable LPC FHW cycles. This is required for the host to + * access the regions specified. + */ + return regmap_update_bits(lpc_ctrl->regmap, HICR5, + HICR5_ENFWH | HICR5_ENL2H, + HICR5_ENFWH | HICR5_ENL2H); } return -EINVAL;