Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp149798lqb; Tue, 4 Jun 2024 07:37:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJSOLANHsKgv9UC+uK6u7TV1M6ummr9+E2aW8RQZle1IIN8ka67QNgTDe4lYNT2LviTXoBJocKLW93UIy1QLJ8rs7eg4UV9Sq9a6fNJQ== X-Google-Smtp-Source: AGHT+IFsfG5mWzU4vBt1Su6E5FbYW0fvmKOMTXxHqAC06nEq7S0losx7bDI+91vKLkYd/jlndD+y X-Received: by 2002:a17:902:d30d:b0:1f4:990c:5ef1 with SMTP id d9443c01a7336-1f6370250c8mr104098405ad.31.1717511855419; Tue, 04 Jun 2024 07:37:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717511855; cv=pass; d=google.com; s=arc-20160816; b=TtC6/duix+0J3fhYLesUCShy/fYm8t0zBaSZlm5x1fJNylk+umtbqAucnk8biixtbA KafeH5b7SIqiq9qnFuhYAa4Zt2RoVm1SBiBwRIZbI4gWPORs3SPZBgO5UkFLPX7zF56a l4Q0D8Ejx3Vw+B7P3BJJu5yeHQDfnW9XzSRnklq5x0PsFu0DlGMX/cS8IoIxE+9SygbP Q6fiwp4yba0hqulhGicBgVAY+DN1Hkwitmpf3shZ9pS/OJYTHdU/+TZ4o/Rtpx58MNh9 h7ekLi+W/IRpMEjfiudGfipjKp3Uulrg+rIbYI7F5yRTfq/hjAsYfH9We+BSAB6+ufYP W57g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SmSb1T/VVTzErPc/hVH5RhenzFyIr1nmaXQZzXj2G2k=; fh=GR6hS7KndsVYe75dH+4I6IVS4M1tDMebpwgsf5Qgbzs=; b=P8TooEtH06WtH00Yk6Pb6nclxXUJkt68/5nikUyJUU8Gnvm4q0SjpuT5Ob91WWe/sV wM1E65g0EWVBR0zZV+ViBd3o/ChEQx0zxPY1MWlCk16j0+1CYRv1WF5Vpg675fc98Rz/ 5/c+hGZ8Ds9fYAvmPYykz48EuoUp64y3iPlEgImRqINvhupH9VwMZjxNSNpPc8jgR2D4 qYCuNlnHflYTANmWH4Cej7MjELjIWkvmVYncGGCW3wji48F6DUvd5E30JfSXqqcgRyQ6 kaeOtH3WjetgLZnud2Tu3v62jEXHAiqO2TpUfN0BLp4ubJK3Y9jK55w5byBClU7OUKU4 IaCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="gPjrhY/7"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-200783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200783-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f63233cf09si9592135ad.73.2024.06.04.07.37.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 07:37:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="gPjrhY/7"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-200783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200783-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8AA25B22A9B for ; Tue, 4 Jun 2024 14:12:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A78312A16C; Tue, 4 Jun 2024 14:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gPjrhY/7" Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E18D9179AF; Tue, 4 Jun 2024 14:12:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717510336; cv=none; b=Lmdxs2VAiwhMqQ9bqVAsgVFxEJND0xzUWrCOWafM0notqUDJB5MDITcwR/zTlyFgSRCAafgFuBvNHQq8ts+DppmlPw/enMPbfiuJ9vdPgvg6hOG6U1ArHGED5m2AbP+m1zUyf2qmY+xRQFwdhOEuO5+0T7UiwTpEqPp6j0vIGEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717510336; c=relaxed/simple; bh=eMyXSOQOT43iLqcN4yT0wGM8KoO/1+7sYYREbBUtemg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CyDoPVCWdlnni12hax7P2muu5QVLV1njOVp7aw0r9rfnz4kRnS8LTYOv1qNJCMVSbJXp1K5Uz5JI6jsyx3hq/dHseCyrg7FQMZzDPbunbiyTCiuRkDCs5YrwYgCD7WtrQdHOosgZ+Hs2hUPMD5+qYVPiQE43w4ctasTfrpk1zkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gPjrhY/7; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-52b8d483a08so4545517e87.1; Tue, 04 Jun 2024 07:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717510333; x=1718115133; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SmSb1T/VVTzErPc/hVH5RhenzFyIr1nmaXQZzXj2G2k=; b=gPjrhY/7aed5GNF3G3yn6GhuzI5oiwHL+WhEuN5wyAgQsbU+fIL1HimwHHfTpJqpJF qn1agwYPDZkrDQrXLKqGVwpWDnvstncP31xQNZsozut/9Pq91sNlP45iW0YyWbhRai64 C5BSuqB6Ww/6ZoQ57DRjXIx3h1S5VXuG1a0TFCdmLhwlmZ274a1hDl/ayktmtu2SROOn 9OeRFYFNNDNt4m83BnTotwRch59MyLL7iwOcG4ggygxVwFZmnaF7KGV0mXoRE97LO6Th cN25UDWv9inbjXxaLAr9p6/7n8HKLNN9WC/DS+D73yfj5ao5KL/F0MFbq4tRLGN2BEEZ OF4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717510333; x=1718115133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SmSb1T/VVTzErPc/hVH5RhenzFyIr1nmaXQZzXj2G2k=; b=mip0d3F7PZIXkhIC+Pru/h9TGKmKibbIGRp3ZmDb0e4Qvi1d7tJj3ypQ8pt8PGVhuY 8ouo82UbZqrDT5/qlTwZJbF+paOP5ied48mghxCsZDoVe7k654eluBC1Z086yTxyrZJx VpklAKanc6VOz46JRVWJuMjO7mxB53hY46KuwfapKiy0rti4FstopK4Z0IRg1SILh8VL M2ENgYZtYOlfKgZdrzr/Z8Skv3bpV4eE9kJUXi6audHk0Ht7wmnW03RjCU8bJUoRSe/i PRQErZV0D61R7SwNx7EA1IHB7gQUk31YiiM+xPrJ34l9fOyGtt6kInbTbY33Qme0Th4z yl2Q== X-Forwarded-Encrypted: i=1; AJvYcCUtQJEp29hj0meGKRV15NxFM2fM8+o4qurlg7+lU6m4c/Zdd1Ls4KqBAxPd9bCms9FhQuS6tIWXnUK8eBC5YZDOpNR+WCubrI4Pw8WrTdG5FVpNzQZhG8Uv3nHBc5qvGe7bHPD49uIQTkne1tqEcOtYpoG/s/vRWPgcBgYs3ZsbleWSbVQ= X-Gm-Message-State: AOJu0YwWEjRMyqyD7Ce6oHunN+SiEdTIYAtsvT+C0Z+cZo+tDskwrgMU 2BxKi7H/5IwOn2mXlYUXQwSs0pT0iVh18GoIniHZ0LBadBV8WTvq X-Received: by 2002:a05:6512:7b:b0:52b:8843:b084 with SMTP id 2adb3069b0e04-52b896bfa33mr8318743e87.47.1717510333160; Tue, 04 Jun 2024 07:12:13 -0700 (PDT) Received: from yoga-710.tas.nnz-ipc.net ([178.218.200.115]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b982d3de7sm742743e87.2.2024.06.04.07.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 07:12:12 -0700 (PDT) From: Dmitry Yashin To: Linus Walleij , Heiko Stuebner Cc: Luca Ceresoli , Jianqun Xu , Jonas Karlman , devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Dmitry Yashin Subject: [PATCH v3 1/2] pinctrl: rockchip: delay recalced_mask and route_mask init Date: Tue, 4 Jun 2024 19:10:19 +0500 Message-ID: <20240604141020.21725-2-dmt.yashin@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604141020.21725-1-dmt.yashin@gmail.com> References: <20240604141020.21725-1-dmt.yashin@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit For some SoC's like rk3308 additional runtime setup needed, so delay recalced_mask and route_mask init. Signed-off-by: Dmitry Yashin --- drivers/pinctrl/pinctrl-rockchip.c | 52 ++++++++++++++++++------------ 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index cc647db76927..b252d1454ce0 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -3170,6 +3170,36 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, return 0; } +static void iomux_recalced_routes_init(struct rockchip_pinctrl *info) +{ + struct rockchip_pin_ctrl *ctrl = info->ctrl; + struct rockchip_pin_bank *bank = ctrl->pin_banks; + int i, j; + + for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { + + /* calculate the per-bank recalced_mask */ + for (j = 0; j < ctrl->niomux_recalced; j++) { + int pin = 0; + + if (ctrl->iomux_recalced[j].num == bank->bank_num) { + pin = ctrl->iomux_recalced[j].pin; + bank->recalced_mask |= BIT(pin); + } + } + + /* calculate the per-bank route_mask */ + for (j = 0; j < ctrl->niomux_routes; j++) { + int pin = 0; + + if (ctrl->iomux_routes[j].bank_num == bank->bank_num) { + pin = ctrl->iomux_routes[j].pin; + bank->route_mask |= BIT(pin); + } + } + } +} + static const struct of_device_id rockchip_pinctrl_dt_match[]; /* retrieve the soc specific data */ @@ -3265,26 +3295,6 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( bank_pins += 8; } - - /* calculate the per-bank recalced_mask */ - for (j = 0; j < ctrl->niomux_recalced; j++) { - int pin = 0; - - if (ctrl->iomux_recalced[j].num == bank->bank_num) { - pin = ctrl->iomux_recalced[j].pin; - bank->recalced_mask |= BIT(pin); - } - } - - /* calculate the per-bank route_mask */ - for (j = 0; j < ctrl->niomux_routes; j++) { - int pin = 0; - - if (ctrl->iomux_routes[j].bank_num == bank->bank_num) { - pin = ctrl->iomux_routes[j].pin; - bank->route_mask |= BIT(pin); - } - } } return ctrl; @@ -3403,6 +3413,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) return PTR_ERR(info->regmap_pmu); } + iomux_recalced_routes_init(info); + ret = rockchip_pinctrl_register(pdev, info); if (ret) return ret; -- 2.39.2