commit
b939689c7b
@ -0,0 +1,25 @@ |
||||
X11 License |
||||
Copyright (C) 1996 X Consortium |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of |
||||
this software and associated documentation files (the "Software"), to deal in |
||||
the Software without restriction, including without limitation the rights to |
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
||||
of the Software, and to permit persons to whom the Software is furnished to do |
||||
so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X |
||||
CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall not be |
||||
used in advertising or otherwise to promote the sale, use or other dealings in |
||||
this Software without prior written authorization from the X Consortium. |
||||
|
||||
X Window System is a trademark of X Consortium, Inc. |
@ -1,45 +0,0 @@ |
||||
/* |
||||
* Copyright (C) 2012 Altera Corporation <www.altera.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <config.h> |
||||
|
||||
/* Set up the platform, once the cpu has been initialized */ |
||||
.globl lowlevel_init
|
||||
lowlevel_init: |
||||
|
||||
/* Remap */ |
||||
#ifdef CONFIG_SPL_BUILD |
||||
/* |
||||
* SPL : configure the remap (L3 NIC-301 GPV) |
||||
* so the on-chip RAM at lower memory instead ROM. |
||||
*/ |
||||
ldr r0, =SOCFPGA_L3REGS_ADDRESS |
||||
mov r1, #0x19 |
||||
str r1, [r0] |
||||
#else |
||||
/* |
||||
* U-Boot : configure the remap (L3 NIC-301 GPV) |
||||
* so the SDRAM at lower memory instead on-chip RAM. |
||||
*/ |
||||
ldr r0, =SOCFPGA_L3REGS_ADDRESS |
||||
mov r1, #0x2 |
||||
str r1, [r0] |
||||
|
||||
/* Private components security */ |
||||
|
||||
/* |
||||
* U-Boot : configure private timer, global timer and cpu |
||||
* component access as non secure for kernel stage (as required |
||||
* by kernel) |
||||
*/ |
||||
mrc p15,4,r0,c15,c0,0 |
||||
add r1, r0, #0x54 |
||||
ldr r2, [r1] |
||||
orr r2, r2, #0xff |
||||
orr r2, r2, #0xf00 |
||||
str r2, [r1] |
||||
#endif /* #ifdef CONFIG_SPL_BUILD */ |
||||
mov pc, lr |
@ -1,7 +0,0 @@ |
||||
#
|
||||
# Copyright (C) 2013 - 2015 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# Allow NEON instructions (needed for lowlevel_init.S with GNU toolchain)
|
||||
PLATFORM_RELFLAGS += -mfpu=neon
|
@ -0,0 +1,11 @@ |
||||
#
|
||||
# (C) Copyright 2000-2006
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
extra-y := start.o
|
||||
obj-y += cpu.o
|
||||
|
||||
obj-$(CONFIG_STM32F4) += stm32f4/
|
@ -0,0 +1,8 @@ |
||||
#
|
||||
# (C) Copyright 2015
|
||||
# Kamil Lulko, <rev13@wp.pl>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
PLATFORM_CPPFLAGS += -march=armv7-m -mthumb
|
@ -0,0 +1,35 @@ |
||||
/*
|
||||
* (C) Copyright 2010,2011 |
||||
* Vladimir Khusainov, Emcraft Systems, vlad@emcraft.com |
||||
* |
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/armv7m.h> |
||||
|
||||
/*
|
||||
* This is called right before passing control to |
||||
* the Linux kernel point. |
||||
*/ |
||||
int cleanup_before_linux(void) |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
/*
|
||||
* Perform the low-level reset. |
||||
*/ |
||||
void reset_cpu(ulong addr) |
||||
{ |
||||
/*
|
||||
* Perform reset but keep priority group unchanged. |
||||
*/ |
||||
writel((V7M_AIRCR_VECTKEY << V7M_AIRCR_VECTKEY_SHIFT) |
||||
| (V7M_SCB->aircr & V7M_AIRCR_PRIGROUP_MSK) |
||||
| V7M_AIRCR_SYSRESET, &V7M_SCB->aircr); |
||||
} |
@ -0,0 +1,15 @@ |
||||
/* |
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl>
|
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
.globl reset
|
||||
.type reset, %function |
||||
reset: |
||||
b _main |
||||
|
||||
.globl c_runtime_cpu_setup
|
||||
c_runtime_cpu_setup: |
||||
mov pc, lr |
@ -0,0 +1,11 @@ |
||||
#
|
||||
# (C) Copyright 2000-2006
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# (C) Copyright 2015
|
||||
# Kamil Lulko, <rev13@wp.pl>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y += soc.o clock.o timer.o flash.o
|
@ -0,0 +1,209 @@ |
||||
/*
|
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl> |
||||
* |
||||
* (C) Copyright 2014 |
||||
* STMicroelectronics |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/stm32.h> |
||||
|
||||
#define RCC_CR_HSION (1 << 0) |
||||
#define RCC_CR_HSEON (1 << 16) |
||||
#define RCC_CR_HSERDY (1 << 17) |
||||
#define RCC_CR_HSEBYP (1 << 18) |
||||
#define RCC_CR_CSSON (1 << 19) |
||||
#define RCC_CR_PLLON (1 << 24) |
||||
#define RCC_CR_PLLRDY (1 << 25) |
||||
|
||||
#define RCC_PLLCFGR_PLLM_MASK 0x3F |
||||
#define RCC_PLLCFGR_PLLN_MASK 0x7FC0 |
||||
#define RCC_PLLCFGR_PLLP_MASK 0x30000 |
||||
#define RCC_PLLCFGR_PLLQ_MASK 0xF000000 |
||||
#define RCC_PLLCFGR_PLLSRC (1 << 22) |
||||
#define RCC_PLLCFGR_PLLN_SHIFT 6 |
||||
#define RCC_PLLCFGR_PLLP_SHIFT 16 |
||||
#define RCC_PLLCFGR_PLLQ_SHIFT 24 |
||||
|
||||
#define RCC_CFGR_AHB_PSC_MASK 0xF0 |
||||
#define RCC_CFGR_APB1_PSC_MASK 0x1C00 |
||||
#define RCC_CFGR_APB2_PSC_MASK 0xE000 |
||||
#define RCC_CFGR_SW0 (1 << 0) |
||||
#define RCC_CFGR_SW1 (1 << 1) |
||||
#define RCC_CFGR_SW_MASK 0x3 |
||||
#define RCC_CFGR_SW_HSI 0 |
||||
#define RCC_CFGR_SW_HSE RCC_CFGR_SW0 |
||||
#define RCC_CFGR_SW_PLL RCC_CFGR_SW1 |
||||
#define RCC_CFGR_SWS0 (1 << 2) |
||||
#define RCC_CFGR_SWS1 (1 << 3) |
||||
#define RCC_CFGR_SWS_MASK 0xC |
||||
#define RCC_CFGR_SWS_HSI 0 |
||||
#define RCC_CFGR_SWS_HSE RCC_CFGR_SWS0 |
||||
#define RCC_CFGR_SWS_PLL RCC_CFGR_SWS1 |
||||
#define RCC_CFGR_HPRE_SHIFT 4 |
||||
#define RCC_CFGR_PPRE1_SHIFT 10 |
||||
#define RCC_CFGR_PPRE2_SHIFT 13 |
||||
|
||||
#define RCC_APB1ENR_PWREN (1 << 28) |
||||
|
||||
#define PWR_CR_VOS0 (1 << 14) |
||||
#define PWR_CR_VOS1 (1 << 15) |
||||
#define PWR_CR_VOS_MASK 0xC000 |
||||
#define PWR_CR_VOS_SCALE_MODE_1 (PWR_CR_VOS0 | PWR_CR_VOS1) |
||||
#define PWR_CR_VOS_SCALE_MODE_2 (PWR_CR_VOS1) |
||||
#define PWR_CR_VOS_SCALE_MODE_3 (PWR_CR_VOS0) |
||||
|
||||
#define FLASH_ACR_WS(n) n |
||||
#define FLASH_ACR_PRFTEN (1 << 8) |
||||
#define FLASH_ACR_ICEN (1 << 9) |
||||
#define FLASH_ACR_DCEN (1 << 10) |
||||
|
||||
struct pll_psc { |
||||
u8 pll_m; |
||||
u16 pll_n; |
||||
u8 pll_p; |
||||
u8 pll_q; |
||||
u8 ahb_psc; |
||||
u8 apb1_psc; |
||||
u8 apb2_psc; |
||||
}; |
||||
|
||||
#define AHB_PSC_1 0 |
||||
#define AHB_PSC_2 0x8 |
||||
#define AHB_PSC_4 0x9 |
||||
#define AHB_PSC_8 0xA |
||||
#define AHB_PSC_16 0xB |
||||
#define AHB_PSC_64 0xC |
||||
#define AHB_PSC_128 0xD |
||||
#define AHB_PSC_256 0xE |
||||
#define AHB_PSC_512 0xF |
||||
|
||||
#define APB_PSC_1 0 |
||||
#define APB_PSC_2 0x4 |
||||
#define APB_PSC_4 0x5 |
||||
#define APB_PSC_8 0x6 |
||||
#define APB_PSC_16 0x7 |
||||
|
||||
#if !defined(CONFIG_STM32_HSE_HZ) |
||||
#error "CONFIG_STM32_HSE_HZ not defined!" |
||||
#else |
||||
#if (CONFIG_STM32_HSE_HZ == 8000000) |
||||
struct pll_psc pll_psc_168 = { |
||||
.pll_m = 8, |
||||
.pll_n = 336, |
||||
.pll_p = 2, |
||||
.pll_q = 7, |
||||
.ahb_psc = AHB_PSC_1, |
||||
.apb1_psc = APB_PSC_4, |
||||
.apb2_psc = APB_PSC_2 |
||||
}; |
||||
#else |
||||
#error "No PLL/Prescaler configuration for given CONFIG_STM32_HSE_HZ exists" |
||||
#endif |
||||
#endif |
||||
|
||||
int configure_clocks(void) |
||||
{ |
||||
/* Reset RCC configuration */ |
||||
setbits_le32(&STM32_RCC->cr, RCC_CR_HSION); |
||||
writel(0, &STM32_RCC->cfgr); /* Reset CFGR */ |
||||
clrbits_le32(&STM32_RCC->cr, (RCC_CR_HSEON | RCC_CR_CSSON |
||||
| RCC_CR_PLLON)); |
||||
writel(0x24003010, &STM32_RCC->pllcfgr); /* Reset value from RM */ |
||||
clrbits_le32(&STM32_RCC->cr, RCC_CR_HSEBYP); |
||||
writel(0, &STM32_RCC->cir); /* Disable all interrupts */ |
||||
|
||||
/* Configure for HSE+PLL operation */ |
||||
setbits_le32(&STM32_RCC->cr, RCC_CR_HSEON); |
||||
while (!(readl(&STM32_RCC->cr) & RCC_CR_HSERDY)) |
||||
; |
||||
|
||||
/* Enable high performance mode, System frequency up to 168 MHz */ |
||||
setbits_le32(&STM32_RCC->apb1enr, RCC_APB1ENR_PWREN); |
||||
writel(PWR_CR_VOS_SCALE_MODE_1, &STM32_PWR->cr); |
||||
|
||||
setbits_le32(&STM32_RCC->cfgr, (( |
||||
pll_psc_168.ahb_psc << RCC_CFGR_HPRE_SHIFT) |
||||
| (pll_psc_168.apb1_psc << RCC_CFGR_PPRE1_SHIFT) |
||||
| (pll_psc_168.apb2_psc << RCC_CFGR_PPRE2_SHIFT))); |
||||
|
||||
writel(pll_psc_168.pll_m |
||||
| (pll_psc_168.pll_n << RCC_PLLCFGR_PLLN_SHIFT) |
||||
| (((pll_psc_168.pll_p >> 1) - 1) << RCC_PLLCFGR_PLLP_SHIFT) |
||||
| (pll_psc_168.pll_q << RCC_PLLCFGR_PLLQ_SHIFT), |
||||
&STM32_RCC->pllcfgr); |
||||
setbits_le32(&STM32_RCC->pllcfgr, RCC_PLLCFGR_PLLSRC); |
||||
|
||||
setbits_le32(&STM32_RCC->cr, RCC_CR_PLLON); |
||||
|
||||
while (!(readl(&STM32_RCC->cr) & RCC_CR_PLLRDY)) |
||||
; |
||||
|
||||
/* 5 wait states, Prefetch enabled, D-Cache enabled, I-Cache enabled */ |
||||
writel(FLASH_ACR_WS(5) | FLASH_ACR_PRFTEN | FLASH_ACR_ICEN |
||||
| FLASH_ACR_DCEN, &STM32_FLASH->acr); |
||||
|
||||
clrbits_le32(&STM32_RCC->cfgr, (RCC_CFGR_SW0 | RCC_CFGR_SW1)); |
||||
setbits_le32(&STM32_RCC->cfgr, RCC_CFGR_SW_PLL); |
||||
|
||||
while ((readl(&STM32_RCC->cfgr) & RCC_CFGR_SWS_MASK) != |
||||
RCC_CFGR_SWS_PLL) |
||||
; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
unsigned long clock_get(enum clock clck) |
||||
{ |
||||
u32 sysclk = 0; |
||||
u32 shift = 0; |
||||
/* Prescaler table lookups for clock computation */ |
||||
u8 ahb_psc_table[16] = { |
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9 |
||||
}; |
||||
u8 apb_psc_table[8] = { |
||||
0, 0, 0, 0, 1, 2, 3, 4 |
||||
}; |
||||
|
||||
if ((readl(&STM32_RCC->cfgr) & RCC_CFGR_SWS_MASK) == |
||||
RCC_CFGR_SWS_PLL) { |
||||
u16 pllm, plln, pllp; |
||||
pllm = (readl(&STM32_RCC->pllcfgr) & RCC_PLLCFGR_PLLM_MASK); |
||||
plln = ((readl(&STM32_RCC->pllcfgr) & RCC_PLLCFGR_PLLN_MASK) |
||||
>> RCC_PLLCFGR_PLLN_SHIFT); |
||||
pllp = ((((readl(&STM32_RCC->pllcfgr) & RCC_PLLCFGR_PLLP_MASK) |
||||
>> RCC_PLLCFGR_PLLP_SHIFT) + 1) << 1); |
||||
sysclk = ((CONFIG_STM32_HSE_HZ / pllm) * plln) / pllp; |
||||
} |
||||
|
||||
switch (clck) { |
||||
case CLOCK_CORE: |
||||
return sysclk; |
||||
break; |
||||
case CLOCK_AHB: |
||||
shift = ahb_psc_table[( |
||||
(readl(&STM32_RCC->cfgr) & RCC_CFGR_AHB_PSC_MASK) |
||||
>> RCC_CFGR_HPRE_SHIFT)]; |
||||
return sysclk >>= shift; |
||||
break; |
||||
case CLOCK_APB1: |
||||
shift = apb_psc_table[( |
||||
(readl(&STM32_RCC->cfgr) & RCC_CFGR_APB1_PSC_MASK) |
||||
>> RCC_CFGR_PPRE1_SHIFT)]; |
||||
return sysclk >>= shift; |
||||
break; |
||||
case CLOCK_APB2: |
||||
shift = apb_psc_table[( |
||||
(readl(&STM32_RCC->cfgr) & RCC_CFGR_APB2_PSC_MASK) |
||||
>> RCC_CFGR_PPRE2_SHIFT)]; |
||||
return sysclk >>= shift; |
||||
break; |
||||
default: |
||||
return 0; |
||||
break; |
||||
} |
||||
} |
@ -0,0 +1,143 @@ |
||||
/*
|
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/stm32.h> |
||||
|
||||
#define STM32_FLASH_KEY1 0x45670123 |
||||
#define STM32_FLASH_KEY2 0xCDEF89AB |
||||
|
||||
flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; |
||||
|
||||
const u32 sect_sz_kb[CONFIG_SYS_MAX_FLASH_SECT] = { |
||||
[0 ... 3] = 16 * 1024, |
||||
[4] = 64 * 1024, |
||||
[5 ... 11] = 128 * 1024 |
||||
}; |
||||
|
||||
static void stm32f4_flash_lock(u8 lock) |
||||
{ |
||||
if (lock) { |
||||
setbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_LOCK); |
||||
} else { |
||||
writel(STM32_FLASH_KEY1, &STM32_FLASH->key); |
||||
writel(STM32_FLASH_KEY2, &STM32_FLASH->key); |
||||
} |
||||
} |
||||
|
||||
unsigned long flash_init(void) |
||||
{ |
||||
unsigned long total_size = 0; |
||||
u8 i, j; |
||||
|
||||
for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { |
||||
flash_info[i].flash_id = FLASH_STM32F4; |
||||
flash_info[i].sector_count = CONFIG_SYS_MAX_FLASH_SECT; |
||||
flash_info[i].start[0] = CONFIG_SYS_FLASH_BASE + (i << 20); |
||||
flash_info[i].size = sect_sz_kb[0]; |
||||
for (j = 1; j < CONFIG_SYS_MAX_FLASH_SECT; j++) { |
||||
flash_info[i].start[j] = flash_info[i].start[j - 1] |
||||
+ (sect_sz_kb[j - 1]); |
||||
flash_info[i].size += sect_sz_kb[j]; |
||||
} |
||||
total_size += flash_info[i].size; |
||||
} |
||||
|
||||
return total_size; |
||||
} |
||||
|
||||
void flash_print_info(flash_info_t *info) |
||||
{ |
||||
int i; |
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) { |
||||
printf("missing or unknown FLASH type\n"); |
||||
return; |
||||
} else if (info->flash_id == FLASH_STM32F4) { |
||||
printf("STM32F4 Embedded Flash\n"); |
||||
} |
||||
|
||||
printf(" Size: %ld MB in %d Sectors\n", |
||||
info->size >> 20, info->sector_count); |
||||
|
||||
printf(" Sector Start Addresses:"); |
||||
for (i = 0; i < info->sector_count; ++i) { |
||||
if ((i % 5) == 0) |
||||
printf("\n "); |
||||
printf(" %08lX%s", |
||||
info->start[i], |
||||
info->protect[i] ? " (RO)" : " "); |
||||
} |
||||
printf("\n"); |
||||
return; |
||||
} |
||||
|
||||
int flash_erase(flash_info_t *info, int first, int last) |
||||
{ |
||||
u8 bank = 0xFF; |
||||
int i; |
||||
|
||||
for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { |
||||
if (info == &flash_info[i]) { |
||||
bank = i; |
||||
break; |
||||
} |
||||
} |
||||
if (bank == 0xFF) |
||||
return -1; |
||||
|
||||
stm32f4_flash_lock(0); |
||||
|
||||
for (i = first; i <= last; i++) { |
||||
while (readl(&STM32_FLASH->sr) & STM32_FLASH_SR_BSY) |
||||
; |
||||
|
||||
if (bank == 0) { |
||||
setbits_le32(&STM32_FLASH->cr, |
||||
(i << STM32_FLASH_CR_SNB_OFFSET)); |
||||
} else if (bank == 1) { |
||||
setbits_le32(&STM32_FLASH->cr, |
||||
((0x10 | i) << STM32_FLASH_CR_SNB_OFFSET)); |
||||
} else { |
||||
stm32f4_flash_lock(1); |
||||
return -1; |
||||
} |
||||
setbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_SER); |
||||
setbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_STRT); |
||||
|
||||
while (readl(&STM32_FLASH->sr) & STM32_FLASH_SR_BSY) |
||||
; |
||||
|
||||
clrbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_SER); |
||||
stm32f4_flash_lock(1); |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) |
||||
{ |
||||
ulong i; |
||||
|
||||
while (readl(&STM32_FLASH->sr) & STM32_FLASH_SR_BSY) |
||||
; |
||||
|
||||
stm32f4_flash_lock(0); |
||||
|
||||
setbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_PG); |
||||
/* To make things simple use byte writes only */ |
||||
for (i = 0; i < cnt; i++) { |
||||
*(uchar *)(addr + i) = src[i]; |
||||
while (readl(&STM32_FLASH->sr) & STM32_FLASH_SR_BSY) |
||||
; |
||||
} |
||||
clrbits_le32(&STM32_FLASH->cr, STM32_FLASH_CR_PG); |
||||
stm32f4_flash_lock(1); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,37 @@ |
||||
/*
|
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/armv7m.h> |
||||
#include <asm/arch/stm32.h> |
||||
|
||||
u32 get_cpu_rev(void) |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
int arch_cpu_init(void) |
||||
{ |
||||
configure_clocks(); |
||||
|
||||
/*
|
||||
* Configure the memory protection unit (MPU) to allow full access to |
||||
* the whole 4GB address space. |
||||
*/ |
||||
writel(0, &V7M_MPU->rnr); |
||||
writel(0, &V7M_MPU->rbar); |
||||
writel((V7M_MPU_RASR_AP_RW_RW | V7M_MPU_RASR_SIZE_4GB |
||||
| V7M_MPU_RASR_EN), &V7M_MPU->rasr); |
||||
writel(V7M_MPU_CTRL_ENABLE | V7M_MPU_CTRL_HFNMIENA, &V7M_MPU->ctrl); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
void s_init(void) |
||||
{ |
||||
} |
@ -0,0 +1,118 @@ |
||||
/*
|
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/armv7m.h> |
||||
#include <asm/arch/stm32.h> |
||||
|
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
|
||||
#define STM32_TIM2_BASE (STM32_APB1PERIPH_BASE + 0x0000) |
||||
|
||||
#define RCC_APB1ENR_TIM2EN (1 << 0) |
||||
|
||||
struct stm32_tim2_5 { |
||||
u32 cr1; |
||||
u32 cr2; |
||||
u32 smcr; |
||||
u32 dier; |
||||
u32 sr; |
||||
u32 egr; |
||||
u32 ccmr1; |
||||
u32 ccmr2; |
||||
u32 ccer; |
||||
u32 cnt; |
||||
u32 psc; |
||||
u32 arr; |
||||
u32 reserved1; |
||||
u32 ccr1; |
||||
u32 ccr2; |
||||
u32 ccr3; |
||||
u32 ccr4; |
||||
u32 reserved2; |
||||
u32 dcr; |
||||
u32 dmar; |
||||
u32 or; |
||||
}; |
||||
|
||||
#define TIM_CR1_CEN (1 << 0) |
||||
|
||||
#define TIM_EGR_UG (1 << 0) |
||||
|
||||
int timer_init(void) |
||||
{ |
||||
struct stm32_tim2_5 *tim = (struct stm32_tim2_5 *)STM32_TIM2_BASE; |
||||
|
||||
setbits_le32(&STM32_RCC->apb1enr, RCC_APB1ENR_TIM2EN); |
||||
|
||||
if (clock_get(CLOCK_AHB) == clock_get(CLOCK_APB1)) |
||||
writel((clock_get(CLOCK_APB1) / CONFIG_SYS_HZ_CLOCK) - 1, |
||||
&tim->psc); |
||||
else |
||||
writel(((clock_get(CLOCK_APB1) * 2) / CONFIG_SYS_HZ_CLOCK) - 1, |
||||
&tim->psc); |
||||
|
||||
writel(0xFFFFFFFF, &tim->arr); |
||||
writel(TIM_CR1_CEN, &tim->cr1); |
||||
setbits_le32(&tim->egr, TIM_EGR_UG); |
||||
|
||||
gd->arch.tbl = 0; |
||||
gd->arch.tbu = 0; |
||||
gd->arch.lastinc = 0; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
ulong get_timer(ulong base) |
||||
{ |
||||
return (get_ticks() / (CONFIG_SYS_HZ_CLOCK / CONFIG_SYS_HZ)) - base; |
||||
} |
||||
|
||||
unsigned long long get_ticks(void) |
||||
{ |
||||
struct stm32_tim2_5 *tim = (struct stm32_tim2_5 *)STM32_TIM2_BASE; |
||||
u32 now; |
||||
|
||||
now = readl(&tim->cnt); |
||||
|
||||
if (now >= gd->arch.lastinc) |
||||
gd->arch.tbl += (now - gd->arch.lastinc); |
||||
else |
||||
gd->arch.tbl += (0xFFFFFFFF - gd->arch.lastinc) + now; |
||||
|
||||
gd->arch.lastinc = now; |
||||
|
||||
return gd->arch.tbl; |
||||
} |
||||
|
||||
void reset_timer(void) |
||||
{ |
||||
struct stm32_tim2_5 *tim = (struct stm32_tim2_5 *)STM32_TIM2_BASE; |
||||
|
||||
gd->arch.lastinc = readl(&tim->cnt); |
||||
gd->arch.tbl = 0; |
||||
} |
||||
|
||||
/* delay x useconds */ |
||||
void __udelay(ulong usec) |
||||
{ |
||||
unsigned long long start; |
||||
|
||||
start = get_ticks(); /* get current timestamp */ |
||||
while ((get_ticks() - start) < usec) |
||||
; /* loop till time has passed */ |
||||
} |
||||
|
||||
/*
|
||||
* This function is derived from PowerPC code (timebase clock frequency). |
||||
* On ARM it returns the number of timer ticks per second. |
||||
*/ |
||||
ulong get_tbclk(void) |
||||
{ |
||||
return CONFIG_SYS_HZ_CLOCK; |
||||
} |
@ -0,0 +1,115 @@ |
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor, Inc. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/errno.h> |
||||
#include <asm/arch/fsl_serdes.h> |
||||
#include <asm/arch-fsl-lsch3/immap_lsch3.h> |
||||
#include <fsl-mc/ldpaa_wriop.h> |
||||
|
||||
#ifdef CONFIG_SYS_FSL_SRDS_1 |
||||
static u8 serdes1_prtcl_map[SERDES_PRCTL_COUNT]; |
||||
#endif |
||||
#ifdef CONFIG_SYS_FSL_SRDS_2 |
||||
static u8 serdes2_prtcl_map[SERDES_PRCTL_COUNT]; |
||||
#endif |
||||
|
||||
int is_serdes_configured(enum srds_prtcl device) |
||||
{ |
||||
int ret = 0; |
||||
|
||||
#ifdef CONFIG_SYS_FSL_SRDS_1 |
||||
ret |= serdes1_prtcl_map[device]; |
||||
#endif |
||||
#ifdef CONFIG_SYS_FSL_SRDS_2 |
||||
ret |= serdes2_prtcl_map[device]; |
||||
#endif |
||||
|
||||
return !!ret; |
||||
} |
||||
|
||||
int serdes_get_first_lane(u32 sd, enum srds_prtcl device) |
||||
{ |
||||
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
||||
u32 cfg = in_le32(&gur->rcwsr[28]); |
||||
int i; |
||||
|
||||
switch (sd) { |
||||
#ifdef CONFIG_SYS_FSL_SRDS_1 |
||||
case FSL_SRDS_1: |
||||
cfg &= FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK; |
||||
cfg >>= FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_SHIFT; |
||||
break; |
||||
#endif |
||||
#ifdef CONFIG_SYS_FSL_SRDS_2 |
||||
case FSL_SRDS_2: |
||||
cfg &= FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK; |
||||
cfg >>= FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT; |
||||
break; |
||||
#endif |
||||
default: |
||||
printf("invalid SerDes%d\n", sd); |
||||
break; |
||||
} |
||||
/* Is serdes enabled at all? */ |
||||
if (cfg == 0) |
||||
return -ENODEV; |
||||
|
||||
for (i = 0; i < SRDS_MAX_LANES; i++) { |
||||
if (serdes_get_prtcl(sd, cfg, i) == device) |
||||
return i; |
||||
} |
||||
|
||||
return -ENODEV; |
||||
} |
||||
|
||||
void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift, |
||||
u8 serdes_prtcl_map[SERDES_PRCTL_COUNT]) |
||||
{ |
||||
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
||||
u32 cfg; |
||||
int lane; |
||||
|
||||
memset(serdes_prtcl_map, 0, sizeof(serdes_prtcl_map)); |
||||
|
||||
cfg = in_le32(&gur->rcwsr[28]) & sd_prctl_mask; |
||||
cfg >>= sd_prctl_shift; |
||||
printf("Using SERDES%d Protocol: %d (0x%x)\n", sd + 1, cfg, cfg); |
||||
|
||||
if (!is_serdes_prtcl_valid(sd, cfg)) |
||||
printf("SERDES%d[PRTCL] = 0x%x is not valid\n", sd + 1, cfg); |
||||
|
||||
for (lane = 0; lane < SRDS_MAX_LANES; lane++) { |
||||
enum srds_prtcl lane_prtcl = serdes_get_prtcl(sd, cfg, lane); |
||||
if (unlikely(lane_prtcl >= SERDES_PRCTL_COUNT)) |
||||
debug("Unknown SerDes lane protocol %d\n", lane_prtcl); |
||||
else { |
||||
serdes_prtcl_map[lane_prtcl] = 1; |
||||
#ifdef CONFIG_FSL_MC_ENET |
||||
wriop_init_dpmac(sd, lane + 1, (int)lane_prtcl); |
||||
#endif |
||||
} |
||||
} |
||||
} |
||||
|
||||
void fsl_serdes_init(void) |
||||
{ |
||||
#ifdef CONFIG_SYS_FSL_SRDS_1 |
||||
serdes_init(FSL_SRDS_1, |
||||
CONFIG_SYS_FSL_LSCH3_SERDES_ADDR, |
||||
FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK, |
||||
FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_SHIFT, |
||||
serdes1_prtcl_map); |
||||
#endif |
||||
#ifdef CONFIG_SYS_FSL_SRDS_2 |
||||
serdes_init(FSL_SRDS_2, |
||||
CONFIG_SYS_FSL_LSCH3_SERDES_ADDR + FSL_SRDS_2 * 0x10000, |
||||
FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK, |
||||
FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT, |
||||
serdes2_prtcl_map); |
||||
#endif |
||||
} |
@ -0,0 +1,117 @@ |
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor, Inc. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/arch/fsl_serdes.h> |
||||
#include <asm/arch-fsl-lsch3/immap_lsch3.h> |
||||
|
||||
struct serdes_config { |
||||
u8 protocol; |
||||
u8 lanes[SRDS_MAX_LANES]; |
||||
}; |
||||
|
||||
static struct serdes_config serdes1_cfg_tbl[] = { |
||||
/* SerDes 1 */ |
||||
{0x03, {PCIE1, PCIE1, PCIE1, PCIE1, PCIE2, PCIE2, PCIE2, PCIE2 } }, |
||||
{0x05, {PCIE2, PCIE2, PCIE2, PCIE2, SGMII4, SGMII3, SGMII2, SGMII1 } }, |
||||
{0x07, {SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, |
||||
SGMII1 } }, |
||||
{0x09, {SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, |
||||
SGMII1 } }, |
||||
{0x0A, {SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, |
||||
SGMII1 } }, |
||||
{0x0C, {SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, |
||||
SGMII1 } }, |
||||
{0x0E, {SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, SGMII2, |
||||
SGMII1 } }, |
||||
{0x26, {SGMII8, SGMII7, SGMII6, SGMII5, SGMII4, SGMII3, XFI2, XFI1 } }, |
||||
{0x28, {SGMII8, SGMII7, SGMII6, SGMII5, XFI4, XFI3, XFI2, XFI1 } }, |
||||
{0x2A, {XFI8, XFI7, XFI6, XFI5, XFI4, XFI3, XFI2, XFI1 } }, |
||||
{0x2B, {SGMII8, SGMII7, SGMII6, SGMII5, XAUI1, XAUI1, XAUI1, XAUI1 } }, |
||||
{0x32, {XAUI2, XAUI2, XAUI2, XAUI2, XAUI1, XAUI1, XAUI1, XAUI1 } }, |
||||
{0x33, {PCIE2, PCIE2, PCIE2, PCIE2, QSGMII_D, QSGMII_C, QSGMII_B, |
||||
QSGMII_A} }, |
||||
{0x35, {QSGMII_D, QSGMII_C, QSGMII_B, PCIE2, XFI4, XFI3, XFI2, XFI1 } }, |
||||
{} |
||||
}; |
||||
static struct serdes_config serdes2_cfg_tbl[] = { |
||||
/* SerDes 2 */ |
||||
{0x07, {SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, |
||||
SGMII16 } }, |
||||
{0x09, {SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, |
||||
SGMII16 } }, |
||||
{0x0A, {SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, |
||||
SGMII16 } }, |
||||
{0x0C, {SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, |
||||
SGMII16 } }, |
||||
{0x0E, {SGMII9, SGMII10, SGMII11, SGMII12, SGMII13, SGMII14, SGMII15, |
||||
SGMII16 } }, |
||||
{0x3D, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3 } }, |
||||
{0x3E, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3, PCIE3 } }, |
||||
{0x3F, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4 } }, |
||||
{0x40, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, PCIE4, PCIE4 } }, |
||||
{0x41, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2 } }, |
||||
{0x42, {PCIE3, PCIE3, PCIE3, PCIE3, PCIE4, PCIE4, SATA1, SATA2 } }, |
||||
{0x43, {PCIE3, PCIE3, PCIE3, PCIE3, NONE, NONE, SATA1, SATA2 } }, |
||||
{0x44, {PCIE3, PCIE3, PCIE3, PCIE3, NONE, NONE, SATA1, SATA2 } }, |
||||
{0x45, {PCIE3, SGMII10, SGMII11, SGMII12, PCIE4, SGMII14, SGMII15, |
||||
SGMII16 } }, |
||||
{0x47, {SGMII9, SGMII10, SGMII11, SGMII12, PCIE4, PCIE4, PCIE4, |
||||
PCIE4 } }, |
||||
{0x49, {SGMII9, SGMII10, SGMII11, SGMII12, PCIE4, PCIE4, SATA1, |
||||
SATA2 } }, |
||||
{0x4A, {SGMII9, SGMII10, SGMII11, SGMII12, PCIE4, PCIE4, SATA1, |
||||
SATA2 } }, |
||||
{} |
||||
}; |
||||
|
||||
static struct serdes_config *serdes_cfg_tbl[] = { |
||||
serdes1_cfg_tbl, |
||||
serdes2_cfg_tbl, |
||||
}; |
||||
|
||||
enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane) |
||||
{ |
||||
struct serdes_config *ptr; |
||||
|
||||
if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
||||
return 0; |
||||
|
||||
ptr = serdes_cfg_tbl[serdes]; |
||||
while (ptr->protocol) { |
||||
if (ptr->protocol == cfg) |
||||
return ptr->lanes[lane]; |
||||
ptr++; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int is_serdes_prtcl_valid(int serdes, u32 prtcl) |
||||
{ |
||||
int i; |
||||
struct serdes_config *ptr; |
||||
|
||||
if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
||||
return 0; |
||||
|
||||
ptr = serdes_cfg_tbl[serdes]; |
||||
while (ptr->protocol) { |
||||
if (ptr->protocol == prtcl) |
||||
break; |
||||
ptr++; |
||||
} |
||||
|
||||
if (!ptr->protocol) |
||||
return 0; |
||||
|
||||
for (i = 0; i < SRDS_MAX_LANES; i++) { |
||||
if (ptr->lanes[i] != NONE) |
||||
return 1; |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,107 @@ |
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <fsl_ifc.h> |
||||
#include <nand.h> |
||||
#include <spl.h> |
||||
#include <asm/arch-fsl-lsch3/soc.h> |
||||
#include <asm/io.h> |
||||
#include <asm/global_data.h> |
||||
|
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
|
||||
static void erratum_a008751(void) |
||||
{ |
||||
#ifdef CONFIG_SYS_FSL_ERRATUM_A008751 |
||||
u32 __iomem *scfg = (u32 __iomem *)SCFG_BASE; |
||||
|
||||
writel(0x27672b2a, scfg + SCFG_USB3PRM1CR / 4); |
||||
#endif |
||||
} |
||||
|
||||
static void erratum_rcw_src(void) |
||||
{ |
||||
#if defined(CONFIG_SPL) |
||||
u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE; |
||||
u32 __iomem *dcfg_dcsr = (u32 __iomem *)DCFG_DCSR_BASE; |
||||
u32 val; |
||||
|
||||
val = in_le32(dcfg_ccsr + DCFG_PORSR1 / 4); |
||||
val &= ~DCFG_PORSR1_RCW_SRC; |
||||
val |= DCFG_PORSR1_RCW_SRC_NOR; |
||||
out_le32(dcfg_dcsr + DCFG_DCSR_PORCR1 / 4, val); |
||||
#endif |
||||
} |
||||
|
||||
#define I2C_DEBUG_REG 0x6 |
||||
#define I2C_GLITCH_EN 0x8 |
||||
/*
|
||||
* This erratum requires setting glitch_en bit to enable |
||||
* digital glitch filter to improve clock stability. |
||||
*/ |
||||
static void erratum_a009203(void) |
||||
{ |
||||
u8 __iomem *ptr; |
||||
#ifdef CONFIG_SYS_I2C |
||||
#ifdef I2C1_BASE_ADDR |
||||
ptr = (u8 __iomem *)(I2C1_BASE_ADDR + I2C_DEBUG_REG); |
||||
|
||||
writeb(I2C_GLITCH_EN, ptr); |
||||
#endif |
||||
#ifdef I2C2_BASE_ADDR |
||||
ptr = (u8 __iomem *)(I2C2_BASE_ADDR + I2C_DEBUG_REG); |
||||
|
||||
writeb(I2C_GLITCH_EN, ptr); |
||||
#endif |
||||
#ifdef I2C3_BASE_ADDR |
||||
ptr = (u8 __iomem *)(I2C3_BASE_ADDR + I2C_DEBUG_REG); |
||||
|
||||
writeb(I2C_GLITCH_EN, ptr); |
||||
#endif |
||||
#ifdef I2C4_BASE_ADDR |
||||
ptr = (u8 __iomem *)(I2C4_BASE_ADDR + I2C_DEBUG_REG); |
||||
|
||||
writeb(I2C_GLITCH_EN, ptr); |
||||
#endif |
||||
#endif |
||||
} |
||||
|
||||
void fsl_lsch3_early_init_f(void) |
||||
{ |
||||
erratum_a008751(); |
||||
erratum_rcw_src(); |
||||
init_early_memctl_regs(); /* tighten IFC timing */ |
||||
erratum_a009203(); |
||||
} |
||||
|
||||
#ifdef CONFIG_SPL_BUILD |
||||
void board_init_f(ulong dummy) |
||||
{ |
||||
/* Clear global data */ |
||||
memset((void *)gd, 0, sizeof(gd_t)); |
||||
|
||||
arch_cpu_init(); |
||||
board_early_init_f(); |
||||
timer_init(); |
||||
env_init(); |
||||
gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); |
||||
|
||||
serial_init(); |
||||
console_init_f(); |
||||
dram_init(); |
||||
|
||||
/* Clear the BSS. */ |
||||
memset(__bss_start, 0, __bss_end - __bss_start); |
||||
|
||||
board_init_r(NULL, 0); |
||||
} |
||||
|
||||
u32 spl_boot_device(void) |
||||
{ |
||||
return BOOT_DEVICE_NAND; |
||||
} |
||||
#endif |
@ -0,0 +1,77 @@ |
||||
/* |
||||
* (C) Copyright 2013 |
||||
* David Feng <fenghua@phytium.com.cn> |
||||
* |
||||
* (C) Copyright 2002 |
||||
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
||||
* |
||||
* (C) Copyright 2010 |
||||
* Texas Instruments, <www.ti.com> |
||||
* Aneesh V <aneesh@ti.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE, |
||||
LENGTH = CONFIG_SPL_MAX_SIZE } |
||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, |
||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE } |
||||
|
||||
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") |
||||
OUTPUT_ARCH(aarch64) |
||||
ENTRY(_start) |
||||
SECTIONS |
||||
{ |
||||
.text : { |
||||
. = ALIGN(8); |
||||
*(.__image_copy_start) |
||||
CPUDIR/start.o (.text*) |
||||
*(.text*) |
||||
} >.sram |
||||
|
||||
.rodata : { |
||||
. = ALIGN(8); |
||||
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) |
||||
} >.sram |
||||
|
||||
.data : { |
||||
. = ALIGN(8); |
||||
*(.data*) |
||||
} >.sram |
||||
|
||||
.u_boot_list : { |
||||
. = ALIGN(8); |
||||
KEEP(*(SORT(.u_boot_list*))); |
||||
} >.sram |
||||
|
||||
.image_copy_end : { |
||||
. = ALIGN(8); |
||||
*(.__image_copy_end) |
||||
} >.sram |
||||
|
||||
.end : { |
||||
. = ALIGN(8); |
||||
*(.__end) |
||||
} >.sram |
||||
|
||||
.bss_start : { |
||||
. = ALIGN(8); |
||||
KEEP(*(.__bss_start)); |
||||
} >.sdram |
||||
|
||||
.bss : { |
||||
*(.bss*) |
||||
. = ALIGN(8); |
||||
} >.sdram |
||||
|
||||
.bss_end : { |
||||
KEEP(*(.__bss_end)); |
||||
} >.sdram |
||||
|
||||
/DISCARD/ : { *(.dynsym) } |
||||
/DISCARD/ : { *(.dynstr*) } |
||||
/DISCARD/ : { *(.dynamic*) } |
||||
/DISCARD/ : { *(.plt*) } |
||||
/DISCARD/ : { *(.interp*) } |
||||
/DISCARD/ : { *(.gnu*) } |
||||
} |
@ -0,0 +1,242 @@ |
||||
/*
|
||||
* (C) Copyright 2014 - 2015 Xilinx, Inc. |
||||
* Michal Simek <michal.simek@xilinx.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <asm/arch/sys_proto.h> |
||||
#include <asm/io.h> |
||||
|
||||
#define LOCK 0 |
||||
#define SPLIT 1 |
||||
|
||||
#define HALT 0 |
||||
#define RELEASE 1 |
||||
|
||||
#define ZYNQMP_BOOTADDR_HIGH_MASK 0xFFFFFFFF |
||||
#define ZYNQMP_R5_HIVEC_ADDR 0xFFFF0000 |
||||
#define ZYNQMP_R5_LOVEC_ADDR 0x0 |
||||
#define ZYNQMP_RPU_CFG_CPU_HALT_MASK 0x01 |
||||
#define ZYNQMP_RPU_CFG_HIVEC_MASK 0x04 |
||||
#define ZYNQMP_RPU_GLBL_CTRL_SPLIT_LOCK_MASK 0x08 |
||||
#define ZYNQMP_RPU_GLBL_CTRL_TCM_COMB_MASK 0x40 |
||||
#define ZYNQMP_RPU_GLBL_CTRL_SLCLAMP_MASK 0x10 |
||||
|
||||
#define ZYNQMP_CRLAPB_RST_LPD_AMBA_RST_MASK 0x04 |
||||
#define ZYNQMP_CRLAPB_RST_LPD_R50_RST_MASK 0x01 |
||||
#define ZYNQMP_CRLAPB_RST_LPD_R51_RST_MASK 0x02 |
||||
#define ZYNQMP_CRLAPB_CPU_R5_CTRL_CLKACT_MASK 0x1000000 |
||||
|
||||
#define ZYNQMP_TCM_START_ADDRESS 0xFFE00000 |
||||
#define ZYNQMP_TCM_BOTH_SIZE 0x40000 |
||||
|
||||
#define ZYNQMP_CORE_APU0 0 |
||||
#define ZYNQMP_CORE_APU3 3 |
||||
|
||||
#define ZYNQMP_MAX_CORES 6 |
||||
|
||||
int is_core_valid(unsigned int core) |
||||
{ |
||||
if (core < ZYNQMP_MAX_CORES) |
||||
return 1; |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int cpu_reset(int nr) |
||||
{ |
||||
puts("Feature is not implemented.\n"); |
||||
return 0; |
||||
} |
||||
|
||||
static void set_r5_halt_mode(u8 halt, u8 mode) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
tmp = readl(&rpu_base->rpu0_cfg); |
||||
if (halt == HALT) |
||||
tmp &= ~ZYNQMP_RPU_CFG_CPU_HALT_MASK; |
||||
else |
||||
tmp |= ZYNQMP_RPU_CFG_CPU_HALT_MASK; |
||||
writel(tmp, &rpu_base->rpu0_cfg); |
||||
|
||||
if (mode == LOCK) { |
||||
tmp = readl(&rpu_base->rpu1_cfg); |
||||
if (halt == HALT) |
||||
tmp &= ~ZYNQMP_RPU_CFG_CPU_HALT_MASK; |
||||
else |
||||
tmp |= ZYNQMP_RPU_CFG_CPU_HALT_MASK; |
||||
writel(tmp, &rpu_base->rpu1_cfg); |
||||
} |
||||
} |
||||
|
||||
static void set_r5_tcm_mode(u8 mode) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
tmp = readl(&rpu_base->rpu_glbl_ctrl); |
||||
if (mode == LOCK) { |
||||
tmp &= ~ZYNQMP_RPU_GLBL_CTRL_SPLIT_LOCK_MASK; |
||||
tmp |= ZYNQMP_RPU_GLBL_CTRL_TCM_COMB_MASK | |
||||
ZYNQMP_RPU_GLBL_CTRL_SLCLAMP_MASK; |
||||
} else { |
||||
tmp |= ZYNQMP_RPU_GLBL_CTRL_SPLIT_LOCK_MASK; |
||||
tmp &= ~(ZYNQMP_RPU_GLBL_CTRL_TCM_COMB_MASK | |
||||
ZYNQMP_RPU_GLBL_CTRL_SLCLAMP_MASK); |
||||
} |
||||
|
||||
writel(tmp, &rpu_base->rpu_glbl_ctrl); |
||||
} |
||||
|
||||
static void set_r5_reset(u8 mode) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
tmp = readl(&crlapb_base->rst_lpd_top); |
||||
tmp |= (ZYNQMP_CRLAPB_RST_LPD_AMBA_RST_MASK | |
||||
ZYNQMP_CRLAPB_RST_LPD_R50_RST_MASK); |
||||
|
||||
if (mode == LOCK) |
||||
tmp |= ZYNQMP_CRLAPB_RST_LPD_R51_RST_MASK; |
||||
|
||||
writel(tmp, &crlapb_base->rst_lpd_top); |
||||
} |
||||
|
||||
static void release_r5_reset(u8 mode) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
tmp = readl(&crlapb_base->rst_lpd_top); |
||||
tmp &= ~(ZYNQMP_CRLAPB_RST_LPD_AMBA_RST_MASK | |
||||
ZYNQMP_CRLAPB_RST_LPD_R50_RST_MASK); |
||||
|
||||
if (mode == LOCK) |
||||
tmp &= ~ZYNQMP_CRLAPB_RST_LPD_R51_RST_MASK; |
||||
|
||||
writel(tmp, &crlapb_base->rst_lpd_top); |
||||
} |
||||
|
||||
static void enable_clock_r5(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
tmp = readl(&crlapb_base->cpu_r5_ctrl); |
||||
tmp |= ZYNQMP_CRLAPB_CPU_R5_CTRL_CLKACT_MASK; |
||||
writel(tmp, &crlapb_base->cpu_r5_ctrl); |
||||
|
||||
/* Give some delay for clock
|
||||
* to propogate */ |
||||
udelay(0x500); |
||||
} |
||||
|
||||
int cpu_disable(int nr) |
||||
{ |
||||
if (nr >= ZYNQMP_CORE_APU0 && nr <= ZYNQMP_CORE_APU3) { |
||||
u32 val = readl(&crfapb_base->rst_fpd_apu); |
||||
val |= 1 << nr; |
||||
writel(val, &crfapb_base->rst_fpd_apu); |
||||
} else { |
||||
set_r5_reset(LOCK); |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int cpu_status(int nr) |
||||
{ |
||||
if (nr >= ZYNQMP_CORE_APU0 && nr <= ZYNQMP_CORE_APU3) { |
||||
u32 addr_low = readl(((u8 *)&apu_base->rvbar_addr0_l) + nr * 8); |
||||
u32 addr_high = readl(((u8 *)&apu_base->rvbar_addr0_h) + |
||||
nr * 8); |
||||
u32 val = readl(&crfapb_base->rst_fpd_apu); |
||||
val &= 1 << nr; |
||||
printf("APU CPU%d %s - starting address HI: %x, LOW: %x\n", |
||||
nr, val ? "OFF" : "ON" , addr_high, addr_low); |
||||
} else { |
||||
u32 val = readl(&crlapb_base->rst_lpd_top); |
||||
val &= 1 << (nr - 4); |
||||
printf("RPU CPU%d %s\n", nr - 4, val ? "OFF" : "ON"); |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
static void set_r5_start(u8 high) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
tmp = readl(&rpu_base->rpu0_cfg); |
||||
if (high) |
||||
tmp |= ZYNQMP_RPU_CFG_HIVEC_MASK; |
||||
else |
||||
tmp &= ~ZYNQMP_RPU_CFG_HIVEC_MASK; |
||||
writel(tmp, &rpu_base->rpu0_cfg); |
||||
|
||||
tmp = readl(&rpu_base->rpu1_cfg); |
||||
if (high) |
||||
tmp |= ZYNQMP_RPU_CFG_HIVEC_MASK; |
||||
else |
||||
tmp &= ~ZYNQMP_RPU_CFG_HIVEC_MASK; |
||||
writel(tmp, &rpu_base->rpu1_cfg); |
||||
} |
||||
|
||||
int cpu_release(int nr, int argc, char * const argv[]) |
||||
{ |
||||
if (nr >= ZYNQMP_CORE_APU0 && nr <= ZYNQMP_CORE_APU3) { |
||||
u64 boot_addr = simple_strtoull(argv[0], NULL, 16); |
||||
/* HIGH */ |
||||
writel((u32)(boot_addr >> 32), |
||||
((u8 *)&apu_base->rvbar_addr0_h) + nr * 8); |
||||
/* LOW */ |
||||
writel((u32)(boot_addr & ZYNQMP_BOOTADDR_HIGH_MASK), |
||||
((u8 *)&apu_base->rvbar_addr0_l) + nr * 8); |
||||
|
||||
u32 val = readl(&crfapb_base->rst_fpd_apu); |
||||
val &= ~(1 << nr); |
||||
writel(val, &crfapb_base->rst_fpd_apu); |
||||
} else { |
||||
if (argc != 2) { |
||||
printf("Invalid number of arguments to release.\n"); |
||||
printf("<addr> <mode>-Start addr lockstep or split\n"); |
||||
return 1; |
||||
} |
||||
|
||||
u32 boot_addr = simple_strtoul(argv[0], NULL, 16); |
||||
if (!(boot_addr == ZYNQMP_R5_LOVEC_ADDR || |
||||
boot_addr == ZYNQMP_R5_HIVEC_ADDR)) { |
||||
printf("Invalid starting address 0x%x\n", boot_addr); |
||||
printf("0 or 0xffff0000 are permitted\n"); |
||||
return 1; |
||||
} |
||||
|
||||
if (!strncmp(argv[1], "lockstep", 8)) { |
||||
printf("R5 lockstep mode\n"); |
||||
set_r5_tcm_mode(LOCK); |
||||
set_r5_halt_mode(HALT, LOCK); |
||||
|
||||
if (boot_addr == 0) |
||||
set_r5_start(0); |
||||
else |
||||
set_r5_start(1); |
||||
|
||||
enable_clock_r5(); |
||||
release_r5_reset(LOCK); |
||||
set_r5_halt_mode(RELEASE, LOCK); |
||||
} else if (!strncmp(argv[1], "split", 5)) { |
||||
printf("R5 split mode\n"); |
||||
set_r5_tcm_mode(SPLIT); |
||||
set_r5_halt_mode(HALT, SPLIT); |
||||
enable_clock_r5(); |
||||
release_r5_reset(SPLIT); |
||||
set_r5_halt_mode(RELEASE, SPLIT); |
||||
} else { |
||||
printf("Unsupported mode\n"); |
||||
return 1; |
||||
} |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,216 @@ |
||||
/* |
||||
* Freescale ls1021a QDS board device tree source |
||||
* |
||||
* Copyright 2013-2015 Freescale Semiconductor, Inc. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
/dts-v1/; |
||||
#include "ls1021a.dtsi" |
||||
|
||||
/ { |
||||
model = "LS1021A QDS Board"; |
||||
|
||||
aliases { |
||||
enet0_rgmii_phy = &rgmii_phy1; |
||||
enet1_rgmii_phy = &rgmii_phy2; |
||||
enet2_rgmii_phy = &rgmii_phy3; |
||||
enet0_sgmii_phy = &sgmii_phy1c; |
||||
enet1_sgmii_phy = &sgmii_phy1d; |
||||
spi0 = &qspi; |
||||
spi1 = &dspi0; |
||||
}; |
||||
}; |
||||
|
||||
&dspi0 { |
||||
bus-num = <0>; |
||||
status = "okay"; |
||||
|
||||
dspiflash: at45db021d@0 { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
compatible = "spi-flash"; |
||||
spi-max-frequency = <16000000>; |
||||
spi-cpol; |
||||
spi-cpha; |
||||
reg = <0>; |
||||
}; |
||||
}; |
||||
|
||||
&qspi { |
||||
bus-num = <0>; |
||||
status = "okay"; |
||||
|
||||
qflash0: s25fl128s@0 { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
compatible = "spi-flash"; |
||||
spi-max-frequency = <20000000>; |
||||
reg = <0>; |
||||
}; |
||||
}; |
||||
|
||||
&i2c0 { |
||||
status = "okay"; |
||||
|
||||
pca9547: mux@77 { |
||||
reg = <0x77>; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
|
||||
i2c@0 { |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x0>; |
||||
|
||||
ds3232: rtc@68 { |
||||
compatible = "dallas,ds3232"; |
||||
reg = <0x68>; |
||||
interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; |
||||
}; |
||||
}; |
||||
|
||||
i2c@2 { |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x2>; |
||||
|
||||
ina220@40 { |
||||
compatible = "ti,ina220"; |
||||
reg = <0x40>; |
||||
shunt-resistor = <1000>; |
||||
}; |
||||
|
||||
ina220@41 { |
||||
compatible = "ti,ina220"; |
||||
reg = <0x41>; |
||||
shunt-resistor = <1000>; |
||||
}; |
||||
}; |
||||
|
||||
i2c@3 { |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x3>; |
||||
|
||||
eeprom@56 { |
||||
compatible = "atmel,24c512"; |
||||
reg = <0x56>; |
||||
}; |
||||
|
||||
eeprom@57 { |
||||
compatible = "atmel,24c512"; |
||||
reg = <0x57>; |
||||
}; |
||||
|
||||
adt7461a@4c { |
||||
compatible = "adi,adt7461a"; |
||||
reg = <0x4c>; |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
&ifc { |
||||
#address-cells = <2>; |
||||
#size-cells = <1>; |
||||
/* NOR, NAND Flashes and FPGA on board */ |
||||
ranges = <0x0 0x0 0x60000000 0x08000000 |
||||
0x2 0x0 0x7e800000 0x00010000 |
||||
0x3 0x0 0x7fb00000 0x00000100>; |
||||
status = "okay"; |
||||
|
||||
nor@0,0 { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
compatible = "cfi-flash"; |
||||
reg = <0x0 0x0 0x8000000>; |
||||
bank-width = <2>; |
||||
device-width = <1>; |
||||
}; |
||||
|
||||
fpga: board-control@3,0 { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
compatible = "simple-bus"; |
||||
reg = <0x3 0x0 0x0000100>; |
||||
bank-width = <1>; |
||||
device-width = <1>; |
||||
ranges = <0 3 0 0x100>; |
||||
|
||||
mdio-mux-emi1 { |
||||
compatible = "mdio-mux-mmioreg"; |
||||
mdio-parent-bus = <&mdio0>; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x54 1>; /* BRDCFG4 */ |
||||
mux-mask = <0xe0>; /* EMI1[2:0] */ |
||||
|
||||
/* Onboard PHYs */ |
||||
ls1021amdio0: mdio@0 { |
||||
reg = <0>; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
rgmii_phy1: ethernet-phy@1 { |
||||
reg = <0x1>; |
||||
}; |
||||
}; |
||||
|
||||
ls1021amdio1: mdio@20 { |
||||
reg = <0x20>; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
rgmii_phy2: ethernet-phy@2 { |
||||
reg = <0x2>; |
||||
}; |
||||
}; |
||||
|
||||
ls1021amdio2: mdio@40 { |
||||
reg = <0x40>; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
rgmii_phy3: ethernet-phy@3 { |
||||
reg = <0x3>; |
||||
}; |
||||
}; |
||||
|
||||
ls1021amdio3: mdio@60 { |
||||
reg = <0x60>; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
sgmii_phy1c: ethernet-phy@1c { |
||||
reg = <0x1c>; |
||||
}; |
||||
}; |
||||
|
||||
ls1021amdio4: mdio@80 { |
||||
reg = <0x80>; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
sgmii_phy1d: ethernet-phy@1d { |
||||
reg = <0x1d>; |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
&lpuart0 { |
||||
status = "okay"; |
||||
}; |
||||
|
||||
&mdio0 { |
||||
tbi0: tbi-phy@8 { |
||||
reg = <0x8>; |
||||
device_type = "tbi-phy"; |
||||
}; |
||||
}; |
||||
|
||||
&uart0 { |
||||
status = "okay"; |
||||
}; |
||||
|
||||
&uart1 { |
||||
status = "okay"; |
||||
}; |
@ -0,0 +1,87 @@ |
||||
/* |
||||
* Freescale ls1021a TWR board device tree source |
||||
* |
||||
* Copyright 2013-2015 Freescale Semiconductor, Inc. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
/dts-v1/; |
||||
#include "ls1021a.dtsi" |
||||
|
||||
/ { |
||||
model = "LS1021A TWR Board"; |
||||
|
||||
aliases { |
||||
enet2_rgmii_phy = &rgmii_phy1; |
||||
enet0_sgmii_phy = &sgmii_phy2; |
||||
enet1_sgmii_phy = &sgmii_phy0; |
||||
spi0 = &qspi; |
||||
}; |
||||
}; |
||||
|
||||
&qspi { |
||||
bus-num = <0>; |
||||
status = "okay"; |
||||
|
||||
qflash0: n25q128a13@0 { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
compatible = "spi-flash"; |
||||
spi-max-frequency = <20000000>; |
||||
reg = <0>; |
||||
}; |
||||
}; |
||||
|
||||
&i2c0 { |
||||
status = "okay"; |
||||
}; |
||||
|
||||
&i2c1 { |
||||
status = "okay"; |
||||
}; |
||||
|
||||
&ifc { |
||||
#address-cells = <2>; |
||||
#size-cells = <1>; |
||||
/* NOR Flash on board */ |
||||
ranges = <0x0 0x0 0x60000000 0x08000000>; |
||||
status = "okay"; |
||||
|
||||
nor@0,0 { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
compatible = "cfi-flash"; |
||||
reg = <0x0 0x0 0x8000000>; |
||||
bank-width = <2>; |
||||
device-width = <1>; |
||||
}; |
||||
}; |
||||
|
||||
&lpuart0 { |
||||
status = "okay"; |
||||
}; |
||||
|
||||
&mdio0 { |
||||
sgmii_phy0: ethernet-phy@0 { |
||||
reg = <0x0>; |
||||
}; |
||||
rgmii_phy1: ethernet-phy@1 { |
||||
reg = <0x1>; |
||||
}; |
||||
sgmii_phy2: ethernet-phy@2 { |
||||
reg = <0x2>; |
||||
}; |
||||
tbi1: tbi-phy@1f { |
||||
reg = <0x1f>; |
||||
device_type = "tbi-phy"; |
||||
}; |
||||
}; |
||||
|
||||
&uart0 { |
||||
status = "okay"; |
||||
}; |
||||
|
||||
&uart1 { |
||||
status = "okay"; |
||||
}; |
@ -0,0 +1,381 @@ |
||||
/* |
||||
* Freescale ls1021a SOC common device tree source |
||||
* |
||||
* Copyright 2013-2015 Freescale Semiconductor, Inc. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include "skeleton.dtsi" |
||||
#include <dt-bindings/interrupt-controller/arm-gic.h> |
||||
|
||||
/ { |
||||
compatible = "fsl,ls1021a"; |
||||
interrupt-parent = <&gic>; |
||||
|
||||
aliases { |
||||
serial0 = &lpuart0; |
||||
serial1 = &lpuart1; |
||||
serial2 = &lpuart2; |
||||
serial3 = &lpuart3; |
||||
serial4 = &lpuart4; |
||||
serial5 = &lpuart5; |
||||
sysclk = &sysclk; |
||||
}; |
||||
|
||||
cpus { |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
|
||||
cpu@f00 { |
||||
compatible = "arm,cortex-a7"; |
||||
device_type = "cpu"; |
||||
reg = <0xf00>; |
||||
clocks = <&cluster1_clk>; |
||||
}; |
||||
|
||||
cpu@f01 { |
||||
compatible = "arm,cortex-a7"; |
||||
device_type = "cpu"; |
||||
reg = <0xf01>; |
||||
clocks = <&cluster1_clk>; |
||||
}; |
||||
}; |
||||
|
||||
timer { |
||||
compatible = "arm,armv7-timer"; |
||||
interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
||||
<GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
||||
<GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
||||
<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; |
||||
}; |
||||
|
||||
pmu { |
||||
compatible = "arm,cortex-a7-pmu"; |
||||
interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, |
||||
<GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
||||
}; |
||||
|
||||
soc { |
||||
compatible = "simple-bus"; |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
device_type = "soc"; |
||||
interrupt-parent = <&gic>; |
||||
ranges; |
||||
|
||||
gic: interrupt-controller@1400000 { |
||||
compatible = "arm,cortex-a7-gic"; |
||||
#interrupt-cells = <3>; |
||||
interrupt-controller; |
||||
reg = <0x1401000 0x1000>, |
||||
<0x1402000 0x1000>, |
||||
<0x1404000 0x2000>, |
||||
<0x1406000 0x2000>; |
||||
interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>; |
||||
|
||||
}; |
||||
|
||||
ifc: ifc@1530000 { |
||||
compatible = "fsl,ifc", "simple-bus"; |
||||
reg = <0x1530000 0x10000>; |
||||
interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; |
||||
}; |
||||
|
||||
dcfg: dcfg@1ee0000 { |
||||
compatible = "fsl,ls1021a-dcfg", "syscon"; |
||||
reg = <0x1ee0000 0x10000>; |
||||
big-endian; |
||||
}; |
||||
|
||||
esdhc: esdhc@1560000 { |
||||
compatible = "fsl,esdhc"; |
||||
reg = <0x1560000 0x10000>; |
||||
interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-frequency = <0>; |
||||
voltage-ranges = <1800 1800 3300 3300>; |
||||
sdhci,auto-cmd12; |
||||
big-endian; |
||||
bus-width = <4>; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
scfg: scfg@1570000 { |
||||
compatible = "fsl,ls1021a-scfg", "syscon"; |
||||
reg = <0x1570000 0x10000>; |
||||
big-endian; |
||||
}; |
||||
|
||||
clockgen: clocking@1ee1000 { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
ranges = <0x0 0x1ee1000 0x10000>; |
||||
|
||||
sysclk: sysclk { |
||||
compatible = "fixed-clock"; |
||||
#clock-cells = <0>; |
||||
clock-output-names = "sysclk"; |
||||
}; |
||||
|
||||
cga_pll1: pll@800 { |
||||
compatible = "fsl,qoriq-core-pll-2.0"; |
||||
#clock-cells = <1>; |
||||
reg = <0x800 0x10>; |
||||
clocks = <&sysclk>; |
||||
clock-output-names = "cga-pll1", "cga-pll1-div2", |
||||
"cga-pll1-div4"; |
||||
}; |
||||
|
||||
platform_clk: pll@c00 { |
||||
compatible = "fsl,qoriq-core-pll-2.0"; |
||||
#clock-cells = <1>; |
||||
reg = <0xc00 0x10>; |
||||
clocks = <&sysclk>; |
||||
clock-output-names = "platform-clk", "platform-clk-div2"; |
||||
}; |
||||
|
||||
cluster1_clk: clk0c0@0 { |
||||
compatible = "fsl,qoriq-core-mux-2.0"; |
||||
#clock-cells = <0>; |
||||
reg = <0x0 0x10>; |
||||
clock-names = "pll1cga", "pll1cga-div2", "pll1cga-div4"; |
||||
clocks = <&cga_pll1 0>, <&cga_pll1 1>, <&cga_pll1 2>; |
||||
clock-output-names = "cluster1-clk"; |
||||
}; |
||||
}; |
||||
|
||||
dspi0: dspi@2100000 { |
||||
compatible = "fsl,vf610-dspi"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x2100000 0x10000>; |
||||
interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-names = "dspi"; |
||||
clocks = <&platform_clk 1>; |
||||
num-cs = <6>; |
||||
big-endian; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
dspi1: dspi@2110000 { |
||||
compatible = "fsl,vf610-dspi"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x2110000 0x10000>; |
||||
interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-names = "dspi"; |
||||
clocks = <&platform_clk 1>; |
||||
num-cs = <6>; |
||||
big-endian; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
qspi: quadspi@1550000 { |
||||
compatible = "fsl,vf610-qspi"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x1550000 0x10000>, |
||||
<0x40000000 0x4000000>; |
||||
num-cs = <2>; |
||||
big-endian; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
i2c0: i2c@2180000 { |
||||
compatible = "fsl,vf610-i2c"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x2180000 0x10000>; |
||||
interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-names = "i2c"; |
||||
clocks = <&platform_clk 1>; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
i2c1: i2c@2190000 { |
||||
compatible = "fsl,vf610-i2c"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x2190000 0x10000>; |
||||
interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-names = "i2c"; |
||||
clocks = <&platform_clk 1>; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
i2c2: i2c@21a0000 { |
||||
compatible = "fsl,vf610-i2c"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x21a0000 0x10000>; |
||||
interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-names = "i2c"; |
||||
clocks = <&platform_clk 1>; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
uart0: serial@21c0500 { |
||||
compatible = "fsl,16550-FIFO64", "ns16550a"; |
||||
reg = <0x21c0500 0x100>; |
||||
interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-frequency = <0>; |
||||
fifo-size = <15>; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
uart1: serial@21c0600 { |
||||
compatible = "fsl,16550-FIFO64", "ns16550a"; |
||||
reg = <0x21c0600 0x100>; |
||||
interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-frequency = <0>; |
||||
fifo-size = <15>; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
uart2: serial@21d0500 { |
||||
compatible = "fsl,16550-FIFO64", "ns16550a"; |
||||
reg = <0x21d0500 0x100>; |
||||
interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-frequency = <0>; |
||||
fifo-size = <15>; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
uart3: serial@21d0600 { |
||||
compatible = "fsl,16550-FIFO64", "ns16550a"; |
||||
reg = <0x21d0600 0x100>; |
||||
interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; |
||||
clock-frequency = <0>; |
||||
fifo-size = <15>; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
lpuart0: serial@2950000 { |
||||
compatible = "fsl,ls1021a-lpuart"; |
||||
reg = <0x2950000 0x1000>; |
||||
interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&sysclk>; |
||||
clock-names = "ipg"; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
lpuart1: serial@2960000 { |
||||
compatible = "fsl,ls1021a-lpuart"; |
||||
reg = <0x2960000 0x1000>; |
||||
interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&platform_clk 1>; |
||||
clock-names = "ipg"; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
lpuart2: serial@2970000 { |
||||
compatible = "fsl,ls1021a-lpuart"; |
||||
reg = <0x2970000 0x1000>; |
||||
interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&platform_clk 1>; |
||||
clock-names = "ipg"; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
lpuart3: serial@2980000 { |
||||
compatible = "fsl,ls1021a-lpuart"; |
||||
reg = <0x2980000 0x1000>; |
||||
interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&platform_clk 1>; |
||||
clock-names = "ipg"; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
lpuart4: serial@2990000 { |
||||
compatible = "fsl,ls1021a-lpuart"; |
||||
reg = <0x2990000 0x1000>; |
||||
interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&platform_clk 1>; |
||||
clock-names = "ipg"; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
lpuart5: serial@29a0000 { |
||||
compatible = "fsl,ls1021a-lpuart"; |
||||
reg = <0x29a0000 0x1000>; |
||||
interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&platform_clk 1>; |
||||
clock-names = "ipg"; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
wdog0: watchdog@2ad0000 { |
||||
compatible = "fsl,imx21-wdt"; |
||||
reg = <0x2ad0000 0x10000>; |
||||
interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&platform_clk 1>; |
||||
clock-names = "wdog-en"; |
||||
big-endian; |
||||
}; |
||||
|
||||
sai1: sai@2b50000 { |
||||
compatible = "fsl,vf610-sai"; |
||||
reg = <0x2b50000 0x10000>; |
||||
interrupts = <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&platform_clk 1>; |
||||
clock-names = "sai"; |
||||
dma-names = "tx", "rx"; |
||||
dmas = <&edma0 1 47>, |
||||
<&edma0 1 46>; |
||||
big-endian; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
sai2: sai@2b60000 { |
||||
compatible = "fsl,vf610-sai"; |
||||
reg = <0x2b60000 0x10000>; |
||||
interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>; |
||||
clocks = <&platform_clk 1>; |
||||
clock-names = "sai"; |
||||
dma-names = "tx", "rx"; |
||||
dmas = <&edma0 1 45>, |
||||
<&edma0 1 44>; |
||||
big-endian; |
||||
status = "disabled"; |
||||
}; |
||||
|
||||
edma0: edma@2c00000 { |
||||
#dma-cells = <2>; |
||||
compatible = "fsl,vf610-edma"; |
||||
reg = <0x2c00000 0x10000>, |
||||
<0x2c10000 0x10000>, |
||||
<0x2c20000 0x10000>; |
||||
interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>, |
||||
<GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>; |
||||
interrupt-names = "edma-tx", "edma-err"; |
||||
dma-channels = <32>; |
||||
big-endian; |
||||
clock-names = "dmamux0", "dmamux1"; |
||||
clocks = <&platform_clk 1>, |
||||
<&platform_clk 1>; |
||||
}; |
||||
|
||||
mdio0: mdio@2d24000 { |
||||
compatible = "gianfar"; |
||||
device_type = "mdio"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x2d24000 0x4000>; |
||||
}; |
||||
|
||||
usb@8600000 { |
||||
compatible = "fsl-usb2-dr-v2.5", "fsl-usb2-dr"; |
||||
reg = <0x8600000 0x1000>; |
||||
interrupts = <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>; |
||||
dr_mode = "host"; |
||||
phy_type = "ulpi"; |
||||
}; |
||||
|
||||
usb3@3100000 { |
||||
compatible = "snps,dwc3"; |
||||
reg = <0x3100000 0x10000>; |
||||
interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; |
||||
dr_mode = "host"; |
||||
}; |
||||
}; |
||||
}; |
@ -0,0 +1,13 @@ |
||||
/* |
||||
* Skeleton device tree in the 64 bits version; the bare minimum |
||||
* needed to boot; just include and add a compatible value. The |
||||
* bootloader will typically populate the memory node. |
||||
*/ |
||||
|
||||
/ { |
||||
#address-cells = <2>; |
||||
#size-cells = <2>; |
||||
chosen { }; |
||||
aliases { }; |
||||
memory { device_type = "memory"; reg = <0 0 0 0>; }; |
||||
}; |
@ -0,0 +1,23 @@ |
||||
/* |
||||
* Avnet PicoZed board DTS |
||||
* |
||||
* Copyright (C) 2015 Xilinx, Inc. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
/dts-v1/; |
||||
#include "zynq-7000.dtsi" |
||||
|
||||
/ { |
||||
model = "Zynq PicoZed Board"; |
||||
compatible = "xlnx,zynq-picozed", "xlnx,zynq-7000"; |
||||
|
||||
aliases { |
||||
serial0 = &uart1; |
||||
}; |
||||
|
||||
memory { |
||||
device_type = "memory"; |
||||
reg = <0 0x40000000>; |
||||
}; |
||||
}; |
@ -0,0 +1,278 @@ |
||||
/*
|
||||
* Copyright 2015 Toradex, Inc. |
||||
* |
||||
* Based on vf610twr: |
||||
* Copyright 2013 Freescale Semiconductor, Inc. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <asm/io.h> |
||||
#include <asm/arch/imx-regs.h> |
||||
#include <asm/arch/iomux-vf610.h> |
||||
#include <asm/arch/ddrmc-vf610.h> |
||||
|
||||
void ddrmc_setup_iomux(void) |
||||
{ |
||||
static const iomux_v3_cfg_t ddr_pads[] = { |
||||
VF610_PAD_DDR_A15__DDR_A_15, |
||||
VF610_PAD_DDR_A14__DDR_A_14, |
||||
VF610_PAD_DDR_A13__DDR_A_13, |
||||
VF610_PAD_DDR_A12__DDR_A_12, |
||||
VF610_PAD_DDR_A11__DDR_A_11, |
||||
VF610_PAD_DDR_A10__DDR_A_10, |
||||
VF610_PAD_DDR_A9__DDR_A_9, |
||||
VF610_PAD_DDR_A8__DDR_A_8, |
||||
VF610_PAD_DDR_A7__DDR_A_7, |
||||
VF610_PAD_DDR_A6__DDR_A_6, |
||||
VF610_PAD_DDR_A5__DDR_A_5, |
||||
VF610_PAD_DDR_A4__DDR_A_4, |
||||
VF610_PAD_DDR_A3__DDR_A_3, |
||||
VF610_PAD_DDR_A2__DDR_A_2, |
||||
VF610_PAD_DDR_A1__DDR_A_1, |
||||
VF610_PAD_DDR_A0__DDR_A_0, |
||||
VF610_PAD_DDR_BA2__DDR_BA_2, |
||||
VF610_PAD_DDR_BA1__DDR_BA_1, |
||||
VF610_PAD_DDR_BA0__DDR_BA_0, |
||||
VF610_PAD_DDR_CAS__DDR_CAS_B, |
||||
VF610_PAD_DDR_CKE__DDR_CKE_0, |
||||
VF610_PAD_DDR_CLK__DDR_CLK_0, |
||||
VF610_PAD_DDR_CS__DDR_CS_B_0, |
||||
VF610_PAD_DDR_D15__DDR_D_15, |
||||
VF610_PAD_DDR_D14__DDR_D_14, |
||||
VF610_PAD_DDR_D13__DDR_D_13, |
||||
VF610_PAD_DDR_D12__DDR_D_12, |
||||
VF610_PAD_DDR_D11__DDR_D_11, |
||||
VF610_PAD_DDR_D10__DDR_D_10, |
||||
VF610_PAD_DDR_D9__DDR_D_9, |
||||
VF610_PAD_DDR_D8__DDR_D_8, |
||||
VF610_PAD_DDR_D7__DDR_D_7, |
||||
VF610_PAD_DDR_D6__DDR_D_6, |
||||
VF610_PAD_DDR_D5__DDR_D_5, |
||||
VF610_PAD_DDR_D4__DDR_D_4, |
||||
VF610_PAD_DDR_D3__DDR_D_3, |
||||
VF610_PAD_DDR_D2__DDR_D_2, |
||||
VF610_PAD_DDR_D1__DDR_D_1, |
||||
VF610_PAD_DDR_D0__DDR_D_0, |
||||
VF610_PAD_DDR_DQM1__DDR_DQM_1, |
||||
VF610_PAD_DDR_DQM0__DDR_DQM_0, |
||||
VF610_PAD_DDR_DQS1__DDR_DQS_1, |
||||
VF610_PAD_DDR_DQS0__DDR_DQS_0, |
||||
VF610_PAD_DDR_RAS__DDR_RAS_B, |
||||
VF610_PAD_DDR_WE__DDR_WE_B, |
||||
VF610_PAD_DDR_ODT1__DDR_ODT_0, |
||||
VF610_PAD_DDR_ODT0__DDR_ODT_1, |
||||
VF610_PAD_DDR_RESETB, |
||||
}; |
||||
|
||||
imx_iomux_v3_setup_multiple_pads(ddr_pads, ARRAY_SIZE(ddr_pads)); |
||||
} |
||||
|
||||
void ddrmc_phy_init(void) |
||||
{ |
||||
struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR; |
||||
|
||||
writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[0]); |
||||
writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[16]); |
||||
writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[32]); |
||||
|
||||
writel(DDRMC_PHY_DQS_TIMING, &ddrmr->phy[1]); |
||||
writel(DDRMC_PHY_DQS_TIMING, &ddrmr->phy[17]); |
||||
|
||||
writel(DDRMC_PHY_CTRL, &ddrmr->phy[2]); |
||||
writel(DDRMC_PHY_CTRL, &ddrmr->phy[18]); |
||||
writel(DDRMC_PHY_CTRL, &ddrmr->phy[34]); |
||||
|
||||
writel(DDRMC_PHY_MASTER_CTRL, &ddrmr->phy[3]); |
||||
writel(DDRMC_PHY_MASTER_CTRL, &ddrmr->phy[19]); |
||||
writel(DDRMC_PHY_MASTER_CTRL, &ddrmr->phy[35]); |
||||
|
||||
writel(DDRMC_PHY_SLAVE_CTRL, &ddrmr->phy[4]); |
||||
writel(DDRMC_PHY_SLAVE_CTRL, &ddrmr->phy[20]); |
||||
writel(DDRMC_PHY_SLAVE_CTRL, &ddrmr->phy[36]); |
||||
|
||||
/* LPDDR2 only parameter */ |
||||
writel(DDRMC_PHY_OFF, &ddrmr->phy[49]); |
||||
|
||||
writel(DDRMC_PHY50_DDR3_MODE | |
||||
DDRMC_PHY50_EN_SW_HALF_CYCLE, &ddrmr->phy[50]); |
||||
|
||||
/* Processor Pad ODT settings */ |
||||
writel(DDRMC_PHY_PROC_PAD_ODT, &ddrmr->phy[52]); |
||||
} |
||||
|
||||
static void ddrmc_ctrl_lvl_init(struct ddrmc_lvl_info *lvl) |
||||
{ |
||||
struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR; |
||||
u32 cr102 = 0, cr105 = 0, cr106 = 0, cr110 = 0; |
||||
|
||||
if (lvl->wrlvl_reg_en) { |
||||
writel(DDRMC_CR97_WRLVL_EN, &ddrmr->cr[97]); |
||||
writel(DDRMC_CR98_WRLVL_DL_0(lvl->wrlvl_dl_0), &ddrmr->cr[98]); |
||||
writel(DDRMC_CR99_WRLVL_DL_1(lvl->wrlvl_dl_1), &ddrmr->cr[99]); |
||||
} |
||||
|
||||
if (lvl->rdlvl_reg_en) { |
||||
cr102 |= DDRMC_CR102_RDLVL_REG_EN; |
||||
cr105 |= DDRMC_CR105_RDLVL_DL_0(lvl->rdlvl_dl_0); |
||||
cr110 |= DDRMC_CR110_RDLVL_DL_1(lvl->rdlvl_dl_1); |
||||
} |
||||
|
||||
if (lvl->rdlvl_gt_reg_en) { |
||||
cr102 |= DDRMC_CR102_RDLVL_GT_REGEN; |
||||
cr106 |= DDRMC_CR106_RDLVL_GTDL_0(lvl->rdlvl_gt_dl_0); |
||||
cr110 |= DDRMC_CR110_RDLVL_GTDL_1(lvl->rdlvl_gt_dl_1); |
||||
} |
||||
|
||||
writel(cr102, &ddrmr->cr[102]); |
||||
writel(cr105, &ddrmr->cr[105]); |
||||
writel(cr106, &ddrmr->cr[106]); |
||||
writel(cr110, &ddrmr->cr[110]); |
||||
} |
||||
|
||||
void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings, |
||||
struct ddrmc_lvl_info *lvl, |
||||
int col_diff, int row_diff) |
||||
{ |
||||
struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR; |
||||
|
||||
writel(DDRMC_CR00_DRAM_CLASS_DDR3, &ddrmr->cr[0]); |
||||
writel(DDRMC_CR02_DRAM_TINIT(timings->tinit), &ddrmr->cr[2]); |
||||
writel(DDRMC_CR10_TRST_PWRON(timings->trst_pwron), &ddrmr->cr[10]); |
||||
|
||||
writel(DDRMC_CR11_CKE_INACTIVE(timings->cke_inactive), &ddrmr->cr[11]); |
||||
writel(DDRMC_CR12_WRLAT(timings->wrlat) | |
||||
DDRMC_CR12_CASLAT_LIN(timings->caslat_lin), &ddrmr->cr[12]); |
||||
writel(DDRMC_CR13_TRC(timings->trc) | DDRMC_CR13_TRRD(timings->trrd) | |
||||
DDRMC_CR13_TCCD(timings->tccd), &ddrmr->cr[13]); |
||||
writel(DDRMC_CR14_TFAW(timings->tfaw) | DDRMC_CR14_TRP(timings->trp) | |
||||
DDRMC_CR14_TWTR(timings->twtr) | |
||||
DDRMC_CR14_TRAS_MIN(timings->tras_min), &ddrmr->cr[14]); |
||||
writel(DDRMC_CR16_TMRD(timings->tmrd) | |
||||
DDRMC_CR16_TRTP(timings->trtp), &ddrmr->cr[16]); |
||||
writel(DDRMC_CR17_TRAS_MAX(timings->tras_max) | |
||||
DDRMC_CR17_TMOD(timings->tmod), &ddrmr->cr[17]); |
||||
writel(DDRMC_CR18_TCKESR(timings->tckesr) | |
||||
DDRMC_CR18_TCKE(timings->tcke), &ddrmr->cr[18]); |
||||
|
||||
writel(DDRMC_CR20_AP_EN, &ddrmr->cr[20]); |
||||
writel(DDRMC_CR21_TRCD_INT(timings->trcd_int) | |
||||
DDRMC_CR21_CCMAP_EN, &ddrmr->cr[21]); |
||||
|
||||
writel(DDRMC_CR22_TDAL(timings->tdal), &ddrmr->cr[22]); |
||||
writel(DDRMC_CR23_BSTLEN(3) | |
||||
DDRMC_CR23_TDLL(timings->tdll), &ddrmr->cr[23]); |
||||
writel(DDRMC_CR24_TRP_AB(timings->trp_ab), &ddrmr->cr[24]); |
||||
|
||||
writel(DDRMC_CR25_TREF_EN, &ddrmr->cr[25]); |
||||
writel(DDRMC_CR26_TREF(timings->tref) | |
||||
DDRMC_CR26_TRFC(timings->trfc), &ddrmr->cr[26]); |
||||
writel(DDRMC_CR28_TREF_INT(0), &ddrmr->cr[28]); |
||||
writel(DDRMC_CR29_TPDEX(timings->tpdex), &ddrmr->cr[29]); |
||||
|
||||
writel(DDRMC_CR30_TXPDLL(timings->txpdll), &ddrmr->cr[30]); |
||||
writel(DDRMC_CR31_TXSNR(timings->txsnr) | |
||||
DDRMC_CR31_TXSR(timings->txsr), &ddrmr->cr[31]); |
||||
writel(DDRMC_CR33_EN_QK_SREF, &ddrmr->cr[33]); |
||||
writel(DDRMC_CR34_CKSRX(timings->cksrx) | |
||||
DDRMC_CR34_CKSRE(timings->cksre), &ddrmr->cr[34]); |
||||
|
||||
writel(DDRMC_CR38_FREQ_CHG_EN(0), &ddrmr->cr[38]); |
||||
writel(DDRMC_CR39_PHY_INI_COM(1024) | DDRMC_CR39_PHY_INI_STA(16) | |
||||
DDRMC_CR39_FRQ_CH_DLLOFF(2), &ddrmr->cr[39]); |
||||
|
||||
writel(DDRMC_CR41_PHY_INI_STRT_INI_DIS, &ddrmr->cr[41]); |
||||
writel(DDRMC_CR48_MR1_DA_0(70) | |
||||
DDRMC_CR48_MR0_DA_0(1056), &ddrmr->cr[48]); |
||||
|
||||
writel(DDRMC_CR66_ZQCL(timings->zqcl) | |
||||
DDRMC_CR66_ZQINIT(timings->zqinit), &ddrmr->cr[66]); |
||||
writel(DDRMC_CR67_ZQCS(timings->zqcs), &ddrmr->cr[67]); |
||||
writel(DDRMC_CR69_ZQ_ON_SREF_EX(2), &ddrmr->cr[69]); |
||||
|
||||
writel(DDRMC_CR70_REF_PER_ZQ(timings->ref_per_zq), &ddrmr->cr[70]); |
||||
writel(DDRMC_CR72_ZQCS_ROTATE(0), &ddrmr->cr[72]); |
||||
|
||||
writel(DDRMC_CR73_APREBIT(timings->aprebit) | |
||||
DDRMC_CR73_COL_DIFF(col_diff) | |
||||
DDRMC_CR73_ROW_DIFF(row_diff), &ddrmr->cr[73]); |
||||
writel(DDRMC_CR74_BANKSPLT_EN | DDRMC_CR74_ADDR_CMP_EN | |
||||
DDRMC_CR74_CMD_AGE_CNT(64) | DDRMC_CR74_AGE_CNT(64), |
||||
&ddrmr->cr[74]); |
||||
writel(DDRMC_CR75_RW_PG_EN | DDRMC_CR75_RW_EN | DDRMC_CR75_PRI_EN | |
||||
DDRMC_CR75_PLEN, &ddrmr->cr[75]); |
||||
writel(DDRMC_CR76_NQENT_ACTDIS(3) | DDRMC_CR76_D_RW_G_BKCN(3) | |
||||
DDRMC_CR76_W2R_SPLT_EN, &ddrmr->cr[76]); |
||||
writel(DDRMC_CR77_CS_MAP | DDRMC_CR77_DI_RD_INTLEAVE | |
||||
DDRMC_CR77_SWAP_EN, &ddrmr->cr[77]); |
||||
writel(DDRMC_CR78_Q_FULLNESS(7) | |
||||
DDRMC_CR78_BUR_ON_FLY_BIT(12), &ddrmr->cr[78]); |
||||
writel(DDRMC_CR79_CTLUPD_AREF(0), &ddrmr->cr[79]); |
||||
|
||||
writel(DDRMC_CR82_INT_MASK, &ddrmr->cr[82]); |
||||
|
||||
writel(DDRMC_CR87_ODT_WR_MAPCS0, &ddrmr->cr[87]); |
||||
writel(DDRMC_CR88_TODTL_CMD(4), &ddrmr->cr[88]); |
||||
writel(DDRMC_CR89_AODT_RWSMCS(2), &ddrmr->cr[89]); |
||||
|
||||
writel(DDRMC_CR91_R2W_SMCSDL(2), &ddrmr->cr[91]); |
||||
writel(DDRMC_CR96_WLMRD(timings->wlmrd) | |
||||
DDRMC_CR96_WLDQSEN(timings->wldqsen), &ddrmr->cr[96]); |
||||
|
||||
if (lvl != NULL) |
||||
ddrmc_ctrl_lvl_init(lvl); |
||||
|
||||
writel(DDRMC_CR117_AXI0_W_PRI(0) | |
||||
DDRMC_CR117_AXI0_R_PRI(0), &ddrmr->cr[117]); |
||||
writel(DDRMC_CR118_AXI1_W_PRI(1) | |
||||
DDRMC_CR118_AXI1_R_PRI(1), &ddrmr->cr[118]); |
||||
|
||||
writel(DDRMC_CR120_AXI0_PRI1_RPRI(2) | |
||||
DDRMC_CR120_AXI0_PRI0_RPRI(2), &ddrmr->cr[120]); |
||||
writel(DDRMC_CR121_AXI0_PRI3_RPRI(2) | |
||||
DDRMC_CR121_AXI0_PRI2_RPRI(2), &ddrmr->cr[121]); |
||||
writel(DDRMC_CR122_AXI1_PRI1_RPRI(1) | DDRMC_CR122_AXI1_PRI0_RPRI(1) | |
||||
DDRMC_CR122_AXI0_PRIRLX(100), &ddrmr->cr[122]); |
||||
writel(DDRMC_CR123_AXI1_P_ODR_EN | DDRMC_CR123_AXI1_PRI3_RPRI(1) | |
||||
DDRMC_CR123_AXI1_PRI2_RPRI(1), &ddrmr->cr[123]); |
||||
writel(DDRMC_CR124_AXI1_PRIRLX(100), &ddrmr->cr[124]); |
||||
|
||||
writel(DDRMC_CR126_PHY_RDLAT(8), &ddrmr->cr[126]); |
||||
writel(DDRMC_CR132_WRLAT_ADJ(5) | |
||||
DDRMC_CR132_RDLAT_ADJ(6), &ddrmr->cr[132]); |
||||
writel(DDRMC_CR137_PHYCTL_DL(2), &ddrmr->cr[137]); |
||||
writel(DDRMC_CR138_PHY_WRLV_MXDL(256) | |
||||
DDRMC_CR138_PHYDRAM_CK_EN(1), &ddrmr->cr[138]); |
||||
writel(DDRMC_CR139_PHY_WRLV_RESPLAT(4) | DDRMC_CR139_PHY_WRLV_LOAD(7) | |
||||
DDRMC_CR139_PHY_WRLV_DLL(3) | |
||||
DDRMC_CR139_PHY_WRLV_EN(3), &ddrmr->cr[139]); |
||||
writel(DDRMC_CR140_PHY_WRLV_WW(64), &ddrmr->cr[140]); |
||||
writel(DDRMC_CR143_RDLV_GAT_MXDL(1536) | |
||||
DDRMC_CR143_RDLV_MXDL(128), &ddrmr->cr[143]); |
||||
writel(DDRMC_CR144_PHY_RDLVL_RES(4) | DDRMC_CR144_PHY_RDLV_LOAD(7) | |
||||
DDRMC_CR144_PHY_RDLV_DLL(3) | |
||||
DDRMC_CR144_PHY_RDLV_EN(3), &ddrmr->cr[144]); |
||||
writel(DDRMC_CR145_PHY_RDLV_RR(64), &ddrmr->cr[145]); |
||||
writel(DDRMC_CR146_PHY_RDLVL_RESP(64), &ddrmr->cr[146]); |
||||
writel(DDRMC_CR147_RDLV_RESP_MASK(983040), &ddrmr->cr[147]); |
||||
writel(DDRMC_CR148_RDLV_GATE_RESP_MASK(983040), &ddrmr->cr[148]); |
||||
writel(DDRMC_CR151_RDLV_GAT_DQ_ZERO_CNT(1) | |
||||
DDRMC_CR151_RDLVL_DQ_ZERO_CNT(1), &ddrmr->cr[151]); |
||||
|
||||
writel(DDRMC_CR154_PAD_ZQ_EARLY_CMP_EN_TIMER(13) | |
||||
DDRMC_CR154_PAD_ZQ_MODE(1) | |
||||
DDRMC_CR154_DDR_SEL_PAD_CONTR(3) | |
||||
DDRMC_CR154_PAD_ZQ_HW_FOR(1), &ddrmr->cr[154]); |
||||
writel(DDRMC_CR155_PAD_ODT_BYTE1(2) | |
||||
DDRMC_CR155_PAD_ODT_BYTE0(2), &ddrmr->cr[155]); |
||||
writel(DDRMC_CR158_TWR(6), &ddrmr->cr[158]); |
||||
writel(DDRMC_CR161_ODT_EN(1) | DDRMC_CR161_TODTH_RD(2) | |
||||
DDRMC_CR161_TODTH_WR(2), &ddrmr->cr[161]); |
||||
|
||||
ddrmc_phy_init(); |
||||
|
||||
writel(DDRMC_CR00_DRAM_CLASS_DDR3 | DDRMC_CR00_START, &ddrmr->cr[0]); |
||||
|
||||
while (!(readl(&ddrmr->cr[80]) && 0x100)) |
||||
udelay(10); |
||||
} |
@ -1,17 +0,0 @@ |
||||
#ifndef __ARM7_HW_H |
||||
#define __ARM7_HW_H |
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Cucy Systems (http://www.cucy.com)
|
||||
* Curt Brune <curt@cucy.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#if defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR) |
||||
/* include IntegratorCP/CM720T specific hardware file if there was one */ |
||||
#else |
||||
#error No hardware file defined for this configuration |
||||
#endif |
||||
|
||||
#endif /* __ARM7_HW_H */ |
@ -0,0 +1,67 @@ |
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor, Inc. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef __FSL_SERDES_H |
||||
#define __FSL_SERDES_H |
||||
|
||||
#include <config.h> |
||||
|
||||
#define SRDS_MAX_LANES 8 |
||||
|
||||
enum srds_prtcl { |
||||
NONE = 0, |
||||
PCIE1, |
||||
PCIE2, |
||||
PCIE3, |
||||
PCIE4, |
||||
SATA1, |
||||
SATA2, |
||||
XAUI1, |
||||
XAUI2, |
||||
XFI1, |
||||
XFI2, |
||||
XFI3, |
||||
XFI4, |
||||
XFI5, |
||||
XFI6, |
||||
XFI7, |
||||
XFI8, |
||||
SGMII1, |
||||
SGMII2, |
||||
SGMII3, |
||||
SGMII4, |
||||
SGMII5, |
||||
SGMII6, |
||||
SGMII7, |
||||
SGMII8, |
||||
SGMII9, |
||||
SGMII10, |
||||
SGMII11, |
||||
SGMII12, |
||||
SGMII13, |
||||
SGMII14, |
||||
SGMII15, |
||||
SGMII16, |
||||
QSGMII_A, /* A indicates MACs 1-4 */ |
||||
QSGMII_B, /* B indicates MACs 5-8 */ |
||||
QSGMII_C, /* C indicates MACs 9-12 */ |
||||
QSGMII_D, /* D indicates MACs 12-16 */ |
||||
SERDES_PRCTL_COUNT |
||||
}; |
||||
|
||||
enum srds { |
||||
FSL_SRDS_1 = 0, |
||||
FSL_SRDS_2 = 1, |
||||
}; |
||||
|
||||
int is_serdes_configured(enum srds_prtcl device); |
||||
void fsl_serdes_init(void); |
||||
|
||||
int serdes_get_first_lane(u32 sd, enum srds_prtcl device); |
||||
enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane); |
||||
int is_serdes_prtcl_valid(int serdes, u32 prtcl); |
||||
|
||||
#endif /* __FSL_SERDES_H */ |
@ -0,0 +1,8 @@ |
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
void fsl_lsch3_early_init_f(void); |
||||
|
@ -0,0 +1,19 @@ |
||||
/*
|
||||
* Copyright (C) 2015 Marek Vasut <marex@denx.de> |
||||
* |
||||
* FIXME: This file contains temporary stub functions and is here |
||||
* only until these functions are properly merged into |
||||
* mainline. |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef __ARCH_SDRAM_H__ |
||||
#define __ARCH_SDRAM_H__ |
||||
|
||||
/* function declaration */ |
||||
inline unsigned long sdram_calculate_size(void) { return 0; } |
||||
inline unsigned sdram_mmr_init_full(unsigned int sdr_phy_reg) { return 0; } |
||||
inline int sdram_calibration_full(void) { return 0; } |
||||
|
||||
#endif /* __ARCH_SDRAM_H__ */ |
@ -0,0 +1,75 @@ |
||||
/*
|
||||
* (C) Copyright 2013 |
||||
* Pavel Boldin, Emcraft Systems, paboldin@emcraft.com |
||||
* |
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef _MACH_FMC_H_ |
||||
#define _MACH_FMC_H_ |
||||
|
||||
struct stm32_fmc_regs { |
||||
u32 sdcr1; /* Control register 1 */ |
||||
u32 sdcr2; /* Control register 2 */ |
||||
u32 sdtr1; /* Timing register 1 */ |
||||
u32 sdtr2; /* Timing register 2 */ |
||||
u32 sdcmr; /* Mode register */ |
||||
u32 sdrtr; /* Refresh timing register */ |
||||
u32 sdsr; /* Status register */ |
||||
}; |
||||
|
||||
/*
|
||||
* FMC registers base |
||||
*/ |
||||
#define STM32_SDRAM_FMC_BASE 0xA0000140 |
||||
#define STM32_SDRAM_FMC ((struct stm32_fmc_regs *)STM32_SDRAM_FMC_BASE) |
||||
|
||||
/* Control register SDCR */ |
||||
#define FMC_SDCR_RPIPE_SHIFT 13 /* RPIPE bit shift */ |
||||
#define FMC_SDCR_RBURST_SHIFT 12 /* RBURST bit shift */ |
||||
#define FMC_SDCR_SDCLK_SHIFT 10 /* SDRAM clock divisor shift */ |
||||
#define FMC_SDCR_WP_SHIFT 9 /* Write protection shift */ |
||||
#define FMC_SDCR_CAS_SHIFT 7 /* CAS latency shift */ |
||||
#define FMC_SDCR_NB_SHIFT 6 /* Number of banks shift */ |
||||
#define FMC_SDCR_MWID_SHIFT 4 /* Memory width shift */ |
||||
#define FMC_SDCR_NR_SHIFT 2 /* Number of row address bits shift */ |
||||
#define FMC_SDCR_NC_SHIFT 0 /* Number of col address bits shift */ |
||||
|
||||
/* Timings register SDTR */ |
||||
#define FMC_SDTR_TMRD_SHIFT 0 /* Load mode register to active */ |
||||
#define FMC_SDTR_TXSR_SHIFT 4 /* Exit self-refresh time */ |
||||
#define FMC_SDTR_TRAS_SHIFT 8 /* Self-refresh time */ |
||||
#define FMC_SDTR_TRC_SHIFT 12 /* Row cycle delay */ |
||||
#define FMC_SDTR_TWR_SHIFT 16 /* Recovery delay */ |
||||
#define FMC_SDTR_TRP_SHIFT 20 /* Row precharge delay */ |
||||
#define FMC_SDTR_TRCD_SHIFT 24 /* Row-to-column delay */ |
||||
|
||||
|
||||
#define FMC_SDCMR_NRFS_SHIFT 5 |
||||
|
||||
#define FMC_SDCMR_MODE_NORMAL 0 |
||||
#define FMC_SDCMR_MODE_START_CLOCK 1 |
||||
#define FMC_SDCMR_MODE_PRECHARGE 2 |
||||
#define FMC_SDCMR_MODE_AUTOREFRESH 3 |
||||
#define FMC_SDCMR_MODE_WRITE_MODE 4 |
||||
#define FMC_SDCMR_MODE_SELFREFRESH 5 |
||||
#define FMC_SDCMR_MODE_POWERDOWN 6 |
||||
|
||||
#define FMC_SDCMR_BANK_1 (1 << 4) |
||||
#define FMC_SDCMR_BANK_2 (1 << 3) |
||||
|
||||
#define FMC_SDCMR_MODE_REGISTER_SHIFT 9 |
||||
|
||||
#define FMC_SDSR_BUSY (1 << 5) |
||||
|
||||
#define FMC_BUSY_WAIT() do { \ |
||||
__asm__ __volatile__ ("dsb" : : : "memory"); \
|
||||
while (STM32_SDRAM_FMC->sdsr & FMC_SDSR_BUSY) \
|
||||
; \
|
||||
} while (0) |
||||
|
||||
|
||||
#endif /* _MACH_FMC_H_ */ |
@ -0,0 +1,116 @@ |
||||
/*
|
||||
* (C) Copyright 2011 |
||||
* Yuri Tikhonov, Emcraft Systems, yur@emcraft.com |
||||
* |
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef _STM32_GPIO_H_ |
||||
#define _STM32_GPIO_H_ |
||||
|
||||
enum stm32_gpio_port { |
||||
STM32_GPIO_PORT_A = 0, |
||||
STM32_GPIO_PORT_B, |
||||
STM32_GPIO_PORT_C, |
||||
STM32_GPIO_PORT_D, |
||||
STM32_GPIO_PORT_E, |
||||
STM32_GPIO_PORT_F, |
||||
STM32_GPIO_PORT_G, |
||||
STM32_GPIO_PORT_H, |
||||
STM32_GPIO_PORT_I |
||||
}; |
||||
|
||||
enum stm32_gpio_pin { |
||||
STM32_GPIO_PIN_0 = 0, |
||||
STM32_GPIO_PIN_1, |
||||
STM32_GPIO_PIN_2, |
||||
STM32_GPIO_PIN_3, |
||||
STM32_GPIO_PIN_4, |
||||
STM32_GPIO_PIN_5, |
||||
STM32_GPIO_PIN_6, |
||||
STM32_GPIO_PIN_7, |
||||
STM32_GPIO_PIN_8, |
||||
STM32_GPIO_PIN_9, |
||||
STM32_GPIO_PIN_10, |
||||
STM32_GPIO_PIN_11, |
||||
STM32_GPIO_PIN_12, |
||||
STM32_GPIO_PIN_13, |
||||
STM32_GPIO_PIN_14, |
||||
STM32_GPIO_PIN_15 |
||||
}; |
||||
|
||||
enum stm32_gpio_mode { |
||||
STM32_GPIO_MODE_IN = 0, |
||||
STM32_GPIO_MODE_OUT, |
||||
STM32_GPIO_MODE_AF, |
||||
STM32_GPIO_MODE_AN |
||||
}; |
||||
|
||||
enum stm32_gpio_otype { |
||||
STM32_GPIO_OTYPE_PP = 0, |
||||
STM32_GPIO_OTYPE_OD |
||||
}; |
||||
|
||||
enum stm32_gpio_speed { |
||||
STM32_GPIO_SPEED_2M = 0, |
||||
STM32_GPIO_SPEED_25M, |
||||
STM32_GPIO_SPEED_50M, |
||||
STM32_GPIO_SPEED_100M |
||||
}; |
||||
|
||||
enum stm32_gpio_pupd { |
||||
STM32_GPIO_PUPD_NO = 0, |
||||
STM32_GPIO_PUPD_UP, |
||||
STM32_GPIO_PUPD_DOWN |
||||
}; |
||||
|
||||
enum stm32_gpio_af { |
||||
STM32_GPIO_AF0 = 0, |
||||
STM32_GPIO_AF1, |
||||
STM32_GPIO_AF2, |
||||
STM32_GPIO_AF3, |
||||
STM32_GPIO_AF4, |
||||
STM32_GPIO_AF5, |
||||
STM32_GPIO_AF6, |
||||
STM32_GPIO_AF7, |
||||
STM32_GPIO_AF8, |
||||
STM32_GPIO_AF9, |
||||
STM32_GPIO_AF10, |
||||
STM32_GPIO_AF11, |
||||
STM32_GPIO_AF12, |
||||
STM32_GPIO_AF13, |
||||
STM32_GPIO_AF14, |
||||
STM32_GPIO_AF15 |
||||
}; |
||||
|
||||
struct stm32_gpio_dsc { |
||||
enum stm32_gpio_port port; |
||||
enum stm32_gpio_pin pin; |
||||
}; |
||||
|
||||
struct stm32_gpio_ctl { |
||||
enum stm32_gpio_mode mode; |
||||
enum stm32_gpio_otype otype; |
||||
enum stm32_gpio_speed speed; |
||||
enum stm32_gpio_pupd pupd; |
||||
enum stm32_gpio_af af; |
||||
}; |
||||
|
||||
static inline unsigned stm32_gpio_to_port(unsigned gpio) |
||||
{ |
||||
return gpio / 16; |
||||
} |
||||
|
||||
static inline unsigned stm32_gpio_to_pin(unsigned gpio) |
||||
{ |
||||
return gpio % 16; |
||||
} |
||||
|
||||
int stm32_gpio_config(const struct stm32_gpio_dsc *gpio_dsc, |
||||
const struct stm32_gpio_ctl *gpio_ctl); |
||||
int stm32_gpout_set(const struct stm32_gpio_dsc *gpio_dsc, int state); |
||||
|
||||
#endif /* _STM32_GPIO_H_ */ |
@ -0,0 +1,108 @@ |
||||
/*
|
||||
* (C) Copyright 2011 |
||||
* Yuri Tikhonov, Emcraft Systems, yur@emcraft.com |
||||
* |
||||
* (C) Copyright 2015 |
||||
* Kamil Lulko, <rev13@wp.pl> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef _MACH_STM32_H_ |
||||
#define _MACH_STM32_H_ |
||||
|
||||
/*
|
||||
* Peripheral memory map |
||||
*/ |
||||
#define STM32_PERIPH_BASE 0x40000000 |
||||
#define STM32_APB1PERIPH_BASE (STM32_PERIPH_BASE + 0x00000000) |
||||
#define STM32_APB2PERIPH_BASE (STM32_PERIPH_BASE + 0x00010000) |
||||
#define STM32_AHB1PERIPH_BASE (STM32_PERIPH_BASE + 0x00020000) |
||||
#define STM32_AHB2PERIPH_BASE (STM32_PERIPH_BASE + 0x10000000) |
||||
|
||||
#define STM32_BUS_MASK 0xFFFF0000 |
||||
|
||||
/*
|
||||
* Register maps |
||||
*/ |
||||
struct stm32_rcc_regs { |
||||
u32 cr; /* RCC clock control */ |
||||
u32 pllcfgr; /* RCC PLL configuration */ |
||||
u32 cfgr; /* RCC clock configuration */ |
||||
u32 cir; /* RCC clock interrupt */ |
||||
u32 ahb1rstr; /* RCC AHB1 peripheral reset */ |
||||
u32 ahb2rstr; /* RCC AHB2 peripheral reset */ |
||||
u32 ahb3rstr; /* RCC AHB3 peripheral reset */ |
||||
u32 rsv0; |
||||
u32 apb1rstr; /* RCC APB1 peripheral reset */ |
||||
u32 apb2rstr; /* RCC APB2 peripheral reset */ |
||||
u32 rsv1[2]; |
||||
u32 ahb1enr; /* RCC AHB1 peripheral clock enable */ |
||||
u32 ahb2enr; /* RCC AHB2 peripheral clock enable */ |
||||
u32 ahb3enr; /* RCC AHB3 peripheral clock enable */ |
||||
u32 rsv2; |
||||
u32 apb1enr; /* RCC APB1 peripheral clock enable */ |
||||
u32 apb2enr; /* RCC APB2 peripheral clock enable */ |
||||
u32 rsv3[2]; |
||||
u32 ahb1lpenr; /* RCC AHB1 periph clk enable in low pwr mode */ |
||||
u32 ahb2lpenr; /* RCC AHB2 periph clk enable in low pwr mode */ |
||||
u32 ahb3lpenr; /* RCC AHB3 periph clk enable in low pwr mode */ |
||||
u32 rsv4; |
||||
u32 apb1lpenr; /* RCC APB1 periph clk enable in low pwr mode */ |
||||
u32 apb2lpenr; /* RCC APB2 periph clk enable in low pwr mode */ |
||||
u32 rsv5[2]; |
||||
u32 bdcr; /* RCC Backup domain control */ |
||||
u32 csr; /* RCC clock control & status */ |
||||
u32 rsv6[2]; |
||||
u32 sscgr; /* RCC spread spectrum clock generation */ |
||||
u32 plli2scfgr; /* RCC PLLI2S configuration */ |
||||
u32 pllsaicfgr; |
||||
u32 dckcfgr; |
||||
}; |
||||
|
||||
struct stm32_pwr_regs { |
||||
u32 cr; |
||||
u32 csr; |
||||
}; |
||||
|
||||
struct stm32_flash_regs { |
||||
u32 acr; |
||||
u32 key; |
||||
u32 optkeyr; |
||||
u32 sr; |
||||
u32 cr; |
||||
u32 optcr; |
||||
u32 optcr1; |
||||
}; |
||||
|
||||
/*
|
||||
* Registers access macros |
||||
*/ |
||||
#define STM32_RCC_BASE (STM32_AHB1PERIPH_BASE + 0x3800) |
||||
#define STM32_RCC ((struct stm32_rcc_regs *)STM32_RCC_BASE) |
||||
|
||||
#define STM32_PWR_BASE (STM32_APB1PERIPH_BASE + 0x7000) |
||||
#define STM32_PWR ((struct stm32_pwr_regs *)STM32_PWR_BASE) |
||||
|
||||
#define STM32_FLASH_BASE (STM32_AHB1PERIPH_BASE + 0x3C00) |
||||
#define STM32_FLASH ((struct stm32_flash_regs *)STM32_FLASH_BASE) |
||||
|
||||
#define STM32_FLASH_SR_BSY (1 << 16) |
||||
|
||||
#define STM32_FLASH_CR_PG (1 << 0) |
||||
#define STM32_FLASH_CR_SER (1 << 1) |
||||
#define STM32_FLASH_CR_STRT (1 << 16) |
||||
#define STM32_FLASH_CR_LOCK (1 << 31) |
||||
#define STM32_FLASH_CR_SNB_OFFSET 3 |
||||
|
||||
enum clock { |
||||
CLOCK_CORE, |
||||
CLOCK_AHB, |
||||
CLOCK_APB1, |
||||
CLOCK_APB2 |
||||
}; |
||||
|
||||
int configure_clocks(void); |
||||
unsigned long clock_get(enum clock clck); |
||||
|
||||
#endif /* _MACH_STM32_H_ */ |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue