mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-30 08:31:03 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
96 lines
1.9 KiB
ArmAsm
96 lines
1.9 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* (C) Copyright 2011
|
|
* Matthias Weisser <weisserm@arcor.de>
|
|
*
|
|
* (C) Copyright 2009 DENX Software Engineering
|
|
* Author: John Rigby <jrigby@gmail.com>
|
|
*
|
|
* Based on U-Boot and RedBoot sources for several different i.mx
|
|
* platforms.
|
|
*/
|
|
|
|
#include <asm/macro.h>
|
|
#include <asm/arch/macro.h>
|
|
#include <asm/arch/imx-regs.h>
|
|
#include <generated/asm-offsets.h>
|
|
|
|
/*
|
|
* clocks
|
|
*/
|
|
.macro init_clocks
|
|
|
|
/* disable clock output */
|
|
write32 IMX_CCM_BASE + CCM_MCR, 0x00000000
|
|
write32 IMX_CCM_BASE + CCM_CCTL, 0x50030000
|
|
|
|
/*
|
|
* enable all implemented clocks in all three
|
|
* clock control registers
|
|
*/
|
|
write32 IMX_CCM_BASE + CCM_CGCR0, 0x1fffffff
|
|
write32 IMX_CCM_BASE + CCM_CGCR1, 0xffffffff
|
|
write32 IMX_CCM_BASE + CCM_CGCR2, 0xfffff
|
|
|
|
/* Devide NAND clock by 32 */
|
|
write32 IMX_CCM_BASE + CCM_PCDR2, 0x0101011F
|
|
.endm
|
|
|
|
/*
|
|
* sdram controller init
|
|
*/
|
|
.macro init_lpddr
|
|
ldr r0, =IMX_ESDRAMC_BASE
|
|
ldr r2, =IMX_SDRAM_BANK0_BASE
|
|
|
|
/*
|
|
* reset SDRAM controller
|
|
* then wait for initialization to complete
|
|
*/
|
|
ldr r1, =(1 << 1) | (1 << 2)
|
|
str r1, [r0, #ESDRAMC_ESDMISC]
|
|
1: ldr r3, [r0, #ESDRAMC_ESDMISC]
|
|
tst r3, #(1 << 31)
|
|
beq 1b
|
|
ldr r1, =(1 << 2)
|
|
str r1, [r0, #ESDRAMC_ESDMISC]
|
|
|
|
ldr r1, =0x002a7420
|
|
str r1, [r0, #ESDRAMC_ESDCFG0]
|
|
|
|
/* control | precharge */
|
|
ldr r1, =0x92216008
|
|
str r1, [r0, #ESDRAMC_ESDCTL0]
|
|
/* dram command encoded in address */
|
|
str r1, [r2, #0x400]
|
|
|
|
/* auto refresh */
|
|
ldr r1, =0xa2216008
|
|
str r1, [r0, #ESDRAMC_ESDCTL0]
|
|
/* read dram twice to auto refresh */
|
|
ldr r3, [r2]
|
|
ldr r3, [r2]
|
|
|
|
/* control | load mode */
|
|
ldr r1, =0xb2216008
|
|
str r1, [r0, #ESDRAMC_ESDCTL0]
|
|
|
|
/* mode register of lpddram */
|
|
strb r1, [r2, #0x33]
|
|
|
|
/* extended mode register of lpddrram */
|
|
ldr r2, =0x81000000
|
|
strb r1, [r2]
|
|
|
|
/* control | normal */
|
|
ldr r1, =0x82216008
|
|
str r1, [r0, #ESDRAMC_ESDCTL0]
|
|
.endm
|
|
|
|
.globl lowlevel_init
|
|
lowlevel_init:
|
|
init_aips
|
|
init_max
|
|
init_clocks
|
|
init_lpddr
|
|
mov pc, lr
|