summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeLines
* common: nvedit: use snprintf instead of sprintfPeng Fan2016-01-04-1/+1
| | | | | | | | | | | | | | | | Use snprintf to replace sprintf. Coverity log: " Unbounded source buffer (STRING_SIZE) string_size: Passing string init_val of unknown size to sprintf. " Reported-by: Coverity Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* common: env: initialize scalar variablePeng Fan2016-01-04-0/+2
| | | | | | | | | | | | | | | | Before calling hsearch_r, initialize callback entry to NULL. Coverity log: " Uninitialized scalar variable (UNINIT) uninit_use_in_call: Using uninitialized value e. Field e.callback is uninitialized when calling hsearch_r. " Reported-by: Coverity Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org>
* common: cli: avoid memory leakPeng Fan2016-01-04-1/+1
| | | | | | | | | | Whether CONFIG_SYS_HUSH_PARSER is defined or not, should always check to free 'buff' to avoid memory leak. Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Tom Rini <trini@konsulko.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Simon Glass <sjg@chromium.org>
* usb: Move determination of TT hub address/port into separate functionStefan Brüns2015-12-31-0/+56
| | | | | | | | | | | | | Start split and complete split tokens need the hub address and the downstream port of the first HS hub (device view). The core of the function was duplicated in both host/ehci_hcd and musb-new/usb-compat.h. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com>
* usb: Alloc buffer for USB descriptor dynamicallyStefan Brüns2015-12-31-14/+28
| | | | | | | | | The configuration descriptor includes all interface, endpoint and auxiliary descriptors (e.g. report, union) so 512 bytes may not be enough. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini2015-12-17-0/+3
|\
| * usb: kbd: don't use int xfers when polling via ctrl xfersStephen Warren2015-12-17-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP is enabled, use a GET_REPORT control transfer to retrieve the initial state of the keyboard. This matches the technique used to poll the keyboard state. This is useful since it eliminates the remaining use of interrupt transfers from the USB keyboard driver, which allows it to work with USB HCD that don't support interrupt transfers. Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
* | Merge git://git.denx.de/u-boot-rockchipTom Rini2015-12-16-1/+1
|\ \ | |/ |/|
| * spl: use panic_str instead of panicSjoerd Simons2015-12-13-1/+1
| | | | | | | | | | | | | | | | For a simple static string, use panic_str() which prevents calling printf needlessly. Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Reviewed-by: Simon Glass <sjg@chromium.org>
* | eeprom: fix eeprom write procedureAlexey Brodkin2015-12-16-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes commit 1a37889b0ad084a740b4f785031d7ae9955d947b: ----------------------->8-------------------- eeprom: Pull out the RW loop Unify the code for doing read/write into single function, since the code for both the read and write is almost identical. This again trims down the code duplication. ----------------------->8-------------------- where the same one routine is utilized for both EEPROM writing and reading. The only difference was supposed to be a "read" flag which in both cases was set with 1 somehow. That lead to a missing delay in case of writing which lead to write failure (in my case no data was written). Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Acked-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de>
* | Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriqTom Rini2015-12-14-11/+33
|\ \
| * | armv8/ls1043ardb: add SECURE BOOT target for NORAneesh Bansal2015-12-15-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LS1043ARDB Secure Boot Target from NOR has been added. - Configs defined to enable esbc_validate. - ESBC Address in header is made 64 bit. - SMMU is re-configured in Bypass mode. Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
| * | common: Rewrite hiding the end of memoryYork Sun2015-12-15-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves some memory from the end of ram, tracked by gd->ram_size. It is not always the top of u-boot visible memory. Rewrite the macro with a weak function to provide flexibility for complex calcuation. Legacy use of this macro is still supported. Signed-off-by: York Sun <yorksun@freescale.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * | Reserve secure memoryYork Sun2015-12-15-0/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Secure memory is at the end of memory, separated and reserved from OS, tracked by gd->secure_ram. Secure memory can host MMU tables, security monitor, etc. This is different from PRAM used to reserve private memory. PRAM offers memory at the top of u-boot memory, not necessarily the real end of memory for systems with very large DDR. Using the end of memory simplifies MMU setup and avoid memory fragmentation. "bdinfo" command shows gd->secure_ram value if this memory is marked as secured. Signed-off-by: York Sun <yorksun@freescale.com>
* | spl: mmc: use block device number, not hard-coded 0Eric Nelson2015-12-14-3/+5
| | | | | | | | | | | | | | | | | | | | | | In order to support boot from multiple devices through board_boot_order, it's necessary to use the block number of a device. The use of a hard-coded 0 for the device number also creates a need to re-order block devices for use in SPL like this: http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx6slevk/mx6slevk.c;hb=HEAD#l195 Signed-off-by: Eric Nelson <eric@nelint.com>
* | part: fix "part list ... -bootable varname" to use hexStephen Warren2015-12-13-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately U-Boot assumes that almost all numbers are in hex, including partition numbers passed to e.g. "load". So, the command "part list mmc 0 -bootable devplist" should use hex when writing partition numbers into $devplist, so they'll be correctly interpreted. Change-Id: I9a70b19749643876baadb45efbc3decaef8bfee2 Fixes: 0798d6fd4191 ("part: Add support for list filtering on bootable partitions") Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
* | common: cli_hush: Fix up simple typoNishanth Menon2015-12-12-2/+2
| | | | | | | | | | | | | | Correct the spelling for character.. Signed-off-by: Nishanth Menon <nm@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | VxWorks: fixup MAC address for VxWorksMiao Yan2015-12-12-0/+2
|/ | | | | | | | | | | | VxWorks 7 kernels retrieve 'local-mac-addr' from dtb and use that for NIC MAC address. As a result, when booting the same kernel image on multiple boards, there will be address conflicts. So fixup MAC address when booting VxWorks 7 kernels Signed-off-by: Miao Yan <yanmiaobest@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* common: Remove timer_init() call for x86Bin Meng2015-12-09-1/+1
| | | | | | | | With driver model timer support, there should not be an explict call to timer_init(). Remove this call for x86. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* fdt: Change OF_BAD_ADDR to FDT_ADDR_T_NONEBin Meng2015-12-09-1/+2
| | | | | | | | | | | | Currently OF_BAD_ADDR is always -1ULL. When using OF_BAD_ADDR as the return value of dev_get_addr(), it creates potential size mismatch as dev_get_addr() uses FDT_ADDR_T_NONE as the return value which can be either -1U or -1ULL depending on CONFIG_PHYS_64BIT. Now we change OF_BAD_ADDR to FDT_ADDR_T_NONE to avoid such case. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
* CONFIG_NEEDS_MANUAL_RELOC: Fix warnings when not setTom Rini2015-12-07-0/+1
| | | | | | | | | Now that we may compile (but not link) code calling fixup_cmdtable when this is not set, we need to always have the declaration available. We should also make sure that anyone calling the function includes <command.h> as that's where the function declaration is. Signed-off-by: Tom Rini <trini@konsulko.com>
* i2c: cmd: Relocate subcommands when MANUAL_RELOCMichal Simek2015-12-07-4/+12
| | | | | | | | | Subcommands contain pointers to functions which are not updated when MANUAL_RELOC is enabled. This patch fix it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* common: board: Dont relocate FDT incase of CONFIG_OF_EMBEDSiva Durga Prasad Paladugu2015-12-05-0/+12
| | | | | | | | | | | | | | | | Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Update fdt_blob after relocation as the fdt will be copied during u-boot relocation. Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86) Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2) Acked-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Simon Glass <sjg@chromium.org>
* spl: mmc: Unify non/driver model spl_mmc_find_device()Simon Glass2015-12-05-32/+9
| | | | | | | | | | | | | | | | | | | It is risky to have two different functions with much the same code. Future authors may update one but not the other. It is hard to see which parts are the same and which are different. Unify the functions and drop the differences that are not really needed. Note that one puts() becomes printf() as Tom mentioned that this does not affect image size: https://patchwork.ozlabs.org/patch/537276/ Note: It would be better to have an empty printf() and avoid the #ifdef for CONFIG_SPL_LIBCOMMON_SUPPORT. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Michal Simek <michal.simek@xilinx.com>
* spl: mmc: Rename 'mmc' variable to 'mmcp'Simon Glass2015-12-05-7/+7
| | | | | | | | | The 'p' suffix makes it more obvious that we are dealing with a pointer to a (pointer) value that will be returned to its caller. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Nikita Kiryanov <nikita@compulab.co.il> Tested-by: Michal Simek <michal.simek@xilinx.com>
* spl: mmc: Fix compiler warning with CONFIG_DM_MMCSimon Glass2015-12-05-1/+1
| | | | | | | | | | | | | | | | Since commit 4188ba3 we get the following warning on rockchip boards: common/spl/spl_mmc.c:31:24: warning: ‘mmc’ may be used uninitialized in this function [-Wmaybe-uninitialized] count = mmc->block_dev.block_read(0, sector, 1, header); ^ common/spl/spl_mmc.c:251:14: note: ‘mmc’ was declared here struct mmc *mmc; Correct this by move the variable init earlier. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Nikita Kiryanov <nikita@compulab.co.il>
* common: cli_hush: avoid memory leakPeng Fan2015-12-05-2/+7
| | | | | | | | | Need to free memory avoid memory leak, when error. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
* common/Makefile: Compile fdt_support is enabled in SPLStefan Roese2015-12-05-0/+1
| | | | | | | | | | When CONFIG_SPL_OF_TRANSLATE is enabled fdt_support.c needs to get compiled. Otherwise fdt_translate_address() is missing which is needed in dev_get_addr(). Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* common: miiphyutil: avoid memory leakPeng Fan2015-12-05-0/+2
| | | | | | | | | | | | | | | | | | The following code will alloc memory for new_dev and ldev: " new_dev = mdio_alloc(); ldev = malloc(sizeof(*ldev)); " Either new_dev or ldev is NULL, directly return, but this may leak memory. So before return, using free(ldev) and mdio_free(new_dev) to avoid leaking memory, also free can handle NULL pointer. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* common: mmc: unsigned char compared against 0Peng Fan2015-12-05-1/+1
| | | | | | | | | | | | | | "enable" is unsigned char type and its value will not be negative, so discard "enable < 0". Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Diego Santa Cruz <Diego.SantaCruz@spinetix.com> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com> Cc: Simon Glass <sjg@chromium.org> Cc: Stefano Babic <sbabic@denx.de> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* common: miiphyutil: no need to check name of mii_devPeng Fan2015-12-05-1/+1
| | | | | | | | | | | | | The entry name of mii_dev is an array not pointer, so no need to check. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* common: image-fdt: correct fdt_blob for IMAGE_FORMAT_LEGACYPeng Fan2015-12-05-1/+1
| | | | | | | | | | | | | | | | | If condition of "(load == image_start || load == image_data)" is true, should use "fdt_addr = load;", but not "fdt_blob = (char *)image_data;", or fdt_blob will be overridden by "fdt_blob = map_sysmem(fdt_addr, 0);" at the end of the switch case. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Simon Glass <sjg@chromium.org> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Max Krummenacher <max.krummenacher@toradex.com> Cc: Marek Vasut <marex@denx.de> Cc: Suriyan Ramasami <suriyan.r@gmail.com> Cc: Paul Kocialkowski <contact@paulk.fr> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* common: cli_hush: avoid dead codePeng Fan2015-12-05-1/+1
| | | | | | | | | | | | | | | Condition "(value == NULL && ++value == NULL)" actully will always return false. Instead, use condition "(value == NULL || *(value + 1) == 0)" to detect such expression "c=". To "c=", *(value + 1) is 0, so directly return -1, but not continue. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Rabin Vincent <rabin@rab.in> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of http://git.denx.de/u-boot-sparcTom Rini2015-12-04-2/+28
|\
| * sparc: Update PROM initialization code for generic boardFrancois Retief2015-12-03-0/+24
| | | | | | | | | | | | | | | | | | | | Fixed the prom_relocate() function in start.S file by reserving memory in the board_init_f sequence and saving the offset to the __prom_start_reloc variable. This value is used as the destination when relocating the PROM. Add the prom_init() function to the end of the board_init_r sequence. Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>
| * sparc: Update cpu_init.c to use generic timer infrastructureFrancois Retief2015-12-03-1/+2
| | | | | | | | | | | | | | | | | | | | | | Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use of the generic timer infrastructure in lib/time.c. Created a timer_init() function to initialize the timer hardware and update the #ifdef in board_init_f to allow this function to be called during the start-up sequence. Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>
| * sparc: Initial ground work for generic board initializationFrancois Retief2015-12-03-1/+2
| | | | | | | | | | | | | | Initial ground work in preperation for generic board initialization code for the SPARC architecture. Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>
* | Revert "LCD: Add an option to skip registration as an stdio output"Anatolij Gustschin2015-12-02-13/+0
|/ | | | | | | | | | This reverts commit 05bfe1321024e2ae0039dc16f17d2165610fb4fd. As discussed on the list, we already have the needed functionality by defining CONFIG_SYS_CONSOLE_IS_IN_ENV, CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE and adding custom overwrite_console() in the board code. Signed-off-by: Anatolij Gustschin <agust@denx.de>
* dm: pci: Convert 'pci' command to driver modelSimon Glass2015-12-01-5/+128
| | | | | | | | | Adjust this command to use the correct PCI functions, instead of the compatibility layer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
* pci: Move PCI header output code into its own functionSimon Glass2015-12-01-6/+11
| | | | | | | | We want to share this code with the driver model version, so put it in a separate function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* pci: Use a separate 'dev' variable for the PCI deviceSimon Glass2015-12-01-5/+8
| | | | | | | | | In the 'pci' command, add a separate variable to hold the PCI device. When this code is converted to driver model, this variable will be used to hold a struct udevice instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* pci: Use common functions to read/write configSimon Glass2015-12-01-43/+31
| | | | | | | | | | Currently we use switch() and access PCI configuration via several functions, one for each data size. Adjust the code to use generic functions, where the data size is a parameter. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
* pci: Tidy up function comments in cmd_pci.cSimon Glass2015-12-01-45/+39
| | | | | | | The function comments use an old style and some are incorrect. Update them. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: pci: Reorder functions in cmd_pci.cSimon Glass2015-12-01-110/+106
| | | | | | | | Before converting this to driver model, reorder the code to avoid forward function declarations. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* pci: Refactor the pciinfo() functionSimon Glass2015-12-01-89/+148
| | | | | | | | | | This function uses macros to output data. It seems better to use a table of registers rather than macro-based code generation. It also reduces the code/data size by 2KB on ARM. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
* pci: Use a separate variable for the bus numberSimon Glass2015-12-01-3/+3
| | | | | | | | At present in do_pci(), bdf can either mean a bus number or a PCI bus number. Use separate variables instead to reduce confusion. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* pci: Use a common return in command processingSimon Glass2015-12-01-6/+13
| | | | | | | Adjust the commands to return from the same place. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: pci: Avoid a driver model build error with CONFIG_CMD_PCI_ENUMSimon Glass2015-12-01-0/+4
| | | | | | | | | | | | | This is not supported with driver model, so print a message instead of generating a build error. Rescanning PCI is not yet implemented. This function will be implemented later once some additional PCI driver model improvements are merged. It was confirmed on the mailing list that no one on the tegra side will miss this feature, so it is disabled for tegra. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
* dm: timer: Avoid using timer before it is readySimon Glass2015-12-01-1/+9
| | | | | | | | | | | | | | At present bootstage will try to read the timer very early after relocation. When driver model is used to provide the timer, we cannot read it until driver model is ready. Correct this by adding a separate stage for the post-relocation bootstage init. This fixes booting on chromebook_link. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>
* Merge branch 'master' of git://git.denx.de/u-boot-videoTom Rini2015-11-30-0/+13
|\