src: Use #include <timer.h> when appropriate
Also, extra-lines added or removed and local includes moved down.
Change-Id: I5e739233f3742fd68d537f671642bb04886e3009
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32009
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/commonlib/storage/sd.c b/src/commonlib/storage/sd.c
index 1389ffb..2e1ae85 100644
--- a/src/commonlib/storage/sd.c
+++ b/src/commonlib/storage/sd.c
@@ -24,9 +24,9 @@
#include <commonlib/storage.h>
#include <delay.h>
#include <endian.h>
+
#include "sd_mmc.h"
#include "storage.h"
-#include <timer.h>
int sd_send_if_cond(struct storage_media *media)
{
diff --git a/src/commonlib/storage/sd_mmc.c b/src/commonlib/storage/sd_mmc.c
index bda8d74..fd59bd0 100644
--- a/src/commonlib/storage/sd_mmc.c
+++ b/src/commonlib/storage/sd_mmc.c
@@ -24,11 +24,11 @@
#include <commonlib/storage.h>
#include <delay.h>
#include <endian.h>
+#include <string.h>
+
#include "mmc.h"
#include "sd_mmc.h"
#include "storage.h"
-#include <string.h>
-#include <timer.h>
uint64_t sd_mmc_extract_uint32_bits(const uint32_t *array, int start, int count)
{
diff --git a/src/commonlib/storage/sdhci_adma.c b/src/commonlib/storage/sdhci_adma.c
index e95742b..1bae3fb 100644
--- a/src/commonlib/storage/sdhci_adma.c
+++ b/src/commonlib/storage/sdhci_adma.c
@@ -22,11 +22,11 @@
#include <commonlib/storage.h>
#include <delay.h>
#include <endian.h>
+#include <string.h>
+
#include "sdhci.h"
#include "sd_mmc.h"
#include "storage.h"
-#include <string.h>
-#include <timer.h>
static void sdhci_alloc_adma_descs(struct sdhci_ctrlr *sdhci_ctrlr,
u32 need_descriptors)
diff --git a/src/cpu/allwinner/a10/timer.c b/src/cpu/allwinner/a10/timer.c
index c91d492..87228a0 100644
--- a/src/cpu/allwinner/a10/timer.c
+++ b/src/cpu/allwinner/a10/timer.c
@@ -17,11 +17,10 @@
*
*/
-#include "timer.h"
-
#include <device/mmio.h>
#include <delay.h>
-#include <timer.h>
+
+#include "timer.h"
struct a1x_timer_module *const timer_module = (void *)A1X_TIMER_BASE;
struct a1x_timer *const tmr0 =
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index 138f194..9d51b3e 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -36,6 +36,7 @@
#include <smp/atomic.h>
#include <smp/spinlock.h>
#include <symbols.h>
+#include <timer.h>
#include <thread.h>
#define MAX_APIC_IDS 256
diff --git a/src/drivers/i2c/tpm/tis.c b/src/drivers/i2c/tpm/tis.c
index 92c8921..fd56ade 100644
--- a/src/drivers/i2c/tpm/tis.c
+++ b/src/drivers/i2c/tpm/tis.c
@@ -18,15 +18,14 @@
#include <string.h>
#include <assert.h>
#include <commonlib/endian.h>
+#include <console/console.h>
#include <delay.h>
#include <device/i2c_simple.h>
#include <endian.h>
#include <lib.h>
#include <security/tpm/tis.h>
-#include "tpm.h"
-#include <timer.h>
-#include <console/console.h>
+#include "tpm.h"
/* global structure for tpm chip data */
static struct tpm_chip g_chip CAR_GLOBAL;
diff --git a/src/lib/thread.c b/src/lib/thread.c
index 57a0f8c..281885f 100644
--- a/src/lib/thread.c
+++ b/src/lib/thread.c
@@ -12,6 +12,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
+
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
@@ -19,6 +20,7 @@
#include <bootstate.h>
#include <console/console.h>
#include <thread.h>
+#include <timer.h>
static void idle_thread_init(void);
diff --git a/src/soc/cavium/cn81xx/include/soc/timer.h b/src/soc/cavium/cn81xx/include/soc/timer.h
index 4507b0b..5c4cbd2 100644
--- a/src/soc/cavium/cn81xx/include/soc/timer.h
+++ b/src/soc/cavium/cn81xx/include/soc/timer.h
@@ -18,7 +18,6 @@
#include <inttypes.h>
#include <types.h>
-#include <timer.h>
#include <delay.h>
/* Watchdog functions */
diff --git a/src/soc/intel/apollolake/pmutil.c b/src/soc/intel/apollolake/pmutil.c
index e766c77..22f5309 100644
--- a/src/soc/intel/apollolake/pmutil.c
+++ b/src/soc/intel/apollolake/pmutil.c
@@ -35,8 +35,8 @@
#include <soc/pci_devs.h>
#include <soc/pm.h>
#include <soc/smbus.h>
-#include <timer.h>
#include <security/vboot/vbnv.h>
+
#include "chip.h"
static uintptr_t read_pmc_mmio_bar(void)
diff --git a/src/soc/intel/cannonlake/pmutil.c b/src/soc/intel/cannonlake/pmutil.c
index 310a0c6..ab36c70 100644
--- a/src/soc/intel/cannonlake/pmutil.c
+++ b/src/soc/intel/cannonlake/pmutil.c
@@ -38,8 +38,8 @@
#include <soc/pci_devs.h>
#include <soc/pm.h>
#include <soc/smbus.h>
-#include <timer.h>
#include <security/vboot/vbnv.h>
+
#include "chip.h"
/*
diff --git a/src/soc/intel/cannonlake/reset.c b/src/soc/intel/cannonlake/reset.c
index a6f8092..e92396f 100644
--- a/src/soc/intel/cannonlake/reset.c
+++ b/src/soc/intel/cannonlake/reset.c
@@ -20,7 +20,6 @@
#include <fsp/util.h>
#include <soc/intel/common/reset.h>
#include <string.h>
-#include <timer.h>
#include <soc/pci_devs.h>
/* Reset Request */
diff --git a/src/soc/intel/common/block/systemagent/systemagent_early.c b/src/soc/intel/common/block/systemagent/systemagent_early.c
index 93fa5df..a3e278f 100644
--- a/src/soc/intel/common/block/systemagent/systemagent_early.c
+++ b/src/soc/intel/common/block/systemagent/systemagent_early.c
@@ -22,8 +22,8 @@
#include <soc/iomap.h>
#include <soc/pci_devs.h>
#include <soc/systemagent.h>
+
#include "systemagent_def.h"
-#include <timer.h>
#if !ENV_RAMSTAGE
void bootblock_systemagent_early_init(void)
diff --git a/src/soc/intel/icelake/pmutil.c b/src/soc/intel/icelake/pmutil.c
index fa2411d..96ff52d 100644
--- a/src/soc/intel/icelake/pmutil.c
+++ b/src/soc/intel/icelake/pmutil.c
@@ -37,8 +37,8 @@
#include <soc/pci_devs.h>
#include <soc/pm.h>
#include <soc/smbus.h>
-#include <timer.h>
#include <security/vboot/vbnv.h>
+
#include "chip.h"
/*
diff --git a/src/soc/intel/icelake/reset.c b/src/soc/intel/icelake/reset.c
index 854723c..470b5f4 100644
--- a/src/soc/intel/icelake/reset.c
+++ b/src/soc/intel/icelake/reset.c
@@ -20,7 +20,6 @@
#include <fsp/util.h>
#include <soc/intel/common/reset.h>
#include <string.h>
-#include <timer.h>
#include <soc/pci_devs.h>
/* Reset Request */
diff --git a/src/soc/intel/quark/storage_test.c b/src/soc/intel/quark/storage_test.c
index 79901f2..bdf86b1 100644
--- a/src/soc/intel/quark/storage_test.c
+++ b/src/soc/intel/quark/storage_test.c
@@ -25,6 +25,7 @@
#include <soc/iomap.h>
#include <soc/pci_devs.h>
#include <soc/storage_test.h>
+#include <timer.h>
#include <string.h>
#if CONFIG(STORAGE_LOG)
diff --git a/src/soc/intel/skylake/pmutil.c b/src/soc/intel/skylake/pmutil.c
index b517e6d..7d0dc0a 100644
--- a/src/soc/intel/skylake/pmutil.c
+++ b/src/soc/intel/skylake/pmutil.c
@@ -37,8 +37,8 @@
#include <soc/pm.h>
#include <soc/pmc.h>
#include <soc/smbus.h>
-#include <timer.h>
#include <security/vboot/vbnv.h>
+
#include "chip.h"
/*
diff --git a/src/soc/intel/skylake/reset.c b/src/soc/intel/skylake/reset.c
index f73563e..ff1a959 100644
--- a/src/soc/intel/skylake/reset.c
+++ b/src/soc/intel/skylake/reset.c
@@ -20,7 +20,6 @@
#include <soc/intel/common/reset.h>
#include <soc/me.h>
#include <soc/pm.h>
-#include <timer.h>
static void do_force_global_reset(void)
{
diff --git a/src/soc/mediatek/common/include/soc/pmic_wrap_common.h b/src/soc/mediatek/common/include/soc/pmic_wrap_common.h
index bf0b752..0b9f2d3 100644
--- a/src/soc/mediatek/common/include/soc/pmic_wrap_common.h
+++ b/src/soc/mediatek/common/include/soc/pmic_wrap_common.h
@@ -17,7 +17,6 @@
#define SOC_MEDIATEK_PMIC_WRAP_COMMON_H
#include <console/console.h>
-#include <timer.h>
#define PWRAPTAG "[PWRAP] "
#define pwrap_err(fmt, arg ...) printk(BIOS_ERR, PWRAPTAG "ERROR,line=%d" fmt, \
diff --git a/src/soc/mediatek/common/include/soc/rtc_common.h b/src/soc/mediatek/common/include/soc/rtc_common.h
index e3c231b..11c2f5f 100644
--- a/src/soc/mediatek/common/include/soc/rtc_common.h
+++ b/src/soc/mediatek/common/include/soc/rtc_common.h
@@ -21,7 +21,6 @@
#include <console/console.h>
#include <delay.h>
#include <rtc.h>
-#include <timer.h>
#include <soc/pmic_wrap_common.h>
#define RTCTAG "[RTC]"
diff --git a/src/soc/mediatek/common/pmic_wrap.c b/src/soc/mediatek/common/pmic_wrap.c
index 9e1163b..1b8bc5d 100644
--- a/src/soc/mediatek/common/pmic_wrap.c
+++ b/src/soc/mediatek/common/pmic_wrap.c
@@ -16,6 +16,7 @@
#include <device/mmio.h>
#include <assert.h>
#include <soc/pmic_wrap.h>
+#include <timer.h>
u32 wait_for_state_idle(u32 timeout_us, void *wacs_register,
void *wacs_vldclr_register, u32 *read_reg)
diff --git a/src/soc/mediatek/common/rtc.c b/src/soc/mediatek/common/rtc.c
index 3b1a600..2fe024a 100644
--- a/src/soc/mediatek/common/rtc.c
+++ b/src/soc/mediatek/common/rtc.c
@@ -16,6 +16,7 @@
#include <soc/rtc_common.h>
#include <soc/rtc.h>
#include <soc/pmic_wrap.h>
+#include <timer.h>
/* ensure rtc write success */
int rtc_busy_wait(void)
diff --git a/src/soc/mediatek/mt8183/pmic_wrap.c b/src/soc/mediatek/mt8183/pmic_wrap.c
index 2593b7a..65584ab 100644
--- a/src/soc/mediatek/mt8183/pmic_wrap.c
+++ b/src/soc/mediatek/mt8183/pmic_wrap.c
@@ -17,6 +17,7 @@
#include <soc/infracfg.h>
#include <soc/pll.h>
#include <soc/pmic_wrap.h>
+#include <timer.h>
#define PRIORITY_FIELD(x) ((x % 4) * 8)
#define PRIORITY_IN(id, priority) (id << PRIORITY_FIELD(priority))
diff --git a/src/soc/nvidia/tegra210/romstage.c b/src/soc/nvidia/tegra210/romstage.c
index bfa3c0a..3bd1a5b 100644
--- a/src/soc/nvidia/tegra210/romstage.c
+++ b/src/soc/nvidia/tegra210/romstage.c
@@ -28,7 +28,6 @@
#include <soc/romstage.h>
#include <soc/nvidia/tegra/apbmisc.h>
#include <symbols.h>
-#include <timer.h>
#include <vendorcode/google/chromeos/chromeos.h>
void __weak romstage_mainboard_init(void)
diff --git a/src/soc/nvidia/tegra210/soc.c b/src/soc/nvidia/tegra210/soc.c
index c013099..cedcc18 100644
--- a/src/soc/nvidia/tegra210/soc.c
+++ b/src/soc/nvidia/tegra210/soc.c
@@ -26,7 +26,6 @@
#include <soc/cpu.h>
#include <soc/mc.h>
#include <soc/nvidia/tegra/apbmisc.h>
-#include <timer.h>
#include <soc/sdram.h>
#include <soc/sdram_configs.h>
diff --git a/src/soc/nvidia/tegra210/spi.c b/src/soc/nvidia/tegra210/spi.c
index 6542df1..edb052d 100644
--- a/src/soc/nvidia/tegra210/spi.c
+++ b/src/soc/nvidia/tegra210/spi.c
@@ -29,8 +29,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <symbols.h>
-#include <timer.h>
-
#if defined(CONFIG_DEBUG_SPI) && CONFIG_DEBUG_SPI
# define DEBUG_SPI(x,...) printk(BIOS_DEBUG, "TEGRA_SPI: " x)
diff --git a/src/soc/qualcomm/ipq40xx/blobs_init.c b/src/soc/qualcomm/ipq40xx/blobs_init.c
index 761b571..5cda9fc 100644
--- a/src/soc/qualcomm/ipq40xx/blobs_init.c
+++ b/src/soc/qualcomm/ipq40xx/blobs_init.c
@@ -19,9 +19,7 @@
#include <cbfs.h>
#include <console/console.h>
#include <string.h>
-#include <timer.h>
#include <program_loading.h>
-
#include <soc/iomap.h>
#include <soc/soc_services.h>
diff --git a/src/soc/qualcomm/sdm845/clock.c b/src/soc/qualcomm/sdm845/clock.c
index bdbcfb8..5f0c305 100644
--- a/src/soc/qualcomm/sdm845/clock.c
+++ b/src/soc/qualcomm/sdm845/clock.c
@@ -17,10 +17,8 @@
#include <types.h>
#include <console/console.h>
#include <delay.h>
-#include <timer.h>
#include <commonlib/helpers.h>
#include <assert.h>
-
#include <soc/clock.h>
#define DIV(div) (2*div - 1)
diff --git a/src/soc/qualcomm/sdm845/gpio.c b/src/soc/qualcomm/sdm845/gpio.c
index a2a6fb9..afa461d 100644
--- a/src/soc/qualcomm/sdm845/gpio.c
+++ b/src/soc/qualcomm/sdm845/gpio.c
@@ -16,8 +16,6 @@
#include <device/mmio.h>
#include <types.h>
#include <delay.h>
-#include <timer.h>
-
#include <gpio.h>
void gpio_configure(gpio_t gpio, uint32_t func, uint32_t pull,
diff --git a/src/soc/samsung/exynos5420/dp.c b/src/soc/samsung/exynos5420/dp.c
index 190842e..5ad3dd3 100644
--- a/src/soc/samsung/exynos5420/dp.c
+++ b/src/soc/samsung/exynos5420/dp.c
@@ -23,7 +23,6 @@
#include <soc/sysreg.h>
#include <stdlib.h>
#include <string.h>
-#include <timer.h>
/*
* Here is the rough outline of how we bring up the display:
diff --git a/src/soc/samsung/exynos5420/dp_lowlevel.c b/src/soc/samsung/exynos5420/dp_lowlevel.c
index 5381657..164704b 100644
--- a/src/soc/samsung/exynos5420/dp_lowlevel.c
+++ b/src/soc/samsung/exynos5420/dp_lowlevel.c
@@ -23,7 +23,6 @@
#include <soc/power.h>
#include <soc/sysreg.h>
#include <stdlib.h>
-#include <timer.h>
/* FIXME: I think the DP controller shouldn't be hardcoded here... */
static struct exynos_dp * const dp_regs = (void *)EXYNOS5_DP1_BASE;
diff --git a/src/soc/samsung/exynos5420/fimd.c b/src/soc/samsung/exynos5420/fimd.c
index 2987598..6b69f18 100644
--- a/src/soc/samsung/exynos5420/fimd.c
+++ b/src/soc/samsung/exynos5420/fimd.c
@@ -24,7 +24,6 @@
#include <soc/fimd.h>
#include <soc/periph.h>
#include <soc/sysreg.h>
-#include <timer.h>
/* fairly useful debugging stuff. */
#if 0