From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Andreas_Bie=c3=9fmann?= Date: Fri, 27 Nov 2015 22:39:41 +0100 Subject: [U-Boot] [PATCH 3/3] arm: at91/spl: mpddrc: use IP version to check configuration In-Reply-To: <1446618755-11300-4-git-send-email-wenyou.yang@atmel.com> References: <1446618755-11300-1-git-send-email-wenyou.yang@atmel.com> <1446618755-11300-4-git-send-email-wenyou.yang@atmel.com> Message-ID: <5658CD9D.3050604@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Wenyou, On 04.11.15 07:32, Wenyou Yang wrote: > To remove the unnecessary #ifdef-endif, use the mpddrc IP version > to check whether or not the interleaved decoding type is supported. > > Signed-off-by: Wenyou Yang > --- > > arch/arm/mach-at91/mpddrc.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mach-at91/mpddrc.c b/arch/arm/mach-at91/mpddrc.c > index ae8b0ff..5a75541 100644 > --- a/arch/arm/mach-at91/mpddrc.c > +++ b/arch/arm/mach-at91/mpddrc.c > @@ -12,6 +12,8 @@ > #include > #include > > +#define SAMA5D3_MPDDRC_VERSION 0x140 > + > static inline void atmel_mpddr_op(const struct atmel_mpddr *mpddr, > int mode, > u32 ram_address) > @@ -22,11 +24,13 @@ static inline void atmel_mpddr_op(const struct atmel_mpddr *mpddr, > > static int ddr2_decodtype_is_seq(u32 cr) > { > -#if defined(CONFIG_SAMA5D3) || defined(CONFIG_SAMA5D4) || \ > - defined(CONFIG_AT91SAM9X5) || defined(CONFIG_AT91SAM9N12) > - if (cr & ATMEL_MPDDRC_CR_DECOD_INTERLEAVED) > + struct atmel_mpddr *mpddr = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC; > + u16 version = readl(&mpddr->version) & 0xffff; Unfortunately I can't check the version thing ... But the code looks good to me Reviewed-by: Andreas Bie?mann > + > + if ((version >= SAMA5D3_MPDDRC_VERSION) && > + (cr & ATMEL_MPDDRC_CR_DECOD_INTERLEAVED)) > return 0; > -#endif > + > return 1; > } > >