summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-amd.c
AgeCommit message (Collapse)AuthorFilesLines
2020-11-23spi: amd: Use devm_platform_ioremap_resource() in amd_spi_probeQing Zhang1-4/+1
Simplify this function implementation by using a known wrapper function. Signed-off-by: Qing Zhang <zhangqing@loongson.cn> Link: https://lore.kernel.org/r/1605930231-19448-1-git-send-email-zhangqing@loongson.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-17spi: spi-amd: Do not define 'struct acpi_device_id' when !CONFIG_ACPILee Jones1-0/+2
Since ACPI_PTR() is used to NULLify the value when !CONFIG_ACPI, struct 'spi_acpi_match' becomes defined but unused. Fixes the following W=1 kernel build warning(s): drivers/spi/spi-amd.c:297:36: warning: ‘spi_acpi_match’ defined but not used [-Wunused-const-variable=] 297 | static const struct acpi_device_id spi_acpi_match[] = { | ^~~~~~~~~~~~~~ Signed-off-by: Lee Jones <lee.jones@linaro.org> Cc: Sanjay R Mehta <sanju.mehta@amd.com> Link: https://lore.kernel.org/r/20200717135424.2442271-15-lee.jones@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-04spi: amd: Drop superfluous member from struct amd_spiLukas Wunner1-4/+2
The AMD SPI driver stores a pointer to the spi_master in struct amd_spi so that it can get from the latter to the former in amd_spi_fifo_xfer(). It's simpler to just pass the pointer from the sole caller amd_spi_master_transfer() and drop the pointer from struct amd_spi. Signed-off-by: Lukas Wunner <lukas@wunner.de> Link: https://lore.kernel.org/r/a088b684ad292faf3bd036e51529e608e5c94638.1588590210.git.lukas@wunner.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-04spi: amd: Fix refcount underflow on removeLukas Wunner1-12/+1
The AMD SPI driver calls spi_master_put() in its ->remove() hook even though the preceding call to spi_unregister_master() already drops a ref, thus leading to a refcount underflow. Drop the superfluous call to spi_master_put(). This only leaves the call to spi_unregister_master() in the ->remove() hook, so it's safe to change the ->probe() hook to use the devm version of spi_register_master() and drop the ->remove() hook altogether. Signed-off-by: Lukas Wunner <lukas@wunner.de> Link: https://lore.kernel.org/r/5e53ccdf1eecd4e015dba99d0d77389107f8a2e3.1588590210.git.lukas@wunner.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-04spi: amd: Drop duplicate driver data assignmentsLukas Wunner1-2/+0
The AMD SPI driver calls platform_set_drvdata() on probe even though it's already been set by __spi_alloc_controller(). Likewise, it calls platform_set_drvdata() on remove even though it's going to be set by __device_release_driver(). Drop the duplicate assignments. Signed-off-by: Lukas Wunner <lukas@wunner.de> Link: https://lore.kernel.org/r/499f8ad4759c2ff0f586e0459fb9a293faecff6d.1588590210.git.lukas@wunner.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-04spi: amd: Pass probe errors back to driver coreLukas Wunner1-1/+1
If probing fails, the AMD SPI driver pretends success to the driver core by returning 0. Return the errno instead. Signed-off-by: Lukas Wunner <lukas@wunner.de> Link: https://lore.kernel.org/r/689f29a359718dab4f5de9ee66c02ea97b3bd9e8.1588590210.git.lukas@wunner.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-04spi: amd: Fix duplicate iounmap in error pathLukas Wunner1-3/+1
The AMD SPI driver uses devm_ioremap_resource() to map its registers, so they're automatically unmapped via device_release() when the last ref on the SPI controller is dropped. The additional iounmap() in the ->probe() error path is thus unnecessary. Signed-off-by: Lukas Wunner <lukas@wunner.de> Link: https://lore.kernel.org/r/497cc38ae2beb7900ae05a1463eb83ff96e2770e.1588590210.git.lukas@wunner.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29spi: spi-amd: Fix a NULL vs IS_ERR() check in amd_spi_probe()Wei Yongjun1-3/+2
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: bbb336f39efc ("spi: spi-amd: Add AMD SPI controller driver support") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20200429025426.167664-1-weiyongjun1@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-28spi: spi-amd: fix warningSanjay R Mehta1-1/+1
remove unused variable "opcode" Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/1588049801-37995-1-git-send-email-sanju.mehta@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-27spi: spi-amd: Add AMD SPI controller driver supportSanjay R Mehta1-0/+333
This driver supports SPI Controller for AMD SOCs.This driver supports SPI operations using FIFO mode of transfer. Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/1587844788-33997-1-git-send-email-sanju.mehta@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>