x86: Convert to use driver model timer
authorBin Meng <bmeng.cn@gmail.com>
Fri, 13 Nov 2015 08:11:22 +0000 (00:11 -0800)
committerSimon Glass <sjg@chromium.org>
Tue, 1 Dec 2015 13:26:35 +0000 (06:26 -0700)
Convert all x86 boards to use driver model tsc timer.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
27 files changed:
arch/x86/cpu/baytrail/valleyview.c
arch/x86/cpu/coreboot/timestamp.c
arch/x86/cpu/efi/efi.c
arch/x86/cpu/ivybridge/cpu.c
arch/x86/cpu/qemu/qemu.c
arch/x86/cpu/quark/quark.c
arch/x86/cpu/queensbay/tnc.c
arch/x86/dts/bayleybay.dts
arch/x86/dts/broadwell_som-6896.dts
arch/x86/dts/chromebook_link.dts
arch/x86/dts/chromebox_panther.dts
arch/x86/dts/crownbay.dts
arch/x86/dts/efi.dts
arch/x86/dts/galileo.dts
arch/x86/dts/minnowmax.dts
arch/x86/dts/qemu-x86_i440fx.dts
arch/x86/dts/qemu-x86_q35.dts
arch/x86/dts/tsc_timer.dtsi [new file with mode: 0644]
configs/bayleybay_defconfig
configs/chromebook_link_defconfig
configs/chromebox_panther_defconfig
configs/coreboot-x86_defconfig
configs/crownbay_defconfig
configs/efi-x86_defconfig
configs/galileo_defconfig
configs/minnowmax_defconfig
configs/qemu-x86_defconfig

index a009c14..9b30451 100644 (file)
@@ -28,9 +28,6 @@ int arch_cpu_init(void)
        int ret;
 
        post_code(POST_CPU_INIT);
-#ifdef CONFIG_SYS_X86_TSC_TIMER
-       timer_set_base(rdtsc());
-#endif
 
        ret = x86_cpu_init_f();
        if (ret)
index 0edee6b..b382795 100644 (file)
@@ -27,28 +27,6 @@ static struct timestamp_table *ts_table  __attribute__((section(".data")));
 
 void timestamp_init(void)
 {
-#ifdef CONFIG_SYS_X86_TSC_TIMER
-       uint64_t base_time;
-#endif
-
-       ts_table = lib_sysinfo.tstamp_table;
-#ifdef CONFIG_SYS_X86_TSC_TIMER
-       /*
-        * If coreboot is built with CONFIG_COLLECT_TIMESTAMPS, use the value
-        * of base_time in coreboot's timestamp table as our timer base,
-        * otherwise TSC counter value will be used.
-        *
-        * Sometimes even coreboot is built with CONFIG_COLLECT_TIMESTAMPS,
-        * the value of base_time in the timestamp table is still zero, so
-        * we must exclude this case too (this is currently seen on booting
-        * coreboot in qemu)
-        */
-       if (ts_table && ts_table->base_time)
-               base_time = ts_table->base_time;
-       else
-               base_time = rdtsc();
-       timer_set_base(base_time);
-#endif
        timestamp_add_now(TS_U_BOOT_INITTED);
 }
 
index 75ba0d4..993ab8d 100644 (file)
 
 int arch_cpu_init(void)
 {
-#ifdef CONFIG_SYS_X86_TSC_TIMER
-       timer_set_base(rdtsc());
-#endif
-
        return 0;
 }
 
index 0e6512c..0387444 100644 (file)
@@ -118,7 +118,6 @@ static void set_spi_speed(void)
 int arch_cpu_init(void)
 {
        post_code(POST_CPU_INIT);
-       timer_set_base(rdtsc());
 
        return x86_cpu_init_f();
 }
index 84fb082..1f93f72 100644 (file)
@@ -64,9 +64,6 @@ int arch_cpu_init(void)
        int ret;
 
        post_code(POST_CPU_INIT);
-#ifdef CONFIG_SYS_X86_TSC_TIMER
-       timer_set_base(rdtsc());
-#endif
 
        ret = x86_cpu_init_f();
        if (ret)
index f737e19..c2bf497 100644 (file)
@@ -233,9 +233,6 @@ int arch_cpu_init(void)
        int ret;
 
        post_code(POST_CPU_INIT);
-#ifdef CONFIG_SYS_X86_TSC_TIMER
-       timer_set_base(rdtsc());
-#endif
 
        ret = x86_cpu_init_f();
        if (ret)
index 933d189..fb81919 100644 (file)
@@ -52,9 +52,6 @@ int arch_cpu_init(void)
        int ret;
 
        post_code(POST_CPU_INIT);
-#ifdef CONFIG_SYS_X86_TSC_TIMER
-       timer_set_base(rdtsc());
-#endif
 
        ret = x86_cpu_init_f();
        if (ret)
index aa86387..d3380de 100644 (file)
@@ -13,6 +13,7 @@
 /include/ "keyboard.dtsi"
 /include/ "serial.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "Intel Bayley Bay";
index a6b5d0f..194f0eb 100644 (file)
@@ -3,6 +3,7 @@
 /include/ "skeleton.dtsi"
 /include/ "serial.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "Advantech SOM-6896";
index 7870bb1..c4469a9 100644 (file)
@@ -4,6 +4,7 @@
 /include/ "keyboard.dtsi"
 /include/ "serial.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "Google Link";
