25 Oct, 2020

1 commit

  • Pull ARM SoC-related driver updates from Olof Johansson:
    "Various driver updates for platforms. A bulk of this is smaller fixes
    or cleanups, but some of the new material this time around is:

    - Support for Nvidia Tegra234 SoC

    - Ring accelerator support for TI AM65x

    - PRUSS driver for TI platforms

    - Renesas support for R-Car V3U SoC

    - Reset support for Cortex-M4 processor on i.MX8MQ

    There are also new socinfo entries for a handful of different SoCs and
    platforms"

    * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (131 commits)
    drm/mediatek: reduce clear event
    soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api
    soc: mediatek: cmdq: add jump function
    soc: mediatek: cmdq: add write_s_mask value function
    soc: mediatek: cmdq: add write_s value function
    soc: mediatek: cmdq: add read_s function
    soc: mediatek: cmdq: add write_s_mask function
    soc: mediatek: cmdq: add write_s function
    soc: mediatek: cmdq: add address shift in jump
    soc: mediatek: mtk-infracfg: Fix kerneldoc
    soc: amlogic: pm-domains: use always-on flag
    reset: sti: reset-syscfg: fix struct description warnings
    reset: imx7: add the cm4 reset for i.MX8MQ
    dt-bindings: reset: imx8mq: add m4 reset
    reset: Fix and extend kerneldoc
    reset: reset-zynqmp: Added support for Versal platform
    dt-bindings: reset: Updated binding for Versal reset driver
    reset: imx7: Support module build
    soc: fsl: qe: Remove unnessesary check in ucc_set_tdm_rxtx_clk
    soc: fsl: qman: convert to use be32_add_cpu()
    ...

    Linus Torvalds
     

17 Oct, 2020

1 commit

  • If the txdone is done by polling, it is possible for msg_submit() to start
    the timer while txdone_hrtimer() callback is running. If the timer needs
    recheduling, it could already be enqueued by the time hrtimer_forward_now()
    is called, leading hrtimer to loudly complain.

    WARNING: CPU: 3 PID: 74 at kernel/time/hrtimer.c:932 hrtimer_forward+0xc4/0x110
    CPU: 3 PID: 74 Comm: kworker/u8:1 Not tainted 5.9.0-rc2-00236-gd3520067d01c-dirty #5
    Hardware name: Libre Computer AML-S805X-AC (DT)
    Workqueue: events_freezable_power_ thermal_zone_device_check
    pstate: 20000085 (nzCv daIf -PAN -UAO BTYPE=--)
    pc : hrtimer_forward+0xc4/0x110
    lr : txdone_hrtimer+0xf8/0x118
    [...]

    This can be fixed by not starting the timer from the callback path. Which
    requires the timer reloading as long as any message is queued on the
    channel, and not just when current tx is not done yet.

    Fixes: 0cc67945ea59 ("mailbox: switch to hrtimer for tx_complete polling")
    Reported-by: Da Xue
    Reviewed-by: Sudeep Holla
    Tested-by: Sudeep Holla
    Acked-by: Jerome Brunet
    Tested-by: Jerome Brunet
    Signed-off-by: Jassi Brar

    Jassi Brar
     

13 Oct, 2020

