Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mailbox-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/jassibrar/mailbox

Pull mailbox updates from Jassi Brar:

- Qualcomm: add Glymur CPUCP mailbox binding

- Xilinx Zynq: misc cleanup

- MediaTek:
- add new GPUEB mailbox driver
- cmdq: remove pm_runtime calls from send_data
- gce: make clock-names optional

- misc:
- change mailbox-altera maintainer
- remove redundant 'fast_io' in regmap_config
- mhuv3: Remove no_free_ptr

* tag 'mailbox-v6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/jassibrar/mailbox:
mailbox: mtk-cmdq: Remove pm_runtime APIs from cmdq_mbox_send_data()
mailbox: add MediaTek GPUEB IPI mailbox
dt-bindings: mailbox: Add MT8196 GPUEB Mailbox
mailbox: zynqmp-ipi: Fix SGI cleanup on unbind
mailbox: zynqmp-ipi: Fix out-of-bounds access in mailbox cleanup loop
mailbox: zynqmp-ipi: Remove dev.parent check in zynqmp_ipi_free_mboxes
mailbox: zynqmp-ipi: Remove redundant mbox_controller_unregister() call
mailbox: remove unneeded 'fast_io' parameter in regmap_config
dt-bindings: mailbox: mediatek,gce-mailbox: Make clock-names optional
dt-bindings: mailbox: qcom: Document Glymur CPUCP mailbox controller binding
MAINTAINERS: Change mailbox-altera maintainer
mailbox: arm_mhuv3: Remove no_free_ptr() to maintain the original form of the pointer

