[U-Boot] [PATCH v3 11/16] dm: Add a demonstration/example driver

Marek Vasut marex at denx.de
Fri Jun 28 23:46:47 CEST 2013


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 at chromium.org>
> Signed-off-by: Marek Vasut <marex at denx.de>
> Signed-off-by: Pavel Herrmann <morpheus.ibis at gmail.com>
> Signed-off-by: Viktor Křivák <viktor.krivak at gmail.com>
> Signed-off-by: Tomas Hlavacek <tmshlvck at 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?

[...]

> +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 ;-)

> +	.platform_data_auto_alloc_size = sizeof(struct dm_demo_pdata),
> +};

[...]

Best regards,
Marek Vasut


More information about the U-Boot mailing list