linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add MediaTek MT8365 SPI support
@ 2023-01-19 17:28 Alexandre Mergnat
  2023-01-19 17:28 ` [PATCH v2 1/2] arm64: dts: mediatek: add spidev support for mt8365-evk board Alexandre Mergnat
  2023-01-19 17:28 ` [PATCH v2 2/2] spi: spidev: add new mediatek support Alexandre Mergnat
  0 siblings, 2 replies; 7+ messages in thread
From: Alexandre Mergnat @ 2023-01-19 17:28 UTC (permalink / raw)
  To: Matthias Brugger, Rob Herring, Mark Brown, Krzysztof Kozlowski
  Cc: linux-arm-kernel, Alexandre Mergnat, linux-kernel, devicetree,
	Amjad Ouled-Ameur, linux-mediatek, linux-spi

Hi,
This patch series adds SPI support for MT8365-EVK board.
The SPIDEV is enabled, it can be used through the board pin header,
as described directly on the PCB.

This series depends to another one which add support for
MT8365 SoC and EVK board. Link [1].

Test:
- Loopback MOSI and MISO pins
- Issue the following command:
spidev_test -D /dev/spidev0.0 -v
- RX line should be the same as TX line.

Regards,
Alex

[1]: https://lore.kernel.org/linux-mediatek/20230101220149.3035048-1-bero@baylibre.com/

To: Rob Herring <robh+dt@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
To: Matthias Brugger <matthias.bgg@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-spi@vger.kernel.org
Cc: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
---
Changes in v2:
- Add Amjad Ouled-Ameur SoB.
- Link to v1: https://lore.kernel.org/r/20230118-mt8365-spi-support-v1-0-842a21e50494@baylibre.com

---
Alexandre Mergnat (2):
      arm64: dts: mediatek: add spidev support for mt8365-evk board
      spi: spidev: add new mediatek support

 arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 24 ++++++++++++++++++++++++
 drivers/spi/spidev.c                        |  2 ++
 2 files changed, 26 insertions(+)
---
base-commit: 8b6cfcce3ce939db11166680a57253c39110f07e
change-id: 20230118-mt8365-spi-support-0d96bc55a4a0

Best regards,
-- 
Alexandre Mergnat <amergnat@baylibre.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] arm64: dts: mediatek: add spidev support for mt8365-evk board
  2023-01-19 17:28 [PATCH v2 0/2] Add MediaTek MT8365 SPI support Alexandre Mergnat
@ 2023-01-19 17:28 ` Alexandre Mergnat
  2023-01-19 17:28 ` [PATCH v2 2/2] spi: spidev: add new mediatek support Alexandre Mergnat
  1 sibling, 0 replies; 7+ messages in thread
From: Alexandre Mergnat @ 2023-01-19 17:28 UTC (permalink / raw)
  To: Matthias Brugger, Rob Herring, Mark Brown, Krzysztof Kozlowski
  Cc: linux-arm-kernel, Alexandre Mergnat, linux-kernel, devicetree,
	Amjad Ouled-Ameur, linux-mediatek, linux-spi

Add SPI pins and spidev support for mt8365-evk.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
---
 arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
index 275ea3a0e708..c1d603cb129a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
@@ -142,6 +142,17 @@ pins {
 				 <MT8365_PIN_116_I2S_BCK__FUNC_PWM_C>;
 		};
 	};
