Skip to content

Commit

Permalink
Merge tag 'mailbox-v5.12' of git://git.linaro.org/landing-teams/worki…
Browse files Browse the repository at this point in the history
…ng/fujitsu/integration

Pull mailbox updates from Jassi Brar:

 - sprd: fix a macro value

 - omap: support for K3 AM64x

 - tegra: fix lockdep warnings

 - qcom: support for SDX55 and SC8180X

 - arm: fixes for sparse, kfree and void return

* tag 'mailbox-v5.12' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
  mailbox: arm_mhuv2: Skip calling kfree() with invalid pointer
  mailbox: tegra-hsp: Set lockdep class dynamically
  mailbox: sprd: correct definition of SPRD_OUTBOX_FIFO_FULL
  mailbox: arm_mhuv2: make remove callback return void
  mailbox: arm_mhuv2: Fix sparse warnings
  mailbox: qcom: Add support for SDX55 APCS IPC
  dt-bindings: mailbox: Add binding for SDX55 APCS
  mailbox: omap: Add support for K3 AM64x SoCs
  dt-bindings: mailbox: omap: Update binding for AM64x SoCs
  mailbox: qcom: Add SC8180X apcs compatible
  dt-bindings: mailbox: qcom: Add SC8180X APCS compatible
  • Loading branch information
torvalds committed Feb 24, 2021
2 parents 825d150 + 6b50df2 commit b817c93
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 15 deletions.
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/mailbox/omap-mailbox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ SoCs has each of these instances form a cluster and combine multiple clusters
into a single IP block present within the Main NavSS. The interrupt lines from
all these clusters are multiplexed and routed to different processor subsystems
over a limited number of common interrupt output lines of an Interrupt Router.
The AM64x SoCS also uses a single IP block comprising of multiple clusters,
but the number of clusters are smaller, and the interrupt output lines are
connected directly to various processors.

Mailbox Device Node:
====================
Expand All @@ -42,6 +45,7 @@ Required properties:
"ti,omap4-mailbox" for OMAP44xx, OMAP54xx, AM33xx,
AM43xx and DRA7xx SoCs
"ti,am654-mailbox" for K3 AM65x and J721E SoCs
"ti,am64-mailbox" for K3 AM64x SoCs
- reg: Contains the mailbox register address range (base
address and length)
- interrupts: Contains the interrupt information for the mailbox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ properties:
- qcom,msm8998-apcs-hmss-global
- qcom,qcs404-apcs-apps-global
- qcom,sc7180-apss-shared
- qcom,sc8180x-apss-shared
- qcom,sdm660-apcs-hmss-global
- qcom,sdm845-apss-shared
- qcom,sm8150-apss-shared
Expand All @@ -33,9 +34,11 @@ properties:

clocks:
description: phandles to the parent clocks of the clock driver
minItems: 2
items:
- description: primary pll parent of the clock driver
- description: auxiliary parent
- description: reference clock

'#mbox-cells':
const: 1
Expand All @@ -44,9 +47,11 @@ properties:
const: 0

clock-names:
minItems: 2
items:
- const: pll
- const: aux
- const: ref

required:
- compatible
Expand All @@ -55,6 +60,35 @@ required:

additionalProperties: false

allOf:
- if:
properties:
compatible:
enum:
- qcom,ipq6018-apcs-apps-global
- qcom,ipq8074-apcs-apps-global
- qcom,msm8916-apcs-kpss-global
- qcom,msm8994-apcs-kpss-global
- qcom,msm8996-apcs-hmss-global
- qcom,msm8998-apcs-hmss-global
- qcom,qcs404-apcs-apps-global
- qcom,sc7180-apss-shared
- qcom,sdm660-apcs-hmss-global
- qcom,sdm845-apss-shared
- qcom,sm8150-apss-shared
then:
properties:
clocks:
maxItems: 2
- if:
properties:
compatible:
enum:
- qcom,sdx55-apcs-gcc
then:
properties:
clocks:
maxItems: 3
examples:

# Example apcs with msm8996
Expand Down
26 changes: 14 additions & 12 deletions drivers/mailbox/arm_mhuv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ struct mhuv2_mbox_chan_priv {
};

/* Macro for reading a bitfield within a physically mapped packed struct */
#define readl_relaxed_bitfield(_regptr, _field) \
#define readl_relaxed_bitfield(_regptr, _type, _field) \
({ \
u32 _regval; \
_regval = readl_relaxed((_regptr)); \
(*(typeof((_regptr)))(&_regval))._field; \
(*(_type *)(&_regval))._field; \
})

/* Macro for writing a bitfield within a physically mapped packed struct */
#define writel_relaxed_bitfield(_value, _regptr, _field) \
#define writel_relaxed_bitfield(_value, _regptr, _type, _field) \
({ \
u32 _regval; \
_regval = readl_relaxed(_regptr); \
(*(typeof(_regptr))(&_regval))._field = _value; \
(*(_type *)(&_regval))._field = _value; \
writel_relaxed(_regval, _regptr); \
})

Expand Down Expand Up @@ -496,7 +496,7 @@ static const struct mhuv2_protocol_ops mhuv2_data_transfer_ops = {

/* Interrupt handlers */

static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 *reg)
static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 __iomem *reg)
{
struct mbox_chan *chans = mhu->mbox.chans;
int channel = 0, i, offset = 0, windows, protocol, ch_wn;
Expand Down Expand Up @@ -699,7 +699,9 @@ static irqreturn_t mhuv2_receiver_interrupt(int irq, void *arg)
ret = IRQ_HANDLED;
}

kfree(data);
if (!IS_ERR(data))
kfree(data);

return ret;
}

Expand Down Expand Up @@ -969,8 +971,8 @@ static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
mhu->mbox.ops = &mhuv2_sender_ops;
mhu->send = reg;

mhu->windows = readl_relaxed_bitfield(&mhu->send->mhu_cfg, num_ch);
mhu->minor = readl_relaxed_bitfield(&mhu->send->aidr, arch_minor_rev);
mhu->windows = readl_relaxed_bitfield(&mhu->send->mhu_cfg, struct mhu_cfg_t, num_ch);
mhu->minor = readl_relaxed_bitfield(&mhu->send->aidr, struct aidr_t, arch_minor_rev);

spin_lock_init(&mhu->doorbell_pending_lock);

Expand All @@ -990,7 +992,7 @@ static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
mhu->mbox.txdone_poll = false;
mhu->irq = adev->irq[0];

writel_relaxed_bitfield(1, &mhu->send->int_en, chcomb);
writel_relaxed_bitfield(1, &mhu->send->int_en, struct int_en_t, chcomb);

/* Disable all channel interrupts */
for (i = 0; i < mhu->windows; i++)
Expand Down Expand Up @@ -1023,8 +1025,8 @@ static int mhuv2_rx_init(struct amba_device *adev, struct mhuv2 *mhu,
mhu->mbox.ops = &mhuv2_receiver_ops;
mhu->recv = reg;

mhu->windows = readl_relaxed_bitfield(&mhu->recv->mhu_cfg, num_ch);
mhu->minor = readl_relaxed_bitfield(&mhu->recv->aidr, arch_minor_rev);
mhu->windows = readl_relaxed_bitfield(&mhu->recv->mhu_cfg, struct mhu_cfg_t, num_ch);
mhu->minor = readl_relaxed_bitfield(&mhu->recv->aidr, struct aidr_t, arch_minor_rev);

mhu->irq = adev->irq[0];
if (!mhu->irq) {
Expand All @@ -1045,7 +1047,7 @@ static int mhuv2_rx_init(struct amba_device *adev, struct mhuv2 *mhu,
writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_set);

if (mhu->minor)
writel_relaxed_bitfield(1, &mhu->recv->int_en, chcomb);
writel_relaxed_bitfield(1, &mhu->recv->int_en, struct int_en_t, chcomb);

return 0;
}
Expand Down
6 changes: 5 additions & 1 deletion drivers/mailbox/omap-mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* OMAP mailbox driver
*
* Copyright (C) 2006-2009 Nokia Corporation. All rights reserved.
* Copyright (C) 2013-2019 Texas Instruments Incorporated - https://www.ti.com
* Copyright (C) 2013-2021 Texas Instruments Incorporated - https://www.ti.com
*
* Contact: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
* Suman Anna <s-anna@ti.com>
Expand Down Expand Up @@ -663,6 +663,10 @@ static const struct of_device_id omap_mailbox_of_match[] = {
.compatible = "ti,am654-mailbox",
.data = &omap4_data,
},
{
.compatible = "ti,am64-mailbox",
.data = &omap4_data,
},
{
/* end */
},
Expand Down
8 changes: 7 additions & 1 deletion drivers/mailbox/qcom-apcs-ipc-mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ static const struct qcom_apcs_ipc_data apps_shared_apcs_data = {
.offset = 12, .clk_name = NULL
};

static const struct qcom_apcs_ipc_data sdx55_apcs_data = {
.offset = 0x1008, .clk_name = "qcom-sdx55-acps-clk"
};

static const struct regmap_config apcs_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.max_register = 0xFFC,
.max_register = 0x1008,
.fast_io = true,
};

