From: Krzysztof Kozlowski <krzk@kernel.org>
To: xianwei.zhao@amlogic.com, Sunny Luo <sunny.luo@amlogic.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-amlogic@lists.infradead.org, linux-spi@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] spi: Add Amlogic SPISG driver
Date: Mon, 23 Jun 2025 11:17:05 +0200 [thread overview]
Message-ID: <682a48fc-8451-46e5-b3a8-5ad7c237588e@kernel.org> (raw)
In-Reply-To: <20250623-spisg-v3-2-c731f57e289c@amlogic.com>
On 23/06/2025 10:53, Xianwei Zhao via B4 Relay wrote:
> From: Sunny Luo <sunny.luo@amlogic.com>
>
> Introduced support for the new SPI IP (SPISG) driver. The SPISG is
> a communication-oriented SPI controller from Amlogic,supporting
> three operation modes: PIO, block DMA, and scatter-gather DMA.
>
> Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
> ---
> drivers/spi/Kconfig | 9 +
> drivers/spi/Makefile | 1 +
> drivers/spi/spi-amlogic-spisg.c | 876 ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 886 insertions(+)
>
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index c51da3fc3604..e11341df2ecf 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -99,6 +99,15 @@ config SPI_AMLOGIC_SPIFC_A1
> This enables master mode support for the SPIFC (SPI flash
> controller) available in Amlogic A1 (A113L SoC).
>
> +config SPI_AMLOGIC_SPISG
> + tristate "Amlogic SPISG controller"
> + depends on COMMON_CLK
> + depends on ARCH_MESON || COMPILE_TEST
> + help
> + This enables master mode support for the SPISG (SPI scatter-gather
> + communication controller), which is available on platforms such as
> + Amlogic A4 SoCs.
> +
> config SPI_APPLE
> tristate "Apple SoC SPI Controller platform driver"
> depends on ARCH_APPLE || COMPILE_TEST
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index 4ea89f6fc531..b74e3104d71f 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -20,6 +20,7 @@ obj-$(CONFIG_SPI_ALTERA) += spi-altera-platform.o
> obj-$(CONFIG_SPI_ALTERA_CORE) += spi-altera-core.o
> obj-$(CONFIG_SPI_ALTERA_DFL) += spi-altera-dfl.o
> obj-$(CONFIG_SPI_AMLOGIC_SPIFC_A1) += spi-amlogic-spifc-a1.o
> +obj-$(CONFIG_SPI_AMLOGIC_SPISG) += spi-amlogic-spisg.o
> obj-$(CONFIG_SPI_APPLE) += spi-apple.o
> obj-$(CONFIG_SPI_AR934X) += spi-ar934x.o
> obj-$(CONFIG_SPI_ARMADA_3700) += spi-armada-3700.o
> diff --git a/drivers/spi/spi-amlogic-spisg.c b/drivers/spi/spi-amlogic-spisg.c
> new file mode 100644
> index 000000000000..2f2982154d49
> --- /dev/null
> +++ b/drivers/spi/spi-amlogic-spisg.c
> @@ -0,0 +1,876 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Driver for Amlogic SPI communication Scatter-Gather Controller
> + *
> + * Copyright (C) 2025 Amlogic, Inc. All rights reserved
> + *
> + * Author: Sunny Luo <sunny.luo@amlogic.com>
> + * Author: Xianwei Zhao <xianwei.zhao@amlogic.com>
> + */
> +
> +#include <linux/bitfield.h>
> +#include <linux/clk.h>
> +#include <linux/device.h>
> +#include <linux/io.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/clk-provider.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/pm_domain.h>
cacheflush
> +#include <linux/platform_device.h>
> +#include <linux/spi/spi.h>
> +#include <linux/types.h>
> +#include <linux/interrupt.h>
> +#include <linux/reset.h>
So this you take to reset device... but your device does not have any
resets! Just look at your binding.
> +#include <linux/pinctrl/consumer.h>
> +#include <linux/delay.h>
> +#include <linux/cacheflush.h>
Where do you use it?
> +#include <linux/regmap.h>
Actually several other headers looks unused. I am not going to keep
checking one by one - you should check and do not include irrelevant
headers.
> +
> +static int aml_spisg_probe(struct platform_device *pdev)
> +{
> + struct spi_controller *ctlr;
> + struct spisg_device *spisg;
> + struct device *dev = &pdev->dev;
> + void __iomem *base;
> + int ret, irq;
> +
> + const struct regmap_config aml_regmap_config = {
> + .reg_bits = 32,
> + .val_bits = 32,
> + .reg_stride = 4,
> + .max_register = SPISG_MAX_REG,
> + };
> +
> + if (of_property_read_bool(dev->of_node, "slave"))
"slave" is not a bool. You want to check for child presence, don't you?
You need to use appropriate API for that otherwise you just add one of
the issues which was being fixed recently.
> + ctlr = spi_alloc_target(dev, sizeof(*spisg));
> + else
> + ctlr = spi_alloc_host(dev, sizeof(*spisg));
> + if (!ctlr)
> + return dev_err_probe(dev, -ENOMEM, "controller allocation failed\n");
> +
> +
> +static struct platform_driver amlogic_spisg_driver = {
> + .probe = aml_spisg_probe,
> + .remove = aml_spisg_remove,
> + .driver = {
> + .name = "amlogic-spisg",
> + .of_match_table = of_match_ptr(amlogic_spisg_of_match),
So now you will have warnings... drop of_match_ptr.
Both suggest you send us some old code, instead of working on something
recent.
> + .pm = &amlogic_spisg_pm_ops,
> + },
> +};
> +
> +module_platform_driver(amlogic_spisg_driver);
> +
> +MODULE_DESCRIPTION("Amlogic SPI Scatter-Gather Controller driver");
> +MODULE_AUTHOR("Sunny Luo <sunny.luo@amlogic.com>");
> +MODULE_LICENSE("GPL");
>
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-06-23 9:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 8:53 [PATCH v3 0/3] support for amlogic the new SPI IP Xianwei Zhao via B4 Relay
2025-06-23 8:53 ` [PATCH v3 1/3] dt-bindings: spi: Add binding document of Amlogic SPISG controller Xianwei Zhao via B4 Relay
2025-06-23 9:15 ` Krzysztof Kozlowski
2025-06-24 9:05 ` Xianwei Zhao
2025-06-23 8:53 ` [PATCH v3 2/3] spi: Add Amlogic SPISG driver Xianwei Zhao via B4 Relay
2025-06-23 9:17 ` Krzysztof Kozlowski [this message]
2025-06-24 9:52 ` Xianwei Zhao
2025-06-23 8:53 ` [PATCH v3 3/3] MAINTAINERS: Add an entry for Amlogic spi driver Xianwei Zhao via B4 Relay
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=682a48fc-8451-46e5-b3a8-5ad7c237588e@kernel.org \
--to=krzk@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sunny.luo@amlogic.com \
--cc=xianwei.zhao@amlogic.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).