aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox')
-rw-r--r--arch/sandbox/cpu/sdl.c3
-rw-r--r--arch/sandbox/cpu/spl.c18
-rw-r--r--arch/sandbox/cpu/start.c15
-rw-r--r--arch/sandbox/dts/sandbox.dts1
-rw-r--r--arch/sandbox/dts/sandbox.dtsi35
-rw-r--r--arch/sandbox/dts/test.dts88
-rw-r--r--arch/sandbox/include/asm/state.h3
7 files changed, 131 insertions, 32 deletions
diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index 7dc3dab32e..d4dab36981 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -127,7 +127,8 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp,
sdl.pitch = sdl.width * sdl.depth / 8;
SDL_Window *screen = SDL_CreateWindow("U-Boot", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
- sdl.vis_width, sdl.vis_height, 0);
+ sdl.vis_width, sdl.vis_height,
+ SDL_WINDOW_RESIZABLE);
if (!screen) {
printf("Unable to initialise SDL screen: %s\n",
SDL_GetError());
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 7ab8919eb9..9a77da1561 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -12,6 +12,7 @@
#include <spl.h>
#include <asm/spl.h>
#include <asm/state.h>
+#include <test/test.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -53,19 +54,14 @@ SPL_LOAD_IMAGE_METHOD("sandbox", 9, BOOT_DEVICE_BOARD, spl_board_load_image);
void spl_board_init(void)
{
struct sandbox_state *state = state_get_current();
- struct udevice *dev;
preloader_console_init();
- if (state->show_of_platdata) {
- /*
- * Scan all the devices so that we can output their platform
- * data. See sandbox_spl_probe().
- */
- printf("Scanning misc devices\n");
- for (uclass_first_device(UCLASS_MISC, &dev);
- dev;
- uclass_next_device(&dev))
- ;
+
+ if (state->run_unittests) {
+ int ret;
+
+ ret = dm_test_main(state->select_unittests);
+ /* continue execution into U-Boot */
}
}
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index c6a2bbe468..58ada13fba 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -365,14 +365,23 @@ static int sandbox_cmdline_cb_log_level(struct sandbox_state *state,
SANDBOX_CMDLINE_OPT_SHORT(log_level, 'L', 1,
"Set log level (0=panic, 7=debug)");
-static int sandbox_cmdline_cb_show_of_platdata(struct sandbox_state *state,
+static int sandbox_cmdline_cb_unittests(struct sandbox_state *state,
+ const char *arg)
+{
+ state->run_unittests = true;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(unittests, 'u', 0, "Run unit tests");
+
+static int sandbox_cmdline_cb_select_unittests(struct sandbox_state *state,
const char *arg)
{
- state->show_of_platdata = true;
+ state->select_unittests = arg;
return 0;
}
-SANDBOX_CMDLINE_OPT(show_of_platdata, 0, "Show of-platdata in SPL");
+SANDBOX_CMDLINE_OPT_SHORT(select_unittests, 'k', 1, "Select unit tests to run");
static void setup_ram_buf(struct sandbox_state *state)
{
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index 20f6893829..8b50a40289 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -69,6 +69,7 @@
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c0>;
+ u-boot,dm-pre-reloc;
};
pcic: pci@0 {
diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi
index c76ecc013c..81cdc55b0d 100644
--- a/arch/sandbox/dts/sandbox.dtsi
+++ b/arch/sandbox/dts/sandbox.dtsi
@@ -18,17 +18,43 @@
buttons {
compatible = "gpio-keys";
- summer {
+ btn1 {
gpios = <&gpio_a 3 0>;
- label = "summer";
+ label = "button1";
};
- christmas {
+ btn2 {
gpios = <&gpio_a 4 0>;
- label = "christmas";
+ label = "button2";
};
};
+ clk_fixed: clk-fixed {
+ u-boot,dm-pre-reloc;
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <1234>;
+ };
+
+ clk_sandbox: clk-sbox {
+ u-boot,dm-pre-reloc;
+ compatible = "sandbox,clk";
+ #clock-cells = <1>;
+ assigned-clocks = <&clk_sandbox 3>;
+ assigned-clock-rates = <321>;
+ };
+
+ clk-test {
+ u-boot,dm-pre-reloc;
+ compatible = "sandbox,clk-test";
+ clocks = <&clk_fixed>,
+ <&clk_sandbox 1>,
+ <&clk_sandbox 0>,
+ <&clk_sandbox 3>,
+ <&clk_sandbox 2>;
+ clock-names = "fixed", "i2c", "spi", "uart2", "uart1";
+ };
+
gpio_a: gpios@0 {
u-boot,dm-pre-reloc;
gpio-controller;
@@ -64,6 +90,7 @@
reg = <0x43>;
compatible = "sandbox-rtc";
sandbox,emul = <&emul0>;
+ u-boot,dm-pre-reloc;
};
sandbox_pmic: sandbox_pmic {
reg = <0x40>;
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index cc372806a0..70ccb4951a 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -2,6 +2,8 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/gpio/sandbox-gpio.h>
+#include <dt-bindings/pinctrl/sandbox-pinmux.h>
+#include <dt-bindings/mux/mux.h>
/ {
model = "sandbox";
@@ -54,14 +56,14 @@
buttons {
compatible = "gpio-keys";
- summer {
+ btn1 {
gpios = <&gpio_a 3 0>;
- label = "summer";
+ label = "button1";
};
- christmas {
+ btn2 {
gpios = <&gpio_a 4 0>;
- label = "christmas";
+ label = "button2";
};
};
@@ -132,6 +134,12 @@
interrupts-extended = <&irq 3 0>;
acpi,name = "GHIJ";
phandle-value = <&gpio_c 10>, <0xFFFFFFFF 20>, <&gpio_a 30>;
+
+ mux-controls = <&muxcontroller0 0>, <&muxcontroller0 1>,
+ <&muxcontroller0 2>, <&muxcontroller0 3>,
+ <&muxcontroller1>;
+ mux-control-names = "mux0", "mux1", "mux2", "mux3", "mux4";
+ mux-syscon = <&syscon3>;
};
junk {
@@ -169,6 +177,9 @@
compatible = "denx,u-boot-fdt-test";
ping-expect = <3>;
ping-add = <3>;
+
+ mux-controls = <&muxcontroller0 0>;
+ mux-control-names = "mux0";
};
phy_provider0: gen_phy@0 {
@@ -558,7 +569,7 @@
default_off {
gpios = <&gpio_a 6 0>;
- label = "sandbox:default_off";
+ /* label intentionally omitted */
default-state = "off";
};
};
@@ -883,6 +894,29 @@
0x58 8>;
};
+ syscon3: syscon@3 {
+ compatible = "simple-mfd", "syscon";
+ reg = <0x000100 0x10>;
+
+ muxcontroller0: a-mux-controller {
+ compatible = "mmio-mux";
+ #mux-control-cells = <1>;
+
+ mux-reg-masks = <0x0 0x30>, /* 0: reg 0x0, bits 5:4 */
+ <0xc 0x1E>, /* 1: reg 0xc, bits 4:1 */
+ <0x4 0xFF>; /* 2: reg 0x4, bits 7:0 */
+ idle-states = <MUX_IDLE_AS_IS>, <0x02>, <0x73>;
+ u-boot,mux-autoprobe;
+ };
+ };
+
+ muxcontroller1: emul-mux-controller {
+ compatible = "mux-emul";
+ #mux-control-cells = <0>;
+ u-boot,mux-autoprobe;
+ idle-state = <0xabcd>;
+ };
+
timer@0 {
compatible = "sandbox,timer";
clock-frequency = <1000000>;
@@ -1094,30 +1128,60 @@
pinctrl {
compatible = "sandbox,pinctrl";
- pinctrl-names = "default";
- pinctrl-0 = <&gpios>;
+ pinctrl-names = "default", "alternate";
+ pinctrl-0 = <&pinctrl_gpios>, <&pinctrl_i2s>;
+ pinctrl-1 = <&pinctrl_spi>, <&pinctrl_i2c>;
- gpios: gpios {
+ pinctrl_gpios: gpios {
gpio0 {
- pins = "GPIO0";
+ pins = "P5";
+ function = "GPIO";
bias-pull-up;
input-disable;
};
gpio1 {
- pins = "GPIO1";
+ pins = "P6";
+ function = "GPIO";
output-high;
drive-open-drain;
};
gpio2 {
- pins = "GPIO2";
+ pinmux = <SANDBOX_PINMUX(7, SANDBOX_PINMUX_GPIO)>;
bias-pull-down;
input-enable;
};
gpio3 {
- pins = "GPIO3";
+ pinmux = <SANDBOX_PINMUX(8, SANDBOX_PINMUX_GPIO)>;
bias-disable;
};
};
+
+ pinctrl_i2c: i2c {
+ groups {
+ groups = "I2C_UART";
+ function = "I2C";
+ };
+
+ pins {
+ pins = "P0", "P1";
+ drive-open-drain;
+ };
+ };
+
+ pinctrl_i2s: i2s {
+ groups = "SPI_I2S";
+ function = "I2S";
+ };
+
+ pinctrl_spi: spi {
+ groups = "SPI_I2S";
+ function = "SPI";
+
+ cs {
+ pinmux = <SANDBOX_PINMUX(5, SANDBOX_PINMUX_CS)>,
+ <SANDBOX_PINMUX(6, SANDBOX_PINMUX_CS)>;
+ };
+ };
};
hwspinlock@0 {
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index 1bfad305f1..bca1306982 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -90,8 +90,9 @@ struct sandbox_state {
bool skip_delays; /* Ignore any time delays (for test) */
bool show_test_output; /* Don't suppress stdout in tests */
int default_log_level; /* Default log level for sandbox */
- bool show_of_platdata; /* Show of-platdata in SPL */
bool ram_buf_read; /* true if we read the RAM buffer */
+ bool run_unittests; /* Run unit tests */
+ const char *select_unittests; /* Unit test to run */
/* Pointer to information for each SPI bus/cs */
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]