mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 14:13:16 +00:00
raimps: mtk_eth_soc: drop rst_esw from ESW driver
The ESW core needs to be reset together with FE core, so after the relevant reset controller lines are moved under FE, drop rst_esw and all related code, which would not execute anyway, because rst_esw would be NULL. While at that, ensure that if reset line for EPHY cannot be claimed, a proper error message is reported. Fixes:60fadae62b
("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe") Co-developed-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com> Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com> [Split out of the bigger commit, provide commit mesage, refactor error handling] Signed-off-by: Lech Perczak <lech.perczak@gmail.com> (cherry picked from commitf393ffcac1
) Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
This commit is contained in:
parent
5ef01117b7
commit
17ee3e0b20
@ -235,7 +235,6 @@ struct rt305x_esw {
|
|||||||
int led_frequency;
|
int led_frequency;
|
||||||
struct esw_vlan vlans[RT305X_ESW_NUM_VLANS];
|
struct esw_vlan vlans[RT305X_ESW_NUM_VLANS];
|
||||||
struct esw_port ports[RT305X_ESW_NUM_PORTS];
|
struct esw_port ports[RT305X_ESW_NUM_PORTS];
|
||||||
struct reset_control *rst_esw;
|
|
||||||
struct reset_control *rst_ephy;
|
struct reset_control *rst_ephy;
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -259,18 +258,6 @@ static inline void esw_rmw_raw(struct rt305x_esw *esw, unsigned reg,
|
|||||||
__raw_writel(t | val, esw->base + reg);
|
__raw_writel(t | val, esw->base + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void esw_reset(struct rt305x_esw *esw)
|
|
||||||
{
|
|
||||||
if (!esw->rst_esw)
|
|
||||||
return;
|
|
||||||
|
|
||||||
reset_control_assert(esw->rst_esw);
|
|
||||||
usleep_range(60, 120);
|
|
||||||
reset_control_deassert(esw->rst_esw);
|
|
||||||
/* the esw takes long to reset otherwise the board hang */
|
|
||||||
msleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void esw_reset_ephy(struct rt305x_esw *esw)
|
static void esw_reset_ephy(struct rt305x_esw *esw)
|
||||||
{
|
{
|
||||||
if (!esw->rst_ephy)
|
if (!esw->rst_ephy)
|
||||||
@ -464,8 +451,6 @@ static void esw_hw_init(struct rt305x_esw *esw)
|
|||||||
u8 port_disable = 0;
|
u8 port_disable = 0;
|
||||||
u8 port_map = RT305X_ESW_PMAP_LLLLLL;
|
u8 port_map = RT305X_ESW_PMAP_LLLLLL;
|
||||||
|
|
||||||
esw_reset(esw);
|
|
||||||
|
|
||||||
/* vodoo from original driver */
|
/* vodoo from original driver */
|
||||||
esw_w32(esw, 0xC8A07850, RT305X_ESW_REG_FCT0);
|
esw_w32(esw, 0xC8A07850, RT305X_ESW_REG_FCT0);
|
||||||
esw_w32(esw, 0x00000000, RT305X_ESW_REG_SGC2);
|
esw_w32(esw, 0x00000000, RT305X_ESW_REG_SGC2);
|
||||||
@ -1435,12 +1420,11 @@ static int esw_probe(struct platform_device *pdev)
|
|||||||
if (reg_init)
|
if (reg_init)
|
||||||
esw->reg_led_polarity = be32_to_cpu(*reg_init);
|
esw->reg_led_polarity = be32_to_cpu(*reg_init);
|
||||||
|
|
||||||
esw->rst_esw = devm_reset_control_get(&pdev->dev, "esw");
|
esw->rst_ephy = devm_reset_control_get_exclusive(&pdev->dev, "ephy");
|
||||||
if (IS_ERR(esw->rst_esw))
|
if (IS_ERR(esw->rst_ephy)) {
|
||||||
esw->rst_esw = NULL;
|
dev_err(esw->dev, "failed to get EPHY reset: %pe\n", esw->rst_ephy);
|
||||||
esw->rst_ephy = devm_reset_control_get(&pdev->dev, "ephy");
|
|
||||||
if (IS_ERR(esw->rst_ephy))
|
|
||||||
esw->rst_ephy = NULL;
|
esw->rst_ephy = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock_init(&esw->reg_rw_lock);
|
spin_lock_init(&esw->reg_rw_lock);
|
||||||
platform_set_drvdata(pdev, esw);
|
platform_set_drvdata(pdev, esw);
|
||||||
|
Loading…
Reference in New Issue
Block a user