From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-io0-x241.google.com ([2607:f8b0:4001:c06::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNMYz-0007m6-Os for barebox@lists.infradead.org; Mon, 28 May 2018 18:08:11 +0000 Received: by mail-io0-x241.google.com with SMTP id e20-v6so14868638iof.4 for ; Mon, 28 May 2018 11:07:59 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20180528160412.sprzpllamhnxt7wb@pengutronix.de> References: <20180526204451.16530-1-andrew.smirnov@gmail.com> <20180526204451.16530-48-andrew.smirnov@gmail.com> <20180528160412.sprzpllamhnxt7wb@pengutronix.de> From: Andrey Smirnov Date: Mon, 28 May 2018 11:07:58 -0700 Message-ID: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH v2 47/48] ARM: i.MX8: Add i.MX8mq EVK support To: Sascha Hauer Cc: Barebox List On Mon, May 28, 2018 at 9:04 AM, Sascha Hauer wrote: > On Sat, May 26, 2018 at 01:44:50PM -0700, Andrey Smirnov wrote: >> From: Sascha Hauer >> >> Signed-off-by: Andrey Smirnov >> Signed-off-by: Sascha Hauer >> --- >> + >> +#define reg32_write(a, v) writel(v, a) >> +#define reg32_read(a) readl(a) >> + >> +#define DDRC_DDR_SS_GPR0 0x3d000000 >> + >> +#define DDRC_IPS_BASE_ADDR(X) (0x3d400000 + (X * 0x2000000)) >> +#define DDRC_IPS_BASE_ADDR_0 0x3f400000 >> + >> +#define DDRC_MSTR_0 0x3d400000 >> +#define DDRC_STAT_0 0x3d400004 >> +#define DDRC_MSTR1_0 0x3d400008 >> +#define DDRC_MRCTRL0_0 0x3d400010 > > These are all i.MX8M register defines, right? They shouldn't live in the > board support. > Yes, that's right. I placed them here out of concern that autogenerated code might one day re-name/abandon those constants. But I can move them into imx8-ddrc.h. >> diff --git a/arch/arm/boards/nxp-imx8mq-evk/ddr_init.c b/arch/arm/boards/nxp-imx8mq-evk/ddr_init.c >> new file mode 100644 >> index 000000000..81691b2fa >> --- /dev/null >> +void ddr_init(void) >> +{ >> + tmp=reg32_read(0x30360060); >> + tmp &= ~0x10; >> + reg32_write(0x30360060,tmp); >> + do{ >> + tmp=reg32_read(0x30360060); >> + if(tmp&0x80000000) break; >> + }while(1); >> + reg32_write(0x30391000,0x8f000006); >> + reg32_write(0x3d400304,0x1); >> + reg32_write(0x3d400030,0x1); > > Do we need the defines anyway when the generated code uses raw adresses > and not the defines? Unfortunately the code is a mix of raw addresses and symbolic constants. We don't need all of them but there is a few that are required. I'll cull the list while I am moving it to imx8-ddrc.h Thanks, Andrey Smirnov _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox