All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer
@ 2022-08-24  4:44 William Zhang
  2022-08-24  4:44 ` [PATCH v2 2/2] timer: bcmbca: use arm global timer for bcm63138 SoC William Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: William Zhang @ 2022-08-24  4:44 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: anand.gore, joel.peshkin, dan.beygelman, f.fainelli, kursad.oney,
	William Zhang, Clément Léger, Eugen Hristev, Jim Liu,
	Michal Simek, Nick Hawkins, Patrice Chotard, Rick Chen,
	Simon Glass

[-- Attachment #1: Type: text/plain, Size: 4706 bytes --]

STI timer is actually ARM Cortex A9 global timer. Convert the driver to
use generic global timer name and make it consistent with Linux kernel
global timer driver. This also allows any A9 based device to use this
driver.

Signed-off-by: William Zhang <william.zhang@broadcom.com>
---

(no changes since v1)

 MAINTAINERS                                   |  2 +-
 drivers/timer/Kconfig                         |  8 +++--
 drivers/timer/Makefile                        |  2 +-
 .../timer/{sti-timer.c => arm_global_timer.c} | 30 ++++++++++---------
 4 files changed, 23 insertions(+), 19 deletions(-)
 rename drivers/timer/{sti-timer.c => arm_global_timer.c} (66%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1103bb068154..f7d77bb8cfa9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -503,7 +503,7 @@ F:	drivers/mmc/sti_sdhci.c
 F:	drivers/reset/sti-reset.c
 F:	drivers/serial/serial_sti_asc.c
 F:	drivers/sysreset/sysreset_sti.c
-F:	drivers/timer/sti-timer.c
+F:	drivers/timer/arm_global_timer.c
 F:	drivers/usb/host/dwc3-sti-glue.c
 F:	include/dwc3-sti-glue.h
 F:	include/dt-bindings/clock/stih407-clks.h
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
index 20b5af7e260f..3e1d70fbb930 100644
--- a/drivers/timer/Kconfig
+++ b/drivers/timer/Kconfig
@@ -215,12 +215,14 @@ config SANDBOX_TIMER
 	  Select this to enable an emulated timer for sandbox. It gets
 	  time from host os.
 
-config STI_TIMER
-	bool "STi timer support"
+config ARM_GLOBAL_TIMER
+	bool "ARM Cortex A9 global timer support"
 	depends on TIMER
+	depends on ARM
 	default y if ARCH_STI
 	help
-	  Select this to enable a timer for STi devices.
+	  Select this to enable global timer found on ARM Cortex A9
+	  based devices.
 
 config STM32_TIMER
 	bool "STM32 timer support"
diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile
index d9822a537009..d23569365408 100644
--- a/drivers/timer/Makefile
+++ b/drivers/timer/Makefile
@@ -22,7 +22,7 @@ obj-$(CONFIG_RISCV_TIMER) += riscv_timer.o
 obj-$(CONFIG_ROCKCHIP_TIMER) += rockchip_timer.o
 obj-$(CONFIG_SANDBOX_TIMER)	+= sandbox_timer.o
 obj-$(CONFIG_$(SPL_)SIFIVE_CLINT) += sifive_clint_timer.o
-obj-$(CONFIG_STI_TIMER)		+= sti-timer.o
+obj-$(CONFIG_ARM_GLOBAL_TIMER)	+= arm_global_timer.o
 obj-$(CONFIG_STM32_TIMER)	+= stm32_timer.o
 obj-$(CONFIG_X86_TSC_TIMER)	+= tsc_timer.o
 obj-$(CONFIG_MTK_TIMER)		+= mtk_timer.o
diff --git a/drivers/timer/sti-timer.c b/drivers/timer/arm_global_timer.c
similarity index 66%
rename from drivers/timer/sti-timer.c
rename to drivers/timer/arm_global_timer.c
index 87444a0650f6..065f10bb742b 100644
--- a/drivers/timer/sti-timer.c
+++ b/drivers/timer/arm_global_timer.c
@@ -2,6 +2,8 @@
 /*
  * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
  * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
+ *
+ * ARM Cortext A9 global timer driver
  */
 
 #include <common.h>
@@ -13,13 +15,13 @@
 #include <asm/io.h>
 #include <asm/arch-armv7/globaltimer.h>
 
-struct sti_timer_priv {
+struct arm_global_timer_priv {
 	struct globaltimer *global_timer;
 };
 
-static u64 sti_timer_get_count(struct udevice *dev)
+static u64 arm_global_timer_get_count(struct udevice *dev)
 {
-	struct sti_timer_priv *priv = dev_get_priv(dev);
+	struct arm_global_timer_priv *priv = dev_get_priv(dev);
 	struct globaltimer *global_timer = priv->global_timer;
 	u32 low, high;
 	u64 timer;
@@ -37,10 +39,10 @@ static u64 sti_timer_get_count(struct udevice *dev)
 	return (u64)((timer << 32) | low);
 }
 
-static int sti_timer_probe(struct udevice *dev)
+static int arm_global_timer_probe(struct udevice *dev)
 {
 	struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
-	struct sti_timer_priv *priv = dev_get_priv(dev);
+	struct arm_global_timer_priv *priv = dev_get_priv(dev);
 	struct clk clk;
 	int err;
 	ulong ret;
@@ -66,20 +68,20 @@ static int sti_timer_probe(struct udevice *dev)
 	return 0;
 }
 
-static const struct timer_ops sti_timer_ops = {
-	.get_count = sti_timer_get_count,
+static const struct timer_ops arm_global_timer_ops = {
+	.get_count = arm_global_timer_get_count,
 };
 
-static const struct udevice_id sti_timer_ids[] = {
+static const struct udevice_id arm_global_timer_ids[] = {
 	{ .compatible = "arm,cortex-a9-global-timer" },
 	{}
 };
 
-U_BOOT_DRIVER(sti_timer) = {
-	.name = "sti_timer",
+U_BOOT_DRIVER(arm_global_timer) = {
+	.name = "arm_global_timer",
 	.id = UCLASS_TIMER,
-	.of_match = sti_timer_ids,
-	.priv_auto	= sizeof(struct sti_timer_priv),
-	.probe = sti_timer_probe,
-	.ops = &sti_timer_ops,
+	.of_match = arm_global_timer_ids,
+	.priv_auto	= sizeof(struct arm_global_timer_priv),
+	.probe = arm_global_timer_probe,
+	.ops = &arm_global_timer_ops,
 };
-- 
2.37.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

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

* [PATCH v2 2/2] timer: bcmbca: use arm global timer for bcm63138 SoC
  2022-08-24  4:44 [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer William Zhang
@ 2022-08-24  4:44 ` William Zhang
  2022-08-24 15:08 ` [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer Patrice CHOTARD
  2022-10-31 14:45 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: William Zhang @ 2022-08-24  4:44 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: anand.gore, joel.peshkin, dan.beygelman, f.fainelli, kursad.oney,
	William Zhang, Philippe Reynes

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]

As STI timer is renamed to ARM A9 global timer, change BCM63138 to use
the new global timer config symbol name.

This patch applies on top of the my previous patch [1].

[1]: https://lists.denx.de/pipermail/u-boot/2022-August/491060.html

Signed-off-by: William Zhang <william.zhang@broadcom.com>

---

Changes in v2:
- Fix typo in the subject line and patch link in the commit message

 arch/arm/mach-bcmbca/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-bcmbca/Kconfig b/arch/arm/mach-bcmbca/Kconfig
index 27b243cbc3d8..62b371612b6a 100644
--- a/arch/arm/mach-bcmbca/Kconfig
+++ b/arch/arm/mach-bcmbca/Kconfig
@@ -29,7 +29,7 @@ config BCM4912
 config BCM63138
 	bool "Support for Broadcom 63138 Family"
 	select TIMER
-	select STI_TIMER
+	select ARM_GLOBAL_TIMER
 	select CPU_V7A
 	select DM_SERIAL
 	select BCM6345_SERIAL
-- 
2.37.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

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

* Re: [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer
  2022-08-24  4:44 [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer William Zhang
  2022-08-24  4:44 ` [PATCH v2 2/2] timer: bcmbca: use arm global timer for bcm63138 SoC William Zhang