+418 -27
+64
Documentation/devicetree/bindings/mailbox/mediatek,mt8196-gpueb-mbox.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mailbox/mediatek,mt8196-gpueb-mbox.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: MediaTek MFlexGraphics GPUEB Mailbox Controller 8 + 9 + maintainers: 10 + - Nicolas Frattaroli <nicolas.frattaroli@collabora.com> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - mediatek,mt8196-gpueb-mbox 16 + 17 + reg: 18 + items: 19 + - description: mailbox data registers 20 + - description: mailbox control registers 21 + 22 + reg-names: 23 + items: 24 + - const: data 25 + - const: ctl 26 + 27 + clocks: 28 + items: 29 + - description: main clock of the GPUEB MCU 30 + 31 + interrupts: 32 + items: 33 + - description: fires when a new message is received 34 + 35 + "#mbox-cells": 36 + const: 1 37 + description: 38 + The number of the mailbox channel. 39 + 40 + required: 41 + - compatible 42 + - reg 43 + - reg-names 44 + - clocks 45 + - interrupts 46 + - "#mbox-cells" 47 + 48 + additionalProperties: false 49 + 50 + examples: 51 + - | 52 + #include <dt-bindings/clock/mediatek,mt8196-clock.h> 53 + #include <dt-bindings/interrupt-controller/arm-gic.h> 54 + #include <dt-bindings/interrupt-controller/irq.h> 55 + 56 + mailbox@4b09fd80 { 57 + compatible = "mediatek,mt8196-gpueb-mbox"; 58 + reg = <0x4b09fd80 0x280>, 59 + <0x4b170000 0x7c>; 60 + reg-names = "data", "ctl"; 61 + clocks = <&topckgen CLK_TOP_MFG_EB>; 62 + interrupts = <GIC_SPI 608 IRQ_TYPE_LEVEL_HIGH 0>; 63 + #mbox-cells = <1>; 64 + };
+7 -2
Documentation/devicetree/bindings/mailbox/qcom,cpucp-mbox.yaml
··· 15 15 16 16 properties: 17 17 compatible: 18 - items: 19 - - const: qcom,x1e80100-cpucp-mbox 18 + oneOf: 19 + - items: 20 + - enum: 21 + - qcom,glymur-cpucp-mbox 22 + - const: qcom,x1e80100-cpucp-mbox 23 + - enum: 24 + - qcom,x1e80100-cpucp-mbox 20 25 21 26 reg: 22 27 items:
+1 -1
MAINTAINERS
··· 924 924 F: drivers/input/mouse/alps.* 925 925 926 926 ALTERA MAILBOX DRIVER 927 - M: Mun Yew Tham <mun.yew.tham@intel.com> 927 + M: Tien Sung Ang <tiensung.ang@altera.com> 928 928 S: Maintained 929 929 F: drivers/mailbox/mailbox-altera.c 930 930
+10
drivers/mailbox/Kconfig
··· 294 294 critical time limitation, such as updating display configuration 295 295 during the vblank. 296 296 297 + config MTK_GPUEB_MBOX 298 + tristate "MediaTek GPUEB Mailbox Support" 299 + depends on ARCH_MEDIATEK || COMPILE_TEST 300 + help 301 + The MediaTek GPUEB mailbox is used to communicate with the embedded 302 + controller in charge of GPU frequency and power management on some 303 + MediaTek SoCs, such as the MT8196. 304 + Say Y or m here if you want to support the MT8196 SoC in your kernel 305 + build. 306 + 297 307 config ZYNQMP_IPI_MBOX 298 308 tristate "Xilinx ZynqMP IPI Mailbox" 299 309 depends on ARCH_ZYNQMP && OF
+2
drivers/mailbox/Makefile
··· 63 63 64 64 obj-$(CONFIG_MTK_CMDQ_MBOX) += mtk-cmdq-mailbox.o 65 65 66 + obj-$(CONFIG_MTK_GPUEB_MBOX) += mtk-gpueb-mailbox.o 67 + 66 68 obj-$(CONFIG_ZYNQMP_IPI_MBOX) += zynqmp-ipi-mailbox.o 67 69 68 70 obj-$(CONFIG_SUN6I_MSGBOX) += sun6i-msgbox.o
+1 -1
drivers/mailbox/arm_mhuv3.c
··· 945 945 if (IS_ERR(data)) { 946 946 dev_err(dev, 947 947 "Failed to read in-band data. err:%ld\n", 948 - PTR_ERR(no_free_ptr(data))); 948 + PTR_ERR(data)); 949 949 goto rx_ack; 950 950 } 951 951 }
+1 -11
drivers/mailbox/mtk-cmdq-mailbox.c
··· 379 379 struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev); 380 380 struct cmdq_task *task; 381 381 unsigned long curr_pa, end_pa; 382 - int ret; 383 382 384 383 /* Client should not flush new tasks if suspended. */ 385 384 WARN_ON(cmdq->suspended); 386 385 387 - ret = pm_runtime_get_sync(cmdq->mbox.dev); 388 - if (ret < 0) 389 - return ret; 390 - 391 386 task = kzalloc(sizeof(*task), GFP_ATOMIC); 392 - if (!task) { 393 - pm_runtime_put_autosuspend(cmdq->mbox.dev); 387 + if (!task) 394 388 return -ENOMEM; 395 - } 396 389 397 390 task->cmdq = cmdq; 398 391 INIT_LIST_HEAD(&task->list_entry); ··· 431 438 cmdq_thread_resume(thread); 432 439 } 433 440 list_move_tail(&task->list_entry, &thread->task_busy_list); 434 - 435 - pm_runtime_mark_last_busy(cmdq->mbox.dev); 436 - pm_runtime_put_autosuspend(cmdq->mbox.dev); 437 441 438 442 return 0; 439 443 }
+319
drivers/mailbox/mtk-gpueb-mailbox.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * MediaTek GPUEB mailbox driver for SoCs such as the MT8196 4 + * 5 + * Copyright (C) 2025, Collabora Ltd. 6 + * 7 + * Developers harmed in the making of this driver: 8 + * - Nicolas Frattaroli <nicolas.frattaroli@collabora.com> 9 + */ 10 + 11 + #include <linux/atomic.h> 12 + #include <linux/clk.h> 13 + #include <linux/device.h> 14 + #include <linux/interrupt.h> 15 + #include <linux/io.h> 16 + #include <linux/iopoll.h> 17 + #include <linux/mailbox_controller.h> 18 + #include <linux/module.h> 19 + #include <linux/of.h> 20 + #include <linux/platform_device.h> 21 + 22 + #define GPUEB_MBOX_CTL_TX_STS 0x00 23 + #define GPUEB_MBOX_CTL_IRQ_SET 0x04 24 + #define GPUEB_MBOX_CTL_IRQ_CLR 0x74 25 + #define GPUEB_MBOX_CTL_RX_STS 0x78 26 + 27 + #define GPUEB_MBOX_FULL BIT(0) /* i.e. we've received data */ 28 + #define GPUEB_MBOX_BLOCKED BIT(1) /* i.e. the channel is shutdown */ 29 + 30 + #define GPUEB_MBOX_MAX_RX_SIZE 32 /* in bytes */ 31 + 32 + struct mtk_gpueb_mbox { 33 + struct device *dev; 34 + struct clk *clk; 35 + void __iomem *mbox_mmio; 36 + void __iomem *mbox_ctl; 37 + struct mbox_controller mbox; 38 + struct mtk_gpueb_mbox_chan *ch; 39 + int irq; 40 + const struct mtk_gpueb_mbox_variant *v; 41 + }; 42 + 43 + /** 44 + * struct mtk_gpueb_mbox_chan - per-channel runtime data 45 + * @ebm: pointer to the parent &struct mtk_gpueb_mbox mailbox 46 + * @full_name: descriptive name of channel for IRQ subsystem 47 + * @num: channel number, starting at 0 48 + * @rx_status: signifies whether channel reception is turned off, or full 49 + * @c: pointer to the constant &struct mtk_gpueb_mbox_chan_desc channel data 50 + */ 51 + struct mtk_gpueb_mbox_chan { 52 + struct mtk_gpueb_mbox *ebm; 53 + char *full_name; 54 + u8 num; 55 + atomic_t rx_status; 56 + const struct mtk_gpueb_mbox_chan_desc *c; 57 + }; 58 + 59 + /** 60 + * struct mtk_gpueb_mbox_chan_desc - per-channel constant data 61 + * @name: name of this channel 62 + * @num: index of this channel, starting at 0 63 + * @tx_offset: byte offset measured from mmio base for outgoing data 64 + * @tx_len: size, in bytes, of the outgoing data on this channel 65 + * @rx_offset: bytes offset measured from mmio base for incoming data 66 + * @rx_len: size, in bytes, of the incoming data on this channel 67 + */ 68 + struct mtk_gpueb_mbox_chan_desc { 69 + const char *name; 70 + const u8 num; 71 + const u16 tx_offset; 72 + const u8 tx_len; 73 + const u16 rx_offset; 74 + const u8 rx_len; 75 + }; 76 + 77 + struct mtk_gpueb_mbox_variant { 78 + const u8 num_channels; 79 + const struct mtk_gpueb_mbox_chan_desc channels[] __counted_by(num_channels); 80 + }; 81 + 82 + /** 83 + * mtk_gpueb_mbox_read_rx - read RX buffer from MMIO into channel's RX buffer 84 + * @buf: buffer to read into 85 + * @chan: pointer to the channel to read 86 + */ 87 + static void mtk_gpueb_mbox_read_rx(void *buf, struct mtk_gpueb_mbox_chan *chan) 88 + { 89 + memcpy_fromio(buf, chan->ebm->mbox_mmio + chan->c->rx_offset, chan->c->rx_len); 90 + } 91 + 92 + static irqreturn_t mtk_gpueb_mbox_isr(int irq, void *data) 93 + { 94 + struct mtk_gpueb_mbox_chan *ch = data; 95 + u32 rx_sts; 96 + 97 + rx_sts = readl(ch->ebm->mbox_ctl + GPUEB_MBOX_CTL_RX_STS); 98 + 99 + if (rx_sts & BIT(ch->num)) { 100 + if (!atomic_cmpxchg(&ch->rx_status, 0, GPUEB_MBOX_FULL | GPUEB_MBOX_BLOCKED)) 101 + return IRQ_WAKE_THREAD; 102 + } 103 + 104 + return IRQ_NONE; 105 + } 106 + 107 + static irqreturn_t mtk_gpueb_mbox_thread(int irq, void *data) 108 + { 109 + struct mtk_gpueb_mbox_chan *ch = data; 110 + int status; 111 + 112 + status = atomic_cmpxchg(&ch->rx_status, GPUEB_MBOX_FULL | GPUEB_MBOX_BLOCKED, 113 + GPUEB_MBOX_FULL); 114 + if (status == (GPUEB_MBOX_FULL | GPUEB_MBOX_BLOCKED)) { 115 + u8 buf[GPUEB_MBOX_MAX_RX_SIZE] = {}; 116 + 117 + mtk_gpueb_mbox_read_rx(buf, ch); 118 + writel(BIT(ch->num), ch->ebm->mbox_ctl + GPUEB_MBOX_CTL_IRQ_CLR); 119 + mbox_chan_received_data(&ch->ebm->mbox.chans[ch->num], buf); 120 + atomic_set(&ch->rx_status, 0); 121 + return IRQ_HANDLED; 122 + } 123 + 124 + return IRQ_NONE; 125 + } 126 + 127 + static int mtk_gpueb_mbox_send_data(struct mbox_chan *chan, void *data) 128 + { 129 + struct mtk_gpueb_mbox_chan *ch = chan->con_priv; 130 + u32 *values = data; 131 + int i; 132 + 133 + if (atomic_read(&ch->rx_status)) 134 + return -EBUSY; 135 + 136 + /* 137 + * We don't want any fancy nonsense, just write the 32-bit values in 138 + * order. memcpy_toio/__iowrite32_copy don't work here, as they may use 139 + * writes of different sizes or memory ordering characteristics depending 140 + * on the architecture, alignment and the current phase of the moon. 141 + */ 142 + for (i = 0; i < ch->c->tx_len; i += 4) 143 + writel(values[i / 4], ch->ebm->mbox_mmio + ch->c->tx_offset + i); 144 + 145 + writel(BIT(ch->num), ch->ebm->mbox_ctl + GPUEB_MBOX_CTL_IRQ_SET); 146 + 147 + return 0; 148 + } 149 + 150 + static int mtk_gpueb_mbox_startup(struct mbox_chan *chan) 151 + { 152 + struct mtk_gpueb_mbox_chan *ch = chan->con_priv; 153 + int ret; 154 + 155 + atomic_set(&ch->rx_status, 0); 156 + 157 + ret = clk_enable(ch->ebm->clk); 158 + if (ret) { 159 + dev_err(ch->ebm->dev, "Failed to enable EB clock: %pe\n", 160 + ERR_PTR(ret)); 161 + goto err_block; 162 + } 163 + 164 + writel(BIT(ch->num), ch->ebm->mbox_ctl + GPUEB_MBOX_CTL_IRQ_CLR); 165 + 166 + ret = devm_request_threaded_irq(ch->ebm->dev, ch->ebm->irq, mtk_gpueb_mbox_isr, 167 + mtk_gpueb_mbox_thread, IRQF_SHARED | IRQF_ONESHOT, 168 + ch->full_name, ch); 169 + if (ret) { 170 + dev_err(ch->ebm->dev, "Failed to request IRQ: %pe\n", 171 + ERR_PTR(ret)); 172 + goto err_unclk; 173 + } 174 + 175 + return 0; 176 + 177 + err_unclk: 178 + clk_disable(ch->ebm->clk); 179 + err_block: 180 + atomic_set(&ch->rx_status, GPUEB_MBOX_BLOCKED); 181 + 182 + return ret; 183 + } 184 + 185 + static void mtk_gpueb_mbox_shutdown(struct mbox_chan *chan) 186 + { 187 + struct mtk_gpueb_mbox_chan *ch = chan->con_priv; 188 + 189 + atomic_set(&ch->rx_status, GPUEB_MBOX_BLOCKED); 190 + 191 + devm_free_irq(ch->ebm->dev, ch->ebm->irq, ch); 192 + 193 + clk_disable(ch->ebm->clk); 194 + } 195 + 196 + static bool mtk_gpueb_mbox_last_tx_done(struct mbox_chan *chan) 197 + { 198 + struct mtk_gpueb_mbox_chan *ch = chan->con_priv; 199 + 200 + return !(readl(ch->ebm->mbox_ctl + GPUEB_MBOX_CTL_TX_STS) & BIT(ch->num)); 201 + } 202 + 203 + const struct mbox_chan_ops mtk_gpueb_mbox_ops = { 204 + .send_data = mtk_gpueb_mbox_send_data, 205 + .startup = mtk_gpueb_mbox_startup, 206 + .shutdown = mtk_gpueb_mbox_shutdown, 207 + .last_tx_done = mtk_gpueb_mbox_last_tx_done, 208 + }; 209 + 210 + static int mtk_gpueb_mbox_probe(struct platform_device *pdev) 211 + { 212 + struct mtk_gpueb_mbox_chan *ch; 213 + struct mtk_gpueb_mbox *ebm; 214 + unsigned int i; 215 + 216 + ebm = devm_kzalloc(&pdev->dev, sizeof(*ebm), GFP_KERNEL); 217 + if (!ebm) 218 + return -ENOMEM; 219 + 220 + ebm->dev = &pdev->dev; 221 + ebm->v = of_device_get_match_data(ebm->dev); 222 + 223 + ebm->irq = platform_get_irq(pdev, 0); 224 + if (ebm->irq < 0) 225 + return ebm->irq; 226 + 227 + ebm->clk = devm_clk_get_prepared(ebm->dev, NULL); 228 + if (IS_ERR(ebm->clk)) 229 + return dev_err_probe(ebm->dev, PTR_ERR(ebm->clk), 230 + "Failed to get 'eb' clock\n"); 231 + 232 + ebm->mbox_mmio = devm_platform_ioremap_resource(pdev, 0); 233 + if (IS_ERR(ebm->mbox_mmio)) 234 + return dev_err_probe(ebm->dev, PTR_ERR(ebm->mbox_mmio), 235 + "Couldn't map mailbox data registers\n"); 236 + 237 + ebm->mbox_ctl = devm_platform_ioremap_resource(pdev, 1); 238 + if (IS_ERR(ebm->mbox_ctl)) 239 + return dev_err_probe( 240 + ebm->dev, PTR_ERR(ebm->mbox_ctl), 241 + "Couldn't map mailbox control registers\n"); 242 + 243 + ebm->ch = devm_kmalloc_array(ebm->dev, ebm->v->num_channels, 244 + sizeof(*ebm->ch), GFP_KERNEL); 245 + if (!ebm->ch) 246 + return -ENOMEM; 247 + 248 + ebm->mbox.chans = devm_kcalloc(ebm->dev, ebm->v->num_channels, 249 + sizeof(struct mbox_chan), GFP_KERNEL); 250 + if (!ebm->mbox.chans) 251 + return -ENOMEM; 252 + 253 + for (i = 0; i < ebm->v->num_channels; i++) { 254 + ch = &ebm->ch[i]; 255 + ch->c = &ebm->v->channels[i]; 256 + if (ch->c->rx_len > GPUEB_MBOX_MAX_RX_SIZE) { 257 + dev_err(ebm->dev, "Channel %s RX size (%d) too large\n", 258 + ch->c->name, ch->c->rx_len); 259 + return -EINVAL; 260 + } 261 + ch->full_name = devm_kasprintf(ebm->dev, GFP_KERNEL, "%s:%s", 262 + dev_name(ebm->dev), ch->c->name); 263 + if (!ch->full_name) 264 + return -ENOMEM; 265 + 266 + ch->ebm = ebm; 267 + ch->num = i; 268 + spin_lock_init(&ebm->mbox.chans[i].lock); 269 + ebm->mbox.chans[i].con_priv = ch; 270 + atomic_set(&ch->rx_status, GPUEB_MBOX_BLOCKED); 271 + } 272 + 273 + ebm->mbox.dev = ebm->dev; 274 + ebm->mbox.num_chans = ebm->v->num_channels; 275 + ebm->mbox.txdone_poll = true; 276 + ebm->mbox.txpoll_period = 0; /* minimum hrtimer interval */ 277 + ebm->mbox.ops = &mtk_gpueb_mbox_ops; 278 + 279 + dev_set_drvdata(ebm->dev, ebm); 280 + 281 + return devm_mbox_controller_register(ebm->dev, &ebm->mbox); 282 + } 283 + 284 + static const struct mtk_gpueb_mbox_variant mtk_gpueb_mbox_mt8196 = { 285 + .num_channels = 12, 286 + .channels = { 287 + { "fast-dvfs-event", 0, 0x0000, 16, 0x00e0, 16 }, 288 + { "gpufreq", 1, 0x0010, 32, 0x00f0, 32 }, 289 + { "sleep", 2, 0x0030, 12, 0x0110, 4 }, 290 + { "timer", 3, 0x003c, 24, 0x0114, 4 }, 291 + { "fhctl", 4, 0x0054, 36, 0x0118, 4 }, 292 + { "ccf", 5, 0x0078, 16, 0x011c, 16 }, 293 + { "gpumpu", 6, 0x0088, 24, 0x012c, 4 }, 294 + { "fast-dvfs", 7, 0x00a0, 24, 0x0130, 24 }, 295 + { "ipir-c-met", 8, 0x00b8, 4, 0x0148, 16 }, 296 + { "ipis-c-met", 9, 0x00bc, 16, 0x0158, 4 }, 297 + { "brisket", 10, 0x00cc, 16, 0x015c, 16 }, 298 + { "ppb", 11, 0x00dc, 4, 0x016c, 4 }, 299 + }, 300 + }; 301 + 302 + static const struct of_device_id mtk_gpueb_mbox_of_ids[] = { 303 + { .compatible = "mediatek,mt8196-gpueb-mbox", .data = &mtk_gpueb_mbox_mt8196 }, 304 + { /* Sentinel */ } 305 + }; 306 + MODULE_DEVICE_TABLE(of, mtk_gpueb_mbox_of_ids); 307 + 308 + static struct platform_driver mtk_gpueb_mbox_drv = { 309 + .probe = mtk_gpueb_mbox_probe, 310 + .driver = { 311 + .name = "mtk-gpueb-mbox", 312 + .of_match_table = mtk_gpueb_mbox_of_ids, 313 + } 314 + }; 315 + module_platform_driver(mtk_gpueb_mbox_drv); 316 + 317 + MODULE_AUTHOR("Nicolas Frattaroli <nicolas.frattaroli@collabora.com>"); 318 + MODULE_DESCRIPTION("MediaTek GPUEB mailbox driver"); 319 + MODULE_LICENSE("GPL");
-1
drivers/mailbox/qcom-apcs-ipc-mailbox.c
··· 58 58 .reg_stride = 4, 59 59 .val_bits = 32, 60 60 .max_register = 0x1008, 61 - .fast_io = true, 62 61 }; 63 62 64 63 static int qcom_apcs_ipc_send_data(struct mbox_chan *chan, void *data)
+13 -11
drivers/mailbox/zynqmp-ipi-mailbox.c
··· 62 62 #define DST_BIT_POS 9U 63 63 #define SRC_BITMASK GENMASK(11, 8) 64 64 65 - #define MAX_SGI 16 65 + /* Macro to represent SGI type for IPI IRQs */ 66 + #define IPI_IRQ_TYPE_SGI 2 66 67 67 68 /* 68 69 * Module parameters ··· 122 121 * @dev: device pointer corresponding to the Xilinx ZynqMP 123 122 * IPI agent 124 123 * @irq: IPI agent interrupt ID 124 + * @irq_type: IPI SGI or SPI IRQ type 125 125 * @method: IPI SMC or HVC is going to be used 126 126 * @local_id: local IPI agent ID 127 127 * @virq_sgi: IRQ number mapped to SGI ··· 132 130 struct zynqmp_ipi_pdata { 133 131 struct device *dev; 134 132 int irq; 133 + unsigned int irq_type; 135 134 unsigned int method; 136 135 u32 local_id; 137 136 int virq_sgi; ··· 890 887 struct zynqmp_ipi_mbox *ipi_mbox; 891 888 int i; 892 889 893 - if (pdata->irq < MAX_SGI) 890 + if (pdata->irq_type == IPI_IRQ_TYPE_SGI) 894 891 xlnx_mbox_cleanup_sgi(pdata); 895 892 896 - i = pdata->num_mboxes; 893 + i = pdata->num_mboxes - 1; 897 894 for (; i >= 0; i--) { 898 895 ipi_mbox = &pdata->ipi_mboxes[i]; 899 - if (ipi_mbox->dev.parent) { 900 - mbox_controller_unregister(&ipi_mbox->mbox); 901 - if (device_is_registered(&ipi_mbox->dev)) 902 - device_unregister(&ipi_mbox->dev); 903 - } 896 + if (device_is_registered(&ipi_mbox->dev)) 897 + device_unregister(&ipi_mbox->dev); 904 898 } 905 899 } 906 900 ··· 959 959 dev_err(dev, "failed to parse interrupts\n"); 960 960 goto free_mbox_dev; 961 961 } 962 - ret = out_irq.args[1]; 962 + 963 + /* Use interrupt type to distinguish SGI and SPI interrupts */ 964 + pdata->irq_type = out_irq.args[0]; 963 965 964 966 /* 965 967 * If Interrupt number is in SGI range, then request SGI else request 966 968 * IPI system IRQ. 967 969 */ 968 - if (ret < MAX_SGI) { 969 - pdata->irq = ret; 970 + if (pdata->irq_type == IPI_IRQ_TYPE_SGI) { 971 + pdata->irq = out_irq.args[1]; 970 972 ret = xlnx_mbox_init_sgi(pdev, pdata->irq, pdata); 971 973 if (ret) 972 974 goto free_mbox_dev;