+
+	spi_pins: spi-pins {
+		pins {
+			pinmux = <MT8365_PIN_26_SPI_CS__FUNC_SPI_CSB>,
+				 <MT8365_PIN_27_SPI_CK__FUNC_SPI_CLK>,
+				 <MT8365_PIN_28_SPI_MI__FUNC_SPI_MI>,
+				 <MT8365_PIN_29_SPI_MO__FUNC_SPI_MO>;
+			bias-disable;
+		};
+	};
+
 };
 
 &pwm {
@@ -150,6 +161,19 @@ &pwm {
 	status = "okay";
 };
 
+&spi {
+	pinctrl-0 = <&spi_pins>;
+	pinctrl-names = "default";
+	mediatek,pad-select = <0>;
+	status = "okay";
+
+	spidev@0 {
+		compatible = "mediatek,genio";
+		spi-max-frequency = <5000000>;
+		reg = <0>;
+	};
+};
+
 &uart0 {
 	pinctrl-0 = <&uart0_pins>;
 	pinctrl-names = "default";

-- 
b4 0.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] spi: spidev: add new mediatek support
  2023-01-19 17:28 [PATCH v2 0/2] Add MediaTek MT8365 SPI support Alexandre Mergnat
  2023-01-19 17:28 ` [PATCH v2 1/2] arm64: dts: mediatek: add spidev support for mt8365-evk board Alexandre Mergnat
@ 2023-01-19 17:28 ` Alexandre Mergnat
  2023-01-19 17:36   ` Mark Brown
  2023-01-20  8:26   ` Krzysztof Kozlowski
  1 sibling, 2 replies; 7+ messages in thread
From: Alexandre Mergnat @ 2023-01-19 17:28 UTC (permalink / raw)
  To: Matthias Brugger, Rob Herring, Mark Brown, Krzysztof Kozlowski
  Cc: linux-arm-kernel, Alexandre Mergnat, linux-kernel, devicetree,
	Amjad Ouled-Ameur, linux-mediatek, linux-spi

Add the "mediatek,genio" compatible string to support Mediatek
SPI controller on the genio boards.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
---
 drivers/spi/spidev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 6313e7d0cdf8..e23b825b8d30 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -702,6 +702,7 @@ static const struct spi_device_id spidev_spi_ids[] = {
 	{ .name = "m53cpld" },
 	{ .name = "spi-petra" },
 	{ .name = "spi-authenta" },
+	{ .name = "genio" },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, spidev_spi_ids);
@@ -728,6 +729,7 @@ static const struct of_device_id spidev_dt_ids[] = {
 	{ .compatible = "menlo,m53cpld", .data = &spidev_of_check },
 	{ .compatible = "cisco,spi-petra", .data = &spidev_of_check },
 	{ .compatible = "micron,spi-authenta", .data = &spidev_of_check },
+	{ .compatible = "mediatek,genio", .data = &spidev_of_check },
 	{},
 };
 MODULE_DEVICE_TABLE(of, spidev_dt_ids);

-- 
b4 0.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] spi: spidev: add new mediatek support
  2023-01-19 17:28 ` [PATCH v2 2/2] spi: spidev: add new mediatek support Alexandre Mergnat
@ 2023-01-19 17:36   ` Mark Brown
  2023-01-19 19:30     ` Alexandre Mergnat
  2023-01-20  8:26   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2023-01-19 17:36 UTC (permalink / raw)
  To: Alexandre Mergnat
  Cc: Matthias Brugger, Rob Herring, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, devicetree, Amjad Ouled-Ameur,
	linux-mediatek, linux-spi

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

On Thu, Jan 19, 2023 at 06:28:20PM +0100, Alexandre Mergnat wrote:
> Add the "mediatek,genio" compatible string to support Mediatek
> SPI controller on the genio boards.

All my previous review comments stand, please don't ignore review
feedback.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] spi: spidev: add new mediatek support
  2023-01-19 17:36   ` Mark Brown
@ 2023-01-19 19:30     ` Alexandre Mergnat
  2023-01-20  8:23       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Alexandre Mergnat @ 2023-01-19 19:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Matthias Brugger, Rob Herring, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, devicetree, Amjad Ouled-Ameur,
	linux-mediatek, linux-spi

Le jeu. 19 janv. 2023 à 18:36, Mark Brown <broonie@kernel.org> a écrit :
>
> On Thu, Jan 19, 2023 at 06:28:20PM +0100, Alexandre Mergnat wrote:
> > Add the "mediatek,genio" compatible string to support Mediatek
> > SPI controller on the genio boards.
>
> All my previous review comments stand, please don't ignore review
> feedback.

Hi Mark,

Yes sorry about that, I wasn't aware that I've some feedback when I
sent V2 for a quickfix.

I will take care about your comment:

> We need a matching update to the binding document.
>
> This does also seem like a terribly generic name - Google
> suggests that this is actually a series of numbered products (eg,
> Genio 700), perhaps we should be using the specific numbers here?
> I guess users would care which they're talking to.  It really
> parses as being "generic I/O" which would be an end run around
> describing the actual product though it's not actually that.

Is there a binding documentation for spidev ? I didn't find it.

My understanding is to have something more specific like:
compatible = "mediatek,genio350"
Or maybe use the SoC name, to be aligned with the DTS ?
compatible = "mediatek,spi-mt8365"

Regards,
Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] spi: spidev: add new mediatek support
  2023-01-19 19:30     ` Alexandre Mergnat
