Skip to contentSkip to conversation

common: Remove timer_init() call for x86

PATCH New Bin Meng 2 participants 6 messages Dec 2, 2015 – Dec 3, 2015 x86

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/2 common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict call to timer_init(). Remove this call for x86.

---

 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -1
index b035c90..92c42c5 100644
@@ -807,7 +807,7 @@ static init_fnc_t init_sequence_f[] = {
 	/* TODO: can we rename this to timer_init()? */
 	init_timebase,
 #endif
-#if defined(CONFIG_X86) || defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
+#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
 		defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32)
 	timer_init,		/* initialize timer */
 #endif
Signature · 1 line
1.8.2.1
author
#1 lore raw

PATCH 2/2 x86: Remove timer_init() and move i8254_init() to x86_cpu_init_f()

Right now i8254_init() is called from timer_init() in the tsc timer driver. But actually i8254 and tsc are completely different things. Since tsc timer has been converted to driver model, we should find a new place that is appropriate for U-Boot to call i8254_init(), which is now x86_cpu_init_f().

---

 arch/x86/cpu/cpu.c        |  5 +++++
 drivers/timer/tsc_timer.c | 10 ----------
 2 files changed, 5 insertions(+), 10 deletions(-)
arch/x86/cpu/cpu.c +5 -0
index 1707993..381d835 100644
@@ -399,6 +399,11 @@ int x86_cpu_init_f(void)
 		}
 	}
 
+#ifdef CONFIG_I8254_TIMER
+	/* Set up the i8254 timer if required */
+	i8254_init();
+#endif
+
 	return 0;
 }
 
drivers/timer/tsc_timer.c +0 -10
index 6aa2437..5c4ec00 100644
@@ -325,16 +325,6 @@ void __udelay(unsigned long usec)
 #endif
 }
 
-int timer_init(void)
-{
-#ifdef CONFIG_I8254_TIMER
-	/* Set up the i8254 timer if required */
-	i8254_init();
-#endif
-
-	return 0;
-}
-
 static int tsc_timer_get_count(struct udevice *dev, u64 *count)
 {
 	u64 now_tick = rdtsc();
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH 2/2 x86: Remove timer_init() and move i8254_init() to x86_cpu_init_f()

Quoted 6 lines · Bin Meng

Right now i8254_init() is called from timer_init() in the tsc timer driver. But actually i8254 and tsc are completely different things. Since tsc timer has been converted to driver model, we should find a new place that is appropriate for U-Boot to call i8254_init(), which is now x86_cpu_init_f().

Quoted 6 lines

---

 arch/x86/cpu/cpu.c        |  5 +++++
 drivers/timer/tsc_timer.c | 10 ----------
 2 files changed, 5 insertions(+), 10 deletions(-)
#3 lore raw

PATCH 1/2 common: Remove timer_init() call for x86

In reply to Bin Meng

Hi Bin,

Quoted 23 lines · Bin Meng

With driver model timer support, there should not be an explict call to timer_init(). Remove this call for x86.

---

 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -2
index b035c90..92c42c5 100644
@@ -807,7 +807,7 @@ static init_fnc_t init_sequence_f[] = {
        /* TODO: can we rename this to timer_init()? */
        init_timebase,
 #endif
-#if defined(CONFIG_X86) || defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
+#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
                defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32)
        timer_init,             /* initialize timer */
 #endif
--
Quoted 2 lines

1.8.2.1

I have two questions:

1. Should we define a point during boot where the timer becomes available? I can't think of a good reason, but we should think about it.

2. Should we provide an 'early timer' before DM is ready, a bit like we do with the UART?

Regards,
Simon

author
#4 lore raw

PATCH 1/2 common: Remove timer_init() call for x86

Hi Simon,

Quoted 31 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

With driver model timer support, there should not be an explict call to timer_init(). Remove this call for x86.

---

 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -2
index b035c90..92c42c5 100644
@@ -807,7 +807,7 @@ static init_fnc_t init_sequence_f[] = {
        /* TODO: can we rename this to timer_init()? */
        init_timebase,
 #endif
-#if defined(CONFIG_X86) || defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
+#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
                defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32)
        timer_init,             /* initialize timer */
 #endif
--
Quoted 2 lines

1.8.2.1

Quoted 6 lines

I have two questions:

1. Should we define a point during boot where the timer becomes available? I can't think of a good reason, but we should think about it.

I would rather not create such a special point for timer, instead we just use the generic driver model limitations for the timer as well. That is, with dm timer support, these U-Boot timer APIs should only be available after driver model is initialized.

Quoted 3 lines

2. Should we provide an 'early timer' before DM is ready, a bit like we do with the UART?

I cannot think of a use case that uses timer in that early time.

Regards,
Bin

#5 lore raw

PATCH 1/2 common: Remove timer_init() call for x86

Hi Bin,

Quoted 16 lines · Bin Meng

Hi Simon,

Quoted 12 lines · Simon Glass

Hi Bin,

Quoted 9 lines · Bin Meng

With driver model timer support, there should not be an explict call to timer_init(). Remove this call for x86.

---

 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines
Quoted 9 lines

common/board_f.c static init_fnc_t init_sequence_f[] = { · line 810

Quoted 9 lines
common/board_f.c +0 -1
index b035c90..92c42c5 100644
@@ -807,7 +807,7 @@ static init_fnc_t init_sequence_f[] = {
        /* TODO: can we rename this to timer_init()? */
        init_timebase,
 #endif
-#if defined(CONFIG_X86) || defined(CONFIG_ARM) ||

defined(CONFIG_MIPS) || \

Quoted 22 lines
Quoted 8 lines
Quoted 7 lines
common/board_f.c +1 -1
+#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
                defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32)
        timer_init,             /* initialize timer */
 #endif
--

1.8.2.1

Quoted 8 lines

I have two questions:

1. Should we define a point during boot where the timer becomes available? I can't think of a good reason, but we should think about it.

I would rather not create such a special point for timer, instead we just use the generic driver model limitations for the timer as well. That is, with dm timer support, these U-Boot timer APIs should only be available after driver model is initialized.

Quoted 5 lines
Quoted 3 lines

2. Should we provide an 'early timer' before DM is ready, a bit like we do with the UART?

I cannot think of a use case that uses timer in that early time.

I can thing of two.

Bootstage requires a timer and the earliest we can mark the start time, the better.

In spl we may want to start DM after we have Sdram running, but Sdram may need time delays to work.

Regards,
Simon