Skip to contentSkip to conversation

FHCI USB Host support patches

PATCH Superseded Anton Vorontsov 3 participants 14 messages Sep 24, 2008 – Sep 25, 2008

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover FHCI USB Host support patches

Here comes the whole patchset.

Sorry for the inconvenience,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#1 lore raw

PATCH 1/4 gpiolib: make gpio_to_chip() public

We'll need this function to write platform-specific hooks to deal with pin's dedicated functions. Quite obviously this will work only for the platforms with 1-to-1 GPIO to PIN mapping.

This is stopgap solution till we think out and implement a proper api (pinlib?).

p.s. This patch actually exports gpio_desc and places gpio_to_chip into the asm-generic/gpio.h as `static inline'. This is needed to not cause function calls for this trivial translation.

Also, the patch does not export FLAG_*s... the names are too generic, and nobody is using them outside of gpiolib.c.

---
 drivers/gpio/gpiolib.c     |   16 ++--------------
 include/asm-generic/gpio.h |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 14 deletions(-)
drivers/gpio/gpiolib.c +2 -14
index 8d29405..fb36a90 100644
@@ -40,9 +40,6 @@
  */
 static DEFINE_SPINLOCK(gpio_lock);
 
-struct gpio_desc {
-	struct gpio_chip	*chip;
-	unsigned long		flags;
 /* flag symbols are bit numbers */
 #define FLAG_REQUESTED	0
 #define FLAG_IS_OUT	1
@@ -50,11 +47,8 @@ struct gpio_desc {
 #define FLAG_EXPORT	3	/* protected by sysfs_lock */
 #define FLAG_SYSFS	4	/* exported via /sys/class/gpio/control */
 
-#ifdef CONFIG_DEBUG_FS
-	const char		*label;
-#endif
-};
-static struct gpio_desc gpio_desc[ARCH_NR_GPIOS];
+struct gpio_desc gpio_desc[ARCH_NR_GPIOS];
+EXPORT_SYMBOL_GPL(gpio_desc);
 
 static inline void desc_set_label(struct gpio_desc *d, const char *label)
 {
@@ -80,12 +74,6 @@ static void gpio_ensure_requested(struct gpio_desc *desc)
 	}
 }
 
-/* caller holds gpio_lock *OR* gpio is marked as requested */
-static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
-{
-	return gpio_desc[gpio].chip;
-}
-
 /* dynamic allocation of GPIOs, e.g. on a hotplugged device */
 static int gpiochip_find_base(int ngpio)
 {
include/asm-generic/gpio.h +17 -0
index 0f99ad3..88962f0 100644
@@ -81,6 +81,23 @@ struct gpio_chip {
 	unsigned		exported:1;
 };
 
+struct gpio_desc {
+	struct gpio_chip	*chip;
+	unsigned long		flags;
+
+#ifdef CONFIG_DEBUG_FS
+	const char		*label;
+#endif
+};
+
+extern struct gpio_desc gpio_desc[ARCH_NR_GPIOS];
+
+/* caller holds gpio_lock *OR* gpio is marked as requested */
+static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
+{
+	return gpio_desc[gpio].chip;
+}
+
 extern const char *gpiochip_is_requested(struct gpio_chip *chip,
 			unsigned offset);
 extern int __must_check gpiochip_reserve(int start, int ngpio);
Signature · 1 line
1.5.6.3
#2 lore raw

PATCH 2/4 powerpc/qe: new call to revert a gpio to a dedicated function

In reply to Anton Vorontsov

qe_gpio_set_dedicated() is a platform specific function, which is used to revert a pin to a dedicated function. Caller should have already obtained the gpio via gpio_request().

This is needed to support Freescale USB Host Controller.

---
 arch/powerpc/include/asm/qe.h     |    1 +
 arch/powerpc/sysdev/qe_lib/gpio.c |   46 +++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/qe.h +1 -0
index edee15d..c926147 100644
@@ -111,6 +111,7 @@ extern void __par_io_config_pin(struct qe_pio_regs __iomem *par_io, u8 pin,
 extern int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
 			     int assignment, int has_irq);
 extern int par_io_data_set(u8 port, u8 pin, u8 val);
+extern int qe_gpio_set_dedicated(unsigned int gpio);
 
 /* QE internal API */
 int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
arch/powerpc/sysdev/qe_lib/gpio.c +46 -0

64 lines not on this page · raw message

Signature · 1 line
1.5.6.3
#11 lore raw

PATCH 3/4 USB: Protect hcd.h from multiple inclusions

In reply to Anton Vorontsov

This will let us use this header in other header files. Will be needed for the FHCI USB Host driver.

---
 drivers/usb/core/hcd.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/core/hcd.h +4 -0
index e710ce0..66b64d7 100644
@@ -16,6 +16,8 @@
  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#ifndef __USB_CORE_HCD_H
+#define __USB_CORE_HCD_H
 
 #ifdef __KERNEL__
 
@@ -483,3 +485,5 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
 extern struct rw_semaphore ehci_cf_port_reset_rwsem;
 
 #endif /* __KERNEL__ */
+
+#endif /* __USB_CORE_HCD_H */
Signature · 1 line
1.5.6.3
#13 lore raw

PATCH 4/4 USB: driver for Freescale QUICC Engine USB Host Controller

In reply to Anton Vorontsov

This patch adds support for the FHCI USB controller, as found in the Freescale MPC836x and MPC832x processors. It can support Full or Low speed modes.

Quite a lot the hardware is doing by itself (SOF generation, CRC generation and checking), though scheduling and retransmission is on software's shoulders.

This controller does not integrate the root hub, so this driver also fakes one-port hub. External hub is required to support more than one device.

---
 drivers/usb/Makefile          |    1 +
 drivers/usb/host/Kconfig      |   17 +
 drivers/usb/host/Makefile     |    8 +
 drivers/usb/host/fhci-dbg.c   |  139 +++++++
 drivers/usb/host/fhci-hcd.c   |  789 ++++++++++++++++++++++++++++++++++++
 drivers/usb/host/fhci-hub.c   |  349 ++++++++++++++++
 drivers/usb/host/fhci-mem.c   |  112 ++++++
 drivers/usb/host/fhci-q.c     |  280 +++++++++++++
 drivers/usb/host/fhci-sched.c |  889 +++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/fhci-tds.c   |  626 +++++++++++++++++++++++++++++
 drivers/usb/host/fhci.h       |  597 +++++++++++++++++++++++++++
 11 files changed, 3807 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/fhci-dbg.c
 create mode 100644 drivers/usb/host/fhci-hcd.c
 create mode 100644 drivers/usb/host/fhci-hub.c
 create mode 100644 drivers/usb/host/fhci-mem.c
 create mode 100644 drivers/usb/host/fhci-q.c
 create mode 100644 drivers/usb/host/fhci-sched.c
 create mode 100644 drivers/usb/host/fhci-tds.c
 create mode 100644 drivers/usb/host/fhci.h
drivers/usb/Makefile +1 -0
index a419c42..7b14564 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_USB_UHCI_HCD)	+= host/
 obj-$(CONFIG_USB_SL811_HCD)	+= host/
 obj-$(CONFIG_USB_U132_HCD)	+= host/
 obj-$(CONFIG_USB_R8A66597_HCD)	+= host/
+obj-$(CONFIG_USB_FHCI_HCD)	+= host/
 
 obj-$(CONFIG_USB_C67X00_HCD)	+= c67x00/
 
drivers/usb/host/Kconfig +17 -0
index 228797e..594c263 100644
@@ -305,3 +305,20 @@ config SUPERH_ON_CHIP_R8A66597
 	help
 	   This driver enables support for the on-chip R8A66597 in the
 	   SH7366 and SH7723 processors.
+
+config USB_FHCI_HCD
+	tristate "Freescale QE USB Host Controller support"
+	depends on USB && OF_GPIO && QUICC_ENGINE
+	select FSL_GTM
+	select QE_USB
+	help
+	  This driver enables support for Freescale QE USB Host Controller
+	  (as found on MPC8360 and MPC8323 processors), the driver supports
+	  Full and Low Speed USB.
+
+config FHCI_DEBUG
+	bool "Freescale QE USB Host Controller debug support"
+	depends on USB_FHCI_HCD && DEBUG_FS
+	help
+	  Say "y" to see some FHCI debug information and statistics
+	  throught debugfs.
drivers/usb/host/Makefile +8 -0
index f1edda2..2e1eaa7 100644
@@ -8,6 +8,13 @@ endif
 
 isp1760-objs := isp1760-hcd.o isp1760-if.o
 
+fhci-objs := fhci-hcd.o fhci-hub.o fhci-q.o fhci-mem.o \
+	     fhci-tds.o fhci-sched.o
+
+ifeq ($(CONFIG_FHCI_DEBUG),y)
+fhci-objs += fhci-dbg.o
+endif
+
 obj-$(CONFIG_PCI)		+= pci-quirks.o
 
 obj-$(CONFIG_USB_EHCI_HCD)	+= ehci-hcd.o
@@ -19,3 +26,4 @@ obj-$(CONFIG_USB_SL811_CS)	+= sl811_cs.o
 obj-$(CONFIG_USB_U132_HCD)	+= u132-hcd.o
 obj-$(CONFIG_USB_R8A66597_HCD)	+= r8a66597-hcd.o
 obj-$(CONFIG_USB_ISP1760_HCD)	+= isp1760.o
+obj-$(CONFIG_USB_FHCI_HCD)	+= fhci.o
drivers/usb/host/fhci-dbg.c new file +139 -0

139 lines not on this page · raw message

drivers/usb/host/fhci-hcd.c new file +789 -0

789 lines not on this page · raw message

drivers/usb/host/fhci-hub.c new file +349 -0

349 lines not on this page · raw message

drivers/usb/host/fhci-mem.c new file +112 -0

112 lines not on this page · raw message

drivers/usb/host/fhci-q.c new file +280 -0

280 lines not on this page · raw message

drivers/usb/host/fhci-sched.c new file +889 -0

889 lines not on this page · raw message

drivers/usb/host/fhci-tds.c new file +626 -0

398 lines not on this page · raw message

drivers/usb/host/fhci.h new file +597 -0

597 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.5.6.3

Part of the diff is not shown here. View the raw message.

Acked-by on v1 3/4
#12 lore raw

Re: [PATCH 3/4] USB: Protect hcd.h from multiple inclusions

In reply to Anton Vorontsov
Quoted 4 lines · Anton Vorontsov

This will let us use this header in other header files. Will be needed for the FHCI USB Host driver.

This seems innocuous. I'm content with Greg merging it into his tree for 2.6.28-rc0 merge ...

Quoted 27 lines
---
 drivers/usb/core/hcd.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/core/hcd.h +4 -0
index e710ce0..66b64d7 100644
@@ -16,6 +16,8 @@
  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#ifndef __USB_CORE_HCD_H
+#define __USB_CORE_HCD_H
 
 #ifdef __KERNEL__
 
@@ -483,3 +485,5 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
 extern struct rw_semaphore ehci_cf_port_reset_rwsem;
 
 #endif /* __KERNEL__ */
+
+#endif /* __USB_CORE_HCD_H */
Signature · 1 line
1.5.6.3
#3 lore raw

Re: [PATCH 2/4] powerpc/qe: new call to revert a gpio to a dedicated function

In reply to Anton Vorontsov
Quoted 4 lines · Anton Vorontsov

qe_gpio_set_dedicated() is a platform specific function, which is used to revert a pin to a dedicated function. Caller should have already obtained the gpio via gpio_request().

Quoted 8 lines

This is needed to support Freescale USB Host Controller.

---
arch/powerpc/include/asm/qe.h | 1 +
arch/powerpc/sysdev/qe_lib/gpio.c | 46 ++++++++++++++++++++++++++++
+++++++++

2 files changed, 47 insertions(+), 0 deletions(-)

what do you mean by dedicated function.. be a bit clearer in the commit log. Also, does this depend on gpio_to_chip() patch?

- k

#4 lore raw

Re: [PATCH 2/4] powerpc/qe: new call to revert a gpio to a dedicated function

Quoted 16 lines · Kumar Gala
Quoted 4 lines · Anton Vorontsov

qe_gpio_set_dedicated() is a platform specific function, which is used to revert a pin to a dedicated function. Caller should have already obtained the gpio via gpio_request().

Quoted 8 lines

This is needed to support Freescale USB Host Controller.

---
arch/powerpc/include/asm/qe.h | 1 +
arch/powerpc/sysdev/qe_lib/gpio.c | 46 ++++++++++++++++++++++++++++
+++++++++

2 files changed, 47 insertions(+), 0 deletions(-)
Quoted 2 lines

what do you mean by dedicated function.. be a bit clearer in the commit log.

This term is from the QE spec, I didn't invent anything. ;-)

"Each pin in the I/O ports can be configured as a general-purpose I/O signal or as a dedicated peripheral interface signal. ...many dedicated peripheral functions are multiplexed onto the ports."

Quoted 1 line

Also, does this depend on gpio_to_chip() patch?

Yeah, the point of exported gpio_to_chip is to let us write this function.

Thanks!

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#5 lore raw

Re: [PATCH 2/4] powerpc/qe: new call to revert a gpio to a dedicated function

Quoted 18 lines · Anton Vorontsov
Quoted 17 lines · Kumar Gala
Quoted 13 lines · Anton Vorontsov

qe_gpio_set_dedicated() is a platform specific function, which is used to revert a pin to a dedicated function. Caller should have already obtained the gpio via gpio_request().

This is needed to support Freescale USB Host Controller.

---
arch/powerpc/include/asm/qe.h | 1 +
arch/powerpc/sysdev/qe_lib/gpio.c | 46 ++++++++++++++++++++++++++
++
+++++++++

2 files changed, 47 insertions(+), 0 deletions(-)
Quoted 8 lines
Quoted 2 lines

what do you mean by dedicated function.. be a bit clearer in the commit log.

This term is from the QE spec, I didn't invent anything. ;-)

"Each pin in the I/O ports can be configured as a general-purpose I/O signal or as a dedicated peripheral interface signal. ...many dedicated peripheral functions are multiplexed onto the ports."

I understand but I think 'dedicated' could be interpreted in another way (like the GPIO pin is dedicated, not that the pin is used for a dedicated SoC block).

If it the commit message had said 'to a dedicated on chip peripheral' it would be clearer.

Quoted 4 lines
Quoted 1 line

Also, does this depend on gpio_to_chip() patch?

Yeah, the point of exported gpio_to_chip is to let us write this function.

I meant can I take this patch w/o the gpio_to_chip() patch? (not clear from your response)

- k

#6 lore raw

Re: [PATCH 2/4] powerpc/qe: new call to revert a gpio to a dedicated function

Quoted 32 lines · Kumar Gala
Quoted 23 lines · Anton Vorontsov
Quoted 18 lines · Kumar Gala
Quoted 7 lines · Anton Vorontsov

qe_gpio_set_dedicated() is a platform specific function, which is used
to revert a pin to a dedicated function. Caller should have already obtained the gpio via gpio_request().

This is needed to support Freescale USB Host Controller.

Quoted 7 lines

---
arch/powerpc/include/asm/qe.h | 1 +
arch/powerpc/sysdev/qe_lib/gpio.c | 46 ++++++++++++++++++++++++++
++
+++++++++

2 files changed, 47 insertions(+), 0 deletions(-)
Quoted 3 lines

what do you mean by dedicated function.. be a bit clearer in the commit
log.

Quoted 5 lines

This term is from the QE spec, I didn't invent anything. ;-)

"Each pin in the I/O ports can be configured as a general-purpose I/O signal or as a dedicated peripheral interface signal. ...many dedicated peripheral functions are multiplexed onto the ports."

Quoted 6 lines

I understand but I think 'dedicated' could be interpreted in another way (like the GPIO pin is dedicated, not that the pin is used for a dedicated SoC block).

If it the commit message had said 'to a dedicated on chip peripheral' it would be clearer.

Ah, ok, I'll fix that.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Also, does this depend on gpio_to_chip() patch?

Yeah, the point of exported gpio_to_chip is to let us write this function.

I meant can I take this patch w/o the gpio_to_chip() patch? (not clear from your response)

No, unfortunately you can't. It would be great if we could pass the whole patchset via single tree (USB? Or -mm to Linus directly?), so Acks are more than appreciated.

Thanks again,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#8 lore raw

Re: [PATCH 2/4] powerpc/qe: new call to revert a gpio to a dedicated function

In reply to Anton Vorontsov
Quoted 3 lines · Anton Vorontsov

qe_gpio_set_dedicated() is a platform specific function, which is used to revert a pin to a dedicated function. Caller should have already obtained the gpio via gpio_request().

Note the missing sibling function: putting the pin back into GPIO mode!! You seem to assume that some of the GPIO calls will be performing that pinmux function. But those calls are explicitly defined as NOT incorporating any pinmux tasks.

Also note your nonportable assumption that GPIOs and pins are the same concept ... they aren't.

You'd be better off calling something other than of_get_gpio() for those three pins in of_fhci_probe() ... call something that returns a "qe_pin" structure (e.g. wrapping an instance of the misnamed qe_gpio_chip plus an offset) which holds the pinmux primitives you need. Like this one to put the pin into its normal mode.

When I look at patch 4 of this series I observe that only two pins are true GPIOs: the optional POWER and SPEED pins. (External transceiver support?)

arch/powerpc/sysdev/qe_lib/gpio.c static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) · line 117

Quoted 3 lines
arch/powerpc/sysdev/qe_lib/gpio.c +3 -0
+int qe_gpio_set_dedicated(unsigned int gpio)
+{
+	struct gpio_chip *gc = gpio_to_chip(gpio);

So the caller must already have requested it, yes -- that's a needed for any stable mapping between GPIO and controller inside the GPIO library.

For the record, this single call seems to be the entire reason motivating that rather ugly patch #1. (Ugly for more than just the confusion between pin, which is what you need, and GPIO. There's no need to export those internal data structures.)

And in turn, the reason to want this call is so that you can have io_port_generate_reset() generate a short reset on the single downstream USB port. ("Short" meaning "45 msec below USB spec requirements for root hub resets" ...)

And to top it off ... that driver does gpio_request(), runs those pins as GPIOs for virtually no time, and then uses them as "dedicated functions" the rest of the time (after the reset completes)!!

Which highlights the fact that these pins are fundamentally NOT used as GPIOs. They're function pins that need brief detours as GPIOs because, it seems, those functions only support differential signaling (USB J and K states) instead of the full set of USB states. (It's not quite clear from the driver. Are the pins expected to be using a 3-wire external transciever hookup? 4-wire? 6-wire?)

But there are other requirements for this no-kerneldoc call:

arch/powerpc/sysdev/qe_lib/gpio.c static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) · line 118

Quoted 1 line
arch/powerpc/sysdev/qe_lib/gpio.c +1 -0
+	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);

... it must be part of an of_mm_gpio_chip (in <linux/of_gpio.h>, which might seem less odd to me if I read its supporting code).

Can you first ensure that it *is* an of_mm_gpio_chip instance? When it isn't, this code will oops rudely.

arch/powerpc/sysdev/qe_lib/gpio.c static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) · line 119

Quoted 1 line
arch/powerpc/sysdev/qe_lib/gpio.c +1 -0
+	struct qe_gpio_chip *qe_gc = to_qe_gpio_chip(mm_gc);

... it must be the qe_gpio_chip flavor (defined only in this very file, arch/powerpc/sysdev/qe_lib/gpio.c); IMO the code would be cleaner if you just did

	qe_gc = container_of(gpio_to_chip(gpio),
			struct qe_gpio_chip, mm_gc.of_gc.gc);

and had just one pointer (not three!) for all these purposes.

(And cleaner still if it didn't require whacking the GPIO framework out of shape to have a hope of working.)

But again: you're trusting, with no evident basis for that trust, that it's a qe_gpio_chip instance. Oops if it isn't. Much better for these calls to take e.g. a "qe_pin" parameter, struct pointer or whatever ... not a GPIO number.

Quoted 7 lines
arch/powerpc/sysdev/qe_lib/gpio.c +6 -0
+	struct qe_pio_regs __iomem *regs = mm_gc->regs;
+	struct qe_pio_regs *sregs = &qe_gc->saved_regs;
+	u8 pin = gpio - gc->base;
+	u32 mask1 = 1 << (QE_PIO_PINS - (pin + 1));
+	u32 mask2 = 0x3 << (QE_PIO_PINS - (pin % (QE_PIO_PINS / 2) + 1) * 2);
+	bool second_reg = pin > (QE_PIO_PINS / 2) - 1;
...
#7 lore raw

Re: [PATCH 2/4] powerpc/qe: new call to revert a gpio to a dedicated function

In reply to Anton Vorontsov
Quoted 8 lines · Anton Vorontsov
Quoted 2 lines

what do you mean by dedicated function.. be a bit clearer in the commit log.

This term is from the QE spec, I didn't invent anything. ;-)

"Each pin in the I/O ports can be configured as a general-purpose I/O signal or as a dedicated peripheral interface signal. ...many dedicated peripheral functions are multiplexed onto the ports."

Which, to me, highlights the point I've made previously: the right abstraction for you to work with is "pin", not GPIO.

You need to switch a QE "pin" from one of its roles to the other.

Evil things, like oopsing, will happen if you try to use this call on a GPIO that's not backed by a QE pin.

#9 lore raw

Re: [PATCH 2/4] powerpc/qe: new call to revert a gpio to a dedicated function

In reply to David Brownell

On Wed, Sep 24, 2008 at 11:54:24AM -0700, David Brownell wrote:
[...]

Quoted 6 lines

You'd be better off calling something other than of_get_gpio() for those three pins in of_fhci_probe() ... call something that returns a "qe_pin" structure (e.g. wrapping an instance of the misnamed qe_gpio_chip plus an offset) which holds the pinmux primitives you need. Like this one to put the pin into its normal mode.

The driver anyway will have to call of_get_gpio(), because it have to use the pins as gpios. At least it have to specify a direction, luckily for this we have the gpio_set_direction call already. ;-)

But true, switching a pin to a dedicated function isn't a gpio controller's job, it is a pinmuxing.

Quoted 3 lines

When I look at patch 4 of this series I observe that only two pins are true GPIOs: the optional POWER and SPEED pins. (External transceiver support?)

Yes.

[...]

Quoted 5 lines

And in turn, the reason to want this call is so that you can have io_port_generate_reset() generate a short reset on the single downstream USB port. ("Short" meaning "45 msec below USB spec requirements for root hub resets" ...)

Quoted 8 lines

And to top it off ... that driver does gpio_request(), runs those pins as GPIOs for virtually no time, and then uses them as "dedicated functions" the rest of the time (after the reset completes)!!

Which highlights the fact that these pins are fundamentally NOT used as GPIOs.

Well.. they are used as gpios anyway, to signal a reset. This is host's duty, and we have to support it, otherwise things won't work. There is no other way to signal a reset than turning these *pins* to a gpio state, setting the direction and then reverting them back to a dedicated function.

But true, most of it isn't gpio controller's authority.

[...]

Quoted 9 lines

But there are other requirements for this no-kerneldoc call:

arch/powerpc/sysdev/qe_lib/gpio.c static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) · line 118

Quoted 1 line
arch/powerpc/sysdev/qe_lib/gpio.c +1 -0
+	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);

... it must be part of an of_mm_gpio_chip (in <linux/of_gpio.h>, which might seem less odd to me if I read its supporting code).

Can you first ensure that it *is* an of_mm_gpio_chip instance? When it isn't, this code will oops rudely.

Yeah, unfortunately. The "oops" thought didn't visit my mind though, because I'm still thinking it terms of this patch:

http://ozlabs.org/pipermail/linuxppc-dev/2008-February/051230.html

^^ with that patch no oops is possible, and we could detect anything you pointed out here and below in your post. Which doesn't mean that the patch above was ideologically correct, though.

But you clearly pointed out the issues which ruin the whole approach.

Anyway, just want to thank you for your time and persistence on this matter, you're forcing others' people brains to *work*. And since you rejected this approach too, I have no other option but to implement something else... something better. ;-)

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#10 lore raw

Re: [PATCH 2/4] powerpc/qe: new call to revert a gpio to a dedicated function

Quoted 5 lines · Anton Vorontsov

Anyway, just want to thank you for your time and persistence on this matter, you're forcing others' people brains to *work*. And since you rejected this approach too, I have no other option but to implement something else... something better. ;-)

I think you have enough pieces in place to get that "something better" _very_ quickly. Or I'd feel worse about abusing those poor little grey cells. ;)