public inbox for linux-spi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: xilinx: use device property accessors.
@ 2026-01-15  0:33 Abdurrahman Hussain
  2026-01-16  7:51 ` Michal Simek
  2026-01-16 15:23 ` Andrew Lunn
  0 siblings, 2 replies; 7+ messages in thread
From: Abdurrahman Hussain @ 2026-01-15  0:33 UTC (permalink / raw)
  To: Mark Brown, Michal Simek
  Cc: linux-spi, linux-arm-kernel, linux-kernel, Abdurrahman Hussain

This makes the driver work on non-OF platforms.
Also, make irq optional, since the driver can already work in
polling mode.

Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
---
 drivers/spi/spi-xilinx.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index c86dc56f38b4..9fb1da2fcce4 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -405,11 +405,11 @@ static int xilinx_spi_probe(struct platform_device *pdev)
 		bits_per_word = pdata->bits_per_word;
 		force_irq = pdata->force_irq;
 	} else {
-		of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits",
-					  &num_cs);
-		ret = of_property_read_u32(pdev->dev.of_node,
-					   "xlnx,num-transfer-bits",
-					   &bits_per_word);
+		device_property_read_u32(&pdev->dev, "xlnx,num-ss-bits",
+					 &num_cs);
+		ret = device_property_read_u32(&pdev->dev,
+					       "xlnx,num-transfer-bits",
+					       &bits_per_word);
 		if (ret)
 			bits_per_word = 8;
 	}
@@ -471,7 +471,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
 	xspi->bytes_per_word = bits_per_word / 8;
 	xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
 
