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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 07, 2024 at 08:18:30AM -0700, Witold Sadowski wrote:

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

> +#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?

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

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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux