29 Jul, 2020

1 commit

  • [ Upstream commit 69339d083dfb7786b0e0b3fc19eaddcf11fabdfb ]

    uart0_pins is defined as:
    static const unsigned uart0_pins[] = {135, 136, 137, 138, 139};

    which npins is wronly specified as 9 later
    {
    .name = "uart0",
    .pins = uart0_pins,
    .npins = 9,
    },

    npins should be 5 instead of 9 according to the definition.

    Signed-off-by: Jacky Hu
    Link: https://lore.kernel.org/r/20200616015024.287683-1-hengqing.hu@gmail.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Jacky Hu
     

01 Jul, 2020

2 commits

  • [ Upstream commit 782b6b69847f34dda330530493ea62b7de3fd06a ]

    Use noirq suspend/resume callbacks as other drivers which implement
    noirq suspend/resume callbacks (Ex:- PCIe) depend on pinctrl driver to
    configure the signals used by their respective devices in the noirq phase.

    Signed-off-by: Vidya Sagar
    Reviewed-by: Dmitry Osipenko
    Link: https://lore.kernel.org/r/20200604174935.26560-1-vidyas@nvidia.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Vidya Sagar
     
  • [ Upstream commit 5e50311556c9f409a85740e3cb4c4511e7e27da0 ]

    Fix the following warnings caused by reusage of the same irq_chip
    instance for all spmi-gpio gpio_irq_chip instances. Instead embed
    irq_chip into pmic_gpio_state struct.

    gpio gpiochip2: (c440000.qcom,spmi:pmic@2:gpio@c000): detected irqchip that is shared with multiple gpiochips: please fix the driver.
    gpio gpiochip3: (c440000.qcom,spmi:pmic@4:gpio@c000): detected irqchip that is shared with multiple gpiochips: please fix the driver.
    gpio gpiochip4: (c440000.qcom,spmi:pmic@a:gpio@c000): detected irqchip that is shared with multiple gpiochips: please fix the driver.

    Signed-off-by: Dmitry Baryshkov
    Acked-by: Manivannan Sadhasivam
    Link: https://lore.kernel.org/r/20200604002817.667160-1-dmitry.baryshkov@linaro.org
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Dmitry Baryshkov
     

24 Jun, 2020

