* [PATCH 0/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() @ 2022-12-26 6:53 ` Yoshihiro Shimoda 0 siblings, 0 replies; 8+ messages in thread From: Yoshihiro Shimoda @ 2022-12-26 6:53 UTC (permalink / raw) To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda Add initialization function for each channel from step 9 or later on the datasheet. Otherwise, the rswitch driver cannot initialize this SERDES hardware correctly. Yoshihiro Shimoda (2): phy: renesas: r8a779f0-eth-serdes: Add .power_on() into phy_ops phy: renesas: r8a779f0-eth-serdes: Remove retry code in .init() drivers/phy/renesas/r8a779f0-ether-serdes.c | 65 ++++++++++----------- 1 file changed, 30 insertions(+), 35 deletions(-) -- 2.25.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 0/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() @ 2022-12-26 6:53 ` Yoshihiro Shimoda 0 siblings, 0 replies; 8+ messages in thread From: Yoshihiro Shimoda @ 2022-12-26 6:53 UTC (permalink / raw) To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda Add initialization function for each channel from step 9 or later on the datasheet. Otherwise, the rswitch driver cannot initialize this SERDES hardware correctly. Yoshihiro Shimoda (2): phy: renesas: r8a779f0-eth-serdes: Add .power_on() into phy_ops phy: renesas: r8a779f0-eth-serdes: Remove retry code in .init() drivers/phy/renesas/r8a779f0-ether-serdes.c | 65 ++++++++++----------- 1 file changed, 30 insertions(+), 35 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() into phy_ops 2022-12-26 6:53 ` Yoshihiro Shimoda @ 2022-12-26 6:53 ` Yoshihiro Shimoda -1 siblings, 0 replies; 8+ messages in thread From: Yoshihiro Shimoda @ 2022-12-26 6:53 UTC (permalink / raw) To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda Add r8a779f0_eth_serdes_power_on() to initialize the hardware for each channel from the step 9 or later on the datasheet. In other words, the procedure from the step 1 to 8 is for all channel and it is needed once only. So, the .init() in any channel instance is called, this driver initializes the hardware from step 1 to 8. And then, .power_on() is called, this driver initializes the hardware from step 9 or later. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/phy/renesas/r8a779f0-ether-serdes.c | 57 +++++++++++---------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/phy/renesas/r8a779f0-ether-serdes.c b/drivers/phy/renesas/r8a779f0-ether-serdes.c index e7588a940d69..9f55a08e6da1 100644 --- a/drivers/phy/renesas/r8a779f0-ether-serdes.c +++ b/drivers/phy/renesas/r8a779f0-ether-serdes.c @@ -242,34 +242,7 @@ static int r8a779f0_eth_serdes_hw_init(struct r8a779f0_eth_serdes_channel *chann if (ret) return ret; - ret = r8a779f0_eth_serdes_reg_wait(&dd->channel[0], 0x0000, 0x380, BIT(15), 0); - if (ret) - return ret; - - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) { - ret = r8a779f0_eth_serdes_chan_setting(&dd->channel[i]); - if (ret) - return ret; - } - - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) { - ret = r8a779f0_eth_serdes_chan_speed(&dd->channel[i]); - if (ret) - return ret; - } - - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) - r8a779f0_eth_serdes_write32(dd->channel[i].addr, 0x03c0, 0x380, 0x0000); - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) - r8a779f0_eth_serdes_write32(dd->channel[i].addr, 0x03d0, 0x380, 0x0000); - - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) { - ret = r8a779f0_eth_serdes_monitor_linkup(&dd->channel[i]); - if (ret) - return ret; - } - - return 0; + return r8a779f0_eth_serdes_reg_wait(&dd->channel[0], 0x0000, 0x380, BIT(15), 0); } static int r8a779f0_eth_serdes_init(struct phy *p) @@ -289,6 +262,33 @@ static int r8a779f0_eth_serdes_init(struct phy *p) return ret; } +static int r8a779f0_eth_serdes_hw_init_late(struct r8a779f0_eth_serdes_channel +*channel) +{ + int ret; + + ret = r8a779f0_eth_serdes_chan_setting(channel); + if (ret) + return ret; + + ret = r8a779f0_eth_serdes_chan_speed(channel); + if (ret) + return ret; + + r8a779f0_eth_serdes_write32(channel->addr, 0x03c0, 0x380, 0x0000); + + r8a779f0_eth_serdes_write32(channel->addr, 0x03d0, 0x380, 0x0000); + + return r8a779f0_eth_serdes_monitor_linkup(channel); +} + +static int r8a779f0_eth_serdes_power_on(struct phy *p) +{ + struct r8a779f0_eth_serdes_channel *channel = phy_get_drvdata(p); + + return r8a779f0_eth_serdes_hw_init_late(channel); +} + static int r8a779f0_eth_serdes_set_mode(struct phy *p, enum phy_mode mode, int submode) { @@ -319,6 +319,7 @@ static int r8a779f0_eth_serdes_set_speed(struct phy *p, int speed) static const struct phy_ops r8a779f0_eth_serdes_ops = { .init = r8a779f0_eth_serdes_init, + .power_on = r8a779f0_eth_serdes_power_on, .set_mode = r8a779f0_eth_serdes_set_mode, .set_speed = r8a779f0_eth_serdes_set_speed, }; -- 2.25.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() into phy_ops @ 2022-12-26 6:53 ` Yoshihiro Shimoda 0 siblings, 0 replies; 8+ messages in thread From: Yoshihiro Shimoda @ 2022-12-26 6:53 UTC (permalink / raw) To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda Add r8a779f0_eth_serdes_power_on() to initialize the hardware for each channel from the step 9 or later on the datasheet. In other words, the procedure from the step 1 to 8 is for all channel and it is needed once only. So, the .init() in any channel instance is called, this driver initializes the hardware from step 1 to 8. And then, .power_on() is called, this driver initializes the hardware from step 9 or later. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/phy/renesas/r8a779f0-ether-serdes.c | 57 +++++++++++---------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/phy/renesas/r8a779f0-ether-serdes.c b/drivers/phy/renesas/r8a779f0-ether-serdes.c index e7588a940d69..9f55a08e6da1 100644 --- a/drivers/phy/renesas/r8a779f0-ether-serdes.c +++ b/drivers/phy/renesas/r8a779f0-ether-serdes.c @@ -242,34 +242,7 @@ static int r8a779f0_eth_serdes_hw_init(struct r8a779f0_eth_serdes_channel *chann if (ret) return ret; - ret = r8a779f0_eth_serdes_reg_wait(&dd->channel[0], 0x0000, 0x380, BIT(15), 0); - if (ret) - return ret; - - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) { - ret = r8a779f0_eth_serdes_chan_setting(&dd->channel[i]); - if (ret) - return ret; - } - - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) { - ret = r8a779f0_eth_serdes_chan_speed(&dd->channel[i]); - if (ret) - return ret; - } - - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) - r8a779f0_eth_serdes_write32(dd->channel[i].addr, 0x03c0, 0x380, 0x0000); - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) - r8a779f0_eth_serdes_write32(dd->channel[i].addr, 0x03d0, 0x380, 0x0000); - - for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) { - ret = r8a779f0_eth_serdes_monitor_linkup(&dd->channel[i]); - if (ret) - return ret; - } - - return 0; + return r8a779f0_eth_serdes_reg_wait(&dd->channel[0], 0x0000, 0x380, BIT(15), 0); } static int r8a779f0_eth_serdes_init(struct phy *p) @@ -289,6 +262,33 @@ static int r8a779f0_eth_serdes_init(struct phy *p) return ret; } +static int r8a779f0_eth_serdes_hw_init_late(struct r8a779f0_eth_serdes_channel +*channel) +{ + int ret; + + ret = r8a779f0_eth_serdes_chan_setting(channel); + if (ret) + return ret; + + ret = r8a779f0_eth_serdes_chan_speed(channel); + if (ret) + return ret; + + r8a779f0_eth_serdes_write32(channel->addr, 0x03c0, 0x380, 0x0000); + + r8a779f0_eth_serdes_write32(channel->addr, 0x03d0, 0x380, 0x0000); + + return r8a779f0_eth_serdes_monitor_linkup(channel); +} + +static int r8a779f0_eth_serdes_power_on(struct phy *p) +{ + struct r8a779f0_eth_serdes_channel *channel = phy_get_drvdata(p); + + return r8a779f0_eth_serdes_hw_init_late(channel); +} + static int r8a779f0_eth_serdes_set_mode(struct phy *p, enum phy_mode mode, int submode) { @@ -319,6 +319,7 @@ static int r8a779f0_eth_serdes_set_speed(struct phy *p, int speed) static const struct phy_ops r8a779f0_eth_serdes_ops = { .init = r8a779f0_eth_serdes_init, + .power_on = r8a779f0_eth_serdes_power_on, .set_mode = r8a779f0_eth_serdes_set_mode, .set_speed = r8a779f0_eth_serdes_set_speed, }; -- 2.25.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] phy: renesas: r8a779f0-eth-serdes: Remove retry code in .init() 2022-12-26 6:53 ` Yoshihiro Shimoda @ 2022-12-26 6:53 ` Yoshihiro Shimoda -1 siblings, 0 replies; 8+ messages in thread From: Yoshihiro Shimoda @ 2022-12-26 6:53 UTC (permalink / raw) To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda Remove retry code in r8a779f0_eth_serdes_init() because r8a779f0_eth_serdes_chan_setting() was fixed so that no timeout happened in the initializing procedure. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/phy/renesas/r8a779f0-ether-serdes.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/phy/renesas/r8a779f0-ether-serdes.c b/drivers/phy/renesas/r8a779f0-ether-serdes.c index 9f55a08e6da1..c5206ef9195b 100644 --- a/drivers/phy/renesas/r8a779f0-ether-serdes.c +++ b/drivers/phy/renesas/r8a779f0-ether-serdes.c @@ -18,7 +18,6 @@ #define R8A779F0_ETH_SERDES_BANK_SELECT 0x03fc #define R8A779F0_ETH_SERDES_TIMEOUT_US 100000 #define R8A779F0_ETH_SERDES_NUM_RETRY_LINKUP 3 -#define R8A779F0_ETH_SERDES_NUM_RETRY_INIT 3 struct r8a779f0_eth_serdes_drv_data; struct r8a779f0_eth_serdes_channel { @@ -248,16 +247,11 @@ static int r8a779f0_eth_serdes_hw_init(struct r8a779f0_eth_serdes_channel *chann static int r8a779f0_eth_serdes_init(struct phy *p) { struct r8a779f0_eth_serdes_channel *channel = phy_get_drvdata(p); - int i, ret; + int ret; - for (i = 0; i < R8A779F0_ETH_SERDES_NUM_RETRY_INIT; i++) { - ret = r8a779f0_eth_serdes_hw_init(channel); - if (!ret) { - channel->dd->initialized = true; - break; - } - usleep_range(1000, 2000); - } + ret = r8a779f0_eth_serdes_hw_init(channel); + if (!ret) + channel->dd->initialized = true; return ret; } -- 2.25.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] phy: renesas: r8a779f0-eth-serdes: Remove retry code in .init() @ 2022-12-26 6:53 ` Yoshihiro Shimoda 0 siblings, 0 replies; 8+ messages in thread From: Yoshihiro Shimoda @ 2022-12-26 6:53 UTC (permalink / raw) To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda Remove retry code in r8a779f0_eth_serdes_init() because r8a779f0_eth_serdes_chan_setting() was fixed so that no timeout happened in the initializing procedure. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/phy/renesas/r8a779f0-ether-serdes.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/phy/renesas/r8a779f0-ether-serdes.c b/drivers/phy/renesas/r8a779f0-ether-serdes.c index 9f55a08e6da1..c5206ef9195b 100644 --- a/drivers/phy/renesas/r8a779f0-ether-serdes.c +++ b/drivers/phy/renesas/r8a779f0-ether-serdes.c @@ -18,7 +18,6 @@ #define R8A779F0_ETH_SERDES_BANK_SELECT 0x03fc #define R8A779F0_ETH_SERDES_TIMEOUT_US 100000 #define R8A779F0_ETH_SERDES_NUM_RETRY_LINKUP 3 -#define R8A779F0_ETH_SERDES_NUM_RETRY_INIT 3 struct r8a779f0_eth_serdes_drv_data; struct r8a779f0_eth_serdes_channel { @@ -248,16 +247,11 @@ static int r8a779f0_eth_serdes_hw_init(struct r8a779f0_eth_serdes_channel *chann static int r8a779f0_eth_serdes_init(struct phy *p) { struct r8a779f0_eth_serdes_channel *channel = phy_get_drvdata(p); - int i, ret; + int ret; - for (i = 0; i < R8A779F0_ETH_SERDES_NUM_RETRY_INIT; i++) { - ret = r8a779f0_eth_serdes_hw_init(channel); - if (!ret) { - channel->dd->initialized = true; - break; - } - usleep_range(1000, 2000); - } + ret = r8a779f0_eth_serdes_hw_init(channel); + if (!ret) + channel->dd->initialized = true; return ret; } -- 2.25.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() 2022-12-26 6:53 ` Yoshihiro Shimoda @ 2023-01-13 18:04 ` Vinod Koul -1 siblings, 0 replies; 8+ messages in thread From: Vinod Koul @ 2023-01-13 18:04 UTC (permalink / raw) To: Yoshihiro Shimoda; +Cc: kishon, linux-phy, linux-renesas-soc On 26-12-22, 15:53, Yoshihiro Shimoda wrote: > Add initialization function for each channel from step 9 or later on > the datasheet. Otherwise, the rswitch driver cannot initialize > this SERDES hardware correctly. Applied, thanks -- ~Vinod -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() @ 2023-01-13 18:04 ` Vinod Koul 0 siblings, 0 replies; 8+ messages in thread From: Vinod Koul @ 2023-01-13 18:04 UTC (permalink / raw) To: Yoshihiro Shimoda; +Cc: kishon, linux-phy, linux-renesas-soc On 26-12-22, 15:53, Yoshihiro Shimoda wrote: > Add initialization function for each channel from step 9 or later on > the datasheet. Otherwise, the rswitch driver cannot initialize > this SERDES hardware correctly. Applied, thanks -- ~Vinod ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-01-13 18:13 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-12-26 6:53 [PATCH 0/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() Yoshihiro Shimoda 2022-12-26 6:53 ` Yoshihiro Shimoda 2022-12-26 6:53 ` [PATCH 1/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() into phy_ops Yoshihiro Shimoda 2022-12-26 6:53 ` Yoshihiro Shimoda 2022-12-26 6:53 ` [PATCH 2/2] phy: renesas: r8a779f0-eth-serdes: Remove retry code in .init() Yoshihiro Shimoda 2022-12-26 6:53 ` Yoshihiro Shimoda 2023-01-13 18:04 ` [PATCH 0/2] phy: renesas: r8a779f0-eth-serdes: Add .power_on() Vinod Koul 2023-01-13 18:04 ` Vinod Koul
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.