
So far it's used for specifying whether we want to use FSL DR USB or FSL eSDHC devices on MPC837X processors.
There are two more candidates for future use: 1. USB ULPI PHY vs. TSEC1 on MPC8315E-RDB boards; 2. Marvell vs. Vitesse PHYs on MPC8313E-RDB boards.
Signed-off-by: Anton Vorontsov avorontsov@ru.mvista.com --- board/freescale/common/Makefile | 1 + board/freescale/common/fsl_can_use.c | 30 ++++++++++++++++++++++++++++++ include/fsl_can_use.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 0 deletions(-) create mode 100644 board/freescale/common/fsl_can_use.c create mode 100644 include/fsl_can_use.h
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index 02a824d..d4e2009 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -29,6 +29,7 @@ endif
LIB = $(obj)lib$(VENDOR).a
+COBJS-y += fsl_can_use.o COBJS-${CONFIG_FSL_CADMUS} += cadmus.o COBJS-${CONFIG_FSL_VIA} += cds_via.o COBJS-${CONFIG_FSL_DIU_FB} += fsl_diu_fb.o fsl_logo_bmp.o diff --git a/board/freescale/common/fsl_can_use.c b/board/freescale/common/fsl_can_use.c new file mode 100644 index 0000000..17cc20f --- /dev/null +++ b/board/freescale/common/fsl_can_use.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2009 MontaVista Software, Inc. + * + * Author: Anton Vorontsov avorontsov@ru.mvista.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include <common.h> + +#if defined(CONFIG_MPC837X) && defined(CONFIG_USB_FSL_DR) && \ + defined(CONFIG_FSL_ESDHC) +int __fsl_can_use_dr_usb(void) +{ + const char *usb_or_esdhc = getenv("usb_or_esdhc"); + + if (!usb_or_esdhc || !strcmp(usb_or_esdhc, "usb")) + return 1; + + if (!strcmp(usb_or_esdhc, "esdhc")) + return 0; + + printf("WARNING: Wrong value for `usb_or_esdhc' environment variable: " + "`%s', should be `usb' (default) or `esdhc'\n", usb_or_esdhc); + return 1; +} +#endif diff --git a/include/fsl_can_use.h b/include/fsl_can_use.h new file mode 100644 index 0000000..932bbc1 --- /dev/null +++ b/include/fsl_can_use.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2009 MontaVista Software, Inc. + * + * Author: Anton Vorontsov avorontsov@ru.mvista.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#ifndef __FSL_CAN_USE_H +#define __FSL_CAN_USE_H + +#if defined(CONFIG_MPC837X) && defined(CONFIG_USB_FSL_DR) && \ + defined(CONFIG_FSL_ESDHC) +extern int __fsl_can_use_dr_usb(void); +#define fsl_can_use_dr_usb __fsl_can_use_dr_usb + +static inline int __fsl_can_use_esdhc(void) { return !fsl_can_use_dr_usb(); } +#define fsl_can_use_esdhc __fsl_can_use_esdhc +#endif /* CONFIG_MPC837X && CONFIG_USB_FSL_DR && CONFIG_FSL_ESDHC */ + +#ifndef fsl_can_use_dr_usb +#define fsl_can_use_dr_usb() 1 +#endif + +#ifndef fsl_can_use_esdhc +#define fsl_can_use_esdhc() 1 +#endif + +#endif /* __FSL_CAN_USE_H */