Skip to content

Commit

Permalink
net: dsa: qca8k: add support for QCA8328
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ansuel Smith authored and David S. Miller committed Oct 15, 2021
1 parent ed7988d commit f477d1c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions drivers/net/dsa/qca8k.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ static int
qca8k_setup_of_pws_reg(struct qca8k_priv *priv)
{
struct device_node *node = priv->dev->of_node;
const struct qca8k_match_data *data;
u32 val = 0;
int ret;

Expand All @@ -943,8 +944,14 @@ qca8k_setup_of_pws_reg(struct qca8k_priv *priv)
* Should be applied by default but we set this just to make sure.
*/
if (priv->switch_id == QCA8K_ID_QCA8327) {
data = of_device_get_match_data(priv->dev);

/* Set the correct package of 148 pin for QCA8327 */
if (data->reduced_package)
val |= QCA8327_PWS_PACKAGE148_EN;

ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8327_PWS_PACKAGE148_EN,
QCA8327_PWS_PACKAGE148_EN);
val);
if (ret)
return ret;
}
Expand Down Expand Up @@ -2105,7 +2112,12 @@ static int qca8k_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(qca8k_pm_ops,
qca8k_suspend, qca8k_resume);

static const struct qca8k_match_data qca832x = {
static const struct qca8k_match_data qca8327 = {
.id = QCA8K_ID_QCA8327,
.reduced_package = true,
};

static const struct qca8k_match_data qca8328 = {
.id = QCA8K_ID_QCA8327,
};

Expand All @@ -2114,7 +2126,8 @@ static const struct qca8k_match_data qca833x = {
};

static const struct of_device_id qca8k_of_match[] = {
{ .compatible = "qca,qca8327", .data = &qca832x },
{ .compatible = "qca,qca8327", .data = &qca8327 },
{ .compatible = "qca,qca8328", .data = &qca8328 },
{ .compatible = "qca,qca8334", .data = &qca833x },
{ .compatible = "qca,qca8337", .data = &qca833x },
{ /* sentinel */ },
Expand Down
1 change: 1 addition & 0 deletions drivers/net/dsa/qca8k.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ struct ar8xxx_port_status {

struct qca8k_match_data {
u8 id;
bool reduced_package;
};

enum {
Expand Down

0 comments on commit f477d1c

Please sign in to comment.