diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/bootcount.h | 1 | ||||
-rw-r--r-- | include/clk.h | 12 | ||||
-rw-r--r-- | include/command.h | 1 | ||||
-rw-r--r-- | include/common.h | 191 | ||||
-rw-r--r-- | include/configs/brsmarc1.h | 83 | ||||
-rw-r--r-- | include/configs/da850evm.h | 4 | ||||
-rw-r--r-- | include/configs/hikey960.h | 60 | ||||
-rw-r--r-- | include/dm/fdtaddr.h | 18 | ||||
-rw-r--r-- | include/dm/read.h | 41 | ||||
-rw-r--r-- | include/dt-bindings/clock/hi3660-clock.h | 214 | ||||
-rw-r--r-- | include/dt-bindings/phy/phy-am654-serdes.h | 13 | ||||
-rw-r--r-- | include/env.h | 335 | ||||
-rw-r--r-- | include/env_callback.h | 25 | ||||
-rw-r--r-- | include/env_default.h | 2 | ||||
-rw-r--r-- | include/env_flags.h | 7 | ||||
-rw-r--r-- | include/env_internal.h (renamed from include/environment.h) | 110 | ||||
-rw-r--r-- | include/exports.h | 1 | ||||
-rw-r--r-- | include/gzip.h | 103 | ||||
-rw-r--r-- | include/lcd.h | 1 | ||||
-rw-r--r-- | include/net.h | 12 | ||||
-rw-r--r-- | include/pcmcia.h | 137 | ||||
-rw-r--r-- | include/pcmcia/yenta.h | 156 | ||||
-rw-r--r-- | include/search.h | 77 | ||||
-rw-r--r-- | include/watchdog.h | 2 |
24 files changed, 972 insertions, 634 deletions
diff --git a/include/bootcount.h b/include/bootcount.h index daee84316c..8fa8cf8218 100644 --- a/include/bootcount.h +++ b/include/bootcount.h @@ -9,6 +9,7 @@ #include <common.h> #include <asm/io.h> #include <asm/byteorder.h> +#include <env.h> #ifdef CONFIG_DM_BOOTCOUNT diff --git a/include/clk.h b/include/clk.h index 2ebc905e04..3ca2796b57 100644 --- a/include/clk.h +++ b/include/clk.h @@ -333,6 +333,18 @@ int clk_disable(struct clk *clk); */ int clk_disable_bulk(struct clk_bulk *bulk); +/** + * clk_is_match - check if two clk's point to the same hardware clock + * @p: clk compared against q + * @q: clk compared against p + * + * Returns true if the two struct clk pointers both point to the same hardware + * clock node. + * + * Returns false otherwise. Note that two NULL clks are treated as matching. + */ +bool clk_is_match(const struct clk *p, const struct clk *q); + int soc_clk_dump(void); /** diff --git a/include/command.h b/include/command.h index 2bfee89df3..f6170e7151 100644 --- a/include/command.h +++ b/include/command.h @@ -10,6 +10,7 @@ #ifndef __COMMAND_H #define __COMMAND_H +#include <env.h> #include <linker_lists.h> #ifndef NULL diff --git a/include/common.h b/include/common.h index 2c21dee850..d8f302ea92 100644 --- a/include/common.h +++ b/include/common.h @@ -1,5 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* + * Common header file for U-Boot + * + * This file still includes quite a bit of stuff that should be in separate + * headers like command.h, cpu.h and timer.h. Please think before adding more + * things. Patches to remove things are welcome. + * * (C) Copyright 2000-2009 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ @@ -45,16 +51,6 @@ typedef void (interrupt_handler_t)(void *); #include <asm/u-boot.h> /* boot information for Linux kernel */ #include <asm/global_data.h> /* global data used for startup functions */ -#if defined(CONFIG_ENV_IS_EMBEDDED) -#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN -#elif ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \ - (CONFIG_ENV_ADDR >= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)) ) || \ - defined(CONFIG_ENV_IS_IN_NVRAM) -#define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE) -#else -#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN -#endif - /* startup functions, used in: * common/board_f.c * common/init/board_init.c @@ -145,114 +141,6 @@ int do_fat_fsload(cmd_tbl_t *, int, int, char * const []); /* common/cmd_ext2.c */ int do_ext2load(cmd_tbl_t *, int, int, char * const []); -/* common/cmd_nvedit.c */ -int env_init (void); -void env_relocate (void); -int envmatch (uchar *, int); - -/** - * env_get() - Look up the value of an environment variable - * - * In U-Boot proper this can be called before relocation (which is when the - * environment is loaded from storage, i.e. GD_FLG_ENV_READY is 0). In that - * case this function calls env_get_f(). - * - * @varname: Variable to look up - * @return value of variable, or NULL if not found - */ -char *env_get(const char *varname); - -/** - * env_get_f() - Look up the value of an environment variable (early) - * - * This function is called from env_get() if the environment has not been - * loaded yet (GD_FLG_ENV_READY flag is 0). Some environment locations will - * support reading the value (slowly) and some will not. - * - * @varname: Variable to look up - * @return value of variable, or NULL if not found - */ -int env_get_f(const char *name, char *buf, unsigned len); - -/** - * env_get_ulong() - Return an environment variable as an integer value - * - * Most U-Boot environment variables store hex values. For those which store - * (e.g.) base-10 integers, this function can be used to read the value. - * - * @name: Variable to look up - * @base: Base to use (e.g. 10 for base 10, 2 for binary) - * @default_val: Default value to return if no value is found - * @return the value found, or @default_val if none - */ -ulong env_get_ulong(const char *name, int base, ulong default_val); - -/** - * env_get_hex() - Return an environment variable as a hex value - * - * Decode an environment as a hex number (it may or may not have a 0x - * prefix). If the environment variable cannot be found, or does not start - * with hex digits, the default value is returned. - * - * @varname: Variable to decode - * @default_val: Value to return on error - */ -ulong env_get_hex(const char *varname, ulong default_val); - -/* - * Read an environment variable as a boolean - * Return -1 if variable does not exist (default to true) - */ -int env_get_yesno(const char *var); - -/** - * env_set() - set an environment variable - * - * This sets or deletes the value of an environment variable. For setting the - * value the variable is created if it does not already exist. - * - * @varname: Variable to adjust - * @value: Value to set for the variable, or NULL or "" to delete the variable - * @return 0 if OK, 1 on error - */ -int env_set(const char *varname, const char *value); - -/** - * env_set_ulong() - set an environment variable to an integer - * - * @varname: Variable to adjust - * @value: Value to set for the variable (will be converted to a string) - * @return 0 if OK, 1 on error - */ -int env_set_ulong(const char *varname, ulong value); - -/** - * env_set_hex() - set an environment variable to a hex value - * - * @varname: Variable to adjust - * @value: Value to set for the variable (will be converted to a hex string) - * @return 0 if OK, 1 on error - */ -int env_set_hex(const char *varname, ulong value); - -/** - * env_set_addr - Set an environment variable to an address in hex - * - * @varname: Environment variable to set - * @addr: Value to set it to - * @return 0 if ok, 1 on error - */ -static inline int env_set_addr(const char *varname, const void *addr) -{ - return env_set_hex(varname, (ulong)addr); -} - -#ifdef CONFIG_AUTO_COMPLETE -int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf, - bool dollar_comp); -#endif -int get_env_id (void); - void pci_init_board(void); /* common/exports.c */ @@ -379,23 +267,12 @@ void enable_interrupts (void); int disable_interrupts (void); /* $(CPU)/.../commproc.c */ -int dpram_init (void); -uint dpram_base(void); -uint dpram_base_align(uint align); -uint dpram_alloc(uint size); -uint dpram_alloc_align(uint size,uint align); void bootcount_store (ulong); ulong bootcount_load (void); /* $(CPU)/.../<eth> */ void mii_init (void); -/* $(CPU)/.../lcd.c */ -ulong lcd_setmem (ulong); - -/* $(CPU)/.../video.c */ -ulong video_setmem (ulong); - /* arch/$(ARCH)/lib/cache.c */ void enable_caches(void); void flush_cache (unsigned long, unsigned long); @@ -428,51 +305,6 @@ void wait_ticks (unsigned long); ulong usec2ticks (unsigned long usec); ulong ticks2usec (unsigned long ticks); -/* lib/gunzip.c */ -int gzip_parse_header(const unsigned char *src, unsigned long len); -int gunzip(void *, int, unsigned char *, unsigned long *); -int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, - int stoponerr, int offset); - -/** - * gzwrite progress indicators: defined weak to allow board-specific - * overrides: - * - * gzwrite_progress_init called on startup - * gzwrite_progress called during decompress/write loop - * gzwrite_progress_finish called at end of loop to - * indicate success (retcode=0) or failure - */ -void gzwrite_progress_init(u64 expected_size); - -void gzwrite_progress(int iteration, - u64 bytes_written, - u64 total_bytes); - -void gzwrite_progress_finish(int retcode, - u64 totalwritten, - u64 totalsize, - u32 expected_crc, - u32 calculated_crc); - -/** - * decompress and write gzipped image from memory to block device - * - * @param src compressed image address - * @param len compressed image length in bytes - * @param dev block device descriptor - * @param szwritebuf bytes per write (pad to erase size) - * @param startoffs offset in bytes of first write - * @param szexpected expected uncompressed length - * may be zero to use gzip trailer - * for files under 4GiB - */ -int gzwrite(unsigned char *src, int len, - struct blk_desc *dev, - unsigned long szwritebuf, - u64 startoffs, - u64 szexpected); - /* lib/lz4_wrapper.c */ int ulz4fn(const void *src, size_t srcn, void *dst, size_t *dstn); @@ -506,13 +338,6 @@ unsigned int rand_r(unsigned int *seedp); int serial_printf (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); -/* lib/gzip.c */ -int gzip(void *dst, unsigned long *lenp, - unsigned char *src, unsigned long srclen); -int zzip(void *dst, unsigned long *lenp, unsigned char *src, - unsigned long srclen, int stoponerr, - int (*func)(unsigned long, unsigned long)); - /* lib/net_utils.c */ #include <net.h> static inline struct in_addr env_get_ip(char *var) @@ -520,8 +345,6 @@ static inline struct in_addr env_get_ip(char *var) return string_to_ip(env_get(var)); } -int pcmcia_init (void); - #ifdef CONFIG_LED_STATUS # include <status_led.h> #endif @@ -575,7 +398,7 @@ int cpu_release(u32 nr, int argc, char * const argv[]); /* Pull in stuff for the build system */ #ifdef DO_DEPS_ONLY -# include <environment.h> +# include <env_internal.h> #endif #endif /* __COMMON_H_ */ diff --git a/include/configs/brsmarc1.h b/include/configs/brsmarc1.h new file mode 100644 index 0000000000..c18445816e --- /dev/null +++ b/include/configs/brsmarc1.h @@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * brsmarc1.h + * + * specific parts for B&R BRSMARC1 Motherboard + * + * Copyright (C) 2017 Hannes Schmelzer <oe5hpm@oevsv.at> - + * B&R Industrial Automation GmbH - http://www.br-automation.com + * + */ + +#ifndef __CONFIG_BRSMARC1_H__ +#define __CONFIG_BRSMARC1_H__ + +#include <configs/bur_cfg_common.h> +#include <configs/bur_am335x_common.h> +/* ------------------------------------------------------------------------- */ +#define CONFIG_BOARD_TYPES + +/* memory */ +#define CONFIG_SYS_MALLOC_LEN (5 * 1024 * 1024) +#define CONFIG_SYS_BOOTM_LEN (32 * 1024 * 1024) + +/* Clock Defines */ +#define V_OSCK 26000000 /* Clock output from T2 */ +#define V_SCLK (V_OSCK) + +#define CONFIG_MACH_TYPE 3589 + +#ifndef CONFIG_SPL_BUILD + +/* Default environment */ +#define CONFIG_EXTRA_ENV_SETTINGS \ +BUR_COMMON_ENV \ +"autoload=0\0" \ +"scradr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ +"cfgscr=mw ${dtbaddr} 0;" \ +" sf probe && sf read ${scradr} 0xC0000 0x10000 && source ${scradr};" \ +" fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0" \ +"dtbaddr=0x84000000\0" \ +"loadaddr=0x82000000\0" \ +"b_break=0\0" \ +"b_tgts_std=mmc0 mmc1 def net usb0\0" \ +"b_tgts_rcy=def net usb0\0" \ +"b_tgts_pme=net usb0 mmc0 mmc1\0" \ +"b_deftgts=if test ${b_mode} = 12; then setenv b_tgts ${b_tgts_pme};" \ +" elif test ${b_mode} = 0; then setenv b_tgts ${b_tgts_rcy};" \ +" else setenv b_tgts ${b_tgts_std}; fi\0" \ +"b_mmc0=load mmc 1 ${scradr} bootscr.img && source ${scradr}\0" \ +"b_mmc1=load mmc 1 ${loadaddr} arimg.ugz && run startsys\0" \ +"b_def=sf read ${loadaddr} 100000 700000; run startsys\0" \ +"b_net=tftp ${scradr} netscript.img && source ${scradr}\0" \ +"b_usb0=usb start && load usb 0 ${scradr} bootscr.img && source ${scradr}\0" \ +"b_default=run b_deftgts; for target in ${b_tgts};"\ +" do run b_${target}; if test ${b_break} = 1; then; exit; fi; done\0" \ +"vxargs=setenv bootargs cpsw(0,0)host:vxWorks h=${serverip}" \ +" e=${ipaddr}:${netmask} g=${gatewayip} u=vxWorksFTP pw=vxWorks\0" \ +"vxfdt=fdt addr ${dtbaddr}; fdt resize 0x8000;" \ +" fdt boardsetup\0" \ +"startsys=run vxargs && mw 0x80001100 0 && run vxfdt &&" \ +" bootm ${loadaddr} - ${dtbaddr}\0" +#endif /* !CONFIG_SPL_BUILD*/ + +/* undefine command which we not need here */ +#undef CONFIG_BOOTM_NETBSD +#undef CONFIG_BOOTM_PLAN9 +#undef CONFIG_BOOTM_RTEMS + +/* Support both device trees and ATAGs. */ +#define CONFIG_CMDLINE_TAG +#define CONFIG_SETUP_MEMORY_TAGS +#define CONFIG_INITRD_TAG + +/* SPI Flash */ +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x40000 + +/* Environment */ +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT +#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \ + CONFIG_ENV_SECT_SIZE) + +#define CONFIG_CONS_INDEX 1 +#endif /* __CONFIG_BRSMARC1_H__ */ diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index ff536131ba..9bd6da015e 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -26,7 +26,7 @@ #define CONFIG_SYS_OSCIN_FREQ 24000000 #define CONFIG_SYS_TIMERBASE DAVINCI_TIMER0_BASE #define CONFIG_SYS_HZ_CLOCK clk_get(DAVINCI_AUXCLK_CLKID) -#define CONFIG_SKIP_LOWLEVEL_INIT +#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY #ifdef CONFIG_DIRECT_NOR_BOOT #define CONFIG_ARCH_CPU_INIT @@ -192,7 +192,7 @@ #ifdef CONFIG_USE_NOR #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of flash banks */ #define CONFIG_SYS_FLASH_SECT_SZ (128 << 10) /* 128KB */ -#define CONFIG_ENV_OFFSET (CONFIG_SYS_FLASH_SECT_SZ * 3) +#define CONFIG_ENV_OFFSET (SZ_1M) #define CONFIG_ENV_SIZE (10 << 10) /* 10KB */ #define CONFIG_SYS_FLASH_BASE DAVINCI_ASYNC_EMIF_DATA_CE2_BASE #define PHYS_FLASH_SIZE (8 << 20) /* Flash size 8MB */ diff --git a/include/configs/hikey960.h b/include/configs/hikey960.h new file mode 100644 index 0000000000..f6f9c8d85a --- /dev/null +++ b/include/configs/hikey960.h @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2019 Linaro + * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> + */ + +#ifndef __HIKEY_H +#define __HIKEY_H + +#include <linux/sizes.h> + +#define CONFIG_SYS_BOOTM_LEN SZ_64M + +/* Physical Memory Map */ + +/* CONFIG_SYS_TEXT_BASE needs to align with where ATF loads bl33.bin */ + +#define PHYS_SDRAM_1 0x00000000 +#define PHYS_SDRAM_1_SIZE 0xC0000000 + +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 + +#define CONFIG_SYS_INIT_RAM_SIZE 0x1000 + +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0) + +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x80000) + +/* Generic Timer Definitions */ +#define COUNTER_FREQUENCY 19000000 + +/* Generic Interrupt Controller Definitions */ +#define GICD_BASE 0xe82b1000 +#define GICC_BASE 0xe82b2000 + +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M) + +#define CONFIG_ENV_SIZE 0x1000 + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) +#include <config_distro_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "image=Image\0" \ + "fdtfile=hi3660-hikey960.dtb\0" \ + "fdt_addr_r=0x10000000\0" \ + "kernel_addr_r=0x11000000\0" \ + "scriptaddr=0x00020000\0" \ + "fdt_high=0xffffffffffffffff\0" \ + "initrd_high=0xffffffffffffffff\0" \ + BOOTENV + +#define CONFIG_ENV_SIZE 0x1000 + +/* TODO: Remove this once the SD clock is fixed */ +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1024 + +#endif /* __HIKEY_H */ diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h index 3bc2599b6c..57b326cb33 100644 --- a/include/dm/fdtaddr.h +++ b/include/dm/fdtaddr.h @@ -120,4 +120,22 @@ fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index, */ fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name); +/** + * devfdt_get_addr_size_name() - Get the reg property and its size for a device, + * indexed by name + * + * Returns the address and size specified in the 'reg' property of a device. + * + * @dev: Pointer to a device + * @name: the 'reg' property can hold a list of <addr, size> pairs, with the + * 'reg-names' property providing named-based identification. @index + * indicates the value to search for in 'reg-names'. + * @size: Pointer to size variable - this function returns the size + * specified in the 'reg' property here + * + * @return addr + */ +fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name, + fdt_size_t *size); + #endif diff --git a/include/dm/read.h b/include/dm/read.h index 6ecd062e20..0c62d62f11 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -145,6 +145,19 @@ int dev_read_size(struct udevice *dev, const char *propname); fdt_addr_t dev_read_addr_index(struct udevice *dev, int index); /** + * dev_read_addr_size_index() - Get the indexed reg property of a device + * + * @dev: Device to read from + * @index: the 'reg' property can hold a list of <addr, size> pairs + * and @index is used to select which one is required + * @size: place to put size value (on success) + * + * @return address or FDT_ADDR_T_NONE if not found + */ +fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index, + fdt_size_t *size); + +/** * dev_remap_addr_index() - Get the indexed reg property of a device * as a memory-mapped I/O pointer * @@ -169,6 +182,20 @@ void *dev_remap_addr_index(struct udevice *dev, int index); fdt_addr_t dev_read_addr_name(struct udevice *dev, const char* name); /** + * dev_read_addr_size_name() - Get the reg property of a device, indexed by name + * + * @dev: Device to read from + * @name: the 'reg' property can hold a list of <addr, size> pairs, with the + * 'reg-names' property providing named-based identification. @index + * indicates the value to search for in 'reg-names'. + * @size: place to put size value (on success) + * + * @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_size_t *size); + +/** * dev_remap_addr_name() - Get the reg property of a device, indexed by name, * as a memory-mapped I/O pointer * @@ -601,12 +628,26 @@ static inline fdt_addr_t dev_read_addr_index(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, + 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, const char *name) { return devfdt_get_addr_name(dev, name); } +static inline fdt_addr_t dev_read_addr_size_name(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) { return devfdt_get_addr(dev); diff --git a/include/dt-bindings/clock/hi3660-clock.h b/include/dt-bindings/clock/hi3660-clock.h new file mode 100644 index 0000000000..e1374e1809 --- /dev/null +++ b/include/dt-bindings/clock/hi3660-clock.h @@ -0,0 +1,214 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2016-2017 Linaro Ltd. + * Copyright (c) 2016-2017 HiSilicon Technologies Co., Ltd. + */ + +#ifndef __DTS_HI3660_CLOCK_H +#define __DTS_HI3660_CLOCK_H + +/* fixed rate clocks */ +#define HI3660_CLKIN_SYS 0 +#define HI3660_CLKIN_REF 1 +#define HI3660_CLK_FLL_SRC 2 +#define HI3660_CLK_PPLL0 3 +#define HI3660_CLK_PPLL1 4 +#define HI3660_CLK_PPLL2 5 +#define HI3660_CLK_PPLL3 6 +#define HI3660_CLK_SCPLL 7 +#define HI3660_PCLK 8 +#define HI3660_CLK_UART0_DBG 9 +#define HI3660_CLK_UART6 10 +#define HI3660_OSC32K 11 +#define HI3660_OSC19M 12 +#define HI3660_CLK_480M 13 +#define HI3660_CLK_INV 14 + +/* clk in crgctrl */ +#define HI3660_FACTOR_UART3 15 +#define HI3660_CLK_FACTOR_MMC 16 +#define HI3660_CLK_GATE_I2C0 17 +#define HI3660_CLK_GATE_I2C1 18 +#define HI3660_CLK_GATE_I2C2 19 +#define HI3660_CLK_GATE_I2C6 20 +#define HI3660_CLK_DIV_SYSBUS 21 +#define HI3660_CLK_DIV_320M 22 +#define HI3660_CLK_DIV_A53 23 +#define HI3660_CLK_GATE_SPI0 24 +#define HI3660_CLK_GATE_SPI2 25 +#define HI3660_PCIEPHY_REF 26 +#define HI3660_CLK_ABB_USB 27 +#define HI3660_HCLK_GATE_SDIO0 28 +#define HI3660_HCLK_GATE_SD 29 +#define HI3660_CLK_GATE_AOMM 30 +#define HI3660_PCLK_GPIO0 31 +#define HI3660_PCLK_GPIO1 32 +#define HI3660_PCLK_GPIO2 33 +#define HI3660_PCLK_GPIO3 34 +#define HI3660_PCLK_GPIO4 35 +#define HI3660_PCLK_GPIO5 36 +#define HI3660_PCLK_GPIO6 37 +#define HI3660_PCLK_GPIO7 38 +#define HI3660_PCLK_GPIO8 39 +#define HI3660_PCLK_GPIO9 40 +#define HI3660_PCLK_GPIO10 41 +#define HI3660_PCLK_GPIO11 42 +#define HI3660_PCLK_GPIO12 43 +#define HI3660_PCLK_GPIO13 44 +#define HI3660_PCLK_GPIO14 45 +#define HI3660_PCLK_GPIO15 46 +#define HI3660_PCLK_GPIO16 47 +#define HI3660_PCLK_GPIO17 48 +#define HI3660_PCLK_GPIO18 49 +#define HI3660_PCLK_GPIO19 50 +#define HI3660_PCLK_GPIO20 51 +#define HI3660_PCLK_GPIO21 52 +#define HI3660_CLK_GATE_SPI3 53 +#define HI3660_CLK_GATE_I2C7 54 +#define HI3660_CLK_GATE_I2C3 55 +#define HI3660_CLK_GATE_SPI1 56 +#define HI3660_CLK_GATE_UART1 57 +#define HI3660_CLK_GATE_UART2 58 +#define HI3660_CLK_GATE_UART4 59 +#define HI3660_CLK_GATE_UART5 60 +#define HI3660_CLK_GATE_I2C4 61 +#define HI3660_CLK_GATE_DMAC 62 +#define HI3660_PCLK_GATE_DSS 63 +#define HI3660_ACLK_GATE_DSS 64 +#define HI3660_CLK_GATE_LDI1 65 +#define HI3660_CLK_GATE_LDI0 66 +#define HI3660_CLK_GATE_VIVOBUS 67 +#define HI3660_CLK_GATE_EDC0 68 +#define HI3660_CLK_GATE_TXDPHY0_CFG 69 +#define HI3660_CLK_GATE_TXDPHY0_REF 70 +#define HI3660_CLK_GATE_TXDPHY1_CFG 71 +#define HI3660_CLK_GATE_TXDPHY1_REF 72 +#define HI3660_ACLK_GATE_USB3OTG 73 +#define HI3660_CLK_GATE_SPI4 74 +#define HI3660_CLK_GATE_SD 75 +#define HI3660_CLK_GATE_SDIO0 76 +#define HI3660_CLK_GATE_UFS_SUBSYS 77 +#define HI3660_PCLK_GATE_DSI0 78 +#define HI3660_PCLK_GATE_DSI1 79 +#define HI3660_ACLK_GATE_PCIE 80 +#define HI3660_PCLK_GATE_PCIE_SYS 81 +#define HI3660_CLK_GATE_PCIEAUX 82 +#define HI3660_PCLK_GATE_PCIE_PHY 83 +#define HI3660_CLK_ANDGT_LDI0 84 +#define HI3660_CLK_ANDGT_LDI1 85 +#define HI3660_CLK_ANDGT_EDC0 86 +#define HI3660_CLK_GATE_UFSPHY_GT 87 +#define HI3660_CLK_ANDGT_MMC 88 +#define HI3660_CLK_ANDGT_SD 89 +#define HI3660_CLK_A53HPM_ANDGT 90 +#define HI3660_CLK_ANDGT_SDIO 91 +#define HI3660_CLK_ANDGT_UART0 92 +#define HI3660_CLK_ANDGT_UART1 93 +#define HI3660_CLK_ANDGT_UARTH 94 +#define HI3660_CLK_ANDGT_SPI 95 +#define HI3660_CLK_VIVOBUS_ANDGT 96 +#define HI3660_CLK_AOMM_ANDGT 97 +#define HI3660_CLK_320M_PLL_GT 98 +#define HI3660_AUTODIV_EMMC0BUS 99 +#define HI3660_AUTODIV_SYSBUS 100 +#define HI3660_CLK_GATE_UFSPHY_CFG 101 +#define HI3660_CLK_GATE_UFSIO_REF 102 +#define HI3660_CLK_MUX_SYSBUS 103 +#define HI3660_CLK_MUX_UART0 104 +#define HI3660_CLK_MUX_UART1 105 +#define HI3660_CLK_MUX_UARTH 106 +#define HI3660_CLK_MUX_SPI 107 +#define HI3660_CLK_MUX_I2C 108 +#define HI3660_CLK_MUX_MMC_PLL 109 +#define HI3660_CLK_MUX_LDI1 110 +#define HI3660_CLK_MUX_LDI0 111 +#define HI3660_CLK_MUX_SD_PLL 112 +#define HI3660_CLK_MUX_SD_SYS 113 +#define HI3660_CLK_MUX_EDC0 114 +#define HI3660_CLK_MUX_SDIO_SYS 115 +#define HI3660_CLK_MUX_SDIO_PLL 116 +#define HI3660_CLK_MUX_VIVOBUS 117 +#define HI3660_CLK_MUX_A53HPM 118 +#define HI3660_CLK_MUX_320M 119 +#define HI3660_CLK_MUX_IOPERI 120 +#define HI3660_CLK_DIV_UART0 121 +#define HI3660_CLK_DIV_UART1 122 +#define HI3660_CLK_DIV_UARTH 123 +#define HI3660_CLK_DIV_MMC 124 +#define HI3660_CLK_DIV_SD 125 +#define HI3660_CLK_DIV_EDC0 126 +#define HI3660_CLK_DIV_LDI0 127 +#define HI3660_CLK_DIV_SDIO 128 +#define HI3660_CLK_DIV_LDI1 129 +#define HI3660_CLK_DIV_SPI 130 +#define HI3660_CLK_DIV_VIVOBUS 131 +#define HI3660_CLK_DIV_I2C 132 +#define HI3660_CLK_DIV_UFSPHY 133 +#define HI3660_CLK_DIV_CFGBUS 134 +#define HI3660_CLK_DIV_MMC0BUS 135 +#define HI3660_CLK_DIV_MMC1BUS 136 +#define HI3660_CLK_DIV_UFSPERI 137 +#define HI3660_CLK_DIV_AOMM 138 +#define HI3660_CLK_DIV_IOPERI 139 +#define HI3660_VENC_VOLT_HOLD 140 +#define HI3660_PERI_VOLT_HOLD 141 +#define HI3660_CLK_GATE_VENC 142 +#define HI3660_CLK_GATE_VDEC 143 +#define HI3660_CLK_ANDGT_VENC 144 +#define HI3660_CLK_ANDGT_VDEC 145 +#define HI3660_CLK_MUX_VENC 146 +#define HI3660_CLK_MUX_VDEC 147 +#define HI3660_CLK_DIV_VENC 148 +#define HI3660_CLK_DIV_VDEC 149 +#define HI3660_CLK_FAC_ISP_SNCLK 150 +#define HI3660_CLK_GATE_ISP_SNCLK0 151 +#define HI3660_CLK_GATE_ISP_SNCLK1 152 +#define HI3660_CLK_GATE_ISP_SNCLK2 153 +#define HI3660_CLK_ANGT_ISP_SNCLK 154 +#define HI3660_CLK_MUX_ISP_SNCLK 155 +#define HI3660_CLK_DIV_ISP_SNCLK 156 + +/* clk in pmuctrl */ +#define HI3660_GATE_ABB_192 0 + +/* clk in pctrl */ +#define HI3660_GATE_UFS_TCXO_EN 0 +#define HI3660_GATE_USB_TCXO_EN 1 + +/* clk in sctrl */ +#define HI3660_PCLK_AO_GPIO0 0 +#define HI3660_PCLK_AO_GPIO1 1 +#define HI3660_PCLK_AO_GPIO2 2 +#define HI3660_PCLK_AO_GPIO3 3 +#define HI3660_PCLK_AO_GPIO4 4 +#define HI3660_PCLK_AO_GPIO5 5 +#define HI3660_PCLK_AO_GPIO6 6 +#define HI3660_PCLK_GATE_MMBUF 7 +#define HI3660_CLK_GATE_DSS_AXI_MM 8 +#define HI3660_PCLK_MMBUF_ANDGT 9 +#define HI3660_CLK_MMBUF_PLL_ANDGT 10 +#define HI3660_CLK_FLL_MMBUF_ANDGT 11 +#define HI3660_CLK_SYS_MMBUF_ANDGT 12 +#define HI3660_CLK_GATE_PCIEPHY_GT 13 +#define HI3660_ACLK_MUX_MMBUF 14 +#define HI3660_CLK_SW_MMBUF 15 +#define HI3660_CLK_DIV_AOBUS 16 +#define HI3660_PCLK_DIV_MMBUF 17 +#define HI3660_ACLK_DIV_MMBUF 18 +#define HI3660_CLK_DIV_PCIEPHY 19 + +/* clk in iomcu */ +#define HI3660_CLK_I2C0_IOMCU 0 +#define HI3660_CLK_I2C1_IOMCU 1 +#define HI3660_CLK_I2C2_IOMCU 2 +#define HI3660_CLK_I2C6_IOMCU 3 +#define HI3660_CLK_IOMCU_PERI0 4 + +/* clk in stub clock */ +#define HI3660_CLK_STUB_CLUSTER0 0 +#define HI3660_CLK_STUB_CLUSTER1 1 +#define HI3660_CLK_STUB_GPU 2 +#define HI3660_CLK_STUB_DDR 3 +#define HI3660_CLK_STUB_NUM 4 + +#endif /* __DTS_HI3660_CLOCK_H */ diff --git a/include/dt-bindings/phy/phy-am654-serdes.h b/include/dt-bindings/phy/phy-am654-serdes.h new file mode 100644 index 0000000000..e8d901729e --- /dev/null +++ b/include/dt-bindings/phy/phy-am654-serdes.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * This header provides constants for AM654 SERDES. + */ + +#ifndef _DT_BINDINGS_AM654_SERDES +#define _DT_BINDINGS_AM654_SERDES + +#define AM654_SERDES_CMU_REFCLK 0 +#define AM654_SERDES_LO_REFCLK 1 +#define AM654_SERDES_RO_REFCLK 2 + +#endif /* _DT_BINDINGS_AM654_SERDES */ diff --git a/include/env.h b/include/env.h new file mode 100644 index 0000000000..a74a261337 --- /dev/null +++ b/include/env.h @@ -0,0 +1,335 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Common environment functions and definitions + * + * (C) Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + */ + +#ifndef __ENV_H +#define __ENV_H + +#include <stdbool.h> +#include <linux/types.h> + +struct environment_s; + +/* Value for environment validity */ +enum env_valid { + ENV_INVALID, /* No valid environment */ + ENV_VALID, /* First or only environment is valid */ + ENV_REDUND, /* Redundant environment is valid */ +}; + +/** enum env_op - environment callback operation */ +enum env_op { + env_op_create, + env_op_delete, + env_op_overwrite, +}; + +/** struct env_clbk_tbl - declares a new callback */ +struct env_clbk_tbl { + const char *name; /* Callback name */ + int (*callback)(const char *name, const char *value, enum env_op op, + int flags); +}; + +/* + * Define a callback that can be associated with variables. + * when associated through the ".callbacks" environment variable, the callback + * will be executed any time the variable is inserted, overwritten, or deleted. + * + * For SPL these are silently dropped to reduce code size, since environment + * callbacks are not supported with SPL. + */ +#ifdef CONFIG_SPL_BUILD +#define U_BOOT_ENV_CALLBACK(name, callback) \ + static inline __maybe_unused void _u_boot_env_noop_##name(void) \ + { \ + (void)callback; \ + } +#else +#define U_BOOT_ENV_CALLBACK(name, callback) \ + ll_entry_declare(struct env_clbk_tbl, name, env_clbk) = \ + {#name, callback} +#endif + +/** enum env_redund_flags - Flags for the redundand_environment */ +enum env_redund_flags { + ENV_REDUND_OBSOLETE = 0, + ENV_REDUND_ACTIVE = 1, +}; + +/** + * env_get_id() - Gets a sequence number for the environment + * + * This value increments every time the environment changes, so can be used an + * an indication of this + * + * @return environment ID + */ +int env_get_id(void); + +/** + * env_init() - Set up the pre-relocation environment + * + * This locates the environment or uses the default if nothing is available. + * This must be called before env_get() will work. + * + * @return 0 if OK, -ENODEV if no environment drivers are enabled + */ +int env_init(void); + +/** + * env_relocate() - Set up the post-relocation environment + * + * This loads the environment into RAM so that it can be modified. This is + * called after relocation, before the environment is used + */ +void env_relocate(void); + +/** + * env_match() - Match a name / name=value pair + * + * This is used prior to relocation for finding envrionment variables + * + * @name: A simple 'name', or a 'name=value' pair. + * @index: The environment index for a 'name2=value2' pair. + * @return index for the value if the names match, else -1. + */ +int env_match(unsigned char *name, int index); + +/** + * env_get() - Look up the value of an environment variable + * + * In U-Boot proper this can be called before relocation (which is when the + * environment is loaded from storage, i.e. GD_FLG_ENV_READY is 0). In that + * case this function calls env_get_f(). + * + * @varname: Variable to look up + * @return value of variable, or NULL if not found + */ +char *env_get(const char *varname); + +/** + * env_get_f() - Look up the value of an environment variable (early) + * + * This function is called from env_get() if the environment has not been + * loaded yet (GD_FLG_ENV_READY flag is 0). Some environment locations will + * support reading the value (slowly) and some will not. + * + * @varname: Variable to look up + * @return value of variable, or NULL if not found + */ +int env_get_f(const char *name, char *buf, unsigned int len); + +/** + * env_get_yesno() - Read an environment variable as a boolean + * + * @return 1 if yes/true (Y/y/T/t), -1 if variable does not exist (i.e. default + * to true), 0 if otherwise + */ +int env_get_yesno(const char *var); + +/** + * env_set() - set an environment variable + * + * This sets or deletes the value of an environment variable. For setting the + * value the variable is created if it does not already exist. + * + * @varname: Variable to adjust + * @value: Value to set for the variable, or NULL or "" to delete the variable + * @return 0 if OK, 1 on error + */ +int env_set(const char *varname, const char *value); + +/** + * env_get_ulong() - Return an environment variable as an integer value + * + * Most U-Boot environment variables store hex values. For those which store + * (e.g.) base-10 integers, this function can be used to read the value. + * + * @name: Variable to look up + * @base: Base to use (e.g. 10 for base 10, 2 for binary) + * @default_val: Default value to return if no value is found + * @return the value found, or @default_val if none + */ +ulong env_get_ulong(const char *name, int base, ulong default_val); + +/** + * env_set_ulong() - set an environment variable to an integer + * + * @varname: Variable to adjust + * @value: Value to set for the variable (will be converted to a string) + * @return 0 if OK, 1 on error + */ +int env_set_ulong(const char *varname, ulong value); + +/** + * env_get_hex() - Return an environment variable as a hex value + * + * Decode an environment as a hex number (it may or may not have a 0x + * prefix). If the environment variable cannot be found, or does not start + * with hex digits, the default value is returned. + * + * @varname: Variable to decode + * @default_val: Value to return on error + */ +ulong env_get_hex(const char *varname, ulong default_val); + +/** + * env_set_hex() - set an environment variable to a hex value + * + * @varname: Variable to adjust + * @value: Value to set for the variable (will be converted to a hex string) + * @return 0 if OK, 1 on error + */ +int env_set_hex(const char *varname, ulong value); + +/** + * env_set_addr - Set an environment variable to an address in hex + * + * @varname: Environment variable to set + * @addr: Value to set it to + * @return 0 if ok, 1 on error + */ +static inline int env_set_addr(const char *varname, const void *addr) +{ + return env_set_hex(varname, (ulong)addr); +} + +/** + * env_complete() - return an auto-complete for environment variables + * + * @var: partial name to auto-complete + * @maxv: Maximum number of matches to return + * @cmdv: Returns a list of possible matches + * @maxsz: Size of buffer to use for matches + * @buf: Buffer to use for matches + * @dollar_comp: non-zero to wrap each match in ${...} + * @return number of matches found (in @cmdv) + */ +int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf, + bool dollar_comp); + +/** + * eth_env_get_enetaddr() - Get an ethernet address from the environmnet + * + * @name: Environment variable to get (e.g. "ethaddr") + * @enetaddr: Place to put MAC address (6 bytes) + * @return 0 if OK, 1 on error + */ +int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr); + +/** + * eth_env_set_enetaddr() - Set an ethernet address in the environmnet + * + * @name: Environment variable to set (e.g. "ethaddr") + * @enetaddr: Pointer to MAC address to put into the variable (6 bytes) + * @return 0 if OK, 1 on error + */ +int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr); + +/** + * env_fix_drivers() - Updates envdriver as per relocation + */ +void env_fix_drivers(void); + +/** + * env_set_default_vars() - reset variables to their default value + * + * This resets individual variables to their value in the default environment + * + * @nvars: Number of variables to set/reset + * @vars: List of variables to set/reset + * @flags: Flags controlling matching (H_... - see search.h) + */ +int env_set_default_vars(int nvars, char *const vars[], int flags); + +/** + * env_load() - Load the environment from storage + * + * @return 0 if OK, -ve on error + */ +int env_load(void); + +/** + * env_save() - Save the environment to storage + * + * @return 0 if OK, -ve on error + */ +int env_save(void); + +/** + * env_erase() - Erase the environment on storage + * + * @return 0 if OK, -ve on error + */ +int env_erase(void); + +/** + * env_import() - Import from a binary representation into hash table + * + * This imports the environment from a buffer. The format for each variable is + * var=value\0 with a double \0 at the end of the buffer. + * + * @buf: Buffer containing the environment (struct environemnt_s *) + * @check: non-zero to check the CRC at the start of the environment, 0 to + * ignore it + * @return 0 if imported successfully, -ENOMSG if the CRC was bad, -EIO if + * something else went wrong + */ +int env_import(const char *buf, int check); + +/** + * env_export() - Export the environment to a buffer + * + * Export from hash table into binary representation + * + * @env_out: Buffer to contain the environment (must be large enough!) + * @return 0 if OK, 1 on error + */ +int env_export(struct environment_s *env_out); + +/** + * env_import_redund() - Select and import one of two redundant environments + * + * @buf1: First environment (struct environemnt_s *) + * @buf1_read_fail: 0 if buf1 is valid, non-zero if invalid + * @buf2: Second environment (struct environemnt_s *) + * @buf2_read_fail: 0 if buf2 is valid, non-zero if invalid + * @return 0 if OK, -EIO if no environment is valid, -ENOMSG if the CRC was bad + */ +int env_import_redund(const char *buf1, int buf1_read_fail, + const char *buf2, int buf2_read_fail); + +/** + * env_get_default() - Look up a variable from the default environment + * + * @name: Variable to look up + * @return value if found, NULL if not found in default environment + */ +char *env_get_default(const char *name); + +/* [re]set to the default environment */ +void env_set_default(const char *s, int flags); + +/** + * env_get_char() - Get a character from the early environment + * + * This reads from the pre-relocation environment + * + * @index: Index of character to read (0 = first) + * @return character read, or -ve on error + */ +int env_get_char(int index); + +/** + * env_reloc() - Relocate the 'env' sub-commands + * + * This is used for those unfortunate archs with crappy toolchains + */ +void env_reloc(void); + +#endif diff --git a/include/env_callback.h b/include/env_callback.h index 507a52e13c..982c07854d 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -72,29 +72,6 @@ "serial#:serialno," \ CONFIG_ENV_CALLBACK_LIST_STATIC -struct env_clbk_tbl { - const char *name; /* Callback name */ - int (*callback)(const char *name, const char *value, enum env_op op, - int flags); -}; - -void env_callback_init(ENTRY *var_entry); - -/* - * Define a callback that can be associated with variables. - * when associated through the ".callbacks" environment variable, the callback - * will be executed any time the variable is inserted, overwritten, or deleted. - */ -#ifdef CONFIG_SPL_BUILD -#define U_BOOT_ENV_CALLBACK(name, callback) \ - static inline __maybe_unused void _u_boot_env_noop_##name(void) \ - { \ - (void)callback; \ - } -#else -#define U_BOOT_ENV_CALLBACK(name, callback) \ - ll_entry_declare(struct env_clbk_tbl, name, env_clbk) = \ - {#name, callback} -#endif +void env_callback_init(struct env_entry *var_entry); #endif /* __ENV_CALLBACK_H__ */ diff --git a/include/env_default.h b/include/env_default.h index 86b639d3e2..56a8bae39a 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -10,7 +10,7 @@ #include <env_callback.h> #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED -env_t environment __UBOOT_ENV_SECTION__(environment) = { +env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = { ENV_CRC, /* CRC Sum */ #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT 1, /* Flags: valid */ diff --git a/include/env_flags.h b/include/env_flags.h index 23744e395c..e5380f2948 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -146,19 +146,20 @@ int env_flags_validate_env_set_params(char *name, char *const val[], int count); #else /* !USE_HOSTCC */ +#include <env.h> #include <search.h> /* * When adding a variable to the environment, initialize the flags for that * variable. */ -void env_flags_init(ENTRY *var_entry); +void env_flags_init(struct env_entry *var_entry); /* * Validate the newval for to conform with the requirements defined by its flags */ -int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op, - int flag); +int env_flags_validate(const struct env_entry *item, const char *newval, + enum env_op op, int flag); #endif /* USE_HOSTCC */ diff --git a/include/environment.h b/include/env_internal.h index de67cf4f0e..b1ddcb5adf 100644 --- a/include/environment.h +++ b/include/env_internal.h @@ -1,11 +1,19 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* + * Internal environment header file. This includes direct access to environment + * information such as its size and offset, direct access to the default + * environment and embedded environment (if used). It also provides environment + * drivers with various declarations. + * + * It should not be included by board files, drivers and code other than that + * related to the environment implementation. + * * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ -#ifndef _ENVIRONMENT_H_ -#define _ENVIRONMENT_H_ +#ifndef _ENV_INTERNAL_H_ +#define _ENV_INTERNAL_H_ #include <linux/kconfig.h> @@ -135,33 +143,40 @@ extern unsigned long nand_env_oob_offset; #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT # define ENV_HEADER_SIZE (sizeof(uint32_t) + 1) - -# define ACTIVE_FLAG 1 -# define OBSOLETE_FLAG 0 #else # define ENV_HEADER_SIZE (sizeof(uint32_t)) #endif #define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE) +/* + * If the environment is in RAM, allocate extra space for it in the malloc + * region. + */ +#if defined(CONFIG_ENV_IS_EMBEDDED) +#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN +#elif (CONFIG_ENV_ADDR + CONFIG_ENV_SIZE < CONFIG_SYS_MONITOR_BASE) || \ + (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) || \ + defined(CONFIG_ENV_IS_IN_NVRAM) +#define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE) +#else +#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN +#endif + typedef struct environment_s { uint32_t crc; /* CRC32 over data bytes */ #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT - unsigned char flags; /* active/obsolete flags */ + unsigned char flags; /* active/obsolete flags ENVF_REDUND_ */ #endif unsigned char data[ENV_SIZE]; /* Environment data */ } env_t; #ifdef ENV_IS_EMBEDDED -extern env_t environment; +extern env_t embedded_environment; #endif /* ENV_IS_EMBEDDED */ extern const unsigned char default_environment[]; -#if defined(CONFIG_NEEDS_MANUAL_RELOC) -extern void env_reloc(void); -#endif - #ifndef DO_DEPS_ONLY #include <env_attr.h> @@ -169,13 +184,6 @@ extern void env_reloc(void); #include <env_flags.h> #include <search.h> -/* Value for environment validity */ -enum env_valid { - ENV_INVALID, /* No valid environment */ - ENV_VALID, /* First or only environment is valid */ - ENV_REDUND, /* Redundant environment is valid */ -}; - enum env_location { ENVL_UNKNOWN, ENVL_EEPROM, @@ -265,70 +273,6 @@ struct env_driver { extern struct hsearch_data env_htab; -/* Function that updates CRC of the enironment */ -void env_crc_update(void); - -/* Look up the variable from the default environment */ -char *env_get_default(const char *name); - -/* [re]set to the default environment */ -void set_default_env(const char *s, int flags); - -/* [re]set individual variables to their value in the default environment */ -int set_default_vars(int nvars, char * const vars[], int flags); - -/* Import from binary representation into hash table */ -int env_import(const char *buf, int check); - -/* Export from hash table into binary representation */ -int env_export(env_t *env_out); - -#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT -/* Select and import one of two redundant environments */ -int env_import_redund(const char *buf1, int buf1_status, - const char *buf2, int buf2_status); -#endif - -/** - * env_get_char() - Get a character from the early environment - * - * This reads from the pre-relocation environment - * - * @index: Index of character to read (0 = first) - * @return character read, or -ve on error - */ -int env_get_char(int index); - -/** - * env_load() - Load the environment from storage - * - * @return 0 if OK, -ve on error - */ -int env_load(void); - -/** - * env_save() - Save the environment to storage - * - * @return 0 if OK, -ve on error - */ -int env_save(void); - -/** - * env_erase() - Erase the environment on storage - * - * @return 0 if OK, -ve on error - */ -int env_erase(void); - -/** - * env_fix_drivers() - Updates envdriver as per relocation - */ -void env_fix_drivers(void); - -void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr); -int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr); -int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr); - #endif /* DO_DEPS_ONLY */ -#endif /* _ENVIRONMENT_H_ */ +#endif /* _ENV_INTERNAL_H_ */ diff --git a/include/exports.h b/include/exports.h index bf8d53c6b0..147a00f860 100644 --- a/include/exports.h +++ b/include/exports.h @@ -3,6 +3,7 @@ #ifndef __ASSEMBLY__ #ifdef CONFIG_PHY_AQUANTIA +#include <env.h> #include <phy_interface.h> #endif diff --git a/include/gzip.h b/include/gzip.h new file mode 100644 index 0000000000..2e340673c3 --- /dev/null +++ b/include/gzip.h @@ -0,0 +1,103 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + */ + +#ifndef __GZIP_H +#define __GZIP_H + +/** + * gzip_parse_header() - Parse a header from a gzip file + * + * This returns the length of the header. + * + * @src: Pointer to gzip file + * @len: Length of data + * @return length of header in bytes, or -1 if not enough data + */ +int gzip_parse_header(const unsigned char *src, unsigned long len); + +/** + * gunzip() - Decompress gzipped data + * + * @dst: Destination for uncompressed data + * @dstlen: Size of destination buffer + * @src: Source data to decompress + * @lenp: Returns length of uncompressed data + * @return 0 if OK, -1 on error + */ +int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp); + +/** + * zunzip() - Uncompress blocks compressed with zlib without headers + * + * @dst: Destination for uncompressed data + * @dstlen: Size of destination buffer + * @src: Source data to decompress + * @lenp: On entry, length data at @src. On exit, number of bytes used from @src + * @stoponerr: 0 to continue when a decode error is found, 1 to stop + * @offset: start offset within the src buffer + * @return 0 if OK, -1 on error + */ +int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, + int stoponerr, int offset); + +/** + * gzwrite progress indicators: defined weak to allow board-specific + * overrides: + * + * gzwrite_progress_init called on startup + * gzwrite_progress called during decompress/write loop + * gzwrite_progress_finish called at end of loop to + * indicate success (retcode=0) or failure + */ +void gzwrite_progress_init(u64 expected_size); + +void gzwrite_progress(int iteration, u64 bytes_written, u64 total_bytes); + +void gzwrite_progress_finish(int retcode, u64 totalwritten, u64 totalsize, + u32 expected_crc, u32 calculated_crc); + +/** + * gzwrite() - decompress and write gzipped image from memory to block device + * + * @src: compressed image address + * @len: compressed image length in bytes + * @dev: block device descriptor + * @szwritebuf: bytes per write (pad to erase size) + * @startoffs: offset in bytes of first write + * @szexpected: expected uncompressed length, may be zero to use gzip trailer + * for files under 4GiB + * @return 0 if OK, -1 on error + */ +int gzwrite(unsigned char *src, int len, struct blk_desc *dev, ulong szwritebuf, + u64 startoffs, u64 szexpected); + +/** + * gzip()- Compress data into a buffer using the gzip algorithm + * + * @dst: Destination buffer for compressed data + * @lenp: On entry, space available in destination buffer (in bytes). On exit, + * number of bytes used in the buffer + * @src: Source data to compress + * @srclen: Size of source data + * @return 0 if OK, -1 on error + */ +int gzip(void *dst, unsigned long *lenp, unsigned char *src, ulong srclen); + +/** + * zzip() - Compress blocks with zlib + * + * @dst: Destination for compressed data + * @lenp: On entry, length data at @dst. On exit, number of bytes written to + * @dst + * @src: Source data to compress + * @srclen: Size of source data + * @stoponerr: 0 to continue when a decode error is found, 1 to stop + * @func: Some sort of function that is called to do something. !ADD DOCS HERE! + */ +int zzip(void *dst, ulong *lenp, unsigned char *src, ulong srclen, + int stoponerr, int (*func)(ulong, ulong)); + +#endif diff --git a/include/lcd.h b/include/lcd.h index cb6b6a4d12..9a4c0da5ba 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -30,6 +30,7 @@ extern struct vidinfo panel_info; void lcd_ctrl_init(void *lcdbase); void lcd_enable(void); void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue); +ulong lcd_setmem(ulong addr); /** * Set whether we need to flush the dcache when changing the LCD image. This diff --git a/include/net.h b/include/net.h index 7684076af6..a54d5eeac5 100644 --- a/include/net.h +++ b/include/net.h @@ -14,6 +14,7 @@ #include <asm/cache.h> #include <asm/byteorder.h> /* for nton* / ntoh* stuff */ +#include <env.h> #include <linux/if_ether.h> #define DEBUG_LL_STATE 0 /* Link local state machine changes */ @@ -874,4 +875,15 @@ int update_tftp(ulong addr, char *interface, char *devstring); /**********************************************************************/ +/** + * eth_parse_enetaddr() - Parse a MAC address + * + * Convert a string MAC address + * + * @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit + * hex value + * @enetaddr: Place to put MAC address (6 bytes) + */ +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr); + #endif /* __NET_H__ */ diff --git a/include/pcmcia.h b/include/pcmcia.h deleted file mode 100644 index 89e528efb9..0000000000 --- a/include/pcmcia.h +++ /dev/null @@ -1,137 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - */ - -#ifndef _PCMCIA_H -#define _PCMCIA_H - -#include <common.h> -#include <config.h> - -/* - * Allow configuration to select PCMCIA slot, - * or try to generate a useful default - */ -#if defined(CONFIG_CMD_PCMCIA) - -#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) -# error "PCMCIA Slot not configured" -#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ - -/* Make sure exactly one slot is defined - we support only one for now */ -#if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) -#error Neither CONFIG_PCMCIA_SLOT_A nor CONFIG_PCMCIA_SLOT_B configured -#endif -#if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B) -#error Both CONFIG_PCMCIA_SLOT_A and CONFIG_PCMCIA_SLOT_B configured -#endif - -#ifndef PCMCIA_SOCKETS_NO -#define PCMCIA_SOCKETS_NO 1 -#endif -#ifndef PCMCIA_MEM_WIN_NO -#define PCMCIA_MEM_WIN_NO 4 -#endif -#define PCMCIA_IO_WIN_NO 2 - -/* define _slot_ to be able to optimize macros */ -#ifdef CONFIG_PCMCIA_SLOT_A -# define _slot_ 0 -# define PCMCIA_SLOT_MSG "slot A" -# define PCMCIA_SLOT_x PCMCIA_PSLOT_A -#else -# define _slot_ 1 -# define PCMCIA_SLOT_MSG "slot B" -# define PCMCIA_SLOT_x PCMCIA_PSLOT_B -#endif - -/* - * This structure is used to address each window in the PCMCIA controller. - * - * Keep in mind that we assume that pcmcia_win_t[n+1] is mapped directly - * after pcmcia_win_t[n]... - */ - -typedef struct { - ulong br; - ulong or; -} pcmcia_win_t; - -/**********************************************************************/ - -/* - * CIS Tupel codes - */ -#define CISTPL_NULL 0x00 -#define CISTPL_DEVICE 0x01 -#define CISTPL_LONGLINK_CB 0x02 -#define CISTPL_INDIRECT 0x03 -#define CISTPL_CONFIG_CB 0x04 -#define CISTPL_CFTABLE_ENTRY_CB 0x05 -#define CISTPL_LONGLINK_MFC 0x06 -#define CISTPL_BAR 0x07 -#define CISTPL_PWR_MGMNT 0x08 -#define CISTPL_EXTDEVICE 0x09 -#define CISTPL_CHECKSUM 0x10 -#define CISTPL_LONGLINK_A 0x11 -#define CISTPL_LONGLINK_C 0x12 -#define CISTPL_LINKTARGET 0x13 -#define CISTPL_NO_LINK 0x14 -#define CISTPL_VERS_1 0x15 -#define CISTPL_ALTSTR 0x16 -#define CISTPL_DEVICE_A 0x17 -#define CISTPL_JEDEC_C 0x18 -#define CISTPL_JEDEC_A 0x19 -#define CISTPL_CONFIG 0x1a -#define CISTPL_CFTABLE_ENTRY 0x1b -#define CISTPL_DEVICE_OC 0x1c -#define CISTPL_DEVICE_OA 0x1d -#define CISTPL_DEVICE_GEO 0x1e -#define CISTPL_DEVICE_GEO_A 0x1f -#define CISTPL_MANFID 0x20 -#define CISTPL_FUNCID 0x21 -#define CISTPL_FUNCE 0x22 -#define CISTPL_SWIL 0x23 -#define CISTPL_END 0xff - -/* - * CIS Function ID codes - */ -#define CISTPL_FUNCID_MULTI 0x00 -#define CISTPL_FUNCID_MEMORY 0x01 -#define CISTPL_FUNCID_SERIAL 0x02 -#define CISTPL_FUNCID_PARALLEL 0x03 -#define CISTPL_FUNCID_FIXED 0x04 -#define CISTPL_FUNCID_VIDEO 0x05 -#define CISTPL_FUNCID_NETWORK 0x06 -#define CISTPL_FUNCID_AIMS 0x07 -#define CISTPL_FUNCID_SCSI 0x08 - -/* - * Fixed Disk FUNCE codes - */ -#define CISTPL_IDE_INTERFACE 0x01 - -#define CISTPL_FUNCE_IDE_IFACE 0x01 -#define CISTPL_FUNCE_IDE_MASTER 0x02 -#define CISTPL_FUNCE_IDE_SLAVE 0x03 - -/* First feature byte */ -#define CISTPL_IDE_SILICON 0x04 -#define CISTPL_IDE_UNIQUE 0x08 -#define CISTPL_IDE_DUAL 0x10 - -/* Second feature byte */ -#define CISTPL_IDE_HAS_SLEEP 0x01 -#define CISTPL_IDE_HAS_STANDBY 0x02 -#define CISTPL_IDE_HAS_IDLE 0x04 -#define CISTPL_IDE_LOW_POWER 0x08 -#define CISTPL_IDE_REG_INHIBIT 0x10 -#define CISTPL_IDE_HAS_INDEX 0x20 -#define CISTPL_IDE_IOIS16 0x40 - -#endif - -#endif /* _PCMCIA_H */ diff --git a/include/pcmcia/yenta.h b/include/pcmcia/yenta.h deleted file mode 100644 index 5cd58a7da3..0000000000 --- a/include/pcmcia/yenta.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * yenta.h 1.20 2001/08/24 12:15:34 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * The initial developer of the original code is David A. Hinds - * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use - * your version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ - -#ifndef _LINUX_YENTA_H -#define _LINUX_YENTA_H - -/* PCI Configuration Registers */ - -#define PCI_STATUS_CAPLIST 0x10 -#define PCI_CB_CAPABILITY_POINTER 0x14 /* 8 bit */ -#define PCI_CAPABILITY_ID 0x00 /* 8 bit */ -#define PCI_CAPABILITY_PM 0x01 -#define PCI_NEXT_CAPABILITY 0x01 /* 8 bit */ -#define PCI_PM_CAPABILITIES 0x02 /* 16 bit */ -#define PCI_PMCAP_PME_D3COLD 0x8000 -#define PCI_PMCAP_PME_D3HOT 0x4000 -#define PCI_PMCAP_PME_D2 0x2000 -#define PCI_PMCAP_PME_D1 0x1000 -#define PCI_PMCAP_PME_D0 0x0800 -#define PCI_PMCAP_D2_CAP 0x0400 -#define PCI_PMCAP_D1_CAP 0x0200 -#define PCI_PMCAP_DYN_DATA 0x0100 -#define PCI_PMCAP_DSI 0x0020 -#define PCI_PMCAP_AUX_PWR 0x0010 -#define PCI_PMCAP_PMECLK 0x0008 -#define PCI_PMCAP_VERSION_MASK 0x0007 -#define PCI_PM_CONTROL_STATUS 0x04 /* 16 bit */ -#define PCI_PMCS_PME_STATUS 0x8000 -#define PCI_PMCS_DATASCALE_MASK 0x6000 -#define PCI_PMCS_DATASCALE_SHIFT 13 -#define PCI_PMCS_DATASEL_MASK 0x1e00 -#define PCI_PMCS_DATASEL_SHIFT 9 -#define PCI_PMCS_PME_ENABLE 0x0100 -#define PCI_PMCS_PWR_STATE_MASK 0x0003 -#define PCI_PMCS_PWR_STATE_D0 0x0000 -#define PCI_PMCS_PWR_STATE_D1 0x0001 -#define PCI_PMCS_PWR_STATE_D2 0x0002 -#define PCI_PMCS_PWR_STATE_D3 0x0003 -#define PCI_PM_BRIDGE_EXT 0x06 /* 8 bit */ -#define PCI_PM_DATA 0x07 /* 8 bit */ - -#define CB_PRIMARY_BUS 0x18 /* 8 bit */ -#define CB_CARDBUS_BUS 0x19 /* 8 bit */ -#define CB_SUBORD_BUS 0x1a /* 8 bit */ -#define CB_LATENCY_TIMER 0x1b /* 8 bit */ - -#define CB_MEM_BASE(m) (0x1c + 8*(m)) -#define CB_MEM_LIMIT(m) (0x20 + 8*(m)) -#define CB_IO_BASE(m) (0x2c + 8*(m)) -#define CB_IO_LIMIT(m) (0x30 + 8*(m)) - -#define CB_BRIDGE_CONTROL 0x3e /* 16 bit */ -#define CB_BCR_PARITY_ENA 0x0001 -#define CB_BCR_SERR_ENA 0x0002 -#define CB_BCR_ISA_ENA 0x0004 -#define CB_BCR_VGA_ENA 0x0008 -#define CB_BCR_MABORT 0x0020 -#define CB_BCR_CB_RESET 0x0040 -#define CB_BCR_ISA_IRQ 0x0080 -#define CB_BCR_PREFETCH(m) (0x0100 << (m)) -#define CB_BCR_WRITE_POST 0x0400 - -#define CB_LEGACY_MODE_BASE 0x44 - -/* Memory mapped registers */ - -#define CB_SOCKET_EVENT 0x0000 -#define CB_SE_CSTSCHG 0x00000001 -#define CB_SE_CCD 0x00000006 -#define CB_SE_CCD1 0x00000002 -#define CB_SE_CCD2 0x00000004 -#define CB_SE_PWRCYCLE 0x00000008 - -#define CB_SOCKET_MASK 0x0004 -#define CB_SM_CSTSCHG 0x00000001 -#define CB_SM_CCD 0x00000006 -#define CB_SM_PWRCYCLE 0x00000008 - -#define CB_SOCKET_STATE 0x0008 -#define CB_SS_CSTSCHG 0x00000001 -#define CB_SS_CCD 0x00000006 -#define CB_SS_CCD1 0x00000002 -#define CB_SS_CCD2 0x00000004 -#define CB_SS_PWRCYCLE 0x00000008 -#define CB_SS_16BIT 0x00000010 -#define CB_SS_32BIT 0x00000020 -#define CB_SS_CINT 0x00000040 -#define CB_SS_BADCARD 0x00000080 -#define CB_SS_DATALOST 0x00000100 -#define CB_SS_BADVCC 0x00000200 -#define CB_SS_5VCARD 0x00000400 -#define CB_SS_3VCARD 0x00000800 -#define CB_SS_XVCARD 0x00001000 -#define CB_SS_YVCARD 0x00002000 -#define CB_SS_VSENSE 0x00003c86 -#define CB_SS_5VSOCKET 0x10000000 -#define CB_SS_3VSOCKET 0x20000000 -#define CB_SS_XVSOCKET 0x40000000 -#define CB_SS_YVSOCKET 0x80000000 - -#define CB_SOCKET_FORCE 0x000c -#define CB_SF_CVSTEST 0x00004000 - -#define CB_SOCKET_CONTROL 0x0010 -#define CB_SC_VPP_MASK 0x00000007 -#define CB_SC_VPP_OFF 0x00000000 -#define CB_SC_VPP_12V 0x00000001 -#define CB_SC_VPP_5V 0x00000002 -#define CB_SC_VPP_3V 0x00000003 -#define CB_SC_VPP_XV 0x00000004 -#define CB_SC_VPP_YV 0x00000005 -#define CB_SC_VCC_MASK 0x00000070 -#define CB_SC_VCC_OFF 0x00000000 -#define CB_SC_VCC_5V 0x00000020 -#define CB_SC_VCC_3V 0x00000030 -#define CB_SC_VCC_XV 0x00000040 -#define CB_SC_VCC_YV 0x00000050 -#define CB_SC_CCLK_STOP 0x00000080 - -#define CB_SOCKET_POWER 0x0020 -#define CB_SP_CLK_CTRL 0x00000001 -#define CB_SP_CLK_CTRL_ENA 0x00010000 -#define CB_SP_CLK_MODE 0x01000000 -#define CB_SP_ACCESS 0x02000000 - -/* Address bits 31..24 for memory windows for 16-bit cards, - accessable only by memory mapping the 16-bit register set */ -#define CB_MEM_PAGE(map) (0x40 + (map)) - -#endif /* _LINUX_YENTA_H */ diff --git a/include/search.h b/include/search.h index 5d07b49073..0469a852e0 100644 --- a/include/search.h +++ b/include/search.h @@ -14,32 +14,25 @@ #ifndef _SEARCH_H_ #define _SEARCH_H_ +#include <env.h> #include <stddef.h> -#define __set_errno(val) do { errno = val; } while (0) +#define set_errno(val) do { errno = val; } while (0) -enum env_op { - env_op_create, - env_op_delete, - env_op_overwrite, +/* enum env_action: action which shall be performed in the call to hsearch */ +enum env_action { + ENV_FIND, + ENV_ENTER, }; -/* Action which shall be performed in the call to hsearch. */ -typedef enum { - FIND, - ENTER -} ACTION; - -typedef struct entry { +/** struct env_entry - An entry in the environment hashtable */ +struct env_entry { const char *key; char *data; int (*callback)(const char *name, const char *value, enum env_op op, int flags); int flags; -} ENTRY; - -/* Opaque type for internal use. */ -struct _ENTRY; +}; /* * Family of hash table handling functions. The functions also @@ -49,61 +42,59 @@ struct _ENTRY; /* Data type for reentrant functions. */ struct hsearch_data { - struct _ENTRY *table; + struct env_entry_node *table; unsigned int size; unsigned int filled; /* * Callback function which will check whether the given change for variable - * "__item" to "newval" may be applied or not, and possibly apply such change. + * "item" to "newval" may be applied or not, and possibly apply such change. * When (flag & H_FORCE) is set, it shall not print out any error message and * shall force overwriting of write-once variables. * Must return 0 for approval, 1 for denial. */ - int (*change_ok)(const ENTRY *__item, const char *newval, enum env_op, - int flag); + int (*change_ok)(const struct env_entry *item, const char *newval, + enum env_op, int flag); }; -/* Create a new hash table which will contain at most "__nel" elements. */ -extern int hcreate_r(size_t __nel, struct hsearch_data *__htab); +/* Create a new hash table which will contain at most "nel" elements. */ +int hcreate_r(size_t nel, struct hsearch_data *htab); /* Destroy current internal hash table. */ -extern void hdestroy_r(struct hsearch_data *__htab); +void hdestroy_r(struct hsearch_data *htab); /* - * Search for entry matching __item.key in internal hash table. If - * ACTION is `FIND' return found entry or signal error by returning - * NULL. If ACTION is `ENTER' replace existing data (if any) with - * __item.data. + * Search for entry matching item.key in internal hash table. If + * action is `ENV_FIND' return found entry or signal error by returning + * NULL. If action is `ENV_ENTER' replace existing data (if any) with + * item.data. * */ -extern int hsearch_r(ENTRY __item, ACTION __action, ENTRY ** __retval, - struct hsearch_data *__htab, int __flag); +int hsearch_r(struct env_entry item, enum env_action action, + struct env_entry **retval, struct hsearch_data *htab, int flag); /* - * Search for an entry matching "__match". Otherwise, Same semantics + * Search for an entry matching "match". Otherwise, Same semantics * as hsearch_r(). */ -extern int hmatch_r(const char *__match, int __last_idx, ENTRY ** __retval, - struct hsearch_data *__htab); +int hmatch_r(const char *match, int last_idx, struct env_entry **retval, + struct hsearch_data *htab); -/* Search and delete entry matching "__key" in internal hash table. */ -extern int hdelete_r(const char *__key, struct hsearch_data *__htab, - int __flag); +/* Search and delete entry matching "key" in internal hash table. */ +int hdelete_r(const char *key, struct hsearch_data *htab, int flag); -extern ssize_t hexport_r(struct hsearch_data *__htab, - const char __sep, int __flag, char **__resp, size_t __size, - int argc, char * const argv[]); +ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag, + char **resp, size_t size, int argc, char * const argv[]); /* * nvars: length of vars array * vars: array of strings (variable names) to import (nvars == 0 means all) */ -extern int himport_r(struct hsearch_data *__htab, - const char *__env, size_t __size, const char __sep, - int __flag, int __crlf_is_lf, int nvars, - char * const vars[]); +int himport_r(struct hsearch_data *htab, const char *env, size_t size, + const char sep, int flag, int crlf_is_lf, int nvars, + char * const vars[]); /* Walk the whole table calling the callback on each element */ -extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *)); +int hwalk_r(struct hsearch_data *htab, + int (*callback)(struct env_entry *entry)); /* Flags for himport_r(), hexport_r(), hdelete_r(), and hsearch_r() */ #define H_NOCLEAR (1 << 0) /* do not clear hash table before importing */ diff --git a/include/watchdog.h b/include/watchdog.h index 3a357de903..a4a4e8e614 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -77,7 +77,7 @@ int init_func_watchdog_reset(void); * Prototypes from $(CPU)/cpu.c. */ -#if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__) +#if (defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)) && !defined(__ASSEMBLY__) void hw_watchdog_init(void); #endif |