All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/6] Remove no use clk_enable() for rockchip platform
@ 2019-08-28  8:23 Kever Yang
  2019-08-28  8:23 ` [U-Boot] [PATCH 1/6] usb: ehci-generic: don't probe fail if there is no clk_enable() ops Kever Yang
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Kever Yang @ 2019-08-28  8:23 UTC (permalink / raw)
  To: u-boot


There are some clk_enable() callback add to rockchip clock drivers but
with out any real operation driver code, it's waste of CPU cycles at
runtime and waste of code size. The callback are add because some
peripheral REQUIRE it, eg. ehci/ohci generic driver, and other driver
also need it if the ops exist, eg. dwc3 driver and designware net driver.

After update ehci&ohci driver to not always need clk_enable ops in
vendor driver, we can remove all relate no use code in rockchip clock
drivers.



Kever Yang (6):
  usb: ehci-generic: don't probe fail if there is no clk_enable() ops
  usb: ohci-generic: don't probe fail if there is no clk_enable() ops
  rockchip: clk: rk3288: remove clk_enable()
  rockchip: clk: rk3328: remove clk_enable()
  rockchip: clk: rk3368: remove clk_enable()
  rockchip: clk: rk3399: remove clk_enable()

 drivers/clk/rockchip/clk_rk3288.c | 23 -------------------
 drivers/clk/rockchip/clk_rk3328.c | 12 ----------
 drivers/clk/rockchip/clk_rk3368.c | 19 ----------------
 drivers/clk/rockchip/clk_rk3399.c | 37 -------------------------------
 drivers/usb/host/ehci-generic.c   |  2 +-
 drivers/usb/host/ohci-generic.c   |  2 +-
 6 files changed, 2 insertions(+), 93 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/6] usb: ehci-generic: don't probe fail if there is no clk_enable() ops
  2019-08-28  8:23 [U-Boot] [PATCH 0/6] Remove no use clk_enable() for rockchip platform Kever Yang
@ 2019-08-28  8:23 ` Kever Yang
  2019-08-28  8:40   ` Patrice CHOTARD
  2019-08-28  8:23 ` [U-Boot] [PATCH 2/6] usb: ohci-generic: " Kever Yang
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Kever Yang @ 2019-08-28  8:23 UTC (permalink / raw)
  To: u-boot

Some clock driver do not have a clk_enable() call back, and we should not
treat this as fail in ehci probe like other modules, eg. clk_enabl_bulk()
do not return fail if ret value is '-ENOSYS'

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 drivers/usb/host/ehci-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
index 0270f3bc95..682a070306 100644
--- a/drivers/usb/host/ehci-generic.c
+++ b/drivers/usb/host/ehci-generic.c
@@ -96,7 +96,7 @@ static int ehci_usb_probe(struct udevice *dev)
 			if (err < 0)
 				break;
 			err = clk_enable(&priv->clocks[i]);
-			if (err) {
+			if (err && err != -ENOSYS) {
 				dev_err(dev, "failed to enable clock %d\n", i);
 				clk_free(&priv->clocks[i]);
 				goto clk_err;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/6] usb: ohci-generic: don't probe fail if there is no clk_enable() ops
  2019-08-28  8:23 [U-Boot] [PATCH 0/6] Remove no use clk_enable() for rockchip platform Kever Yang
  2019-08-28  8:23 ` [U-Boot] [PATCH 1/6] usb: ehci-generic: don't probe fail if there is no clk_enable() ops Kever Yang
@ 2019-08-28  8:23 ` Kever Yang
  2019-08-28  8:41   ` Patrice CHOTARD
  2019-08-28  8:23 ` [U-Boot] [PATCH 3/6] rockchip: clk: rk3288: remove clk_enable() Kever Yang
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Kever Yang @ 2019-08-28  8:23 UTC (permalink / raw)
  To: u-boot

Some clock driver do not have a clk_enable() call back, and we should not
treat this as fail in ehci probe like other modules, eg. clk_enabl_bulk()
do not return fail if ret value is '-ENOSYS'

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 drivers/usb/host/ohci-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
index 24b5c3156f..916ea0b955 100644
--- a/drivers/usb/host/ohci-generic.c
+++ b/drivers/usb/host/ohci-generic.c
@@ -95,7 +95,7 @@ static int ohci_usb_probe(struct udevice *dev)
 				break;
 
 			err = clk_enable(&priv->clocks[i]);
-			if (err) {
+			if (err && err != -ENOSYS) {
 				dev_err(dev, "failed to enable clock %d\n", i);
 				clk_free(&priv->clocks[i]);
 				goto clk_err;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/6] rockchip: clk: rk3288: remove clk_enable()
  2019-08-28  8:23 [U-Boot] [PATCH 0/6] Remove no use clk_enable() for rockchip platform Kever Yang
  2019-08-28  8:23 ` [U-Boot] [PATCH 1/6] usb: ehci-generic: don't probe fail if there is no clk_enable() ops Kever Yang
  2019-08-28  8:23 ` [U-Boot] [PATCH 2/6] usb: ohci-generic: " Kever Yang
@ 2019-08-28  8:23 ` Kever Yang
  2019-08-28  8:23 ` [U-Boot] [PATCH 4/6] rockchip: clk: rk3328: " Kever Yang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Kever Yang @ 2019-08-28  8:23 UTC (permalink / raw)
  To: u-boot

There is no real driver for clk enable/disable now, and we actually
don't need it now, remove it so that not waste CPU cycles and code size.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 drivers/clk/rockchip/clk_rk3288.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
index 375d7f8acb..0122381633 100644
--- a/drivers/clk/rockchip/clk_rk3288.c
+++ b/drivers/clk/rockchip/clk_rk3288.c
@@ -940,35 +940,12 @@ static int __maybe_unused rk3288_clk_set_parent(struct clk *clk, struct clk *par
 	return -ENOENT;
 }
 
-static int rk3288_clk_enable(struct clk *clk)
-{
-	switch (clk->id) {
-	case HCLK_USBHOST0:
-	case HCLK_HSIC:
-		return 0;
-
-	case SCLK_MAC:
-	case SCLK_MAC_RX:
-	case SCLK_MAC_TX:
-	case SCLK_MACREF:
-	case SCLK_MACREF_OUT:
-	case ACLK_GMAC:
-	case PCLK_GMAC:
-		/* Required to successfully probe the Designware GMAC driver */
-		return 0;
-	}
-
-	debug("%s: unsupported clk %ld\n", __func__, clk->id);
-	return -ENOENT;
-}
-
 static struct clk_ops rk3288_clk_ops = {
 	.get_rate	= rk3288_clk_get_rate,
 	.set_rate	= rk3288_clk_set_rate,
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.set_parent	= rk3288_clk_set_parent,
 #endif
-	.enable = rk3288_clk_enable,
 };
 
 static int rk3288_clk_ofdata_to_platdata(struct udevice *dev)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 4/6] rockchip: clk: rk3328: remove clk_enable()
  2019-08-28  8:23 [U-Boot] [PATCH 0/6] Remove no use clk_enable() for rockchip platform Kever Yang
                   ` (2 preceding siblings ...)
  2019-08-28  8:23 ` [U-Boot] [PATCH 3/6] rockchip: clk: rk3288: remove clk_enable() Kever Yang
@ 2019-08-28  8:23 ` Kever Yang
  2019-08-28  8:23 ` [U-Boot] [PATCH 5/6] rockchip: clk: rk3368: " Kever Yang
  2019-08-28  8:23 ` [U-Boot] [PATCH 6/6] rockchip: clk: rk3399: " Kever Yang
  5 siblings, 0 replies; 9+ messages in thread
From: Kever Yang @ 2019-08-28  8:23 UTC (permalink / raw)
  To: u-boot

There is no real driver for clk enable/disable now, and we actually
don't need it now, remove it so that not waste CPU cycles and code size.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 drivers/clk/rockchip/clk_rk3328.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c
index 5957a00402..a89e2ecc4a 100644
--- a/drivers/clk/rockchip/clk_rk3328.c
+++ b/drivers/clk/rockchip/clk_rk3328.c
@@ -745,22 +745,10 @@ static int rk3328_clk_set_parent(struct clk *clk, struct clk *parent)
 	return -ENOENT;
 }
 
-static int rk3328_clk_enable(struct clk *clk)
-{
-	switch (clk->id) {
-	case HCLK_HOST0:
-		/* Required to successfully probe the ehci generic driver */
-		return 0;
-	}
-
-	return -ENOENT;
-}
-
 static struct clk_ops rk3328_clk_ops = {
 	.get_rate = rk3328_clk_get_rate,
 	.set_rate = rk3328_clk_set_rate,
 	.set_parent = rk3328_clk_set_parent,
-	.enable = rk3328_clk_enable,
 };
 
 static int rk3328_clk_probe(struct udevice *dev)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 5/6] rockchip: clk: rk3368: remove clk_enable()
  2019-08-28  8:23 [U-Boot] [PATCH 0/6] Remove no use clk_enable() for rockchip platform Kever Yang
                   ` (3 preceding siblings ...)
  2019-08-28  8:23 ` [U-Boot] [PATCH 4/6] rockchip: clk: rk3328: " Kever Yang
@ 2019-08-28  8:23 ` Kever Yang
  2019-08-28  8:23 ` [U-Boot] [PATCH 6/6] rockchip: clk: rk3399: " Kever Yang
  5 siblings, 0 replies; 9+ messages in thread
From: Kever Yang @ 2019-08-28  8:23 UTC (permalink / raw)
  To: u-boot

There is no real driver for clk enable/disable now, and we actually
don't need it now, remove it so that not waste CPU cycles and code size.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 drivers/clk/rockchip/clk_rk3368.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c
index 89cbae59c5..c1a867b2ed 100644
--- a/drivers/clk/rockchip/clk_rk3368.c
+++ b/drivers/clk/rockchip/clk_rk3368.c
@@ -566,31 +566,12 @@ static int __maybe_unused rk3368_clk_set_parent(struct clk *clk, struct clk *par
 	return -ENOENT;
 }
 
-static int rk3368_clk_enable(struct clk *clk)
-{
-	switch (clk->id) {
-	case SCLK_MAC:
-	case SCLK_MAC_RX:
-	case SCLK_MAC_TX:
-	case SCLK_MACREF:
-	case SCLK_MACREF_OUT:
-	case ACLK_GMAC:
-	case PCLK_GMAC:
-		/* Required to successfully probe the Designware GMAC driver */
-		return 0;
-	}
-
-	debug("%s: unsupported clk %ld\n", __func__, clk->id);
-	return -ENOENT;
-}
-
 static struct clk_ops rk3368_clk_ops = {
 	.get_rate = rk3368_clk_get_rate,
 	.set_rate = rk3368_clk_set_rate,
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.set_parent = rk3368_clk_set_parent,
 #endif
-	.enable = rk3368_clk_enable,
 };
 
 static int rk3368_clk_probe(struct udevice *dev)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 6/6] rockchip: clk: rk3399: remove clk_enable()
  2019-08-28  8:23 [U-Boot] [PATCH 0/6] Remove no use clk_enable() for rockchip platform Kever Yang
                   ` (4 preceding siblings ...)
  2019-08-28  8:23 ` [U-Boot] [PATCH 5/6] rockchip: clk: rk3368: " Kever Yang
@ 2019-08-28  8:23 ` Kever Yang
  5 siblings, 0 replies; 9+ messages in thread
From: Kever Yang @ 2019-08-28  8:23 UTC (permalink / raw)
  To: u-boot

There is no real driver for clk enable/disable now, and we actually
don't need it now, remove it so that not waste CPU cycles and code size.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 drivers/clk/rockchip/clk_rk3399.c | 37 -------------------------------
 1 file changed, 37 deletions(-)

diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
index d9950c159b..a273bd1beb 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -1062,49 +1062,12 @@ static int __maybe_unused rk3399_clk_set_parent(struct clk *clk,
 	return -ENOENT;
 }
 
-static int rk3399_clk_enable(struct clk *clk)
-{
-	switch (clk->id) {
-	case HCLK_HOST0:
-	case HCLK_HOST0_ARB:
-	case HCLK_HOST1:
-	case HCLK_HOST1_ARB:
-		return 0;
-
-	case SCLK_MAC:
-	case SCLK_MAC_RX:
-	case SCLK_MAC_TX:
-	case SCLK_MACREF:
-	case SCLK_MACREF_OUT:
-	case ACLK_GMAC:
-	case PCLK_GMAC:
-		/* Required to successfully probe the Designware GMAC driver */
-		return 0;
-
-	case SCLK_USB3OTG0_REF:
-	case SCLK_USB3OTG1_REF:
-	case SCLK_USB3OTG0_SUSPEND:
-	case SCLK_USB3OTG1_SUSPEND:
-	case ACLK_USB3OTG0:
-	case ACLK_USB3OTG1:
-	case ACLK_USB3_RKSOC_AXI_PERF:
-	case ACLK_USB3:
-	case ACLK_USB3_GRF:
-		/* Required to successfully probe the Designware USB3 driver */
-		return 0;
-	}
-
-	debug("%s: unsupported clk %ld\n", __func__, clk->id);
-	return -ENOENT;
-}
-
 static struct clk_ops rk3399_clk_ops = {
 	.get_rate = rk3399_clk_get_rate,
 	.set_rate = rk3399_clk_set_rate,
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.set_parent = rk3399_clk_set_parent,
 #endif
-	.enable = rk3399_clk_enable,
 };
 
 #ifdef CONFIG_SPL_BUILD
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/6] usb: ehci-generic: don't probe fail if there is no clk_enable() ops
  2019-08-28  8:23 ` [U-Boot] [PATCH 1/6] usb: ehci-generic: don't probe fail if there is no clk_enable() ops Kever Yang
@ 2019-08-28  8:40   ` Patrice CHOTARD
  0 siblings, 0 replies; 9+ messages in thread
From: Patrice CHOTARD @ 2019-08-28  8:40 UTC (permalink / raw)
  To: u-boot

Hi Kever

On 8/28/19 10:23 AM, Kever Yang wrote:
> Some clock driver do not have a clk_enable() call back, and we should not
> treat this as fail in ehci probe like other modules, eg. clk_enabl_bulk()
> do not return fail if ret value is '-ENOSYS'
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
>  drivers/usb/host/ehci-generic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
> index 0270f3bc95..682a070306 100644
> --- a/drivers/usb/host/ehci-generic.c
> +++ b/drivers/usb/host/ehci-generic.c
> @@ -96,7 +96,7 @@ static int ehci_usb_probe(struct udevice *dev)
>  			if (err < 0)
>  				break;
>  			err = clk_enable(&priv->clocks[i]);
> -			if (err) {
> +			if (err && err != -ENOSYS) {
>  				dev_err(dev, "failed to enable clock %d\n", i);
>  				clk_free(&priv->clocks[i]);
>  				goto clk_err;

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/6] usb: ohci-generic: don't probe fail if there is no clk_enable() ops
  2019-08-28  8:23 ` [U-Boot] [PATCH 2/6] usb: ohci-generic: " Kever Yang
@ 2019-08-28  8:41   ` Patrice CHOTARD
  0 siblings, 0 replies; 9+ messages in thread
From: Patrice CHOTARD @ 2019-08-28  8:41 UTC (permalink / raw)
  To: u-boot

Hi Kever

On 8/28/19 10:23 AM, Kever Yang wrote:
> Some clock driver do not have a clk_enable() call back, and we should not
> treat this as fail in ehci probe like other modules, eg. clk_enabl_bulk()
> do not return fail if ret value is '-ENOSYS'
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
>  drivers/usb/host/ohci-generic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
> index 24b5c3156f..916ea0b955 100644
> --- a/drivers/usb/host/ohci-generic.c
> +++ b/drivers/usb/host/ohci-generic.c
> @@ -95,7 +95,7 @@ static int ohci_usb_probe(struct udevice *dev)
>  				break;
>  
>  			err = clk_enable(&priv->clocks[i]);
> -			if (err) {
> +			if (err && err != -ENOSYS) {
>  				dev_err(dev, "failed to enable clock %d\n", i);
>  				clk_free(&priv->clocks[i]);
>  				goto clk_err;

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-08-28  8:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-28  8:23 [U-Boot] [PATCH 0/6] Remove no use clk_enable() for rockchip platform Kever Yang
2019-08-28  8:23 ` [U-Boot] [PATCH 1/6] usb: ehci-generic: don't probe fail if there is no clk_enable() ops Kever Yang
2019-08-28  8:40   ` Patrice CHOTARD
2019-08-28  8:23 ` [U-Boot] [PATCH 2/6] usb: ohci-generic: " Kever Yang
2019-08-28  8:41   ` Patrice CHOTARD
2019-08-28  8:23 ` [U-Boot] [PATCH 3/6] rockchip: clk: rk3288: remove clk_enable() Kever Yang
2019-08-28  8:23 ` [U-Boot] [PATCH 4/6] rockchip: clk: rk3328: " Kever Yang
2019-08-28  8:23 ` [U-Boot] [PATCH 5/6] rockchip: clk: rk3368: " Kever Yang
2019-08-28  8:23 ` [U-Boot] [PATCH 6/6] rockchip: clk: rk3399: " Kever Yang

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.