4 commits

  • platform_get_irq() returns -ERRNO on error. In such case casting to u32
    and comparing to 0 would pass the check.

    Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")
    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Jassi Brar

    Krzysztof Kozlowski
     
  • The MHU drives the signal using a 32-bit register, with all 32 bits
    logically ORed together. The MHU provides a set of registers to enable
    software to set, clear, and check the status of each of the bits of this
    register independently. The use of 32 bits for each interrupt line
    enables software to provide more information about the source of the
    interrupt. For example, each bit of the register can be associated with
    a type of event that can contribute to raising the interrupt.

    This patch adds a separate the MHU controller driver for doorbel mode
    of operation using the extended DT binding to add support the same.

    Signed-off-by: Sudeep Holla
    Signed-off-by: Jassi Brar

    Sudeep Holla
     
  • Since we will be soon adding a separate driver based on this ARM MHU
    driver to support doorbell mode, let us add explicit check to match
    the default compatible for this driver. This is needed as the probe
    and match reuses the AMBA device ids currently and don't have any
    explicit compatible check.

    Signed-off-by: Sudeep Holla
    Signed-off-by: Jassi Brar

    Sudeep Holla
     
  • In preparation for unconditionally passing the
    struct tasklet_struct pointer to all tasklet
    callbacks, switch to using the new tasklet_setup()
    and from_tasklet() to pass the tasklet pointer explicitly.

    Signed-off-by: Romain Perier
    Signed-off-by: Allen Pais
    Signed-off-by: Jassi Brar

    Allen Pais
     

18 Sep, 2020

1 commit

  • Enable support for the BPMP on Tegra234 to avoid relying on Tegra194
    being enabled to pull in the needed OF device ID table entry.

    On simulation platforms the BPMP hasn't booted up yet by the time we
    probe the BPMP driver and the BPMP hasn't had a chance to mark the
    doorbell as ringable by the CCPLEX. This corresponding check in the
    BPMP driver will therefore fail. Work around this by disabling the
    check on simulation platforms.

    Reviewed-by: Jon Hunter
    Signed-off-by: Thierry Reding

    Thierry Reding
     

15 Aug, 2020

1 commit

  • Patch series "iomap: Constify ioreadX() iomem argument", v3.

    The ioread8/16/32() and others have inconsistent interface among the
    architectures: some taking address as const, some not.

    It seems there is nothing really stopping all of them to take pointer to
    const.

    This patch (of 4):

    The ioreadX() and ioreadX_rep() helpers have inconsistent interface. On
    some architectures void *__iomem address argument is a pointer to const,
    on some not.

    Implementations of ioreadX() do not modify the memory under the address so
    they can be converted to a "const" version for const-safety and
    consistency among architectures.

    [krzk@kernel.org: sh: clk: fix assignment from incompatible pointer type for ioreadX()]
    Link: http://lkml.kernel.org/r/20200723082017.24053-1-krzk@kernel.org
    [akpm@linux-foundation.org: fix drivers/mailbox/bcm-pdc-mailbox.c]
    Link: http://lkml.kernel.org/r/202007132209.Rxmv4QyS%25lkp@intel.com

    Suggested-by: Geert Uytterhoeven
    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Andrew Morton
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Arnd Bergmann
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner
    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Cc: Michael Ellerman
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Yoshinori Sato
    Cc: Rich Felker
    Cc: Kalle Valo
    Cc: "David S. Miller"
    Cc: Jakub Kicinski
    Cc: Dave Jiang
    Cc: Jon Mason
    Cc: Allen Hubbe
    Cc: "Michael S. Tsirkin"
    Cc: Jason Wang
    Link: http://lkml.kernel.org/r/20200709072837.5869-1-krzk@kernel.org
    Link: http://lkml.kernel.org/r/20200709072837.5869-2-krzk@kernel.org
    Signed-off-by: Linus Torvalds

    Krzysztof Kozlowski
     

04 Aug, 2020

