From: Krzysztof Kozlowski <krzk@kernel.org>
To: Valentina Fernandez <valentina.fernandezalanis@microchip.com>,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, peterlin@andestech.com,
dminus@andestech.com, conor.dooley@microchip.com,
conor+dt@kernel.org, ycliang@andestech.com,
jassisinghbrar@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
andersson@kernel.org, mathieu.poirier@linaro.org
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH v1 3/5] mailbox: add Microchip IPC support
Date: Mon, 16 Sep 2024 22:21:21 +0200 [thread overview]
Message-ID: <0b855362-d0a7-45da-81d5-10d53bf8d965@kernel.org> (raw)
In-Reply-To: <20240912170025.455167-4-valentina.fernandezalanis@microchip.com>
On 12/09/2024 19:00, Valentina Fernandez wrote:
> Add a mailbox controller driver for the Microchip Inter-processor
> Communication (IPC), which is used to send and receive data between
> processors.
>
> The driver uses the RISC-V Supervisor Binary Interface (SBI) to
> communicate with software running in machine mode (M-mode) to access
> the IPC hardware block.
>
...
> +
> +static struct microchip_ipc *to_mchp_ipc_mbox(struct mbox_controller *mbox)
> +{
> + return container_of(mbox, struct microchip_ipc, controller);
> +}
> +
You need kerneldoc for exported functions.
> +u32 mchp_ipc_get_chan_id(struct mbox_chan *chan)
> +{
> + struct ipc_chan_info *chan_info = (struct ipc_chan_info *)chan->con_priv;
> +
> + return chan_info->id;
> +}
> +EXPORT_SYMBOL(mchp_ipc_get_chan_id);
EXPORT_SYMBOL_GPL
> +
...
> +static int mchp_ipc_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mchp_ipc_probe ipc_info;
> + struct microchip_ipc *ipc;
> + struct ipc_chan_info *priv;
> + bool irq_avail = false;
> + int ret;
> + u32 chan_id;
> +
> + ret = sbi_probe_extension(SBI_EXT_MICROCHIP_TECHNOLOGY);
> + if (ret <= 0)
> + return dev_err_probe(dev, ret, "Microchip SBI extension not detected\n");
> +
> + ipc = devm_kzalloc(dev, sizeof(*ipc), GFP_KERNEL);
> + if (!ipc)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, ipc);
> +
> + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(IPC_DMA_BIT_MASK));
> + if (ret)
> + return dev_err_probe(dev, ret, "dma_set_mask_and_coherent failed\n");
> +
> + ipc->buf_base = dmam_alloc_coherent(dev, sizeof(u32), &ipc->dma_addr, GFP_KERNEL);
> +
Drop blank line.
> + if (!ipc->buf_base)
> + return -ENOMEM;
> +
> + ret = mchp_ipc_sbi_send(SBI_EXT_IPC_PROBE, ipc->dma_addr);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "could not probe IPC SBI service\n");
> +
> + memcpy(&ipc_info, ipc->buf_base, sizeof(struct mchp_ipc_probe));
> + ipc->num_channels = ipc_info.num_channels;
> + ipc->hw_type = ipc_info.hw_type;
> +
> + ipc->chans = devm_kcalloc(dev, ipc->num_channels, sizeof(*ipc->chans), GFP_KERNEL);
> + if (!ipc->chans)
> + return -ENOMEM;
> +
> + ipc->dev = dev;
> + ipc->controller.txdone_irq = true;
> + ipc->controller.dev = ipc->dev;
> + ipc->controller.ops = &mchp_ipc_ops;
> + ipc->controller.chans = ipc->chans;
> + ipc->controller.num_chans = ipc->num_channels;
> + ipc->controller.of_xlate = mchp_ipc_mbox_xlate;
> +
> + for (chan_id = 0; chan_id < ipc->num_channels; chan_id++) {
> + priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + ipc->chans[chan_id].con_priv = priv;
> + priv->id = chan_id;
> + }
> +
> + if (ipc->hw_type == MIV_IHC) {
> + ipc->cluster_cfg = devm_kcalloc(dev, num_online_cpus(),
> + sizeof(struct mchp_ipc_cluster_cfg),
> + GFP_KERNEL);
> + if (!ipc->cluster_cfg)
> + return -ENOMEM;
> +
> + if (mchp_ipc_get_cluster_aggr_irq(ipc))
> + irq_avail = true;
> + }
> +
> + if (!irq_avail)
> + return dev_err_probe(dev, -ENODEV, "missing interrupt property\n");
> +
> + ret = devm_mbox_controller_register(dev, &ipc->controller);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "Inter-Processor communication (IPC) registration failed\n");
Fix alignment.
> +
> + return 0;
> +}
> +
> +MODULE_DEVICE_TABLE(of, mchp_ipc_of_match);
This is ALWAYS next to the definition.
> +
> +static struct platform_driver mchp_ipc_driver = {
> + .driver = {
> + .name = "microchip_ipc",
> + .of_match_table = of_match_ptr(mchp_ipc_of_match),
Drop of_match_ptr. You have warnings here.
> + },
> + .probe = mchp_ipc_probe,
> +};
> +
> +module_platform_driver(mchp_ipc_driver);
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-09-16 20:21 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 17:00 [PATCH v1 0/5] Add Microchip IPC mailbox and remoteproc support Valentina Fernandez
2024-09-12 17:00 ` [PATCH v1 1/5] riscv: asm: vendorid_list: Add Microchip Technology to the vendor list Valentina Fernandez
2024-09-12 17:16 ` Conor Dooley
2024-09-12 17:00 ` [PATCH v1 2/5] dt-bindings: mailbox: add binding for Microchip IPC mailbox driver Valentina Fernandez
2024-09-12 17:15 ` Conor Dooley
2024-09-12 21:23 ` Samuel Holland
2024-09-16 16:31 ` Conor Dooley
2024-09-18 15:35 ` Rob Herring
2024-09-19 7:40 ` Conor Dooley
2024-09-12 17:00 ` [PATCH v1 3/5] mailbox: add Microchip IPC support Valentina Fernandez
2024-09-12 21:30 ` Samuel Holland
2024-09-16 9:25 ` Valentina.FernandezAlanis
2024-09-16 20:21 ` Krzysztof Kozlowski [this message]
2024-09-12 17:00 ` [PATCH v1 4/5] dt-bindings: remoteproc: add binding for Microchip IPC remoteproc Valentina Fernandez
2024-09-16 20:14 ` Krzysztof Kozlowski
2024-10-15 12:09 ` Valentina.FernandezAlanis
2024-10-15 13:35 ` Krzysztof Kozlowski
2024-10-15 20:22 ` Conor Dooley
2024-09-12 17:00 ` [PATCH v1 5/5] remoteproc: add support for Microchip IPC remoteproc platform driver Valentina Fernandez
2024-09-16 20:18 ` Krzysztof Kozlowski
2024-09-18 15:51 ` Valentina.FernandezAlanis
2024-09-22 20:21 ` Krzysztof Kozlowski
2024-09-13 14:44 ` [PATCH v1 0/5] Add Microchip IPC mailbox and remoteproc support Mathieu Poirier
2024-09-16 15:04 ` Mathieu Poirier
2024-09-16 22:28 ` Bo Gan
2024-09-17 10:45 ` Valentina.FernandezAlanis
2024-09-17 12:42 ` Conor Dooley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0b855362-d0a7-45da-81d5-10d53bf8d965@kernel.org \
--to=krzk@kernel.org \
--cc=andersson@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=conor.dooley@microchip.com \
--cc=devicetree@vger.kernel.org \
--cc=dminus@andestech.com \
--cc=jassisinghbrar@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mathieu.poirier@linaro.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peterlin@andestech.com \
--cc=robh@kernel.org \
--cc=valentina.fernandezalanis@microchip.com \
--cc=ycliang@andestech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).