net: ethernet: ti: am65-cpsw: retain PORT_VLAN_REG after suspend/resume

During suspend resume the context of PORT_VLAN_REG is lost so
save it during suspend and restore it during resume for
host port and slave ports.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Roger Quadros 2022-11-04 15:23:09 +02:00 коммит произвёл David S. Miller
Родитель eadb434374
Коммит 643cf0e3ab
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -2877,7 +2877,9 @@ static int am65_cpsw_nuss_suspend(struct device *dev)
struct am65_cpsw_port *port;
struct net_device *ndev;
int i, ret;
struct am65_cpsw_host *host_p = am65_common_get_host(common);
host_p->vid_context = readl(host_p->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET);
for (i = 0; i < common->port_num; i++) {
port = &common->ports[i];
ndev = port->ndev;
@ -2885,6 +2887,7 @@ static int am65_cpsw_nuss_suspend(struct device *dev)
if (!ndev)
continue;
port->vid_context = readl(port->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET);
netif_device_detach(ndev);
if (netif_running(ndev)) {
rtnl_lock();
@ -2908,6 +2911,7 @@ static int am65_cpsw_nuss_resume(struct device *dev)
struct am65_cpsw_port *port;
struct net_device *ndev;
int i, ret;
struct am65_cpsw_host *host_p = am65_common_get_host(common);
am65_cpts_resume(common->cpts);
@ -2929,8 +2933,11 @@ static int am65_cpsw_nuss_resume(struct device *dev)
}
netif_device_attach(ndev);
writel(port->vid_context, port->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET);
}
writel(host_p->vid_context, host_p->port_base + AM65_CPSW_PORT_VLAN_REG_OFFSET);
return 0;
}
#endif /* CONFIG_PM_SLEEP */

Просмотреть файл

@ -55,12 +55,16 @@ struct am65_cpsw_port {
bool rx_ts_enabled;
struct am65_cpsw_qos qos;
struct devlink_port devlink_port;
/* Only for suspend resume context */
u32 vid_context;
};
struct am65_cpsw_host {
struct am65_cpsw_common *common;
void __iomem *port_base;
void __iomem *stat_base;
/* Only for suspend resume context */
u32 vid_context;
};
struct am65_cpsw_tx_chn {