index 61e8f2f..4e2b517 100644 (file)
@@ -3,6 +3,7 @@
 /include/ "skeleton.dtsi"
 /include/ "serial.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "Google Panther";
index eb8421c..e17ce71 100644 (file)
@@ -12,6 +12,7 @@
 /include/ "serial.dtsi"
 /include/ "keyboard.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "Intel Crown Bay";
index 1f50428..6cd8116 100644 (file)
@@ -7,6 +7,7 @@
 /dts-v1/;
 
 /include/ "skeleton.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "EFI";
                stdout-path = &serial;
        };
 
+       tsc-timer {
+               clock-frequency = <1000000000>;
+       };
+
        serial: serial {
                compatible = "efi,uart";
        };
index b49b1f5..2342de7 100644 (file)
@@ -11,6 +11,7 @@
 
 /include/ "skeleton.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "Intel Galileo";
                stdout-path = &pciuart0;
        };
 
+       tsc-timer {
+               clock-frequency = <400000000>;
+       };
+
        mrc {
                compatible = "intel,quark-mrc";
                flags = <MRC_FLAG_SCRAMBLE_EN>;
index b03f987..bbfd6d4 100644 (file)
@@ -12,6 +12,7 @@
 /include/ "skeleton.dtsi"
 /include/ "serial.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "Intel Minnowboard Max";
index 8da7e52..8a06229 100644 (file)
@@ -12,6 +12,7 @@
 /include/ "serial.dtsi"
 /include/ "keyboard.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "QEMU x86 (I440FX)";
                };
        };
 
+       tsc-timer {
+               clock-frequency = <1000000000>;
+       };
+
        pci {
                compatible = "pci-x86";
                #address-cells = <3>;
index df30c89..0b685c8 100644 (file)
@@ -22,6 +22,7 @@
 /include/ "serial.dtsi"
 /include/ "keyboard.dtsi"
 /include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
 
 / {
        model = "QEMU x86 (Q35)";
                };
        };
 
+       tsc-timer {
+               clock-frequency = <1000000000>;
+       };
+
        pci {
                compatible = "pci-x86";
                #address-cells = <3>;
diff --git a/arch/x86/dts/tsc_timer.dtsi b/arch/x86/dts/tsc_timer.dtsi
new file mode 100644 (file)
index 0000000..4f5021d
--- /dev/null
@@ -0,0 +1,6 @@
+/ {
+       tsc-timer {
+               compatible = "x86,tsc-timer";
+               u-boot,dm-pre-reloc;
+       };
+};
index 0a5a56f..f462e05 100644 (file)
@@ -30,6 +30,7 @@ CONFIG_DM_PCI=y
 CONFIG_DM_RTC=y
 CONFIG_SYS_NS16550=y
 CONFIG_ICH_SPI=y
+CONFIG_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_VIDEO_VESA=y
index ac64877..dbfbb97 100644 (file)
@@ -32,6 +32,7 @@ CONFIG_DEBUG_UART_CLOCK=1843200
 CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_SYS_NS16550=y
 CONFIG_ICH_SPI=y
+CONFIG_TIMER=y
 CONFIG_TPM_TIS_LPC=y
 CONFIG_VIDEO_VESA=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
index 0f3a9af..ed4428f 100644 (file)
@@ -27,6 +27,7 @@ CONFIG_DM_PCI=y
 CONFIG_DM_RTC=y
 CONFIG_SYS_NS16550=y
 CONFIG_ICH_SPI=y
+CONFIG_TIMER=y
 CONFIG_TPM_TIS_LPC=y
 CONFIG_VIDEO_VESA=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
index 8903cdd..05b1325 100644 (file)
@@ -21,6 +21,7 @@ CONFIG_E1000=y
 CONFIG_DM_PCI=y
 CONFIG_DM_RTC=y
 CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
 CONFIG_TPM_TIS_LPC=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
index f4592c5..932d9ec 100644 (file)
@@ -30,6 +30,7 @@ CONFIG_DM_PCI=y
 CONFIG_DM_RTC=y
 CONFIG_SYS_NS16550=y
 CONFIG_ICH_SPI=y
+CONFIG_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_VIDEO_VESA=y
index 2daab36..3b81046 100644 (file)
@@ -14,4 +14,6 @@ CONFIG_DEBUG_EFI_CONSOLE=y
 CONFIG_DEBUG_UART_BASE=0
 CONFIG_DEBUG_UART_CLOCK=0
 CONFIG_ICH_SPI=y
+# CONFIG_X86_SERIAL is not set
+CONFIG_TIMER=y
 CONFIG_EFI=y
index 3612350..0604aa7 100644 (file)
@@ -24,6 +24,7 @@ CONFIG_DM_PCI=y
 CONFIG_DM_RTC=y
 CONFIG_SYS_NS16550=y
 CONFIG_ICH_SPI=y
+CONFIG_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USE_PRIVATE_LIBGCC=y
index 37c07c1..864fd1b 100644 (file)
@@ -32,6 +32,7 @@ CONFIG_DEBUG_UART_BASE=0x3f8
 CONFIG_DEBUG_UART_CLOCK=1843200
 CONFIG_SYS_NS16550=y
 CONFIG_ICH_SPI=y
+CONFIG_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_VIDEO_VESA=y
index ebdb892..8c86931 100644 (file)
@@ -23,6 +23,7 @@ CONFIG_E1000=y
 CONFIG_DM_PCI=y
 CONFIG_DM_RTC=y
 CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_VIDEO_VESA=y