[U-Boot] [PATCH] export SPI functions to standalone apps

Rafal Jaworowski raj at semihalf.com
Mon Jul 20 21:50:22 CEST 2009


On 2009-07-19, at 04:22, Mike Frysinger wrote:

> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> ---
> common/exports.c   |    8 ++++++++
> include/_exports.h |    8 ++++++++
> include/exports.h  |    3 ++-
> 3 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/common/exports.c b/common/exports.c
> index ec4656b..b3b6e1f 100644
> --- a/common/exports.c
> +++ b/common/exports.c
> @@ -38,4 +38,12 @@ void jumptable_init (void)
> 	gd->jt[XF_i2c_write] = (void *) i2c_write;
> 	gd->jt[XF_i2c_read] = (void *) i2c_read;
> #endif
> +#ifdef CONFIG_CMD_SPI
> +	gd->jt[XF_spi_init] = (void *) spi_init;
> +	gd->jt[XF_spi_setup_slave] = (void *) spi_setup_slave;
> +	gd->jt[XF_spi_free_slave] = (void *) spi_free_slave;
> +	gd->jt[XF_spi_claim_bus] = (void *) spi_claim_bus;
> +	gd->jt[XF_spi_release_bus] = (void *) spi_release_bus;
> +	gd->jt[XF_spi_xfer] = (void *) spi_xfer;
> +#endif
> }

Such conditional entries in the jumptable make this interface  
unstable, as the calls table is made dependent on configuration of a  
particular image built, while it should only depend on the interface  
version. The application in such case is entagled with the knowledge  
of how the underlying firmware was configured at build time. I know  
there are other calls already #ifdef'ed, but they should be all fixed.

Rafal



More information about the U-Boot mailing list