ARM: bcm2835: fix get_timer() to return ms
Subsystems (4)
PATCH v2 1/1 ARM: bcm2835: fix get_timer() to return ms
Apparently, CONFIG_SYS_HZ must be 1000. Change this, and fix the timer driver to conform to this.
Have the timer implementation export a custom API get_timer_us() for use by the BCM2835 MMC API, which needs us resolution for a HW workaround.
---
v2: Export custom API get_timer_us() to allow the MMC driver to maintain
its current workaround implementation.
--- arch/arm/cpu/arm1176/bcm2835/timer.c | 14 +++++++++++--- arch/arm/include/asm/arch-bcm2835/timer.h | 2 ++ drivers/mmc/bcm2835_sdhci.c | 5 +++-- include/configs/rpi_b.h | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-)
arch/arm/cpu/arm1176/bcm2835/timer.c +11 -3
@@ -23,7 +23,7 @@ int timer_init(void)return 0 ; } -ulong get_timer (ulong base) +ulong get_timer_us (ulong base) {struct bcm2835_timer_regs *regs = (struct bcm2835_timer_regs *)BCM2835_TIMER_PHYSADDR ;
@@ -31,6 +31,14 @@ ulong get_timer(ulong base)return readl (®s->clo) - base; } +ulong get_timer (ulong base) +{ +ulong us =get_timer_us (0 ); + us /= (1000000 /CONFIG_SYS_HZ ); + us -= base; +return us; +} +unsigned long long get_ticks (void ) {return get_timer (0 );
@@ -46,10 +54,10 @@ void __udelay(unsigned long usec)ulong endtime;signed long diff; - endtime =get_timer (0 ) + usec; + endtime =get_timer_us (0 ) + usec;do { -ulong now =get_timer (0 ); +ulong now =get_timer_us (0 ); diff = endtime - now; }while (diff >=0 ); }
arch/arm/include/asm/arch-bcm2835/timer.h +2 -0
@@ -34,4 +34,6 @@ struct bcm2835_timer_regs {#define BCM2835_TIMER_CS_M1 (1 << 1)#define BCM2835_TIMER_CS_M0 (1 << 0) +extern ulong get_timer_us (ulong base); +#endif
drivers/mmc/bcm2835_sdhci.c +3 -2
@@ -39,6 +39,7 @@#include <common.h> #include <malloc.h> #include <sdhci.h> +#include <asm/arch/timer.h> /* 400KHz is max freq for card ID etc. Use that as min */ #define MIN_FREQ 400000
@@ -67,11 +68,11 @@ static inline void bcm2835_sdhci_raw_writel(struct sdhci_host *host, u32 val,* (Which is just as well - otherwise we'd have to nobble the DMA engine * too) */ -while (get_timer (bcm_host->last_write) < bcm_host->twoticks_delay) +while (get_timer_us (bcm_host->last_write) < bcm_host->twoticks_delay) ;writel (val, host->ioaddr + reg); - bcm_host->last_write =get_timer (0 ); + bcm_host->last_write =get_timer_us (0 ); }static inline u32 bcm2835_sdhci_raw_readl (struct sdhci_host *host,int reg)
include/configs/rpi_b.h +1 -1
@@ -31,7 +31,7 @@#define CONFIG_MACH_TYPE MACH_TYPE_BCM2708/* Timer */ -#define CONFIG_SYS_HZ 1000000 +#define CONFIG_SYS_HZ 1000/* Memory layout */ #define CONFIG_NR_DRAM_BANKS 1
Signature · 1 line
1.7.10.4
PATCH v2 1/1 ARM: bcm2835: fix get_timer() to return ms
Hi Stephen,
Quoted 11 lines · Stephen Warren
Apparently,
CONFIG_SYS_HZmust be 1000. Change this, and fix the timer driver to conform to this.Have the timer implementation export a custom API
get_timer_us()for use by the BCM2835 MMC API, which needs us resolution for a HW workaround.Signed-off-by Stephen Warren <[email protected]>---
v2: Export custom APIget_timer_us()to allow the MMC driver to maintain
its current workaround implementation.
---
This patch and "mmc: bcm2835: fix delays in bug workaround" cannot be both applied together. Can you do a V2 for the delays fix patch too?
Amicalement,
Signature · 1 line
Albert.
PATCH v2 1/1 ARM: bcm2835: fix get_timer() to return ms
Quoted 11 lines · Albert ARIBAUD
Hi Stephen,
Quoted 6 lines · Stephen Warren
Apparently,
CONFIG_SYS_HZmust be 1000. Change this, and fix the timer driver to conform to this.Have the timer implementation export a custom API
get_timer_us()for use by the BCM2835 MMC API, which needs us resolution for a HW workaround.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Stephen Warren <[email protected]>---
v2: Export custom APIget_timer_us()to allow the MMC driver to maintain
its current workaround implementation.
---This patch and "mmc: bcm2835: fix delays in bug workaround" cannot be both applied together. Can you do a V2 for the delays fix patch too?
This patch replaces the two previous separate patches. Only this one needs to be applied.
PATCH v2 1/1 ARM: bcm2835: fix get_timer() to return ms
Hi Stephen,
Quoted 18 lines · Stephen Warren
Quoted 17 lines · Albert ARIBAUD
Hi Stephen,
Quoted 11 lines · Stephen Warren
Apparently,
CONFIG_SYS_HZmust be 1000. Change this, and fix the timer driver to conform to this.Have the timer implementation export a custom API
get_timer_us()for use by the BCM2835 MMC API, which needs us resolution for a HW workaround.Signed-off-by Stephen Warren <[email protected]>---
v2: Export custom APIget_timer_us()to allow the MMC driver to maintain
its current workaround implementation.
---
Quoted 5 lines
Quoted 2 lines
This patch and "mmc: bcm2835: fix delays in bug workaround" cannot be both applied together. Can you do a V2 for the delays fix patch too?
This patch replaces the two previous separate patches. Only this one needs to be applied.
Ok -- thanks. Will soon (i.e., in one hour at most) be available in u-boot-arm/master.
Amicalement,
Signature · 1 line
Albert.
PATCH v2 1/1 ARM: bcm2835: fix get_timer() to return ms
Quoted 23 lines · Albert ARIBAUD
Hi Stephen,
Quoted 18 lines · Stephen Warren
Quoted 17 lines · Albert ARIBAUD
Hi Stephen,
Quoted 11 lines · Stephen Warren
Apparently,
CONFIG_SYS_HZmust be 1000. Change this, and fix the timer driver to conform to this.Have the timer implementation export a custom API
get_timer_us()for use by the BCM2835 MMC API, which needs us resolution for a HW workaround.Signed-off-by Stephen Warren <[email protected]>---
v2: Export custom APIget_timer_us()to allow the MMC driver to maintain
its current workaround implementation.
---
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
This patch and "mmc: bcm2835: fix delays in bug workaround" cannot be both applied together. Can you do a V2 for the delays fix patch too?
This patch replaces the two previous separate patches. Only this one needs to be applied.
Ok -- thanks. Will soon (i.e., in one hour at most) be available in u-boot-arm/master.
I can't see it there yet. I assume this patch is targeted at the release?
PATCH v2 1/1 ARM: bcm2835: fix get_timer() to return ms
Hi Stephen,
Quoted 27 lines · Stephen Warren
Quoted 26 lines · Albert ARIBAUD
Hi Stephen,
Quoted 21 lines · Stephen Warren
Quoted 19 lines · Albert ARIBAUD
Hi Stephen,
Quoted 11 lines · Stephen Warren
Apparently,
CONFIG_SYS_HZmust be 1000. Change this, and fix the timer driver to conform to this.Have the timer implementation export a custom API
get_timer_us()for use by the BCM2835 MMC API, which needs us resolution for a HW workaround.Signed-off-by Stephen Warren <[email protected]>---
v2: Export custom APIget_timer_us()to allow the MMC driver to maintain
its current workaround implementation.
---This patch and "mmc: bcm2835: fix delays in bug workaround" cannot be both applied together. Can you do a V2 for the delays fix patch too?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
This patch replaces the two previous separate patches. Only this one needs to be applied.
Ok -- thanks. Will soon (i.e., in one hour at most) be available in u-boot-arm/master.
I can't see it there yet. I assume this patch is targeted at the release?
My fault. I'd applied it somewhere in my tree and marked it accepted in patchwork (I can find trace of both actions) but for some reason, it did not end on my master branch.
Error fixed now, commit 5eaa2156 at ARM ToT.
Amicalement,
Signature · 1 line
Albert.