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;