avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
634
u-boot/board/sunxi/Kconfig
Normal file
634
u-boot/board/sunxi/Kconfig
Normal file
@@ -0,0 +1,634 @@
|
||||
if ARCH_SUNXI
|
||||
|
||||
# Note only one of these may be selected at a time! But hidden choices are
|
||||
# not supported by Kconfig
|
||||
config SUNXI_GEN_SUN4I
|
||||
bool
|
||||
---help---
|
||||
Select this for sunxi SoCs which have resets and clocks set up
|
||||
as the original A10 (mach-sun4i).
|
||||
|
||||
config SUNXI_GEN_SUN6I
|
||||
bool
|
||||
---help---
|
||||
Select this for sunxi SoCs which have sun6i like periphery, like
|
||||
separate ahb reset control registers, custom pmic bus, new style
|
||||
watchdog, etc.
|
||||
|
||||
|
||||
choice
|
||||
prompt "Sunxi SoC Variant"
|
||||
optional
|
||||
|
||||
config MACH_SUN4I
|
||||
bool "sun4i (Allwinner A10)"
|
||||
select CPU_V7
|
||||
select SUNXI_GEN_SUN4I
|
||||
select SUPPORT_SPL
|
||||
|
||||
config MACH_SUN5I
|
||||
bool "sun5i (Allwinner A13)"
|
||||
select CPU_V7
|
||||
select SUNXI_GEN_SUN4I
|
||||
select SUPPORT_SPL
|
||||
|
||||
config MACH_SUN6I
|
||||
bool "sun6i (Allwinner A31)"
|
||||
select CPU_V7
|
||||
select CPU_V7_HAS_NONSEC
|
||||
select CPU_V7_HAS_VIRT
|
||||
select SUNXI_GEN_SUN6I
|
||||
select SUPPORT_SPL
|
||||
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
|
||||
|
||||
config MACH_SUN7I
|
||||
bool "sun7i (Allwinner A20)"
|
||||
select CPU_V7
|
||||
select CPU_V7_HAS_NONSEC
|
||||
select CPU_V7_HAS_VIRT
|
||||
select SUNXI_GEN_SUN4I
|
||||
select SUPPORT_SPL
|
||||
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
|
||||
|
||||
config MACH_SUN8I_A23
|
||||
bool "sun8i (Allwinner A23)"
|
||||
select CPU_V7
|
||||
select CPU_V7_HAS_NONSEC
|
||||
select CPU_V7_HAS_VIRT
|
||||
select SUNXI_GEN_SUN6I
|
||||
select SUPPORT_SPL
|
||||
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
|
||||
|
||||
config MACH_SUN8I_A33
|
||||
bool "sun8i (Allwinner A33)"
|
||||
select CPU_V7
|
||||
select CPU_V7_HAS_NONSEC
|
||||
select CPU_V7_HAS_VIRT
|
||||
select SUNXI_GEN_SUN6I
|
||||
select SUPPORT_SPL
|
||||
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
|
||||
|
||||
config MACH_SUN8I_A83T
|
||||
bool "sun8i (Allwinner A83T)"
|
||||
select CPU_V7
|
||||
select SUNXI_GEN_SUN6I
|
||||
select SUPPORT_SPL
|
||||
|
||||
config MACH_SUN8I_H3
|
||||
bool "sun8i (Allwinner H3)"
|
||||
select CPU_V7
|
||||
select CPU_V7_HAS_NONSEC
|
||||
select CPU_V7_HAS_VIRT
|
||||
select SUNXI_GEN_SUN6I
|
||||
select SUPPORT_SPL
|
||||
select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
|
||||
|
||||
config MACH_SUN9I
|
||||
bool "sun9i (Allwinner A80)"
|
||||
select CPU_V7
|
||||
select SUNXI_GEN_SUN6I
|
||||
|
||||
config MACH_SUN50I
|
||||
bool "sun50i (Allwinner A64)"
|
||||
select ARM64
|
||||
select SUNXI_GEN_SUN6I
|
||||
|
||||
endchoice
|
||||
|
||||
# The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33"
|
||||
config MACH_SUN8I
|
||||
bool
|
||||
default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_H3 || MACH_SUN8I_A83T
|
||||
|
||||
config DRAM_TYPE
|
||||
int "sunxi dram type"
|
||||
depends on MACH_SUN8I_A83T
|
||||
default 3
|
||||
---help---
|
||||
Set the dram type, 3: DDR3, 7: LPDDR3
|
||||
|
||||
config DRAM_CLK
|
||||
int "sunxi dram clock speed"
|
||||
default 312 if MACH_SUN6I || MACH_SUN8I
|
||||
default 360 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
|
||||
---help---
|
||||
Set the dram clock speed, valid range 240 - 480, must be a multiple
|
||||
of 24.
|
||||
|
||||
if MACH_SUN5I || MACH_SUN7I
|
||||
config DRAM_MBUS_CLK
|
||||
int "sunxi mbus clock speed"
|
||||
default 300
|
||||
---help---
|
||||
Set the mbus clock speed. The maximum on sun5i hardware is 300MHz.
|
||||
|
||||
endif
|
||||
|
||||
config DRAM_ZQ
|
||||
int "sunxi dram zq value"
|
||||
default 123 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I
|
||||
default 127 if MACH_SUN7I
|
||||
---help---
|
||||
Set the dram zq value.
|
||||
|
||||
config DRAM_ODT_EN
|
||||
bool "sunxi dram odt enable"
|
||||
default n if !MACH_SUN8I_A23
|
||||
default y if MACH_SUN8I_A23
|
||||
---help---
|
||||
Select this to enable dram odt (on die termination).
|
||||
|
||||
if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
|
||||
config DRAM_EMR1
|
||||
int "sunxi dram emr1 value"
|
||||
default 0 if MACH_SUN4I
|
||||
default 4 if MACH_SUN5I || MACH_SUN7I
|
||||
---help---
|
||||
Set the dram controller emr1 value.
|
||||
|
||||
config DRAM_TPR3
|
||||
hex "sunxi dram tpr3 value"
|
||||
default 0
|
||||
---help---
|
||||
Set the dram controller tpr3 parameter. This parameter configures
|
||||
the delay on the command lane and also phase shifts, which are
|
||||
applied for sampling incoming read data. The default value 0
|
||||
means that no phase/delay adjustments are necessary. Properly
|
||||
configuring this parameter increases reliability at high DRAM
|
||||
clock speeds.
|
||||
|
||||
config DRAM_DQS_GATING_DELAY
|
||||
hex "sunxi dram dqs_gating_delay value"
|
||||
default 0
|
||||
---help---
|
||||
Set the dram controller dqs_gating_delay parmeter. Each byte
|
||||
encodes the DQS gating delay for each byte lane. The delay
|
||||
granularity is 1/4 cycle. For example, the value 0x05060606
|
||||
means that the delay is 5 quarter-cycles for one lane (1.25
|
||||
cycles) and 6 quarter-cycles (1.5 cycles) for 3 other lanes.
|
||||
The default value 0 means autodetection. The results of hardware
|
||||
autodetection are not very reliable and depend on the chip
|
||||
temperature (sometimes producing different results on cold start
|
||||
and warm reboot). But the accuracy of hardware autodetection
|
||||
is usually good enough, unless running at really high DRAM
|
||||
clocks speeds (up to 600MHz). If unsure, keep as 0.
|
||||
|
||||
choice
|
||||
prompt "sunxi dram timings"
|
||||
default DRAM_TIMINGS_VENDOR_MAGIC
|
||||
---help---
|
||||
Select the timings of the DDR3 chips.
|
||||
|
||||
config DRAM_TIMINGS_VENDOR_MAGIC
|
||||
bool "Magic vendor timings from Android"
|
||||
---help---
|
||||
The same DRAM timings as in the Allwinner boot0 bootloader.
|
||||
|
||||
config DRAM_TIMINGS_DDR3_1066F_1333H
|
||||
bool "JEDEC DDR3-1333H with down binning to DDR3-1066F"
|
||||
---help---
|
||||
Use the timings of the standard JEDEC DDR3-1066F speed bin for
|
||||
DRAM_CLK <= 533MHz and the timings of the DDR3-1333H speed bin
|
||||
for DRAM_CLK > 533MHz. This covers the majority of DDR3 chips
|
||||
used in Allwinner A10/A13/A20 devices. In the case of DDR3-1333
|
||||
or DDR3-1600 chips, be sure to check the DRAM datasheet to confirm
|
||||
that down binning to DDR3-1066F is supported (because DDR3-1066F
|
||||
uses a bit faster timings than DDR3-1333H).
|
||||
|
||||
config DRAM_TIMINGS_DDR3_800E_1066G_1333J
|
||||
bool "JEDEC DDR3-800E / DDR3-1066G / DDR3-1333J"
|
||||
---help---
|
||||
Use the timings of the slowest possible JEDEC speed bin for the
|
||||
selected DRAM_CLK. Depending on the DRAM_CLK value, it may be
|
||||
DDR3-800E, DDR3-1066G or DDR3-1333J.
|
||||
|
||||
endchoice
|
||||
|
||||
endif
|
||||
|
||||
if MACH_SUN8I_A23
|
||||
config DRAM_ODT_CORRECTION
|
||||
int "sunxi dram odt correction value"
|
||||
default 0
|
||||
---help---
|
||||
Set the dram odt correction value (range -255 - 255). In allwinner
|
||||
fex files, this option is found in bits 8-15 of the u32 odt_en variable
|
||||
in the [dram] section. When bit 31 of the odt_en variable is set
|
||||
then the correction is negative. Usually the value for this is 0.
|
||||
endif
|
||||
|
||||
config SYS_CLK_FREQ
|
||||
default 816000000 if MACH_SUN50I
|
||||
default 912000000 if MACH_SUN7I
|
||||
default 1008000000 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "sun4i" if MACH_SUN4I
|
||||
default "sun5i" if MACH_SUN5I
|
||||
default "sun6i" if MACH_SUN6I
|
||||
default "sun7i" if MACH_SUN7I
|
||||
default "sun8i" if MACH_SUN8I
|
||||
default "sun9i" if MACH_SUN9I
|
||||
default "sun50i" if MACH_SUN50I
|
||||
|
||||
config SYS_BOARD
|
||||
default "sunxi"
|
||||
|
||||
config SYS_SOC
|
||||
default "sunxi"
|
||||
|
||||
config UART0_PORT_F
|
||||
bool "UART0 on MicroSD breakout board"
|
||||
default n
|
||||
---help---
|
||||
Repurpose the SD card slot for getting access to the UART0 serial
|
||||
console. Primarily useful only for low level u-boot debugging on
|
||||
tablets, where normal UART0 is difficult to access and requires
|
||||
device disassembly and/or soldering. As the SD card can't be used
|
||||
at the same time, the system can be only booted in the FEL mode.
|
||||
Only enable this if you really know what you are doing.
|
||||
|
||||
config OLD_SUNXI_KERNEL_COMPAT
|
||||
boolean "Enable workarounds for booting old kernels"
|
||||
default n
|
||||
---help---
|
||||
Set this to enable various workarounds for old kernels, this results in
|
||||
sub-optimal settings for newer kernels, only enable if needed.
|
||||
|
||||
config MMC
|
||||
depends on !UART0_PORT_F
|
||||
default y if ARCH_SUNXI
|
||||
|
||||
config MMC0_CD_PIN
|
||||
string "Card detect pin for mmc0"
|
||||
default "PF6" if MACH_SUN8I_A83T || MACH_SUN8I_H3 || MACH_SUN50I
|
||||
default ""
|
||||
---help---
|
||||
Set the card detect pin for mmc0, leave empty to not use cd. This
|
||||
takes a string in the format understood by sunxi_name_to_gpio, e.g.
|
||||
PH1 for pin 1 of port H.
|
||||
|
||||
config MMC1_CD_PIN
|
||||
string "Card detect pin for mmc1"
|
||||
default ""
|
||||
---help---
|
||||
See MMC0_CD_PIN help text.
|
||||
|
||||
config MMC2_CD_PIN
|
||||
string "Card detect pin for mmc2"
|
||||
default ""
|
||||
---help---
|
||||
See MMC0_CD_PIN help text.
|
||||
|
||||
config MMC3_CD_PIN
|
||||
string "Card detect pin for mmc3"
|
||||
default ""
|
||||
---help---
|
||||
See MMC0_CD_PIN help text.
|
||||
|
||||
config MMC1_PINS
|
||||
string "Pins for mmc1"
|
||||
default ""
|
||||
---help---
|
||||
Set the pins used for mmc1, when applicable. This takes a string in the
|
||||
format understood by sunxi_name_to_gpio_bank, e.g. PH for port H.
|
||||
|
||||
config MMC2_PINS
|
||||
string "Pins for mmc2"
|
||||
default ""
|
||||
---help---
|
||||
See MMC1_PINS help text.
|
||||
|
||||
config MMC3_PINS
|
||||
string "Pins for mmc3"
|
||||
default ""
|
||||
---help---
|
||||
See MMC1_PINS help text.
|
||||
|
||||
config MMC_SUNXI_SLOT_EXTRA
|
||||
int "mmc extra slot number"
|
||||
default -1
|
||||
---help---
|
||||
sunxi builds always enable mmc0, some boards also have a second sdcard
|
||||
slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable
|
||||
support for this.
|
||||
|
||||
config INITIAL_USB_SCAN_DELAY
|
||||
int "delay initial usb scan by x ms to allow builtin devices to init"
|
||||
default 0
|
||||
---help---
|
||||
Some boards have on board usb devices which need longer than the
|
||||
USB spec's 1 second to connect from board powerup. Set this config
|
||||
option to a non 0 value to add an extra delay before the first usb
|
||||
bus scan.
|
||||
|
||||
config USB0_VBUS_PIN
|
||||
string "Vbus enable pin for usb0 (otg)"
|
||||
default ""
|
||||
---help---
|
||||
Set the Vbus enable pin for usb0 (otg). This takes a string in the
|
||||
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
config USB0_VBUS_DET
|
||||
string "Vbus detect pin for usb0 (otg)"
|
||||
default ""
|
||||
---help---
|
||||
Set the Vbus detect pin for usb0 (otg). This takes a string in the
|
||||
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
config USB0_ID_DET
|
||||
string "ID detect pin for usb0 (otg)"
|
||||
default ""
|
||||
---help---
|
||||
Set the ID detect pin for usb0 (otg). This takes a string in the
|
||||
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
config USB1_VBUS_PIN
|
||||
string "Vbus enable pin for usb1 (ehci0)"
|
||||
default "PH6" if MACH_SUN4I || MACH_SUN7I
|
||||
default "PH27" if MACH_SUN6I
|
||||
---help---
|
||||
Set the Vbus enable pin for usb1 (ehci0, usb0 is the otg). This takes
|
||||
a string in the format understood by sunxi_name_to_gpio, e.g.
|
||||
PH1 for pin 1 of port H.
|
||||
|
||||
config USB2_VBUS_PIN
|
||||
string "Vbus enable pin for usb2 (ehci1)"
|
||||
default "PH3" if MACH_SUN4I || MACH_SUN7I
|
||||
default "PH24" if MACH_SUN6I
|
||||
---help---
|
||||
See USB1_VBUS_PIN help text.
|
||||
|
||||
config USB3_VBUS_PIN
|
||||
string "Vbus enable pin for usb3 (ehci2)"
|
||||
default ""
|
||||
---help---
|
||||
See USB1_VBUS_PIN help text.
|
||||
|
||||
config I2C0_ENABLE
|
||||
bool "Enable I2C/TWI controller 0"
|
||||
default y if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
|
||||
default n if MACH_SUN6I || MACH_SUN8I
|
||||
select CMD_I2C
|
||||
---help---
|
||||
This allows enabling I2C/TWI controller 0 by muxing its pins, enabling
|
||||
its clock and setting up the bus. This is especially useful on devices
|
||||
with slaves connected to the bus or with pins exposed through e.g. an
|
||||
expansion port/header.
|
||||
|
||||
config I2C1_ENABLE
|
||||
bool "Enable I2C/TWI controller 1"
|
||||
default n
|
||||
select CMD_I2C
|
||||
---help---
|
||||
See I2C0_ENABLE help text.
|
||||
|
||||
config I2C2_ENABLE
|
||||
bool "Enable I2C/TWI controller 2"
|
||||
default n
|
||||
select CMD_I2C
|
||||
---help---
|
||||
See I2C0_ENABLE help text.
|
||||
|
||||
if MACH_SUN6I || MACH_SUN7I
|
||||
config I2C3_ENABLE
|
||||
bool "Enable I2C/TWI controller 3"
|
||||
default n
|
||||
select CMD_I2C
|
||||
---help---
|
||||
See I2C0_ENABLE help text.
|
||||
endif
|
||||
|
||||
if SUNXI_GEN_SUN6I
|
||||
config R_I2C_ENABLE
|
||||
bool "Enable the PRCM I2C/TWI controller"
|
||||
# This is used for the pmic on H3
|
||||
default y if SY8106A_POWER
|
||||
select CMD_I2C
|
||||
---help---
|
||||
Set this to y to enable the I2C controller which is part of the PRCM.
|
||||
endif
|
||||
|
||||
if MACH_SUN7I
|
||||
config I2C4_ENABLE
|
||||
bool "Enable I2C/TWI controller 4"
|
||||
default n
|
||||
select CMD_I2C
|
||||
---help---
|
||||
See I2C0_ENABLE help text.
|
||||
endif
|
||||
|
||||
config AXP_GPIO
|
||||
boolean "Enable support for gpio-s on axp PMICs"
|
||||
default n
|
||||
---help---
|
||||
Say Y here to enable support for the gpio pins of the axp PMIC ICs.
|
||||
|
||||
config VIDEO
|
||||
boolean "Enable graphical uboot console on HDMI, LCD or VGA"
|
||||
depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN9I && !MACH_SUN50I_A64
|
||||
default y
|
||||
---help---
|
||||
Say Y here to add support for using a cfb console on the HDMI, LCD
|
||||
or VGA output found on most sunxi devices. See doc/README.video for
|
||||
info on how to select the video output and mode.
|
||||
|
||||
config VIDEO_HDMI
|
||||
boolean "HDMI output support"
|
||||
depends on VIDEO && !MACH_SUN8I
|
||||
default y
|
||||
---help---
|
||||
Say Y here to add support for outputting video over HDMI.
|
||||
|
||||
config VIDEO_VGA
|
||||
boolean "VGA output support"
|
||||
depends on VIDEO && (MACH_SUN4I || MACH_SUN7I)
|
||||
default n
|
||||
---help---
|
||||
Say Y here to add support for outputting video over VGA.
|
||||
|
||||
config VIDEO_VGA_VIA_LCD
|
||||
boolean "VGA via LCD controller support"
|
||||
depends on VIDEO && (MACH_SUN5I || MACH_SUN6I || MACH_SUN8I)
|
||||
default n
|
||||
---help---
|
||||
Say Y here to add support for external DACs connected to the parallel
|
||||
LCD interface driving a VGA connector, such as found on the
|
||||
Olimex A13 boards.
|
||||
|
||||
config VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH
|
||||
boolean "Force sync active high for VGA via LCD controller support"
|
||||
depends on VIDEO_VGA_VIA_LCD
|
||||
default n
|
||||
---help---
|
||||
Say Y here if you've a board which uses opendrain drivers for the vga
|
||||
hsync and vsync signals. Opendrain drivers cannot generate steep enough
|
||||
positive edges for a stable video output, so on boards with opendrain
|
||||
drivers the sync signals must always be active high.
|
||||
|
||||
config VIDEO_VGA_EXTERNAL_DAC_EN
|
||||
string "LCD panel power enable pin"
|
||||
depends on VIDEO_VGA_VIA_LCD
|
||||
default ""
|
||||
---help---
|
||||
Set the enable pin for the external VGA DAC. This takes a string in the
|
||||
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
config VIDEO_COMPOSITE
|
||||
boolean "Composite video output support"
|
||||
depends on VIDEO && (MACH_SUN4I || MACH_SUN5I || MACH_SUN7I)
|
||||
default n
|
||||
---help---
|
||||
Say Y here to add support for outputting composite video.
|
||||
|
||||
config VIDEO_LCD_MODE
|
||||
string "LCD panel timing details"
|
||||
depends on VIDEO
|
||||
default ""
|
||||
---help---
|
||||
LCD panel timing details string, leave empty if there is no LCD panel.
|
||||
This is in drivers/video/videomodes.c: video_get_params() format, e.g.
|
||||
x:800,y:480,depth:18,pclk_khz:33000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:0,vmode:0
|
||||
Also see: http://linux-sunxi.org/LCD
|
||||
|
||||
config VIDEO_LCD_DCLK_PHASE
|
||||
int "LCD panel display clock phase"
|
||||
depends on VIDEO
|
||||
default 1
|
||||
---help---
|
||||
Select LCD panel display clock phase shift, range 0-3.
|
||||
|
||||
config VIDEO_LCD_POWER
|
||||
string "LCD panel power enable pin"
|
||||
depends on VIDEO
|
||||
default ""
|
||||
---help---
|
||||
Set the power enable pin for the LCD panel. This takes a string in the
|
||||
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
config VIDEO_LCD_RESET
|
||||
string "LCD panel reset pin"
|
||||
depends on VIDEO
|
||||
default ""
|
||||
---help---
|
||||
Set the reset pin for the LCD panel. This takes a string in the format
|
||||
understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
config VIDEO_LCD_BL_EN
|
||||
string "LCD panel backlight enable pin"
|
||||
depends on VIDEO
|
||||
default ""
|
||||
---help---
|
||||
Set the backlight enable pin for the LCD panel. This takes a string in the
|
||||
the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of
|
||||
port H.
|
||||
|
||||
config VIDEO_LCD_BL_PWM
|
||||
string "LCD panel backlight pwm pin"
|
||||
depends on VIDEO
|
||||
default ""
|
||||
---help---
|
||||
Set the backlight pwm pin for the LCD panel. This takes a string in the
|
||||
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
config VIDEO_LCD_BL_PWM_ACTIVE_LOW
|
||||
bool "LCD panel backlight pwm is inverted"
|
||||
depends on VIDEO
|
||||
default y
|
||||
---help---
|
||||
Set this if the backlight pwm output is active low.
|
||||
|
||||
config VIDEO_LCD_PANEL_I2C
|
||||
bool "LCD panel needs to be configured via i2c"
|
||||
depends on VIDEO
|
||||
default n
|
||||
select CMD_I2C
|
||||
---help---
|
||||
Say y here if the LCD panel needs to be configured via i2c. This
|
||||
will add a bitbang i2c controller using gpios to talk to the LCD.
|
||||
|
||||
config VIDEO_LCD_PANEL_I2C_SDA
|
||||
string "LCD panel i2c interface SDA pin"
|
||||
depends on VIDEO_LCD_PANEL_I2C
|
||||
default "PG12"
|
||||
---help---
|
||||
Set the SDA pin for the LCD i2c interface. This takes a string in the
|
||||
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
config VIDEO_LCD_PANEL_I2C_SCL
|
||||
string "LCD panel i2c interface SCL pin"
|
||||
depends on VIDEO_LCD_PANEL_I2C
|
||||
default "PG10"
|
||||
---help---
|
||||
Set the SCL pin for the LCD i2c interface. This takes a string in the
|
||||
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
|
||||
|
||||
|
||||
# Note only one of these may be selected at a time! But hidden choices are
|
||||
# not supported by Kconfig
|
||||
config VIDEO_LCD_IF_PARALLEL
|
||||
bool
|
||||
|
||||
config VIDEO_LCD_IF_LVDS
|
||||
bool
|
||||
|
||||
|
||||
choice
|
||||
prompt "LCD panel support"
|
||||
depends on VIDEO
|
||||
---help---
|
||||
Select which type of LCD panel to support.
|
||||
|
||||
config VIDEO_LCD_PANEL_PARALLEL
|
||||
bool "Generic parallel interface LCD panel"
|
||||
select VIDEO_LCD_IF_PARALLEL
|
||||
|
||||
config VIDEO_LCD_PANEL_LVDS
|
||||
bool "Generic lvds interface LCD panel"
|
||||
select VIDEO_LCD_IF_LVDS
|
||||
|
||||
config VIDEO_LCD_PANEL_MIPI_4_LANE_513_MBPS_VIA_SSD2828
|
||||
bool "MIPI 4-lane, 513Mbps LCD panel via SSD2828 bridge chip"
|
||||
select VIDEO_LCD_SSD2828
|
||||
select VIDEO_LCD_IF_PARALLEL
|
||||
---help---
|
||||
7.85" 768x1024 LCD panels, such as LG LP079X01 or AUO B079XAN01.0
|
||||
|
||||
config VIDEO_LCD_PANEL_EDP_4_LANE_1620M_VIA_ANX9804
|
||||
bool "eDP 4-lane, 1.62G LCD panel via ANX9804 bridge chip"
|
||||
select VIDEO_LCD_ANX9804
|
||||
select VIDEO_LCD_IF_PARALLEL
|
||||
select VIDEO_LCD_PANEL_I2C
|
||||
---help---
|
||||
Select this for eDP LCD panels with 4 lanes running at 1.62G,
|
||||
connected via an ANX9804 bridge chip.
|
||||
|
||||
config VIDEO_LCD_PANEL_HITACHI_TX18D42VM
|
||||
bool "Hitachi tx18d42vm LCD panel"
|
||||
select VIDEO_LCD_HITACHI_TX18D42VM
|
||||
select VIDEO_LCD_IF_LVDS
|
||||
---help---
|
||||
7.85" 1024x768 Hitachi tx18d42vm LCD panel support
|
||||
|
||||
config VIDEO_LCD_TL059WV5C0
|
||||
bool "tl059wv5c0 LCD panel"
|
||||
select VIDEO_LCD_PANEL_I2C
|
||||
select VIDEO_LCD_IF_PARALLEL
|
||||
---help---
|
||||
6" 480x800 tl059wv5c0 panel support, as used on the Utoo P66 and
|
||||
Aigo M60/M608/M606 tablets.
|
||||
|
||||
endchoice
|
||||
|
||||
|
||||
config GMAC_TX_DELAY
|
||||
int "GMAC Transmit Clock Delay Chain"
|
||||
default 0
|
||||
---help---
|
||||
Set the GMAC Transmit Clock Delay Chain value.
|
||||
|
||||
config SPL_STACK_R_ADDR
|
||||
default 0x4fe00000 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN7I || MACH_SUN8I || MACH_SUN50I
|
||||
default 0x2fe00000 if MACH_SUN9I
|
||||
|
||||
endif
|
||||
240
u-boot/board/sunxi/MAINTAINERS
Normal file
240
u-boot/board/sunxi/MAINTAINERS
Normal file
@@ -0,0 +1,240 @@
|
||||
SUNXI BOARD
|
||||
M: Hans de Goede <hdegoede@redhat.com>
|
||||
S: Maintained
|
||||
F: board/sunxi/
|
||||
F: include/configs/sun4i.h
|
||||
F: configs/A10-OLinuXino-Lime_defconfig
|
||||
F: configs/ba10_tv_box_defconfig
|
||||
F: configs/Chuwi_V7_CW0825_defconfig
|
||||
F: configs/Cubieboard_defconfig
|
||||
F: configs/dserve_dsrv9703c_defconfig
|
||||
F: configs/Hyundai_A7HD_defconfig
|
||||
F: configs/inet1_defconfig
|
||||
F: configs/inet97fv2_defconfig
|
||||
F: configs/inet9f_rev03_defconfig
|
||||
F: configs/jesurun_q5_defconfig
|
||||
F: configs/Mele_A1000_defconfig
|
||||
F: configs/Mele_M3_defconfig
|
||||
F: configs/Mini-X_defconfig
|
||||
F: configs/mk802_defconfig
|
||||
F: configs/mk802ii_defconfig
|
||||
F: configs/pov_protab2_ips9_defconfig
|
||||
F: include/configs/sun5i.h
|
||||
F: configs/A10s-OLinuXino-M_defconfig
|
||||
F: configs/A13-OLinuXino_defconfig
|
||||
F: configs/A13-OLinuXinoM_defconfig
|
||||
F: configs/Auxtek-T003_defconfig
|
||||
F: configs/Auxtek-T004_defconfig
|
||||
F: configs/CHIP_defconfig
|
||||
F: configs/difrnce_dit4350_defconfig
|
||||
F: configs/Empire_electronix_d709_defconfig
|
||||
F: configs/inet98v_rev2_defconfig
|
||||
F: configs/mk802_a10s_defconfig
|
||||
F: configs/q8_a13_tablet_defconfig
|
||||
F: configs/r7-tv-dongle_defconfig
|
||||
F: configs/UTOO_P66_defconfig
|
||||
F: configs/Wobo_i5_defconfig
|
||||
F: include/configs/sun6i.h
|
||||
F: configs/colorfly_e708_q1_defconfig
|
||||
F: configs/CSQ_CS908_defconfig
|
||||
F: configs/Mele_A1000G_quad_defconfig
|
||||
F: configs/Mele_M9_defconfig
|
||||
F: configs/Sinovoip_BPI_M2_defconfig
|
||||
F: include/configs/sun7i.h
|
||||
F: configs/A20-OLinuXino_MICRO_defconfig
|
||||
F: configs/Bananapi_defconfig
|
||||
F: configs/Bananapro_defconfig
|
||||
F: configs/i12-tvbox_defconfig
|
||||
F: configs/Linksprite_pcDuino3_defconfig
|
||||
F: configs/Linksprite_pcDuino3_fdt_defconfig
|
||||
F: configs/Orangepi_defconfig
|
||||
F: configs/Orangepi_mini_defconfig
|
||||
F: configs/qt840a_defconfig
|
||||
F: configs/Wits_Pro_A20_DKT_defconfig
|
||||
F: include/configs/sun8i.h
|
||||
F: configs/ga10h_v1_1_defconfig
|
||||
F: configs/gt90h_v4_defconfig
|
||||
F: configs/inet86dz_defconfig
|
||||
F: configs/orangepi_2_defconfig
|
||||
F: configs/orangepi_one_defconfig
|
||||
F: configs/orangepi_pc_defconfig
|
||||
F: configs/orangepi_plus_defconfig
|
||||
F: configs/polaroid_mid2407pxe03_defconfig
|
||||
F: configs/polaroid_mid2809pxe04_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
|
||||
F: include/configs/sun50i.h
|
||||
F: configs/pine64_plus_defconfig
|
||||
|
||||
A20-OLIMEX-SOM-EVB BOARD
|
||||
M: Marcus Cooper <codekipper@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/A20-Olimex-SOM-EVB_defconfig
|
||||
|
||||
A20-OLINUXINO-LIME BOARD
|
||||
M: FUKAUMI Naoki <naobsd@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/A20-OLinuXino-Lime_defconfig
|
||||
|
||||
A20-OLINUXINO-LIME2 BOARD
|
||||
M: Iain Paton <ipaton0@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/A20-OLinuXino-Lime2_defconfig
|
||||
|
||||
AINOL AW1 BOARD
|
||||
M: Paul Kocialkowski <contact@paulk.fr>
|
||||
S: Maintained
|
||||
F: configs/Ainol_AW1_defconfig
|
||||
|
||||
AMPE A76 BOARD
|
||||
M: Paul Kocialkowski <contact@paulk.fr>
|
||||
S: Maintained
|
||||
F: configs/Ampe_A76_defconfig
|
||||
|
||||
COLOMBUS BOARD
|
||||
M: Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
S: Maintained
|
||||
F: configs/Colombus_defconfig
|
||||
|
||||
CUBIEBOARD2 BOARD
|
||||
M: Ian Campbell <ijc@hellion.org.uk>
|
||||
M: Hans de Goede <hdegoede@redhat.com>
|
||||
S: Maintained
|
||||
F: include/configs/sun7i.h
|
||||
F: configs/Cubieboard2_defconfig
|
||||
F: configs/Cubietruck_defconfig
|
||||
|
||||
CUBIETRUCK-PLUS BOARD
|
||||
M: Chen-Yu Tsai <wens@csie.org>
|
||||
S: Maintained
|
||||
F: configs/Cubietruck_plus_defconfig
|
||||
|
||||
GEMEI-G9 TABLET
|
||||
M: Priit Laes <plaes@plaes.org>
|
||||
S: Maintained
|
||||
F: configs/sunxi_Gemei_G9_defconfig
|
||||
|
||||
H8HOMLET PROTO A83T BOARD
|
||||
M: VishnuPatekar <vishnupatekar0510@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/h8_homlet_v2_defconfig
|
||||
|
||||
HUMMINGBIRD-A31 BOARD
|
||||
M: Chen-Yu Tsai <wens@csie.org>
|
||||
S: Maintained
|
||||
F: configs/Hummingbird_A31_defconfig
|
||||
|
||||
ICnova-A20-SWAC BOARD
|
||||
M: Stefan Roese <sr@denx.de>
|
||||
S: Maintained
|
||||
F: configs/icnova-a20-swac_defconfig
|
||||
|
||||
ITEAD IBOX BOARD
|
||||
M: Marcus Cooper <codekipper@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/Itead_Ibox_A20_defconfig
|
||||
|
||||
INET 3F BOARD
|
||||
M: Paul Kocialkowski <contact@paulk.fr>
|
||||
S: Maintained
|
||||
F: configs/iNet_3F_defconfig
|
||||
|
||||
INET 3W BOARD
|
||||
M: Paul Kocialkowski <contact@paulk.fr>
|
||||
S: Maintained
|
||||
F: configs/iNet_3W_defconfig
|
||||
|
||||
INET 86VS BOARD
|
||||
M: Michal Suchanek <hramrach@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/iNet_86VS_defconfig
|
||||
|
||||
LAMOBO-R1 BOARD
|
||||
M: Jelle de Jong <jelledejong@powercraft.nl>
|
||||
S: Maintained
|
||||
F: configs/Lamobo_R1_defconfig
|
||||
|
||||
LINKSPRITE-PCDUINO BOARD
|
||||
M: Zoltan Herpai <wigyori@uid0.hu>
|
||||
S: Maintained
|
||||
F: configs/Linksprite_pcDuino_defconfig
|
||||
|
||||
LINKSPRITE-PCDUINO3-NANO BOARD
|
||||
M: Adam Sampson <ats@offog.org>
|
||||
S: Maintained
|
||||
F: configs/Linksprite_pcDuino3_Nano_defconfig
|
||||
|
||||
MARSBOARD-A10 BOARD
|
||||
M: Aleksei Mamlin <mamlinav@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/Marsboard_A10_defconfig
|
||||
|
||||
MELE I7 BOARD
|
||||
M: Marcus Cooper <codekipper@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/Mele_I7_defconfig
|
||||
|
||||
MELE M5 BOARD
|
||||
M: Ian Campbell <ijc@hellion.org.uk>
|
||||
S: Maintained
|
||||
F: configs/Mele_M5_defconfig
|
||||
|
||||
MIXTILE-LOFTQ BOARD
|
||||
M: Phil Han <pengphei@sina.com>
|
||||
S: Maintained
|
||||
F: configs/mixtile_loftq_defconfig
|
||||
|
||||
MK808C BOARD
|
||||
M: Marcus Cooper <codekipper@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/MK808C_defconfig
|
||||
|
||||
MSI-PRIMO73 BOARD
|
||||
M: Siarhei Siamashka <siarhei.siamashka@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/MSI_Primo73_defconfig
|
||||
|
||||
MSI-PRIMO81 BOARD
|
||||
M: Siarhei Siamashka <siarhei.siamashka@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/MSI_Primo81_defconfig
|
||||
|
||||
R16 EVB PARROT BOARD
|
||||
M: Quentin Schulz <quentin.schulz@free-electrons.com>
|
||||
S: Maintained
|
||||
F: configs/parrot_r16_defconfig
|
||||
|
||||
SINLINX SINA31s BOARD
|
||||
M: Chen-Yu Tsai <wens@csie.org>
|
||||
S: Maintained
|
||||
F: configs/Sinlinx_SinA31s_defconfig
|
||||
W: http://linux-sunxi.org/Sinlinx_SinA31s
|
||||
|
||||
SINLINX SINA33 BOARD
|
||||
M: Chen-Yu Tsai <wens@csie.org>
|
||||
S: Maintained
|
||||
F: configs/Sinlinx_SinA33_defconfig
|
||||
W: http://linux-sunxi.org/Sinlinx_SinA33
|
||||
|
||||
SINOVOIP BPI M3 A83T BOARD
|
||||
M: VishnuPatekar <vishnupatekar0510@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/Sinovoip_BPI_M3_defconfig
|
||||
|
||||
WEXLER-TAB7200 BOARD
|
||||
M: Aleksei Mamlin <mamlinav@gmail.com>
|
||||
S: Maintained
|
||||
F: configs/Wexler_TAB7200_defconfig
|
||||
|
||||
YONES TOPTECH BD1078 BOARD
|
||||
M: Paul Kocialkowski <contact@paulk.fr>
|
||||
S: Maintained
|
||||
F: configs/Yones_Toptech_BD1078_defconfig
|
||||
|
||||
YONES TOPTECH BS1078 V2 BOARD
|
||||
M: Peter Korsgaard <peter@korsgaard.com>
|
||||
S: Maintained
|
||||
F: configs/Yones_Toptech_BS1078_V2_defconfig
|
||||
16
u-boot/board/sunxi/Makefile
Normal file
16
u-boot/board/sunxi/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
|
||||
#
|
||||
# Based on some other board Makefile
|
||||
#
|
||||
# (C) Copyright 2000-2003
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
obj-y += board.o
|
||||
obj-$(CONFIG_SUNXI_GMAC) += gmac.o
|
||||
obj-$(CONFIG_SUNXI_AHCI) += ahci.o
|
||||
obj-$(CONFIG_MACH_SUN4I) += dram_sun4i_auto.o
|
||||
obj-$(CONFIG_MACH_SUN5I) += dram_sun5i_auto.o
|
||||
obj-$(CONFIG_MACH_SUN7I) += dram_sun5i_auto.o
|
||||
98
u-boot/board/sunxi/README.pine64
Normal file
98
u-boot/board/sunxi/README.pine64
Normal file
@@ -0,0 +1,98 @@
|
||||
Pine64 board README
|
||||
====================
|
||||
|
||||
The Pine64(+) is a single board computer equipped with an AArch64 capable ARMv8
|
||||
compliant Allwinner A64 SoC.
|
||||
This chip has ARM Cortex A-53 cores and thus can run both in AArch32
|
||||
(compatible to 32-bit ARMv7) and AArch64 modes. Upon reset the SoC starts
|
||||
in AArch32 mode and executes 32-bit code from the Boot ROM (BROM).
|
||||
This has some implications on U-Boot.
|
||||
|
||||
Quick start
|
||||
============
|
||||
- Get hold of a boot0.img file (see below for more details).
|
||||
- Get the boot0img tool source from the tools directory in [1] and compile
|
||||
that on your host.
|
||||
- Build U-Boot:
|
||||
$ export CROSS_COMPILE=aarch64-linux-gnu-
|
||||
$ make pine64_plus_defconfig
|
||||
$ make
|
||||
- You also need a compiled ARM Trusted Firmware (ATF) binary. Checkout the
|
||||
"allwinner" branch from the github repository [2] and build it:
|
||||
$ export CROSS_COMPILE=aarch64-linux-gnu-
|
||||
$ make PLAT=sun50iw1p1 DEBUG=1 bl31
|
||||
The resulting binary is build/sun50iw1p1/debug/bl31.bin.
|
||||
|
||||
Now put an empty (or disposable) micro SD card in your card reader and learn
|
||||
its device file name, replacing /dev/sd<x> below with the result (that could
|
||||
be /dev/mmcblk<x> as well):
|
||||
|
||||
$ ./boot0img --device /dev/sd<x> -e -u u-boot.bin -B boot0.img \
|
||||
-d trampoline64:0x44000 -s bl31.bin -a 0x44008 -p 100
|
||||
(either copying the respective files to the working directory or specifying
|
||||
the paths directly)
|
||||
|
||||
This will create a new partition table (with a 100 MB FAT boot partition),
|
||||
copies boot0.img, ATF and U-Boot to the proper locations on the SD card and
|
||||
will fill in the magic Allwinner header to be recognized by boot0.
|
||||
Prefix the above call with "sudo" if you don't have write access to the
|
||||
uSD card. You can also use "-o output.img" instead of "--device /dev/sd<x>"
|
||||
to create an image file and "dd" that to the uSD card.
|
||||
Omitting the "-p" option will skip the partition table.
|
||||
|
||||
Now put this uSD card in the board and power it on. You should be greeted by
|
||||
the U-Boot prompt.
|
||||
|
||||
|
||||
Main U-Boot
|
||||
============
|
||||
The main U-Boot proper is a real 64-bit ARMv8 port and runs entirely in the
|
||||
64-bit AArch64 mode. It can load any AArch64 code, EFI applications or arm64
|
||||
Linux kernel images (often named "Image") using the booti command.
|
||||
Launching 32-bit code and kernels is technically possible, though not without
|
||||
drawbacks (or hacks to avoid them) and currently not implemented.
|
||||
|
||||
SPL support
|
||||
============
|
||||
The main task of the SPL support is to bring up the DRAM controller and make
|
||||
DRAM actually accessible. At the moment there is no documentation or source
|
||||
code available which would do this.
|
||||
There are currently two ways to overcome this situation: using a tainted 32-bit
|
||||
SPL (involving some hacks and resulting in a non-redistributable binary, thus
|
||||
not described here) or using the Allwinner boot0 blob.
|
||||
|
||||
boot0 method
|
||||
-------------
|
||||
boot0 is Allwiner's secondary program loader and it can be used as some kind
|
||||
of SPL replacement to get U-Boot up and running.
|
||||
The binary is a 32 KByte blob and contained on every Pine64 image distributed
|
||||
so far. It can be easily extracted from a micro SD card or an image file:
|
||||
# dd if=/dev/sd<x> of=boot0.bin bs=8k skip=1 count=4
|
||||
where /dev/sd<x> is the device name of the uSD card or the name of the image
|
||||
file. Apparently Allwinner allows re-distribution of this proprietary code
|
||||
as-is.
|
||||
For the time being this boot0 blob is the only redistributable way of making
|
||||
U-Boot work on the Pine64. Beside loading the various parts of the (original)
|
||||
firmware it also switches the core into AArch64 mode.
|
||||
The original boot0 code looks for U-Boot at a certain place on an uSD card
|
||||
(at 19096 KB), also it expects a header with magic bytes and a checksum.
|
||||
There is a tool called boot0img[1] which takes a boot0.bin image and a compiled
|
||||
U-Boot binary (plus other binaries) and will populate that header accordingly.
|
||||
To make space for the magic header, the pine64_plus_defconfig will make sure
|
||||
there is sufficient space at the beginning of the U-Boot binary.
|
||||
boot0img will also take care of putting the different binaries at the right
|
||||
places on the uSD card and works around unused, but mandatory parts by using
|
||||
trampoline code. See the output of "boot0img -h" for more information.
|
||||
boot0img can also patch boot0 to avoid loading U-Boot from 19MB, instead
|
||||
fetching it from just behind the boot0 binary (-B option).
|
||||
|
||||
FEL boot
|
||||
=========
|
||||
FEL is the name of the Allwinner defined USB boot protocol built-in the
|
||||
mask ROM of most Allwinner SoCs. It allows to bootstrap a board solely
|
||||
by using the USB-OTG interface and a host port on another computer.
|
||||
Since FEL boot does not work with boot0, it requires the libdram hack, which
|
||||
is not described here.
|
||||
|
||||
[1] https://github.com/apritzel/pine64/
|
||||
[2] https://github.com/apritzel/arm-trusted-firmware.git
|
||||
79
u-boot/board/sunxi/ahci.c
Normal file
79
u-boot/board/sunxi/ahci.c
Normal file
@@ -0,0 +1,79 @@
|
||||
#include <common.h>
|
||||
#include <ahci.h>
|
||||
#include <scsi.h>
|
||||
#include <errno.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/gpio.h>
|
||||
|
||||
#define AHCI_PHYCS0R 0x00c0
|
||||
#define AHCI_PHYCS1R 0x00c4
|
||||
#define AHCI_PHYCS2R 0x00c8
|
||||
#define AHCI_RWCR 0x00fc
|
||||
|
||||
/* This magic PHY initialisation was taken from the Allwinner releases
|
||||
* and Linux driver, but is completely undocumented.
|
||||
*/
|
||||
static int sunxi_ahci_phy_init(u32 base)
|
||||
{
|
||||
u8 *reg_base = (u8 *)base;
|
||||
u32 reg_val;
|
||||
int timeout;
|
||||
|
||||
writel(0, reg_base + AHCI_RWCR);
|
||||
mdelay(5);
|
||||
|
||||
setbits_le32(reg_base + AHCI_PHYCS1R, 0x1 << 19);
|
||||
clrsetbits_le32(reg_base + AHCI_PHYCS0R,
|
||||
(0x7 << 24),
|
||||
(0x5 << 24) | (0x1 << 23) | (0x1 << 18));
|
||||
clrsetbits_le32(reg_base + AHCI_PHYCS1R,
|
||||
(0x3 << 16) | (0x1f << 8) | (0x3 << 6),
|
||||
(0x2 << 16) | (0x6 << 8) | (0x2 << 6));
|
||||
setbits_le32(reg_base + AHCI_PHYCS1R, (0x1 << 28) | (0x1 << 15));
|
||||
clrbits_le32(reg_base + AHCI_PHYCS1R, (0x1 << 19));
|
||||
clrsetbits_le32(reg_base + AHCI_PHYCS0R, (0x7 << 20), (0x3 << 20));
|
||||
clrsetbits_le32(reg_base + AHCI_PHYCS2R, (0x1f << 5), (0x19 << 5));
|
||||
mdelay(5);
|
||||
|
||||
setbits_le32(reg_base + AHCI_PHYCS0R, (0x1 << 19));
|
||||
|
||||
timeout = 250; /* Power up takes approx 50 us */
|
||||
for (;;) {
|
||||
reg_val = readl(reg_base + AHCI_PHYCS0R) & (0x7 << 28);
|
||||
if (reg_val == (0x2 << 28))
|
||||
break;
|
||||
if (--timeout == 0) {
|
||||
printf("AHCI PHY power up failed.\n");
|
||||
return -EIO;
|
||||
}
|
||||
udelay(1);
|
||||
};
|
||||
|
||||
setbits_le32(reg_base + AHCI_PHYCS2R, (0x1 << 24));
|
||||
|
||||
timeout = 100; /* Calibration takes approx 10 us */
|
||||
for (;;) {
|
||||
reg_val = readl(reg_base + AHCI_PHYCS2R) & (0x1 << 24);
|
||||
if (reg_val == 0x0)
|
||||
break;
|
||||
if (--timeout == 0) {
|
||||
printf("AHCI PHY calibration failed.\n");
|
||||
return -EIO;
|
||||
}
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
mdelay(15);
|
||||
|
||||
writel(0x7, reg_base + AHCI_RWCR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void scsi_init(void)
|
||||
{
|
||||
if (sunxi_ahci_phy_init(SUNXI_SATA_BASE) < 0)
|
||||
return;
|
||||
|
||||
ahci_init((void __iomem *)SUNXI_SATA_BASE);
|
||||
}
|
||||
660
u-boot/board/sunxi/board.c
Normal file
660
u-boot/board/sunxi/board.c
Normal file
@@ -0,0 +1,660 @@
|
||||
/*
|
||||
* (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net>
|
||||
* (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
|
||||
*
|
||||
* (C) Copyright 2007-2011
|
||||
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
|
||||
* Tom Cubie <tangliang@allwinnertech.com>
|
||||
*
|
||||
* Some board init for the Allwinner A10-evb board.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mmc.h>
|
||||
#include <axp_pmic.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/cpu.h>
|
||||
#include <asm/arch/display.h>
|
||||
#include <asm/arch/dram.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/mmc.h>
|
||||
#include <asm/arch/usb_phy.h>
|
||||
#ifndef CONFIG_ARM64
|
||||
#include <asm/armv7.h>
|
||||
#endif
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <nand.h>
|
||||
#include <net.h>
|
||||
#include <sy8106a.h>
|
||||
|
||||
#if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
|
||||
/* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */
|
||||
int soft_i2c_gpio_sda;
|
||||
int soft_i2c_gpio_scl;
|
||||
|
||||
static int soft_i2c_board_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA);
|
||||
if (soft_i2c_gpio_sda < 0) {
|
||||
printf("Error invalid soft i2c sda pin: '%s', err %d\n",
|
||||
CONFIG_VIDEO_LCD_PANEL_I2C_SDA, soft_i2c_gpio_sda);
|
||||
return soft_i2c_gpio_sda;
|
||||
}
|
||||
ret = gpio_request(soft_i2c_gpio_sda, "soft-i2c-sda");
|
||||
if (ret) {
|
||||
printf("Error requesting soft i2c sda pin: '%s', err %d\n",
|
||||
CONFIG_VIDEO_LCD_PANEL_I2C_SDA, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL);
|
||||
if (soft_i2c_gpio_scl < 0) {
|
||||
printf("Error invalid soft i2c scl pin: '%s', err %d\n",
|
||||
CONFIG_VIDEO_LCD_PANEL_I2C_SCL, soft_i2c_gpio_scl);
|
||||
return soft_i2c_gpio_scl;
|
||||
}
|
||||
ret = gpio_request(soft_i2c_gpio_scl, "soft-i2c-scl");
|
||||
if (ret) {
|
||||
printf("Error requesting soft i2c scl pin: '%s', err %d\n",
|
||||
CONFIG_VIDEO_LCD_PANEL_I2C_SCL, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static int soft_i2c_board_init(void) { return 0; }
|
||||
#endif
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* add board specific code here */
|
||||
int board_init(void)
|
||||
{
|
||||
__maybe_unused int id_pfr1, ret;
|
||||
|
||||
gd->bd->bi_boot_params = (PHYS_SDRAM_0 + 0x100);
|
||||
|
||||
#ifndef CONFIG_ARM64
|
||||
asm volatile("mrc p15, 0, %0, c0, c1, 1" : "=r"(id_pfr1));
|
||||
debug("id_pfr1: 0x%08x\n", id_pfr1);
|
||||
/* Generic Timer Extension available? */
|
||||
if ((id_pfr1 >> CPUID_ARM_GENTIMER_SHIFT) & 0xf) {
|
||||
uint32_t freq;
|
||||
|
||||
debug("Setting CNTFRQ\n");
|
||||
|
||||
/*
|
||||
* CNTFRQ is a secure register, so we will crash if we try to
|
||||
* write this from the non-secure world (read is OK, though).
|
||||
* In case some bootcode has already set the correct value,
|
||||
* we avoid the risk of writing to it.
|
||||
*/
|
||||
asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r"(freq));
|
||||
if (freq != CONFIG_TIMER_CLK_FREQ) {
|
||||
debug("arch timer frequency is %d Hz, should be %d, fixing ...\n",
|
||||
freq, CONFIG_TIMER_CLK_FREQ);
|
||||
#ifdef CONFIG_NON_SECURE
|
||||
printf("arch timer frequency is wrong, but cannot adjust it\n");
|
||||
#else
|
||||
asm volatile("mcr p15, 0, %0, c14, c0, 0"
|
||||
: : "r"(CONFIG_TIMER_CLK_FREQ));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* !CONFIG_ARM64 */
|
||||
|
||||
ret = axp_gpio_init();
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
#ifdef CONFIG_SATAPWR
|
||||
gpio_request(CONFIG_SATAPWR, "satapwr");
|
||||
gpio_direction_output(CONFIG_SATAPWR, 1);
|
||||
#endif
|
||||
#ifdef CONFIG_MACPWR
|
||||
gpio_request(CONFIG_MACPWR, "macpwr");
|
||||
gpio_direction_output(CONFIG_MACPWR, 1);
|
||||
#endif
|
||||
|
||||
/* Uses dm gpio code so do this here and not in i2c_init_board() */
|
||||
return soft_i2c_board_init();
|
||||
}
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
gd->ram_size = get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_NAND_SUNXI) && defined(CONFIG_SPL_BUILD)
|
||||
static void nand_pinmux_setup(void)
|
||||
{
|
||||
unsigned int pin;
|
||||
|
||||
for (pin = SUNXI_GPC(0); pin <= SUNXI_GPC(19); pin++)
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_NAND);
|
||||
|
||||
#if defined CONFIG_MACH_SUN4I || defined CONFIG_MACH_SUN7I
|
||||
for (pin = SUNXI_GPC(20); pin <= SUNXI_GPC(22); pin++)
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_NAND);
|
||||
#endif
|
||||
/* sun4i / sun7i do have a PC23, but it is not used for nand,
|
||||
* only sun7i has a PC24 */
|
||||
#ifdef CONFIG_MACH_SUN7I
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPC(24), SUNXI_GPC_NAND);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void nand_clock_setup(void)
|
||||
{
|
||||
struct sunxi_ccm_reg *const ccm =
|
||||
(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
|
||||
|
||||
setbits_le32(&ccm->ahb_gate0, (CLK_GATE_OPEN << AHB_GATE_OFFSET_NAND0));
|
||||
#ifdef CONFIG_MACH_SUN9I
|
||||
setbits_le32(&ccm->ahb_gate1, (1 << AHB_GATE_OFFSET_DMA));
|
||||
#else
|
||||
setbits_le32(&ccm->ahb_gate0, (1 << AHB_GATE_OFFSET_DMA));
|
||||
#endif
|
||||
setbits_le32(&ccm->nand0_clk_cfg, CCM_NAND_CTRL_ENABLE | AHB_DIV_1);
|
||||
}
|
||||
|
||||
void board_nand_init(void)
|
||||
{
|
||||
nand_pinmux_setup();
|
||||
nand_clock_setup();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GENERIC_MMC
|
||||
static void mmc_pinmux_setup(int sdc)
|
||||
{
|
||||
unsigned int pin;
|
||||
__maybe_unused int pins;
|
||||
|
||||
switch (sdc) {
|
||||
case 0:
|
||||
/* SDC0: PF0-PF5 */
|
||||
for (pin = SUNXI_GPF(0); pin <= SUNXI_GPF(5); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPF_SDC0);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
pins = sunxi_name_to_gpio_bank(CONFIG_MMC1_PINS);
|
||||
|
||||
#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I)
|
||||
if (pins == SUNXI_GPIO_H) {
|
||||
/* SDC1: PH22-PH-27 */
|
||||
for (pin = SUNXI_GPH(22); pin <= SUNXI_GPH(27); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN4I_GPH_SDC1);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
} else {
|
||||
/* SDC1: PG0-PG5 */
|
||||
for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN4I_GPG_SDC1);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
}
|
||||
#elif defined(CONFIG_MACH_SUN5I)
|
||||
/* SDC1: PG3-PG8 */
|
||||
for (pin = SUNXI_GPG(3); pin <= SUNXI_GPG(8); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN5I_GPG_SDC1);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
#elif defined(CONFIG_MACH_SUN6I)
|
||||
/* SDC1: PG0-PG5 */
|
||||
for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPG_SDC1);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
#elif defined(CONFIG_MACH_SUN8I)
|
||||
if (pins == SUNXI_GPIO_D) {
|
||||
/* SDC1: PD2-PD7 */
|
||||
for (pin = SUNXI_GPD(2); pin <= SUNXI_GPD(7); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN8I_GPD_SDC1);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
} else {
|
||||
/* SDC1: PG0-PG5 */
|
||||
for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN8I_GPG_SDC1);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 2:
|
||||
pins = sunxi_name_to_gpio_bank(CONFIG_MMC2_PINS);
|
||||
|
||||
#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I)
|
||||
/* SDC2: PC6-PC11 */
|
||||
for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(11); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
#elif defined(CONFIG_MACH_SUN5I)
|
||||
if (pins == SUNXI_GPIO_E) {
|
||||
/* SDC2: PE4-PE9 */
|
||||
for (pin = SUNXI_GPE(4); pin <= SUNXI_GPD(9); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN5I_GPE_SDC2);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
} else {
|
||||
/* SDC2: PC6-PC15 */
|
||||
for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
}
|
||||
#elif defined(CONFIG_MACH_SUN6I)
|
||||
if (pins == SUNXI_GPIO_A) {
|
||||
/* SDC2: PA9-PA14 */
|
||||
for (pin = SUNXI_GPA(9); pin <= SUNXI_GPA(14); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_SDC2);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
} else {
|
||||
/* SDC2: PC6-PC15, PC24 */
|
||||
for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPC(24), SUNXI_GPC_SDC2);
|
||||
sunxi_gpio_set_pull(SUNXI_GPC(24), SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(SUNXI_GPC(24), 2);
|
||||
}
|
||||
#elif defined(CONFIG_MACH_SUN8I) || defined(CONFIG_MACH_SUN50I)
|
||||
/* SDC2: PC5-PC6, PC8-PC16 */
|
||||
for (pin = SUNXI_GPC(5); pin <= SUNXI_GPC(6); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
|
||||
for (pin = SUNXI_GPC(8); pin <= SUNXI_GPC(16); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 3:
|
||||
pins = sunxi_name_to_gpio_bank(CONFIG_MMC3_PINS);
|
||||
|
||||
#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I)
|
||||
/* SDC3: PI4-PI9 */
|
||||
for (pin = SUNXI_GPI(4); pin <= SUNXI_GPI(9); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUNXI_GPI_SDC3);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
#elif defined(CONFIG_MACH_SUN6I)
|
||||
if (pins == SUNXI_GPIO_A) {
|
||||
/* SDC3: PA9-PA14 */
|
||||
for (pin = SUNXI_GPA(9); pin <= SUNXI_GPA(14); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_SDC3);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
} else {
|
||||
/* SDC3: PC6-PC15, PC24 */
|
||||
for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPC_SDC3);
|
||||
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPC(24), SUN6I_GPC_SDC3);
|
||||
sunxi_gpio_set_pull(SUNXI_GPC(24), SUNXI_GPIO_PULL_UP);
|
||||
sunxi_gpio_set_drv(SUNXI_GPC(24), 2);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("sunxi: invalid MMC slot %d for pinmux setup\n", sdc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int board_mmc_init(bd_t *bis)
|
||||
{
|
||||
__maybe_unused struct mmc *mmc0, *mmc1;
|
||||
__maybe_unused char buf[512];
|
||||
|
||||
mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
|
||||
mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
|
||||
if (!mmc0)
|
||||
return -1;
|
||||
|
||||
#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
|
||||
mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
|
||||
mmc1 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
|
||||
if (!mmc1)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SPL_BUILD) && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2
|
||||
/*
|
||||
* On systems with an emmc (mmc2), figure out if we are booting from
|
||||
* the emmc and if we are make it "mmc dev 0" so that boot.scr, etc.
|
||||
* are searched there first. Note we only do this for u-boot proper,
|
||||
* not for the SPL, see spl_boot_device().
|
||||
*/
|
||||
if (!sunxi_mmc_has_egon_boot_signature(mmc0) &&
|
||||
sunxi_mmc_has_egon_boot_signature(mmc1)) {
|
||||
/* Booting from emmc / mmc2, swap */
|
||||
mmc0->block_dev.devnum = 1;
|
||||
mmc1->block_dev.devnum = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void i2c_init_board(void)
|
||||
{
|
||||
#ifdef CONFIG_I2C0_ENABLE
|
||||
#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN5I) || defined(CONFIG_MACH_SUN7I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN4I_GPB_TWI0);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN4I_GPB_TWI0);
|
||||
clock_twi_onoff(0, 1);
|
||||
#elif defined(CONFIG_MACH_SUN6I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(14), SUN6I_GPH_TWI0);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(15), SUN6I_GPH_TWI0);
|
||||
clock_twi_onoff(0, 1);
|
||||
#elif defined(CONFIG_MACH_SUN8I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0);
|
||||
clock_twi_onoff(0, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C1_ENABLE
|
||||
#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN4I_GPB_TWI1);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN4I_GPB_TWI1);
|
||||
clock_twi_onoff(1, 1);
|
||||
#elif defined(CONFIG_MACH_SUN5I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(15), SUN5I_GPB_TWI1);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(16), SUN5I_GPB_TWI1);
|
||||
clock_twi_onoff(1, 1);
|
||||
#elif defined(CONFIG_MACH_SUN6I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1);
|
||||
clock_twi_onoff(1, 1);
|
||||
#elif defined(CONFIG_MACH_SUN8I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1);
|
||||
clock_twi_onoff(1, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C2_ENABLE
|
||||
#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN4I_GPB_TWI2);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(21), SUN4I_GPB_TWI2);
|
||||
clock_twi_onoff(2, 1);
|
||||
#elif defined(CONFIG_MACH_SUN5I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(17), SUN5I_GPB_TWI2);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN5I_GPB_TWI2);
|
||||
clock_twi_onoff(2, 1);
|
||||
#elif defined(CONFIG_MACH_SUN6I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(18), SUN6I_GPH_TWI2);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPH(19), SUN6I_GPH_TWI2);
|
||||
clock_twi_onoff(2, 1);
|
||||
#elif defined(CONFIG_MACH_SUN8I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPE(12), SUN8I_GPE_TWI2);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPE(13), SUN8I_GPE_TWI2);
|
||||
clock_twi_onoff(2, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C3_ENABLE
|
||||
#if defined(CONFIG_MACH_SUN6I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPG(10), SUN6I_GPG_TWI3);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPG(11), SUN6I_GPG_TWI3);
|
||||
clock_twi_onoff(3, 1);
|
||||
#elif defined(CONFIG_MACH_SUN7I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPI(0), SUN7I_GPI_TWI3);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPI(1), SUN7I_GPI_TWI3);
|
||||
clock_twi_onoff(3, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C4_ENABLE
|
||||
#if defined(CONFIG_MACH_SUN7I)
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPI(2), SUN7I_GPI_TWI4);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPI(3), SUN7I_GPI_TWI4);
|
||||
clock_twi_onoff(4, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_R_I2C_ENABLE
|
||||
clock_twi_onoff(5, 1);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI);
|
||||
sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPL_BUILD
|
||||
void sunxi_board_init(void)
|
||||
{
|
||||
int power_failed = 0;
|
||||
unsigned long ramsize;
|
||||
|
||||
#ifdef CONFIG_SY8106A_POWER
|
||||
power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT);
|
||||
#endif
|
||||
|
||||
#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || \
|
||||
defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || \
|
||||
defined CONFIG_AXP818_POWER
|
||||
power_failed = axp_init();
|
||||
|
||||
#if defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || \
|
||||
defined CONFIG_AXP818_POWER
|
||||
power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
|
||||
#endif
|
||||
power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
|
||||
power_failed |= axp_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
|
||||
#if !defined(CONFIG_AXP209_POWER) && !defined(CONFIG_AXP818_POWER)
|
||||
power_failed |= axp_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
|
||||
#endif
|
||||
#if defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || \
|
||||
defined CONFIG_AXP818_POWER
|
||||
power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
|
||||
#endif
|
||||
|
||||
#if defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || \
|
||||
defined CONFIG_AXP818_POWER
|
||||
power_failed |= axp_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
|
||||
#endif
|
||||
power_failed |= axp_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
|
||||
#if !defined(CONFIG_AXP152_POWER)
|
||||
power_failed |= axp_set_aldo3(CONFIG_AXP_ALDO3_VOLT);
|
||||
#endif
|
||||
#ifdef CONFIG_AXP209_POWER
|
||||
power_failed |= axp_set_aldo4(CONFIG_AXP_ALDO4_VOLT);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_AXP221_POWER) || defined(CONFIG_AXP809_POWER) || \
|
||||
defined(CONFIG_AXP818_POWER)
|
||||
power_failed |= axp_set_dldo(1, CONFIG_AXP_DLDO1_VOLT);
|
||||
power_failed |= axp_set_dldo(2, CONFIG_AXP_DLDO2_VOLT);
|
||||
#if !defined CONFIG_AXP809_POWER
|
||||
power_failed |= axp_set_dldo(3, CONFIG_AXP_DLDO3_VOLT);
|
||||
power_failed |= axp_set_dldo(4, CONFIG_AXP_DLDO4_VOLT);
|
||||
#endif
|
||||
power_failed |= axp_set_eldo(1, CONFIG_AXP_ELDO1_VOLT);
|
||||
power_failed |= axp_set_eldo(2, CONFIG_AXP_ELDO2_VOLT);
|
||||
power_failed |= axp_set_eldo(3, CONFIG_AXP_ELDO3_VOLT);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AXP818_POWER
|
||||
power_failed |= axp_set_fldo(1, CONFIG_AXP_FLDO1_VOLT);
|
||||
power_failed |= axp_set_fldo(2, CONFIG_AXP_FLDO2_VOLT);
|
||||
power_failed |= axp_set_fldo(3, CONFIG_AXP_FLDO3_VOLT);
|
||||
#endif
|
||||
|
||||
#if defined CONFIG_AXP809_POWER || defined CONFIG_AXP818_POWER
|
||||
power_failed |= axp_set_sw(IS_ENABLED(CONFIG_AXP_SW_ON));
|
||||
#endif
|
||||
#endif
|
||||
printf("DRAM:");
|
||||
ramsize = sunxi_dram_init();
|
||||
printf(" %d MiB\n", (int)(ramsize >> 20));
|
||||
if (!ramsize)
|
||||
hang();
|
||||
|
||||
/*
|
||||
* Only clock up the CPU to full speed if we are reasonably
|
||||
* assured it's being powered with suitable core voltage
|
||||
*/
|
||||
if (!power_failed)
|
||||
clock_set_pll1(CONFIG_SYS_CLK_FREQ);
|
||||
else
|
||||
printf("Failed to set core voltage! Can't set CPU frequency\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_GADGET
|
||||
int g_dnl_board_usb_cable_connected(void)
|
||||
{
|
||||
return sunxi_usb_phy_vbus_detect(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SERIAL_TAG
|
||||
void get_board_serial(struct tag_serialnr *serialnr)
|
||||
{
|
||||
char *serial_string;
|
||||
unsigned long long serial;
|
||||
|
||||
serial_string = getenv("serial#");
|
||||
|
||||
if (serial_string) {
|
||||
serial = simple_strtoull(serial_string, NULL, 16);
|
||||
|
||||
serialnr->high = (unsigned int) (serial >> 32);
|
||||
serialnr->low = (unsigned int) (serial & 0xffffffff);
|
||||
} else {
|
||||
serialnr->high = 0;
|
||||
serialnr->low = 0;
|
||||
}
|
||||
}
|
||||
#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 *)(ulong)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)
|
||||
{
|
||||
char serial_string[17] = { 0 };
|
||||
unsigned int sid[4];
|
||||
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")) {
|
||||
/* Non OUI / registered MAC address */
|
||||
mac_addr[0] = 0x02;
|
||||
mac_addr[1] = (sid[0] >> 0) & 0xff;
|
||||
mac_addr[2] = (sid[3] >> 24) & 0xff;
|
||||
mac_addr[3] = (sid[3] >> 16) & 0xff;
|
||||
mac_addr[4] = (sid[3] >> 8) & 0xff;
|
||||
mac_addr[5] = (sid[3] >> 0) & 0xff;
|
||||
|
||||
eth_setenv_enetaddr("ethaddr", mac_addr);
|
||||
}
|
||||
|
||||
if (!getenv("serial#")) {
|
||||
snprintf(serial_string, sizeof(serial_string),
|
||||
"%08x%08x", sid[0], sid[3]);
|
||||
|
||||
setenv("serial#", serial_string);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MACH_SUN9I
|
||||
ret = sunxi_usb_phy_probe();
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
sunxi_musb_board_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
int __maybe_unused r;
|
||||
|
||||
#ifdef CONFIG_VIDEO_DT_SIMPLEFB
|
||||
r = sunxi_simplefb_setup(blob);
|
||||
if (r)
|
||||
return r;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
35
u-boot/board/sunxi/dram_sun4i_auto.c
Normal file
35
u-boot/board/sunxi/dram_sun4i_auto.c
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <common.h>
|
||||
#include <asm/arch/dram.h>
|
||||
|
||||
static struct dram_para dram_para = {
|
||||
.clock = CONFIG_DRAM_CLK,
|
||||
.type = 3,
|
||||
.rank_num = 1,
|
||||
.density = 0,
|
||||
.io_width = 0,
|
||||
.bus_width = 0,
|
||||
.zq = CONFIG_DRAM_ZQ,
|
||||
.odt_en = IS_ENABLED(CONFIG_DRAM_ODT_EN),
|
||||
.size = 0,
|
||||
#ifdef CONFIG_DRAM_TIMINGS_VENDOR_MAGIC
|
||||
.cas = 6,
|
||||
.tpr0 = 0x30926692,
|
||||
.tpr1 = 0x1090,
|
||||
.tpr2 = 0x1a0c8,
|
||||
.emr2 = 0,
|
||||
#else
|
||||
# include "dram_timings_sun4i.h"
|
||||
.active_windowing = 1,
|
||||
#endif
|
||||
.tpr3 = CONFIG_DRAM_TPR3,
|
||||
.tpr4 = 0,
|
||||
.tpr5 = 0,
|
||||
.emr1 = CONFIG_DRAM_EMR1,
|
||||
.emr3 = 0,
|
||||
.dqs_gating_delay = CONFIG_DRAM_DQS_GATING_DELAY,
|
||||
};
|
||||
|
||||
unsigned long sunxi_dram_init(void)
|
||||
{
|
||||
return dramc_init(&dram_para);
|
||||
}
|
||||
38
u-boot/board/sunxi/dram_sun5i_auto.c
Normal file
38
u-boot/board/sunxi/dram_sun5i_auto.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* DRAM parameters for auto dram configuration on sun5i and sun7i */
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/arch/dram.h>
|
||||
|
||||
static struct dram_para dram_para = {
|
||||
.clock = CONFIG_DRAM_CLK,
|
||||
.mbus_clock = CONFIG_DRAM_MBUS_CLK,
|
||||
.type = 3,
|
||||
.rank_num = 1,
|
||||
.density = 0,
|
||||
.io_width = 0,
|
||||
.bus_width = 0,
|
||||
.zq = CONFIG_DRAM_ZQ,
|
||||
.odt_en = IS_ENABLED(CONFIG_DRAM_ODT_EN),
|
||||
.size = 0,
|
||||
#ifdef CONFIG_DRAM_TIMINGS_VENDOR_MAGIC
|
||||
.cas = 9,
|
||||
.tpr0 = 0x42d899b7,
|
||||
.tpr1 = 0xa090,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x10,
|
||||
#else
|
||||
# include "dram_timings_sun4i.h"
|
||||
.active_windowing = 1,
|
||||
#endif
|
||||
.tpr3 = CONFIG_DRAM_TPR3,
|
||||
.tpr4 = 0,
|
||||
.tpr5 = 0,
|
||||
.emr1 = CONFIG_DRAM_EMR1,
|
||||
.emr3 = 0,
|
||||
.dqs_gating_delay = CONFIG_DRAM_DQS_GATING_DELAY,
|
||||
};
|
||||
|
||||
unsigned long sunxi_dram_init(void)
|
||||
{
|
||||
return dramc_init(&dram_para);
|
||||
}
|
||||
205
u-boot/board/sunxi/dram_timings_sun4i.h
Normal file
205
u-boot/board/sunxi/dram_timings_sun4i.h
Normal file
@@ -0,0 +1,205 @@
|
||||
/* This file is automatically generated, do not edit */
|
||||
|
||||
#if defined(CONFIG_DRAM_TIMINGS_DDR3_1066F_1333H)
|
||||
# if CONFIG_DRAM_CLK <= 360 /* DDR3-1066F @360MHz, timings: 6-5-5-14 */
|
||||
.cas = 6,
|
||||
.tpr0 = 0x268e5590,
|
||||
.tpr1 = 0xa090,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x0,
|
||||
# elif CONFIG_DRAM_CLK <= 384 /* DDR3-1066F @384MHz, timings: 6-6-6-15 */
|
||||
.cas = 6,
|
||||
.tpr0 = 0x288f6690,
|
||||
.tpr1 = 0xa0a0,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x0,
|
||||
# elif CONFIG_DRAM_CLK <= 396 /* DDR3-1066F @396MHz, timings: 6-6-6-15 */
|
||||
.cas = 6,
|
||||
.tpr0 = 0x2a8f6690,
|
||||
.tpr1 = 0xa0a0,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x0,
|
||||
# elif CONFIG_DRAM_CLK <= 408 /* DDR3-1066F @408MHz, timings: 7-6-6-16 */
|
||||
.cas = 7,
|
||||
.tpr0 = 0x2ab06690,
|
||||
.tpr1 = 0xa0a8,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 432 /* DDR3-1066F @432MHz, timings: 7-6-6-17 */
|
||||
.cas = 7,
|
||||
.tpr0 = 0x2cb16690,
|
||||
.tpr1 = 0xa0b0,
|
||||
.tpr2 = 0x22e00,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 456 /* DDR3-1066F @456MHz, timings: 7-6-6-18 */
|
||||
.cas = 7,
|
||||
.tpr0 = 0x30b26690,
|
||||
.tpr1 = 0xa0b8,
|
||||
.tpr2 = 0x22e00,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 468 /* DDR3-1066F @468MHz, timings: 7-7-7-18 */
|
||||
.cas = 7,
|
||||
.tpr0 = 0x30b27790,
|
||||
.tpr1 = 0xa0c0,
|
||||
.tpr2 = 0x23200,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 480 /* DDR3-1066F @480MHz, timings: 7-7-7-18 */
|
||||
.cas = 7,
|
||||
.tpr0 = 0x32b27790,
|
||||
.tpr1 = 0xa0c0,
|
||||
.tpr2 = 0x23200,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 504 /* DDR3-1066F @504MHz, timings: 7-7-7-19 */
|
||||
.cas = 7,
|
||||
.tpr0 = 0x34d37790,
|
||||
.tpr1 = 0xa0d0,
|
||||
.tpr2 = 0x23600,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 528 /* DDR3-1066F @528MHz, timings: 7-7-7-20 */
|
||||
.cas = 7,
|
||||
.tpr0 = 0x36d47790,
|
||||
.tpr1 = 0xa0d8,
|
||||
.tpr2 = 0x23600,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 540 /* DDR3-1333H @540MHz, timings: 9-8-8-20 */
|
||||
.cas = 9,
|
||||
.tpr0 = 0x36b488b4,
|
||||
.tpr1 = 0xa0c8,
|
||||
.tpr2 = 0x2b600,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 552 /* DDR3-1333H @552MHz, timings: 9-8-8-20 */
|
||||
.cas = 9,
|
||||
.tpr0 = 0x38b488b4,
|
||||
.tpr1 = 0xa0c8,
|
||||
.tpr2 = 0x2ba00,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 576 /* DDR3-1333H @576MHz, timings: 9-8-8-21 */
|
||||
.cas = 9,
|
||||
.tpr0 = 0x3ab588b4,
|
||||
.tpr1 = 0xa0d0,
|
||||
.tpr2 = 0x2ba00,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 600 /* DDR3-1333H @600MHz, timings: 9-9-9-22 */
|
||||
.cas = 9,
|
||||
.tpr0 = 0x3cb699b4,
|
||||
.tpr1 = 0xa0d8,
|
||||
.tpr2 = 0x2be00,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 624 /* DDR3-1333H @624MHz, timings: 9-9-9-23 */
|
||||
.cas = 9,
|
||||
.tpr0 = 0x3eb799b4,
|
||||
.tpr1 = 0xa0e8,
|
||||
.tpr2 = 0x2be00,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 648 /* DDR3-1333H @648MHz, timings: 9-9-9-24 */
|
||||
.cas = 9,
|
||||
.tpr0 = 0x42b899b4,
|
||||
.tpr1 = 0xa0f0,
|
||||
.tpr2 = 0x2c200,
|
||||
.emr2 = 0x10,
|
||||
# else
|
||||
# error CONFIG_DRAM_CLK is set too high
|
||||
# endif
|
||||
#elif defined(CONFIG_DRAM_TIMINGS_DDR3_800E_1066G_1333J)
|
||||
# if CONFIG_DRAM_CLK <= 360 /* DDR3-800E @360MHz, timings: 6-6-6-14 */
|
||||
.cas = 6,
|
||||
.tpr0 = 0x268e6690,
|
||||
.tpr1 = 0xa090,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x0,
|
||||
# elif CONFIG_DRAM_CLK <= 384 /* DDR3-800E @384MHz, timings: 6-6-6-15 */
|
||||
.cas = 6,
|
||||
.tpr0 = 0x2a8f6690,
|
||||
.tpr1 = 0xa0a0,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x0,
|
||||
# elif CONFIG_DRAM_CLK <= 396 /* DDR3-800E @396MHz, timings: 6-6-6-15 */
|
||||
.cas = 6,
|
||||
.tpr0 = 0x2a8f6690,
|
||||
.tpr1 = 0xa0a0,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x0,
|
||||
# elif CONFIG_DRAM_CLK <= 408 /* DDR3-1066G @408MHz, timings: 8-7-7-16 */
|
||||
.cas = 8,
|
||||
.tpr0 = 0x2cb07790,
|
||||
.tpr1 = 0xa0a8,
|
||||
.tpr2 = 0x22a00,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 432 /* DDR3-1066G @432MHz, timings: 8-7-7-17 */
|
||||
.cas = 8,
|
||||
.tpr0 = 0x2eb17790,
|
||||
.tpr1 = 0xa0b0,
|
||||
.tpr2 = 0x22e00,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 456 /* DDR3-1066G @456MHz, timings: 8-7-7-18 */
|
||||
.cas = 8,
|
||||
.tpr0 = 0x30b27790,
|
||||
.tpr1 = 0xa0b8,
|
||||
.tpr2 = 0x22e00,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 468 /* DDR3-1066G @468MHz, timings: 8-8-8-18 */
|
||||
.cas = 8,
|
||||
.tpr0 = 0x32b28890,
|
||||
.tpr1 = 0xa0c0,
|
||||
.tpr2 = 0x23200,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 480 /* DDR3-1066G @480MHz, timings: 8-8-8-18 */
|
||||
.cas = 8,
|
||||
.tpr0 = 0x34b28890,
|
||||
.tpr1 = 0xa0c0,
|
||||
.tpr2 = 0x23200,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 504 /* DDR3-1066G @504MHz, timings: 8-8-8-19 */
|
||||
.cas = 8,
|
||||
.tpr0 = 0x36d38890,
|
||||
.tpr1 = 0xa0d0,
|
||||
.tpr2 = 0x23600,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 528 /* DDR3-1066G @528MHz, timings: 8-8-8-20 */
|
||||
.cas = 8,
|
||||
.tpr0 = 0x38d48890,
|
||||
.tpr1 = 0xa0d8,
|
||||
.tpr2 = 0x23600,
|
||||
.emr2 = 0x8,
|
||||
# elif CONFIG_DRAM_CLK <= 540 /* DDR3-1333J @540MHz, timings: 10-9-9-20 */
|
||||
.cas = 10,
|
||||
.tpr0 = 0x38b499b4,
|
||||
.tpr1 = 0xa0c8,
|
||||
.tpr2 = 0x2b600,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 552 /* DDR3-1333J @552MHz, timings: 10-9-9-20 */
|
||||
.cas = 10,
|
||||
.tpr0 = 0x3ab499b4,
|
||||
.tpr1 = 0xa0c8,
|
||||
.tpr2 = 0x2ba00,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 576 /* DDR3-1333J @576MHz, timings: 10-9-9-21 */
|
||||
.cas = 10,
|
||||
.tpr0 = 0x3cb599b4,
|
||||
.tpr1 = 0xa0d0,
|
||||
.tpr2 = 0x2ba00,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 600 /* DDR3-1333J @600MHz, timings: 10-9-9-22 */
|
||||
.cas = 10,
|
||||
.tpr0 = 0x3eb699b4,
|
||||
.tpr1 = 0xa0d8,
|
||||
.tpr2 = 0x2be00,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 624 /* DDR3-1333J @624MHz, timings: 10-10-10-23 */
|
||||
.cas = 10,
|
||||
.tpr0 = 0x40b7aab4,
|
||||
.tpr1 = 0xa0e8,
|
||||
.tpr2 = 0x2be00,
|
||||
.emr2 = 0x10,
|
||||
# elif CONFIG_DRAM_CLK <= 648 /* DDR3-1333J @648MHz, timings: 10-10-10-24 */
|
||||
.cas = 10,
|
||||
.tpr0 = 0x44b8aab4,
|
||||
.tpr1 = 0xa0f0,
|
||||
.tpr2 = 0x2c200,
|
||||
.emr2 = 0x10,
|
||||
# else
|
||||
# error CONFIG_DRAM_CLK is set too high
|
||||
# endif
|
||||
#else
|
||||
# error CONFIG_DRAM_TIMINGS_* is not defined
|
||||
#endif
|
||||
82
u-boot/board/sunxi/gmac.c
Normal file
82
u-boot/board/sunxi/gmac.c
Normal file
@@ -0,0 +1,82 @@
|
||||
#include <common.h>
|
||||
#include <netdev.h>
|
||||
#include <miiphy.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
|
||||
void eth_init_board(void)
|
||||
{
|
||||
int pin;
|
||||
struct sunxi_ccm_reg *const ccm =
|
||||
(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
|
||||
|
||||
/* Set up clock gating */
|
||||
#ifdef CONFIG_SUNXI_GEN_SUN6I
|
||||
setbits_le32(&ccm->ahb_reset0_cfg, 0x1 << AHB_RESET_OFFSET_GMAC);
|
||||
setbits_le32(&ccm->ahb_gate0, 0x1 << AHB_GATE_OFFSET_GMAC);
|
||||
#else
|
||||
setbits_le32(&ccm->ahb_gate1, 0x1 << AHB_GATE_OFFSET_GMAC);
|
||||
#endif
|
||||
|
||||
/* Set MII clock */
|
||||
#ifdef CONFIG_RGMII
|
||||
setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII |
|
||||
CCM_GMAC_CTRL_GPIT_RGMII);
|
||||
setbits_le32(&ccm->gmac_clk_cfg,
|
||||
CCM_GMAC_CTRL_TX_CLK_DELAY(CONFIG_GMAC_TX_DELAY));
|
||||
#else
|
||||
setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_MII |
|
||||
CCM_GMAC_CTRL_GPIT_MII);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MACH_SUN6I
|
||||
/* Configure pin mux settings for GMAC */
|
||||
for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
|
||||
#ifdef CONFIG_RGMII
|
||||
/* skip unused pins in RGMII mode */
|
||||
if (pin == SUNXI_GPA(9) || pin == SUNXI_GPA(14))
|
||||
continue;
|
||||
#endif
|
||||
sunxi_gpio_set_cfgpin(pin, SUN7I_GPA_GMAC);
|
||||
sunxi_gpio_set_drv(pin, 3);
|
||||
}
|
||||
#elif defined CONFIG_RGMII
|
||||
/* Configure sun6i RGMII mode pin mux settings */
|
||||
for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(3); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
sunxi_gpio_set_drv(pin, 3);
|
||||
}
|
||||
for (pin = SUNXI_GPA(9); pin <= SUNXI_GPA(14); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
sunxi_gpio_set_drv(pin, 3);
|
||||
}
|
||||
for (pin = SUNXI_GPA(19); pin <= SUNXI_GPA(20); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
sunxi_gpio_set_drv(pin, 3);
|
||||
}
|
||||
for (pin = SUNXI_GPA(25); pin <= SUNXI_GPA(27); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
sunxi_gpio_set_drv(pin, 3);
|
||||
}
|
||||
#elif defined CONFIG_GMII
|
||||
/* Configure sun6i GMII mode pin mux settings */
|
||||
for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(27); pin++) {
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
sunxi_gpio_set_drv(pin, 2);
|
||||
}
|
||||
#else
|
||||
/* Configure sun6i MII mode pin mux settings */
|
||||
for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(3); pin++)
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
for (pin = SUNXI_GPA(8); pin <= SUNXI_GPA(9); pin++)
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
for (pin = SUNXI_GPA(11); pin <= SUNXI_GPA(14); pin++)
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
for (pin = SUNXI_GPA(19); pin <= SUNXI_GPA(24); pin++)
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
for (pin = SUNXI_GPA(26); pin <= SUNXI_GPA(27); pin++)
|
||||
sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user