[U-Boot] [PATCH] arm: socfpga: fix up a questionable macro for SDMMC

Pavel Machek pavel at denx.de
Thu Dec 3 19:42:56 CET 2015


On Tue 2015-12-01 17:33:02, Dinh Nguyen wrote:
> On 12/01/2015 05:30 PM, Marek Vasut wrote:
> > On Wednesday, December 02, 2015 at 12:20:47 AM, dinguyen at opensource.altera.com 
> > wrote:
> >> From: Dinh Nguyen <dinguyen at opensource.altera.com>
> >>
> >> Not sure what made this macro questionable, but edit the macro to be
> >> similar to what is used in Linux.
> > 
> > It should most likely be dissolved and moved into socfpga_dw_mmc.c , since
> > it's used only once in there. What do you think ?
> > 
> 
> Hmm...if you move this to socfpga_dw_mmc.c then the #if defined(A10)
> would have to follow as the bit for smplsel is at shift 4 instead of 3.
> 
> So if you had this for in system_manager.h, then socfpga_dw_mmc.c
> doesn't have to change.
> 
> --- a/arch/arm/mach-socfpga/include/mach/system_manager.h
> +++ b/arch/arm/mach-socfpga/include/mach/system_manager.h
> @@ -201,8 +201,13 @@ struct socfpga_system_manager {
>  #define SYSMGR_FPGAINTF_NAND   (1 << 4)
>  #define SYSMGR_FPGAINTF_SDMMC  (1 << 5)
> 
> +#if defined(SOCFPGA_GEN5)
>  #define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
>         ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))
> +#else /* Arria10 */
> +#define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
> +       ((((smplsel) & 0x7) << 4) | (((drvsel) & 0x7) << 0))
> +#endif

Also... can we get a rid of << 0 here?

Is it ever valid to pass values >= 8 to this macro?

Thanks,
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


More information about the U-Boot mailing list