From patchwork Mon Dec 21 05:56:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ChiaWei Wang X-Patchwork-Id: 11984241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45958C433DB for ; Mon, 21 Dec 2020 06:00:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA9E322B2A for ; Mon, 21 Dec 2020 06:00:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA9E322B2A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aspeedtech.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ylfPkfN+jfyEUnaqDPFRD911ZUzwA7ey68LQn1ISj+s=; b=kpNvqP+q+CU7ULrJddN6qa960 3SaLMp4yaU2IImZV+MpSYBN0QHZLcbaJZpuvB46jWoc5q6QcihYuf7UoJfrGmmw+FvuoEXsGhz/yx FXGqvwdhM6Sv1eWlh6Xi2vHAqV7TMR0IDO+dXqo9Pli9+jMBTFC31JdPNidshOgsTc6Nqe+JXXZKm UPwRHKUiEiDjsjRmVGmzeuGKRVBV/Mgcv6vDGHqLhqRAZqZ83HjvTCWgRIATCX223AhP+gC5X9NPY Be4QqlFyY7bqbKeIGwW+641/y8fTUfgaVGl6QFKiLYO0zlzRQTJNCJGHNMOtIglXyE8s8WSC31Sir dxQTfk8Cg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1krEDu-0005VZ-Rf; Mon, 21 Dec 2020 05:59:10 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1krEDs-0005Un-Th for linux-arm-kernel@merlin.infradead.org; Mon, 21 Dec 2020 05:59:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ggjTUWqH4vn17pwpwJChUxKIG63yvpDgzVt5+RwEPRA=; b=SB7jNx9nYxDZd1jDg4uAsyjOii rK4atRaai478BogR8qXj/KpK+dsYwTArxpAABsT6/x7ag9H+OnJqxeXsF0U6k9xaSLncQ1O8WcKBE E8ohWfb5zWiiiTn0FGnuX6OouKsxNuRcwVWxPnAXC5xB4RYVQaqVcaUnWQPId71h+Ml7GGoLoJZ7d AStDpEC4zFEZWWDYEaYH96FFvvTPxZc90qYrQxoBoTB1zbxtyeKsTHFaqF7KUfce2kYtM5OkCJhXv NaDZo5UwX/U6a3BLau8rVD5LWDpz0DVtDOzn/26IvzkXM7XT/PhzraF3LtLqxRlfFOwji6sY8G6HX KBHyu45w==; Received: from twspam01.aspeedtech.com ([211.20.114.71]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1krEDo-0007bE-EY for linux-arm-kernel@lists.infradead.org; Mon, 21 Dec 2020 05:59:06 +0000 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 0BL5qWvE013664; Mon, 21 Dec 2020 13:52:37 +0800 (GMT-8) (envelope-from chiawei_wang@aspeedtech.com) Received: from ChiaWeiWang-PC.aspeed.com (192.168.2.66) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 21 Dec 2020 13:56:09 +0800 From: "Chia-Wei, Wang" To: , , , , , , , , , , Subject: [PATCH v3 4/5] pinctrl: aspeed-g5: Adapt to new LPC device tree layout Date: Mon, 21 Dec 2020 13:56:22 +0800 Message-ID: <20201221055623.31463-5-chiawei_wang@aspeedtech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201221055623.31463-1-chiawei_wang@aspeedtech.com> References: <20201221055623.31463-1-chiawei_wang@aspeedtech.com> MIME-Version: 1.0 X-Originating-IP: [192.168.2.66] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 0BL5qWvE013664 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201221_055905_092644_706D9C77 X-CRM114-Status: GOOD ( 13.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: BMC-SW@aspeedtech.com, cyrilbur@gmail.com, haiyue.wang@linux.intel.com, rlippert@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add check against LPC device v2 compatible string to ensure that the fixed device tree layout is adopted. The LPC register offsets are also fixed accordingly. Signed-off-by: Chia-Wei, Wang --- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c index 0cab4c2576e2..6e0e5b64e677 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c @@ -60,7 +60,7 @@ #define COND2 { ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 0, 0 } /* LHCR0 is offset from the end of the H8S/2168-compatible registers */ -#define LHCR0 0x20 +#define LHCR0 0xa0 #define GFX064 0x64 #define B14 0 @@ -2648,14 +2648,21 @@ static struct regmap *aspeed_g5_acquire_regmap(struct aspeed_pinmux_data *ctx, } if (ip == ASPEED_IP_LPC) { - struct device_node *node; + struct device_node *lhc_np; + struct device_node *lpc_np; struct regmap *map; - node = of_parse_phandle(ctx->dev->of_node, + lhc_np = of_parse_phandle(ctx->dev->of_node, "aspeed,external-nodes", 1); - if (node) { - map = syscon_node_to_regmap(node->parent); - of_node_put(node); + if (lhc_np) { + lpc_np = lhc_np->parent; + if (!of_device_is_compatible(lpc_np, "aspeed,ast2400-lpc-v2") && + !of_device_is_compatible(lpc_np, "aspeed,ast2500-lpc-v2") && + !of_device_is_compatible(lpc_np, "aspeed,ast2600-lpc-v2")) + return ERR_PTR(-ENODEV); + + map = syscon_node_to_regmap(lpc_np); + of_node_put(lhc_np); if (IS_ERR(map)) return map; } else