@ 2023-01-20  8:23       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-20  8:23 UTC (permalink / raw)
  To: Alexandre Mergnat, Mark Brown
  Cc: Matthias Brugger, Rob Herring, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, devicetree, Amjad Ouled-Ameur,
	linux-mediatek, linux-spi

On 19/01/2023 20:30, Alexandre Mergnat wrote:
> Le jeu. 19 janv. 2023 à 18:36, Mark Brown <broonie@kernel.org> a écrit :
>>
>> On Thu, Jan 19, 2023 at 06:28:20PM +0100, Alexandre Mergnat wrote:
>>> Add the "mediatek,genio" compatible string to support Mediatek
>>> SPI controller on the genio boards.
>>
>> All my previous review comments stand, please don't ignore review
>> feedback.
> 
> Hi Mark,
> 
> Yes sorry about that, I wasn't aware that I've some feedback when I
> sent V2 for a quickfix.
> 
> I will take care about your comment:
> 
>> We need a matching update to the binding document.
>>
>> This does also seem like a terribly generic name - Google
>> suggests that this is actually a series of numbered products (eg,
>> Genio 700), perhaps we should be using the specific numbers here?
>> I guess users would care which they're talking to.  It really
>> parses as being "generic I/O" which would be an end run around
>> describing the actual product though it's not actually that.
> 
> Is there a binding documentation for spidev ? I didn't find it.
> 
> My understanding is to have something more specific like:
> compatible = "mediatek,genio350"
> Or maybe use the SoC name, to be aligned with the DTS ?
> compatible = "mediatek,spi-mt8365"

This should be specific compatible for your device attached over SPI. If
you have there "Genio 350", then the first.

Compatible can be documented in its own binding or in trivial-devices (I
sent a patch for existing ones).

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] spi: spidev: add new mediatek support
  2023-01-19 17:28 ` [PATCH v2 2/2] spi: spidev: add new mediatek support Alexandre Mergnat
  2023-01-19 17:36   ` Mark Brown
@ 2023-01-20  8:26   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-20  8:26 UTC (permalink / raw)
  To: Alexandre Mergnat, Matthias Brugger, Rob Herring, Mark Brown,
	Krzysztof Kozlowski
  Cc: linux-arm-kernel, linux-kernel, devicetree, Amjad Ouled-Ameur,
	linux-mediatek, linux-spi

On 19/01/2023 18:28, Alexandre Mergnat wrote:
> Add the "mediatek,genio" compatible string to support Mediatek
> SPI controller on the genio boards.
> 
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
> Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
> ---
>  drivers/spi/spidev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
> index 6313e7d0cdf8..e23b825b8d30 100644
> --- a/drivers/spi/spidev.c
> +++ b/drivers/spi/spidev.c
> @@ -702,6 +702,7 @@ static const struct spi_device_id spidev_spi_ids[] = {
>  	{ .name = "m53cpld" },
>  	{ .name = "spi-petra" },
>  	{ .name = "spi-authenta" },
> +	{ .name = "genio" },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(spi, spidev_spi_ids);
> @@ -728,6 +729,7 @@ static const struct of_device_id spidev_dt_ids[] = {
>  	{ .compatible = "menlo,m53cpld", .data = &spidev_of_check },
>  	{ .compatible = "cisco,spi-petra", .data = &spidev_of_check },
>  	{ .compatible = "micron,spi-authenta", .data = &spidev_of_check },
> +	{ .compatible = "mediatek,genio", .data = &spidev_of_check },

Please, stop adding stuff to the end. It leads to unnecessary conflicts
with simultaneous edits and increases overall entropy.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-20  8:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 17:28 [PATCH v2 0/2] Add MediaTek MT8365 SPI support Alexandre Mergnat
2023-01-19 17:28 ` [PATCH v2 1/2] arm64: dts: mediatek: add spidev support for mt8365-evk board Alexandre Mergnat
2023-01-19 17:28 ` [PATCH v2 2/2] spi: spidev: add new mediatek support Alexandre Mergnat
2023-01-19 17:36   ` Mark Brown
2023-01-19 19:30     ` Alexandre Mergnat
2023-01-20  8:23       ` Krzysztof Kozlowski
2023-01-20  8:26   ` Krzysztof Kozlowski

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).