summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* linux_compat: remove cpu_relax() defineMasahiro Yamada2015-07-222-2/+1
| | | | | | | | | | | | | | | | | | | | | | | The macro cpu_relax() is defined by several headers in different ways. arch/{arm,avr32,mips}/include/asm/processor.h defines it as follows: #define cpu_relax() barrier() On the other hand, include/linux/compat.h defines it as follows: #define cpu_relax() do {} while (0) If both headers are included from the same source file, the warning warning: "cpu_relax" redefined [enabled by default] is displayed. It effectively makes it impossible to include <linux/compat.h> from some sources. Drop the latter. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Heiko Schocher <hs@denx.de> Acked-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
* x86: delete unneeded declarations of disable_irq() and enable_irq()Masahiro Yamada2015-07-221-4/+0
| | | | | | | | | | | | | These two declarations in arch/x86/include/asm/interrupt.h conflict with ones in include/linux/compat.h, so x86 boards cannot include <linux/compat.h>. The comment /* arch/x86/lib/interrupts.c */ is bogus now, and we do not see any definitions of disable_irq() and enable_irq() in there. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Allow drivers to return -ENOSYS with the write_hwaddr() methodSimon Glass2015-07-212-1/+9
| | | | | | | | | | | | Some drivers may want to implement this method for some of their devices but not for others. So it is not possible to just leave the operation out of the table. Drivers could get around this by masquerading as two separate drivers but that seems unpleasant. Allow the driver to return an error when it does not want to process the write_hwaddr() method. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: usb: eth: Add driver-model support to the asix driverSimon Glass2015-07-211-21/+216
| | | | | | | | This USB Ethernet driver is quite widely use. Allow it to work with CONFIG_DM_ETH enabled. Most of the code remains common but there is a new packet receive flow which is handled specially. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: usb: Add driver-model support to ehci-pciSimon Glass2015-07-211-20/+77
| | | | | | | | | Support driver model in this driver. This uses the normal USB driver search mechanism. Any EHCI controllers will be set up as they are found during usb_init(). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* x86: minnowmax: Drop the cache line size hackSimon Glass2015-07-211-3/+0
| | | | | | | | Now that the RTL8169 driver warning is fixed we can drop this. The incorrect value is causing problems with USB EHCI. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: usb: Adjust the USB_DEVICE() macro namingSimon Glass2015-07-216-9/+25
| | | | | | | | | 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-213-12/+206
| | | | | | | | | | | | | 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: eth: Avoid blocking on packet receptionSimon Glass2015-07-216-6/+17
| | | | | | | | | | | | | | | | | | | | Some devices can take a long time to work out whether they have a new packet or now. For example the ASIX USB Ethernet dongle can take 5 seconds to do this, since it waits until it gets a new packet on the wire before allowing the USB bulk read packet to be submitted. At present with driver mode the Ethernet receive code reads 32 packets. This can take a very long time if we must wait for all 32 packets. The old code (before driver model) worked by reading a single set of packets from the USB device, then processing all the packets with in. It would be nice to use the same behaviour with driver model. Add a flag to the receive method which indicates that the driver should try to find a packet if available, by consulting the hardware. When the flag is not set, it should just return any packet data it has already received. If there is none, it should return -EAGAIN so that the loop will terminate. Signed-off-by: Simon Glass <sjg@chromium.org>
* 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: usb: Correct the struct usb_driver_entry commentSimon Glass2015-07-211-2/+2
| | | | | | | The function documentation is incorrect. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de>
* dm: pci: Add a function to get the BDF for a deviceSimon Glass2015-07-213-12/+19
| | | | | | | | | It is useful to be able to find the full PCI address (bus, device and function) for a PCI device. Add a function to provide this. Adjust the existing code to use this. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: eth: Add driver-model support to the rtl8169 driverSimon Glass2015-07-211-49/+187
| | | | | | | This driver is used by the Intel Minnowmax board. Convert it to driver model so it can use the new Ethernet implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: pci: Add support for PCI driver matchingSimon Glass2015-07-213-19/+197
| | | | | | | | | | | | | | | | | | | 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>
* usb: Update some EHCI driver licenses to use SPDXSimon Glass2015-07-215-68/+5
| | | | | | | A few drivers still write out the license in full. Fix these. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de>
* usb: ehci: Correct a missing hypen in an error messageSimon Glass2015-07-211-1/+1
| | | | | | Add a hyphen to correct the grammar. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add \n to two dm_warn() messagesSimon Glass2015-07-211-2/+2
| | | | | | These should finish with a newline like the others. Signed-off-by: Simon Glass <sjg@chromium.org>
* musb: Add device-model support to the musb-host u-boot glueHans de Goede2015-07-212-1/+73
| | | | | | | | | Add device-model support to the musb-host u-boot glue, note this only adds device-model support to the musb-core glue code, it does not add support for device-model to any of the SoC specific musb glue code. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* musb: Add musb_host_data struct to hold global dataHans de Goede2015-07-212-54/+77
| | | | | | | | Add a musb_host_data struct to hold all the global data host related musb data. This is a preparation patch for adding device-model support. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* musb: Rename and wrap public functionsHans de Goede2015-07-211-11/+59
| | | | | | | | Rename and wrap the usb host API public functions, this is a preparation patch for adding device-model support. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* musb: Update usb-compat to work with struct usb_device without a parent ptrHans de Goede2015-07-213-1/+75
| | | | | | | | When building with CONFIG_DM_USB=y struct usb_device does not have a parent pointer. This commit adds support to the musb code to deal with this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* musb: Allow musb_platform_enable to return an error codeHans de Goede2015-07-217-3/+64
| | | | | | | | | | | | | | | | | | | | Allow musb_platform_enable to return an error code and propagate it up to usb_lowlevel_init(). This allows moving the checks for an external vbus being present to be moved from platform_init to platform_enable, so that the user can unplug a charger, plug in a host adapter with a usb-device, do a "usb reset" and have things working. This also allows adding a check for the id-pin to platform_enable, so that it can short circuit the 1s delay in usb_lowlevel_init() when no host cable is plugged in and thus waiting for a device to show up is useless. Note that all the changes to code shared with the kernel are wrapped in the kernel. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: usb: Do not assume that first child is always a hubHans de Goede2015-07-212-10/+9
| | | | | | | | | | | | | 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: Allow usb host drivers to implement usb_reset_root_portHans de Goede2015-07-212-5/+16
| | | | | | | | | Allow usb uclass host drivers to implement usb_reset_root_port, this is used by single port usb hosts which do not emulate a hub, such as otg controllers. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: usb: Rename usb_find_child to usb_find_emul_childHans de Goede2015-07-211-10/+9
| | | | | | | | | | | | | | | Now that we unbind usb devices from usb_stop() usb_find_child() is only necessary to deal with emulated usb devices. Rename it to make this clear and add a #ifdef to make it a nop in other cases. Note the #ifdef turns usb_find_emul_child() into a nop, rather then not building it and adding another #ifdef to the caller, this is done this way because adding a #ifdef to the caller is somewhat hairy. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: usb: Use device_unbind_children to clean up usb devs on stopHans de Goede2015-07-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On an usb stop instead of leaving orphan usb devices behind simply remove them. The result of this commit is best seen in the output of "dm tree" after plugging out an usb hub with 2 devices plugges in and plugging in a keyb. instead, before this commit the output would be: usb [ + ] `-- sunxi-musb usb_hub [ ] |-- usb_hub usb_mass_st [ ] | |-- usb_mass_storage usb_dev_gen [ ] | `-- generic_bus_0_dev_3 usb_dev_gen [ + ] `-- generic_bus_0_dev_1 Notice the non active usb_hub child and its 2 non active children. The first child being non-active as in this example also causes usb_get_dev_index to return NULL when probing the first child, which results in the usb kbd code not binding to the keyboard. With this commit in place the output after swapping and "usb reset" is: usb [ + ] `-- sunxi-musb usb_dev_gen [ + ] `-- generic_bus_0_dev_1 As expected, and usb_get_dev_index works properly and the keyboard works. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: usb: Document that mixing DM_DEVICE_REMOVE and DM_USB is a bad ideaHans de Goede2015-07-211-0/+4
| | | | | | | | Document that mixing DM_DEVICE_REMOVE and DM_USB is a bad idea, and also why this is a bad idea. 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>
* dm: Export device_remove_children / device_unbind_childrenHans de Goede2015-07-212-18/+30
| | | | | | | | These functions are useful to remove all children from an usb bus before rescanning the bus. Give them a better name and export them. 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-214-10/+6
| | | | | | | | | | | 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-213-9/+9
| | | | | | | | 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-213-40/+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>
* dm: remove redundant CONFIG_DM from driver/core/MakefileMasahiro Yamada2015-07-211-1/+1
| | | | | | | | As you see in driver/Makefile, Kbuild descends into the driver/core/ directory only when CONFIG_DM is enabled. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: do not set DM_FLAG_ACTIVATED twiceMasahiro Yamada2015-07-211-1/+0
| | | | | | | | | | | | | | | Currently, DM_FLAG_ACTIVATED is set twice; before calling uclass_pre_probe_device() and again before calling drv->probe(). It looks like Simon's intention is the first one. The DM_FLAG_ACTIVATED was moved twice, by commit 02eeb1bbb174 (dm: core: Mark device as active before calling its probe() method), and then by commit 206d4d2b4b30 (dm: core: Mark device as active before calling uclass probe() methods). The first marking was added by the last move. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: change dm_warn() message into debug() in uclass_add()Masahiro Yamada2015-07-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The command "dm uclass" tries to display all the UClasses, but some of them might be disabled by Kconfig. The function do_dm_dump_uclass() iterates over all the UClass IDs and calls uclass_get() for each of them. Then, it displays annoying message "Cannot find uclass for id ..." every time it fails to get the UClass. As a result, we get much noisier log for the "dm uclass" command. => dm uclass uclass 0: root - * root_driver @ bfb54028, seq 0, (req -1) Cannot find uclass for id 1: please add the UCLASS_DRIVER() ... Cannot find uclass for id 2: please add the UCLASS_DRIVER() ... Cannot find uclass for id 3: please add the UCLASS_DRIVER() ... Cannot find uclass for id 4: please add the UCLASS_DRIVER() ... Cannot find uclass for id 5: please add the UCLASS_DRIVER() ... Cannot find uclass for id 6: please add the UCLASS_DRIVER() ... This commit suppresses these warnings. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
* test: Add a test for regmapSimon Glass2015-07-212-0/+83
| | | | | | We use syscon to test that the regmap functions work as expected. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add device checking to syscon_get_regmap()Simon Glass2015-07-211-2/+5
| | | | | | | | | | This function can only handle a syscon device. It is possible that someone will make a mistake, so add a check for this. Also we should return -ENODEV when a device cannot be found, so update the syscon_get_regmap_by_driver_data() to follow this convention. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Add a macro to check that a value is not an error pointerSimon Glass2015-07-211-0/+15
| | | | | | | Some functions can return ERR_PTR(errval). Add a unit test macro to check that no error is returned in a pointer. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a size to each reg propertySimon Glass2015-07-211-12/+15
| | | | | | | | Each sandbox peripheral should have a size as well as a base address. This is required for regmaps to work, so make this change for all nodes that have an address. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the system controller uclassSimon Glass2015-07-217-0/+79
| | | | | | | Add a test to confirm that we can access system controllers and find their driver data. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the LED uclassSimon Glass2015-07-215-0/+95
| | | | | | Add a test to confirm that we can adjust LEDs using the led_gpio driver. Signed-off-by: Simon Glass <sjg@chromium.org>
* led: Return -ENODEV if the LED device cannot be foundSimon Glass2015-07-212-3/+4
| | | | | | | | | | We normally use -ENODEV for a missing device, rather than -ENOENT. The latter is reserved for when we have a device but cannot find something within it. Also avoid looking at the root LED device since it is only a container. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the mmc uclassSimon Glass2015-07-216-0/+59
| | | | | | | Add a test to confirm that we can probe this device. Since there is no MMC stack support in sandbox at present, this is as far as the test goes. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the ram uclassSimon Glass2015-07-216-0/+73
| | | | | | | Add a test to confirm that we can probe this device and get information on the available RAM. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the reset uclassSimon Glass2015-07-212-0/+75
| | | | | | | Add tests that confirm that the drivers work as expected, and we can walk through the available reset types trying to reset the board. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Use the reset driver to handle resetSimon Glass2015-07-215-9/+14
| | | | | | | Move sandbox over to use the reset uclass for reset, instead of a direct call to do_reset(). This allows us to add tests. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Add a warm and cold reset driverSimon Glass2015-07-212-0/+101
| | | | | | | | Add drivers for sandbox. One can only perform a warm reset (which does nothing). The other can perform a cold reset or a power reset (the latter will quit U-Boot). These can be used for testing the reset uclass. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: reset: Allow reset_walk() to returnSimon Glass2015-07-212-7/+35
| | | | | | | | | | Add a new reset_walk_halt() function to cause a reset and then halt on failure. The reset_walk() function returns an error code. This is needed for testing since otherwise U-Boot will halt in the middle of a test. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Support multiple reset typesSimon Glass2015-07-212-0/+7
| | | | | | | Add settings for the last reset generated, and the types of resets which are permitted. This will be used for testing. Signed-off-by: Simon Glass <sjg@chromium.org>
OpenPOWER on IntegriCloud