From patchwork Tue Dec 12 08:20:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Shubin via B4 Relay X-Patchwork-Id: 177134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7581319vqy; Tue, 12 Dec 2023 00:22:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGu4Ymrm7xXpFNFp8RnYYMdTOZKJMIJZJTwIeb6r7egp8O5ts0c1RjE1n4bVKTWJhj3+4Bc X-Received: by 2002:a17:90a:4406:b0:28a:bc14:8f08 with SMTP id s6-20020a17090a440600b0028abc148f08mr101194pjg.88.1702369331737; Tue, 12 Dec 2023 00:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702369331; cv=none; d=google.com; s=arc-20160816; b=jt28wEEvz34q7zL+hq8jBQsKWkCPbUhwPMLR6wTudoYZlae/PX3r+RrHjtp31+m56H vgcVb4pKprggPncPt/sYyzblGpEZJBvTfiN21Qi3fDUCVLqDyu6J0zc04e+2I2ScfhJN 3g+jnHHy0HxpyI6zprvuUYBn0LHOTBnJTVMaeh8Pz1ayz0pWEl3J/UAMwk64XGyyFJSx wvykSpQZqLiTaO+hVugQMDt9lvu5nHnSPAGbQ0Cj+5JeNfAzs5dbE82inT4FmGBH+dnB hi8qxD5u+XtE3yh+yLZF98UiQf5mMRayHv1v7S6S4T+QvKm5v/V2amC6s0auyfjpW6Oa WZbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=IpGrx2xxG9NN1yreUr4F4CtAzIIvGuyTj4pADMvGBAg=; fh=lcMz+iDkHQ2AzmxsqPpOwtAVzI3sU5FyWGbXShUbkLQ=; b=J+UZkojZfY3tbPTimUiAwHb8wPWPrJW7jl4SruaF27cIFsHbJJUeDDZZNtKR1uxvoq lj1oLn4gz7LvVhIZeFHN4yruRJE+qwTdWiWel5YyNgPzD0ceemscTbY3dxdtMAOiDQ8U 2TdYymWW4gFN2gwWjavro6J9b6o35LbogKEit9wS9ST1YXr4nfJzO40sRP5Cbvsxknxt gUMhm0epHPUUigGgsbxAC6gsg5+qmhf5pe6uWpeko1n1X7PcT2trkpVLrBKvlyGI/ITr rWtjH120FQRXvNJz9AMOwCs4oGAxKdvBIe1+OUTzNYPaPrc0XdC9QdrFdoX9ezrBQC0Q oUYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dQQRaAQT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id o22-20020a17090ab89600b00286e9d394d0si7514367pjr.23.2023.12.12.00.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 00:22:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dQQRaAQT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A28308043994; Tue, 12 Dec 2023 00:22:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345948AbjLLIV7 (ORCPT + 99 others); Tue, 12 Dec 2023 03:21:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbjLLIV6 (ORCPT ); Tue, 12 Dec 2023 03:21:58 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A631D2 for ; Tue, 12 Dec 2023 00:22:05 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPS id B4D6CC433CC; Tue, 12 Dec 2023 08:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702369324; bh=buzcRXUjCLmwedxDWvwtpshNY+cYB6kdPqYugv3vjOY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=dQQRaAQTR1hQn4slnBWX2AsGKEzqMNmsgs1Qju1mr5D4Yh/fO3DNbRuy0IiG2ALQ4 KmsxRvqHQ6cnrHYWUwTs+MZpBeLSGbum5E8sTksJdgNhWONXINSHwV4rnLJn0Gsf/G +JYFwI1gJiNfJY/RCaJwJC/rG+JDI9+P8LcyLaU3ZRmbSEDkR0JAy5Vx9aBnymrqsN SdXKO9A7u1bwshXJXEESOyp5LOVFZMaFjOZKe1gA7zpjfLNQAPUlpfkpKVNtc/IKIH I0ikASV9OoICupk7PSQVRi/GMAF67FPgnbBITHg7x4D75fwVSHLwM2vShfQ3bZQllj cbmtGTmZbDv2g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0DA1C38145; Tue, 12 Dec 2023 08:22:04 +0000 (UTC) From: Nikita Shubin via B4 Relay Date: Tue, 12 Dec 2023 11:20:20 +0300 Subject: [PATCH v6 03/40] ARM: ep93xx: add regmap aux_dev MIME-Version: 1.0 Message-Id: <20231212-ep93xx-v6-3-c307b8ac9aa8@maquefel.me> References: <20231212-ep93xx-v6-0-c307b8ac9aa8@maquefel.me> In-Reply-To: <20231212-ep93xx-v6-0-c307b8ac9aa8@maquefel.me> To: Nikita Shubin , Linus Walleij , Dmitry Torokhov , Damien Le Moal , Andy Shevchenko Cc: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-kernel@vger.kernel.org, Arnd Bergmann X-Mailer: b4 0.13-dev-e3e53 X-Developer-Signature: v=1; a=ed25519-sha256; t=1702369322; l=1827; i=nikita.shubin@maquefel.me; s=20230718; h=from:subject:message-id; bh=eYKSe0rCshZoOeVwRz9I1FuWVPyqzS0/nTRbTMhj8wM=; =?utf-8?q?b=3D2ivmC5S5mStq?= =?utf-8?q?AgysB6XZ9bDah+Od6zlHy1pGhWoETzb3c6Xv/oMb7sSivgLKlgfLAHg8LaJt7ud9?= 9TAL8LM/BlGYVoS1YbbM/L7ZXLnDK0zTm17u8QNANmu89wN8oFot X-Developer-Key: i=nikita.shubin@maquefel.me; a=ed25519; pk=vqf5YIUJ7BJv3EJFaNNxWZgGuMgDH6rwufTLflwU9ac= X-Endpoint-Received: by B4 Relay for nikita.shubin@maquefel.me/20230718 with auth_id=65 X-Original-From: Nikita Shubin Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 00:22:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785063623942303418 X-GMAIL-MSGID: 1785063623942303418 From: Nikita Shubin The following driver's should be instantiated by ep93xx syscon driver: - reboot - pinctrl - clock They all require access to DEVCFG register with a shared lock held, to avoid conflict writing to swlocked parts of DEVCFG. Provide common resources such as base, regmap and spinlock via auxiliary bus framework. Signed-off-by: Nikita Shubin --- include/linux/soc/cirrus/ep93xx.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/linux/soc/cirrus/ep93xx.h b/include/linux/soc/cirrus/ep93xx.h index 56fbe2dc59b1..fc35be3af723 100644 --- a/include/linux/soc/cirrus/ep93xx.h +++ b/include/linux/soc/cirrus/ep93xx.h @@ -3,6 +3,18 @@ #define _SOC_EP93XX_H struct platform_device; +struct regmap; + +enum ep93xx_soc_model { + EP93XX_9301_SOC, + EP93XX_9307_SOC, + EP93XX_9312_SOC +}; + +#include +#include +#include +#include #define EP93XX_CHIP_REV_D0 3 #define EP93XX_CHIP_REV_D1 4 @@ -10,6 +22,20 @@ struct platform_device; #define EP93XX_CHIP_REV_E1 6 #define EP93XX_CHIP_REV_E2 7 +struct ep93xx_regmap_adev { + struct auxiliary_device adev; + struct regmap *map; + void __iomem *base; + spinlock_t *lock; + void (*write)(struct regmap *map, spinlock_t *lock, unsigned int reg, + unsigned int val); + void (*update_bits)(struct regmap *map, spinlock_t *lock, + unsigned int reg, unsigned int mask, unsigned int val); +}; + +#define to_ep93xx_regmap_adev(_adev) \ + container_of((_adev), struct ep93xx_regmap_adev, adev) + #ifdef CONFIG_ARCH_EP93XX int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); void ep93xx_pwm_release_gpio(struct platform_device *pdev);