diff options
author | Timur Tabi <timur@codeaurora.org> | 2016-12-08 13:24:21 -0600 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-12-09 22:11:02 -0500 |
commit | a51f4047232aeb4aee85268b351c7a84b83b36c5 (patch) | |
tree | d35ca8c893f3e1af1618ba7acbb9abe91863dd77 /drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | |
parent | net: qcom/emac: move phy init code to separate files (diff) | |
download | linux-dev-a51f4047232aeb4aee85268b351c7a84b83b36c5.tar.xz linux-dev-a51f4047232aeb4aee85268b351c7a84b83b36c5.zip |
net: qcom/emac: add support for the Qualcomm Technologies QDF2400
The QDF2432 and the QDF2400 have slightly different internal PHYs,
so there are some programming differences. Some of the registers in
the QDF2400 have moved, and some registers require different values
during initialization.
Because of the differences, and because HIDs are a scare resource,
the ACPI tables specify the hardware version in an _HRV property.
Version 1 is the QDF2432, and version 2 is the QDF2400. Any future
SOC that has the same internal PHY but different programming
requirements will be assigned the next available version number.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm/emac/emac-sgmii.c')
-rw-r--r-- | drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c b/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c index 0b25c46dc15c..bf722a9bb09d 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c +++ b/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c @@ -161,20 +161,45 @@ void emac_sgmii_reset(struct emac_adapter *adpt) static int emac_sgmii_acpi_match(struct device *dev, void *data) { +#ifdef CONFIG_ACPI static const struct acpi_device_id match_table[] = { { .id = "QCOM8071", - .driver_data = (kernel_ulong_t)emac_sgmii_init_qdf2432, }, {} }; const struct acpi_device_id *id = acpi_match_device(match_table, dev); emac_sgmii_initialize *initialize = data; - if (id) - *initialize = (emac_sgmii_initialize)id->driver_data; + if (id) { + acpi_handle handle = ACPI_HANDLE(dev); + unsigned long long hrv; + acpi_status status; + + status = acpi_evaluate_integer(handle, "_HRV", NULL, &hrv); + if (status) { + if (status == AE_NOT_FOUND) + /* Older versions of the QDF2432 ACPI tables do + * not have an _HRV property. + */ + hrv = 1; + else + /* Something is wrong with the tables */ + return 0; + } - return !!id; + switch (hrv) { + case 1: + *initialize = emac_sgmii_init_qdf2432; + return 1; + case 2: + *initialize = emac_sgmii_init_qdf2400; + return 1; + } + } +#endif + + return 0; } static const struct of_device_id emac_sgmii_dt_match[] = { |