summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* dm: usb: Move descriptor setup code into its own functionSimon Glass2015-04-181-65/+82
| | | | | | | | | | | | | | | | usb_new_device() is far too long and does far too much. As a first step, move the code that does initial setup and reads a descriptor into its own function called usb_setup_descriptor(). For XHCI the init order is different - we set up the device but don't actually read the descriptor until after we set an address. Support this option as a parameter to usb_setup_descriptor(). Avoid changing this torturous code more than necessary to make it easy to review. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* dm: usb: Refactor port resetsSimon Glass2015-04-182-16/+28
| | | | | | | | Move the port reset code into its own function. Rename usb_hub_reset() to indicate that is is now a legacy function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* dm: usb: Drop the legacy USB init sequenceSimon Glass2015-04-181-22/+4
| | | | | | | This CONFIG is not used anywhere in U-Boot, so drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de>
* dm: usb: Convert 'usb' command to support driver modelSimon Glass2015-04-181-2/+145
| | | | | | | | | | Adjust this command to work with the new driver model uclass. It needs to iterate through multiple independent controllers to find hubs, and work through their children recursively in a different way. Otherwise the functionality is much the same. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* dm: usb: Adjust usb_alloc_new_device() to return an errorSimon Glass2015-04-182-25/+35
| | | | | | | | | | This function returns NULL on error at present. Adjust it so that we can return a real error, as is needed with driver model. Also improve the error handling in its caller, usb_hub_port_connect_change(), and adjust the code order to prepare for driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* dm: usb: Adjust usb command to prepare for driver modelSimon Glass2015-04-181-26/+25
| | | | | | | | | Use 'udev' instead of 'dev' in a few places, reserving 'dev' for driver model's struct udevice. Also adjust the code in a few minor ways to make it easier to plumb in driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* cros_ec: Remove unused cros_ec_board_init() functionSimon Glass2015-04-181-5/+0
| | | | | | Now that driver model handles cros_ec init, we can drop this special code. Signed-off-by: Simon Glass <sjg@chromium.org>
* cros_ec: Drop unused CONFIG_DM_CROS_ECSimon Glass2015-04-181-29/+1
| | | | | | | Since all supported boards enable this option now, we can remove it along with the old code. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: x86: spi: Convert ICH SPI driver to driver modelSimon Glass2015-04-181-3/+0
| | | | | | | | | | | | Convert this driver over to use driver model. Since all x86 platforms use it, move x86 to use driver model for SPI and SPI flash. Adjust all dependent code and remove the old x86 spi_init() function. Note that this does not make full use of the new PCI uclass as yet. We still scan the bus looking for the device. It should move to finding its details in the device tree. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: eth: Add basic driver model support to Ethernet stackJoe Hershberger2015-04-181-0/+2
| | | | | | | First just add support for MAC drivers. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: net: Clean up return codesJoe Hershberger2015-04-181-24/+21
| | | | | | | | The return codes in common/cmd_net.c had a number of inconsistencies. Update them to all use the enum from command.h Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* net: Remove the bd* parameter from net stack functionsJoe Hershberger2015-04-182-2/+2
| | | | | | | | | | | | | This value is not used by the network stack and is available in the global data, so stop passing it around. For the one legacy function that still expects it (init op on old Ethernet drivers) pass in the global pointer version directly to avoid changing that interface. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reported-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> (Trival fix to remove an unneeded variable declaration in 4xx_enet.c)
* common: Make sure arch-specific map_sysmem() is definedJoe Hershberger2015-04-1823-0/+23
| | | | | | | | | | | In the case where the arch defines a custom map_sysmem(), make sure that including just mapmem.h is sufficient to have these functions as they are when the arch does not override it. Also split the non-arch specific functions out of common.h Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: pci: Add a uclass for PCISimon Glass2015-04-162-3/+13
| | | | | | | | | | | Add a uclass for PCI controllers and a generic one for PCI devices. Adjust the 'pci' command and the existing PCI support to work with this new uclass. Keep most of the compatibility code in a separate file so that it can be removed one day. TODO: Add more header file comments to the new parts of pci.h Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add dev_get_uclass_priv() to access uclass private dataSimon Glass2015-04-162-2/+2
| | | | | | | | Add a convenience function to access the private data that a uclass stores for each of its devices. Convert over most existing uses for consistency and to provide an example for others. Signed-off-by: Simon Glass <sjg@chromium.org>
* Correct map_sysmem() logic in do_mem_mw()Simon Glass2015-04-161-3/+4
| | | | | | | This function does not unmap what it maps. Correct it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: Add a new CPU init function which can use driver modelSimon Glass2015-04-161-0/+6
| | | | | | | | | | | Since driver model is set up after arch_cpu_init(), that function cannot use drivers. Add a new arch_cpu_init_dm() function which is called immediately after driver model is ready, and can reference devices. This can be used to probe essential devices for the CPU. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* fastboot: Proper download gadget unregister and clear when cable is missingPaul Kocialkowski2015-04-141-0/+2
| | | | Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* fastboot: check for alias when looking up partition by nameMichael Scott2015-04-141-2/+24
| | | | | | | | | | | | | | | | | Implement an alias name check for devices where GPT limitations prevent user-friendly partition names such as "boot", "system" and "cache". Or, where the actual partition name doesn't match a standard partition name used commonly with fastboot. To set an alias, add an environment setting as follows: fastboot_partition_alias_<alias partition name>=<actual partition name> Example: fastboot_partition_alias_boot=LNX Signed-off-by: Michael Scott <michael.scott@linaro.org> Acked-by: Steve Rae <srae@broadcom.com> Cc: Steve Rae <srae@broadcom.com> Cc: Lukasz Majewski <l.majewski@samsung.com>
* dfu: cmd: trigger watchdog before calling usb_gadget_handle_interruptsHeiko Schocher2015-04-141-0/+2
| | | | | | | | | | trigger watchdog before calling usb_gadget_handle_interrupts() This prevents board resets when calling dfu command on boards which have a watchdog. Signed-off-by: Heiko Schocher <hs@denx.de> [ Reedition by Lukasz Majewski <l.majewski@samsung.com> to apply to v2014.04 release ]
* cmd_usb_mass_storage: Use 'USB Mass Storage' in the help textFabio Estevam2015-04-141-1/+1
| | | | | | | | USB Mass Storage is the standard name, so let's use it here. Suggested-by: Soeren Moch <smoch@web.de> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Marek Vasut <marex@denx.de>
* usb: gadget: thor: Invoke board specific USB cleanup interfaceInha Song2015-04-141-0/+1
| | | | | | | This patch invokes board-specific USB cleanup (board_usb_cleanup) function in the thor gadget. Signed-off-by: Inha Song <ideal.song@samsung.com>
* usb: gadget: UMS: Invoke board specific USB cleanup interfaceInha Song2015-04-141-0/+1
| | | | | | | This patch invokes board-specific USB cleanup (board_usb_cleanup) function in the mass storage gadget Signed-off-by: Inha Song <ideal.song@samsung.com>
* usb: modify usb_gadget_handle_interrupts to take controller indexKishon Vijay Abraham I2015-04-143-3/+3
| | | | | | | | | | | | | | Since we support multiple dwc3 controllers to be existent at the same time, in order to handle the interrupts of a particular dwc3 controller usb_gadget_handle_interrutps should take controller index as an argument. Hence the API of usb_gadget_handle_interrupts is modified to take controller index as an argument and made the corresponding changes to all the usb_gadget_handle_interrupts calls. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
* common: cmd_dfu: invoke board_usb_cleanup() for cleaning upKishon Vijay Abraham I2015-04-142-0/+7
| | | | | | | | Invoked board_usb_cleanup for cleaning up initialized USB. It will be invoked if the user enterts ctrl-C. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
* usb: hub: allow pgood_delay to be specified via envTim Harvey2015-04-141-0/+8
| | | | | | | Some USB devices break the spec and require longer warm-up times. Allow the usb_pgood_delay env variable to override the calculated time. Signed-off-by: Tim Harvey <tharvey@gateworks.com>
* usb: fix first descriptor fetch error handlingStephen Warren2015-04-141-1/+16
| | | | | | | | | | | | | | | | | | When fetching the first descriptor from a new device, only validate that we received at least 8 bytes, not that we received the entire descriptor. The reasoning is: - The code only uses fields in the first 8 bytes, so that's all we need to have fetched at this stage. - The smallest maxpacket size is 8 bytes. Before we know the actual maxpacket the device uses, the USB controller may only accept a single packet (see the DWC2 note in the comment added in the commit). Consequently we are only guaranteed to receive 1 packet (at least 8 bytes) even in a non-error case. Fixes: 1a7758044b04 ("usb: Early failure when the first descriptor read fails or is invalid") Cc: Paul Kocialkowski <contact@paulk.fr> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
* usb: Early failure when the first descriptor read fails or is invalidPaul Kocialkowski2015-04-141-1/+4
| | | | | | | | This may happen when using an USB1 device on a controller that only supports USB2 (e.g. EHCI). Reading the first descriptor will fail (read 0 byte), so we can abort the process at this point instead of failing later and wasting time. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* usb: Check usb_new_device for failurePaul Kocialkowski2015-04-141-4/+10
| | | | | | | This checks that a new USB device is correctly initialized and frees it if not. In addition, this doesn't report that USB was started when no device was found. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* usb: usb_new_device return codes consistencyPaul Kocialkowski2015-04-141-29/+29
| | | | | | | This makes use of errno return codes for representing error codes in a unified way. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* usb_storage:Fix USB storage capacity detection on 64 bit architecturesSergey Temerkhanov2015-04-141-21/+23
| | | | | | | | | | | This patch fixes USB storage capacity detection breakage on 64-bit systems which arises due to 'unsigned long' length difference. Old code assumes that to be 32 bit and breaks because of inappropriate response buffer layout. Also this fixes a number of build warnings and changes big-endian values treatment style to be architecture-independent Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
* usb_storage : scan all interfaces to find a storage deviceFranck Jullien2015-04-141-17/+28
| | | | | | | Mass storage is not necessary present on interface 0. This patch allow usb_stor_scan to look in every available interface. Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
* common/armflash: Support for ARM flash imagesLinus Walleij2015-04-103-0/+285
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The ARM reference designs all use a special flash image format that stores a footer (two versions exist) at the end of the last erase block of the image in flash memory. Version one of the footer is indicated by the magic number 0xA0FFFF9F at 12 bytes before the end of the flash block and version two is indicated by the magic number 0x464F4F54 0x464C5348 (ASCII for "FLSHFOOT") in the very last 8 bytes of the erase block. This command driver implements support for both versions of the AFS images (the name comes from the Linux driver in drivers/mtd/afs.c) and makes it possible to list images and load an image by name into the memory with these commands: afs - lists flash contents afs load <image> - loads image to address indicated in the image afs load <image> <addres> - loads image to a specified address This image scheme is used on the ARM Integrator family, ARM Versatile family, ARM RealView family (not yet supported in U-Boot) and ARM Versatile Express family up to and including the new Juno board for 64 bit development. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2015-04-102-0/+13
|\
| * Introduce CONFIG_SPL_PANIC_ON_RAW_IMAGEAlbert ARIBAUD \(3ADEV\)2015-04-101-0/+12
| | | | | | | | | | | | | | | | | | introduce CONFIG_SPL_PANIC_ON_RAW_IMAGE. An SPL which define this will panic() if the image it has loaded does not have a mkimage signature. Signed-off-by: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
| * lpc32xx: add lpc32xx-spl.bin boot image targetAlbert ARIBAUD \(3ADEV\)2015-04-101-0/+1
| | | | | | | | Signed-off-by: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
* | common, ubi: use positive return values for ubi checkStefan Agner2015-04-101-1/+1
|/ | | | | | | | | | | The ubi check command is expected to not fail and just check whether a volume exist or not. Currently, when a volume does not exist, the command fails which leads to an error: "exit not allowed from main input shell." Use 1 to indicate that a volume does not exist. This allows to use ubi check in an if statement, e.g. if ubi check rootfs; then; echo "exists"; else; echo "not there"; fi
* cmd_mem.c: Update 'iteration_limit' to unsigned longTom Rini2015-04-071-1/+1
| | | | | | | | | With e37f1eb we now use strict_strtoul() in do_mem_mtest() and this gives us a warning: ../include/vsprintf.h:38:5: note: expected 'long unsigned int *' but argument is of type 'int *' Signed-off-by: Tom Rini <trini@konsulko.com>
* cmd_mem: cleanups, catch bad usagePavel Machek2015-04-071-15/+19
| | | | | | | Currently, memtest will silently accept bad data. Perform error checking on user intput. Signed-off-by: Pavel Machek <pavel@denx.de>
* env_sf: Fix recovery defaultMario Schuknecht2015-04-071-2/+4
| | | | | | | | | | | | | | | | | | | | | The u-boot environment is redundantly stored in a NOR flash on our boards. Redundant means that there are two places to store the environment. But only one of the two is active. I discovered that on one board the u-boot (env_sf) uses the environment from the second place and the Kernel (fw_printenv) uses the environment from the first place. To decide which is the active environment there is a byte inside the environment. 1 means active and 0 means obsolete. But on that board both environments had have a 1. This can happen if a power loss or reset occurs during writing the environment. In this situation the u-boot (env_sf) implementation uses the second environment as default. But the Kernel (fw_printenv) implementation uses the first environment as default. This commit corrects the default in the u-boot env_sf implementation when a problem was detected. Now the recovery default is the same like in all other environment implementations. E.g. fw_printenv and env_flash. This ensures that u-boot and Kernel use the same environment. Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
* arc: clean-up init procedureAlexey Brodkin2015-04-031-4/+4
| | | | | | | | | | | | | | | | Intention behind this work was elimination of as much assembly-written code as it is possible. In case of ARC we already have relocation fix-up implemented in C so why don't we use C for U-Boot copying, .bss zeroing etc. It turned out x86 uses pretty similar approach so we re-used parts of code in "board_f.c" initially implemented for x86. Now assembly usage during init is limited to stack- and frame-pointer setup before and after relocation. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Simon Glass <sjg@chromium.org>
* nand: yaffs: Remove the "nand write.yaffs" commandPeter Tyser2015-03-301-15/+0
| | | | | | | | | | | | | | | | This command is only enabled by one board, complicates the NAND code, and doesn't appear to have been functioning properly for several years. If there are no bad blocks in the NAND region being written nand_write_skip_bad() will take the shortcut of calling nand_write() which bypasses the special yaffs handling. This causes invalid YAFFS data to be written. See http://lists.denx.de/pipermail/u-boot/2011-September/102830.html for an example and a potential workaround. U-Boot still retains the ability to mount and access YAFFS partitions via CONFIG_YAFFS2. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* cmd_nand: Verify writes to NANDPeter Tyser2015-03-301-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously NAND writes were only verified when CONFIG_MTD_NAND_VERIFY_WRITE was defined. On boards without this define writes could fail silently. Boards with CONFIG_MTD_NAND_VERIFY_WRITE could prematurely report failures which ECC could correct. Add a verification step after all "nand write[.x]" commands to ensure the writes were successful. The verification uses ECC for for "normal" writes, but does not for raw and yaffs writes. Some test cases which inject fake bad bits on a 2K page flash are below. Test cases with CONFIG_MTD_NAND_VERIFY_WRITE defined: Example of an ECC write which previously failed when CONFIG_MTD_NAND_VERIFY_WRITE was defined, but now succeeds because ECC is used during verification: nand erase 0 0x10000 dhcp /somefile mw.b 0x10000 0xff 0x2000 mw.b 0x10020 0xfe 1 nand write.raw 0x10000 0x800 1 mw.b 0x1000020 0x01 1 nand write 0x1000000 0x800 0x1800 Test cases without CONFIG_MTD_NAND_VERIFY_WRITE defined: Example of an ECC write which previously silently failed: nand erase 0 0x10000 dhcp /somefile mw.b 0x10000 0xff 0x2000 mw.b 0x10020 0x00 1 nand write.raw 0x10000 0x800 1 mw.b 0x1000020 0xff 1 nand write 0x1000000 0x800 0x1800 Example of a raw write which previously failed silently due to stuck data bit, but now errors out: nand erase 0 0x10000 dhcp /somefile mw.b 0x10000 0xff 0x2000 mw.b 0x10020 0xfe 1 nand write.raw 0x10000 0x800 1 mw.b 0x1000020 0x01 1 nand write.raw 0x1000000 0x800 3 Example of a raw write which previously failed silently due to stuck OOB bit, but now errors out: nand erase 0 0x10000 dhcp /somefile mw.b 0x10000 0xff 0x2000 mw.b 0x10810 0xfe 1 nand write.raw 0x10000 0x800 1 mw.b 0x1000810 0x01 1 nand write.raw 0x1000000 0x800 3 Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Tested-by: Heiko Schocher <hs@denx.de> Acked-by: Heiko Schocher <hs@denx.de>
* m68k: fix 3 broken boardsangelo@sysam.it2015-03-281-2/+2
| | | | | | | | | | | Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error. These boards have video but don't need any ppc related video_setmem(). Fix M53017EVB moving away embedded env to a different offset, as in M52277EVB. Signed-off-by: Angelo Dureghello <angelo@sysam.it>
* common/board_f: move board_init_f_mem() from #else CONFIG_X86Alexey Brodkin2015-03-281-2/+4
| | | | | | | | | | | | | | | | | | | | Purpose of this change is to make it possible to re-use code currently used on X86 solely for other architectures. For example: * init_sequence_f_r * board_init_f_r Even though board_init_f_mem() has nothing to do with any particular architecture it won't work (at least in current implementation) for X86. This is because on X86 "gd" is an alias to function get_fs_gd_ptr(), thus we cannot assign anything to it. So this change separates selection of board_init_f_mem() from X86 while keeping it disabled for X86 still. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
* part: Add support for list filtering on bootable partitionsSjoerd Simons2015-03-251-12/+41
| | | | | | | | Add an optional -bootable parameter to the part list commands to only put the list of bootable partitions in the environment variable Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* remove unnecessary version.h includesRob Herring2015-03-242-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various files are needlessly rebuilt every time due to the version and build time changing. As version.h is not actually needed, remove the include. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Stefano Babic <sbabic@denx.de> Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: Tom Warren <twarren@nvidia.com> Cc: Michal Simek <monstr@monstr.eu> Cc: Macpaul Lin <macpaul@andestech.com> Cc: Wolfgang Denk <wd@denx.de> Cc: York Sun <yorksun@freescale.com> Cc: Stefan Roese <sr@denx.de> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Philippe Reynes <tremyfr@yahoo.fr> Cc: Eric Jarrige <eric.jarrige@armadeus.org> Cc: "David Müller" <d.mueller@elsoft.ch> Cc: Phil Edworthy <phil.edworthy@renesas.com> Cc: Robert Baldyga <r.baldyga@samsung.com> Cc: Torsten Koschorrek <koschorrek@synertronixx.de> Cc: Anatolij Gustschin <agust@denx.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Łukasz Majewski <l.majewski@samsung.com>
* Merge branch 'master' of git://www.denx.de/git/u-boot-imxTom Rini2015-03-181-1/+2
|\
| * common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()Stefan Roese2015-03-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Without this patch, the IMX watchdog will not be initialized. And therefor not active. This patch fixes this by calling hw_watchdog_init() also when CONFIG_IMX_WATCHDOG is defined. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Stefano Babic <sbabic@denx.de> Cc: Heiko Schocher <hs@denx.de> Acked-by: Heiko Schocher <hs@denx.de>
| * Merge branch 'master' of git://git.denx.de/u-bootStefano Babic2015-03-053-2/+99
| |\
OpenPOWER on IntegriCloud