linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] GPIO support on the Etron EJ168/EJ188/EJ198 xHCI controllers
@ 2020-10-04 16:29 Martin Blumenstingl
  2020-10-04 16:29 ` [RFC PATCH 1/3] PCI: Add the IDs for Etron EJ168 and EJ188 Martin Blumenstingl
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Martin Blumenstingl @ 2020-10-04 16:29 UTC (permalink / raw)
  To: linux-pci, devicetree, linux-gpio, robh+dt, bgolaszewski, linus.walleij
  Cc: linux-kernel, bhelgaas, Martin Blumenstingl, systemchip

Hello,

I have a "Belkin F9K115v2" (wifi router) [0]. It comes with an Etron
EJ168 xHCI controllers soldered to the board. One of the LEDs on this
device is connected to one of the four GPIO lines provided by the
Etron xHCI controller.

The goal of this series to add support for the GPIO controller on the
Etron EJ168/EJ188/EJ198 controllers.

Unfortunately there's no (public) datasheet available. I have Cc'ed
Etron and I'm hoping that they can either provide a datasheet or at
least some code-review feedback.
Instead I used the GPL tarball [0] for this device. Inside this
tarball the relevant "reference" code is in:
  linux/kernels/mips-linux-2.6.31/drivers/usb/host/etxhci-pci.c
Unfortunately it uses magic numbers for the registers instead of
human-readable names. The register names are what I came up with.

For reference, I have tested this on a patched OpenWrt build with the
following .dts changes (I am showing these here so it will be easier
to review the whole series):
	&pcie1 {
		status = "okay";

		xhci: usb-controller@0,0,0 {
			compatible = "pci1b6f,7023";
			reg = <0x0 0x0 0x0 0x0 0x1000>;

			#address-cells = <1>;
			#size-cells = <0>;

			gpio-controller;
			#gpio-cells = <2>;

			xhci_port0: port@1 {
				reg = <1>;
				#trigger-source-cells = <0>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		usb3 {
			label = "green:usb3";
			gpios = <&xhci 2 GPIO_ACTIVE_LOW>;
			trigger-sources = <&xhci_port0>;
			linux,default-trigger = "usbport";
		};
	};

In general I followed [2] because it says:
  PCI drivers should have a really good reason for not using the
  pci_register_driver() [...] The main reason [...] is because one
  PCI device implements several different HW services.
My understanding that my driver fits into this category.

I am sending this as RFC because this is my first self-written GPIO
driver as well as my first PCI device driver. Any feedback is welcome!


Best regards,
Martin


[0] https://openwrt.org/toh/belkin/f9k1115v2
[1] https://www.belkin.com/support/dl/F9K1115v2.03.97-GPL-10.2.85.tar.gz
[2] https://www.kernel.org/doc/html/latest/PCI/pci.html#how-to-find-pci-devices-manually


Martin Blumenstingl (3):
  PCI: Add the IDs for Etron EJ168 and EJ188
  dt-bindings: gpio: Add binding documentation for Etron
    EJ168/EJ188/EJ198
  gpio: ej1x8: Add GPIO driver for Etron Tech Inc. EJ168/EJ188/EJ198

 .../devicetree/bindings/gpio/etron,ej1x8.yaml |  48 +++
 drivers/gpio/Kconfig                          |   9 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/gpio-ej1x8.c                     | 311 ++++++++++++++++++
 include/linux/pci_ids.h                       |   4 +
 5 files changed, 373 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/etron,ej1x8.yaml
 create mode 100644 drivers/gpio/gpio-ej1x8.c

-- 
2.28.0


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2021-01-07 10:37 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 16:29 [RFC PATCH 0/3] GPIO support on the Etron EJ168/EJ188/EJ198 xHCI controllers Martin Blumenstingl
2020-10-04 16:29 ` [RFC PATCH 1/3] PCI: Add the IDs for Etron EJ168 and EJ188 Martin Blumenstingl
2020-10-07  9:14   ` Linus Walleij
2020-10-07 19:45     ` Martin Blumenstingl
2020-11-03 22:32       ` Bjorn Helgaas
2020-10-04 16:29 ` [RFC PATCH 2/3] dt-bindings: gpio: Add binding documentation for Etron EJ168/EJ188/EJ198 Martin Blumenstingl
2020-10-06 21:25   ` Rob Herring
2020-10-07 19:57     ` Martin Blumenstingl
2020-10-07  9:19   ` Linus Walleij
2020-10-07 19:57     ` Martin Blumenstingl
2020-10-13 13:27       ` Linus Walleij
2020-10-14 12:43         ` Rob Herring
2020-10-16 20:52           ` Martin Blumenstingl
2020-10-29 17:11             ` Linus Walleij
2020-10-04 16:29 ` [RFC PATCH 3/3] gpio: ej1x8: Add GPIO driver for Etron Tech Inc. EJ168/EJ188/EJ198 Martin Blumenstingl
2020-10-07  9:29   ` Linus Walleij
2020-10-07 19:44     ` Martin Blumenstingl
2020-12-21 15:28       ` Martin Blumenstingl
2020-12-31  0:15         ` Martin Blumenstingl
2021-01-05 22:23         ` Linus Walleij
2021-01-06 15:17           ` Martin Blumenstingl
2021-01-07 10:36             ` Linus Walleij
2020-10-07  9:17 ` [RFC PATCH 0/3] GPIO support on the Etron EJ168/EJ188/EJ198 xHCI controllers Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).