@ 2022-08-24 15:08 ` Patrice CHOTARD
  2022-10-31 14:45 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Patrice CHOTARD @ 2022-08-24 15:08 UTC (permalink / raw)
  To: William Zhang, U-Boot Mailing List
  Cc: anand.gore, joel.peshkin, dan.beygelman, f.fainelli, kursad.oney,
	Clément Léger, Eugen Hristev, Jim Liu, Michal Simek,
	Nick Hawkins, Rick Chen, Simon Glass

Hi William

On 8/24/22 06:44, William Zhang wrote:
> STI timer is actually ARM Cortex A9 global timer. Convert the driver to
> use generic global timer name and make it consistent with Linux kernel
> global timer driver. This also allows any A9 based device to use this
> driver.
> 
> Signed-off-by: William Zhang <william.zhang@broadcom.com>
> ---
> 
> (no changes since v1)
> 
>  MAINTAINERS                                   |  2 +-
>  drivers/timer/Kconfig                         |  8 +++--
>  drivers/timer/Makefile                        |  2 +-
>  .../timer/{sti-timer.c => arm_global_timer.c} | 30 ++++++++++---------
>  4 files changed, 23 insertions(+), 19 deletions(-)
>  rename drivers/timer/{sti-timer.c => arm_global_timer.c} (66%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1103bb068154..f7d77bb8cfa9 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -503,7 +503,7 @@ F:	drivers/mmc/sti_sdhci.c
>  F:	drivers/reset/sti-reset.c
>  F:	drivers/serial/serial_sti_asc.c
>  F:	drivers/sysreset/sysreset_sti.c
> -F:	drivers/timer/sti-timer.c
> +F:	drivers/timer/arm_global_timer.c
>  F:	drivers/usb/host/dwc3-sti-glue.c
>  F:	include/dwc3-sti-glue.h
>  F:	include/dt-bindings/clock/stih407-clks.h
> diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
> index 20b5af7e260f..3e1d70fbb930 100644
> --- a/drivers/timer/Kconfig
> +++ b/drivers/timer/Kconfig
> @@ -215,12 +215,14 @@ config SANDBOX_TIMER
>  	  Select this to enable an emulated timer for sandbox. It gets
>  	  time from host os.
>  
> -config STI_TIMER
> -	bool "STi timer support"
> +config ARM_GLOBAL_TIMER
> +	bool "ARM Cortex A9 global timer support"
>  	depends on TIMER
> +	depends on ARM
>  	default y if ARCH_STI
>  	help
> -	  Select this to enable a timer for STi devices.
> +	  Select this to enable global timer found on ARM Cortex A9
> +	  based devices.
>  
>  config STM32_TIMER
>  	bool "STM32 timer support"
> diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile
> index d9822a537009..d23569365408 100644
> --- a/drivers/timer/Makefile
> +++ b/drivers/timer/Makefile
> @@ -22,7 +22,7 @@ obj-$(CONFIG_RISCV_TIMER) += riscv_timer.o
>  obj-$(CONFIG_ROCKCHIP_TIMER) += rockchip_timer.o
>  obj-$(CONFIG_SANDBOX_TIMER)	+= sandbox_timer.o
>  obj-$(CONFIG_$(SPL_)SIFIVE_CLINT) += sifive_clint_timer.o
> -obj-$(CONFIG_STI_TIMER)		+= sti-timer.o
> +obj-$(CONFIG_ARM_GLOBAL_TIMER)	+= arm_global_timer.o
>  obj-$(CONFIG_STM32_TIMER)	+= stm32_timer.o
>  obj-$(CONFIG_X86_TSC_TIMER)	+= tsc_timer.o
>  obj-$(CONFIG_MTK_TIMER)		+= mtk_timer.o
> diff --git a/drivers/timer/sti-timer.c b/drivers/timer/arm_global_timer.c
> similarity index 66%
> rename from drivers/timer/sti-timer.c
> rename to drivers/timer/arm_global_timer.c
> index 87444a0650f6..065f10bb742b 100644
> --- a/drivers/timer/sti-timer.c
> +++ b/drivers/timer/arm_global_timer.c
> @@ -2,6 +2,8 @@
>  /*
>   * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
>   * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
> + *
> + * ARM Cortext A9 global timer driver
>   */
>  
>  #include <common.h>
> @@ -13,13 +15,13 @@
>  #include <asm/io.h>
>  #include <asm/arch-armv7/globaltimer.h>
>  
> -struct sti_timer_priv {
> +struct arm_global_timer_priv {
>  	struct globaltimer *global_timer;
>  };
>  
> -static u64 sti_timer_get_count(struct udevice *dev)
> +static u64 arm_global_timer_get_count(struct udevice *dev)
>  {
> -	struct sti_timer_priv *priv = dev_get_priv(dev);
> +	struct arm_global_timer_priv *priv = dev_get_priv(dev);
>  	struct globaltimer *global_timer = priv->global_timer;
>  	u32 low, high;
>  	u64 timer;
> @@ -37,10 +39,10 @@ static u64 sti_timer_get_count(struct udevice *dev)
>  	return (u64)((timer << 32) | low);
>  }
>  
> -static int sti_timer_probe(struct udevice *dev)
> +static int arm_global_timer_probe(struct udevice *dev)
>  {
>  	struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
> -	struct sti_timer_priv *priv = dev_get_priv(dev);
> +	struct arm_global_timer_priv *priv = dev_get_priv(dev);
>  	struct clk clk;
>  	int err;
>  	ulong ret;
> @@ -66,20 +68,20 @@ static int sti_timer_probe(struct udevice *dev)
>  	return 0;
>  }
>  
> -static const struct timer_ops sti_timer_ops = {
> -	.get_count = sti_timer_get_count,
> +static const struct timer_ops arm_global_timer_ops = {
> +	.get_count = arm_global_timer_get_count,
>  };
>  
> -static const struct udevice_id sti_timer_ids[] = {
> +static const struct udevice_id arm_global_timer_ids[] = {
>  	{ .compatible = "arm,cortex-a9-global-timer" },
>  	{}
>  };
>  
> -U_BOOT_DRIVER(sti_timer) = {
> -	.name = "sti_timer",
> +U_BOOT_DRIVER(arm_global_timer) = {
> +	.name = "arm_global_timer",
>  	.id = UCLASS_TIMER,
> -	.of_match = sti_timer_ids,
> -	.priv_auto	= sizeof(struct sti_timer_priv),
> -	.probe = sti_timer_probe,
> -	.ops = &sti_timer_ops,
> +	.of_match = arm_global_timer_ids,
> +	.priv_auto	= sizeof(struct arm_global_timer_priv),
> +	.probe = arm_global_timer_probe,
> +	.ops = &arm_global_timer_ops,
>  };

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

Tested on stih410-b2260 boards.

Thanks
Patrice

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

* Re: [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer
  2022-08-24  4:44 [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer William Zhang
  2022-08-24  4:44 ` [PATCH v2 2/2] timer: bcmbca: use arm global timer for bcm63138 SoC William Zhang
  2022-08-24 15:08 ` [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer Patrice CHOTARD
@ 2022-10-31 14:45 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2022-10-31 14:45 UTC (permalink / raw)
  To: William Zhang
  Cc: U-Boot Mailing List, anand.gore, joel.peshkin, dan.beygelman,
	f.fainelli, kursad.oney, Clément Léger, Eugen Hristev,
	Jim Liu, Michal Simek, Nick Hawkins, Patrice Chotard, Rick Chen,
	Simon Glass

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

On Tue, Aug 23, 2022 at 09:44:32PM -0700, William Zhang wrote:

> STI timer is actually ARM Cortex A9 global timer. Convert the driver to
> use generic global timer name and make it consistent with Linux kernel
> global timer driver. This also allows any A9 based device to use this
> driver.
> 
> Signed-off-by: William Zhang <william.zhang@broadcom.com>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>

For the series, applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2022-10-31 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24  4:44 [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer William Zhang
2022-08-24  4:44 ` [PATCH v2 2/2] timer: bcmbca: use arm global timer for bcm63138 SoC William Zhang
2022-08-24 15:08 ` [PATCH v2 1/2] timer: sti: convert sti-timer to arm a9 global timer Patrice CHOTARD
2022-10-31 14:45 ` Tom Rini

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.