Patches to support QE USB Host Controller
Subsystems (4)
cover Patches to support QE USB Host Controller
Hi all,
Most patches that were needed to support QE USB Host were merged during 2.6.27 merge window, and only three more patches left over. Here they are.
David, could you bear with gpio_to_chip() exported function, just as a stopgap for a proper api?
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
PATCH 1/3 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?).
--- drivers/gpio/gpiolib.c | 3 ++- include/asm-generic/gpio.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/gpio/gpiolib.c +2 -1
@@ -81,10 +81,11 @@ 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) +struct gpio_chip *gpio_to_chip (unsigned gpio) {return gpio_desc[gpio].chip; } +EXPORT_SYMBOL_GPL (gpio_to_chip);/* dynamic allocation of GPIOs, e.g. on a hotplugged device */ static int gpiochip_find_base (int ngpio)
include/asm-generic/gpio.h +1 -0
@@ -81,6 +81,7 @@ struct gpio_chip { unsigned exported:1; }; +extern struct gpio_chip *gpio_to_chip (unsigned gpio);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.5.4
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
Quoted 6 lines · Anton Vorontsov
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?).
How do you support reverting the GPIO mode to non-dedicated ?
Quoted 35 lines
Signed-off-by Anton Vorontsov <[email protected]>--- drivers/gpio/gpiolib.c | 3 ++- include/asm-generic/gpio.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)drivers/gpio/gpiolib.c +2
-1@@ -81,10 +81,11 @@ 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) +struct gpio_chip *gpio_to_chip (unsigned gpio) {return gpio_desc[gpio].chip; } +EXPORT_SYMBOL_GPL (gpio_to_chip);/* dynamic allocation of GPIOs, e.g. on a hotplugged device */ static int gpiochip_find_base (int ngpio)include/asm-generic/gpio.h +1
-0@@ -81,6 +81,7 @@ struct gpio_chip { unsigned exported:1; }; +extern struct gpio_chip *gpio_to_chip (unsigned gpio);extern const char *gpiochip_is_requested (struct gpio_chip *chip,unsigned offset);extern int __must_check gpiochip_reserve (int start,int ngpio);
Signature · 9 lines
Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
Quoted 9 lines · Laurent Pinchart
Quoted 6 lines · Anton Vorontsov
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?).
How do you support reverting the GPIO mode to non-dedicated ?
As we always do with the GPIO API: gpio_direction_*() calls.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
Quoted 6 lines · Anton Vorontsov
Quoted 5 lines · Laurent Pinchart
Quoted 4 lines · Anton Vorontsov
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.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This is stopgap solution till we think out and implement a proper api (pinlib?).
How do you support reverting the GPIO mode to non-dedicated ?
As we always do with the GPIO API: gpio_direction_*() calls.
So the proper sequence to configure a pin in dedicated mode is to set the direction first (which will unset the dedicated mode bit) and then set dedicated mode (which will not touch the direction bit) ?
Signature · 9 lines
Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
Quoted 10 lines · Laurent Pinchart
Quoted 9 lines · Anton Vorontsov
Quoted 8 lines · Laurent Pinchart
Quoted 6 lines · Anton Vorontsov
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?).
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
How do you support reverting the GPIO mode to non-dedicated ?
As we always do with the GPIO API: gpio_direction_*() calls.
So the proper sequence to configure a pin in dedicated mode is to set the direction first (which will unset the dedicated mode bit) and then set dedicated mode (which will not touch the direction bit) ?
Not exactly. But you can do this way, if you need to preserve a direction. What I did is a bit different though.
qe_gpio_set_dedicated() actually just restores a mode that firmware had set up, including direction (since direction could be a part of dedicated configuration).
That is, upon GPIO controller registration, we save all registers, then driver can set up a pin to a GPIO mode via standard API, and then it can _revert_ a pin to a dedicated function via qe_gpio_set_dedicated() call. Dedicated function is specified by the firmware (or board file), we're just restoring it.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
Quoted 26 lines · Anton Vorontsov
Quoted 10 lines · Laurent Pinchart
Quoted 9 lines · Anton Vorontsov
Quoted 8 lines · Laurent Pinchart
Quoted 6 lines · Anton Vorontsov
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?).
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
How do you support reverting the GPIO mode to non-dedicated ?
As we always do with the GPIO API: gpio_direction_*() calls.
So the proper sequence to configure a pin in dedicated mode is to set the direction first (which will unset the dedicated mode bit) and then set dedicated mode (which will not touch the direction bit) ?
Not exactly. But you can do this way, if you need to preserve a direction. What I did is a bit different though.
qe_gpio_set_dedicated()actually just restores a mode that firmware had set up, including direction (since direction could be a part of dedicated configuration).
Quoted 5 lines
That is, upon GPIO controller registration, we save all registers, then driver can set up a pin to a GPIO mode via standard API, and then it can _revert_ a pin to a dedicated function via
qe_gpio_set_dedicated()call. Dedicated function is specified by the firmware (or board file), we're just restoring it.
The semantic of the set_dedicated() operation needs to be clearly defined then. I can live with this behaviour, but it might not be acceptable for everybody.
Your patch requires the firmware to set a pin in dedicated mode at bootup in order to be used later in dedicated mode. If, for some reason (driver not loaded, ...), no GPIO user shows up for that pin, it will stay configured in dedicated mode.
It might be better to set the PAR bit unconditionally in qe_gpio_set_dedicated() instead of restoring its value. That way the board initialization code could just set the DIR, DAT and ODR bits for dedicated mode but still configure the pin in GPIO mode.
Signature · 9 lines
Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
On Mon, Aug 18, 2008 at 03:58:46PM +0200, Laurent Pinchart wrote:
[...]
Quoted 7 lines
Quoted 7 lines
Not exactly. But you can do this way, if you need to preserve a direction. What I did is a bit different though.
qe_gpio_set_dedicated()actually just restores a mode that firmware had set up, including direction (since direction could be a part of dedicated configuration).
Quoted 8 lines
Quoted 5 lines
That is, upon GPIO controller registration, we save all registers, then driver can set up a pin to a GPIO mode via standard API, and then it can _revert_ a pin to a dedicated function via
qe_gpio_set_dedicated()call. Dedicated function is specified by the firmware (or board file), we're just restoring it.The semantic of the
set_dedicated()operation needs to be clearly defined then.
It is. We set up a dedicated function that firmware (or board file) has configured.
Quoted 2 lines
I can live with this behaviour, but it might not be acceptable for everybody.
For example?
Quoted 2 lines
Your patch requires the firmware to set a pin in dedicated mode at bootup in order to be used later in dedicated mode.
Yes. On a PowerPC this is always true: firmware should set up PIO config. Linux' board file could fixup the firmware though.
Another option would be to add some argument to the set_dedicated call, thus the software could specify arbitrary dedicated function (thus no need to save/restore anything). But this would be SOC-model specific, thus no driver can use this argument anyway.
Quoted 3 lines
If, for some
reason (driver not loaded, ...), no GPIO user shows up for that pin, it will stay configured in dedicated mode.
Yes.
Quoted 1 line
It might be better to set the PAR bit unconditionally in
Why it might be better? That way you may set up wrong _GPIO_ mode, because you didn't set PAR bit (when PAR bit set DIR/ODR/DAT bits are losing their meanings).
Quoted 3 lines
qe_gpio_set_dedicated()instead of restoring its value. That way the board initialization code could just set the DIR, DAT and ODR bits for dedicated mode but still configure the pin in GPIO mode.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
Quoted 15 lines · Anton Vorontsov
On Mon, Aug 18, 2008 at 03:58:46PM +0200, Laurent Pinchart wrote:
[...]Quoted 13 lines
Quoted 12 lines
Not exactly. But you can do this way, if you need to preserve a direction. What I did is a bit different though.
qe_gpio_set_dedicated()actually just restores a mode that firmware had set up, including direction (since direction could be a part of dedicated configuration).That is, upon GPIO controller registration, we save all registers, then driver can set up a pin to a GPIO mode via standard API, and then it can _revert_ a pin to a dedicated function via
qe_gpio_set_dedicated()call. Dedicated function is specified by the firmware (or board file), we're just restoring it.
Quoted 5 lines
Quoted 2 lines
The semantic of the
set_dedicated()operation needs to be clearly defined then.It is. We set up a dedicated function that firmware (or board file) has configured.
A comment in the source would help.
Quoted 10 lines
Quoted 2 lines
I can live with this behaviour, but it might not be acceptable for everybody.
For example?
Quoted 2 lines
Your patch requires the firmware to set a pin in dedicated mode at bootup in order to be used later in dedicated mode.
Yes. On a PowerPC this is always true: firmware should set up PIO config. Linux' board file could fixup the firmware though.
That's not what I meant. What if the hardware requires to pin to be configured in GPIO mode with a fixed value until the SOC-specific driver that will drive the GPIO is loaded ? That's not possible with your API.
Until a SOC peripheral is initialized by its associated Linux driver, the behaviour of a GPIO pin in dedicated mode will be undefined. The firmware/board code will probably want to set the pin as a GPIO output with a fixed value until the driver initializes the hardware.
Quoted 4 lines
Another option would be to add some argument to the
set_dedicatedcall, thus the software could specify arbitrary dedicated function (thus no need to save/restore anything). But this would be SOC-model specific, thus no driver can use this argument anyway.
Drivers that require dedicated mode are SOC-specific anyway.
Quoted 9 lines
Quoted 3 lines
If, for some
reason (driver not loaded, ...), no GPIO user shows up for that pin, it will stay configured in dedicated mode.Yes.
Quoted 1 line
It might be better to set the PAR bit unconditionally in
Why it might be better?
Because, as explained a few lines down, the board initialization code will be able to configure a pin in a known state (PAR not set) at boot time until a driver requests the pin to be switched to dedicated mode.
Quoted 7 lines
That way you may set up wrong _GPIO_
mode, because you didn't set PAR bit (when PAR bit set DIR/ODR/DAT bits are losing their meanings).Quoted 3 lines
qe_gpio_set_dedicated()instead of restoring its value. That way the board initialization code could just set the DIR, DAT and ODR bits for dedicated mode but still configure the pin in GPIO mode.
Signature · 9 lines
Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
Quoted 32 lines · Laurent Pinchart
Quoted 15 lines · Anton Vorontsov
On Mon, Aug 18, 2008 at 03:58:46PM +0200, Laurent Pinchart wrote:
[...]Quoted 13 lines
Quoted 12 lines
Not exactly. But you can do this way, if you need to preserve a direction. What I did is a bit different though.
qe_gpio_set_dedicated()actually just restores a mode that firmware had set up, including direction (since direction could be a part of dedicated configuration).That is, upon GPIO controller registration, we save all registers, then driver can set up a pin to a GPIO mode via standard API, and then it can _revert_ a pin to a dedicated function via
qe_gpio_set_dedicated()call. Dedicated function is specified by the firmware (or board file), we're just restoring it.Quoted 5 lines
Quoted 2 lines
The semantic of the
set_dedicated()operation needs to be clearly defined then.It is. We set up a dedicated function that firmware (or board file) has configured.
A comment in the source would help.
Quoted 8 lines
Quoted 2 lines
I can live with this behaviour, but it might not be acceptable for everybody.
For example?
Quoted 2 lines
Your patch requires the firmware to set a pin in dedicated mode at bootup in order to be used later in dedicated mode.
Quoted 7 lines
Quoted 2 lines
Yes. On a PowerPC this is always true: firmware should set up PIO config. Linux' board file could fixup the firmware though.
That's not what I meant. What if the hardware requires to pin to be configured in GPIO mode with a fixed value until the SOC-specific driver that will drive the GPIO is loaded ? That's not possible with your API.
Yes, this isn't possible with this API. Because you can do this with standard GPIO API! ;-)
Just call gpio_direction_*() in the board file, before probing the hardware.
Quoted 2 lines
Until a SOC peripheral is initialized by its associated Linux driver, the behaviour of a GPIO pin in dedicated mode will be undefined.
Huh?! Then all current software is simply broken: we're setting pinmux config _prior_ to controller initialization.
Quoted 2 lines
The
firmware/boardcode will probably want to set the pin as a GPIO output with a fixed value until the driver initializes the hardware.
Probably? Do you have any such hardware?
Quoted 6 lines
Quoted 4 lines
Another option would be to add some argument to the
set_dedicatedcall, thus the software could specify arbitrary dedicated function (thus no need to save/restore anything). But this would be SOC-model specific, thus no driver can use this argument anyway.Drivers that require dedicated mode are SOC-specific anyway.
I didn't say "SOC-specific". I said "SOC-model specific", which means that the driver would be not portable even across QE chips (i.e. MPC8323 vs. MPC8360, you can assume that the "CLK12" function is having same PAR/ODR/DAT/DIR bits).
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
If, for some
reason (driver not loaded, ...), no GPIO user shows up for that pin, it will stay configured in dedicated mode.Yes.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
It might be better to set the PAR bit unconditionally in
Why it might be better?
Because, as explained a few lines down, the board initialization code will be able to configure a pin in a known state (PAR not set) at boot time until a driver requests the pin to be switched to dedicated mode.
You can do this as I described above. But prior to this, yes, you have to configure the pins and let Linux save these values. There is no other way to pass this information, unfortunately.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
Quoted 41 lines · Anton Vorontsov
Quoted 32 lines · Laurent Pinchart
Quoted 15 lines · Anton Vorontsov
On Mon, Aug 18, 2008 at 03:58:46PM +0200, Laurent Pinchart wrote:
[...]Quoted 13 lines
Quoted 12 lines
Not exactly. But you can do this way, if you need to preserve a direction. What I did is a bit different though.
qe_gpio_set_dedicated()actually just restores a mode that firmware had set up, including direction (since direction could be a part of dedicated configuration).That is, upon GPIO controller registration, we save all registers, then driver can set up a pin to a GPIO mode via standard API, and then it can _revert_ a pin to a dedicated function via
qe_gpio_set_dedicated()call. Dedicated function is specified by the firmware (or board file), we're just restoring it.Quoted 5 lines
Quoted 2 lines
The semantic of the
set_dedicated()operation needs to be clearly defined then.It is. We set up a dedicated function that firmware (or board file) has configured.
A comment in the source would help.
Quoted 8 lines
Quoted 2 lines
I can live with this behaviour, but it might not be acceptable for everybody.
For example?
Quoted 2 lines
Your patch requires the firmware to set a pin in dedicated mode at bootup in order to be used later in dedicated mode.
Quoted 7 lines
Quoted 2 lines
Yes. On a PowerPC this is always true: firmware should set up PIO config. Linux' board file could fixup the firmware though.
That's not what I meant. What if the hardware requires to pin to be configured in GPIO mode with a fixed value until the SOC-specific driver that will drive the GPIO is loaded ? That's not possible with your API.
Quoted 5 lines
Yes, this isn't possible with this API. Because you can do this with standard GPIO API! ;-)
Just call gpio_direction_*() in the board file, before probing the hardware.
You'd have to do that after the GPIO drivers saved the pin registers.
Quoted 5 lines
Quoted 2 lines
Until a SOC peripheral is initialized by its associated Linux driver, the behaviour of a GPIO pin in dedicated mode will be undefined.
Huh?! Then all current software is simply broken: we're setting pinmux config _prior_ to controller initialization.
Undefined behaviour doesn't mean broken behaviour :-) Signals coming from SOC peripherals are mostly undefined until the peripheral is initialized. For most hardware that doesn't matter much, but it might in some cases. For instance the state of the RTS signal on a serial port probably doesn't matter before we start serial communication, but some boards might require that RTS is deasserted before the controller is initialized. We can just ignore the issue for now and wait until it bites us.
Quoted 4 lines
Quoted 2 lines
The
firmware/boardcode will probably want to set the pin as a GPIO output with a fixed value until the driver initializes the hardware.Probably? Do you have any such hardware?
Nope. I was referring to the hardware such as in the above example.
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
Another option would be to add some argument to the
set_dedicatedcall, thus the software could specify arbitrary dedicated function (thus no need to save/restore anything). But this would be SOC-model specific, thus no driver can use this argument anyway.Drivers that require dedicated mode are SOC-specific anyway.
I didn't say "SOC-specific". I said "SOC-model specific", which means that the driver would be not portable even across QE chips (i.e. MPC8323 vs. MPC8360, you can assume that the "CLK12" function is having same PAR/ODR/DAT/DIR bits).
If I'm not mistaken, the PAR bit is used to select between GPIO and dedicated mode by definition. It should be safe to assume that setting a GPIO in dedicated mode requires the PAR bit to be set. But as I stated above, we can ignore that for now until a hardware use case comes up.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
If, for some
reason (driver not loaded, ...), no GPIO user shows up for that pin, it will stay configured in dedicated mode.Yes.
Quoted 1 line
It might be better to set the PAR bit unconditionally in
Why it might be better?
Quoted 7 lines
Quoted 3 lines
Because, as explained a few lines down, the board initialization code will be able to configure a pin in a known state (PAR not set) at boot time until a driver requests the pin to be switched to dedicated mode.
You can do this as I described above. But prior to this, yes, you have to configure the pins and let Linux save these values. There is no other way to pass this information, unfortunately.
Ok.
I started implementing CPM2 dedicated mode support to be used in the CPM UART driver for RTS/CTS flow control, and soon realized there was a show stopper. The CPM UART driver is mostly CPM1/CPM2 agnostic. I can't use a function such as cpm2_gpio32_set_dedicated, as that wouldn't work on a CPM1 (at least not on all its ports). I could call the right function depending on which port the GPIO is on, but that's really hackish and would defeat the purpose of using GPIOs. What we really need there is a set_dedicated/set_option/set_whatever function in the GPIO API :-/
Signature · 9 lines
Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75
Re: [PATCH 1/3] gpiolib: make gpio_to_chip() public
On Tue, Aug 19, 2008 at 11:26:28AM +0200, Laurent Pinchart wrote:
[...]
Quoted 10 lines
Quoted 4 lines
I didn't say "SOC-specific". I said "SOC-model specific", which means that the driver would be not portable even across QE chips (i.e. MPC8323 vs. MPC8360, you can assume that the "CLK12" function is having same PAR/ODR/DAT/DIR bits).
If I'm not mistaken, the PAR bit is used to select between GPIO and dedicated mode by definition. It should be safe to assume that setting a GPIO in dedicated mode requires the PAR bit to be set. But as I stated above, we can ignore that for now until a hardware use case comes up.
One more thing: you're assuming that there is one par bit, but there are two par bits for QE chips. Which one would you set in set_dedicated()? ;-)
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
If, for some
reason (driver not loaded, ...), no GPIO user shows up for that pin, it will stay configured in dedicated mode.Yes.
Quoted 1 line
It might be better to set the PAR bit unconditionally in
Why it might be better?
Quoted 7 lines
Quoted 3 lines
Because, as explained a few lines down, the board initialization code will be able to configure a pin in a known state (PAR not set) at boot time until a driver requests the pin to be switched to dedicated mode.
You can do this as I described above. But prior to this, yes, you have to configure the pins and let Linux save these values. There is no other way to pass this information, unfortunately.
Ok.
Quoted 7 lines
I started implementing CPM2 dedicated mode support to be used in the CPM UART driver for RTS/CTS flow control, and soon realized there was a show stopper. The CPM UART driver is mostly CPM1/CPM2 agnostic. I can't use a function such as
cpm2_gpio32_set_dedicated, as that wouldn't work on a CPM1 (at least not on all its ports). I could call the right function depending on which port the GPIO is on, but that's really hackish and would defeat the purpose of using GPIOs.
You can easily refactor cpm gpio code so that you'll have common cpm structure with platform-specific "GPIO API extension" callbacks. Something like this:
/*
* generic structure, does not know anything about cpm1/2/qe, or
* ports width.
*/
struct cpm_gpio_chip {
struct of_mm_gpio_chip mm_gc;
spinlock_t lock;
void (*set_dedicated)(unsigned int gpio);
};struct cpm1_gpio16_chip {
struct cpm_gpio_chip cpgc;
/* shadowed data register to clear/set bits safely */
u16 cpdata;
};void cpm_gpio_set_dedicated(unsigned int gpio)
{
struct gpio_chip *gc = gpio_to_chip(gpio);
struct of_gpio_chip *ofgc = to_of_gpio_chip(gc);
struct cpm_gpio_chip *cpgc = to_cpm_gpio_chip(ofgc);
if (cpgc->set_dedicated)
cpgc->set_dedicated(gc->base - gpio);
}Quoted 3 lines
What we
really need there is a set_dedicated/set_option/set_whatever function in the GPIO API :-/
Won't happen. ;-)
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
PATCH 2/3 powerpc/qe: new call to revert a gpio to a dedicated function
In reply to Anton Vorontsovqe_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
@@ -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); +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.5.4
PATCH 3/3 USB: driver for Freescale QUICC Engine USB Host Controller
In reply to Anton VorontsovThis is 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 an 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 | 1 + drivers/usb/host/fhci-cq.c | 105 +++++ drivers/usb/host/fhci-dbg.c | 144 +++++++ drivers/usb/host/fhci-hcd.c | 783 +++++++++++++++++++++++++++++++++++++ drivers/usb/host/fhci-hub.c | 332 ++++++++++++++++ drivers/usb/host/fhci-mem.c | 105 +++++ drivers/usb/host/fhci-q.c | 242 ++++++++++++ drivers/usb/host/fhci-sched.c | 864 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/fhci-tds.c | 633 ++++++++++++++++++++++++++++++ drivers/usb/host/fhci.h | 526 +++++++++++++++++++++++++ 12 files changed, 3753 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/fhci-cq.c 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
@@ -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
@@ -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 +1 -0
@@ -19,3 +19,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-hcd.o
drivers/usb/host/fhci-cq.c new file +105 -0
105 lines not on this page · raw message
drivers/usb/host/fhci-dbg.c new file +144 -0
144 lines not on this page · raw message
drivers/usb/host/fhci-hcd.c new file +783 -0
783 lines not on this page · raw message
drivers/usb/host/fhci-hub.c new file +332 -0
332 lines not on this page · raw message
drivers/usb/host/fhci-mem.c new file +105 -0
105 lines not on this page · raw message
drivers/usb/host/fhci-q.c new file +242 -0
242 lines not on this page · raw message
drivers/usb/host/fhci-sched.c new file +864 -0
864 lines not on this page · raw message
drivers/usb/host/fhci-tds.c new file +633 -0
394 lines not on this page · raw message
drivers/usb/host/fhci.h new file +526 -0
526 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.5.4
Part of the diff is not shown here. View the raw message.
Quoted 8 lines · Anton Vorontsov
Hi all,
Most patches that were needed to support QE USB Host were merged during 2.6.27 merge window, and only three more patches left over. Here they are.
David, could you bear with
gpio_to_chip()exported function, just as a stopgap for a proper api?
I'll hold off on the 3rd patch until david takes the first two.
thanks,
greg k-h
Quoted 11 lines · Greg KH
Quoted 8 lines · Anton Vorontsov
Hi all,
Most patches that were needed to support QE USB Host were merged during 2.6.27 merge window, and only three more patches left over. Here they are.
David, could you bear with
gpio_to_chip()exported function, just as a stopgap for a proper api?I'll hold off on the 3rd patch until david takes the first two.
David, are there any issues with the first patch in the series?
It would be great if you'll ack the first patch, so that I'll respin the whole patchset with some minor fixes in the 3rd patch.
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Quoted 8 lines · Anton Vorontsov
Hi all,
Most patches that were needed to support QE USB Host were merged during 2.6.27 merge window, and only three more patches left over. Here they are.
David, could you bear with
gpio_to_chip()exported function, just as a stopgap for a proper api?
I need gpio_to_chip() (or another 'proper API') as well for RTS/CTS based flow control in the CPM/CPM2 UART driver.
Best regards,
Signature · 9 lines
Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75
Quoted 6 lines · Laurent Pinchart
Quoted 3 lines
David, could you bear with
gpio_to_chip()exported function, just as a stopgap for a proper api?I need
gpio_to_chip()(or another 'proper API') as well for RTS/CTS based flow control in the CPM/CPM2 UART driver.
I'l still say "proper". This should be straightforward; along the lines of
struct qe_pin {
struct ... *qe_ports; /* includes gpio_chip */
unsigned offset;
};And instead of having the driver look up a "gpio" for such non-GPIO usage, have it call something that sets up a qe_pin. All that infrastructure exists already...
Then drivers can use calls which mux the pin into its "normal" mode (QE function of some kind), or into its "gpio" mode.
The gpio number would be gpio_chip->base + offset, and the gpio_chip is visible -- in a fully typesafe manner! -- from the qe_ports structure.
No type-unsafe interfaces. No confusion between roles of a given pin. No hidden assumption there's only one kind of GPIO (backed by QE ports). And ... no need to change any core structural assumptions of the GPIO framework.
- Dave