summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-cadence-xspi.c
diff options
context:
space:
mode:
authorWitold Sadowski <wsadowski@marvell.com>2024-07-24 08:47:37 -0700
committerMark Brown <broonie@kernel.org>2024-07-29 01:19:30 +0100
commit4b8cb7dcd8acd7a05354f0b458aca02e4497f2a6 (patch)
treedf69cd4c47740a006c51ac0a62bdeb46497ca753 /drivers/spi/spi-cadence-xspi.c
parent931e389ded0f1411cbf07ad50074dc2bcd49e1a8 (diff)
downloadlwn-4b8cb7dcd8acd7a05354f0b458aca02e4497f2a6.tar.gz
lwn-4b8cb7dcd8acd7a05354f0b458aca02e4497f2a6.zip
spi: cadence: Change resource mapping
If mapping resource by name will fail try to map resource by number. Such situation can occur in ACPI case. Signed-off-by: Witold Sadowski <wsadowski@marvell.com> Signed-off-by: Piyush Malgujar <pmalgujar@marvell.com> Link: https://patch.msgid.link/20240724154739.582367-8-wsadowski@marvell.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-cadence-xspi.c')
-rw-r--r--drivers/spi/spi-cadence-xspi.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c
index 69c08bae7628..a129f33bfd38 100644
--- a/drivers/spi/spi-cadence-xspi.c
+++ b/drivers/spi/spi-cadence-xspi.c
@@ -1118,28 +1118,41 @@ static int cdns_xspi_probe(struct platform_device *pdev)
cdns_xspi->iobase = devm_platform_ioremap_resource_byname(pdev, "io");
if (IS_ERR(cdns_xspi->iobase)) {
- dev_err(dev, "Failed to remap controller base address\n");
- return PTR_ERR(cdns_xspi->iobase);
+ cdns_xspi->iobase = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(cdns_xspi->iobase)) {
+ dev_err(dev, "Failed to remap controller base address\n");
+ return PTR_ERR(cdns_xspi->iobase);
+ }
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sdma");
cdns_xspi->sdmabase = devm_ioremap_resource(dev, res);
- if (IS_ERR(cdns_xspi->sdmabase))
- return PTR_ERR(cdns_xspi->sdmabase);
+ if (IS_ERR(cdns_xspi->sdmabase)) {
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ cdns_xspi->sdmabase = devm_ioremap_resource(dev, res);
+ if (IS_ERR(cdns_xspi->sdmabase))
+ return PTR_ERR(cdns_xspi->sdmabase);
+ }
cdns_xspi->sdmasize = resource_size(res);
cdns_xspi->auxbase = devm_platform_ioremap_resource_byname(pdev, "aux");
if (IS_ERR(cdns_xspi->auxbase)) {
- dev_err(dev, "Failed to remap AUX address\n");
- return PTR_ERR(cdns_xspi->auxbase);
+ cdns_xspi->auxbase = devm_platform_ioremap_resource(pdev, 2);
+ if (IS_ERR(cdns_xspi->auxbase)) {
+ dev_err(dev, "Failed to remap AUX address\n");
+ return PTR_ERR(cdns_xspi->auxbase);
+ }
}
if (cdns_xspi->driver_data->mrvl_hw_overlay) {
cdns_xspi->xferbase = devm_platform_ioremap_resource_byname(pdev, "xfer");
if (IS_ERR(cdns_xspi->xferbase)) {
- dev_info(dev, "XFER register base not found, set it\n");
- // For compatibility with older firmware
- cdns_xspi->xferbase = cdns_xspi->iobase + 0x8000;
+ cdns_xspi->xferbase = devm_platform_ioremap_resource(pdev, 3);
+ if (IS_ERR(cdns_xspi->xferbase)) {
+ dev_info(dev, "XFER register base not found, set it\n");
+ // For compatibility with older firmware
+ cdns_xspi->xferbase = cdns_xspi->iobase + 0x8000;
+ }
}
}