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 EA353C433F5 for ; Sun, 26 Sep 2021 09:59:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C079C6103B for ; Sun, 26 Sep 2021 09:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230073AbhIZKBQ (ORCPT ); Sun, 26 Sep 2021 06:01:16 -0400 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:59893 "EHLO new2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229755AbhIZKBP (ORCPT ); Sun, 26 Sep 2021 06:01:15 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 9036A580FBA; Sun, 26 Sep 2021 05:59:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 26 Sep 2021 05:59:38 -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=mlHm6qJaY97xGTZYEJ3J85Alc/ WY1AV0Z5CGewPFjJw=; b=UhHGVNovPleofpk5mVBeMMls1i4coOXmt80/bw0HyF HjTu8qNJvqq54MN3sIsFDgJESrj0RNMZQVjzoyzhPwXCLgqc0z0JmbbLEf6pOre9 c+CcG+SVsywGs5PAldJ2a19z4ybEbY9jo7cJ7LmvMxxNT5vvrukSFYw4cwEMS01R ujwGvMLLRCnSKa/DRCd2Mud3MJCQjQEHYpbTww5DLoJydbzYNGM2Uat+qlrN4Vvc HTAZVNJR+hLdwKt3idxcKDhuexrgtTNidldPmydKEvSsdif0gGL/ryQY2S8iPOHa 1tUSNKw5fCCbzKo/NMvy6jcyHy/OuadCOfIaoil20A9Q== 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=fm3; bh=mlHm6qJaY97xGTZYE J3J85Alc/WY1AV0Z5CGewPFjJw=; b=C+k4X3XQGbpbimAylv7MAWKQt8i7EYeJd KdPdfizHnI9ca95NaiC5zhGAh+s06MsAY/W7fz6IAOQZHhxdFjoeiIYMbtN7iZF1 Ovo0e/8qWR3+72b7d1rRJ7mgkmj1eCNdR3cVm9BybT1zlt67tDINx4ykXpKmY8yM JVNF/Ye9/8XQ6iUxeOD5WoFtECxUhs5IEUAkEgMSOsuUwhTZiQbBmoNsYxHjqqs3 ltzsJUwRyQ+zA7eRECsryljZeAfH58l2UkGQINKWiu3PdayRIOMr8w9DfCIikwli S+PpgH20QrEse5AvL8boFEyi9QWK7dHGT2JmgoD3NpuvxxhPhn0Wg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudejiedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epuefgleekvddtjefffeejheevleefveekgfduudfhgefhfeegtdehveejfefffffgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvghnse hsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 26 Sep 2021 05:59:33 -0400 (EDT) From: Sven Peter To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Olof Johansson 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 00/10] Add Apple M1 support to PASemi i2c driver Date: Sun, 26 Sep 2021 11:58:37 +0200 Message-Id: <20210926095847.38261-1-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, 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. Now unfortunately I don't have access to any old PASemi hardware and cannot confirm that my changes haven't broken anything for those. I believe Hector was in contact with Olof a few months ago who said that he might still have an old machine on which he could test this. I'd very much appreciate if he (or anyone else for that matter :-)) could give this series a quick test on the old PASemi machines. Best, Sven Sven Peter (10): dt-bindings: i2c: Add Apple I2C controller bindings i2c: pasemi: Use io{read,write}32 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 + drivers/i2c/busses/i2c-pasemi-apple.c | 122 ++++++++++++++++++ .../{i2c-pasemi.c => i2c-pasemi-core.c} | 114 +++++----------- drivers/i2c/busses/i2c-pasemi-core.h | 21 +++ drivers/i2c/busses/i2c-pasemi-pci.c | 85 ++++++++++++ 8 files changed, 334 insertions(+), 85 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/apple,i2c.yaml create mode 100644 drivers/i2c/busses/i2c-pasemi-apple.c 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 -- 2.25.1 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 D951FC433F5 for ; Sun, 26 Sep 2021 10:02:20 +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 A355761029 for ; Sun, 26 Sep 2021 10:02:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A355761029 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=eR3D57amUJa2e3KCwvhkhHV06+z4zm4JmeXTyT1md6E=; b=d9jUrl1G27PwT2 V+CaQ+onx4C1WLyFqbTN0P5geN3eJloT5o1OoxVexLD/eehHnJoz5WaXDENaCdPfEU3bNWr3edykK GNxxznDnpfNQ89nRq7CKkAOv/C5lMFntHNWJDAZ/v4acP6D98Qtg9IPT+UPGQ6/nNNl7b24vxnwX3 Mv7Pk8s0RkP680D9MMxWABwWmxC1NRaec+havdoFbx3kmq993pzpxy8nq9MUONa6CJvfBx0IljpOu Qperc5coKTMf0JiF+6JfUfTDqnh0voRq65laZgGwfYIgVhm4gN3tIFeqnOMpucU/Vky1F+xrjg5Vr pvwakRehmJViz2FJy54g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUQwj-000KEQ-7W; Sun, 26 Sep 2021 09:59:45 +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 1mUQwf-000KDY-Iv for linux-arm-kernel@lists.infradead.org; Sun, 26 Sep 2021 09:59:43 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 9036A580FBA; Sun, 26 Sep 2021 05:59:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 26 Sep 2021 05:59:38 -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=mlHm6qJaY97xGTZYEJ3J85Alc/ WY1AV0Z5CGewPFjJw=; b=UhHGVNovPleofpk5mVBeMMls1i4coOXmt80/bw0HyF HjTu8qNJvqq54MN3sIsFDgJESrj0RNMZQVjzoyzhPwXCLgqc0z0JmbbLEf6pOre9 c+CcG+SVsywGs5PAldJ2a19z4ybEbY9jo7cJ7LmvMxxNT5vvrukSFYw4cwEMS01R ujwGvMLLRCnSKa/DRCd2Mud3MJCQjQEHYpbTww5DLoJydbzYNGM2Uat+qlrN4Vvc HTAZVNJR+hLdwKt3idxcKDhuexrgtTNidldPmydKEvSsdif0gGL/ryQY2S8iPOHa 1tUSNKw5fCCbzKo/NMvy6jcyHy/OuadCOfIaoil20A9Q== 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=fm3; bh=mlHm6qJaY97xGTZYE J3J85Alc/WY1AV0Z5CGewPFjJw=; b=C+k4X3XQGbpbimAylv7MAWKQt8i7EYeJd KdPdfizHnI9ca95NaiC5zhGAh+s06MsAY/W7fz6IAOQZHhxdFjoeiIYMbtN7iZF1 Ovo0e/8qWR3+72b7d1rRJ7mgkmj1eCNdR3cVm9BybT1zlt67tDINx4ykXpKmY8yM JVNF/Ye9/8XQ6iUxeOD5WoFtECxUhs5IEUAkEgMSOsuUwhTZiQbBmoNsYxHjqqs3 ltzsJUwRyQ+zA7eRECsryljZeAfH58l2UkGQINKWiu3PdayRIOMr8w9DfCIikwli S+PpgH20QrEse5AvL8boFEyi9QWK7dHGT2JmgoD3NpuvxxhPhn0Wg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudejiedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epuefgleekvddtjefffeejheevleefveekgfduudfhgefhfeegtdehveejfefffffgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvghnse hsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 26 Sep 2021 05:59:33 -0400 (EDT) From: Sven Peter To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Olof Johansson 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 00/10] Add Apple M1 support to PASemi i2c driver Date: Sun, 26 Sep 2021 11:58:37 +0200 Message-Id: <20210926095847.38261-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-20210926_025941_785254_3EF303A3 X-CRM114-Status: GOOD ( 19.94 ) 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, 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. Now unfortunately I don't have access to any old PASemi hardware and cannot confirm that my changes haven't broken anything for those. I believe Hector was in contact with Olof a few months ago who said that he might still have an old machine on which he could test this. I'd very much appreciate if he (or anyone else for that matter :-)) could give this series a quick test on the old PASemi machines. Best, Sven Sven Peter (10): dt-bindings: i2c: Add Apple I2C controller bindings i2c: pasemi: Use io{read,write}32 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 + drivers/i2c/busses/i2c-pasemi-apple.c | 122 ++++++++++++++++++ .../{i2c-pasemi.c => i2c-pasemi-core.c} | 114 +++++----------- drivers/i2c/busses/i2c-pasemi-core.h | 21 +++ drivers/i2c/busses/i2c-pasemi-pci.c | 85 ++++++++++++ 8 files changed, 334 insertions(+), 85 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/apple,i2c.yaml create mode 100644 drivers/i2c/busses/i2c-pasemi-apple.c 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 -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 AD60DC433F5 for ; Sun, 26 Sep 2021 12:47:54 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 E87CF60FED for ; Sun, 26 Sep 2021 12:47:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E87CF60FED Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=svenpeter.dev Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HHQXm18wGz2ybK for ; Sun, 26 Sep 2021 22:47:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=svenpeter.dev header.i=@svenpeter.dev header.a=rsa-sha256 header.s=fm2 header.b=UhHGVNov; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=C+k4X3XQ; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=svenpeter.dev (client-ip=66.111.4.224; helo=new2-smtp.messagingengine.com; envelope-from=sven@svenpeter.dev; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=svenpeter.dev header.i=@svenpeter.dev header.a=rsa-sha256 header.s=fm2 header.b=UhHGVNov; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=C+k4X3XQ; dkim-atps=neutral X-Greylist: delayed 370 seconds by postgrey-1.36 at boromir; Sun, 26 Sep 2021 20:05:54 AEST Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HHLxt1LP0z2yV4 for ; Sun, 26 Sep 2021 20:05:54 +1000 (AEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 9036A580FBA; Sun, 26 Sep 2021 05:59:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 26 Sep 2021 05:59:38 -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=mlHm6qJaY97xGTZYEJ3J85Alc/ WY1AV0Z5CGewPFjJw=; b=UhHGVNovPleofpk5mVBeMMls1i4coOXmt80/bw0HyF HjTu8qNJvqq54MN3sIsFDgJESrj0RNMZQVjzoyzhPwXCLgqc0z0JmbbLEf6pOre9 c+CcG+SVsywGs5PAldJ2a19z4ybEbY9jo7cJ7LmvMxxNT5vvrukSFYw4cwEMS01R ujwGvMLLRCnSKa/DRCd2Mud3MJCQjQEHYpbTww5DLoJydbzYNGM2Uat+qlrN4Vvc HTAZVNJR+hLdwKt3idxcKDhuexrgtTNidldPmydKEvSsdif0gGL/ryQY2S8iPOHa 1tUSNKw5fCCbzKo/NMvy6jcyHy/OuadCOfIaoil20A9Q== 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=fm3; bh=mlHm6qJaY97xGTZYE J3J85Alc/WY1AV0Z5CGewPFjJw=; b=C+k4X3XQGbpbimAylv7MAWKQt8i7EYeJd KdPdfizHnI9ca95NaiC5zhGAh+s06MsAY/W7fz6IAOQZHhxdFjoeiIYMbtN7iZF1 Ovo0e/8qWR3+72b7d1rRJ7mgkmj1eCNdR3cVm9BybT1zlt67tDINx4ykXpKmY8yM JVNF/Ye9/8XQ6iUxeOD5WoFtECxUhs5IEUAkEgMSOsuUwhTZiQbBmoNsYxHjqqs3 ltzsJUwRyQ+zA7eRECsryljZeAfH58l2UkGQINKWiu3PdayRIOMr8w9DfCIikwli S+PpgH20QrEse5AvL8boFEyi9QWK7dHGT2JmgoD3NpuvxxhPhn0Wg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudejiedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epuefgleekvddtjefffeejheevleefveekgfduudfhgefhfeegtdehveejfefffffgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvghnse hsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 26 Sep 2021 05:59:33 -0400 (EDT) From: Sven Peter To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Olof Johansson Subject: [PATCH 00/10] Add Apple M1 support to PASemi i2c driver Date: Sun, 26 Sep 2021 11:58:37 +0200 Message-Id: <20210926095847.38261-1-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sun, 26 Sep 2021 22:47:12 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Sven Peter , Hector Martin , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mohamed Mediouni , Stan Skowronek , linuxppc-dev@lists.ozlabs.org, Alyssa Rosenzweig , Mark Kettenis Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi, 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. Now unfortunately I don't have access to any old PASemi hardware and cannot confirm that my changes haven't broken anything for those. I believe Hector was in contact with Olof a few months ago who said that he might still have an old machine on which he could test this. I'd very much appreciate if he (or anyone else for that matter :-)) could give this series a quick test on the old PASemi machines. Best, Sven Sven Peter (10): dt-bindings: i2c: Add Apple I2C controller bindings i2c: pasemi: Use io{read,write}32 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 + drivers/i2c/busses/i2c-pasemi-apple.c | 122 ++++++++++++++++++ .../{i2c-pasemi.c => i2c-pasemi-core.c} | 114 +++++----------- drivers/i2c/busses/i2c-pasemi-core.h | 21 +++ drivers/i2c/busses/i2c-pasemi-pci.c | 85 ++++++++++++ 8 files changed, 334 insertions(+), 85 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/apple,i2c.yaml create mode 100644 drivers/i2c/busses/i2c-pasemi-apple.c 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 -- 2.25.1