forked from luck/tmp_suning_uos_patched
spi: HiSilicon v3xx: Use DMI quirk to set controller buswidth override bits
The Huawei D06 board (and variants) can support Quad mode of operation. Since we have no current method in ACPI SPI bus device resource description to describe this information, use DMI to detect the board, and set the controller buswidth override bits. Signed-off-by: John Garry <john.garry@huawei.com> Link: https://lore.kernel.org/r/1582903131-160033-4-git-send-email-john.garry@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
8fe21d6b34
commit
34e608b023
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
@ -250,6 +251,44 @@ static const struct spi_controller_mem_ops hisi_sfc_v3xx_mem_ops = {
|
|||
.exec_op = hisi_sfc_v3xx_exec_op,
|
||||
};
|
||||
|
||||
static int hisi_sfc_v3xx_buswidth_override_bits;
|
||||
|
||||
/*
|
||||
* ACPI FW does not allow us to currently set the device buswidth, so quirk it
|
||||
* depending on the board.
|
||||
*/
|
||||
static int __init hisi_sfc_v3xx_dmi_quirk(const struct dmi_system_id *d)
|
||||
{
|
||||
hisi_sfc_v3xx_buswidth_override_bits = SPI_RX_QUAD | SPI_TX_QUAD;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dmi_system_id hisi_sfc_v3xx_dmi_quirk_table[] = {
|
||||
{
|
||||
.callback = hisi_sfc_v3xx_dmi_quirk,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Huawei"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "D06"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.callback = hisi_sfc_v3xx_dmi_quirk,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Huawei"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "TaiShan 2280 V2"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.callback = hisi_sfc_v3xx_dmi_quirk,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Huawei"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "TaiShan 200 (Model 2280)"),
|
||||
},
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
|
@ -265,6 +304,8 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
|
|||
ctlr->mode_bits = SPI_RX_DUAL | SPI_RX_QUAD |
|
||||
SPI_TX_DUAL | SPI_TX_QUAD;
|
||||
|
||||
ctlr->buswidth_override_bits = hisi_sfc_v3xx_buswidth_override_bits;
|
||||
|
||||
host = spi_controller_get_devdata(ctlr);
|
||||
host->dev = dev;
|
||||
|
||||
|
@ -320,7 +361,20 @@ static struct platform_driver hisi_sfc_v3xx_spi_driver = {
|
|||
.probe = hisi_sfc_v3xx_probe,
|
||||
};
|
||||
|
||||
module_platform_driver(hisi_sfc_v3xx_spi_driver);
|
||||
static int __init hisi_sfc_v3xx_spi_init(void)
|
||||
{
|
||||
dmi_check_system(hisi_sfc_v3xx_dmi_quirk_table);
|
||||
|
||||
return platform_driver_register(&hisi_sfc_v3xx_spi_driver);
|
||||
}
|
||||
|
||||
static void __exit hisi_sfc_v3xx_spi_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&hisi_sfc_v3xx_spi_driver);
|
||||
}
|
||||
|
||||
module_init(hisi_sfc_v3xx_spi_init);
|
||||
module_exit(hisi_sfc_v3xx_spi_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("John Garry <john.garry@huawei.com>");
|
||||
|
|
Loading…
Reference in New Issue
Block a user