Expand Down Expand Up @@ -159,9 +163,11 @@ static const struct of_device_id qcom_apcs_ipc_of_match[] = {
{ .compatible = "qcom,msm8998-apcs-hmss-global", .data = &msm8998_apcs_data },
{ .compatible = "qcom,qcs404-apcs-apps-global", .data = &msm8916_apcs_data },
{ .compatible = "qcom,sc7180-apss-shared", .data = &apps_shared_apcs_data },
{ .compatible = "qcom,sc8180x-apss-shared", .data = &apps_shared_apcs_data },
{ .compatible = "qcom,sdm660-apcs-hmss-global", .data = &sdm660_apcs_data },
{ .compatible = "qcom,sdm845-apss-shared", .data = &apps_shared_apcs_data },
{ .compatible = "qcom,sm8150-apss-shared", .data = &apps_shared_apcs_data },
{ .compatible = "qcom,sdx55-apcs-gcc", .data = &sdx55_apcs_data },
{}
};
MODULE_DEVICE_TABLE(of, qcom_apcs_ipc_of_match);
Expand Down
2 changes: 1 addition & 1 deletion drivers/mailbox/sprd-mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define SPRD_MBOX_IRQ_CLR BIT(0)

/* Bit and mask definiation for outbox's SPRD_MBOX_FIFO_STS register */
#define SPRD_OUTBOX_FIFO_FULL BIT(0)
#define SPRD_OUTBOX_FIFO_FULL BIT(2)
#define SPRD_OUTBOX_FIFO_WR_SHIFT 16
#define SPRD_OUTBOX_FIFO_RD_SHIFT 24
#define SPRD_OUTBOX_FIFO_POS_MASK GENMASK(7, 0)
Expand Down
15 changes: 15 additions & 0 deletions drivers/mailbox/tegra-hsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ struct tegra_hsp {
unsigned int num_ss;
unsigned int num_db;
unsigned int num_si;

spinlock_t lock;
struct lock_class_key lock_key;

struct list_head doorbells;
struct tegra_hsp_mailbox *mailboxes;
Expand Down Expand Up @@ -775,6 +777,18 @@ static int tegra_hsp_probe(struct platform_device *pdev)
return err;
}

lockdep_register_key(&hsp->lock_key);
lockdep_set_class(&hsp->lock, &hsp->lock_key);

return 0;
}

static int tegra_hsp_remove(struct platform_device *pdev)
{
struct tegra_hsp *hsp = platform_get_drvdata(pdev);

lockdep_unregister_key(&hsp->lock_key);

return 0;
}

Expand Down Expand Up @@ -834,6 +848,7 @@ static struct platform_driver tegra_hsp_driver = {
.pm = &tegra_hsp_pm_ops,
},
.probe = tegra_hsp_probe,
.remove = tegra_hsp_remove,
};

static int __init tegra_hsp_init(void)
Expand Down

0 comments on commit b817c93

Please sign in to comment.