7fbd97feca55d0f7cb80c1f6d93b5b187d437b7d
[openwrt/staging/mkresin.git] / target / linux / lantiq / patches-5.4 / 0024-MIPS-lantiq-autoselect-soc-rev-matching-fw.patch
1 From ae0c287060749dc72c866484d12bd3cade8c517d Mon Sep 17 00:00:00 2001
2 From: Mathias Kresin <dev@kresin.me>
3 Date: Fri, 19 Jan 2018 20:19:06 +0100
4 Subject: [PATCH] MIPS: lantiq: autoselect matching vr9 rev gphy firmware
5
6 Add a custom xrx200 ethernet phy compatible to load the firmware matching
7 the vr9 revision without specifing an expected revision.
8
9 We have quite a few boards in the tree were later produced ones are using
10 a more recent vr9. It is impossible to distinguish which revision of the
11 vr9 is used without opening the case and removing a heatsink for some of
12 them.
13
14 Signed-off-by: Mathias Kresin <dev@kresin.me>
15 ---
16 drivers/soc/lantiq/gphy.c | 11 +++++++++++
17 1 file changed, 11 insertions(+)
18
19 --- a/drivers/soc/lantiq/gphy.c
20 +++ b/drivers/soc/lantiq/gphy.c
21 @@ -55,6 +55,7 @@ static const struct xway_gphy_match_data
22 };
23
24 static const struct of_device_id xway_gphy_match[] = {
25 + { .compatible = "lantiq,xrx200-gphy", .data = NULL },
26 { .compatible = "lantiq,xrx200a1x-gphy", .data = &xrx200a1x_gphy_data },
27 { .compatible = "lantiq,xrx200a2x-gphy", .data = &xrx200a2x_gphy_data },
28 { .compatible = "lantiq,xrx300-gphy", .data = &xrx300_gphy_data },
29 @@ -111,6 +112,16 @@ static int xway_gphy_of_probe(struct pla
30
31 gphy_fw_name_cfg = of_device_get_match_data(dev);
32
33 + if (of_device_is_compatible(pdev->dev.of_node, "lantiq,xrx200-gphy"))
34 + switch (ltq_soc_type()) {
35 + case SOC_TYPE_VR9:
36 + gphy_fw_name_cfg = &xrx200a1x_gphy_data;
37 + break;
38 + case SOC_TYPE_VR9_2:
39 + gphy_fw_name_cfg = &xrx200a2x_gphy_data;
40 + break;
41 + }
42 +
43 priv->gphy_clk_gate = devm_clk_get(dev, NULL);
44 if (IS_ERR(priv->gphy_clk_gate)) {
45 dev_err(dev, "Failed to lookup gate clock\n");