From patchwork Mon Feb 19 07:24:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 128779 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3201047ljc; Sun, 18 Feb 2018 23:25:14 -0800 (PST) X-Google-Smtp-Source: AH8x224z70MFDdMEHvuMTGYi6cr/Eu72QOf0yBXcVZK/eJTvD+FGh6ZQay8j2/KcXi0cbRdC1T9V X-Received: by 10.98.88.1 with SMTP id m1mr13822713pfb.178.1519025114415; Sun, 18 Feb 2018 23:25:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519025114; cv=none; d=google.com; s=arc-20160816; b=0aPATaPVonXylj0Cxe4SCLjXwukJ81ogix30UXhcRHAau+lda47pN2ewT8iYoXTfEH wby/1MHGtJ399mFNP2uQqdRUP/D5IMB+PvezO4V5aXe9JfNrHsA6uOE9eAOy6JOdiP8N W+t2iuXLjTVAJQNYI056wCC5cCOZbGAq0BKOWd8p28ka8hTeRkYLXY+oSpdDEp4WXnJ+ KOUloe2g/9ySAo0fBPygoqyfP/RWlrLAtjexJyjbk5gQ6VGb83zDQyPLHf6UEtgoAiGY iYI3MpgEPC/iy9J2nbbUiJ3nCHDK0jO94YP2hqAZUegwNhE+T2QNqwcQ0s9OhY/+kKeF rfNA== 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=0+y23RNN9DiEUUahCXyZcFMFudK8X0KhRebf3LNpKXs=; b=umrxF4bLgFLgPZYT4IrH+qJTJzuX9BrbzGJrU19nF6gRT4W0uTeeePRaBJWqRg3Qkx BylqZEGUTQLgPeyGeCaOjw6aGHZuAkQiLFWfITCrcsVeSTzyb5dTY/eDR5nfxgq9XBHZ VBLcxsvyr5qyndmf8seT9JWKl5EIadMPTbbgNVJnzXULmRSuFKFG8XLN/Dc1viiiWNhj CsLhR+Hg5mM7wHsnQZInttrgDsiLqxgfBXkyJ6OkK5mX05JkIJZf7aujYF3cv9LFc9td SpNOj5LiakEpUnik3qNQBVFCvU3fm5HpB4AdMuykNZKtFrDkcxl070fpqsJdpG9r5Nfw CQfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=mhAxtisp; 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 9-v6si8613937ple.367.2018.02.18.23.25.14; Sun, 18 Feb 2018 23:25:14 -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=mhAxtisp; 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 S1752102AbeBSHZK (ORCPT + 28 others); Mon, 19 Feb 2018 02:25:10 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34674 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751467AbeBSHZH (ORCPT ); Mon, 19 Feb 2018 02:25:07 -0500 Received: by mail-pf0-f196.google.com with SMTP id g17so1843019pfh.1; Sun, 18 Feb 2018 23:25: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=0+y23RNN9DiEUUahCXyZcFMFudK8X0KhRebf3LNpKXs=; b=mhAxtispq9o8/Bi821GDjKXCNnPUgwQmdLQk+qEyFU6UrpN0qRM+raAmSrjtET2QRj Ri00UPSdycBAy3thmqNWV5RYn3XQ205OZnUxyZ90KaKAKKht6T2IzxOY4zYk6SZu2EsE SVnxAX63hbz73Y2knq+/wHrjNmK0dEPo59adcPoTs3Ko3+J6F37cDo/aa1bcQzLQj9dJ PdElsnDY1Zc2CECi/e6yxSIxKe7PCmERyKaRatWaplnSNXdPYaEIUnpPjD6QjOJfeFNu 2aBh45EHFDFFbyfJ/eTepFQohy4XdlL42UWocj7AGs5VIsU2yyEmn+smvjciHv8Uz6QI dtnA== 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=0+y23RNN9DiEUUahCXyZcFMFudK8X0KhRebf3LNpKXs=; b=qYD3sG3VcjVJp50RH2g7PNOnQdK+HxJbXfYm+tXAFXlxlM5aQUTgPqs2sYQDImEOXV k1QEYKqOUbUIK1lG9Ohf1eaK5NYEopNUZzyYy+6u4J769st3vhEWQNjYM7ns5w7scmYd XwLCudoYj3oqWP199/vsBRPBaJ3isY97NtCnCqcbfAlgDWn/PH+MN5yqkWlxR3NcH4ER 9mkA3HDbNPSYMPRDEDk87I3mheQGS/qCfastMZ8QxPTFKdCfXA5GrDmw75O/bwyYye9i eyEgpb7S/zpwkprgTMNVL5UxVMd+1Mo+IdBNuWlRhavY2LUPcg9whQEHfs51lwWTSTkS ihsg== X-Gm-Message-State: APf1xPD2svtCjKwCPfiIW0gI2TYKV80bPjdYS/t9i03gYaXfz6n53BwM oS6OPnslmDwWN42cYt0CTzw= X-Received: by 10.99.2.202 with SMTP id 193mr4130832pgc.137.1519025106797; Sun, 18 Feb 2018 23:25:06 -0800 (PST) Received: from aurora.jms.id.au ([45.124.203.19]) by smtp.gmail.com with ESMTPSA id z79sm7221962pfa.139.2018.02.18.23.25.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Feb 2018 23:25:06 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 19 Feb 2018 17:54:57 +1030 From: Joel Stanley To: Lee Jones , Greg Kroah-Hartman , Rob Herring , Mark Rutland Cc: Arnd Bergmann , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Cyril Bur , Benjamin Herrenschmidt , Ryan Chen , Lei YU Subject: [PATCH v2 3/3] misc: aspeed-lpc-ctrl: Enable FWH and A2H bridge cycles Date: Mon, 19 Feb 2018 17:54:22 +1030 Message-Id: <20180219072422.22733-4-joel@jms.id.au> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180219072422.22733-1-joel@jms.id.au> References: <20180219072422.22733-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;