mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Compare commits
153 Commits
v2015.10-r
...
v2015.10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ec0003b19 | ||
|
|
75918afa64 | ||
|
|
6a48109d0e | ||
|
|
ecdc3df611 | ||
|
|
743d75925a | ||
|
|
71d5511628 | ||
|
|
7229c3c70b | ||
|
|
73f7550715 | ||
|
|
84ca65aa4b | ||
|
|
81fd858cbe | ||
|
|
2fdc9b741b | ||
|
|
2d0cee1ca2 | ||
|
|
2727f3bfba | ||
|
|
f4c9258213 | ||
|
|
d718ff70ee | ||
|
|
04d6f1420f | ||
|
|
7003e4cf76 | ||
|
|
ef1e5710b3 | ||
|
|
461f592649 | ||
|
|
79ad5cef15 | ||
|
|
d1a2f32fca | ||
|
|
8626cb8021 | ||
|
|
b9f06b360d | ||
|
|
ac6a53219a | ||
|
|
3790a8c662 | ||
|
|
8d8e13e129 | ||
|
|
4b8cdd484c | ||
|
|
a7e2c6f6bb | ||
|
|
53fd4b8c22 | ||
|
|
1275456d31 | ||
|
|
aaf87f03ad | ||
|
|
b1964c72bd | ||
|
|
ad3d6e88a1 | ||
|
|
cb4c833b74 | ||
|
|
c57a9a6350 | ||
|
|
55aa0bed98 | ||
|
|
cf04ad3219 | ||
|
|
d45fd018c8 | ||
|
|
e24bb2b732 | ||
|
|
13a3972585 | ||
|
|
297faccca2 | ||
|
|
2308ea7c6f | ||
|
|
995a54cc12 | ||
|
|
6a9fbb6e20 | ||
|
|
1a9d1731f9 | ||
|
|
8e34a74d69 | ||
|
|
4ed50807e2 | ||
|
|
f861f51c46 | ||
|
|
f532727d16 | ||
|
|
87a9595709 | ||
|
|
e3cc5bc582 | ||
|
|
040ef8f565 | ||
|
|
e8de6d7b4a | ||
|
|
4c90234586 | ||
|
|
f0aa26f006 | ||
|
|
d1d0167663 | ||
|
|
0219e4bfb4 | ||
|
|
1fec3c5d83 | ||
|
|
354973076a | ||
|
|
e392b923ed | ||
|
|
9950098e31 | ||
|
|
027b728d4a | ||
|
|
b6b5e394db | ||
|
|
c0c7a55428 | ||
|
|
04386f656b | ||
|
|
1254b44a9f | ||
|
|
e876be4b5c | ||
|
|
5e1a860e6c | ||
|
|
1d7f2ece69 | ||
|
|
8133f43d1c | ||
|
|
689821fd76 | ||
|
|
492f24e886 | ||
|
|
ecbed5d6f4 | ||
|
|
4a6bdb59e1 | ||
|
|
6607d397c2 | ||
|
|
1a9717fb30 | ||
|
|
74e264b49f | ||
|
|
fc04b92354 | ||
|
|
0d3012af5a | ||
|
|
b483cb5a94 | ||
|
|
c0ae9703b4 | ||
|
|
03d1d568a0 | ||
|
|
f2b76c6037 | ||
|
|
a8ee68df49 | ||
|
|
5cb1b7b395 | ||
|
|
a22bba81e4 | ||
|
|
d5f60737db | ||
|
|
9a4c6e9abf | ||
|
|
974936a80f | ||
|
|
38ab75a2aa | ||
|
|
7445435fb3 | ||
|
|
e928fbf9c6 | ||
|
|
739c5e0833 | ||
|
|
f6e27ba5b4 | ||
|
|
61903b759a | ||
|
|
835c30e368 | ||
|
|
7bb91dd109 | ||
|
|
cbfc2ff9da | ||
|
|
84d26e296a | ||
|
|
b1f492ca9e | ||
|
|
d18f37c72b | ||
|
|
996ec1dcc5 | ||
|
|
cce573e8d8 | ||
|
|
7241df1c39 | ||
|
|
6f183e869e | ||
|
|
ff0a6358b6 | ||
|
|
d93b9a0709 | ||
|
|
3d3f60cb7a | ||
|
|
97fec7105c | ||
|
|
fbb0c7bd92 | ||
|
|
fe82857c4b | ||
|
|
9f75a222c7 | ||
|
|
930c514d47 | ||
|
|
0c35e3a8b4 | ||
|
|
f9d3cab091 | ||
|
|
cb96bf991b | ||
|
|
b8d242121d | ||
|
|
7daaac5281 | ||
|
|
931a1d2a14 | ||
|
|
03544c6640 | ||
|
|
3f353ceccb | ||
|
|
b9a1609915 | ||
|
|
e2748b4167 | ||
|
|
4bbc08f2ec | ||
|
|
aca5d0830a | ||
|
|
ac1eefebf5 | ||
|
|
2959f936c5 | ||
|
|
e29f1db3dd | ||
|
|
787ddb7cd1 | ||
|
|
cefd764222 | ||
|
|
02c2c51cf7 | ||
|
|
8ac46a9861 | ||
|
|
2666074809 | ||
|
|
4917c061a2 | ||
|
|
c163e43679 | ||
|
|
eaa8a195cc | ||
|
|
26d3acdab8 | ||
|
|
4af90a6d03 | ||
|
|
46f166caad | ||
|
|
be90974c43 | ||
|
|
31c5614af4 | ||
|
|
f3b589c09b | ||
|
|
af654d1461 | ||
|
|
a188438175 | ||
|
|
e954eb8028 | ||
|
|
cb42d63554 | ||
|
|
5c965ed901 | ||
|
|
daf6d399ae | ||
|
|
861ba4aaac | ||
|
|
196193a4d4 | ||
|
|
c1446ac6c1 | ||
|
|
208bd51396 | ||
|
|
ed64190f67 |
2
Makefile
2
Makefile
@@ -1,7 +1,7 @@
|
||||
VERSION = 2015
|
||||
PATCHLEVEL = 10
|
||||
SUBLEVEL =
|
||||
EXTRAVERSION = -rc4
|
||||
EXTRAVERSION =
|
||||
NAME =
|
||||
|
||||
# *DOCUMENTATION*
|
||||
|
||||
12
README
12
README
@@ -681,8 +681,10 @@ The following options need to be configured:
|
||||
CONFIG_ARM_ERRATA_742230
|
||||
CONFIG_ARM_ERRATA_743622
|
||||
CONFIG_ARM_ERRATA_751472
|
||||
CONFIG_ARM_ERRATA_794072
|
||||
CONFIG_ARM_ERRATA_761320
|
||||
CONFIG_ARM_ERRATA_773022
|
||||
CONFIG_ARM_ERRATA_774769
|
||||
CONFIG_ARM_ERRATA_794072
|
||||
|
||||
If set, the workarounds for these ARM errata are applied early
|
||||
during U-Boot startup. Note that these options force the
|
||||
@@ -2359,16 +2361,20 @@ CBFS (Coreboot Filesystem) support
|
||||
|
||||
- drivers/i2c/i2c_mxc.c
|
||||
- activate this driver with CONFIG_SYS_I2C_MXC
|
||||
- enable bus 1 with CONFIG_SYS_I2C_MXC_I2C1
|
||||
- enable bus 2 with CONFIG_SYS_I2C_MXC_I2C2
|
||||
- enable bus 3 with CONFIG_SYS_I2C_MXC_I2C3
|
||||
- enable bus 4 with CONFIG_SYS_I2C_MXC_I2C4
|
||||
- define speed for bus 1 with CONFIG_SYS_MXC_I2C1_SPEED
|
||||
- define slave for bus 1 with CONFIG_SYS_MXC_I2C1_SLAVE
|
||||
- define speed for bus 2 with CONFIG_SYS_MXC_I2C2_SPEED
|
||||
- define slave for bus 2 with CONFIG_SYS_MXC_I2C2_SLAVE
|
||||
- define speed for bus 3 with CONFIG_SYS_MXC_I2C3_SPEED
|
||||
- define slave for bus 3 with CONFIG_SYS_MXC_I2C3_SLAVE
|
||||
- define speed for bus 4 with CONFIG_SYS_MXC_I2C4_SPEED
|
||||
- define slave for bus 4 with CONFIG_SYS_MXC_I2C4_SLAVE
|
||||
If those defines are not set, default value is 100000
|
||||
for speed, and 0 for slave.
|
||||
- enable bus 3 with CONFIG_SYS_I2C_MXC_I2C3
|
||||
- enable bus 4 with CONFIG_SYS_I2C_MXC_I2C4
|
||||
|
||||
- drivers/i2c/rcar_i2c.c:
|
||||
- activate this driver with CONFIG_SYS_I2C_RCAR
|
||||
|
||||
@@ -538,6 +538,10 @@ config TARGET_COLIBRI_VF
|
||||
bool "Support Colibri VF50/61"
|
||||
select CPU_V7
|
||||
|
||||
config TARGET_PCM052
|
||||
bool "Support pcm-052"
|
||||
select CPU_V7
|
||||
|
||||
config ARCH_ZYNQ
|
||||
bool "Xilinx Zynq Platform"
|
||||
select CPU_V7
|
||||
@@ -563,6 +567,15 @@ config TARGET_VEXPRESS64_BASE_FVP
|
||||
select ARM64
|
||||
select SEMIHOSTING
|
||||
|
||||
config TARGET_VEXPRESS64_BASE_FVP_DRAM
|
||||
bool "Support Versatile Express ARMv8a FVP BASE model booting from DRAM"
|
||||
select ARM64
|
||||
help
|
||||
This target is derived from TARGET_VEXPRESS64_BASE_FVP and over-rides
|
||||
the default config to allow the user to load the images directly into
|
||||
DRAM using model parameters rather than by using semi-hosting to load
|
||||
the files from the host filesystem.
|
||||
|
||||
config TARGET_VEXPRESS64_JUNO
|
||||
bool "Support Versatile Express Juno Development Platform"
|
||||
select ARM64
|
||||
@@ -753,6 +766,7 @@ source "board/maxbcm/Kconfig"
|
||||
source "board/mpl/vcma9/Kconfig"
|
||||
source "board/olimex/mx23_olinuxino/Kconfig"
|
||||
source "board/phytec/pcm051/Kconfig"
|
||||
source "board/phytec/pcm052/Kconfig"
|
||||
source "board/ppcag/bg0900/Kconfig"
|
||||
source "board/samsung/smdk2410/Kconfig"
|
||||
source "board/sandisk/sansa_fuze_plus/Kconfig"
|
||||
|
||||
@@ -54,12 +54,12 @@ unsigned int get_hclk_pll_rate(void)
|
||||
if (fref > 27000000ULL || fref < 1000000ULL)
|
||||
return 0;
|
||||
|
||||
fout = fref * m_div;
|
||||
if (val & CLK_HCLK_PLL_FEEDBACK) {
|
||||
fcco = fout;
|
||||
fcco = fref * m_div;
|
||||
fout = fcco;
|
||||
if (val & CLK_HCLK_PLL_FEEDBACK)
|
||||
fcco *= p_div;
|
||||
else
|
||||
do_div(fout, p_div);
|
||||
} else
|
||||
fcco = fout * p_div;
|
||||
|
||||
if (fcco > 320000000ULL || fcco < 156000000ULL)
|
||||
return 0;
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <tsec.h>
|
||||
#include <netdev.h>
|
||||
#include <fsl_esdhc.h>
|
||||
#include <config.h>
|
||||
#include <fsl_wdog.h>
|
||||
|
||||
#include "fsl_epu.h"
|
||||
|
||||
@@ -354,3 +356,16 @@ void smp_kick_all_cpus(void)
|
||||
asm volatile("sev");
|
||||
}
|
||||
#endif
|
||||
|
||||
void reset_cpu(ulong addr)
|
||||
{
|
||||
struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
|
||||
|
||||
clrbits_be16(&wdog->wcr, WCR_SRS);
|
||||
|
||||
while (1) {
|
||||
/*
|
||||
* Let the watchdog trigger
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,6 +535,8 @@ int enable_fec_anatop_clock(int fec_id, enum enet_freq freq)
|
||||
if (freq < ENET_25MHZ || freq > ENET_125MHZ)
|
||||
return -EINVAL;
|
||||
|
||||
reg = readl(&anatop->pll_enet);
|
||||
|
||||
if (fec_id == 0) {
|
||||
reg &= ~BM_ANADIG_PLL_ENET_DIV_SELECT;
|
||||
reg |= BF_ANADIG_PLL_ENET_DIV_SELECT(freq);
|
||||
|
||||
@@ -53,6 +53,20 @@ _secure_monitor:
|
||||
bl psci_arch_init
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARM_ERRATA_773022
|
||||
mrc p15, 0, r5, c1, c0, 1
|
||||
orr r5, r5, #(1 << 1)
|
||||
mcr p15, 0, r5, c1, c0, 1
|
||||
isb
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARM_ERRATA_774769
|
||||
mrc p15, 0, r5, c1, c0, 1
|
||||
orr r5, r5, #(1 << 25)
|
||||
mcr p15, 0, r5, c1, c0, 1
|
||||
isb
|
||||
#endif
|
||||
|
||||
mrc p15, 0, r5, c1, c1, 0 @ read SCR
|
||||
bic r5, r5, #0x4a @ clear IRQ, EA, nET bits
|
||||
orr r5, r5, #0x31 @ enable NS, AW, FW bits
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/spl.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <asm/arch/timer.h>
|
||||
#include <asm/arch/tzpc.h>
|
||||
@@ -152,7 +153,7 @@ u32 spl_boot_device(void)
|
||||
* binary over USB. If it is found, it determines where SPL was
|
||||
* read from.
|
||||
*/
|
||||
if (readl(4) != 0x4E4F4765 || readl(8) != 0x3054422E) /* eGON.BT0 */
|
||||
if (!is_boot0_magic(SPL_ADDR + 4)) /* eGON.BT0 */
|
||||
return BOOT_DEVICE_BOARD;
|
||||
|
||||
/* The BROM will try to boot from mmc0 first, so try that first. */
|
||||
@@ -198,11 +199,6 @@ void board_init_f(ulong dummy)
|
||||
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
|
||||
#endif
|
||||
sunxi_board_init();
|
||||
|
||||
/* Clear the BSS. */
|
||||
memset(__bss_start, 0, __bss_end - __bss_start);
|
||||
|
||||
board_init_r(NULL, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ ENDPROC(__asm_flush_dcache_all)
|
||||
|
||||
ENTRY(__asm_invalidate_dcache_all)
|
||||
mov x16, lr
|
||||
mov x0, #0xffff
|
||||
mov x0, #0x1
|
||||
bl __asm_dcache_all
|
||||
mov lr, x16
|
||||
ret
|
||||
|
||||
@@ -59,15 +59,15 @@ static void mmu_setup(void)
|
||||
el = current_el();
|
||||
if (el == 1) {
|
||||
set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
|
||||
TCR_FLAGS | TCR_EL1_IPS_BITS,
|
||||
TCR_EL1_RSVD | TCR_FLAGS | TCR_EL1_IPS_BITS,
|
||||
MEMORY_ATTRIBUTES);
|
||||
} else if (el == 2) {
|
||||
set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
|
||||
TCR_FLAGS | TCR_EL2_IPS_BITS,
|
||||
TCR_EL2_RSVD | TCR_FLAGS | TCR_EL2_IPS_BITS,
|
||||
MEMORY_ATTRIBUTES);
|
||||
} else {
|
||||
set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
|
||||
TCR_FLAGS | TCR_EL3_IPS_BITS,
|
||||
TCR_EL3_RSVD | TCR_FLAGS | TCR_EL3_IPS_BITS,
|
||||
MEMORY_ATTRIBUTES);
|
||||
}
|
||||
/* enable the mmu */
|
||||
|
||||
@@ -153,11 +153,13 @@ dtb-$(CONFIG_MACH_SUN8I_A23) += \
|
||||
sun8i-a23-evb.dtb \
|
||||
sun8i-a23-gt90h-v4.dtb \
|
||||
sun8i-a23-ippo-q8h-v5.dtb \
|
||||
sun8i-a23-ippo-q8h-v1.2.dtb
|
||||
sun8i-a23-ippo-q8h-v1.2.dtb \
|
||||
sun8i-a23-q8-tablet.dtb
|
||||
dtb-$(CONFIG_MACH_SUN8I_A33) += \
|
||||
sun8i-a33-et-q8-v1.6.dtb \
|
||||
sun8i-a33-ga10h-v1.1.dtb \
|
||||
sun8i-a33-ippo-q8h-v1.2.dtb \
|
||||
sun8i-a33-q8-tablet.dtb \
|
||||
sun8i-a33-sinlinx-sina33.dtb
|
||||
dtb-$(CONFIG_MACH_SUN9I) += \
|
||||
sun9i-a80-optimus.dtb \
|
||||
|
||||
@@ -117,4 +117,8 @@
|
||||
sdhci@12540000 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
dwmmc@12550000 {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
enet0_sgmii_phy = &sgmii_phy2;
|
||||
enet1_sgmii_phy = &sgmii_phy0;
|
||||
spi0 = &qspi;
|
||||
spi1 = &dspi1;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -33,6 +34,21 @@
|
||||
};
|
||||
};
|
||||
|
||||
&dspi1 {
|
||||
bus-num = <0>;
|
||||
status = "okay";
|
||||
|
||||
dspiflash: at26df081a@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
compatible = "spi-flash";
|
||||
spi-max-frequency = <16000000>;
|
||||
spi-cpol;
|
||||
spi-cpha;
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -69,6 +69,9 @@
|
||||
};
|
||||
|
||||
&mmc0 {
|
||||
status = "okay";
|
||||
u-boot,dm-pre-reloc;
|
||||
|
||||
cd-gpios = <&portb 18 0>;
|
||||
vmmc-supply = <®ulator_3_3v>;
|
||||
vqmmc-supply = <®ulator_3_3v>;
|
||||
|
||||
65
arch/arm/dts/sun8i-a23-q8-tablet.dts
Normal file
65
arch/arm/dts/sun8i-a23-q8-tablet.dts
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2015 Hans de Goede <hdegoede@redhat.com>
|
||||
*
|
||||
* This file is dual-licensed: you can use it either under the terms
|
||||
* of the GPL or the X11 license, at your option. Note that this dual
|
||||
* licensing only applies to this file, and not this project as a
|
||||
* whole.
|
||||
*
|
||||
* a) This file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* Or, alternatively,
|
||||
*
|
||||
* b) 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 AUTHORS OR COPYRIGHT
|
||||
* HOLDERS 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.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include "sun8i-a23.dtsi"
|
||||
#include "sun8i-q8-common.dtsi"
|
||||
|
||||
/ {
|
||||
model = "Q8 A23 Tablet";
|
||||
compatible = "allwinner,q8-a23", "allwinner,sun8i-a23";
|
||||
};
|
||||
|
||||
/*
|
||||
* FIXME for now we only support host mode and rely on u-boot to have
|
||||
* turned on Vbus which is controlled by the axp223 pmic on the board.
|
||||
*
|
||||
* Once we have axp223 support we should switch to fully supporting otg.
|
||||
*/
|
||||
&usb_otg {
|
||||
dr_mode = "host";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usbphy {
|
||||
status = "okay";
|
||||
};
|
||||
65
arch/arm/dts/sun8i-a33-q8-tablet.dts
Normal file
65
arch/arm/dts/sun8i-a33-q8-tablet.dts
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2015 Hans de Goede <hdegoede@redhat.com>
|
||||
*
|
||||
* This file is dual-licensed: you can use it either under the terms
|
||||
* of the GPL or the X11 license, at your option. Note that this dual
|
||||
* licensing only applies to this file, and not this project as a
|
||||
* whole.
|
||||
*
|
||||
* a) This file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* Or, alternatively,
|
||||
*
|
||||
* b) 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 AUTHORS OR COPYRIGHT
|
||||
* HOLDERS 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.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include "sun8i-a33.dtsi"
|
||||
#include "sun8i-q8-common.dtsi"
|
||||
|
||||
/ {
|
||||
model = "Q8 A33 Tablet";
|
||||
compatible = "allwinner,q8-a33", "allwinner,sun8i-a33";
|
||||
};
|
||||
|
||||
/*
|
||||
* FIXME for now we only support host mode and rely on u-boot to have
|
||||
* turned on Vbus which is controlled by the axp223 pmic on the board.
|
||||
*
|
||||
* Once we have axp223 support we should switch to fully supporting otg.
|
||||
*/
|
||||
&usb_otg {
|
||||
dr_mode = "host";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usbphy {
|
||||
status = "okay";
|
||||
};
|
||||
84
arch/arm/dts/sun8i-q8-common.dtsi
Normal file
84
arch/arm/dts/sun8i-q8-common.dtsi
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 2015 Hans de Goede <hdegoede@redhat.com>
|
||||
*
|
||||
* This file is dual-licensed: you can use it either under the terms
|
||||
* of the GPL or the X11 license, at your option. Note that this dual
|
||||
* licensing only applies to this file, and not this project as a
|
||||
* whole.
|
||||
*
|
||||
* a) This file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* Or, alternatively,
|
||||
*
|
||||
* b) 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 AUTHORS OR COPYRIGHT
|
||||
* HOLDERS 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.
|
||||
*/
|
||||
#include "sunxi-q8-common.dtsi"
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
serial0 = &r_uart;
|
||||
};
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
};
|
||||
|
||||
&mmc0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_q8>;
|
||||
vmmc-supply = <®_vcc3v0>;
|
||||
bus-width = <4>;
|
||||
cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
|
||||
cd-inverted;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pio {
|
||||
bl_en_pin_q8: bl_en_pin@0 {
|
||||
allwinner,pins = "PH6";
|
||||
allwinner,function = "gpio_in";
|
||||
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
|
||||
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
|
||||
};
|
||||
|
||||
mmc0_cd_pin_q8: mmc0_cd_pin@0 {
|
||||
allwinner,pins = "PB4";
|
||||
allwinner,function = "gpio_in";
|
||||
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
|
||||
allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
|
||||
};
|
||||
};
|
||||
|
||||
&r_uart {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&r_uart_pins_a>;
|
||||
status = "okay";
|
||||
};
|
||||
@@ -12,9 +12,9 @@
|
||||
#include <asm/arch/iomux-vf610.h>
|
||||
#include <asm/arch/ddrmc-vf610.h>
|
||||
|
||||
void ddrmc_setup_iomux(void)
|
||||
void ddrmc_setup_iomux(const iomux_v3_cfg_t *pads, int pads_count)
|
||||
{
|
||||
static const iomux_v3_cfg_t ddr_pads[] = {
|
||||
static const iomux_v3_cfg_t default_pads[] = {
|
||||
VF610_PAD_DDR_A15__DDR_A_15,
|
||||
VF610_PAD_DDR_A14__DDR_A_14,
|
||||
VF610_PAD_DDR_A13__DDR_A_13,
|
||||
@@ -65,76 +65,54 @@ void ddrmc_setup_iomux(void)
|
||||
VF610_PAD_DDR_RESETB,
|
||||
};
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(ddr_pads, ARRAY_SIZE(ddr_pads));
|
||||
if ((pads == NULL) || (pads_count == 0)) {
|
||||
pads = default_pads;
|
||||
pads_count = ARRAY_SIZE(default_pads);
|
||||
}
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(pads, pads_count);
|
||||
}
|
||||
|
||||
void ddrmc_phy_init(void)
|
||||
{
|
||||
struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR;
|
||||
static struct ddrmc_phy_setting default_phy_settings[] = {
|
||||
{ DDRMC_PHY_DQ_TIMING, 0 },
|
||||
{ DDRMC_PHY_DQ_TIMING, 16 },
|
||||
{ DDRMC_PHY_DQ_TIMING, 32 },
|
||||
|
||||
writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[0]);
|
||||
writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[16]);
|
||||
writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[32]);
|
||||
{ DDRMC_PHY_DQS_TIMING, 1 },
|
||||
{ DDRMC_PHY_DQS_TIMING, 17 },
|
||||
|
||||
writel(DDRMC_PHY_DQS_TIMING, &ddrmr->phy[1]);
|
||||
writel(DDRMC_PHY_DQS_TIMING, &ddrmr->phy[17]);
|
||||
{ DDRMC_PHY_CTRL, 2 },
|
||||
{ DDRMC_PHY_CTRL, 18 },
|
||||
{ DDRMC_PHY_CTRL, 34 },
|
||||
|
||||
writel(DDRMC_PHY_CTRL, &ddrmr->phy[2]);
|
||||
writel(DDRMC_PHY_CTRL, &ddrmr->phy[18]);
|
||||
writel(DDRMC_PHY_CTRL, &ddrmr->phy[34]);
|
||||
{ DDRMC_PHY_MASTER_CTRL, 3 },
|
||||
{ DDRMC_PHY_MASTER_CTRL, 19 },
|
||||
{ DDRMC_PHY_MASTER_CTRL, 35 },
|
||||
|
||||
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]);
|
||||
{ DDRMC_PHY_SLAVE_CTRL, 4 },
|
||||
{ DDRMC_PHY_SLAVE_CTRL, 20 },
|
||||
{ DDRMC_PHY_SLAVE_CTRL, 36 },
|
||||
|
||||
/* LPDDR2 only parameter */
|
||||
writel(DDRMC_PHY_OFF, &ddrmr->phy[49]);
|
||||
{ DDRMC_PHY_OFF, 49 },
|
||||
|
||||
writel(DDRMC_PHY50_DDR3_MODE |
|
||||
DDRMC_PHY50_EN_SW_HALF_CYCLE, &ddrmr->phy[50]);
|
||||
{ DDRMC_PHY50_DDR3_MODE | DDRMC_PHY50_EN_SW_HALF_CYCLE, 50 },
|
||||
|
||||
/* Processor Pad ODT settings */
|
||||
writel(DDRMC_PHY_PROC_PAD_ODT, &ddrmr->phy[52]);
|
||||
}
|
||||
{ DDRMC_PHY_PROC_PAD_ODT, 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]);
|
||||
}
|
||||
/* end marker */
|
||||
{ 0, -1 }
|
||||
};
|
||||
|
||||
void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,
|
||||
struct ddrmc_lvl_info *lvl,
|
||||
int col_diff, int row_diff)
|
||||
struct ddrmc_cr_setting *board_cr_settings,
|
||||
struct ddrmc_phy_setting *board_phy_settings,
|
||||
int col_diff, int row_diff)
|
||||
{
|
||||
struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR;
|
||||
struct ddrmc_cr_setting *cr_setting;
|
||||
struct ddrmc_phy_setting *phy_setting;
|
||||
|
||||
writel(DDRMC_CR00_DRAM_CLASS_DDR3, &ddrmr->cr[0]);
|
||||
writel(DDRMC_CR02_DRAM_TINIT(timings->tinit), &ddrmr->cr[2]);
|
||||
@@ -144,7 +122,9 @@ void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,
|
||||
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]);
|
||||
DDRMC_CR13_TCCD(timings->tccd) |
|
||||
DDRMC_CR13_TBST_INT_INTERVAL(timings->tbst_int_interval),
|
||||
&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]);
|
||||
@@ -156,18 +136,19 @@ void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,
|
||||
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_CR21_TRCD_INT(timings->trcd_int) | DDRMC_CR21_CCMAP_EN |
|
||||
DDRMC_CR21_TRAS_LOCKOUT(timings->tras_lockout),
|
||||
&ddrmr->cr[21]);
|
||||
|
||||
writel(DDRMC_CR22_TDAL(timings->tdal), &ddrmr->cr[22]);
|
||||
writel(DDRMC_CR23_BSTLEN(3) |
|
||||
writel(DDRMC_CR23_BSTLEN(timings->bstlen) |
|
||||
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_CR28_TREF_INT(timings->tref_int), &ddrmr->cr[28]);
|
||||
writel(DDRMC_CR29_TPDEX(timings->tpdex), &ddrmr->cr[29]);
|
||||
|
||||
writel(DDRMC_CR30_TXPDLL(timings->txpdll), &ddrmr->cr[30]);
|
||||
@@ -177,7 +158,7 @@ void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,
|
||||
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_CR38_FREQ_CHG_EN(timings->freq_chg_en), &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]);
|
||||
|
||||
@@ -191,13 +172,14 @@ void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,
|
||||
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_CR72_ZQCS_ROTATE(timings->zqcs_rotate), &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),
|
||||
DDRMC_CR74_CMD_AGE_CNT(timings->cmd_age_cnt) |
|
||||
DDRMC_CR74_AGE_CNT(timings->age_cnt),
|
||||
&ddrmr->cr[74]);
|
||||
writel(DDRMC_CR75_RW_PG_EN | DDRMC_CR75_RW_EN | DDRMC_CR75_PRI_EN |
|
||||
DDRMC_CR75_PLEN, &ddrmr->cr[75]);
|
||||
@@ -205,13 +187,15 @@ void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,
|
||||
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) |
|
||||
writel(DDRMC_CR78_Q_FULLNESS(timings->q_fullness) |
|
||||
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_CR87_ODT_RD_MAPCS0(timings->odt_rd_mapcs0) |
|
||||
DDRMC_CR87_ODT_WR_MAPCS0(timings->odt_wr_mapcs0),
|
||||
&ddrmr->cr[87]);
|
||||
writel(DDRMC_CR88_TODTL_CMD(4), &ddrmr->cr[88]);
|
||||
writel(DDRMC_CR89_AODT_RWSMCS(2), &ddrmr->cr[89]);
|
||||
|
||||
@@ -219,58 +203,33 @@ void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,
|
||||
writel(DDRMC_CR96_WLMRD(timings->wlmrd) |
|
||||
DDRMC_CR96_WLDQSEN(timings->wldqsen), &ddrmr->cr[96]);
|
||||
|
||||
if (lvl != NULL)
|
||||
ddrmc_ctrl_lvl_init(lvl);
|
||||
/* execute custom CR setting sequence (may be NULL) */
|
||||
cr_setting = board_cr_settings;
|
||||
if (cr_setting != NULL)
|
||||
while (cr_setting->cr_rnum >= 0) {
|
||||
writel(cr_setting->setting,
|
||||
&ddrmr->cr[cr_setting->cr_rnum]);
|
||||
cr_setting++;
|
||||
}
|
||||
|
||||
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]);
|
||||
/* perform default PHY settings (may be overriden by custom settings */
|
||||
phy_setting = default_phy_settings;
|
||||
while (phy_setting->phy_rnum >= 0) {
|
||||
writel(phy_setting->setting,
|
||||
&ddrmr->phy[phy_setting->phy_rnum]);
|
||||
phy_setting++;
|
||||
}
|
||||
|
||||
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();
|
||||
/* execute custom PHY setting sequence (may be NULL) */
|
||||
phy_setting = board_phy_settings;
|
||||
if (phy_setting != NULL)
|
||||
while (phy_setting->phy_rnum >= 0) {
|
||||
writel(phy_setting->setting,
|
||||
&ddrmr->phy[phy_setting->phy_rnum]);
|
||||
phy_setting++;
|
||||
}
|
||||
|
||||
/* all inits done, start the DDR controller */
|
||||
writel(DDRMC_CR00_DRAM_CLASS_DDR3 | DDRMC_CR00_START, &ddrmr->cr[0]);
|
||||
|
||||
while (!(readl(&ddrmr->cr[80]) && 0x100))
|
||||
|
||||
@@ -70,7 +70,7 @@ struct emc_regs {
|
||||
|
||||
/* Static Memory Delay Registers */
|
||||
#define EMC_STAT_WAITWEN(n) (((n) - 1) & 0x0F)
|
||||
#define EMC_STAT_WAITOEN(n) (((n) - 1) & 0x0F)
|
||||
#define EMC_STAT_WAITOEN(n) ((n) & 0x0F)
|
||||
#define EMC_STAT_WAITRD(n) (((n) - 1) & 0x1F)
|
||||
#define EMC_STAT_WAITPAGE(n) (((n) - 1) & 0x1F)
|
||||
#define EMC_STAT_WAITWR(n) (((n) - 2) & 0x1F)
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#define IOMUXC_GPR1_REF_SSP_EN (1 << 16)
|
||||
#define IOMUXC_GPR1_TEST_POWERDOWN (1 << 18)
|
||||
|
||||
#define IOMUXC_GPR1_PCIE_SW_RST (1 << 29)
|
||||
|
||||
/*
|
||||
* IOMUXC_GPR5 bit fields
|
||||
*/
|
||||
|
||||
@@ -1,20 +1,50 @@
|
||||
/*
|
||||
* This is a copy of omap3/spl.h:
|
||||
*
|
||||
* (C) Copyright 2012
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* (C) Copyright 2007-2011
|
||||
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
|
||||
* Tom Cubie <tangliang@allwinnertech.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
#ifndef _ASM_ARCH_SPL_H_
|
||||
#define _ASM_ARCH_SPL_H_
|
||||
|
||||
#define BOOT_DEVICE_NONE 0
|
||||
#define BOOT_DEVICE_XIP 1
|
||||
#define BOOT_DEVICE_NAND 2
|
||||
#define BOOT_DEVICE_ONE_NAND 3
|
||||
#define BOOT_DEVICE_MMC2 5 /*emmc*/
|
||||
#define BOOT_DEVICE_MMC1 6
|
||||
#define BOOT_DEVICE_XIPWAIT 7
|
||||
#define BOOT_DEVICE_MMC2_2 0xff
|
||||
#define BOOT0_MAGIC "eGON.BT0"
|
||||
#define SPL_SIGNATURE "SPL" /* marks "sunxi" SPL header */
|
||||
#define SPL_HEADER_VERSION 1
|
||||
|
||||
/* Note: A80 will require special handling here: SPL_ADDR 0x10000 */
|
||||
#define SPL_ADDR 0x0
|
||||
|
||||
/* boot head definition from sun4i boot code */
|
||||
struct boot_file_head {
|
||||
uint32_t b_instruction; /* one intruction jumping to real code */
|
||||
uint8_t magic[8]; /* ="eGON.BT0" or "eGON.BT1", not C-style str */
|
||||
uint32_t check_sum; /* generated by PC */
|
||||
uint32_t length; /* generated by PC */
|
||||
/*
|
||||
* We use a simplified header, only filling in what is needed
|
||||
* by the boot ROM. To be compatible with Allwinner tools we
|
||||
* would need to implement the proper fields here instead of
|
||||
* padding.
|
||||
*
|
||||
* Actually we want the ability to recognize our "sunxi" variant
|
||||
* of the SPL. To do so, let's place a special signature into the
|
||||
* "pub_head_size" field. We can reasonably expect Allwinner's
|
||||
* boot0 to always have the upper 16 bits of this set to 0 (after
|
||||
* all the value shouldn't be larger than the limit imposed by
|
||||
* SRAM size).
|
||||
* If the signature is present (at 0x14), then we know it's safe
|
||||
* to use the remaining 8 bytes (at 0x18) for our own purposes.
|
||||
* (E.g. sunxi-tools "fel" utility can pass information there.)
|
||||
*/
|
||||
union {
|
||||
uint32_t pub_head_size;
|
||||
uint8_t spl_signature[4];
|
||||
};
|
||||
uint32_t fel_script_address;
|
||||
uint32_t reserved; /* padding, align to 32 bytes */
|
||||
};
|
||||
|
||||
#define is_boot0_magic(addr) (memcmp((void *)addr, BOOT0_MAGIC, 8) == 0)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,18 +11,6 @@
|
||||
#ifndef __ASM_ARCH_VF610_DDRMC_H
|
||||
#define __ASM_ARCH_VF610_DDRMC_H
|
||||
|
||||
struct ddrmc_lvl_info {
|
||||
u16 wrlvl_reg_en;
|
||||
u16 wrlvl_dl_0;
|
||||
u16 wrlvl_dl_1;
|
||||
u16 rdlvl_gt_reg_en;
|
||||
u16 rdlvl_gt_dl_0;
|
||||
u16 rdlvl_gt_dl_1;
|
||||
u16 rdlvl_reg_en;
|
||||
u16 rdlvl_dl_0;
|
||||
u16 rdlvl_dl_1;
|
||||
};
|
||||
|
||||
struct ddr3_jedec_timings {
|
||||
u8 tinit;
|
||||
u32 trst_pwron;
|
||||
@@ -32,6 +20,7 @@ struct ddr3_jedec_timings {
|
||||
u8 trc;
|
||||
u8 trrd;
|
||||
u8 tccd;
|
||||
u8 tbst_int_interval;
|
||||
u8 tfaw;
|
||||
u8 trp;
|
||||
u8 twtr;
|
||||
@@ -43,30 +32,51 @@ struct ddr3_jedec_timings {
|
||||
u8 tckesr;
|
||||
u8 tcke;
|
||||
u8 trcd_int;
|
||||
u8 tras_lockout;
|
||||
u8 tdal;
|
||||
u8 bstlen;
|
||||
u16 tdll;
|
||||
u8 trp_ab;
|
||||
u16 tref;
|
||||
u8 trfc;
|
||||
u16 tref_int;
|
||||
u8 tpdex;
|
||||
u8 txpdll;
|
||||
u8 txsnr;
|
||||
u16 txsr;
|
||||
u8 cksrx;
|
||||
u8 cksre;
|
||||
u8 freq_chg_en;
|
||||
u16 zqcl;
|
||||
u16 zqinit;
|
||||
u8 zqcs;
|
||||
u8 ref_per_zq;
|
||||
u8 zqcs_rotate;
|
||||
u8 aprebit;
|
||||
u8 cmd_age_cnt;
|
||||
u8 age_cnt;
|
||||
u8 q_fullness;
|
||||
u8 odt_rd_mapcs0;
|
||||
u8 odt_wr_mapcs0;
|
||||
u8 wlmrd;
|
||||
u8 wldqsen;
|
||||
};
|
||||
|
||||
void ddrmc_setup_iomux(void);
|
||||
struct ddrmc_cr_setting {
|
||||
u32 setting;
|
||||
int cr_rnum; /* CR register ; -1 for last entry */
|
||||
};
|
||||
|
||||
struct ddrmc_phy_setting {
|
||||
u32 setting;
|
||||
int phy_rnum; /* PHY register ; -1 for last entry */
|
||||
};
|
||||
|
||||
void ddrmc_setup_iomux(const iomux_v3_cfg_t *pads, int pads_count);
|
||||
void ddrmc_phy_init(void);
|
||||
void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,
|
||||
struct ddrmc_lvl_info *lvl,
|
||||
int col_diff, int row_diff);
|
||||
struct ddrmc_cr_setting *board_cr_settings,
|
||||
struct ddrmc_phy_setting *board_phy_settings,
|
||||
int col_diff, int row_diff);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
#define DDRMC_CR18_TCKE(v) ((v) & 0x7)
|
||||
#define DDRMC_CR20_AP_EN (1 << 24)
|
||||
#define DDRMC_CR21_TRCD_INT(v) (((v) & 0xff) << 16)
|
||||
#define DDRMC_CR21_TRAS_LOCKOUT (1 << 8)
|
||||
#define DDRMC_CR21_TRAS_LOCKOUT(v) ((v) << 8)
|
||||
#define DDRMC_CR21_CCMAP_EN 1
|
||||
#define DDRMC_CR22_TDAL(v) (((v) & 0x3f) << 16)
|
||||
#define DDRMC_CR23_BSTLEN(v) (((v) & 0x7) << 24)
|
||||
@@ -200,8 +200,8 @@
|
||||
#define DDRMC_CR78_BUR_ON_FLY_BIT(v) ((v) & 0xf)
|
||||
#define DDRMC_CR79_CTLUPD_AREF(v) (((v) & 0x1) << 24)
|
||||
#define DDRMC_CR82_INT_MASK 0x10000000
|
||||
#define DDRMC_CR87_ODT_WR_MAPCS0 (1 << 24)
|
||||
#define DDRMC_CR87_ODT_RD_MAPCS0 (1 << 16)
|
||||
#define DDRMC_CR87_ODT_WR_MAPCS0(v) ((v) << 24)
|
||||
#define DDRMC_CR87_ODT_RD_MAPCS0(v) ((v) << 16)
|
||||
#define DDRMC_CR88_TODTL_CMD(v) (((v) & 0x1f) << 16)
|
||||
#define DDRMC_CR89_AODT_RWSMCS(v) ((v) & 0xf)
|
||||
#define DDRMC_CR91_R2W_SMCSDL(v) (((v) & 0x7) << 16)
|
||||
|
||||
@@ -103,13 +103,17 @@
|
||||
#define TCR_EL2_IPS_BITS (3 << 16) /* 42 bits physical address */
|
||||
#define TCR_EL3_IPS_BITS (3 << 16) /* 42 bits physical address */
|
||||
|
||||
/* PTWs cacheable, inner/outer WBWA and non-shareable */
|
||||
/* PTWs cacheable, inner/outer WBWA and inner shareable */
|
||||
#define TCR_FLAGS (TCR_TG0_64K | \
|
||||
TCR_SHARED_NON | \
|
||||
TCR_SHARED_INNER | \
|
||||
TCR_ORGN_WBWA | \
|
||||
TCR_IRGN_WBWA | \
|
||||
TCR_T0SZ(VA_BITS))
|
||||
|
||||
#define TCR_EL1_RSVD (1 << 31)
|
||||
#define TCR_EL2_RSVD (1 << 31 | 1 << 23)
|
||||
#define TCR_EL3_RSVD (1 << 31 | 1 << 23)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
void set_pgtable_section(u64 *page_table, u64 index,
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#define L2X0_CTRL_EN 1
|
||||
|
||||
#define L310_SHARED_ATT_OVERRIDE_ENABLE (1 << 22)
|
||||
#define L310_AUX_CTRL_DATA_PREFETCH_MASK (1 << 28)
|
||||
#define L310_AUX_CTRL_INST_PREFETCH_MASK (1 << 29)
|
||||
|
||||
struct pl310_regs {
|
||||
u32 pl310_cache_id;
|
||||
|
||||
@@ -194,7 +194,7 @@ void save_boot_params_ret(void);
|
||||
static inline unsigned int get_cr(void)
|
||||
{
|
||||
unsigned int val;
|
||||
asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
|
||||
asm volatile("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
* the GD ('global data') structure, both located in some readily
|
||||
* available RAM (SRAM, locked cache...). In this context, VARIABLE
|
||||
* global data, initialized or not (BSS), are UNAVAILABLE; only
|
||||
* CONSTANT initialized data are available.
|
||||
* CONSTANT initialized data are available. GD should be zeroed
|
||||
* before board_init_f() is called.
|
||||
*
|
||||
* 2. Call board_init_f(). This function prepares the hardware for
|
||||
* execution from system RAM (DRAM, DDR...) As system RAM may not
|
||||
@@ -34,24 +35,29 @@
|
||||
* data include the relocation destination, the future stack, and
|
||||
* the future GD location.
|
||||
*
|
||||
* (the following applies only to non-SPL builds)
|
||||
*
|
||||
* 3. Set up intermediate environment where the stack and GD are the
|
||||
* ones allocated by board_init_f() in system RAM, but BSS and
|
||||
* initialized non-const data are still not available.
|
||||
*
|
||||
* 4. Call relocate_code(). This function relocates U-Boot from its
|
||||
* current location into the relocation destination computed by
|
||||
* board_init_f().
|
||||
* 4a.For U-Boot proper (not SPL), call relocate_code(). This function
|
||||
* relocates U-Boot from its current location into the relocation
|
||||
* destination computed by board_init_f().
|
||||
*
|
||||
* 4b.For SPL, board_init_f() just returns (to crt0). There is no
|
||||
* code relocation in SPL.
|
||||
*
|
||||
* 5. Set up final environment for calling board_init_r(). This
|
||||
* environment has BSS (initialized to 0), initialized non-const
|
||||
* data (initialized to their intended value), and stack in system
|
||||
* RAM. GD has retained values set by board_init_f(). Some CPUs
|
||||
* have some work left to do at this point regarding memory, so
|
||||
* call c_runtime_cpu_setup.
|
||||
* RAM (for SPL moving the stack and GD into RAM is optional - see
|
||||
* CONFIG_SPL_STACK_R). GD has retained values set by board_init_f().
|
||||
*
|
||||
* 6. Branch to board_init_r().
|
||||
* 6. For U-Boot proper (not SPL), some CPUs have some work left to do
|
||||
* at this point regarding memory, so call c_runtime_cpu_setup.
|
||||
*
|
||||
* 7. Branch to board_init_r().
|
||||
*
|
||||
* For more information see 'Board Initialisation Flow in README.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
* the GD ('global data') structure, both located in some readily
|
||||
* available RAM (SRAM, locked cache...). In this context, VARIABLE
|
||||
* global data, initialized or not (BSS), are UNAVAILABLE; only
|
||||
* CONSTANT initialized data are available.
|
||||
* CONSTANT initialized data are available. GD should be zeroed
|
||||
* before board_init_f() is called.
|
||||
*
|
||||
* 2. Call board_init_f(). This function prepares the hardware for
|
||||
* execution from system RAM (DRAM, DDR...) As system RAM may not
|
||||
@@ -36,24 +37,31 @@
|
||||
* data include the relocation destination, the future stack, and
|
||||
* the future GD location.
|
||||
*
|
||||
* (the following applies only to non-SPL builds)
|
||||
*
|
||||
* 3. Set up intermediate environment where the stack and GD are the
|
||||
* ones allocated by board_init_f() in system RAM, but BSS and
|
||||
* initialized non-const data are still not available.
|
||||
*
|
||||
* 4. Call relocate_code(). This function relocates U-Boot from its
|
||||
* current location into the relocation destination computed by
|
||||
* board_init_f().
|
||||
* 4a.For U-Boot proper (not SPL), call relocate_code(). This function
|
||||
* relocates U-Boot from its current location into the relocation
|
||||
* destination computed by board_init_f().
|
||||
*
|
||||
* 4b.For SPL, board_init_f() just returns (to crt0). There is no
|
||||
* code relocation in SPL.
|
||||
*
|
||||
* 5. Set up final environment for calling board_init_r(). This
|
||||
* environment has BSS (initialized to 0), initialized non-const
|
||||
* data (initialized to their intended value), and stack in system
|
||||
* RAM. GD has retained values set by board_init_f(). Some CPUs
|
||||
* have some work left to do at this point regarding memory, so
|
||||
* call c_runtime_cpu_setup.
|
||||
* RAM (for SPL moving the stack and GD into RAM is optional - see
|
||||
* CONFIG_SPL_STACK_R). GD has retained values set by board_init_f().
|
||||
*
|
||||
* 6. Branch to board_init_r().
|
||||
* TODO: For SPL, implement stack relocation on AArch64.
|
||||
*
|
||||
* 6. For U-Boot proper (not SPL), some CPUs have some work left to do
|
||||
* at this point regarding memory, so call c_runtime_cpu_setup.
|
||||
*
|
||||
* 7. Branch to board_init_r().
|
||||
*
|
||||
* For more information see 'Board Initialisation Flow in README.
|
||||
*/
|
||||
|
||||
ENTRY(_main)
|
||||
@@ -106,6 +114,8 @@ relocation_return:
|
||||
*/
|
||||
bl c_runtime_cpu_setup /* still call old routine */
|
||||
|
||||
/* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */
|
||||
|
||||
/*
|
||||
* Clear BSS section
|
||||
*/
|
||||
|
||||
@@ -46,11 +46,19 @@ ENTRY(gic_init_secure)
|
||||
ldr w9, [x0, GICD_TYPER]
|
||||
and w10, w9, #0x1f /* ITLinesNumber */
|
||||
cbz w10, 1f /* No SPIs */
|
||||
add x11, x0, (GICD_IGROUPRn + 4)
|
||||
add x11, x0, GICD_IGROUPRn
|
||||
mov w9, #~0 /* Config SPIs as Grp1 */
|
||||
str w9, [x11], #0x4
|
||||
0: str w9, [x11], #0x4
|
||||
sub w10, w10, #0x1
|
||||
cbnz w10, 0b
|
||||
|
||||
ldr x1, =GICC_BASE /* GICC_CTLR */
|
||||
mov w0, #3 /* EnableGrp0 | EnableGrp1 */
|
||||
str w0, [x1]
|
||||
|
||||
mov w0, #1 << 7 /* allow NS access to GICC_PMR */
|
||||
str w0, [x1, #4] /* GICC_PMR */
|
||||
#endif
|
||||
1:
|
||||
ret
|
||||
|
||||
@@ -150,6 +150,7 @@ struct bcm2835_mbox_tag_hdr {
|
||||
#define BCM2835_BOARD_REV_A_PLUS 0x12
|
||||
#define BCM2835_BOARD_REV_B_PLUS_13 0x13
|
||||
#define BCM2835_BOARD_REV_CM_14 0x14
|
||||
#define BCM2835_BOARD_REV_A_PLUS_15 0x15
|
||||
#endif
|
||||
|
||||
struct bcm2835_mbox_tag_get_board_rev {
|
||||
|
||||
@@ -1661,6 +1661,9 @@ unsigned long get_mmc_clk(int dev_index)
|
||||
{
|
||||
enum periph_id id;
|
||||
|
||||
if (cpu_is_exynos4())
|
||||
return exynos4_get_mmc_clk(dev_index);
|
||||
|
||||
switch (dev_index) {
|
||||
case 0:
|
||||
id = PERIPH_ID_SDMMC0;
|
||||
@@ -1679,12 +1682,7 @@ unsigned long get_mmc_clk(int dev_index)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cpu_is_exynos5())
|
||||
return clock_get_periph_rate(id);
|
||||
else if (cpu_is_exynos4())
|
||||
return exynos4_get_mmc_clk(dev_index);
|
||||
|
||||
return 0;
|
||||
return clock_get_periph_rate(id);
|
||||
}
|
||||
|
||||
void set_mmc_clk(int dev_index, unsigned int div)
|
||||
|
||||
@@ -33,6 +33,11 @@ const struct keystone_pll_regs keystone_pll_regs[] = {
|
||||
[DDR3B_PLL] = {KS2_DDR3BPLLCTL0, KS2_DDR3BPLLCTL1},
|
||||
};
|
||||
|
||||
inline void pll_pa_clk_sel(void)
|
||||
{
|
||||
setbits_le32(keystone_pll_regs[PASS_PLL].reg1, CFG_PLLCTL1_PAPLL_MASK);
|
||||
}
|
||||
|
||||
static void wait_for_completion(const struct pll_init_data *data)
|
||||
{
|
||||
int i;
|
||||
@@ -180,9 +185,8 @@ void configure_secondary_pll(const struct pll_init_data *data)
|
||||
sdelay(21000);
|
||||
|
||||
/* Select the Output of PASS PLL as input to PASS */
|
||||
if (data->pll == PASS_PLL)
|
||||
setbits_le32(keystone_pll_regs[data->pll].reg1,
|
||||
CFG_PLLCTL1_PAPLL_MASK);
|
||||
if (data->pll == PASS_PLL && cpu_is_k2hk())
|
||||
pll_pa_clk_sel();
|
||||
|
||||
/* Select the Output of ARM PLL as input to ARM */
|
||||
if (data->pll == TETRIS_PLL)
|
||||
|
||||
@@ -118,6 +118,7 @@ unsigned long clk_round_rate(unsigned int clk, unsigned long hz);
|
||||
int clk_set_rate(unsigned int clk, unsigned long hz);
|
||||
int get_max_dev_speed(void);
|
||||
int get_max_arm_speed(void);
|
||||
void pll_pa_clk_sel(void);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -214,32 +214,40 @@ static void setup_usb_phys(void)
|
||||
|
||||
int arch_cpu_init(void)
|
||||
{
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
if (mvebu_soc_family() == MVEBU_SOC_A38X) {
|
||||
struct pl310_regs *const pl310 =
|
||||
(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
|
||||
|
||||
/*
|
||||
* Only with disabled MMU its possible to switch the base
|
||||
* register address on Armada 38x. Without this the SDRAM
|
||||
* located at >= 0x4000.0000 is also not accessible, as its
|
||||
* still locked to cache.
|
||||
*
|
||||
* So to fully release / unlock this area from cache, we need
|
||||
* to first flush all caches, then disable the MMU and
|
||||
* disable the L2 cache.
|
||||
*/
|
||||
icache_disable();
|
||||
dcache_disable();
|
||||
mmu_disable();
|
||||
clrbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
|
||||
}
|
||||
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_ARMADA_38X)
|
||||
/*
|
||||
* Only with disabled MMU its possible to switch the base
|
||||
* register address on Armada 38x. Without this the SDRAM
|
||||
* located at >= 0x4000.0000 is also not accessible, as its
|
||||
* still locked to cache.
|
||||
*/
|
||||
mmu_disable();
|
||||
#endif
|
||||
|
||||
/* Linux expects the internal registers to be at 0xf1000000 */
|
||||
writel(SOC_REGS_PHY_BASE, INTREG_BASE_ADDR_REG);
|
||||
set_cbar(SOC_REGS_PHY_BASE + 0xC000);
|
||||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
/*
|
||||
* From this stage on, the SoC detection is working. As we have
|
||||
* configured the internal register base to the value used
|
||||
* in the macros / defines in the U-Boot header (soc.h).
|
||||
*/
|
||||
if (mvebu_soc_family() == MVEBU_SOC_A38X) {
|
||||
struct pl310_regs *const pl310 =
|
||||
(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
|
||||
|
||||
/*
|
||||
* To fully release / unlock this area from cache, we need
|
||||
* to flush all caches and disable the L2 cache.
|
||||
*/
|
||||
icache_disable();
|
||||
dcache_disable();
|
||||
clrbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We need to call mvebu_mbus_probe() before calling
|
||||
* update_sdram_window_sizes() as it disables all previously
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#define timestamp gd->arch.tbl
|
||||
#define lastdec gd->arch.lastinc
|
||||
|
||||
static int init_done;
|
||||
static int init_done __attribute__((section(".data"))) = 0;
|
||||
|
||||
/* Timer reload and current value registers */
|
||||
struct kwtmr_val {
|
||||
|
||||
@@ -217,6 +217,13 @@ void board_init_f(ulong dummy)
|
||||
debug("DRAM init failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now that DRAM is initialized setup base pointer for simple malloc
|
||||
* into RAM.
|
||||
*/
|
||||
gd->malloc_base = CONFIG_SPL_STACK_R_ADDR;
|
||||
gd->malloc_ptr = 0;
|
||||
}
|
||||
|
||||
static int setup_led(void)
|
||||
|
||||
@@ -52,6 +52,18 @@ void enable_caches(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void v7_outer_cache_enable(void)
|
||||
{
|
||||
/* disable the L2 cache */
|
||||
writel(0, &pl310->pl310_ctrl);
|
||||
|
||||
/* enable BRESP, instruction and data prefetch, full line of zeroes */
|
||||
setbits_le32(&pl310->pl310_aux_ctrl,
|
||||
L310_AUX_CTRL_DATA_PREFETCH_MASK |
|
||||
L310_AUX_CTRL_INST_PREFETCH_MASK |
|
||||
L310_SHARED_ATT_OVERRIDE_ENABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* DesignWare Ethernet initialization
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,8 @@ LDFLAGS_FINAL += --bss-plt
|
||||
PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections \
|
||||
-fdata-sections -mcall-linux
|
||||
|
||||
PLATFORM_CPPFLAGS += -D__powerpc__ -ffixed-r2 -m32
|
||||
PF_CPPFLAGS_POWERPC := $(call cc-option,-fno-ira-hoist-pressure,)
|
||||
PLATFORM_CPPFLAGS += -D__powerpc__ -ffixed-r2 -m32 $(PF_CPPFLAGS_POWERPC)
|
||||
PLATFORM_LDFLAGS += -m32 -melf32ppclinux
|
||||
|
||||
#
|
||||
|
||||
@@ -8,6 +8,9 @@ choice
|
||||
prompt "Target select"
|
||||
optional
|
||||
|
||||
config TARGET_LWMON5
|
||||
bool "Support lwmon5"
|
||||
|
||||
config TARGET_T3CORP
|
||||
bool "Support t3corp"
|
||||
|
||||
@@ -165,6 +168,7 @@ source "board/gdsys/405ex/Kconfig"
|
||||
source "board/gdsys/dlvision/Kconfig"
|
||||
source "board/gdsys/gdppc440etx/Kconfig"
|
||||
source "board/gdsys/intip/Kconfig"
|
||||
source "board/lwmon5/Kconfig"
|
||||
source "board/mosaixtech/icon/Kconfig"
|
||||
source "board/mpl/mip405/Kconfig"
|
||||
source "board/mpl/pip405/Kconfig"
|
||||
|
||||
@@ -106,6 +106,12 @@ struct arch_global_data {
|
||||
#ifdef CONFIG_SYS_FPGA_COUNT
|
||||
unsigned fpga_state[CONFIG_SYS_FPGA_COUNT];
|
||||
#endif
|
||||
#if defined(CONFIG_WD_MAX_RATE)
|
||||
unsigned long long wdt_last; /* trace watch-dog triggering rate */
|
||||
#endif
|
||||
#if defined(CONFIG_LWMON5)
|
||||
unsigned long kbd_status;
|
||||
#endif
|
||||
};
|
||||
|
||||
#include <asm-generic/global_data.h>
|
||||
|
||||
@@ -1,986 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2011
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio_dev.h>
|
||||
#ifdef CONFIG_8xx
|
||||
#include <mpc8xx.h>
|
||||
#endif
|
||||
#ifdef CONFIG_5xx
|
||||
#include <mpc5xx.h>
|
||||
#endif
|
||||
#ifdef CONFIG_MPC5xxx
|
||||
#include <mpc5xxx.h>
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_IDE)
|
||||
#include <ide.h>
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_SCSI)
|
||||
#include <scsi.h>
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_KGDB)
|
||||
#include <kgdb.h>
|
||||
#endif
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
#include <status_led.h>
|
||||
#endif
|
||||
#include <net.h>
|
||||
#ifdef CONFIG_GENERIC_MMC
|
||||
#include <mmc.h>
|
||||
#endif
|
||||
#include <serial.h>
|
||||
#ifdef CONFIG_SYS_ALLOC_DPRAM
|
||||
#if !defined(CONFIG_CPM2)
|
||||
#include <commproc.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <version.h>
|
||||
#if defined(CONFIG_BAB7xx)
|
||||
#include <w83c553f.h>
|
||||
#endif
|
||||
#include <dtt.h>
|
||||
#if defined(CONFIG_POST)
|
||||
#include <post.h>
|
||||
#endif
|
||||
#if defined(CONFIG_LOGBUFFER)
|
||||
#include <logbuff.h>
|
||||
#endif
|
||||
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
|
||||
#include <asm/cache.h>
|
||||
#endif
|
||||
#ifdef CONFIG_PS2KBD
|
||||
#include <keyboard.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADDR_MAP
|
||||
#include <asm/mmu.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MP
|
||||
#include <asm/mp.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BITBANGMII
|
||||
#include <miiphy.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
|
||||
extern int update_flash_size(int flash_size);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_DOC)
|
||||
void doc_init(void);
|
||||
#endif
|
||||
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
|
||||
#include <i2c.h>
|
||||
#endif
|
||||
#include <spi.h>
|
||||
#include <nand.h>
|
||||
|
||||
static char *failed = "*** failed ***\n";
|
||||
|
||||
#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
|
||||
extern flash_info_t flash_info[];
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_START_IDE)
|
||||
extern int board_start_ide(void);
|
||||
#endif
|
||||
#include <environment.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#if !defined(CONFIG_SYS_MEM_TOP_HIDE)
|
||||
#define CONFIG_SYS_MEM_TOP_HIDE 0
|
||||
#endif
|
||||
|
||||
extern ulong __init_end;
|
||||
extern ulong __bss_end;
|
||||
ulong monitor_flash_len;
|
||||
|
||||
#if defined(CONFIG_CMD_BEDBUG)
|
||||
#include <bedbug/type.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Utilities
|
||||
*/
|
||||
|
||||
/*
|
||||
* All attempts to come up with a "common" initialization sequence
|
||||
* that works for all boards and architectures failed: some of the
|
||||
* requirements are just _too_ different. To get rid of the resulting
|
||||
* mess of board dependend #ifdef'ed code we now make the whole
|
||||
* initialization sequence configurable to the user.
|
||||
*
|
||||
* The requirements for any new initalization function is simple: it
|
||||
* receives a pointer to the "global data" structure as it's only
|
||||
* argument, and returns an integer return code, where 0 means
|
||||
* "continue" and != 0 means "fatal error, hang the system".
|
||||
*/
|
||||
typedef int (init_fnc_t)(void);
|
||||
|
||||
/*
|
||||
* Init Utilities
|
||||
*
|
||||
* Some of this code should be moved into the core functions,
|
||||
* but let's get it working (again) first...
|
||||
*/
|
||||
|
||||
static int init_baudrate(void)
|
||||
{
|
||||
gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
static void __board_add_ram_info(int use_default)
|
||||
{
|
||||
/* please define platform specific board_add_ram_info() */
|
||||
}
|
||||
|
||||
void board_add_ram_info(int)
|
||||
__attribute__ ((weak, alias("__board_add_ram_info")));
|
||||
|
||||
static int __board_flash_wp_on(void)
|
||||
{
|
||||
/*
|
||||
* Most flashes can't be detected when write protection is enabled,
|
||||
* so provide a way to let U-Boot gracefully ignore write protected
|
||||
* devices.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_flash_wp_on(void)
|
||||
__attribute__ ((weak, alias("__board_flash_wp_on")));
|
||||
|
||||
static void __cpu_secondary_init_r(void)
|
||||
{
|
||||
}
|
||||
|
||||
void cpu_secondary_init_r(void)
|
||||
__attribute__ ((weak, alias("__cpu_secondary_init_r")));
|
||||
|
||||
static int init_func_ram(void)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_TYPES
|
||||
int board_type = gd->board_type;
|
||||
#else
|
||||
int board_type = 0; /* use dummy arg */
|
||||
#endif
|
||||
puts("DRAM: ");
|
||||
|
||||
gd->ram_size = initdram(board_type);
|
||||
|
||||
if (gd->ram_size > 0) {
|
||||
print_size(gd->ram_size, "");
|
||||
board_add_ram_info(0);
|
||||
putc('\n');
|
||||
return 0;
|
||||
}
|
||||
puts(failed);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
|
||||
static int init_func_i2c(void)
|
||||
{
|
||||
puts("I2C: ");
|
||||
#ifdef CONFIG_SYS_I2C
|
||||
i2c_init_all();
|
||||
#else
|
||||
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
|
||||
#endif
|
||||
puts("ready\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_HARD_SPI)
|
||||
static int init_func_spi(void)
|
||||
{
|
||||
puts("SPI: ");
|
||||
spi_init();
|
||||
puts("ready\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
int init_func_watchdog_init(void)
|
||||
{
|
||||
#if defined(CONFIG_MPC85xx)
|
||||
init_85xx_watchdog();
|
||||
#endif
|
||||
puts(" Watchdog enabled\n");
|
||||
WATCHDOG_RESET();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int init_func_watchdog_reset(void)
|
||||
{
|
||||
WATCHDOG_RESET();
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
|
||||
/*
|
||||
* Initialization sequence
|
||||
*/
|
||||
|
||||
static init_fnc_t *init_sequence[] = {
|
||||
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
||||
probecpu,
|
||||
#endif
|
||||
#if defined(CONFIG_BOARD_EARLY_INIT_F)
|
||||
board_early_init_f,
|
||||
#endif
|
||||
#if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
|
||||
get_clocks, /* get CPU and bus clocks (etc.) */
|
||||
#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
|
||||
&& !defined(CONFIG_TQM885D)
|
||||
adjust_sdram_tbs_8xx,
|
||||
#endif
|
||||
init_timebase,
|
||||
#endif
|
||||
#ifdef CONFIG_SYS_ALLOC_DPRAM
|
||||
#if !defined(CONFIG_CPM2)
|
||||
dpram_init,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(CONFIG_BOARD_POSTCLK_INIT)
|
||||
board_postclk_init,
|
||||
#endif
|
||||
env_init,
|
||||
#if defined(CONFIG_8xx_CPUCLK_DEFAULT)
|
||||
/* get CPU and bus clocks according to the environment variable */
|
||||
get_clocks_866,
|
||||
/* adjust sdram refresh rate according to the new clock */
|
||||
sdram_adjust_866,
|
||||
init_timebase,
|
||||
#endif
|
||||
init_baudrate,
|
||||
serial_init,
|
||||
console_init_f,
|
||||
display_options,
|
||||
#if defined(CONFIG_MPC8260)
|
||||
prt_8260_rsr,
|
||||
prt_8260_clks,
|
||||
#endif /* CONFIG_MPC8260 */
|
||||
#if defined(CONFIG_MPC83xx)
|
||||
prt_83xx_rsr,
|
||||
#endif
|
||||
checkcpu,
|
||||
#if defined(CONFIG_MPC5xxx)
|
||||
prt_mpc5xxx_clks,
|
||||
#endif /* CONFIG_MPC5xxx */
|
||||
checkboard,
|
||||
INIT_FUNC_WATCHDOG_INIT
|
||||
#if defined(CONFIG_MISC_INIT_F)
|
||||
misc_init_f,
|
||||
#endif
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
|
||||
init_func_i2c,
|
||||
#endif
|
||||
#if defined(CONFIG_HARD_SPI)
|
||||
init_func_spi,
|
||||
#endif
|
||||
#ifdef CONFIG_POST
|
||||
post_init_f,
|
||||
#endif
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
init_func_ram,
|
||||
#if defined(CONFIG_SYS_DRAM_TEST)
|
||||
testdram,
|
||||
#endif /* CONFIG_SYS_DRAM_TEST */
|
||||
INIT_FUNC_WATCHDOG_RESET
|
||||
NULL, /* Terminate this list */
|
||||
};
|
||||
|
||||
static int __fixup_cpu(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fixup_cpu(void) __attribute__((weak, alias("__fixup_cpu")));
|
||||
|
||||
/*
|
||||
* This is the first part of the initialization sequence that is
|
||||
* implemented in C, but still running from ROM.
|
||||
*
|
||||
* The main purpose is to provide a (serial) console interface as
|
||||
* soon as possible (so we can see any error messages), and to
|
||||
* initialize the RAM so that we can relocate the monitor code to
|
||||
* RAM.
|
||||
*
|
||||
* Be aware of the restrictions: global data is read-only, BSS is not
|
||||
* initialized, and stack space is limited to a few kB.
|
||||
*/
|
||||
|
||||
void board_init_f(ulong bootflag)
|
||||
{
|
||||
bd_t *bd;
|
||||
ulong len, addr, addr_sp;
|
||||
ulong *s;
|
||||
gd_t *id;
|
||||
init_fnc_t **init_fnc_ptr;
|
||||
|
||||
#ifdef CONFIG_PRAM
|
||||
ulong reg;
|
||||
#endif
|
||||
|
||||
/* Pointer is writable since we allocated a register for it */
|
||||
gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
|
||||
/* compiler optimization barrier needed for GCC >= 3.4 */
|
||||
__asm__ __volatile__("":::"memory");
|
||||
|
||||
#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \
|
||||
!defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \
|
||||
!defined(CONFIG_MPC86xx)
|
||||
/* Clear initial global data */
|
||||
memset((void *) gd, 0, sizeof(gd_t));
|
||||
#endif
|
||||
|
||||
gd->flags = bootflag;
|
||||
|
||||
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr)
|
||||
if ((*init_fnc_ptr) () != 0)
|
||||
hang();
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
post_bootmode_init();
|
||||
post_run(NULL, POST_ROM | post_bootmode_get(NULL));
|
||||
#endif
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
/*
|
||||
* Now that we have DRAM mapped and working, we can
|
||||
* relocate the code and continue running from DRAM.
|
||||
*
|
||||
* Reserve memory at end of RAM for (top down in that order):
|
||||
* - area that won't get touched by U-Boot and Linux (optional)
|
||||
* - kernel log buffer
|
||||
* - protected RAM
|
||||
* - LCD framebuffer
|
||||
* - monitor code
|
||||
* - board info struct
|
||||
*/
|
||||
len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
|
||||
|
||||
/*
|
||||
* Subtract specified amount of memory to hide so that it won't
|
||||
* get "touched" at all by U-Boot. By fixing up gd->ram_size
|
||||
* the Linux kernel should now get passed the now "corrected"
|
||||
* memory size and won't touch it either. This should work
|
||||
* for arch/ppc and arch/powerpc. Only Linux board ports in
|
||||
* arch/powerpc with bootwrapper support, that recalculate the
|
||||
* memory size from the SDRAM controller setup will have to
|
||||
* get fixed.
|
||||
*/
|
||||
gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
|
||||
|
||||
addr = CONFIG_SYS_SDRAM_BASE + get_effective_memsize();
|
||||
|
||||
#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
|
||||
/*
|
||||
* We need to make sure the location we intend to put secondary core
|
||||
* boot code is reserved and not used by any part of u-boot
|
||||
*/
|
||||
if (addr > determine_mp_bootpg(NULL)) {
|
||||
addr = determine_mp_bootpg(NULL);
|
||||
debug("Reserving MP boot page to %08lx\n", addr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LOGBUFFER
|
||||
#ifndef CONFIG_ALT_LB_ADDR
|
||||
/* reserve kernel log buffer */
|
||||
addr -= (LOGBUFF_RESERVE);
|
||||
debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN,
|
||||
addr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PRAM
|
||||
/*
|
||||
* reserve protected RAM
|
||||
*/
|
||||
reg = getenv_ulong("pram", 10, CONFIG_PRAM);
|
||||
addr -= (reg << 10); /* size is in kB */
|
||||
debug("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
|
||||
#endif /* CONFIG_PRAM */
|
||||
|
||||
/* round down to next 4 kB limit */
|
||||
addr &= ~(4096 - 1);
|
||||
debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
|
||||
|
||||
#ifdef CONFIG_LCD
|
||||
#ifdef CONFIG_FB_ADDR
|
||||
gd->fb_base = CONFIG_FB_ADDR;
|
||||
#else
|
||||
/* reserve memory for LCD display (always full pages) */
|
||||
addr = lcd_setmem(addr);
|
||||
gd->fb_base = addr;
|
||||
#endif /* CONFIG_FB_ADDR */
|
||||
#endif /* CONFIG_LCD */
|
||||
|
||||
#if defined(CONFIG_VIDEO) && defined(CONFIG_8xx)
|
||||
/* reserve memory for video display (always full pages) */
|
||||
addr = video_setmem(addr);
|
||||
gd->fb_base = addr;
|
||||
#endif /* CONFIG_VIDEO */
|
||||
|
||||
/*
|
||||
* reserve memory for U-Boot code, data & bss
|
||||
* round down to next 4 kB limit
|
||||
*/
|
||||
addr -= len;
|
||||
addr &= ~(4096 - 1);
|
||||
#ifdef CONFIG_E500
|
||||
/* round down to next 64 kB limit so that IVPR stays aligned */
|
||||
addr &= ~(65536 - 1);
|
||||
#endif
|
||||
|
||||
debug("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
|
||||
|
||||
/*
|
||||
* reserve memory for malloc() arena
|
||||
*/
|
||||
addr_sp = addr - TOTAL_MALLOC_LEN;
|
||||
debug("Reserving %dk for malloc() at: %08lx\n",
|
||||
TOTAL_MALLOC_LEN >> 10, addr_sp);
|
||||
|
||||
/*
|
||||
* (permanently) allocate a Board Info struct
|
||||
* and a permanent copy of the "global" data
|
||||
*/
|
||||
addr_sp -= sizeof(bd_t);
|
||||
bd = (bd_t *) addr_sp;
|
||||
memset(bd, 0, sizeof(bd_t));
|
||||
gd->bd = bd;
|
||||
debug("Reserving %zu Bytes for Board Info at: %08lx\n",
|
||||
sizeof(bd_t), addr_sp);
|
||||
addr_sp -= sizeof(gd_t);
|
||||
id = (gd_t *) addr_sp;
|
||||
debug("Reserving %zu Bytes for Global Data at: %08lx\n",
|
||||
sizeof(gd_t), addr_sp);
|
||||
|
||||
/*
|
||||
* Finally, we set up a new (bigger) stack.
|
||||
*
|
||||
* Leave some safety gap for SP, force alignment on 16 byte boundary
|
||||
* Clear initial stack frame
|
||||
*/
|
||||
addr_sp -= 16;
|
||||
addr_sp &= ~0xF;
|
||||
s = (ulong *) addr_sp;
|
||||
*s = 0; /* Terminate back chain */
|
||||
*++s = 0; /* NULL return address */
|
||||
debug("Stack Pointer at: %08lx\n", addr_sp);
|
||||
|
||||
/*
|
||||
* Save local variables to board info struct
|
||||
*/
|
||||
|
||||
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of memory */
|
||||
bd->bi_memsize = gd->ram_size; /* size in bytes */
|
||||
|
||||
#ifdef CONFIG_SYS_SRAM_BASE
|
||||
bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
|
||||
bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_8xx) || defined(CONFIG_MPC8260) || defined(CONFIG_5xx) || \
|
||||
defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
|
||||
bd->bi_immr_base = CONFIG_SYS_IMMR; /* base of IMMR register */
|
||||
#endif
|
||||
#if defined(CONFIG_MPC5xxx)
|
||||
bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
|
||||
#endif
|
||||
#if defined(CONFIG_MPC83xx)
|
||||
bd->bi_immrbar = CONFIG_SYS_IMMR;
|
||||
#endif
|
||||
|
||||
WATCHDOG_RESET();
|
||||
bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
|
||||
bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
|
||||
#if defined(CONFIG_CPM2)
|
||||
bd->bi_cpmfreq = gd->arch.cpm_clk;
|
||||
bd->bi_brgfreq = gd->arch.brg_clk;
|
||||
bd->bi_sccfreq = gd->arch.scc_clk;
|
||||
bd->bi_vco = gd->arch.vco_out;
|
||||
#endif /* CONFIG_CPM2 */
|
||||
#if defined(CONFIG_MPC512X)
|
||||
bd->bi_ipsfreq = gd->arch.ips_clk;
|
||||
#endif /* CONFIG_MPC512X */
|
||||
#if defined(CONFIG_MPC5xxx)
|
||||
bd->bi_ipbfreq = gd->arch.ipb_clk;
|
||||
bd->bi_pcifreq = gd->pci_clk;
|
||||
#endif /* CONFIG_MPC5xxx */
|
||||
|
||||
#ifdef CONFIG_SYS_EXTBDINFO
|
||||
strncpy((char *) bd->bi_s_version, "1.2", sizeof(bd->bi_s_version));
|
||||
strncpy((char *) bd->bi_r_version, U_BOOT_VERSION,
|
||||
sizeof(bd->bi_r_version));
|
||||
|
||||
bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
|
||||
bd->bi_plb_busfreq = gd->bus_clk;
|
||||
#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
|
||||
defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
|
||||
defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
|
||||
bd->bi_pci_busfreq = get_PCI_freq();
|
||||
bd->bi_opbfreq = get_OPB_freq();
|
||||
#elif defined(CONFIG_XILINX_405)
|
||||
bd->bi_pci_busfreq = get_PCI_freq();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
debug("New Stack Pointer is: %08lx\n", addr_sp);
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
gd->relocaddr = addr; /* Store relocation addr, useful for debug */
|
||||
|
||||
memcpy(id, (void *) gd, sizeof(gd_t));
|
||||
|
||||
relocate_code(addr_sp, id, addr);
|
||||
|
||||
/* NOTREACHED - relocate_code() does not return */
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the next part if the initialization sequence: we are now
|
||||
* running from RAM and have a "normal" C environment, i. e. global
|
||||
* data can be written, BSS has been cleared, the stack size in not
|
||||
* that critical any more, etc.
|
||||
*/
|
||||
void board_init_r(gd_t *id, ulong dest_addr)
|
||||
{
|
||||
bd_t *bd;
|
||||
ulong malloc_start;
|
||||
|
||||
#ifndef CONFIG_SYS_NO_FLASH
|
||||
ulong flash_size;
|
||||
#endif
|
||||
|
||||
gd = id; /* initialize RAM version of global data */
|
||||
bd = gd->bd;
|
||||
|
||||
gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
|
||||
|
||||
/* The Malloc area is immediately below the monitor copy in DRAM */
|
||||
malloc_start = dest_addr - TOTAL_MALLOC_LEN;
|
||||
|
||||
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
||||
/*
|
||||
* The gd->arch.cpu pointer is set to an address in flash before
|
||||
* relocation. We need to update it to point to the same CPU entry
|
||||
* in RAM.
|
||||
*/
|
||||
gd->arch.cpu += dest_addr - CONFIG_SYS_MONITOR_BASE;
|
||||
|
||||
/*
|
||||
* If we didn't know the cpu mask & # cores, we can save them of
|
||||
* now rather than 'computing' them constantly
|
||||
*/
|
||||
fixup_cpu();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYS_EXTRA_ENV_RELOC
|
||||
/*
|
||||
* Some systems need to relocate the env_addr pointer early because the
|
||||
* location it points to will get invalidated before env_relocate is
|
||||
* called. One example is on systems that might use a L2 or L3 cache
|
||||
* in SRAM mode and initialize that cache from SRAM mode back to being
|
||||
* a cache in cpu_init_r.
|
||||
*/
|
||||
gd->env_addr += dest_addr - CONFIG_SYS_MONITOR_BASE;
|
||||
#endif
|
||||
|
||||
serial_initialize();
|
||||
|
||||
debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
/*
|
||||
* Setup trap handlers
|
||||
*/
|
||||
trap_init(dest_addr);
|
||||
|
||||
#ifdef CONFIG_ADDR_MAP
|
||||
init_addr_map();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BOARD_EARLY_INIT_R)
|
||||
board_early_init_r();
|
||||
#endif
|
||||
|
||||
monitor_flash_len = (ulong)&__init_end - dest_addr;
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#ifdef CONFIG_LOGBUFFER
|
||||
logbuff_init_ptrs();
|
||||
#endif
|
||||
#ifdef CONFIG_POST
|
||||
post_output_backlog();
|
||||
#endif
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#if defined(CONFIG_SYS_DELAYED_ICACHE)
|
||||
icache_enable(); /* it's time to enable the instruction cache */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
|
||||
unlock_ram_in_cache(); /* it's time to unlock D-cache in e500 */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
|
||||
/*
|
||||
* Do early PCI configuration _before_ the flash gets initialised,
|
||||
* because PCU ressources are crucial for flash access on some boards.
|
||||
*/
|
||||
pci_init();
|
||||
#endif
|
||||
#if defined(CONFIG_WINBOND_83C553)
|
||||
/*
|
||||
* Initialise the ISA bridge
|
||||
*/
|
||||
initialise_w83c553f();
|
||||
#endif
|
||||
|
||||
asm("sync ; isync");
|
||||
|
||||
mem_malloc_init(malloc_start, TOTAL_MALLOC_LEN);
|
||||
|
||||
#if !defined(CONFIG_SYS_NO_FLASH)
|
||||
puts("Flash: ");
|
||||
|
||||
if (board_flash_wp_on()) {
|
||||
printf("Uninitialized - Write Protect On\n");
|
||||
/* Since WP is on, we can't find real size. Set to 0 */
|
||||
flash_size = 0;
|
||||
} else if ((flash_size = flash_init()) > 0) {
|
||||
#ifdef CONFIG_SYS_FLASH_CHECKSUM
|
||||
print_size(flash_size, "");
|
||||
/*
|
||||
* Compute and print flash CRC if flashchecksum is set to 'y'
|
||||
*
|
||||
* NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
|
||||
*/
|
||||
if (getenv_yesno("flashchecksum") == 1) {
|
||||
printf(" CRC: %08X",
|
||||
crc32(0,
|
||||
(const unsigned char *)
|
||||
CONFIG_SYS_FLASH_BASE, flash_size)
|
||||
);
|
||||
}
|
||||
putc('\n');
|
||||
#else /* !CONFIG_SYS_FLASH_CHECKSUM */
|
||||
print_size(flash_size, "\n");
|
||||
#endif /* CONFIG_SYS_FLASH_CHECKSUM */
|
||||
} else {
|
||||
puts(failed);
|
||||
hang();
|
||||
}
|
||||
|
||||
/* update start of FLASH memory */
|
||||
bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
|
||||
/* size of FLASH memory (final value) */
|
||||
bd->bi_flashsize = flash_size;
|
||||
|
||||
#if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
|
||||
/* Make a update of the Memctrl. */
|
||||
update_flash_size(flash_size);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
|
||||
/* flash mapped at end of memory map */
|
||||
bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
|
||||
#elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
|
||||
bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */
|
||||
#endif
|
||||
#endif /* !CONFIG_SYS_NO_FLASH */
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
/* initialize higher level parts of CPU like time base and timers */
|
||||
cpu_init_r();
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#ifdef CONFIG_SPI
|
||||
#if !defined(CONFIG_ENV_IS_IN_EEPROM)
|
||||
spi_init_f();
|
||||
#endif
|
||||
spi_init_r();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_NAND)
|
||||
WATCHDOG_RESET();
|
||||
puts("NAND: ");
|
||||
nand_init(); /* go init the NAND */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GENERIC_MMC
|
||||
/*
|
||||
* MMC initialization is called before relocating env.
|
||||
* Thus It is required that operations like pin multiplexer
|
||||
* be put in board_init.
|
||||
*/
|
||||
WATCHDOG_RESET();
|
||||
puts("MMC: ");
|
||||
mmc_initialize(bd);
|
||||
#endif
|
||||
|
||||
/* relocate environment function pointers etc. */
|
||||
env_relocate();
|
||||
|
||||
/*
|
||||
* after non-volatile devices & environment is setup and cpu code have
|
||||
* another round to deal with any initialization that might require
|
||||
* full access to the environment or loading of some image (firmware)
|
||||
* from a non-volatile device
|
||||
*/
|
||||
cpu_secondary_init_r();
|
||||
|
||||
/*
|
||||
* Fill in missing fields of bd_info.
|
||||
* We do this here, where we have "normal" access to the
|
||||
* environment; we used to do this still running from ROM,
|
||||
* where had to use getenv_f(), which can be pretty slow when
|
||||
* the environment is in EEPROM.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SYS_EXTBDINFO)
|
||||
#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
|
||||
#if defined(CONFIG_I2CFAST)
|
||||
/*
|
||||
* set bi_iic_fast for linux taking environment variable
|
||||
* "i2cfast" into account
|
||||
*/
|
||||
{
|
||||
if (getenv_yesno("i2cfast") == 1) {
|
||||
bd->bi_iic_fast[0] = 1;
|
||||
bd->bi_iic_fast[1] = 1;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_I2CFAST */
|
||||
#endif /* CONFIG_405GP, CONFIG_405EP */
|
||||
#endif /* CONFIG_SYS_EXTBDINFO */
|
||||
|
||||
#if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
|
||||
mac_read_from_eeprom();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CMD_NET
|
||||
/* kept around for legacy kernels only ... ignore the next section */
|
||||
eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
|
||||
#ifdef CONFIG_HAS_ETH1
|
||||
eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAS_ETH2
|
||||
eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAS_ETH3
|
||||
eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAS_ETH4
|
||||
eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAS_ETH5
|
||||
eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
|
||||
#endif
|
||||
#endif /* CONFIG_CMD_NET */
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
|
||||
/*
|
||||
* Do pci configuration
|
||||
*/
|
||||
pci_init();
|
||||
#endif
|
||||
|
||||
/** leave this here (after malloc(), environment and PCI are working) **/
|
||||
/* Initialize stdio devices */
|
||||
stdio_init();
|
||||
|
||||
/* Initialize the jump table for applications */
|
||||
jumptable_init();
|
||||
|
||||
#if defined(CONFIG_API)
|
||||
/* Initialize API */
|
||||
api_init();
|
||||
#endif
|
||||
|
||||
/* Initialize the console (after the relocation and devices init) */
|
||||
console_init_r();
|
||||
|
||||
#if defined(CONFIG_MISC_INIT_R)
|
||||
/* miscellaneous platform dependent initialisations */
|
||||
misc_init_r();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_KGDB)
|
||||
WATCHDOG_RESET();
|
||||
puts("KGDB: ");
|
||||
kgdb_init();
|
||||
#endif
|
||||
|
||||
debug("U-Boot relocated to %08lx\n", dest_addr);
|
||||
|
||||
/*
|
||||
* Enable Interrupts
|
||||
*/
|
||||
interrupt_init();
|
||||
|
||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||
status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
|
||||
#endif
|
||||
|
||||
udelay(20);
|
||||
|
||||
/* Initialize from environment */
|
||||
load_addr = getenv_ulong("loadaddr", 16, load_addr);
|
||||
|
||||
WATCHDOG_RESET();
|
||||
|
||||
#if defined(CONFIG_CMD_SCSI)
|
||||
WATCHDOG_RESET();
|
||||
puts("SCSI: ");
|
||||
scsi_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_DOC)
|
||||
WATCHDOG_RESET();
|
||||
puts("DOC: ");
|
||||
doc_init();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BITBANGMII
|
||||
bb_miiphy_init();
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_NET)
|
||||
WATCHDOG_RESET();
|
||||
puts("Net: ");
|
||||
eth_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
|
||||
WATCHDOG_RESET();
|
||||
debug("Reset Ethernet PHY\n");
|
||||
reset_phy();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
post_run(NULL, POST_RAM | post_bootmode_get(0));
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_PCMCIA) \
|
||||
&& !defined(CONFIG_CMD_IDE)
|
||||
WATCHDOG_RESET();
|
||||
puts("PCMCIA:");
|
||||
pcmcia_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_IDE)
|
||||
WATCHDOG_RESET();
|
||||
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||
puts("PCMCIA:");
|
||||
#else
|
||||
puts("IDE: ");
|
||||
#endif
|
||||
#if defined(CONFIG_START_IDE)
|
||||
if (board_start_ide())
|
||||
ide_init();
|
||||
#else
|
||||
ide_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LAST_STAGE_INIT
|
||||
WATCHDOG_RESET();
|
||||
/*
|
||||
* Some parts can be only initialized if all others (like
|
||||
* Interrupts) are up and running (i.e. the PC-style ISA
|
||||
* keyboard).
|
||||
*/
|
||||
last_stage_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_BEDBUG)
|
||||
WATCHDOG_RESET();
|
||||
bedbug_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
|
||||
/*
|
||||
* Export available size of memory for Linux,
|
||||
* taking into account the protected RAM at top of memory
|
||||
*/
|
||||
{
|
||||
ulong pram = 0;
|
||||
char memsz[32];
|
||||
|
||||
#ifdef CONFIG_PRAM
|
||||
pram = getenv_ulong("pram", 10, CONFIG_PRAM);
|
||||
#endif
|
||||
#ifdef CONFIG_LOGBUFFER
|
||||
#ifndef CONFIG_ALT_LB_ADDR
|
||||
/* Also take the logbuffer into account (pram is in kB) */
|
||||
pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
|
||||
#endif
|
||||
#endif
|
||||
sprintf(memsz, "%ldk", (ulong) (bd->bi_memsize / 1024) - pram);
|
||||
setenv("mem", memsz);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PS2KBD
|
||||
puts("PS/2: ");
|
||||
kbd_init();
|
||||
#endif
|
||||
|
||||
/* Initialization complete - start the monitor */
|
||||
|
||||
/* main_loop() can return to retry autoboot, if so just run it again. */
|
||||
for (;;) {
|
||||
WATCHDOG_RESET();
|
||||
main_loop();
|
||||
}
|
||||
|
||||
/* NOTREACHED - no way out of command loop except booting */
|
||||
}
|
||||
|
||||
#if 0 /* We could use plain global data, but the resulting code is bigger */
|
||||
/*
|
||||
* Pointer to initial global data area
|
||||
*
|
||||
* Here we initialize it.
|
||||
*/
|
||||
#undef XTRN_DECLARE_GLOBAL_DATA_PTR
|
||||
#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
|
||||
DECLARE_GLOBAL_DATA_PTR =
|
||||
(gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
|
||||
#endif /* 0 */
|
||||
|
||||
/************************************************************************/
|
||||
@@ -153,6 +153,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
reset@1 {
|
||||
compatible = "sandbox,reset";
|
||||
};
|
||||
|
||||
spi@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
@@ -72,9 +72,10 @@ unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
|
||||
entries[num_entries].type = E820_RAM;
|
||||
else if (res_desc->type == RES_MEM_RESERVED)
|
||||
entries[num_entries].type = E820_RESERVED;
|
||||
|
||||
num_entries++;
|
||||
}
|
||||
hdr = get_next_hob(hdr);
|
||||
num_entries++;
|
||||
}
|
||||
|
||||
/* Mark PCIe ECAM address range as reserved */
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
NET2BIG_V2 BOARD
|
||||
#M: -
|
||||
M: Simon Guinot <simon.guinot@sequanux.org>
|
||||
S: Maintained
|
||||
F: board/LaCie/net2big_v2/
|
||||
F: include/configs/lacie_kw.h
|
||||
F: configs/d2net_v2_defconfig
|
||||
|
||||
NET2BIG_V2 BOARD
|
||||
M: Simon Guinot <simon.guinot@sequanux.org>
|
||||
S: Maintained
|
||||
F: configs/net2big_v2_defconfig
|
||||
|
||||
@@ -1,17 +1,4 @@
|
||||
if TARGET_VEXPRESS64_BASE_FVP
|
||||
|
||||
config SYS_BOARD
|
||||
default "vexpress64"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "armltd"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "vexpress_aemv8a"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_VEXPRESS64_JUNO
|
||||
if TARGET_VEXPRESS64_BASE_FVP || TARGET_VEXPRESS64_JUNO || TARGET_VEXPRESS64_BASE_FVP_DRAM
|
||||
|
||||
config SYS_BOARD
|
||||
default "vexpress64"
|
||||
|
||||
@@ -10,6 +10,11 @@ M: Linus Walleij <linus.walleij@linaro.org>
|
||||
S: Maintained
|
||||
F: configs/vexpress_aemv8a_semi_defconfig
|
||||
|
||||
VEXPRESS_AEMV8A_DRAM BOARD
|
||||
M: Ryan Harkin <ryan.harkin@linaro.org>
|
||||
S: Maintained
|
||||
F: configs/vexpress_aemv8a_dram_defconfig
|
||||
|
||||
JUNO DEVELOPMENT PLATFORM BOARD
|
||||
M: Linus Walleij <linus.walleij@linaro.org>
|
||||
S: Maintained
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y := vexpress64.o
|
||||
obj-y := vexpress64.o pcie.o
|
||||
|
||||
197
board/armltd/vexpress64/pcie.c
Normal file
197
board/armltd/vexpress64/pcie.c
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Copyright (C) ARM Ltd 2015
|
||||
*
|
||||
* Author: Liviu Dudau <Liviu.Dudau@arm.com>
|
||||
*
|
||||
* SPDX-Licence-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <pci_ids.h>
|
||||
#include "pcie.h"
|
||||
|
||||
/* XpressRICH3 support */
|
||||
#define XR3_CONFIG_BASE 0x7ff30000
|
||||
#define XR3_RESET_BASE 0x7ff20000
|
||||
|
||||
#define XR3_PCI_ECAM_START 0x40000000
|
||||
#define XR3_PCI_ECAM_SIZE 28 /* as power of 2 = 0x10000000 */
|
||||
#define XR3_PCI_IOSPACE_START 0x5f800000
|
||||
#define XR3_PCI_IOSPACE_SIZE 23 /* as power of 2 = 0x800000 */
|
||||
#define XR3_PCI_MEMSPACE_START 0x50000000
|
||||
#define XR3_PCI_MEMSPACE_SIZE 27 /* as power of 2 = 0x8000000 */
|
||||
#define XR3_PCI_MEMSPACE64_START 0x4000000000
|
||||
#define XR3_PCI_MEMSPACE64_SIZE 33 /* as power of 2 = 0x200000000 */
|
||||
|
||||
#define JUNO_V2M_MSI_START 0x2c1c0000
|
||||
#define JUNO_V2M_MSI_SIZE 12 /* as power of 2 = 4096 */
|
||||
|
||||
#define XR3PCI_BASIC_STATUS 0x18
|
||||
#define XR3PCI_BS_GEN_MASK (0xf << 8)
|
||||
#define XR3PCI_BS_LINK_MASK 0xff
|
||||
|
||||
#define XR3PCI_VIRTCHAN_CREDITS 0x90
|
||||
#define XR3PCI_BRIDGE_PCI_IDS 0x9c
|
||||
#define XR3PCI_PEX_SPC2 0xd8
|
||||
|
||||
#define XR3PCI_ATR_PCIE_WIN0 0x600
|
||||
#define XR3PCI_ATR_PCIE_WIN1 0x700
|
||||
#define XR3PCI_ATR_AXI4_SLV0 0x800
|
||||
|
||||
#define XR3PCI_ATR_TABLE_SIZE 0x20
|
||||
#define XR3PCI_ATR_SRC_ADDR_LOW 0x0
|
||||
#define XR3PCI_ATR_SRC_ADDR_HIGH 0x4
|
||||
#define XR3PCI_ATR_TRSL_ADDR_LOW 0x8
|
||||
#define XR3PCI_ATR_TRSL_ADDR_HIGH 0xc
|
||||
#define XR3PCI_ATR_TRSL_PARAM 0x10
|
||||
|
||||
/* IDs used in the XR3PCI_ATR_TRSL_PARAM */
|
||||
#define XR3PCI_ATR_TRSLID_AXIDEVICE (0x420004)
|
||||
#define XR3PCI_ATR_TRSLID_AXIMEMORY (0x4e0004) /* Write-through, read/write allocate */
|
||||
#define XR3PCI_ATR_TRSLID_PCIE_CONF (0x000001)
|
||||
#define XR3PCI_ATR_TRSLID_PCIE_IO (0x020000)
|
||||
#define XR3PCI_ATR_TRSLID_PCIE_MEMORY (0x000000)
|
||||
|
||||
#define XR3PCI_ECAM_OFFSET(b, d, o) (((b) << 20) | \
|
||||
(PCI_SLOT(d) << 15) | \
|
||||
(PCI_FUNC(d) << 12) | o)
|
||||
|
||||
#define JUNO_RESET_CTRL 0x1004
|
||||
#define JUNO_RESET_CTRL_PHY BIT(0)
|
||||
#define JUNO_RESET_CTRL_RC BIT(1)
|
||||
|
||||
#define JUNO_RESET_STATUS 0x1008
|
||||
#define JUNO_RESET_STATUS_PLL BIT(0)
|
||||
#define JUNO_RESET_STATUS_PHY BIT(1)
|
||||
#define JUNO_RESET_STATUS_RC BIT(2)
|
||||
#define JUNO_RESET_STATUS_MASK (JUNO_RESET_STATUS_PLL | \
|
||||
JUNO_RESET_STATUS_PHY | \
|
||||
JUNO_RESET_STATUS_RC)
|
||||
|
||||
void xr3pci_set_atr_entry(unsigned long base, unsigned long src_addr,
|
||||
unsigned long trsl_addr, int window_size,
|
||||
int trsl_param)
|
||||
{
|
||||
/* X3PCI_ATR_SRC_ADDR_LOW:
|
||||
- bit 0: enable entry,
|
||||
- bits 1-6: ATR window size: total size in bytes: 2^(ATR_WSIZE + 1)
|
||||
- bits 7-11: reserved
|
||||
- bits 12-31: start of source address
|
||||
*/
|
||||
writel((u32)(src_addr & 0xfffff000) | (window_size - 1) << 1 | 1,
|
||||
base + XR3PCI_ATR_SRC_ADDR_LOW);
|
||||
writel((u32)(src_addr >> 32), base + XR3PCI_ATR_SRC_ADDR_HIGH);
|
||||
writel((u32)(trsl_addr & 0xfffff000), base + XR3PCI_ATR_TRSL_ADDR_LOW);
|
||||
writel((u32)(trsl_addr >> 32), base + XR3PCI_ATR_TRSL_ADDR_HIGH);
|
||||
writel(trsl_param, base + XR3PCI_ATR_TRSL_PARAM);
|
||||
|
||||
printf("ATR entry: 0x%010lx %s 0x%010lx [0x%010llx] (param: 0x%06x)\n",
|
||||
src_addr, (trsl_param & 0x400000) ? "<-" : "->", trsl_addr,
|
||||
((u64)1) << window_size, trsl_param);
|
||||
}
|
||||
|
||||
void xr3pci_setup_atr(void)
|
||||
{
|
||||
/* setup PCIe to CPU address translation tables */
|
||||
unsigned long base = XR3_CONFIG_BASE + XR3PCI_ATR_PCIE_WIN0;
|
||||
|
||||
/* forward all writes from PCIe to GIC V2M (used for MSI) */
|
||||
xr3pci_set_atr_entry(base, JUNO_V2M_MSI_START, JUNO_V2M_MSI_START,
|
||||
JUNO_V2M_MSI_SIZE, XR3PCI_ATR_TRSLID_AXIDEVICE);
|
||||
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
|
||||
/* PCIe devices can write anywhere in memory */
|
||||
xr3pci_set_atr_entry(base, PHYS_SDRAM_1, PHYS_SDRAM_1,
|
||||
31 /* grant access to all RAM under 4GB */,
|
||||
XR3PCI_ATR_TRSLID_AXIMEMORY);
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
xr3pci_set_atr_entry(base, PHYS_SDRAM_2, PHYS_SDRAM_2,
|
||||
XR3_PCI_MEMSPACE64_SIZE,
|
||||
XR3PCI_ATR_TRSLID_AXIMEMORY);
|
||||
|
||||
|
||||
/* setup CPU to PCIe address translation table */
|
||||
base = XR3_CONFIG_BASE + XR3PCI_ATR_AXI4_SLV0;
|
||||
|
||||
/* setup ECAM space to bus configuration interface */
|
||||
xr3pci_set_atr_entry(base, XR3_PCI_ECAM_START, 0, XR3_PCI_ECAM_SIZE,
|
||||
XR3PCI_ATR_TRSLID_PCIE_CONF);
|
||||
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
|
||||
/* setup IO space translation */
|
||||
xr3pci_set_atr_entry(base, XR3_PCI_IOSPACE_START, XR3_PCI_IOSPACE_START,
|
||||
XR3_PCI_IOSPACE_SIZE, XR3PCI_ATR_TRSLID_PCIE_IO);
|
||||
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
|
||||
/* setup 32bit MEM space translation */
|
||||
xr3pci_set_atr_entry(base, XR3_PCI_MEMSPACE_START, XR3_PCI_MEMSPACE_START,
|
||||
XR3_PCI_MEMSPACE_SIZE, XR3PCI_ATR_TRSLID_PCIE_MEMORY);
|
||||
|
||||
base += XR3PCI_ATR_TABLE_SIZE;
|
||||
|
||||
/* setup 64bit MEM space translation */
|
||||
xr3pci_set_atr_entry(base, XR3_PCI_MEMSPACE64_START, XR3_PCI_MEMSPACE64_START,
|
||||
XR3_PCI_MEMSPACE64_SIZE, XR3PCI_ATR_TRSLID_PCIE_MEMORY);
|
||||
}
|
||||
|
||||
void xr3pci_init(void)
|
||||
{
|
||||
u32 val;
|
||||
int timeout = 200;
|
||||
|
||||
/* Initialise the XpressRICH3 PCIe host bridge */
|
||||
|
||||
/* add credits */
|
||||
writel(0x00f0b818, XR3_CONFIG_BASE + XR3PCI_VIRTCHAN_CREDITS);
|
||||
writel(0x1, XR3_CONFIG_BASE + XR3PCI_VIRTCHAN_CREDITS + 4);
|
||||
/* allow ECRC */
|
||||
writel(0x6006, XR3_CONFIG_BASE + XR3PCI_PEX_SPC2);
|
||||
/* setup the correct class code for the host bridge */
|
||||
writel(PCI_CLASS_BRIDGE_PCI << 16, XR3_CONFIG_BASE + XR3PCI_BRIDGE_PCI_IDS);
|
||||
|
||||
/* reset phy and root complex */
|
||||
writel(JUNO_RESET_CTRL_PHY | JUNO_RESET_CTRL_RC,
|
||||
XR3_RESET_BASE + JUNO_RESET_CTRL);
|
||||
|
||||
do {
|
||||
mdelay(1);
|
||||
val = readl(XR3_RESET_BASE + JUNO_RESET_STATUS);
|
||||
} while (--timeout &&
|
||||
(val & JUNO_RESET_STATUS_MASK) != JUNO_RESET_STATUS_MASK);
|
||||
|
||||
if (!timeout) {
|
||||
printf("PCI XR3 Root complex reset timed out\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Wait for the link to train */
|
||||
mdelay(20);
|
||||
timeout = 20;
|
||||
|
||||
do {
|
||||
mdelay(1);
|
||||
val = readl(XR3_CONFIG_BASE + XR3PCI_BASIC_STATUS);
|
||||
} while (--timeout && !(val & XR3PCI_BS_LINK_MASK));
|
||||
|
||||
if (!(val & XR3PCI_BS_LINK_MASK)) {
|
||||
printf("Failed to negotiate a link!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("PCIe XR3 Host Bridge enabled: x%d link (Gen %d)\n",
|
||||
val & XR3PCI_BS_LINK_MASK, (val & XR3PCI_BS_GEN_MASK) >> 8);
|
||||
|
||||
xr3pci_setup_atr();
|
||||
}
|
||||
|
||||
void vexpress64_pcie_init(void)
|
||||
{
|
||||
#ifdef CONFIG_TARGET_VEXPRESS64_JUNO
|
||||
xr3pci_init();
|
||||
#endif
|
||||
}
|
||||
6
board/armltd/vexpress64/pcie.h
Normal file
6
board/armltd/vexpress64/pcie.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __VEXPRESS64_PCIE_H__
|
||||
#define __VEXPRESS64_PCIE_H__
|
||||
|
||||
void vexpress64_pcie_init(void);
|
||||
|
||||
#endif /* __VEXPRESS64_PCIE_H__ */
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/compiler.h>
|
||||
#include <dm/platdata.h>
|
||||
#include <dm/platform_data/serial_pl01x.h>
|
||||
#include "pcie.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@@ -29,6 +30,7 @@ U_BOOT_DEVICE(vexpress_serials) = {
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
vexpress64_pcie_init();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,6 +40,14 @@ int dram_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dram_init_banksize(void)
|
||||
{
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
|
||||
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Board specific reset that is system reset.
|
||||
*/
|
||||
|
||||
@@ -28,63 +28,117 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
#define ENET_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_HIGH | \
|
||||
PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE)
|
||||
|
||||
static struct ddrmc_cr_setting vf610twr_cr_settings[] = {
|
||||
/* levelling */
|
||||
{ DDRMC_CR97_WRLVL_EN, 97 },
|
||||
{ DDRMC_CR98_WRLVL_DL_0(0), 98 },
|
||||
{ DDRMC_CR99_WRLVL_DL_1(0), 99 },
|
||||
{ DDRMC_CR102_RDLVL_REG_EN | DDRMC_CR102_RDLVL_GT_REGEN, 102 },
|
||||
{ DDRMC_CR105_RDLVL_DL_0(0), 105 },
|
||||
{ DDRMC_CR106_RDLVL_GTDL_0(4), 106 },
|
||||
{ DDRMC_CR110_RDLVL_DL_1(0) | DDRMC_CR110_RDLVL_GTDL_1(4), 110 },
|
||||
/* AXI */
|
||||
{ DDRMC_CR117_AXI0_W_PRI(0) | DDRMC_CR117_AXI0_R_PRI(0), 117 },
|
||||
{ DDRMC_CR118_AXI1_W_PRI(1) | DDRMC_CR118_AXI1_R_PRI(1), 118 },
|
||||
{ DDRMC_CR120_AXI0_PRI1_RPRI(2) |
|
||||
DDRMC_CR120_AXI0_PRI0_RPRI(2), 120 },
|
||||
{ DDRMC_CR121_AXI0_PRI3_RPRI(2) |
|
||||
DDRMC_CR121_AXI0_PRI2_RPRI(2), 121 },
|
||||
{ DDRMC_CR122_AXI1_PRI1_RPRI(1) | DDRMC_CR122_AXI1_PRI0_RPRI(1) |
|
||||
DDRMC_CR122_AXI0_PRIRLX(100), 122 },
|
||||
{ DDRMC_CR123_AXI1_P_ODR_EN | DDRMC_CR123_AXI1_PRI3_RPRI(1) |
|
||||
DDRMC_CR123_AXI1_PRI2_RPRI(1), 123 },
|
||||
{ DDRMC_CR124_AXI1_PRIRLX(100), 124 },
|
||||
{ DDRMC_CR126_PHY_RDLAT(8), 126 },
|
||||
{ DDRMC_CR132_WRLAT_ADJ(5) |
|
||||
DDRMC_CR132_RDLAT_ADJ(6), 132 },
|
||||
{ DDRMC_CR137_PHYCTL_DL(2), 137 },
|
||||
{ DDRMC_CR138_PHY_WRLV_MXDL(256) |
|
||||
DDRMC_CR138_PHYDRAM_CK_EN(1), 138 },
|
||||
{ DDRMC_CR139_PHY_WRLV_RESPLAT(4) | DDRMC_CR139_PHY_WRLV_LOAD(7) |
|
||||
DDRMC_CR139_PHY_WRLV_DLL(3) |
|
||||
DDRMC_CR139_PHY_WRLV_EN(3), 139 },
|
||||
{ DDRMC_CR140_PHY_WRLV_WW(64), 140 },
|
||||
{ DDRMC_CR143_RDLV_GAT_MXDL(1536) |
|
||||
DDRMC_CR143_RDLV_MXDL(128), 143 },
|
||||
{ DDRMC_CR144_PHY_RDLVL_RES(4) | DDRMC_CR144_PHY_RDLV_LOAD(7) |
|
||||
DDRMC_CR144_PHY_RDLV_DLL(3) |
|
||||
DDRMC_CR144_PHY_RDLV_EN(3), 144 },
|
||||
{ DDRMC_CR145_PHY_RDLV_RR(64), 145 },
|
||||
{ DDRMC_CR146_PHY_RDLVL_RESP(64), 146 },
|
||||
{ DDRMC_CR147_RDLV_RESP_MASK(983040), 147 },
|
||||
{ DDRMC_CR148_RDLV_GATE_RESP_MASK(983040), 148 },
|
||||
{ DDRMC_CR151_RDLV_GAT_DQ_ZERO_CNT(1) |
|
||||
DDRMC_CR151_RDLVL_DQ_ZERO_CNT(1), 151 },
|
||||
|
||||
{ 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), 154 },
|
||||
{ DDRMC_CR155_PAD_ODT_BYTE1(1) | DDRMC_CR155_PAD_ODT_BYTE0(1), 155 },
|
||||
{ DDRMC_CR158_TWR(6), 158 },
|
||||
{ DDRMC_CR161_ODT_EN(1) | DDRMC_CR161_TODTH_RD(2) |
|
||||
DDRMC_CR161_TODTH_WR(2), 161 },
|
||||
/* end marker */
|
||||
{ 0, -1 }
|
||||
};
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
struct ddrmc_lvl_info lvl = {
|
||||
.wrlvl_reg_en = 1,
|
||||
.wrlvl_dl_0 = 0,
|
||||
.wrlvl_dl_1 = 0,
|
||||
.rdlvl_gt_reg_en = 1,
|
||||
.rdlvl_gt_dl_0 = 4,
|
||||
.rdlvl_gt_dl_1 = 4,
|
||||
.rdlvl_reg_en = 1,
|
||||
.rdlvl_dl_0 = 0,
|
||||
.rdlvl_dl_1 = 0,
|
||||
};
|
||||
|
||||
static const struct ddr3_jedec_timings timings = {
|
||||
.tinit = 5,
|
||||
.trst_pwron = 80000,
|
||||
.cke_inactive = 200000,
|
||||
.wrlat = 5,
|
||||
.caslat_lin = 12,
|
||||
.trc = 21,
|
||||
.trrd = 4,
|
||||
.tccd = 4,
|
||||
.tfaw = 20,
|
||||
.trp = 6,
|
||||
.twtr = 4,
|
||||
.tras_min = 15,
|
||||
.tmrd = 4,
|
||||
.trtp = 4,
|
||||
.tras_max = 28080,
|
||||
.tmod = 12,
|
||||
.tckesr = 4,
|
||||
.tcke = 3,
|
||||
.trcd_int = 6,
|
||||
.tdal = 12,
|
||||
.tdll = 512,
|
||||
.trp_ab = 6,
|
||||
.tref = 3120,
|
||||
.trfc = 44,
|
||||
.tpdex = 3,
|
||||
.txpdll = 10,
|
||||
.txsnr = 48,
|
||||
.txsr = 468,
|
||||
.cksrx = 5,
|
||||
.cksre = 5,
|
||||
.zqcl = 256,
|
||||
.zqinit = 512,
|
||||
.zqcs = 64,
|
||||
.ref_per_zq = 64,
|
||||
.aprebit = 10,
|
||||
.wlmrd = 40,
|
||||
.wldqsen = 25,
|
||||
.tinit = 5,
|
||||
.trst_pwron = 80000,
|
||||
.cke_inactive = 200000,
|
||||
.wrlat = 5,
|
||||
.caslat_lin = 12,
|
||||
.trc = 21,
|
||||
.trrd = 4,
|
||||
.tccd = 4,
|
||||
.tbst_int_interval = 0,
|
||||
.tfaw = 20,
|
||||
.trp = 6,
|
||||
.twtr = 4,
|
||||
.tras_min = 15,
|
||||
.tmrd = 4,
|
||||
.trtp = 4,
|
||||
.tras_max = 28080,
|
||||
.tmod = 12,
|
||||
.tckesr = 4,
|
||||
.tcke = 3,
|
||||
.trcd_int = 6,
|
||||
.tras_lockout = 0,
|
||||
.tdal = 12,
|
||||
.bstlen = 3,
|
||||
.tdll = 512,
|
||||
.trp_ab = 6,
|
||||
.tref = 3120,
|
||||
.trfc = 44,
|
||||
.tref_int = 0,
|
||||
.tpdex = 3,
|
||||
.txpdll = 10,
|
||||
.txsnr = 48,
|
||||
.txsr = 468,
|
||||
.cksrx = 5,
|
||||
.cksre = 5,
|
||||
.freq_chg_en = 0,
|
||||
.zqcl = 256,
|
||||
.zqinit = 512,
|
||||
.zqcs = 64,
|
||||
.ref_per_zq = 64,
|
||||
.zqcs_rotate = 0,
|
||||
.aprebit = 10,
|
||||
.cmd_age_cnt = 64,
|
||||
.age_cnt = 64,
|
||||
.q_fullness = 7,
|
||||
.odt_rd_mapcs0 = 0,
|
||||
.odt_wr_mapcs0 = 1,
|
||||
.wlmrd = 40,
|
||||
.wldqsen = 25,
|
||||
};
|
||||
|
||||
ddrmc_setup_iomux();
|
||||
ddrmc_setup_iomux(NULL, 0);
|
||||
|
||||
ddrmc_ctrl_init_ddr3(&timings, &lvl, 1, 3);
|
||||
ddrmc_ctrl_init_ddr3(&timings, vf610twr_cr_settings, NULL, 1, 3);
|
||||
gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
|
||||
|
||||
return 0;
|
||||
|
||||
13
board/lwmon5/Kconfig
Normal file
13
board/lwmon5/Kconfig
Normal file
@@ -0,0 +1,13 @@
|
||||
if TARGET_LWMON5
|
||||
|
||||
config SYS_BOARD
|
||||
default "lwmon5"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "lwmon5"
|
||||
|
||||
config DISPLAY_BOARDINFO
|
||||
bool
|
||||
default y
|
||||
|
||||
endif
|
||||
6
board/lwmon5/MAINTAINERS
Normal file
6
board/lwmon5/MAINTAINERS
Normal file
@@ -0,0 +1,6 @@
|
||||
LWMON5 BOARD
|
||||
M: Stefan Roese <sr@denx.de>
|
||||
S: Maintained
|
||||
F: board/lwmon5/
|
||||
F: include/configs/lwmon5.h
|
||||
F: configs/lwmon5_defconfig
|
||||
9
board/lwmon5/Makefile
Normal file
9
board/lwmon5/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# (C) Copyright 2002-2006
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y = lwmon5.o kbd.o sdram.o
|
||||
extra-y += init.o
|
||||
18
board/lwmon5/config.mk
Normal file
18
board/lwmon5/config.mk
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# (C) Copyright 2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# lwmon5 (440EPx)
|
||||
#
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_440=1
|
||||
|
||||
ifeq ($(debug),1)
|
||||
PLATFORM_CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(dbcr),1)
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_SYS_INIT_DBCR=0x8cff0000
|
||||
endif
|
||||
75
board/lwmon5/init.S
Normal file
75
board/lwmon5/init.S
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* (C) Copyright 2007
|
||||
* Stefan Roese, DENX Software Engineering, sr@denx.de.
|
||||
*
|
||||
* Copyright (C) 2002 Scott McNutt <smcnutt@artesyncp.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm-offsets.h>
|
||||
#include <ppc_asm.tmpl>
|
||||
#include <config.h>
|
||||
#include <asm/mmu.h>
|
||||
|
||||
/**************************************************************************
|
||||
* TLB TABLE
|
||||
*
|
||||
* This table is used by the cpu boot code to setup the initial tlb
|
||||
* entries. Rather than make broad assumptions in the cpu source tree,
|
||||
* this table lets each board set things up however they like.
|
||||
*
|
||||
* Pointer to the table is returned in r1
|
||||
*
|
||||
*************************************************************************/
|
||||
.section .bootpg,"ax"
|
||||
.globl tlbtab
|
||||
|
||||
tlbtab:
|
||||
tlbtab_start
|
||||
|
||||
/*
|
||||
* BOOT_CS (FLASH) must be first. Before relocation SA_I can be off to use the
|
||||
* speed up boot process. It is patched after relocation to enable SA_I
|
||||
*/
|
||||
tlbentry(CONFIG_SYS_BOOT_BASE_ADDR, SZ_256M, CONFIG_SYS_BOOT_BASE_ADDR, 1, AC_RWX | SA_G)
|
||||
|
||||
/*
|
||||
* TLB entries for SDRAM are not needed on this platform.
|
||||
* They are dynamically generated in the SPD DDR(2) detection
|
||||
* routine.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SYS_INIT_RAM_DCACHE
|
||||
/* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
|
||||
tlbentry(CONFIG_SYS_INIT_RAM_ADDR, SZ_4K, CONFIG_SYS_INIT_RAM_ADDR, 0, AC_RWX | SA_G)
|
||||
#endif
|
||||
|
||||
/* TLB-entry for PCI Memory */
|
||||
tlbentry(CONFIG_SYS_PCI_MEMBASE, SZ_256M, CONFIG_SYS_PCI_MEMBASE, 1, AC_RW | SA_IG)
|
||||
tlbentry(CONFIG_SYS_PCI_MEMBASE1, SZ_256M, CONFIG_SYS_PCI_MEMBASE1, 1, AC_RW | SA_IG)
|
||||
tlbentry(CONFIG_SYS_PCI_MEMBASE2, SZ_256M, CONFIG_SYS_PCI_MEMBASE2, 1, AC_RW | SA_IG)
|
||||
tlbentry(CONFIG_SYS_PCI_MEMBASE3, SZ_256M, CONFIG_SYS_PCI_MEMBASE3, 1, AC_RW | SA_IG)
|
||||
|
||||
/* TLB-entry for the FPGA Chip select 2 */
|
||||
tlbentry(CONFIG_SYS_FPGA_BASE_0, SZ_1M, CONFIG_SYS_FPGA_BASE_0, 1, AC_RWX | SA_I|SA_G)
|
||||
|
||||
/* TLB-entry for the FPGA Chip select 3 */
|
||||
tlbentry(CONFIG_SYS_FPGA_BASE_1, SZ_1M, CONFIG_SYS_FPGA_BASE_1, 1,AC_RWX | SA_I|SA_G)
|
||||
|
||||
/* TLB-entry for the LIME Controller */
|
||||
tlbentry(CONFIG_SYS_LIME_BASE_0, SZ_16M, CONFIG_SYS_LIME_BASE_0, 1, AC_RWX | SA_I|SA_G)
|
||||
tlbentry(CONFIG_SYS_LIME_BASE_1, SZ_16M, CONFIG_SYS_LIME_BASE_1, 1, AC_RWX | SA_I|SA_G)
|
||||
tlbentry(CONFIG_SYS_LIME_BASE_2, SZ_16M, CONFIG_SYS_LIME_BASE_2, 1, AC_RWX | SA_I|SA_G)
|
||||
tlbentry(CONFIG_SYS_LIME_BASE_3, SZ_16M, CONFIG_SYS_LIME_BASE_3, 1, AC_RWX | SA_I|SA_G)
|
||||
|
||||
/* TLB-entry for Internal Registers & OCM */
|
||||
tlbentry(0xe0000000, SZ_16M, 0xe0000000, 0, AC_RWX | SA_I)
|
||||
|
||||
/*TLB-entry PCI registers*/
|
||||
tlbentry(0xEEC00000, SZ_1K, 0xEEC00000, 1, AC_RWX | SA_IG)
|
||||
|
||||
/* TLB-entry for peripherals */
|
||||
tlbentry(0xEF000000, SZ_16M, 0xEF000000, 1, AC_RWX | SA_IG)
|
||||
|
||||
tlbtab_end
|
||||
490
board/lwmon5/kbd.c
Normal file
490
board/lwmon5/kbd.c
Normal file
@@ -0,0 +1,490 @@
|
||||
/*
|
||||
* (C) Copyright 2007
|
||||
* Stefan Roese, DENX Software Engineering, sr@denx.de.
|
||||
*
|
||||
* (C) Copyright 2001, 2002
|
||||
* DENX Software Engineering
|
||||
* Wolfgang Denk, wd@denx.de
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/* define DEBUG for debugging output (obviously ;-)) */
|
||||
#if 0
|
||||
#define DEBUG
|
||||
#endif
|
||||
|
||||
#include <common.h>
|
||||
#include <i2c.h>
|
||||
#include <command.h>
|
||||
#include <post.h>
|
||||
#include <serial.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/string.h> /* for strdup */
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static void kbd_init (void);
|
||||
static int compare_magic (uchar *kbd_data, uchar *str);
|
||||
|
||||
/*--------------------- Local macros and constants --------------------*/
|
||||
#define _NOT_USED_ 0xFFFFFFFF
|
||||
|
||||
/*------------------------- dspic io expander -----------------------*/
|
||||
#define DSPIC_PON_STATUS_REG 0x80A
|
||||
#define DSPIC_PON_INV_STATUS_REG 0x80C
|
||||
#define DSPIC_PON_KEY_REG 0x810
|
||||
/*------------------------- Keyboard controller -----------------------*/
|
||||
/* command codes */
|
||||
#define KEYBD_CMD_READ_KEYS 0x01
|
||||
#define KEYBD_CMD_READ_VERSION 0x02
|
||||
#define KEYBD_CMD_READ_STATUS 0x03
|
||||
#define KEYBD_CMD_RESET_ERRORS 0x10
|
||||
|
||||
/* status codes */
|
||||
#define KEYBD_STATUS_MASK 0x3F
|
||||
#define KEYBD_STATUS_H_RESET 0x20
|
||||
#define KEYBD_STATUS_BROWNOUT 0x10
|
||||
#define KEYBD_STATUS_WD_RESET 0x08
|
||||
#define KEYBD_STATUS_OVERLOAD 0x04
|
||||
#define KEYBD_STATUS_ILLEGAL_WR 0x02
|
||||
#define KEYBD_STATUS_ILLEGAL_RD 0x01
|
||||
|
||||
/* Number of bytes returned from Keyboard Controller */
|
||||
#define KEYBD_VERSIONLEN 2 /* version information */
|
||||
|
||||
/*
|
||||
* This is different from the "old" lwmon dsPIC kbd controller
|
||||
* implementation. Now the controller still answers with 9 bytes,
|
||||
* but the last 3 bytes are always "0x06 0x07 0x08". So we just
|
||||
* set the length to compare to 6 instead of 9.
|
||||
*/
|
||||
#define KEYBD_DATALEN 6 /* normal key scan data */
|
||||
|
||||
/* maximum number of "magic" key codes that can be assigned */
|
||||
|
||||
static uchar kbd_addr = CONFIG_SYS_I2C_KEYBD_ADDR;
|
||||
static uchar dspic_addr = CONFIG_SYS_I2C_DSPIC_IO_ADDR;
|
||||
|
||||
static uchar *key_match (uchar *);
|
||||
|
||||
#define KEYBD_SET_DEBUGMODE '#' /* Magic key to enable debug output */
|
||||
|
||||
/***********************************************************************
|
||||
F* Function: int board_postclk_init (void) P*A*Z*
|
||||
*
|
||||
P* Parameters: none
|
||||
P*
|
||||
P* Returnvalue: int
|
||||
P* - 0 is always returned.
|
||||
*
|
||||
Z* Intention: This function is the board_postclk_init() method implementation
|
||||
Z* for the lwmon board.
|
||||
*
|
||||
***********************************************************************/
|
||||
int board_postclk_init (void)
|
||||
{
|
||||
kbd_init();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void kbd_init (void)
|
||||
{
|
||||
uchar kbd_data[KEYBD_DATALEN];
|
||||
uchar tmp_data[KEYBD_DATALEN];
|
||||
uchar val, errcd;
|
||||
int i;
|
||||
|
||||
i2c_set_bus_num(0);
|
||||
|
||||
gd->arch.kbd_status = 0;
|
||||
|
||||
/* Forced by PIC. Delays <= 175us loose */
|
||||
udelay(1000);
|
||||
|
||||
/* Read initial keyboard error code */
|
||||
val = KEYBD_CMD_READ_STATUS;
|
||||
i2c_write (kbd_addr, 0, 0, &val, 1);
|
||||
i2c_read (kbd_addr, 0, 0, &errcd, 1);
|
||||
/* clear unused bits */
|
||||
errcd &= KEYBD_STATUS_MASK;
|
||||
/* clear "irrelevant" bits. Recommended by Martin Rajek, LWN */
|
||||
errcd &= ~(KEYBD_STATUS_H_RESET|KEYBD_STATUS_BROWNOUT);
|
||||
if (errcd) {
|
||||
gd->arch.kbd_status |= errcd << 8;
|
||||
}
|
||||
/* Reset error code and verify */
|
||||
val = KEYBD_CMD_RESET_ERRORS;
|
||||
i2c_write (kbd_addr, 0, 0, &val, 1);
|
||||
udelay(1000); /* delay NEEDED by keyboard PIC !!! */
|
||||
|
||||
val = KEYBD_CMD_READ_STATUS;
|
||||
i2c_write (kbd_addr, 0, 0, &val, 1);
|
||||
i2c_read (kbd_addr, 0, 0, &val, 1);
|
||||
|
||||
val &= KEYBD_STATUS_MASK; /* clear unused bits */
|
||||
if (val) { /* permanent error, report it */
|
||||
gd->arch.kbd_status |= val;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read current keyboard state.
|
||||
*
|
||||
* After the error reset it may take some time before the
|
||||
* keyboard PIC picks up a valid keyboard scan - the total
|
||||
* scan time is approx. 1.6 ms (information by Martin Rajek,
|
||||
* 28 Sep 2002). We read a couple of times for the keyboard
|
||||
* to stabilize, using a big enough delay.
|
||||
* 10 times should be enough. If the data is still changing,
|
||||
* we use what we get :-(
|
||||
*/
|
||||
|
||||
memset (tmp_data, 0xFF, KEYBD_DATALEN); /* impossible value */
|
||||
for (i=0; i<10; ++i) {
|
||||
val = KEYBD_CMD_READ_KEYS;
|
||||
i2c_write (kbd_addr, 0, 0, &val, 1);
|
||||
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
|
||||
|
||||
if (memcmp(kbd_data, tmp_data, KEYBD_DATALEN) == 0) {
|
||||
/* consistent state, done */
|
||||
break;
|
||||
}
|
||||
/* remeber last state, delay, and retry */
|
||||
memcpy (tmp_data, kbd_data, KEYBD_DATALEN);
|
||||
udelay (5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read a register from the dsPIC. */
|
||||
int _dspic_read(ushort reg, ushort *data)
|
||||
{
|
||||
uchar buf[sizeof(*data)];
|
||||
int rval;
|
||||
|
||||
if (i2c_read(dspic_addr, reg, 2, buf, 2))
|
||||
return -1;
|
||||
|
||||
rval = i2c_read(dspic_addr, reg, sizeof(reg), buf, sizeof(*data));
|
||||
*data = (buf[0] << 8) | buf[1];
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
F* Function: int misc_init_r (void) P*A*Z*
|
||||
*
|
||||
P* Parameters: none
|
||||
P*
|
||||
P* Returnvalue: int
|
||||
P* - 0 is always returned, even in the case of a keyboard
|
||||
P* error.
|
||||
*
|
||||
Z* Intention: This function is the misc_init_r() method implementation
|
||||
Z* for the lwmon board.
|
||||
Z* The keyboard controller is initialized and the result
|
||||
Z* of a read copied to the environment variable "keybd".
|
||||
Z* If KEYBD_SET_DEBUGMODE is defined, a check is made for
|
||||
Z* this key, and if found display to the LCD will be enabled.
|
||||
Z* The keys in "keybd" are checked against the magic
|
||||
Z* keycommands defined in the environment.
|
||||
Z* See also key_match().
|
||||
*
|
||||
D* Design: wd@denx.de
|
||||
C* Coding: wd@denx.de
|
||||
V* Verification: dzu@denx.de
|
||||
***********************************************************************/
|
||||
int misc_init_r_kbd (void)
|
||||
{
|
||||
uchar kbd_data[KEYBD_DATALEN];
|
||||
char keybd_env[2 * KEYBD_DATALEN + 1];
|
||||
uchar kbd_init_status = gd->arch.kbd_status >> 8;
|
||||
uchar kbd_status = gd->arch.kbd_status;
|
||||
uchar val;
|
||||
ushort data, inv_data;
|
||||
char *str;
|
||||
int i;
|
||||
|
||||
if (kbd_init_status) {
|
||||
printf ("KEYBD: Error %02X\n", kbd_init_status);
|
||||
}
|
||||
if (kbd_status) { /* permanent error, report it */
|
||||
printf ("*** Keyboard error code %02X ***\n", kbd_status);
|
||||
sprintf (keybd_env, "%02X", kbd_status);
|
||||
setenv ("keybd", keybd_env);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we know that we have a working keyboard, so disable
|
||||
* all output to the LCD except when a key press is detected.
|
||||
*/
|
||||
|
||||
if ((console_assign (stdout, "serial") < 0) ||
|
||||
(console_assign (stderr, "serial") < 0)) {
|
||||
printf ("Can't assign serial port as output device\n");
|
||||
}
|
||||
|
||||
/* Read Version */
|
||||
val = KEYBD_CMD_READ_VERSION;
|
||||
i2c_write (kbd_addr, 0, 0, &val, 1);
|
||||
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_VERSIONLEN);
|
||||
printf ("KEYBD: Version %d.%d\n", kbd_data[0], kbd_data[1]);
|
||||
|
||||
/* Read current keyboard state */
|
||||
val = KEYBD_CMD_READ_KEYS;
|
||||
i2c_write (kbd_addr, 0, 0, &val, 1);
|
||||
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
|
||||
|
||||
/* read out start key from bse01 received via can */
|
||||
_dspic_read(DSPIC_PON_STATUS_REG, &data);
|
||||
/* check highbyte from status register */
|
||||
if (data > 0xFF) {
|
||||
_dspic_read(DSPIC_PON_INV_STATUS_REG, &inv_data);
|
||||
|
||||
/* check inverse data */
|
||||
if ((data+inv_data) == 0xFFFF) {
|
||||
/* don't overwrite local key */
|
||||
if (kbd_data[1] == 0) {
|
||||
/* read key value */
|
||||
_dspic_read(DSPIC_PON_KEY_REG, &data);
|
||||
str = (char *)&data;
|
||||
/* swap bytes */
|
||||
kbd_data[1] = str[1];
|
||||
kbd_data[2] = str[0];
|
||||
printf("CAN received startkey: 0x%X\n", data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < KEYBD_DATALEN; ++i) {
|
||||
sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
|
||||
}
|
||||
|
||||
setenv ("keybd", keybd_env);
|
||||
|
||||
str = strdup ((char *)key_match (kbd_data)); /* decode keys */
|
||||
#ifdef KEYBD_SET_DEBUGMODE
|
||||
if (kbd_data[0] == KEYBD_SET_DEBUGMODE) { /* set debug mode */
|
||||
if ((console_assign (stdout, "lcd") < 0) ||
|
||||
(console_assign (stderr, "lcd") < 0)) {
|
||||
printf ("Can't assign LCD display as output device\n");
|
||||
}
|
||||
}
|
||||
#endif /* KEYBD_SET_DEBUGMODE */
|
||||
#ifdef CONFIG_PREBOOT /* automatically configure "preboot" command on key match */
|
||||
setenv ("preboot", str); /* set or delete definition */
|
||||
#endif /* CONFIG_PREBOOT */
|
||||
if (str != NULL) {
|
||||
free (str);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PREBOOT
|
||||
|
||||
static uchar kbd_magic_prefix[] = "key_magic";
|
||||
static uchar kbd_command_prefix[] = "key_cmd";
|
||||
|
||||
static int compare_magic (uchar *kbd_data, uchar *str)
|
||||
{
|
||||
uchar compare[KEYBD_DATALEN-1];
|
||||
char *nxt;
|
||||
int i;
|
||||
|
||||
/* Don't include modifier byte */
|
||||
memcpy (compare, kbd_data+1, KEYBD_DATALEN-1);
|
||||
|
||||
for (; str != NULL; str = (*nxt) ? (uchar *)(nxt+1) : (uchar *)nxt) {
|
||||
uchar c;
|
||||
int k;
|
||||
|
||||
c = (uchar) simple_strtoul ((char *)str, (char **) (&nxt), 16);
|
||||
|
||||
if (str == (uchar *)nxt) { /* invalid character */
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if this key matches the input.
|
||||
* Set matches to zero, so they match only once
|
||||
* and we can find duplicates or extra keys
|
||||
*/
|
||||
for (k = 0; k < sizeof(compare); ++k) {
|
||||
if (compare[k] == '\0') /* only non-zero entries */
|
||||
continue;
|
||||
if (c == compare[k]) { /* found matching key */
|
||||
compare[k] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (k == sizeof(compare)) {
|
||||
return -1; /* unmatched key */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A full match leaves no keys in the `compare' array,
|
||||
*/
|
||||
for (i = 0; i < sizeof(compare); ++i) {
|
||||
if (compare[i])
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
F* Function: static uchar *key_match (uchar *kbd_data) P*A*Z*
|
||||
*
|
||||
P* Parameters: uchar *kbd_data
|
||||
P* - The keys to match against our magic definitions
|
||||
P*
|
||||
P* Returnvalue: uchar *
|
||||
P* - != NULL: Pointer to the corresponding command(s)
|
||||
P* NULL: No magic is about to happen
|
||||
*
|
||||
Z* Intention: Check if pressed key(s) match magic sequence,
|
||||
Z* and return the command string associated with that key(s).
|
||||
Z*
|
||||
Z* If no key press was decoded, NULL is returned.
|
||||
Z*
|
||||
Z* Note: the first character of the argument will be
|
||||
Z* overwritten with the "magic charcter code" of the
|
||||
Z* decoded key(s), or '\0'.
|
||||
Z*
|
||||
Z* Note: the string points to static environment data
|
||||
Z* and must be saved before you call any function that
|
||||
Z* modifies the environment.
|
||||
*
|
||||
D* Design: wd@denx.de
|
||||
C* Coding: wd@denx.de
|
||||
V* Verification: dzu@denx.de
|
||||
***********************************************************************/
|
||||
static uchar *key_match (uchar *kbd_data)
|
||||
{
|
||||
char magic[sizeof (kbd_magic_prefix) + 1];
|
||||
uchar *suffix;
|
||||
char *kbd_magic_keys;
|
||||
|
||||
/*
|
||||
* The following string defines the characters that can pe appended
|
||||
* to "key_magic" to form the names of environment variables that
|
||||
* hold "magic" key codes, i. e. such key codes that can cause
|
||||
* pre-boot actions. If the string is empty (""), then only
|
||||
* "key_magic" is checked (old behaviour); the string "125" causes
|
||||
* checks for "key_magic1", "key_magic2" and "key_magic5", etc.
|
||||
*/
|
||||
if ((kbd_magic_keys = getenv ("magic_keys")) == NULL)
|
||||
kbd_magic_keys = "";
|
||||
|
||||
/* loop over all magic keys;
|
||||
* use '\0' suffix in case of empty string
|
||||
*/
|
||||
for (suffix=(uchar *)kbd_magic_keys; *suffix || suffix==(uchar *)kbd_magic_keys; ++suffix) {
|
||||
sprintf (magic, "%s%c", kbd_magic_prefix, *suffix);
|
||||
debug ("### Check magic \"%s\"\n", magic);
|
||||
if (compare_magic(kbd_data, (uchar *)getenv(magic)) == 0) {
|
||||
char cmd_name[sizeof (kbd_command_prefix) + 1];
|
||||
char *cmd;
|
||||
|
||||
sprintf (cmd_name, "%s%c", kbd_command_prefix, *suffix);
|
||||
|
||||
cmd = getenv (cmd_name);
|
||||
debug ("### Set PREBOOT to $(%s): \"%s\"\n",
|
||||
cmd_name, cmd ? cmd : "<<NULL>>");
|
||||
*kbd_data = *suffix;
|
||||
return ((uchar *)cmd);
|
||||
}
|
||||
}
|
||||
debug ("### Delete PREBOOT\n");
|
||||
*kbd_data = '\0';
|
||||
return (NULL);
|
||||
}
|
||||
#endif /* CONFIG_PREBOOT */
|
||||
|
||||
/***********************************************************************
|
||||
F* Function: int do_kbd (cmd_tbl_t *cmdtp, int flag,
|
||||
F* int argc, char * const argv[]) P*A*Z*
|
||||
*
|
||||
P* Parameters: cmd_tbl_t *cmdtp
|
||||
P* - Pointer to our command table entry
|
||||
P* int flag
|
||||
P* - If the CMD_FLAG_REPEAT bit is set, then this call is
|
||||
P* a repetition
|
||||
P* int argc
|
||||
P* - Argument count
|
||||
P* char * const argv[]
|
||||
P* - Array of the actual arguments
|
||||
P*
|
||||
P* Returnvalue: int
|
||||
P* - 0 is always returned.
|
||||
*
|
||||
Z* Intention: Implement the "kbd" command.
|
||||
Z* The keyboard status is read. The result is printed on
|
||||
Z* the console and written into the "keybd" environment
|
||||
Z* variable.
|
||||
*
|
||||
D* Design: wd@denx.de
|
||||
C* Coding: wd@denx.de
|
||||
V* Verification: dzu@denx.de
|
||||
***********************************************************************/
|
||||
int do_kbd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
uchar kbd_data[KEYBD_DATALEN];
|
||||
char keybd_env[2 * KEYBD_DATALEN + 1];
|
||||
uchar val;
|
||||
int i;
|
||||
|
||||
#if 0 /* Done in kbd_init */
|
||||
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
|
||||
#endif
|
||||
|
||||
/* Read keys */
|
||||
val = KEYBD_CMD_READ_KEYS;
|
||||
i2c_write (kbd_addr, 0, 0, &val, 1);
|
||||
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
|
||||
|
||||
puts ("Keys:");
|
||||
for (i = 0; i < KEYBD_DATALEN; ++i) {
|
||||
sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
|
||||
printf (" %02x", kbd_data[i]);
|
||||
}
|
||||
putc ('\n');
|
||||
setenv ("keybd", keybd_env);
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
kbd, 1, 1, do_kbd,
|
||||
"read keyboard status",
|
||||
""
|
||||
);
|
||||
|
||||
/*----------------------------- Utilities -----------------------------*/
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
int post_hotkeys_pressed(void)
|
||||
{
|
||||
uchar kbd_data[KEYBD_DATALEN];
|
||||
uchar val;
|
||||
|
||||
/* Read keys */
|
||||
val = KEYBD_CMD_READ_KEYS;
|
||||
i2c_write (kbd_addr, 0, 0, &val, 1);
|
||||
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
|
||||
|
||||
return (compare_magic(kbd_data, (uchar *)CONFIG_POST_KEY_MAGIC) == 0);
|
||||
}
|
||||
#endif
|
||||
550
board/lwmon5/lwmon5.c
Normal file
550
board/lwmon5/lwmon5.c
Normal file
@@ -0,0 +1,550 @@
|
||||
/*
|
||||
* (C) Copyright 2007-2013
|
||||
* Stefan Roese, DENX Software Engineering, sr@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <asm/ppc440.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/ppc4xx-gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <post.h>
|
||||
#include <flash.h>
|
||||
#include <mtd/cfi_flash.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static phys_addr_t lwmon5_cfi_flash_bank_addr[2] = CONFIG_SYS_FLASH_BANKS_LIST;
|
||||
|
||||
ulong flash_get_size(ulong base, int banknum);
|
||||
int misc_init_r_kbd(void);
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
u32 sdr0_pfc1, sdr0_pfc2;
|
||||
u32 reg;
|
||||
|
||||
/* PLB Write pipelining disabled. Denali Core workaround */
|
||||
mtdcr(PLB4A0_ACR, 0xDE000000);
|
||||
mtdcr(PLB4A1_ACR, 0xDE000000);
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Setup the interrupt controller polarities, triggers, etc.
|
||||
*-------------------------------------------------------------------*/
|
||||
mtdcr(UIC0SR, 0xffffffff); /* clear all. if write with 1 then the status is cleared */
|
||||
mtdcr(UIC0ER, 0x00000000); /* disable all */
|
||||
mtdcr(UIC0CR, 0x00000000); /* we have not critical interrupts at the moment */
|
||||
mtdcr(UIC0PR, 0xFFBFF1EF); /* Adjustment of the polarity */
|
||||
mtdcr(UIC0TR, 0x00000900); /* per ref-board manual */
|
||||
mtdcr(UIC0VR, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
|
||||
mtdcr(UIC0SR, 0xffffffff); /* clear all */
|
||||
|
||||
mtdcr(UIC1SR, 0xffffffff); /* clear all */
|
||||
mtdcr(UIC1ER, 0x00000000); /* disable all */
|
||||
mtdcr(UIC1CR, 0x00000000); /* all non-critical */
|
||||
mtdcr(UIC1PR, 0xFFFFC6A5); /* Adjustment of the polarity */
|
||||
mtdcr(UIC1TR, 0x60000040); /* per ref-board manual */
|
||||
mtdcr(UIC1VR, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
|
||||
mtdcr(UIC1SR, 0xffffffff); /* clear all */
|
||||
|
||||
mtdcr(UIC2SR, 0xffffffff); /* clear all */
|
||||
mtdcr(UIC2ER, 0x00000000); /* disable all */
|
||||
mtdcr(UIC2CR, 0x00000000); /* all non-critical */
|
||||
mtdcr(UIC2PR, 0x27C00000); /* Adjustment of the polarity */
|
||||
mtdcr(UIC2TR, 0x3C000000); /* per ref-board manual */
|
||||
mtdcr(UIC2VR, 0x00000000); /* int31 highest, base=0x000 is within DDRAM */
|
||||
mtdcr(UIC2SR, 0xffffffff); /* clear all */
|
||||
|
||||
/* Trace Pins are disabled. SDR0_PFC0 Register */
|
||||
mtsdr(SDR0_PFC0, 0x0);
|
||||
|
||||
/* select Ethernet pins */
|
||||
mfsdr(SDR0_PFC1, sdr0_pfc1);
|
||||
/* SMII via ZMII */
|
||||
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) |
|
||||
SDR0_PFC1_SELECT_CONFIG_6;
|
||||
mfsdr(SDR0_PFC2, sdr0_pfc2);
|
||||
sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) |
|
||||
SDR0_PFC2_SELECT_CONFIG_6;
|
||||
|
||||
/* enable SPI (SCP) */
|
||||
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_SCP_SEL;
|
||||
|
||||
mtsdr(SDR0_PFC2, sdr0_pfc2);
|
||||
mtsdr(SDR0_PFC1, sdr0_pfc1);
|
||||
|
||||
mtsdr(SDR0_PFC4, 0x80000000);
|
||||
|
||||
/* PCI arbiter disabled */
|
||||
/* PCI Host Configuration disbaled */
|
||||
mfsdr(SDR0_PCI0, reg);
|
||||
reg = 0;
|
||||
mtsdr(SDR0_PCI0, 0x00000000 | reg);
|
||||
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_FLASH_WP, 1);
|
||||
|
||||
#if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
|
||||
/* enable the LSB transmitter */
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_LSB_ENABLE, 1);
|
||||
/* enable the CAN transmitter */
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_CAN_ENABLE, 1);
|
||||
|
||||
reg = 0; /* reuse as counter */
|
||||
out_be32((void *)CONFIG_SYS_DSPIC_TEST_ADDR,
|
||||
in_be32((void *)CONFIG_SYS_DSPIC_TEST_ADDR)
|
||||
& ~CONFIG_SYS_DSPIC_TEST_MASK);
|
||||
while (gpio_read_in_bit(CONFIG_SYS_GPIO_DSPIC_READY) && reg++ < 1000) {
|
||||
udelay(1000);
|
||||
}
|
||||
if (gpio_read_in_bit(CONFIG_SYS_GPIO_DSPIC_READY)) {
|
||||
/* set "boot error" flag */
|
||||
out_be32((void *)CONFIG_SYS_DSPIC_TEST_ADDR,
|
||||
in_be32((void *)CONFIG_SYS_DSPIC_TEST_ADDR) |
|
||||
CONFIG_SYS_DSPIC_TEST_MASK);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Reset PHY's:
|
||||
* The PHY's need a 2nd reset pulse, since the MDIO address is latched
|
||||
* upon reset, and with the first reset upon powerup, the addresses are
|
||||
* not latched reliable, since the IRQ line is multiplexed with an
|
||||
* MDIO address. A 2nd reset at this time will make sure, that the
|
||||
* correct address is latched.
|
||||
*/
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_PHY0_RST, 1);
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_PHY1_RST, 1);
|
||||
udelay(1000);
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_PHY0_RST, 0);
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_PHY1_RST, 0);
|
||||
udelay(1000);
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_PHY0_RST, 1);
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_PHY1_RST, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Override weak default with board specific version
|
||||
*/
|
||||
phys_addr_t cfi_flash_bank_addr(int bank)
|
||||
{
|
||||
return lwmon5_cfi_flash_bank_addr[bank];
|
||||
}
|
||||
|
||||
/*
|
||||
* Override the weak default mapping function with a board specific one
|
||||
*/
|
||||
u32 flash_get_bank_size(int cs, int idx)
|
||||
{
|
||||
return flash_info[idx].size;
|
||||
}
|
||||
|
||||
int board_early_init_r(void)
|
||||
{
|
||||
u32 val0, val1;
|
||||
|
||||
/*
|
||||
* lwmon5 is manufactured in 2 different board versions:
|
||||
* The lwmon5a board has 64MiB NOR flash instead of the
|
||||
* 128MiB of the original lwmon5. Unfortunately the CFI driver
|
||||
* will report 2 banks of 64MiB even for the smaller flash
|
||||
* chip, since the bank is mirrored. To fix this, we bring
|
||||
* one bank into CFI query mode and read its response. This
|
||||
* enables us to detect the real number of flash devices/
|
||||
* banks which will be used later on by the common CFI driver.
|
||||
*/
|
||||
|
||||
/* Put bank 0 into CFI command mode and read */
|
||||
out_be32((void *)CONFIG_SYS_FLASH0, 0x00980098);
|
||||
val0 = in_be32((void *)CONFIG_SYS_FLASH0 + FLASH_OFFSET_CFI_RESP);
|
||||
val1 = in_be32((void *)CONFIG_SYS_FLASH1 + FLASH_OFFSET_CFI_RESP);
|
||||
|
||||
/* Reset flash again out of query mode */
|
||||
out_be32((void *)CONFIG_SYS_FLASH0, 0x00f000f0);
|
||||
|
||||
/* When not identical, we have 2 different flash devices/banks */
|
||||
if (val0 != val1)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Now we're sure that we're running on a LWMON5a board with
|
||||
* only 64MiB NOR flash in one bank:
|
||||
*
|
||||
* Set flash base address and bank count for CFI driver probing.
|
||||
*/
|
||||
cfi_flash_num_flash_banks = 1;
|
||||
lwmon5_cfi_flash_bank_addr[0] = CONFIG_SYS_FLASH0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int misc_init_r(void)
|
||||
{
|
||||
u32 pbcr;
|
||||
int size_val = 0;
|
||||
u32 reg;
|
||||
unsigned long usb2d0cr = 0;
|
||||
unsigned long usb2phy0cr, usb2h0cr = 0;
|
||||
unsigned long sdr0_pfc1, sdr0_srst;
|
||||
|
||||
/*
|
||||
* FLASH stuff...
|
||||
*/
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
|
||||
/* adjust flash start and offset */
|
||||
gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
|
||||
gd->bd->bi_flashoffset = 0;
|
||||
|
||||
mfebc(PB0CR, pbcr);
|
||||
size_val = ffs(gd->bd->bi_flashsize) - 21;
|
||||
pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
|
||||
mtebc(PB0CR, pbcr);
|
||||
|
||||
/*
|
||||
* Re-check to get correct base address
|
||||
*/
|
||||
flash_get_size(gd->bd->bi_flashstart, 0);
|
||||
|
||||
/* Monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET, -CONFIG_SYS_MONITOR_LEN, 0xffffffff,
|
||||
&flash_info[cfi_flash_num_flash_banks - 1]);
|
||||
|
||||
/* Env protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR_REDUND,
|
||||
CONFIG_ENV_ADDR_REDUND + 2 * CONFIG_ENV_SECT_SIZE - 1,
|
||||
&flash_info[cfi_flash_num_flash_banks - 1]);
|
||||
|
||||
/*
|
||||
* USB suff...
|
||||
*/
|
||||
|
||||
/* Reset USB */
|
||||
/* Reset of USB2PHY0 must be active at least 10 us */
|
||||
mtsdr(SDR0_SRST0, SDR0_SRST0_USB2H | SDR0_SRST0_USB2D);
|
||||
udelay(2000);
|
||||
|
||||
mtsdr(SDR0_SRST1, SDR0_SRST1_USB20PHY | SDR0_SRST1_USB2HUTMI |
|
||||
SDR0_SRST1_USB2HPHY | SDR0_SRST1_OPBA2 |
|
||||
SDR0_SRST1_PLB42OPB1 | SDR0_SRST1_OPB2PLB40);
|
||||
udelay(2000);
|
||||
|
||||
/* Errata CHIP_6 */
|
||||
|
||||
/* 1. Set internal PHY configuration */
|
||||
/* SDR Setting */
|
||||
mfsdr(SDR0_PFC1, sdr0_pfc1);
|
||||
mfsdr(SDR0_USB0, usb2d0cr);
|
||||
mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
|
||||
mfsdr(SDR0_USB2H0CR, usb2h0cr);
|
||||
|
||||
usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_XOCLK_MASK;
|
||||
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL; /*0*/
|
||||
usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_WDINT_MASK;
|
||||
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_16BIT_30MHZ; /*1*/
|
||||
usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_DVBUS_MASK;
|
||||
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PUREN; /*1*/
|
||||
usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_DWNSTR_MASK;
|
||||
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST; /*1*/
|
||||
usb2phy0cr = usb2phy0cr & ~SDR0_USB2PHY0CR_UTMICN_MASK;
|
||||
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST; /*1*/
|
||||
|
||||
/*
|
||||
* An 8-bit/60MHz interface is the only possible alternative
|
||||
* when connecting the Device to the PHY
|
||||
*/
|
||||
usb2h0cr = usb2h0cr & ~SDR0_USB2H0CR_WDINT_MASK;
|
||||
usb2h0cr = usb2h0cr | SDR0_USB2H0CR_WDINT_16BIT_30MHZ; /*1*/
|
||||
|
||||
mtsdr(SDR0_PFC1, sdr0_pfc1);
|
||||
mtsdr(SDR0_USB0, usb2d0cr);
|
||||
mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
|
||||
mtsdr(SDR0_USB2H0CR, usb2h0cr);
|
||||
|
||||
/* 2. De-assert internal PHY reset */
|
||||
mfsdr(SDR0_SRST1, sdr0_srst);
|
||||
sdr0_srst = sdr0_srst & ~SDR0_SRST1_USB20PHY;
|
||||
mtsdr(SDR0_SRST1, sdr0_srst);
|
||||
|
||||
/* 3. Wait for more than 1 ms */
|
||||
udelay(2000);
|
||||
|
||||
/* 4. De-assert USB 2.0 Host main reset */
|
||||
mfsdr(SDR0_SRST0, sdr0_srst);
|
||||
sdr0_srst = sdr0_srst &~ SDR0_SRST0_USB2H;
|
||||
mtsdr(SDR0_SRST0, sdr0_srst);
|
||||
udelay(1000);
|
||||
|
||||
/* 5. De-assert reset of OPB2 cores */
|
||||
mfsdr(SDR0_SRST1, sdr0_srst);
|
||||
sdr0_srst = sdr0_srst &~ SDR0_SRST1_PLB42OPB1;
|
||||
sdr0_srst = sdr0_srst &~ SDR0_SRST1_OPB2PLB40;
|
||||
sdr0_srst = sdr0_srst &~ SDR0_SRST1_OPBA2;
|
||||
mtsdr(SDR0_SRST1, sdr0_srst);
|
||||
udelay(1000);
|
||||
|
||||
/* 6. Set EHCI Configure FLAG */
|
||||
|
||||
/* 7. Reassert internal PHY reset: */
|
||||
mtsdr(SDR0_SRST1, SDR0_SRST1_USB20PHY);
|
||||
udelay(1000);
|
||||
|
||||
/*
|
||||
* Clear resets
|
||||
*/
|
||||
mtsdr(SDR0_SRST1, 0x00000000);
|
||||
mtsdr(SDR0_SRST0, 0x00000000);
|
||||
|
||||
printf("USB: Host(int phy) Device(ext phy)\n");
|
||||
|
||||
/*
|
||||
* Clear PLB4A0_ACR[WRP]
|
||||
* This fix will make the MAL burst disabling patch for the Linux
|
||||
* EMAC driver obsolete.
|
||||
*/
|
||||
reg = mfdcr(PLB4A0_ACR) & ~PLB4Ax_ACR_WRP_MASK;
|
||||
mtdcr(PLB4A0_ACR, reg);
|
||||
|
||||
/*
|
||||
* Init matrix keyboard
|
||||
*/
|
||||
misc_init_r_kbd();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
char buf[64];
|
||||
int i = getenv_f("serial#", buf, sizeof(buf));
|
||||
|
||||
printf("Board: %s", __stringify(CONFIG_HOSTNAME));
|
||||
|
||||
if (i > 0) {
|
||||
puts(", serial# ");
|
||||
puts(buf);
|
||||
}
|
||||
putc('\n');
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void hw_watchdog_reset(void)
|
||||
{
|
||||
int val;
|
||||
#if defined(CONFIG_WD_MAX_RATE)
|
||||
unsigned long long ct = get_ticks();
|
||||
|
||||
/*
|
||||
* Don't allow watch-dog triggering more frequently than
|
||||
* the predefined value CONFIG_WD_MAX_RATE [ticks].
|
||||
*/
|
||||
if (ct >= gd->arch.wdt_last) {
|
||||
if ((ct - gd->arch.wdt_last) < CONFIG_WD_MAX_RATE)
|
||||
return;
|
||||
} else {
|
||||
/* Time base counter had been reset */
|
||||
if (((unsigned long long)(-1) - gd->arch.wdt_last + ct) <
|
||||
CONFIG_WD_MAX_RATE)
|
||||
return;
|
||||
}
|
||||
gd->arch.wdt_last = get_ticks();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Toggle watchdog output
|
||||
*/
|
||||
val = gpio_read_out_bit(CONFIG_SYS_GPIO_WATCHDOG) == 0 ? 1 : 0;
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_WATCHDOG, val);
|
||||
}
|
||||
|
||||
int do_eeprom_wp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
if (argc < 2)
|
||||
return cmd_usage(cmdtp);
|
||||
|
||||
if ((strcmp(argv[1], "on") == 0))
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_EEPROM_EXT_WP, 1);
|
||||
else if ((strcmp(argv[1], "off") == 0))
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_EEPROM_EXT_WP, 0);
|
||||
else
|
||||
return cmd_usage(cmdtp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
eepromwp, 2, 0, do_eeprom_wp,
|
||||
"eeprom write protect off/on",
|
||||
"<on|off> - enable (on) or disable (off) I2C EEPROM write protect"
|
||||
);
|
||||
|
||||
#if defined(CONFIG_VIDEO)
|
||||
#include <video_fb.h>
|
||||
#include <mb862xx.h>
|
||||
|
||||
extern GraphicDevice mb862xx;
|
||||
|
||||
static const gdc_regs init_regs [] = {
|
||||
{ 0x0100, 0x00000f00 },
|
||||
{ 0x0020, 0x801401df },
|
||||
{ 0x0024, 0x00000000 },
|
||||
{ 0x0028, 0x00000000 },
|
||||
{ 0x002c, 0x00000000 },
|
||||
{ 0x0110, 0x00000000 },
|
||||
{ 0x0114, 0x00000000 },
|
||||
{ 0x0118, 0x01df0280 },
|
||||
{ 0x0004, 0x031f0000 },
|
||||
{ 0x0008, 0x027f027f },
|
||||
{ 0x000c, 0x015f028f },
|
||||
{ 0x0010, 0x020c0000 },
|
||||
{ 0x0014, 0x01df01ea },
|
||||
{ 0x0018, 0x00000000 },
|
||||
{ 0x001c, 0x01e00280 },
|
||||
{ 0x0100, 0x80010f00 },
|
||||
{ 0x0, 0x0 }
|
||||
};
|
||||
|
||||
const gdc_regs *board_get_regs(void)
|
||||
{
|
||||
return init_regs;
|
||||
}
|
||||
|
||||
/* Returns Lime base address */
|
||||
unsigned int board_video_init(void)
|
||||
{
|
||||
/*
|
||||
* Reset Lime controller
|
||||
*/
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_LIME_S, 1);
|
||||
udelay(500);
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_LIME_RST, 1);
|
||||
|
||||
mb862xx.winSizeX = 640;
|
||||
mb862xx.winSizeY = 480;
|
||||
mb862xx.gdfBytesPP = 2;
|
||||
mb862xx.gdfIndex = GDF_15BIT_555RGB;
|
||||
|
||||
return CONFIG_SYS_LIME_BASE_0;
|
||||
}
|
||||
|
||||
#define DEFAULT_BRIGHTNESS 0x64
|
||||
|
||||
static void board_backlight_brightness(int brightness)
|
||||
{
|
||||
if (brightness > 0) {
|
||||
/* pwm duty, lamp on */
|
||||
out_be32((void *)(CONFIG_SYS_FPGA_BASE_0 + 0x00000024), brightness);
|
||||
out_be32((void *)(CONFIG_SYS_FPGA_BASE_0 + 0x00000020), 0x701);
|
||||
} else {
|
||||
/* lamp off */
|
||||
out_be32((void *)(CONFIG_SYS_FPGA_BASE_0 + 0x00000024), 0x00);
|
||||
out_be32((void *)(CONFIG_SYS_FPGA_BASE_0 + 0x00000020), 0x00);
|
||||
}
|
||||
}
|
||||
|
||||
void board_backlight_switch(int flag)
|
||||
{
|
||||
char * param;
|
||||
int rc;
|
||||
|
||||
if (flag) {
|
||||
param = getenv("brightness");
|
||||
rc = param ? simple_strtol(param, NULL, 10) : -1;
|
||||
if (rc < 0)
|
||||
rc = DEFAULT_BRIGHTNESS;
|
||||
} else {
|
||||
rc = 0;
|
||||
}
|
||||
board_backlight_brightness(rc);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_CONSOLE_EXTRA_INFO)
|
||||
/*
|
||||
* Return text to be printed besides the logo.
|
||||
*/
|
||||
void video_get_info_str(int line_number, char *info)
|
||||
{
|
||||
if (line_number == 1)
|
||||
strcpy(info, " Board: Lwmon5 (Liebherr Elektronik GmbH)");
|
||||
else
|
||||
info [0] = '\0';
|
||||
}
|
||||
#endif /* CONFIG_CONSOLE_EXTRA_INFO */
|
||||
#endif /* CONFIG_VIDEO */
|
||||
|
||||
void board_reset(void)
|
||||
{
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_BOARD_RESET, 1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPL_OS_BOOT
|
||||
/*
|
||||
* lwmon5 specific implementation of spl_start_uboot()
|
||||
*
|
||||
* RETURN
|
||||
* 0 if booting into OS is selected (default)
|
||||
* 1 if booting into U-Boot is selected
|
||||
*/
|
||||
int spl_start_uboot(void)
|
||||
{
|
||||
char s[8];
|
||||
|
||||
env_init();
|
||||
getenv_f("boot_os", s, sizeof(s));
|
||||
if ((s != NULL) && (strcmp(s, "yes") == 0))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is called from the SPL U-Boot version for
|
||||
* early init stuff, that needs to be done for OS (e.g. Linux)
|
||||
* booting. Doing it later in the real U-Boot would not work
|
||||
* in case that the SPL U-Boot boots Linux directly.
|
||||
*/
|
||||
void spl_board_init(void)
|
||||
{
|
||||
const gdc_regs *regs = board_get_regs();
|
||||
|
||||
/*
|
||||
* Setup PFC registers, mainly for ethernet support
|
||||
* later on in Linux
|
||||
*/
|
||||
board_early_init_f();
|
||||
|
||||
/* enable the LSB transmitter */
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_LSB_ENABLE, 1);
|
||||
|
||||
/*
|
||||
* Clear resets
|
||||
*/
|
||||
mtsdr(SDR0_SRST1, 0x00000000);
|
||||
mtsdr(SDR0_SRST0, 0x00000000);
|
||||
|
||||
/*
|
||||
* Reset Lime controller
|
||||
*/
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_LIME_S, 1);
|
||||
udelay(500);
|
||||
gpio_write_bit(CONFIG_SYS_GPIO_LIME_RST, 1);
|
||||
|
||||
out_be32((void *)CONFIG_SYS_LIME_SDRAM_CLOCK, CONFIG_SYS_MB862xx_CCF);
|
||||
udelay(300);
|
||||
out_be32((void *)CONFIG_SYS_LIME_MMR, CONFIG_SYS_MB862xx_MMR);
|
||||
|
||||
while (regs->index) {
|
||||
out_be32((void *)(CONFIG_SYS_LIME_BASE_0 + GC_DISP_BASE) +
|
||||
regs->index, regs->value);
|
||||
regs++;
|
||||
}
|
||||
|
||||
board_backlight_brightness(DEFAULT_BRIGHTNESS);
|
||||
}
|
||||
#endif
|
||||
245
board/lwmon5/sdram.c
Normal file
245
board/lwmon5/sdram.c
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* (C) Copyright 2006
|
||||
* Sylvie Gohl, AMCC/IBM, gohl.sylvie@fr.ibm.com
|
||||
* Jacqueline Pira-Ferriol, AMCC/IBM, jpira-ferriol@fr.ibm.com
|
||||
* Thierry Roman, AMCC/IBM, thierry_roman@fr.ibm.com
|
||||
* Alain Saurel, AMCC/IBM, alain.saurel@fr.ibm.com
|
||||
* Robert Snyder, AMCC/IBM, rob.snyder@fr.ibm.com
|
||||
*
|
||||
* (C) Copyright 2007-2013
|
||||
* Stefan Roese, DENX Software Engineering, sr@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/* define DEBUG for debugging output (obviously ;-)) */
|
||||
#if 0
|
||||
#define DEBUG
|
||||
#endif
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/mmu.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/cache.h>
|
||||
#include <asm/ppc440.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
/*
|
||||
* This DDR2 setup code can dynamically setup the TLB entries for the DDR2 memory
|
||||
* region. Right now the cache should still be disabled in U-Boot because of the
|
||||
* EMAC driver, that need it's buffer descriptor to be located in non cached
|
||||
* memory.
|
||||
*
|
||||
* If at some time this restriction doesn't apply anymore, just define
|
||||
* CONFIG_4xx_DCACHE in the board config file and this code should setup
|
||||
* everything correctly.
|
||||
*/
|
||||
#ifdef CONFIG_4xx_DCACHE
|
||||
#define MY_TLB_WORD2_I_ENABLE 0 /* enable caching on SDRAM */
|
||||
#else
|
||||
#define MY_TLB_WORD2_I_ENABLE TLB_WORD2_I_ENABLE /* disable caching on SDRAM */
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------+
|
||||
* Prototypes
|
||||
*-----------------------------------------------------------------------------*/
|
||||
extern int denali_wait_for_dlllock(void);
|
||||
extern void denali_core_search_data_eye(void);
|
||||
extern void dcbz_area(u32 start_address, u32 num_bytes);
|
||||
|
||||
static u32 is_ecc_enabled(void)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
mfsdram(DDR0_22, val);
|
||||
val &= DDR0_22_CTRL_RAW_MASK;
|
||||
if (val)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void board_add_ram_info(int use_default)
|
||||
{
|
||||
PPC4xx_SYS_INFO board_cfg;
|
||||
u32 val;
|
||||
|
||||
if (is_ecc_enabled())
|
||||
puts(" (ECC");
|
||||
else
|
||||
puts(" (ECC not");
|
||||
|
||||
get_sys_info(&board_cfg);
|
||||
printf(" enabled, %ld MHz", (board_cfg.freqPLB * 2) / 1000000);
|
||||
|
||||
mfsdram(DDR0_03, val);
|
||||
val = DDR0_03_CASLAT_DECODE(val);
|
||||
printf(", CL%d)", val);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DDR_ECC
|
||||
static void wait_ddr_idle(void)
|
||||
{
|
||||
/*
|
||||
* Controller idle status cannot be determined for Denali
|
||||
* DDR2 code. Just return here.
|
||||
*/
|
||||
}
|
||||
|
||||
static void program_ecc(u32 start_address,
|
||||
u32 num_bytes,
|
||||
u32 tlb_word2_i_value)
|
||||
{
|
||||
u32 val;
|
||||
u32 current_addr = start_address;
|
||||
u32 size;
|
||||
int bytes_remaining;
|
||||
|
||||
sync();
|
||||
wait_ddr_idle();
|
||||
|
||||
/*
|
||||
* Because of 440EPx errata CHIP 11, we don't touch the last 256
|
||||
* bytes of SDRAM.
|
||||
*/
|
||||
bytes_remaining = num_bytes - CONFIG_SYS_MEM_TOP_HIDE;
|
||||
|
||||
/*
|
||||
* We have to write the ECC bytes by zeroing and flushing in smaller
|
||||
* steps, since the whole 256MByte takes too long for the external
|
||||
* watchdog.
|
||||
*/
|
||||
while (bytes_remaining > 0) {
|
||||
size = min((64 << 20), bytes_remaining);
|
||||
|
||||
/* Write zero's to SDRAM */
|
||||
dcbz_area(current_addr, size);
|
||||
|
||||
/* Write modified dcache lines back to memory */
|
||||
clean_dcache_range(current_addr, current_addr + size);
|
||||
|
||||
current_addr += 64 << 20;
|
||||
bytes_remaining -= 64 << 20;
|
||||
WATCHDOG_RESET();
|
||||
}
|
||||
|
||||
sync();
|
||||
wait_ddr_idle();
|
||||
|
||||
/* Clear error status */
|
||||
mfsdram(DDR0_00, val);
|
||||
mtsdram(DDR0_00, val | DDR0_00_INT_ACK_ALL);
|
||||
|
||||
/* Set 'int_mask' parameter to functionnal value */
|
||||
mfsdram(DDR0_01, val);
|
||||
mtsdram(DDR0_01, ((val &~ DDR0_01_INT_MASK_MASK) | DDR0_01_INT_MASK_ALL_OFF));
|
||||
|
||||
sync();
|
||||
wait_ddr_idle();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* initdram -- 440EPx's DDR controller is a DENALI Core
|
||||
*
|
||||
************************************************************************/
|
||||
phys_size_t initdram (int board_type)
|
||||
{
|
||||
/* CL=4 */
|
||||
mtsdram(DDR0_02, 0x00000000);
|
||||
|
||||
mtsdram(DDR0_00, 0x0000190A);
|
||||
mtsdram(DDR0_01, 0x01000000);
|
||||
mtsdram(DDR0_03, 0x02040803); /* A suitable burst length was taken. CAS is right for our board */
|
||||
|
||||
mtsdram(DDR0_04, 0x0B030300);
|
||||
mtsdram(DDR0_05, 0x02020308);
|
||||
mtsdram(DDR0_06, 0x0003C812);
|
||||
mtsdram(DDR0_07, 0x00090100);
|
||||
mtsdram(DDR0_08, 0x03c80001);
|
||||
mtsdram(DDR0_09, 0x00011D5F);
|
||||
mtsdram(DDR0_10, 0x00000100);
|
||||
mtsdram(DDR0_11, 0x000CC800);
|
||||
mtsdram(DDR0_12, 0x00000003);
|
||||
mtsdram(DDR0_14, 0x00000000);
|
||||
mtsdram(DDR0_17, 0x1e000000);
|
||||
mtsdram(DDR0_18, 0x1e1e1e1e);
|
||||
mtsdram(DDR0_19, 0x1e1e1e1e);
|
||||
mtsdram(DDR0_20, 0x0B0B0B0B);
|
||||
mtsdram(DDR0_21, 0x0B0B0B0B);
|
||||
#ifdef CONFIG_DDR_ECC
|
||||
mtsdram(DDR0_22, 0x00267F0B | DDR0_22_CTRL_RAW_ECC_ENABLE); /* enable ECC */
|
||||
#else
|
||||
mtsdram(DDR0_22, 0x00267F0B);
|
||||
#endif
|
||||
|
||||
mtsdram(DDR0_23, 0x01000000);
|
||||
mtsdram(DDR0_24, 0x01010001);
|
||||
|
||||
mtsdram(DDR0_26, 0x2D93028A);
|
||||
mtsdram(DDR0_27, 0x0784682B);
|
||||
|
||||
mtsdram(DDR0_28, 0x00000080);
|
||||
mtsdram(DDR0_31, 0x00000000);
|
||||
mtsdram(DDR0_42, 0x01000008);
|
||||
|
||||
mtsdram(DDR0_43, 0x050A0200);
|
||||
mtsdram(DDR0_44, 0x00000005);
|
||||
mtsdram(DDR0_02, 0x00000001); /* Activate the denali core */
|
||||
|
||||
denali_wait_for_dlllock();
|
||||
|
||||
#if defined(CONFIG_DDR_DATA_EYE)
|
||||
/* -----------------------------------------------------------+
|
||||
* Perform data eye search if requested.
|
||||
* ----------------------------------------------------------*/
|
||||
program_tlb(0, CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MBYTES_SDRAM << 20,
|
||||
TLB_WORD2_I_ENABLE);
|
||||
denali_core_search_data_eye();
|
||||
remove_tlb(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MBYTES_SDRAM << 20);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Program tlb entries for this size (dynamic)
|
||||
*/
|
||||
program_tlb(0, CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MBYTES_SDRAM << 20,
|
||||
MY_TLB_WORD2_I_ENABLE);
|
||||
|
||||
#if defined(CONFIG_DDR_ECC)
|
||||
#if defined(CONFIG_4xx_DCACHE)
|
||||
/*
|
||||
* If ECC is enabled, initialize the parity bits.
|
||||
*/
|
||||
program_ecc(0, CONFIG_SYS_MBYTES_SDRAM << 20, 0);
|
||||
#else /* CONFIG_4xx_DCACHE */
|
||||
/*
|
||||
* Setup 2nd TLB with same physical address but different virtual address
|
||||
* with cache enabled. This is done for fast ECC generation.
|
||||
*/
|
||||
program_tlb(0, CONFIG_SYS_DDR_CACHED_ADDR, CONFIG_SYS_MBYTES_SDRAM << 20, 0);
|
||||
|
||||
/*
|
||||
* If ECC is enabled, initialize the parity bits.
|
||||
*/
|
||||
program_ecc(CONFIG_SYS_DDR_CACHED_ADDR, CONFIG_SYS_MBYTES_SDRAM << 20, 0);
|
||||
|
||||
/*
|
||||
* Now after initialization (auto-calibration and ECC generation)
|
||||
* remove the TLB entries with caches enabled and program again with
|
||||
* desired cache functionality
|
||||
*/
|
||||
remove_tlb(CONFIG_SYS_DDR_CACHED_ADDR, CONFIG_SYS_MBYTES_SDRAM << 20);
|
||||
#endif /* CONFIG_4xx_DCACHE */
|
||||
#endif /* CONFIG_DDR_ECC */
|
||||
|
||||
/*
|
||||
* Clear possible errors resulting from data-eye-search.
|
||||
* If not done, then we could get an interrupt later on when
|
||||
* exceptions are enabled.
|
||||
*/
|
||||
set_mcsr(get_mcsr());
|
||||
|
||||
return (CONFIG_SYS_MBYTES_SDRAM << 20);
|
||||
}
|
||||
@@ -24,6 +24,17 @@
|
||||
static const struct tegra_gpio_config p2371_2180_gpio_inits[] = {
|
||||
/* gpio, init_val */
|
||||
GPIO_INIT(A5, IN),
|
||||
GPIO_INIT(B0, IN),
|
||||
GPIO_INIT(B1, IN),
|
||||
GPIO_INIT(B2, IN),
|
||||
GPIO_INIT(B3, IN),
|
||||
GPIO_INIT(C0, IN),
|
||||
GPIO_INIT(C1, IN),
|
||||
GPIO_INIT(C2, IN),
|
||||
GPIO_INIT(C3, IN),
|
||||
GPIO_INIT(C4, IN),
|
||||
GPIO_INIT(E4, IN),
|
||||
GPIO_INIT(E5, IN),
|
||||
GPIO_INIT(E6, IN),
|
||||
GPIO_INIT(H0, OUT0),
|
||||
GPIO_INIT(H1, OUT0),
|
||||
@@ -32,7 +43,7 @@ static const struct tegra_gpio_config p2371_2180_gpio_inits[] = {
|
||||
GPIO_INIT(H4, OUT0),
|
||||
GPIO_INIT(H5, IN),
|
||||
GPIO_INIT(H6, IN),
|
||||
GPIO_INIT(H7, OUT0),
|
||||
GPIO_INIT(H7, IN),
|
||||
GPIO_INIT(I0, OUT0),
|
||||
GPIO_INIT(I1, IN),
|
||||
GPIO_INIT(I2, OUT0),
|
||||
@@ -47,6 +58,8 @@ static const struct tegra_gpio_config p2371_2180_gpio_inits[] = {
|
||||
GPIO_INIT(S7, OUT0),
|
||||
GPIO_INIT(T0, OUT0),
|
||||
GPIO_INIT(T1, OUT0),
|
||||
GPIO_INIT(U2, IN),
|
||||
GPIO_INIT(U3, IN),
|
||||
GPIO_INIT(V1, OUT0),
|
||||
GPIO_INIT(V2, OUT0),
|
||||
GPIO_INIT(V3, IN),
|
||||
@@ -65,8 +78,9 @@ static const struct tegra_gpio_config p2371_2180_gpio_inits[] = {
|
||||
GPIO_INIT(Z0, IN),
|
||||
GPIO_INIT(Z2, IN),
|
||||
GPIO_INIT(Z3, OUT0),
|
||||
GPIO_INIT(BB0, IN),
|
||||
GPIO_INIT(BB2, OUT0),
|
||||
GPIO_INIT(BB3, OUT0),
|
||||
GPIO_INIT(BB3, IN),
|
||||
GPIO_INIT(CC1, IN),
|
||||
};
|
||||
|
||||
@@ -91,19 +105,19 @@ static const struct pmux_pingrp_config p2371_2180_pingrps[] = {
|
||||
PINCFG(PEX_L1_CLKREQ_N_PA4, PE1, NORMAL, NORMAL, INPUT, DISABLE, HIGH),
|
||||
PINCFG(SATA_LED_ACTIVE_PA5, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(PA6, SATA, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP1_FS_PB0, I2S1, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP1_DIN_PB1, I2S1, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP1_DOUT_PB2, I2S1, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP1_SCLK_PB3, I2S1, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP1_FS_PB0, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP1_DIN_PB1, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP1_DOUT_PB2, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP1_SCLK_PB3, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI2_MOSI_PB4, SPI2, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI2_MISO_PB5, SPI2, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI2_SCK_PB6, SPI2, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI2_CS0_PB7, SPI2, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_MOSI_PC0, SPI1, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_MISO_PC1, SPI1, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_SCK_PC2, SPI1, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_CS0_PC3, SPI1, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_CS1_PC4, SPI1, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_MOSI_PC0, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_MISO_PC1, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_SCK_PC2, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_CS0_PC3, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI1_CS1_PC4, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI4_SCK_PC5, SPI4, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI4_CS0_PC6, SPI4, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(SPI4_MOSI_PC7, SPI4, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
@@ -116,9 +130,9 @@ static const struct pmux_pingrp_config p2371_2180_pingrps[] = {
|
||||
PINCFG(DMIC1_DAT_PE1, I2S3, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DMIC2_CLK_PE2, I2S3, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DMIC2_DAT_PE3, I2S3, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DMIC3_CLK_PE4, DMIC3, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DMIC3_DAT_PE5, DMIC3, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(PE6, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DMIC3_CLK_PE4, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DMIC3_DAT_PE5, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(PE6, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(PE7, PWM3, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(GEN3_I2C_SCL_PF0, I2C3, NORMAL, NORMAL, INPUT, DISABLE, NORMAL),
|
||||
PINCFG(GEN3_I2C_SDA_PF1, I2C3, NORMAL, NORMAL, INPUT, DISABLE, NORMAL),
|
||||
@@ -133,7 +147,7 @@ static const struct pmux_pingrp_config p2371_2180_pingrps[] = {
|
||||
PINCFG(BT_RST_PH4, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(BT_WAKE_AP_PH5, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(PH6, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(AP_WAKE_NFC_PH7, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(AP_WAKE_NFC_PH7, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(NFC_EN_PI0, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(NFC_INT_PI1, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(GPS_EN_PI2, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
@@ -184,8 +198,8 @@ static const struct pmux_pingrp_config p2371_2180_pingrps[] = {
|
||||
PINCFG(CAM1_STROBE_PT1, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(UART1_TX_PU0, UARTA, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(UART1_RX_PU1, UARTA, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(UART1_RTS_PU2, UARTA, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(UART1_CTS_PU3, UARTA, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(UART1_RTS_PU2, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(UART1_CTS_PU3, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(LCD_BL_PWM_PV0, PWM0, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(LCD_BL_EN_PV1, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(LCD_RST_PV2, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
@@ -194,10 +208,10 @@ static const struct pmux_pingrp_config p2371_2180_pingrps[] = {
|
||||
PINCFG(AP_READY_PV5, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(TOUCH_RST_PV6, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(TOUCH_CLK_PV7, TOUCH, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(MODEM_WAKE_AP_PX0, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(MODEM_WAKE_AP_PX0, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(TOUCH_INT_PX1, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(MOTION_INT_PX2, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(ALS_PROX_INT_PX3, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(ALS_PROX_INT_PX3, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(TEMP_ALERT_PX4, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(BUTTON_POWER_ON_PX5, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(BUTTON_VOL_UP_PX6, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
@@ -218,10 +232,10 @@ static const struct pmux_pingrp_config p2371_2180_pingrps[] = {
|
||||
PINCFG(DAP2_SCLK_PAA1, I2S2, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP2_DIN_PAA2, I2S2, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DAP2_DOUT_PAA3, I2S2, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(AUD_MCLK_PBB0, AUD, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(AUD_MCLK_PBB0, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DVFS_PWM_PBB1, CLDVFS, NORMAL, TRISTATE, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(DVFS_CLK_PBB2, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(GPIO_X1_AUD_PBB3, DEFAULT, NORMAL, NORMAL, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(GPIO_X1_AUD_PBB3, DEFAULT, UP, NORMAL, INPUT, DISABLE, DEFAULT),
|
||||
PINCFG(GPIO_X3_AUD_PBB4, RSVD0, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT),
|
||||
PINCFG(HDMI_CEC_PCC0, CEC, NORMAL, NORMAL, INPUT, DISABLE, HIGH),
|
||||
PINCFG(HDMI_INT_DP_HPD_PCC1, DEFAULT, DOWN, NORMAL, INPUT, DISABLE, NORMAL),
|
||||
|
||||
15
board/phytec/pcm052/Kconfig
Normal file
15
board/phytec/pcm052/Kconfig
Normal file
@@ -0,0 +1,15 @@
|
||||
if TARGET_PCM052
|
||||
|
||||
config SYS_BOARD
|
||||
default "pcm052"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "phytec"
|
||||
|
||||
config SYS_SOC
|
||||
default "vf610"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "pcm052"
|
||||
|
||||
endif
|
||||
6
board/phytec/pcm052/MAINTAINERS
Normal file
6
board/phytec/pcm052/MAINTAINERS
Normal file
@@ -0,0 +1,6 @@
|
||||
PCM052 BOARD
|
||||
M: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
|
||||
S: Maintained
|
||||
F: board/phytec/pcm052/
|
||||
F: include/configs/pcm052.h
|
||||
F: configs/pcm052_defconfig
|
||||
7
board/phytec/pcm052/Makefile
Normal file
7
board/phytec/pcm052/Makefile
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# Copyright 2013 Freescale Semiconductor, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y := pcm052.o
|
||||
17
board/phytec/pcm052/imximage.cfg
Normal file
17
board/phytec/pcm052/imximage.cfg
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2015 3ADEV <http://www.3adev.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*
|
||||
* Refer docs/README.imxmage for more details about how-to configure
|
||||
* and create imximage boot image
|
||||
*
|
||||
* The syntax is taken as close as possible with the kwbimage
|
||||
*/
|
||||
#include <asm/imx-common/imximage.cfg>
|
||||
|
||||
/* image version */
|
||||
IMAGE_VERSION 2
|
||||
|
||||
/* Boot Offset 0x400, valid for both SD and NAND boot */
|
||||
BOOT_OFFSET FLASH_OFFSET_STANDARD
|
||||
515
board/phytec/pcm052/pcm052.c
Normal file
515
board/phytec/pcm052/pcm052.c
Normal file
@@ -0,0 +1,515 @@
|
||||
/*
|
||||
* Copyright 2013 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/imx-regs.h>
|
||||
#include <asm/arch/iomux-vf610.h>
|
||||
#include <asm/arch/ddrmc-vf610.h>
|
||||
#include <asm/arch/crm_regs.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <mmc.h>
|
||||
#include <fsl_esdhc.h>
|
||||
#include <miiphy.h>
|
||||
#include <netdev.h>
|
||||
#include <i2c.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/*
|
||||
* Default DDR pad settings in arch/arm/include/asm/arch-vf610/iomux-vf610.h
|
||||
* do not match our settings. Let us (re)define our own settings here.
|
||||
*/
|
||||
|
||||
#define PCM052_VF610_DDR_PAD_CTRL PAD_CTL_DSE_20ohm
|
||||
#define PCM052_VF610_DDR_PAD_CTRL_1 (PAD_CTL_DSE_20ohm | \
|
||||
PAD_CTL_INPUT_DIFFERENTIAL)
|
||||
#define PCM052_VF610_DDR_RESET_PAD_CTL (PAD_CTL_DSE_150ohm | \
|
||||
PAD_CTL_PUS_100K_UP | \
|
||||
PAD_CTL_INPUT_DIFFERENTIAL)
|
||||
|
||||
enum {
|
||||
PCM052_VF610_PAD_DDR_RESETB = IOMUX_PAD(0x021c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_RESET_PAD_CTL),
|
||||
PCM052_VF610_PAD_DDR_A15__DDR_A_15 = IOMUX_PAD(0x0220, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A14__DDR_A_14 = IOMUX_PAD(0x0224, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A13__DDR_A_13 = IOMUX_PAD(0x0228, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A12__DDR_A_12 = IOMUX_PAD(0x022c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A11__DDR_A_11 = IOMUX_PAD(0x0230, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A10__DDR_A_10 = IOMUX_PAD(0x0234, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A9__DDR_A_9 = IOMUX_PAD(0x0238, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A8__DDR_A_8 = IOMUX_PAD(0x023c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A7__DDR_A_7 = IOMUX_PAD(0x0240, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A6__DDR_A_6 = IOMUX_PAD(0x0244, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A5__DDR_A_5 = IOMUX_PAD(0x0248, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A4__DDR_A_4 = IOMUX_PAD(0x024c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A3__DDR_A_3 = IOMUX_PAD(0x0250, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A2__DDR_A_2 = IOMUX_PAD(0x0254, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A1__DDR_A_1 = IOMUX_PAD(0x0258, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_A0__DDR_A_0 = IOMUX_PAD(0x025c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_BA2__DDR_BA_2 = IOMUX_PAD(0x0260, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_BA1__DDR_BA_1 = IOMUX_PAD(0x0264, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_BA0__DDR_BA_0 = IOMUX_PAD(0x0268, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_CAS__DDR_CAS_B = IOMUX_PAD(0x026c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_CKE__DDR_CKE_0 = IOMUX_PAD(0x0270, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_CLK__DDR_CLK_0 = IOMUX_PAD(0x0274, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL_1),
|
||||
PCM052_VF610_PAD_DDR_CS__DDR_CS_B_0 = IOMUX_PAD(0x0278, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D15__DDR_D_15 = IOMUX_PAD(0x027c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D14__DDR_D_14 = IOMUX_PAD(0x0280, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D13__DDR_D_13 = IOMUX_PAD(0x0284, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D12__DDR_D_12 = IOMUX_PAD(0x0288, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D11__DDR_D_11 = IOMUX_PAD(0x028c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D10__DDR_D_10 = IOMUX_PAD(0x0290, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D9__DDR_D_9 = IOMUX_PAD(0x0294, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D8__DDR_D_8 = IOMUX_PAD(0x0298, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D7__DDR_D_7 = IOMUX_PAD(0x029c, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D6__DDR_D_6 = IOMUX_PAD(0x02a0, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D5__DDR_D_5 = IOMUX_PAD(0x02a4, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D4__DDR_D_4 = IOMUX_PAD(0x02a8, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D3__DDR_D_3 = IOMUX_PAD(0x02ac, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D2__DDR_D_2 = IOMUX_PAD(0x02b0, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D1__DDR_D_1 = IOMUX_PAD(0x02b4, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_D0__DDR_D_0 = IOMUX_PAD(0x02b8, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_DQM1__DDR_DQM_1 = IOMUX_PAD(0x02bc, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_DQM0__DDR_DQM_0 = IOMUX_PAD(0x02c0, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_DQS1__DDR_DQS_1 = IOMUX_PAD(0x02c4, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL_1),
|
||||
PCM052_VF610_PAD_DDR_DQS0__DDR_DQS_0 = IOMUX_PAD(0x02c8, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL_1),
|
||||
PCM052_VF610_PAD_DDR_RAS__DDR_RAS_B = IOMUX_PAD(0x02cc, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_WE__DDR_WE_B = IOMUX_PAD(0x02d0, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_ODT1__DDR_ODT_0 = IOMUX_PAD(0x02d4, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_ODT0__DDR_ODT_1 = IOMUX_PAD(0x02d8, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_DDRBYTE1__DDR_DDRBYTE1 = IOMUX_PAD(0x02dc, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
PCM052_VF610_PAD_DDR_DDRBYTE0__DDR_DDRBYTE0 = IOMUX_PAD(0x02e0, __NA_, 0, __NA_, 0, PCM052_VF610_DDR_PAD_CTRL),
|
||||
};
|
||||
|
||||
static struct ddrmc_cr_setting pcm052_cr_settings[] = {
|
||||
/* not in the datasheets, but in the original code */
|
||||
{ 0x00002000, 105 },
|
||||
{ 0x00000020, 110 },
|
||||
/* AXI */
|
||||
{ DDRMC_CR117_AXI0_W_PRI(1) | DDRMC_CR117_AXI0_R_PRI(1), 117 },
|
||||
{ DDRMC_CR118_AXI1_W_PRI(1) | DDRMC_CR118_AXI1_R_PRI(1), 118 },
|
||||
{ DDRMC_CR120_AXI0_PRI1_RPRI(2) |
|
||||
DDRMC_CR120_AXI0_PRI0_RPRI(2), 120 },
|
||||
{ DDRMC_CR121_AXI0_PRI3_RPRI(2) |
|
||||
DDRMC_CR121_AXI0_PRI2_RPRI(2), 121 },
|
||||
{ DDRMC_CR122_AXI1_PRI1_RPRI(1) | DDRMC_CR122_AXI1_PRI0_RPRI(1) |
|
||||
DDRMC_CR122_AXI0_PRIRLX(100), 122 },
|
||||
{ DDRMC_CR123_AXI1_P_ODR_EN | DDRMC_CR123_AXI1_PRI3_RPRI(1) |
|
||||
DDRMC_CR123_AXI1_PRI2_RPRI(1), 123 },
|
||||
{ DDRMC_CR124_AXI1_PRIRLX(100), 124 },
|
||||
{ DDRMC_CR126_PHY_RDLAT(11), 126 },
|
||||
{ DDRMC_CR132_WRLAT_ADJ(5) | DDRMC_CR132_RDLAT_ADJ(6), 132 },
|
||||
{ DDRMC_CR137_PHYCTL_DL(2), 137 },
|
||||
{ DDRMC_CR139_PHY_WRLV_RESPLAT(4) | DDRMC_CR139_PHY_WRLV_LOAD(7) |
|
||||
DDRMC_CR139_PHY_WRLV_DLL(3) |
|
||||
DDRMC_CR139_PHY_WRLV_EN(3), 139 },
|
||||
{ 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(0), 154 },
|
||||
{ DDRMC_CR155_PAD_ODT_BYTE1(5) | DDRMC_CR155_PAD_ODT_BYTE0(5), 155 },
|
||||
{ DDRMC_CR158_TWR(6), 158 },
|
||||
{ DDRMC_CR161_ODT_EN(0) | DDRMC_CR161_TODTH_RD(0) |
|
||||
DDRMC_CR161_TODTH_WR(6), 161 },
|
||||
/* end marker */
|
||||
{ 0, -1 }
|
||||
};
|
||||
|
||||
/* PHY settings -- most of them differ from default in imx-regs.h */
|
||||
|
||||
#define PCM052_DDRMC_PHY_DQ_TIMING 0x00002213
|
||||
#define PCM052_DDRMC_PHY_CTRL 0x00290000
|
||||
#define PCM052_DDRMC_PHY_SLAVE_CTRL 0x00002c00
|
||||
#define PCM052_DDRMC_PHY_PROC_PAD_ODT 0x00010020
|
||||
|
||||
static struct ddrmc_phy_setting pcm052_phy_settings[] = {
|
||||
{ PCM052_DDRMC_PHY_DQ_TIMING, 0 },
|
||||
{ PCM052_DDRMC_PHY_DQ_TIMING, 16 },
|
||||
{ PCM052_DDRMC_PHY_DQ_TIMING, 32 },
|
||||
{ PCM052_DDRMC_PHY_DQ_TIMING, 48 },
|
||||
{ DDRMC_PHY_DQS_TIMING, 1 },
|
||||
{ DDRMC_PHY_DQS_TIMING, 17 },
|
||||
{ DDRMC_PHY_DQS_TIMING, 33 },
|
||||
{ DDRMC_PHY_DQS_TIMING, 49 },
|
||||
{ PCM052_DDRMC_PHY_CTRL, 2 },
|
||||
{ PCM052_DDRMC_PHY_CTRL, 18 },
|
||||
{ PCM052_DDRMC_PHY_CTRL, 34 },
|
||||
{ DDRMC_PHY_MASTER_CTRL, 3 },
|
||||
{ DDRMC_PHY_MASTER_CTRL, 19 },
|
||||
{ DDRMC_PHY_MASTER_CTRL, 35 },
|
||||
{ PCM052_DDRMC_PHY_SLAVE_CTRL, 4 },
|
||||
{ PCM052_DDRMC_PHY_SLAVE_CTRL, 20 },
|
||||
{ PCM052_DDRMC_PHY_SLAVE_CTRL, 36 },
|
||||
{ DDRMC_PHY50_DDR3_MODE | DDRMC_PHY50_EN_SW_HALF_CYCLE, 50 },
|
||||
{ PCM052_DDRMC_PHY_PROC_PAD_ODT, 52 },
|
||||
|
||||
/* end marker */
|
||||
{ 0, -1 }
|
||||
};
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
static const struct ddr3_jedec_timings pcm052_ddr_timings = {
|
||||
.tinit = 5,
|
||||
.trst_pwron = 80000,
|
||||
.cke_inactive = 200000,
|
||||
.wrlat = 5,
|
||||
.caslat_lin = 12,
|
||||
.trc = 6,
|
||||
.trrd = 4,
|
||||
.tccd = 4,
|
||||
.tbst_int_interval = 4,
|
||||
.tfaw = 18,
|
||||
.trp = 6,
|
||||
.twtr = 4,
|
||||
.tras_min = 15,
|
||||
.tmrd = 4,
|
||||
.trtp = 4,
|
||||
.tras_max = 14040,
|
||||
.tmod = 12,
|
||||
.tckesr = 4,
|
||||
.tcke = 3,
|
||||
.trcd_int = 6,
|
||||
.tras_lockout = 1,
|
||||
.tdal = 10,
|
||||
.bstlen = 3,
|
||||
.tdll = 512,
|
||||
.trp_ab = 6,
|
||||
.tref = 1542,
|
||||
.trfc = 64,
|
||||
.tref_int = 5,
|
||||
.tpdex = 3,
|
||||
.txpdll = 10,
|
||||
.txsnr = 68,
|
||||
.txsr = 506,
|
||||
.cksrx = 5,
|
||||
.cksre = 5,
|
||||
.freq_chg_en = 1,
|
||||
.zqcl = 256,
|
||||
.zqinit = 512,
|
||||
.zqcs = 64,
|
||||
.ref_per_zq = 64,
|
||||
.zqcs_rotate = 1,
|
||||
.aprebit = 10,
|
||||
.cmd_age_cnt = 255,
|
||||
.age_cnt = 255,
|
||||
.q_fullness = 0,
|
||||
.odt_rd_mapcs0 = 1,
|
||||
.odt_wr_mapcs0 = 1,
|
||||
.wlmrd = 40,
|
||||
.wldqsen = 25,
|
||||
};
|
||||
|
||||
static const iomux_v3_cfg_t pcm052_pads[] = {
|
||||
PCM052_VF610_PAD_DDR_A15__DDR_A_15,
|
||||
PCM052_VF610_PAD_DDR_A14__DDR_A_14,
|
||||
PCM052_VF610_PAD_DDR_A13__DDR_A_13,
|
||||
PCM052_VF610_PAD_DDR_A12__DDR_A_12,
|
||||
PCM052_VF610_PAD_DDR_A11__DDR_A_11,
|
||||
PCM052_VF610_PAD_DDR_A10__DDR_A_10,
|
||||
PCM052_VF610_PAD_DDR_A9__DDR_A_9,
|
||||
PCM052_VF610_PAD_DDR_A8__DDR_A_8,
|
||||
PCM052_VF610_PAD_DDR_A7__DDR_A_7,
|
||||
PCM052_VF610_PAD_DDR_A6__DDR_A_6,
|
||||
PCM052_VF610_PAD_DDR_A5__DDR_A_5,
|
||||
PCM052_VF610_PAD_DDR_A4__DDR_A_4,
|
||||
PCM052_VF610_PAD_DDR_A3__DDR_A_3,
|
||||
PCM052_VF610_PAD_DDR_A2__DDR_A_2,
|
||||
PCM052_VF610_PAD_DDR_A1__DDR_A_1,
|
||||
PCM052_VF610_PAD_DDR_A0__DDR_A_0,
|
||||
PCM052_VF610_PAD_DDR_BA2__DDR_BA_2,
|
||||
PCM052_VF610_PAD_DDR_BA1__DDR_BA_1,
|
||||
PCM052_VF610_PAD_DDR_BA0__DDR_BA_0,
|
||||
PCM052_VF610_PAD_DDR_CAS__DDR_CAS_B,
|
||||
PCM052_VF610_PAD_DDR_CKE__DDR_CKE_0,
|
||||
PCM052_VF610_PAD_DDR_CLK__DDR_CLK_0,
|
||||
PCM052_VF610_PAD_DDR_CS__DDR_CS_B_0,
|
||||
PCM052_VF610_PAD_DDR_D15__DDR_D_15,
|
||||
PCM052_VF610_PAD_DDR_D14__DDR_D_14,
|
||||
PCM052_VF610_PAD_DDR_D13__DDR_D_13,
|
||||
PCM052_VF610_PAD_DDR_D12__DDR_D_12,
|
||||
PCM052_VF610_PAD_DDR_D11__DDR_D_11,
|
||||
PCM052_VF610_PAD_DDR_D10__DDR_D_10,
|
||||
PCM052_VF610_PAD_DDR_D9__DDR_D_9,
|
||||
PCM052_VF610_PAD_DDR_D8__DDR_D_8,
|
||||
PCM052_VF610_PAD_DDR_D7__DDR_D_7,
|
||||
PCM052_VF610_PAD_DDR_D6__DDR_D_6,
|
||||
PCM052_VF610_PAD_DDR_D5__DDR_D_5,
|
||||
PCM052_VF610_PAD_DDR_D4__DDR_D_4,
|
||||
PCM052_VF610_PAD_DDR_D3__DDR_D_3,
|
||||
PCM052_VF610_PAD_DDR_D2__DDR_D_2,
|
||||
PCM052_VF610_PAD_DDR_D1__DDR_D_1,
|
||||
PCM052_VF610_PAD_DDR_D0__DDR_D_0,
|
||||
PCM052_VF610_PAD_DDR_DQM1__DDR_DQM_1,
|
||||
PCM052_VF610_PAD_DDR_DQM0__DDR_DQM_0,
|
||||
PCM052_VF610_PAD_DDR_DQS1__DDR_DQS_1,
|
||||
PCM052_VF610_PAD_DDR_DQS0__DDR_DQS_0,
|
||||
PCM052_VF610_PAD_DDR_RAS__DDR_RAS_B,
|
||||
PCM052_VF610_PAD_DDR_WE__DDR_WE_B,
|
||||
PCM052_VF610_PAD_DDR_ODT1__DDR_ODT_0,
|
||||
PCM052_VF610_PAD_DDR_ODT0__DDR_ODT_1,
|
||||
PCM052_VF610_PAD_DDR_DDRBYTE1__DDR_DDRBYTE1,
|
||||
PCM052_VF610_PAD_DDR_DDRBYTE0__DDR_DDRBYTE0,
|
||||
PCM052_VF610_PAD_DDR_RESETB,
|
||||
};
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(pcm052_pads, ARRAY_SIZE(pcm052_pads));
|
||||
|
||||
ddrmc_ctrl_init_ddr3(&pcm052_ddr_timings, pcm052_cr_settings,
|
||||
pcm052_phy_settings, 1, 2);
|
||||
|
||||
gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void setup_iomux_uart(void)
|
||||
{
|
||||
static const iomux_v3_cfg_t uart1_pads[] = {
|
||||
NEW_PAD_CTRL(VF610_PAD_PTB4__UART1_TX, VF610_UART_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTB5__UART1_RX, VF610_UART_PAD_CTRL),
|
||||
};
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
|
||||
}
|
||||
|
||||
#define ENET_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_HIGH | \
|
||||
PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE)
|
||||
|
||||
static void setup_iomux_enet(void)
|
||||
{
|
||||
static const iomux_v3_cfg_t enet0_pads[] = {
|
||||
NEW_PAD_CTRL(VF610_PAD_PTA6__RMII0_CLKIN, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC1__RMII0_MDIO, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC0__RMII0_MDC, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC2__RMII0_CRS_DV, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC3__RMII0_RD1, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC4__RMII0_RD0, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC5__RMII0_RXER, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC6__RMII0_TD1, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC7__RMII0_TD0, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTC8__RMII0_TXEN, ENET_PAD_CTRL),
|
||||
};
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(enet0_pads, ARRAY_SIZE(enet0_pads));
|
||||
}
|
||||
|
||||
/*
|
||||
* I2C2 is the only I2C used, on pads PTA22/PTA23.
|
||||
*/
|
||||
|
||||
static void setup_iomux_i2c(void)
|
||||
{
|
||||
static const iomux_v3_cfg_t i2c_pads[] = {
|
||||
VF610_PAD_PTA22__I2C2_SCL,
|
||||
VF610_PAD_PTA23__I2C2_SDA,
|
||||
};
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(i2c_pads, ARRAY_SIZE(i2c_pads));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NAND_VF610_NFC
|
||||
static void setup_iomux_nfc(void)
|
||||
{
|
||||
static const iomux_v3_cfg_t nfc_pads[] = {
|
||||
VF610_PAD_PTD31__NF_IO15,
|
||||
VF610_PAD_PTD30__NF_IO14,
|
||||
VF610_PAD_PTD29__NF_IO13,
|
||||
VF610_PAD_PTD28__NF_IO12,
|
||||
VF610_PAD_PTD27__NF_IO11,
|
||||
VF610_PAD_PTD26__NF_IO10,
|
||||
VF610_PAD_PTD25__NF_IO9,
|
||||
VF610_PAD_PTD24__NF_IO8,
|
||||
VF610_PAD_PTD23__NF_IO7,
|
||||
VF610_PAD_PTD22__NF_IO6,
|
||||
VF610_PAD_PTD21__NF_IO5,
|
||||
VF610_PAD_PTD20__NF_IO4,
|
||||
VF610_PAD_PTD19__NF_IO3,
|
||||
VF610_PAD_PTD18__NF_IO2,
|
||||
VF610_PAD_PTD17__NF_IO1,
|
||||
VF610_PAD_PTD16__NF_IO0,
|
||||
VF610_PAD_PTB24__NF_WE_B,
|
||||
VF610_PAD_PTB25__NF_CE0_B,
|
||||
VF610_PAD_PTB27__NF_RE_B,
|
||||
VF610_PAD_PTC26__NF_RB_B,
|
||||
VF610_PAD_PTC27__NF_ALE,
|
||||
VF610_PAD_PTC28__NF_CLE
|
||||
};
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(nfc_pads, ARRAY_SIZE(nfc_pads));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void setup_iomux_qspi(void)
|
||||
{
|
||||
static const iomux_v3_cfg_t qspi0_pads[] = {
|
||||
VF610_PAD_PTD0__QSPI0_A_QSCK,
|
||||
VF610_PAD_PTD1__QSPI0_A_CS0,
|
||||
VF610_PAD_PTD2__QSPI0_A_DATA3,
|
||||
VF610_PAD_PTD3__QSPI0_A_DATA2,
|
||||
VF610_PAD_PTD4__QSPI0_A_DATA1,
|
||||
VF610_PAD_PTD5__QSPI0_A_DATA0,
|
||||
VF610_PAD_PTD7__QSPI0_B_QSCK,
|
||||
VF610_PAD_PTD8__QSPI0_B_CS0,
|
||||
VF610_PAD_PTD9__QSPI0_B_DATA3,
|
||||
VF610_PAD_PTD10__QSPI0_B_DATA2,
|
||||
VF610_PAD_PTD11__QSPI0_B_DATA1,
|
||||
VF610_PAD_PTD12__QSPI0_B_DATA0,
|
||||
};
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(qspi0_pads, ARRAY_SIZE(qspi0_pads));
|
||||
}
|
||||
|
||||
#define ESDHC_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_HIGH | \
|
||||
PAD_CTL_DSE_20ohm | PAD_CTL_OBE_IBE_ENABLE)
|
||||
|
||||
struct fsl_esdhc_cfg esdhc_cfg[1] = {
|
||||
{ESDHC1_BASE_ADDR},
|
||||
};
|
||||
|
||||
int board_mmc_getcd(struct mmc *mmc)
|
||||
{
|
||||
/* eSDHC1 is always present */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int board_mmc_init(bd_t *bis)
|
||||
{
|
||||
static const iomux_v3_cfg_t esdhc1_pads[] = {
|
||||
NEW_PAD_CTRL(VF610_PAD_PTA24__ESDHC1_CLK, ESDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTA25__ESDHC1_CMD, ESDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTA26__ESDHC1_DAT0, ESDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTA27__ESDHC1_DAT1, ESDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTA28__ESDHC1_DAT2, ESDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(VF610_PAD_PTA29__ESDHC1_DAT3, ESDHC_PAD_CTRL),
|
||||
};
|
||||
|
||||
esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(
|
||||
esdhc1_pads, ARRAY_SIZE(esdhc1_pads));
|
||||
|
||||
return fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
|
||||
}
|
||||
|
||||
static void clock_init(void)
|
||||
{
|
||||
struct ccm_reg *ccm = (struct ccm_reg *)CCM_BASE_ADDR;
|
||||
struct anadig_reg *anadig = (struct anadig_reg *)ANADIG_BASE_ADDR;
|
||||
|
||||
clrsetbits_le32(&ccm->ccgr0, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR0_UART1_CTRL_MASK);
|
||||
clrsetbits_le32(&ccm->ccgr1, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR1_PIT_CTRL_MASK | CCM_CCGR1_WDOGA5_CTRL_MASK);
|
||||
clrsetbits_le32(&ccm->ccgr2, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR2_IOMUXC_CTRL_MASK | CCM_CCGR2_PORTA_CTRL_MASK |
|
||||
CCM_CCGR2_PORTB_CTRL_MASK | CCM_CCGR2_PORTC_CTRL_MASK |
|
||||
CCM_CCGR2_PORTD_CTRL_MASK | CCM_CCGR2_PORTE_CTRL_MASK |
|
||||
CCM_CCGR2_QSPI0_CTRL_MASK);
|
||||
clrsetbits_le32(&ccm->ccgr3, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR3_ANADIG_CTRL_MASK | CCM_CCGR3_SCSC_CTRL_MASK);
|
||||
clrsetbits_le32(&ccm->ccgr4, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR4_WKUP_CTRL_MASK | CCM_CCGR4_CCM_CTRL_MASK |
|
||||
CCM_CCGR4_GPC_CTRL_MASK);
|
||||
clrsetbits_le32(&ccm->ccgr6, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR6_OCOTP_CTRL_MASK | CCM_CCGR6_DDRMC_CTRL_MASK);
|
||||
clrsetbits_le32(&ccm->ccgr7, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR7_SDHC1_CTRL_MASK);
|
||||
clrsetbits_le32(&ccm->ccgr9, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR9_FEC0_CTRL_MASK | CCM_CCGR9_FEC1_CTRL_MASK);
|
||||
clrsetbits_le32(&ccm->ccgr10, CCM_REG_CTRL_MASK,
|
||||
CCM_CCGR10_NFC_CTRL_MASK | CCM_CCGR10_I2C2_CTRL_MASK);
|
||||
|
||||
clrsetbits_le32(&anadig->pll2_ctrl, ANADIG_PLL2_CTRL_POWERDOWN,
|
||||
ANADIG_PLL2_CTRL_ENABLE | ANADIG_PLL2_CTRL_DIV_SELECT);
|
||||
clrsetbits_le32(&anadig->pll1_ctrl, ANADIG_PLL1_CTRL_POWERDOWN,
|
||||
ANADIG_PLL1_CTRL_ENABLE | ANADIG_PLL1_CTRL_DIV_SELECT);
|
||||
|
||||
clrsetbits_le32(&ccm->ccr, CCM_CCR_OSCNT_MASK,
|
||||
CCM_CCR_FIRC_EN | CCM_CCR_OSCNT(5));
|
||||
clrsetbits_le32(&ccm->ccsr, CCM_REG_CTRL_MASK,
|
||||
CCM_CCSR_PLL1_PFD_CLK_SEL(3) | CCM_CCSR_PLL2_PFD4_EN |
|
||||
CCM_CCSR_PLL2_PFD3_EN | CCM_CCSR_PLL2_PFD2_EN |
|
||||
CCM_CCSR_PLL2_PFD1_EN | CCM_CCSR_PLL1_PFD4_EN |
|
||||
CCM_CCSR_PLL1_PFD3_EN | CCM_CCSR_PLL1_PFD2_EN |
|
||||
CCM_CCSR_PLL1_PFD1_EN | CCM_CCSR_DDRC_CLK_SEL(1) |
|
||||
CCM_CCSR_FAST_CLK_SEL(1) | CCM_CCSR_SYS_CLK_SEL(4));
|
||||
clrsetbits_le32(&ccm->cacrr, CCM_REG_CTRL_MASK,
|
||||
CCM_CACRR_IPG_CLK_DIV(1) | CCM_CACRR_BUS_CLK_DIV(2) |
|
||||
CCM_CACRR_ARM_CLK_DIV(0));
|
||||
clrsetbits_le32(&ccm->cscmr1, CCM_REG_CTRL_MASK,
|
||||
CCM_CSCMR1_ESDHC1_CLK_SEL(3) |
|
||||
CCM_CSCMR1_QSPI0_CLK_SEL(3) |
|
||||
CCM_CSCMR1_NFC_CLK_SEL(0));
|
||||
clrsetbits_le32(&ccm->cscdr1, CCM_REG_CTRL_MASK,
|
||||
CCM_CSCDR1_RMII_CLK_EN);
|
||||
clrsetbits_le32(&ccm->cscdr2, CCM_REG_CTRL_MASK,
|
||||
CCM_CSCDR2_ESDHC1_EN | CCM_CSCDR2_ESDHC1_CLK_DIV(0) |
|
||||
CCM_CSCDR2_NFC_EN);
|
||||
clrsetbits_le32(&ccm->cscdr3, CCM_REG_CTRL_MASK,
|
||||
CCM_CSCDR3_QSPI0_EN | CCM_CSCDR3_QSPI0_DIV(1) |
|
||||
CCM_CSCDR3_QSPI0_X2_DIV(1) |
|
||||
CCM_CSCDR3_QSPI0_X4_DIV(3) |
|
||||
CCM_CSCDR3_NFC_PRE_DIV(5));
|
||||
clrsetbits_le32(&ccm->cscmr2, CCM_REG_CTRL_MASK,
|
||||
CCM_CSCMR2_RMII_CLK_SEL(0));
|
||||
}
|
||||
|
||||
static void mscm_init(void)
|
||||
{
|
||||
struct mscm_ir *mscmir = (struct mscm_ir *)MSCM_IR_BASE_ADDR;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MSCM_IRSPRC_NUM; i++)
|
||||
writew(MSCM_IRSPRC_CP0_EN, &mscmir->irsprc[i]);
|
||||
}
|
||||
|
||||
int board_phy_config(struct phy_device *phydev)
|
||||
{
|
||||
if (phydev->drv->config)
|
||||
phydev->drv->config(phydev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
clock_init();
|
||||
mscm_init();
|
||||
setup_iomux_uart();
|
||||
setup_iomux_enet();
|
||||
setup_iomux_i2c();
|
||||
setup_iomux_qspi();
|
||||
setup_iomux_nfc();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
struct scsc_reg *scsc = (struct scsc_reg *)SCSC_BASE_ADDR;
|
||||
|
||||
/* address of boot parameters */
|
||||
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
|
||||
|
||||
/*
|
||||
* Enable external 32K Oscillator
|
||||
*
|
||||
* The internal clock experiences significant drift
|
||||
* so we must use the external oscillator in order
|
||||
* to maintain correct time in the hwclock
|
||||
*/
|
||||
setbits_le32(&scsc->sosc_ctr, SCSC_SOSC_CTR_SOSC_EN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
puts("Board: PCM-052\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -176,6 +176,11 @@ static const struct {
|
||||
"bcm2835-rpi-cm.dtb",
|
||||
false,
|
||||
},
|
||||
[BCM2835_BOARD_REV_A_PLUS_15] = {
|
||||
"Model A+",
|
||||
"bcm2835-rpi-a-plus.dtb",
|
||||
false,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Wind River SBC8641D reference board
|
||||
|
||||
Created 06/14/2007 Joe Hamman
|
||||
Copyright 2007, Embedded Specialties, Inc.
|
||||
Copyright 2007 Wind River Systemes, Inc.
|
||||
Copyright 2007 Wind River Systems, Inc.
|
||||
-----------------------------
|
||||
|
||||
1. Building U-Boot
|
||||
@@ -26,3 +26,24 @@ and settings may change with board revisions.
|
||||
--------------------
|
||||
PCI:
|
||||
The PCI command may hang if no boards are present in either slot.
|
||||
|
||||
4. Reflashing U-Boot
|
||||
--------------------
|
||||
The board has two independent flash devices which can be used for dual
|
||||
booting, or for u-boot backup and recovery. A two pin jumper on the
|
||||
three pin JP10 determines which device is attached to /CS0 line.
|
||||
|
||||
Assuming one device has a functional u-boot, and the other device has
|
||||
a recently installed non-functional image, to perform a recovery from
|
||||
that non-functional image goes essentially as follows:
|
||||
|
||||
a) power down the board and jumper JP10 to select the functional image.
|
||||
b) power on the board and let it get to u-boot prompt.
|
||||
c) while on, using static precautions, move JP10 back to the failed image.
|
||||
d) use "md fff00000" to confirm you are looking at the failed image
|
||||
e) turn off write protect with "prot off all"
|
||||
f) get new image, i.e. "tftp 200000 /somepath/u-boot.bin"
|
||||
g) erase failed image: "erase FFF00000 FFF5FFFF"
|
||||
h) copy in new image: "cp.b 200000 FFF00000 60000"
|
||||
i) ensure new image is written: "md fff00000"
|
||||
k) power cycle the board and confirm new image works.
|
||||
|
||||
@@ -90,7 +90,8 @@ static void smartweb_macb_hw_init(void)
|
||||
pin_to_mask(AT91_PIN_PA17) |
|
||||
pin_to_mask(AT91_PIN_PA25) |
|
||||
pin_to_mask(AT91_PIN_PA26) |
|
||||
pin_to_mask(AT91_PIN_PA28),
|
||||
pin_to_mask(AT91_PIN_PA28) |
|
||||
pin_to_mask(AT91_PIN_PA29),
|
||||
&pioa->pudr);
|
||||
|
||||
at91_phy_reset();
|
||||
@@ -101,7 +102,8 @@ static void smartweb_macb_hw_init(void)
|
||||
pin_to_mask(AT91_PIN_PA17) |
|
||||
pin_to_mask(AT91_PIN_PA25) |
|
||||
pin_to_mask(AT91_PIN_PA26) |
|
||||
pin_to_mask(AT91_PIN_PA28),
|
||||
pin_to_mask(AT91_PIN_PA28) |
|
||||
pin_to_mask(AT91_PIN_PA29),
|
||||
&pioa->puer);
|
||||
|
||||
/* Initialize EMAC=MACB hardware */
|
||||
@@ -141,13 +143,6 @@ int board_early_init_f(void)
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
/* Adress of boot parameters */
|
||||
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
|
||||
|
||||
smartweb_nand_hw_init();
|
||||
#ifdef CONFIG_MACB
|
||||
smartweb_macb_hw_init();
|
||||
#endif
|
||||
/* power LED red */
|
||||
at91_set_gpio_output(AT91_PIN_PC6, 0);
|
||||
at91_set_gpio_output(AT91_PIN_PC7, 1);
|
||||
@@ -163,6 +158,13 @@ int board_init(void)
|
||||
at91_udc_probe(&board_udc_data);
|
||||
#endif
|
||||
|
||||
/* Adress of boot parameters */
|
||||
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
|
||||
|
||||
smartweb_nand_hw_init();
|
||||
#ifdef CONFIG_MACB
|
||||
smartweb_macb_hw_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -197,6 +199,7 @@ void matrix_init(void)
|
||||
|
||||
void spl_board_init(void)
|
||||
{
|
||||
/* power LED orange */
|
||||
at91_set_gpio_output(AT91_PIN_PC6, 1);
|
||||
at91_set_gpio_output(AT91_PIN_PC7, 1);
|
||||
/* alarm LED orange */
|
||||
@@ -212,8 +215,8 @@ void spl_board_init(void)
|
||||
|
||||
/* check if both button are pressed */
|
||||
if (at91_get_gpio_value(AT91_PIN_PA28) == 0 &&
|
||||
at91_get_gpio_value(AT91_PIN_PA29) == 0) {
|
||||
debug("Recovery button pressed\n");
|
||||
at91_get_gpio_value(AT91_PIN_PA29) == 0) {
|
||||
smartweb_nand_hw_init();
|
||||
nand_init();
|
||||
spl_nand_erase_one(0, 0);
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ F: configs/mk802ii_defconfig
|
||||
F: configs/pov_protab2_ips9_defconfig
|
||||
F: include/configs/sun5i.h
|
||||
F: configs/A10s-OLinuXino-M_defconfig
|
||||
F: configs/A10s-OLinuXino-M_defconfig
|
||||
F: configs/A10s-Wobo-i5_defconfig
|
||||
F: configs/A13-OLinuXino_defconfig
|
||||
F: configs/A13-OLinuXinoM_defconfig
|
||||
F: configs/Auxtek-T003_defconfig
|
||||
@@ -35,6 +33,7 @@ F: include/configs/sun6i.h
|
||||
F: configs/CSQ_CS908_defconfig
|
||||
F: configs/Mele_A1000G_quad_defconfig
|
||||
F: configs/Mele_M9_defconfig
|
||||
F: configs/Wobo_i5_defconfig
|
||||
F: include/configs/sun7i.h
|
||||
F: configs/A20-OLinuXino_MICRO_defconfig
|
||||
F: configs/Bananapi_defconfig
|
||||
@@ -51,6 +50,9 @@ F: configs/ga10h_v1_1_defconfig
|
||||
F: configs/gt90h_v4_defconfig
|
||||
F: configs/Ippo_q8h_v1_2_defconfig
|
||||
F: configs/Ippo_q8h_v1_2_a33_1024x600_defconfig
|
||||
F: configs/q8_a23_tablet_800x480_defconfig
|
||||
F: configs/q8_a33_tablet_800x480_defconfig
|
||||
F: configs/q8_a33_tablet_1024x600_defconfig
|
||||
F: include/configs/sun9i.h
|
||||
F: configs/Merrii_A80_Optimus_defconfig
|
||||
|
||||
|
||||
@@ -516,6 +516,31 @@ void get_board_serial(struct tag_serialnr *serialnr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
#include <asm/arch/spl.h>
|
||||
|
||||
/*
|
||||
* Check the SPL header for the "sunxi" variant. If found: parse values
|
||||
* that might have been passed by the loader ("fel" utility), and update
|
||||
* the environment accordingly.
|
||||
*/
|
||||
static void parse_spl_header(const uint32_t spl_addr)
|
||||
{
|
||||
struct boot_file_head *spl = (void *)spl_addr;
|
||||
if (memcmp(spl->spl_signature, SPL_SIGNATURE, 3) == 0) {
|
||||
uint8_t spl_header_version = spl->spl_signature[3];
|
||||
if (spl_header_version == SPL_HEADER_VERSION) {
|
||||
if (spl->fel_script_address)
|
||||
setenv_hex("fel_scriptaddr",
|
||||
spl->fel_script_address);
|
||||
return;
|
||||
}
|
||||
printf("sunxi SPL version mismatch: expected %u, got %u\n",
|
||||
SPL_HEADER_VERSION, spl_header_version);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MISC_INIT_R
|
||||
int misc_init_r(void)
|
||||
{
|
||||
@@ -524,6 +549,16 @@ int misc_init_r(void)
|
||||
uint8_t mac_addr[6];
|
||||
int ret;
|
||||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
setenv("fel_booted", NULL);
|
||||
setenv("fel_scriptaddr", NULL);
|
||||
/* determine if we are running in FEL mode */
|
||||
if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */
|
||||
setenv("fel_booted", "1");
|
||||
parse_spl_header(SPL_ADDR);
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = sunxi_get_sid(sid);
|
||||
if (ret == 0 && sid[0] != 0 && sid[3] != 0) {
|
||||
if (!getenv("ethaddr")) {
|
||||
|
||||
@@ -30,7 +30,7 @@ int board_mmc_init(bd_t *bis)
|
||||
host->dev_index = 0;
|
||||
host->bus_hz = 50000000;
|
||||
|
||||
add_dwmci(host, host->bus_hz, 400000);
|
||||
add_dwmci(host, host->bus_hz / 2, 400000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <fdt_support.h>
|
||||
#include <asm/arch/ddr3.h>
|
||||
#include <asm/arch/psc_defs.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/ti-common/ti-aemif.h>
|
||||
#include <asm/ti-common/keystone_net.h>
|
||||
|
||||
@@ -81,6 +82,9 @@ int board_eth_init(bd_t *bis)
|
||||
if (psc_enable_module(KS2_LPSC_CRYPTO))
|
||||
return -1;
|
||||
|
||||
if (cpu_is_k2e() || cpu_is_k2l())
|
||||
pll_pa_clk_sel();
|
||||
|
||||
port_num = get_num_eth_ports();
|
||||
|
||||
for (j = 0; j < port_num; j++) {
|
||||
|
||||
@@ -62,7 +62,7 @@ int board_init(void)
|
||||
|
||||
/* Change the NOR timings to optimum value to get maximum bandwidth */
|
||||
emc->stat[0].waitwen = EMC_STAT_WAITWEN(1);
|
||||
emc->stat[0].waitoen = EMC_STAT_WAITOEN(1);
|
||||
emc->stat[0].waitoen = EMC_STAT_WAITOEN(0);
|
||||
emc->stat[0].waitrd = EMC_STAT_WAITRD(12);
|
||||
emc->stat[0].waitpage = EMC_STAT_WAITPAGE(12);
|
||||
emc->stat[0].waitwr = EMC_STAT_WAITWR(5);
|
||||
|
||||
@@ -35,6 +35,61 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define USB_PEN_GPIO 83
|
||||
|
||||
static struct ddrmc_cr_setting colibri_vf_cr_settings[] = {
|
||||
/* levelling */
|
||||
{ DDRMC_CR97_WRLVL_EN, 97 },
|
||||
{ DDRMC_CR98_WRLVL_DL_0(0), 98 },
|
||||
{ DDRMC_CR99_WRLVL_DL_1(0), 99 },
|
||||
{ DDRMC_CR102_RDLVL_REG_EN | DDRMC_CR102_RDLVL_GT_REGEN, 102 },
|
||||
{ DDRMC_CR105_RDLVL_DL_0(0), 105 },
|
||||
{ DDRMC_CR106_RDLVL_GTDL_0(4), 106 },
|
||||
{ DDRMC_CR110_RDLVL_DL_1(0) | DDRMC_CR110_RDLVL_GTDL_1(4), 110 },
|
||||
/* AXI */
|
||||
{ DDRMC_CR117_AXI0_W_PRI(0) | DDRMC_CR117_AXI0_R_PRI(0), 117 },
|
||||
{ DDRMC_CR118_AXI1_W_PRI(1) | DDRMC_CR118_AXI1_R_PRI(1), 118 },
|
||||
{ DDRMC_CR120_AXI0_PRI1_RPRI(2) |
|
||||
DDRMC_CR120_AXI0_PRI0_RPRI(2), 120 },
|
||||
{ DDRMC_CR121_AXI0_PRI3_RPRI(2) |
|
||||
DDRMC_CR121_AXI0_PRI2_RPRI(2), 121 },
|
||||
{ DDRMC_CR122_AXI1_PRI1_RPRI(1) | DDRMC_CR122_AXI1_PRI0_RPRI(1) |
|
||||
DDRMC_CR122_AXI0_PRIRLX(100), 122 },
|
||||
{ DDRMC_CR123_AXI1_P_ODR_EN | DDRMC_CR123_AXI1_PRI3_RPRI(1) |
|
||||
DDRMC_CR123_AXI1_PRI2_RPRI(1), 123 },
|
||||
{ DDRMC_CR124_AXI1_PRIRLX(100), 124 },
|
||||
{ DDRMC_CR126_PHY_RDLAT(8), 126 },
|
||||
{ DDRMC_CR132_WRLAT_ADJ(5) |
|
||||
DDRMC_CR132_RDLAT_ADJ(6), 132 },
|
||||
{ DDRMC_CR137_PHYCTL_DL(2), 137 },
|
||||
{ DDRMC_CR138_PHY_WRLV_MXDL(256) |
|
||||
DDRMC_CR138_PHYDRAM_CK_EN(1), 138 },
|
||||
{ DDRMC_CR139_PHY_WRLV_RESPLAT(4) | DDRMC_CR139_PHY_WRLV_LOAD(7) |
|
||||
DDRMC_CR139_PHY_WRLV_DLL(3) |
|
||||
DDRMC_CR139_PHY_WRLV_EN(3), 139 },
|
||||
{ DDRMC_CR140_PHY_WRLV_WW(64), 140 },
|
||||
{ DDRMC_CR143_RDLV_GAT_MXDL(1536) |
|
||||
DDRMC_CR143_RDLV_MXDL(128), 143 },
|
||||
{ DDRMC_CR144_PHY_RDLVL_RES(4) | DDRMC_CR144_PHY_RDLV_LOAD(7) |
|
||||
DDRMC_CR144_PHY_RDLV_DLL(3) |
|
||||
DDRMC_CR144_PHY_RDLV_EN(3), 144 },
|
||||
{ DDRMC_CR145_PHY_RDLV_RR(64), 145 },
|
||||
{ DDRMC_CR146_PHY_RDLVL_RESP(64), 146 },
|
||||
{ DDRMC_CR147_RDLV_RESP_MASK(983040), 147 },
|
||||
{ DDRMC_CR148_RDLV_GATE_RESP_MASK(983040), 148 },
|
||||
{ DDRMC_CR151_RDLV_GAT_DQ_ZERO_CNT(1) |
|
||||
DDRMC_CR151_RDLVL_DQ_ZERO_CNT(1), 151 },
|
||||
|
||||
{ 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), 154 },
|
||||
{ DDRMC_CR155_PAD_ODT_BYTE1(1) | DDRMC_CR155_PAD_ODT_BYTE0(1), 155 },
|
||||
{ DDRMC_CR158_TWR(6), 158 },
|
||||
{ DDRMC_CR161_ODT_EN(1) | DDRMC_CR161_TODTH_RD(2) |
|
||||
DDRMC_CR161_TODTH_WR(2), 161 },
|
||||
/* end marker */
|
||||
{ 0, -1 }
|
||||
};
|
||||
|
||||
static const iomux_v3_cfg_t usb_pads[] = {
|
||||
VF610_PAD_PTD4__GPIO_83,
|
||||
};
|
||||
@@ -42,48 +97,59 @@ static const iomux_v3_cfg_t usb_pads[] = {
|
||||
int dram_init(void)
|
||||
{
|
||||
static const struct ddr3_jedec_timings timings = {
|
||||
.tinit = 5,
|
||||
.trst_pwron = 80000,
|
||||
.cke_inactive = 200000,
|
||||
.wrlat = 5,
|
||||
.caslat_lin = 12,
|
||||
.trc = 21,
|
||||
.trrd = 4,
|
||||
.tccd = 4,
|
||||
.tfaw = 20,
|
||||
.trp = 6,
|
||||
.twtr = 4,
|
||||
.tras_min = 15,
|
||||
.tmrd = 4,
|
||||
.trtp = 4,
|
||||
.tras_max = 28080,
|
||||
.tmod = 12,
|
||||
.tckesr = 4,
|
||||
.tcke = 3,
|
||||
.trcd_int = 6,
|
||||
.tdal = 12,
|
||||
.tdll = 512,
|
||||
.trp_ab = 6,
|
||||
.tref = 3120,
|
||||
.trfc = 64,
|
||||
.tpdex = 3,
|
||||
.txpdll = 10,
|
||||
.txsnr = 48,
|
||||
.txsr = 468,
|
||||
.cksrx = 5,
|
||||
.cksre = 5,
|
||||
.zqcl = 256,
|
||||
.zqinit = 512,
|
||||
.zqcs = 64,
|
||||
.ref_per_zq = 64,
|
||||
.aprebit = 10,
|
||||
.wlmrd = 40,
|
||||
.wldqsen = 25,
|
||||
.tinit = 5,
|
||||
.trst_pwron = 80000,
|
||||
.cke_inactive = 200000,
|
||||
.wrlat = 5,
|
||||
.caslat_lin = 12,
|
||||
.trc = 21,
|
||||
.trrd = 4,
|
||||
.tccd = 4,
|
||||
.tbst_int_interval = 0,
|
||||
.tfaw = 20,
|
||||
.trp = 6,
|
||||
.twtr = 4,
|
||||
.tras_min = 15,
|
||||
.tmrd = 4,
|
||||
.trtp = 4,
|
||||
.tras_max = 28080,
|
||||
.tmod = 12,
|
||||
.tckesr = 4,
|
||||
.tcke = 3,
|
||||
.trcd_int = 6,
|
||||
.tras_lockout = 0,
|
||||
.tdal = 12,
|
||||
.bstlen = 3,
|
||||
.tdll = 512,
|
||||
.trp_ab = 6,
|
||||
.tref = 3120,
|
||||
.trfc = 64,
|
||||
.tref_int = 0,
|
||||
.tpdex = 3,
|
||||
.txpdll = 10,
|
||||
.txsnr = 48,
|
||||
.txsr = 468,
|
||||
.cksrx = 5,
|
||||
.cksre = 5,
|
||||
.freq_chg_en = 0,
|
||||
.zqcl = 256,
|
||||
.zqinit = 512,
|
||||
.zqcs = 64,
|
||||
.ref_per_zq = 64,
|
||||
.zqcs_rotate = 0,
|
||||
.aprebit = 10,
|
||||
.cmd_age_cnt = 64,
|
||||
.age_cnt = 64,
|
||||
.q_fullness = 7,
|
||||
.odt_rd_mapcs0 = 0,
|
||||
.odt_wr_mapcs0 = 1,
|
||||
.wlmrd = 40,
|
||||
.wldqsen = 25,
|
||||
};
|
||||
|
||||
ddrmc_setup_iomux();
|
||||
ddrmc_setup_iomux(NULL, 0);
|
||||
|
||||
ddrmc_ctrl_init_ddr3(&timings, NULL, 1, 2);
|
||||
ddrmc_ctrl_init_ddr3(&timings, colibri_vf_cr_settings, NULL, 1, 2);
|
||||
gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -389,6 +389,15 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type,
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_LZO */
|
||||
#ifdef CONFIG_LZ4
|
||||
case IH_COMP_LZ4: {
|
||||
size_t size = unc_len;
|
||||
|
||||
ret = ulz4fn(image_buf, image_len, load_buf, &size);
|
||||
image_len = size;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_LZ4 */
|
||||
default:
|
||||
printf("Unimplemented compression type %d\n", comp);
|
||||
return BOOTM_ERR_UNIMPLEMENTED;
|
||||
@@ -474,7 +483,9 @@ ulong bootm_disable_interrupts(void)
|
||||
#ifdef CONFIG_NETCONSOLE
|
||||
/* Stop the ethernet stack if NetConsole could have left it up */
|
||||
eth_halt();
|
||||
# ifndef CONFIG_DM_ETH
|
||||
eth_unregister(eth_get_dev());
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_USB)
|
||||
|
||||
@@ -175,7 +175,7 @@ static void parse_flash(void)
|
||||
parse_bank(bank);
|
||||
}
|
||||
|
||||
static void load_image(const char * const name, const ulong address)
|
||||
static int load_image(const char * const name, const ulong address)
|
||||
{
|
||||
struct afs_image *afi = NULL;
|
||||
int i;
|
||||
@@ -191,7 +191,7 @@ static void load_image(const char * const name, const ulong address)
|
||||
}
|
||||
if (!afi) {
|
||||
printf("image \"%s\" not found in flash\n", name);
|
||||
return;
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
for (i = 0; i < afi->region_count; i++) {
|
||||
@@ -204,7 +204,7 @@ static void load_image(const char * const name, const ulong address)
|
||||
to = afi->regions[i].load_address;
|
||||
} else {
|
||||
printf("no valid load address\n");
|
||||
return;
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
memcpy((void *)to, (void *)from, afi->regions[i].size);
|
||||
@@ -215,6 +215,7 @@ static void load_image(const char * const name, const ulong address)
|
||||
to,
|
||||
afi->regions[i].size);
|
||||
}
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
static void print_images(void)
|
||||
@@ -251,27 +252,47 @@ static void print_images(void)
|
||||
}
|
||||
}
|
||||
|
||||
static int exists(const char * const name)
|
||||
{
|
||||
int i;
|
||||
|
||||
parse_flash();
|
||||
for (i = 0; i < num_afs_images; i++) {
|
||||
struct afs_image *afi = &afs_images[i];
|
||||
|
||||
if (strcmp(afi->name, name) == 0)
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
static int do_afs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
int ret = CMD_RET_SUCCESS;
|
||||
|
||||
if (argc == 1) {
|
||||
print_images();
|
||||
} else if (argc == 3 && !strcmp(argv[1], "exists")) {
|
||||
ret = exists(argv[2]);
|
||||
} else if (argc == 3 && !strcmp(argv[1], "load")) {
|
||||
load_image(argv[2], 0x0);
|
||||
ret = load_image(argv[2], 0x0);
|
||||
} else if (argc == 4 && !strcmp(argv[1], "load")) {
|
||||
ulong load_addr;
|
||||
|
||||
load_addr = simple_strtoul(argv[3], NULL, 16);
|
||||
load_image(argv[2], load_addr);
|
||||
ret = load_image(argv[2], load_addr);
|
||||
} else {
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(afs, 4, 0, do_afs, "show AFS partitions",
|
||||
"no arguments\n"
|
||||
" - list images in flash\n"
|
||||
"exists <image>\n"
|
||||
" - returns 1 if an image exists, else 0\n"
|
||||
"load <image>\n"
|
||||
" - load an image to the location indicated in the header\n"
|
||||
"load <image> 0x<address>\n"
|
||||
|
||||
@@ -82,17 +82,117 @@ uchar env_get_char_spec(int index)
|
||||
|
||||
void env_relocate_spec(void)
|
||||
{
|
||||
char buf[CONFIG_ENV_SIZE];
|
||||
char buf_env[CONFIG_ENV_SIZE];
|
||||
unsigned int off = CONFIG_ENV_OFFSET;
|
||||
|
||||
#ifdef CONFIG_ENV_OFFSET_REDUND
|
||||
ulong len, crc[2], crc_tmp;
|
||||
unsigned int off_env[2];
|
||||
uchar rdbuf[64], flags[2];
|
||||
int i, crc_ok[2] = {0, 0};
|
||||
|
||||
eeprom_init(); /* prepare for EEPROM read/write */
|
||||
|
||||
off_env[0] = CONFIG_ENV_OFFSET;
|
||||
off_env[1] = CONFIG_ENV_OFFSET_REDUND;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
/* read CRC */
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
off_env[i] + offsetof(env_t, crc),
|
||||
(uchar *)&crc[i], sizeof(ulong));
|
||||
/* read FLAGS */
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
off_env[i] + offsetof(env_t, flags),
|
||||
(uchar *)&flags[i], sizeof(uchar));
|
||||
|
||||
crc_tmp = 0;
|
||||
len = ENV_SIZE;
|
||||
off = off_env[i] + offsetof(env_t, data);
|
||||
while (len > 0) {
|
||||
int n = (len > sizeof(rdbuf)) ? sizeof(rdbuf) : len;
|
||||
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR, off,
|
||||
rdbuf, n);
|
||||
|
||||
crc_tmp = crc32(crc_tmp, rdbuf, n);
|
||||
len -= n;
|
||||
off += n;
|
||||
}
|
||||
|
||||
if (crc_tmp == crc[i])
|
||||
crc_ok[i] = 1;
|
||||
}
|
||||
|
||||
if (!crc_ok[0] && !crc_ok[1]) {
|
||||
gd->env_addr = 0;
|
||||
gd->env_valid = 0;
|
||||
} else if (crc_ok[0] && !crc_ok[1]) {
|
||||
gd->env_valid = 1;
|
||||
} else if (!crc_ok[0] && crc_ok[1]) {
|
||||
gd->env_valid = 2;
|
||||
} else {
|
||||
/* both ok - check serial */
|
||||
if (flags[0] == ACTIVE_FLAG && flags[1] == OBSOLETE_FLAG)
|
||||
gd->env_valid = 1;
|
||||
else if (flags[0] == OBSOLETE_FLAG && flags[1] == ACTIVE_FLAG)
|
||||
gd->env_valid = 2;
|
||||
else if (flags[0] == 0xFF && flags[1] == 0)
|
||||
gd->env_valid = 2;
|
||||
else if (flags[1] == 0xFF && flags[0] == 0)
|
||||
gd->env_valid = 1;
|
||||
else /* flags are equal - almost impossible */
|
||||
gd->env_valid = 1;
|
||||
}
|
||||
|
||||
if (gd->env_valid == 2)
|
||||
gd->env_addr = off_env[1] + offsetof(env_t, data);
|
||||
else if (gd->env_valid == 1)
|
||||
gd->env_addr = off_env[0] + offsetof(env_t, data);
|
||||
|
||||
#else /* CONFIG_ENV_OFFSET_REDUND */
|
||||
ulong crc, len, new;
|
||||
uchar rdbuf[64];
|
||||
|
||||
eeprom_init(); /* prepare for EEPROM read/write */
|
||||
|
||||
/* read old CRC */
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
CONFIG_ENV_OFFSET + offsetof(env_t, crc),
|
||||
(uchar *)&crc, sizeof(ulong));
|
||||
|
||||
new = 0;
|
||||
len = ENV_SIZE;
|
||||
off = offsetof(env_t, data);
|
||||
while (len > 0) {
|
||||
int n = (len > sizeof(rdbuf)) ? sizeof(rdbuf) : len;
|
||||
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
CONFIG_ENV_OFFSET + off, rdbuf, n);
|
||||
new = crc32(new, rdbuf, n);
|
||||
len -= n;
|
||||
off += n;
|
||||
}
|
||||
|
||||
if (crc == new) {
|
||||
gd->env_addr = offsetof(env_t, data);
|
||||
gd->env_valid = 1;
|
||||
} else {
|
||||
gd->env_addr = 0;
|
||||
gd->env_valid = 0;
|
||||
}
|
||||
#endif /* CONFIG_ENV_OFFSET_REDUND */
|
||||
|
||||
off = CONFIG_ENV_OFFSET;
|
||||
#ifdef CONFIG_ENV_OFFSET_REDUND
|
||||
if (gd->env_valid == 2)
|
||||
off = CONFIG_ENV_OFFSET_REDUND;
|
||||
#endif
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
off, (uchar *)buf, CONFIG_ENV_SIZE);
|
||||
|
||||
env_import(buf, 1);
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
off, (uchar *)buf_env, CONFIG_ENV_SIZE);
|
||||
|
||||
env_import(buf_env, 1);
|
||||
}
|
||||
|
||||
int saveenv(void)
|
||||
@@ -144,121 +244,9 @@ int saveenv(void)
|
||||
* We are still running from ROM, so data use is limited.
|
||||
* Use a (moderately small) buffer on the stack
|
||||
*/
|
||||
#ifdef CONFIG_ENV_OFFSET_REDUND
|
||||
int env_init(void)
|
||||
{
|
||||
#ifdef ENV_IS_EMBEDDED
|
||||
ulong len, crc[2], crc_tmp;
|
||||
unsigned int off, off_env[2];
|
||||
uchar buf[64], flags[2];
|
||||
int i, crc_ok[2] = {0, 0};
|
||||
|
||||
eeprom_init(); /* prepare for EEPROM read/write */
|
||||
|
||||
off_env[0] = CONFIG_ENV_OFFSET;
|
||||
off_env[1] = CONFIG_ENV_OFFSET_REDUND;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
/* read CRC */
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
off_env[i] + offsetof(env_t, crc),
|
||||
(uchar *)&crc[i], sizeof(ulong));
|
||||
/* read FLAGS */
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
off_env[i] + offsetof(env_t, flags),
|
||||
(uchar *)&flags[i], sizeof(uchar));
|
||||
|
||||
crc_tmp = 0;
|
||||
len = ENV_SIZE;
|
||||
off = off_env[i] + offsetof(env_t, data);
|
||||
while (len > 0) {
|
||||
int n = (len > sizeof(buf)) ? sizeof(buf) : len;
|
||||
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR, off,
|
||||
buf, n);
|
||||
|
||||
crc_tmp = crc32(crc_tmp, buf, n);
|
||||
len -= n;
|
||||
off += n;
|
||||
}
|
||||
|
||||
if (crc_tmp == crc[i])
|
||||
crc_ok[i] = 1;
|
||||
}
|
||||
|
||||
if (!crc_ok[0] && !crc_ok[1]) {
|
||||
gd->env_addr = 0;
|
||||
gd->env_valid = 0;
|
||||
|
||||
return 0;
|
||||
} else if (crc_ok[0] && !crc_ok[1]) {
|
||||
gd->env_valid = 1;
|
||||
} else if (!crc_ok[0] && crc_ok[1]) {
|
||||
gd->env_valid = 2;
|
||||
} else {
|
||||
/* both ok - check serial */
|
||||
if (flags[0] == ACTIVE_FLAG && flags[1] == OBSOLETE_FLAG)
|
||||
gd->env_valid = 1;
|
||||
else if (flags[0] == OBSOLETE_FLAG && flags[1] == ACTIVE_FLAG)
|
||||
gd->env_valid = 2;
|
||||
else if (flags[0] == 0xFF && flags[1] == 0)
|
||||
gd->env_valid = 2;
|
||||
else if (flags[1] == 0xFF && flags[0] == 0)
|
||||
gd->env_valid = 1;
|
||||
else /* flags are equal - almost impossible */
|
||||
gd->env_valid = 1;
|
||||
}
|
||||
|
||||
if (gd->env_valid == 2)
|
||||
gd->env_addr = off_env[1] + offsetof(env_t, data);
|
||||
else if (gd->env_valid == 1)
|
||||
gd->env_addr = off_env[0] + offsetof(env_t, data);
|
||||
#else
|
||||
gd->env_addr = (ulong)&default_environment[0];
|
||||
gd->env_valid = 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int env_init(void)
|
||||
{
|
||||
#ifdef ENV_IS_EMBEDDED
|
||||
ulong crc, len, new;
|
||||
unsigned off;
|
||||
uchar buf[64];
|
||||
|
||||
eeprom_init(); /* prepare for EEPROM read/write */
|
||||
|
||||
/* read old CRC */
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
CONFIG_ENV_OFFSET + offsetof(env_t, crc),
|
||||
(uchar *)&crc, sizeof(ulong));
|
||||
|
||||
new = 0;
|
||||
len = ENV_SIZE;
|
||||
off = offsetof(env_t, data);
|
||||
|
||||
while (len > 0) {
|
||||
int n = (len > sizeof(buf)) ? sizeof(buf) : len;
|
||||
|
||||
eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
|
||||
CONFIG_ENV_OFFSET + off, buf, n);
|
||||
new = crc32(new, buf, n);
|
||||
len -= n;
|
||||
off += n;
|
||||
}
|
||||
|
||||
if (crc == new) {
|
||||
gd->env_addr = offsetof(env_t, data);
|
||||
gd->env_valid = 1;
|
||||
} else {
|
||||
gd->env_addr = 0;
|
||||
gd->env_valid = 0;
|
||||
}
|
||||
#else
|
||||
gd->env_addr = (ulong)&default_environment[0];
|
||||
gd->env_valid = 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -130,8 +130,10 @@ ulong android_image_get_kload(const struct andr_img_hdr *hdr)
|
||||
int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
|
||||
ulong *rd_data, ulong *rd_len)
|
||||
{
|
||||
if (!hdr->ramdisk_size)
|
||||
if (!hdr->ramdisk_size) {
|
||||
*rd_data = *rd_len = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("RAM disk load addr 0x%08x size %u KiB\n",
|
||||
hdr->ramdisk_addr, DIV_ROUND_UP(hdr->ramdisk_size, 1024));
|
||||
|
||||
@@ -1030,8 +1030,10 @@ int fit_image_verify(const void *fit, int image_noffset)
|
||||
strlen(FIT_SIG_NODENAME))) {
|
||||
ret = fit_image_check_sig(fit, noffset, data,
|
||||
size, -1, &err_msg);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
puts("- ");
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
puts("+ ");
|
||||
}
|
||||
|
||||
@@ -167,6 +167,7 @@ static const table_entry_t uimage_comp[] = {
|
||||
{ IH_COMP_GZIP, "gzip", "gzip compressed", },
|
||||
{ IH_COMP_LZMA, "lzma", "lzma compressed", },
|
||||
{ IH_COMP_LZO, "lzo", "lzo compressed", },
|
||||
{ IH_COMP_LZ4, "lz4", "lz4 compressed", },
|
||||
{ -1, "", "", },
|
||||
};
|
||||
|
||||
@@ -907,6 +908,15 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
|
||||
*rd_start = 0;
|
||||
*rd_end = 0;
|
||||
|
||||
#ifdef CONFIG_ANDROID_BOOT_IMAGE
|
||||
/*
|
||||
* Look for an Android boot image.
|
||||
*/
|
||||
buf = map_sysmem(images->os.start, 0);
|
||||
if (genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
|
||||
select = argv[0];
|
||||
#endif
|
||||
|
||||
if (argc >= 2)
|
||||
select = argv[1];
|
||||
|
||||
|
||||
@@ -11,5 +11,6 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
CONFIG_NETCONSOLE=y
|
||||
CONFIG_ETH_DESIGNWARE=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
|
||||
@@ -13,5 +13,6 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
CONFIG_NETCONSOLE=y
|
||||
CONFIG_ETH_DESIGNWARE=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_SUNXI=y
|
||||
CONFIG_MACH_SUN4I=y
|
||||
CONFIG_DRAM_CLK=408
|
||||
CONFIG_USB1_VBUS_PIN=""
|
||||
CONFIG_USB2_VBUS_PIN=""
|
||||
CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-pcduino"
|
||||
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
|
||||
CONFIG_SPL=y
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
CONFIG_X86=y
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x1800
|
||||
CONFIG_VENDOR_GOOGLE=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="chromebook_link"
|
||||
CONFIG_TARGET_CHROMEBOOK_LINK=y
|
||||
|
||||
8
configs/d2net_v2_defconfig
Normal file
8
configs/d2net_v2_defconfig
Normal file
@@ -0,0 +1,8 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_KIRKWOOD=y
|
||||
CONFIG_TARGET_NET2BIG_V2=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="D2NET_V2"
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_SPI_FLASH=y
|
||||
8
configs/inetspace_v2_defconfig
Normal file
8
configs/inetspace_v2_defconfig
Normal file
@@ -0,0 +1,8 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_KIRKWOOD=y
|
||||
CONFIG_TARGET_NETSPACE_V2=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="INETSPACE_V2"
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_SPI_FLASH=y
|
||||
4
configs/lwmon5_defconfig
Normal file
4
configs/lwmon5_defconfig
Normal file
@@ -0,0 +1,4 @@
|
||||
CONFIG_PPC=y
|
||||
CONFIG_4xx=y
|
||||
CONFIG_TARGET_LWMON5=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
6
configs/pcm052_defconfig
Normal file
6
configs/pcm052_defconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_TARGET_PCM052=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/phytec/pcm052/imximage.cfg,ENV_IS_IN_NAND"
|
||||
CONFIG_NAND_VF610_NFC=y
|
||||
CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
|
||||
CONFIG_SYS_NAND_VF610_NFC_45_ECC_BYTES=y
|
||||
25
configs/q8_a23_tablet_800x480_defconfig
Normal file
25
configs/q8_a23_tablet_800x480_defconfig
Normal file
@@ -0,0 +1,25 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_SUNXI=y
|
||||
CONFIG_MACH_SUN8I_A23=y
|
||||
CONFIG_DRAM_CLK=432
|
||||
CONFIG_DRAM_ZQ=63306
|
||||
CONFIG_MMC0_CD_PIN="PB4"
|
||||
CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
|
||||
CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
|
||||
CONFIG_USB0_ID_DET="PH8"
|
||||
CONFIG_AXP_GPIO=y
|
||||
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:36,ri:210,up:18,lo:22,hs:10,vs:5,sync:3,vmode:0"
|
||||
CONFIG_VIDEO_LCD_DCLK_PHASE=0
|
||||
CONFIG_VIDEO_LCD_POWER="PH7"
|
||||
CONFIG_VIDEO_LCD_BL_EN="PH6"
|
||||
CONFIG_VIDEO_LCD_BL_PWM="PH0"
|
||||
CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-q8-tablet"
|
||||
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
|
||||
CONFIG_SPL=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
CONFIG_AXP221_DLDO1_VOLT=3300
|
||||
CONFIG_AXP221_ALDO1_VOLT=3000
|
||||
CONFIG_USB_MUSB_HOST=y
|
||||
25
configs/q8_a33_tablet_1024x600_defconfig
Normal file
25
configs/q8_a33_tablet_1024x600_defconfig
Normal file
@@ -0,0 +1,25 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_SUNXI=y
|
||||
CONFIG_MACH_SUN8I_A33=y
|
||||
CONFIG_DRAM_CLK=456
|
||||
CONFIG_DRAM_ZQ=15291
|
||||
CONFIG_MMC0_CD_PIN="PB4"
|
||||
CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
|
||||
CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
|
||||
CONFIG_USB0_ID_DET="PH8"
|
||||
CONFIG_AXP_GPIO=y
|
||||
CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:18,pclk_khz:51000,le:159,ri:160,up:22,lo:12,hs:1,vs:1,sync:3,vmode:0"
|
||||
CONFIG_VIDEO_LCD_DCLK_PHASE=0
|
||||
CONFIG_VIDEO_LCD_POWER="PH7"
|
||||
CONFIG_VIDEO_LCD_BL_EN="PH6"
|
||||
CONFIG_VIDEO_LCD_BL_PWM="PH0"
|
||||
CONFIG_DEFAULT_DEVICE_TREE="sun8i-a33-q8-tablet"
|
||||
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
|
||||
CONFIG_SPL=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
CONFIG_AXP221_DLDO1_VOLT=3300
|
||||
CONFIG_AXP221_ALDO1_VOLT=3000
|
||||
CONFIG_USB_MUSB_HOST=y
|
||||
25
configs/q8_a33_tablet_800x480_defconfig
Normal file
25
configs/q8_a33_tablet_800x480_defconfig
Normal file
@@ -0,0 +1,25 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_SUNXI=y
|
||||
CONFIG_MACH_SUN8I_A33=y
|
||||
CONFIG_DRAM_CLK=456
|
||||
CONFIG_DRAM_ZQ=15291
|
||||
CONFIG_MMC0_CD_PIN="PB4"
|
||||
CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
|
||||
CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
|
||||
CONFIG_USB0_ID_DET="PH8"
|
||||
CONFIG_AXP_GPIO=y
|
||||
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:87,ri:167,up:31,lo:13,hs:1,vs:1,sync:3,vmode:0"
|
||||
CONFIG_VIDEO_LCD_DCLK_PHASE=0
|
||||
CONFIG_VIDEO_LCD_POWER="PH7"
|
||||
CONFIG_VIDEO_LCD_BL_EN="PH6"
|
||||
CONFIG_VIDEO_LCD_BL_PWM="PH0"
|
||||
CONFIG_DEFAULT_DEVICE_TREE="sun8i-a33-q8-tablet"
|
||||
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
|
||||
CONFIG_SPL=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
CONFIG_AXP221_DLDO1_VOLT=3300
|
||||
CONFIG_AXP221_ALDO1_VOLT=3000
|
||||
CONFIG_USB_MUSB_HOST=y
|
||||
@@ -56,6 +56,7 @@ CONFIG_USB_STORAGE=y
|
||||
CONFIG_SYS_VSNPRINTF=y
|
||||
CONFIG_CMD_DHRYSTONE=y
|
||||
CONFIG_TPM=y
|
||||
CONFIG_LZ4=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
CONFIG_UNIT_TEST=y
|
||||
CONFIG_UT_TIME=y
|
||||
|
||||
19
configs/vexpress_aemv8a_dram_defconfig
Normal file
19
configs/vexpress_aemv8a_dram_defconfig
Normal file
@@ -0,0 +1,19 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_TARGET_VEXPRESS64_BASE_FVP_DRAM=y
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x2000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="vexpress64"
|
||||
# CONFIG_CMD_CONSOLE is not set
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
# CONFIG_CMD_EDITENV is not set
|
||||
# CONFIG_CMD_ENV_EXISTS is not set
|
||||
# CONFIG_CMD_LOADS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
# CONFIG_CMD_ITEST is not set
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
# CONFIG_CMD_NFS is not set
|
||||
# CONFIG_CMD_MISC is not set
|
||||
CONFIG_DM=y
|
||||
CONFIG_DM_SERIAL=y
|
||||
CONFIG_SYS_PROMPT="VExpress64# "
|
||||
@@ -12,16 +12,86 @@ The list should be sorted in reverse chronological order.
|
||||
|
||||
Board Arch CPU Commit Removed Last known maintainer/contact
|
||||
=================================================================================================
|
||||
stxgp3 powerpc mpc85xx - - Dan Malek <dan@embeddedalley.com>
|
||||
stxssa powerpc mpc85xx - - Dan Malek <dan@embeddedalley.com>
|
||||
cmi_mpc5xx powerpc mpc5xx - -
|
||||
zeus powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
sbc405 powerpc ppc4xx - -
|
||||
pcs440ep powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
p3p440 powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
lwmon5 powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
csb272/csb472 powerpc ppc4xx - - Tolunay Orkun <torkun@nextio.com>
|
||||
alpr powerpc ppc4xx - - Stefan Roese <sr@denx.de>
|
||||
lcd4_lwmon5 powerpc ppc4xx b6b5e394 2015-10-02 Stefan Roese <sr@denx.de>
|
||||
da830evm arm arm926ejs d7e8b2b9 2015-09-12 Nick Thompson <nick.thompson@gefanuc.com>
|
||||
wireless_space arm arm926ejs b352182a 2015-09-12 Albert ARIBAUD <albert.u.boot@aribaud.net>
|
||||
stxgp3 powerpc mpc85xx 2ec69b88 2015-09-02 Dan Malek <dan@embeddedalley.com>
|
||||
stxssa powerpc mpc85xx 2ec69b88 2015-09-02 Dan Malek <dan@embeddedalley.com>
|
||||
cmi_mpc5xx powerpc mpc5xx 972f5320 2015-09-02
|
||||
zeus powerpc ppc4xx eb5d1dc7 2015-09-02 Stefan Roese <sr@denx.de>
|
||||
sbc405 powerpc ppc4xx 0e030593 2015-09-02
|
||||
pcs440ep powerpc ppc4xx 242836a8 2015-09-02 Stefan Roese <sr@denx.de>
|
||||
p3p440 powerpc ppc4xx c6999e5f 2015-09-02 Stefan Roese <sr@denx.de>
|
||||
csb272/csb472 powerpc ppc4xx 54a3f260 2015-09-02 Tolunay Orkun <torkun@nextio.com>
|
||||
alpr powerpc ppc4xx 0d2fc811 2015-09-02 Stefan Roese <sr@denx.de>
|
||||
balloon3 arm pxa 679d4456 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
cpu9260_128M arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9260 arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9260_nand_128M arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9260_nand arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9G20_128M arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpu9G20 arm arm926ejs af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpuat91 arm arm920t af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
cpuat91_ram arm arm920t af7f884b 2015-08-30 Eric Benard <eric@eukrea.com>
|
||||
davinci_dm355evm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dm355leopard arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dm365evm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dm6467evm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dm6467Tevm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_dvevm arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_schmoogie arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_sffsdr arm arm926ejs 6761946f 2015-08-30
|
||||
davinci_sonata arm arm926ejs 6761946f 2015-08-30
|
||||
dig297 arm armv7 5ff33d04 2015-08-30 Luca Ceresoli <luca.ceresoli@comelit.it>
|
||||
ea20 arm arm926ejs 6761946f 2015-08-30
|
||||
eb_cpux9k2 arm arm920t 5522f12b 2015-08-30 Jens Scharsig <esw@bus-elektronik.de>
|
||||
eb_cpux9k2_ram arm arm920t 5522f12b 2015-08-30 Jens Scharsig <esw@bus-elektronik.de>
|
||||
enbw_cmc arm arm926ejs a6f7f787 2015-08-30 Heiko Schocher <hs@denx.de>
|
||||
ima3-mx53 arm armv7 3eb8f58d 2015-08-30
|
||||
imx27lite arm arm926ejs bc0840bc 2015-08-30 Wolfgang Denk <wd@denx.de>
|
||||
imx31_litekit arm arm1136 36d14178 2015-08-30
|
||||
jornada arm sa1100 df0b116d 2015-08-30 Kristoffer Ericson <kristoffer.ericson@gmail.com>
|
||||
lp8x4x arm pxa 9f840b8d 2015-08-30 Sergey Yanovich <ynvich@gmail.com>
|
||||
magnesium arm arm926ejs bc0840bc 2015-08-30 Heiko Schocher <hs@denx.de>
|
||||
mv88f6281gtw_ge arm arm926ejs 7cd768cf 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
mx51_efikamx arm armv7 b6073fd2 2015-08-30
|
||||
mx51_efikasb arm armv7 b6073fd2 2015-08-30
|
||||
nhk8815 arm arm926ejs 0abdd9d0 2015-08-30 Nomadik Linux Team <STN_WMM_nomadik_linux@list.st.com>
|
||||
nhk8815_onenand arm arm926ejs 0abdd9d0 2015-08-30 Nomadik Linux Team <STN_WMM_nomadik_linux@list.st.com>
|
||||
omap3_mvblx arm armv7 8dc372f9 2015-08-30 Michael Jones <michael.jones@matrix-vision.de>
|
||||
omap3_sdp3430 arm armv7 93b25c08 2015-08-30 Nishanth Menon <nm@ti.com>
|
||||
openrd_base arm arm926ejs 7a2c1b13 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
openrd_client arm arm926ejs 7a2c1b13 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
openrd_ultimate arm arm926ejs 7a2c1b13 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
otc570 arm arm926ejs 819216dd 2015-08-30 Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
|
||||
otc570_dataflash arm arm926ejs 819216dd 2015-08-30 Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
|
||||
palmld arm pxa 35782e9c 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
palmtc arm pxa 8896325d 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
palmtreo680 arm pxa ad4f54ea 2015-08-30 Mike Dunn <mikedunn@newsguy.com>
|
||||
polaris arm pxa f6eac00a 2015-08-30 Stefano Babic <sbabic@denx.de>
|
||||
portuxg20 arm arm926ejs 79d19734 2015-08-30 Markus Hubig <mhubig@imko.de>
|
||||
pxa255_idp arm pxa 49d8899b 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
qong arm arm1136 daf77086 2015-08-30 Wolfgang Denk <wd@denx.de>
|
||||
rd6281a arm arm926ejs 47b87d2e 2015-08-30 Prafulla Wadaskar <prafulla@marvell.com>
|
||||
scb9328 arm arm920t 7650beb7 2015-08-30 Torsten Koschorrek <koschorrek@synertronixx.de>
|
||||
snowball arm armv7 7495e41b 2015-08-30 Mathieu Poirier <mathieu.poirier@linaro.org>
|
||||
stamp9g20 arm arm926ejs 79d19734 2015-08-30 Markus Hubig <mhubig@imko.de>
|
||||
tk71 arm arm926ejs f73db66d 2015-08-30
|
||||
trizepsiv arm pxa f6eac00a 2015-08-30 Stefano Babic <sbabic@denx.de>
|
||||
tt01 arm arm1136 0c81f37d 2015-08-30 Helmut Raiger <helmut.raiger@hale.at>
|
||||
tx25 arm arm926ejs b9599dd8 2015-08-30 John Rigby <jcrigby@gmail.com>
|
||||
u8500_href arm armv7 7495e41b 2015-08-30
|
||||
versatileab arm arm926ejs b928e658 2015-08-30
|
||||
versatilepb arm arm926ejs b928e658 2015-08-30
|
||||
versatileqemu arm arm926ejs b928e658 2015-08-30
|
||||
vision2 arm armv7 bee2b99d 2015-08-30 Stefano Babic <sbabic@denx.de>
|
||||
vl_ma2sc arm arm926ejs 6e830dfc 2015-08-30 Jens Scharsig <esw@bus-elektronik.de>
|
||||
vl_ma2sc_ram arm arm926ejs 6e830dfc 2015-08-30 Jens Scharsig <esw@bus-elektronik.de>
|
||||
vpac270_nor_128 arm pxa 452ef830 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
vpac270_nor_256 arm pxa 452ef830 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
vpac270_ond_256 arm pxa 452ef830 2015-08-30 Marek Vasut <marex@denx.de>
|
||||
xaeniax arm pxa 1c87dd76 2015-08-30
|
||||
zipitz2 arm pxa 49d8899b 2015-08-30 Cliff Brake <cliff.brake@gmail.com>
|
||||
cam_enc_4xx arm arm926ejs 8d775763 2015-08-20 Heiko Schocher <hs@denx.de>
|
||||
atstk1003 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
|
||||
atstk1004 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
|
||||
|
||||
@@ -129,10 +129,10 @@ as follows:
|
||||
|
||||
BKSZ Description RAM slot Peripherals
|
||||
--------------------------------------------------------------------
|
||||
0b00 15MB RAM / 1MB Peri 00000000-0effffff 0f000000-0fffffff
|
||||
0b01 31MB RAM / 1MB Peri 00000000-1effffff 1f000000-1fffffff
|
||||
0b10 64MB RAM / 1MB Peri 00000000-3effffff 3f000000-3fffffff
|
||||
0b11 127MB RAM / 1MB Peri 00000000-7effffff 7f000000-7fffffff
|
||||
0b00 15MB RAM / 1MB Peri 00000000-00efffff 00f00000-00ffffff
|
||||
0b01 31MB RAM / 1MB Peri 00000000-01efffff 01f00000-01ffffff
|
||||
0b10 64MB RAM / 1MB Peri 00000000-03efffff 03f00000-03ffffff
|
||||
0b11 127MB RAM / 1MB Peri 00000000-07efffff 07f00000-07ffffff
|
||||
|
||||
Set BSKZ[1:0] to 0b01 for U-Boot.
|
||||
This mode is the most handy because EA[24] is always supported by the save pin
|
||||
|
||||
@@ -289,8 +289,12 @@ int device_probe_child(struct udevice *dev, void *parent_priv)
|
||||
|
||||
dev->flags |= DM_FLAG_ACTIVATED;
|
||||
|
||||
/* continue regardless of the result of pinctrl */
|
||||
pinctrl_select_state(dev, "default");
|
||||
/*
|
||||
* Process pinctrl for everything except the root device, and
|
||||
* continue regardless of the result of pinctrl.
|
||||
*/
|
||||
if (dev->parent)
|
||||
pinctrl_select_state(dev, "default");
|
||||
|
||||
ret = uclass_pre_probe_device(dev);
|
||||
if (ret)
|
||||
|
||||
@@ -23,16 +23,25 @@ static int dfu_read_medium_sf(struct dfu_entity *dfu, u64 offset, void *buf,
|
||||
return spi_flash_read(dfu->data.sf.dev, offset, *len, buf);
|
||||
}
|
||||
|
||||
static u64 find_sector(struct dfu_entity *dfu, u64 start, u64 offset)
|
||||
{
|
||||
return (lldiv((start + offset), dfu->data.sf.dev->sector_size)) *
|
||||
dfu->data.sf.dev->sector_size;
|
||||
}
|
||||
|
||||
static int dfu_write_medium_sf(struct dfu_entity *dfu,
|
||||
u64 offset, void *buf, long *len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = spi_flash_erase(dfu->data.sf.dev, offset, *len);
|
||||
ret = spi_flash_erase(dfu->data.sf.dev,
|
||||
find_sector(dfu, dfu->data.sf.start, offset),
|
||||
dfu->data.sf.dev->sector_size);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = spi_flash_write(dfu->data.sf.dev, offset, *len, buf);
|
||||
ret = spi_flash_write(dfu->data.sf.dev, dfu->data.sf.start + offset,
|
||||
*len, buf);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -341,18 +341,22 @@ static int gpio_exynos_bind(struct udevice *parent)
|
||||
plat = calloc(1, sizeof(*plat));
|
||||
if (!plat)
|
||||
return -ENOMEM;
|
||||
reg = fdtdec_get_addr(blob, node, "reg");
|
||||
if (reg != FDT_ADDR_T_NONE)
|
||||
bank = (struct s5p_gpio_bank *)((ulong)base + reg);
|
||||
plat->bank = bank;
|
||||
plat->bank_name = fdt_get_name(blob, node, NULL);
|
||||
debug("dev at %p: %s\n", bank, plat->bank_name);
|
||||
|
||||
plat->bank_name = fdt_get_name(blob, node, NULL);
|
||||
ret = device_bind(parent, parent->driver,
|
||||
plat->bank_name, plat, -1, &dev);
|
||||
plat->bank_name, plat, -1, &dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev->of_offset = node;
|
||||
|
||||
reg = dev_get_addr(dev);
|
||||
if (reg != FDT_ADDR_T_NONE)
|
||||
bank = (struct s5p_gpio_bank *)((ulong)base + reg);
|
||||
|
||||
plat->bank = bank;
|
||||
|
||||
debug("dev at %p: %s\n", bank, plat->bank_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* NVIDIA Tegra20 GPIO handling.
|
||||
* (C) Copyright 2010-2012
|
||||
* (C) Copyright 2010-2012,2015
|
||||
* NVIDIA Corporation <www.nvidia.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
@@ -25,12 +25,10 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
enum {
|
||||
TEGRA_CMD_INFO,
|
||||
TEGRA_CMD_PORT,
|
||||
TEGRA_CMD_OUTPUT,
|
||||
TEGRA_CMD_INPUT,
|
||||
};
|
||||
static const int CONFIG_SFIO = 0;
|
||||
static const int CONFIG_GPIO = 1;
|
||||
static const int DIRECTION_INPUT = 0;
|
||||
static const int DIRECTION_OUTPUT = 1;
|
||||
|
||||
struct tegra_gpio_platdata {
|
||||
struct gpio_ctlr_bank *bank;
|
||||
@@ -44,7 +42,7 @@ struct tegra_port_info {
|
||||
int base_gpio; /* Port number for this port (0, 1,.., n-1) */
|
||||
};
|
||||
|
||||
/* Return config of pin 'gpio' as GPIO (1) or SFPIO (0) */
|
||||
/* Return config of pin 'gpio' as GPIO (1) or SFIO (0) */
|
||||
static int get_config(unsigned gpio)
|
||||
{
|
||||
struct gpio_ctlr *ctlr = (struct gpio_ctlr *)NV_PA_GPIO_BASE;
|
||||
@@ -53,15 +51,15 @@ static int get_config(unsigned gpio)
|
||||
int type;
|
||||
|
||||
u = readl(&bank->gpio_config[GPIO_PORT(gpio)]);
|
||||
type = (u >> GPIO_BIT(gpio)) & 1;
|
||||
type = (u >> GPIO_BIT(gpio)) & 1;
|
||||
|
||||
debug("get_config: port = %d, bit = %d is %s\n",
|
||||
GPIO_FULLPORT(gpio), GPIO_BIT(gpio), type ? "GPIO" : "SFPIO");
|
||||
|
||||
return type;
|
||||
return type ? CONFIG_GPIO : CONFIG_SFIO;
|
||||
}
|
||||
|
||||
/* Config pin 'gpio' as GPIO or SFPIO, based on 'type' */
|
||||
/* Config pin 'gpio' as GPIO or SFIO, based on 'type' */
|
||||
static void set_config(unsigned gpio, int type)
|
||||
{
|
||||
struct gpio_ctlr *ctlr = (struct gpio_ctlr *)NV_PA_GPIO_BASE;
|
||||
@@ -72,7 +70,7 @@ static void set_config(unsigned gpio, int type)
|
||||
GPIO_FULLPORT(gpio), GPIO_BIT(gpio), type ? "GPIO" : "SFPIO");
|
||||
|
||||
u = readl(&bank->gpio_config[GPIO_PORT(gpio)]);
|
||||
if (type) /* GPIO */
|
||||
if (type != CONFIG_SFIO)
|
||||
u |= 1 << GPIO_BIT(gpio);
|
||||
else
|
||||
u &= ~(1 << GPIO_BIT(gpio));
|
||||
@@ -93,7 +91,7 @@ static int get_direction(unsigned gpio)
|
||||
debug("get_direction: port = %d, bit = %d, %s\n",
|
||||
GPIO_FULLPORT(gpio), GPIO_BIT(gpio), dir ? "OUT" : "IN");
|
||||
|
||||
return dir;
|
||||
return dir ? DIRECTION_OUTPUT : DIRECTION_INPUT;
|
||||
}
|
||||
|
||||
/* Config GPIO pin 'gpio' as input or output (OE) as per 'output' */
|
||||
@@ -107,7 +105,7 @@ static void set_direction(unsigned gpio, int output)
|
||||
GPIO_FULLPORT(gpio), GPIO_BIT(gpio), output ? "OUT" : "IN");
|
||||
|
||||
u = readl(&bank->gpio_dir_out[GPIO_PORT(gpio)]);
|
||||
if (output)
|
||||
if (output != DIRECTION_INPUT)
|
||||
u |= 1 << GPIO_BIT(gpio);
|
||||
else
|
||||
u &= ~(1 << GPIO_BIT(gpio));
|
||||
@@ -136,24 +134,16 @@ static void set_level(unsigned gpio, int high)
|
||||
* Generic_GPIO primitives.
|
||||
*/
|
||||
|
||||
static int tegra_gpio_request(struct udevice *dev, unsigned offset,
|
||||
const char *label)
|
||||
{
|
||||
struct tegra_port_info *state = dev_get_priv(dev);
|
||||
|
||||
/* Configure as a GPIO */
|
||||
set_config(state->base_gpio + offset, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set GPIO pin 'gpio' as an input */
|
||||
static int tegra_gpio_direction_input(struct udevice *dev, unsigned offset)
|
||||
{
|
||||
struct tegra_port_info *state = dev_get_priv(dev);
|
||||
|
||||
/* Configure GPIO direction as input. */
|
||||
set_direction(state->base_gpio + offset, 0);
|
||||
set_direction(state->base_gpio + offset, DIRECTION_INPUT);
|
||||
|
||||
/* Enable the pin as a GPIO */
|
||||
set_config(state->base_gpio + offset, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -169,7 +159,10 @@ static int tegra_gpio_direction_output(struct udevice *dev, unsigned offset,
|
||||
set_level(gpio, value);
|
||||
|
||||
/* Configure GPIO direction as output. */
|
||||
set_direction(gpio, 1);
|
||||
set_direction(gpio, DIRECTION_OUTPUT);
|
||||
|
||||
/* Enable the pin as a GPIO */
|
||||
set_config(state->base_gpio + offset, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -211,16 +204,18 @@ void gpio_config_table(const struct tegra_gpio_config *config, int len)
|
||||
for (i = 0; i < len; i++) {
|
||||
switch (config[i].init) {
|
||||
case TEGRA_GPIO_INIT_IN:
|
||||
gpio_direction_input(config[i].gpio);
|
||||
set_direction(config[i].gpio, DIRECTION_INPUT);
|
||||
break;
|
||||
case TEGRA_GPIO_INIT_OUT0:
|
||||
gpio_direction_output(config[i].gpio, 0);
|
||||
set_level(config[i].gpio, 0);
|
||||
set_direction(config[i].gpio, DIRECTION_OUTPUT);
|
||||
break;
|
||||
case TEGRA_GPIO_INIT_OUT1:
|
||||
gpio_direction_output(config[i].gpio, 1);
|
||||
set_level(config[i].gpio, 1);
|
||||
set_direction(config[i].gpio, DIRECTION_OUTPUT);
|
||||
break;
|
||||
}
|
||||
set_config(config[i].gpio, 1);
|
||||
set_config(config[i].gpio, CONFIG_GPIO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +249,6 @@ static int tegra_gpio_xlate(struct udevice *dev, struct gpio_desc *desc,
|
||||
}
|
||||
|
||||
static const struct dm_gpio_ops gpio_tegra_ops = {
|
||||
.request = tegra_gpio_request,
|
||||
.direction_input = tegra_gpio_direction_input,
|
||||
.direction_output = tegra_gpio_direction_output,
|
||||
.get_value = tegra_gpio_get_value,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user