All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Peter <sven@svenpeter.dev>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Olof Johansson <olof@lixom.net>,
	Christian Zigotzky <chzigotzky@xenosoft.de>,
	Wolfram Sang <wsa@kernel.org>
Cc: Sven Peter <sven@svenpeter.dev>, Arnd Bergmann <arnd@arndb.de>,
	Hector Martin <marcan@marcan.st>,
	Mohamed Mediouni <mohamed.mediouni@caramail.com>,
	Stan Skowronek <stan@corellium.com>,
	Mark Kettenis <mark.kettenis@xs4all.nl>,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	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	[thread overview]
Message-ID: <20211008163532.75569-1-sven@svenpeter.dev> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Sven Peter <sven@svenpeter.dev>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Olof Johansson <olof@lixom.net>,
	Christian Zigotzky <chzigotzky@xenosoft.de>,
	Wolfram Sang <wsa@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Sven Peter <sven@svenpeter.dev>,
	Hector Martin <marcan@marcan.st>,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Mohamed Mediouni <mohamed.mediouni@caramail.com>,
	Stan Skowronek <stan@corellium.com>,
	linuxppc-dev@lists.ozlabs.org,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Mark Kettenis <mark.kettenis@xs4all.nl>
Subject: [PATCH v2 00/11] Add Apple M1 support to PASemi i2c driver
Date: Fri,  8 Oct 2021 18:35:21 +0200	[thread overview]
Message-ID: <20211008163532.75569-1-sven@svenpeter.dev> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Sven Peter <sven@svenpeter.dev>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Olof Johansson <olof@lixom.net>,
	Christian Zigotzky <chzigotzky@xenosoft.de>,
	Wolfram Sang <wsa@kernel.org>
Cc: Sven Peter <sven@svenpeter.dev>, Arnd Bergmann <arnd@arndb.de>,
	Hector Martin <marcan@marcan.st>,
	Mohamed Mediouni <mohamed.mediouni@caramail.com>,
	Stan Skowronek <stan@corellium.com>,
	Mark Kettenis <mark.kettenis@xs4all.nl>,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	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	[thread overview]
Message-ID: <20211008163532.75569-1-sven@svenpeter.dev> (raw)

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

             reply	other threads:[~2021-10-08 16:36 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 16:35 Sven Peter [this message]
2021-10-08 16:35 ` [PATCH v2 00/11] Add Apple M1 support to PASemi i2c driver Sven Peter
2021-10-08 16:35 ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 01/11] dt-bindings: i2c: Add Apple I2C controller bindings Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 02/11] i2c: pasemi: Use io{read,write}32 Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 03/11] i2c: pasemi: Use dev_name instead of port number Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 04/11] i2c: pasemi: Remove usage of pci_dev Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 05/11] i2c: pasemi: Split off common probing code Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 06/11] i2c: pasemi: Split pci driver to its own file Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 07/11] i2c: pasemi: Move common reset code to own function Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 08/11] i2c: pasemi: Allow to configure bus frequency Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 09/11] i2c: pasemi: Refactor _probe to use devm_* Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 10/11] i2c: pasemi: Add Apple platform driver Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-09 10:09   ` Wolfram Sang
2021-10-09 10:09     ` Wolfram Sang
2021-10-09 10:09     ` Wolfram Sang
2021-10-09 11:29     ` Sven Peter
2021-10-09 11:29       ` Sven Peter
2021-10-09 11:29       ` Sven Peter
2021-10-08 16:35 ` [PATCH v2 11/11] i2c: pasemi: Set enable bit for Apple variant Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 16:35   ` Sven Peter
2021-10-08 20:49 ` [PATCH v2 00/11] Add Apple M1 support to PASemi i2c driver Olof Johansson
2021-10-08 20:49   ` Olof Johansson
2021-10-08 20:49   ` Olof Johansson
2021-10-09 10:10 ` Wolfram Sang
2021-10-09 10:10   ` Wolfram Sang
2021-10-09 10:10   ` Wolfram Sang
2021-10-09 11:30   ` Sven Peter
2021-10-09 11:30     ` Sven Peter
2021-10-09 11:30     ` Sven Peter
2021-10-09 13:57   ` Christian Zigotzky
2021-10-09 13:57     ` Christian Zigotzky
2021-10-10 13:17     ` Sven Peter
2021-10-10 13:17       ` Sven Peter
2021-10-11  8:54       ` Wolfram Sang
2021-10-11  8:54         ` Wolfram Sang
2021-10-11  8:54         ` Wolfram Sang
2021-10-11  9:23         ` Hector Martin
2021-10-11  9:23           ` Hector Martin
2021-10-11  9:37           ` Wolfram Sang
2021-10-11  9:37             ` Wolfram Sang
2021-10-11  9:37             ` Wolfram Sang
2021-10-13  8:06     ` Christian Zigotzky
2021-10-13  8:06       ` Christian Zigotzky
2021-10-11 10:04 ` Wolfram Sang
2021-10-11 10:04   ` Wolfram Sang
2021-10-11 10:04   ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211008163532.75569-1-sven@svenpeter.dev \
    --to=sven@svenpeter.dev \
    --cc=alyssa@rosenzweig.io \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=chzigotzky@xenosoft.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=marcan@marcan.st \
    --cc=mark.kettenis@xs4all.nl \
    --cc=mohamed.mediouni@caramail.com \
    --cc=mpe@ellerman.id.au \
    --cc=olof@lixom.net \
    --cc=paulus@samba.org \
    --cc=stan@corellium.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.