rk3288: Change all SoC headers to <soc/headername.h> system
This patch is the start of a series to change all non-x86 SoC-specific
headers to be included as <soc/header.h> instead of the old
<soc/vendor/chip/header.h> or "header.h". It will add an include/soc/
directory under every src/soc/vendor/chip/ and append the .../include/
part of that to the global include path.
This matches the usage of <arch/header.h> for architecture-specific
headers and had already been done for some headers on Tegra. It has the
advantage that a source file which does not know the specific SoC used
(e.g. Tegra files common for multiple chips, or a global include file)
can still include SoC-specific headers and access macros/types defined
there. It also makes the includes for mainboard files more readable, and
reduces the chance to pull in a wrong header when copying mainboard
sources to use a different-related SoC (e.g. using a Tegra124 mainboard
as template for a Tegra132 one).
For easier maintainability, every SoC family is modified individually.
This patch starts out by changing Rk3288. Also alphabetized headers in
affected files since we touch them anyway.
BUG=None
TEST=Whole series: compared binary images for Daisy, Nyan_Blaze,
Rush_Ryu, Storm, Urara and Veyron_Pinky. Confirmed that they are
byte-for-byte identical except for timestamps, hashes, and __LINE__
macro replacements. Compile-tested individual patches.
Change-Id: I4d74a0c56be278e591a9cf43f93e9900e41f4319
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 4ad8b6d2e0280428aa9742f0f7b723c00857334a
Original-Change-Id: I415b8dbe735e572d4ae2cb1df62d66bcce386fff
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/222025
Reviewed-on: http://review.coreboot.org/9349
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/src/soc/rockchip/rk3288/Makefile.inc b/src/soc/rockchip/rk3288/Makefile.inc
index 076f0dc..9885aaf 100644
--- a/src/soc/rockchip/rk3288/Makefile.inc
+++ b/src/soc/rockchip/rk3288/Makefile.inc
@@ -68,6 +68,8 @@
ramstage-y += pwm.c
ramstage-$(CONFIG_DRIVERS_UART) += uart.c
+CPPFLAGS_common += -Isrc/soc/rockchip/rk3288/include/
+
$(objcbfs)/bootblock.raw.elf: $(objcbfs)/bootblock.elf
cp $< $@
diff --git a/src/soc/rockchip/rk3288/bootblock.c b/src/soc/rockchip/rk3288/bootblock.c
index b2f5bd9..26a6569 100644
--- a/src/soc/rockchip/rk3288/bootblock.c
+++ b/src/soc/rockchip/rk3288/bootblock.c
@@ -21,11 +21,11 @@
#include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h>
-#include <soc/rockchip/rk3288/grf.h>
+#include <soc/addressmap.h>
+#include <soc/clock.h>
+#include <soc/grf.h>
+#include <soc/timer.h>
#include <symbols.h>
-#include "addressmap.h"
-#include "timer.h"
-#include "clock.h"
static void bootblock_cpu_init(void)
{
diff --git a/src/soc/rockchip/rk3288/cbmem.c b/src/soc/rockchip/rk3288/cbmem.c
index dc1e0aa..1c3a902 100644
--- a/src/soc/rockchip/rk3288/cbmem.c
+++ b/src/soc/rockchip/rk3288/cbmem.c
@@ -17,9 +17,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <stddef.h>
#include <cbmem.h>
-#include "soc.h"
+#include <soc/soc.h>
+#include <stddef.h>
+
void *cbmem_top(void)
{
return (void *)(get_fb_base_kb()*KiB);
diff --git a/src/soc/rockchip/rk3288/clock.c b/src/soc/rockchip/rk3288/clock.c
index 5ad431c..d95257f 100644
--- a/src/soc/rockchip/rk3288/clock.c
+++ b/src/soc/rockchip/rk3288/clock.c
@@ -17,17 +17,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <assert.h>
-#include <stdlib.h>
#include <arch/io.h>
-#include <stdint.h>
-#include <string.h>
+#include <assert.h>
#include <console/console.h>
#include <delay.h>
-#include "clock.h"
-#include "grf.h"
-#include "addressmap.h"
-#include "soc.h"
+#include <soc/addressmap.h>
+#include <soc/clock.h>
+#include <soc/grf.h>
+#include <soc/soc.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
struct pll_div {
u32 nr;
diff --git a/src/soc/rockchip/rk3288/gpio.c b/src/soc/rockchip/rk3288/gpio.c
index 2d1ae15..c3784ec 100644
--- a/src/soc/rockchip/rk3288/gpio.c
+++ b/src/soc/rockchip/rk3288/gpio.c
@@ -17,12 +17,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <console/console.h>
#include <arch/io.h>
+#include <console/console.h>
+#include <soc/soc.h>
+#include <soc/gpio.h>
+#include <soc/grf.h>
+#include <soc/pmu.h>
#include <stdlib.h>
-#include "soc.h"
-#include "gpio.h"
-#include "pmu.h"
struct rk3288_gpio_regs *gpio_port[] = {
(struct rk3288_gpio_regs *)0xff750000,
diff --git a/src/soc/rockchip/rk3288/i2c.c b/src/soc/rockchip/rk3288/i2c.c
index eb480a7..d69bb7c 100644
--- a/src/soc/rockchip/rk3288/i2c.c
+++ b/src/soc/rockchip/rk3288/i2c.c
@@ -17,21 +17,19 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <console/console.h>
#include <arch/io.h>
-#include <stdlib.h>
#include <assert.h>
-
-#include <delay.h>
#include <cbfs.h>
-#include <string.h>
+#include <console/console.h>
+#include <delay.h>
#include <device/i2c.h>
-
-#include "addressmap.h"
-#include "grf.h"
-#include "soc.h"
-#include "i2c.h"
-#include "clock.h"
+#include <soc/addressmap.h>
+#include <soc/grf.h>
+#include <soc/soc.h>
+#include <soc/i2c.h>
+#include <soc/clock.h>
+#include <stdlib.h>
+#include <string.h>
#define RETRY_COUNT 3
/* 100000us = 100ms */
diff --git a/src/soc/rockchip/rk3288/addressmap.h b/src/soc/rockchip/rk3288/include/soc/addressmap.h
similarity index 100%
rename from src/soc/rockchip/rk3288/addressmap.h
rename to src/soc/rockchip/rk3288/include/soc/addressmap.h
diff --git a/src/soc/rockchip/rk3288/clock.h b/src/soc/rockchip/rk3288/include/soc/clock.h
similarity index 97%
rename from src/soc/rockchip/rk3288/clock.h
rename to src/soc/rockchip/rk3288/include/soc/clock.h
index e2e8f3f..d11c6ec 100644
--- a/src/soc/rockchip/rk3288/clock.h
+++ b/src/soc/rockchip/rk3288/include/soc/clock.h
@@ -20,7 +20,7 @@
#ifndef __SOC_ROCKCHIP_RK3288_CLOCK_H__
#define __SOC_ROCKCHIP_RK3288_CLOCK_H__
-#include "addressmap.h"
+#include <soc/addressmap.h>
#define OSC_HZ (24*MHz)
diff --git a/src/soc/rockchip/rk3288/gpio.h b/src/soc/rockchip/rk3288/include/soc/gpio.h
similarity index 97%
rename from src/soc/rockchip/rk3288/gpio.h
rename to src/soc/rockchip/rk3288/include/soc/gpio.h
index 7049ddf..c459de9 100644
--- a/src/soc/rockchip/rk3288/gpio.h
+++ b/src/soc/rockchip/rk3288/include/soc/gpio.h
@@ -20,8 +20,7 @@
#ifndef __SOC_ROCKCHIP_RK3288_GPIO_H__
#define __SOC_ROCKCHIP_RK3288_GPIO_H__
-#include "addressmap.h"
-#include "grf.h"
+#include <types.h>
#define GPIO(p, b, i) ((gpio_t){.port = p, .bank = GPIO_##b, .idx = i})
diff --git a/src/soc/rockchip/rk3288/grf.h b/src/soc/rockchip/rk3288/include/soc/grf.h
similarity index 98%
rename from src/soc/rockchip/rk3288/grf.h
rename to src/soc/rockchip/rk3288/include/soc/grf.h
index e84359b..8325638 100644
--- a/src/soc/rockchip/rk3288/grf.h
+++ b/src/soc/rockchip/rk3288/include/soc/grf.h
@@ -20,9 +20,9 @@
#ifndef __SOC_ROCKCHIP_RK3288_GRF_H__
#define __SOC_ROCKCHIP_RK3288_GRF_H__
+#include <soc/addressmap.h>
+#include <soc/soc.h>
#include <types.h>
-#include "addressmap.h"
-#include "soc.h"
struct rk3288_grf_gpio_lh {
u32 l;
diff --git a/src/soc/rockchip/rk3288/i2c.h b/src/soc/rockchip/rk3288/include/soc/i2c.h
similarity index 100%
rename from src/soc/rockchip/rk3288/i2c.h
rename to src/soc/rockchip/rk3288/include/soc/i2c.h
diff --git a/src/soc/rockchip/rk3288/memlayout.ld b/src/soc/rockchip/rk3288/include/soc/memlayout.ld
similarity index 100%
rename from src/soc/rockchip/rk3288/memlayout.ld
rename to src/soc/rockchip/rk3288/include/soc/memlayout.ld
diff --git a/src/soc/rockchip/rk3288/pmu.h b/src/soc/rockchip/rk3288/include/soc/pmu.h
similarity index 98%
rename from src/soc/rockchip/rk3288/pmu.h
rename to src/soc/rockchip/rk3288/include/soc/pmu.h
index 23ca8b1..2a93515 100644
--- a/src/soc/rockchip/rk3288/pmu.h
+++ b/src/soc/rockchip/rk3288/include/soc/pmu.h
@@ -19,7 +19,8 @@
#ifndef __SOC_ROCKCHIP_RK3288_PMU_H__
#define __SOC_ROCKCHIP_RK3288_PMU_H__
-#include "addressmap.h"
+
+#include <soc/addressmap.h>
struct rk3288_pmu_regs {
u32 wakeup_cfg[2];
diff --git a/src/soc/rockchip/rk3288/pwm.h b/src/soc/rockchip/rk3288/include/soc/pwm.h
similarity index 100%
rename from src/soc/rockchip/rk3288/pwm.h
rename to src/soc/rockchip/rk3288/include/soc/pwm.h
diff --git a/src/soc/rockchip/rk3288/rk808.h b/src/soc/rockchip/rk3288/include/soc/rk808.h
similarity index 100%
rename from src/soc/rockchip/rk3288/rk808.h
rename to src/soc/rockchip/rk3288/include/soc/rk808.h
diff --git a/src/soc/rockchip/rk3288/sdram.h b/src/soc/rockchip/rk3288/include/soc/sdram.h
similarity index 98%
rename from src/soc/rockchip/rk3288/sdram.h
rename to src/soc/rockchip/rk3288/include/soc/sdram.h
index 1da14b7..16e4f81 100644
--- a/src/soc/rockchip/rk3288/sdram.h
+++ b/src/soc/rockchip/rk3288/include/soc/sdram.h
@@ -20,8 +20,6 @@
#ifndef __SOC_ROCKCHIP_RK3288_SDRAM_H__
#define __SOC_ROCKCHIP_RK3288_SDRAM_H__
-#include <arch/io.h>
-
enum {
DDR3 = 3,
LPDDR3 = 6,
diff --git a/src/soc/rockchip/rk3288/soc.h b/src/soc/rockchip/rk3288/include/soc/soc.h
similarity index 100%
rename from src/soc/rockchip/rk3288/soc.h
rename to src/soc/rockchip/rk3288/include/soc/soc.h
diff --git a/src/soc/rockchip/rk3288/spi.h b/src/soc/rockchip/rk3288/include/soc/spi.h
similarity index 100%
rename from src/soc/rockchip/rk3288/spi.h
rename to src/soc/rockchip/rk3288/include/soc/spi.h
diff --git a/src/soc/rockchip/rk3288/timer.h b/src/soc/rockchip/rk3288/include/soc/timer.h
similarity index 95%
rename from src/soc/rockchip/rk3288/timer.h
rename to src/soc/rockchip/rk3288/include/soc/timer.h
index 8507939..2301686 100644
--- a/src/soc/rockchip/rk3288/timer.h
+++ b/src/soc/rockchip/rk3288/include/soc/timer.h
@@ -21,9 +21,9 @@
#define __SOC_ROCKCHIP_RK3288_TIMER_H__
#include <inttypes.h>
+#include <soc/addressmap.h>
+#include <soc/clock.h>
#include <timer.h>
-#include "addressmap.h"
-#include "clock.h"
static const u32 clocks_per_usec = OSC_HZ/USECS_PER_SEC;
diff --git a/src/soc/rockchip/rk3288/tsadc.h b/src/soc/rockchip/rk3288/include/soc/tsadc.h
similarity index 100%
rename from src/soc/rockchip/rk3288/tsadc.h
rename to src/soc/rockchip/rk3288/include/soc/tsadc.h
diff --git a/src/soc/rockchip/rk3288/media.c b/src/soc/rockchip/rk3288/media.c
index f2471f9..7f0ea51 100644
--- a/src/soc/rockchip/rk3288/media.c
+++ b/src/soc/rockchip/rk3288/media.c
@@ -18,10 +18,9 @@
*/
#include <cbfs.h>
+#include <soc/spi.h>
#include <symbols.h>
-#include "spi.h"
-
int init_default_cbfs_media(struct cbfs_media *media)
{
return initialize_rockchip_spi_cbfs_media(media,
diff --git a/src/soc/rockchip/rk3288/monotonic_timer.c b/src/soc/rockchip/rk3288/monotonic_timer.c
index d33ed68..4062860 100644
--- a/src/soc/rockchip/rk3288/monotonic_timer.c
+++ b/src/soc/rockchip/rk3288/monotonic_timer.c
@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <arch/io.h>
+#include <soc/addressmap.h>
+#include <soc/timer.h>
#include <stdint.h>
#include <timer.h>
-#include <arch/io.h>
-#include "addressmap.h"
-#include "timer.h"
static uint64_t timer_raw_value(void)
{
diff --git a/src/soc/rockchip/rk3288/pwm.c b/src/soc/rockchip/rk3288/pwm.c
index 7f659f2..a447249 100644
--- a/src/soc/rockchip/rk3288/pwm.c
+++ b/src/soc/rockchip/rk3288/pwm.c
@@ -17,18 +17,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <console/console.h>
#include <arch/io.h>
-#include <stdlib.h>
#include <assert.h>
-#include <timer.h>
+#include <console/console.h>
#include <delay.h>
-
-#include "addressmap.h"
-#include "grf.h"
-#include "soc.h"
-#include "pwm.h"
-#include "clock.h"
+#include <soc/addressmap.h>
+#include <soc/grf.h>
+#include <soc/soc.h>
+#include <soc/pwm.h>
+#include <soc/clock.h>
+#include <stdlib.h>
+#include <timer.h>
struct pwm_ctl {
u32 pwm_cnt;
diff --git a/src/soc/rockchip/rk3288/rk808.c b/src/soc/rockchip/rk3288/rk808.c
index 48cfa86..aa39b8d 100644
--- a/src/soc/rockchip/rk3288/rk808.c
+++ b/src/soc/rockchip/rk3288/rk808.c
@@ -19,11 +19,11 @@
#include <assert.h>
#include <console/console.h>
+#include <delay.h>
#include <device/i2c.h>
+#include <soc/rk808.h>
#include <stdint.h>
#include <stdlib.h>
-#include <delay.h>
-#include "rk808.h"
#define RK808_ADDR 0x1b
diff --git a/src/soc/rockchip/rk3288/sdram.c b/src/soc/rockchip/rk3288/sdram.c
index 2b0a396..d49b860 100644
--- a/src/soc/rockchip/rk3288/sdram.c
+++ b/src/soc/rockchip/rk3288/sdram.c
@@ -17,16 +17,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <arch/io.h>
-#include <string.h>
-#include <types.h>
#include <console/console.h>
#include <delay.h>
-#include "addressmap.h"
-#include "clock.h"
-#include "sdram.h"
-#include "grf.h"
-#include "soc.h"
-#include "pmu.h"
+#include <soc/addressmap.h>
+#include <soc/clock.h>
+#include <soc/sdram.h>
+#include <soc/grf.h>
+#include <soc/soc.h>
+#include <soc/pmu.h>
+#include <string.h>
+#include <types.h>
struct rk3288_ddr_pctl_regs {
u32 scfg;
diff --git a/src/soc/rockchip/rk3288/soc.c b/src/soc/rockchip/rk3288/soc.c
index 0985c08..f5e52eb 100644
--- a/src/soc/rockchip/rk3288/soc.c
+++ b/src/soc/rockchip/rk3288/soc.c
@@ -17,16 +17,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <arch/cache.h>
+#include <cbmem.h>
+#include <console/console.h>
+#include <delay.h>
+#include <device/device.h>
+#include <soc/gpio.h>
+#include <soc/soc.h>
+#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include <stddef.h>
-#include <delay.h>
-#include <console/console.h>
-#include <device/device.h>
-#include <cbmem.h>
-#include <arch/cache.h>
-#include <soc/rockchip/rk3288/gpio.h>
-#include "soc.h"
+
#include "chip.h"
static void soc_enable(device_t dev)
diff --git a/src/soc/rockchip/rk3288/spi.c b/src/soc/rockchip/rk3288/spi.c
index 796107e..6ece8c1 100644
--- a/src/soc/rockchip/rk3288/spi.c
+++ b/src/soc/rockchip/rk3288/spi.c
@@ -17,18 +17,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <console/console.h>
#include <arch/io.h>
-#include <stdlib.h>
#include <assert.h>
+#include <console/console.h>
+#include <delay.h>
+#include <endian.h>
+#include <soc/addressmap.h>
+#include <soc/spi.h>
+#include <soc/clock.h>
#include <spi-generic.h>
#include <spi_flash.h>
-#include <delay.h>
+#include <stdlib.h>
#include <timer.h>
-#include <endian.h>
-#include "addressmap.h"
-#include "spi.h"
-#include "clock.h"
struct rockchip_spi_slave {
struct spi_slave slave;
diff --git a/src/soc/rockchip/rk3288/timer.c b/src/soc/rockchip/rk3288/timer.c
index 91186cc..7162482 100644
--- a/src/soc/rockchip/rk3288/timer.c
+++ b/src/soc/rockchip/rk3288/timer.c
@@ -17,10 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <arch/io.h>
#include <console/console.h>
#include <delay.h>
-#include <arch/io.h>
-#include "timer.h"
+#include <soc/timer.h>
+#include <timer.h>
void init_timer(void)
{
diff --git a/src/soc/rockchip/rk3288/tsadc.c b/src/soc/rockchip/rk3288/tsadc.c
index 73980a0..b7d8e9d 100644
--- a/src/soc/rockchip/rk3288/tsadc.c
+++ b/src/soc/rockchip/rk3288/tsadc.c
@@ -17,16 +17,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <arch/io.h>
#include <assert.h>
#include <console/console.h>
+#include <delay.h>
+#include <soc/clock.h>
+#include <soc/grf.h>
+#include <soc/pmu.h>
+#include <soc/tsadc.h>
#include <stdint.h>
#include <stdlib.h>
-#include <arch/io.h>
-#include <delay.h>
-#include "tsadc.h"
-#include "clock.h"
-#include "pmu.h"
-#include "grf.h"
struct rk3288_tsadc_regs {
u32 user_con;
diff --git a/src/soc/rockchip/rk3288/uart.c b/src/soc/rockchip/rk3288/uart.c
index 60b14a3..01759fe 100644
--- a/src/soc/rockchip/rk3288/uart.c
+++ b/src/soc/rockchip/rk3288/uart.c
@@ -17,12 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <console/uart.h>
#include <arch/io.h>
#include <boot/coreboot_tables.h>
#include <console/console.h> /* for __console definition */
-#include <stdint.h>
+#include <console/uart.h>
#include <drivers/uart/uart8250reg.h>
+#include <stdint.h>
/*
* TODO: Use DRIVERS_UART_8250MEM driver instead.