
Hi Marek,
On Fri, Jun 28, 2013 at 3:46 PM, Marek Vasut marex@denx.de wrote:
Dear Simon Glass,
As an example of how to write a uclass and a driver, provide a demo
version
of each, accessible through the 'demo' command.
To use these with driver model, define CONFIG_CMD_DEMO and
CONFIG_DM_DEMO.
The two demo drivers are enabled with CONFIG_DM_DEMO_SIMPLE and CONFIG_DM_DEMO_SHAPE.
Signed-off-by: Simon Glass sjg@chromium.org Signed-off-by: Marek Vasut marex@denx.de Signed-off-by: Pavel Herrmann morpheus.ibis@gmail.com Signed-off-by: Viktor Křivák viktor.krivak@gmail.com Signed-off-by: Tomas Hlavacek tmshlvck@gmail.com
Changes in v3:
- Fix up demo command help
- Update demo driver to use device tree
Changes in v2: None
[...]
+U_BOOT_DEVICE(demo4) = {
.name = "demo_shape_drv",
.platform_data = &yellow_hexagon,
+};
So this is static instantiation of the drivers?
Yes, it is possible to set up a device either with statically-linked platform_data (as here) or with device tree.
[...]
+U_BOOT_DRIVER(demo_simple_drv) = {
.name = "demo_simple_drv",
.of_match = demo_shape_id,
.id = UCLASS_DEMO,
.probe = demo_shape_probe,
.ops = &simple_ops,
.ops = &simple_ops,
This .ops is here twice ;-)
Fixed.
.platform_data_auto_alloc_size = sizeof(struct dm_demo_pdata),
+};
[...]
Regards, Simon