21 Jun, 2016

1 commit


11 May, 2016

1 commit

  • Currrently the gpio_chip.to_irq() callback returns -ENOSYS on error,
    which causes bad interactions with the serial_mctrl_gpio helpers.

    mctrl_gpio_init() returns -ENOSYS if GPIOLIB is not enabled, which is
    intended to be ignored by its callers. However, ignoring -ENOSYS when it
    was caused by a gpiod_to_irq() failure will lead to a crash later:

    Unable to handle kernel paging request at virtual address ffffffde
    ...
    PC is at mctrl_gpio_set+0x14/0x78

    Fix this by returning zero instead, like gpiochip_to_irq() does.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     

05 Jan, 2016

1 commit


19 Nov, 2015

1 commit

  • The name .dev in a struct is normally reserved for a struct device
    that is let us say a superclass to the thing described by the struct.
    struct gpio_chip stands out by confusingly using a struct device *dev
    to point to the parent device (such as a platform_device) that
    represents the hardware. As we want to give gpio_chip:s real devices,
    this is not working. We need to rename this member to parent.

    This was done by two coccinelle scripts, I guess it is possible to
    combine them into one, but I don't know such stuff. They look like
    this:

    @@
    struct gpio_chip *var;
    @@
    -var->dev
    +var->parent

    and:

    @@
    struct gpio_chip var;
    @@
    -var.dev
    +var.parent

    and:

    @@
    struct bgpio_chip *var;
    @@
    -var->gc.dev
    +var->gc.parent

    Plus a few instances of bgpio that I couldn't figure out how
    to teach Coccinelle to rewrite.

    This patch hits all over the place, but I *strongly* prefer this
    solution to any piecemal approaches that just exercise patch
    mechanics all over the place. It mainly hits drivers/gpio and
    drivers/pinctrl which is my own backyard anyway.

    Cc: Haavard Skinnemoen
    Cc: Rafał Miłecki
    Cc: Richard Purdie
    Cc: Mauro Carvalho Chehab
    Cc: Alek Du
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Acked-by: Dmitry Torokhov
    Acked-by: Greg Kroah-Hartman
    Acked-by: Lee Jones
    Acked-by: Jiri Kosina
    Acked-by: Hans-Christian Egtvedt
    Acked-by: Jacek Anaszewski
    Signed-off-by: Linus Walleij

    Linus Walleij
     

02 Oct, 2015

5 commits


18 Mar, 2015

4 commits

  • Currently all PFC registers lie in low 32-bit address space. Hence use
    u32 instead of unsigned long to store PFC register addresses in pinctrl
    tables. All calculations of virtual addresses use a phys_addr_t
    intermediate, so we know where to add an offset if the 32-bit assumption
    ever becomes false.

    While this doesn't impact 32-bit builds, it would save ca. 7 KiB on a
    64-bit shmobile_defconfig kernel.

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Laurent Pinchart
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     
  • All other loops over sh_pfc_soc_info.data_regs[] use
    pinmux_data_reg.regwidth as the sentinel, which is safer as zero is
    never a valid regwidth value (reg could be zero if we start using it to
    store an offset).

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Laurent Pinchart
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     
  • As register and field widths and offsets are in the range 1..32, use
    unsigned int (mostly replacing unsigned long) to store them in local
    variables and for passing them around.

    Move to one variable per line, move variables to the beginning of the
    block where they are used, and drop superfluous initializations while we
    are at it.

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Laurent Pinchart
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     
  • As PFC registers are either 8, 16, or 32 bits wide, use u32 (mostly
    replacing unsigned long) to store (parts of) register values and masks.

    Switch the shadow register operations from {set,clear}_bit() to plain C
    bit operations, as the former can operate on long data only.

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Laurent Pinchart
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     

22 Jul, 2014

1 commit


20 Dec, 2013

1 commit


13 Dec, 2013

4 commits

  • On non-DT platforms IRQ controllers associated with the GPIOs have a
    fixed IRQ base value known at compile time. The sh-pfc driver translates
    GPIO number to IRQ numbers using a hardcoded table. This mechanism
    breaks on DT platforms, as the IRQ base values are dynamic in that case.

    Fix this by specifying IRQs associated with GPIOs in IRQ resources,
    populated automatically from the device tree. When IRQ resources are
    specified the driver requires one IRQ resource per GPIO able to generate
    an interrupt, and uses the translation table to compute the IRQ resource
    offset instead of the IRQ number.

    Cc: devicetree@vger.kernel.org
    Signed-off-by: Laurent Pinchart
    Acked-by: Magnus Damm
    Signed-off-by: Linus Walleij

    Laurent Pinchart
     
  • There's more than one window, name the field windows.

    Signed-off-by: Laurent Pinchart
    Acked-by: Magnus Damm
    Signed-off-by: Linus Walleij

    Laurent Pinchart
     
  • 0 is a valid GPIO value, use -1 to terminate the gpios array in IRQ
    lists.

    Signed-off-by: Laurent Pinchart
    Acked-by: Magnus Damm
    Signed-off-by: Linus Walleij

    Laurent Pinchart
     
  • Some indices take positive values only, make them unsigned.

    Signed-off-by: Laurent Pinchart
    Acked-by: Magnus Damm
    Signed-off-by: Linus Walleij

    Laurent Pinchart
     

29 Jul, 2013

5 commits


03 Apr, 2013

3 commits

  • Boards/platforms that register dedicated GPIO devices will not supply a
    memory resource for GPIOs. Try to locate the GPIO memory resource at
    initialization time, and skip registration of the gpiochip if the
    resource can't be found.

    This is a temporary modification to ease the transition to separate GPIO
    drivers. It should be reverted when all boards and platforms will have
    been moved.

    Signed-off-by: Laurent Pinchart
    Acked-by: Linus Walleij
    Signed-off-by: Simon Horman

    Laurent Pinchart
     
  • When implemented as a separate IP block, GPIOs should be handled by a
    separate driver. To make this possible GPIO support needs to be optional
    in the sh-pfc driver.

    If no GPIO data registers are supplied in the SoC information structure
    skip registration of the gpiochip.

    Signed-off-by: Laurent Pinchart
    Acked-by: Linus Walleij
    Signed-off-by: Simon Horman

    Laurent Pinchart
     
  • The target is to get rid of function GPIOs completely. To reach this,
    make function GPIOs support optional by skipping the function GPIO chip
    registration if no function GPIOS are defined in SoC data.

    Signed-off-by: Laurent Pinchart
    Acked-by: Linus Walleij
    Signed-off-by: Simon Horman

    Laurent Pinchart
     

15 Mar, 2013

13 commits