IPQ40xx: clk: use dev_read_addr()
Subsystems (2)
PATCH 1/4 IPQ40xx: clk: use dev_read_addr()
Lets convert the driver to use dev_read_addr() instead of the devfdt_get_addr().
While we are here, lets also alphabetise the includes.
--- arch/arm/mach-ipq40xx/clock-ipq4019.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-ipq40xx/clock-ipq4019.c +2 -2
@@ -8,8 +8,8 @@* */ -#include <common.h> #include <clk-uclass.h> +#include <common.h> #include <dm.h> #include <errno.h>
@@ -35,7 +35,7 @@ static int msm_clk_probe(struct udevice *dev) {struct msm_clk_priv *priv =dev_get_priv (dev); - priv->base =devfdt_get_addr (dev); + priv->base =dev_read_addr (dev);if (priv->base ==FDT_ADDR_T_NONE )return -EINVAL ;
Signature · 1 line
2.28.0
PATCH 1/4 IPQ40xx: clk: use dev_read_addr()
Quoted 35 lines · Robert Marko
Lets convert the driver to use
dev_read_addr()instead of thedevfdt_get_addr().While we are here, lets also alphabetise the includes.
Signed-off-by Robert Marko <[email protected]>Cc Luka Perkov <[email protected]>--- arch/arm/mach-ipq40xx/clock-ipq4019.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-ipq40xx/clock-ipq4019.c +2
-3@@ -8,8 +8,8 @@* */ -#include <common.h> #include <clk-uclass.h> +#include <common.h> #include <dm.h> #include <errno.h> @@ -35,7 +35,7 @@ static int msm_clk_probe(struct udevice *dev) {struct msm_clk_priv *priv =dev_get_priv (dev); - priv->base =devfdt_get_addr (dev); + priv->base =dev_read_addr (dev);if (priv->base ==FDT_ADDR_T_NONE )return -EINVAL ; --
Quoted 2 lines
2.28.0
Hi,
Is there something I can improve in the patch series?
Regards,
Robert
PATCH 2/4 IPQ40xx: clk: drop breaks in switch case
In reply to Robert MarkoThere is no point in having break statements in the switch case as there is already a return before break.
So lets drop them from the driver.
--- arch/arm/mach-ipq40xx/clock-ipq4019.c | 3 --- 1 file changed, 3 deletions(-)
arch/arm/mach-ipq40xx/clock-ipq4019.c +0 -3
@@ -25,7 +25,6 @@ ulong msm_set_rate(struct clk *clk, ulong rate)case GCC_BLSP1_UART1_APPS_CLK :/*UART1*/ /* This clock is already initialized by SBL1 */ return 0 ; -break ;default :return 0 ; }
@@ -53,11 +52,9 @@ static int msm_enable(struct clk *clk)case GCC_BLSP1_QUP1_SPI_APPS_CLK :/*SPI1*/ /* This clock is already initialized by SBL1 */ return 0 ; -break ;case GCC_PRNG_AHB_CLK :/*PRNG*/ /* This clock is already initialized by SBL1 */ return 0 ; -break ;default :return 0 ; }
Signature · 1 line
2.28.0
PATCH 2/4 IPQ40xx: clk: drop breaks in switch case
Quoted 6 lines · Robert Marko
There is no point in having break statements in the switch case as there is already a return before break.
So lets drop them from the driver.
Signed-off-by Robert Marko <[email protected]>Cc Luka Perkov <[email protected]>
Applied to u-boot/next, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201202/c36b3c4d/attachment.sig>
PATCH 3/4 IPQ40xx: clk: dont always return 0
In reply to Robert MarkoCurrently the driver will go through the clock ID-s and set/enable them as needed.
But if the ID is unknown it will fall through the switch case to the default case which will always return 0.
This is not correct and default cases should return a error code since clock ID is unknown. So lets return -EINVAL instead.
--- arch/arm/mach-ipq40xx/clock-ipq4019.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-ipq40xx/clock-ipq4019.c +2 -2
@@ -26,7 +26,7 @@ ulong msm_set_rate(struct clk *clk, ulong rate)/* This clock is already initialized by SBL1 */ return 0 ;default : -return 0 ; +return -EINVAL ; } }
@@ -56,7 +56,7 @@ static int msm_enable(struct clk *clk)/* This clock is already initialized by SBL1 */ return 0 ;default : -return 0 ; +return -EINVAL ; } }
Signature · 1 line
2.28.0
PATCH 3/4 IPQ40xx: clk: dont always return 0
Quoted 8 lines · Robert Marko
Currently the driver will go through the clock ID-s and set/enable them as needed.
But if the ID is unknown it will fall through the switch case to the default case which will always return 0.This is not correct and default cases should return a error code since clock ID is unknown. So lets return
-EINVALinstead.Signed-off-by Robert Marko <[email protected]>Cc Luka Perkov <[email protected]>
Applied to u-boot/next, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201202/1d92f405/attachment.sig>
PATCH 4/4 IPQ40xx: clk: add USB clock handling
In reply to Robert MarkoUSB clocks were completely forgotten as driver would always return 0 even if clock ID was unknown.
This behaviour changed with "IPQ40xx: clk: dont always return 0" and this will now causes the USB-s to fail probing as clock enable will return -EINVAL.
So to fix that lets add all of the USB clocks to the driver.
--- arch/arm/mach-ipq40xx/clock-ipq4019.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/mach-ipq40xx/clock-ipq4019.c +8 -0
@@ -55,6 +55,14 @@ static int msm_enable(struct clk *clk)case GCC_PRNG_AHB_CLK :/*PRNG*/ /* This clock is already initialized by SBL1 */ return 0 ; +case GCC_USB3_MASTER_CLK : +case GCC_USB3_SLEEP_CLK : +case GCC_USB3_MOCK_UTMI_CLK : +case GCC_USB2_MASTER_CLK : +case GCC_USB2_SLEEP_CLK : +case GCC_USB2_MOCK_UTMI_CLK : +/* These clocks is already initialized by SBL1 */ +return 0 ;default :return -EINVAL ; }
Signature · 1 line
2.28.0
PATCH 4/4 IPQ40xx: clk: add USB clock handling
Quoted 10 lines · Robert Marko
USB clocks were completely forgotten as driver would always return 0 even if clock ID was unknown.
This behaviour changed with "IPQ40xx: clk: dont always return 0" and this will now causes the USB-s to fail probing as clock enable will return
-EINVAL.So to fix that lets add all of the USB clocks to the driver.
Fixes 430e1dcf ("IPQ40xx: Add USB nodes")Signed-off-by Robert Marko <[email protected]>Cc Luka Perkov <[email protected]>
Applied to u-boot/next, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201202/05f13dc1/attachment.sig>
PATCH 1/4 IPQ40xx: clk: use dev_read_addr()
In reply to Robert MarkoQuoted 6 lines · Robert Marko
Lets convert the driver to use
dev_read_addr()instead of thedevfdt_get_addr().While we are here, lets also alphabetise the includes.
Signed-off-by Robert Marko <[email protected]>Cc Luka Perkov <[email protected]>
Applied to u-boot/next, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201202/b18356c3/attachment.sig>