5 commits

  • [ Upstream commit 11d8da5cabf7c6c3263ba2cd9c00260395867048 ]

    'pinctrl_unregister()' should not be called to undo
    'devm_pinctrl_register_and_init()', it is already handled by the framework.

    This simplifies the error handling paths of the probe function.
    The 'imx_free_resources()' can be removed as well.

    Fixes: a51c158bf0f7 ("pinctrl: imx: use radix trees for groups and functions")
    Signed-off-by: Christophe JAILLET
    Reviewed-by: Dong Aisheng
    Link: https://lore.kernel.org/r/20200530204955.588962-1-christophe.jaillet@wanadoo.fr
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Christophe JAILLET
     
  • [ Upstream commit 9eb728321286c4b31e964d2377fca2368526d408 ]

    When 'pinctrl_register()' has been turned into 'devm_pinctrl_register()',
    an error handling path has not been updated.

    Axe a now unneeded 'pinctrl_unregister()'.

    Fixes: e55e025d1687 ("pinctrl: imxl: Use devm_pinctrl_register() for pinctrl registration")
    Signed-off-by: Christophe JAILLET
    Link: https://lore.kernel.org/r/20200530201952.585798-1-christophe.jaillet@wanadoo.fr
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Christophe JAILLET
     
  • [ Upstream commit d7faa8ffb6be57bf8233a4b5a636d76b83c51ce7 ]

    In function rockchip_dt_node_to_map, a new_map variable is
    allocated by:

    new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map),
    GFP_KERNEL);

    This uses devres and attaches new_map to the pinctrl driver.
    This cause a leak since new_map is not released when the probed
    driver is removed. Fix it by using kcalloc to allocate new_map
    and free it in `rockchip_dt_free_map`

    Signed-off-by: Dafna Hirschfeld
    Reviewed-by: Heiko Stuebner
    Link: https://lore.kernel.org/r/20200506100903.15420-1-dafna.hirschfeld@collabora.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Dafna Hirschfeld
     
  • [ Upstream commit 4b4e8e93eccc2abc4209fe226ec89e7fbe9f3c61 ]

    The rza1l_swio_entries referred to the wrong array rza1h_swio_pins,
    which was intended to be rza1l_swio_pins. So let's fix it.

    This is detected by the following gcc warning:

    drivers/pinctrl/pinctrl-rza1.c:401:35: warning: ‘rza1l_swio_pins’
    defined but not used [-Wunused-const-variable=]
    static const struct rza1_swio_pin rza1l_swio_pins[] = {
    ^~~~~~~~~~~~~~~

    Fixes: 039bc58e73b77723 ("pinctrl: rza1: Add support for RZ/A1L")
    Reported-by: Hulk Robot
    Signed-off-by: Jason Yan
    Link: https://lore.kernel.org/r/20200417111604.19143-1-yanaijie@huawei.com
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Sasha Levin

    Jason Yan
     
  • [ Upstream commit 0b47afc65453a70bc521e251138418056f65793f ]

    This fixes a problem with using the GPIO as an interrupt on Jaguar2
    (and similar), as the register layout of the platforms with 64 GPIO's
    are pairwise, such that the original offset must be multiplied with
    the platform stride.

    Fixes: da801ab56ad8 pinctrl: ocelot: add MSCC Jaguar2 support.
    Reviewed-by: Alexandre Belloni
    Signed-off-by: Lars Povlsen
    Link: https://lore.kernel.org/r/20200513125532.24585-4-lars.povlsen@microchip.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Lars Povlsen
     

22 Jun, 2020

2 commits

  • commit f354157a7d184db430c1a564c506434e33b1bec5 upstream.

    Currently, for EINT_TYPE GPIOs, the CON and FLTCON registers
    are saved and restored over a suspend/resume cycle. However, the
    EINT_MASK registers are not.

    On S5PV210 at the very least, these registers are not retained over
    suspend, leading to the interrupts remaining masked upon resume and
    therefore no interrupts being triggered for the device. There should
    be no effect on any SoCs that do retain these registers as theoretically
    we would just be re-writing what was already there.

    Fixes: 7ccbc60cd9c2 ("pinctrl: exynos: Handle suspend/resume of GPIO EINT registers")
    Cc:
    Signed-off-by: Jonathan Bakker
    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Greg Kroah-Hartman

    Jonathan Bakker
     
  • commit b577a279914085c6b657c33e9f39ef56d96a3302 upstream.

    Commit a8be2af0218c ("pinctrl: samsung: Write external wakeup interrupt
    mask") started writing the eint wakeup mask from the pinctrl driver.
    Unfortunately, it made the assumption that the private retention data
    was always a regmap while in the case of s5pv210 it is a raw pointer
    to the clock base (as the eint wakeup mask not in the PMU as with newer
    Exynos platforms).

    Fixes: a8be2af0218c ("pinctrl: samsung: Write external wakeup interrupt mask")
    Cc:
    Signed-off-by: Jonathan Bakker
    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Greg Kroah-Hartman

    Jonathan Bakker
     

20 May, 2020

4 commits

  • [ Upstream commit 69388e15f5078c961b9e5319e22baea4c57deff1 ]

    According to Braswell NDA Specification Update (#557593),
    concurrent read accesses may result in returning 0xffffffff and write
    instructions may be dropped. We have an established format for the
    commit references, i.e.
    cdca06e4e859 ("pinctrl: baytrail: Add missing spinlock usage in
    byt_gpio_irq_handler")

    Fixes: 0bd50d719b00 ("pinctrl: cherryview: prevent concurrent access to GPIO controllers")
    Signed-off-by: Grace Kao
    Reported-by: Brian Norris
    Reviewed-by: Brian Norris
    Acked-by: Mika Westerberg
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Sasha Levin

    Grace Kao
     
  • [ Upstream commit 90bcb0c3ca0809d1ed358bfbf838df4b3d4e58e0 ]

    Fix a typo in the readl/writel accessor conversion where val is used
    instead of pol changing the behavior of the original code.

    Cc: stable@vger.kernel.org
    Fixes: 6c73698904aa pinctrl: qcom: Introduce readl/writel accessors
    Signed-off-by: Ansuel Smith
    Reviewed-by: Bjorn Andersson
    Link: https://lore.kernel.org/r/20200414003726.25347-1-ansuelsmth@gmail.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Ansuel Smith
     
  • [ Upstream commit ccd025eaddaeb99e982029446197c544252108e2 ]

    It appears that pin configuration for GPIO chip hasn't been enabled yet
    due to absence of ->set_config() callback.

    Enable it here for Intel Baytrail.

    Fixes: c501d0b149de ("pinctrl: baytrail: Add pin control operations")
    Depends-on: 2956b5d94a76 ("pinctrl / gpio: Introduce .set_config() callback for GPIO chips")
    Signed-off-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Sasha Levin

    Andy Shevchenko
     
  • [ Upstream commit 6b7275c87717652daace4c0b8131eb184c7d7516 ]

    It appears that SPT-H variant has different offset for PAD locking registers.
    Fix it here.

    Fixes: 551fa5801ef1 ("pinctrl: intel: sunrisepoint: Add Intel Sunrisepoint-H support")
    Signed-off-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Sasha Levin

    Andy Shevchenko
     

18 Mar, 2020

4 commits

  • commit aafd56fc79041bf36f97712d4b35208cbe07db90 upstream.

    kref_init starts with the reference count at 1, which will be balanced
    by the pinctrl_put in pinctrl_unregister. The additional kref_get in
    pinctrl_claim_hogs will increase this count to 2 and cause the hogs to
    not get freed when pinctrl_unregister is called.

    Fixes: 6118714275f0 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()")
    Signed-off-by: Charles Keepax
    Link: https://lore.kernel.org/r/20200228154142.13860-1-ckeepax@opensource.cirrus.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Charles Keepax
     
  • commit 4c48e549f39f8ed10cf8a0b6cb96f5eddf0391ce upstream.

    The imx SC api strongly assumes that messages are composed out of
    4-bytes words but some of our message structs have odd sizeofs.

    This produces many oopses with CONFIG_KASAN=y.

    Fix by marking with __aligned(4).

    Fixes: b96eea718bf6 ("pinctrl: fsl: add scu based pinctrl support")
    Signed-off-by: Leonard Crestez
    Link: https://lore.kernel.org/r/bd7ad5fd755739a6d8d5f4f65e03b3ca4f457bd2.1582216144.git.leonard.crestez@nxp.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Leonard Crestez
     
  • commit dc7a06b0dbbafac8623c2b7657e61362f2f479a7 upstream.

    In the gxl driver, the sdio cmd and clk pins are inverted. It has not caused
    any issue so far because devices using these pins always take both pins
    so the resulting configuration is OK.

    Fixes: 0f15f500ff2c ("pinctrl: meson: Add GXL pinctrl definitions")
    Reviewed-by: Jerome Brunet
    Signed-off-by: Nicolas Belin
    Link: https://lore.kernel.org/r/1582204512-7582-1-git-send-email-nbelin@baylibre.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Nicolas Belin
     
  • commit d62e7fbea4951c124a24176da0c7bf3003ec53d4 upstream.

    Add the missing semicolon after of_node_put to get the file compiled.

    Fixes: f17d2f54d36d ("pinctrl: falcon: Add of_node_put() before return")
    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Mathias Kresin
    Link: https://lore.kernel.org/r/20200305182245.9636-1-dev@kresin.me
    Acked-by: Thomas Langer
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Mathias Kresin
     

24 Feb, 2020

3 commits

  • [ Upstream commit 02aeb2f21530c98fc3ca51028eda742a3fafbd9f ]

    pinmux_func_gpios[] contains a hole due to the missing function GPIO
    definition for the "CTX0&CTX1" signal, which is the logical "AND" of the
    first two CAN outputs.

    A closer look reveals other issues:
    - Some functionality is available on alternative pins, but the
    PINMUX_DATA() entries is using the wrong marks,
    - Several configurations are missing.

    Fix this by:
    - Renaming CTX0CTX1CTX2_MARK, CRX0CRX1_PJ22_MARK, and
    CRX0CRX1CRX2_PJ20_MARK to CTX0_CTX1_CTX2_MARK, CRX0_CRX1_PJ22_MARK,
    resp. CRX0_CRX1_CRX2_PJ20_MARK for consistency with the
    corresponding enum IDs,
    - Adding all missing enum IDs and marks,
    - Use the right (*_PJ2x) variants for alternative pins,
    - Adding all missing configurations to pinmux_data[],
    - Adding all missing function GPIO definitions to pinmux_func_gpios[].

    See SH7268 Group, SH7269 Group User’s Manual: Hardware, Rev. 2.00:
    [1] Table 1.4 List of Pins
    [2] Figure 23.29 Connection Example when Using Channels 0 and 1 as One
    Channel (64 Mailboxes × 1 Channel) and Channel 2 as One Channel
    (32 Mailboxes × 1 Channel),
    [3] Figure 23.30 Connection Example when Using Channels 0, 1, and 2 as
    One Channel (96 Mailboxes × 1 Channel),
    [4] Table 48.3 Multiplexed Pins (Port B),
    [5] Table 48.4 Multiplexed Pins (Port C),
    [6] Table 48.10 Multiplexed Pins (Port J),
    [7] Section 48.2.4 Port B Control Registers 0 to 5 (PBCR0 to PBCR5).

    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20191218194812.12741-5-geert+renesas@glider.be
    Signed-off-by: Sasha Levin

    Geert Uytterhoeven
     
  • [ Upstream commit a23680594da7a9e2696dbcf4f023e9273e2fa40b ]

    Suspending Goodix touchscreens requires changing the interrupt pin to
    output before sending them a power-down command. Followed by wiggling
    the interrupt pin to wake the device up, after which it is put back
    in input mode.

    On Bay Trail devices with a Goodix touchscreen direct-irq mode is used
    in combination with listing the pin as a normal GpioIo resource.

    This works fine, until the goodix driver gets rmmod-ed and then insmod-ed
    again. In this case byt_gpio_disable_free() calls
    byt_gpio_clear_triggering() which clears the IRQ flags and after that the
    (direct) IRQ no longer triggers.

    This commit fixes this by adding a check for the BYT_DIRECT_IRQ_EN flag
    to byt_gpio_clear_triggering().

    Note that byt_gpio_clear_triggering() only gets called from
    byt_gpio_disable_free() for direct-irq enabled pins, as these are excluded
    from the irq_valid mask by byt_init_irq_valid_mask().

    Signed-off-by: Hans de Goede
    Acked-by: Mika Westerberg
    Reviewed-by: Linus Walleij
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Sasha Levin

    Hans de Goede
     
  • [ Upstream commit 55b1cb1f03ad5eea39897d0c74035e02deddcff2 ]

    pinmux_func_gpios[] contains a hole due to the missing function GPIO
    definition for the "CTX0&CTX1" signal, which is the logical "AND" of the
    two CAN outputs.

    Fix this by:
    - Renaming CRX0_CRX1_MARK to CTX0_CTX1_MARK, as PJ2MD[2:0]=010
    configures the combined "CTX0&CTX1" output signal,
    - Renaming CRX0X1_MARK to CRX0_CRX1_MARK, as PJ3MD[1:0]=10 configures
    the shared "CRX0/CRX1" input signal, which is fed to both CAN
    inputs,
    - Adding the missing function GPIO definition for "CTX0&CTX1" to
    pinmux_func_gpios[],
    - Moving all CAN enums next to each other.

    See SH7262 Group, SH7264 Group User's Manual: Hardware, Rev. 4.00:
    [1] Figure 1.2 (3) (Pin Assignment for the SH7264 Group (1-Mbyte
    Version),
    [2] Figure 1.2 (4) Pin Assignment for the SH7264 Group (640-Kbyte
    Version,
    [3] Table 1.4 List of Pins,
    [4] Figure 20.29 Connection Example when Using This Module as 1-Channel
    Module (64 Mailboxes x 1 Channel),
    [5] Table 32.10 Multiplexed Pins (Port J),
    [6] Section 32.2.30 (3) Port J Control Register 0 (PJCR0).

    Note that the last 2 disagree about PJ2MD[2:0], which is probably the
    root cause of this bug. But considering [4], "CTx0&CTx1" in [5] must
    be correct, and "CRx0&CRx1" in [6] must be wrong.

    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20191218194812.12741-4-geert+renesas@glider.be
    Signed-off-by: Sasha Levin

    Geert Uytterhoeven
     

15 Feb, 2020

2 commits

  • commit 805f635703b2562b5ddd822c62fc9124087e5dd5 upstream.

    The FN_SDSELF_B and FN_SD1_CLK_B enum IDs are used twice, which means
    one set of users must be wrong. Replace them by the correct enum IDs.

    Fixes: 87f8c988636db0d4 ("sh-pfc: Add r8a7778 pinmux support")
    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20191218194812.12741-2-geert+renesas@glider.be
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • commit a34cd9dfd03fa9ec380405969f1d638bc63b8d63 upstream.

    R-Car Gen3 Hardware Manual Errata for Rev. 2.00 of October 24, 2019
    changed the configuration bits for drive and bias control for the
    DU_DOTCLKIN3 pin on R-Car M3-N, to match the same pin on R-Car H3.
    Update the driver to reflect this.

    After this, the handling of drive and bias control for the various
    DU_DOTCLKINx pins is consistent across all of the R-Car H3, M3-W,
    M3-W+, and M3-N SoCs.

    Fixes: 86c045c2e4201e94 ("pinctrl: sh-pfc: r8a77965: Replace DU_DOTCLKIN2 by DU_DOTCLKIN3")
    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20191113101653.28428-1-geert+renesas@glider.be
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     

29 Jan, 2020

1 commit

  • commit 9608ea6c6613ced75b2c41703d99f44e6f8849f1 upstream.

    Commit 179e5a6114cc ("pinctrl: intel: Remove default Interrupt Status
    offset") removes default interrupt status offset of GPIO controllers,
    with previous commits explicitly providing the previously default
    offsets. However, the is_offset value in SPTH_COMMUNITY is missing,
    preventing related irq from being properly detected and handled.

    Fixes: f702e0b93cdb ("pinctrl: sunrisepoint: Provide Interrupt Status register offset")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=205745
    Cc: stable@vger.kernel.org
    Signed-off-by: Boyan Ding
    Acked-by: Mika Westerberg
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Greg Kroah-Hartman

    Boyan Ding
     

18 Jan, 2020

6 commits

  • commit e66ff71fd0dba36a53f91f39e4da6c7b84764f2e upstream.

    Version 1.1v6 of pin list has some changes in pin names for Intel Lewisburg.

    Update the driver accordingly.

    Note, it reveals the bug in the driver that misses two pins in GPP_L and
    has rather two extra ones. That's why the ordering of some groups is changed.

    Fixes: e480b745386e ("pinctrl: intel: Add Intel Lewisburg GPIO support")
    Signed-off-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20191120133739.54332-1-andriy.shevchenko@linux.intel.com
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     
  • commit ad7fe1a1a35994a201497443b5140bf54b074cca upstream.

    As platform_get_irq() now prints an error when the interrupt does not
    exist, counting interrupts by looping until failure causes the printing
    of scary messages like:

    sh-pfc e6060000.pin-controller: IRQ index 0 not found

    Fix this by using the platform_irq_count() helper instead.

    Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Yoshihiro Shimoda
    Reviewed-by: Stephen Boyd
    Reviewed-by: Niklas Söderlund
    Tested-by: Yoshihiro Shimoda
    Link: https://lore.kernel.org/r/20191016142601.28255-1-geert+renesas@glider.be
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • commit d30710b8cce3a581c170d69002e311cc18ed47d3 upstream.

    This patch allows PINMUX_IPSR_PHYS() to set bits in GPSR.
    When assigning function to pin, GPSR should be set to peripheral
    function.
    For example when using SCL3, GPSR2 bit7 (PWM1_A pin) should be set to
    peripheral function.

    Signed-off-by: Keiya Nobuta
    Link: https://lore.kernel.org/r/20191008060112.29819-1-nobuta.keiya@fujitsu.com
    Fixes: 50d1ba1764b3e00a ("pinctrl: sh-pfc: Add physical pin multiplexing helper macros")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Greg Kroah-Hartman

    Keiya Nobuta
     
  • commit 5ff8aca906f3a7a7db79fad92f2a4401107ef50d upstream.

    The call to pinctrl_count_index_with_args checks for a -EINVAL return
    however this function calls pinctrl_get_list_and_count and this can
    return -ENOENT. Rather than check for a specific error, fix this by
    checking for any error return to catch the -ENOENT case.

    Addresses-Coverity: ("Improper use of negative")
    Fixes: 003910ebc83b ("pinctrl: Introduce TI IOdelay configuration driver")
    Signed-off-by: Colin Ian King
    Link: https://lore.kernel.org/r/20190920122030.14340-1-colin.king@canonical.com
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     
  • commit 35c60be220572de7d6605c4318f640d133982040 upstream.

    In meson_pinconf_get_drive_strength, variable bit is calculated by
    meson_calc_reg_and_bit, this value is the offset from the first pin of a
    certain bank to current pin, while Meson SoCs use two bits for each pin
    to depict drive-strength. So a left shift by 1 should be done or node
    pinconf-pins shows wrong message.

    Fixes: 6ea3e3bbef37 ("pinctrl: meson: add support of drive-strength-microamp")

    Signed-off-by: Qianggui Song
    Link: https://lore.kernel.org/r/20191226023734.9631-1-qianggui.song@amlogic.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Qianggui Song
     
  • commit f7e36e18946b4ec756b9c5cf4fb8891be8d1e4a3 upstream.

    In a rare randconfig build I came across one configuration that does
    not enable CONFIG_GPIOLIB, which is needed by lochnagar:

    ERROR: "devm_gpiochip_add_data" [drivers/pinctrl/cirrus/pinctrl-lochnagar.ko] undefined!
    ERROR: "gpiochip_generic_free" [drivers/pinctrl/cirrus/pinctrl-lochnagar.ko] undefined!
    ERROR: "gpiochip_generic_request" [drivers/pinctrl/cirrus/pinctrl-lochnagar.ko] undefined!
    ERROR: "gpiochip_get_data" [drivers/pinctrl/cirrus/pinctrl-lochnagar.ko] undefined!

    Add another 'select' like all other pinctrl drivers have.

    Fixes: 0548448b719a ("pinctrl: lochnagar: Add support for the Cirrus Logic Lochnagar")
    Signed-off-by: Arnd Bergmann
    Link: https://lore.kernel.org/r/20191218163701.171914-1-arnd@arndb.de
    Acked-by: Charles Keepax
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     

12 Jan, 2020

2 commits

  • [ Upstream commit 6ba2fd391ac58c1a26874f10c3054a1ea4aca2d0 ]

    This commit adds a check on ops pointer to avoid a kernel panic when
    ops->strict is used. Indeed, on some pinctrl driver (at least for
    pinctrl-stmfx) the pinmux ops is not implemented. Let's assume than gpio
    can be used in this case.

    Fixes: 472a61e777fe ("pinctrl/gpio: Take MUX usage into account")
    Signed-off-by: Alexandre Torgue
    Link: https://lore.kernel.org/r/20191204144106.10876-1-alexandre.torgue@st.com
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Alexandre Torgue
     
  • [ Upstream commit eb45f2110b036e4e35d3f3aaee1c2ccf49d92425 ]

    Early revisions of the AST2600 datasheet are conflicted about the state
    of the LPC/eSPI strapping bit (SCU510[6]). Conversations with ASPEED
    determined that the reference pinmux configuration tables were in error
    and the SCU documentation contained the correct configuration. Update
    the driver to reflect the state described in the SCU documentation.

    Fixes: 2eda1cdec49f ("pinctrl: aspeed: Add AST2600 pinmux support")
    Signed-off-by: Andrew Jeffery
    Link: https://lore.kernel.org/r/20191202050110.15340-1-andrew@aj.id.au
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Andrew Jeffery
     

31 Dec, 2019

7 commits

  • commit 40ecab551232972a39cdd8b6f17ede54a3fdb296 upstream.

    Commit 39ce8150a079 ("pinctrl: baytrail: Serialize all register access")
    added a spinlock around all register accesses because:

    "There is a hardware issue in Intel Baytrail where concurrent GPIO register
    access might result reads of 0xffffffff and writes might get dropped
    completely."

    Testing has shown that this does not catch all cases, there are still
    2 problems remaining

    1) The original fix uses a spinlock per byt_gpio device / struct,
    additional testing has shown that this is not sufficient concurent
    accesses to 2 different GPIO banks also suffer from the same problem.

    This commit fixes this by moving to a single global lock.

    2) The original fix did not add a lock around the register accesses in
    the suspend/resume handling.

    Since pinctrl-baytrail.c is using normal suspend/resume handlers,
    interrupts are still enabled during suspend/resume handling. Nothing
    should be using the GPIOs when they are being taken down, _but_ the
    GPIOs themselves may still cause interrupts, which are likely to
    use (read) the triggering GPIO. So we need to protect against
    concurrent GPIO register accesses in the suspend/resume handlers too.

    This commit fixes this by adding the missing spin_lock / unlock calls.

    The 2 fixes together fix the Acer Switch 10 SW5-012 getting completely
    confused after a suspend resume. The DSDT for this device has a bug
    in its _LID method which reprograms the home and power button trigger-
    flags requesting both high and low _level_ interrupts so the IRQs for
    these 2 GPIOs continuously fire. This combined with the saving of
    registers during suspend, triggers concurrent GPIO register accesses
    resulting in saving 0xffffffff as pconf0 value during suspend and then
    when restoring this on resume the pinmux settings get all messed up,
    resulting in various I2C busses being stuck, the wifi no longer working
    and often the tablet simply not coming out of suspend at all.

    Cc: stable@vger.kernel.org
    Fixes: 39ce8150a079 ("pinctrl: baytrail: Serialize all register access")
    Signed-off-by: Hans de Goede
    Acked-by: Mika Westerberg
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • [ Upstream commit 10ff58aa3c2e2a093b6ad615a7e3d8bb0dc613e5 ]

    The regs pointer in amd_gpio_irq_handler() should have __iomem
    on it, so add that to fix the following sparse warnings:

    drivers/pinctrl/pinctrl-amd.c:555:14: warning: incorrect type in assignment (different address spaces)
    drivers/pinctrl/pinctrl-amd.c:555:14: expected unsigned int [usertype] *regs
    drivers/pinctrl/pinctrl-amd.c:555:14: got void [noderef] *base
    drivers/pinctrl/pinctrl-amd.c:563:34: warning: incorrect type in argument 1 (different address spaces)
    drivers/pinctrl/pinctrl-amd.c:563:34: expected void const volatile [noderef] *addr
    drivers/pinctrl/pinctrl-amd.c:563:34: got unsigned int [usertype] *
    drivers/pinctrl/pinctrl-amd.c:580:34: warning: incorrect type in argument 1 (different address spaces)
    drivers/pinctrl/pinctrl-amd.c:580:34: expected void const volatile [noderef] *addr
    drivers/pinctrl/pinctrl-amd.c:580:34: got unsigned int [usertype] *
    drivers/pinctrl/pinctrl-amd.c:587:25: warning: incorrect type in argument 2 (different address spaces)
    drivers/pinctrl/pinctrl-amd.c:587:25: expected void volatile [noderef] *addr
    drivers/pinctrl/pinctrl-amd.c:587:25: got unsigned int [usertype] *

    Signed-off-by: Ben Dooks (Codethink)
    Link: https://lore.kernel.org/r/20191022151154.5986-1-ben.dooks@codethink.co.uk
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Ben Dooks (Codethink)
     
  • [ Upstream commit 81898a44f288607cb3b11a42aed6efb646891c19 ]

    The SDC_QDSD_PINGROUP/UFS_RESET macros are missing the .tile info needed to
    calculate the right register offsets. Adding them here and also
    adjusting the offsets accordingly.

    Fixes: f2ae04c45b1a ("pinctrl: qcom: Add SC7180 pinctrl driver")

    Reported-by: Veerabhadrarao Badiganti
    Signed-off-by: Rajendra Nayak
    Link: https://lore.kernel.org/r/20191021141507.24066-1-rnayak@codeaurora.org
    Reviewed-by: Bjorn Andersson
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Rajendra Nayak
     
  • [ Upstream commit 884caadad128efad8e00c1cdc3177bc8912ee8ec ]

    The definitions for bit field [19:18] of the Peripheral Function Select
    Register 3 were accidentally copied from bit field [20], leading to
    duplicates for the TCLK1_B function, and missing TCLK0, CAN_CLK_B, and
    ET0_ETXD4 functions.

    Fix this by adding the missing GPIO_FN_CAN_CLK_B and GPIO_FN_ET0_ETXD4
    enum values, and correcting the functions.

    Reported-by: Ben Dooks
    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20191024131308.16659-1-geert+renesas@glider.be
    Signed-off-by: Sasha Levin

    Geert Uytterhoeven
     
  • [ Upstream commit be4c60b563edee3712d392aaeb0943a768df7023 ]

    When populating the pinctrl mapping table entries for a device, the
    'dev_name' field for each entry is initialised to point directly at the
    string returned by 'dev_name()' for the device and subsequently used by
    'create_pinctrl()' when looking up the mappings for the device being
    probed.

    This is unreliable in the presence of calls to 'dev_set_name()', which may
    reallocate the device name string leaving the pinctrl mappings with a
    dangling reference. This then leads to a use-after-free every time the
    name is dereferenced by a device probe:

    | BUG: KASAN: invalid-access in strcmp+0x20/0x64
    | Read of size 1 at addr 13ffffc153494b00 by task modprobe/590
    | Pointer tag: [13], memory tag: [fe]
    |
    | Call trace:
    | __kasan_report+0x16c/0x1dc
    | kasan_report+0x10/0x18
    | check_memory_region
    | __hwasan_load1_noabort+0x4c/0x54
    | strcmp+0x20/0x64
    | create_pinctrl+0x18c/0x7f4
    | pinctrl_get+0x90/0x114
    | devm_pinctrl_get+0x44/0x98
    | pinctrl_bind_pins+0x5c/0x450
    | really_probe+0x1c8/0x9a4
    | driver_probe_device+0x120/0x1d8

    Follow the example of sysfs, and duplicate the device name string before
    stashing it away in the pinctrl mapping entries.

    Cc: Linus Walleij
    Reported-by: Elena Petrova
    Tested-by: Elena Petrova
    Signed-off-by: Will Deacon
    Link: https://lore.kernel.org/r/20191002124206.22928-1-will@kernel.org
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Will Deacon
     
  • [ Upstream commit 7666dfd533d4c55733037775d47a8e3551b341a2 ]

    This reverts commit e167d723e1a472d252e5c4baf823b77ce5543b05.

    According to the R-Car Gen3 Hardware Manual Errata for Rev 1.00 of Aug
    24, 2018, the SEL_SIMCARD_{0,1} definition was to be deleted. However,
    this errata merely fixed an accidental double definition in the Hardware
    User's Manual Rev. 1.00. The real definition is still present in later
    revisions of the manual (Rev. 1.50 and Rev. 2.00).

    Hence revert the commit to recover the definition.

    Based on a patch in the BSP by Takeshi Kihara
    .

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Simon Horman
    Link: https://lore.kernel.org/r/20190904121658.2617-4-geert+renesas@glider.be
    Signed-off-by: Sasha Levin

    Geert Uytterhoeven
     
  • [ Upstream commit 3672bc7093434621c83299ef27ea3b3225a67600 ]

    This reverts commit e87882eb9be10b2b9e28156922c2a47d877f5db4.

    According to the R-Car Gen3 Hardware Manual Errata for Rev 1.00 of Aug
    24, 2018, the SEL_SSI2_{0,1} definition was to be deleted. However,
    this errata merely fixed an accidental double definition in the Hardware
    User's Manual Rev. 1.00. The real definition is still present in later
    revisions of the manual (Rev. 1.50 and Rev. 2.00).

    Hence revert the commit to recover the definition.

    Based on a patch in the BSP by Takeshi Kihara
    .

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Simon Horman
    Link: https://lore.kernel.org/r/20190904121658.2617-3-geert+renesas@glider.be
    Signed-off-by: Sasha Levin

    Geert Uytterhoeven
     

18 Dec, 2019

1 commit

  • commit 7f028caadf6c37580d0f59c6c094ed09afc04062 upstream.

    In s3c64xx_eint_eint0_init() the for_each_child_of_node() loop is used
    with a break to find a matching child node. Although each iteration of
    for_each_child_of_node puts the previous node, but early exit from loop
    misses it. This leads to leak of device node.

    Cc:
    Fixes: 61dd72613177 ("pinctrl: Add pinctrl-s3c64xx driver")
    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Greg Kroah-Hartman

    Krzysztof Kozlowski