[U-Boot] [PATCH v2] smc911x: split out useful defines/functions into local header
Ben Warren
biggerbadderben at gmail.com
Mon Feb 23 07:56:13 CET 2009
Hi Mike,
Sorry I didn't address this earlier.
Mike Frysinger wrote:
> The smc911x driver has a lot of useful defines/functions which can be used
> by pieces of code (such as example eeprom programmers). Rather than
> forcing each place to duplicate these defines/functions, split them out
> of the smdc911x driver into a local header.
>
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> CC: Sascha Hauer <s.hauer at pengutronix.de>
> CC: Guennadi Liakhovetski <lg at denx.de>
> CC: Magnus Lilja <lilja.magnus at gmail.com>
> CC: Ben Warren <biggerbadderben at gmail.com>
> ---
> v2
> - add includes for types utilized in smc911x.h
>
> drivers/net/smc911x.c | 452 +---------------------------------------------
> drivers/net/smc911x.h | 489 +++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 491 insertions(+), 450 deletions(-)
> create mode 100644 drivers/net/smc911x.h
>
> diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> index 648c94c..192bd96 100644
> --- a/drivers/net/smc911x.c
> +++ b/drivers/net/smc911x.c
> @@ -27,35 +27,7 @@
> #include <net.h>
> #include <miiphy.h>
>
> -#if defined (CONFIG_DRIVER_SMC911X_32_BIT) && \
> - defined (CONFIG_DRIVER_SMC911X_16_BIT)
> -#error "SMC911X: Only one of CONFIG_DRIVER_SMC911X_32_BIT and \
> - CONFIG_DRIVER_SMC911X_16_BIT shall be set"
> -#endif
> -
> -#if defined (CONFIG_DRIVER_SMC911X_32_BIT)
> -static inline u32 reg_read(u32 addr)
> -{
> - return *(volatile u32*)addr;
> -}
> -static inline void reg_write(u32 addr, u32 val)
> -{
> - *(volatile u32*)addr = val;
> -}
> -#elif defined (CONFIG_DRIVER_SMC911X_16_BIT)
> -static inline u32 reg_read(u32 addr)
> -{
> - volatile u16 *addr_16 = (u16 *)addr;
> - return ((*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16));
> -}
> -static inline void reg_write(u32 addr, u32 val)
> -{
> - *(volatile u16*)addr = (u16)val;
> - *(volatile u16*)(addr + 2) = (u16)(val >> 16);
> -}
> -#else
> -#error "SMC911X: undefined bus width"
> -#endif /* CONFIG_DRIVER_SMC911X_16_BIT */
> +#include "smc911x.h"
>
>
This hunk doesn't apply any more. Commit
890a02e8ee6b8c26a6e3e505e1a2d29cd73aa6f6 in late November changed
several of these functions to weak.
<snip>
regards,
Ben
More information about the U-Boot
mailing list