Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: qca8k: add support for QCA8328

QCA8328 switch is the bigger brother of the qca8327. Same regs different
chip. Change the function to set the correct pin layout and introduce a
new match_data to differentiate the 2 switch as they have the same ID
and their internal PHY have the same ID.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ansuel Smith and committed by
David S. Miller
f477d1c8 ed7988d7

+17 -3
+16 -3
drivers/net/dsa/qca8k.c
··· 935 935 qca8k_setup_of_pws_reg(struct qca8k_priv *priv) 936 936 { 937 937 struct device_node *node = priv->dev->of_node; 938 + const struct qca8k_match_data *data; 938 939 u32 val = 0; 939 940 int ret; 940 941 ··· 944 943 * Should be applied by default but we set this just to make sure. 945 944 */ 946 945 if (priv->switch_id == QCA8K_ID_QCA8327) { 946 + data = of_device_get_match_data(priv->dev); 947 + 948 + /* Set the correct package of 148 pin for QCA8327 */ 949 + if (data->reduced_package) 950 + val |= QCA8327_PWS_PACKAGE148_EN; 951 + 947 952 ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8327_PWS_PACKAGE148_EN, 948 - QCA8327_PWS_PACKAGE148_EN); 953 + val); 949 954 if (ret) 950 955 return ret; 951 956 } ··· 2112 2105 static SIMPLE_DEV_PM_OPS(qca8k_pm_ops, 2113 2106 qca8k_suspend, qca8k_resume); 2114 2107 2115 - static const struct qca8k_match_data qca832x = { 2108 + static const struct qca8k_match_data qca8327 = { 2109 + .id = QCA8K_ID_QCA8327, 2110 + .reduced_package = true, 2111 + }; 2112 + 2113 + static const struct qca8k_match_data qca8328 = { 2116 2114 .id = QCA8K_ID_QCA8327, 2117 2115 }; 2118 2116 ··· 2126 2114 }; 2127 2115 2128 2116 static const struct of_device_id qca8k_of_match[] = { 2129 - { .compatible = "qca,qca8327", .data = &qca832x }, 2117 + { .compatible = "qca,qca8327", .data = &qca8327 }, 2118 + { .compatible = "qca,qca8328", .data = &qca8328 }, 2130 2119 { .compatible = "qca,qca8334", .data = &qca833x }, 2131 2120 { .compatible = "qca,qca8337", .data = &qca833x }, 2132 2121 { /* sentinel */ },
+1
drivers/net/dsa/qca8k.h
··· 260 260 261 261 struct qca8k_match_data { 262 262 u8 id; 263 + bool reduced_package; 263 264 }; 264 265 265 266 enum {