summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* spl, common, serial: build SPL without serial supportHeiko Schocher2015-08-124-4/+12
| | | | | | | | | This patch enables building SPL without CONFIG_SPL_SERIAL_SUPPORT support. Signed-off-by: Heiko Schocher <hs@denx.de> [trini: Ensure we build arch/arm/imx-common on mx28] Signed-off-by: Tom Rini <trini@konsulko.com>
* dm: pmic: Display the regulator limits on errorSimon Glass2015-08-051-1/+2
| | | | | | | | When a regulator command cannot honour the requested voltage, display the limits to try to be helpful. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: usb: fix USB Ethernet without CONFIG_DM_ETH regressionMarcel Ziswiler2015-08-051-3/+6
| | | | | | | | | | | | | | | | The following commit enforces CONFIG_DM_ETH for USB Ethernet which breaks any board using CONFIG_USB_HOST_ETHER without CONFIG_DM_ETH which this patch fixes. commit 69559093f6173dcfcb041df0995063bdbd07d49b dm: usb: Avoid using USB ethernet with CONFIG_DM_USB and no DM_ETH Tested on Colibri T20/T30 as well as Apalis T30 with CONFIG_USB_HOST_ETHER and CONFIG_USB_ETHER_ASIX enabled and a LevelOne USB-0301 ASIX AX88772 dongle. Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Simon Glass <sjg@chromium.org>
* Merge git://git.denx.de/u-boot-x86Tom Rini2015-08-055-5/+272
|\
| * efi: Add a command to display the memory mapSimon Glass2015-08-052-0/+258
| | | | | | | | | | | | | | | | | | | | The EFI memory map is passed from the stub to U-Boot in a table. Add a command to display it in a vaguely readable fashion. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested on QEMU Tested-by: Bin Meng <bmeng.cn@gmail.com>
| * Add a way to skip relocationSimon Glass2015-08-051-0/+9
| | | | | | | | | | | | | | | | | | | | | | When running U-Boot as an EFI application we cannot relocate since we do not have relocation information. U-Boot has already been relocated to a suitable address. Add a global_data flag to control skipping relocation. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * efi: Avoid using non-existent text baseBen Stoltz2015-08-051-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | When U-Boot runs as an EFI application is does not have a definition of CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation is done by EFI. U-Boot can be loaded at any address. This is similar to how sandbox works. Adjust the early board init to deal with this. Signed-off-by: Ben Stoltz <stoltz@google.com> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * common: command add '\n' for debug msgPeng Fan2015-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | Add '\n' for debug msg. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Tom Rini <trini@konsulko.com> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
| * common: Print nothing in the __weak checkboard()Bin Meng2015-08-051-1/+0
| | | | | | | | | | | | | | Do not print confusing "Board: Unknown" during boot. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* | usb: Fix device detection codeMarek Vasut2015-08-051-3/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code in question polls an USB port status via USB_REQ_GET_STATUS to determine whether there is a device on the port or not. The way to figure that out is to check two bits. Those are wPortChange[0] and wPortStatus[0]. The wPortChange[0] indicates whether some kind of a connection status change happened on a port (a device was plugged or unplugged). The wPortStatus[0] bit indicates the status of the connection (plugged or unplugged). The current code tests whether wPortChange[0] == wPortStatus[0] and if that's the case, considers the loop polling for the presence of a USB device on port finished. This works for most USB sticks, since they come up really quickly and trigger the USB port change detection before the first iteration of the detection loop happens. Thus, both wPortChange[0] and wPortStatus[0] are set to 1 and thus equal. The loop is existed in it's first iteration and the stick is detected correctly. The problem is with some obscure USB sticks, which take some time before they pop up on the bus after the port was enabled. In this case, both the wPortChange[0] and wPortStatus[0] are 0. They are equal again, so the loop again exits in the first iteration, but this is incorrect, as such USB stick didn't have the opportunity to get detected on the bus. Rework the code such, that it checks for wPortChange[0] first to test if any connection change happened at all. If no change occured, keep polling. If a change did occur, test the wPortStatus[0] to see there is some device present on the port and only if this is the case, break out of the polling loop. This patch also trims down the duration of the polling loop from 10s per port to 1s per port. This is still annoyingly long, but there is no better option in case of U-Boot unfortunatelly. This change will most likely increase the duration of 'usb start' on some platforms, but this is needed to fix a bug. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Hans de Goede <hdegoede@redhat.com>
* Merge branch 'master' of git://git.denx.de/u-boot-tegraTom Rini2015-07-291-2/+6
|\
| * pxe: add AArch64 image supportStephen Warren2015-07-271-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sysboot and pxe commands currently support either U-Boot formats or raw zImages. Add support for the AArch64 Linux port's native image format too. As with zImage support, there is no auto-detection of the native image format. Rather, if the image is auto-detected as a U-Boot format, U-Boot will try to interpret it as such. Otherwise, U-Boot will fall back to a raw/native image format, if one is enabled. My belief is that CONFIG_CMD_BOOTZ won't ever be enabled for any AArch64 port, hence there's never a need to differentiate between CONFIG_CMD_ _BOOTI and _BOOTZ at run-time; compile-time will do. Even if this isn't true, we want to prefer _BOOTI over _BOOTZ when defined, since _BOOTI is definitely the native format for AArch64. Change-Id: I83c5cc7566032afd72516de46f4e5eb7a780284a Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | Merge branch 'zynq' of git://www.denx.de/git/u-boot-microblazeTom Rini2015-07-281-0/+22
|\ \
| * | cmd_mp: Add support for showing all CPU status by one commandMichal Simek2015-07-281-0/+22
| |/ | | | | | | | | | | | | | | Use one command for showing overall CPU status than several without knowing how many cpus is available in the system. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* | generic_board: Call "checkboard" even though the root node has a "model" ↵Haikun.Wang@freescale.com2015-07-271-5/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | property In case of enable CONFIG_OF_CONTROL and has a "model" property in the root node, the board special "checkboard" will not be called. Usually we show some useful version information in the function. This patch enable call "checkboard" in any case. It is not conflicting with showing "model" at the same time. For example on LS2085AQDS: Showing "model" only: Model: Freescale Layerscape 2085a QDS Board Showing "checkboard" only: Board: LS2085E-QDS, Board Arch: V1, Board version: B, boot from vBank: 4 Showing both: Model: Freescale Layerscape 2085a QDS Board Board: LS2085E-QDS, Board Arch: V1, Board version: B, boot from vBank: 4 Signed-off-by: Haikun Wang <haikun.wang@freescale.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge git://git.denx.de/u-boot-usbTom Rini2015-07-241-7/+26
|\
| * fastboot: Dynamic controller index for usb_gadget_handle_interruptsPaul Kocialkowski2015-07-221-1/+1
| | | | | | | | | | | | | | | | Since we're now using a dynamic controller index for fastboot too, usb_gadget_handle_interrupts should be using it instead of 0 (despite the fact that it's currently not being used at all in the musb-new implementation). Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
| * usb: board_usb_init and board_usb_cleanup calls in the fastboot commandPaul Kocialkowski2015-07-221-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each USB download function command calls board_usb_init before registering the USB gadget and board_usb_cleanup after de-registering it. On devices currently using fasboot, musb-new is usually initialized earlier, but some other boards might need the board_usb_init call to properly initialize musb-new. This requires adding an argument (the USB controller index) to the fastboot command, as it is currently done with other USB download gadget functions. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Test HW: Odroid_XU3 (Exynos5422), trats (Exynos4210)
* | spl: spl_mmc: Add option to boot from a MMC partition with offsetStefan Roese2015-07-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces the option to boot from a MMC card parition with an offset. This can be done by using both defines together: define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION 1 define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR ((160 << 10) / 512) The example above loads the main U-Boot at offset 160KiB from the MMC partition 1. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Luka Perkov <luka.perkov@sartura.hr> Cc: Dirk Eibach <eibach@gdsys.de> Cc: Tom Rini <trini@konsulko.com>
* | dm: usb: Adjust the USB_DEVICE() macro namingSimon Glass2015-07-213-4/+4
| | | | | | | | | | | | | | | | | | In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID. We should follow the same convention in U-Boot. Rename the existing USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE() macro from Linux for use in U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: usb: eth: Support driver model with USB EthernetSimon Glass2015-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | At present USB Ethernet does not work with CONFIG_DM_ETH. Add driver model support to this feature, so that it can work alongside other Ethernet devices with driver model. It was found that quite a bit of code is common in most of the USB Ethernet drivers. Add this code to the common layer to reduce the amount of duplicate code needed in USB Ethernet drivers when CONFIG_DM_ETH is used. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* | dm: usb: Avoid using USB ethernet with CONFIG_DM_USB and no DM_ETHSimon Glass2015-07-211-2/+5
| | | | | | | | | | | | | | | | | | If driver model is used for Ethernet then USB Ethernet does not build. This can be made to work with driver model is used for USB also. Add #ifdef logic to make this clear when building. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* | dm: pci: Add support for PCI driver matchingSimon Glass2015-07-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present all PCI devices must be present in the device tree in order to be used. Many or most PCI devices don't require any configuration other than that which is done automatically by U-Boot. It is inefficent to add a node with nothing but a compatible string in order to get a device working. Add a mechanism whereby PCI drivers can be declared along with the device parameters they support (vendor/device/class). When no suitable driver is found in the device tree the list of such devices is consulted to determine the correct driver. If this also fails, then a generic driver is used as before. The mechanism used is very similar to that provided by Linux and the header file defintions are copied from Linux 4.1. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | dm: usb: Do not assume that first child is always a hubHans de Goede2015-07-211-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | On some single port (otg) controllers there is no emulated root hub, so the first child (if any) may be one of: UCLASS_MASS_STORAGE, UCLASS_USB_DEV_GENERIC or UCLASS_USB_HUB. All three of these (and in the future others) are suitable for our purposes, remove the check for the device being a hub, and add a check to deal with the fact that there may be no child-dev. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* | dm: usb: Fix "usb tree" outputHans de Goede2015-07-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | last_child was abused by the old usb code to first store 1 if the usb_device was not the root of the usb tree, and then later on re-used to store whether or not the usb_device is actually the last child. The dm-usb code was always setting it to actually reflect the last-child status which is wrong for the last child leading to output like this: USB device tree: 1 Hub (12 Mb/s, 100mA) | ALCOR USB Hub 2.0 | | 2 Mass Storage (12 Mb/s, 100mA) | USB Flash Disk 4C0E960F | +-3 Human Interface (1.5 Mb/s, 100mA) SINO WEALTH USB Composite Device Instead of this: USB device tree: 1 Hub (12 Mb/s, 100mA) | ALCOR USB Hub 2.0 | +-2 Mass Storage (12 Mb/s, 100mA) | USB Flash Disk 4C0E960F | +-3 Human Interface (1.5 Mb/s, 100mA) SINO WEALTH USB Composite Device This commit fixes this by first checking that the device is not root, and then setting last_child. This commit also updates the old code to not abuse the last_child variable to store the root check result. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* | usb: Add an usb_device parameter to usb_reset_root_portHans de Goede2015-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | Add an usb_device parameter to usb_reset_root_port so that it knows which root-port it is resetting. This is necessary for proper device-model support for usb_reset_root_port. Also remove a duplicate declaration of usb_reset_root_port() from usb.h . Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* | usb: Pass device instead of portnr to usb_legacy_port_resetHans de Goede2015-07-211-4/+4
| | | | | | | | | | | | | | | | Pass the usb_device instead of the portnr to usb_legacy_port_reset and rename it to usb_hub_port_reset as there is nothing legacy about it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* | usb: usb_setup_device: Drop unneeded portnr function argumentHans de Goede2015-07-211-5/+5
| | | | | | | | | | | | | | | | Drop the unneeded portnr function argument, the portnr is part of the usb_device struct which is passed via the dev argument. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* | usb: Drop device-model specific copy of usb_legacy_port_resetHans de Goede2015-07-211-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The device-model usb_legacy_port_reset function calls the device-model usb_port_reset function which is a 1 on 1 copy of the non dm usb_legacy_port_reset and this is the only use of usb_port_reset in all of u-boot. Drop both, and alway use the usb_legacy_port_reset() version in common/usb.c . Also while at it make it static as it is only used in common/usb.c . Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* | spl: Add a debug string before the jump to U-BootSimon Glass2015-07-211-0/+1
| | | | | | | | | | | | | | As a debug option, add positive confirmation that SPL has completed execution. This can help with diagnosing the location of unexpected hangs. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: spl: Allow device tree/driver model in board_init_f()Simon Glass2015-07-211-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | Add an spl_init() function that does basic init such that board_init_f() can use simple malloc(), device tree and driver model. Each one is set up only if enabled for SPL. Note: We really should refactor SPL such that there is a single board_init_f() and rename the existing weak board_init_f() functions provided by boards, calling them from the single board_init_f(). Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: mmc: Allow driver model to be used for MMC in SPLSimon Glass2015-07-211-2/+15
| | | | | | | | | | | | Enable MMC using driver model in SPL for consistency with U-Boot proper. Signed-off-by: Simon Glass <sjg@chromium.org>
* | spl: Add debugging info for spl_mmc bootSimon Glass2015-07-211-2/+7
| | | | | | | | | | | | Add a few messages to indicate progress and failure. Signed-off-by: Simon Glass <sjg@chromium.org>
* | sandbox: Drop special-case sandbox console codeSimon Glass2015-07-211-5/+1
| | | | | | | | | | | | | | | | | | At present printf() skips output if it can see there is no console. This is really just an optimisation, and is not necessary. Also it is currently incorrect in some cases. Rather than update the logic, just remove it so that we don't need to keep it in sync. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: Allow debug UART to support an early consoleSimon Glass2015-07-211-0/+19
| | | | | | | | | | | | | | When there is no console ready, allow the debug UART to be used for output. This makes debugging of early code considerably easier. Signed-off-by: Simon Glass <sjg@chromium.org>
* | mkimage: Display a better list of available image typesSimon Glass2015-07-211-26/+32
|/ | | | | | | | | | | Offer to display the available image types in help. Also, rather than hacking the genimg_get_type_id() function to display a list of types, do this in the tool. Also, sort the list. The list of image types is quite long, and hard to discover. Print it out when we show help information. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriqTom Rini2015-07-201-0/+7
|\
| * board/ls2085rdb: Export functions for standalone AQ FW load appsPrabhakar Kushwaha2015-07-201-0/+7
| | | | | | | | | | | | | | | | | | Export functions required by Aquntia PHY firmware load application. functions are memset, strcpy, mdelay, mdio_get_current_dev, phy_find_by_mask, mdio_phydev_for_ethname and miiphy_set_current_dev Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
* | cmd_fdt: save fdtaddr in hex formatSudeep Holla2015-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 90fbee3e4051 ("cmd_fdt: Actually fix fdt command in sandbox") changed the format(from hex address to unsigned long) in which "fdtaddr" is saved . However do_fdt continues reads the "fdtaddr" assuming it to be in hex format. This may lead to fdt being either loaded or attempted to load at erroneous address generating fault if the address is out of memory. This patch changes back the format to hex while saving the "fdtaddr" as it was done before. Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Hua Yanghao <huayanghao@gmail.com> Cc: Heiko Schocher <hs@denx.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Simon Glass <sjg@chromium.org>
* | fdt: prevent clearing memory node if there are no banksAndre Przywara2015-07-201-0/+3
|/ | | | | | | | | | | | | Avoid clearing the reg property in the memory DT node if no memory banks have been specified for a board (CONFIG_NR_DRAM_BANKS == 0). This allows boards to let U-Boot skip the DT memory tinkering in case other firmware has already setup the node properly before. This should be safe as all callers of fdt_fixup_memory_banks that use a computed <banks> value put at least 1 in there. Add some documentation comments to the header file. Signed-off-by: Andre Przywara <osp@andrep.de> Acked-by: Simon Glass <sjg@chromium.org>
* cmd: date: Change to use CONFIG_DM_RTC instead of CONFIG_DM_I2CBin Meng2015-07-141-6/+6
| | | | | | | | Currently CONFIG_DM_I2C is used in cmd_date.c for driver model, but it should be actually CONFIG_DM_RTC. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: cpu: Fix undefined ENOSYS build errorBin Meng2015-07-141-0/+1
| | | | | | | Include <errno.h> otherwise ENOSYS is undefined. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* spi: sf: Print the error code on failureSimon Glass2015-07-141-2/+6
| | | | | | | | | | Rather than just 'ERROR', display the error code, which may be useful, at least with driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Marek Vasut <marex@denx.de> Reviewed-by: Jagan Teki <jteki@openedev.com>
* x86: fsp: Move FspInitEntry call to board_init_f()Bin Meng2015-07-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far. It worked pretty well but looks not that good. Apart from doing too much work than just enabling CAR, it cannot read the configuration data from device tree at that time. Now we want to move it a little bit later as part of init_sequence_f[] being called by board_init_f(). This way it looks and works better in the U-Boot initialization path. Due to FSP's design, after calling FspInitEntry it will not return to its caller, instead it jumps to a continuation function which is given by bootloader with a new stack in system memory. The original stack in the CAR is gone, but its content is perserved by FSP and described by a bootloader temporary memory HOB. Technically we can recover anything we had before in the previous stack, but that is way too complicated. To make life much easier, in the FSP continuation routine we just simply call fsp_init_done() and jump back to car_init_ret() to redo the whole board_init_f() initialization, but this time with a non-zero HOB list pointer saved in U-Boot's global data so that we can bypass the FspInitEntry for the second time. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com> Tested-by: Simon Glass <sjg@chromium.org>
* scsi: fix compiler warning with DEBUG and 48bit LBAsAndre Przywara2015-07-111-2/+2
| | | | | | | | | | | | | | | | | | Commit 2b42c9317db ("ahci: support LBA48 data reads for 2+TB drives") introduced conditional code which triggers a warning when compiled with DEBUG enabled: In file included from common/cmd_scsi.c:12:0: common/cmd_scsi.c: In function 'scsi_read': include/common.h:109:4: warning: 'smallblks' may be used uninitialized in this function [-Wmaybe-uninitialized] ... Since this is for debug only, take the easy way and initialize the variable explicitly on declaration to avoid the warning. (Fix a nearby whitespace error on the way.) Tested-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Andre Przywara <osp@andrep.de>
* common: Add CMD_SF Kconfig entryJagan Teki2015-07-011-0/+5
| | | | | | Added Kconfig entry for CMD_SF. Signed-off-by: Jagan Teki <jteki@openedev.com>
* mtd, spi: Check if flash pointer is usedHeiko Schocher2015-06-301-0/+5
| | | | | | | | | If flash pointer is used free it, before probing a new flash and storing it in flash. Signed-off-by: Heiko Schocher <hs@denx.de> Tested-by: Jagannadh Teki <jteki@openedev.com> Reviewed-by: Jagannadh Teki <jteki@openedev.com>
* spi, sf: Use offset and size in sf cmd from mtdpartitionHeiko Schocher2015-06-301-25/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this patch, it is possible to get the offset and size information from the mtdpartiton setting in "mtdparts", similiar to the "nand" commandos. => sf sf - SPI flash sub-system Usage: sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus and chip select sf read addr offset|partition len - read `len' bytes starting at `offset' to memory at `addr' sf write addr offset|partition len - write `len' bytes from memory at `addr' to flash at `offset' sf erase offset|partition [+]len - erase `len' bytes from `offset' `+len' round up `len' to block size sf update addr offset|partition len - erase and write `len' bytes from memory at `addr' to flash at `offset' => for example "env" is defined in mtdparts: => sf read 13000000 env device 0 offset 0xd0000, size 0x10000 SF: 65536 bytes @ 0xd0000 Read: OK zynq-uboot> mtdparts add nor0 0x10000@0x0 env zynq-uboot> sf erase env 0x10000 SF: 65536 bytes @ 0x0 Erased: OK zynq-uboot> sf write 0x100 env device 0 offset 0x0, size 0x10000 SF: 65536 bytes @ 0x0 Written: OK zynq-uboot> sf read 0x40000 env device 0 offset 0x0, size 0x10000 SF: 65536 bytes @ 0x0 Read: OK Signed-off-by: Heiko Schocher <hs@denx.de> Tested-by: Jagannadh Teki <jteki@openedev.com> Reviewed-by: Jagannadh Teki <jteki@openedev.com>
* mtd, nand: Move common functions from cmd_nand.c to common placeHeiko Schocher2015-06-303-139/+40
| | | | | | | | | | | | | | Move common functions from cmd_nand.c (for calculating offset and size from cmdline paramter) to common place, so they could used from other commands which use mtd partitions. For onenand the arg_off_size() is left in common/cmd_onenand.c. It should use now the common arg_off() function, but as I could not test onenand I let it there ... Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Scott Wood <scottwood@freescale.com> Reviewed-by: Jagannadh Teki <jteki@openedev.com>
* mtd, spi: Add MTD layer driverDaniel Schwierzeck2015-06-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add MTD layer driver for spi, original patch from: http://git.denx.de/?p=u-boot/u-boot-mips.git;a=commitdiff;h=bb246819cdc90493dd7089eaa51b9e639765cced Changes from Heiko Schocher against this patch: - Remove compile error if not defining CONFIG_SPI_FLASH_MTD: LD drivers/mtd/spi/built-in.o drivers/mtd/spi/sf_probe.o: In function `spi_flash_mtd_unregister': /home/hs/abb/imx6/u-boot/drivers/mtd/spi/sf_internal.h:168: multiple definition of `spi_flash_mtd_unregister' drivers/mtd/spi/sf_params.o:/home/hs/abb/imx6/u-boot/drivers/mtd/spi/sf_internal.h:168: first defined here drivers/mtd/spi/sf_ops.o: In function `spi_flash_mtd_unregister': /home/hs/abb/imx6/u-boot/drivers/mtd/spi/sf_internal.h:168: multiple definition of `spi_flash_mtd_unregister' drivers/mtd/spi/sf_params.o:/home/hs/abb/imx6/u-boot/drivers/mtd/spi/sf_internal.h:168: first defined here make[1]: *** [drivers/mtd/spi/built-in.o] Fehler 1 make: *** [drivers/mtd/spi] Fehler 2 - Add a README entry. - Add correct writebufsize, to fit with Linux v3.14 MTD, UBI/UBIFS sync. Note (From Jagan): For testing raw mtd parition erase/read/write operations using cmd_sf, sf_mtd should be required to register the spi flash device to MTD layer but the sf_mtd_info ops were not required until and unless if we use any flash filesystem layer say for example UBI. Due to this the foot-print got increased ~290bytes in non-UBI case here that should be acceptible. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Signed-off-by: Heiko Schocher <hs@denx.de> Tested-by: Jagannadh Teki <jteki@openedev.com> Reviewed-by: Jagannadh Teki <jteki@openedev.com>
OpenPOWER on IntegriCloud