summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-11-23 15:28:01 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-29 22:25:16 +0000
commit88684b2a25d0349bcd57cdba2a5aadb60d7bef07 (patch)
tree536f7547b233b9b6ef0a3d3506109f845a7e2f87
parent599c438e80c634a580c33bfb431472cf36c1cad5 (diff)
downloadchrome-ec-88684b2a25d0349bcd57cdba2a5aadb60d7bef07.tar.gz
chip: Sort header files
Sort all includes in chip with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j72 buildall_only runtests TEST=zmake compare-builds -a Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I13454e38fa3766aa0ba26a058075f51965b8462e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4053346 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--chip/host/flash.c4
-rw-r--r--chip/host/gpio.c2
-rw-r--r--chip/host/persistence.c9
-rw-r--r--chip/host/reboot.c7
-rw-r--r--chip/host/spi_controller.c5
-rw-r--r--chip/host/trng.c4
-rw-r--r--chip/host/uart.c13
-rw-r--r--chip/ish/aontaskfw/ish_aontask.c2
-rw-r--r--chip/ish/clock.c2
-rw-r--r--chip/ish/dma.c2
-rw-r--r--chip/ish/hbm.h6
-rw-r--r--chip/ish/heci_client.h6
-rw-r--r--chip/ish/hid_device.h6
-rw-r--r--chip/ish/hwtimer.c2
-rw-r--r--chip/ish/i2c.c6
-rw-r--r--chip/ish/ipc_heci.c10
-rw-r--r--chip/ish/ish_i2c.h3
-rw-r--r--chip/ish/ish_persistent_data.c4
-rw-r--r--chip/ish/power_mgt.c4
-rw-r--r--chip/ish/power_mgt.h4
-rw-r--r--chip/ish/system_state_subsys.c2
-rw-r--r--chip/ish/uart.c11
-rw-r--r--chip/ish/uart_defs.h5
-rw-r--r--chip/ish/watchdog.c2
-rw-r--r--chip/it83xx/adc.c2
-rw-r--r--chip/it83xx/adc_chip.h4
-rw-r--r--chip/it83xx/flash.c8
-rw-r--r--chip/it83xx/hwtimer.c2
-rw-r--r--chip/it83xx/i2c_peripheral.c3
-rw-r--r--chip/it83xx/keyboard_raw.c2
-rw-r--r--chip/it83xx/peci.c4
-rw-r--r--chip/it83xx/pwm.c2
-rw-r--r--chip/max32660/clock_chip.c6
-rw-r--r--chip/max32660/flash_chip.c8
-rw-r--r--chip/max32660/gpio_chip.c6
-rw-r--r--chip/max32660/hwtimer_chip.c6
-rw-r--r--chip/max32660/i2c_chip.c9
-rw-r--r--chip/max32660/system_chip.c4
-rw-r--r--chip/max32660/uart_chip.c15
-rw-r--r--chip/max32660/wdt_chip.c4
-rw-r--r--chip/mchp/adc.c2
-rw-r--r--chip/mchp/clock.c2
-rw-r--r--chip/mchp/dma.c2
-rw-r--r--chip/mchp/dma_chip.h2
-rw-r--r--chip/mchp/espi.c19
-rw-r--r--chip/mchp/fan.c2
-rw-r--r--chip/mchp/flash.c4
-rw-r--r--chip/mchp/gpio.c4
-rw-r--r--chip/mchp/gpio_chip.h6
-rw-r--r--chip/mchp/gpio_cmds.c4
-rw-r--r--chip/mchp/gpspi.c10
-rw-r--r--chip/mchp/gpspi_chip.h2
-rw-r--r--chip/mchp/hwtimer.c2
-rw-r--r--chip/mchp/keyboard_raw.c2
-rw-r--r--chip/mchp/lfw/ec_lfw.c20
-rw-r--r--chip/mchp/lfw/ec_lfw.h1
-rw-r--r--chip/mchp/lpc.c8
-rw-r--r--chip/mchp/pwm.c2
-rw-r--r--chip/mchp/qmspi.c12
-rw-r--r--chip/mchp/qmspi_chip.h2
-rw-r--r--chip/mchp/spi.c8
-rw-r--r--chip/mchp/spi_chip.h2
-rw-r--r--chip/mchp/system.c6
-rw-r--r--chip/mchp/uart.c2
-rw-r--r--chip/mchp/watchdog.c2
-rw-r--r--chip/mt_scp/mt818x/ipi.c2
-rw-r--r--chip/mt_scp/mt818x/memmap.c2
-rw-r--r--chip/mt_scp/mt8192/clock.c6
-rw-r--r--chip/mt_scp/mt8195/clock.c6
-rw-r--r--chip/npcx/adc.c2
-rw-r--r--chip/npcx/espi.c14
-rw-r--r--chip/npcx/fan.c13
-rw-r--r--chip/npcx/flash.c6
-rw-r--r--chip/npcx/gpio.c12
-rw-r--r--chip/npcx/header.c4
-rw-r--r--chip/npcx/hwtimer.c2
-rw-r--r--chip/npcx/keyboard_raw.c4
-rw-r--r--chip/npcx/lct.c2
-rw-r--r--chip/npcx/lpc.c4
-rw-r--r--chip/npcx/peci.c2
-rw-r--r--chip/npcx/ps2.c4
-rw-r--r--chip/npcx/registers.h2
-rw-r--r--chip/npcx/shi.c2
-rw-r--r--chip/npcx/spi.c4
-rw-r--r--chip/npcx/spiflashfw/npcx_monitor.c3
-rw-r--r--chip/npcx/system-npcx7.c8
-rw-r--r--chip/npcx/system-npcx9.c8
-rw-r--r--chip/npcx/uart.c2
-rw-r--r--chip/npcx/uartn.c7
-rw-r--r--chip/npcx/watchdog.c8
-rw-r--r--chip/stm32/adc-stm32l.c2
-rw-r--r--chip/stm32/bkpdata.c4
-rw-r--r--chip/stm32/clock-f.c2
-rw-r--r--chip/stm32/clock-stm32f0.c2
-rw-r--r--chip/stm32/clock-stm32f3.c2
-rw-r--r--chip/stm32/clock-stm32f4.c2
-rw-r--r--chip/stm32/clock-stm32g4.c2
-rw-r--r--chip/stm32/clock-stm32h7.c4
-rw-r--r--chip/stm32/clock-stm32l4.c2
-rw-r--r--chip/stm32/flash-f.c9
-rw-r--r--chip/stm32/flash-stm32f3.c7
-rw-r--r--chip/stm32/flash-stm32f4.c7
-rw-r--r--chip/stm32/flash-stm32g4-l4.c4
-rw-r--r--chip/stm32/flash-stm32h7.c6
-rw-r--r--chip/stm32/hwtimer32.c2
-rw-r--r--chip/stm32/i2c-stm32l4.c3
-rw-r--r--chip/stm32/i2c_ite_flash_support.c2
-rw-r--r--chip/stm32/pwm.c2
-rw-r--r--chip/stm32/uart.c4
-rw-r--r--chip/stm32/ucpd-stm32gx.c2
-rw-r--r--chip/stm32/usart-stm32f0.c3
-rw-r--r--chip/stm32/usart-stm32f3.c3
-rw-r--r--chip/stm32/usart-stm32f4.c3
-rw-r--r--chip/stm32/usart-stm32l.c3
-rw-r--r--chip/stm32/usart-stm32l5.c3
-rw-r--r--chip/stm32/usart_host_command.c6
-rw-r--r--chip/stm32/usart_host_command.h3
-rw-r--r--chip/stm32/usart_rx_dma.c3
-rw-r--r--chip/stm32/usart_rx_dma.h2
-rw-r--r--chip/stm32/usart_rx_interrupt-stm32f0.c3
-rw-r--r--chip/stm32/usart_rx_interrupt-stm32f3.c3
-rw-r--r--chip/stm32/usart_rx_interrupt-stm32f4.c3
-rw-r--r--chip/stm32/usart_rx_interrupt-stm32l.c3
-rw-r--r--chip/stm32/usart_rx_interrupt.c3
-rw-r--r--chip/stm32/usart_tx_dma.c5
-rw-r--r--chip/stm32/usart_tx_interrupt.c3
-rw-r--r--chip/stm32/usb-stm32f3.c3
-rw-r--r--chip/stm32/usb-stream.c4
-rw-r--r--chip/stm32/usb.c2
-rw-r--r--chip/stm32/usb_console.c2
-rw-r--r--chip/stm32/usb_dwc.c4
-rw-r--r--chip/stm32/usb_dwc_console.c2
-rw-r--r--chip/stm32/usb_dwc_stream.c3
-rw-r--r--chip/stm32/usb_dwc_stream.h2
-rw-r--r--chip/stm32/usb_endpoints.c7
-rw-r--r--chip/stm32/usb_hid.c4
-rw-r--r--chip/stm32/usb_hid_keyboard.c4
-rw-r--r--chip/stm32/usb_hid_touchpad.c4
-rw-r--r--chip/stm32/usb_isochronous.c4
-rw-r--r--chip/stm32/usb_pd_phy.c4
140 files changed, 313 insertions, 321 deletions
diff --git a/chip/host/flash.c b/chip/host/flash.c
index 209489162c..03a5fc777b 100644
--- a/chip/host/flash.c
+++ b/chip/host/flash.c
@@ -5,8 +5,6 @@
/* Flash module for emulator */
-#include <stdio.h>
-
#include "builtin/assert.h"
#include "common.h"
#include "config_chip.h"
@@ -14,6 +12,8 @@
#include "persistence.h"
#include "util.h"
+#include <stdio.h>
+
/* This needs to be aligned to the erase bank size for NVCTR. */
__aligned(CONFIG_FLASH_ERASE_SIZE) char __host_flash[CONFIG_FLASH_SIZE_BYTES];
uint8_t __host_flash_protect[PHYSICAL_BANKS];
diff --git a/chip/host/gpio.c b/chip/host/gpio.c
index b74bec52a1..d80d93dcf7 100644
--- a/chip/host/gpio.c
+++ b/chip/host/gpio.c
@@ -5,8 +5,6 @@
/* GPIO module for emulator */
-#include "console.h"
-
#include "common.h"
#include "console.h"
#include "gpio.h"
diff --git a/chip/host/persistence.c b/chip/host/persistence.c
index 4d8ef09df1..369f58034b 100644
--- a/chip/host/persistence.c
+++ b/chip/host/persistence.c
@@ -18,13 +18,14 @@
* this homegrown implementation of something similar-yet-different.
*/
-#include <linux/limits.h>
-#include <unistd.h>
+#include "builtin/assert.h"
+#include "util.h"
+
#include <stdio.h>
#include <string.h>
-#include "builtin/assert.h"
-#include "util.h"
+#include <linux/limits.h>
+#include <unistd.h>
/* The longest path in a chroot seems to be about 280 characters (as of
* April 2021) so define a cut-off instead of just hoping for the best:
diff --git a/chip/host/reboot.c b/chip/host/reboot.c
index 24d90d943d..59e15ee81d 100644
--- a/chip/host/reboot.c
+++ b/chip/host/reboot.c
@@ -5,14 +5,15 @@
/* Emulator self-reboot procedure */
-#include <string.h>
-#include <unistd.h>
-
#include "console.h"
#include "host_test.h"
#include "reboot.h"
#include "test_util.h"
+#include <string.h>
+
+#include <unistd.h>
+
#ifdef TEST_FUZZ
/* reboot breaks fuzzing, let's just not do it. */
void emulator_reboot(void)
diff --git a/chip/host/spi_controller.c b/chip/host/spi_controller.c
index a1df53d935..ae6e2c9346 100644
--- a/chip/host/spi_controller.c
+++ b/chip/host/spi_controller.c
@@ -5,13 +5,12 @@
* Mock SPI Controller driver for unit test.
*/
-#include <stdint.h>
-
#include "common.h"
#include "gpio.h"
-
#include "spi.h"
+#include <stdint.h>
+
test_mockable int spi_enable(const struct spi_device_t *spi_device, int enable)
{
return EC_SUCCESS;
diff --git a/chip/host/trng.c b/chip/host/trng.c
index ef3df1ad5f..d0def66277 100644
--- a/chip/host/trng.c
+++ b/chip/host/trng.c
@@ -14,11 +14,11 @@
#error "This fake trng driver must not be used in non-test builds."
#endif
+#include "common.h"
+
#include <stdint.h>
#include <stdlib.h> /* Only valid for host */
-#include "common.h"
-
static unsigned int seed;
test_mockable void trng_init(void)
diff --git a/chip/host/uart.c b/chip/host/uart.c
index 9e70a6005c..71e8345196 100644
--- a/chip/host/uart.c
+++ b/chip/host/uart.c
@@ -5,12 +5,6 @@
/* UART driver for emulator */
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <termio.h>
-#include <unistd.h>
-
#include "builtin/assert.h"
#include "common.h"
#include "queue.h"
@@ -19,6 +13,13 @@
#include "uart.h"
#include "util.h"
+#include <signal.h>
+#include <stdio.h>
+
+#include <pthread.h>
+#include <termio.h>
+#include <unistd.h>
+
static int stopped = 1;
static int init_done;
diff --git a/chip/ish/aontaskfw/ish_aontask.c b/chip/ish/aontaskfw/ish_aontask.c
index 58d62d1891..6f2d9c9f2d 100644
--- a/chip/ish/aontaskfw/ish_aontask.c
+++ b/chip/ish/aontaskfw/ish_aontask.c
@@ -45,8 +45,8 @@
#include "common.h"
#include "ia_structs.h"
-#include "ish_aon_share.h"
#include "ish_aon_defs.h"
+#include "ish_aon_share.h"
#include "ish_dma.h"
#include "power_mgt.h"
diff --git a/chip/ish/clock.c b/chip/ish/clock.c
index e46c4278b7..f9fec0b7d2 100644
--- a/chip/ish/clock.c
+++ b/chip/ish/clock.c
@@ -7,8 +7,8 @@
#include "clock.h"
#include "common.h"
-#include "util.h"
#include "power_mgt.h"
+#include "util.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CLOCK, outstr)
diff --git a/chip/ish/dma.c b/chip/ish/dma.c
index e2f1aba8ed..eae6a850f1 100644
--- a/chip/ish/dma.c
+++ b/chip/ish/dma.c
@@ -7,8 +7,8 @@
#include "common.h"
#include "console.h"
-#include "registers.h"
#include "ish_dma.h"
+#include "registers.h"
#include "util.h"
static int dma_init_called; /* If ish_dma_init is called */
diff --git a/chip/ish/hbm.h b/chip/ish/hbm.h
index d666f748c8..17c7853b1d 100644
--- a/chip/ish/hbm.h
+++ b/chip/ish/hbm.h
@@ -6,11 +6,11 @@
#ifndef __HBM_H
#define __HBM_H
-#include <stdint.h>
-#include <stddef.h>
-
#include "heci_client.h"
+#include <stddef.h>
+#include <stdint.h>
+
#define HBM_MAJOR_VERSION 1
#ifdef HECI_ENABLE_DMA
#define HBM_MINOR_VERSION 2
diff --git a/chip/ish/heci_client.h b/chip/ish/heci_client.h
index 951b82c6d9..2ba9ea01db 100644
--- a/chip/ish/heci_client.h
+++ b/chip/ish/heci_client.h
@@ -6,11 +6,11 @@
#ifndef __HECI_CLIENT_H
#define __HECI_CLIENT_H
-#include <stdint.h>
-#include <stddef.h>
-
#include "hooks.h"
+#include <stddef.h>
+#include <stdint.h>
+
#define HECI_MAX_NUM_OF_CLIENTS 2
#define HECI_MAX_MSG_SIZE 4960
diff --git a/chip/ish/hid_device.h b/chip/ish/hid_device.h
index ba7722f5bb..07d8a77673 100644
--- a/chip/ish/hid_device.h
+++ b/chip/ish/hid_device.h
@@ -6,11 +6,11 @@
#ifndef __HID_DEVICE_H
#define __HID_DEVICE_H
-#include <stdint.h>
-#include <stddef.h>
-
#include "hooks.h"
+#include <stddef.h>
+#include <stdint.h>
+
#define HID_SUBSYS_MAX_PAYLOAD_SIZE 4954
enum HID_SUBSYS_ERR {
diff --git a/chip/ish/hwtimer.c b/chip/ish/hwtimer.c
index 57049a63b3..40c3de67a8 100644
--- a/chip/ish/hwtimer.c
+++ b/chip/ish/hwtimer.c
@@ -8,9 +8,9 @@
#include "console.h"
#include "hpet.h"
#include "hwtimer.h"
-#include "timer.h"
#include "registers.h"
#include "task.h"
+#include "timer.h"
#include "util.h"
#define CPUTS(outstr) cputs(CC_CLOCK, outstr)
diff --git a/chip/ish/i2c.c b/chip/ish/i2c.c
index e26bcd70e5..230f073369 100644
--- a/chip/ish/i2c.c
+++ b/chip/ish/i2c.c
@@ -6,16 +6,16 @@
/* I2C port module for ISH */
#include "common.h"
-#include "console.h"
#include "config_chip.h"
+#include "console.h"
#include "gpio.h"
#include "hooks.h"
+#include "hwtimer.h"
#include "i2c.h"
-#include "registers.h"
#include "ish_i2c.h"
+#include "registers.h"
#include "task.h"
#include "timer.h"
-#include "hwtimer.h"
#include "util.h"
#define CPUTS(outstr) cputs(CC_I2C, outstr)
diff --git a/chip/ish/ipc_heci.c b/chip/ish/ipc_heci.c
index 1fd81e3d3f..8ce0a258e1 100644
--- a/chip/ish/ipc_heci.c
+++ b/chip/ish/ipc_heci.c
@@ -24,15 +24,15 @@
*/
#include "builtin/assert.h"
-#include "registers.h"
#include "console.h"
-#include "task.h"
-#include "util.h"
+#include "hooks.h"
+#include "hwtimer.h"
#include "ipc_heci.h"
#include "ish_fwst.h"
#include "queue.h"
-#include "hooks.h"
-#include "hwtimer.h"
+#include "registers.h"
+#include "task.h"
+#include "util.h"
#define CPUTS(outstr) cputs(CC_LPC, outstr)
#define CPRINTS(format, args...) cprints(CC_LPC, format, ##args)
diff --git a/chip/ish/ish_i2c.h b/chip/ish/ish_i2c.h
index c24f4e0cdc..7aa2977178 100644
--- a/chip/ish/ish_i2c.h
+++ b/chip/ish/ish_i2c.h
@@ -6,9 +6,10 @@
#ifndef __CROS_EC_ISH_I2C_H
#define __CROS_EC_ISH_I2C_H
-#include <stdint.h>
#include "task.h"
+#include <stdint.h>
+
#define I2C_TSC_TIMEOUT 2000000
#define I2C_CALIB_ADDRESS 0x3
#define I2C_INTERRUPT_TIMEOUT (TICKFREQ / 20)
diff --git a/chip/ish/ish_persistent_data.c b/chip/ish/ish_persistent_data.c
index 149acaeade..ed909d6f7b 100644
--- a/chip/ish/ish_persistent_data.c
+++ b/chip/ish/ish_persistent_data.c
@@ -4,11 +4,11 @@
*/
#include "common.h"
-#include "ec_commands.h"
#include "config.h"
+#include "ec_commands.h"
#include "hooks.h"
-#include "system.h"
#include "ish_persistent_data.h"
+#include "system.h"
#define PERSISTENT_DATA_MAGIC 0x49534864 /* "ISHd" */
diff --git a/chip/ish/power_mgt.c b/chip/ish/power_mgt.c
index b3e2a407ad..de9022b55a 100644
--- a/chip/ish/power_mgt.c
+++ b/chip/ish/power_mgt.c
@@ -3,8 +3,6 @@
* found in the LICENSE file.
*/
-#include <stdnoreturn.h>
-
#include "aontaskfw/ish_aon_share.h"
#include "console.h"
#include "hwtimer.h"
@@ -17,6 +15,8 @@
#include "util.h"
#include "watchdog.h"
+#include <stdnoreturn.h>
+
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
diff --git a/chip/ish/power_mgt.h b/chip/ish/power_mgt.h
index 851529ffb1..a7a702018f 100644
--- a/chip/ish/power_mgt.h
+++ b/chip/ish/power_mgt.h
@@ -6,11 +6,11 @@
#ifndef __CROS_EC_POWER_MGT_H
#define __CROS_EC_POWER_MGT_H
-#include <stdnoreturn.h>
-
#include "common.h"
#include "registers.h"
+#include <stdnoreturn.h>
+
extern void uart_port_restore(void);
extern void uart_to_idle(void);
extern void clear_fabric_error(void);
diff --git a/chip/ish/system_state_subsys.c b/chip/ish/system_state_subsys.c
index bfc120ff9b..76053dcded 100644
--- a/chip/ish/system_state_subsys.c
+++ b/chip/ish/system_state_subsys.c
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
+#include "console.h"
#include "heci_client.h"
#include "registers.h"
#include "system_state.h"
-#include "console.h"
#ifdef SS_SUBSYSTEM_DEBUG
#define CPUTS(outstr) cputs(CC_LPC, outstr)
diff --git a/chip/ish/uart.c b/chip/ish/uart.c
index b1c9493869..0ff03da89a 100644
--- a/chip/ish/uart.c
+++ b/chip/ish/uart.c
@@ -4,17 +4,16 @@
*/
/* UART module for ISH */
+#include "atomic.h"
#include "common.h"
-#include "math_util.h"
#include "console.h"
-#include "uart_defs.h"
-#include "atomic.h"
-#include "task.h"
+#include "interrupts.h"
+#include "math_util.h"
#include "registers.h"
+#include "system.h"
+#include "task.h"
#include "uart.h"
#include "uart_defs.h"
-#include "interrupts.h"
-#include "system.h"
#define CPUTS(outstr) cputs(CC_LPC, outstr)
#define CPRINTS(format, args...) cprints(CC_LPC, format, ##args)
diff --git a/chip/ish/uart_defs.h b/chip/ish/uart_defs.h
index 1fc36b7adc..581a702d31 100644
--- a/chip/ish/uart_defs.h
+++ b/chip/ish/uart_defs.h
@@ -8,10 +8,11 @@
#ifndef __CROS_EC_UART_DEFS_H_
#define __CROS_EC_UART_DEFS_H_
-#include <stdint.h>
-#include <stddef.h>
#include "atomic.h"
+#include <stddef.h>
+#include <stdint.h>
+
#define UART_ERROR -1
#define UART_BUSY -2
#ifdef CHIP_VARIANT_ISH5P4
diff --git a/chip/ish/watchdog.c b/chip/ish/watchdog.c
index 7b32133619..8f0ea5ddf1 100644
--- a/chip/ish/watchdog.c
+++ b/chip/ish/watchdog.c
@@ -23,9 +23,9 @@
#include "ec_commands.h"
#include "hooks.h"
#include "ish_persistent_data.h"
-#include "task.h"
#include "registers.h"
#include "system.h"
+#include "task.h"
#include "watchdog.h"
/* Units are hundreds of milliseconds */
diff --git a/chip/it83xx/adc.c b/chip/it83xx/adc.c
index 9f9fa27f41..c666fc4e88 100644
--- a/chip/it83xx/adc.c
+++ b/chip/it83xx/adc.c
@@ -7,8 +7,8 @@
#include "adc.h"
#include "clock.h"
-#include "console.h"
#include "common.h"
+#include "console.h"
#include "gpio.h"
#include "hooks.h"
#include "registers.h"
diff --git a/chip/it83xx/adc_chip.h b/chip/it83xx/adc_chip.h
index 99e84624e0..3804a684e5 100644
--- a/chip/it83xx/adc_chip.h
+++ b/chip/it83xx/adc_chip.h
@@ -8,10 +8,10 @@
#ifndef __CROS_EC_ADC_CHIP_H
#define __CROS_EC_ADC_CHIP_H
-#include <stdint.h>
-
#include "common.h"
+#include <stdint.h>
+
/*
* Maximum time we allow for an ADC conversion.
* NOTE:
diff --git a/chip/it83xx/flash.c b/chip/it83xx/flash.c
index 25aefa2f66..fa8ab65292 100644
--- a/chip/it83xx/flash.c
+++ b/chip/it83xx/flash.c
@@ -9,13 +9,13 @@
#include "flash_chip.h"
#include "host_command.h"
#include "intc.h"
-#include "system.h"
-#include "util.h"
-#include "watchdog.h"
#include "registers.h"
-#include "task.h"
#include "shared_mem.h"
+#include "system.h"
+#include "task.h"
#include "uart.h"
+#include "util.h"
+#include "watchdog.h"
#define FLASH_DMA_START ((uint32_t)&__flash_dma_start)
#define FLASH_DMA_CODE __attribute__((section(".flash_direct_map")))
diff --git a/chip/it83xx/hwtimer.c b/chip/it83xx/hwtimer.c
index b9add82b5a..7a46f52773 100644
--- a/chip/it83xx/hwtimer.c
+++ b/chip/it83xx/hwtimer.c
@@ -5,8 +5,8 @@
/* Hardware timers driver */
-#include "cpu.h"
#include "common.h"
+#include "cpu.h"
#include "hooks.h"
#include "hwtimer.h"
#include "hwtimer_chip.h"
diff --git a/chip/it83xx/i2c_peripheral.c b/chip/it83xx/i2c_peripheral.c
index 80fea907fd..dfb139514f 100644
--- a/chip/it83xx/i2c_peripheral.c
+++ b/chip/it83xx/i2c_peripheral.c
@@ -12,9 +12,10 @@
#include "i2c_peripheral.h"
#include "printf.h"
#include "registers.h"
+#include "task.h"
+
#include <stddef.h>
#include <string.h>
-#include "task.h"
/* Console output macros */
#define CPRINTS(format, args...) cprints(CC_I2C, format, ##args)
diff --git a/chip/it83xx/keyboard_raw.c b/chip/it83xx/keyboard_raw.c
index 0d2f048deb..9123a6e5e8 100644
--- a/chip/it83xx/keyboard_raw.c
+++ b/chip/it83xx/keyboard_raw.c
@@ -4,11 +4,11 @@
*/
#include "common.h"
+#include "irq_chip.h"
#include "keyboard_raw.h"
#include "keyboard_scan.h"
#include "registers.h"
#include "task.h"
-#include "irq_chip.h"
#define KSOH_PIN_MASK (((1 << (KEYBOARD_COLS_MAX - 8)) - 1) & 0xff)
diff --git a/chip/it83xx/peci.c b/chip/it83xx/peci.c
index e5f172ce80..ee94f2baac 100644
--- a/chip/it83xx/peci.c
+++ b/chip/it83xx/peci.c
@@ -10,9 +10,9 @@
#include "hooks.h"
#include "peci.h"
#include "registers.h"
-#include "util.h"
-#include "timer.h"
#include "task.h"
+#include "timer.h"
+#include "util.h"
enum peci_status {
PECI_STATUS_NO_ERR = 0x00,
diff --git a/chip/it83xx/pwm.c b/chip/it83xx/pwm.c
index 07165dea77..3d0d4eaeb6 100644
--- a/chip/it83xx/pwm.c
+++ b/chip/it83xx/pwm.c
@@ -8,11 +8,11 @@
#include "clock.h"
#include "gpio.h"
#include "hooks.h"
+#include "math_util.h"
#include "pwm.h"
#include "pwm_chip.h"
#include "registers.h"
#include "util.h"
-#include "math_util.h"
#define PWM_CTRX_MIN 100
#define PWM_EC_FREQ 8000000
diff --git a/chip/max32660/clock_chip.c b/chip/max32660/clock_chip.c
index 93a5f862d8..26225401ba 100644
--- a/chip/max32660/clock_chip.c
+++ b/chip/max32660/clock_chip.c
@@ -9,16 +9,16 @@
#include "common.h"
#include "console.h"
#include "cpu.h"
+#include "gcr_regs.h"
#include "hooks.h"
#include "hwtimer.h"
+#include "pwrseq_regs.h"
#include "registers.h"
#include "system.h"
#include "timer.h"
+#include "tmr_regs.h"
#include "util.h"
#include "watchdog.h"
-#include "tmr_regs.h"
-#include "gcr_regs.h"
-#include "pwrseq_regs.h"
#define MAX32660_SYSTEMCLOCK SYS_CLOCK_HIRC
diff --git a/chip/max32660/flash_chip.c b/chip/max32660/flash_chip.c
index eb702799b0..01a26f94b5 100644
--- a/chip/max32660/flash_chip.c
+++ b/chip/max32660/flash_chip.c
@@ -5,16 +5,16 @@
/* MAX32660 Flash Memory Module for Chrome EC */
+#include "common.h"
#include "flash.h"
+#include "flc_regs.h"
+#include "icc_regs.h"
+#include "registers.h"
#include "switch.h"
#include "system.h"
#include "timer.h"
#include "util.h"
#include "watchdog.h"
-#include "registers.h"
-#include "common.h"
-#include "icc_regs.h"
-#include "flc_regs.h"
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
diff --git a/chip/max32660/gpio_chip.c b/chip/max32660/gpio_chip.c
index cc54f9055f..b6deaa9111 100644
--- a/chip/max32660/gpio_chip.c
+++ b/chip/max32660/gpio_chip.c
@@ -6,16 +6,16 @@
/* MAX32660 GPIO module for Chrome EC */
#include "clock.h"
-#include "console.h"
#include "common.h"
+#include "console.h"
#include "gpio.h"
+#include "gpio_regs.h"
#include "hooks.h"
+#include "registers.h"
#include "switch.h"
#include "task.h"
#include "timer.h"
#include "util.h"
-#include "registers.h"
-#include "gpio_regs.h"
#define CPRINTF(format, args...) cprintf(CC_GPIO, format, ##args)
#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
diff --git a/chip/max32660/hwtimer_chip.c b/chip/max32660/hwtimer_chip.c
index a6469ae795..b6c39f4036 100644
--- a/chip/max32660/hwtimer_chip.c
+++ b/chip/max32660/hwtimer_chip.c
@@ -6,15 +6,15 @@
/* MAX32660 HW Timer module for Chrome EC */
#include "clock.h"
-#include "console.h"
#include "common.h"
+#include "console.h"
+#include "gcr_regs.h"
#include "hooks.h"
#include "hwtimer.h"
+#include "registers.h"
#include "task.h"
#include "timer.h"
-#include "registers.h"
#include "tmr_regs.h"
-#include "gcr_regs.h"
/* Define the rollover timer */
#define TMR_ROLLOVER MXC_TMR0
diff --git a/chip/max32660/i2c_chip.c b/chip/max32660/i2c_chip.c
index bb116f4d8a..a4fab91199 100644
--- a/chip/max32660/i2c_chip.c
+++ b/chip/max32660/i2c_chip.c
@@ -5,18 +5,19 @@
/* MAX32660 I2C port module for Chrome EC. */
-#include <stdint.h>
-#include <stddef.h>
#include "common.h"
#include "config_chip.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
+#include "i2c_regs.h"
+#include "registers.h"
#include "stdbool.h"
#include "system.h"
#include "task.h"
-#include "registers.h"
-#include "i2c_regs.h"
+
+#include <stddef.h>
+#include <stdint.h>
/**
* Byte to use if the EC HOST requested more data
diff --git a/chip/max32660/system_chip.c b/chip/max32660/system_chip.c
index 8679881102..f63e22dc26 100644
--- a/chip/max32660/system_chip.c
+++ b/chip/max32660/system_chip.c
@@ -9,14 +9,14 @@
#include "common.h"
#include "console.h"
#include "cpu.h"
+#include "gcr_regs.h"
#include "host_command.h"
#include "panic.h"
+#include "registers.h"
#include "system.h"
#include "task.h"
#include "timer.h"
#include "util.h"
-#include "registers.h"
-#include "gcr_regs.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
diff --git a/chip/max32660/uart_chip.c b/chip/max32660/uart_chip.c
index 87ba59e629..ec25d9e476 100644
--- a/chip/max32660/uart_chip.c
+++ b/chip/max32660/uart_chip.c
@@ -5,18 +5,19 @@
/* MAX32660 Console UART Module for Chrome EC */
-#include <stdint.h>
+#include "common.h"
+#include "gcr_regs.h"
+#include "gpio.h"
+#include "gpio_regs.h"
+#include "registers.h"
#include "system.h"
#include "task.h"
-#include "uart.h"
-#include "registers.h"
#include "tmr_regs.h"
-#include "gpio.h"
-#include "gpio_regs.h"
-#include "common.h"
-#include "gcr_regs.h"
+#include "uart.h"
#include "uart_regs.h"
+#include <stdint.h>
+
static int done_uart_init_yet;
#ifndef UARTN
diff --git a/chip/max32660/wdt_chip.c b/chip/max32660/wdt_chip.c
index af9a5d2ef4..4890c34536 100644
--- a/chip/max32660/wdt_chip.c
+++ b/chip/max32660/wdt_chip.c
@@ -8,13 +8,13 @@
#include "clock.h"
#include "common.h"
#include "config.h"
+#include "console.h"
#include "gpio.h"
#include "hooks.h"
+#include "registers.h"
#include "task.h"
#include "util.h"
#include "watchdog.h"
-#include "console.h"
-#include "registers.h"
#include "wdt_regs.h"
#define CPUTS(outstr) cputs(CC_COMMAND, outstr)
diff --git a/chip/mchp/adc.c b/chip/mchp/adc.c
index 621fe1f3be..f09c04d26b 100644
--- a/chip/mchp/adc.c
+++ b/chip/mchp/adc.c
@@ -10,9 +10,9 @@
#include "hooks.h"
#include "registers.h"
#include "task.h"
+#include "tfdp_chip.h"
#include "timer.h"
#include "util.h"
-#include "tfdp_chip.h"
/*
* Conversion on a single channel takes less than 12 ms. Set timeout to
diff --git a/chip/mchp/clock.c b/chip/mchp/clock.c
index 4701d43b1f..0323d16f8f 100644
--- a/chip/mchp/clock.c
+++ b/chip/mchp/clock.c
@@ -17,10 +17,10 @@
#include "shared_mem.h"
#include "system.h"
#include "task.h"
+#include "tfdp_chip.h"
#include "timer.h"
#include "uart.h"
#include "util.h"
-#include "tfdp_chip.h"
#include "vboot_hash.h"
/* Console output macros */
diff --git a/chip/mchp/dma.c b/chip/mchp/dma.c
index 8a091286a7..c921527d7f 100644
--- a/chip/mchp/dma.c
+++ b/chip/mchp/dma.c
@@ -9,9 +9,9 @@
#include "hooks.h"
#include "registers.h"
#include "task.h"
+#include "tfdp_chip.h"
#include "timer.h"
#include "util.h"
-#include "tfdp_chip.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_DMA, outstr)
diff --git a/chip/mchp/dma_chip.h b/chip/mchp/dma_chip.h
index 6f569a1dc7..bfdb8ab9be 100644
--- a/chip/mchp/dma_chip.h
+++ b/chip/mchp/dma_chip.h
@@ -13,8 +13,8 @@
#ifndef _DMA_CHIP_H
#define _DMA_CHIP_H
-#include <stdint.h>
#include <stddef.h>
+#include <stdint.h>
#ifdef __cplusplus
extern "C" {
diff --git a/chip/mchp/espi.c b/chip/mchp/espi.c
index 371cf09c5e..53d17e90b2 100644
--- a/chip/mchp/espi.c
+++ b/chip/mchp/espi.c
@@ -5,29 +5,26 @@
/* ESPI module for Chrome EC */
-#include "common.h"
#include "acpi.h"
+#include "chipset.h"
+#include "common.h"
#include "console.h"
+#include "espi.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
#include "keyboard_protocol.h"
-#include "port80.h"
-#include "util.h"
-#include "chipset.h"
-
-#include "registers.h"
-#include "espi.h"
#include "lpc.h"
#include "lpc_chip.h"
+#include "port80.h"
+#include "power.h"
+#include "registers.h"
#include "system.h"
#include "task.h"
-#include "console.h"
+#include "tfdp_chip.h"
+#include "timer.h"
#include "uart.h"
#include "util.h"
-#include "power.h"
-#include "timer.h"
-#include "tfdp_chip.h"
/* Console output macros */
#ifdef CONFIG_MCHP_ESPI_DEBUG
diff --git a/chip/mchp/fan.c b/chip/mchp/fan.c
index 3f61cb4d2f..c68d71bcc8 100644
--- a/chip/mchp/fan.c
+++ b/chip/mchp/fan.c
@@ -9,8 +9,8 @@
#include "fan.h"
#include "registers.h"
-#include "util.h"
#include "tfdp_chip.h"
+#include "util.h"
/* Maximum fan driver setting value */
#define MAX_FAN_DRIVER_SETTING 0x3ff
diff --git a/chip/mchp/flash.c b/chip/mchp/flash.c
index 4b0e407fb2..f0f3a5575e 100644
--- a/chip/mchp/flash.c
+++ b/chip/mchp/flash.c
@@ -6,14 +6,14 @@
#include "common.h"
#include "console.h"
#include "flash.h"
+#include "hooks.h"
#include "host_command.h"
#include "shared_mem.h"
#include "spi.h"
#include "spi_flash.h"
#include "system.h"
-#include "util.h"
-#include "hooks.h"
#include "tfdp_chip.h"
+#include "util.h"
#define PAGE_SIZE 256
diff --git a/chip/mchp/gpio.c b/chip/mchp/gpio.c
index a3cab86fcc..3ad9d7b6e4 100644
--- a/chip/mchp/gpio.c
+++ b/chip/mchp/gpio.c
@@ -8,13 +8,13 @@
#include "common.h"
#include "gpio.h"
#include "hooks.h"
+#include "lpc_chip.h"
#include "registers.h"
#include "system.h"
#include "task.h"
+#include "tfdp_chip.h"
#include "timer.h"
#include "util.h"
-#include "lpc_chip.h"
-#include "tfdp_chip.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LPC, outstr)
diff --git a/chip/mchp/gpio_chip.h b/chip/mchp/gpio_chip.h
index e092669b60..ec0f3d2278 100644
--- a/chip/mchp/gpio_chip.h
+++ b/chip/mchp/gpio_chip.h
@@ -13,11 +13,11 @@
#ifndef _GPIO_CHIP_H
#define _GPIO_CHIP_H
-#include <stdint.h>
-#include <stddef.h>
-
#include "gpio.h"
+#include <stddef.h>
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/chip/mchp/gpio_cmds.c b/chip/mchp/gpio_cmds.c
index 927d6d0326..a53f8cca2a 100644
--- a/chip/mchp/gpio_cmds.c
+++ b/chip/mchp/gpio_cmds.c
@@ -8,12 +8,12 @@
#include "common.h"
#include "console.h"
#include "gpio.h"
+#include "gpio_chip.h"
#include "hooks.h"
#include "registers.h"
#include "system.h"
-#include "util.h"
-#include "gpio_chip.h"
#include "tfdp_chip.h"
+#include "util.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LPC, outstr)
diff --git a/chip/mchp/gpspi.c b/chip/mchp/gpspi.c
index 0142fe0e3c..a7f7b388c4 100644
--- a/chip/mchp/gpspi.c
+++ b/chip/mchp/gpspi.c
@@ -9,15 +9,15 @@
#include "console.h"
#include "dma.h"
#include "gpio.h"
+#include "gpspi_chip.h"
+#include "hooks.h"
#include "registers.h"
#include "spi.h"
-#include "timer.h"
-#include "util.h"
-#include "hooks.h"
-#include "task.h"
#include "spi_chip.h"
-#include "gpspi_chip.h"
+#include "task.h"
#include "tfdp_chip.h"
+#include "timer.h"
+#include "util.h"
#define CPUTS(outstr) cputs(CC_SPI, outstr)
#define CPRINTS(format, args...) cprints(CC_SPI, format, ##args)
diff --git a/chip/mchp/gpspi_chip.h b/chip/mchp/gpspi_chip.h
index 7c1285b6cf..16c3208410 100644
--- a/chip/mchp/gpspi_chip.h
+++ b/chip/mchp/gpspi_chip.h
@@ -13,8 +13,8 @@
#ifndef _GPSPI_CHIP_H
#define _GPSPI_CHIP_H
-#include <stdint.h>
#include <stddef.h>
+#include <stdint.h>
/* struct spi_device_t */
#include "spi.h"
diff --git a/chip/mchp/hwtimer.c b/chip/mchp/hwtimer.c
index 2e9ff780fb..c72140b18f 100644
--- a/chip/mchp/hwtimer.c
+++ b/chip/mchp/hwtimer.c
@@ -11,8 +11,8 @@
#include "hwtimer.h"
#include "registers.h"
#include "task.h"
-#include "timer.h"
#include "tfdp_chip.h"
+#include "timer.h"
void __hw_clock_event_set(uint32_t deadline)
{
diff --git a/chip/mchp/keyboard_raw.c b/chip/mchp/keyboard_raw.c
index daa0c8e64f..30181776fa 100644
--- a/chip/mchp/keyboard_raw.c
+++ b/chip/mchp/keyboard_raw.c
@@ -11,8 +11,8 @@
#include "keyboard_scan.h"
#include "registers.h"
#include "task.h"
-#include "util.h"
#include "tfdp_chip.h"
+#include "util.h"
/*
* Using direct mode interrupt, do not enable
diff --git a/chip/mchp/lfw/ec_lfw.c b/chip/mchp/lfw/ec_lfw.c
index 3a9d7160dc..eb8b3370cb 100644
--- a/chip/mchp/lfw/ec_lfw.c
+++ b/chip/mchp/lfw/ec_lfw.c
@@ -6,23 +6,23 @@
*
*/
-#include <stdint.h>
-
+#include "clock.h"
#include "config.h"
+#include "cpu.h"
#include "cros_version.h"
+#include "dma.h"
#include "gpio.h"
+#include "gpio_list.h"
+#include "hwtimer.h"
+#include "registers.h"
#include "spi.h"
#include "spi_flash.h"
-#include "util.h"
-#include "timer.h"
-#include "dma.h"
-#include "registers.h"
-#include "cpu.h"
-#include "clock.h"
#include "system.h"
-#include "hwtimer.h"
-#include "gpio_list.h"
#include "tfdp_chip.h"
+#include "timer.h"
+#include "util.h"
+
+#include <stdint.h>
#ifdef CONFIG_MCHP_LFW_DEBUG
#include "dma_chip.h"
diff --git a/chip/mchp/lfw/ec_lfw.h b/chip/mchp/lfw/ec_lfw.h
index 2589638954..0c677e5d0b 100644
--- a/chip/mchp/lfw/ec_lfw.h
+++ b/chip/mchp/lfw/ec_lfw.h
@@ -7,6 +7,7 @@
*/
#include <stdint.h>
+
#include <stdnoreturn.h>
/* Why naked? This is dangerous except for
diff --git a/chip/mchp/lpc.c b/chip/mchp/lpc.c
index da9b045b22..e41e4b0c78 100644
--- a/chip/mchp/lpc.c
+++ b/chip/mchp/lpc.c
@@ -5,24 +5,24 @@
/* LPC module for MCHP MEC family */
-#include "common.h"
#include "acpi.h"
+#include "chipset.h"
+#include "common.h"
#include "console.h"
+#include "espi.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
#include "keyboard_protocol.h"
#include "lpc.h"
#include "lpc_chip.h"
-#include "espi.h"
#include "port80.h"
#include "registers.h"
#include "system.h"
#include "task.h"
+#include "tfdp_chip.h"
#include "timer.h"
#include "util.h"
-#include "chipset.h"
-#include "tfdp_chip.h"
/* Console output macros */
#ifdef CONFIG_MCHP_DEBUG_LPC
diff --git a/chip/mchp/pwm.c b/chip/mchp/pwm.c
index d0e88b5175..706228fa53 100644
--- a/chip/mchp/pwm.c
+++ b/chip/mchp/pwm.c
@@ -12,8 +12,8 @@
#include "pwm.h"
#include "pwm_chip.h"
#include "registers.h"
-#include "util.h"
#include "tfdp_chip.h"
+#include "util.h"
#define CPUTS(outstr) cputs(CC_PWM, outstr)
#define CPRINTS(format, args...) cprints(CC_PWM, format, ##args)
diff --git a/chip/mchp/qmspi.c b/chip/mchp/qmspi.c
index 6979bdae6a..a0d31b72e3 100644
--- a/chip/mchp/qmspi.c
+++ b/chip/mchp/qmspi.c
@@ -8,17 +8,17 @@
#include "common.h"
#include "console.h"
#include "dma.h"
+#include "dma_chip.h"
#include "gpio.h"
+#include "hooks.h"
+#include "qmspi_chip.h"
#include "registers.h"
#include "spi.h"
-#include "timer.h"
-#include "util.h"
-#include "hooks.h"
-#include "task.h"
-#include "dma_chip.h"
#include "spi_chip.h"
-#include "qmspi_chip.h"
+#include "task.h"
#include "tfdp_chip.h"
+#include "timer.h"
+#include "util.h"
#define CPUTS(outstr) cputs(CC_SPI, outstr)
#define CPRINTS(format, args...) cprints(CC_SPI, format, ##args)
diff --git a/chip/mchp/qmspi_chip.h b/chip/mchp/qmspi_chip.h
index 5a66c34e62..899f59516f 100644
--- a/chip/mchp/qmspi_chip.h
+++ b/chip/mchp/qmspi_chip.h
@@ -13,8 +13,8 @@
#ifndef _QMSPI_CHIP_H
#define _QMSPI_CHIP_H
-#include <stdint.h>
#include <stddef.h>
+#include <stdint.h>
/* struct spi_device_t */
#include "spi.h"
diff --git a/chip/mchp/spi.c b/chip/mchp/spi.c
index 195c10d8a6..4445666790 100644
--- a/chip/mchp/spi.c
+++ b/chip/mchp/spi.c
@@ -9,14 +9,14 @@
#include "console.h"
#include "dma.h"
#include "gpio.h"
+#include "hooks.h"
+#include "qmspi_chip.h"
#include "registers.h"
#include "spi.h"
+#include "spi_chip.h"
+#include "task.h"
#include "timer.h"
#include "util.h"
-#include "hooks.h"
-#include "task.h"
-#include "spi_chip.h"
-#include "qmspi_chip.h"
#if defined(CONFIG_MCHP_GPSPI) && !defined(LFW)
#include "gpspi_chip.h"
#endif
diff --git a/chip/mchp/spi_chip.h b/chip/mchp/spi_chip.h
index f8c4c1169c..e651901ea4 100644
--- a/chip/mchp/spi_chip.h
+++ b/chip/mchp/spi_chip.h
@@ -13,8 +13,8 @@
#ifndef _SPI_CHIP_H
#define _SPI_CHIP_H
-#include <stdint.h>
#include <stddef.h>
+#include <stdint.h>
/* struct spi_device_t */
#include "spi.h"
diff --git a/chip/mchp/system.c b/chip/mchp/system.c
index bb5224c455..65470c43b9 100644
--- a/chip/mchp/system.c
+++ b/chip/mchp/system.c
@@ -5,11 +5,9 @@
/* System module for Chrome EC : MCHP hardware specific implementation */
-#include <stdnoreturn.h>
-
-#include "common.h" /* includes config.h and board.h */
#include "clock.h"
#include "clock_chip.h"
+#include "common.h" /* includes config.h and board.h */
#include "console.h"
#include "cpu.h"
#include "gpio.h"
@@ -25,6 +23,8 @@
#include "timer.h"
#include "util.h"
+#include <stdnoreturn.h>
+
#define CPUTS(outstr) cputs(CC_LPC, outstr)
#define CPRINTS(format, args...) cprints(CC_LPC, format, ##args)
diff --git a/chip/mchp/uart.c b/chip/mchp/uart.c
index 00bfc77e14..59ea3e1c35 100644
--- a/chip/mchp/uart.c
+++ b/chip/mchp/uart.c
@@ -13,9 +13,9 @@
#include "registers.h"
#include "system.h"
#include "task.h"
+#include "tfdp_chip.h"
#include "uart.h"
#include "util.h"
-#include "tfdp_chip.h"
#define TX_FIFO_SIZE 16
diff --git a/chip/mchp/watchdog.c b/chip/mchp/watchdog.c
index 0de4398fdb..50edda70e0 100644
--- a/chip/mchp/watchdog.c
+++ b/chip/mchp/watchdog.c
@@ -8,8 +8,8 @@
#include "hooks.h"
#include "registers.h"
#include "task.h"
-#include "watchdog.h"
#include "tfdp_chip.h"
+#include "watchdog.h"
void watchdog_reload(void)
{
diff --git a/chip/mt_scp/mt818x/ipi.c b/chip/mt_scp/mt818x/ipi.c
index 723137d9c9..d0d9292fd1 100644
--- a/chip/mt_scp/mt818x/ipi.c
+++ b/chip/mt_scp/mt818x/ipi.c
@@ -24,13 +24,13 @@
#include "console.h"
#include "hooks.h"
#include "host_command.h"
+#include "hwtimer.h"
#include "ipi_chip.h"
#include "mkbp_event.h"
#include "power.h"
#include "system.h"
#include "task.h"
#include "util.h"
-#include "hwtimer.h"
#include "video.h"
#define CPRINTF(format, args...) cprintf(CC_IPI, format, ##args)
diff --git a/chip/mt_scp/mt818x/memmap.c b/chip/mt_scp/mt818x/memmap.c
index 0ecb370cf3..24c0fd8f7a 100644
--- a/chip/mt_scp/mt818x/memmap.c
+++ b/chip/mt_scp/mt818x/memmap.c
@@ -11,8 +11,8 @@
#include "hooks.h"
#include "memmap.h"
#include "registers.h"
-#include "util.h"
#include "task.h"
+#include "util.h"
/*
* Map SCP address (bits 31~28) to AP address
diff --git a/chip/mt_scp/mt8192/clock.c b/chip/mt_scp/mt8192/clock.c
index 665695a7a2..21d07d410a 100644
--- a/chip/mt_scp/mt8192/clock.c
+++ b/chip/mt_scp/mt8192/clock.c
@@ -5,9 +5,6 @@
/* Clocks, PLL and power settings */
-#include <assert.h>
-#include <string.h>
-
#include "clock.h"
#include "common.h"
#include "console.h"
@@ -17,6 +14,9 @@
#include "registers.h"
#include "timer.h"
+#include <assert.h>
+#include <string.h>
+
#define CPRINTF(format, args...) cprintf(CC_CLOCK, format, ##args)
#define CPRINTS(format, args...) cprints(CC_CLOCK, format, ##args)
diff --git a/chip/mt_scp/mt8195/clock.c b/chip/mt_scp/mt8195/clock.c
index 2ed3fab4a1..779f356bab 100644
--- a/chip/mt_scp/mt8195/clock.c
+++ b/chip/mt_scp/mt8195/clock.c
@@ -5,9 +5,6 @@
/* Clocks, PLL and power settings */
-#include <assert.h>
-#include <string.h>
-
#include "clock.h"
#include "common.h"
#include "console.h"
@@ -20,6 +17,9 @@
#include "task.h"
#include "timer.h"
+#include <assert.h>
+#include <string.h>
+
#define CPRINTF(format, args...) cprintf(CC_CLOCK, format, ##args)
#define CPRINTS(format, args...) cprints(CC_CLOCK, format, ##args)
diff --git a/chip/npcx/adc.c b/chip/npcx/adc.c
index f01419bf67..73d4ec48b3 100644
--- a/chip/npcx/adc.c
+++ b/chip/npcx/adc.c
@@ -9,8 +9,8 @@
#include "atomic.h"
#include "clock.h"
#include "clock_chip.h"
-#include "console.h"
#include "common.h"
+#include "console.h"
#include "gpio.h"
#include "hooks.h"
#include "registers.h"
diff --git a/chip/npcx/espi.c b/chip/npcx/espi.c
index 4cf5b0e80d..e73d04e988 100644
--- a/chip/npcx/espi.c
+++ b/chip/npcx/espi.c
@@ -5,18 +5,18 @@
/* ESPI module for Chrome EC */
-#include "registers.h"
-#include "system.h"
-#include "task.h"
#include "chipset.h"
#include "console.h"
-#include "uart.h"
-#include "util.h"
-#include "power.h"
#include "espi.h"
-#include "lpc_chip.h"
#include "hooks.h"
+#include "lpc_chip.h"
+#include "power.h"
+#include "registers.h"
+#include "system.h"
+#include "task.h"
#include "timer.h"
+#include "uart.h"
+#include "util.h"
/* Console output macros */
#if !(DEBUG_ESPI)
diff --git a/chip/npcx/fan.c b/chip/npcx/fan.c
index 6a246f5c6a..9ceccaba33 100644
--- a/chip/npcx/fan.c
+++ b/chip/npcx/fan.c
@@ -7,20 +7,19 @@
#include "clock.h"
#include "clock_chip.h"
+#include "console.h"
#include "fan.h"
#include "fan_chip.h"
#include "gpio.h"
#include "hooks.h"
-#include "registers.h"
-#include "util.h"
+#include "math_util.h"
#include "pwm.h"
#include "pwm_chip.h"
-#include "console.h"
-#include "timer.h"
-#include "task.h"
-#include "hooks.h"
+#include "registers.h"
#include "system.h"
-#include "math_util.h"
+#include "task.h"
+#include "timer.h"
+#include "util.h"
#if !(DEBUG_FAN)
#define CPRINTS(...)
diff --git a/chip/npcx/flash.c b/chip/npcx/flash.c
index 390cb1fa64..dc8de6e3ee 100644
--- a/chip/npcx/flash.c
+++ b/chip/npcx/flash.c
@@ -6,18 +6,18 @@
/* Flash memory module for Chrome EC */
#include "builtin/assert.h"
+#include "console.h"
#include "flash.h"
#include "host_command.h"
+#include "hwtimer_chip.h"
#include "registers.h"
#include "spi_flash_reg.h"
#include "switch.h"
#include "system.h"
+#include "task.h"
#include "timer.h"
#include "util.h"
-#include "task.h"
#include "watchdog.h"
-#include "console.h"
-#include "hwtimer_chip.h"
static int all_protected; /* Has all-flash protection been requested? */
static int addr_prot_start;
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c
index 4127b79e30..a976b3b122 100644
--- a/chip/npcx/gpio.c
+++ b/chip/npcx/gpio.c
@@ -7,19 +7,19 @@
#include "builtin/assert.h"
#include "common.h"
+#include "ec_commands.h"
#include "gpio.h"
#include "gpio_chip.h"
-#include "i2c.h"
#include "hooks.h"
+#include "host_command.h"
+#include "hwtimer_chip.h"
+#include "i2c.h"
#include "registers.h"
+#include "system.h"
+#include "system_chip.h"
#include "task.h"
#include "timer.h"
#include "util.h"
-#include "system.h"
-#include "system_chip.h"
-#include "ec_commands.h"
-#include "host_command.h"
-#include "hwtimer_chip.h"
#if !(DEBUG_GPIO)
#define CPUTS(...)
diff --git a/chip/npcx/header.c b/chip/npcx/header.c
index 2db7d9094c..81e5e986af 100644
--- a/chip/npcx/header.c
+++ b/chip/npcx/header.c
@@ -10,11 +10,11 @@
* This header is used by Nuvoton EC Booter.
*/
-#include <stdint.h>
-
#include "config.h"
#include "registers.h"
+#include <stdint.h>
+
/* Signature used by fw header */
#define SIG_FW_EC 0x2A3B4D5E
diff --git a/chip/npcx/hwtimer.c b/chip/npcx/hwtimer.c
index dfa06f69b2..e2e2fe4b19 100644
--- a/chip/npcx/hwtimer.c
+++ b/chip/npcx/hwtimer.c
@@ -8,12 +8,12 @@
#include "clock.h"
#include "clock_chip.h"
#include "common.h"
+#include "console.h"
#include "hooks.h"
#include "hwtimer.h"
#include "hwtimer_chip.h"
#include "math_util.h"
#include "registers.h"
-#include "console.h"
#include "task.h"
#include "timer.h"
#include "util.h"
diff --git a/chip/npcx/keyboard_raw.c b/chip/npcx/keyboard_raw.c
index cb2be7911e..1774e7353d 100644
--- a/chip/npcx/keyboard_raw.c
+++ b/chip/npcx/keyboard_raw.c
@@ -5,11 +5,11 @@
/* Functions needed by keyboard scanner module for Chrome EC */
+#include "clock.h"
#include "common.h"
+#include "gpio.h"
#include "keyboard_raw.h"
#include "keyboard_scan.h"
-#include "clock.h"
-#include "gpio.h"
#include "registers.h"
#include "task.h"
diff --git a/chip/npcx/lct.c b/chip/npcx/lct.c
index 19568cac44..8f720e1376 100644
--- a/chip/npcx/lct.c
+++ b/chip/npcx/lct.c
@@ -4,9 +4,9 @@
*/
/* LCT (Long Countdown Timer) module for Chrome EC */
-#include "lct_chip.h"
#include "console.h"
#include "hooks.h"
+#include "lct_chip.h"
#include "registers.h"
#include "rtc.h"
#include "task.h"
diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c
index 48e094f3fc..b44420e025 100644
--- a/chip/npcx/lpc.c
+++ b/chip/npcx/lpc.c
@@ -20,12 +20,12 @@
#include "lpc_chip.h"
#include "port80.h"
#include "registers.h"
-#include "system.h"
#include "sib_chip.h"
+#include "system.h"
+#include "system_chip.h"
#include "task.h"
#include "uart.h"
#include "util.h"
-#include "system_chip.h"
/* Console output macros */
#if !(DEBUG_LPC)
diff --git a/chip/npcx/peci.c b/chip/npcx/peci.c
index 7c213648f4..8a4372f7bd 100644
--- a/chip/npcx/peci.c
+++ b/chip/npcx/peci.c
@@ -15,8 +15,8 @@
#include "peci.h"
#include "registers.h"
#include "task.h"
-#include "timer.h"
#include "temp_sensor.h"
+#include "timer.h"
#include "util.h"
/* Initial PECI baud rate */
diff --git a/chip/npcx/ps2.c b/chip/npcx/ps2.c
index a8a65e63ea..5fc91ef241 100644
--- a/chip/npcx/ps2.c
+++ b/chip/npcx/ps2.c
@@ -8,11 +8,11 @@
#include "atomic.h"
#include "clock.h"
#include "console.h"
-#include "hooks.h"
#include "gpio.h"
+#include "hooks.h"
#include "ps2_chip.h"
-#include "task.h"
#include "registers.h"
+#include "task.h"
#include "timer.h"
#include "util.h"
diff --git a/chip/npcx/registers.h b/chip/npcx/registers.h
index 922d787323..a583fb1c64 100644
--- a/chip/npcx/registers.h
+++ b/chip/npcx/registers.h
@@ -8,9 +8,9 @@
#ifndef __CROS_EC_REGISTERS_H
#define __CROS_EC_REGISTERS_H
+#include "clock_chip.h"
#include "common.h"
#include "compile_time_macros.h"
-#include "clock_chip.h"
/******************************************************************************/
/*
diff --git a/chip/npcx/shi.c b/chip/npcx/shi.c
index d5f19c9191..dde2243462 100644
--- a/chip/npcx/shi.c
+++ b/chip/npcx/shi.c
@@ -15,12 +15,12 @@
#include "clock.h"
#include "console.h"
#include "gpio.h"
-#include "task.h"
#include "hooks.h"
#include "host_command.h"
#include "registers.h"
#include "spi.h"
#include "system.h"
+#include "task.h"
#include "timer.h"
#include "util.h"
diff --git a/chip/npcx/spi.c b/chip/npcx/spi.c
index 0161ce63ef..bbe6b33a9d 100644
--- a/chip/npcx/spi.c
+++ b/chip/npcx/spi.c
@@ -5,11 +5,11 @@
/* SPI module for Chrome EC */
+#include "clock.h"
+#include "clock_chip.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
-#include "clock.h"
-#include "clock_chip.h"
#include "registers.h"
#include "spi.h"
#include "task.h"
diff --git a/chip/npcx/spiflashfw/npcx_monitor.c b/chip/npcx/spiflashfw/npcx_monitor.c
index 5b7a767992..0d8530a456 100644
--- a/chip/npcx/spiflashfw/npcx_monitor.c
+++ b/chip/npcx/spiflashfw/npcx_monitor.c
@@ -5,12 +5,13 @@
* NPCX SoC spi flash update tool - monitor firmware
*/
-#include <stdint.h>
#include "config.h"
#include "npcx_monitor.h"
#include "registers.h"
#include "util.h"
+#include <stdint.h>
+
/*****************************************************************************/
/* spi flash internal functions */
void sspi_flash_pinmux(int enable)
diff --git a/chip/npcx/system-npcx7.c b/chip/npcx/system-npcx7.c
index 5cacbec749..386544ed04 100644
--- a/chip/npcx/system-npcx7.c
+++ b/chip/npcx/system-npcx7.c
@@ -11,16 +11,16 @@
#include "console.h"
#include "cpu.h"
#include "ec_commands.h"
+#include "gpio.h"
#include "hooks.h"
+#include "hwtimer_chip.h"
#include "lct_chip.h"
#include "registers.h"
+#include "rom_chip.h"
#include "system.h"
+#include "system_chip.h"
#include "task.h"
#include "util.h"
-#include "gpio.h"
-#include "hwtimer_chip.h"
-#include "system_chip.h"
-#include "rom_chip.h"
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
diff --git a/chip/npcx/system-npcx9.c b/chip/npcx/system-npcx9.c
index 5cacbec749..386544ed04 100644
--- a/chip/npcx/system-npcx9.c
+++ b/chip/npcx/system-npcx9.c
@@ -11,16 +11,16 @@
#include "console.h"
#include "cpu.h"
#include "ec_commands.h"
+#include "gpio.h"
#include "hooks.h"
+#include "hwtimer_chip.h"
#include "lct_chip.h"
#include "registers.h"
+#include "rom_chip.h"
#include "system.h"
+#include "system_chip.h"
#include "task.h"
#include "util.h"
-#include "gpio.h"
-#include "hwtimer_chip.h"
-#include "system_chip.h"
-#include "rom_chip.h"
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
diff --git a/chip/npcx/uart.c b/chip/npcx/uart.c
index bc87b5921e..d77c3579c5 100644
--- a/chip/npcx/uart.c
+++ b/chip/npcx/uart.c
@@ -6,6 +6,7 @@
/* UART module for Chrome EC */
#include "clock.h"
+#include "clock_chip.h"
#include "common.h"
#include "console.h"
#include "gpio.h"
@@ -13,7 +14,6 @@
#include "hwtimer_chip.h"
#include "lpc.h"
#include "registers.h"
-#include "clock_chip.h"
#include "system.h"
#include "task.h"
#include "timer.h"
diff --git a/chip/npcx/uartn.c b/chip/npcx/uartn.c
index 9bcaccd94c..66cb30062b 100644
--- a/chip/npcx/uartn.c
+++ b/chip/npcx/uartn.c
@@ -6,15 +6,16 @@
/* UART module for Chrome EC */
-#include <clock.h>
#include "common.h"
-#include <gpio.h>
-#include <gpio_chip.h>
#include "registers.h"
#include "system.h"
#include "task.h"
#include "util.h"
+#include <clock.h>
+#include <gpio.h>
+#include <gpio_chip.h>
+
#ifdef NPCX_UART_FIFO_SUPPORT
/* Enable UART Tx FIFO empty interrupt */
#define NPCX_UART_TX_EMPTY_INT_EN(n) \
diff --git a/chip/npcx/watchdog.c b/chip/npcx/watchdog.c
index 8ae9ee0474..7998378565 100644
--- a/chip/npcx/watchdog.c
+++ b/chip/npcx/watchdog.c
@@ -8,14 +8,14 @@
#include "clock.h"
#include "common.h"
#include "console.h"
-#include "registers.h"
-#include "hwtimer_chip.h"
#include "gpio.h"
#include "hooks.h"
-#include "timer.h"
+#include "hwtimer_chip.h"
+#include "registers.h"
+#include "system_chip.h"
#include "task.h"
+#include "timer.h"
#include "util.h"
-#include "system_chip.h"
#include "watchdog.h"
/* WDCNT value for watchdog period */
diff --git a/chip/stm32/adc-stm32l.c b/chip/stm32/adc-stm32l.c
index 636710f071..06b16224f7 100644
--- a/chip/stm32/adc-stm32l.c
+++ b/chip/stm32/adc-stm32l.c
@@ -4,9 +4,9 @@
*/
#include "adc.h"
+#include "clock.h"
#include "common.h"
#include "console.h"
-#include "clock.h"
#include "dma.h"
#include "hooks.h"
#include "registers.h"
diff --git a/chip/stm32/bkpdata.c b/chip/stm32/bkpdata.c
index bde026facd..ef5729d118 100644
--- a/chip/stm32/bkpdata.c
+++ b/chip/stm32/bkpdata.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
-#include <assert.h>
-
#include "bkpdata.h"
#include "registers.h"
#include "system.h" /* enum system_bbram_idx */
#include "task.h"
+#include <assert.h>
+
uint16_t bkpdata_read(enum bkpdata_index index)
{
if (index < 0 || index >= STM32_BKP_ENTRIES)
diff --git a/chip/stm32/clock-f.c b/chip/stm32/clock-f.c
index d181397d86..0aad58ab00 100644
--- a/chip/stm32/clock-f.c
+++ b/chip/stm32/clock-f.c
@@ -7,8 +7,8 @@
#include "builtin/assert.h"
#include "chipset.h"
-#include "clock.h"
#include "clock-f.h"
+#include "clock.h"
#include "common.h"
#include "console.h"
#include "cpu.h"
diff --git a/chip/stm32/clock-stm32f0.c b/chip/stm32/clock-stm32f0.c
index 3b56382fdb..18c089b036 100644
--- a/chip/stm32/clock-stm32f0.c
+++ b/chip/stm32/clock-stm32f0.c
@@ -6,8 +6,8 @@
/* Clocks and power management settings */
#include "chipset.h"
-#include "clock.h"
#include "clock-f.h"
+#include "clock.h"
#include "common.h"
#include "console.h"
#include "cpu.h"
diff --git a/chip/stm32/clock-stm32f3.c b/chip/stm32/clock-stm32f3.c
index 7d2b3de7f2..5b17fe56eb 100644
--- a/chip/stm32/clock-stm32f3.c
+++ b/chip/stm32/clock-stm32f3.c
@@ -6,8 +6,8 @@
/* Clocks and power management settings */
#include "chipset.h"
-#include "clock.h"
#include "clock-f.h"
+#include "clock.h"
#include "common.h"
#include "console.h"
#include "cpu.h"
diff --git a/chip/stm32/clock-stm32f4.c b/chip/stm32/clock-stm32f4.c
index 479faac7da..15cf8a45e2 100644
--- a/chip/stm32/clock-stm32f4.c
+++ b/chip/stm32/clock-stm32f4.c
@@ -7,8 +7,8 @@
#include "builtin/assert.h"
#include "chipset.h"
-#include "clock.h"
#include "clock-f.h"
+#include "clock.h"
#include "common.h"
#include "console.h"
#include "cpu.h"
diff --git a/chip/stm32/clock-stm32g4.c b/chip/stm32/clock-stm32g4.c
index dbb8fd88cb..962fdc37f2 100644
--- a/chip/stm32/clock-stm32g4.c
+++ b/chip/stm32/clock-stm32g4.c
@@ -7,8 +7,8 @@
#include "builtin/assert.h"
#include "chipset.h"
-#include "clock.h"
#include "clock-f.h"
+#include "clock.h"
#include "common.h"
#include "console.h"
#include "cpu.h"
diff --git a/chip/stm32/clock-stm32h7.c b/chip/stm32/clock-stm32h7.c
index 67e17f4174..3e6ba679cb 100644
--- a/chip/stm32/clock-stm32h7.c
+++ b/chip/stm32/clock-stm32h7.c
@@ -13,8 +13,6 @@
* but at least yields predictable behavior.
*/
-#include <stdbool.h>
-
#include "builtin/assert.h"
#include "chipset.h"
#include "clock.h"
@@ -29,6 +27,8 @@
#include "uart.h"
#include "util.h"
+#include <stdbool.h>
+
/* Check chip family and variant for compatibility */
#ifndef CHIP_FAMILY_STM32H7
#error Source clock-stm32h7.c does not support this chip family.
diff --git a/chip/stm32/clock-stm32l4.c b/chip/stm32/clock-stm32l4.c
index 77e807c1ad..412771163c 100644
--- a/chip/stm32/clock-stm32l4.c
+++ b/chip/stm32/clock-stm32l4.c
@@ -7,8 +7,8 @@
#include "builtin/assert.h"
#include "chipset.h"
-#include "clock.h"
#include "clock-l4.h"
+#include "clock.h"
#include "common.h"
#include "console.h"
#include "cpu.h"
diff --git a/chip/stm32/flash-f.c b/chip/stm32/flash-f.c
index 9bfdb1b6b7..2673201472 100644
--- a/chip/stm32/flash-f.c
+++ b/chip/stm32/flash-f.c
@@ -5,22 +5,23 @@
/* Common flash memory module for STM32F and STM32F0 */
-#include <stdbool.h>
#include "battery.h"
#include "builtin/assert.h"
-#include "console.h"
#include "clock.h"
-#include "flash.h"
+#include "console.h"
#include "flash-f.h"
+#include "flash.h"
#include "hooks.h"
-#include "registers.h"
#include "panic.h"
+#include "registers.h"
#include "system.h"
#include "task.h"
#include "timer.h"
#include "util.h"
#include "watchdog.h"
+#include <stdbool.h>
+
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
diff --git a/chip/stm32/flash-stm32f3.c b/chip/stm32/flash-stm32f3.c
index 8705e4d657..c41f9c526d 100644
--- a/chip/stm32/flash-stm32f3.c
+++ b/chip/stm32/flash-stm32f3.c
@@ -5,15 +5,16 @@
/* Flash memory module for stm32f3 and stm32f4 */
-#include <stdbool.h>
#include "common.h"
-#include "flash.h"
#include "flash-f.h"
#include "flash-regs.h"
+#include "flash.h"
#include "hooks.h"
+#include "panic.h"
#include "registers.h"
#include "system.h"
-#include "panic.h"
+
+#include <stdbool.h>
/*****************************************************************************/
/* Physical layer APIs */
diff --git a/chip/stm32/flash-stm32f4.c b/chip/stm32/flash-stm32f4.c
index 8705e4d657..c41f9c526d 100644
--- a/chip/stm32/flash-stm32f4.c
+++ b/chip/stm32/flash-stm32f4.c
@@ -5,15 +5,16 @@
/* Flash memory module for stm32f3 and stm32f4 */
-#include <stdbool.h>
#include "common.h"
-#include "flash.h"
#include "flash-f.h"
#include "flash-regs.h"
+#include "flash.h"
#include "hooks.h"
+#include "panic.h"
#include "registers.h"
#include "system.h"
-#include "panic.h"
+
+#include <stdbool.h>
/*****************************************************************************/
/* Physical layer APIs */
diff --git a/chip/stm32/flash-stm32g4-l4.c b/chip/stm32/flash-stm32g4-l4.c
index 31dba5c887..ad08047c23 100644
--- a/chip/stm32/flash-stm32g4-l4.c
+++ b/chip/stm32/flash-stm32g4-l4.c
@@ -4,12 +4,12 @@
*/
/* Flash memory module for STM32L4 family */
-#include "common.h"
#include "clock.h"
+#include "common.h"
#include "flash.h"
#include "hooks.h"
-#include "registers.h"
#include "panic.h"
+#include "registers.h"
#include "system.h"
#include "task.h"
#include "timer.h"
diff --git a/chip/stm32/flash-stm32h7.c b/chip/stm32/flash-stm32h7.c
index 445b354e57..2b9b594938 100644
--- a/chip/stm32/flash-stm32h7.c
+++ b/chip/stm32/flash-stm32h7.c
@@ -4,14 +4,14 @@
*/
/* Flash memory module for STM32H7 family */
-#include "common.h"
#include "clock.h"
+#include "common.h"
#include "cpu.h"
-#include "flash.h"
#include "flash-regs.h"
+#include "flash.h"
#include "hooks.h"
-#include "registers.h"
#include "panic.h"
+#include "registers.h"
#include "system.h"
#include "task.h"
#include "timer.h"
diff --git a/chip/stm32/hwtimer32.c b/chip/stm32/hwtimer32.c
index 0448d34e4b..ebe46d8316 100644
--- a/chip/stm32/hwtimer32.c
+++ b/chip/stm32/hwtimer32.c
@@ -6,8 +6,8 @@
/* Hardware 32-bit timer driver */
#include "builtin/assert.h"
-#include "clock.h"
#include "clock-f.h"
+#include "clock.h"
#include "common.h"
#include "hooks.h"
#include "hwtimer.h"
diff --git a/chip/stm32/i2c-stm32l4.c b/chip/stm32/i2c-stm32l4.c
index eeb87ec4e0..bb24a8a50f 100644
--- a/chip/stm32/i2c-stm32l4.c
+++ b/chip/stm32/i2c-stm32l4.c
@@ -4,7 +4,6 @@
*/
#include "builtin/assert.h"
-#include "printf.h"
#include "chipset.h"
#include "clock.h"
#include "common.h"
@@ -13,8 +12,8 @@
#include "hooks.h"
#include "hwtimer.h"
#include "i2c.h"
+#include "printf.h"
#include "registers.h"
-
#include "system.h"
#include "task.h"
#include "timer.h"
diff --git a/chip/stm32/i2c_ite_flash_support.c b/chip/stm32/i2c_ite_flash_support.c
index 8482065086..335064572b 100644
--- a/chip/stm32/i2c_ite_flash_support.c
+++ b/chip/stm32/i2c_ite_flash_support.c
@@ -4,8 +4,8 @@
*/
/* STM implementation for flashing ITE-based ECs over i2c */
-#include "i2c_ite_flash_support.h"
#include "i2c.h"
+#include "i2c_ite_flash_support.h"
#include "registers.h"
#include "time.h"
diff --git a/chip/stm32/pwm.c b/chip/stm32/pwm.c
index 0f2e50c999..a9f266cbe0 100644
--- a/chip/stm32/pwm.c
+++ b/chip/stm32/pwm.c
@@ -6,8 +6,8 @@
/* PWM control module for STM32 */
#include "builtin/assert.h"
-#include "clock.h"
#include "clock-f.h"
+#include "clock.h"
#include "gpio.h"
#include "hooks.h"
#include "hwtimer.h"
diff --git a/chip/stm32/uart.c b/chip/stm32/uart.c
index 1bb961a935..916cb2257a 100644
--- a/chip/stm32/uart.c
+++ b/chip/stm32/uart.c
@@ -5,17 +5,17 @@
/* USART driver for Chrome EC */
-#include "common.h"
#include "clock.h"
+#include "common.h"
#include "dma.h"
#include "gpio.h"
#include "hooks.h"
#include "registers.h"
+#include "stm32-dma.h"
#include "system.h"
#include "task.h"
#include "uart.h"
#include "util.h"
-#include "stm32-dma.h"
/* Console USART index */
#define UARTN CONFIG_UART_CONSOLE
diff --git a/chip/stm32/ucpd-stm32gx.c b/chip/stm32/ucpd-stm32gx.c
index 3fec860200..424792c5d0 100644
--- a/chip/stm32/ucpd-stm32gx.c
+++ b/chip/stm32/ucpd-stm32gx.c
@@ -6,8 +6,8 @@
/* STM32GX UCPD module for Chrome EC */
#include "clock.h"
-#include "console.h"
#include "common.h"
+#include "console.h"
#include "driver/tcpm/tcpm.h"
#include "gpio.h"
#include "hooks.h"
diff --git a/chip/stm32/usart-stm32f0.c b/chip/stm32/usart-stm32f0.c
index 56325cdc74..debb062473 100644
--- a/chip/stm32/usart-stm32f0.c
+++ b/chip/stm32/usart-stm32f0.c
@@ -2,14 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "usart-stm32f0.h"
-
#include "clock.h"
#include "common.h"
#include "compile_time_macros.h"
#include "hooks.h"
#include "registers.h"
#include "task.h"
+#include "usart-stm32f0.h"
#include "util.h"
/*
diff --git a/chip/stm32/usart-stm32f3.c b/chip/stm32/usart-stm32f3.c
index f5a138643c..b46ac2ed8f 100644
--- a/chip/stm32/usart-stm32f3.c
+++ b/chip/stm32/usart-stm32f3.c
@@ -2,13 +2,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "usart-stm32f3.h"
-
#include "common.h"
#include "compile_time_macros.h"
#include "hooks.h"
#include "registers.h"
#include "task.h"
+#include "usart-stm32f3.h"
#include "util.h"
/*
diff --git a/chip/stm32/usart-stm32f4.c b/chip/stm32/usart-stm32f4.c
index a710760e3a..0806cab062 100644
--- a/chip/stm32/usart-stm32f4.c
+++ b/chip/stm32/usart-stm32f4.c
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
-#include "usart-stm32f4.h"
-
#include "clock.h"
#include "common.h"
#include "compile_time_macros.h"
#include "hooks.h"
#include "registers.h"
#include "task.h"
+#include "usart-stm32f4.h"
#include "util.h"
/*
diff --git a/chip/stm32/usart-stm32l.c b/chip/stm32/usart-stm32l.c
index dc300d598a..b6c9e21595 100644
--- a/chip/stm32/usart-stm32l.c
+++ b/chip/stm32/usart-stm32l.c
@@ -2,14 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "usart-stm32l.h"
-
#include "clock.h"
#include "common.h"
#include "compile_time_macros.h"
#include "hooks.h"
#include "registers.h"
#include "task.h"
+#include "usart-stm32l.h"
#include "util.h"
/*
diff --git a/chip/stm32/usart-stm32l5.c b/chip/stm32/usart-stm32l5.c
index 30e0f009ff..5f34c37bc4 100644
--- a/chip/stm32/usart-stm32l5.c
+++ b/chip/stm32/usart-stm32l5.c
@@ -2,14 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "usart-stm32l.h"
-
#include "clock.h"
#include "common.h"
#include "compile_time_macros.h"
#include "hooks.h"
#include "registers.h"
#include "task.h"
+#include "usart-stm32l.h"
#include "util.h"
/*
diff --git a/chip/stm32/usart_host_command.c b/chip/stm32/usart_host_command.c
index 437975e609..817343df98 100644
--- a/chip/stm32/usart_host_command.c
+++ b/chip/stm32/usart_host_command.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "common.h"
#include "clock.h"
+#include "common.h"
#include "dma.h"
#include "gpio.h"
#include "hooks.h"
@@ -13,9 +13,9 @@
#include "registers.h"
#include "system.h"
#include "task.h"
-#include "usart_rx_dma.h"
-#include "usart_host_command.h"
#include "usart-stm32f4.h"
+#include "usart_host_command.h"
+#include "usart_rx_dma.h"
#include "util.h"
/* Console output macros */
diff --git a/chip/stm32/usart_host_command.h b/chip/stm32/usart_host_command.h
index ee4bdd88dc..ddbd5c5c99 100644
--- a/chip/stm32/usart_host_command.h
+++ b/chip/stm32/usart_host_command.h
@@ -6,12 +6,13 @@
#ifndef __CROS_EC_USART_HOST_COMMAND_H
#define __CROS_EC_USART_HOST_COMMAND_H
-#include <stdarg.h> /* For va_list */
#include "common.h"
#include "gpio.h"
#include "host_command.h"
#include "usart.h"
+#include <stdarg.h> /* For va_list */
+
/*
* Add data to host command layer buffer.
*/
diff --git a/chip/stm32/usart_rx_dma.c b/chip/stm32/usart_rx_dma.c
index 21c8313c73..8997617ff3 100644
--- a/chip/stm32/usart_rx_dma.c
+++ b/chip/stm32/usart_rx_dma.c
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
-#include "usart_rx_dma.h"
-
#include "atomic.h"
#include "common.h"
#include "console.h"
#include "registers.h"
#include "system.h"
#include "usart_host_command.h"
+#include "usart_rx_dma.h"
#include "util.h"
typedef size_t (*add_data_t)(struct usart_config const *config,
diff --git a/chip/stm32/usart_rx_dma.h b/chip/stm32/usart_rx_dma.h
index 6d273d18b9..191ccc8c7f 100644
--- a/chip/stm32/usart_rx_dma.h
+++ b/chip/stm32/usart_rx_dma.h
@@ -7,8 +7,8 @@
#ifndef __CROS_EC_USART_RX_DMA_H
#define __CROS_EC_USART_RX_DMA_H
-#include "producer.h"
#include "dma.h"
+#include "producer.h"
#include "queue.h"
#include "usart.h"
diff --git a/chip/stm32/usart_rx_interrupt-stm32f0.c b/chip/stm32/usart_rx_interrupt-stm32f0.c
index dfbe6ec3ff..a142bcd436 100644
--- a/chip/stm32/usart_rx_interrupt-stm32f0.c
+++ b/chip/stm32/usart_rx_interrupt-stm32f0.c
@@ -5,12 +5,11 @@
/* Interrupt based USART RX driver for STM32F0 and STM32F3 */
-#include "usart.h"
-
#include "atomic.h"
#include "common.h"
#include "queue.h"
#include "registers.h"
+#include "usart.h"
static void usart_rx_init(struct usart_config const *config)
{
diff --git a/chip/stm32/usart_rx_interrupt-stm32f3.c b/chip/stm32/usart_rx_interrupt-stm32f3.c
index dfbe6ec3ff..a142bcd436 100644
--- a/chip/stm32/usart_rx_interrupt-stm32f3.c
+++ b/chip/stm32/usart_rx_interrupt-stm32f3.c
@@ -5,12 +5,11 @@
/* Interrupt based USART RX driver for STM32F0 and STM32F3 */
-#include "usart.h"
-
#include "atomic.h"
#include "common.h"
#include "queue.h"
#include "registers.h"
+#include "usart.h"
static void usart_rx_init(struct usart_config const *config)
{
diff --git a/chip/stm32/usart_rx_interrupt-stm32f4.c b/chip/stm32/usart_rx_interrupt-stm32f4.c
index 1d86c7d5b6..80ba37e88f 100644
--- a/chip/stm32/usart_rx_interrupt-stm32f4.c
+++ b/chip/stm32/usart_rx_interrupt-stm32f4.c
@@ -5,12 +5,11 @@
/* Interrupt based USART RX driver for STM32F0 and STM32F4 */
-#include "usart.h"
-
#include "atomic.h"
#include "common.h"
#include "queue.h"
#include "registers.h"
+#include "usart.h"
static void usart_rx_init(struct usart_config const *config)
{
diff --git a/chip/stm32/usart_rx_interrupt-stm32l.c b/chip/stm32/usart_rx_interrupt-stm32l.c
index 750809307b..2c74d7dbd1 100644
--- a/chip/stm32/usart_rx_interrupt-stm32l.c
+++ b/chip/stm32/usart_rx_interrupt-stm32l.c
@@ -5,12 +5,11 @@
/* Interrupt based USART RX driver for STM32L */
-#include "usart.h"
-
#include "atomic.h"
#include "common.h"
#include "queue.h"
#include "registers.h"
+#include "usart.h"
static void usart_rx_init(struct usart_config const *config)
{
diff --git a/chip/stm32/usart_rx_interrupt.c b/chip/stm32/usart_rx_interrupt.c
index dfbe6ec3ff..a142bcd436 100644
--- a/chip/stm32/usart_rx_interrupt.c
+++ b/chip/stm32/usart_rx_interrupt.c
@@ -5,12 +5,11 @@
/* Interrupt based USART RX driver for STM32F0 and STM32F3 */
-#include "usart.h"
-
#include "atomic.h"
#include "common.h"
#include "queue.h"
#include "registers.h"
+#include "usart.h"
static void usart_rx_init(struct usart_config const *config)
{
diff --git a/chip/stm32/usart_tx_dma.c b/chip/stm32/usart_tx_dma.c
index 8128231ff7..d6469aa9e6 100644
--- a/chip/stm32/usart_tx_dma.c
+++ b/chip/stm32/usart_tx_dma.c
@@ -2,13 +2,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "usart_tx_dma.h"
-
-#include "usart.h"
#include "common.h"
#include "registers.h"
#include "system.h"
#include "task.h"
+#include "usart.h"
+#include "usart_tx_dma.h"
#include "util.h"
void usart_tx_dma_written(struct consumer const *consumer, size_t count)
diff --git a/chip/stm32/usart_tx_interrupt.c b/chip/stm32/usart_tx_interrupt.c
index 80d1d4df0f..7c99840e26 100644
--- a/chip/stm32/usart_tx_interrupt.c
+++ b/chip/stm32/usart_tx_interrupt.c
@@ -5,12 +5,11 @@
/* Interrupt based USART TX driver for STM32 */
-#include "usart.h"
-
#include "common.h"
#include "registers.h"
#include "system.h"
#include "task.h"
+#include "usart.h"
#include "usart_host_command.h"
#include "util.h"
diff --git a/chip/stm32/usb-stm32f3.c b/chip/stm32/usb-stm32f3.c
index eb48129e09..bef15db566 100644
--- a/chip/stm32/usb-stm32f3.c
+++ b/chip/stm32/usb-stm32f3.c
@@ -5,9 +5,8 @@
* STM32F3 Family specific USB functionality
*/
-#include "usb-stm32f3.h"
-
#include "system.h"
+#include "usb-stm32f3.h"
#include "usb_api.h"
void usb_connect(void)
diff --git a/chip/stm32/usb-stream.c b/chip/stm32/usb-stream.c
index 76f7fbd340..f9cd2687bf 100644
--- a/chip/stm32/usb-stream.c
+++ b/chip/stm32/usb-stream.c
@@ -11,10 +11,10 @@
#include "registers.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usart.h"
-#include "usb_hw.h"
#include "usb-stream.h"
+#include "usb_hw.h"
+#include "util.h"
static size_t rx_read(struct usb_stream_config const *config)
{
diff --git a/chip/stm32/usb.c b/chip/stm32/usb.c
index 1c621a32b3..dba9ebaba1 100644
--- a/chip/stm32/usb.c
+++ b/chip/stm32/usb.c
@@ -15,10 +15,10 @@
#include "system.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usb_api.h"
#include "usb_descriptor.h"
#include "usb_hw.h"
+#include "util.h"
/* Console output macro */
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
diff --git a/chip/stm32/usb_console.c b/chip/stm32/usb_console.c
index fdadc243c1..062ce2f484 100644
--- a/chip/stm32/usb_console.c
+++ b/chip/stm32/usb_console.c
@@ -12,10 +12,10 @@
#include "registers.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usb_api.h"
#include "usb_descriptor.h"
#include "usb_hw.h"
+#include "util.h"
/* Console output macro */
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
diff --git a/chip/stm32/usb_dwc.c b/chip/stm32/usb_dwc.c
index 67f89a5222..15ce4bff7f 100644
--- a/chip/stm32/usb_dwc.c
+++ b/chip/stm32/usb_dwc.c
@@ -13,12 +13,12 @@
#include "hooks.h"
#include "link_defs.h"
#include "registers.h"
-#include "usb_hw.h"
#include "system.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usb_descriptor.h"
+#include "usb_hw.h"
+#include "util.h"
#include "watchdog.h"
/****************************************************************************/
diff --git a/chip/stm32/usb_dwc_console.c b/chip/stm32/usb_dwc_console.c
index fd66db7380..ff3c0817b6 100644
--- a/chip/stm32/usb_dwc_console.c
+++ b/chip/stm32/usb_dwc_console.c
@@ -12,9 +12,9 @@
#include "registers.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usb_descriptor.h"
#include "usb_hw.h"
+#include "util.h"
/* Console output macro */
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
diff --git a/chip/stm32/usb_dwc_stream.c b/chip/stm32/usb_dwc_stream.c
index 670c93b437..78e0a4b484 100644
--- a/chip/stm32/usb_dwc_stream.c
+++ b/chip/stm32/usb_dwc_stream.c
@@ -3,12 +3,11 @@
* found in the LICENSE file.
*/
+#include "console.h"
#include "registers.h"
#include "timer.h"
#include "usb_dwc_stream.h"
#include "util.h"
-
-#include "console.h"
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
/*
diff --git a/chip/stm32/usb_dwc_stream.h b/chip/stm32/usb_dwc_stream.h
index 7e5e938053..bd512f5e9a 100644
--- a/chip/stm32/usb_dwc_stream.h
+++ b/chip/stm32/usb_dwc_stream.h
@@ -10,9 +10,9 @@
#include "compile_time_macros.h"
#include "consumer.h"
#include "hooks.h"
-#include "registers.h"
#include "producer.h"
#include "queue.h"
+#include "registers.h"
#include "usb_descriptor.h"
#include "usb_hw.h"
diff --git a/chip/stm32/usb_endpoints.c b/chip/stm32/usb_endpoints.c
index cf8cb17869..57ebc86eb2 100644
--- a/chip/stm32/usb_endpoints.c
+++ b/chip/stm32/usb_endpoints.c
@@ -5,13 +5,14 @@
* USB endpoints/interfaces callbacks declaration
*/
-#include <stdint.h>
-#include <stddef.h>
+#include "common.h"
#include "compiler.h"
#include "config.h"
-#include "common.h"
#include "usb_hw.h"
+#include <stddef.h>
+#include <stdint.h>
+
typedef void (*xfer_func)(void);
typedef void (*evt_func)(enum usb_ep_event evt);
diff --git a/chip/stm32/usb_hid.c b/chip/stm32/usb_hid.c
index e9426b690d..321248c702 100644
--- a/chip/stm32/usb_hid.c
+++ b/chip/stm32/usb_hid.c
@@ -13,11 +13,11 @@
#include "registers.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usb_descriptor.h"
-#include "usb_hw.h"
#include "usb_hid.h"
#include "usb_hid_hw.h"
+#include "usb_hw.h"
+#include "util.h"
/* Console output macro */
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
diff --git a/chip/stm32/usb_hid_keyboard.c b/chip/stm32/usb_hid_keyboard.c
index 7f3caac960..7b40f31309 100644
--- a/chip/stm32/usb_hid_keyboard.c
+++ b/chip/stm32/usb_hid_keyboard.c
@@ -20,12 +20,12 @@
#include "tablet_mode.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usb_api.h"
#include "usb_descriptor.h"
-#include "usb_hw.h"
#include "usb_hid.h"
#include "usb_hid_hw.h"
+#include "usb_hw.h"
+#include "util.h"
/* Console output macro */
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
diff --git a/chip/stm32/usb_hid_touchpad.c b/chip/stm32/usb_hid_touchpad.c
index 15dd38756f..8eb5ee95dc 100644
--- a/chip/stm32/usb_hid_touchpad.c
+++ b/chip/stm32/usb_hid_touchpad.c
@@ -15,13 +15,13 @@
#include "registers.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usb_api.h"
#include "usb_descriptor.h"
-#include "usb_hw.h"
#include "usb_hid.h"
#include "usb_hid_hw.h"
#include "usb_hid_touchpad.h"
+#include "usb_hw.h"
+#include "util.h"
/* Console output macro */
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
diff --git a/chip/stm32/usb_isochronous.c b/chip/stm32/usb_isochronous.c
index ad20b6d1ca..d2225991c0 100644
--- a/chip/stm32/usb_isochronous.c
+++ b/chip/stm32/usb_isochronous.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "stddef.h"
#include "common.h"
#include "config.h"
#include "link_defs.h"
#include "registers.h"
-#include "util.h"
+#include "stddef.h"
#include "usb_api.h"
#include "usb_hw.h"
#include "usb_isochronous.h"
+#include "util.h"
/* Console output macro */
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c
index 9536301863..2d090293f9 100644
--- a/chip/stm32/usb_pd_phy.c
+++ b/chip/stm32/usb_pd_phy.c
@@ -11,15 +11,15 @@
#include "crc.h"
#include "dma.h"
#include "gpio.h"
-#include "hwtimer.h"
#include "hooks.h"
+#include "hwtimer.h"
#include "registers.h"
#include "system.h"
#include "task.h"
#include "timer.h"
-#include "util.h"
#include "usb_pd.h"
#include "usb_pd_config.h"
+#include "util.h"
#ifdef CONFIG_COMMON_RUNTIME
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)