-	xspi->irq = platform_get_irq(pdev, 0);
+	xspi->irq = platform_get_irq_optional(pdev, 0);
 	if (xspi->irq < 0 && xspi->irq != -ENXIO) {
 		return xspi->irq;
 	} else if (xspi->irq >= 0) {
-- 
2.52.0


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

* Re: [PATCH] spi: xilinx: use device property accessors.
  2026-01-15  0:33 [PATCH] spi: xilinx: use device property accessors Abdurrahman Hussain
@ 2026-01-16  7:51 ` Michal Simek
  2026-01-16 19:56   ` Abdurrahman Hussain
  2026-01-16 15:23 ` Andrew Lunn
  1 sibling, 1 reply; 7+ messages in thread
From: Michal Simek @ 2026-01-16  7:51 UTC (permalink / raw)
  To: Abdurrahman Hussain, Mark Brown; +Cc: linux-spi, linux-arm-kernel, linux-kernel



On 1/15/26 01:33, Abdurrahman Hussain wrote:
> This makes the driver work on non-OF platforms.
> Also, make irq optional, since the driver can already work in
> polling mode.
> 
> Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
> ---
>   drivers/spi/spi-xilinx.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
> index c86dc56f38b4..9fb1da2fcce4 100644
> --- a/drivers/spi/spi-xilinx.c
> +++ b/drivers/spi/spi-xilinx.c
> @@ -405,11 +405,11 @@ static int xilinx_spi_probe(struct platform_device *pdev)
>   		bits_per_word = pdata->bits_per_word;
>   		force_irq = pdata->force_irq;
>   	} else {
> -		of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits",
> -					  &num_cs);
> -		ret = of_property_read_u32(pdev->dev.of_node,
> -					   "xlnx,num-transfer-bits",
> -					   &bits_per_word);
> +		device_property_read_u32(&pdev->dev, "xlnx,num-ss-bits",
> +					 &num_cs);
> +		ret = device_property_read_u32(&pdev->dev,
> +					       "xlnx,num-transfer-bits",
> +					       &bits_per_word);
>   		if (ret)
>   			bits_per_word = 8;
>   	}
> @@ -471,7 +471,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
>   	xspi->bytes_per_word = bits_per_word / 8;
>   	xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
>   
> -	xspi->irq = platform_get_irq(pdev, 0);
> +	xspi->irq = platform_get_irq_optional(pdev, 0);
>   	if (xspi->irq < 0 && xspi->irq != -ENXIO) {
>   		return xspi->irq;
>   	} else if (xspi->irq >= 0) {


I expect this is another IP which you are using on systems with ACPI.
Can you share ASL fragment you use for testing?

Thanks,
Michal

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

* Re: [PATCH] spi: xilinx: use device property accessors.
  2026-01-15  0:33 [PATCH] spi: xilinx: use device property accessors Abdurrahman Hussain
  2026-01-16  7:51 ` Michal Simek
@ 2026-01-16 15:23 ` Andrew Lunn
  2026-01-16 20:00   ` Abdurrahman Hussain
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2026-01-16 15:23 UTC (permalink / raw)
  To: Abdurrahman Hussain
  Cc: Mark Brown, Michal Simek, linux-spi, linux-arm-kernel,
	linux-kernel

On Thu, Jan 15, 2026 at 12:33:28AM +0000, Abdurrahman Hussain wrote:
> This makes the driver work on non-OF platforms.
> Also, make irq optional, since the driver can already work in
> polling mode.

Are you saying ACPI cannot describe interrupts?

    Andrew

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

* Re: [PATCH] spi: xilinx: use device property accessors.
  2026-01-16  7:51 ` Michal Simek
@ 2026-01-16 19:56   ` Abdurrahman Hussain
  0 siblings, 0 replies; 7+ messages in thread
From: Abdurrahman Hussain @ 2026-01-16 19:56 UTC (permalink / raw)
  To: Michal Simek; +Cc: Mark Brown, linux-spi, linux-arm-kernel, linux-kernel



> On Jan 15, 2026, at 11:51 PM, Michal Simek <michal.simek@amd.com> wrote:
> 
> 
> 
> On 1/15/26 01:33, Abdurrahman Hussain wrote:
>> This makes the driver work on non-OF platforms.
>> Also, make irq optional, since the driver can already work in
>> polling mode.
>> Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
>> ---
>>  drivers/spi/spi-xilinx.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
>> index c86dc56f38b4..9fb1da2fcce4 100644
>> --- a/drivers/spi/spi-xilinx.c
>> +++ b/drivers/spi/spi-xilinx.c
>> @@ -405,11 +405,11 @@ static int xilinx_spi_probe(struct platform_device *pdev)
>>   bits_per_word = pdata->bits_per_word;
>>   force_irq = pdata->force_irq;
>>   } else {
>> - of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits",
>> -   &num_cs);
>> - ret = of_property_read_u32(pdev->dev.of_node,
>> -    "xlnx,num-transfer-bits",
>> -    &bits_per_word);
>> + device_property_read_u32(&pdev->dev, "xlnx,num-ss-bits",
>> +  &num_cs);
>> + ret = device_property_read_u32(&pdev->dev,
>> +        "xlnx,num-transfer-bits",
>> +        &bits_per_word);
>>   if (ret)
>>   bits_per_word = 8;
>>   }
>> @@ -471,7 +471,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
>>   xspi->bytes_per_word = bits_per_word / 8;
>>   xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
>>  - xspi->irq = platform_get_irq(pdev, 0);
>> + xspi->irq = platform_get_irq_optional(pdev, 0);
>>   if (xspi->irq < 0 && xspi->irq != -ENXIO) {
>>   return xspi->irq;
>>   } else if (xspi->irq >= 0) {
> 
> 
> I expect this is another IP which you are using on systems with ACPI.
> Can you share ASL fragment you use for testing?
> 
> Thanks,
> Michal


Yes, that’s correct. We are using AMD Ryzen Embedded V3C48 based system with AMD (Xilinx) Artix 7 based FPGA using I2C and SPI IP blocks. The SPI block currently doesn’t have the interrupts working correctly (yet), so we disabled the interrupts. This is what the ASL fragment describing the SPI device looks like:

            Device (SPI0) {
                Name (_HID, "PRP0001")
                Name (_CRS, ResourceTemplate () {
                    Memory32Fixed (ReadWrite, 0x80950000, 0x00000200)
                })
                Name (_DSD, Package () {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package () {
                        Package () { "compatible", "xlnx,axi-quad-spi-1.00.a" },
                        Package () { "xlnx,num-ss-bits", 5 },
                        Package () { "xlnx,num-transfer-bits", 8 },
                    }
                })

                Device (NOR0) {
                    Name (_HID, "PRP0001")
                    Name (_STR, Unicode ("TH5 Boot Flash"))
                    Name (_CRS, ResourceTemplate () {
                        SPISerialBus(0, PolarityLow, FourWireMode, 8, ControllerInitiated,
                            120000000, ClockPolarityHigh, ClockPhaseSecond,
                            "\\_SB.PCI0.GPP6.FPGA.SPI0")
                    })
                    Name (_DSD, Package () {
                        ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                        Package () {
                            Package () { "compatible", "jedec,spi-nor" }
                        }
                    })
                }
            }

Thanks,
Abdurrahman

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

* Re: [PATCH] spi: xilinx: use device property accessors.
  2026-01-16 15:23 ` Andrew Lunn
@ 2026-01-16 20:00   ` Abdurrahman Hussain
  2026-01-16 20:11     ` Andrew Lunn
  0 siblings, 1 reply; 7+ messages in thread
From: Abdurrahman Hussain @ 2026-01-16 20:00 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Mark Brown, Michal Simek, linux-spi, linux-arm-kernel,
	linux-kernel



> On Jan 16, 2026, at 7:23 AM, Andrew Lunn <andrew@lunn.ch> wrote:
> 
> On Thu, Jan 15, 2026 at 12:33:28AM +0000, Abdurrahman Hussain wrote:
>> This makes the driver work on non-OF platforms.
>> Also, make irq optional, since the driver can already work in
>> polling mode.
> 
> Are you saying ACPI cannot describe interrupts?
> 
>    Andrew

It can. We have enabled the interrupts through ACPI on Xilinx I2C block and it works great.
For the SPI block we currently have an issue with our FPGA. Luckily the driver works just fine in the polling mode. By just making the interrupts optional makes the same driver usable on a wider range of hardware platforms, with or without the interrupts.

Thanks,
Abdurrahman 

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

* Re: [PATCH] spi: xilinx: use device property accessors.
  2026-01-16 20:00   ` Abdurrahman Hussain
@ 2026-01-16 20:11     ` Andrew Lunn
  2026-01-16 20:17       ` Abdurrahman Hussain
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2026-01-16 20:11 UTC (permalink / raw)
  To: Abdurrahman Hussain
  Cc: Mark Brown, Michal Simek, linux-spi, linux-arm-kernel,
	linux-kernel

On Fri, Jan 16, 2026 at 12:00:35PM -0800, Abdurrahman Hussain wrote:
> 
> 
> > On Jan 16, 2026, at 7:23 AM, Andrew Lunn <andrew@lunn.ch> wrote:
> > 
> > On Thu, Jan 15, 2026 at 12:33:28AM +0000, Abdurrahman Hussain wrote:
> >> This makes the driver work on non-OF platforms.
> >> Also, make irq optional, since the driver can already work in
> >> polling mode.
> > 
> > Are you saying ACPI cannot describe interrupts?
> > 
> >    Andrew
> 

> It can. We have enabled the interrupts through ACPI on Xilinx I2C
> block and it works great.  For the SPI block we currently have an
> issue with our FPGA. Luckily the driver works just fine in the
> polling mode. By just making the interrupts optional makes the same
> driver usable on a wider range of hardware platforms, with or
> without the interrupts.

It would be good to split this change into two patches, one making the
interrupt optional, and one swapping to device_foo calls. They are
logically different changes. And the commit message can then explain
you are doing this so the driver works with hardware with broken
interrupts.

Actually, you need three patches, you need to change the DT binding,
spi-xilinx.yaml, since currently interrupts are required, not
optional.

       Andrew

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

* Re: [PATCH] spi: xilinx: use device property accessors.
  2026-01-16 20:11     ` Andrew Lunn
@ 2026-01-16 20:17       ` Abdurrahman Hussain
  0 siblings, 0 replies; 7+ messages in thread
From: Abdurrahman Hussain @ 2026-01-16 20:17 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Mark Brown, Michal Simek, linux-spi, linux-arm-kernel,
	linux-kernel



> On Jan 16, 2026, at 12:11 PM, Andrew Lunn <andrew@lunn.ch> wrote:
> 
> On Fri, Jan 16, 2026 at 12:00:35PM -0800, Abdurrahman Hussain wrote:
>> 
>> 
>>> On Jan 16, 2026, at 7:23 AM, Andrew Lunn <andrew@lunn.ch> wrote:
>>> 
>>> On Thu, Jan 15, 2026 at 12:33:28AM +0000, Abdurrahman Hussain wrote:
>>>> This makes the driver work on non-OF platforms.
>>>> Also, make irq optional, since the driver can already work in
>>>> polling mode.
>>> 
>>> Are you saying ACPI cannot describe interrupts?
>>> 
>>>   Andrew
>> 
> 
>> It can. We have enabled the interrupts through ACPI on Xilinx I2C
>> block and it works great.  For the SPI block we currently have an
>> issue with our FPGA. Luckily the driver works just fine in the
>> polling mode. By just making the interrupts optional makes the same
>> driver usable on a wider range of hardware platforms, with or
>> without the interrupts.
> 
> It would be good to split this change into two patches, one making the
> interrupt optional, and one swapping to device_foo calls. They are
> logically different changes. And the commit message can then explain
> you are doing this so the driver works with hardware with broken
> interrupts.
> 
> Actually, you need three patches, you need to change the DT binding,
> spi-xilinx.yaml, since currently interrupts are required, not
> optional.
> 
>       Andrew

Sounds good! I will split this change into three patches and re-submit.

Thanks for your review, Andrew!

Regards,
Abdurrahman

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

end of thread, other threads:[~2026-01-16 20:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15  0:33 [PATCH] spi: xilinx: use device property accessors Abdurrahman Hussain
2026-01-16  7:51 ` Michal Simek
2026-01-16 19:56   ` Abdurrahman Hussain
2026-01-16 15:23 ` Andrew Lunn
2026-01-16 20:00   ` Abdurrahman Hussain
2026-01-16 20:11     ` Andrew Lunn
2026-01-16 20:17       ` Abdurrahman Hussain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox