# use clang only do one configuration.
- if [[ "${BUILDMAN}" != "" ]]; then
ret=0;
- tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
+ NO_SDL=1 tools/buildman/buildman -o /tmp -P -E ${BUILDMAN}
+ ${OVERRIDE}|| ret=$?;
if [[ $ret -ne 0 && $ret -ne 129 ]]; then
tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
exit $ret;
export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl;
export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
- ./tools/buildman/buildman -o /tmp -P sandbox_spl;
+ NO_SDL=1 ./tools/buildman/buildman -o /tmp -P sandbox_spl;
./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
./tools/buildman/buildman -t;
./tools/dtoc/dtoc -t;
- sparse
- bc
- build-essential
- - libsdl1.2-dev
+ - libsdl2-dev
- python
- python-pyelftools
- python3-virtualenv
#include <dm.h>
#include <asm/io.h>
#include <asm/arch/scu_ast2500.h>
+#include <linux/err.h>
int ast_get_clk(struct udevice **devp)
{
*/
#include <common.h>
+#include <malloc.h>
#include <nand.h>
+#include <dm/devres.h>
#include <asm/io.h>
#include <jffs2/jffs2.h>
#include <common.h>
#include <errno.h>
+#include <malloc.h>
#include <asm/io.h>
#include <mmc.h>
#include <spi_flash.h>
#include <linux/bitfield.h>
#include <regmap.h>
#include <syscon.h>
+#include <linux/err.h>
#define AO_SEC_SD_CFG8 0xe0
#define AO_SEC_SOCINFO_OFFSET AO_SEC_SD_CFG8
#include <common.h>
#include <asm/arch/sm.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <dm.h>
#include <linux/bitfield.h>
*/
#include <common.h>
+#include <malloc.h>
#include <linux/errno.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_px30.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_rk3036.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_rk3128.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_rk3188.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/grf_rk3188.h>
#include <asm/arch-rockchip/hardware.h>
+#include <linux/err.h>
#define GRF_BASE 0x20008000
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_rk322x.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <env.h>
#include <clk.h>
#include <init.h>
+#include <malloc.h>
#include <asm/armv7.h>
#include <asm/io.h>
#include <asm/arch-rockchip/bootrom.h>
#include <asm/arch-rockchip/pmu_rk3288.h>
#include <asm/arch-rockchip/qos_rk3288.h>
#include <asm/arch-rockchip/sdram.h>
+#include <linux/err.h>
DECLARE_GLOBAL_DATA_PTR;
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch/cru_rk3308.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
*Copyright (c) 2018 Rockchip Electronics Co., Ltd
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/arch/grf_rk3308.h>
#include <asm/arch-rockchip/hardware.h>
#include <dm.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_rk3328.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_rk3368.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru.h>
+#include <linux/err.h>
static int rockchip_get_cruclk(struct udevice **devp)
{
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_rv1108.h>
+#include <linux/err.h>
int rockchip_get_clk(struct udevice **devp)
{
#include <clk.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <asm/arch/clock_manager.h>
#include <asm/arch/system_manager.h>
#include <asm/io.h>
#include <common.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <asm/io.h>
#include <dm.h>
#include <clk.h>
#include <errno.h>
#include <regmap.h>
#include <syscon.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <fdt_support.h>
#include <fdtdec.h>
#include <hang.h>
+#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <clk.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <asm/arch/clk.h>
DECLARE_GLOBAL_DATA_PTR;
#include <div64.h>
#include <dm.h>
#include <time.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/clk.h>
#include <common.h>
#include <dm.h>
#include <init.h>
+#include <malloc.h>
#include <ram.h>
#include <wdt.h>
#include <asm/io.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <mach/pic32.h>
#include <mach/ddr.h>
#include <dt-bindings/clock/microchip,clock.h>
#include <asm/io.h>
#include <asm/syscon.h>
#include <cpu.h>
+#include <linux/err.h>
/* pending register */
#define PENDING_REG(base, hart) ((ulong)(base) + 0x1000 + ((hart) / 4) * 4)
#include <syscon.h>
#include <asm/io.h>
#include <asm/syscon.h>
+#include <linux/err.h>
/* mtime register */
#define MTIME_REG(base) ((ulong)(base))
#include <syscon.h>
#include <asm/io.h>
#include <asm/syscon.h>
+#include <linux/err.h>
/* MSIP registers */
#define MSIP_REG(base, hart) ((ulong)(base) + (hart) * 4)
PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM
PLATFORM_CPPFLAGS += -fPIC
PLATFORM_LIBS += -lrt
-SDL_CONFIG ?= sdl-config
+SDL_CONFIG ?= sdl2-config
# Define this to avoid linking with SDL, which requires SDL libraries
# This can solve 'sdl-config: Command not found' errors
#include <linux/libfdt.h>
#include <os.h>
#include <asm/io.h>
+#include <asm/malloc.h>
#include <asm/setjmp.h>
#include <asm/state.h>
#include <dm/root.h>
/* Prepare device struct */
priv->local_bind_sd = -1;
- priv->device = os_malloc(sizeof(struct sockaddr_ll));
+ priv->device = malloc(sizeof(struct sockaddr_ll));
if (priv->device == NULL)
return -ENOMEM;
device = priv->device;
/* Prepare device struct */
priv->local_bind_sd = -1;
priv->local_bind_udp_port = 0;
- priv->device = os_malloc(sizeof(struct sockaddr_in));
+ priv->device = malloc(sizeof(struct sockaddr_in));
if (priv->device == NULL)
return -ENOMEM;
device = priv->device;
void sandbox_eth_raw_os_stop(struct eth_sandbox_raw_priv *priv)
{
- os_free(priv->device);
+ free(priv->device);
priv->device = NULL;
close(priv->sd);
priv->sd = -1;
printf("Cannot seek to start of file '%s'\n", fname);
goto err;
}
- *bufp = os_malloc(size);
+ *bufp = malloc(size);
if (!*bufp) {
printf("Not enough memory to read file '%s'\n", fname);
ret = -ENOMEM;
}
}
-void *os_realloc(void *ptr, size_t length)
-{
- int page_size = getpagesize();
- struct os_mem_hdr *hdr;
- void *buf = NULL;
-
- if (length) {
- buf = os_malloc(length);
- if (!buf)
- return buf;
- if (ptr) {
- hdr = ptr - page_size;
- if (length > hdr->length)
- length = hdr->length;
- memcpy(buf, ptr, length);
- }
- }
- if (ptr)
- os_free(ptr);
-
- return buf;
-}
-
void os_usleep(unsigned long usec)
{
usleep(usec);
state->argv = argv;
/* dynamically construct the arguments to the system getopt_long */
- short_opts = os_malloc(sizeof(*short_opts) * num_options * 2 + 1);
- long_opts = os_malloc(sizeof(*long_opts) * num_options);
+ short_opts = malloc(sizeof(*short_opts) * num_options * 2 + 1);
+ long_opts = malloc(sizeof(*long_opts) * (num_options + 1));
if (!short_opts || !long_opts)
return 1;
/* we need to handle output ourselves since u-boot provides printf */
opterr = 0;
+ memset(&long_opts[num_options], '\0', sizeof(*long_opts));
/*
* walk all of the options the user gave us on the command line,
* figure out what u-boot option structure they belong to (via
while (node) {
next = node->next;
- os_free(node);
+ free(node);
node = next;
}
}
/* Create a buffer upfront, with typically sufficient size */
dirlen = strlen(dirname) + 2;
len = dirlen + 256;
- fname = os_malloc(len);
+ fname = malloc(len);
if (!fname) {
ret = -ENOMEM;
goto done;
ret = errno;
break;
}
- next = os_malloc(sizeof(*node) + strlen(entry->d_name) + 1);
+ next = malloc(sizeof(*node) + strlen(entry->d_name) + 1);
if (!next) {
os_dirent_free(head);
ret = -ENOMEM;
if (dirlen + strlen(entry->d_name) > len) {
len = dirlen + strlen(entry->d_name);
old_fname = fname;
- fname = os_realloc(fname, len);
+ fname = realloc(fname, len);
if (!fname) {
- os_free(old_fname);
- os_free(next);
+ free(old_fname);
+ free(next);
os_dirent_free(head);
ret = -ENOMEM;
goto done;
done:
closedir(dir);
- os_free(fname);
+ free(fname);
return ret;
}
for (argc = 0; (*argvp)[argc]; argc++)
;
- argv = os_malloc((argc + count + 1) * sizeof(char *));
+ argv = malloc((argc + count + 1) * sizeof(char *));
if (!argv) {
printf("Out of memory for %d argv\n", count);
return -ENOMEM;
os_exit(2);
err = execv(fname, argv);
- os_free(argv);
+ free(argv);
if (err) {
perror("Unable to run image");
printf("Image filename '%s'\n", fname);
#include <errno.h>
#include <unistd.h>
+#include <stdbool.h>
#include <linux/input.h>
-#include <SDL.h>
+#include <SDL2/SDL.h>
#include <asm/state.h>
/**
uint8_t *data;
};
+/**
+ * struct sdl_info - Information about our use of the SDL library
+ *
+ * @width: Width of simulated LCD display
+ * @height: Height of simulated LCD display
+ * @vis_width: Visible width (may be larger to allow for scaling up)
+ * @vis_height: Visible height (may be larger to allow for scaling up)
+ * @depth: Depth of the display in bits per pixel (16 or 32)
+ * @pitch: Number of bytes per line of the display
+ * @sample_rate: Current sample rate for audio
+ * @audio_active: true if audio can be used
+ * @inited: true if this module is initialised
+ * @cur_buf: Current audio buffer being used by sandbox_sdl_fill_audio (0 or 1)
+ * @buf: The two available audio buffers. SDL can be reading from one while we
+ * are setting up the next
+ * @running: true if audio is running
+ * @stopping: true if audio will stop once it runs out of data
+ * @texture: SDL texture to use for U-Boot display contents
+ * @renderer: SDL renderer to use
+ */
static struct sdl_info {
- SDL_Surface *screen;
int width;
int height;
+ int vis_width;
+ int vis_height;
int depth;
int pitch;
- uint frequency;
uint sample_rate;
bool audio_active;
bool inited;
int cur_buf;
struct buf_info buf[2];
bool running;
+ bool stopping;
+ SDL_Texture *texture;
+ SDL_Renderer *renderer;
} sdl;
static void sandbox_sdl_poll_events(void)
{
if (!sdl.inited) {
if (SDL_Init(0) < 0) {
- printf("Unable to initialize SDL: %s\n",
+ printf("Unable to initialise SDL: %s\n",
SDL_GetError());
return -EIO;
}
return 0;
}
-int sandbox_sdl_init_display(int width, int height, int log2_bpp)
+int sandbox_sdl_init_display(int width, int height, int log2_bpp,
+ bool double_size)
{
struct sandbox_state *state = state_get_current();
int err;
if (err)
return err;
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
- printf("Unable to initialize SDL LCD: %s\n", SDL_GetError());
+ printf("Unable to initialise SDL LCD: %s\n", SDL_GetError());
return -EPERM;
}
- SDL_WM_SetCaption("U-Boot", "U-Boot");
-
sdl.width = width;
sdl.height = height;
+ if (double_size) {
+ sdl.vis_width = sdl.width * 2;
+ sdl.vis_height = sdl.height * 2;
+ } else {
+ sdl.vis_width = sdl.width;
+ sdl.vis_height = sdl.height;
+ }
+
sdl.depth = 1 << log2_bpp;
sdl.pitch = sdl.width * sdl.depth / 8;
- sdl.screen = SDL_SetVideoMode(width, height, 0, 0);
+ SDL_Window *screen = SDL_CreateWindow("U-Boot", SDL_WINDOWPOS_UNDEFINED,
+ SDL_WINDOWPOS_UNDEFINED,
+ sdl.vis_width, sdl.vis_height, 0);
+ if (!screen) {
+ printf("Unable to initialise SDL screen: %s\n",
+ SDL_GetError());
+ return -EIO;
+ }
+ if (log2_bpp != 4 && log2_bpp != 5) {
+ printf("U-Boot SDL does not support depth %d\n", log2_bpp);
+ return -EINVAL;
+ }
+ sdl.renderer = SDL_CreateRenderer(screen, -1,
+ SDL_RENDERER_ACCELERATED |
+ SDL_RENDERER_PRESENTVSYNC);
+ if (!sdl.renderer) {
+ printf("Unable to initialise SDL renderer: %s\n",
+ SDL_GetError());
+ return -EIO;
+ }
+
+ sdl.texture = SDL_CreateTexture(sdl.renderer, log2_bpp == 4 ?
+ SDL_PIXELFORMAT_RGB565 :
+ SDL_PIXELFORMAT_RGB888,
+ SDL_TEXTUREACCESS_STREAMING,
+ width, height);
+ if (!sdl.texture) {
+ printf("Unable to initialise SDL texture: %s\n",
+ SDL_GetError());
+ return -EBADF;
+ }
sandbox_sdl_poll_events();
return 0;
int sandbox_sdl_sync(void *lcd_base)
{
- SDL_Surface *frame;
-
- frame = SDL_CreateRGBSurfaceFrom(lcd_base, sdl.width, sdl.height,
- sdl.depth, sdl.pitch,
- 0x1f << 11, 0x3f << 5, 0x1f << 0, 0);
- SDL_BlitSurface(frame, NULL, sdl.screen, NULL);
- SDL_FreeSurface(frame);
- SDL_UpdateRect(sdl.screen, 0, 0, 0, 0);
+ SDL_UpdateTexture(sdl.texture, NULL, lcd_base, sdl.pitch);
+ SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL);
+ SDL_RenderPresent(sdl.renderer);
sandbox_sdl_poll_events();
return 0;
}
-#define NONE (-1)
-#define NUM_SDL_CODES (SDLK_UNDO + 1)
-
-static int16_t sdl_to_keycode[NUM_SDL_CODES] = {
- /* 0 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, KEY_BACKSPACE, KEY_TAB,
- NONE, NONE, NONE, KEY_ENTER, NONE,
- NONE, NONE, NONE, NONE, KEY_POWER, /* use PAUSE as POWER */
-
- /* 20 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, KEY_ESC, NONE, NONE,
- NONE, NONE, KEY_SPACE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 40 */
- NONE, NONE, NONE, NONE, KEY_COMMA,
- KEY_MINUS, KEY_DOT, KEY_SLASH, KEY_0, KEY_1,
- KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
- KEY_7, KEY_8, KEY_9, NONE, KEY_SEMICOLON,
-
- /* 60 */
- NONE, KEY_EQUAL, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 80 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, KEY_BACKSLASH, NONE, NONE,
- NONE, KEY_GRAVE, KEY_A, KEY_B, KEY_C,
-
- /* 100 */
- KEY_D, KEY_E, KEY_F, KEY_G, KEY_H,
- KEY_I, KEY_J, KEY_K, KEY_L, KEY_M,
- KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R,
- KEY_S, KEY_T, KEY_U, KEY_V, KEY_W,
-
- /* 120 */
- KEY_X, KEY_Y, KEY_Z, NONE, NONE,
- NONE, NONE, KEY_DELETE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 140 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 160 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 180 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 200 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 220 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 240 */
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, NONE, NONE, NONE, NONE,
- NONE, KEY_KP0, KEY_KP1, KEY_KP2, KEY_KP3,
-
- /* 260 */
- KEY_KP4, KEY_KP5, KEY_KP6, KEY_KP7, KEY_KP8,
- KEY_KP9, KEY_KPDOT, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS,
- KEY_KPPLUS, KEY_KPENTER, KEY_KPEQUAL, KEY_UP, KEY_DOWN,
- KEY_RIGHT, KEY_LEFT, KEY_INSERT, KEY_HOME, KEY_END,
-
- /* 280 */
- KEY_PAGEUP, KEY_PAGEDOWN, KEY_F1, KEY_F2, KEY_F3,
- KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8,
- KEY_F9, KEY_F10, KEY_F11, KEY_F12, NONE,
- NONE, NONE, NONE, NONE, NONE,
-
- /* 300 */
- KEY_NUMLOCK, KEY_CAPSLOCK, KEY_SCROLLLOCK, KEY_RIGHTSHIFT,
- KEY_LEFTSHIFT,
- KEY_RIGHTCTRL, KEY_LEFTCTRL, KEY_RIGHTALT, KEY_LEFTALT, KEY_RIGHTMETA,
- KEY_LEFTMETA, NONE, KEY_FN, NONE, KEY_COMPOSE,
- NONE, KEY_PRINT, KEY_SYSRQ, KEY_PAUSE, NONE,
-
- /* 320 */
- NONE, NONE, NONE,
+static const unsigned short sdl_to_keycode[SDL_NUM_SCANCODES] = {
+ [SDL_SCANCODE_A] = KEY_A,
+ [SDL_SCANCODE_B] = KEY_B,
+ [SDL_SCANCODE_C] = KEY_C,
+ [SDL_SCANCODE_D] = KEY_D,
+ [SDL_SCANCODE_E] = KEY_E,
+ [SDL_SCANCODE_F] = KEY_F,
+ [SDL_SCANCODE_G] = KEY_G,
+ [SDL_SCANCODE_H] = KEY_H,
+ [SDL_SCANCODE_I] = KEY_I,
+ [SDL_SCANCODE_J] = KEY_J,
+ [SDL_SCANCODE_K] = KEY_K,
+ [SDL_SCANCODE_L] = KEY_L,
+ [SDL_SCANCODE_M] = KEY_M,
+ [SDL_SCANCODE_N] = KEY_N,
+ [SDL_SCANCODE_O] = KEY_O,
+ [SDL_SCANCODE_P] = KEY_P,
+ [SDL_SCANCODE_Q] = KEY_Q,
+ [SDL_SCANCODE_R] = KEY_R,
+ [SDL_SCANCODE_S] = KEY_S,
+ [SDL_SCANCODE_T] = KEY_T,
+ [SDL_SCANCODE_U] = KEY_U,
+ [SDL_SCANCODE_V] = KEY_V,
+ [SDL_SCANCODE_W] = KEY_W,
+ [SDL_SCANCODE_X] = KEY_X,
+ [SDL_SCANCODE_Y] = KEY_Y,
+ [SDL_SCANCODE_Z] = KEY_Z,
+
+ [SDL_SCANCODE_1] = KEY_1,
+ [SDL_SCANCODE_2] = KEY_2,
+ [SDL_SCANCODE_3] = KEY_3,
+ [SDL_SCANCODE_4] = KEY_4,
+ [SDL_SCANCODE_5] = KEY_5,
+ [SDL_SCANCODE_6] = KEY_6,
+ [SDL_SCANCODE_7] = KEY_7,
+ [SDL_SCANCODE_8] = KEY_8,
+ [SDL_SCANCODE_9] = KEY_9,
+ [SDL_SCANCODE_0] = KEY_0,
+
+ [SDL_SCANCODE_RETURN] = KEY_ENTER,
+ [SDL_SCANCODE_ESCAPE] = KEY_ESC,
+ [SDL_SCANCODE_BACKSPACE] = KEY_BACKSPACE,
+ [SDL_SCANCODE_TAB] = KEY_TAB,
+ [SDL_SCANCODE_SPACE] = KEY_SPACE,
+
+ [SDL_SCANCODE_MINUS] = KEY_MINUS,
+ [SDL_SCANCODE_EQUALS] = KEY_EQUAL,
+ [SDL_SCANCODE_BACKSLASH] = KEY_BACKSLASH,
+ [SDL_SCANCODE_SEMICOLON] = KEY_SEMICOLON,
+ [SDL_SCANCODE_APOSTROPHE] = KEY_APOSTROPHE,
+ [SDL_SCANCODE_GRAVE] = KEY_GRAVE,
+ [SDL_SCANCODE_COMMA] = KEY_COMMA,
+ [SDL_SCANCODE_PERIOD] = KEY_DOT,
+ [SDL_SCANCODE_SLASH] = KEY_SLASH,
+
+ [SDL_SCANCODE_CAPSLOCK] = KEY_CAPSLOCK,
+
+ [SDL_SCANCODE_F1] = KEY_F1,
+ [SDL_SCANCODE_F2] = KEY_F2,
+ [SDL_SCANCODE_F3] = KEY_F3,
+ [SDL_SCANCODE_F4] = KEY_F4,
+ [SDL_SCANCODE_F5] = KEY_F5,
+ [SDL_SCANCODE_F6] = KEY_F6,
+ [SDL_SCANCODE_F7] = KEY_F7,
+ [SDL_SCANCODE_F8] = KEY_F8,
+ [SDL_SCANCODE_F9] = KEY_F9,
+ [SDL_SCANCODE_F10] = KEY_F10,
+ [SDL_SCANCODE_F11] = KEY_F11,
+ [SDL_SCANCODE_F12] = KEY_F12,
+
+ [SDL_SCANCODE_PRINTSCREEN] = KEY_PRINT,
+ [SDL_SCANCODE_SCROLLLOCK] = KEY_SCROLLLOCK,
+ [SDL_SCANCODE_PAUSE] = KEY_PAUSE,
+ [SDL_SCANCODE_INSERT] = KEY_INSERT,
+ [SDL_SCANCODE_HOME] = KEY_HOME,
+ [SDL_SCANCODE_PAGEUP] = KEY_PAGEUP,
+ [SDL_SCANCODE_DELETE] = KEY_DELETE,
+ [SDL_SCANCODE_END] = KEY_END,
+ [SDL_SCANCODE_PAGEDOWN] = KEY_PAGEDOWN,
+ [SDL_SCANCODE_RIGHT] = KEY_RIGHT,
+ [SDL_SCANCODE_LEFT] = KEY_LEFT,
+ [SDL_SCANCODE_DOWN] = KEY_DOWN,
+ [SDL_SCANCODE_UP] = KEY_UP,
+
+ [SDL_SCANCODE_NUMLOCKCLEAR] = KEY_NUMLOCK,
+ [SDL_SCANCODE_KP_DIVIDE] = KEY_KPSLASH,
+ [SDL_SCANCODE_KP_MULTIPLY] = KEY_KPASTERISK,
+ [SDL_SCANCODE_KP_MINUS] = KEY_KPMINUS,
+ [SDL_SCANCODE_KP_PLUS] = KEY_KPPLUS,
+ [SDL_SCANCODE_KP_ENTER] = KEY_KPENTER,
+ [SDL_SCANCODE_KP_1] = KEY_KP1,
+ [SDL_SCANCODE_KP_2] = KEY_KP2,
+ [SDL_SCANCODE_KP_3] = KEY_KP3,
+ [SDL_SCANCODE_KP_4] = KEY_KP4,
+ [SDL_SCANCODE_KP_5] = KEY_KP5,
+ [SDL_SCANCODE_KP_6] = KEY_KP6,
+ [SDL_SCANCODE_KP_7] = KEY_KP7,
+ [SDL_SCANCODE_KP_8] = KEY_KP8,
+ [SDL_SCANCODE_KP_9] = KEY_KP9,
+ [SDL_SCANCODE_KP_0] = KEY_KP0,
+ [SDL_SCANCODE_KP_PERIOD] = KEY_KPDOT,
+
+ [SDL_SCANCODE_KP_EQUALS] = KEY_KPEQUAL,
+ [SDL_SCANCODE_KP_COMMA] = KEY_KPCOMMA,
+
+ [SDL_SCANCODE_SYSREQ] = KEY_SYSRQ,
};
int sandbox_sdl_scan_keys(int key[], int max_keys)
{
- Uint8 *keystate;
+ const Uint8 *keystate;
+ int num_keys;
int i, count;
sandbox_sdl_poll_events();
- keystate = SDL_GetKeyState(NULL);
- for (i = count = 0; i < NUM_SDL_CODES; i++) {
- if (count >= max_keys)
- break;
- else if (keystate[i])
- key[count++] = sdl_to_keycode[i];
+ keystate = SDL_GetKeyboardState(&num_keys);
+ for (i = count = 0; i < num_keys; i++) {
+ if (count < max_keys && keystate[i]) {
+ int keycode = sdl_to_keycode[i];
+
+ if (keycode)
+ key[count++] = keycode;
+ }
}
return count;
{
struct buf_info *buf;
int avail;
+ bool have_data = false;
int i;
for (i = 0; i < 2; i++) {
}
if (avail > len)
avail = len;
+ have_data = true;
SDL_MixAudio(stream, buf->data + buf->pos, avail,
SDL_MIX_MAXVOLUME);
else
break;
}
+ sdl.stopping = !have_data;
}
int sandbox_sdl_sound_init(int rate, int channels)
{
- SDL_AudioSpec wanted;
+ SDL_AudioSpec wanted, have;
int i;
if (sandbox_sdl_ensure_init())
}
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
- printf("Unable to initialize SDL audio: %s\n", SDL_GetError());
+ printf("Unable to initialise SDL audio: %s\n", SDL_GetError());
goto err;
}
/* Open the audio device, forcing the desired format */
- if (SDL_OpenAudio(&wanted, NULL) < 0) {
+ if (SDL_OpenAudio(&wanted, &have) < 0) {
printf("Couldn't open audio: %s\n", SDL_GetError());
goto err;
}
+ if (have.format != wanted.format) {
+ printf("Couldn't select required audio format\n");
+ goto err;
+ }
sdl.audio_active = true;
sdl.sample_rate = wanted.freq;
sdl.cur_buf = 0;
- sdl.running = 0;
+ sdl.running = false;
return 0;
buf->pos = 0;
if (!sdl.running) {
SDL_PauseAudio(0);
- sdl.running = 1;
+ sdl.running = true;
+ sdl.stopping = false;
}
return 0;
int sandbox_sdl_sound_stop(void)
{
if (sdl.running) {
+ while (!sdl.stopping)
+ SDL_Delay(100);
+
SDL_PauseAudio(1);
sdl.running = 0;
+ sdl.stopping = false;
}
return 0;
#include <errno.h>
#include <os.h>
#include <cli.h>
-#include <malloc.h>
+#include <sort.h>
#include <asm/getopt.h>
#include <asm/io.h>
+#include <asm/malloc.h>
#include <asm/sections.h>
#include <asm/state.h>
+#include <linux/ctype.h>
DECLARE_GLOBAL_DATA_PTR;
+/* Compare two options so that they can be sorted into alphabetical order */
+static int h_compare_opt(const void *p1, const void *p2)
+{
+ const struct sandbox_cmdline_option *opt1 = p1;
+ const struct sandbox_cmdline_option *opt2 = p2;
+ const char *str1, *str2;
+ char flag1[2], flag2[2];
+
+ opt1 = *(struct sandbox_cmdline_option **)p1;
+ opt2 = *(struct sandbox_cmdline_option **)p2;
+ flag1[1] = '\0';
+ flag2[1] = '\0';
+
+ *flag1 = opt1->flag_short < 0x100 ? opt1->flag_short : '\0';
+ *flag2 = opt2->flag_short < 0x100 ? opt2->flag_short : '\0';
+
+ str1 = *flag1 ? flag1 : opt1->flag;
+ str2 = *flag2 ? flag2 : opt2->flag;
+
+ /*
+ * Force lower-case flags to come before upper-case ones. We only
+ * support upper-case for short flags.
+ */
+ if (isalpha(*str1) && isalpha(*str2) &&
+ tolower(*str1) == tolower(*str2))
+ return isupper(*str1) - isupper(*str2);
+
+ return strcasecmp(str1, str2);
+}
+
int sandbox_early_getopt_check(void)
{
struct sandbox_state *state = state_get_current();
size_t num_options = __u_boot_sandbox_option_count();
size_t i;
int max_arg_len, max_noarg_len;
+ struct sandbox_cmdline_option **sorted_opt;
+ int size;
/* parse_err will be a string of the faulting option */
if (!state->parse_err)
max_arg_len = max((int)strlen(sb_opt[i]->flag), max_arg_len);
max_noarg_len = max_arg_len + 7;
+ /* Sort the options */
+ size = sizeof(*sorted_opt) * num_options;
+ sorted_opt = malloc(size);
+ if (!sorted_opt) {
+ printf("No memory to sort options\n");
+ os_exit(1);
+ }
+ memcpy(sorted_opt, sb_opt, size);
+ qsort(sorted_opt, num_options, sizeof(*sorted_opt), h_compare_opt);
+
for (i = 0; i < num_options; ++i) {
- struct sandbox_cmdline_option *opt = sb_opt[i];
+ struct sandbox_cmdline_option *opt = sorted_opt[i];
/* first output the short flag if it has one */
if (opt->flag_short >= 0x100)
int len;
len = strlen(state->argv[0]) + strlen(fmt) + 1;
- fname = os_malloc(len);
+ fname = malloc(len);
if (!fname)
return -ENOMEM;
snprintf(fname, len, fmt, state->argv[0]);
int len;
len = strlen(state->argv[0]) + strlen(fmt) + 1;
- fname = os_malloc(len);
+ fname = malloc(len);
if (!fname)
return -ENOMEM;
strcpy(fname, state->argv[0]);
SANDBOX_CMDLINE_OPT_SHORT(show_lcd, 'l', 0,
"Show the sandbox LCD display");
+static int sandbox_cmdline_cb_double_lcd(struct sandbox_state *state,
+ const char *arg)
+{
+ state->double_lcd = true;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(double_lcd, 'K', 0,
+ "Double the LCD display size in each direction");
+
static const char *term_args[STATE_TERM_COUNT] = {
"raw-with-sigs",
"raw",
}
SANDBOX_CMDLINE_OPT(show_of_platdata, 0, "Show of-platdata in SPL");
-int board_run_command(const char *cmdline)
-{
- printf("## Commands are disabled. Please enable CONFIG_CMDLINE.\n");
-
- return 1;
-}
-
static void setup_ram_buf(struct sandbox_state *state)
{
/* Zero the RAM buffer if we didn't read it, to keep valgrind happy */
#include <errno.h>
#include <fdtdec.h>
#include <os.h>
+#include <asm/malloc.h>
#include <asm/state.h>
/* Main state record for the sandbox */
static int state_ensure_space(int extra_size)
{
void *blob = state->state_fdt;
- int used, size, free;
+ int used, size, free_bytes;
void *buf;
int ret;
used = fdt_off_dt_strings(blob) + fdt_size_dt_strings(blob);
size = fdt_totalsize(blob);
- free = size - used;
- if (free > extra_size)
+ free_bytes = size - used;
+ if (free_bytes > extra_size)
return 0;
size = used + extra_size;
- buf = os_malloc(size);
+ buf = malloc(size);
if (!buf)
return -ENOMEM;
ret = fdt_open_into(blob, buf, size);
if (ret) {
- os_free(buf);
+ free(buf);
return -EIO;
}
- os_free(blob);
+ free(blob);
state->state_fdt = buf;
return 0;
}
printf("Cannot find sandbox state file '%s'\n", fname);
return -ENOENT;
}
- state->state_fdt = os_malloc(size);
+ state->state_fdt = malloc(size);
if (!state->state_fdt) {
puts("No memory to read sandbox state\n");
return -ENOMEM;
err_read:
os_close(fd);
err_open:
- os_free(state->state_fdt);
+ free(state->state_fdt);
state->state_fdt = NULL;
return ret;
/* Create a state FDT if we don't have one */
if (!state->state_fdt) {
size = 0x4000;
- state->state_fdt = os_malloc(size);
+ state->state_fdt = malloc(size);
if (!state->state_fdt) {
puts("No memory to create FDT\n");
return -ENOMEM;
err_write:
os_close(fd);
err_create:
- os_free(state->state_fdt);
+ free(state->state_fdt);
return ret;
}
os_unlink(state->jumped_fname);
if (state->state_fdt)
- os_free(state->state_fdt);
+ free(state->state_fdt);
memset(state, '\0', sizeof(*state));
return 0;
compatible = "sandbox,lcd-sdl";
xres = <1366>;
yres = <768>;
+ log2-depth = <5>;
};
leds {
chosen {
#address-cells = <1>;
#size-cells = <1>;
+ setting = "sunrise ohoka";
+ other-node = "/some-bus/c-test@5";
+ int-values = <0x1937 72993>;
chosen-test {
compatible = "denx,u-boot-fdt-test";
reg = <9 1>;
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Sandbox access to system malloc (i.e. not U-Boot's)
+ *
+ * Copyright 2020 Google LLC
+ */
+
+#ifndef __ASM_MALLOC_H
+
+void *malloc(size_t size);
+void free(void *ptr);
+void *calloc(size_t nmemb, size_t size);
+void *realloc(void *ptr, size_t size);
+void *reallocarray(void *ptr, size_t nmemb, size_t size);
+
+/*
+ * This header allows calling the system allocation routines. It makes no
+ * sense to also include U-Boot's malloc.h since that redfines malloc to
+ * have a 'dl' prefix. These two implementations cannot be mixed and matched
+ * in the same file.
+ */
+#ifdef __MALLOC_H__
+#error "This sandbox header file cannot be included with malloc.h"
+#endif
+
+#endif
* @height Window height in pixels
* @log2_bpp: Log to base 2 of the number of bits per pixel. So a 32bpp
* display will pass 5, since 2*5 = 32
+ * @double_size: true to double the visible size in each direction for high-DPI
+ * displays
* @return 0 if OK, -ENODEV if no device, -EIO if SDL failed to initialize
* and -EPERM if the video failed to come up.
*/
-int sandbox_sdl_init_display(int width, int height, int log2_bpp);
+int sandbox_sdl_init_display(int width, int height, int log2_bpp,
+ bool double_size);
/**
* sandbox_sdl_sync() - Sync current U-Boot LCD frame buffer to SDL
int sandbox_sdl_sound_init(int rate, int channels);
#else
-static inline int sandbox_sdl_init_display(int width, int height,
- int log2_bpp)
+static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp,
+ bool double_size)
{
return -ENODEV;
}
bool write_state; /* Write sandbox state on exit */
bool ignore_missing_state_on_read; /* No error if state missing */
bool show_lcd; /* Show LCD on start-up */
+ bool double_lcd; /* Double display size for high-DPI */
enum sysreset_t last_sysreset; /* Last system reset type */
bool sysreset_allowed[SYSRESET_COUNT]; /* Allowed system reset types */
enum state_terminal_raw term_raw; /* Terminal raw/cooked */
*/
int sandbox_get_setup_called(struct udevice *dev);
+/**
+ * sandbox_get_sound_active() - Returns whether sound play is in progress
+ *
+ * @return true if active, false if not
+ */
+int sandbox_get_sound_active(struct udevice *dev);
+
/**
* sandbox_get_sound_sum() - Read back the sum of the sound data so far
*
#include <binman.h>
#include <dm.h>
#include <irq.h>
+#include <malloc.h>
#include <asm/intel_pinctrl.h>
#include <asm/io.h>
#include <asm/intel_regs.h>
#include <common.h>
#include <binman_sym.h>
#include <dm.h>
+#include <malloc.h>
#include <spi.h>
#include <spl.h>
#include <spi_flash.h>
#include <common.h>
#include <dm.h>
#include <dt-structs.h>
+#include <malloc.h>
#include <ns16550.h>
#include <spl.h>
#include <asm/io.h>
#include <dm.h>
#include <dt-structs.h>
#include <irq.h>
+#include <malloc.h>
#include <p2sb.h>
#include <spl.h>
#include <asm/itss.h>
#include <common.h>
#include <env_internal.h>
+#include <malloc.h>
#include <asm/e820.h>
#include <asm/arch/qemu.h>
#include <common.h>
#include <cpu.h>
#include <dm.h>
+#include <malloc.h>
#include <qfw.h>
#include <dm/lists.h>
#include <dm/uclass-internal.h>
#include <common.h>
#include <acpi_s3.h>
+#include <malloc.h>
#include <vbe.h>
#include <asm/coreboot_tables.h>
#include <asm/e820.h>
#include <acpi_s3.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <rtc.h>
#include <asm/cmos_layout.h>
#include <asm/early_cmos.h>
#include <dm.h>
#include <errno.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <net.h>
#include <spi.h>
#include <spi_flash.h>
*/
#include <common.h>
+#include <malloc.h>
#include <smbios.h>
#include <asm/sfi.h>
#include <asm/mpspec.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/bootm.h>
#include <asm/gpio.h>
#include <asm/setup.h>
* Frederik Kriewitz <frederik@kriewitz.eu>
*/
#include <common.h>
+#include <malloc.h>
#include <twl4030.h>
#include <status_led.h>
#include <asm/io.h>
#include <env_internal.h>
#include <init.h>
#include <led.h>
+#include <malloc.h>
#include <net.h>
#include <spi.h>
#include <spi_flash.h>
*/
#include "vpd_reader.h"
+#include <malloc.h>
#include <i2c.h>
#include <linux/bch.h>
#include <dm.h>
#include <asm/arch-rockchip/clock.h>
#include <dt-bindings/clock/rk3288-cru.h>
+#include <linux/err.h>
#include <power/regulator.h>
/*
* Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
*/
+#include <common.h>
#include <cpu_func.h>
#include <dm.h>
-#include <common.h>
#include <init.h>
#include <asm/io.h>
#include <dm/platform_data/serial_pl01x.h>
#include <env.h>
#include <errno.h>
#include <init.h>
+#include <malloc.h>
#include <serial.h>
#include <spl.h>
#include <asm/arch/cpu.h>
*/
#include <common.h>
#include <env.h>
+#include <malloc.h>
#include <status_led.h>
#include <dm.h>
#include <ns16550.h>
#include <common.h>
#include <dm.h>
#include <init.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h>
#include <common.h>
#include <dm.h>
#include <clk.h>
+#include <malloc.h>
#include <dt-bindings/clock/microchip,clock.h>
#include <mach/pic32.h>
#include <common.h>
#include <dm.h>
#include <env.h>
+#include <malloc.h>
#include <ns16550.h>
#include <netdev.h>
#include <twl4030.h>
#include <common.h>
#include <env.h>
#include <errno.h>
+#include <malloc.h>
#include <serial.h>
#include <spl.h>
#include <asm/arch/cpu.h>
#include <env.h>
#include <errno.h>
#include <init.h>
+#include <malloc.h>
#include <spl.h>
#include <asm/arch/cpu.h>
#include <asm/arch/hardware.h>
#include <env.h>
#include <errno.h>
#include <init.h>
+#include <malloc.h>
#include <spi.h>
#include <spl.h>
#include <asm/arch/cpu.h>
#include <i2c.h>
#include <init.h>
#include <led.h>
+#include <malloc.h>
#include <memalign.h>
#include <misc.h>
#include <mtd.h>
#include <asm/arch/stm32.h>
#include <asm/arch/sys_proto.h>
#include <jffs2/load_kernel.h>
+#include <linux/err.h>
#include <power/regulator.h>
#include <usb/dwc2_udc.h>
*/
#include <clk.h>
+#include <malloc.h>
#include <dm/device.h>
#include "clk-lib.h"
* Tapani Utriainen <linuxfae@technexion.com>
*/
#include <common.h>
+#include <malloc.h>
#include <netdev.h>
#include <twl4030.h>
#include <asm/io.h>
static int setup_boottargets(void)
{
const char *boot_device =
- ofnode_get_chosen_prop("u-boot,spl-boot-device");
+ ofnode_read_chosen_string("u-boot,spl-boot-device");
char *env_default, *env;
if (!boot_device) {
#include <env.h>
#include <errno.h>
#include <init.h>
+#include <malloc.h>
#include <spl.h>
#include <serial.h>
#include <asm/arch/cpu.h>
#include <env.h>
#include <fdt_support.h>
#include <init.h>
+#include <malloc.h>
#include <palmas.h>
#include <sata.h>
#include <serial.h>
#include <common.h>
#include <dm.h>
#include <env.h>
+#include <malloc.h>
#include <ns16550.h>
#include <twl4030.h>
#include <asm/io.h>
return -ENODEV;
debug("%s: Path to EEPROM %s\n", __func__,
- ofnode_get_chosen_prop("xlnx,eeprom"));
+ ofnode_read_chosen_string("xlnx,eeprom"));
ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, eeprom, &dev);
if (ret)
#include <efi_selftest.h>
#include <env.h>
#include <errno.h>
+#include <malloc.h>
#include <linux/libfdt.h>
#include <linux/libfdt_env.h>
#include <mapmem.h>
return 0;
}
+static int do_dm_dump_drivers(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ dm_dump_drivers();
+
+ return 0;
+}
+
static cmd_tbl_t test_commands[] = {
U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""),
U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""),
U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
+ U_BOOT_CMD_MKENT(drivers, 1, 1, do_dm_dump_drivers, "", ""),
};
static __maybe_unused void dm_reloc(void)
"Driver model low level access",
"tree Dump driver model tree ('*' = activated)\n"
"dm uclass Dump list of instances for each uclass\n"
- "dm devres Dump list of device resources for each device"
+ "dm devres Dump list of device resources for each device\n"
+ "dm drivers Dump list of drivers and their compatible strings\n"
);
#include <command.h>
#include <errno.h>
#include <dm.h>
+#include <malloc.h>
#include <asm/gpio.h>
+#include <linux/err.h>
__weak int name_to_gpio(const char *name)
{
#include <div64.h>
#include <memalign.h>
#include <linux/compat.h>
+#include <linux/err.h>
#include <linux/sizes.h>
#include <stdlib.h>
#include <fs.h>
#include <part.h>
#include <sandboxblockdev.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
static int host_curr_device = -1;
#include <malloc.h>
#include <mapmem.h>
#include <mtd.h>
+#include <dm/devres.h>
+#include <linux/err.h>
#include <linux/ctype.h>
#include <command.h>
#include <dm.h>
#include <hexdump.h>
+#include <malloc.h>
#include <rng.h>
static int do_rng(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#include <command.h>
#include <dm.h>
#include <env.h>
+#include <malloc.h>
#include <asm/unaligned.h>
#include <linux/string.h>
#include <tpm-common.h>
#include "tpm-user-utils.h"
+static struct udevice *tpm_dev;
+
/**
* Print a byte string in hexdecimal format, 16-bytes per line.
*
return 0;
}
+static int tpm_show_device(void)
+{
+ struct udevice *dev;
+ char buf[80];
+ int n = 0, rc;
+
+ for_each_tpm_device(dev) {
+ rc = tpm_get_desc(dev, buf, sizeof(buf));
+ if (rc < 0)
+ printf("device %d: can't get info\n", n);
+ else
+ printf("device %d: %s\n", n, buf);
+
+ n++;
+ };
+
+ return 0;
+}
+
+static int tpm_set_device(unsigned long num)
+{
+ struct udevice *dev;
+ unsigned long n = 0;
+ int rc = CMD_RET_FAILURE;
+
+ for_each_tpm_device(dev) {
+ if (n == num) {
+ rc = 0;
+ break;
+ }
+
+ n++;
+ }
+
+ if (!rc)
+ tpm_dev = dev;
+
+ return rc;
+}
+
int get_tpm(struct udevice **devp)
{
int rc;
- rc = uclass_first_device_err(UCLASS_TPM, devp);
- if (rc) {
- printf("Could not find TPM (ret=%d)\n", rc);
- return CMD_RET_FAILURE;
+ /*
+ * To keep a backward compatibility with previous code,
+ * if a tpm device is not explicitly set, we set the first one.
+ */
+ if (!tpm_dev) {
+ rc = tpm_set_device(0);
+ if (rc) {
+ printf("Couldn't set TPM 0 (rc = %d)\n", rc);
+ return CMD_RET_FAILURE;
+ }
}
+ if (devp)
+ *devp = tpm_dev;
+
return 0;
}
+int do_tpm_device(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+ unsigned long num;
+ int rc;
+
+ if (argc == 2) {
+ num = simple_strtoul(argv[1], NULL, 10);
+
+ rc = tpm_set_device(num);
+ if (rc)
+ printf("Couldn't set TPM %lu (rc = %d)\n", num, rc);
+ } else {
+ rc = tpm_show_device();
+ }
+
+ return rc;
+}
+
int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
struct udevice *dev;
int type_string_write_vars(const char *type_str, u8 *data, char * const vars[]);
int get_tpm(struct udevice **devp);
+int do_tpm_device(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
int do_tpm_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
TPM_COMMAND_NO_ARG(tpm_physical_disable)
static cmd_tbl_t tpm1_commands[] = {
+ U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""),
U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""),
U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""),
U_BOOT_CMD_MKENT(startup, 0, 1,
"cmd args...\n"
" - Issue TPM command <cmd> with arguments <args...>.\n"
"Admin Startup and State Commands:\n"
+" device [num device]\n"
+" - Show all devices or set the specified device\n"
" info - Show information about the TPM\n"
" init\n"
" - Put TPM into a state where it waits for 'startup' command.\n"
}
static cmd_tbl_t tpm2_commands[] = {
+ U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""),
U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""),
U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""),
U_BOOT_CMD_MKENT(startup, 0, 1, do_tpm2_startup, "", ""),
U_BOOT_CMD(tpm2, CONFIG_SYS_MAXARGS, 1, do_tpm, "Issue a TPMv2.x command",
"<command> [<arguments>]\n"
"\n"
+"device [num device]\n"
+" Show all devices or set the specified device\n"
"info\n"
" Show information about the TPM.\n"
"init\n"
#include <command.h>
#include <env.h>
#include <exports.h>
+#include <malloc.h>
#include <memalign.h>
#include <mtd.h>
#include <nand.h>
#include <onenand_uboot.h>
+#include <dm/devres.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/err.h>
#include <command.h>
#include <console.h>
#include <g_dnl.h>
+#include <malloc.h>
#include <part.h>
#include <usb.h>
#include <usb_mass_storage.h>
#include <env.h>
#include <gzip.h>
#include <image.h>
+#include <malloc.h>
#include <mapmem.h>
#include <watchdog.h>
#if defined(CONFIG_BZIP2)
#include <common.h>
#include <android_ab.h>
#include <android_bootloader_message.h>
+#include <malloc.h>
#include <linux/err.h>
#include <memalign.h>
#include <u-boot/crc.h>
#include <env.h>
#include <fdtdec.h>
#include <hash.h>
+#include <malloc.h>
#include <memalign.h>
#include <menu.h>
#include <post.h>
struct bloblist_rec *rec;
int new_alloced;
- new_alloced = hdr->alloced + sizeof(*rec) +
- ALIGN(size, BLOBLIST_ALIGN);
+ new_alloced = hdr->alloced + sizeof(*rec) + ALIGN(size, BLOBLIST_ALIGN);
if (new_alloced >= hdr->size) {
log(LOGC_BLOBLIST, LOGL_ERR,
- "Failed to allocate %x bytes size=%x, need size>=%x\n",
+ "Failed to allocate %x bytes size=%x, need size=%x\n",
size, hdr->size, new_alloced);
return log_msg_ret("bloblist add", -ENOSPC);
}
rec->hdr_size = sizeof(*rec);
rec->size = size;
rec->spare = 0;
+
+ /* Zero the record data */
+ memset(rec + 1, '\0', rec->size);
*recp = rec;
return 0;
rec = bloblist_findrec(tag);
if (rec) {
- if (size && size != rec->size)
+ if (size && size != rec->size) {
+ *recp = rec;
return -ESPIPE;
+ }
} else {
int ret;
return (void *)rec + rec->hdr_size;
}
+int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp)
+{
+ struct bloblist_rec *rec;
+ int ret;
+
+ ret = bloblist_ensurerec(tag, &rec, *sizep);
+ if (ret == -ESPIPE)
+ *sizep = rec->size;
+ else if (ret)
+ return ret;
+ *blobp = (void *)rec + rec->hdr_size;
+
+ return 0;
+}
+
static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr)
{
struct bloblist_rec *rec;
return 0;
#endif
}
+#else
+__weak int board_run_command(const char *cmdline)
+{
+ printf("## Commands are disabled. Please enable CONFIG_CMDLINE.\n");
+
+ return 1;
+}
#endif /* CONFIG_CMDLINE */
int run_command_list(const char *cmd, int len, int flag)
console_record_reset();
gd->flags |= GD_FLG_RECORD;
}
+
+int console_record_readline(char *str, int maxlen)
+{
+ return membuff_readline(&gd->console_out, str, maxlen, ' ');
+}
+
+int console_record_avail(void)
+{
+ return membuff_avail(&gd->console_out);
+}
+
#endif
/* test if ctrl-c was pressed */
#include <common.h>
#include <exports.h>
+#include <malloc.h>
#include <spi.h>
#include <i2c.h>
#include <env.h>
#include <errno.h>
#include <image.h>
+#include <malloc.h>
#include <linux/libfdt.h>
#include <mapmem.h>
#include <asm/io.h>
/* check if this subnode has a reg property */
ret = fdt_get_resource(fdt_blob, subnode, "reg", 0,
&res);
- if (!ret) {
+ if (!ret && fdtdec_get_is_enabled(fdt_blob, subnode)) {
addr = res.start;
size = res.end - res.start + 1;
boot_fdt_reserve_region(lmb, addr, size);
#include <common.h>
#include <cpu_func.h>
#include <env.h>
+#include <malloc.h>
#include <u-boot/crc.h>
#include <watchdog.h>
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <malloc.h>
#include <memalign.h>
#include <asm/processor.h>
#include <linux/compiler.h>
#include <dm.h>
#include <env.h>
#include <errno.h>
+#include <malloc.h>
#include <memalign.h>
#include <asm/processor.h>
#include <asm/unaligned.h>
API
---
-Bloblist provides a fairly simple API which allows blobs to be created and
-found. All access is via the blob's tag.
+Bloblist provides a fairly simple API which allows blobs to be created and
+found. All access is via the blob's tag. Blob records are zeroed when added.
Finishing the bloblist
./u-boot
Note: If you get errors about 'sdl-config: Command not found' you may need to
-install libsdl1.2-dev or similar to get SDL support. Alternatively you can
+install libsdl2.0-dev or similar to get SDL support. Alternatively you can
build sandbox without SDL (i.e. no display/keyboard support) by removing
the CONFIG_SANDBOX_SDL line in include/configs/sandbox.h or using::
===========
This uses the displaymode.txt binding except that only xres and yres are
-required properties.
+required properties. Also an additional optional property is defined:
+
+log2-depth: Log base 2 of the U-Boot display buffer depth (4=16bpp, 5=32bpp).
+ If not provided, a value of 4 is used.
Example:
compatible = "sandbox,lcd-sdl";
xres = <800>;
yres = <600>;
+ log2-depth = <5>;
};
driver name is the same as the first compatible string in the device tree (with
invalid-variable characters converted to underscore).
-If you are really stuck, #define DEBUG at the top of lists.c should show you
-what is going on.
+If you are really stuck, putting '#define LOG_DEBUG' at the top of
+drivers/core/lists.c should show you what is going on.
#include <dm.h>
#include <errno.h>
#include <asm/io.h>
+#include <linux/err.h>
#define SARADC_CTRL_CHN_MASK GENMASK(2, 0)
#define SARADC_CTRL_POWER_CTRL BIT(3)
#include <common.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <power/regulator.h>
#include "stm32-adc-core.h"
#include <common.h>
#include <adc.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/iopoll.h>
#include "stm32-adc-core.h"
#include <common.h>
#include <axi.h>
#include <dm.h>
+#include <malloc.h>
/**
* struct sandbox_store_priv - Private data structure of a AXI store device
#include <common.h>
#include <blk.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <dm/uclass-internal.h>
+#include <linux/err.h>
static const char *if_typename_str[IF_TYPE_COUNT] = {
[IF_TYPE_IDE] = "ide",
#include <os.h>
#include <malloc.h>
#include <sandboxblockdev.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <dm/device-internal.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/lists.h>
#include <dm/util.h>
#include <asm/arch/scu_ast2500.h>
#include <dm/lists.h>
#include <dt-bindings/clock/ast2500-scu.h>
+#include <linux/err.h>
/*
* MAC Clock Delay settings, taken from Aspeed SDK
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <malloc.h>
+#include <linux/err.h>
#include <linux/io.h>
#include <mach/at91_pmc.h>
#include "pmc.h"
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/util.h>
#include <linux/io.h>
#include <mach/at91_pmc.h>
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <malloc.h>
#include <linux/io.h>
#include <mach/at91_pmc.h>
#include "pmc.h"
#include <common.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <linux/err.h>
#include <linux/io.h>
#include <mach/at91_pmc.h>
#include "pmc.h"
#include <errno.h>
#include <clk-uclass.h>
#include <i2c.h>
+#include <dm/device_compat.h>
#define MAX_NUMBER_OF_PLLS 4
#define MAX_NUMER_OF_OUTPUTS 9
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
#include <clk.h>
+#include <linux/err.h>
#include "clk.h"
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <dm/uclass.h>
#include <dm/lists.h>
#include <dm/device-internal.h>
#include <linux/clk-provider.h>
+#include <linux/err.h>
#include <linux/log2.h>
#include <div64.h>
#include <clk.h>
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
#include <div64.h>
#include <clk.h>
#include "clk.h"
+#include <linux/err.h>
#define UBOOT_DM_CLK_IMX_FIXED_FACTOR "ccf_clk_fixed_factor"
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
#include <clk.h>
#include "clk.h"
+#include <linux/err.h>
#define UBOOT_DM_CLK_GATE "clk_gate"
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
#include <clk.h>
#include "clk.h"
+#include <linux/err.h>
#define UBOOT_DM_CLK_CCF_MUX "ccf_clk_mux"
#include <dm.h>
#include <errno.h>
#include <clk-uclass.h>
+#include <malloc.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/soc/ti/ti_sci_protocol.h>
#include <k3-avs.h>
static struct clk_ops ti_sci_clk_ops = {
.of_xlate = ti_sci_clk_of_xlate,
.request = ti_sci_clk_request,
- .free = ti_sci_clk_free,
+ .rfree = ti_sci_clk_free,
.get_rate = ti_sci_clk_get_rate,
.set_rate = ti_sci_clk_set_rate,
.set_parent = ti_sci_clk_set_parent,
#include <clk.h>
#include <clk-uclass.h>
#include <dm.h>
-#include <dm/read.h>
#include <dt-structs.h>
#include <errno.h>
+#include <malloc.h>
+#include <dm/devres.h>
+#include <dm/read.h>
#include <linux/clk-provider.h>
+#include <linux/err.h>
static inline const struct clk_ops *clk_dev_ops(struct udevice *dev)
{
return 0;
ops = clk_dev_ops(clk->dev);
- if (!ops->free)
+ if (!ops->rfree)
return 0;
- return ops->free(clk);
+ return ops->rfree(clk);
}
ulong clk_get_rate(struct clk *clk)
#include <clk-uclass.h>
#include <div64.h>
#include <dm.h>
+#include <linux/err.h>
struct clk_fixed_factor {
struct clk parent;
#include <clk-uclass.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <asm/clk.h>
struct sandbox_clk_priv {
.enable = sandbox_clk_enable,
.disable = sandbox_clk_disable,
.request = sandbox_clk_request,
- .free = sandbox_clk_free,
+ .rfree = sandbox_clk_free,
};
static int sandbox_clk_probe(struct udevice *dev)
#include <common.h>
#include <dm.h>
#include <clk.h>
+#include <malloc.h>
#include <asm/clk.h>
#include <clk-uclass.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
#include <sandbox-clk.h>
+#include <linux/err.h>
/*
* Sandbox implementation of CCF primitives necessary for clk-uclass testing
#include <common.h>
#include <dm.h>
#include <clk.h>
+#include <malloc.h>
#include <asm/clk.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
struct sandbox_clk_test {
struct clk clks[SANDBOX_CLK_TEST_NON_DEVM_COUNT];
*/
#include <common.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <linux/bitfield.h>
#include <malloc.h>
#include <dm.h>
#include <asm/arch/sys_proto.h>
#include <zynqmp_firmware.h>
+#include <linux/err.h>
#define MAX_PARENT 100
#define MAX_NODES 6
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <errno.h>
#include <misc.h>
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <errno.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <malloc.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <clk-uclass.h>
#include <clk.h>
#include <asm/arch/sys_proto.h>
#include <dm.h>
+#include <linux/err.h>
static const resource_size_t zynqmp_crf_apb_clkc_base = 0xfd1a0020;
static const resource_size_t zynqmp_crl_apb_clkc_base = 0xff5e0020;
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
#include <clk.h>
#include "clk.h"
+#include <linux/err.h>
#define UBOOT_DM_CLK_IMX_COMPOSITE "imx_clk_composite"
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
#include <clk.h>
#include "clk.h"
+#include <linux/err.h>
#define UBOOT_DM_CLK_IMX_GATE2 "imx_clk_gate2"
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <malloc.h>
#include <asm/arch/sci/sci.h>
#include <asm/arch/clock.h>
#include <dt-bindings/clock/imx8qxp-clock.h>
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
#include <div64.h>
#include <clk.h>
#include "clk.h"
+#include <linux/err.h>
#define UBOOT_DM_CLK_IMX_PFD "imx_clk_pfd"
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <linux/clk-provider.h>
+#include <linux/err.h>
#include <linux/iopoll.h>
#include <clk.h>
#include <div64.h>
#include <malloc.h>
#include <clk-uclass.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <dm/uclass.h>
#include <clk.h>
#include "clk.h"
+#include <linux/err.h>
#define UBOOT_DM_CLK_IMX_PLLV3_GENERIC "imx_clk_pllv3_generic"
#define UBOOT_DM_CLK_IMX_PLLV3_SYS "imx_clk_pllv3_sys"
#include <div64.h>
#include <dt-bindings/clock/axg-clkc.h>
#include "clk_meson.h"
+#include <linux/err.h>
#define XTAL_RATE 24000000
#include <syscon.h>
#include <div64.h>
#include <dt-bindings/clock/g12a-clkc.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include "clk_meson.h"
#include <syscon.h>
#include <dt-bindings/clock/gxbb-clkc.h>
#include "clk_meson.h"
+#include <linux/err.h>
/* This driver support only basic clock tree operations :
* - Can calculate clock frequency on a limited tree
#include <dm.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
+#include <dm/device_compat.h>
#define TBG_SEL 0x0
#define DIV_SEL0 0x4
#include <dm.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
+#include <dm/device_compat.h>
#define NUM_TBG 4
#include <clk-uclass.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_px30.h>
#include <clk-uclass.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <syscon.h>
#include <asm/io.h>
#include <asm/arch-rockchip/clock.h>
#include <clk-uclass.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <syscon.h>
#include <asm/io.h>
#include <asm/arch-rockchip/clock.h>
#include <dm.h>
#include <dt-structs.h>
#include <errno.h>
+#include <malloc.h>
#include <mapmem.h>
#include <syscon.h>
#include <asm/io.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <dm/uclass-internal.h>
+#include <linux/err.h>
#include <linux/log2.h>
enum rk3188_clk_type {
#include <clk-uclass.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <syscon.h>
#include <asm/io.h>
#include <asm/arch-rockchip/clock.h>
#include <dm.h>
#include <dt-structs.h>
#include <errno.h>
+#include <malloc.h>
#include <mapmem.h>
#include <syscon.h>
#include <asm/io.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <dm/uclass-internal.h>
+#include <linux/err.h>
#include <linux/log2.h>
DECLARE_GLOBAL_DATA_PTR;
#include <dm.h>
#include <div64.h>
#include <errno.h>
+#include <malloc.h>
#include <syscon.h>
#include <asm/io.h>
#include <asm/arch/cru_rk3308.h>
#include <clk-uclass.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <syscon.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru_rk3328.h>
#include <dm.h>
#include <dt-structs.h>
#include <errno.h>
+#include <malloc.h>
#include <mapmem.h>
#include <syscon.h>
#include <bitfield.h>
#include <dm.h>
#include <dt-structs.h>
#include <errno.h>
+#include <malloc.h>
#include <mapmem.h>
#include <syscon.h>
#include <bitfield.h>
#include <clk-uclass.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <syscon.h>
#include <asm/io.h>
#include <asm/arch-rockchip/clock.h>
#include <div64.h>
#include <dm.h>
#include <errno.h>
+#include <linux/err.h>
#include <linux/math64.h>
#include <linux/clk/analogbits-wrpll-cln28hpc.h>
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <malloc.h>
#include <asm/arch/clock.h>
#include <asm/arch-tegra/clk_rst.h>
static struct clk_ops tegra_car_clk_ops = {
.request = tegra_car_clk_request,
- .free = tegra_car_clk_free,
+ .rfree = tegra_car_clk_free,
.get_rate = tegra_car_clk_get_rate,
.set_rate = tegra_car_clk_set_rate,
.enable = tegra_car_clk_enable,
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/sizes.h>
}
#endif
-int device_get_child(struct udevice *parent, int index, struct udevice **devp)
+int device_get_child(const struct udevice *parent, int index,
+ struct udevice **devp)
{
struct udevice *dev;
return -ENODEV;
}
-int device_get_child_count(struct udevice *parent)
+int device_get_child_count(const struct udevice *parent)
{
struct udevice *dev;
int count = 0;
return count;
}
-int device_find_child_by_seq(struct udevice *parent, int seq_or_req_seq,
+int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq,
bool find_req_seq, struct udevice **devp)
{
struct udevice *dev;
return -ENODEV;
}
-int device_get_child_by_seq(struct udevice *parent, int seq,
+int device_get_child_by_seq(const struct udevice *parent, int seq,
struct udevice **devp)
{
struct udevice *dev;
return device_get_device_tail(dev, ret, devp);
}
-int device_find_child_by_of_offset(struct udevice *parent, int of_offset,
+int device_find_child_by_of_offset(const struct udevice *parent, int of_offset,
struct udevice **devp)
{
struct udevice *dev;
return -ENODEV;
}
-int device_get_child_by_of_offset(struct udevice *parent, int node,
+int device_get_child_by_of_offset(const struct udevice *parent, int node,
struct udevice **devp)
{
struct udevice *dev;
return device_get_device_tail(dev, dev ? 0 : -ENOENT, devp);
}
-int device_find_first_child(struct udevice *parent, struct udevice **devp)
+int device_find_first_child(const struct udevice *parent, struct udevice **devp)
{
if (list_empty(&parent->child_head)) {
*devp = NULL;
return 0;
}
-int device_find_first_inactive_child(struct udevice *parent,
+int device_find_first_inactive_child(const struct udevice *parent,
enum uclass_id uclass_id,
struct udevice **devp)
{
return -ENODEV;
}
-int device_find_first_child_by_uclass(struct udevice *parent,
+int device_find_first_child_by_uclass(const struct udevice *parent,
enum uclass_id uclass_id,
struct udevice **devp)
{
return -ENODEV;
}
-int device_find_child_by_name(struct udevice *parent, const char *name,
+int device_find_child_by_name(const struct udevice *parent, const char *name,
struct udevice **devp)
{
struct udevice *dev;
return -ENODEV;
}
+int device_first_child_err(struct udevice *parent, struct udevice **devp)
+{
+ struct udevice *dev;
+
+ device_find_first_child(parent, &dev);
+ if (!dev)
+ return -ENODEV;
+
+ return device_get_device_tail(dev, 0, devp);
+}
+
+int device_next_child_err(struct udevice **devp)
+{
+ struct udevice *dev = *devp;
+
+ device_find_next_child(&dev);
+ if (!dev)
+ return -ENODEV;
+
+ return device_get_device_tail(dev, 0, devp);
+}
+
+int device_first_child_ofdata_err(struct udevice *parent, struct udevice **devp)
+{
+ struct udevice *dev;
+ int ret;
+
+ device_find_first_child(parent, &dev);
+ if (!dev)
+ return -ENODEV;
+
+ ret = device_ofdata_to_platdata(dev);
+ if (ret)
+ return ret;
+
+ *devp = dev;
+
+ return 0;
+}
+
+int device_next_child_ofdata_err(struct udevice **devp)
+{
+ struct udevice *dev = *devp;
+ int ret;
+
+ device_find_next_child(&dev);
+ if (!dev)
+ return -ENODEV;
+
+ ret = device_ofdata_to_platdata(dev);
+ if (ret)
+ return ret;
+
+ *devp = dev;
+
+ return 0;
+}
+
struct udevice *dev_get_parent(const struct udevice *child)
{
return child->parent;
return !list_empty(&dev->child_head);
}
-bool device_has_active_children(struct udevice *dev)
+bool device_has_active_children(const struct udevice *dev)
{
struct udevice *child;
return false;
}
-bool device_is_last_sibling(struct udevice *dev)
+bool device_is_last_sibling(const struct udevice *dev)
{
struct udevice *parent = dev->parent;
}
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-bool device_is_compatible(struct udevice *dev, const char *compat)
+bool device_is_compatible(const struct udevice *dev, const char *compat)
{
return ofnode_device_is_compatible(dev_ofnode(dev), compat);
}
#define LOG_CATEGORY LOGC_DEVRES
#include <common.h>
+#include <malloc.h>
#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <dm/device.h>
+#include <dm/devres.h>
#include <dm/root.h>
#include <dm/util.h>
puts("\n");
}
}
+
+void dm_dump_drivers(void)
+{
+ struct driver *d = ll_entry_start(struct driver, driver);
+ const int n_ents = ll_entry_count(struct driver, driver);
+ struct driver *entry;
+ const struct udevice_id *match;
+
+ puts("Driver Compatible\n");
+ puts("--------------------------------\n");
+ for (entry = d; entry < d + n_ents; entry++) {
+ for (match = entry->of_match; match->compatible; match++)
+ printf("%-20.20s %s\n",
+ match == entry->of_match ? entry->name : "",
+ match->compatible);
+ if (match == entry->of_match)
+ printf("%-20.20s\n", entry->name);
+ }
+}
DECLARE_GLOBAL_DATA_PTR;
-fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index)
+fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index)
{
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
fdt_addr_t addr;
#endif
}
-fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index,
- fdt_size_t *size)
+fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
+ fdt_size_t *size)
{
#if CONFIG_IS_ENABLED(OF_CONTROL)
/*
#endif
}
-fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name)
+fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name)
{
#if CONFIG_IS_ENABLED(OF_CONTROL)
int index;
#endif
}
-fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name,
- fdt_size_t *size)
+fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
+ const char *name, fdt_size_t *size)
{
#if CONFIG_IS_ENABLED(OF_CONTROL)
int index;
#endif
}
-fdt_addr_t devfdt_get_addr(struct udevice *dev)
+fdt_addr_t devfdt_get_addr(const struct udevice *dev)
{
return devfdt_get_addr_index(dev, 0);
}
-void *devfdt_get_addr_ptr(struct udevice *dev)
+void *devfdt_get_addr_ptr(const struct udevice *dev)
{
return (void *)(uintptr_t)devfdt_get_addr_index(dev, 0);
}
-void *devfdt_remap_addr_index(struct udevice *dev, int index)
+void *devfdt_remap_addr_index(const struct udevice *dev, int index)
{
fdt_addr_t addr = devfdt_get_addr_index(dev, index);
return map_physmem(addr, 0, MAP_NOCACHE);
}
-void *devfdt_remap_addr_name(struct udevice *dev, const char *name)
+void *devfdt_remap_addr_name(const struct udevice *dev, const char *name)
{
fdt_addr_t addr = devfdt_get_addr_name(dev, name);
return map_physmem(addr, 0, MAP_NOCACHE);
}
-void *devfdt_remap_addr(struct udevice *dev)
+void *devfdt_remap_addr(const struct udevice *dev)
{
return devfdt_remap_addr_index(dev, 0);
}
-void *devfdt_map_physmem(struct udevice *dev, unsigned long size)
+void *devfdt_map_physmem(const struct udevice *dev, unsigned long size)
{
fdt_addr_t addr = devfdt_get_addr(dev);
return map_physmem(addr, size, MAP_NOCACHE);
}
-fdt_addr_t devfdt_get_addr_pci(struct udevice *dev)
+fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev)
{
ulong addr;
*/
#include <common.h>
+#include <malloc.h>
#include <linux/libfdt.h>
#include <dm/of_access.h>
#include <linux/ctype.h>
#include <dm.h>
#include <fdtdec.h>
#include <fdt_support.h>
+#include <malloc.h>
#include <linux/libfdt.h>
#include <dm/of_access.h>
#include <dm/of_addr.h>
return prop ? true : false;
}
-const char *ofnode_read_string(ofnode node, const char *propname)
+const void *ofnode_read_prop(ofnode node, const char *propname, int *sizep)
{
- const char *str = NULL;
- int len = -1;
+ const char *val = NULL;
+ int len;
assert(ofnode_valid(node));
debug("%s: %s: ", __func__, propname);
if (ofnode_is_np(node)) {
struct property *prop = of_find_property(
- ofnode_to_np(node), propname, NULL);
+ ofnode_to_np(node), propname, &len);
if (prop) {
- str = prop->value;
+ val = prop->value;
len = prop->length;
}
} else {
- str = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node),
+ val = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node),
propname, &len);
}
- if (!str) {
+ if (!val) {
debug("<not found>\n");
+ if (sizep)
+ *sizep = -FDT_ERR_NOTFOUND;
return NULL;
}
+ if (sizep)
+ *sizep = len;
+
+ return val;
+}
+
+const char *ofnode_read_string(ofnode node, const char *propname)
+{
+ const char *str;
+ int len;
+
+ str = ofnode_read_prop(node, propname, &len);
+ if (!str)
+ return NULL;
+
if (strnlen(str, len) >= len) {
debug("<invalid>\n");
return NULL;
return str;
}
+int ofnode_read_size(ofnode node, const char *propname)
+{
+ int len;
+
+ if (!ofnode_read_prop(node, propname, &len))
+ return -EINVAL;
+
+ return len;
+}
+
ofnode ofnode_find_subnode(ofnode node, const char *subnode_name)
{
ofnode subnode;
return node;
}
-int ofnode_read_size(ofnode node, const char *propname)
-{
- int len;
-
- if (ofnode_is_np(node)) {
- struct property *prop = of_find_property(
- ofnode_to_np(node), propname, NULL);
-
- if (prop)
- return prop->length;
- } else {
- if (fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname,
- &len))
- return len;
- }
-
- return -EINVAL;
-}
-
fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size)
{
int na, ns;
return offset_to_ofnode(fdt_path_offset(gd->fdt_blob, path));
}
-const char *ofnode_get_chosen_prop(const char *name)
+const void *ofnode_read_chosen_prop(const char *propname, int *sizep)
{
ofnode chosen_node;
chosen_node = ofnode_path("/chosen");
- return ofnode_read_string(chosen_node, name);
+ return ofnode_read_prop(chosen_node, propname, sizep);
+}
+
+const char *ofnode_read_chosen_string(const char *propname)
+{
+ return ofnode_read_chosen_prop(propname, NULL);
}
ofnode ofnode_get_chosen_node(const char *name)
{
const char *prop;
- prop = ofnode_get_chosen_prop(name);
+ prop = ofnode_read_chosen_prop(name, NULL);
if (!prop)
return ofnode_null();
#include <mapmem.h>
#include <dm/of_access.h>
-int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp)
+int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp)
{
return ofnode_read_u32(dev_ofnode(dev), propname, outp);
}
-int dev_read_u32_default(struct udevice *dev, const char *propname, int def)
+int dev_read_u32_default(const struct udevice *dev, const char *propname,
+ int def)
{
return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
}
-int dev_read_s32(struct udevice *dev, const char *propname, s32 *outp)
+int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp)
{
return ofnode_read_u32(dev_ofnode(dev), propname, (u32 *)outp);
}
-int dev_read_s32_default(struct udevice *dev, const char *propname, int def)
+int dev_read_s32_default(const struct udevice *dev, const char *propname,
+ int def)
{
return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
}
-int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp)
+int dev_read_u32u(const struct udevice *dev, const char *propname, uint *outp)
{
u32 val;
int ret;
return 0;
}
-int dev_read_u64(struct udevice *dev, const char *propname, u64 *outp)
+int dev_read_u64(const struct udevice *dev, const char *propname, u64 *outp)
{
return ofnode_read_u64(dev_ofnode(dev), propname, outp);
}
-u64 dev_read_u64_default(struct udevice *dev, const char *propname, u64 def)
+u64 dev_read_u64_default(const struct udevice *dev, const char *propname,
+ u64 def)
{
return ofnode_read_u64_default(dev_ofnode(dev), propname, def);
}
-const char *dev_read_string(struct udevice *dev, const char *propname)
+const char *dev_read_string(const struct udevice *dev, const char *propname)
{
return ofnode_read_string(dev_ofnode(dev), propname);
}
-bool dev_read_bool(struct udevice *dev, const char *propname)
+bool dev_read_bool(const struct udevice *dev, const char *propname)
{
return ofnode_read_bool(dev_ofnode(dev), propname);
}
-ofnode dev_read_subnode(struct udevice *dev, const char *subnode_name)
+ofnode dev_read_subnode(const struct udevice *dev, const char *subnode_name)
{
return ofnode_find_subnode(dev_ofnode(dev), subnode_name);
}
-ofnode dev_read_first_subnode(struct udevice *dev)
+ofnode dev_read_first_subnode(const struct udevice *dev)
{
return ofnode_first_subnode(dev_ofnode(dev));
}
return ofnode_next_subnode(node);
}
-int dev_read_size(struct udevice *dev, const char *propname)
+int dev_read_size(const struct udevice *dev, const char *propname)
{
return ofnode_read_size(dev_ofnode(dev), propname);
}
-fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)
+fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index)
{
if (ofnode_is_np(dev_ofnode(dev)))
return ofnode_get_addr_index(dev_ofnode(dev), index);
return devfdt_get_addr_index(dev, index);
}
-fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index,
+fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index,
fdt_size_t *size)
{
if (ofnode_is_np(dev_ofnode(dev)))
return devfdt_get_addr_size_index(dev, index, size);
}
-void *dev_remap_addr_index(struct udevice *dev, int index)
+void *dev_remap_addr_index(const struct udevice *dev, int index)
{
fdt_addr_t addr = dev_read_addr_index(dev, index);
return map_physmem(addr, 0, MAP_NOCACHE);
}
-fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name)
+fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name)
{
int index = dev_read_stringlist_search(dev, "reg-names", name);
return dev_read_addr_index(dev, index);
}
-fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name,
+fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name,
fdt_size_t *size)
{
int index = dev_read_stringlist_search(dev, "reg-names", name);
return dev_read_addr_size_index(dev, index, size);
}
-void *dev_remap_addr_name(struct udevice *dev, const char *name)
+void *dev_remap_addr_name(const struct udevice *dev, const char *name)
{
fdt_addr_t addr = dev_read_addr_name(dev, name);
return map_physmem(addr, 0, MAP_NOCACHE);
}
-fdt_addr_t dev_read_addr(struct udevice *dev)
+fdt_addr_t dev_read_addr(const struct udevice *dev)
{
return dev_read_addr_index(dev, 0);
}
-void *dev_read_addr_ptr(struct udevice *dev)
+void *dev_read_addr_ptr(const struct udevice *dev)
{
fdt_addr_t addr = dev_read_addr(dev);
return (addr == FDT_ADDR_T_NONE) ? NULL : map_sysmem(addr, 0);
}
-void *dev_remap_addr(struct udevice *dev)
+void *dev_remap_addr(const struct udevice *dev)
{
return dev_remap_addr_index(dev, 0);
}
-fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
+fdt_addr_t dev_read_addr_size(const struct udevice *dev, const char *property,
fdt_size_t *sizep)
{
return ofnode_get_addr_size(dev_ofnode(dev), property, sizep);
}
-const char *dev_read_name(struct udevice *dev)
+const char *dev_read_name(const struct udevice *dev)
{
return ofnode_get_name(dev_ofnode(dev));
}
-int dev_read_stringlist_search(struct udevice *dev, const char *property,
+int dev_read_stringlist_search(const struct udevice *dev, const char *property,
const char *string)
{
return ofnode_stringlist_search(dev_ofnode(dev), property, string);
}
-int dev_read_string_index(struct udevice *dev, const char *propname, int index,
- const char **outp)
+int dev_read_string_index(const struct udevice *dev, const char *propname,
+ int index, const char **outp)
{
return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
}
-int dev_read_string_count(struct udevice *dev, const char *propname)
+int dev_read_string_count(const struct udevice *dev, const char *propname)
{
return ofnode_read_string_count(dev_ofnode(dev), propname);
}
-int dev_read_phandle_with_args(struct udevice *dev, const char *list_name,
+int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name,
const char *cells_name, int cell_count,
int index, struct ofnode_phandle_args *out_args)
{
out_args);
}
-int dev_count_phandle_with_args(struct udevice *dev, const char *list_name,
- const char *cells_name)
+int dev_count_phandle_with_args(const struct udevice *dev,
+ const char *list_name, const char *cells_name)
{
return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
cells_name);
}
-int dev_read_addr_cells(struct udevice *dev)
+int dev_read_addr_cells(const struct udevice *dev)
{
return ofnode_read_addr_cells(dev_ofnode(dev));
}
-int dev_read_size_cells(struct udevice *dev)
+int dev_read_size_cells(const struct udevice *dev)
{
return ofnode_read_size_cells(dev_ofnode(dev));
}
-int dev_read_simple_addr_cells(struct udevice *dev)
+int dev_read_simple_addr_cells(const struct udevice *dev)
{
return ofnode_read_simple_addr_cells(dev_ofnode(dev));
}
-int dev_read_simple_size_cells(struct udevice *dev)
+int dev_read_simple_size_cells(const struct udevice *dev)
{
return ofnode_read_simple_size_cells(dev_ofnode(dev));
}
-int dev_read_phandle(struct udevice *dev)
+int dev_read_phandle(const struct udevice *dev)
{
ofnode node = dev_ofnode(dev);
return fdt_get_phandle(gd->fdt_blob, ofnode_to_offset(node));
}
-const void *dev_read_prop(struct udevice *dev, const char *propname, int *lenp)
+const void *dev_read_prop(const struct udevice *dev, const char *propname,
+ int *lenp)
{
return ofnode_get_property(dev_ofnode(dev), propname, lenp);
}
-int dev_read_alias_seq(struct udevice *dev, int *devnump)
+int dev_read_alias_seq(const struct udevice *dev, int *devnump)
{
ofnode node = dev_ofnode(dev);
const char *uc_name = dev->uclass->uc_drv->name;
return ret;
}
-int dev_read_u32_array(struct udevice *dev, const char *propname,
+int dev_read_u32_array(const struct udevice *dev, const char *propname,
u32 *out_values, size_t sz)
{
return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz);
}
-const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, const char *propname,
- size_t sz)
+const uint8_t *dev_read_u8_array_ptr(const struct udevice *dev,
+ const char *propname, size_t sz)
{
return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz);
}
-int dev_read_enabled(struct udevice *dev)
+int dev_read_enabled(const struct udevice *dev)
{
ofnode node = dev_ofnode(dev);
ofnode_to_offset(node));
}
-int dev_read_resource(struct udevice *dev, uint index, struct resource *res)
+int dev_read_resource(const struct udevice *dev, uint index,
+ struct resource *res)
{
return ofnode_read_resource(dev_ofnode(dev), index, res);
}
-int dev_read_resource_byname(struct udevice *dev, const char *name,
+int dev_read_resource_byname(const struct udevice *dev, const char *name,
struct resource *res)
{
return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
}
-u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
+u64 dev_translate_address(const struct udevice *dev, const fdt32_t *in_addr)
{
return ofnode_translate_address(dev_ofnode(dev), in_addr);
}
-u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr)
+u64 dev_translate_dma_address(const struct udevice *dev, const fdt32_t *in_addr)
{
return ofnode_translate_dma_address(dev_ofnode(dev), in_addr);
}
return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
}
-fdt_addr_t dev_read_addr_pci(struct udevice *dev)
+fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
{
ulong addr;
#include <errno.h>
#include <regmap.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <dm/root.h>
#include <linux/err.h>
return -ENODEV;
}
-#if !CONFIG_IS_ENABLED(OF_CONTROL) || \
- CONFIG_IS_ENABLED(OF_PLATDATA) || \
- CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
int uclass_find_next_free_req_seq(enum uclass_id id)
{
struct uclass *uc;
return max + 1;
}
-#endif
int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
bool find_req_seq, struct udevice **devp)
#include <asm/arch/sdram.h>
#include <asm/arch/system_manager.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include "sequencer.h"
#include <asm/arch/system_manager.h>
#include <asm/arch/reset_manager.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/sizes.h>
#define PGTABLE_OFF 0x4000
#include <dfu.h>
#include <mtd.h>
#include <jffs2/load_kernel.h>
+#include <linux/err.h>
static bool mtd_is_aligned_with_block_size(struct mtd_info *mtd, u64 size)
{
#include <cpu_func.h>
#include <dm.h>
#include <dma-uclass.h>
+#include <malloc.h>
#include <memalign.h>
#include <reset.h>
#include <asm/io.h>
#include <common.h>
#include <cpu_func.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/read.h>
#include <dma-uclass.h>
#include <dt-structs.h>
debug("%s(dma=%p)\n", __func__, dma);
- if (!ops->free)
+ if (!ops->rfree)
return 0;
- return ops->free(dma);
+ return ops->rfree(dma);
}
int dma_enable(struct dma *dma)
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/read.h>
#include <dma-uclass.h>
#include <dt-structs.h>
return 0;
}
-static int sandbox_dma_free(struct dma *dma)
+static int sandbox_dma_rfree(struct dma *dma)
{
struct sandbox_dma_dev *ud = dev_get_priv(dma->dev);
struct sandbox_dma_chan *uc;
.transfer = sandbox_dma_transfer,
.of_xlate = sandbox_dma_of_xlate,
.request = sandbox_dma_request,
- .free = sandbox_dma_free,
+ .rfree = sandbox_dma_rfree,
.enable = sandbox_dma_enable,
.disable = sandbox_dma_disable,
.send = sandbox_dma_send,
#include <malloc.h>
#include <asm/dma-mapping.h>
#include <dm.h>
-#include <dm/device.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/read.h>
#include <dm/of_access.h>
#include <dma.h>
#include <linux/delay.h>
#include <dt-bindings/dma/k3-udma.h>
#include <linux/bitmap.h>
+#include <linux/err.h>
#include <linux/soc/ti/k3-navss-ringacc.h>
#include <linux/soc/ti/cppi5.h>
#include <linux/soc/ti/ti-udma.h>
return 0;
}
-static int udma_free(struct dma *dma)
+static int udma_rfree(struct dma *dma)
{
struct udma_dev *ud = dev_get_priv(dma->dev);
struct udma_chan *uc;
.transfer = udma_transfer,
.of_xlate = udma_of_xlate,
.request = udma_request,
- .free = udma_free,
+ .rfree = udma_rfree,
.enable = udma_enable,
.disable = udma_disable,
.send = udma_send,
#include <dm.h>
#include <errno.h>
#include <mailbox.h>
+#include <malloc.h>
#include <dm/device.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/compat.h>
#include <linux/err.h>
#include <linux/soc/ti/k3-sec-proxy.h>
#include <xilinx.h> /* xilinx specific definitions */
#include <altera.h> /* altera specific definitions */
#include <lattice.h>
+#include <dm/device_compat.h>
/* Local definitions */
#ifndef CONFIG_MAX_FPGA_DEVICES
#include <malloc.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <dt-bindings/gpio/gpio.h>
#include <spi.h>
*/
#include <common.h>
+#include <malloc.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <asm/io.h>
#include <linux/sizes.h>
#include <asm/gpio.h>
#include <clk.h>
#include <dm.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <asm/arch/hardware.h>
#include <asm/gpio.h>
#include <mach/gpio.h>
#include <common.h>
#include <dm.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <dt-bindings/gpio/gpio.h>
#include <asm/io.h>
#include <dm.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/lists.h>
#include <dm/root.h>
#include <errno.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
+#include <dm/device_compat.h>
#include <dm/pinctrl.h>
#include <errno.h>
#include <asm/gpio.h>
static const struct dm_gpio_ops rcar_gpio_ops = {
.request = rcar_gpio_request,
- .free = rcar_gpio_free,
+ .rfree = rcar_gpio_free,
.direction_input = rcar_gpio_direction_input,
.direction_output = rcar_gpio_direction_output,
.get_value = rcar_gpio_get_value,
uc_priv = dev_get_uclass_priv(dev);
if (!uc_priv->name[offset])
return -ENXIO;
- if (gpio_get_ops(dev)->free) {
- ret = gpio_get_ops(dev)->free(dev, offset);
+ if (gpio_get_ops(dev)->rfree) {
+ ret = gpio_get_ops(dev)->rfree(dev, offset);
if (ret)
return ret;
}
if (!reloc_done) {
if (ops->request)
ops->request += gd->reloc_off;
- if (ops->free)
- ops->free += gd->reloc_off;
+ if (ops->rfree)
+ ops->rfree += gd->reloc_off;
if (ops->direction_input)
ops->direction_input += gd->reloc_off;
if (ops->direction_output)
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/arch/sysmap.h>
*/
#include <common.h>
+#include <malloc.h>
#include <mpc83xx.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/io.h>
#include <errno.h>
#include <clk.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#define MSCC_SGPIOS_PER_BANK 32
#define MSCC_SGPIO_BANK_DEPTH 4
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <linux/errno.h>
#include "mvgpio.h"
*/
#include <common.h>
+#include <malloc.h>
#include <linux/errno.h>
#include <asm/io.h>
#include <asm/arch/iomux.h>
#include <malloc.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <dt-bindings/gpio/gpio.h>
#define PCA953X_INPUT 0
#include <common.h>
#include <i2c.h>
+#include <malloc.h>
#include <linux/errno.h>
#include <pca9698.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <sh_pfc.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/arch/hardware.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/arch/stm32.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <errno.h>
#include <hwspinlock.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
+#include <linux/compat.h>
static inline const struct hwspinlock_ops *
hwspinlock_dev_ops(struct udevice *dev)
#include <clk.h>
#include <dm.h>
#include <hwspinlock.h>
+#include <malloc.h>
#include <asm/io.h>
#define STM32_MUTEX_COREID BIT(8)
#include <i2c.h>
#include <asm/io.h>
#include <asm/arch/scu_ast2500.h>
+#include <linux/err.h>
#include "ast_i2c.h"
* (C) Copyright 2016 Songjun Wu <songjun.wu@atmel.com>
*/
+#include <malloc.h>
#include <asm/io.h>
#include <common.h>
#include <clk.h>
#include <clk.h>
#include <dm.h>
#include <i2c.h>
+#include <malloc.h>
#include <pci.h>
#include <reset.h>
#include <asm/io.h>
#include "designware_i2c.h"
+#include <dm/device_compat.h>
+#include <linux/err.h>
#ifdef CONFIG_SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED
static int dw_i2c_enable(struct i2c_regs *i2c_base, bool enable)
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*/
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/iopoll.h>
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*/
+#include <dm/device_compat.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <dm.h>
#include <fdtdec.h>
#include <i2c.h>
+#include <dm/device_compat.h>
#define LPI2C_FIFO_SIZE 4
#define LPI2C_NACK_TOUT_MS 1
#include <clk.h>
#include <dm.h>
#include <i2c.h>
+#include <linux/err.h>
#define I2C_TIMEOUT_MS 100
#include <dm.h>
#include <errno.h>
#include <i2c.h>
+#include <malloc.h>
#include <asm/gpio.h>
DECLARE_GLOBAL_DATA_PTR;
#include <asm-generic/gpio.h>
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/pinctrl.h>
#include <fdtdec.h>
#include <i2c.h>
#include <dm.h>
#include <errno.h>
#include <i2c.h>
+#include <malloc.h>
#include <dm/lists.h>
#include <dm/root.h>
#include <dm.h>
#include <errno.h>
#include <i2c.h>
+#include <malloc.h>
#include <asm-generic/gpio.h>
#include <common.h>
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <asm/mach-imx/mxc_i2c.h>
#include <asm/io.h>
#include <i2c.h>
#include <asm/io.h>
#include <wait_bit.h>
+#include <dm/device_compat.h>
#define RCAR_I2C_ICSCR 0x00 /* slave ctrl */
#define RCAR_I2C_ICMCR 0x04 /* master ctrl */
#include <clk.h>
#include <dm.h>
#include <i2c.h>
+#include <malloc.h>
#include <reset.h>
#include <dm/device.h>
#endif
#include <asm/arch/gpio.h>
#include <asm/arch-tegra/tegra_i2c.h>
+#include <linux/err.h>
enum i2c_type {
TYPE_114,
#include <i2c.h>
#include <wait_bit.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
struct xilinx_xiic_priv {
void __iomem *base;
#include <dm.h>
#include <errno.h>
#include <led.h>
+#include <malloc.h>
#include <asm/gpio.h>
#include <dm/lists.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/soc/ti/k3-sec-proxy.h>
struct mbox_ops k3_sec_proxy_mbox_ops = {
.of_xlate = k3_sec_proxy_of_xlate,
.request = k3_sec_proxy_request,
- .free = k3_sec_proxy_free,
+ .rfree = k3_sec_proxy_free,
.send = k3_sec_proxy_send,
.recv = k3_sec_proxy_recv,
};
#include <dm.h>
#include <mailbox.h>
#include <mailbox-uclass.h>
+#include <malloc.h>
#include <time.h>
static inline struct mbox_ops *mbox_dev_ops(struct udevice *dev)
debug("%s(chan=%p)\n", __func__, chan);
- if (ops->free)
- return ops->free(chan);
+ if (ops->rfree)
+ return ops->rfree(chan);
return 0;
}
#include <common.h>
#include <dm.h>
#include <mailbox.h>
+#include <malloc.h>
#include <asm/io.h>
struct sandbox_mbox_test {
#include <common.h>
#include <dm.h>
#include <mailbox-uclass.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/mbox.h>
struct mbox_ops sandbox_mbox_mbox_ops = {
.request = sandbox_mbox_request,
- .free = sandbox_mbox_free,
+ .rfree = sandbox_mbox_free,
.send = sandbox_mbox_send,
.recv = sandbox_mbox_recv,
};
#include <clk.h>
#include <dm.h>
#include <mailbox-uclass.h>
+#include <malloc.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
/*
* IPCC has one set of registers per CPU
struct mbox_ops stm32_ipcc_mbox_ops = {
.request = stm32_ipcc_request,
- .free = stm32_ipcc_free,
+ .rfree = stm32_ipcc_free,
.send = stm32_ipcc_send,
.recv = stm32_ipcc_recv,
};
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <dm.h>
#include <mailbox-uclass.h>
struct mbox_ops tegra_hsp_mbox_ops = {
.of_xlate = tegra_hsp_of_xlate,
.request = tegra_hsp_request,
- .free = tegra_hsp_free,
+ .rfree = tegra_hsp_free,
.send = tegra_hsp_send,
.recv = tegra_hsp_recv,
};
#include <asm/io.h>
#include <dm.h>
#include <mailbox-uclass.h>
+#include <dm/device_compat.h>
#include <mach/sys_proto.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <ec_commands.h>
#include <errno.h>
#include <hash.h>
-#include <malloc.h>
#include <os.h>
#include <u-boot/sha256.h>
#include <spi.h>
+#include <asm/malloc.h>
#include <asm/state.h>
#include <asm/sdl.h>
#include <linux/input.h>
prop = fdt_getprop(blob, node, "flash-data", &len);
if (prop) {
ec->flash_data_len = len;
- ec->flash_data = os_malloc(len);
+ ec->flash_data = malloc(len);
if (!ec->flash_data)
return -ENOMEM;
memcpy(ec->flash_data, prop, len);
ec->flash_data_len != ec->ec_config.flash.length) {
printf("EC data length is %x, expected %x, discarding data\n",
ec->flash_data_len, ec->ec_config.flash.length);
- os_free(ec->flash_data);
+ free(ec->flash_data);
ec->flash_data = NULL;
}
/* Otherwise allocate the memory */
if (!ec->flash_data) {
ec->flash_data_len = ec->ec_config.flash.length;
- ec->flash_data = os_malloc(ec->flash_data_len);
+ ec->flash_data = malloc(ec->flash_data_len);
if (!ec->flash_data)
return -ENOMEM;
}
#include <common.h>
#include <hang.h>
+#include <malloc.h>
#include <asm/io.h>
#include <dm.h>
#include <asm/arch/sci/sci.h>
#include <asm/io.h>
#include <i2c.h>
#include <k3-avs.h>
+#include <dm/device_compat.h>
#include <power/regulator.h>
#define AM6_VTM_DEVINFO(i) (priv->base + 0x100 + 0x20 * (i))
#include <errno.h>
#include <misc.h>
#include <asm/io.h>
+#include <linux/err.h>
struct microchip_flexcom_regs {
u32 cr;
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <mapmem.h>
#include <p2sb.h>
#include <spl.h>
u8 regs[16];
};
-static int sandbox_p2sb_emul_read_config(struct udevice *emul, uint offset,
- ulong *valuep, enum pci_size_t size)
+static int sandbox_p2sb_emul_read_config(const struct udevice *emul,
+ uint offset, ulong *valuep,
+ enum pci_size_t size)
{
struct p2sb_emul_platdata *plat = dev_get_platdata(emul);
#include <misc.h>
#include <stm32_rcc.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
struct stm32_rcc_clk stm32_rcc_clk_f42x = {
char mem_text[MEM_TEXT_SIZE];
};
-static int sandbox_swap_case_use_ea(struct udevice *dev)
+static int sandbox_swap_case_use_ea(const struct udevice *dev)
{
return !!ofnode_get_property(dev->node, "use-ea", NULL);
}
PCI_CAP_EA_SIZE_HI,
};
-static int sandbox_swap_case_read_ea(struct udevice *emul, uint offset,
+static int sandbox_swap_case_read_ea(const struct udevice *emul, uint offset,
ulong *valuep, enum pci_size_t size)
{
u32 reg;
return 0;
}
-static int sandbox_swap_case_read_config(struct udevice *emul, uint offset,
- ulong *valuep, enum pci_size_t size)
+static int sandbox_swap_case_read_config(const struct udevice *emul,
+ uint offset, ulong *valuep,
+ enum pci_size_t size)
{
struct swap_case_platdata *plat = dev_get_platdata(emul);
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <time.h>
#include <dm/lists.h>
#include <dm/root.h>
#include <misc.h>
#include <asm/arch-tegra/bpmp_abi.h>
#include <asm/arch-tegra/ivc.h>
+#include <linux/err.h>
#define BPMP_IVC_FRAME_COUNT 1
#define BPMP_IVC_FRAME_SIZE 128
*/
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/read.h>
#include <asm/io.h>
#include <linux/delay.h>
#include <power-domain.h>
#include <regmap.h>
#include <sdhci.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
/* CTL_CFG Registers */
#define CTL_CFG_2 0x14
#include <errno.h>
#include <malloc.h>
#include <mmc.h>
+#include <dm/device_compat.h>
#include <asm/io.h>
#include <asm-generic/gpio.h>
#include <dm.h>
#include <malloc.h>
#include <sdhci.h>
+#include <linux/err.h>
struct aspeed_sdhci_plat {
struct mmc_config cfg;
#include <asm/arch/msg.h>
#include <asm/arch/mbox.h>
#include <asm/unaligned.h>
+#include <dm/device_compat.h>
#include <linux/compat.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <fdt_support.h>
#include <asm/io.h>
#include <dm.h>
+#include <dm/device_compat.h>
DECLARE_GLOBAL_DATA_PTR;
#include <hwconfig.h>
#include <mmc.h>
#include <part.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <power/regulator.h>
#include <malloc.h>
#include <fsl_esdhc_imx.h>
#include <asm/io.h>
#include <asm/unaligned.h>
#include <errno.h>
+#include <dm/device_compat.h>
#include <mach/jz4780.h>
#include <wait_bit.h>
#include <mmc.h>
#include <dm.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
+#include <linux/compat.h>
#include "mmc_private.h"
int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <sdhci.h>
#include <wait_bit.h>
#include <asm/io.h>
#include <mapmem.h>
#include <stdbool.h>
#include <asm/gpio.h>
+#include <dm/device_compat.h>
#include <dm/pinctrl.h>
#include <linux/bitops.h>
#include <linux/io.h>
#include <asm/arch/mux.h>
#endif
#include <dm.h>
+#include <dm/devres.h>
+#include <linux/err.h>
#include <power/regulator.h>
#include <thermal.h>
#include <common.h>
#include <clk.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <mmc.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/compat.h>
#include <linux/dma-direction.h>
#include <linux/io.h>
#include <common.h>
#include <dm.h>
#include <dt-structs.h>
+#include <linux/err.h>
#include <linux/libfdt.h>
#include <malloc.h>
#include <mapmem.h>
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/bitfield.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <clk.h>
#include <dm.h>
#include <malloc.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <linux/compat.h>
#include <linux/io.h>
#include <malloc.h>
#include <mmc.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <linux/compat.h>
#include <linux/io.h>
#include <dwmmc.h>
#include <errno.h>
#include <fdtdec.h>
+#include <dm/device_compat.h>
#include <linux/libfdt.h>
#include <linux/err.h>
#include <malloc.h>
#include <dwmmc.h>
#include <errno.h>
#include <fdtdec.h>
+#include <dm/device_compat.h>
#include <linux/libfdt.h>
#include <linux/err.h>
#include <malloc.h>
#include <cpu_func.h>
#include <dm.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <linux/libfdt.h>
#include <mmc.h>
#include <reset.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/arch-tegra/tegra_mmc.h>
+#include <linux/err.h>
struct tegra_mmc_plat {
struct mmc_config cfg;
#include <fdtdec.h>
#include <mmc.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/pinctrl.h>
#include <linux/compat.h>
#include <linux/dma-direction.h>
#include <common.h>
#include <clk.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <mmc.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/compat.h>
#include <linux/dma-direction.h>
#include <linux/io.h>
#include <dm.h>
#include <fdtdec.h>
#include "mmc_private.h"
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/libfdt.h>
#include <malloc.h>
#include <sdhci.h>
#include <dm.h>
#include <regmap.h>
#include <syscon.h>
+#include <dm/device_compat.h>
#define FSS_SYSC_REG 0x4
*/
#include <common.h>
#include <env.h>
+#include <malloc.h>
#include <dm/device.h>
#include <dm/uclass-internal.h>
+#include <linux/err.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <mtd.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ptrace.h>
if (!mtd || section < 0)
return -EINVAL;
- if (!mtd->ooblayout || !mtd->ooblayout->free)
+ if (!mtd->ooblayout || !mtd->ooblayout->rfree)
return -ENOTSUPP;
- return mtd->ooblayout->free(mtd, section, oobfree);
+ return mtd->ooblayout->rfree(mtd, section, oobfree);
}
EXPORT_SYMBOL_GPL(mtd_ooblayout_free);
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#define pr_fmt(fmt) "nand-bbt: " fmt
#include <common.h>
+#include <dm/devres.h>
#include <linux/mtd/nand.h>
#ifndef __UBOOT__
#include <linux/slab.h>
#include <common.h>
#ifndef __UBOOT__
+#include <linux/compat.h>
#include <linux/module.h>
#endif
#include <linux/mtd/nand.h>
#include <common.h>
#include <asm/gpio.h>
#include <asm/arch/gpio.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <malloc.h>
#include <nand.h>
#include <asm/io.h>
#include <memalign.h>
#include <nand.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <asm/io.h>
#include <memalign.h>
#include <nand.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <asm/io.h>
#include <memalign.h>
#include <nand.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <memalign.h>
#include <nand.h>
#include <clk.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
+#include <linux/err.h>
#include <linux/ioport.h>
#include <linux/completion.h>
#include <linux/errno.h>
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
+#include <malloc.h>
+#include <dm/devres.h>
#include "brcmnand_compat.h"
static char *devm_kvasprintf(struct udevice *dev, gfp_t gfp, const char *fmt,
#include <asm/dma-mapping.h>
#include <dm.h>
+#include <malloc.h>
#include <nand.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/bitfield.h>
#include <linux/dma-direction.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/mtd/mtd.h>
static const struct mtd_ooblayout_ops denali_ooblayout_ops = {
.ecc = denali_ooblayout_ecc,
- .free = denali_ooblayout_free,
+ .rfree = denali_ooblayout_free,
};
static int denali_multidev_fixup(struct denali_nand_info *denali)
#include <clk.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/printk.h>
#include <command.h>
#include <malloc.h>
#include <nand.h>
+#include <dm/devres.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <command.h>
#include <malloc.h>
#include <nand.h>
+#include <dm/devres.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <nand.h>
#include <malloc.h>
#include <mxs_nand.h>
+#include <linux/err.h>
static struct mtd_info *mtd;
static struct nand_chip nand_chip;
#endif
#include <malloc.h>
#include <watchdog.h>
+#include <dm/devres.h>
#include <linux/err.h>
#include <linux/compat.h>
#include <linux/mtd/mtd.h>
#include <common.h>
#include <malloc.h>
+#include <dm/devres.h>
#include <linux/compat.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/bbm.h>
*/
#include <common.h>
+#include <dm/devres.h>
/*#include <asm/io.h>*/
#include <linux/types.h>
*
*/
#include <common.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/mtd/rawnand.h>
#include <malloc.h>
#include <memalign.h>
#include <div64.h>
+#include <dm/devres.h>
#include <linux/errno.h>
#include <linux/mtd/mtd.h>
#include <malloc.h>
#include <fdtdec.h>
#include <nand.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <dm.h>
#include <nand.h>
#include <reset.h>
+#include <linux/err.h>
#include <linux/iopoll.h>
#include <linux/ioport.h>
#include <common.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <memalign.h>
#include <nand.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <asm/arch/clock.h>
#include <asm/arch/funcmux.h>
#include <asm/arch-tegra/clk_rst.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <fdtdec.h>
#include <common.h>
#include <malloc.h>
+#include <dm/device_compat.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <errno.h>
#include <spi.h>
#include <spi-mem.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/mtd/spinand.h>
#endif
static const struct mtd_ooblayout_ops spinand_noecc_ooblayout = {
.ecc = spinand_noecc_ooblayout_ecc,
- .free = spinand_noecc_ooblayout_free,
+ .rfree = spinand_noecc_ooblayout_free,
};
static int spinand_init(struct spinand_device *spinand)
*/
#ifndef __UBOOT__
+#include <malloc.h>
#include <linux/device.h>
#include <linux/kernel.h>
#endif
static const struct mtd_ooblayout_ops gd5fxgq4xexxg_ooblayout = {
.ecc = gd5fxgq4xexxg_ooblayout_ecc,
- .free = gd5fxgq4xexxg_ooblayout_free,
+ .rfree = gd5fxgq4xexxg_ooblayout_free,
};
static const struct spinand_info gigadevice_spinand_table[] = {
*/
#ifndef __UBOOT__
+#include <malloc.h>
#include <linux/device.h>
#include <linux/kernel.h>
#endif
static const struct mtd_ooblayout_ops mx35lfxge4ab_ooblayout = {
.ecc = mx35lfxge4ab_ooblayout_ecc,
- .free = mx35lfxge4ab_ooblayout_free,
+ .rfree = mx35lfxge4ab_ooblayout_free,
};
static int mx35lf1ge4ab_get_eccsr(struct spinand_device *spinand, u8 *eccsr)
*/
#ifndef __UBOOT__
+#include <malloc.h>
#include <linux/device.h>
#include <linux/kernel.h>
#endif
static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout = {
.ecc = mt29f2g01abagd_ooblayout_ecc,
- .free = mt29f2g01abagd_ooblayout_free,
+ .rfree = mt29f2g01abagd_ooblayout_free,
};
static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
*/
#ifndef __UBOOT__
+#include <malloc.h>
#include <linux/device.h>
#include <linux/kernel.h>
#endif
static const struct mtd_ooblayout_ops w25m02gv_ooblayout = {
.ecc = w25m02gv_ooblayout_ecc,
- .free = w25m02gv_ooblayout_free,
+ .rfree = w25m02gv_ooblayout_free,
};
static int w25m02gv_select_target(struct spinand_device *spinand,
#include <common.h>
#include <watchdog.h>
+#include <dm/devres.h>
#include <linux/compat.h>
#include <linux/mtd/mtd.h>
#include "linux/mtd/flashchip.h"
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <clk.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/of_access.h>
#include <errno.h>
#include <fdt_support.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <spi.h>
#include <spi_flash.h>
#include <dm/device-internal.h>
*/
#include <common.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/log2.h>
*/
#include <common.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/log2.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/crc32.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/stringify.h>
*/
#include <hexdump.h>
+#include <malloc.h>
#include <ubi_uboot.h>
#include "ubi.h"
#ifndef __UBOOT__
#include <linux/debugfs.h>
+#include <linux/err.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#endif
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/slab.h>
#include <linux/crc32.h>
#include <u-boot/crc.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/crc32.h>
+#include <linux/err.h>
#include <u-boot/crc.h>
#else
#include <div64.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/crc32.h>
#include <linux/err.h>
#include <linux/slab.h>
/* This file mostly implements UBI kernel API functions */
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/namei.h>
/* Here we keep miscellaneous functions which are used all over the UBI code */
+#include <malloc.h>
#include <ubi_uboot.h>
#include "ubi.h"
*/
#ifndef __UBOOT__
+#include <malloc.h>
#include <linux/uaccess.h>
#else
#include <div64.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/export.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/crc32.h>
#include <linux/err.h>
#include <linux/slab.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/slab.h>
#include <linux/crc32.h>
#include <linux/freezer.h>
#include <clk.h>
#include <dm.h>
#include <dma.h>
+#include <malloc.h>
#include <miiphy.h>
#include <net.h>
#include <phy.h>
#include <clk.h>
#include <dm.h>
#include <dma.h>
+#include <malloc.h>
#include <miiphy.h>
#include <net.h>
#include <reset.h>
#include <wait_bit.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#define ETH_PORT_STR "brcm,enetsw-port"
#include <malloc.h>
#include <pci.h>
#include <reset.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/compiler.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <memalign.h>
#include <miiphy.h>
#include <net.h>
#include <reset.h>
#include <syscon.h>
#include "designware.h"
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <asm/arch/system_manager.h>
#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <memalign.h>
#include <pci.h>
#include "e1000.h"
#include <common.h>
#include <console.h>
#include "e1000.h"
+#include <malloc.h>
#include <linux/compiler.h>
/*-----------------------------------------------------------------------
* Copyright (C) 2014 Freescale Semiconductor
*/
+#include <malloc.h>
#include <asm/arch/clock.h>
#include "qbman_portal.h"
#include <cpu_func.h>
#include <env.h>
#include <errno.h>
+#include <malloc.h>
#include <linux/bug.h>
#include <asm/io.h>
#include <linux/libfdt.h>
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <memalign.h>
#include <asm/io.h>
#include <pci.h>
#include <clk.h>
#include <cpu_func.h>
#include <dm.h>
+#include <malloc.h>
#include <miiphy.h>
#include <net.h>
#include <wait_bit.h>
+#include <dm/device_compat.h>
#include <linux/io.h>
#include <linux/iopoll.h>
*/
#include <cpu_func.h>
+#include <malloc.h>
#include <asm/io.h>
#include <common.h>
#include <console.h>
#include <common.h>
#include <config.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/of_access.h>
#include <dm/of_addr.h>
#include <fdt_support.h>
#include <common.h>
#include <config.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/of_access.h>
#include <dm/of_addr.h>
#include <fdt_support.h>
#include <common.h>
#include <config.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/of_access.h>
#include <dm/of_addr.h>
#include <fdt_support.h>
#include <common.h>
#include <config.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/of_access.h>
#include <dm/of_addr.h>
#include <fdt_support.h>
#include <common.h>
#include <config.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/of_access.h>
#include <dm/of_addr.h>
#include <fdt_support.h>
#include <wait_bit.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
#include <linux/ioport.h>
#include <linux/mdio.h>
#include <config.h>
#include <malloc.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/errno.h>
#include <phy.h>
#include <miiphy.h>
#include <cpu_func.h>
#include <dm.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/lists.h>
#include <net.h>
#include <netdev.h>
#include <config.h>
#include <malloc.h>
#include <asm/io.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <phy.h>
#include <miiphy.h>
#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <asm/io.h>
#include <pci.h>
#include <miiphy.h>
* Copyright 2017 NXP
*/
+#include <malloc.h>
#include <net/pfe_eth/pfe_eth.h>
#include <net/pfe_eth/pfe_firmware.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/platform_data/pfe_dm_eth.h>
#include <net.h>
#include <net/pfe_eth/pfe_eth.h>
* files.
*/
+#include <malloc.h>
#include <net/pfe_eth/pfe_eth.h>
#include <net/pfe_eth/pfe_firmware.h>
#ifdef CONFIG_CHAIN_OF_TRUST
*/
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/platform_data/pfe_dm_eth.h>
#include <net.h>
#include <net/pfe_eth/pfe_eth.h>
*/
#include <common.h>
#include <phy.h>
+#include <dm/devres.h>
#include <linux/compat.h>
#include <malloc.h>
#include <config.h>
#include <common.h>
+#include <malloc.h>
#include <phy.h>
#include <dm.h>
#include <fdt_support.h>
#include <cpu_func.h>
#include <errno.h>
#include <dm.h>
+#include <malloc.h>
#include <net.h>
#include <miiphy.h>
#include <console.h>
#include <asm/eth-raw-os.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <cpu_func.h>
#include <dm.h>
#include <fdt_support.h>
-#include <linux/io.h>
-#include <linux/iopoll.h>
+#include <malloc.h>
#include <miiphy.h>
#include <net.h>
#include <regmap.h>
#include <reset.h>
#include <syscon.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
#define AVE_GRST_DELAY_MSEC 40
#define AVE_MIN_XMITSIZE 60
#include <clk.h>
#include <dm.h>
#include <fdt_support.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
#include <malloc.h>
#include <miiphy.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
#include <malloc.h>
#include <miiphy.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <clk.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <dma-uclass.h>
#include <dm/of_access.h>
#include <fdt_support.h>
#include <asm/io.h>
#include <cpsw.h>
+#include <dm/device_compat.h>
DECLARE_GLOBAL_DATA_PTR;
#include <net.h>
#include <netdev.h>
#include <cpsw.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <asm/gpio.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <miiphy.h>
#include <wait_bit.h>
#include <asm/system.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/errno.h>
/* Bit/mask specification */
#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <memalign.h>
#include <pci.h>
#include <time.h>
#include <dm/device-internal.h>
+#include <linux/compat.h>
#include "nvme.h"
#define NVME_Q_DEPTH 2
#include <pci.h>
#include <asm/io.h>
#include <asm-generic/gpio.h>
+#include <dm/device_compat.h>
#include <linux/ioport.h>
/* PCIe core registers */
*
* Return: 0 on success
*/
-static int pcie_advk_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
int dev_count;
};
-int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
+int sandbox_pci_get_emul(const struct udevice *bus, pci_dev_t find_devfn,
struct udevice **containerp, struct udevice **emulp)
{
struct pci_emul_uc_priv *upriv;
return 0;
}
-static u32 get_bus_address(struct udevice *dev, pci_dev_t bdf, u32 offset)
+static u32 get_bus_address(const struct udevice *dev, pci_dev_t bdf, u32 offset)
{
struct rcar_gen2_pci_priv *priv = dev_get_priv(dev);
return get_bus_address(dev, bdf, offset);
}
-static int rcar_gen2_pci_read_config(struct udevice *dev, pci_dev_t bdf,
+static int rcar_gen2_pci_read_config(const struct udevice *dev, pci_dev_t bdf,
uint offset, ulong *value,
enum pci_size_t size)
{
mask << shift, data << shift);
}
-static u32 rcar_read_conf(struct udevice *dev, int where)
+static u32 rcar_read_conf(const struct udevice *dev, int where)
{
struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev);
int shift = 8 * (where & 3);
return readl(priv->regs + (where & ~3)) >> shift;
}
-static int rcar_pcie_config_access(struct udevice *udev,
+static int rcar_pcie_config_access(const struct udevice *udev,
unsigned char access_type,
pci_dev_t bdf, int where, ulong *data)
{
return 0;
}
-static int rcar_gen3_pcie_read_config(struct udevice *dev, pci_dev_t bdf,
+static int rcar_gen3_pcie_read_config(const struct udevice *dev, pci_dev_t bdf,
uint where, ulong *val,
enum pci_size_t size)
{
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <pci.h>
#include <asm/io.h>
#include <dm/device-internal.h>
return dev;
}
-pci_dev_t dm_pci_get_bdf(struct udevice *dev)
+pci_dev_t dm_pci_get_bdf(const struct udevice *dev)
{
struct pci_child_platdata *pplat = dev_get_parent_platdata(dev);
struct udevice *bus = dev->parent;
}
};
-int pci_bus_find_devfn(struct udevice *bus, pci_dev_t find_devfn,
+int pci_bus_find_devfn(const struct udevice *bus, pci_dev_t find_devfn,
struct udevice **devp)
{
struct udevice *dev;
return dm_pci_write_config(dev, offset, value, PCI_SIZE_32);
}
-int pci_bus_read_config(struct udevice *bus, pci_dev_t bdf, int offset,
+int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset,
unsigned long *valuep, enum pci_size_t size)
{
struct dm_pci_ops *ops;
return pci_bus_read_config(bus, bdf, offset, valuep, size);
}
-int dm_pci_read_config(struct udevice *dev, int offset, unsigned long *valuep,
- enum pci_size_t size)
+int dm_pci_read_config(const struct udevice *dev, int offset,
+ unsigned long *valuep, enum pci_size_t size)
{
- struct udevice *bus;
+ const struct udevice *bus;
for (bus = dev; device_is_on_pci_bus(bus);)
bus = bus->parent;
return 0;
}
-int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep)
+int dm_pci_read_config8(const struct udevice *dev, int offset, u8 *valuep)
{
unsigned long value;
int ret;
return 0;
}
-int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep)
+int dm_pci_read_config16(const struct udevice *dev, int offset, u16 *valuep)
{
unsigned long value;
int ret;
return 0;
}
-int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep)
+int dm_pci_read_config32(const struct udevice *dev, int offset, u32 *valuep)
{
unsigned long value;
int ret;
}
int pci_generic_mmap_write_config(
- struct udevice *bus,
- int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
+ const struct udevice *bus,
+ int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset,
+ void **addrp),
pci_dev_t bdf,
uint offset,
ulong value,
}
int pci_generic_mmap_read_config(
- struct udevice *bus,
- int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
+ const struct udevice *bus,
+ int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset,
+ void **addrp),
pci_dev_t bdf,
uint offset,
ulong *valuep,
return 0;
}
-static int pci_bridge_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pci_bridge_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
return (*iop != NULL) + (*memp != NULL) + (*prefp != NULL);
}
-u32 dm_pci_read_bar32(struct udevice *dev, int barnum)
+u32 dm_pci_read_bar32(const struct udevice *dev, int barnum)
{
u32 addr;
int bar;
void __iomem *cfg_data;
};
-static int mpc85xx_pci_dm_read_config(struct udevice *dev, pci_dev_t bdf,
+static int mpc85xx_pci_dm_read_config(const struct udevice *dev, pci_dev_t bdf,
uint offset, ulong *value,
enum pci_size_t size)
{
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <dm/of_access.h>
return container_of(hose, struct mvebu_pcie, hose);
}
-static int mvebu_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
+static int mvebu_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
return ops->write_config(emul, offset, value, size);
}
-static int sandbox_pci_read_config(struct udevice *bus, pci_dev_t devfn,
+static int sandbox_pci_read_config(const struct udevice *bus, pci_dev_t devfn,
uint offset, ulong *valuep,
enum pci_size_t size)
{
return 0;
}
-static u32 get_bus_address(struct udevice *dev, pci_dev_t bdf, u32 offset)
+static u32 get_bus_address(const struct udevice *dev, pci_dev_t bdf, u32 offset)
{
return BIT(31) | (PCI_DEV(bdf) << 8) | (offset & ~3);
}
-static int sh7751_pci_read_config(struct udevice *dev, pci_dev_t bdf,
+static int sh7751_pci_read_config(const struct udevice *dev, pci_dev_t bdf,
uint offset, ulong *value,
enum pci_size_t size)
{
}
}
-static int pci_tegra_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pci_tegra_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
#include <pci.h>
#include <asm/pci.h>
-static int _pci_x86_read_config(struct udevice *bus, pci_dev_t bdf, uint offset,
- ulong *valuep, enum pci_size_t size)
+static int _pci_x86_read_config(const struct udevice *bus, pci_dev_t bdf,
+ uint offset, ulong *valuep,
+ enum pci_size_t size)
{
return pci_x86_read_config(bdf, offset, valuep, size);
}
*
* Return: 0 on success
*/
-static int pcie_dw_mvebu_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_dw_mvebu_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
#include <syscon.h>
#include <asm/io.h>
#include <asm-generic/gpio.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
DECLARE_GLOBAL_DATA_PTR;
*
* Return: 0 on success
*/
-static int pcie_dw_ti_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_dw_ti_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
* code. Otherwise the address to access will be written to the pointer pointed
* to by @paddress.
*/
-static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf,
- uint offset, void **paddress)
+static int pci_generic_ecam_conf_address(const struct udevice *bus,
+ pci_dev_t bdf, uint offset,
+ void **paddress)
{
struct generic_ecam_pcie *pcie = dev_get_priv(bus);
void *addr;
* space of the device identified by the bus, device & function numbers in @bdf
* on the PCI bus @bus.
*/
-static int pci_generic_ecam_read_config(struct udevice *bus, pci_dev_t bdf,
- uint offset, ulong *valuep,
- enum pci_size_t size)
+static int pci_generic_ecam_read_config(const struct udevice *bus,
+ pci_dev_t bdf, uint offset,
+ ulong *valuep, enum pci_size_t size)
{
return pci_generic_mmap_read_config(bus, pci_generic_ecam_conf_address,
bdf, offset, valuep, size);
#include <asm/fsl_serdes.h>
#include <asm/io.h>
#include "pcie_fsl.h"
+#include <dm/device_compat.h>
LIST_HEAD(fsl_pcie_list);
return 0;
}
-static int fsl_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
+static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
#include <common.h>
#include <init.h>
+#include <malloc.h>
#include <pci.h>
#include <asm/arch/clock.h>
#include <asm/arch/iomux.h>
imx_pcie_init();
}
#else
-static int imx_pcie_dm_read_config(struct udevice *dev, pci_dev_t bdf,
+static int imx_pcie_dm_read_config(const struct udevice *dev, pci_dev_t bdf,
uint offset, ulong *value,
enum pci_size_t size)
{
#include <dm.h>
#include <pci.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#define RP_TX_REG0 0x2000
#define RP_TX_CNTRL 0x2004
return tlp_read_packet(pcie, NULL);
}
-int intel_fpga_rp_conf_addr(struct udevice *bus, pci_dev_t bdf,
+int intel_fpga_rp_conf_addr(const struct udevice *bus, pci_dev_t bdf,
uint offset, void **paddress)
{
struct intel_fpga_pcie *pcie = dev_get_priv(bus);
byte_en, data);
}
-static int pcie_intel_fpga_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_intel_fpga_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
return 0;
}
-int ls_pcie_conf_address(struct udevice *bus, pci_dev_t bdf,
+int ls_pcie_conf_address(const struct udevice *bus, pci_dev_t bdf,
uint offset, void **paddress)
{
struct ls_pcie *pcie = dev_get_priv(bus);
return 0;
}
-static int ls_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
+static int ls_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
return pcie->cfg + offset;
}
-static int ls_pcie_g4_read_config(struct udevice *bus, pci_dev_t bdf,
+static int ls_pcie_g4_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <pci.h>
#include <reset.h>
#include <asm/io.h>
+#include <dm/devres.h>
#include <linux/iopoll.h>
#include <linux/list.h>
struct list_head ports;
};
-static int mtk_pcie_config_address(struct udevice *udev, pci_dev_t bdf,
+static int mtk_pcie_config_address(const struct udevice *udev, pci_dev_t bdf,
uint offset, void **paddress)
{
struct mtk_pcie *pcie = dev_get_priv(udev);
return 0;
}
-static int mtk_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
+static int mtk_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
* code. Otherwise the address to access will be written to the pointer pointed
* to by @paddress.
*/
-static int pci_phytium_conf_address(struct udevice *bus, pci_dev_t bdf,
- uint offset,
- void **paddress)
+static int pci_phytium_conf_address(const struct udevice *bus, pci_dev_t bdf,
+ uint offset, void **paddress)
{
struct phytium_pcie *pcie = dev_get_priv(bus);
void *addr;
* space of the device identified by the bus, device & function numbers in @bdf
* on the PCI bus @bus.
*/
-static int pci_phytium_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pci_phytium_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
*
* Return: 0 on success, else -ENODEV
*/
-static int pcie_xilinx_config_address(struct udevice *udev, pci_dev_t bdf,
+static int pcie_xilinx_config_address(const struct udevice *udev, pci_dev_t bdf,
uint offset, void **paddress)
{
struct xilinx_pcie *pcie = dev_get_priv(udev);
*
* Return: 0 on success, else -ENODEV or -EINVAL
*/
-static int pcie_xilinx_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_xilinx_read_config(const struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <asm/arch/cpu.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#define REG_ISCR 0x00
#define REG_PHYCTL_A10 0x04
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <power-domain.h>
#include <reset.h>
#include <asm/io.h>
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <reset.h>
#include <asm/io.h>
#include <dm/device.h>
#include <common.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <reset.h>
#include <asm/io.h>
#include <dm/device.h>
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <power-domain.h>
#include <reset.h>
#include <asm/io.h>
#include <common.h>
#include <dm.h>
#include <fdtdec.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <bitfield.h>
#include <dm.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <regmap.h>
#include <errno.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <bitfield.h>
#include <dm.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <bitfield.h>
#include <dm.h>
#include <generic-phy.h>
#include <regmap.h>
#include <syscon.h>
+#include <linux/err.h>
#define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(0)
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <mapmem.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dt-bindings/phy/phy.h>
#include <dm.h>
#include <fdtdec.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <reset.h>
#include <syscon.h>
#include <usb.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <power/regulator.h>
#include <dm.h>
#include <fdtdec.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <reset.h>
#include <syscon.h>
#include <usb.h>
#include <syscon.h>
#include <usb.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <power/regulator.h>
#include <clk-uclass.h>
#include <dm.h>
#include <dm/device.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <dt-bindings/phy/phy.h>
#include <generic-phy.h>
#include <power-domain.h>
#include <regmap.h>
#include <syscon.h>
+#include <linux/err.h>
#define CMU_R07C 0x7c
#define CMU_MASTER_CDN_O BIT(24)
#include <asm/arch/sys_proto.h>
#include <syscon.h>
#include <regmap.h>
+#include <linux/err.h>
/* PLLCTRL Registers */
#define PLL_STATUS 0x00000004
#include <dm.h>
#include <regmap.h>
#include <syscon.h>
+#include <dm/device_compat.h>
#include <dm/pinctrl.h>
#define BCM6838_CMD_LOAD_MUX 0x21
#include <common.h>
#include <dm.h>
#include <irq.h>
+#include <malloc.h>
#include <p2sb.h>
#include <spl.h>
#include <asm-generic/gpio.h>
#include <asm/itss.h>
#include <dm/device-internal.h>
#include <dt-bindings/gpio/gpio.h>
+#include <linux/err.h>
#define GPIO_DW_SIZE(x) (sizeof(u32) * (x))
#define PAD_CFG_OFFSET(x, dw_num) ((x) + GPIO_DW_SIZE(dw_num))
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <dm/pinctrl.h>
#include <fdt_support.h>
#include <config.h>
#include <dm.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/lists.h>
#include <dm/pinctrl.h>
#include <dm/root.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/pinctrl.h>
#include <linux/io.h>
#include <common.h>
#include <config.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/lists.h>
#include <dm/pinctrl.h>
#include <dm/root.h>
*/
#include <common.h>
+#include <malloc.h>
#include <mapmem.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/io.h>
#include <linux/err.h>
#include <dm.h>
*/
#include <common.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/io.h>
#include <linux/err.h>
#include <dm.h>
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/compat.h>
#include <dm/pinctrl.h>
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/pinctrl.h>
#include <linux/libfdt.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <dm/device.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <dm/pinctrl.h>
#include <linux/bitfield.h>
*/
#include <common.h>
+#include <malloc.h>
+#include <dm/device_compat.h>
#include <linux/libfdt.h>
#include <linux/err.h>
#include <linux/list.h>
#include <common.h>
#include <dm.h>
#include <hwspinlock.h>
+#include <malloc.h>
#include <asm/arch/gpio.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <dm/pinctrl.h>
+#include <linux/err.h>
DECLARE_GLOBAL_DATA_PTR;
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/pinctrl.h>
#include <linux/io.h>
#include <linux/sizes.h>
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/io.h>
#include <linux/err.h>
#include <linux/kernel.h>
u8 regs[MEMMAP_SIZE];
};
-static int sandbox_pmc_emul_read_config(struct udevice *emul, uint offset,
+static int sandbox_pmc_emul_read_config(const struct udevice *emul, uint offset,
ulong *valuep, enum pci_size_t size)
{
struct pmc_emul_platdata *plat = dev_get_platdata(emul);
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
#include <asm/io.h>
};
struct power_domain_ops bcm6328_power_domain_ops = {
- .free = bcm6328_power_domain_free,
+ .rfree = bcm6328_power_domain_free,
.off = bcm6328_power_domain_off,
.on = bcm6328_power_domain_on,
.request = bcm6328_power_domain_request,
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
#include <asm/io.h>
#include <asm/arch/power-domain.h>
struct power_domain_ops imx8_power_domain_ops = {
.request = imx8_power_domain_request,
- .free = imx8_power_domain_free,
+ .rfree = imx8_power_domain_free,
.on = imx8_power_domain_on,
.off = imx8_power_domain_off,
.of_xlate = imx8_power_domain_of_xlate,
#define DEBUG
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
#include <asm/arch/power-domain.h>
#include <asm/arch/sci/sci.h>
struct power_domain_ops imx8_power_domain_ops_v2 = {
.request = imx8_power_domain_request,
- .free = imx8_power_domain_free,
+ .rfree = imx8_power_domain_free,
.on = imx8_power_domain_on,
.off = imx8_power_domain_off,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
#include <asm/io.h>
#include <asm/arch/power-domain.h>
struct power_domain_ops imx8m_power_domain_ops = {
.request = imx8m_power_domain_request,
- .free = imx8m_power_domain_free,
+ .rfree = imx8m_power_domain_free,
.on = imx8m_power_domain_on,
.off = imx8m_power_domain_off,
.of_xlate = imx8m_power_domain_of_xlate,
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
#include <regmap.h>
#include <syscon.h>
#include <clk.h>
#include <dt-bindings/power/meson-g12a-power.h>
#include <dt-bindings/power/meson-sm1-power.h>
+#include <linux/err.h>
/* AO Offsets */
}
struct power_domain_ops meson_ee_pwrc_ops = {
- .free = meson_ee_pwrc_free,
+ .rfree = meson_ee_pwrc_free,
.off = meson_ee_pwrc_off,
.on = meson_ee_pwrc_on,
.request = meson_ee_pwrc_request,
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
#include <regmap.h>
#include <syscon.h>
#include <reset.h>
#include <clk.h>
+#include <linux/err.h>
enum {
VPU_PWRC_COMPATIBLE_GX = 0,
}
struct power_domain_ops meson_gx_pwrc_vpu_ops = {
- .free = meson_pwrc_vpu_free,
+ .rfree = meson_pwrc_vpu_free,
.off = meson_pwrc_vpu_off,
.on = meson_pwrc_vpu_on,
.request = meson_pwrc_vpu_request,
#include <clk.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
#include <regmap.h>
#include <syscon.h>
#include <asm/io.h>
#include <asm/processor.h>
+#include <linux/err.h>
#include <linux/iopoll.h>
#include <dt-bindings/power/mt7623-power.h>
};
struct power_domain_ops mtk_power_domain_ops = {
- .free = scpsys_power_free,
+ .rfree = scpsys_power_free,
.off = scpsys_power_off,
.on = scpsys_power_on,
.request = scpsys_power_request,
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain.h>
#include <power-domain-uclass.h>
#include <dm/device-internal.h>
debug("%s(power_domain=%p)\n", __func__, power_domain);
- return ops->free(power_domain);
+ return ops->rfree(power_domain);
}
int power_domain_on(struct power_domain *power_domain)
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain.h>
#include <asm/io.h>
#include <asm/power-domain.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
#include <asm/io.h>
#include <asm/power-domain.h>
struct power_domain_ops sandbox_power_domain_ops = {
.request = sandbox_power_domain_request,
- .free = sandbox_power_domain_free,
+ .rfree = sandbox_power_domain_free,
.on = sandbox_power_domain_on,
.off = sandbox_power_domain_off,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <misc.h>
#include <power-domain-uclass.h>
#include <asm/arch-tegra/bpmp_abi.h>
struct power_domain_ops tegra186_power_domain_ops = {
.request = tegra186_power_domain_request,
- .free = tegra186_power_domain_free,
+ .rfree = tegra186_power_domain_free,
.on = tegra186_power_domain_on,
.off = tegra186_power_domain_off,
};
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <power-domain-uclass.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/soc/ti/ti_sci_protocol.h>
#include <dt-bindings/soc/ti,sci_pm_domain.h>
static struct power_domain_ops ti_sci_power_domain_ops = {
.request = ti_sci_power_domain_request,
- .free = ti_sci_power_domain_free,
+ .rfree = ti_sci_power_domain_free,
.on = ti_sci_power_domain_on,
.off = ti_sci_power_domain_off,
.of_xlate = ti_sci_power_domain_of_xlate,
#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <i2c.h>
#include <power/fan53555.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
+#include <malloc.h>
#include <power/pmic.h>
#include <power/sandbox_pmic.h>
{
struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul);
struct udevice *pmic_dev = i2c_emul_get_device(emul);
- struct uc_pmic_priv *priv = dev_get_uclass_priv(pmic_dev);
- const u8 *reg_defaults;
debug("%s:%d Setting PMIC default registers\n", __func__, __LINE__);
plat->reg_count = pmic_reg_count(pmic_dev);
- plat->trans_len = priv->trans_len;
+
+ return 0;
+}
+
+static int sandbox_i2c_pmic_probe(struct udevice *emul)
+{
+ struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul);
+ struct udevice *pmic_dev = i2c_emul_get_device(emul);
+ struct uc_pmic_priv *upriv = dev_get_uclass_priv(pmic_dev);
+ const u8 *reg_defaults;
+
+ plat->trans_len = upriv->trans_len;
plat->buf_size = plat->reg_count * plat->trans_len;
plat->reg = calloc(1, plat->buf_size);
.id = UCLASS_I2C_EMUL,
.of_match = sandbox_i2c_pmic_ids,
.ofdata_to_platdata = sandbox_i2c_pmic_ofdata_to_platdata,
+ .probe = sandbox_i2c_pmic_probe,
.platdata_auto_alloc_size = sizeof(struct sandbox_i2c_pmic_plat_data),
.ops = &sandbox_i2c_pmic_emul_ops,
};
#include <sysreset.h>
#include <time.h>
#include <dm/device.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <power/pmic.h>
#include <power/stpmic1.h>
#include <common.h>
#include <errno.h>
#include <dm.h>
+#include <linux/err.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <regmap.h>
#include <dm.h>
#include <errno.h>
#include <pwm.h>
+#include <dm/device_compat.h>
#include <power/regulator.h>
DECLARE_GLOBAL_DATA_PTR;
#include <clk.h>
#include <dm.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <power/regulator.h>
#include <common.h>
#include <dm.h>
#include <i2c.h>
+#include <dm/device_compat.h>
#include <power/regulator.h>
#define TPS62360_REG_SET0 0
#include <dm.h>
#include <ram.h>
#include <asm/io.h>
+#include <linux/err.h>
/* SDRAM Command Code */
#define SD_CC_ARD 0x0 /* Master Bus (AXI) command - Read */
#include <power-domain.h>
#include <dm.h>
#include <asm/arch/sys_proto.h>
+#include <dm/device_compat.h>
#include <power/regulator.h>
#include "k3-am654-ddrss.h"
#include <asm/io.h>
#include <power-domain.h>
#include <wait_bit.h>
+#include <dm/device_compat.h>
#include "lpddr4_obj_if.h"
#include "lpddr4_if.h"
#include <asm/arch-rockchip/ddr_rk3368.h>
#include <asm/arch-rockchip/sdram.h>
#include <asm/arch-rockchip/sdram_rk3288.h>
+#include <linux/err.h>
struct dram_info {
struct ram_info info;
#include <dm.h>
#include <ram.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#define MEM_MODE_MASK GENMASK(2, 0)
#define SWP_FMC_OFFSET 10
#include <remoteproc.h>
#include <errno.h>
#include <mailbox.h>
+#include <dm/device_compat.h>
#include <linux/soc/ti/k3-sec-proxy.h>
#define K3_MSG_R5_TO_M3_M3FW 0x8105
#include <dm.h>
#include <elf.h>
#include <remoteproc.h>
+#include <dm/device_compat.h>
+#include <linux/compat.h>
/**
* struct resource_table - firmware resource table header
#include <reset.h>
#include <syscon.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#define RCC_GCR_HOLD_BOOT 0
#define RCC_GCR_RELEASE_BOOT 1
#include <reset.h>
#include <asm/io.h>
#include <power-domain.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/soc/ti/ti_sci_protocol.h>
#include "ti_sci_proc.h"
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <remoteproc.h>
#include <errno.h>
#include <clk.h>
#include <reset.h>
#include <asm/io.h>
#include <power-domain.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/soc/ti/ti_sci_protocol.h>
#include "ti_sci_proc.h"
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <remoteproc.h>
#include <errno.h>
#include <clk.h>
#include <reset.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/soc/ti/ti_sci_protocol.h>
#include "ti_sci_proc.h"
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <reset-uclass.h>
#include <asm/io.h>
}
struct reset_ops bcm6345_reset_reset_ops = {
- .free = bcm6345_reset_free,
+ .rfree = bcm6345_reset_free,
.request = bcm6345_reset_request,
.rst_assert = bcm6345_reset_assert,
.rst_deassert = bcm6345_reset_deassert,
* Copyright (c) 2019, Linaro Limited
*/
+#include <malloc.h>
#include <asm/io.h>
#include <common.h>
#include <dm.h>
static const struct reset_ops hisi_reset_reset_ops = {
.of_xlate = hisi_reset_of_xlate,
.request = hisi_reset_request,
- .free = hisi_reset_free,
+ .rfree = hisi_reset_free,
.rst_assert = hisi_reset_assert,
.rst_deassert = hisi_reset_deassert,
};
static const struct reset_ops hsdk_reset_ops = {
.request = hsdk_reset_noop,
- .free = hsdk_reset_noop,
+ .rfree = hsdk_reset_noop,
.rst_assert = hsdk_reset_noop,
.rst_deassert = hsdk_reset_reset,
};
* Copyright (c) 2017, Impinj, Inc.
*/
+#include <malloc.h>
#include <asm/io.h>
#include <common.h>
#include <dm.h>
static const struct reset_ops imx7_reset_reset_ops = {
.request = imx7_reset_request,
- .free = imx7_reset_free,
+ .rfree = imx7_reset_free,
.rst_assert = imx7_reset_assert,
.rst_deassert = imx7_reset_deassert,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/lists.h>
#include <regmap.h>
#include <reset-uclass.h>
#include <syscon.h>
+#include <linux/err.h>
struct mediatek_reset_priv {
struct regmap *regmap;
struct reset_ops mediatek_reset_ops = {
.request = mediatek_reset_request,
- .free = mediatek_reset_free,
+ .rfree = mediatek_reset_free,
.rst_assert = mediatek_reset_assert,
.rst_deassert = mediatek_reset_deassert,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <reset-uclass.h>
#include <regmap.h>
struct reset_ops meson_reset_ops = {
.request = meson_reset_request,
- .free = meson_reset_free,
+ .rfree = meson_reset_free,
.rst_assert = meson_reset_assert,
.rst_deassert = meson_reset_deassert,
};
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <reset-uclass.h>
#include <linux/io.h>
static const struct reset_ops mtmips_reset_ops = {
.request = mtmips_reset_request,
- .free = mtmips_reset_free,
+ .rfree = mtmips_reset_free,
.rst_assert = mtmips_reset_assert,
.rst_deassert = mtmips_reset_deassert,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <reset-uclass.h>
#include <linux/io.h>
#include <asm/arch-rockchip/hardware.h>
struct reset_ops rockchip_reset_ops = {
.request = rockchip_reset_request,
- .free = rockchip_reset_free,
+ .rfree = rockchip_reset_free,
.rst_assert = rockchip_reset_assert,
.rst_deassert = rockchip_reset_deassert,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/lists.h>
#include <dm/of_access.h>
#include <env.h>
static const struct reset_ops socfpga_reset_ops = {
.request = socfpga_reset_request,
- .free = socfpga_reset_free,
+ .rfree = socfpga_reset_free,
.rst_assert = socfpga_reset_assert,
.rst_deassert = socfpga_reset_deassert,
};
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <reset-uclass.h>
#include <asm/io.h>
#include <dm/lists.h>
struct reset_ops sunxi_reset_ops = {
.request = sunxi_reset_request,
- .free = sunxi_reset_free,
+ .rfree = sunxi_reset_free,
.rst_assert = sunxi_reset_assert,
.rst_deassert = sunxi_reset_deassert,
};
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <reset-uclass.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/soc/ti/ti_sci_protocol.h>
/**
static struct reset_ops ti_sci_reset_ops = {
.of_xlate = ti_sci_reset_of_xlate,
.request = ti_sci_reset_request,
- .free = ti_sci_reset_free,
+ .rfree = ti_sci_reset_free,
.rst_assert = ti_sci_reset_assert,
.rst_deassert = ti_sci_reset_deassert,
.rst_status = ti_sci_reset_status,
#include <common.h>
#include <dm.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <reset.h>
#include <reset-uclass.h>
+#include <dm/devres.h>
static inline struct reset_ops *reset_dev_ops(struct udevice *dev)
{
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
- return ops->free(reset_ctl);
+ return ops->rfree(reset_ctl);
}
int reset_assert(struct reset_ctl *reset_ctl)
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <reset-uclass.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/sizes.h>
static const struct reset_ops uniphier_reset_ops = {
.request = uniphier_reset_request,
- .free = uniphier_reset_free,
+ .rfree = uniphier_reset_free,
.rst_assert = uniphier_reset_assert,
.rst_deassert = uniphier_reset_deassert,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <reset.h>
#include <asm/io.h>
#include <asm/reset.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <reset-uclass.h>
#include <asm/io.h>
#include <asm/reset.h>
struct reset_ops sandbox_reset_reset_ops = {
.request = sandbox_reset_request,
- .free = sandbox_reset_free,
+ .rfree = sandbox_reset_free,
.rst_assert = sandbox_reset_assert,
.rst_deassert = sandbox_reset_deassert,
};
#include <common.h>
#include <errno.h>
+#include <malloc.h>
#include <wait_bit.h>
#include <dm.h>
#include <reset-uclass.h>
struct reset_ops sti_reset_ops = {
.request = sti_reset_request,
- .free = sti_reset_free,
+ .rfree = sti_reset_free,
.rst_assert = sti_reset_assert,
.rst_deassert = sti_reset_deassert,
};
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <reset-uclass.h>
#include <stm32_rcc.h>
#include <asm/io.h>
static const struct reset_ops stm32_reset_ops = {
.request = stm32_reset_request,
- .free = stm32_reset_free,
+ .rfree = stm32_reset_free,
.rst_assert = stm32_reset_assert,
.rst_deassert = stm32_reset_deassert,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <reset-uclass.h>
#include <asm/arch/clock.h>
#include <asm/arch-tegra/clk_rst.h>
struct reset_ops tegra_car_reset_ops = {
.request = tegra_car_reset_request,
- .free = tegra_car_reset_free,
+ .rfree = tegra_car_reset_free,
.rst_assert = tegra_car_reset_assert,
.rst_deassert = tegra_car_reset_deassert,
};
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <misc.h>
#include <reset-uclass.h>
#include <asm/arch-tegra/bpmp_abi.h>
struct reset_ops tegra186_reset_ops = {
.request = tegra186_reset_request,
- .free = tegra186_reset_free,
+ .rfree = tegra186_reset_free,
.rst_assert = tegra186_reset_assert,
.rst_deassert = tegra186_reset_deassert,
};
#include <dm.h>
#include <i2c.h>
#include <rtc.h>
+#include <dm/device_compat.h>
/*
* RTC register addresses
#include <eeprom.h>
#include <i2c.h>
#include <rtc.h>
+#include <dm/device_compat.h>
#define RTC_RV3029_PAGE_LEN 7
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <rtc.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/iopoll.h>
#define STM32_RTC_TR 0x00
#include <clk.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <watchdog.h>
#include <serial.h>
#include <debug_uart.h>
#include <reset.h>
#include <serial.h>
#include <watchdog.h>
+#include <linux/err.h>
#include <linux/types.h>
#include <asm/io.h>
#include <dm.h>
#include <env_internal.h>
#include <errno.h>
+#include <malloc.h>
#include <os.h>
#include <serial.h>
#include <stdio_dev.h>
#include <dm.h>
#include <debug_uart.h>
#include <errno.h>
+#include <malloc.h>
#include <serial.h>
#include <asm/io.h>
#include <asm/types.h>
#include <watchdog.h>
#include <asm/io.h>
#include <serial.h>
+#include <dm/device_compat.h>
#include <linux/compiler.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/clock.h>
#include <clk.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <serial.h>
#include <watchdog.h>
#include <asm/io.h>
#include <watchdog.h>
#include <asm/io.h>
#include <asm/types.h>
+#include <linux/err.h>
struct mtk_serial_regs {
u32 rbr;
DEBUG_UART_FUNCS
-#endif
\ No newline at end of file
+#endif
#include <ns16550.h>
#include <serial.h>
#include <clk.h>
+#include <linux/err.h>
#ifndef CONFIG_SYS_NS16550_CLK
#define CONFIG_SYS_NS16550_CLK 0
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <serial.h>
#include <wait_bit.h>
#include <mach/pic32.h>
#include <asm/io.h>
#include <linux/compiler.h>
#include <serial.h>
+#include <linux/err.h>
DECLARE_GLOBAL_DATA_PTR;
#include <asm/io.h>
#include <asm/arch/stm32.h>
#include "serial_stm32.h"
+#include <dm/device_compat.h>
static void _stm32_serial_setbrg(fdt_addr_t base,
struct stm32_uart_info *uart_info,
#include <fdtdec.h>
#include <watchdog.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/compiler.h>
#include <serial.h>
+#include <linux/err.h>
DECLARE_GLOBAL_DATA_PTR;
#include <common.h>
#include <errno.h>
#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/of_access.h>
#include <dm/of_addr.h>
#include <asm/io.h>
+#include <linux/err.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <smem.h>
#include <asm/dma-mapping.h>
#include <asm/bitops.h>
#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/read.h>
#include <dm/uclass.h>
#include <linux/compat.h>
+#include <linux/err.h>
#include <linux/soc/ti/k3-navss-ringacc.h>
#include <linux/soc/ti/ti_sci_protocol.h>
};
struct sandbox_sound_priv {
- int setup_called;
+ int setup_called; /* Incremented when setup() method is called */
+ bool active; /* TX data is being sent */
int sum; /* Use to sum the provided audio data */
bool allow_beep; /* true to allow the start_beep() interface */
int frequency_hz; /* Beep frequency if active, else 0 */
return priv->setup_called;
}
+int sandbox_get_sound_active(struct udevice *dev)
+{
+ struct sandbox_sound_priv *priv = dev_get_priv(dev);
+
+ return priv->active;
+}
+
int sandbox_get_sound_sum(struct udevice *dev)
{
struct sandbox_sound_priv *priv = dev_get_priv(dev);
return i2s_tx_data(uc_priv->i2s, data, data_size);
}
+static int sandbox_sound_stop_play(struct udevice *dev)
+{
+ struct sandbox_sound_priv *priv = dev_get_priv(dev);
+
+ sandbox_sdl_sound_stop();
+ priv->active = false;
+
+ return 0;
+}
+
int sandbox_sound_start_beep(struct udevice *dev, int frequency_hz)
{
struct sandbox_sound_priv *priv = dev_get_priv(dev);
static const struct sound_ops sandbox_sound_ops = {
.setup = sandbox_sound_setup,
.play = sandbox_sound_play,
+ .stop_play = sandbox_sound_stop_play,
.start_beep = sandbox_sound_start_beep,
.stop_beep = sandbox_sound_stop_beep,
};
#include <common.h>
#include <dm.h>
#include <i2s.h>
+#include <malloc.h>
#include <sound.h>
#define SOUND_BITS_IN_BYTE 8
return ops->play(dev, data, data_size);
}
+int sound_stop_play(struct udevice *dev)
+{
+ struct sound_ops *ops = sound_get_ops(dev);
+
+ if (!ops->play)
+ return -ENOSYS;
+
+ return ops->stop_play(dev);
+}
+
int sound_start_beep(struct udevice *dev, int frequency_hz)
{
struct sound_ops *ops = sound_get_ops(dev);
sound_create_square_wave(i2s_uc_priv->samplingrate, data, data_size,
frequency_hz, i2s_uc_priv->channels);
+ ret = 0;
while (msecs >= 1000) {
ret = sound_play(dev, data, data_size);
+ if (ret)
+ break;
msecs -= 1000;
}
- if (msecs) {
+ if (!ret && msecs) {
unsigned long size =
(data_size * msecs) / (sizeof(int) * 1000);
ret = sound_play(dev, data, size);
}
+ sound_stop_play(dev);
free(data);
* Author: Piotr Bugalski <bugalski.piotr@gmail.com>
*/
+#include <malloc.h>
#include <asm/io.h>
#include <clk.h>
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <fdtdec.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/ioport.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <spi.h>
#include <reset.h>
#include <wait_bit.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <spi.h>
#include <reset.h>
#include <wait_bit.h>
#include <reset.h>
#include <spi.h>
#include <spi-mem.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <linux/sizes.h>
#include "cadence_qspi.h"
#include <spi.h>
#include <fdtdec.h>
#include <reset.h>
+#include <dm/device_compat.h>
#include <linux/compat.h>
#include <linux/iopoll.h>
#include <asm/io.h>
#include <clk.h>
#include <wait_bit.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
DECLARE_GLOBAL_DATA_PTR;
#include <dm.h>
#include <malloc.h>
#include <spi.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <linux/sizes.h>
#include <linux/iopoll.h>
#include <linux/bug.h>
+#include <linux/err.h>
/*
* The driver only uses one single LUT entry, that is updated on
* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
*/
+#include <malloc.h>
#include <spi.h>
#include <spi-mem.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/dmaengine.h>
#include <linux/pm_runtime.h>
#include "internals.h"
#else
+#include <dm/device_compat.h>
#include <spi.h>
#include <spi-mem.h>
#endif
#include <fdt_support.h>
#include <reset.h>
#include <wait_bit.h>
+#include <dm/device_compat.h>
#include <asm/bitops.h>
#include <asm/gpio.h>
#include <clk.h>
#include <reset.h>
#include <spi-mem.h>
+#include <dm/device_compat.h>
#include <linux/iopoll.h>
#include <linux/ioport.h>
#include <linux/sizes.h>
#include <clk.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <reset.h>
#include <spi.h>
+#include <dm/device_compat.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/omap_gpio.h>
#include <asm/omap_common.h>
#include <asm/ti-common/ti-edma3.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <regmap.h>
#include <syscon.h>
#include <common.h>
#include <dm.h>
#include <time.h>
+#include <dm/device_compat.h>
#include <linux/bitfield.h>
#include <linux/io.h>
#include <spi.h>
#include <spi.h>
#include <ubi_uboot.h>
#include <wait_bit.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#define GQSPI_GFIFO_STRT_MODE_MASK BIT(29)
#define GQSPI_CONFIG_MODE_EN_MASK (3 << 30)
#include <errno.h>
#include <fdtdec.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <spmi/spmi.h>
DECLARE_GLOBAL_DATA_PTR;
#include <dm.h>
#include <errno.h>
#include <sysreset.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/soc/ti/ti_sci_protocol.h>
/**
#include <regmap.h>
#include <sysreset.h>
#include <syscon.h>
+#include <linux/err.h>
struct syscon_reboot_priv {
struct regmap *regmap;
#include <common.h>
#include <dm.h>
#include <log.h>
+#include <malloc.h>
#include <tee.h>
#include <linux/arm-smccc.h>
+#include <linux/err.h>
#include <linux/io.h>
#include "optee_smc.h"
#include <log.h>
#include <tee.h>
#include <mmc.h>
+#include <dm/device_compat.h>
#include "optee_msg.h"
#include "optee_private.h"
#include <common.h>
#include <log.h>
+#include <malloc.h>
#include <tee.h>
#include <linux/types.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
+#include <tee.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
-#include <tee.h>
/**
* struct tee_uclass_priv - information of a TEE, stored by the uclass
#include <timer.h>
#include <asm/io.h>
#include <asm/arch/timer.h>
+#include <linux/err.h>
#define AST_TICK_TIMER 1
#define AST_TMC_RELOAD_VAL 0xffffffff
#include <errno.h>
#include <timer.h>
#include <asm/io.h>
+#include <linux/err.h>
#define CNT_CNTRL_RESET BIT(4)
#include <common.h>
#include <dm.h>
#include <clk.h>
+#include <malloc.h>
#include <reset.h>
#include <timer.h>
+#include <dm/device_compat.h>
#include <asm/io.h>
#include <asm/arch/timer.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <dm.h>
#include <clk.h>
#include <dm.h>
#include <fdtdec.h>
#include <timer.h>
+#include <dm/device_compat.h>
#include <asm/io.h>
#include <clk.h>
#include <errno.h>
#include <timer.h>
+#include <linux/err.h>
DECLARE_GLOBAL_DATA_PTR;
to the device using the standard TPM Interface Specification (TIS)
protocol.
+config TPM2_FTPM_TEE
+ bool "TEE based fTPM Interface"
+ depends on TEE && OPTEE && TPM_V2
+ help
+ This driver supports firmware TPM running in TEE.
+
endif # TPM_V2
endmenu
obj-$(CONFIG_TPM2_CR50_I2C) += cr50_i2c.o
obj-$(CONFIG_TPM2_TIS_SANDBOX) += tpm2_tis_sandbox.o
obj-$(CONFIG_TPM2_TIS_SPI) += tpm2_tis_spi.o
+obj-$(CONFIG_TPM2_FTPM_TEE) += tpm2_ftpm_tee.o
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) Microsoft Corporation
+ *
+ * Authors:
+ * Thirupathaiah Annapureddy <thiruan@microsoft.com>
+ *
+ * Description:
+ * Device Driver for a firmware TPM as described here:
+ * https://www.microsoft.com/en-us/research/publication/ftpm-software-implementation-tpm-chip/
+ *
+ * A reference implementation is available here:
+ * https://github.com/microsoft/ms-tpm-20-ref/tree/master/Samples/ARM32-FirmwareTPM/optee_ta/fTPM
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <tpm-v2.h>
+#include <tee.h>
+
+#include "tpm_tis.h"
+#include "tpm2_ftpm_tee.h"
+
+/**
+ * ftpm_tee_transceive() - send fTPM commands and retrieve fTPM response.
+ * @sendbuf - address of the data to send, byte by byte
+ * @send_size - length of the data to send
+ * @recvbuf - address where to read the response, byte by byte.
+ * @recv_len - pointer to the size of buffer
+ *
+ * Return:
+ * In case of success, returns 0.
+ * On failure, -errno
+ */
+static int ftpm_tee_transceive(struct udevice *dev, const u8 *sendbuf,
+ size_t send_size, u8 *recvbuf,
+ size_t *recv_len)
+{
+ struct ftpm_tee_private *context = dev_get_priv(dev);
+ int rc = 0;
+ size_t resp_len;
+ u8 *resp_buf;
+ struct tpm_output_header *resp_header;
+ struct tee_invoke_arg transceive_args;
+ struct tee_param command_params[4];
+ struct tee_shm *shm;
+
+ if (send_size > MAX_COMMAND_SIZE) {
+ debug("%s:send_size=%zd exceeds MAX_COMMAND_SIZE\n",
+ __func__, send_size);
+ return -EIO;
+ }
+
+ shm = context->shm;
+ memset(&transceive_args, 0, sizeof(transceive_args));
+ memset(command_params, 0, sizeof(command_params));
+
+ /* Invoke FTPM_OPTEE_TA_SUBMIT_COMMAND function of fTPM TA */
+ transceive_args = (struct tee_invoke_arg) {
+ .func = FTPM_OPTEE_TA_SUBMIT_COMMAND,
+ .session = context->session,
+ };
+
+ /* Fill FTPM_OPTEE_TA_SUBMIT_COMMAND parameters */
+ /* request */
+ command_params[0] = (struct tee_param) {
+ .attr = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT,
+ .u.memref = {
+ .shm = shm,
+ .size = send_size,
+ .shm_offs = 0,
+ },
+ };
+ memset(command_params[0].u.memref.shm->addr, 0,
+ (MAX_COMMAND_SIZE + MAX_RESPONSE_SIZE));
+ memcpy(command_params[0].u.memref.shm->addr, sendbuf, send_size);
+
+ /* response */
+ command_params[1] = (struct tee_param) {
+ .attr = TEE_PARAM_ATTR_TYPE_MEMREF_INOUT,
+ .u.memref = {
+ .shm = shm,
+ .size = MAX_RESPONSE_SIZE,
+ .shm_offs = MAX_COMMAND_SIZE,
+ },
+ };
+
+ rc = tee_invoke_func(context->tee_dev, &transceive_args, 4,
+ command_params);
+ if ((rc < 0) || (transceive_args.ret != 0)) {
+ debug("%s:SUBMIT_COMMAND invoke error: 0x%x\n",
+ __func__, transceive_args.ret);
+ return (rc < 0) ? rc : transceive_args.ret;
+ }
+
+ resp_buf = command_params[1].u.memref.shm->addr +
+ command_params[1].u.memref.shm_offs;
+ resp_header = (struct tpm_output_header *)resp_buf;
+ resp_len = be32_to_cpu(resp_header->length);
+
+ /* sanity check resp_len*/
+ if (resp_len < TPM_HEADER_SIZE) {
+ debug("%s:tpm response header too small\n", __func__);
+ return -EIO;
+ }
+ if (resp_len > MAX_RESPONSE_SIZE) {
+ debug("%s:resp_len=%zd exceeds MAX_RESPONSE_SIZE\n",
+ __func__, resp_len);
+ return -EIO;
+ }
+ if (resp_len > *recv_len) {
+ debug("%s:response length is bigger than receive buffer\n",
+ __func__);
+ return -EIO;
+ }
+
+ /* sanity checks look good, copy the response */
+ memcpy(recvbuf, resp_buf, resp_len);
+ *recv_len = resp_len;
+
+ return 0;
+}
+
+static int ftpm_tee_open(struct udevice *dev)
+{
+ struct ftpm_tee_private *context = dev_get_priv(dev);
+
+ if (context->is_open)
+ return -EBUSY;
+
+ context->is_open = 1;
+
+ return 0;
+}
+
+static int ftpm_tee_close(struct udevice *dev)
+{
+ struct ftpm_tee_private *context = dev_get_priv(dev);
+
+ if (context->is_open)
+ context->is_open = 0;
+
+ return 0;
+}
+
+static int ftpm_tee_desc(struct udevice *dev, char *buf, int size)
+{
+ if (size < 32)
+ return -ENOSPC;
+
+ return snprintf(buf, size, "Microsoft OP-TEE fTPM");
+}
+
+static int ftpm_tee_match(struct tee_version_data *vers, const void *data)
+{
+ debug("%s:vers->gen_caps =0x%x\n", __func__, vers->gen_caps);
+
+ /*
+ * Currently this driver only support GP Complaint OPTEE based fTPM TA
+ */
+ return vers->gen_caps & TEE_GEN_CAP_GP;
+}
+
+static int ftpm_tee_probe(struct udevice *dev)
+{
+ int rc;
+ struct tpm_chip_priv *priv = dev_get_uclass_priv(dev);
+ struct ftpm_tee_private *context = dev_get_priv(dev);
+ struct tee_open_session_arg sess_arg;
+ const struct tee_optee_ta_uuid uuid = TA_FTPM_UUID;
+
+ memset(context, 0, sizeof(*context));
+
+ /* Use the TPM v2 stack */
+ priv->version = TPM_V2;
+ priv->pcr_count = 24;
+ priv->pcr_select_min = 3;
+
+ /* Find TEE device */
+ context->tee_dev = tee_find_device(NULL, ftpm_tee_match, NULL, NULL);
+ if (!context->tee_dev) {
+ debug("%s:tee_find_device failed\n", __func__);
+ return -ENODEV;
+ }
+
+ /* Open a session with the fTPM TA */
+ memset(&sess_arg, 0, sizeof(sess_arg));
+ tee_optee_ta_uuid_to_octets(sess_arg.uuid, &uuid);
+
+ rc = tee_open_session(context->tee_dev, &sess_arg, 0, NULL);
+ if ((rc < 0) || (sess_arg.ret != 0)) {
+ debug("%s:tee_open_session failed, err=%x\n",
+ __func__, sess_arg.ret);
+ return -EIO;
+ }
+ context->session = sess_arg.session;
+
+ /* Allocate dynamic shared memory with fTPM TA */
+ rc = tee_shm_alloc(context->tee_dev,
+ MAX_COMMAND_SIZE + MAX_RESPONSE_SIZE,
+ 0, &context->shm);
+ if (rc) {
+ debug("%s:tee_shm_alloc failed with rc = %d\n", __func__, rc);
+ goto out_shm_alloc;
+ }
+
+ return 0;
+
+out_shm_alloc:
+ tee_close_session(context->tee_dev, context->session);
+
+ return rc;
+}
+
+static int ftpm_tee_remove(struct udevice *dev)
+{
+ struct ftpm_tee_private *context = dev_get_priv(dev);
+ int rc;
+
+ /* tee_pre_remove frees any leftover TEE shared memory */
+
+ /* close the existing session with fTPM TA*/
+ rc = tee_close_session(context->tee_dev, context->session);
+ debug("%s: tee_close_session - rc =%d\n", __func__, rc);
+
+ return 0;
+}
+
+static const struct tpm_ops ftpm_tee_ops = {
+ .open = ftpm_tee_open,
+ .close = ftpm_tee_close,
+ .get_desc = ftpm_tee_desc,
+ .xfer = ftpm_tee_transceive,
+};
+
+static const struct udevice_id ftpm_tee_ids[] = {
+ { .compatible = "microsoft,ftpm" },
+ { }
+};
+
+U_BOOT_DRIVER(ftpm_tee) = {
+ .name = "ftpm_tee",
+ .id = UCLASS_TPM,
+ .of_match = ftpm_tee_ids,
+ .ops = &ftpm_tee_ops,
+ .probe = ftpm_tee_probe,
+ .remove = ftpm_tee_remove,
+ .flags = DM_FLAG_OS_PREPARE,
+ .priv_auto_alloc_size = sizeof(struct ftpm_tee_private),
+};
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) Microsoft Corporation
+ */
+
+#ifndef __TPM2_FTPM_TEE_H__
+#define __TPM2_FTPM_TEE_H__
+
+/* This UUID is generated with uuidgen */
+#define TA_FTPM_UUID { 0xBC50D971, 0xD4C9, 0x42C4, \
+ {0x82, 0xCB, 0x34, 0x3F, 0xB7, 0xF3, 0x78, 0x96} }
+
+/* The TAFs ID implemented in this TA */
+#define FTPM_OPTEE_TA_SUBMIT_COMMAND (0)
+#define FTPM_OPTEE_TA_EMULATE_PPI (1)
+
+/* max. buffer size supported by fTPM */
+#define MAX_COMMAND_SIZE 4096
+#define MAX_RESPONSE_SIZE 4096
+
+/**
+ * struct ftpm_tee_private - fTPM's private context
+ * @tee_dev: struct udevice for TEE.
+ * @session: fTPM TA session identifier.
+ * @is_open: Indicates whether the driver is already opened by client or not.
+ * @shm: Memory pool shared with fTPM TA in TEE.
+ */
+struct ftpm_tee_private {
+ struct udevice *tee_dev;
+ u32 session;
+ int is_open;
+ struct tee_shm *shm;
+};
+
+#endif /* __TPM2_FTPM_TEE_H__ */
#include <common.h>
#include <dm.h>
#include <ufs.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include "ufs.h"
#include <clk.h>
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#define UFS_SS_CTRL 0x4
#define UFS_SS_RST_N_PCS BIT(0)
#include <charset.h>
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/lists.h>
#include <dm/device-internal.h>
#include <malloc.h>
#include <asm-generic/io.h>
#include <clk.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/io.h>
#include <linux/usb/otg.h>
#include <malloc.h>
#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/lists.h>
#include <linux/kernel.h>
#include <linux/io.h>
*
*/
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/delay.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
*/
#include <cpu_func.h>
+#include <dm/device_compat.h>
#include <linux/usb/composite.h>
#include <linux/iopoll.h>
*/
#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
+#include <linux/err.h>
#include <linux/usb/gadget.h>
#include <linux/compat.h>
#include <linux/iopoll.h>
* Pawel Laszczak <pawell@cadence.com>
*/
#include <dm.h>
+#include <dm/devres.h>
#include <linux/compat.h>
#include <usb.h>
#include <usb/xhci.h>
#include <malloc.h>
#include <dwc3-uboot.h>
#include <asm/dma-mapping.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
+#include <linux/err.h>
#include <linux/ioport.h>
#include <dm.h>
#include <generic-phy.h>
#include <asm/io.h>
#include <dm.h>
#include <dwc3-omap-uboot.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/usb/dwc3-omap.h>
#include <linux/ioport.h>
*/
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <linux/errno.h>
#include <linux/io.h>
*/
#include <common.h>
#include <cpu_func.h>
+#include <dm/device_compat.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <cpu_func.h>
#include <malloc.h>
#include <asm/dma-mapping.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/bug.h>
#include <linux/list.h>
#include <common.h>
#include <malloc.h>
#include <ti-usb-phy-uboot.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/ioport.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
#undef PACKET_TRACE
#include <common.h>
+#include <dm/devres.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <asm/io.h>
#include <asm/gpio.h>
*/
#undef DEBUG
+#include <dm/devres.h>
#include <linux/bitops.h>
#include <linux/usb/composite.h>
#include <generic-phy.h>
#include <malloc.h>
#include <reset.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/errno.h>
#include <linux/list.h>
#include <common.h>
#include <console.h>
#include <g_dnl.h>
+#include <dm/devres.h>
#include <linux/err.h>
#include <linux/usb/ch9.h>
#include <asm/system.h>
#include <asm/mach-types.h>
#include <asm/unaligned.h>
+#include <dm/devres.h>
#include <linux/compat.h>
#include <malloc.h>
#include <asm/io.h>
#define ETOOSMALL 525
#include <usb_mass_storage.h>
+#include <dm/device_compat.h>
/*-------------------------------------------------------------------------*/
* usb_
*/
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/compat.h>
#include <malloc.h>
#include <asm/cache.h>
#include <usbroothubdes.h>
#include <wait_bit.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <power/regulator.h>
#include <reset.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <usb.h>
#include <asm/io.h>
#include <asm/arch/clk.h>
#include <common.h>
#include <clk.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/ofnode.h>
#include <generic-phy.h>
#include <reset.h>
#include <malloc.h>
#include <memalign.h>
#include <watchdog.h>
+#include <dm/device_compat.h>
#include <linux/compiler.h>
#include "ehci.h"
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <clk.h>
#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/ofnode.h>
#include <generic-phy.h>
#include <reset.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <dm/ofnode.h>
#include <generic-phy.h>
#include <reset.h>
#include <dm.h>
#include <usb.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/iopoll.h>
#include <power/regulator.h>
#include <clk.h>
#include <dm.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <usb.h>
#include <wait_bit.h>
+#include <dm/device_compat.h>
#include <usb/xhci.h>
#include "xhci-rcar-r8a779x_usb3_v3.h"
*/
#ifndef __UBOOT__
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/clk.h>
#include <common.h>
#include <dm.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <asm/arch/hardware.h>
#include <asm/arch/da8xx-usb.h>
*/
#ifndef __UBOOT__
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
*/
#ifndef __UBOOT__
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/err.h>
*/
#ifndef __UBOOT__
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/timer.h>
*/
#ifndef __UBOOT__
+#include <dm/device_compat.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/timer.h>
*/
#ifndef __UBOOT__
+#include <dm/device_compat.h>
+#include <dm/devres.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <common.h>
#include <console.h>
+#include <malloc.h>
#include <watchdog.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <dm.h>
#include <serial.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
+#include <linux/err.h>
#include <linux/usb/otg.h>
#include <asm/omap_common.h>
#include <asm/omap_musb.h>
*/
#include <common.h>
+#include <dm/device_compat.h>
#include <linux/usb/musb.h>
#include "linux-compat.h"
#include "musb_core.h"
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <phy-sun4i-usb.h>
#include <reset.h>
#include <asm/arch/cpu.h>
#include <asm/arch/clock.h>
#include <asm/arch/gpio.h>
#include <asm-generic/gpio.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <dm/root.h>
#include <linux/usb/musb.h>
#include <command.h>
#include <console.h>
#include <dm.h>
+#include <malloc.h>
#include <linux/usb/otg.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <common.h>
#include <usb.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <asm/omap_common.h>
#include <asm/arch/cpu.h>
#include <common.h>
#include <cpu_func.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/arch/gpio.h>
#include <asm/arch/clk.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <video.h>
#include <video_console.h>
}
break;
}
+#endif
+#ifdef CONFIG_VIDEO_BPP32
+ case VIDEO_BPP32: {
+ u32 *dst = (u32 *)line + xoff;
+ int i;
+
+ for (i = 0; i < width; i++) {
+ int val = *bits;
+ int out;
+
+ if (vid_priv->colour_bg)
+ val = 255 - val;
+ out = val | val << 8 | val << 16;
+ if (vid_priv->colour_fg)
+ *dst++ |= out;
+ else
+ *dst++ &= out;
+ bits++;
+ }
+ break;
+ }
#endif
default:
free(data);
*/
#include <common.h>
+#include <malloc.h>
#include <memalign.h>
#include <video_fb.h>
#include <linux/list.h>
#include <asm/io.h>
#include <asm/arch/gpio.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <linux/iopoll.h>
#include <video_bridge.h>
#include <common.h>
#include <malloc.h>
#include <fdtdec.h>
+#include <dm/devres.h>
#include <linux/libfdt.h>
#include <linux/compat.h>
#include <linux/err.h>
*/
#include <common.h>
+#include <malloc.h>
#include <asm/gpio.h>
#include <errno.h>
*/
#define DEBUG
#include <common.h>
+#include <malloc.h>
#include <video.h>
#include <dm.h>
#ifdef CONFIG_DISPLAY
#include <os.h>
#include <fdt_support.h>
#include <clk.h>
+#include <dm/device_compat.h>
#include <linux/sizes.h>
#define MALIDP_CORE_ID 0x0018
#include <dm.h>
#include <mipi_display.h>
#include <mipi_dsi.h>
+#include <dm/devres.h>
/**
* DOC: dsi helpers
#include <common.h>
#include <dm.h>
#include <video.h>
+#include <dm/device_compat.h>
#include <linux/mbus.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <common.h>
#include <dm.h>
#include <env.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <malloc.h>
#include <video.h>
#include <mipi_dsi.h>
#include <panel.h>
#include <asm/gpio.h>
+#include <dm/device_compat.h>
#include <power/regulator.h>
#define OTM8009A_BACKLIGHT_DEFAULT 240
#include <common.h>
#include <dm.h>
#include <backlight.h>
+#include <malloc.h>
#include <pwm.h>
#include <asm/gpio.h>
#include <power/regulator.h>
#include <mipi_dsi.h>
#include <panel.h>
#include <asm/gpio.h>
+#include <dm/device_compat.h>
#include <power/regulator.h>
/*** Manufacturer Command Set ***/
#include <dm.h>
#include <dw_hdmi.h>
#include <edid.h>
+#include <malloc.h>
#include <regmap.h>
#include <syscon.h>
#include <asm/gpio.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <dm/uclass-internal.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <dm/uclass-internal.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/cru.h>
#include <display.h>
#include <dm.h>
#include <edid.h>
+#include <malloc.h>
#include <panel.h>
#include <regmap.h>
#include <syscon.h>
#include <asm/arch-rockchip/vop_rk3288.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
+#include <linux/err.h>
#include <power/regulator.h>
#include "rk_vop.h"
#include <common.h>
#include <display.h>
#include <dm.h>
+#include <malloc.h>
#include <video_osd.h>
#include "sandbox_osd.h"
#include <fdtdec.h>
#include <video.h>
#include <asm/sdl.h>
+#include <asm/state.h>
#include <asm/u-boot-sandbox.h>
#include <dm/test.h>
{
struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
+ struct sandbox_state *state = state_get_current();
int ret;
- ret = sandbox_sdl_init_display(plat->xres, plat->yres, plat->bpix);
+ ret = sandbox_sdl_init_display(plat->xres, plat->yres, plat->bpix,
+ state->double_lcd);
if (ret) {
puts("LCD init failed\n");
return ret;
{
struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
- const void *blob = gd->fdt_blob;
- int node = dev_of_offset(dev);
int ret = 0;
- plat->xres = fdtdec_get_int(blob, node, "xres", LCD_MAX_WIDTH);
- plat->yres = fdtdec_get_int(blob, node, "yres", LCD_MAX_HEIGHT);
- plat->bpix = VIDEO_BPP16;
+ plat->xres = dev_read_u32_default(dev, "xres", LCD_MAX_WIDTH);
+ plat->yres = dev_read_u32_default(dev, "yres", LCD_MAX_HEIGHT);
+ plat->bpix = dev_read_u32_default(dev, "log2-depth", VIDEO_BPP16);
uc_plat->size = plat->xres * plat->yres * (1 << plat->bpix) / 8;
debug("%s: Frame buffer size %x\n", __func__, uc_plat->size);
*/
#include <common.h>
+#include <malloc.h>
#include <asm/gpio.h>
#include <spi.h>
*/
#include <common.h>
+#include <malloc.h>
#include <mipi_display.h>
#include <asm/arch/gpio.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/arch/gpio.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <linux/iopoll.h>
#include <power/regulator.h>
#include <asm/io.h>
#include <asm/arch/gpio.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
struct stm32_ltdc_priv {
void __iomem *regs;
#include <asm/arch-tegra/dc.h>
#include "displayport.h"
#include "sor.h"
+#include <linux/err.h>
#define DEBUG_SOR 0
#include <common.h>
#include <cpu_func.h>
#include <dm.h>
+#include <malloc.h>
#include <mapmem.h>
#include <stdio_dev.h>
#include <video.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <virtio_types.h>
#include <virtio.h>
#include <dm/lists.h>
#include <virtio.h>
#include <virtio_ring.h>
#include <linux/compat.h>
+#include <linux/err.h>
#include <linux/io.h>
#include "virtio_mmio.h"
#include <virtio_ring.h>
#include <dm/device.h>
#include <linux/compat.h>
+#include <linux/err.h>
#include <linux/io.h>
#include "virtio_pci.h"
#include <virtio_ring.h>
#include <dm/device.h>
#include <linux/compat.h>
+#include <linux/err.h>
#include <linux/io.h>
#include "virtio_pci.h"
#include <virtio_types.h>
#include <virtio.h>
#include <virtio_ring.h>
+#include <linux/compat.h>
int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[],
unsigned int out_sgs, unsigned int in_sgs)
#include <virtio.h>
#include <virtio_ring.h>
#include <linux/compat.h>
+#include <linux/err.h>
#include <linux/io.h>
struct virtio_sandbox_priv {
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
#include <w1-eeprom.h>
#include <w1.h>
#include <asm/arch/clock.h>
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/io.h>
#include <w1.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
+#include <dm/device_compat.h>
DECLARE_GLOBAL_DATA_PTR;
#include <wdt.h>
#include <asm/io.h>
#include <asm/arch/wdt.h>
+#include <linux/err.h>
#define WDT_AST2500 2500
#define WDT_AST2400 2400
#include <wdt.h>
#include <clk.h>
#include <div64.h>
+#include <dm/device_compat.h>
+#include <linux/err.h>
#include <linux/io.h>
DECLARE_GLOBAL_DATA_PTR;
#include <linux/bitops.h>
#include <watchdog.h>
#include <wdt.h>
+#include <linux/err.h>
#define WDTLOAD 0x000
#define WDTCONTROL 0x008
#include <common.h>
#include <dm.h>
#include <wdt.h>
+#include <linux/err.h>
#include <linux/io.h>
#define XWT_CSR0_WRS_MASK 0x00000008 /* Reset status Mask */
#include <common.h>
+#include <malloc.h>
#include <memalign.h>
#include <linux/stat.h>
#include <div64.h>
#include <ext4fs.h>
#include "ext4_common.h"
#include <div64.h>
+#include <malloc.h>
int ext4fs_symlinknest;
struct ext_filesystem ext_fs;
#include <command.h>
#include <config.h>
#include <fat.h>
+#include <malloc.h>
#include <asm/byteorder.h>
#include <part.h>
#include <linux/ctype.h>
#include <common.h>
#include <fs.h>
+#include <malloc.h>
#include <os.h>
int sandbox_fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info)
*/
#include <hexdump.h>
+#include <dm/devres.h>
#ifndef __UBOOT__
#include <linux/module.h>
* good, and GC takes extra care when moving them.
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/slab.h>
#include <linux/pagemap.h>
#include <linux/list_sort.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/crc32.h>
#include <linux/slab.h>
#include <u-boot/crc.h>
*/
#ifdef __UBOOT__
+#include <dm/devres.h>
#include <linux/err.h>
#endif
#include "ubifs.h"
*/
#ifdef __UBOOT__
+#include <malloc.h>
#include <linux/err.h>
#endif
#include "ubifs.h"
#include "ubifs.h"
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/crc16.h>
#include <linux/math64.h>
#include <linux/slab.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/crc16.h>
#include <linux/slab.h>
#include <linux/random.h>
#include "ubifs.h"
#ifdef __UBOOT__
+#include <dm/devres.h>
#include <linux/compat.h>
#include <linux/err.h>
#include <ubi_uboot.h>
* Author: Adrian Hunter
*/
+#include <dm/devres.h>
#include <linux/err.h>
#include "ubifs.h"
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/crc32.h>
#include <linux/slab.h>
#include <u-boot/crc.h>
*/
#ifdef __UBOOT__
+#include <dm/devres.h>
#include <linux/compat.h>
#include <linux/err.h>
#endif
#include "ubifs.h"
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/math64.h>
#ifdef __UBOOT__
#include <hexdump.h>
+#include <dm/devres.h>
#include <linux/err.h>
#endif
#include "ubifs.h"
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/crc32.h>
#include <linux/slab.h>
#include <u-boot/crc.h>
*/
#ifdef __UBOOT__
+#include <dm/devres.h>
#include <linux/err.h>
#endif
#include "ubifs.h"
#include <common.h>
#include <env.h>
#include <gzip.h>
+#include <malloc.h>
#include <memalign.h>
#include "ubifs.h"
+#include <dm/devres.h>
#include <u-boot/zlib.h>
#include <linux/compat.h>
#include "yaffs_guts.h"
#include "yaffs_trace.h"
#include "yportenv.h"
+#include <dm/devres.h>
/*
* Each entry in yaffs_tnode_list and yaffs_obj_list hold blocks
#include "yaffs_checkptrw.h"
#include "yaffs_getblockinfo.h"
+#include <dm/devres.h>
static int yaffs2_checkpt_space_ok(struct yaffs_dev *dev)
{
#include "yportenv.h"
#include "yaffs_trace.h"
+#include <dm/devres.h>
#include "yaffs_guts.h"
#include "yaffs_getblockinfo.h"
#include "yportenv.h"
#include "yaffs_guts.h"
+#include <malloc.h>
#include "yaffs_nandif.h"
#include "yaffs_nand.h"
#include "yaffs_getblockinfo.h"
#include "yaffs_bitmap.h"
+#include <dm/devres.h>
/*
* The summary is built up in an array of summary tags.
#include <common.h>
#include <div64.h>
+#include <malloc.h>
#include <config.h>
#include "nand.h"
#include "yaffs_getblockinfo.h"
#include "yaffs_nand.h"
#include "yaffs_attribs.h"
+#include <dm/devres.h>
int yaffs1_scan(struct yaffs_dev *dev)
{
#include "yaffs_verify.h"
#include "yaffs_attribs.h"
#include "yaffs_summary.h"
+#include <dm/devres.h>
/*
* Checkpoints are really no benefit on very small partitions.
#include "yaffscfg.h"
#include "yportenv.h"
#include "yaffs_trace.h"
+#include <dm/devres.h>
#define YAFFSFS_MAX_SYMLINK_DEREFERENCES 5
*/
struct dm_gpio_ops {
int (*request)(struct udevice *dev, unsigned offset, const char *label);
- int (*free)(struct udevice *dev, unsigned offset);
+ int (*rfree)(struct udevice *dev, unsigned int offset);
int (*direction_input)(struct udevice *dev, unsigned offset);
int (*direction_output)(struct udevice *dev, unsigned offset,
int value);
*/
void *bloblist_ensure(uint tag, int size);
+/**
+ * bloblist_ensure_size_ret() - Find or add a blob
+ *
+ * Find an existing blob, or add a new one if not found
+ *
+ * @tag: Tag to add (enum bloblist_tag_t)
+ * @sizep: Size of the blob to create; returns size of actual blob
+ * @blobp: Returns a pointer to blob on success
+ * @return 0 if OK, -ENOSPC if it is missing and could not be added due to lack
+ * of space
+ */
+int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp);
+
/**
* bloblist_new() - Create a new, empty bloblist of a given size
*
* @return 0 if OK, -ENOENT if the magic number doesn't match (indicating that
* there problem is no bloblist at the given address), -EPROTONOSUPPORT
* if the version does not match, -EIO if the checksum does not match,
- * -EFBIG if the expected size does not match the detected size
+ * -EFBIG if the expected size does not match the detected size, -ENOSPC
+ * if the size is not large enough to hold the headers
*/
int bloblist_check(ulong addr, uint size);
*/
int (*request)(struct clk *clock);
/**
- * free - Free a previously requested clock.
+ * rfree - Free a previously requested clock.
*
* This is the implementation of the client clk_free() API.
*
* @clock: The clock to free.
* @return 0 if OK, or a negative error code.
*/
- int (*free)(struct clk *clock);
+ int (*rfree)(struct clk *clock);
/**
* get_rate() - Get current clock rate.
*
*/
void console_record_reset_enable(void);
+/**
+ * console_record_readline() - Read a line from the console output
+ *
+ * This reads the next available line from the console output previously
+ * recorded.
+ *
+ * @str: Place to put string
+ * @maxlen: Maximum length of @str including nul terminator
+ * @return length of string returned
+ */
+int console_record_readline(char *str, int maxlen);
+
+/**
+ * console_record_avail() - Get the number of available bytes in console output
+ *
+ * @return available bytes (0 if empty)
+ */
+int console_record_avail(void);
+
/**
* console_announce_r() - print a U-Boot console on non-serial consoles
*
#include <dm/uclass-id.h>
#include <fdtdec.h>
#include <linker_lists.h>
-#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/printk.h>
* @return 0 if OK, -ENODEV if no such device, other error if the device fails
* to probe
*/
-int device_get_child(struct udevice *parent, int index, struct udevice **devp);
+int device_get_child(const struct udevice *parent, int index,
+ struct udevice **devp);
/**
* device_get_child_count() - Get the available child count of a device
*
* @parent: Parent device to check
*/
-int device_get_child_count(struct udevice *parent);
+int device_get_child_count(const struct udevice *parent);
/**
* device_find_child_by_seq() - Find a child device based on a sequence
* Set to NULL if none is found
* @return 0 if OK, -ve on error
*/
-int device_find_child_by_seq(struct udevice *parent, int seq_or_req_seq,
+int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq,
bool find_req_seq, struct udevice **devp);
/**
* Set to NULL if none is found
* @return 0 if OK, -ve on error
*/
-int device_get_child_by_seq(struct udevice *parent, int seq,
+int device_get_child_by_seq(const struct udevice *parent, int seq,
struct udevice **devp);
/**
* @devp: Returns pointer to device if found, otherwise this is set to NULL
* @return 0 if OK, -ve on error
*/
-int device_find_child_by_of_offset(struct udevice *parent, int of_offset,
+int device_find_child_by_of_offset(const struct udevice *parent, int of_offset,
struct udevice **devp);
/**
* @devp: Returns pointer to device if found, otherwise this is set to NULL
* @return 0 if OK, -ve on error
*/
-int device_get_child_by_of_offset(struct udevice *parent, int of_offset,
+int device_get_child_by_of_offset(const struct udevice *parent, int of_offset,
struct udevice **devp);
/**
* @devp: Returns first child device, or NULL if none
* @return 0
*/
-int device_find_first_child(struct udevice *parent, struct udevice **devp);
+int device_find_first_child(const struct udevice *parent,
+ struct udevice **devp);
/**
* device_find_next_child() - Find the next child of a device
* @devp: Returns device found, if any
* @return 0 if found, else -ENODEV
*/
-int device_find_first_inactive_child(struct udevice *parent,
+int device_find_first_inactive_child(const struct udevice *parent,
enum uclass_id uclass_id,
struct udevice **devp);
* @devp: Returns first child device in that uclass, if any
* @return 0 if found, else -ENODEV
*/
-int device_find_first_child_by_uclass(struct udevice *parent,
+int device_find_first_child_by_uclass(const struct udevice *parent,
enum uclass_id uclass_id,
struct udevice **devp);
* @devp: Returns device found, if any
* @return 0 if found, else -ENODEV
*/
-int device_find_child_by_name(struct udevice *parent, const char *name,
+int device_find_child_by_name(const struct udevice *parent, const char *name,
struct udevice **devp);
+/**
+ * device_first_child_ofdata_err() - Find the first child and reads its platdata
+ *
+ * The ofdata_to_platdata() method is called on the child before it is returned,
+ * but the child is not probed.
+ *
+ * @parent: Parent to check
+ * @devp: Returns child that was found, if any
+ * @return 0 on success, -ENODEV if no children, other -ve on error
+ */
+int device_first_child_ofdata_err(struct udevice *parent,
+ struct udevice **devp);
+
+/*
+ * device_next_child_ofdata_err() - Find the next child and read its platdata
+ *
+ * The ofdata_to_platdata() method is called on the child before it is returned,
+ * but the child is not probed.
+ *
+ * @devp: On entry, points to the previous child; on exit returns the child that
+ * was found, if any
+ * @return 0 on success, -ENODEV if no children, other -ve on error
+ */
+int device_next_child_ofdata_err(struct udevice **devp);
+
+/**
+ * device_first_child_err() - Get the first child of a device
+ *
+ * The device returned is probed if necessary, and ready for use
+ *
+ * @parent: Parent device to search
+ * @devp: Returns device found, if any
+ * @return 0 if found, -ENODEV if not, -ve error if device failed to probe
+ */
+int device_first_child_err(struct udevice *parent, struct udevice **devp);
+
+/**
+ * device_next_child_err() - Get the next child of a parent device
+ *
+ * The device returned is probed if necessary, and ready for use
+ *
+ * @devp: On entry, pointer to device to lookup. On exit, returns pointer
+ * to the next sibling if no error occurred
+ * @return 0 if found, -ENODEV if not, -ve error if device failed to probe
+ */
+int device_next_child_err(struct udevice **devp);
+
/**
* device_has_children() - check if a device has any children
*
* @return true if the device has one or more children and at least one of
* them is active (probed).
*/
-bool device_has_active_children(struct udevice *dev);
+bool device_has_active_children(const struct udevice *dev);
/**
* device_is_last_sibling() - check if a device is the last sibling
* @return true if there are no more siblings after this one - i.e. is it
* last in the list.
*/
-bool device_is_last_sibling(struct udevice *dev);
+bool device_is_last_sibling(const struct udevice *dev);
/**
* device_set_name() - set the name of a device
* device
* @return true if OK, false if the compatible is not found
*/
-bool device_is_compatible(struct udevice *dev, const char *compat);
+bool device_is_compatible(const struct udevice *dev, const char *compat);
/**
* of_machine_is_compatible() - check if the machine is compatible with
* @dev: device to test
* @return: true if it is on a PCI bus, false otherwise
*/
-static inline bool device_is_on_pci_bus(struct udevice *dev)
+static inline bool device_is_on_pci_bus(const struct udevice *dev)
{
return device_get_uclass_id(dev->parent) == UCLASS_PCI;
}
#define device_foreach_child(pos, parent) \
list_for_each_entry(pos, &parent->child_head, sibling_node)
+/**
+ * device_foreach_child_ofdata_to_platdata() - iterate through children
+ *
+ * This stops when it gets an error, with @pos set to the device that failed to
+ * read ofdata.
+
+ * This creates a for() loop which works through the available children of
+ * a device in order from start to end. Device ofdata is read by calling
+ * device_ofdata_to_platdata() on each one. The devices are not probed.
+ *
+ * @pos: struct udevice * for the current device
+ * @parent: parent device to scan
+ */
+#define device_foreach_child_ofdata_to_platdata(pos, parent) \
+ for (int _ret = device_first_child_ofdata_err(parent, &dev); !_ret; \
+ _ret = device_next_child_ofdata_err(&dev))
+
+/**
+ * device_foreach_child_probe() - iterate through children, probing them
+ *
+ * This creates a for() loop which works through the available children of
+ * a device in order from start to end. Devices are probed if necessary,
+ * and ready for use.
+ *
+ * This stops when it gets an error, with @pos set to the device that failed to
+ * probe
+ *
+ * @pos: struct udevice * for the current device
+ * @parent: parent device to scan
+ */
+#define device_foreach_child_probe(pos, parent) \
+ for (int _ret = device_first_child_err(parent, &dev); !_ret; \
+ _ret = device_next_child_err(&dev))
+
/**
* dm_scan_fdt_dev() - Bind child device in a the device tree
*
*/
int dm_scan_fdt_dev(struct udevice *dev);
-#include <dm/devres.h>
-
-/*
- * REVISIT:
- * remove the following after resolving conflicts with <linux/compat.h>
- */
-#ifdef dev_dbg
-#undef dev_dbg
-#endif
-#ifdef dev_vdbg
-#undef dev_vdbg
-#endif
-#ifdef dev_info
-#undef dev_info
-#endif
-#ifdef dev_err
-#undef dev_err
-#endif
-#ifdef dev_warn
-#undef dev_warn
-#endif
-
-/*
- * REVISIT:
- * print device name like Linux
- */
-#define dev_printk(dev, fmt, ...) \
-({ \
- printk(fmt, ##__VA_ARGS__); \
-})
-
-#define __dev_printk(level, dev, fmt, ...) \
-({ \
- if (level < CONFIG_VAL(LOGLEVEL)) \
- dev_printk(dev, fmt, ##__VA_ARGS__); \
-})
-
-#define dev_emerg(dev, fmt, ...) \
- __dev_printk(0, dev, fmt, ##__VA_ARGS__)
-#define dev_alert(dev, fmt, ...) \
- __dev_printk(1, dev, fmt, ##__VA_ARGS__)
-#define dev_crit(dev, fmt, ...) \
- __dev_printk(2, dev, fmt, ##__VA_ARGS__)
-#define dev_err(dev, fmt, ...) \
- __dev_printk(3, dev, fmt, ##__VA_ARGS__)
-#define dev_warn(dev, fmt, ...) \
- __dev_printk(4, dev, fmt, ##__VA_ARGS__)
-#define dev_notice(dev, fmt, ...) \
- __dev_printk(5, dev, fmt, ##__VA_ARGS__)
-#define dev_info(dev, fmt, ...) \
- __dev_printk(6, dev, fmt, ##__VA_ARGS__)
-
-#ifdef DEBUG
-#define dev_dbg(dev, fmt, ...) \
- __dev_printk(7, dev, fmt, ##__VA_ARGS__)
-#else
-#define dev_dbg(dev, fmt, ...) \
-({ \
- if (0) \
- __dev_printk(7, dev, fmt, ##__VA_ARGS__); \
-})
-#endif
-
-#ifdef VERBOSE_DEBUG
-#define dev_vdbg dev_dbg
-#else
-#define dev_vdbg(dev, fmt, ...) \
-({ \
- if (0) \
- __dev_printk(7, dev, fmt, ##__VA_ARGS__); \
-})
-#endif
-
#endif
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2013 Google, Inc
+ *
+ * (C) Copyright 2012
+ * Pavel Herrmann <morpheus.ibis@gmail.com>
+ * Marek Vasut <marex@denx.de>
+ */
+
+#ifndef _DM_DEVICE_COMPAT_H
+#define _DM_DEVICE_COMPAT_H
+
+#include <linux/compat.h>
+
+/*
+ * REVISIT:
+ * remove the following after resolving conflicts with <linux/compat.h>
+ */
+#ifdef dev_dbg
+#undef dev_dbg
+#endif
+#ifdef dev_vdbg
+#undef dev_vdbg
+#endif
+#ifdef dev_info
+#undef dev_info
+#endif
+#ifdef dev_err
+#undef dev_err
+#endif
+#ifdef dev_warn
+#undef dev_warn
+#endif
+
+/*
+ * REVISIT:
+ * print device name like Linux
+ */
+#define dev_printk(dev, fmt, ...) \
+({ \
+ printk(fmt, ##__VA_ARGS__); \
+})
+
+#define __dev_printk(level, dev, fmt, ...) \
+({ \
+ if (level < CONFIG_VAL(LOGLEVEL)) \
+ dev_printk(dev, fmt, ##__VA_ARGS__); \
+})
+
+#define dev_emerg(dev, fmt, ...) \
+ __dev_printk(0, dev, fmt, ##__VA_ARGS__)
+#define dev_alert(dev, fmt, ...) \
+ __dev_printk(1, dev, fmt, ##__VA_ARGS__)
+#define dev_crit(dev, fmt, ...) \
+ __dev_printk(2, dev, fmt, ##__VA_ARGS__)
+#define dev_err(dev, fmt, ...) \
+ __dev_printk(3, dev, fmt, ##__VA_ARGS__)
+#define dev_warn(dev, fmt, ...) \
+ __dev_printk(4, dev, fmt, ##__VA_ARGS__)
+#define dev_notice(dev, fmt, ...) \
+ __dev_printk(5, dev, fmt, ##__VA_ARGS__)
+#define dev_info(dev, fmt, ...) \
+ __dev_printk(6, dev, fmt, ##__VA_ARGS__)
+
+#ifdef DEBUG
+#define dev_dbg(dev, fmt, ...) \
+ __dev_printk(7, dev, fmt, ##__VA_ARGS__)
+#else
+#define dev_dbg(dev, fmt, ...) \
+({ \
+ if (0) \
+ __dev_printk(7, dev, fmt, ##__VA_ARGS__); \
+})
+#endif
+
+#ifdef VERBOSE_DEBUG
+#define dev_vdbg dev_dbg
+#else
+#define dev_vdbg(dev, fmt, ...) \
+({ \
+ if (0) \
+ __dev_printk(7, dev, fmt, ##__VA_ARGS__); \
+})
+#endif
+
+#endif
#ifndef _DM_DEVRES_H
#define _DM_DEVRES_H
+#include <linux/compat.h>
+
+struct udevice;
+
/* device resource management */
typedef void (*dr_release_t)(struct udevice *dev, void *res);
typedef int (*dr_match_t)(struct udevice *dev, void *res, void *match_data);
*
* @return addr
*/
-fdt_addr_t devfdt_get_addr(struct udevice *dev);
+fdt_addr_t devfdt_get_addr(const struct udevice *dev);
/**
* devfdt_get_addr_ptr() - Return pointer to the address of the reg property
*
* @return Pointer to addr, or NULL if there is no such property
*/
-void *devfdt_get_addr_ptr(struct udevice *dev);
+void *devfdt_get_addr_ptr(const struct udevice *dev);
/**
* devfdt_remap_addr() - Return pointer to the memory-mapped I/O address
*
* @return Pointer to addr, or NULL if there is no such property
*/
-void *devfdt_remap_addr(struct udevice *dev);
+void *devfdt_remap_addr(const struct udevice *dev);
/**
* devfdt_remap_addr_index() - Return indexed pointer to the memory-mapped
*
* @return Pointer to addr, or NULL if there is no such property
*/
-void *devfdt_remap_addr_index(struct udevice *dev, int index);
+void *devfdt_remap_addr_index(const struct udevice *dev, int index);
/**
* devfdt_remap_addr_name() - Get the reg property of a device, indexed by
*
* @return Pointer to addr, or NULL if there is no such property
*/
-void *devfdt_remap_addr_name(struct udevice *dev, const char *name);
+void *devfdt_remap_addr_name(const struct udevice *dev, const char *name);
/**
* devfdt_map_physmem() - Read device address from reg property of the
* @return mapped address, or NULL if the device does not have reg
* property.
*/
-void *devfdt_map_physmem(struct udevice *dev, unsigned long size);
+void *devfdt_map_physmem(const struct udevice *dev, unsigned long size);
/**
* devfdt_get_addr_index() - Get the indexed reg property of a device
*
* @return addr
*/
-fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index);
+fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index);
/**
* devfdt_get_addr_size_index() - Get the indexed reg property of a device
*
* @return addr
*/
-fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index,
- fdt_size_t *size);
+fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
+ fdt_size_t *size);
/**
* devfdt_get_addr_name() - Get the reg property of a device, indexed by name
*
* @return addr
*/
-fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name);
+fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name);
/**
* devfdt_get_addr_size_name() - Get the reg property and its size for a device,
*
* @return addr
*/
-fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name,
- fdt_size_t *size);
+fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
+ const char *name, fdt_size_t *size);
/**
* devfdt_get_addr_pci() - Read an address and handle PCI address translation
* @dev: Device to read from
* @return address or FDT_ADDR_T_NONE if not found
*/
-fdt_addr_t devfdt_get_addr_pci(struct udevice *dev);
+fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);
#endif
*/
u64 ofnode_read_u64_default(ofnode node, const char *propname, u64 def);
+/**
+ * ofnode_read_prop() - Read a property from a node
+ *
+ * @node: valid node reference to read property from
+ * @propname: name of the property to read
+ * @sizep: if non-NULL, returns the size of the property, or an error code
+ if not found
+ * @return property value, or NULL if there is no such property
+ */
+const void *ofnode_read_prop(ofnode node, const char *propname, int *sizep);
+
/**
* ofnode_read_string() - Read a string from a property
*
- * @ref: valid node reference to read property from
+ * @node: valid node reference to read property from
* @propname: name of the property to read
* @return string from property value, or NULL if there is no such property
*/
ofnode ofnode_path(const char *path);
/**
- * ofnode_get_chosen_prop() - get the value of a chosen property
+ * ofnode_read_chosen_prop() - get the value of a chosen property
*
* This looks for a property within the /chosen node and returns its value
*
* @propname: Property name to look for
+ * @sizep: Returns size of property, or FDT_ERR_... error code if function
+ * returns NULL
* @return property value if found, else NULL
*/
-const char *ofnode_get_chosen_prop(const char *propname);
+const void *ofnode_read_chosen_prop(const char *propname, int *sizep);
/**
- * ofnode_get_chosen_node() - get the chosen node
+ * ofnode_read_chosen_string() - get the string value of a chosen property
+ *
+ * This looks for a property within the /chosen node and returns its value,
+ * checking that it is a valid nul-terminated string
+ *
+ * @propname: Property name to look for
+ * @return string value if found, else NULL
+ */
+const char *ofnode_read_chosen_string(const char *propname);
+
+/**
+ * ofnode_get_chosen_node() - get a referenced node from the chosen node
+ *
+ * This looks up a named property in the chosen node and uses that as a path to
+ * look up a code.
*
- * @return the chosen node if present, else ofnode_null()
+ * @return the referenced node if present, else ofnode_null()
*/
-ofnode ofnode_get_chosen_node(const char *name);
+ofnode ofnode_get_chosen_node(const char *propname);
struct display_timing;
/**
struct resource;
#if CONFIG_IS_ENABLED(OF_LIVE)
-static inline const struct device_node *dev_np(struct udevice *dev)
+static inline const struct device_node *dev_np(const struct udevice *dev)
{
return ofnode_to_np(dev->node);
}
#else
-static inline const struct device_node *dev_np(struct udevice *dev)
+static inline const struct device_node *dev_np(const struct udevice *dev)
{
return NULL;
}
* @dev: device to check
* @return reference of the the device's DT node
*/
-static inline ofnode dev_ofnode(struct udevice *dev)
+static inline ofnode dev_ofnode(const struct udevice *dev)
{
return dev->node;
}
-static inline bool dev_of_valid(struct udevice *dev)
+static inline bool dev_of_valid(const struct udevice *dev)
{
return ofnode_valid(dev_ofnode(dev));
}
* @outp: place to put value (if found)
* @return 0 if OK, -ve on error
*/
-int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp);
+int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp);
/**
* dev_read_u32_default() - read a 32-bit integer from a device's DT property
* @def: default value to return if the property has no value
* @return property value, or @def if not found
*/
-int dev_read_u32_default(struct udevice *dev, const char *propname, int def);
+int dev_read_u32_default(const struct udevice *dev, const char *propname,
+ int def);
/**
* dev_read_s32() - read a signed 32-bit integer from a device's DT property
* @outp: place to put value (if found)
* @return 0 if OK, -ve on error
*/
-int dev_read_s32(struct udevice *dev, const char *propname, s32 *outp);
+int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp);
/**
* dev_read_s32_default() - read a signed 32-bit int from a device's DT property
* @def: default value to return if the property has no value
* @return property value, or @def if not found
*/
-int dev_read_s32_default(struct udevice *dev, const char *propname, int def);
+int dev_read_s32_default(const struct udevice *dev, const char *propname,
+ int def);
/**
* dev_read_u32u() - read a 32-bit integer from a device's DT property
* @outp: place to put value (if found)
* @return 0 if OK, -ve on error
*/
-int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp);
+int dev_read_u32u(const struct udevice *dev, const char *propname, uint *outp);
/**
* dev_read_u64() - read a 64-bit integer from a device's DT property
* @outp: place to put value (if found)
* @return 0 if OK, -ve on error
*/
-int dev_read_u64(struct udevice *dev, const char *propname, u64 *outp);
+int dev_read_u64(const struct udevice *dev, const char *propname, u64 *outp);
/**
* dev_read_u64_default() - read a 64-bit integer from a device's DT property
* @def: default value to return if the property has no value
* @return property value, or @def if not found
*/
-u64 dev_read_u64_default(struct udevice *dev, const char *propname, u64 def);
+u64 dev_read_u64_default(const struct udevice *dev, const char *propname,
+ u64 def);
/**
* dev_read_string() - Read a string from a device's DT property
* @propname: name of the property to read
* @return string from property value, or NULL if there is no such property
*/
-const char *dev_read_string(struct udevice *dev, const char *propname);
+const char *dev_read_string(const struct udevice *dev, const char *propname);
/**
* dev_read_bool() - read a boolean value from a device's DT property
* @propname: name of property to read
* @return true if property is present (meaning true), false if not present
*/
-bool dev_read_bool(struct udevice *dev, const char *propname);
+bool dev_read_bool(const struct udevice *dev, const char *propname);
/**
* dev_read_subnode() - find a named subnode of a device
* @return reference to subnode (which can be invalid if there is no such
* subnode)
*/
-ofnode dev_read_subnode(struct udevice *dev, const char *subbnode_name);
+ofnode dev_read_subnode(const struct udevice *dev, const char *subbnode_name);
/**
* dev_read_size() - read the size of a property
* @propname: property to check
* @return size of property if present, or -EINVAL if not
*/
-int dev_read_size(struct udevice *dev, const char *propname);
+int dev_read_size(const struct udevice *dev, const char *propname);
/**
* dev_read_addr_index() - Get the indexed reg property of a device
*
* @return address or FDT_ADDR_T_NONE if not found
*/
-fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
+fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index);
/**
* dev_read_addr_size_index() - Get the indexed reg property of a device
*
* @return address or FDT_ADDR_T_NONE if not found
*/
-fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index,
+fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index,
fdt_size_t *size);
/**
*
* @return pointer or NULL if not found
*/
-void *dev_remap_addr_index(struct udevice *dev, int index);
+void *dev_remap_addr_index(const struct udevice *dev, int index);
/**
* dev_read_addr_name() - Get the reg property of a device, indexed by name
*
* @return address or FDT_ADDR_T_NONE if not found
*/
-fdt_addr_t dev_read_addr_name(struct udevice *dev, const char* name);
+fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name);
/**
* dev_read_addr_size_name() - Get the reg property of a device, indexed by name
*
* @return address or FDT_ADDR_T_NONE if not found
*/
-fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name,
+fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name,
fdt_size_t *size);
/**
*
* @return pointer or NULL if not found
*/
-void *dev_remap_addr_name(struct udevice *dev, const char* name);
+void *dev_remap_addr_name(const struct udevice *dev, const char *name);
/**
* dev_read_addr() - Get the reg property of a device
*
* @return address or FDT_ADDR_T_NONE if not found
*/
-fdt_addr_t dev_read_addr(struct udevice *dev);
+fdt_addr_t dev_read_addr(const struct udevice *dev);
/**
* dev_read_addr_ptr() - Get the reg property of a device
*
* @return pointer or NULL if not found
*/
-void *dev_read_addr_ptr(struct udevice *dev);
+void *dev_read_addr_ptr(const struct udevice *dev);
/**
* dev_read_addr_pci() - Read an address and handle PCI address translation
* @dev: Device to read from
* @return address or FDT_ADDR_T_NONE if not found
*/
-fdt_addr_t dev_read_addr_pci(struct udevice *dev);
+fdt_addr_t dev_read_addr_pci(const struct udevice *dev);
/**
* dev_remap_addr() - Get the reg property of a device as a
*
* @return pointer or NULL if not found
*/
-void *dev_remap_addr(struct udevice *dev);
+void *dev_remap_addr(const struct udevice *dev);
/**
* dev_read_addr_size() - get address and size from a device property
* @sizep: place to put size value (on success)
* @return address value, or FDT_ADDR_T_NONE on error
*/
-fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *propname,
- fdt_size_t *sizep);
+fdt_addr_t dev_read_addr_size(const struct udevice *dev, const char *propname,
+ fdt_size_t *sizep);
/**
* dev_read_name() - get the name of a device's node
* @dev: Device to read from
* @return name of node
*/
-const char *dev_read_name(struct udevice *dev);
+const char *dev_read_name(const struct udevice *dev);
/**
* dev_read_stringlist_search() - find string in a string list and return index
* -ENODATA if the property is not found
* -EINVAL on some other error
*/
-int dev_read_stringlist_search(struct udevice *dev, const char *property,
- const char *string);
+int dev_read_stringlist_search(const struct udevice *dev, const char *property,
+ const char *string);
/**
* dev_read_string_index() - obtain an indexed string from a string list
* @return:
* length of string, if found or -ve error value if not found
*/
-int dev_read_string_index(struct udevice *dev, const char *propname, int index,
- const char **outp);
+int dev_read_string_index(const struct udevice *dev, const char *propname,
+ int index, const char **outp);
/**
* dev_read_string_count() - find the number of strings in a string list
* @return:
* number of strings in the list, or -ve error value if not found
*/
-int dev_read_string_count(struct udevice *dev, const char *propname);
+int dev_read_string_count(const struct udevice *dev, const char *propname);
/**
* dev_read_phandle_with_args() - Find a node pointed by phandle in a list
*
* @cells_name could not be found, the arguments were truncated or there
* were too many arguments.
*/
-int dev_read_phandle_with_args(struct udevice *dev, const char *list_name,
- const char *cells_name, int cell_count,
- int index,
- struct ofnode_phandle_args *out_args);
+int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name,
+ const char *cells_name, int cell_count,
+ int index, struct ofnode_phandle_args *out_args);
/**
* dev_count_phandle_with_args() - Return phandle number in a list
* errno value.
*/
-int dev_count_phandle_with_args(struct udevice *dev, const char *list_name,
- const char *cells_name);
+int dev_count_phandle_with_args(const struct udevice *dev,
+ const char *list_name, const char *cells_name);
/**
* dev_read_addr_cells() - Get the number of address cells for a device's node
* @dev: device to check
* @return number of address cells this node uses
*/
-int dev_read_addr_cells(struct udevice *dev);
+int dev_read_addr_cells(const struct udevice *dev);
/**
* dev_read_size_cells() - Get the number of size cells for a device's node
* @dev: device to check
* @return number of size cells this node uses
*/
-int dev_read_size_cells(struct udevice *dev);
+int dev_read_size_cells(const struct udevice *dev);
/**
* dev_read_addr_cells() - Get the address cells property in a node
* @dev: device to check
* @return number of address cells this node uses
*/
-int dev_read_simple_addr_cells(struct udevice *dev);
+int dev_read_simple_addr_cells(const struct udevice *dev);
/**
* dev_read_size_cells() - Get the size cells property in a node
* @dev: device to check
* @return number of size cells this node uses
*/
-int dev_read_simple_size_cells(struct udevice *dev);
+int dev_read_simple_size_cells(const struct udevice *dev);
/**
* dev_read_phandle() - Get the phandle from a device
* @dev: device to check
* @return phandle (1 or greater), or 0 if no phandle or other error
*/
-int dev_read_phandle(struct udevice *dev);
+int dev_read_phandle(const struct udevice *dev);
/**
* dev_read_prop()- - read a property from a device's node
* @lenp: place to put length on success
* @return pointer to property, or NULL if not found
*/
-const void *dev_read_prop(struct udevice *dev, const char *propname, int *lenp);
+const void *dev_read_prop(const struct udevice *dev, const char *propname,
+ int *lenp);
/**
* dev_read_alias_seq() - Get the alias sequence number of a node
* @devnump: set to the sequence number if one is found
* @return 0 if a sequence was found, -ve if not
*/
-int dev_read_alias_seq(struct udevice *dev, int *devnump);
+int dev_read_alias_seq(const struct udevice *dev, int *devnump);
/**
* dev_read_u32_array() - Find and read an array of 32 bit integers
* property does not have a value, and -EOVERFLOW if the property data isn't
* large enough.
*/
-int dev_read_u32_array(struct udevice *dev, const char *propname,
+int dev_read_u32_array(const struct udevice *dev, const char *propname,
u32 *out_values, size_t sz);
/**
* @return reference to the first subnode (which can be invalid if the device's
* node has no subnodes)
*/
-ofnode dev_read_first_subnode(struct udevice *dev);
+ofnode dev_read_first_subnode(const struct udevice *dev);
/**
* ofnode_next_subnode() - find the next sibling of a subnode
* @return pointer to byte array if found, or NULL if the property is not
* found or there is not enough data
*/
-const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, const char *propname,
- size_t sz);
+const uint8_t *dev_read_u8_array_ptr(const struct udevice *dev,
+ const char *propname, size_t sz);
/**
* dev_read_enabled() - check whether a node is enabled
* @dev: device to examine
* @return integer value 0 (not enabled) or 1 (enabled)
*/
-int dev_read_enabled(struct udevice *dev);
+int dev_read_enabled(const struct udevice *dev);
/**
* dev_read_resource() - obtain an indexed resource from a device.
* @res returns the resource
* @return 0 if ok, negative on error
*/
-int dev_read_resource(struct udevice *dev, uint index, struct resource *res);
+int dev_read_resource(const struct udevice *dev, uint index,
+ struct resource *res);
/**
* dev_read_resource_byname() - obtain a named resource from a device.
* @res: returns the resource
* @return 0 if ok, negative on error
*/
-int dev_read_resource_byname(struct udevice *dev, const char *name,
+int dev_read_resource_byname(const struct udevice *dev, const char *name,
struct resource *res);
/**
* @in_addr: pointer to the address to translate
* @return the translated address; OF_BAD_ADDR on error
*/
-u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr);
+u64 dev_translate_address(const struct udevice *dev, const fdt32_t *in_addr);
/**
* dev_translate_dma_address() - Translate a device-tree DMA address
* @in_addr: pointer to the DMA address to translate
* @return the translated DMA address; OF_BAD_ADDR on error
*/
-u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr);
+u64 dev_translate_dma_address(const struct udevice *dev,
+ const fdt32_t *in_addr);
/**
* dev_read_alias_highest_id - Get highest alias id for the given stem
#else /* CONFIG_DM_DEV_READ_INLINE is enabled */
-static inline int dev_read_u32(struct udevice *dev,
+static inline int dev_read_u32(const struct udevice *dev,
const char *propname, u32 *outp)
{
return ofnode_read_u32(dev_ofnode(dev), propname, outp);
}
-static inline int dev_read_u32_default(struct udevice *dev,
+static inline int dev_read_u32_default(const struct udevice *dev,
const char *propname, int def)
{
return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
}
-static inline int dev_read_s32(struct udevice *dev,
+static inline int dev_read_s32(const struct udevice *dev,
const char *propname, s32 *outp)
{
return ofnode_read_s32(dev_ofnode(dev), propname, outp);
}
-static inline int dev_read_s32_default(struct udevice *dev,
+static inline int dev_read_s32_default(const struct udevice *dev,
const char *propname, int def)
{
return ofnode_read_s32_default(dev_ofnode(dev), propname, def);
}
-static inline int dev_read_u32u(struct udevice *dev,
+static inline int dev_read_u32u(const struct udevice *dev,
const char *propname, uint *outp)
{
u32 val;
return 0;
}
-static inline int dev_read_u64(struct udevice *dev,
+static inline int dev_read_u64(const struct udevice *dev,
const char *propname, u64 *outp)
{
return ofnode_read_u64(dev_ofnode(dev), propname, outp);
}
-static inline u64 dev_read_u64_default(struct udevice *dev,
+static inline u64 dev_read_u64_default(const struct udevice *dev,
const char *propname, u64 def)
{
return ofnode_read_u64_default(dev_ofnode(dev), propname, def);
}
-static inline const char *dev_read_string(struct udevice *dev,
+static inline const char *dev_read_string(const struct udevice *dev,
const char *propname)
{
return ofnode_read_string(dev_ofnode(dev), propname);
}
-static inline bool dev_read_bool(struct udevice *dev, const char *propname)
+static inline bool dev_read_bool(const struct udevice *dev,
+ const char *propname)
{
return ofnode_read_bool(dev_ofnode(dev), propname);
}
-static inline ofnode dev_read_subnode(struct udevice *dev,
+static inline ofnode dev_read_subnode(const struct udevice *dev,
const char *subbnode_name)
{
return ofnode_find_subnode(dev_ofnode(dev), subbnode_name);
}
-static inline int dev_read_size(struct udevice *dev, const char *propname)
+static inline int dev_read_size(const struct udevice *dev, const char *propname)
{
return ofnode_read_size(dev_ofnode(dev), propname);
}
-static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)
+static inline fdt_addr_t dev_read_addr_index(const struct udevice *dev,
+ int index)
{
return devfdt_get_addr_index(dev, index);
}
-static inline fdt_addr_t dev_read_addr_size_index(struct udevice *dev,
+static inline fdt_addr_t dev_read_addr_size_index(const struct udevice *dev,
int index,
fdt_size_t *size)
{
return devfdt_get_addr_size_index(dev, index, size);
}
-static inline fdt_addr_t dev_read_addr_name(struct udevice *dev,
+static inline fdt_addr_t dev_read_addr_name(const struct udevice *dev,
const char *name)
{
return devfdt_get_addr_name(dev, name);
}
-static inline fdt_addr_t dev_read_addr_size_name(struct udevice *dev,
+static inline fdt_addr_t dev_read_addr_size_name(const struct udevice *dev,
const char *name,
fdt_size_t *size)
{
return devfdt_get_addr_size_name(dev, name, size);
}
-static inline fdt_addr_t dev_read_addr(struct udevice *dev)
+static inline fdt_addr_t dev_read_addr(const struct udevice *dev)
{
return devfdt_get_addr(dev);
}
-static inline void *dev_read_addr_ptr(struct udevice *dev)
+static inline void *dev_read_addr_ptr(const struct udevice *dev)
{
return devfdt_get_addr_ptr(dev);
}
-static inline fdt_addr_t dev_read_addr_pci(struct udevice *dev)
+static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)
{
return devfdt_get_addr_pci(dev);
}
-static inline void *dev_remap_addr(struct udevice *dev)
+static inline void *dev_remap_addr(const struct udevice *dev)
{
return devfdt_remap_addr(dev);
}
-static inline void *dev_remap_addr_index(struct udevice *dev, int index)
+static inline void *dev_remap_addr_index(const struct udevice *dev, int index)
{
return devfdt_remap_addr_index(dev, index);
}
-static inline void *dev_remap_addr_name(struct udevice *dev, const char *name)
+static inline void *dev_remap_addr_name(const struct udevice *dev,
+ const char *name)
{
return devfdt_remap_addr_name(dev, name);
}
-static inline fdt_addr_t dev_read_addr_size(struct udevice *dev,
+static inline fdt_addr_t dev_read_addr_size(const struct udevice *dev,
const char *propname,
fdt_size_t *sizep)
{
return ofnode_get_addr_size(dev_ofnode(dev), propname, sizep);
}
-static inline const char *dev_read_name(struct udevice *dev)
+static inline const char *dev_read_name(const struct udevice *dev)
{
return ofnode_get_name(dev_ofnode(dev));
}
-static inline int dev_read_stringlist_search(struct udevice *dev,
+static inline int dev_read_stringlist_search(const struct udevice *dev,
const char *propname,
const char *string)
{
return ofnode_stringlist_search(dev_ofnode(dev), propname, string);
}
-static inline int dev_read_string_index(struct udevice *dev,
+static inline int dev_read_string_index(const struct udevice *dev,
const char *propname, int index,
const char **outp)
{
return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
}
-static inline int dev_read_string_count(struct udevice *dev,
+static inline int dev_read_string_count(const struct udevice *dev,
const char *propname)
{
return ofnode_read_string_count(dev_ofnode(dev), propname);
}
-static inline int dev_read_phandle_with_args(struct udevice *dev,
+static inline int dev_read_phandle_with_args(const struct udevice *dev,
const char *list_name, const char *cells_name, int cell_count,
int index, struct ofnode_phandle_args *out_args)
{
out_args);
}
-static inline int dev_count_phandle_with_args(struct udevice *dev,
+static inline int dev_count_phandle_with_args(const struct udevice *dev,
const char *list_name, const char *cells_name)
{
return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
cells_name);
}
-static inline int dev_read_addr_cells(struct udevice *dev)
+static inline int dev_read_addr_cells(const struct udevice *dev)
{
/* NOTE: this call should walk up the parent stack */
return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev));
}
-static inline int dev_read_size_cells(struct udevice *dev)
+static inline int dev_read_size_cells(const struct udevice *dev)
{
/* NOTE: this call should walk up the parent stack */
return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev));
}
-static inline int dev_read_simple_addr_cells(struct udevice *dev)
+static inline int dev_read_simple_addr_cells(const struct udevice *dev)
{
return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev));
}
-static inline int dev_read_simple_size_cells(struct udevice *dev)
+static inline int dev_read_simple_size_cells(const struct udevice *dev)
{
return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev));
}
-static inline int dev_read_phandle(struct udevice *dev)
+static inline int dev_read_phandle(const struct udevice *dev)
{
return fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev));
}
-static inline const void *dev_read_prop(struct udevice *dev,
+static inline const void *dev_read_prop(const struct udevice *dev,
const char *propname, int *lenp)
{
return ofnode_get_property(dev_ofnode(dev), propname, lenp);
}
-static inline int dev_read_alias_seq(struct udevice *dev, int *devnump)
+static inline int dev_read_alias_seq(const struct udevice *dev, int *devnump)
{
return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name,
dev_of_offset(dev), devnump);
}
-static inline int dev_read_u32_array(struct udevice *dev, const char *propname,
- u32 *out_values, size_t sz)
+static inline int dev_read_u32_array(const struct udevice *dev,
+ const char *propname, u32 *out_values,
+ size_t sz)
{
return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz);
}
-static inline ofnode dev_read_first_subnode(struct udevice *dev)
+static inline ofnode dev_read_first_subnode(const struct udevice *dev)
{
return ofnode_first_subnode(dev_ofnode(dev));
}
return ofnode_next_subnode(node);
}
-static inline const uint8_t *dev_read_u8_array_ptr(struct udevice *dev,
- const char *propname, size_t sz)
+static inline const uint8_t *dev_read_u8_array_ptr(const struct udevice *dev,
+ const char *propname,
+ size_t sz)
{
return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz);
}
-static inline int dev_read_enabled(struct udevice *dev)
+static inline int dev_read_enabled(const struct udevice *dev)
{
return fdtdec_get_is_enabled(gd->fdt_blob, dev_of_offset(dev));
}
-static inline int dev_read_resource(struct udevice *dev, uint index,
+static inline int dev_read_resource(const struct udevice *dev, uint index,
struct resource *res)
{
return ofnode_read_resource(dev_ofnode(dev), index, res);
}
-static inline int dev_read_resource_byname(struct udevice *dev,
+static inline int dev_read_resource_byname(const struct udevice *dev,
const char *name,
struct resource *res)
{
return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
}
-static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
+static inline u64 dev_translate_address(const struct udevice *dev,
+ const fdt32_t *in_addr)
{
return ofnode_translate_address(dev_ofnode(dev), in_addr);
}
-static inline u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr)
+static inline u64 dev_translate_dma_address(const struct udevice *dev,
+ const fdt32_t *in_addr)
{
return ofnode_translate_dma_address(dev_ofnode(dev), in_addr);
}
}
#endif
+/* Dump out a list of drivers */
+void dm_dump_drivers(void);
+
/**
* Check if an of node should be or was bound before relocation.
*
*/
int (*request)(struct dma *dma);
/**
- * free - Free a previously requested dma.
+ * rfree - Free a previously requested dma.
*
* This is the implementation of the client dma_free() API.
*
* @dma: The DMA to free.
* @return 0 if OK, or a negative error code.
*/
- int (*free)(struct dma *dma);
+ int (*rfree)(struct dma *dma);
/**
* enable() - Enable a DMA Channel.
*
* @param bar returns base address of the pci device's registers
* @return 0 if ok, negative on error
*/
-int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr,
+int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
u32 *bar);
/**
#include <linux/bitops.h>
#include <linux/err.h>
#include <clk-uclass.h>
+#include <linux/err.h>
static inline void clk_dm(ulong id, struct clk *clk)
{
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+/* This is also defined in ARMv8's mmu.h */
+#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
+#endif
/* drivers/char/random.c */
#define get_random_bytes(...)
struct mtd_ooblayout_ops {
int (*ecc)(struct mtd_info *mtd, int section,
struct mtd_oob_region *oobecc);
- int (*free)(struct mtd_info *mtd, int section,
- struct mtd_oob_region *oobfree);
+ int (*rfree)(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *oobfree);
};
/*
size_t strcspn(const char *s, const char *reject);
#endif
+#ifdef CONFIG_SANDBOX
+# define strdup sandbox_strdup
+# define strndup sandbox_strndup
+#endif
+
#ifndef __HAVE_ARCH_STRDUP
extern char * strdup(const char *);
-#endif
extern char * strndup(const char *, size_t);
+#endif
#ifndef __HAVE_ARCH_STRSWAB
extern char * strswab(const char *);
#endif
*/
int (*request)(struct mbox_chan *chan);
/**
- * free - Free a previously requested channel.
+ * rfree - Free a previously requested channel.
*
* This is the implementation of the client mbox_free() API.
*
* @chan: The channel to free.
* @return 0 if OK, or a negative error code.
*/
- int (*free)(struct mbox_chan *chan);
+ int (*rfree)(struct mbox_chan *chan);
/**
* send - Send a message over a mailbox channel
*
*/
-/* #define USE_DL_PREFIX */
-
+/*
+ * Rename the U-Boot alloc functions so that sandbox can still use the system
+ * ones
+ */
+#ifdef CONFIG_SANDBOX
+#define USE_DL_PREFIX
+#endif
/*
# define pvALLOc dlpvalloc
# define mALLINFo dlmallinfo
# define mALLOPt dlmallopt
+
+/* Ensure that U-Boot actually uses these too */
+#define calloc dlcalloc
+#define free(ptr) dlfree(ptr)
+#define malloc(x) dlmalloc(x)
+#define memalign dlmemalign
+#define realloc dlrealloc
+#define valloc dlvalloc
+#define pvalloc dlpvalloc
+#define mallinfo() dlmallinfo()
+#define mallopt dlmallopt
+#define malloc_trim dlmalloc_trim
+#define malloc_usable_size dlmalloc_usable_size
+#define malloc_stats dlmalloc_stats
+
# else /* USE_DL_PREFIX */
# define cALLOc calloc
# define fREe free
void *os_malloc(size_t length);
/**
- * Free memory previous allocated with os_malloc()/os_realloc()
+ * Free memory previous allocated with os_malloc()
*
* This returns the memory to the OS.
*
*/
void os_free(void *ptr);
-/**
- * Reallocate previously-allocated memory to increase/decrease space
- *
- * This works in a similar way to the C library realloc() function. If
- * length is 0, then ptr is freed. Otherwise the space used by ptr is
- * expanded or reduced depending on whether length is larger or smaller
- * than before.
- *
- * If ptr is NULL, then this is similar to calling os_malloc().
- *
- * This function may need to move the memory block to make room for any
- * extra space, in which case the new pointer is returned.
- *
- * \param ptr Pointer to memory block to reallocate
- * \param length New length for memory block
- * \return pointer to new memory block, or NULL on failure or if length
- * is 0.
- */
-void *os_realloc(void *ptr, size_t length);
-
/**
* Access to the usleep function of the os
*
* @size: Access size
* @return 0 if OK, -ve on error
*/
- int (*read_config)(struct udevice *bus, pci_dev_t bdf, uint offset,
- ulong *valuep, enum pci_size_t size);
+ int (*read_config)(const struct udevice *bus, pci_dev_t bdf,
+ uint offset, ulong *valuep, enum pci_size_t size);
/**
* write_config() - Write a PCI configuration value
*
* @dev: Device to check
* @return bus/device/function value (see PCI_BDF())
*/
-pci_dev_t dm_pci_get_bdf(struct udevice *dev);
+pci_dev_t dm_pci_get_bdf(const struct udevice *dev);
/**
* pci_bind_bus_devices() - scan a PCI bus and bind devices
* @devp: Returns the device for this address, if found
* @return 0 if OK, -ENODEV if not found
*/
-int pci_bus_find_devfn(struct udevice *bus, pci_dev_t find_devfn,
+int pci_bus_find_devfn(const struct udevice *bus, pci_dev_t find_devfn,
struct udevice **devp);
/**
* @size: Access size
* @return 0 if OK, -ve on error
*/
-int pci_bus_read_config(struct udevice *bus, pci_dev_t bdf, int offset,
+int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset,
unsigned long *valuep, enum pci_size_t size);
/**
* Driver model PCI config access functions. Use these in preference to others
* when you have a valid device
*/
-int dm_pci_read_config(struct udevice *dev, int offset, unsigned long *valuep,
- enum pci_size_t size);
+int dm_pci_read_config(const struct udevice *dev, int offset,
+ unsigned long *valuep, enum pci_size_t size);
-int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep);
-int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep);
-int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep);
+int dm_pci_read_config8(const struct udevice *dev, int offset, u8 *valuep);
+int dm_pci_read_config16(const struct udevice *dev, int offset, u16 *valuep);
+int dm_pci_read_config32(const struct udevice *dev, int offset, u32 *valuep);
int dm_pci_write_config(struct udevice *dev, int offset, unsigned long value,
enum pci_size_t size);
* Return: 0 on success, else -EINVAL
*/
int pci_generic_mmap_write_config(
- struct udevice *bus,
- int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
+ const struct udevice *bus,
+ int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset,
+ void **addrp),
pci_dev_t bdf,
uint offset,
ulong value,
* Return: 0 on success, else -EINVAL
*/
int pci_generic_mmap_read_config(
- struct udevice *bus,
- int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
+ const struct udevice *bus,
+ int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset,
+ void **addrp),
pci_dev_t bdf,
uint offset,
ulong *valuep,
* @barnum: Bar number to read (numbered from 0)
* @return: value of BAR
*/
-u32 dm_pci_read_bar32(struct udevice *dev, int barnum);
+u32 dm_pci_read_bar32(const struct udevice *dev, int barnum);
/**
* dm_pci_bus_to_phys() - convert a PCI bus address to a physical address
* @size: Access size
* @return 0 if OK, -ve on error
*/
- int (*read_config)(struct udevice *dev, uint offset, ulong *valuep,
- enum pci_size_t size);
+ int (*read_config)(const struct udevice *dev, uint offset,
+ ulong *valuep, enum pci_size_t size);
/**
* write_config() - Write a PCI configuration value
*
* @emulp: Returns emulated device if found
* @return 0 if found, -ENODEV if not found
*/
-int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
+int sandbox_pci_get_emul(const struct udevice *bus, pci_dev_t find_devfn,
struct udevice **containerp, struct udevice **emulp);
/**
#define _PHY_H
#include <dm.h>
+#include <linux/errno.h>
#include <linux/list.h>
#include <linux/mii.h>
#include <linux/ethtool.h>
*/
int (*request)(struct power_domain *power_domain);
/**
- * free - Free a previously requested power domain.
+ * rfree - Free a previously requested power domain.
*
* This is the implementation of the client power_domain_free() API.
*
* @power_domain: The power domain to free.
* @return 0 if OK, or a negative error code.
*/
- int (*free)(struct power_domain *power_domain);
+ int (*rfree)(struct power_domain *power_domain);
/**
* on - Power on a power domain.
*
*/
int (*request)(struct reset_ctl *reset_ctl);
/**
- * free - Free a previously requested reset control.
+ * rfree - Free a previously requested reset control.
*
* This is the implementation of the client reset_free() API.
*
* @reset_ctl: The reset control to free.
* @return 0 if OK, or a negative error code.
*/
- int (*free)(struct reset_ctl *reset_ctl);
+ int (*rfree)(struct reset_ctl *reset_ctl);
/**
* rst_assert - Assert a reset signal.
*
*/
int (*play)(struct udevice *dev, void *data, uint data_size);
+ /**
+ * stop_play() - Indicate that there is no more data coming
+ *
+ * This is called once play() has finished sending all the data to the
+ * output device. This may be used to tell the hardware to turn off the
+ * codec, for example.
+ *
+ * @dev: Sound device
+ * @return 0 if OK, -ve on error
+ */
+ int (*stop_play)(struct udevice *dev);
+
/**
* start_beep() - Start beeping (optional)
*
* @start: Store the starting mallinfo when doing leak test
* @priv: A pointer to some other info some suites want to track
* @of_root: Record of the livetree root node (used for setting up tests)
+ * @expect_str: Temporary string used to hold expected string value
+ * @actual_str: Temporary string used to hold actual string value
*/
struct unit_test_state {
int fail_count;
struct mallinfo start;
void *priv;
struct device_node *of_root;
+ char expect_str[256];
+ char actual_str[256];
};
/**
const char *func, const char *cond, const char *fmt, ...)
__attribute__ ((format (__printf__, 6, 7)));
+/**
+ * ut_check_console_line() - Check the next console line against expectations
+ *
+ * This creates a string and then checks it against the next line of console
+ * output obtained with console_record_readline().
+ *
+ * After the function returns, uts->expect_str holds the expected string and
+ * uts->actual_str holds the actual string read from the console.
+ *
+ * @uts: Test state
+ * @fmt: printf() format string for the error, followed by args
+ * @return 0 if OK, other value on error
+ */
+int ut_check_console_line(struct unit_test_state *uts, const char *fmt, ...)
+ __attribute__ ((format (__printf__, 2, 3)));
+
+/**
+ * ut_check_console_end() - Check there is no more console output
+ *
+ * After the function returns, uts->actual_str holds the actual string read
+ * from the console
+ *
+ * @uts: Test state
+ * @return 0 if OK (console has no output), other value on error
+ */
+int ut_check_console_end(struct unit_test_state *uts);
+
+/**
+ * ut_check_console_dump() - Check that next lines have a print_buffer() dump
+ *
+ * This only supports a byte dump.
+ *
+ * @total_bytes: Size of the expected dump in bytes`
+ * @return 0 if OK (looks like a dump and the length matches), other value on
+ * error
+ */
+int ut_check_console_dump(struct unit_test_state *uts, int total_bytes);
/* Assert that a condition is non-zero */
#define ut_assert(cond) \
/* Assert that two int expressions are equal */
#define ut_asserteq(expr1, expr2) { \
- unsigned int val1 = (expr1), val2 = (expr2); \
+ unsigned int _val1 = (expr1), _val2 = (expr2); \
\
- if (val1 != val2) { \
+ if (_val1 != _val2) { \
ut_failf(uts, __FILE__, __LINE__, __func__, \
#expr1 " == " #expr2, \
- "Expected %#x (%d), got %#x (%d)", val1, val1, \
- val2, val2); \
+ "Expected %#x (%d), got %#x (%d)", \
+ _val1, _val1, _val2, _val2); \
return CMD_RET_FAILURE; \
} \
}
/* Assert that two string expressions are equal */
#define ut_asserteq_str(expr1, expr2) { \
- const char *val1 = (expr1), *val2 = (expr2); \
+ const char *_val1 = (expr1), *_val2 = (expr2); \
\
- if (strcmp(val1, val2)) { \
+ if (strcmp(_val1, _val2)) { \
ut_failf(uts, __FILE__, __LINE__, __func__, \
#expr1 " = " #expr2, \
- "Expected \"%s\", got \"%s\"", val1, val2); \
+ "Expected \"%s\", got \"%s\"", _val1, _val2); \
return CMD_RET_FAILURE; \
} \
}
/* Assert that two memory areas are equal */
#define ut_asserteq_mem(expr1, expr2, len) { \
- const u8 *val1 = (u8 *)(expr1), *val2 = (u8 *)(expr2); \
+ const u8 *_val1 = (u8 *)(expr1), *_val2 = (u8 *)(expr2); \
const uint __len = len; \
\
- if (memcmp(val1, val2, __len)) { \
+ if (memcmp(_val1, _val2, __len)) { \
char __buf1[64 + 1] = "\0"; \
char __buf2[64 + 1] = "\0"; \
- bin2hex(__buf1, val1, min(__len, (uint)32)); \
- bin2hex(__buf2, val2, min(__len, (uint)32)); \
+ bin2hex(__buf1, _val1, min(__len, (uint)32)); \
+ bin2hex(__buf2, _val2, min(__len, (uint)32)); \
ut_failf(uts, __FILE__, __LINE__, __func__, \
#expr1 " = " #expr2, \
"Expected \"%s\", got \"%s\"", \
/* Assert that two pointers are equal */
#define ut_asserteq_ptr(expr1, expr2) { \
- const void *val1 = (expr1), *val2 = (expr2); \
+ const void *_val1 = (expr1), *_val2 = (expr2); \
\
- if (val1 != val2) { \
+ if (_val1 != _val2) { \
ut_failf(uts, __FILE__, __LINE__, __func__, \
#expr1 " = " #expr2, \
- "Expected %p, got %p", val1, val2); \
+ "Expected %p, got %p", _val1, _val2); \
return CMD_RET_FAILURE; \
} \
}
/* Assert that a pointer is NULL */
#define ut_assertnull(expr) { \
- const void *val = (expr); \
+ const void *_val = (expr); \
\
- if (val != NULL) { \
+ if (_val) { \
ut_failf(uts, __FILE__, __LINE__, __func__, \
#expr " != NULL", \
- "Expected NULL, got %p", val); \
+ "Expected NULL, got %p", _val); \
return CMD_RET_FAILURE; \
} \
}
/* Assert that a pointer is not NULL */
#define ut_assertnonnull(expr) { \
- const void *val = (expr); \
+ const void *_val = (expr); \
\
- if (val == NULL) { \
+ if (!_val) { \
ut_failf(uts, __FILE__, __LINE__, __func__, \
#expr " = NULL", \
"Expected non-null, got NULL"); \
/* Assert that a pointer is not an error pointer */
#define ut_assertok_ptr(expr) { \
- const void *val = (expr); \
+ const void *_val = (expr); \
\
- if (IS_ERR(val)) { \
+ if (IS_ERR(_val)) { \
ut_failf(uts, __FILE__, __LINE__, __func__, \
#expr " = NULL", \
"Expected pointer, got error %ld", \
- PTR_ERR(val)); \
+ PTR_ERR(_val)); \
return CMD_RET_FAILURE; \
} \
}
/* Assert that an operation succeeds (returns 0) */
#define ut_assertok(cond) ut_asserteq(0, cond)
+/* Assert that the next console output line matches */
+#define ut_assert_nextline(fmt, args...) \
+ if (ut_check_console_line(uts, fmt, ##args)) { \
+ ut_failf(uts, __FILE__, __LINE__, __func__, \
+ "console", "\nExpected '%s',\n got '%s'", \
+ uts->expect_str, uts->actual_str); \
+ return CMD_RET_FAILURE; \
+ } \
+
+/* Assert that there is no more console output */
+#define ut_assert_console_end() \
+ if (ut_check_console_end(uts)) { \
+ ut_failf(uts, __FILE__, __LINE__, __func__, \
+ "console", "Expected no more output, got '%s'",\
+ uts->actual_str); \
+ return CMD_RET_FAILURE; \
+ } \
+
+/* Assert that the next lines are print_buffer() dump at an address */
+#define ut_assert_nextlines_are_dump(total_bytes) \
+ if (ut_check_console_dump(uts, total_bytes)) { \
+ ut_failf(uts, __FILE__, __LINE__, __func__, \
+ "console", \
+ "Expected dump of length %x bytes, got '%s'", \
+ total_bytes, uts->actual_str); \
+ return CMD_RET_FAILURE; \
+ } \
+
/**
* ut_check_free() - Return the number of bytes free in the malloc() pool
*
*/
enum tpm_version tpm_get_version(struct udevice *dev);
+/* Iterate on all TPM devices */
+#define for_each_tpm_device(dev) uclass_foreach_dev_probe(UCLASS_TPM, (dev))
+
#endif /* __TPM_COMMON_H */
#ifndef USE_HOSTCC
#include <common.h>
+#include <malloc.h>
#include <ubi_uboot.h>
+#include <dm/devres.h>
#include <linux/bitops.h>
#else
#include <common.h>
#include <binman.h>
#include <dm.h>
+#include <malloc.h>
struct binman_info {
ofnode image;
#include <config.h>
#include <common.h>
+#include <malloc.h>
#include <watchdog.h>
/*
* Written by David Howells (dhowells@redhat.com)
*/
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <keys/asymmetric-subtype.h>
#include <keys/asymmetric-parser.h>
#endif
#ifdef __UBOOT__
#include <linux/compat.h>
#include <linux/ctype.h>
+#include <linux/err.h>
#include <linux/string.h>
#else
#include <linux/seq_file.h>
#define pr_fmt(fmt) "PKCS7: "fmt
#ifdef __UBOOT__
+#include <dm/devres.h>
#include <linux/bitops.h>
#include <linux/compat.h>
#endif
#define pr_fmt(fmt) "PKEY: "fmt
#ifdef __UBOOT__
+#include <dm/devres.h>
#include <linux/compat.h>
+#include <linux/err.h>
#else
#include <linux/module.h>
#include <linux/export.h>
* Authors: Tadeusz Struk <tadeusz.struk@intel.com>
*/
#ifndef __UBOOT__
+#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/export.h>
#endif
*/
#define pr_fmt(fmt) "X.509: "fmt
+#include <dm/devres.h>
#include <linux/kernel.h>
#ifndef __UBOOT__
#include <linux/export.h>
#define pr_fmt(fmt) "X.509: "fmt
#ifdef __UBOOT__
#include <common.h>
+#include <dm/devres.h>
#include <linux/compat.h>
+#include <linux/err.h>
#include <linux/errno.h>
#else
#include <linux/module.h>
#include <common.h>
#include <debug_uart.h>
#include <errno.h>
+#include <malloc.h>
#include <linux/err.h>
#include <linux/types.h>
#include <efi.h>
#include <debug_uart.h>
#include <dm.h>
#include <errno.h>
+#include <malloc.h>
#include <linux/err.h>
#include <linux/types.h>
#include <efi.h>
#include <efi.h>
#include <efi_api.h>
#include <errno.h>
+#include <malloc.h>
#include <ns16550.h>
#include <asm/cpu.h>
#include <asm/io.h>
*/
#include <efi_driver.h>
+#include <malloc.h>
#include <dm/device-internal.h>
#include <dm/root.h>
*/
#include <efi_driver.h>
+#include <malloc.h>
/**
* check_node_type() - check node type
#include <common.h>
#include <charset.h>
+#include <malloc.h>
#include <time.h>
#include <dm/device.h>
#include <efi_loader.h>
#include <dm.h>
#include <elf.h>
#include <efi_loader.h>
+#include <malloc.h>
#include <rtc.h>
#include <u-boot/crc.h>
#include <dm.h>
#include <hang.h>
#include <init.h>
+#include <malloc.h>
#include <dm/of_extra.h>
#include <env.h>
#include <errno.h>
return -ENOENT;
}
-int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr,
+int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
u32 *bar)
{
int barnum;
#include "avb_sha.h"
#include "avb_util.h"
#include "avb_version.h"
+#include <malloc.h>
#define NUM_GUIDS 3
#include "avb_descriptor.h"
#include "avb_util.h"
#include "avb_vbmeta_image.h"
+#include <malloc.h>
bool avb_descriptor_validate_and_byteswap(const AvbDescriptor* src,
AvbDescriptor* dest) {
#include "avb_sha.h"
#include "avb_util.h"
#include "avb_vbmeta_image.h"
+#include <malloc.h>
typedef struct IAvbKey {
unsigned int len; /* Length of n[] in number of uint32_t */
#include "avb_util.h"
#include "avb_vbmeta_image.h"
#include "avb_version.h"
+#include <malloc.h>
/* Maximum number of partitions that can be loaded with avb_slot_verify(). */
#define MAX_NUMBER_OF_LOADED_PARTITIONS 32
*/
#include <hang.h>
+#include <malloc.h>
#include <stdarg.h>
#include <stdlib.h>
*/
#include "avb_util.h"
+#include <malloc.h>
#include <stdarg.h>
#include <common.h>
+#include <malloc.h>
#include <memalign.h>
#include <linux/compat.h>
#ifndef __UBOOT__
+#include <dm/devres.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <common.h>
#include <lmb.h>
+#include <malloc.h>
#define LMB_ALLOC_ANYWHERE 0
*/
#include "mkimage.h"
+#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <image.h>
#ifndef USE_HOSTCC
#include <common.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <asm/types.h>
#include <asm/byteorder.h>
#include <linux/errno.h>
strcpy (new, s);
return new;
}
-#endif
char * strndup(const char *s, size_t n)
{
return new;
}
+#endif
#ifndef __HAVE_ARCH_STRSPN
/**
#include "huf.h"
#include "mem.h" /* low level memory routines */
#include "zstd_internal.h"
+#include <malloc.h>
#include <linux/kernel.h>
#include <linux/compat.h>
#include <linux/string.h> /* memcpy, memmove, memset */
***************************************/
#include "error_private.h"
#include "zstd_internal.h" /* declaration of ZSTD_isError, ZSTD_getErrorName, ZSTD_getErrorCode, ZSTD_getErrorString, ZSTD_versionNumber */
+#include <malloc.h>
#include <linux/kernel.h>
/*=**************************************************************
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <miiphy.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/uclass-internal.h>
+#include <linux/compat.h>
/* DT node properties for MAC-PHY interface */
#define PHY_MODE_STR_CNT 2
#include <common.h>
#include <env.h>
+#include <malloc.h>
#include <stdio_dev.h>
#include <time.h>
#include <watchdog.h>
phandle = get_node_phandle(dt, refnode);
*((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
+
+ reference_node(refnode);
}
}
}
path = refnode->fullpath;
prop->val = data_insert_at_marker(prop->val, m, path,
strlen(path) + 1);
+
+ reference_node(refnode);
}
}
}
ERROR(path_references, fixup_path_references, NULL, &duplicate_node_names);
+static void fixup_omit_unused_nodes(struct check *c, struct dt_info *dti,
+ struct node *node)
+{
+ if (node->omit_if_unused && !node->is_referenced)
+ delete_node(node);
+}
+ERROR(omit_unused_nodes, fixup_omit_unused_nodes, NULL, &phandle_references, &path_references);
+
/*
* Semantic checks
*/
&explicit_phandles,
&phandle_references, &path_references,
+ &omit_unused_nodes,
&address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell,
&device_type_is_string, &model_is_string, &status_is_string,
return DT_DEL_NODE;
}
+<*>"/omit-if-no-ref/" {
+ DPRINT("Keyword: /omit-if-no-ref/\n");
+ DPRINT("<PROPNODENAME>\n");
+ BEGIN(PROPNODENAME);
+ return DT_OMIT_NO_REF;
+ }
+
<*>{LABEL}: {
DPRINT("Label: %s\n", yytext);
yylval.labelref = xstrdup(yytext);
%token DT_BITS
%token DT_DEL_PROP
%token DT_DEL_NODE
+%token DT_OMIT_NO_REF
%token <propnodename> DT_PROPNODENAME
%token <integer> DT_LITERAL
%token <integer> DT_CHAR_LITERAL
ERROR(&@3, "Label or path %s not found", $3);
+ $$ = $1;
+ }
+ | devicetree DT_OMIT_NO_REF DT_REF ';'
+ {
+ struct node *target = get_node_by_ref($1, $3);
+
+ if (target)
+ omit_node_if_unused(target);
+ else
+ ERROR(&@3, "Label or path %s not found", $3);
+
+
$$ = $1;
}
;
{
$$ = name_node(build_node_delete(), $2);
}
+ | DT_OMIT_NO_REF subnode
+ {
+ $$ = omit_node_if_unused($2);
+ }
| DT_LABEL subnode
{
add_label(&$2->labels, $1);
struct label *labels;
const struct bus_type *bus;
+
+ bool omit_if_unused, is_referenced;
};
#define for_each_label_withdel(l0, l) \
struct node *build_node(struct property *proplist, struct node *children);
struct node *build_node_delete(void);
struct node *name_node(struct node *node, char *name);
+struct node *omit_node_if_unused(struct node *node);
+struct node *reference_node(struct node *node);
struct node *chain_node(struct node *first, struct node *list);
struct node *merge_nodes(struct node *old_node, struct node *new_node);
struct node *add_orphan_node(struct node *old_node, struct node *new_node, char *ref);
return node;
}
+struct node *omit_node_if_unused(struct node *node)
+{
+ node->omit_if_unused = 1;
+
+ return node;
+}
+
+struct node *reference_node(struct node *node)
+{
+ node->is_referenced = 1;
+
+ return node;
+}
+
struct node *merge_nodes(struct node *old_node, struct node *new_node)
{
struct property *new_prop, *old_prop;
TEST_SIZE = 10,
TEST_SIZE2 = 20,
+ TEST_SIZE_LARGE = 0xe0,
TEST_ADDR = CONFIG_BLOBLIST_ADDR,
TEST_BLOBLIST_SIZE = 0x100,
{
struct bloblist_hdr *hdr;
- /* Clear out any existing bloblist so we have a clean slate */
+ /*
+ * Clear out any existing bloblist so we have a clean slate. Zero the
+ * header so that existing records are removed, but set everything else
+ * to 0xff for testing purposes.
+ */
hdr = map_sysmem(CONFIG_BLOBLIST_ADDR, TEST_BLOBLIST_SIZE);
- memset(hdr, '\0', TEST_BLOBLIST_SIZE);
+ memset(hdr, '\xff', TEST_BLOBLIST_SIZE);
+ memset(hdr, '\0', sizeof(*hdr));
return hdr;
}
+static int check_zero(void *data, int size)
+{
+ u8 *ptr;
+ int i;
+
+ for (ptr = data, i = 0; i < size; i++, ptr++) {
+ if (*ptr)
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int bloblist_test_init(struct unit_test_state *uts)
{
struct bloblist_hdr *hdr;
data = bloblist_find(TEST_TAG, TEST_SIZE);
ut_asserteq_ptr(rec + 1, data);
+ /* Check the data is zeroed */
+ ut_assertok(check_zero(data, TEST_SIZE));
+
/* Check the 'ensure' method */
ut_asserteq_ptr(data, bloblist_ensure(TEST_TAG, TEST_SIZE));
ut_assertnull(bloblist_ensure(TEST_TAG, TEST_SIZE2));
rec2 = (struct bloblist_rec *)(data + ALIGN(TEST_SIZE, BLOBLIST_ALIGN));
+ ut_assertok(check_zero(data, TEST_SIZE));
/* Check for a non-existent record */
ut_asserteq_ptr(data, bloblist_ensure(TEST_TAG, TEST_SIZE));
}
BLOBLIST_TEST(bloblist_test_blob, 0);
+/* Check bloblist_ensure_size_ret() */
+static int bloblist_test_blob_ensure(struct unit_test_state *uts)
+{
+ void *data, *data2;
+ int size;
+
+ /* At the start there should be no records */
+ clear_bloblist();
+ ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0));
+
+ /* Test with an empty bloblist */
+ size = TEST_SIZE;
+ ut_assertok(bloblist_ensure_size_ret(TEST_TAG, &size, &data));
+ ut_asserteq(TEST_SIZE, size);
+ ut_assertok(check_zero(data, TEST_SIZE));
+
+ /* Check that we get the same thing again */
+ ut_assertok(bloblist_ensure_size_ret(TEST_TAG, &size, &data2));
+ ut_asserteq(TEST_SIZE, size);
+ ut_asserteq_ptr(data, data2);
+
+ /* Check that the size remains the same */
+ size = TEST_SIZE2;
+ ut_assertok(bloblist_ensure_size_ret(TEST_TAG, &size, &data));
+ ut_asserteq(TEST_SIZE, size);
+
+ /* Check running out of space */
+ size = TEST_SIZE_LARGE;
+ ut_asserteq(-ENOSPC, bloblist_ensure_size_ret(TEST_TAG2, &size, &data));
+
+ return 0;
+}
+BLOBLIST_TEST(bloblist_test_blob_ensure, 0);
+
static int bloblist_test_bad_blob(struct unit_test_state *uts)
{
struct bloblist_hdr *hdr;
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <asm/clk.h>
#include <dm/test.h>
#include <dm/device-internal.h>
#include <dm.h>
#include <malloc.h>
#include <dm/device-internal.h>
+#include <dm/devres.h>
#include <dm/test.h>
#include <dm/uclass-internal.h>
#include <test/ut.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/test.h>
#include <dma.h>
#include <test/ut.h>
#include <common.h>
#include <fdtdec.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/root.h>
#include <dm/test.h>
#include <dm/util.h>
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/test.h>
#include <asm/mbox.h>
#include <test/ut.h>
return 0;
}
DM_TEST(dm_test_ofnode_fmap, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+static int dm_test_ofnode_read(struct unit_test_state *uts)
+{
+ const u32 *val;
+ ofnode node;
+ int size;
+
+ node = ofnode_path("/a-test");
+ ut_assert(ofnode_valid(node));
+
+ val = ofnode_read_prop(node, "int-value", &size);
+ ut_assertnonnull(val);
+ ut_asserteq(4, size);
+ ut_asserteq(1234, fdt32_to_cpu(val[0]));
+
+ val = ofnode_read_prop(node, "missing", &size);
+ ut_assertnull(val);
+ ut_asserteq(-FDT_ERR_NOTFOUND, size);
+
+ /* Check it works without a size parameter */
+ val = ofnode_read_prop(node, "missing", NULL);
+ ut_assertnull(val);
+
+ return 0;
+}
+DM_TEST(dm_test_ofnode_read, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+static int dm_test_ofnode_read_chosen(struct unit_test_state *uts)
+{
+ const char *str;
+ const u32 *val;
+ ofnode node;
+ int size;
+
+ str = ofnode_read_chosen_string("setting");
+ ut_assertnonnull(str);
+ ut_asserteq_str("sunrise ohoka", str);
+ ut_asserteq_ptr(NULL, ofnode_read_chosen_string("no-setting"));
+
+ node = ofnode_get_chosen_node("other-node");
+ ut_assert(ofnode_valid(node));
+ ut_asserteq_str("c-test@5", ofnode_get_name(node));
+
+ node = ofnode_get_chosen_node("setting");
+ ut_assert(!ofnode_valid(node));
+
+ val = ofnode_read_chosen_prop("int-values", &size);
+ ut_assertnonnull(val);
+ ut_asserteq(8, size);
+ ut_asserteq(0x1937, fdt32_to_cpu(val[0]));
+ ut_asserteq(72993, fdt32_to_cpu(val[1]));
+
+ return 0;
+}
+DM_TEST(dm_test_ofnode_read_chosen, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/test.h>
#include <asm/power-domain.h>
#include <test/ut.h>
#include <syscon.h>
#include <asm/test.h>
#include <dm/test.h>
+#include <linux/err.h>
#include <test/ut.h>
/* Base test of register maps */
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <reset.h>
#include <dm/test.h>
#include <asm/reset.h>
ut_asserteq(4560, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, 100));
ut_asserteq(9120, sandbox_get_sound_sum(dev));
+ ut_asserteq(false, sandbox_get_sound_active(dev));
return 0;
}
#include <common.h>
#include <fdtdec.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/device.h>
#include <dm/root.h>
#include <dm/test.h>
#include <regmap.h>
#include <asm/test.h>
#include <dm/test.h>
+#include <linux/err.h>
#include <test/ut.h>
/* Base test of system controllers */
#include <common.h>
#include <dm.h>
+#include <malloc.h>
#include <dm/test.h>
#include <sandboxtee.h>
#include <tee.h>
#include <dm/test.h>
#include <dm/root.h>
#include <dm/device-internal.h>
+#include <dm/devres.h>
#include <dm/uclass-internal.h>
#include <dm/util.h>
#include <dm/lists.h>
return 0;
}
DM_TEST(dm_test_uclass_drvdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test device_first_child_ofdata_err(), etc. */
+static int dm_test_child_ofdata(struct unit_test_state *uts)
+{
+ struct udevice *bus, *dev;
+ int count;
+
+ ut_assertok(uclass_first_device_err(UCLASS_TEST_BUS, &bus));
+ count = 0;
+ device_foreach_child_ofdata_to_platdata(dev, bus) {
+ ut_assert(dev->flags & DM_FLAG_PLATDATA_VALID);
+ ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
+ count++;
+ }
+ ut_asserteq(3, count);
+
+ return 0;
+}
+DM_TEST(dm_test_child_ofdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test device_first_child_err(), etc. */
+static int dm_test_first_child_probe(struct unit_test_state *uts)
+{
+ struct udevice *bus, *dev;
+ int count;
+
+ ut_assertok(uclass_first_device_err(UCLASS_TEST_BUS, &bus));
+ count = 0;
+ device_foreach_child_probe(dev, bus) {
+ ut_assert(dev->flags & DM_FLAG_PLATDATA_VALID);
+ ut_assert(dev->flags & DM_FLAG_ACTIVATED);
+ count++;
+ }
+ ut_asserteq(3, count);
+
+ return 0;
+}
+DM_TEST(dm_test_first_child_probe, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
* Silence the console and rely on console recording to get
* our output.
*/
- console_record_reset();
+ console_record_reset_enable();
if (!state->show_test_output)
gd->flags |= GD_FLG_SILENT;
test->func(uts);
- gd->flags &= ~GD_FLG_SILENT;
+ gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
state_set_skip_delays(false);
ut_assertok(dm_test_destroy(uts));
#include <common.h>
#include <bzlib.h>
#include <dm.h>
+#include <malloc.h>
#include <mapmem.h>
#include <os.h>
#include <video.h>
#include <common.h>
#include <lmb.h>
+#include <malloc.h>
#include <dm/test.h>
#include <test/ut.h>
#include <charset.h>
#include <command.h>
#include <errno.h>
+#include <malloc.h>
#include <test/test.h>
#include <test/suites.h>
#include <test/ut.h>
*/
#include <common.h>
+#include <console.h>
#include <malloc.h>
#include <test/test.h>
#include <test/ut.h>
return ut_check_free() - last;
}
+int ut_check_console_line(struct unit_test_state *uts, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vsnprintf(uts->expect_str, sizeof(uts->expect_str), fmt, args);
+ va_end(args);
+ console_record_readline(uts->actual_str, sizeof(uts->actual_str));
+
+ return strcmp(uts->expect_str, uts->actual_str);
+}
+
+int ut_check_console_end(struct unit_test_state *uts)
+{
+ if (!console_record_avail())
+ return 0;
+
+ console_record_readline(uts->actual_str, sizeof(uts->actual_str));
+
+ return 1;
+}
+
+int ut_check_console_dump(struct unit_test_state *uts, int total_bytes)
+{
+ char *str = uts->actual_str;
+ int upto;
+
+ /* Handle empty dump */
+ if (!total_bytes)
+ return 0;
+
+ for (upto = 0; upto < total_bytes;) {
+ int len;
+ int bytes;
+
+ len = console_record_readline(str, sizeof(uts->actual_str));
+ if (str[8] != ':' || str[9] != ' ')
+ return 1;
+
+ bytes = len - 8 - 2 - 3 * 16 - 4;
+ upto += bytes;
+ }
+
+ return upto == total_bytes ? 0 : 1;
+}
URL containing this toolchain, if avaialble, else None
"""
arch = command.OutputOneLine('uname', '-m')
+ if arch == 'aarch64':
+ arch = 'arm64'
base = 'https://www.kernel.org/pub/tools/crosstool/files/bin'
versions = ['7.3.0', '6.4.0', '4.9.4']
links = []