[U-Boot] [PATCH 24/60] ARM: tegra: unify+move {board, sys_proto}.h to

Stephen Warren
2016-04-19T20:59:04Z

From: Stephen Warren <swarren@nvidia.com>

Machine-specific headers should be in this location. Eventually, we'll
move all headers from arch/arm/include to arch/arm/mach-tegra/include,
or find a way to delete them.

Both board and sys_proto.h served the same purpose; a place to prototype
functions implemented by the board and called by code in mach-tegra/.
Merge them into a single file to reduce the number of headers.

board_init_uart_f() is private to code in mach-tegra/ so remove its
prototype from the public <mach/> header. cpu.h isn't a great place for
it, but other functions implemented in the same C file are prototyped
there, so it'll do for now. When the C files are all refactored for
Tegra186, this should be cleaned up.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/include/asm/arch-tegra/sys_proto.h | 33 ----------------------
arch/arm/mach-tegra/board.c | 3 +-
arch/arm/mach-tegra/board2.c | 4 +--
arch/arm/mach-tegra/cpu.h | 2 ++
arch/arm/mach-tegra/emc.c | 1 -
.../arch-tegra => mach-tegra/include/mach}/board.h | 33 +++++++++++++++++-----
arch/arm/mach-tegra/spl.c | 2 +-
arch/arm/mach-tegra/tegra20/pmu.c | 1 -
board/avionic-design/common/tamonten.c | 3 +-
board/nvidia/seaboard/seaboard.c | 2 +-
board/toradex/colibri_t20/colibri_t20.c | 2 +-
11 files changed, 35 insertions(+), 51 deletions(-)
delete mode 100644 arch/arm/include/asm/arch-tegra/sys_proto.h
rename arch/arm/{include/asm/arch-tegra => mach-tegra/include/mach}/board.h (63%)

diff --git a/arch/arm/include/asm/arch-tegra/sys_proto.h b/arch/arm/include/asm/arch-tegra/sys_proto.h
deleted file mode 100644
index 8c2f94b578fe..000000000000
--- a/arch/arm/include/asm/arch-tegra/sys_proto.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * (C) Copyright 2010-2016
- * NVIDIA Corporation <www.nvidia.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#ifndef _SYS_PROTO_H_
-#define _SYS_PROTO_H_
-
-/**
- * tegra_board_id() - Get the board iD
- *
- * @return a board ID, or -ve on error
- */
-int tegra_board_id(void);
-
-/**
- * tegra_lcd_pmic_init() - Set up the PMIC for a board
- *
- * @board_id: Board ID which may be used to select LCD type
- * @return 0 if OK, -ve on error
- */
-int tegra_lcd_pmic_init(int board_id);
-
-/**
- * nvidia_board_init() - perform any board-specific init
- *
- * @return 0 if OK, -ve on error
- */
-int nvidia_board_init(void);
-
-#endif
diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c
index cf65ece060dd..87a9b5266804 100644
--- a/arch/arm/mach-tegra/board.c
+++ b/arch/arm/mach-tegra/board.c
@@ -14,8 +14,7 @@
#include <asm/arch/funcmux.h>
#include <asm/arch/mc.h>
#include <asm/arch/tegra.h>
-#include <asm/arch-tegra/board.h>
-#include <asm/arch-tegra/sys_proto.h>
+#include <mach/board.h>
#include "pmc.h"

void save_boot_params_ret(void);
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 9d970c483e0e..ce865be250e0 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -17,9 +17,7 @@
#include <asm/arch/pinmux.h>
#include <asm/arch/pmu.h>
#include <asm/arch/tegra.h>
-#include <asm/arch-tegra/board.h>
#include <asm/arch-tegra/clk_rst.h>
-#include <asm/arch-tegra/sys_proto.h>
#ifdef CONFIG_TEGRA_CLOCK_SCALING
#include <asm/arch/emc.h>
#endif
@@ -27,6 +25,7 @@
#ifdef CONFIG_USB_EHCI_TEGRA
#include <usb.h>
#endif
+#include <mach/board.h>
#ifdef CONFIG_TEGRA_MMC
#include <mach/tegra_mmc.h>
#endif
@@ -34,6 +33,7 @@
#include <power/as3722.h>
#include <i2c.h>
#include <spi.h>
+#include "cpu.h"
#include "emc.h"
#include "gpu.h"
#include "pmc.h"
diff --git a/arch/arm/mach-tegra/cpu.h b/arch/arm/mach-tegra/cpu.h
index c0284ce03787..88ffb29d18e1 100644
--- a/arch/arm/mach-tegra/cpu.h
+++ b/arch/arm/mach-tegra/cpu.h
@@ -84,3 +84,5 @@ void config_cache(void);
#if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
bool tegra_cpu_is_non_secure(void);
#endif
+/* Set up early UART output */
+void board_init_uart_f(void);
diff --git a/arch/arm/mach-tegra/emc.c b/arch/arm/mach-tegra/emc.c
index 70aec7fc1b3d..25150bcc3e80 100644
--- a/arch/arm/mach-tegra/emc.c
+++ b/arch/arm/mach-tegra/emc.c
@@ -12,7 +12,6 @@
#include <asm/arch/pmu.h>
#include <asm/arch/tegra.h>
#include <asm/arch-tegra/clk_rst.h>
-#include <asm/arch-tegra/sys_proto.h>
#include "emc.h"
#include "cpu.h"

diff --git a/arch/arm/include/asm/arch-tegra/board.h b/arch/arm/mach-tegra/include/mach/board.h
similarity index 63%
rename from arch/arm/include/asm/arch-tegra/board.h
rename to arch/arm/mach-tegra/include/mach/board.h
index 783bb3c0fa12..f6688ef761e7 100644
--- a/arch/arm/include/asm/arch-tegra/board.h
+++ b/arch/arm/mach-tegra/include/mach/board.h
@@ -1,19 +1,16 @@
/*
- * (C) Copyright 2010,2011
- * NVIDIA Corporation <www.nvidia.com>
+ * (C) Copyright 2010-2016
+ * NVIDIA Corporation <www.nvidia.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/

-#ifndef _TEGRA_BOARD_H_
-#define _TEGRA_BOARD_H_
+#ifndef _MACH_BOARD_H
+#define _MACH_BOARD_H

/* Set up pinmux to make UART usable */
void gpio_early_init_uart(void);

-/* Set up early UART output */
-void board_init_uart_f(void);
-
/* Set up any early GPIOs the board might need for proper operation */
void gpio_early_init(void); /* overrideable GPIO config */

@@ -31,4 +28,26 @@ void pin_mux_nand(void); /* overridable NAND pinmux setup */
void pin_mux_mmc(void); /* overridable mmc pinmux setup */
void pin_mux_display(void); /* overridable DISPLAY pinmux setup */

+/**
+ * tegra_lcd_pmic_init() - Set up the PMIC for a board
+ *
+ * @board_id: Board ID which may be used to select LCD type
+ * @return 0 if OK, -ve on error
+ */
+int tegra_lcd_pmic_init(int board_id);
+
+/**
+ * tegra_board_id() - Get the board iD
+ *
+ * @return a board ID, or -ve on error
+ */
+int tegra_board_id(void);
+
+/**
+ * nvidia_board_init() - perform any board-specific init
+ *
+ * @return 0 if OK, -ve on error
+ */
+int nvidia_board_init(void);
+
#endif
diff --git a/arch/arm/mach-tegra/spl.c b/arch/arm/mach-tegra/spl.c
index ad13ad5ba5fb..e793700b243e 100644
--- a/arch/arm/mach-tegra/spl.c
+++ b/arch/arm/mach-tegra/spl.c
@@ -13,8 +13,8 @@
#include <asm/arch/clock.h>
#include <asm/arch/pinmux.h>
#include <asm/arch/tegra.h>
-#include <asm/arch-tegra/board.h>
#include <asm/spl.h>
+#include <mach/board.h>
#include "apb_misc.h"
#include "cpu.h"

diff --git a/arch/arm/mach-tegra/tegra20/pmu.c b/arch/arm/mach-tegra/tegra20/pmu.c
index 8488d97d5cde..2ebcfaf2695e 100644
--- a/arch/arm/mach-tegra/tegra20/pmu.c
+++ b/arch/arm/mach-tegra/tegra20/pmu.c
@@ -10,7 +10,6 @@
#include <tps6586x.h>
#include <asm/io.h>
#include <asm/arch/tegra.h>
-#include <asm/arch-tegra/sys_proto.h>
#include <mach/tegra_i2c.h>
#include "../cpu.h"

diff --git a/board/avionic-design/common/tamonten.c b/board/avionic-design/common/tamonten.c
index c05113c1c36c..c369d13e7f50 100644
--- a/board/avionic-design/common/tamonten.c
+++ b/board/avionic-design/common/tamonten.c
@@ -16,9 +16,8 @@
#include <asm/arch/funcmux.h>
#include <asm/arch/pinmux.h>
#include <asm/arch/tegra.h>
-#include <asm/arch-tegra/board.h>
#include <asm/arch-tegra/clk_rst.h>
-#include <asm/arch-tegra/sys_proto.h>
+#include <mach/board.h>

#ifdef CONFIG_BOARD_EARLY_INIT_F
void gpio_early_init(void)
diff --git a/board/nvidia/seaboard/seaboard.c b/board/nvidia/seaboard/seaboard.c
index 9c92fc2e29e2..913679e888d3 100644
--- a/board/nvidia/seaboard/seaboard.c
+++ b/board/nvidia/seaboard/seaboard.c
@@ -13,7 +13,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/funcmux.h>
#include <asm/arch/pinmux.h>
-#include <asm/arch-tegra/board.h>
+#include <mach/board.h>

/* TODO: Remove this code when the SPI switch is working */
#if (CONFIG_MACH_TYPE != MACH_TYPE_VENTANA)
diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c
index e47565fa6389..2505104b78fe 100644
--- a/board/toradex/colibri_t20/colibri_t20.c
+++ b/board/toradex/colibri_t20/colibri_t20.c
@@ -13,8 +13,8 @@
#include <asm/arch/clock.h>
#include <asm/arch/funcmux.h>
#include <asm/arch/pinmux.h>
-#include <asm/arch-tegra/board.h>
#include <asm/arch-tegra/tegra.h>
+#include <mach/board.h>

#define PMU_I2C_ADDRESS 0x34
#define MAX_I2C_RETRY 3
--
2.8.1