| c60e1f25 | 14-Oct-2014 |
Simon Glass <sjg@chromium.org> |
dm: sandbox: Add a SPI emulation uclass
U-Boot includes a SPI emulation driver already but it is not explicit, and is hidden in the SPI flash code.
Conceptually with sandbox's SPI implementation we
dm: sandbox: Add a SPI emulation uclass
U-Boot includes a SPI emulation driver already but it is not explicit, and is hidden in the SPI flash code.
Conceptually with sandbox's SPI implementation we have a layer which creates SPI bus transitions and a layer which interprets them, currently only for SPI flash. The latter is actually an emulation, and it should be possible to add more than one emulation - not just SPI flash.
Add a SPI emulation uclass so that other emulations can be plugged in to support different types of emulated devices on difference buses/chip selects.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
show more ...
|
| 547cea19 | 14-Oct-2014 |
Simon Glass <sjg@chromium.org> |
dm: core: Add a clarifying comment on struct udevice's seq member
The sequence number is unique within the uclass, so state this clearly.
Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Jag
dm: core: Add a clarifying comment on struct udevice's seq member
The sequence number is unique within the uclass, so state this clearly.
Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
show more ...
|
| accd4b19 | 14-Oct-2014 |
Simon Glass <sjg@chromium.org> |
dm: core: Allow parents to pass data to children during probe
Buses sometimes want to pass data to their children when they are probed. For example, a SPI bus may want to tell the slave device about
dm: core: Allow parents to pass data to children during probe
Buses sometimes want to pass data to their children when they are probed. For example, a SPI bus may want to tell the slave device about the chip select it is connected to.
Add a new function to permit the parent data to be supplied to the child.
Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
show more ...
|
| f887cb6d | 07-Oct-2014 |
Masahiro Yamada <yamada.m@jp.panasonic.com> |
dm: add of_match_ptr() macro
The driver model supports two ways for passing device parameters; Device Tree and platform_data (board file). Each driver should generally support both of them because s
dm: add of_match_ptr() macro
The driver model supports two ways for passing device parameters; Device Tree and platform_data (board file). Each driver should generally support both of them because some popular IPs are used on various platforms.
Assume the following scenario: - The driver Foo is used on SoC Bar and SoC Baz - The SoC Bar uses Device Tree control (CONFIG_OF_CONTROL=y) - The SoC Baz does not support Device Tree; uses a board file
In this situation, the device driver Foo should work with/without the device tree control. The driver should have .of_match and .ofdata_to_platdata members for SoC Bar, while they are meaningless for SoC Baz; therefore those device-tree control code should go inside #ifdef CONFIG_OF_CONTROL.
The driver code will be like this:
#ifdef CONFIG_OF_CONTROL static const struct udevice_id foo_of_match = { { .compatible = "foo_driver" }, {}, }
static int foo_ofdata_to_platdata(struct udevice *dev) { ... } #endif
U_BOOT_DRIVER(foo_driver) = { ... .of_match = of_match_ptr(foo_of_match), .ofdata_to_platdata = of_match_ptr(foo_ofdata_to_platdata), ... }
This idea has been borrowed from Linux. (In Linux, this macro is defined in include/linux/of.h)
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
show more ...
|
| bb58503d | 23-Jul-2014 |
Simon Glass <sjg@chromium.org> |
dm: Add dm_scan_other() to locate board-specific devices
Some boards will have devices which are not in the device tree and do not have platform data. They may be programnatically created, for examp
dm: Add dm_scan_other() to locate board-specific devices
Some boards will have devices which are not in the device tree and do not have platform data. They may be programnatically created, for example. Add a hook which boards can use to bind those devices early in boot.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
| a327dee0 | 23-Jul-2014 |
Simon Glass <sjg@chromium.org> |
dm: Add child_pre_probe() and child_post_remove() methods
Some devices (particularly bus devices) must track their children, knowing when a new child is added so that it can be set up for communicat
dm: Add child_pre_probe() and child_post_remove() methods
Some devices (particularly bus devices) must track their children, knowing when a new child is added so that it can be set up for communication on the bus.
Add a child_pre_probe() method to provide this feature, and a corresponding child_post_remove() method.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
| e59f458d | 23-Jul-2014 |
Simon Glass <sjg@chromium.org> |
dm: Introduce per-child data for devices
Some device types can have child devices and want to store information about them. For example a USB flash stick attached to a USB host controller would like
dm: Introduce per-child data for devices
Some device types can have child devices and want to store information about them. For example a USB flash stick attached to a USB host controller would likely use this space. The controller can hold information about the USB state of each of its children.
The data is stored attached to the child device in the 'parent_priv' member. It can be auto-allocated by dm when the child is probed. To do this, add a per_child_auto_alloc_size value to the parent driver.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
| 997c87bb | 23-Jul-2014 |
Simon Glass <sjg@chromium.org> |
dm: Add functions to access a device's children
Devices can have childen that can be addressed by a simple index, the sequence number or a device tree offset. Add functions to access a child in each
dm: Add functions to access a device's children
Devices can have childen that can be addressed by a simple index, the sequence number or a device tree offset. Add functions to access a child in each of these ways.
The index is typically used as a fallback when the sequence number is not available. For example we may use a serial UART with sequence number 0 as the console, but if no UART has sequence number 0, then we can fall back to just using the first UART (index 0).
The device tree offset function is useful for buses, where they want to locate one of their children. The device tree can be scanned to find the offset of each child, and that offset can then find the device.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|