RE: [EXTERNAL] Re: [PATCH v8 3/4] spi: cadence: Allow to read basic xSPI configuration from ACPI

From: Witold Sadowski
Date: Tue Jun 11 2024 - 17:57:35 EST


Hi

> > These changes enable reading the configurations from ACPI tables as
> > required for successful probing in an ACPI UEFI environment. In the
> > case of an ACPI-disabled or DTS-based environment, it will continue to
> > read configurations from DTS as before.
>
> This doesn't describe what the ACPI tables are supposed to look like or
> anything, it's hard to review this...

There should be an example of ACPI table in commit message?

>
> > +#ifdef CONFIG_ACPI
> > +static bool cdns_xspi_supports_op(struct spi_mem *mem,
> > + const struct spi_mem_op *op)
> > +{
>
> > + if (!acpi_dev_get_property(adev, "spi-tx-bus-width",
> ACPI_TYPE_INTEGER,
> > + &obj)) {
>
> > + if (!acpi_dev_get_property(adev, "spi-rx-bus-width",
> ACPI_TYPE_INTEGER,
> > + &obj)) {
>
> Why is this Cadence specific?

So that part should do to generic spi? I think right now it is not
Supported to read tx/rx bus width from acpi.

>
> > static int cdns_xspi_of_get_plat_data(struct platform_device *pdev)
> > {
> > - struct device_node *node_prop = pdev->dev.of_node;
> > + struct fwnode_handle *fwnode_child;
> > unsigned int cs;
> >
> > - for_each_available_child_of_node_scoped(node_prop, node_child) {
> > - if (of_property_read_u32(node_child, "reg", &cs)) {
> > + device_for_each_child_node(&pdev->dev, fwnode_child) {
> > + if (!fwnode_device_is_available(fwnode_child))
> > + continue;
> > +
> > + if (fwnode_property_read_u32(fwnode_child, "reg", &cs)) {
> > dev_err(&pdev->dev, "Couldn't get memory chip
> select\n");
> > + fwnode_handle_put(fwnode_child);
> > return -ENXIO;
> > } else if (cs >= CDNS_XSPI_MAX_BANKS) {
> > dev_err(&pdev->dev, "reg (cs) parameter value too
> large\n");
> > + fwnode_handle_put(fwnode_child);
> > return -ENXIO;
> > }
> > }
>
> This is just a general refactoring to fwnode and could be split out.

Ok.

>
> > @@ -814,19 +890,19 @@ static int cdns_xspi_probe(struct platform_device
> *pdev)
> > if (ret)
> > return -ENODEV;
> >
> > - cdns_xspi->iobase = devm_platform_ioremap_resource_byname(pdev,
> "io");
> > + cdns_xspi->iobase = devm_platform_ioremap_resource(pdev, 0);
>
> > - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sdma");
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>
> > - cdns_xspi->auxbase = devm_platform_ioremap_resource_byname(pdev,
> "aux");
> > + cdns_xspi->auxbase = devm_platform_ioremap_resource(pdev, 2);
>
> This causes us to ignore naming on resources, that's an ABI break for
> other systems.

In that case acpi tables are not able to find resource by name. Or at
least I wasn't able to find a way to handle that in different way.
Is there better solution for that part?

Regards
Witek