8 commits

  • Do success callback in channel when shutdown. For those task not finish,
    callback with error code thus client has chance to cleanup or reset.

    Signed-off-by: Dennis YC Hsieh
    Reviewed-by: CK Hu
    Reviewed-by: Bibby Hsieh
    Signed-off-by: Jassi Brar

    Dennis YC Hsieh
     
  • Add gce v4 hardware support with different thread number and shift.

    Signed-off-by: Dennis YC Hsieh
    Reviewed-by: CK Hu
    Reviewed-by: Matthias Brugger
    Reviewed-by: Bibby Hsieh
    Signed-off-by: Jassi Brar

    Dennis YC Hsieh
     
  • Some gce hardware shift pc and end address in register to support
    large dram addressing.
    Implement gce address shift when write or read pc and end register.
    And add shift bit in platform definition.

    Signed-off-by: Dennis YC Hsieh
    Signed-off-by: Jassi Brar

    Dennis YC Hsieh
     
  • MSM8994 has an APCS block similar to 8916, but
    with a different clock driver due to the former
    one having 2 clusters.

    Signed-off-by: Konrad Dybcio
    Acked-by: Rob Herring
    Reviewed-by: Bjorn Andersson
    Signed-off-by: Jassi Brar

    Konrad Dybcio
     
  • The Qualcomm SDM660 platform has a APCS HMSS GLOBAL block, add the
    compatible for this.

    Signed-off-by: Konrad Dybcio
    Reviewed-by: Bjorn Andersson
    Acked-by: Rob Herring
    Signed-off-by: Jassi Brar

    Konrad Dybcio
     
  • When CONFIG_PM and CONFIG_PM_SLEEP are unset, the following warnings
    occur:

    drivers/mailbox/imx-mailbox.c:638:12: warning: 'imx_mu_runtime_resume'
    defined but not used [-Wunused-function]
    638 | static int imx_mu_runtime_resume(struct device *dev)
    | ^~~~~~~~~~~~~~~~~~~~~
    drivers/mailbox/imx-mailbox.c:629:12: warning: 'imx_mu_runtime_suspend'
    defined but not used [-Wunused-function]
    629 | static int imx_mu_runtime_suspend(struct device *dev)
    | ^~~~~~~~~~~~~~~~~~~~~~
    drivers/mailbox/imx-mailbox.c:611:12: warning: 'imx_mu_resume_noirq'
    defined but not used [-Wunused-function]
    611 | static int imx_mu_resume_noirq(struct device *dev)
    | ^~~~~~~~~~~~~~~~~~~
    drivers/mailbox/imx-mailbox.c:601:12: warning: 'imx_mu_suspend_noirq'
    defined but not used [-Wunused-function]
    601 | static int imx_mu_suspend_noirq(struct device *dev)
    | ^~~~~~~~~~~~~~~~~~~~

    Mark these functions as __maybe_unused, which is the standard procedure
    for PM functions.

    Fixes: bb2b2624dbe2 ("mailbox: imx: Add runtime PM callback to handle MU clocks")
    Signed-off-by: Nathan Chancellor
    Reviewed-by: Dong Aisheng
    Signed-off-by: Jassi Brar

    Nathan Chancellor
     
  • The acpi_get_table() should be coupled with acpi_put_table() if
    the mapped table is not used at runtime to release the table
    mapping.

    In acpi_pcc_probe(), the PCCT table entries will be used as private
    data for communication chan at runtime, but the table should be put
    for error path.

    Signed-off-by: Hanjun Guo
    Signed-off-by: Jassi Brar

    Hanjun Guo
     
  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
    If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Signed-off-by: Jassi Brar

    Alexander A. Klimov
     

11 Jun, 2020

2 commits

  • The Qualcomm ipq6018 has apcs block, add compatible for the same. Also,
    the ipq6018 apcs provides a clock functionality similar to msm8916 but
    the clock driver is different.

    Create a child device based on the apcs compatible for the clock
    controller functionality.

    Signed-off-by: Sivaprakash Murugesan
    Signed-off-by: Jassi Brar

    Sivaprakash Murugesan
     
  • Some apcs mailbox devices supports a clock driver, the compatible
    strings of devices supporting clock driver along with the clock driver
    name are maintained in a separate structure within the mailbox driver.
    And the clock driver is added based on device match.

    With increase in number of devices supporting the clock feature move the
    clock driver name inside the driver data. so that we can use a single
    API to get the register offset of mailbox driver and clock driver name
    together, and the clock driver will be added based on the driver data.

    Signed-off-by: Sivaprakash Murugesan
    Signed-off-by: Jassi Brar

    Sivaprakash Murugesan
     

08 Jun, 2020

3 commits

  • IPC MU has no power domain assigned and there could be IPC during
    noirq suspend phase, so IRQF_NO_SUSPEND flag is needed for IPC MU.
    However, for other MUs, they have power domain assigned and their
    power will be turned off during noirq suspend phase, but with
    IRQF_NO_SUSPEND set, their interrupts are NOT disabled even after
    their power turned off, it will cause system crash when mailbox
    driver trys to handle pending interrupts but the MU power is already
    turned off.

    So, IRQF_NO_SUSPEND flag should ONLY be added to IPC MU which has
    power domain managed by SCU, then all other MUs' pending interrupts
    after noirq suspend phase will be handled after system resume.

    Signed-off-by: Anson Huang
    Signed-off-by: Jassi Brar

    Anson Huang
     
  • Some of i.MX8M SoCs have MU clock, they need to be managed in runtime
    to make sure the MU clock can be off in runtime, add runtime PM callback
    to handle MU clock.

    And on i.MX8MP, the MU clock is combined with power domain and runtime
    PM is enabled for the clock driver, during noirq suspend/resume phase,
    runtime PM is disabled by device suspend, but the MU context save/restore
    needs to enable MU clock for register access, calling clock prepare/enable
    will trigger runtime resume failure and lead to system suspend failed.

    Actually, the MU context save/restore is ONLY necessary for SCU IPC MU,
    other MUs especially on i.MX8MP platforms which have MU clock assigned,
    they need to runtime request/free mailbox channel in the consumer driver,
    so no need to save/restore MU context for them, hence it can avoid this
    issue, so the MU context save/restore is ONLY applied to i.MX platforms
    MU instance without clock present.

    Signed-off-by: Anson Huang
    Signed-off-by: Jassi Brar

    Anson Huang
     
  • For "mem" mode suspend on i.MX8 SoCs, MU settings could be
    lost because its power is off, so save/restore is needed
    for MU settings during suspend/resume. However, the restore
    can ONLY be done when MU settings are actually lost, for the
    scenario of settings NOT lost in "freeze" mode suspend, since
    there could be still IPC going on multiple CPUs, restoring the
    MU settings could overwrite the TIE by mistake and cause system
    freeze, so need to make sure ONLY restore the MU settings when
    it is powered off, Anson fixes this by checking whether restore
    is actually needed when resume.

    Signed-off-by: Dong Aisheng
    Signed-off-by: Anson Huang
    Signed-off-by: Jassi Brar

    Dong Aisheng
     

31 May, 2020

9 commits

  • Add support for the Inter-Processor Communication Controller (IPCC)
    block from Qualcomm that coordinates the interrupts (inbound & outbound)
    for Multiprocessor (MPROC), COMPUTE-Level0 (COMPUTE-L0) & COMPUTE-Level1
    (COMPUTE-L1) protocols for the Application Processor Subsystem (APSS).

    This driver is modeled as an irqchip+mailbox driver. The irqchip part
    helps in receiving the interrupts from the IPCC clients such as modems,
    DSPs, PCI-E etc... and forwards them to respective entities in APSS.

    On the other hand, the mailbox part is used to send interrupts to the IPCC
    clients from the entities of APSS.

    Reviewed-by: Bjorn Andersson
    Signed-off-by: Raghavendra Rao Ananta
    Signed-off-by: Venkata Narendra Kumar Gutta
    Signed-off-by: Bjorn Andersson
    [mani: moved to mailbox, added static mbox channels and cleanups]
    Signed-off-by: Manivannan Sadhasivam
    Signed-off-by: Jassi Brar

    Manivannan Sadhasivam
     
  • In case of error, the function devm_ioremap() returns NULL pointer not
    ERR_PTR(). So we should check whether the return value of devm_ioremap()
    is NULL instead of IS_ERR.

    Fixes: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller")
    Signed-off-by: Wei Yongjun
    Signed-off-by: Jassi Brar

    Wei Yongjun
     
  • The i.MX8 SCU message header size is the number of "u32" elements,
    not "u8", so fix the check.

    Reported-by: coverity-bot
    Addresses-Coverity-ID: 1461658 ("Memory - corruptions")
    Signed-off-by: Peng Fan
    Reviewed-by: Leonard Crestez
    Acked-by: Oleksij Rempel
    Signed-off-by: Jassi Brar

    Peng Fan
     
  • The Spreadtrum mailbox controller supports 8 channels to communicate
    with MCUs, and it contains 2 different parts: inbox and outbox, which
    are used to send and receive messages by IRQ mode.

    Signed-off-by: Baolin Wang
    Signed-off-by: Jassi Brar

    Baolin Wang
     
  • The function platform_get_irq can log an error already.
    Thus omit a redundant message for the exception handling in the
    calling function.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    Signed-off-by: Jassi Brar

    Markus Elfring
     
  • devm_mbox_controller_register() may fail, and in the case of failure the
    priv->clk clock that was previously enabled, should be disabled.

    Fixes: 2bb7005696e2 ("mailbox: Add support for i.MX messaging unit")
    Signed-off-by: Fabio Estevam
    Reviewed-by: Peng Fan
    Acked-by: Oleksij Rempel
    [Jassi: fixed merge/am conflict]
    Signed-off-by: Jassi Brar

    Fabio Estevam
     
  • This called from mbox_request_channel(). The caller is expecting error
    pointers and not NULL so this "return NULL;" will lead to an Oops.

    Fixes: 0a67003b1985 ("mailbox: imx: add SCU MU support")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Jassi Brar

    Dan Carpenter
     
  • Some power hungry sub-systems like VPU has its own MUs which also
    use mailbox driver, current mailbox driver uses platform driver
    model and MU's power will be ON after driver probed and left ON
    there, it may cause the whole sub-system can NOT enter lower power
    mode, take VPU driver for example, it has runtime PM support, but
    due to its MU always ON, the VPU sub-system will be always ON and
    consume many power during kernel idle.

    To save power in kernel idle, mailbox driver needs to support
    runtime PM in order to power off MU when it is unused. However,
    the runtime suspend/resume can ONLY be implemented in mailbox's
    .shutdown/.startup callback, so its consumer needs to call
    mbox_request_channel()/mbox_free_channel() in consumer driver's
    runtime PM callback, then the MU's power will be ON/OFF along with
    consumer's runtime PM status.

    Signed-off-by: Anson Huang
    Signed-off-by: Jassi Brar

    Anson Huang
     
  • Fix the following sparse warning:

    drivers/mailbox/pcc.c:571:24: warning: symbol 'pcc_mbox_driver' was not
    declared. Should it be static?

    Reported-by: Hulk Robot
    Signed-off-by: Jason Yan
    Signed-off-by: Jassi Brar

    Jason Yan
     

20 Mar, 2020

8 commits

  • i.MX8/8X SCU MU is dedicated for communication between SCU and Cortex-A
    cores from hardware design, and could not be reused for other purpose.

    Per i.MX8/8X Reference mannual, Chapter "12.9.2.3.2 Messaging Examples",
    Passing short messages: Transmit register(s) can be used to pass
    short messages from one to four words in length. For example, when
    a four-word message is desired, only one of the registers needs to
    have its corresponding interrupt enable bit set at the receiver side;
    the message’s first three words are written to the registers whose
    interrupt is masked, and the fourth word is written to the other
    register (which triggers an interrupt at the receiver side).

    i.MX8/8X SCU firmware IPC is an implementation of passing short
    messages. But current imx-mailbox driver only support one word
    message, i.MX8/8X linux side firmware has to request four TX
    and four RX to support IPC to SCU firmware. This is low efficent
    and more interrupts triggered compared with one TX and
    one RX.

    To make SCU MU work,
    - parse the size of msg.
    - Only enable TR0/RR0 interrupt for transmit/receive message.
    - For TX/RX, only support one TX channel and one RX channel
    - For RX, support receive msg larger than 4 u32 words.
    - Support 6 channels, TX0/RX0/RXDB[0-3], not support TXDB.

    Reviewed-by: Oleksij Rempel
    Signed-off-by: Peng Fan
    Signed-off-by: Jassi Brar

    Peng Fan
     
  • Add imx_mu_generic_tx for data send and imx_mu_generic_rx for interrupt
    data receive.

    Pack original mu chans related code into imx_mu_init_generic

    Add tx/rx/init hooks into imx_mu_dcfg

    With these, it will be a bit easy to introduce i.MX8/8X SCU type
    MU dedicated to communicate with SCU.

    Reviewed-by: Oleksij Rempel
    Signed-off-by: Peng Fan
    Signed-off-by: Jassi Brar

    Peng Fan
     
  • After implement flush, client can flush the executing
    command buffer or abort the still waiting for event
    command buffer, so controller do not need to implement
    atomic_exe feature. remove it.

    Signed-off-by: Bibby Hsieh
    Reviewed-by: CK Hu
    Signed-off-by: Jassi Brar

    Bibby Hsieh
     
  • For client driver which need to reorganize the command buffer, it could
    use this function to flush the send command buffer.
    If the channel doesn't be started (usually in waiting for event), this
    function will abort it directly.

    Signed-off-by: Bibby Hsieh
    Reviewed-by: CK Hu
    Signed-off-by: Jassi Brar

    Bibby Hsieh
     
  • Handle 'cmpl_pool' dma memory allocation failure.

    Fixes: a9a9da47f8e6 ("mailbox: no need to check return value of debugfs_create functions")
    Signed-off-by: Rayagonda Kokatanur
    Reviewed-by: Tyler Hicks
    Signed-off-by: Jassi Brar

    Rayagonda Kokatanur
     
  • Allwinner sun6i, sun8i, sun9i, and sun50i SoCs contain a hardware
    message box used for communication between the ARM CPUs and the ARISC
    management coprocessor. This mailbox contains 8 unidirectional
    4-message FIFOs.

    Add a driver for it, so it can be used with the Linux mailbox framework.

    Reviewed-by: Philipp Zabel
    Signed-off-by: Samuel Holland
    Signed-off-by: Jassi Brar

    Samuel Holland
     
  • Since snprintf() returns the would-be-output size instead of the
    actual output size, the succeeding calls may go beyond the given
    buffer limit. Fix it by replacing with scnprintf().

    Signed-off-by: Takashi Iwai
    Signed-off-by: Jassi Brar

    Takashi Iwai
     
  • In this function,we don't need dev_err() message because when something
    goes wrong,platform_get_irq() and devm_platform_ioremap_resource() have
    print an error message itself, so we should remove duplicate dev_err().

    Signed-off-by: Tang Bin
    Signed-off-by: Jassi Brar

    Tang Bin
     

08 Jan, 2020

1 commit


02 Dec, 2019

1 commit

  • Pull mailbox updates from Jassi Brar:

    - omap : misc - catch error returned from pm_runtime_put_sync

    - hisi : misc - drop .owner from platform_driver

    - stm : change how wakeup is handled

    - imx : fix - bailout on error and nuke correct irq

    - imx : add support for imx7ulp platform

    * tag 'mailbox-v5.5' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
    mailbox: imx: add support for imx v1 mu
    dt-bindings: mailbox: imx-mu: add imx7ulp MU support
    mailbox: imx: Clear the right interrupts at shutdown
    mailbox: imx: Fix Tx doorbell shutdown path
    mailbox: stm32-ipcc: Update wakeup management
    mailbox: no need to set .owner platform_driver_register
    mailbox/omap: Handle if CONFIG_PM is disabled

    Linus Torvalds