summaryrefslogtreecommitdiff
path: root/arch/sandbox
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox')
-rw-r--r--arch/sandbox/Makefile9
-rw-r--r--arch/sandbox/cpu/Makefile5
-rw-r--r--arch/sandbox/cpu/spl.c41
-rw-r--r--arch/sandbox/dts/sandbox-boot.sh2
-rw-r--r--arch/sandbox/dts/sandbox-inner.sh4
-rw-r--r--arch/sandbox/dts/sandbox-outer.sh4
-rw-r--r--arch/sandbox/dts/sandbox_pmic.dtsi6
-rw-r--r--arch/sandbox/dts/sandbox_scripts.dtsi24
-rw-r--r--arch/sandbox/dts/test.dts82
-rw-r--r--arch/sandbox/include/asm/reset.h3
-rw-r--r--arch/sandbox/include/asm/spl.h14
-rw-r--r--arch/sandbox/include/asm/test.h8
12 files changed, 185 insertions, 17 deletions
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index 5bbf9f1f96b..0360d2bd886 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -1,13 +1,4 @@
# SPDX-License-Identifier: GPL-2.0+
-head-y := arch/sandbox/cpu/start.o
-head-$(CONFIG_SANDBOX_SDL) += arch/sandbox/cpu/sdl.o
libs-y += arch/sandbox/cpu/
libs-y += arch/sandbox/lib/
-
-# sdl.c fails to compile with -fshort-wchar using musl.
-cmd_cc_sdl.o = $(CC) $(filter-out -nostdinc -fshort-wchar, \
- $(patsubst -I%,-idirafter%,$(c_flags))) -fno-lto -c -o $@ $<
-
-$(obj)/sdl.o: $(src)/sdl.c FORCE
- $(call if_changed_dep,cc_sdl.o)
diff --git a/arch/sandbox/cpu/Makefile b/arch/sandbox/cpu/Makefile
index ee3c04c49e1..eb6bf6302e2 100644
--- a/arch/sandbox/cpu/Makefile
+++ b/arch/sandbox/cpu/Makefile
@@ -5,9 +5,8 @@
# (C) Copyright 2000-2003
# Wolfgang Denk, DENX Software Engineering, [email protected].
-obj-y := cache.o cpu.o state.o initjmp.o os.o
-extra-y := start.o
-extra-$(CONFIG_SANDBOX_SDL) += sdl.o
+obj-y := start.o cache.o cpu.o state.o initjmp.o os.o
+obj-$(CONFIG_SANDBOX_SDL) += sdl.o
obj-$(CONFIG_XPL_BUILD) += spl.o
obj-$(CONFIG_ETH_SANDBOX_RAW) += eth-raw-os.o
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 7ee4975523e..460013f933b 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -131,8 +131,8 @@ SPL_LOAD_IMAGE_METHOD("sandbox_image", 7, BOOT_DEVICE_BOARD, load_from_image);
int dram_init_banksize(void)
{
/* These are necessary so TFTP can use LMBs to check its load address */
- gd->bd->bi_dram[0].start = gd->ram_base;
- gd->bd->bi_dram[0].size = get_effective_memsize();
+ gd->dram[0].start = gd->ram_base;
+ gd->dram[0].size = get_effective_memsize();
return 0;
}
@@ -265,6 +265,43 @@ int sandbox_spl_load_fit(char *fname, int maxlen, struct spl_image_info *image)
return 0;
}
+int sandbox_spl_load_fit_full(char *fname, int maxlen,
+ struct spl_image_info *image)
+{
+ struct legacy_img_hdr *header;
+ long long size;
+ int ret;
+ int fd;
+
+ ret = sandbox_find_next_phase(fname, maxlen, true);
+ if (ret) {
+ printf("%s not found, error %d\n", fname, ret);
+ return log_msg_ret("nph", ret);
+ }
+
+ log_debug("reading from %s\n", fname);
+ fd = os_open(fname, OS_O_RDONLY);
+ if (fd < 0) {
+ printf("Failed to open '%s'\n", fname);
+ return log_msg_ret("ope", -errno);
+ }
+
+ if (os_get_filesize(fname, &size))
+ return log_msg_ret("fis", -ENOENT);
+
+ header = spl_get_load_buffer(0, size);
+
+ if (os_read(fd, header, size) != size)
+ return log_msg_ret("rea", -EIO);
+ os_close(fd);
+
+ ret = spl_load_fit_image(image, header);
+ if (ret)
+ return log_msg_ret("slf", ret);
+
+ return 0;
+}
+
static int upl_load_from_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
diff --git a/arch/sandbox/dts/sandbox-boot.sh b/arch/sandbox/dts/sandbox-boot.sh
new file mode 100644
index 00000000000..4f7fa661151
--- /dev/null
+++ b/arch/sandbox/dts/sandbox-boot.sh
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+echo "* default script"
diff --git a/arch/sandbox/dts/sandbox-inner.sh b/arch/sandbox/dts/sandbox-inner.sh
new file mode 100644
index 00000000000..b8fc8f7484b
--- /dev/null
+++ b/arch/sandbox/dts/sandbox-inner.sh
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+# Some comment.
+echo "* inner"
diff --git a/arch/sandbox/dts/sandbox-outer.sh b/arch/sandbox/dts/sandbox-outer.sh
new file mode 100644
index 00000000000..40294085433
--- /dev/null
+++ b/arch/sandbox/dts/sandbox-outer.sh
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+echo "* outer 1"
+source ${fdtcontroladdr}:inner
+echo "* outer 2"
diff --git a/arch/sandbox/dts/sandbox_pmic.dtsi b/arch/sandbox/dts/sandbox_pmic.dtsi
index ff2cb42844c..d90ab040827 100644
--- a/arch/sandbox/dts/sandbox_pmic.dtsi
+++ b/arch/sandbox/dts/sandbox_pmic.dtsi
@@ -47,6 +47,12 @@
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <1500000>;
};
+
+ ldo3 {
+ regulator-name = "SUPPLY_1.8_3.3V";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <3300000>;
+ };
};
&mc34708 {
diff --git a/arch/sandbox/dts/sandbox_scripts.dtsi b/arch/sandbox/dts/sandbox_scripts.dtsi
new file mode 100644
index 00000000000..c800ec39e87
--- /dev/null
+++ b/arch/sandbox/dts/sandbox_scripts.dtsi
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/ {
+ images {
+ default = "boot";
+ boot {
+ description = "Test boot script";
+ data = /incbin/("sandbox-boot.sh");
+ type = "script";
+ compression = "none";
+ };
+ outer {
+ description = "Script testing recursion";
+ data = /incbin/("sandbox-outer.sh");
+ type = "script";
+ compression = "none";
+ };
+ inner {
+ description = "Another test script";
+ data = /incbin/("sandbox-inner.sh");
+ type = "script";
+ compression = "none";
+ };
+ };
+};
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index ac92ebf1afd..d24feec5422 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -16,6 +16,7 @@
#include <dt-bindings/leds/common.h>
#include <dt-bindings/pinctrl/sandbox-pinmux.h>
#include <dt-bindings/mux/mux.h>
+#include <dt-bindings/phy/phy.h>
/ {
model = "sandbox";
@@ -175,7 +176,7 @@
storage = "mmc3";
skip-offset = <0x800000>;
area-start = <0>;
- area-size = <0xe00000>;
+ area-size = <0x2000000>;
state-offset = <0xdffc00>;
state-size = <0x40>;
version-offset = <0xdffe00>;
@@ -502,6 +503,65 @@
phy-names = "phy1";
};
+ /* PHY common props test nodes */
+ phy_common_props_missing: phy-common-props-missing {
+ /* empty: no rx-polarity or tx-polarity properties */
+ };
+
+ phy_common_props_more_values: phy-common-props-more-values {
+ /* 3 values but only 2 names => count mismatch */
+ rx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT PHY_POL_NORMAL>;
+ rx-polarity-names = "sgmii", "2500base-x";
+ tx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT PHY_POL_NORMAL>;
+ tx-polarity-names = "sgmii", "2500base-x";
+ };
+
+ phy_common_props_single: phy-common-props-single {
+ /* 1 value, no names array => value applies to all modes */
+ rx-polarity = <PHY_POL_INVERT>;
+ tx-polarity = <PHY_POL_INVERT>;
+ };
+
+ phy_common_props_more_names: phy-common-props-more-names {
+ /* 2 values but 3 names => count mismatch */
+ rx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;
+ rx-polarity-names = "sgmii", "2500base-x", "1000base-x";
+ tx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;
+ tx-polarity-names = "sgmii", "2500base-x", "1000base-x";
+ };
+
+ phy_common_props_find_by_name: phy-common-props-find-by-name {
+ /* valid 3-element arrays, lookup by mode name */
+ rx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT PHY_POL_AUTO>;
+ rx-polarity-names = "sgmii", "2500base-x", "usb-ss";
+ tx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT PHY_POL_NORMAL>;
+ tx-polarity-names = "sgmii", "2500base-x", "1000base-x";
+ };
+
+ phy_common_props_no_default: phy-common-props-no-default {
+ /* name not in array, no "default" entry => -EINVAL */
+ rx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;
+ rx-polarity-names = "2500base-x", "1000base-x";
+ tx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;
+ tx-polarity-names = "2500base-x", "1000base-x";
+ };
+
+ phy_common_props_with_default: phy-common-props-with-default {
+ /* name not in array, but "default" entry exists */
+ rx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;
+ rx-polarity-names = "2500base-x", "default";
+ tx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;
+ tx-polarity-names = "2500base-x", "default";
+ };
+
+ phy_common_props_unsupported: phy-common-props-unsupported {
+ /* PHY_POL_AUTO is not supported for manual-only modes */
+ rx-polarity = <PHY_POL_AUTO>;
+ rx-polarity-names = "sgmii";
+ tx-polarity = <PHY_POL_AUTO>;
+ tx-polarity-names = "sgmii";
+ };
+
some-bus {
#address-cells = <1>;
#size-cells = <0>;
@@ -967,6 +1027,9 @@
emul1: emull {
compatible = "sandbox,i2c-rtc-emul";
};
+ emul_pmbus: emul-pmbus {
+ compatible = "sandbox,i2c-pmbus";
+ };
};
sandbox_pmic: sandbox_pmic@40 {
@@ -978,6 +1041,13 @@
reg = <0x41>;
sandbox,emul = <&emul_pmic1>;
};
+
+ pmbus@70 {
+ reg = <0x70>;
+ compatible = "pmbus";
+ regulator-name = "sandbox-pmbus-vout";
+ sandbox,emul = <&emul_pmbus>;
+ };
};
i3c0 {
@@ -1470,10 +1540,16 @@
#reset-cells = <1>;
};
+ resetc_fb: reset-ctl-fallback {
+ compatible = "sandbox,reset-ctl-fallback-only";
+ #reset-cells = <1>;
+ };
+
reset-ctl-test {
compatible = "sandbox,reset-ctl-test";
- resets = <&resetc 100>, <&resetc 2>, <&resetc 20>, <&resetc 40>;
- reset-names = "other", "test", "test2", "test3";
+ resets = <&resetc 100>, <&resetc 2>, <&resetc 20>, <&resetc 40>,
+ <&resetc_fb 5>;
+ reset-names = "other", "test", "test2", "test3", "fallback";
};
rng {
diff --git a/arch/sandbox/include/asm/reset.h b/arch/sandbox/include/asm/reset.h
index f0709b41c09..2890e0dc09b 100644
--- a/arch/sandbox/include/asm/reset.h
+++ b/arch/sandbox/include/asm/reset.h
@@ -10,6 +10,7 @@ struct udevice;
int sandbox_reset_query(struct udevice *dev, unsigned long id);
int sandbox_reset_is_requested(struct udevice *dev, unsigned long id);
+int sandbox_reset_get_count(struct udevice *dev, unsigned long id);
int sandbox_reset_test_get(struct udevice *dev);
int sandbox_reset_test_get_devm(struct udevice *dev);
@@ -19,6 +20,8 @@ int sandbox_reset_test_assert(struct udevice *dev);
int sandbox_reset_test_assert_bulk(struct udevice *dev);
int sandbox_reset_test_deassert(struct udevice *dev);
int sandbox_reset_test_deassert_bulk(struct udevice *dev);
+int sandbox_reset_test_reset(struct udevice *dev);
+int sandbox_reset_test_reset_bulk(struct udevice *dev);
int sandbox_reset_test_free(struct udevice *dev);
int sandbox_reset_test_release_bulk(struct udevice *dev);
diff --git a/arch/sandbox/include/asm/spl.h b/arch/sandbox/include/asm/spl.h
index d824b2123a2..49a613ba92d 100644
--- a/arch/sandbox/include/asm/spl.h
+++ b/arch/sandbox/include/asm/spl.h
@@ -46,4 +46,18 @@ int sandbox_find_next_phase(char *fname, int maxlen, bool use_img);
*/
int sandbox_spl_load_fit(char *fname, int maxlen, struct spl_image_info *image);
+/**
+ * sandbox_spl_load_fit_full() - Load the next phase from a FIT with the "full" loader
+ *
+ * Loads a FIT containing the next phase and sets it up for booting, using the
+ * "full" FIT loader
+ *
+ * @fname: Returns filename loaded
+ * @maxlen: Maximum length for @fname including \0
+ * @image: Place to put SPL-image information
+ * Return: 0 if OK, -ve on error
+ */
+int sandbox_spl_load_fit_full(char *fname, int maxlen,
+ struct spl_image_info *image);
+
#endif
diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 0e8d19ce232..0438790028b 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -244,6 +244,14 @@ uint sandbox_spi_get_speed(struct udevice *dev);
uint sandbox_spi_get_mode(struct udevice *dev);
/**
+ * sandbox_spi_get_wordlen() - Get current wordlen setting of a sandbox spi slave
+ *
+ * @dev: Device to check
+ * Return: current wordlen
+ */
+uint sandbox_spi_get_wordlen(struct udevice *dev);
+
+/**
* sandbox_get_pch_spi_protect() - Get the PCI SPI protection status
*
* @dev: Device to check