Patches needed to support QE USB Host Controller
Subsystems (6)
cover Patches needed to support QE USB Host Controller
Hi all,
These patches are needed to support "FHCI" host controller.
This includes:
- GPIO LIB support for PowerPC;
- GPIO LIB support for QUICC Engine;
- gpio_set_dedicated() addition to GPIO LIB;
- QE LIB additions: usb, gtm;
- FHCI driver;
- Support for MPC8360E-RDK as an example.
I have already posted GPIO LIB support for PowerPC/QE, but since patches changed a bit, I thought it's good idea to take a chance and repost them for the next RFC round.
Thanks,
p.s.
David, I'm Cc:ing you to this patchset (except qe_gtm, and qe_usb patches -- nothing insteresting), to show the complete picture of why we need additions to GPIO LIB.
Also will appreciate any comments regarding GPIO LIB support for PowerPC/QE.
linux-usb Cc'ed only for FHCI driver patch.
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
PATCH 1/11 Implement support for the GPIO LIB API
This patch implements support for the GPIO LIB API. Two calls unimplemented though: irq_to_gpio and gpio_to_irq.
--- Documentation/powerpc/booting-without-of.txt | 58 ++++++++ arch/powerpc/Kconfig | 5 + arch/powerpc/kernel/Makefile | 1 + arch/powerpc/kernel/gpio.c | 200 ++++++++++++++++++++++++++ include/asm-powerpc/gpio.h | 118 +++++++++++++++ 5 files changed, 382 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/kernel/gpio.c create mode 100644 include/asm-powerpc/gpio.h
Documentation/powerpc/booting-without-of.txt +58 -0
@@ -64,6 +64,10 @@ Table of Contents 3) OpenPIC Interrupt Controllers 4) ISA Interrupt Controllers + VIII - Specifying GPIO information for devices + 1) gpios property + 2) gpio-controller nodes + Appendix A - Sample SOC node for MPC8540
@@ -2858,6 +2862,60 @@ encodings listed below: 2 = high to low edge sensitive type enabled 3 = low to high edge sensitive type enabled +VIII - Specifying GPIO information for devices +============================================== + +1) gpios property +----------------- + +Nodes that makes use of GPIOs should define them using `gpios' property, +format of which is: <&gpio-controller1-phandle gpio1-specifier + &gpio-controller2-phandle gpio2-specifier + ...>; + +Note that gpio-specifier length is controller dependent. + +gpio-specifier may encode: bank, pin position inside the bank, +whether pin is open-drain and whether pin is logically inverted. + +Example of the node using GPIOs: + + nand-flash@1,0 { + compatible = "stmicro,NAND512W3A2BN6E", "fsl,upm-nand"; + reg = <1 0 1>; + width = <1>; + upm = "A"; + upm-addr-offset = <16>; + upm-cmd-offset = <8>; + gpios = <&qe_pio_e 18 0>; + wait-pattern; + wait-write; + }; + +In this example gpio-specifier is "18 0" and encodes GPIO pin number, +and empty GPIO flags as accepted by the "qe_pio_e" gpio-controller. + +2) gpio-controller nodes +------------------------ + +Every GPIO controller node must have #gpio-cells property defined, +this information will be used to translate gpio-specifiers. + +Example of two SOC GPIO banks defined as gpio-controller nodes: + + qe_pio_a: gpio-controller@1400 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank"; + reg = <0x1400 0x18>; + gpio-controller; + }; + + qe_pio_e: gpio-controller@1460 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank"; + reg = <0x1460 0x18>; + gpio-controller; + }; Appendix A - Sample SOC node for MPC8540 ========================================
arch/powerpc/Kconfig +5 -0
@@ -81,6 +81,11 @@ config GENERIC_FIND_NEXT_BIT bool default y +config GENERIC_GPIO + bool + help + Generic GPIO API support + config ARCH_NO_VIRT_TO_BUS def_bool PPC64
arch/powerpc/kernel/Makefile +1 -0
@@ -65,6 +65,7 @@ obj-$(CONFIG_BOOTX_TEXT) += btext.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o +obj-$(CONFIG_HAVE_GPIO_LIB) += gpio.o pci64-$(CONFIG_PPC64) += pci_dn.o isa-bridge.o obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \
arch/powerpc/kernel/gpio.c new file +200 -0
200 lines not on this page · raw message
include/asm-powerpc/gpio.h new file +118 -0
118 lines not on this page · raw message
Signature · 1 line
1.5.2.2
Re: [PATCH 01/11] [POWERPC] Implement support for the GPIO LIB API
Quoted 2 lines · Anton Vorontsov
This patch implements support for the GPIO LIB API. Two calls unimplemented though:
irq_to_gpioandgpio_to_irq.
Also gpio_cansleep().
Quoted 5 lines
Documentation/powerpc/booting-without-of.txt +5
-0+Example of two SOC GPIO banks defined as gpio-controller nodes: + + qe_pio_a: gpio-controller@1400 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank";
Documentation/powerpc/booting-without-of.txt encodings listed below: · line 2918
Quoted 10 lines
Documentation/powerpc/booting-without-of.txt +10
-0+ reg = <0x1400 0x18>; + gpio-controller; + }; + + qe_pio_e: gpio-controller@1460 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank"; + reg = <0x1460 0x18>; + gpio-controller; + };
Let me suggest another example to provide: an I2C GPIO expander
such as a pcf8574 or pca9354 (both eight bit expanders). The SOC case is probably the easiest to cover.
Quoted 1 line
+#define ARCH_OF_GPIOS_PER_CHIP 32
Well, ARCH_OF_* is clearly not the now-removed ARCH_GPIOS_PER_CHIP, but I still suggest moving away from that concept.
include/asm-powerpc/gpio.h line 42
Quoted 9 lines
include/asm-powerpc/gpio.h new file +9
-0+static inline int gpio_get_value (unsigned int gpio) +{ +return __gpio_get_value (gpio); +} + +static inline void gpio_set_value (unsigned int gpio,int value) +{ +__gpio_set_value (gpio, value); +}
static inline int gpio_cansleep(unsigned int gpio)
{
return __gpio_cansleep(gpio);
}include/asm-powerpc/gpio.h line 54
Quoted 3 lines
include/asm-powerpc/gpio.h new file +3
-0+static inline int irq_to_gpio (unsigned int irq) +{ +return -ENOSYS ;
Minor nit: "-EINVAL" would be better here, since the argument is constrained to have been returned from gpio_to_irq(), and as you wrote that call there can be no such values.
Re: [PATCH 01/11] [POWERPC] Implement support for the GPIO LIB API
Quoted 18 lines · David Brownell
Quoted 2 lines · Anton Vorontsov
This patch implements support for the GPIO LIB API. Two calls unimplemented though:
irq_to_gpioandgpio_to_irq.Also
gpio_cansleep().Quoted 11 lines
Documentation/powerpc/booting-without-of.txt +11
-0+Example of two SOC GPIO banks defined as gpio-controller nodes: + + qe_pio_a: gpio-controller@1400 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank"; + reg = <0x1400 0x18>; + gpio-controller; + }; + + qe_pio_e: gpio-controller@1460 { + #gpio-cells = <2>;
Quoted 8 lines
Documentation/powerpc/booting-without-of.txt encodings listed below: · line 2918
Quoted 4 lines
Documentation/powerpc/booting-without-of.txt +4
-0+ compatible = "fsl,qe-pario-bank"; + reg = <0x1460 0x18>; + gpio-controller; + };Let me suggest another example to provide: an I2C GPIO expander
such as a pcf8574 or pca9354 (both eight bit expanders). The SOC case is probably the easiest to cover.
I2C expander will be easy to support via device tree too, something like:
i2c@3000 {
#address-cells = <1>;
#size-cells = <0>;
cell-index = <0>;
compatible = "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <14 8>;
interrupt-parent = <&ipic>;
dfsrr;
pcf_pio: gpio-controller@27 {
#gpio-cells = <2>;
compatible = "ti,pcf8574";
reg = <0x27>;
gpio-controller;
};
};Of course, to support this, pcf857x driver needs OF bindings.
Quoted 4 lines
Quoted 1 line
+#define ARCH_OF_GPIOS_PER_CHIP 32
Well, ARCH_OF_* is clearly not the now-removed
ARCH_GPIOS_PER_CHIP, but I still suggest moving away from that concept.
Yes, I noticed that ARCH_GPIOS_PER_CHIP is removed from the gpiolib. But I solely use it to assign gpio_bases to the chips:
static int of_get_gpiochip_base(struct device_node *np)
{
struct device_node *gc = NULL;
int gpiochip_base = 0;
while ((gc = of_find_all_nodes(gc))) {
if (!of_get_property(gc, "gpio-controller", NULL))
continue;
if (gc != np) {
gpiochip_base += ARCH_OF_GPIOS_PER_CHIP;
continue;
}
of_node_put(gc);
if (gpiochip_base >= ARCH_OF_GPIOS_END)
return -ENOSPC;
return gpiochip_base;
}
return -ENOENT;
}This function walks the device tree and assigns gpio_base 0 to the first encountered gpio-controller, ARCH_OF_GPIOS_PER_CHIP * N to the Nth controller...
Technically, I can replace
if (gc != np) {
gpiochip_base += ARCH_OF_GPIOS_PER_CHIP;
continue;
}With
if (gc != np) {
struct gpio_chip *chip = gc->data;
if (chip)
gpiochip_base += chip->ngpio;
continue;
}Here we're getting next available GPIO base. But then this code can't handle gpio chip removal. So, we need smart "dynamic GPIO base allocator" as described asm-generic/gpio.h, gpio_find_base(ngpios) that will find free gpio base suitable for ngpios to place. Until that allocator implemented, we use simple allocator with OF_GPIOS_PER_CHIP...
Quoted 11 lines
include/asm-powerpc/gpio.h line 42
Quoted 9 lines
include/asm-powerpc/gpio.h new file +9
-0+static inline int gpio_get_value (unsigned int gpio) +{ +return __gpio_get_value (gpio); +} + +static inline void gpio_set_value (unsigned int gpio,int value) +{ +__gpio_set_value (gpio, value); +}static inline int
gpio_cansleep(unsigned int gpio)
Quoted 3 lines
{
return __gpio_cansleep(gpio);
}Will fix.
Quoted 7 lines
include/asm-powerpc/gpio.h line 54
Quoted 3 lines
include/asm-powerpc/gpio.h new file +3
-0+static inline int irq_to_gpio (unsigned int irq) +{ +return -ENOSYS ;Minor nit: "
-EINVAL" would be better here, since the argument is constrained to have been returned fromgpio_to_irq(), and as you wrote that call there can be no such values.
Will change.
Thanks!
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
PATCH 2/11 QE: split par_io_config_pin()
In reply to Anton VorontsovThis patch splits par_io_config_pin so we can use it with GPIO LIB API.
Also add a comment regarding #ifdef CONFIG_PPC_85xx being legacy.
--- arch/powerpc/sysdev/qe_lib/qe_io.c | 60 +++++++++++++++++++++++------------ 1 files changed, 39 insertions(+), 21 deletions(-)
arch/powerpc/sysdev/qe_lib/qe_io.c +39 -21
@@ -37,6 +37,10 @@ struct port_regs {__be32 cppar1;/* Pin assignment register */ __be32 cppar2;/* Pin assignment register */ #ifdef CONFIG_PPC_85xx +/* +* This is needed for legacy support only, should go away, +* because we started using per-bank gpio chips. +*/ u8 pad[8 ];#endif };
@@ -63,28 +67,29 @@ int par_io_init(struct device_node *np)return 0 ; } -int par_io_config_pin (u8 port,u8 pin,int dir,int open_drain, -int assignment,int has_irq) +static void __par_io_config_pin (struct port_regs __iomem *par_io, +u8 pin,int dir,int open_drain, +int assignment,int has_irq) { -u32 pin_mask1bit, pin_mask2bits, new_mask2bits, tmp_val; - -if (!par_io) -return -1 ; +u32 pin_mask1bit; +u32 pin_mask2bits; +u32 new_mask2bits; +u32 tmp_val;/* calculate pin location for single and 2 bits information */ pin_mask1bit = (u32) (1 << (NUM_OF_PINS - (pin +1 )));/* Set open drain, if required */ - tmp_val =in_be32 (&par_io[port].cpodr); + tmp_val =in_be32 (&par_io->cpodr);if (open_drain) -out_be32 (&par_io[port].cpodr, pin_mask1bit | tmp_val); +out_be32 (&par_io->cpodr, pin_mask1bit | tmp_val);else -out_be32 (&par_io[port].cpodr, ~pin_mask1bit & tmp_val); +out_be32 (&par_io->cpodr, ~pin_mask1bit & tmp_val);/* define direction */ tmp_val = (pin > (NUM_OF_PINS /2 ) -1 ) ? -in_be32 (&par_io[port].cpdir2) : -in_be32 (&par_io[port].cpdir1); +in_be32 (&par_io->cpdir2) : +in_be32 (&par_io->cpdir1);/* get all bits mask for 2 bit per port */ pin_mask2bits = (u32) (0x3 << (NUM_OF_PINS -
@@ -96,36 +101,49 @@ int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,/* clear and set 2 bits mask */ if (pin > (NUM_OF_PINS /2 ) -1 ) { -out_be32 (&par_io[port].cpdir2, +out_be32 (&par_io->cpdir2, ~pin_mask2bits & tmp_val); tmp_val &= ~pin_mask2bits; -out_be32 (&par_io[port].cpdir2, new_mask2bits | tmp_val); +out_be32 (&par_io->cpdir2, new_mask2bits | tmp_val); }else { -out_be32 (&par_io[port].cpdir1, +out_be32 (&par_io->cpdir1, ~pin_mask2bits & tmp_val); tmp_val &= ~pin_mask2bits; -out_be32 (&par_io[port].cpdir1, new_mask2bits | tmp_val); +out_be32 (&par_io->cpdir1, new_mask2bits | tmp_val); }/* define pin assignment */ tmp_val = (pin > (NUM_OF_PINS /2 ) -1 ) ? -in_be32 (&par_io[port].cppar2) : -in_be32 (&par_io[port].cppar1); +in_be32 (&par_io->cppar2) : +in_be32 (&par_io->cppar1); new_mask2bits = (u32) (assignment << (NUM_OF_PINS - (pin % (NUM_OF_PINS /2 ) +1 ) *2 ));/* clear and set 2 bits mask */ if (pin > (NUM_OF_PINS /2 ) -1 ) { -out_be32 (&par_io[port].cppar2, +out_be32 (&par_io->cppar2, ~pin_mask2bits & tmp_val); tmp_val &= ~pin_mask2bits; -out_be32 (&par_io[port].cppar2, new_mask2bits | tmp_val); +out_be32 (&par_io->cppar2, new_mask2bits | tmp_val); }else { -out_be32 (&par_io[port].cppar1, +out_be32 (&par_io->cppar1, ~pin_mask2bits & tmp_val); tmp_val &= ~pin_mask2bits; -out_be32 (&par_io[port].cppar1, new_mask2bits | tmp_val); +out_be32 (&par_io->cppar1, new_mask2bits | tmp_val); } +} + +/* +* This is "legacy" function that takes port number as an argument +* instead of pointer to the appropriate bank. +*/ +int par_io_config_pin (u8 port,u8 pin,int dir,int open_drain, +int assignment,int has_irq) +{ +if (!par_io || port >= num_par_io_ports) +return -EINVAL ; +__par_io_config_pin (&par_io[port], pin, dir, open_drain, assignment, + has_irq);return 0 ; }EXPORT_SYMBOL (par_io_config_pin);
Signature · 1 line
1.5.2.2
PATCH 3/11 QE: implement GPIO LIB API
In reply to Anton Vorontsov--- Documentation/powerpc/booting-without-of.txt | 32 ++++--- arch/powerpc/platforms/Kconfig | 2 + arch/powerpc/sysdev/qe_lib/qe_io.c | 133 ++++++++++++++++++++++++++ 3 files changed, 155 insertions(+), 12 deletions(-)
Documentation/powerpc/booting-without-of.txt +20 -12
@@ -1701,24 +1701,32 @@ platforms are moved over to use the flattened-device-tree model. information. Required properties: - - device_type : should be "par_io". + - #gpio-cells : should be "2". + - compatible : should be "fsl,qe-pario-bank" - reg : offset to the register set and its length. - - num-ports : number of Parallel I/O ports + - gpio-controller : node to identify gpio controllers. - Example: - par_io@1400 { - reg = <1400 100>; - #address-cells = <1>; - #size-cells = <0>; - device_type = "par_io"; - num-ports = <7>; - ucc_pin@01 { - ...... - }; + For example, two QE Par I/O banks: + qe_pio_a: gpio-controller@1400 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank"; + reg = <0x1400 0x18>; + gpio-controller; + }; + qe_pio_e: gpio-controller@1460 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank"; + reg = <0x1460 0x18>; + gpio-controller; + }; vi) Pin configuration nodes + NOTE: pin configuration nodes are obsolete. Usually, their existance + is an evidence of the firmware shortcomings. Such fixups are + better handled by the Linux board file, not the device tree. + Required properties: - linux,phandle : phandle of this node; likely referenced by a QE device.
arch/powerpc/platforms/Kconfig +2 -0
@@ -271,6 +271,8 @@ config QUICC_ENGINE bool select PPC_LIB_RHEAP select CRC32 + select GENERIC_GPIO + select HAVE_GPIO_LIB help The QUICC Engine (QE) is a new generation of communications coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
arch/powerpc/sysdev/qe_lib/qe_io.c +133 -0
148 lines not on this page · raw message
Signature · 1 line
1.5.2.2
RFC PATCH 4/11 add gpio_set_dedicated() routine
In reply to Anton VorontsovThis routine sets dedicated functions of the GPIO pin.
---
Hello David,
Yes, I did read Documentation/gpio.txt's last chapter. :-)
...that says:
One of the biggest things these conventions omit is pin multiplexing, since this is highly chip-specific and nonportable.
Let me counter: "chip-specific" is a weak argument, IMO. Imagine some GPIO controller that can't do inputs, or outputs. First one will be still suitable for gpio_leds, second one will be suitable for gpio_keys.
Or... gpio_to_irq/irq_to_gpio. More than chip-specific, isn't it? Some GPIO controllers might provide interrupt sources, some might not.
Or let's put it completely different way: IRQs, they are chip specific too, some of them can't do EDGE_FALLING or EDGE_RISING. But these flags still exists for the IRQs, and drivers use them.
The same for GPIO pin multiplexing: some drivers aren't aware of GPIO multiplexing, but some are.
With the device tree/OpenFirmware environment it's quite easy to pass "dedicated functions" flags to the drivers. Platform device drivers also may accept functions via platform data (or better yet via IORESOURCE_GPIO and its flags -- yet to be implemented, of course).
Today, there is a driver for the Freescale USB Host Controller, that needs switching some pins to GPIOs for short period, and then back to the dedicated functions...
So, down below is the proposal patch: gpio_set_dedicated() routine.
There are other options, tough. But I don't like them:
- Don't use GPIO API for that driver. Bad idea, this driver completely fits in the current GPIO use cases, except set_dedicated()...
- Export "gpio_chips", thus we can implement arch-specific functions. Bad idea, we'll smear "GPIO LIB" across the whole kernel.
- Implement gpio_chip->free() and gpio_chip->request() callbacks, so controllers could restore pin's functions in the ->free().
Then drivers could do:
gpio_request();
gpio_direction_...();
...do some GPIO work...
gpio_free(); /* and controller will restore dedicated function */
Well, this is viable option. But expensive and it isn't good idea to release gpios when driver already probed (think someone might request it meantime). Still viable for my case, though.
Oh, there is no way to pass "func" argument also.
- Another option?
Thanks!
--- drivers/gpio/gpiolib.c | 13 +++++++++++++ include/asm-generic/gpio.h | 3 +++ 2 files changed, 16 insertions(+), 0 deletions(-)
drivers/gpio/gpiolib.c +13 -0
@@ -440,6 +440,19 @@ void gpio_set_value_cansleep(unsigned gpio, int value) }EXPORT_SYMBOL_GPL (gpio_set_value_cansleep); +int gpio_set_dedicated (unsigned gpio,int func) +{ +struct gpio_chip *chip; + +might_sleep_if (extra_checks); + chip =gpio_to_chip (gpio); +if (chip->set_dedicated) +return chip->set_dedicated (chip, gpio - chip->base, func); + +return -ENOSYS ; +} +EXPORT_SYMBOL_GPL (gpio_set_dedicated); +#ifdef CONFIG_DEBUG_FS
include/asm-generic/gpio.h +3 -0
@@ -61,6 +61,8 @@ struct gpio_chip { unsigned offset, int value);void (*set)(struct gpio_chip *chip,unsigned offset,int value); +int (*set_dedicated)(struct gpio_chip *chip, +unsigned offset,int func);void (*dbg_show)(struct seq_file *s,struct gpio_chip *chip);int base;
@@ -88,6 +90,7 @@ extern int gpio_direction_output(unsigned gpio, int value);extern int gpio_get_value_cansleep (unsigned gpio);extern void gpio_set_value_cansleep (unsigned gpio,int value); +extern int gpio_set_dedicated (unsigned gpio,int func);/* A platform's <asm/gpio.h> code may want to inline the I/O calls when * the GPIO is constant and refers to some always-present controller,
Signature · 1 line
1.5.2.2
Re: [PATCH 04/11] [RFC][GPIOLIB] add gpio_set_dedicated() routine
Quoted 6 lines · Anton Vorontsov
This routine sets dedicated functions of the GPIO pin.
---
Hello David,
Quoted 8 lines
Yes, I did read Documentation/gpio.txt's last chapter. :-)
...that says:
One of the biggest things these conventions omit is pin multiplexing, since this is highly chip-specific and nonportable.
Let me counter: "chip-specific" is a weak argument, IMO.
Then focus on "nonportable concepts" instead. :)
Note that "pin" != "GPIO". There are platforms that let one GPIO be routed to any of several pins/balls; and let a given pin/ball be multiplexed to support any of several GPIOs. (Annoying because it's so error prone, but true. I'll call that the "OMAP1" pinmux issue, since that's where I first ran into it.)
Likewise, not all pins with multiplexed functionality include GPIO as one of those functions.
So when you assume that a GPIO number can uniquely specify a pin for use in function multiplexing ... you're stressing a "nonportable" aspect of this issue.
Ditto when you assume that the multiplexing is on a per-pin basis, rather than affecting a defined group of pins. (More common, and less annoying, than the OMAP1 issue.)
(And that doesn't even touch issues like configurable drive strength, pullups, pulldowns, and so on.)
Quoted 3 lines
Imagine some
GPIO controller that can't do inputs, or outputs. First one will be still suitable forgpio_leds, second one will be suitable forgpio_keys.
The interface easily handles input-only and output-only GPIOs. Make the relevant gpio_direction_*() methods fail those requests.
Quoted 3 lines
Or... gpio_to_irq/irq_to_gpio. More than chip-specific, isn't it? Some GPIO controllers might provide interrupt sources, some might not.
Right now there isn't a generic hookup between GPIOs and IRQs; that's all very platform-specific. For example, maybe it doesn't use the genirq framework ... and even if it does, there's a huge hole where "removing irq_chip and its irqs" fits.
It's easy enough for most platforms to arrange that a particular range of GPIO numbers maps to a particular set of IRQ numbers through the IRQ chaining mechanism.
Quoted 4 lines
Or let's put it completely different way: IRQs, they are chip specific too, some of them can't do
EDGE_FALLINGorEDGE_RISING. But these flags still exists for the IRQs, and drivers use them.
Sure; though as a rule, any driver that specifies trigger modes is platform-specific when it does so. Plus, very few would know what to do when they learn that the EDGE_FALLING mode they asked for is not supported by the underlying hardware.
Quoted 2 lines
The same for GPIO pin multiplexing: some drivers aren't aware of GPIO multiplexing, but some are.
And if they are aware, that's platform-specific code. So there can be no issue in requiring use of platform-specific calls for that.
Example, when a given function can come out on either of two pins (like MMC0.CMD on some chips), and those pins vary between models of that SOC family ... the driver will either know highly nonportable details about each chip, or will punt to external code that needs to accommodate both board-specific wiring choices and chip-specific differences in ballout. (In fact, that particular situation is mostly handled by board-specific setup code, not a driver.)
Quoted 7 lines
So, down below is the proposal patch:
gpio_set_dedicated()routine.There are other options, tough. But I don't like them:
...
- Another option?
The way it's usually done: platform-specific code to handle those platform-specific pin configuration issues.
Quoted 1 line
+int
gpio_set_dedicated(unsigned gpio, int func)
It's not required that a pin/ball identifier have a one-to-one mapping to "gpio" numbers, or that all pins/balls have "gpio" as one of the possible functions. So if there were a cross-platform call like this, I'd want to see such it reference not a "gpio" but a "pin".
And for that matter, "dedicated" is inaccurate. It's not uncommon that even after setting a pin function among the N options available for that pin on that platform, it still be usable as a GPIO input.
Of course, the "function" codes are extremely chip-specific ... and some platforms would want to include things like pullups, pulldowns, and so forth as part of pin configuration.
If you want to pursue this problem, don't couple it to GPIOs.
- Dave
Quoted 11 lines
drivers/gpio/gpiolib.c +11
-0+{ +struct gpio_chip *chip; + +might_sleep_if (extra_checks); + chip =gpio_to_chip (gpio); +if (chip->set_dedicated) +return chip->set_dedicated (chip, gpio - chip->base, func); + +return -ENOSYS ; +} +EXPORT_SYMBOL_GPL (gpio_set_dedicated);
Re: [PATCH 04/11] [RFC][GPIOLIB] add gpio_set_dedicated() routine
On Sun, Feb 03, 2008 at 01:22:08PM -0800, David Brownell wrote:
[...]
Quoted 21 lines
Quoted 4 lines
One of the biggest things these conventions omit is pin multiplexing, since this is highly chip-specific and nonportable.
Let me counter: "chip-specific" is a weak argument, IMO.
Then focus on "nonportable concepts" instead. :)
Note that "pin" != "GPIO". There are platforms that let one GPIO be routed to any of several pins/balls; and let a given pin/ball be multiplexed to support any of several GPIOs. (Annoying because it's so error prone, but true. I'll call that the "OMAP1" pinmux issue, since that's where I first ran into it.)
Likewise, not all pins with multiplexed functionality include GPIO as one of those functions.
So when you assume that a GPIO number can uniquely specify a pin for use in function multiplexing ... you're stressing a "nonportable" aspect of this issue.
Quoted 6 lines
Ditto when you assume that the multiplexing is on a per-pin basis, rather than affecting a defined group of pins. (More common, and less annoying, than the OMAP1 issue.)
(And that doesn't even touch issues like configurable drive strength, pullups, pulldowns, and so on.)
This is all true, of course.
Quoted 7 lines
Quoted 4 lines
Imagine some
GPIO controller that can't do inputs, or outputs. First one will be still suitable forgpio_leds, second one will be suitable forgpio_keys.The interface easily handles input-only and output-only GPIOs. Make the relevant gpio_direction_*() methods fail those requests.
The point was: GPIOs could be "input only" but you still have "output" callback, and that doesn't troubles anybody. Not sure why set_dedicated() such a big issue then, it could fail too! :-)
We're talking about General Purpose IOs, right? They're general enough to support not only input/output stuff. And we want some API for these General Purpose IOs. GPIO LIB is the best candidate and we can implement such API at almost no cost, few lines of code.
Quoted 4 lines
Quoted 3 lines
Or... gpio_to_irq/irq_to_gpio. More than chip-specific, isn't it? Some GPIO controllers might provide interrupt sources, some might not.
Quoted 8 lines
Right now there isn't a generic hookup between GPIOs and IRQs; that's all very platform-specific. For example, maybe it doesn't use the genirq framework ... and even if it does, there's a huge hole where "removing
irq_chipand its irqs" fits.It's easy enough for most platforms to arrange that a particular range of GPIO numbers maps to a particular set of IRQ numbers through the IRQ chaining mechanism.
He-he. Actually, I have a patch that adds "to_irq" callback to GPIO LIB. :-) But I just didn't find time yet to cleanup the "user" of that addition (ARM-based "samcop" companion chip).
Briefly: gpio<->irq mapping there isn't "flat". It is messed all around. GPIO 1 is IRQ 12, GPIO 2 if IRQ 45 and so on... no common pattern. So, to support gpio_to_irq() we have to either:
1. change the mappings of the IRQs, to match GPIOs. or
2. implement to_irq() callback (way easier).
Quoted 9 lines
Quoted 4 lines
Or let's put it completely different way: IRQs, they are chip specific too, some of them can't do
EDGE_FALLINGorEDGE_RISING. But these flags still exists for the IRQs, and drivers use them.Sure; though as a rule, any driver that specifies trigger modes is platform-specific when it does so. Plus, very few would know what to do when they learn that the
EDGE_FALLINGmode they asked for is not supported by the underlying hardware.
Exactly. The question is how much "platforms" that driver could support. When driver that using EDGE_* works for >= 2 platforms, then this flag is worthwhile already.
Quoted 10 lines
Quoted 2 lines
The same for GPIO pin multiplexing: some drivers aren't aware of GPIO multiplexing, but some are.
And if they are aware, that's platform-specific code. So there can be no issue in requiring use of platform-specific calls for that.
Example, when a given function can come out on either of two pins (like MMC0.CMD on some chips), and those pins vary between models of that SOC family ... the driver will either know highly nonportable details about each chip,
No. Driver don't have to know chip details. _Platform code_ is passing these details to the driver (via platform data or OF device tree properties). Then driver is using these details absolutely blindly, without knowing their meaning.
Quoted 4 lines
or will punt to external code that needs to accommodate both board-specific wiring choices and chip-specific differences in ballout. (In fact, that particular situation is mostly handled by board-specific setup code, not a driver.)
The point is that driver needs non-static GPIO configuration. In some cases you can't just configure gpio's dedicated functions at the start-up and use it for the whole driver's lifecycle. Driver wants to switch between "pin as GPIO" and "pin as dedicated function".
I think GPIO LIB should provide this ability to do so. See below though.
Quoted 10 lines
Quoted 7 lines
So, down below is the proposal patch:
gpio_set_dedicated()routine.There are other options, tough. But I don't like them:
...
- Another option?
The way it's usually done: platform-specific code to handle those platform-specific pin configuration issues.
There is a problem. Driver could be cross-platform. For example, we have platforms with "CPM1", "CPM2" and "QE" on-chip gpio controllers.
One kernel could run on all these platforms (well, not now, but there are some plans). Mostly, they share drivers (well, actually no, but there are some plans :-), i.e. differences between CPM and QE peripherals usually minor enough to write a driver which is able to work on both.
At the same time, difference between CPM and QE gpio controllers are drastic, so we can't use "qe_set_dedicated" for both (assuming that we don't want "if (is_qe) ... else ..." scheme).
So, imagine driver X which is doing:
qe_set_dedicated(pin);
It will be tied to the "QE" platform. But if we'll do
gpio_set_dedicated(pin);
Then underlaying gpio controller would handle that call, be it CPM or QE. See? GPIO LIB is a simple dispatcher.
And despite special _set_dedicated() function, this driver actually does _use_ pins as GPIOs. And as dedicated functions. And as GPIOs. The same pins, but at the different times.
Okay. FHCI is probably not the case of the cross-platform driver, so for now we can forget about cross-platform usage. Ok, let's imagine I'll not use GPIO LIB for these "special" pins. But there are other pins, usual GPIOs. So, to use gpio api and some special qe_set_dedicated() we want them to play nicely with each other, locking e.t.c. Will you agree to export "chips" so we can write GPIO LIB "platform extensions", like
qe_set_dedicated(unsigned int value_that_we_got_from_gpio_request)
{
qe_chip = container_of(gpio_to_chip(...), struct qe_chip, chip);
spin_lock_irqsave(&qe_chip->lock, flags);
...do qe-specific work...
}?
Quoted 10 lines
Quoted 1 line
+int
gpio_set_dedicated(unsigned gpio, int func)It's not required that a pin/ball identifier have a one-to-one mapping to "gpio" numbers, or that all pins/balls have "gpio" as one of the possible functions. So if there were a cross-platform call like this, I'd want to see such it reference not a "gpio" but a "pin".
And for that matter, "dedicated" is inaccurate. It's not uncommon that even after setting a pin function among the N options available for that pin on that platform, it still be usable as a GPIO input.
Yes. But again, there are lots of cases when GPIOs are special just as IRQs being special. And we still want to use them through single interface: genirq, gpiolib.
Quoted 5 lines
Of course, the "function" codes are extremely chip-specific ... and some platforms would want to include things like pullups, pulldowns, and so forth as part of pin configuration.
If you want to pursue this problem, don't couple it to GPIOs.
Um... couple it to what then?..
Thanks,
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 04/11] [RFC][GPIOLIB] add gpio_set_dedicated() routine
Quoted 7 lines · Anton Vorontsov
On Sun, Feb 03, 2008 at 01:22:08PM -0800, David Brownell wrote:
[...]Quoted 4 lines
So when you assume that a GPIO number can uniquely specify a pin for use in function multiplexing ... you're stressing a "nonportable" aspect of this issue.
Quoted 8 lines
Quoted 6 lines
Ditto when you assume that the multiplexing is on a per-pin basis, rather than affecting a defined group of pins. (More common, and less annoying, than the OMAP1 issue.)
(And that doesn't even touch issues like configurable drive strength, pullups, pulldowns, and so on.)
This is all true, of course.
And a related truism: with at best rare exceptions, those things get set up once at board setup and don't change later. So the audience for reconfiguring pins is quite limited ... basically it'd all be for code which is already hardware-specific.
That's much less true of GPIOs. It really *is* practical to have generic GPIO based drivers for LEDs, keypad buttons, bitbanged I2C, 1-wire, SPI ... etc.
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Imagine some
GPIO controller that can't do inputs, or outputs. First one will be still suitable forgpio_leds, second one will be suitable forgpio_keys.The interface easily handles input-only and output-only GPIOs. Make the relevant gpio_direction_*() methods fail those requests.
The point was: GPIOs could be "input only" but you still have "output" callback, and that doesn't troubles anybody. Not sure why
set_dedicated()such a big issue then, it could fail too! :-)
See above: you're equating pin and gpio ... and while GPIOs have (by definition) standardized boolean input and output functionality, the rest of what can be done with a pin isn't.
Quoted 4 lines
We're talking about General Purpose IOs, right? They're general enough to support not only input/output stuff. And we want some API for these General Purpose IOs. GPIO LIB is the best candidate and we can implement such API at almost no cost, few lines of code.
GPIOs are not intended to be a kitchen sink though; and that's the sense in which you seem to mean "best candidate": it's a clean lightweight interface, not gummed up with all kinds of unrelated stuff.
Take your ideas and use them to create a pin configuration interface. On some platforms, configurable pins will map onto GPIOs, one-to-one. On others, there will be configurable pins that aren't GPIOs ... GPIOs that can be mapped to any of several pins ... pins that can be used with several GPIOs ... pins that can only be used with GPIOs ... and so on.
Quoted 11 lines
He-he. Actually, I have a patch that adds "
to_irq" callback to GPIO LIB. :-) But I just didn't find time yet to cleanup the "user" of that addition (ARM-based "samcop" companion chip).Briefly: gpio<->irq mapping there isn't "flat". It is messed all around. GPIO 1 is IRQ 12, GPIO 2 if IRQ 45 and so on... no common pattern. So, to support
gpio_to_irq()we have to either:1. change the mappings of the IRQs, to match GPIOs. or
2. implementto_irq()callback (way easier).
That seems like maybe a reasonable thing to add to gpiolib. It's fully within the current scope of the GPIO interface. Show it when you've got a cleaned up version...
And although the original notion was that those mappings cost on the order of an addition, I think that's not a big deal ... except maybe sometimes for irq_to_gpio().
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
So, down below is the proposal patch:
gpio_set_dedicated()routine.There are other options, tough. But I don't like them:
...
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
- Another option?
The way it's usually done: platform-specific code to handle those platform-specific pin configuration issues.
There is a problem. Driver could be cross-platform. For example, we have platforms with "CPM1", "CPM2" and "QE" on-chip gpio controllers.
So "platform" isn't exactly the right word. "Hardware-specific" is more to the point. You know you're using <Brand-X-SOC-27> and that means you must reconfigure <this-way> because <reason>; or likewise, <Vendor-Y-ASIC-2> must be reconfigured <that-way> etc.
Quoted 3 lines
And despite special
_set_dedicated()function, this driver actually does _use_ pins as GPIOs. And as dedicated functions. And as GPIOs. The same pins, but at the different times.
But you're assuming that GPIO identifiers can be used as pin/ball identifiers ... and as I pointed out, that's chip-specific.
Quoted 4 lines
Will you agree to export "chips" so we can write
GPIO LIB "platform extensions", like
qe_set_dedicated(unsigned int value_that_we_got_from_gpio_request)
gpio_request() returns zero-or-negative-errno. Never unsigned int. ;)
Quoted 3 lines
{
qe_chip = container_of(gpio_to_chip(...), struct qe_chip, chip);
...You know, you can write all this yourself, without needing any support from the GPIO framework whatsoever. The QE stuff that registered a gpio_chip interface to its hardware probably keeps some records itself, sufficient for such (infrequent) mappings.
Quoted 11 lines
Quoted 8 lines
Quoted 1 line
+int
gpio_set_dedicated(unsigned gpio, int func)It's not required that a pin/ball identifier have a one-to-one mapping to "gpio" numbers, or that all pins/balls have "gpio" as one of the possible functions. So if there were a cross-platform call like this, I'd want to see such it reference not a "gpio" but a "pin".
And for that matter, "dedicated" is inaccurate.
... deletia ...
Quoted 7 lines
Quoted 5 lines
Of course, the "function" codes are extremely chip-specific ... and some platforms would want to include things like pullups, pulldowns, and so forth as part of pin configuration.
If you want to pursue this problem, don't couple it to GPIOs.
Um... couple it to what then?..
An abstraction of "pin", where pins don't correspond to GPIOs in a one-to-one manner.
- dave
Re: [PATCH 04/11] [RFC][GPIOLIB] add gpio_set_dedicated() routine
On Thu, Feb 14, 2008 at 08:36:40PM -0800, David Brownell wrote:
[...]
Quoted 7 lines
Quoted 3 lines
The point was: GPIOs could be "input only" but you still have "output" callback, and that doesn't troubles anybody. Not sure why
set_dedicated()such a big issue then, it could fail too! :-)See above: you're equating pin and gpio ... and while GPIOs have (by definition) standardized boolean input and output functionality, the rest of what can be done with a pin isn't.
There is nothing much left to do with a "pin", IMO. Pin can be GPIO or abstract "dedicated function". Am I missing anything else here?
Quoted 9 lines
Quoted 4 lines
We're talking about General Purpose IOs, right? They're general enough to support not only input/output stuff. And we want some API for these General Purpose IOs. GPIO LIB is the best candidate and we can implement such API at almost no cost, few lines of code.
GPIOs are not intended to be a kitchen sink though; and that's the sense in which you seem to mean "best candidate": it's a clean lightweight interface, not gummed up with all kinds of unrelated stuff.
Just one more callback won't bloat lightweight interface... Later I'll ask to add another one, and someone will ask for another. Yes, I see the pattern. Surely, if you want to keep it clean and lightweight, you should resist to additions -- I fully understand that. :-)
Quoted 6 lines
Take your ideas and use them to create a pin configuration interface. On some platforms, configurable pins will map onto GPIOs, one-to-one. On others, there will be configurable pins that aren't GPIOs ... GPIOs that can be mapped to any of several pins ... pins that can be used with several GPIOs ... pins that can only be used with GPIOs ... and so on.
Sure, that's doable. But IMO this idea is about overcomplicating the trivial task. Let's call it pinlib, with:
1. pin_request
2. pin_configure(pin, integer-representing-configuration)
3. pin_free
Hm... 2 auxiliary functions with the full-fledged subsystem just to configure some pins? Plus count here that drivers would have to deal with the two separate subsystems. Both GPIO/Pin-providers and drivers that would use these GPIOs/Pins.
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
The way it's usually done: platform-specific code to handle those platform-specific pin configuration issues.
There is a problem. Driver could be cross-platform. For example, we have platforms with "CPM1", "CPM2" and "QE" on-chip gpio controllers.
So "platform" isn't exactly the right word. "Hardware-specific" is more to the point. You know you're using <Brand-X-SOC-27> and that means you must reconfigure <this-way> because <reason>; or likewise, <Vendor-Y-ASIC-2> must be reconfigured <that-way> etc.
<this-way> or <that-way> is passed through platform data, platform code knowns "hardware-specific" details.
Quoted 6 lines
Quoted 3 lines
And despite special
_set_dedicated()function, this driver actually does _use_ pins as GPIOs. And as dedicated functions. And as GPIOs. The same pins, but at the different times.But you're assuming that GPIO identifiers can be used as pin/ball identifiers ... and as I pointed out, that's chip-specific.
Heh. I did re-read Documentation/gpio.txt once again, and still don't get it, where are the differences between GPIOs and Pins? Yes, some pins can't be GPIOs, but any GPIO must have associated Pin (internal or external doesn't matter, it's "logical Pin").
For pins that can not be "GPIOs", we can just return errors from output/input callbacks. Is it violation of the current GPIO API conventions? Yes, but this is extension that will not break anything, neither we contradict the "GPIO" term here, btw.
Quoted 8 lines
Quoted 3 lines
{ qe_chip = container_of(gpio_to_chip(...), struct qe_chip, chip); ...You know, you can write all this yourself, without needing any support from the GPIO framework whatsoever. The QE stuff that registered a
gpio_chipinterface to its hardware probably keeps some records itself, sufficient for such (infrequent) mappings.
Yes, surely. And as I've said already, I do know how to workaround that, without GPIOLIB support. The thing is that I don't like the way I'm going to do it.
[...]
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Of course, the "function" codes are extremely chip-specific ... and some platforms would want to include things like pullups, pulldowns, and so forth as part of pin configuration.
If you want to pursue this problem, don't couple it to GPIOs.
Um... couple it to what then?..
An abstraction of "pin", where pins don't correspond to GPIOs in a one-to-one manner.
Keeping in mind that GPIOLIB was brewing a year (?), I think another GPIOLIB-alike subsystem not worth powder and shot, pins and GPIOs will be obsolete at that time. :-)
Thanks,
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 04/11] [RFC][GPIOLIB] add gpio_set_dedicated() routine
On Fri, Feb 15, 2008 at 02:40:29PM +0300, Anton Vorontsov wrote:
[...]
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
{ qe_chip = container_of(gpio_to_chip(...), struct qe_chip, chip); ...
Quoted 8 lines
Quoted 4 lines
You know, you can write all this yourself, without needing any support from the GPIO framework whatsoever. The QE stuff that registered a
gpio_chipinterface to its hardware probably keeps some records itself, sufficient for such (infrequent) mappings.Yes, surely. And as I've said already, I do know how to workaround that, without GPIOLIB support. The thing is that I don't like the way I'm going to do it.
...please, don't force me to do these dirty hacks inside the arch code, nobody will like them, I know it beforehand. ;-)
...if you so reluctant supporting dedicated functions inside the gpiolib, then nothing could be easier than exporting gpio_to_chip(), so arch code can write extensions without dirty hacks. Please?
p.s. By "dirty hacks" I mean:
a) drivers will need to fetch and store device_node in their private driver data, in _addition_ to gpio numbers;
b) which means that I'll have to introduce of_get_gpio_controller() to solely workaround gpio_to_chip() absence;
c) and all that will result in 9 * N additional lines of code to handle by the drivers, where N is the number of GPIOs we want to use:
struct drvdata {
(1) struct device_node *gpioX_controller;
drv_probe()
(2) drvdata->gpioX_controller = of_get_gpio_controller(...);
(3) if (!drvdata->gpioX_controller) {
(4) ret = -EINVAL;
(5) goto gpioX_contr_failed;
(6) }
(7) gpioX_contr_failed:
(8) of_put_gpio_controller(drvdata->gpioX_controller)
drv_remove()
{
(9) of_put_gpio_controller(drvdata->gpioX_controller)Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
PATCH 5/11 qe_lib: support for gpio_set_dedicated
In reply to Anton VorontsovSo far we just restore pre-set dedicated function of the pin. No need for anything else, so far.
--- arch/powerpc/sysdev/qe_lib/qe_io.c | 46 ++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-)
arch/powerpc/sysdev/qe_lib/qe_io.c +46 -0
@@ -225,6 +225,9 @@ struct qe_gpio_chip {/* shadowed data register to clear/set bits safely */ u32 cpdata; + +/* saved_regs used to restore dedicated functions */ +struct port_regs saved_regs; };#define to_qe_gpio_chip (x) container_of(x, struct qe_gpio_chip, mm_gc)
@@ -235,6 +238,12 @@ static void qe_gpio_save_regs(struct of_mm_gpio_chip *mm_gc)struct port_regs __iomem *regs = mm_gc->regs; qe_gc->cpdata =in_be32 (®s->cpdata); + qe_gc->saved_regs.cpdata = qe_gc->cpdata; + qe_gc->saved_regs.cpdir1 =in_be32 (®s->cpdir1); + qe_gc->saved_regs.cpdir2 =in_be32 (®s->cpdir2); + qe_gc->saved_regs.cppar1 =in_be32 (®s->cppar1); + qe_gc->saved_regs.cppar2 =in_be32 (®s->cppar2); + qe_gc->saved_regs.cpodr =in_be32 (®s->cpodr); }static int qe_gpio_get (struct gpio_chip *gc,unsigned int gpio)
@@ -301,6 +310,43 @@ static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)return 0 ; } +static int qe_gpio_set_dedicated (struct gpio_chip *gc,unsigned int gpio, +int func) +{ +struct of_mm_gpio_chip *mm_gc =to_of_mm_gpio_chip (gc); +struct qe_gpio_chip *qe_gc =to_qe_gpio_chip (mm_gc); +struct port_regs __iomem *regs = mm_gc->regs; +struct port_regs *sregs = &qe_gc->saved_regs; +unsigned long flags; +u32 mask1 =1 << (NUM_OF_PINS - (gpio +1 )); +u32 mask2 =0x3 << (NUM_OF_PINS - (gpio % (NUM_OF_PINS /2 ) +1 ) *2 ); +bool second_reg = gpio > (NUM_OF_PINS /2 ) -1 ; + +spin_lock_irqsave (&qe_gc->lock, flags); + +if (second_reg) +clrsetbits_be32 (®s->cpdir2, mask2, sregs->cpdir2 & mask2); +else +clrsetbits_be32 (®s->cpdir1, mask2, sregs->cpdir1 & mask2); + +if (second_reg) +clrsetbits_be32 (®s->cppar2, mask2, sregs->cppar2 & mask2); +else +clrsetbits_be32 (®s->cppar1, mask2, sregs->cppar1 & mask2); + +if (sregs->cpdata & mask1) + qe_gc->cpdata |= mask1; +else + qe_gc->cpdata &= ~mask1; + +out_be32 (®s->cpdata, qe_gc->cpdata); +clrsetbits_be32 (®s->cpodr, mask1, sregs->cpodr & mask1); + +spin_unlock_irqrestore (&qe_gc->lock, flags); + +return 0 ; +} +static int __init qe_add_gpiochips (void ) {int ret;
Signature · 1 line
1.5.2.2
Re: [PATCH 05/11] [POWERPC] qe_lib: support for gpio_set_dedicated
Quoted 13 lines · Anton Vorontsov
arch/powerpc/sysdev/qe_lib/qe_io.c +13
-0+static int qe_gpio_set_dedicated (struct gpio_chip *gc,unsigned int gpio, +int func) +{ +struct of_mm_gpio_chip *mm_gc =to_of_mm_gpio_chip (gc); +struct qe_gpio_chip *qe_gc =to_qe_gpio_chip (mm_gc); +struct port_regs __iomem *regs = mm_gc->regs; +struct port_regs *sregs = &qe_gc->saved_regs; +unsigned long flags; +u32 mask1 =1 << (NUM_OF_PINS - (gpio +1 )); +u32 mask2 =0x3 << (NUM_OF_PINS - (gpio % (NUM_OF_PINS /2 ) +1 ) *2 ); +bool second_reg = gpio > (NUM_OF_PINS /2 ) -1 ; + +spin_lock_irqsave (&qe_gc->lock, flags);
arch/powerpc/sysdev/qe_lib/qe_io.c static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) · line 335
Quoted 10 lines
arch/powerpc/sysdev/qe_lib/qe_io.c +10
-0+ +if (second_reg) +clrsetbits_be32 (®s->cpdir2, mask2, sregs->cpdir2 & mask2); +else +clrsetbits_be32 (®s->cpdir1, mask2, sregs->cpdir1 & mask2); + +if (second_reg) +clrsetbits_be32 (®s->cppar2, mask2, sregs->cppar2 & mask2); +else +clrsetbits_be32 (®s->cppar1, mask2, sregs->cppar1 & mask2);
You could combine these into one if-statement.
I took a quick look at all of your QE lib patches. They generally look okay, but I haven't examined them thoroughly enough to formally ACK them.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH 6/11 qe_lib: implement qe_muram_offset
In reply to Anton Vorontsovqe_muram_offset is the reverse of the qe_muram_addr.
Also, move qe_muram_addr to the qe.h header.
--- arch/powerpc/sysdev/qe_lib/qe.c | 6 ------ include/asm-powerpc/qe.h | 11 ++++++++++- 2 files changed, 10 insertions(+), 7 deletions(-)
arch/powerpc/sysdev/qe_lib/qe.c +0 -6
@@ -415,12 +415,6 @@ void qe_muram_dump(void) }EXPORT_SYMBOL (qe_muram_dump); -void *qe_muram_addr (unsigned long offset) -{ -return (void *)&qe_immr->muram[offset]; -} -EXPORT_SYMBOL (qe_muram_addr); -/* The maximum number of RISCs we support */ #define MAX_QE_RISC 2
include/asm-powerpc/qe.h +10 -1
@@ -92,7 +92,16 @@ unsigned long qe_muram_alloc(int size, int align);int qe_muram_free (unsigned long offset);unsigned long qe_muram_alloc_fixed (unsigned long offset,int size);void qe_muram_dump (void ); -void *qe_muram_addr (unsigned long offset); + +static inline void *qe_muram_addr (unsigned long offset) +{ +return (void *)&qe_immr->muram[offset]; +} + +static inline unsigned long qe_muram_offset (void *addr) +{ +return addr - (void *)qe_immr->muram; +}/* Structure that defines QE firmware binary files. *
Signature · 1 line
1.5.2.2
PATCH 7/11 qe_lib: export qe_get_brg_clk
In reply to Anton Vorontsov--- arch/powerpc/sysdev/qe_lib/qe.c | 5 +++-- include/asm-powerpc/qe.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/qe_lib/qe.c +3 -2
@@ -155,7 +155,7 @@ EXPORT_SYMBOL(qe_issue_cmd);*/ static unsigned int brg_clk =0 ; -unsigned int get_brg_clk (void ) +unsigned int qe_get_brg_clk (void ) {struct device_node *qe;unsigned int size;
@@ -180,6 +180,7 @@ unsigned int get_brg_clk(void)return brg_clk; } +EXPORT_SYMBOL (qe_get_brg_clk);/* Program the BRG to the given sampling rate and multiplier *
@@ -197,7 +198,7 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier)if ((brg <QE_BRG1 ) || (brg >QE_BRG16 ))return -EINVAL ; - divisor =get_brg_clk () / (rate * multiplier); + divisor =qe_get_brg_clk () / (rate * multiplier);if (divisor >QE_BRGC_DIVISOR_MAX +1 ) { div16 =QE_BRGC_DIV16 ;
include/asm-powerpc/qe.h +1 -0
@@ -85,6 +85,7 @@ extern int par_io_data_set(u8 port, u8 pin, u8 val);/* QE internal API */ int qe_issue_cmd (u32 cmd,u32 device,u8 mcn_protocol,u32 cmd_input);enum qe_clock qe_clock_source (const char *source); +unsigned int qe_get_brg_clk (void );int qe_setbrg (enum qe_clock brg,unsigned int rate,unsigned int multiplier);int qe_get_snum (void );void qe_put_snum (u8 snum);
Signature · 1 line
1.5.2.2
PATCH 8/11 qe_lib: implement QE GTM support
In reply to Anton VorontsovGTM stands for General-purpose Timers Module and able to generate timer{1,2,3,4} interrupts.
There are several limitations in this support:
1. Cascaded (32 bit) timers unimplemented (1-2, 3-4).
This is straightforward to implement when needed, two timers should be marked as "requested" and configured as appropriate.
2. Super-cascaded (64 bit) timers unimplemented (1-2-3-4). This is also straightforward to implement when needed, all timers should be marked as "requested" and configured as appropriate.
--- arch/powerpc/sysdev/qe_lib/Kconfig | 4 + arch/powerpc/sysdev/qe_lib/Makefile | 1 + arch/powerpc/sysdev/qe_lib/gtm.c | 204 +++++++++++++++++++++++++++++++++++ include/asm-powerpc/immap_qe.h | 7 +- include/asm-powerpc/qe.h | 22 ++++ 5 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/sysdev/qe_lib/gtm.c
arch/powerpc/sysdev/qe_lib/Kconfig +4 -0
@@ -20,3 +20,7 @@ config UCC bool default y if UCC_FAST || UCC_SLOW +config QE_GTM + bool + help + QE General-Purpose Timers Module support
arch/powerpc/sysdev/qe_lib/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_ic.o qe_io.o obj-$(CONFIG_UCC) += ucc.o obj-$(CONFIG_UCC_SLOW) += ucc_slow.o obj-$(CONFIG_UCC_FAST) += ucc_fast.o +obj-$(CONFIG_QE_GTM) += gtm.o
arch/powerpc/sysdev/qe_lib/gtm.c new file +204 -0
204 lines not on this page · raw message
include/asm-powerpc/immap_qe.h +5 -2
@@ -128,8 +128,11 @@ struct qe_timers {__be16 gtevr2;/* Timer 2 event register */ __be16 gtevr3;/* Timer 3 event register */ __be16 gtevr4;/* Timer 4 event register */ -__be16 gtps;/* Timer 1 prescale register */ -u8 res2[0x46 ]; +__be16 gtpsr1;/* Timer 1 prescale register */ +__be16 gtpsr2;/* Timer 2 prescale register */ +__be16 gtpsr3;/* Timer 3 prescale register */ +__be16 gtpsr4;/* Timer 4 prescale register */ +u8 res2[0x40 ]; } __attribute__ ((packed));/* BRG */
include/asm-powerpc/qe.h +22 -0
@@ -153,6 +153,12 @@ struct qe_firmware_info {/* Upload a firmware to the QE */ int qe_upload_firmware (const struct qe_firmware *firmware); +/* QE GTM */ +extern int qe_get_timer (int width,unsigned int *irq); +extern void qe_put_timer (int num); +extern int qe_reset_ref_timer_16 (int num,unsigned int hz,u16 ref); +extern void qe_stop_timer (int num); +/* Obtain information on the uploaded firmware */ struct qe_firmware_info *qe_get_firmware_info (void );
@@ -255,6 +261,11 @@ enum comm_dir {#define QE_CMXGCR_MII_ENET_MNG_SHIFT 12#define QE_CMXGCR_USBCS 0x0000000f +#define QE_CMXGCR_TIMERCS 0x00300000 +#define QE_CMXGCR_TIMERCS_CLK11 0x00000000 +#define QE_CMXGCR_TIMERCS_CLK12 0x00100000 +#define QE_CMXGCR_TIMERCS_BRG11 0x00300000 +/* QE CECR Commands. */ #define QE_CR_FLG 0x00010000
@@ -367,6 +378,17 @@ enum comm_dir {#define QE_GTCFR1_STP1 0x02#define QE_GTCFR1_RST1 0x01 +#define QE_GTCFR_STP (x) ((x) & 1 ? 1 << 5 : 1 << 1) +#define QE_GTCFR_RST (x) ((x) & 1 ? 1 << 4 : 1 << 0) + +#define QE_GTMDR_ICLK_MASK (3 << 1) +#define QE_GTMDR_ICLK_ICAS (0 << 1) +#define QE_GTMDR_ICLK_QERF (1 << 1) +#define QE_GTMDR_ICLK_SLGO (2 << 1) +#define QE_GTMDR_ORI (1 << 4) +#define QE_GTMDR_SPS_MASK (0xFF << 8) +#define QE_GTMDR_SPS (x) ((x) << 8) +/* SDMA registers */ #define QE_SDSR_BER1 0x02000000#define QE_SDSR_BER2 0x01000000
Signature · 1 line
1.5.2.2
Re: [PATCH 08/11] [POWERPC] qe_lib: implement QE GTM support
Quoted 10 lines · Anton Vorontsov
GTM stands for General-purpose Timers Module and able to generate timer{1,2,3,4} interrupts.
There are several limitations in this support:
1. Cascaded (32 bit) timers unimplemented (1-2, 3-4).
This is straightforward to implement when needed, two timers should be marked as "requested" and configured as appropriate.
2. Super-cascaded (64 bit) timers unimplemented (1-2-3-4). This is also straightforward to implement when needed, all timers should be marked as "requested" and configured as appropriate.
This isn't QE-specific; the same (as far as I see) timer hardware exists on, for example, mpc8313 and mpc8349.
arch/powerpc/sysdev/qe_lib/Kconfig config UCC · line 26
Quoted 4 lines
arch/powerpc/sysdev/qe_lib/Kconfig +4
-0+config QE_GTM + bool + help + QE General-Purpose Timers Module support
No bool text?
arch/powerpc/sysdev/qe_lib/gtm.c line 34
Quoted 11 lines
arch/powerpc/sysdev/qe_lib/gtm.c new file +11
-0+struct gtm_timer { +unsigned int irq; +bool requested; + +u8 __iomem *gtcfr; +u16 __iomem *gtmdr; +u16 __iomem *gtpsr; +u16 __iomem *gtcnr; +u16 __iomem *gtrfr; +u16 __iomem *gtevr; +};
__be16
arch/powerpc/sysdev/qe_lib/gtm.c line 38
Quoted 3 lines
arch/powerpc/sysdev/qe_lib/gtm.c new file +3
-0+static struct gtm_timer timers[4 ]; +static struct qe_timers __iomem *qet; +static spinlock_t gtm_lock =__SPIN_LOCK_UNLOCKED (gtm_lock);
static DEFINE_SPINLOCK(gtm_lock);
Put these in a struct so multiple timer blocks can be supported (the non-QE chips tend to have two blocks).
Quoted 1 line
+int
qe_reset_ref_timer_16(int num, unsigned int hz, u16 ref)
What does this function do? What goes in "hz" and "ref"? Is it periodic or one-shot?
-Scott
Re: [PATCH 08/11] [POWERPC] qe_lib: implement QE GTM support
Quoted 12 lines · Scott Wood
Quoted 10 lines · Anton Vorontsov
GTM stands for General-purpose Timers Module and able to generate timer{1,2,3,4} interrupts.
There are several limitations in this support:
1. Cascaded (32 bit) timers unimplemented (1-2, 3-4).
This is straightforward to implement when needed, two timers should be marked as "requested" and configured as appropriate.
2. Super-cascaded (64 bit) timers unimplemented (1-2-3-4). This is also straightforward to implement when needed, all timers should be marked as "requested" and configured as appropriate.
Quoted 2 lines
This isn't QE-specific; the same (as far as I see) timer hardware exists on, for example, mpc8313 and mpc8349.
In my endless todo list. I'll try to evolve it to support fsl gtms in general. Though the problem is that, for example, for QE USB we prefer QE timers. So, we probably want to pass timers via device tree to distinguish them.
Quoted 6 lines
arch/powerpc/sysdev/qe_lib/Kconfig config UCC · line 26
Quoted 4 lines
arch/powerpc/sysdev/qe_lib/Kconfig +4
-0+config QE_GTM + bool + help + QE General-Purpose Timers Module supportNo bool text?
No. This is silent config option.
Quoted 5 lines
Quoted 5 lines
arch/powerpc/sysdev/qe_lib/gtm.c new file +5
-0+struct gtm_timer { +unsigned int irq; +bool requested; + +u8 __iomem *gtcfr;
Quoted 8 lines
arch/powerpc/sysdev/qe_lib/gtm.c line 34
Quoted 6 lines
arch/powerpc/sysdev/qe_lib/gtm.c new file +6
-0+u16 __iomem *gtmdr; +u16 __iomem *gtpsr; +u16 __iomem *gtcnr; +u16 __iomem *gtrfr; +u16 __iomem *gtevr; +};
__be16
Will do.
Quoted 5 lines
arch/powerpc/sysdev/qe_lib/gtm.c line 38
Quoted 3 lines
arch/powerpc/sysdev/qe_lib/gtm.c new file +3
-0+static struct gtm_timer timers[4 ]; +static struct qe_timers __iomem *qet; +static spinlock_t gtm_lock =__SPIN_LOCK_UNLOCKED (gtm_lock);static
DEFINE_SPINLOCK(gtm_lock);
I'm trying to open-code as much as I could (well, not as much, but just using common sense :-), so I prefer the first variant, if you don't mind. DEFINE_SPINLOCK() and above are equivalents.
This is not something I'm going to argue about, though. Just ask one more time and I'll simply change it to DEFINE_SPINLOCK().
Quoted 2 lines
Put these in a struct so multiple timer blocks can be supported (the non-QE chips tend to have two blocks).
Yes, this is in my todo list. Btw, QE chips have three gtms, QE + 2 IMMR.
Quoted 4 lines
Quoted 1 line
+int
qe_reset_ref_timer_16(int num, unsigned int hz, u16 ref)What does this function do? What goes in "hz" and "ref"? Is it periodic or one-shot?
"ref" means that it counts to some reference value and fires the interrupt. Hz is count rate. This particular function implements "reset reference mode", timer will reset itself when reference value is reached. We probably want to add frr flag (free run). Will kernel-doc this function.
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.net/bd2
PATCH 9/11 qe_lib: add support for QE USB
In reply to Anton VorontsovI believe QE USB clocks routing is qe_lib authority, so usb.c created. Also, now cmxgcr needs its own lock.
This patch also fixes QE_USB_RESTART_TX command definition.
--- arch/powerpc/sysdev/qe_lib/Kconfig | 6 ++++ arch/powerpc/sysdev/qe_lib/Makefile | 1 + arch/powerpc/sysdev/qe_lib/ucc.c | 7 ++-- arch/powerpc/sysdev/qe_lib/usb.c | 57 +++++++++++++++++++++++++++++++++++ include/asm-powerpc/qe.h | 18 ++++++++++- 5 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/sysdev/qe_lib/usb.c
arch/powerpc/sysdev/qe_lib/Kconfig +6 -0
@@ -24,3 +24,9 @@ config QE_GTM bool help QE General-Purpose Timers Module support + +config QE_USB + bool + default y if USB_FHCI_HCD + help + QE USB Host Controller support
arch/powerpc/sysdev/qe_lib/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_UCC) += ucc.o obj-$(CONFIG_UCC_SLOW) += ucc_slow.o obj-$(CONFIG_UCC_FAST) += ucc_fast.o obj-$(CONFIG_QE_GTM) += gtm.o +obj-$(CONFIG_QE_USB) += usb.o
arch/powerpc/sysdev/qe_lib/ucc.c +4 -3
@@ -26,7 +26,8 @@#include <asm/qe.h> #include <asm/ucc.h> -static DEFINE_SPINLOCK (ucc_lock); +DEFINE_SPINLOCK (cmxgcr_lock); +EXPORT_SYMBOL (cmxgcr_lock);int ucc_set_qe_mux_mii_mng (unsigned int ucc_num) {
@@ -35,10 +36,10 @@ int ucc_set_qe_mux_mii_mng(unsigned int ucc_num)if (ucc_num >UCC_MAX_NUM -1 )return -EINVAL ; -spin_lock_irqsave (&ucc_lock, flags); +spin_lock_irqsave (&cmxgcr_lock, flags);clrsetbits_be32 (&qe_immr->qmx.cmxgcr,QE_CMXGCR_MII_ENET_MNG , ucc_num <<QE_CMXGCR_MII_ENET_MNG_SHIFT ); -spin_unlock_irqrestore (&ucc_lock, flags); +spin_unlock_irqrestore (&cmxgcr_lock, flags);return 0 ; }
arch/powerpc/sysdev/qe_lib/usb.c new file +57 -0
57 lines not on this page · raw message
include/asm-powerpc/qe.h +17 -1
@@ -16,6 +16,7 @@#define _ASM_POWERPC_QE_H#ifdef __KERNEL__ +#include <linux/spinlock.h> #include <asm/immap_qe.h> #define QE_NUM_OF_SNUM 28
@@ -74,6 +75,8 @@ enum qe_clock { QE_CLK_DUMMY }; +extern spinlock_t cmxgcr_lock; +/* Export QE common operations */ extern void qe_reset (void );extern int par_io_init (struct device_node *np);
@@ -159,6 +162,9 @@ extern void qe_put_timer(int num);extern int qe_reset_ref_timer_16 (int num,unsigned int hz,u16 ref);extern void qe_stop_timer (int num); +/* QE USB */ +int qe_usb_clock_set (enum qe_clock clk,int rate); +/* Obtain information on the uploaded firmware */ struct qe_firmware_info *qe_get_firmware_info (void );
@@ -260,6 +266,16 @@ enum comm_dir {#define QE_CMXGCR_MII_ENET_MNG 0x00007000#define QE_CMXGCR_MII_ENET_MNG_SHIFT 12#define QE_CMXGCR_USBCS 0x0000000f +#define QE_CMXGCR_USBCS_CLK3 0x1 +#define QE_CMXGCR_USBCS_CLK5 0x2 +#define QE_CMXGCR_USBCS_CLK7 0x3 +#define QE_CMXGCR_USBCS_CLK9 0x4 +#define QE_CMXGCR_USBCS_CLK13 0x5 +#define QE_CMXGCR_USBCS_CLK17 0x6 +#define QE_CMXGCR_USBCS_CLK19 0x7 +#define QE_CMXGCR_USBCS_CLK21 0x8 +#define QE_CMXGCR_USBCS_BRG9 0x9 +#define QE_CMXGCR_USBCS_BRG10 0xa#define QE_CMXGCR_TIMERCS 0x00300000#define QE_CMXGCR_TIMERCS_CLK11 0x00000000
@@ -294,7 +310,7 @@ enum comm_dir {#define QE_HPAC_START_TX 0x0000060b#define QE_HPAC_START_RX 0x0000070b#define QE_USB_STOP_TX 0x0000000a -#define QE_USB_RESTART_TX 0x0000000b +#define QE_USB_RESTART_TX 0x0000000c#define QE_QMC_STOP_TX 0x0000000c#define QE_QMC_STOP_RX 0x0000000d#define QE_SS7_SU_FIL_RESET 0x0000000e
Signature · 1 line
1.5.2.2
PATCH 10/11 mpc8360erdk: add FHCI USB support
In reply to Anton VorontsovThis consists of: usb node, gtm node and gpio-controllers of the B and E banks.
--- arch/powerpc/boot/dts/mpc836x_rdk.dts | 42 +++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/mpc836x_rdk.dts +42 -0
@@ -133,6 +133,20 @@ reg = <0x700 0x100>; }; + qe_pio_b: gpio-controller@1418 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank"; + reg = <0x1418 0x18>; + gpio-controller; + }; + + qe_pio_e: gpio-controller@1460 { + #gpio-cells = <2>; + compatible = "fsl,qe-pario-bank"; + reg = <0x1460 0x18>; + gpio-controller; + }; + qe@100000 { #address-cells = <1>; #size-cells = <1>;
@@ -156,6 +170,34 @@ "fsl,cpm-muram-data"; reg = <0 0xc000>; }; + + usb-pram@8b00 { + compatible = "fsl,qe-muram-usb-pram"; + reg = <0x8b00 0x100>; + }; + }; + + gtm@440 { + compatible = "fsl,qe-gtm"; + reg = <0x440 0x40>; + interrupts = <12 13 14 15>; + interrupt-parent = <&qeic>; + }; + + usb@6c0 { + compatible = "fsl,usb-fhci"; + reg = <0x6c0 0x40>; + interrupts = <11>; + interrupt-parent = <&qeic>; + fullspeed-clock = "clk21"; + gpios = <&qe_pio_b 2 0 /* USBOE */ + &qe_pio_b 3 0 /* USBTP */ + &qe_pio_b 8 0 /* USBTN */ + &qe_pio_b 9 0 /* USBRP */ + &qe_pio_b 11 0 /* USBRN */ + &qe_pio_e 20 0 /* SPEED */ + &qe_pio_e 21 0 /* SUSPN */>; + mode = "host"; }; spi@4c0 {
Signature · 1 line
1.5.2.2
RFC PATCH 11/11 Freescale QUICC Engine USB Host Controller
In reply to Anton Vorontsov---
Hi all,
This is RFC for the "FHCI" USB host controller driver.
My TODO list:
1. Locking completely braindead, needs fixing. I just inserted plain spin_lock()s to outline what I'm going to do. _irq and _irqsave variants will be inserted appropriately.
2. Try to get rid of -cq part of the driver and use kfifo instead;
3. Probably fix Packet-Level interface support. It was and is broken. I didn't include fhci-bds.c file in this RFC, today it's not worth looking, and weights about 60Kb additionally;
4. Make sparse happy.
Will appreciate any comments,
Thanks,
drivers/usb/Makefile | 1 + drivers/usb/host/Kconfig | 36 + drivers/usb/host/Makefile | 2 +- drivers/usb/host/fhci-bds.c | 1696 +++++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/fhci-cq.c | 105 +++ drivers/usb/host/fhci-dbg.c | 133 ++++ drivers/usb/host/fhci-hcd.c | 1391 +++++++++++++++++++++++++++++++++++ drivers/usb/host/fhci-hub.c | 343 +++++++++ drivers/usb/host/fhci-mem.c | 95 +++ drivers/usb/host/fhci-q.c | 495 +++++++++++++ drivers/usb/host/fhci-tds.c | 628 ++++++++++++++++ drivers/usb/host/fhci.h | 543 ++++++++++++++ 12 files changed, 5467 insertions(+), 1 deletions(-) create mode 100644 drivers/usb/host/fhci-bds.c 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-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_ACM) += class/ obj-$(CONFIG_USB_PRINTER) += class/
drivers/usb/host/Kconfig +36 -0
@@ -261,3 +261,39 @@ config USB_R8A66597_HCD To compile this driver as a module, choose M here: the module will be called r8a66597-hcd. +config USB_FHCI_HCD + tristate "Freescale QE USB Host Controller support" + depends on USB && GENERIC_GPIO + select QE_GTM + help + Some Freescale PowerPC processors (such as MPC8360E and + MPC8323) have a Full Speed or Low Speed QE USB Host controller. + + Say "y" to enable support for such controllers, or "m" to compile + it as a module: the module will be called fhci-hcd.ko + +config FHCI_DEBUG + bool "Freescale QE USB Host Controller debug support" + depends on USB_FHCI_HCD + select DEBUG_FS + help + Say "y" to see some FHCI debug information and statistics + throught debugfs. + +choice + prompt "FHCI interface type" + depends on USB_FHCI_HCD + default FHCI_WITH_TDS + +config FHCI_WITH_BDS + bool "Packet-Level interface (BDs)" + depends on BROKEN + help + Controller uses a packet-level interface to communicate. + +config FHCI_WITH_TDS + bool "Transaction-Level interface (TDs)" + help + Controller uses a transaction-level interface to communicate. + +endchoice
drivers/usb/host/Makefile +1 -1
@@ -16,4 +16,4 @@ obj-$(CONFIG_USB_SL811_HCD) += sl811-hcd.o 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_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 +133 -0
133 lines not on this page · raw message
drivers/usb/host/fhci-hcd.c new file +1391 -0
1,391 lines not on this page · raw message
drivers/usb/host/fhci-hub.c new file +343 -0
343 lines not on this page · raw message
drivers/usb/host/fhci-mem.c new file +95 -0
95 lines not on this page · raw message
drivers/usb/host/fhci-q.c new file +495 -0
495 lines not on this page · raw message
drivers/usb/host/fhci-tds.c new file +628 -0
387 lines not on this page · raw message
drivers/usb/host/fhci.h new file +543 -0
543 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.2.2
Part of the diff is not shown here. View the raw message.