aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox
AgeCommit message (Collapse)AuthorFilesLines
2019-04-14Merge branch 'master' of git://git.denx.de/u-boot-spiTom Rini1-1/+1
Conflicts: arch/arm/dts/armada-385-amc.dts arch/arm/dts/armada-xp-theadorable.dts arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi Signed-off-by: Tom Rini <trini@konsulko.com>
2019-04-12dts: switch spi-flash to jedec, spi-nor compatibleNeil Armstrong1-1/+1
There is no reason not to use the Linux "jedec,spi-nor" binding in U-Boot dts files. This compatible has been added in sf_probe, let use it. This patch switches to jedec,spi-nor when spi-flash is used in the DTS and DTSI files, and removed spi-flash when jedec,spi-nor is already present. The x86 dts are switched in a separate commit since it depends on a change in fdtdec. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Evgeniy Paltsev <paltsev@synopsys.com> Reviewed-by: Rick Chen <rick@andestech.com> Reviewed-by: Patrick Delaunay <Patrick.delaunay@st.com> Reviewed-by: Jagan Teki <jagan@openedev.com>
2019-04-11dm: sound: make all functions static inlineChristian Gmeiner1-2/+2
Fixes following compile problem: ➜ u-boot-mainline git:(master) ✗ make sandbox_defconfig all NO_SDL=1 scripts/kconfig/conf --syncconfig Kconfig CHK include/config.h CFG u-boot.cfg GEN include/autoconf.mk GEN include/autoconf.mk.dep CHK include/config/uboot.release CHK include/generated/version_autogenerated.h CHK include/generated/timestamp_autogenerated.h UPD include/generated/timestamp_autogenerated.h CHK include/generated/generic-asm-offsets.h HOSTCC tools/mkenvimage.o HOSTLD tools/mkenvimage HOSTCC tools/fit_image.o HOSTCC tools/image-host.o HOSTCC tools/dumpimage.o HOSTLD tools/dumpimage HOSTCC tools/mkimage.o HOSTLD tools/mkimage HOSTLD tools/fit_info HOSTLD tools/fit_check_sign CC cmd/version.o GZIP cmd/config_data.gz CHK cmd/config_data_gz.h CHK cmd/config_data_size.h CHK cmd/license_data_gz.h CHK cmd/license_data_size.h LD cmd/built-in.o CC common/main.o LD common/built-in.o CC drivers/fastboot/fb_getvar.o LD drivers/fastboot/built-in.o LD drivers/video/built-in.o ld.bfd: drivers/video/sandbox_sdl.o: in function `sandbox_sdl_sound_play': /home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:110: multiple definition of `sandbox_sdl_sound_play'; drivers/video/video-uclass.o:/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:110: first defined here ld.bfd: drivers/video/sandbox_sdl.o: in function `sandbox_sdl_sound_init': /home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:120: multiple definition of `sandbox_sdl_sound_init'; drivers/video/video-uclass.o:/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:120: first defined here make[3]: *** [scripts/Makefile.build:355: drivers/video/built-in.o] Fehler 1 make[2]: *** [scripts/Makefile.build:432: drivers/video] Fehler 2 make[1]: *** [Makefile:1531: drivers] Fehler 2 make: *** [Makefile:485: __build_one_by_one] Fehler 2 Fixes: f2b25c9bf82 ("dm: sound: Complete migration to driver model") Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2019-04-11sandbox: Properly print physical addressesThierry Reding1-1/+1
Use the %pap printf specifier to print physical addresses. The physical address is passed by reference and hence avoids the need to play tricks with the preprocessor to use the correct specifier. Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-11sandbox: Use correct phys_{addr, size}_t for PHYS_64BIT=yThierry Reding1-6/+6
If 64-bit physical addresses support is enabled, make sure the sandox defines the correct types for phys_addr_t and phys_size_t. Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-11syscon: update syscon_regmap_lookup_by_phandlePatrick Delaunay1-1/+2
Change the function syscon_regmap_lookup_by_phandle() introduced by commit 6c3af1f24e4b ("syscon: dm: Add a new method to get a regmap from DTS") to have Linux-compatible syscon API. Same modification than commit e151a1c288bd ("syscon: add Linux-compatible syscon API") solves issue when the node identified by the phandle has several compatibles and is already bound to a dedicated driver. See Linux commit bdb0066df96e ("mfd: syscon: Decouple syscon interface from platform devices"). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-02-27clk: Add fixed-factor clock driverAnup Patel1-0/+8
This patch adds fixed-factor clock driver which derives clock rate by dividing (div) and multiplying (mult) fixed factors to a parent clock. Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-02-20sandbox: sound: Silence sound for testingSimon Glass1-0/+1
When testing the sound system we don't need the hear the beeps. The testing works by checking the data that would be emitted. Add a device-tree property to silence the sound, and enable it for testing. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-02-20sound: Add uclass operations for beepingSimon Glass1-0/+16
Some audio codecs such as Intel HDA do not need to use digital data to play sounds, but instead have a way to emit beeps. Add this interface as an option. If the beep interface is not supported, then the sound uclass falls back to the I2S interface. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-02-20sandbox: pch: Add a test for the PCH uclassSimon Glass2-0/+12
This uclass currently has no tests. Add a sandbox driver and some simple tests to provide basic coverage. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: Use "sandbox,pch" for the compatible string, for consistency] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-02-20sandbox: Add a note about the growing state_info structSimon Glass1-0/+9
This struct is getting larger and in some cases is being used for things which would be better put into a driver. For example hwspinlock is not used outside of sandbox_hwspinlock.c. Add a note to encourage people to put things elsewhere. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-01-15Merge tag 'dm-pull-15jan19' of git://git.denx.de/u-boot-dmTom Rini5-11/+21
Fix recent changes to serial API for driver model Buildman clang support and a few fixes Small fixes to 'dm tree' and regmap test Improve sandbox build compatibility A few other minor fixes
2019-01-14sandbox: i2c_emul_find() No emulators for device 'rtc@43'Heinrich Schuchardt2-8/+8
when running the date command on sandbox_defconfig an error occurs: ./u-boot -D u-boot.dtb => date i2c_emul_find() No emulators for device 'rtc@43' ## Get date failed Correct the references to the emulator devices in the sandbox device trees using test.dts as a reference. Fixes: 031a650e1309 ("dm: sandbox: i2c: Use new emulator parent uclass") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Dropped unnecessary #address/size-cells property in i2c_emul: Signed-off-by: Simon Glass <sjg@chromium.org>
2019-01-14sandbox: Correct SDL build flagsSimon Glass2-3/+1
The check for CONFIG_SANDBOX_SDL in config.mk does not work since the build config is not available by the time that file is included. Remove it so that we always call sdl-config except when NO_SDL is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-01-14sandbox: add memset_io(..), memcpy_fromio(..) and memcpy_toio(..)Christian GMEINER1-0/+12
These functions could be used by drivers. Signed-off-by: Christian GMEINER <christian.GMEINER@bachmann.info> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-01-14test: bootcount: add bootcount-uclass testPhilipp Tomsich1-0/+6
Add a test for the bootcount uclass, which uses the RTC bootcount backend (i.e. drivers/bootcount/rtc.c is implictly also tested). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-12-13dm: sandbox: Allow selection of sample rate and channelsSimon Glass2-9/+7
At present these parameters are hard-coded in the sdl interface code. Allow them to be specified by the driver instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-13dm: sound: Complete migration to driver modelSimon Glass3-26/+9
All users of sound are converted to use driver model. Drop the old code and the CONFIG_DM_SOUND option. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-13dm: sandbox: sound: Convert to use driver modelSimon Glass3-11/+55
Update sandbox's device tree and config to use driver model for sound. Use the double buffer for sound output so that we don't need to wait for the sound to complete before returning. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-13dm: core: Add a function to read into a unsigned intSimon Glass1-0/+2
The current dev_read...() functions use s32 and u32 which are convenient for device tree but not so useful for normal code, which often wants to use normal integers for values. Add a helper which supports returning an unsigned int. Also add signed versions of the unsigned readers. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-13dm: sound: Create a uclass for soundSimon Glass2-0/+31
The sound driver pulls together the audio codec and i2s drivers in order to actually make sounds. It supports setup() and play() methods. The sound_find_codec_i2s() function allows locating the linked codec and i2s devices. They can be referred to from uclass-private data. Add a uclass and a test for sound. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-13dm: sandbox: Update sound to use two buffersSimon Glass1-25/+63
At present we use a single buffer for sound which means we cannot be playing one sound while queueing up the next. This wouldn't matter except that a long sound (more than a second) has to be created as a single buffer, thus using a lot of memory. To better mimic what real sound drivers do, add support for double buffering in sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-13dm: sound: Create a uclass for i2sSimon Glass2-1/+16
The i2s bus is commonly used with audio codecs. It provides a way to stream digital data sychronously in both directions. U-Boot only supports audio output, so this uclass is very simple, with a single tx_data() method. Add a uclass and a test for i2s. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-13dm: sound: Create a uclass for audio codecsSimon Glass2-1/+16
An audio codec provides a way to convert digital data to sound and vice versa. Add a simple uclass which just supports setting the parameters for the codec. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-10Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini1-2/+4
- DWC3 and UDC cleanup
2018-12-07syscon: dm: Add a new method to get a regmap from DTSJean-Jacques Hiblot1-2/+4
syscon_regmap_lookup_by_phandle() can be used to get the regmap of a syscon device from a reference in the DTS. It operates similarly to the linux version of the namesake function. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-12-07test: dma: add dma-uclass testGrygorii Strashko1-0/+8
Add a sandbox DMA driver implementation (provider) and corresponding DM test. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Álvaro Fernández Rojas <noltari@gmail.com>
2018-12-06dm: Add Hardware Spinlock classBenjamin Gaignard2-0/+5
This is uclass for Hardware Spinlocks. It implements two mandatory operations: lock and unlock and one optional relax operation. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2018-12-05dm: core: add functions to get/remap I/O addresses by nameÁlvaro Fernández Rojas1-0/+1
This functions allow us to get and remap I/O addresses by name, which is useful when there are multiple reg addresses indexed by reg-names property. This is needed in bmips dma/eth patch series, but can also be used on many other drivers. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-12-05sandbox: Use 'extras' to specify 'head' filesSimon Glass3-5/+7
At present sandbox has a start.o in the 'start' target but also includes it in the normal target list. This is not how this is normally handled. It is needed because sandbox does not include the u-boot-init variable in its link rule. Update the rule and move start.o from the normal target list to the 'extras' list. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-05sandbox: Zero the ram buffer on startupSimon Glass2-0/+8
At present the RAM buffer is not inited unless it is read from a file, likely produced by an earlier phase of U-Boot. This causes valgrind warnings whenever the RAM buffer is used. Correct this by initing it if needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-05sandbox: Check the filename in jump_to_image_no_args()Simon Glass1-2/+6
If the filename is NULL this function currently crashes. Update it to fail gracefully. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-05sandbox: Fix up the debug message for the image filenameSimon Glass1-1/+1
This currently prints out the wrong filename. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-29sandbox: Use memmove() to move overlapping regionsSimon Glass1-2/+3
The use of strcpy() to remove characters at the start of a string is safe in U-Boot, since we know the implementation. But in os.c we are using the C library's strcpy() function, where this behaviour is not permitted. Update the code to use memmove() instead. Reported-by: Coverity (CID: 173279) Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexander Graf <agraf@suse.de>
2018-11-29sandbox: Enable soundSimon Glass1-19/+0
Now that the buffer-overflow bug is fixed, we can enable sound on sandbox. Drop the code which exits early. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-29sound: sandbox: Use the correct frequencySimon Glass1-2/+9
At present we request a particular frequency but we may not get the exact same frequency in response. So use the actual frequency for generation of the square wave. This ensures that the pitch remains accurate on all host machines. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-29sound: Add sample rate as a parameter for square waveSimon Glass1-1/+1
At present this value is hard-coded in the function that generates a square wave. Since sample rates vary between different hardware, it makes more sense to have this as a parameter. Update the function and its users. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-29dm: sandbox: i2c: Use new emulator parent uclassSimon Glass4-60/+85
Update the device tree, sandbox i2c driver and tests to use the new emulation parent to hold emulators. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26spl: Add support for passing handoff info to U-Boot properSimon Glass1-0/+18
There is some basic informaton that SPL normally wants to pass through to U-Boot, such as the SDRAM size and bank information. Mkae use of the new bloblist structure for this. Add a new 'handoff' blob which is set up in SPL and passed to U-Boot proper. Also adda test for sandbox_spl that checks that this works correctly and a new 'sb' command to show the information passed from SPL. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26sandbox: Boot in U-Boot through the standard callSimon Glass2-14/+20
Most architectures use jump_to_image_no_args() to jump from SPL to U-Boot. At present sandbox is special in that it jumps in its spl_board_load_image() call. This is not strictly correct, and means that sandbox misses out some parts of board_init_r(), just as calling bloblist_finish(), for example. Change spl_board_load_image() to just identify the filename to boot, and implement jump_to_image_no_args() to actually jump to it. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26sandbox: Filter arguments when starting U-BootSimon Glass1-6/+26
The current method of starting U-Boot from U-Boot adds arguments to pass the memory file through, so that memory is preserved. This is fine for a single call, but if we call from TPL -> SPL -> U-Boot the arguments build up and we have several memory files in the argument list. Adjust the implementation to filter out arguments that we want to replace with new ones. Also print a useful error if the exec() call fails. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26sandbox: Use malloc() and free() from os layerSimon Glass2-12/+15
At present sandbox calls malloc() from various places in the OS layer and this results in calls to U-Boot's malloc() implementation. It is better to use the on in the OS layer, since it does not mix allocations with the main U-Boot code. Fix this by replacing calls with malloc() to os_malloc(), etc. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-11-26sandbox: Refactor code to create os_jump_to_file()Simon Glass1-10/+38
At present os_jump_to_image() jumps to a given image, and this is written to a file. But it is useful to be able to jump to a file also. To avoid duplicating code, split out the implementation of os_jump_to_image() into a new function that jumps to a file. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26sandbox: Add a new 'sb' commandSimon Glass2-0/+17
The old 'sb' command was deprecated in 2015 and replaced with 'host'. It is useful to be able to access some internal sandbox state, particularly for testing. Resurrect the old command and provide a way to print some basic state information (currently just the arguments to sandbox). Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26sandbox: Add an option to display of-platdata in SPLSimon Glass4-1/+25
At present we don't have a test that of-platdata can be accessed in SPL. Add this in as a command-line option to SPL. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-20sf: Add a method to obtain the block-protect settingSimon Glass1-0/+8
It is useful to obtain the block-protect setting of the SPI flash, so we know whether it is fully open or (perhaps partially) write-protected. Add a method for this. Update the sandbox driver to process this operation and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-20sandbox: Update some drivers to work in SPL/TPLSimon Glass1-0/+15
At present sandbox drivers are mostly not used before relocation. Some of these are needed by Chromium OS verified boot, since it uses sandbox TPL, so update them accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-20sandbox: Add a function to read a host fileSimon Glass1-3/+41
Add a way to read a file from the host filesystem. This can be useful for reading test data, for example. Also fix up the writing function which was not the right version, and drop the debugging lines. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-20sandbox: remove stray DEBUGHeinrich Schuchardt1-4/+4
DEBUG should not be defined in production code. Change printf() to debug() where this writes a debug message. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Alexander Graf <agraf@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-11-16test/py: test pinmux commandPatrice Chotard1-0/+4
Add pinmux test which test the following commands: - pinmux list - pinmux dev - pinmux status Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Mark some tests as sandbox-centric] Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Tom Rini <trini@konsulko.com>