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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56170C433EF for ; Fri, 8 Oct 2021 16:38:54 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 163CB60F12 for ; Fri, 8 Oct 2021 16:38:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 163CB60F12 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=svenpeter.dev Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=V0DIXvIvUEUysi9IqfIeNVO4JSpwL1/toLZR08dVVOs=; b=worORjF6BWJCWQ nsAagpgWYHBS4QIHMfep4n+PgwnL1CpYStKAYk3e9GqM96TAnp4fOop+9ehyEtkMfAXmP0roHBbMf wWb8rtRyPyXg2WrK3HSTUR1zvSODfYf+d4KL4CKXgmnUZnahwmkBdeFcipxFfpSclbdLmmv0sLeKg gdmtfyRvBdAp9RNgFHRuhOWt1Oxc6qTn7xZqhWuei8d8UOxEErWBqF50ZvEuqVIJoBG8hu/jVsz4z EGZ+KAXa7X/af7kj+8GujO5ZsV0kaYc8t7t/KQfqPlifQQh9iohbhCB74vJS98nF3asDHiMYiDDtt 4bayyOZ8T7sShV5hhq7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYsrB-003XMT-EW; Fri, 08 Oct 2021 16:36:27 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYsr5-003XJn-0C for linux-arm-kernel@lists.infradead.org; Fri, 08 Oct 2021 16:36:20 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id AB54B580FD5; Fri, 8 Oct 2021 12:36:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 08 Oct 2021 12:36:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm2; bh=cHX2rY9rskeE1+fRnngpouQp+f owWM3d9LCqW9L1Z+0=; b=TqkAafPNpdb94tkYSGI5CqyYCj7IfvR/jOKRt7WVvv 1YidtBYXtoK9qwTjJfxhR1tIS2LS/UkEQvs0D/+Im47XmW4ojwJOPQLp2UYmEn9O HjeVfl0lsa/kznsJKi/uTZGZh+97pwXZVEoIIeiGZyMFzEMuEQKkPVXhl0U96GQD B0wcKHB4kbCYitFbQO4dwYSZEi2dMPTIZz4ZQpY2aZhlZJjWxoVxOibZ/gMPHg29 AxrWvbvVsCh90YlY3U07DiE0D91Ql1174hgFU2VbJYuoQjjlrUBrV+iF8XvTJdas h43MIAP7NOHmQyn74UUPAnc+2VkJRfwVOAYbaUa+QZ0w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=cHX2rY9rskeE1+fRn ngpouQp+fowWM3d9LCqW9L1Z+0=; b=Vu6xa+sbSYGmBVWHV6njmWP5ItJrJuLsa lkZCT6DVC/STDr/vRMwYcl/uVkoREkZAWt2bJ6E98drt/GHnJDLdeRhWS6N7W1zR n2pu6hBl5J3P0DQxLBVA6S2DWGCqva0vKa1kqp0fWIRZGa5922O0aYdE+6WVRUt1 a2eP5dvma2I6mnlxKmbhZPkhIoyawxCG3bM6lzBbZYBYcMSX0W1Ld4dgPp71INJt I0NH3xQytIf+jFpxnTVjxpXUkI9vp+tnJadw8jZn/w1KT1PmQlyXUHYnGLSSqAXH oFUxypulkbpx6V2Jvrns9K6GPIF0OAuWnx9C1IJzzzmarMtn/2gzA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddttddgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epfeehudeftddvhfehvdduhedtjeejheeuudfftdfgvdekvdelleeuveelgfeflefgnecu ffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehsvhgvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Oct 2021 12:36:09 -0400 (EDT) From: Sven Peter To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Olof Johansson , Christian Zigotzky , Wolfram Sang Cc: Sven Peter , Arnd Bergmann , Hector Martin , Mohamed Mediouni , Stan Skowronek , Mark Kettenis , Alyssa Rosenzweig , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 00/11] Add Apple M1 support to PASemi i2c driver Date: Fri, 8 Oct 2021 18:35:21 +0200 Message-Id: <20211008163532.75569-1-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211008_093619_230611_2E428083 X-CRM114-Status: GOOD ( 21.82 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, v1: https://lore.kernel.org/linux-i2c/20210926095847.38261-1-sven@svenpeter.dev/ Changes for v2: - Added reviewed-by/acks - Switched from ioport_map to pci_iomap as suggested by Arnd Bergmann - Renamed i2c-pasemi-apple.c to i2c-pasemi-platform.c as suggested by Wolfram Sang - Replaced the ioport number in the adapter name with dev_name to be able to identify separate busses in e.g. i2cdetect. I still don't have access to any old PASemi hardware but the changes from v1 are pretty small and I expect them to still work. Would still be nice if someone with access to such hardware could give this a quick test. And for those who didn't see v1 the (almost) unchanged original cover letter: This series adds support for the I2C controller found on Apple Silicon Macs which has quite a bit of history: Apple bought P.A. Semi in 2008 and it looks like a part of its legacy continues to live on in the M1. This controller has actually been used since at least the iPhone 4S and hasn't changed much since then. Essentially, there are only a few differences that matter: - The controller no longer is a PCI device - Starting at some iPhone an additional bit in one register must be set in order to start transmissions. - The reference clock and hence the clock dividers are different In order to add support for a platform device I first replaced PCI-specific bits and split out the PCI driver to its own file. Then I added support to make the clock divider configurable and converted the driver to use managed device resources to make it a bit simpler. The Apple and PASemi driver will never be compiled in the same kernel since the Apple one will run on arm64 while the original PASemi driver will only be useful on powerpc. I've thus followed the octeon (mips)/thunderx(arm64) approach to do the split: I created a -core.c file which contains the shared logic and just compile that one for both the PASemi and the new Apple driver. Best, Sven Sven Peter (11): dt-bindings: i2c: Add Apple I2C controller bindings i2c: pasemi: Use io{read,write}32 i2c: pasemi: Use dev_name instead of port number i2c: pasemi: Remove usage of pci_dev i2c: pasemi: Split off common probing code i2c: pasemi: Split pci driver to its own file i2c: pasemi: Move common reset code to own function i2c: pasemi: Allow to configure bus frequency i2c: pasemi: Refactor _probe to use devm_* i2c: pasemi: Add Apple platform driver i2c: pasemi: Set enable bit for Apple variant .../devicetree/bindings/i2c/apple,i2c.yaml | 61 +++++++++ MAINTAINERS | 2 + drivers/i2c/busses/Kconfig | 11 ++ drivers/i2c/busses/Makefile | 3 + .../{i2c-pasemi.c => i2c-pasemi-core.c} | 114 +++++----------- drivers/i2c/busses/i2c-pasemi-core.h | 21 +++ drivers/i2c/busses/i2c-pasemi-pci.c | 85 ++++++++++++ drivers/i2c/busses/i2c-pasemi-platform.c | 122 ++++++++++++++++++ 8 files changed, 334 insertions(+), 85 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/apple,i2c.yaml rename drivers/i2c/busses/{i2c-pasemi.c => i2c-pasemi-core.c} (77%) create mode 100644 drivers/i2c/busses/i2c-pasemi-core.h create mode 100644 drivers/i2c/busses/i2c-pasemi-pci.c create mode 100644 drivers/i2c/busses/i2c-pasemi-platform.c -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel