From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46D25CA5FDB for ; Thu, 1 Oct 2026 12:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3JIoDgTOv4u7+6ibmfqW7fSxcMoJyhlM7wt4GAWTfqc=; b=TVn4RdPE90JaIhMMETIoy1JkB3 J9BP5qfUc48l2ZE3B3G9LjYIo45u5UAmWtoeTBKuk2AjDk4plKI2PkJfmNuylHCmr2uHQp8T5BUMh 1Df2kbWPoS6Bog6mpnZH/YPaDsEvIQQ3XJBT5i198gcLmw4dE7ppIVQc7UbnTtU5T+LKevIVVgpgU vDHx18VTDBg7lixr70hzY8XL/NriT/ppTRFiuS7iYAstKLPZj1U+qNQ+7vQQaHzP5doULzxvfPaqw +99ZalBOFXpSGdZNS2c1fdNwP9PokSopZISD4tNBxEAYOUROvq3sGpBIDsS39XgKMRky6YZiQhM96 8mGiBM4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCG63-000000094w0-3HxH; Thu, 01 Oct 2026 12:41:11 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCG5u-000000094mI-28p9 for linux-arm-kernel@lists.infradead.org; Thu, 01 Oct 2026 12:41:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 905FE44833; Thu, 1 Oct 2026 12:41:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 338CBC4AF5F; Thu, 1 Oct 2026 12:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790858461; bh=uI73kZ2fVLB778ZIX6xTd62hdi+Tv5H5o2+oLIxsFhg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=K7w8XFOKntMR0VkbuaKT5H2M87GKxdukEko83YLMo6CCsTzlxw8IzHM3L7l34P02z RmQ1EkoTakzwSle+IfhsK2o1doV2Ly421ZkaSKLsUMSOf7d0MPbAccVkRpgMS3xDBX lgD0laCZIR1mBDyEJjXfmb3G/mdUf1toiG4/Sl+A4zF++65pdSzg0JYVjtQbXgo+ct hs9dp+of2y2R3uMv9UyMiRieR+czw8kcF/V23qRN7AzpJptxRU3Wi2S2SOUGxYRd3n ejCmjXGXurJE0Wos66hSqZUMOY9uR01lxaFoHUv9sPsCxmamjWx4FBiuH0C5YSKOQ9 NjOZH9JfTdsMw== 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 20A53CA5FD4; Thu, 1 Oct 2026 12:41:01 +0000 (UTC) From: Long Zhao via B4 Relay Date: Thu, 01 Oct 2026 20:41:01 +0800 Subject: [PATCH v9 12/15] gpio: pl061: add Ambarella register-layout variant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261001-cv75-v5-v9-12-486cc289a4b8@ambarella.com> References: <20261001-cv75-v5-v9-0-486cc289a4b8@ambarella.com> In-Reply-To: <20261001-cv75-v5-v9-0-486cc289a4b8@ambarella.com> To: Arnd Bergmann , Krzysztof Kozlowski , Alexandre Belloni , soc@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Long Zhao , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd , Jerome Brunet , Linus Walleij , Bartosz Golaszewski , Michael Walle , Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Catalin Marinas , Will Deacon , Long Zhao , Lee Jones , mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790858457; l=3980; i=longzhao@ambarella.com; s=20260730; h=from:subject:message-id; bh=zkcP1Kw3eAzvUqGloHYc7RvGy1ic8OilRLpgIyaHt+g=; b=aELpVqcQ75J00/Y5KnPay/cS7j5IeCOQryL+L5vSiG/TcrKE0DpqxnBrzWttyUQuRamUnMB5I Kym3GxpVmgZCA6rt/platVmD1Cja7CNcUSjL36GKB7D33soedss7XiV X-Developer-Key: i=longzhao@ambarella.com; a=ed25519; pk=/xGhPTOX0/eYsyTWzyjjgAIW1Z/YD+IlnOnvcdRozow= X-Endpoint-Received: by B4 Relay for longzhao@ambarella.com/20260730 with auth_id=903 X-Original-From: Long Zhao X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: longzhao@ambarella.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Long Zhao Add a 32-bit, 32-line layout with DAT/DIR/IS/IBE/IEV/IE/MIS/IC plus MASK and ENABLE. Probe unmasks the bank and enables the controller. IRQ type changes also clear the pending bit. This derivative does not need write-after-direction or system suspend save/restore. Match the part with designer AMBA_VENDOR_AMBARELLA (JEP106 identity 0x68, bit 7 set) and part number 0x061. Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij Signed-off-by: Long Zhao --- drivers/gpio/gpio-pl061.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/amba/bus.h | 1 + 2 files changed, 60 insertions(+) diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 08d45f8923c2..bbb9eeeb074a 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -38,6 +38,18 @@ #define PL061_MIS 0x418 #define PL061_IC 0x41c +#define AMBARELLA_GPIO_NR 32 +#define AMBARELLA_DAT 0x00 +#define AMBARELLA_DIR 0x04 +#define AMBARELLA_IS 0x08 +#define AMBARELLA_IBE 0x0c +#define AMBARELLA_IEV 0x10 +#define AMBARELLA_IE 0x14 +#define AMBARELLA_MIS 0x20 +#define AMBARELLA_IC 0x24 +#define AMBARELLA_MASK 0x28 +#define AMBARELLA_ENABLE 0x2c + struct pl061_regs { unsigned int dat; unsigned int dir; @@ -318,6 +330,18 @@ static bool pl061_arm_volatile_reg(struct device *dev, unsigned int reg) } } +static bool pl061_ambarella_volatile_reg(struct device *dev, unsigned int reg) +{ + switch (reg) { + case AMBARELLA_DAT: + case AMBARELLA_MIS: + case AMBARELLA_IC: + return true; + default: + return false; + } +} + static const struct regmap_config pl061_arm_regmap_config = { .reg_bits = 16, .val_bits = 8, @@ -329,6 +353,16 @@ static const struct regmap_config pl061_arm_regmap_config = { .use_raw_spinlock = true, }; +static const struct regmap_config pl061_ambarella_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + .max_register = AMBARELLA_ENABLE, + .volatile_reg = pl061_ambarella_volatile_reg, + .fast_io = true, + .use_raw_spinlock = true, +}; + static const struct pl061_regs pl061_arm_regs = { .dir = PL061_DIR, .is = PL061_IS, @@ -339,6 +373,19 @@ static const struct pl061_regs pl061_arm_regs = { .ic = PL061_IC, }; +static const struct pl061_regs pl061_ambarella_regs = { + .dat = AMBARELLA_DAT, + .dir = AMBARELLA_DIR, + .is = AMBARELLA_IS, + .ibe = AMBARELLA_IBE, + .iev = AMBARELLA_IEV, + .ie = AMBARELLA_IE, + .mis = AMBARELLA_MIS, + .ic = AMBARELLA_IC, + .mask = AMBARELLA_MASK, + .enable = AMBARELLA_ENABLE, +}; + static const struct pl061_drvdata pl061_arm = { .regmap_config = &pl061_arm_regmap_config, .regs = &pl061_arm_regs, @@ -348,6 +395,13 @@ static const struct pl061_drvdata pl061_arm = { .reg_mask_xlate = pl061_arm_reg_mask_xlate, }; +static const struct pl061_drvdata pl061_ambarella = { + .regmap_config = &pl061_ambarella_regmap_config, + .regs = &pl061_ambarella_regs, + .ngpio = AMBARELLA_GPIO_NR, + .clear_irq_on_type = true, +}; + static int pl061_probe(struct amba_device *adev, const struct amba_id *id) { struct device *dev = &adev->dev; @@ -515,6 +569,11 @@ static const struct amba_id pl061_ids[] = { .mask = 0x000fffff, .data = (void *)&pl061_arm, }, + { + .id = (AMBA_VENDOR_AMBARELLA << 12) | 0x061, + .mask = 0x000fffff, + .data = (void *)&pl061_ambarella, + }, { 0, 0 }, }; MODULE_DEVICE_TABLE(amba, pl061_ids); diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 80a74cd2da7e..411533bfa61d 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h @@ -98,6 +98,7 @@ enum amba_vendor { AMBA_VENDOR_ST = 0x80, AMBA_VENDOR_QCOM = 0x51, AMBA_VENDOR_LSI = 0xb6, + AMBA_VENDOR_AMBARELLA = 0xe8, }; extern const struct bus_type amba_bustype; -- 2.34.1