From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 A6F9B3E1201 for ; Mon, 27 Jul 2026 08:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785140406; cv=none; b=pq90Vw5JX8BPhk6Tq2PsXFwpgRBIb7prsUwEvrAGG7qKc7isETAlXyaPaUsO6F/uMDQyS+pctPThmHzC28Vbh0jLheTomT92fmqvSQf5qBeGbi/Q7tWLXCkGtCxyAkUesn7kxfJOesjh9CbZbboHd4V2BA2bQcsL5d41Xo1l9Jw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785140406; c=relaxed/simple; bh=NeWTLH60XPDWK5+mw5xbUbJfajTDDxDNPLX2UcUzbVs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZOuWxcv0Dh5C8DZzz8ZpSIaC8gMo00a/oapliq5B/Y6mBeXXHQaw4bBl0s70fwmI4vCpG/pL7t7u9X+wrtiKAsvSVEs8a/MRjmVRPZ+qDgb3XenQ4/E6OU9RU4nOpq6xkCrzWQwvgTPcAB6bE9e4SqRf7LLlvEX6MTPbQGAz7Pw= 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=I4TpMLot; arc=none smtp.client-ip=209.85.214.177 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I4TpMLot" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2cc73e322dbso22474125ad.1 for ; Mon, 27 Jul 2026 01:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785140403; x=1785745203; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=qPnz/v80LXwYp0PVxXjwmAK2BJ3kZ1bk+zxjufazDlY=; b=I4TpMLotyMJuWXlbKpE7UMQwdk2ppN2R86fTlwJwF5cVlgCqpSS1WM189d8VgLVXTK KP8G3pIJhpVIlOgxiciPJxN6i6DTKXhs81WpAuO6RQyNcLAU8kSU6891N0O4xoZcxJ4Y sngWrnYEnsfgfZJyy8dZkmPO3sq5x0IETi/+8sQlDrI2o1Qw85oGvC3bMfPt85ik9D9p 2VwicxqJIUoC0pzlmW6zs5G1NHi6Ff23DgYPZo22oEsl9s9ReuTB5Ro8h1PFe2iVmU75 ss5gVBtqsIlstIcRMmfMIf68DdHmGe6UxnTVczGMGrFJFT6/5wLM3aDAP9klSPTr8R57 D6iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785140403; x=1785745203; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qPnz/v80LXwYp0PVxXjwmAK2BJ3kZ1bk+zxjufazDlY=; b=pwc7EZTW1OgJmPKX8zkix6jGZXgZa4eOzp/gqQL1yYWOg5PGYpDDrEdm17qOUbkm/d 9MfCNGTHX2HSVfz9BKw13kM2mqPtfrWhoAkCrD36QB2T5ywQ0dh4p/z8PJKfXsGFhZnA URL/T68XaPFv+2Jd29Yk8SWraYYbvl2ZoNzhamM2nW8o2qPEAI4i6fRQmYtsQ0v++YAa bUnYabk1m5howlLOjcSYRG3G67zNKt+pmMStiiWGM+zkAxz48SW4j2sJ2p28J+kzakNF vcsqA6DUchKVZmhBH76sZmVYx1/2QHxvUFOpMr7bdXiESDvjeqM60WtKdYSuUXjbqliG PVzg== X-Forwarded-Encrypted: i=1; AHgh+Rr1iD4sOhtk8GR521kO6CfaoZziwZfPy0Ljp02Nj1DW4MsvxtrrxbrknkAqGy+avJcnKNT4fqo8vuv87ls=@vger.kernel.org X-Gm-Message-State: AOJu0Ywr22QyYAosfh67Jl51oH9V/4T+1/v4OjBIlLtWdy/Kdn1zcOLx VNnJPJKd6AyiBmYuMw9L3m3wX7zb3qZg0xMFusGE7e9+2EBg6P6OKgwT X-Gm-Gg: AR+sD11NGPXUrtJ0bhqCE43VrzROCgD0o1BivmCX3E7fh/ceJfW+MwnsJLECZgs9GCp pj4TIo20Q7BsTEutq+4+f7JxRw2i3kOAnBT2hwTMPdEt62Yrgv3o1XKyZjbpRTTn8lChiLanNlV WTyFUE6Nyvc/mqMm0IO+GVnnmqWPUHno025rDQ1qyNYprQwno8f8JlPMN+UoWqvfD/iK5tEEUNI NdhmJnLRAohlIMRkI0DIRIcULGPZFmCQUNOq7KDL4bIPsYEjayNrCwiRA8O7h0QGVYMFh9UehY4 fe6x99ywJoQqoDPyNcjzDquqRr6L4gb9CqlkOive9EIBkwJc13MKqYyn3ZrqBHnvF9m/2SWdV+E b49obD6GPqrlf+Kd6ZoV0gYU03zWUDiPqAlhsSq0+B0XwxV1D5fY0MQEdY3hpwRhrGeYX+LbDeG kCHqBYHXmQMW8SkqGBxnsPDq2ZDQNl4EwSpRryv1LwjV/br0dY4FcQlTOtUwiB X-Received: by 2002:a17:90b:268b:b0:38d:eaec:4396 with SMTP id 98e67ed59e1d1-38f293caf01mr7455177a91.11.1785140402768; Mon, 27 Jul 2026 01:20:02 -0700 (PDT) Received: from localhost.localdomain (60-250-196-139.hinet-ip.hinet.net. [60.250.196.139]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38f292aed12sm2629156a91.4.2026.07.27.01.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 01:20:02 -0700 (PDT) From: Zi-Yu Chen To: Andi Shyti , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jacky Huang , Shan-Chun Hung , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Zi-Yu Chen Subject: [PATCH v7 0/3] i2c: ma35d1: Add support for MA35D1 I2C controller Date: Mon, 27 Jul 2026 16:18:56 +0800 Message-Id: <20260727081859.1737223-1-zychennvt@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series adds support for the I2C controller found in the Nuvoton MA35D1 SoC. The driver supports controller and optional target mode and runtime power management. The implementation has been tested on the Nuvoton MA35D1 SOM board. Changes in v7: - Disable IRQ before clearing i2c->msg. - Support CONFIG_PM=n, and simplify runtime PM setup accordingly. - Remove redundant register access in runtime suspend/resume callbacks. - Defer clearing i2c->target until after pm_runtime_put_sync() in ma35d1_unreg_target(). - Enable interrupts alongside I2C enable in ma35d1_i2c_reset(). v6: https://lore.kernel.org/r/20260720030616.1067660-1-zychennvt@gmail.com/ Changes in v6: - Patch 2 (driver): - Removed dynamic IRQ toggling helpers for simpler interrupt management. Address review feedback: - Added zero-length read quirk. - Set i2c->msg to NULL on timeout to avoid use-after-free. - Cleared hardware registers on target unregistration to release the bus. - Protected suspend-path register writes with a spinlock. - Validated clock-frequency to prevent division-by-zero. - Removed incorrect I2C_M_IGNORE_NAK handling. - Corrected a comment typo in the receive data path. - Patch 3 (dts): - use a generic functional name audio-codec@1a v5: https://lore.kernel.org/r/20260630012106.3616821-1-zychennvt@gmail.com/ Changes in v5: - Patch 2 (driver): - Add spinlock protection for MA35_CTL0 register access. - Add NULL pointer check for i2c->msg in the ISR. - Use devres-managed cleanup (devm_add_action_or_reset) for runtime PM. - Use pm_runtime_force_suspend/resume() for Controller mode system sleep. - Control I2CEN bit enabling/disabling via runtime PM. - Refactor arbitration lost handling in state machines. - Remove unsupported I2C_FUNC_PROTOCOL_MANGLING flag. - Clean up readl_poll_timeout() parameters, retry loop, and unused macros. v4: https://lore.kernel.org/r/20260610030208.2020275-1-zychennvt@gmail.com/ Changes in v4: - Patch 1 (dt-bindings): - Update example interrupt number. - Patch 2 (driver): - Remove redundant spinlocks and fix 'irq' type to signed. - Fix target address recovery in ma35d1_i2c_reset(). - Refactor IRQ handler for multi-msg reads and NACK/IGNORE_NAK. - Fix timeout UAF via explicit IRQ disabling during recovery. - Drop IRQF_SHARED and fix PM paths in probe/unregistration. - Limit suspend/resume wakeup logic to target mode only. - Patch 3 (dts): - Add missing i2c0 node to dtsi. - Switch SoM configuration from i2c1 to i2c2 with updated pinctrl. - Add nau8822 audio codec node under i2c2 on the SoM board. - Drop redundant i2c0 alias and clean up dtsi property ordering. v3: https://lore.kernel.org/r/20260512073953.564323-1-zychennvt@gmail.com/ Changes in v3: - Fix minor DTS formatting issues (whitespace, missing newline) v2: https://lore.kernel.org/r/20260316063726.41048-1-zychennvt@gmail.com Changes in v2: - Overall: - Rebase on linux-i2c/i2c-next - Switched terminology from "master/slave" to "controller/target". - Patch 1 (dt-bindings): - Simplified description and fixed 'reg' size in example. - Patch 2 (driver): - Modernized using devm_*, generic device properties, and FIELD_PREP/GENMASK. - Optimized power management by moving clock control to runtime PM. - Simplified code by removing redundant .remove(), .owner, and inlines. - Added dev_err_probe() and default bus frequency handling. - Patch 3 (dts): - Moved i2c aliases to board dts and reordered nodes alphabetically. v1: https://lore.kernel.org/r/20260302020822.13936-1-zychennvt@gmail.com Zi-Yu Chen (3): dt-bindings: i2c: nuvoton,ma35d1-i2c: Add MA35D1 I2C controller i2c: ma35d1: Add Nuvoton MA35D1 I2C driver support arm64: dts: nuvoton: Add I2C nodes for MA35D1 SoC .../bindings/i2c/nuvoton,ma35d1-i2c.yaml | 63 ++ .../boot/dts/nuvoton/ma35d1-som-256m.dts | 20 + arch/arm64/boot/dts/nuvoton/ma35d1.dtsi | 72 ++ drivers/i2c/busses/Kconfig | 13 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ma35d1.c | 759 ++++++++++++++++++ 6 files changed, 928 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nuvoton,ma35d1-i2c.yaml create mode 100644 drivers/i2c/busses/i2c-ma35d1.c -- 2.34.1