Skip to content

Commit

Permalink
Merge branch 'master' of git://git.denx.de/u-boot-sunxi
Browse files Browse the repository at this point in the history
  • Loading branch information
trini committed Feb 2, 2015
2 parents 358b8bc + 5abdb15 commit be8ddad
Show file tree
Hide file tree
Showing 47 changed files with 490 additions and 331 deletions.
2 changes: 2 additions & 0 deletions arch/arm/cpu/armv7/sunxi/Makefile
Expand Up @@ -15,8 +15,10 @@ obj-y += pinmux.o
obj-y += usbc.o
obj-$(CONFIG_MACH_SUN6I) += prcm.o
obj-$(CONFIG_MACH_SUN8I) += prcm.o
obj-$(CONFIG_MACH_SUN9I) += prcm.o
obj-$(CONFIG_MACH_SUN6I) += p2wi.o
obj-$(CONFIG_MACH_SUN8I) += rsb.o
obj-$(CONFIG_MACH_SUN9I) += rsb.o
obj-$(CONFIG_MACH_SUN4I) += clock_sun4i.o
obj-$(CONFIG_MACH_SUN5I) += clock_sun4i.o
obj-$(CONFIG_MACH_SUN6I) += clock_sun6i.o
Expand Down
22 changes: 19 additions & 3 deletions arch/arm/cpu/armv7/sunxi/rsb.c
Expand Up @@ -16,14 +16,27 @@
#include <asm/arch/prcm.h>
#include <asm/arch/rsb.h>

static int rsb_set_device_mode(void);

static void rsb_cfg_io(void)
{
#ifdef CONFIG_MACH_SUN8I
sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_GPL0_R_RSB_SCK);
sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_GPL1_R_RSB_SDA);
sunxi_gpio_set_pull(SUNXI_GPL(0), 1);
sunxi_gpio_set_pull(SUNXI_GPL(1), 1);
sunxi_gpio_set_drv(SUNXI_GPL(0), 2);
sunxi_gpio_set_drv(SUNXI_GPL(1), 2);
#elif defined CONFIG_MACH_SUN9I
sunxi_gpio_set_cfgpin(SUNXI_GPN(0), SUN9I_GPN0_R_RSB_SCK);
sunxi_gpio_set_cfgpin(SUNXI_GPN(1), SUN9I_GPN1_R_RSB_SDA);
sunxi_gpio_set_pull(SUNXI_GPN(0), 1);
sunxi_gpio_set_pull(SUNXI_GPN(1), 1);
sunxi_gpio_set_drv(SUNXI_GPN(0), 2);
sunxi_gpio_set_drv(SUNXI_GPN(1), 2);
#else
#error unsupported MACH_SUNXI
#endif
}

static void rsb_set_clk(void)
Expand All @@ -42,7 +55,7 @@ static void rsb_set_clk(void)
writel((cd_odly << 8) | div, &rsb->ccr);
}

void rsb_init(void)
int rsb_init(void)
{
struct sunxi_rsb_reg * const rsb =
(struct sunxi_rsb_reg *)SUNXI_RSB_BASE;
Expand All @@ -54,6 +67,8 @@ void rsb_init(void)

writel(RSB_CTRL_SOFT_RST, &rsb->ctrl);
rsb_set_clk();

return rsb_set_device_mode();
}

static int rsb_await_trans(void)
Expand Down Expand Up @@ -88,13 +103,14 @@ static int rsb_await_trans(void)
return ret;
}

int rsb_set_device_mode(u32 device_mode_data)
static int rsb_set_device_mode(void)
{
struct sunxi_rsb_reg * const rsb =
(struct sunxi_rsb_reg *)SUNXI_RSB_BASE;
unsigned long tmo = timer_get_us() + 1000000;

writel(RSB_DMCR_DEVICE_MODE_START | device_mode_data, &rsb->dmcr);
writel(RSB_DMCR_DEVICE_MODE_START | RSB_DMCR_DEVICE_MODE_DATA,
&rsb->dmcr);

while (readl(&rsb->dmcr) & RSB_DMCR_DEVICE_MODE_START) {
if (timer_get_us() > tmo)
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/include/asm/arch-sunxi/clock_sun4i.h
Expand Up @@ -305,6 +305,8 @@ struct sunxi_ccm_reg {
#define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2
#define CCM_GMAC_CTRL_GPIT_MII (0x0 << 2)
#define CCM_GMAC_CTRL_GPIT_RGMII (0x1 << 2)
#define CCM_GMAC_CTRL_RX_CLK_DELAY(x) ((x) << 5)
#define CCM_GMAC_CTRL_TX_CLK_DELAY(x) ((x) << 10)

#define CCM_USB_CTRL_PHY0_RST (0x1 << 0)
#define CCM_USB_CTRL_PHY1_RST (0x1 << 1)
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/include/asm/arch-sunxi/clock_sun6i.h
Expand Up @@ -243,6 +243,8 @@ struct sunxi_ccm_reg {
#define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2
#define CCM_GMAC_CTRL_GPIT_MII (0x0 << 2)
#define CCM_GMAC_CTRL_GPIT_RGMII (0x1 << 2)
#define CCM_GMAC_CTRL_RX_CLK_DELAY(x) ((x) << 5)
#define CCM_GMAC_CTRL_TX_CLK_DELAY(x) ((x) << 10)

#define MDFS_CLK_DEFAULT 0x81000002 /* PLL6 / 3 */

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/include/asm/arch-sunxi/cpu_sun9i.h
Expand Up @@ -73,7 +73,6 @@
#define SUNXI_CCM_BASE (REGS_APB0_BASE + 0x0000)
#define SUNXI_CCMMODULE_BASE (REGS_APB0_BASE + 0x0400)
#define SUNXI_PIO_BASE (REGS_APB0_BASE + 0x0800)
#define SUNXI_R_PIO_BASE (0x08002C00)
#define SUNXI_TIMER_BASE (REGS_APB0_BASE + 0x0C00)
#define SUNXI_PWM_BASE (REGS_APB0_BASE + 0x1400)
#define SUNXI_LRADC_BASE (REGS_APB0_BASE + 0x1800)
Expand All @@ -92,8 +91,10 @@
#define SUNXI_TWI4_BASE (REGS_APB1_BASE + 0x3800)

/* RCPUS Module */
#define SUNXI_RPRCM_BASE (REGS_RCPUS_BASE + 0x1400)
#define SUNXI_PRCM_BASE (REGS_RCPUS_BASE + 0x1400)
#define SUNXI_R_UART_BASE (REGS_RCPUS_BASE + 0x2800)
#define SUNXI_R_PIO_BASE (REGS_RCPUS_BASE + 0x2c00)
#define SUNXI_RSB_BASE (REGS_RCPUS_BASE + 0x3400)

/* Misc. */
#define SUNXI_BROM_BASE 0xFFFF0000 /* 32K */
Expand Down
9 changes: 9 additions & 0 deletions arch/arm/include/asm/arch-sunxi/gpio.h
Expand Up @@ -45,9 +45,13 @@
*
* sun8i has 1 bank:
* PL0 - PL11
*
* sun9i has 3 banks:
* PL0 - PL9 | PM0 - PM15 | PN0 - PN1
*/
#define SUNXI_GPIO_L 11
#define SUNXI_GPIO_M 12
#define SUNXI_GPIO_N 13

struct sunxi_gpio {
u32 cfg[4];
Expand Down Expand Up @@ -114,6 +118,7 @@ enum sunxi_gpio_number {
SUNXI_GPIO_I_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_H),
SUNXI_GPIO_L_START = 352,
SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L),
SUNXI_GPIO_N_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_M),
SUNXI_GPIO_AXP0_START = 1024,
};

Expand All @@ -129,6 +134,7 @@ enum sunxi_gpio_number {
#define SUNXI_GPI(_nr) (SUNXI_GPIO_I_START + (_nr))
#define SUNXI_GPL(_nr) (SUNXI_GPIO_L_START + (_nr))
#define SUNXI_GPM(_nr) (SUNXI_GPIO_M_START + (_nr))
#define SUNXI_GPN(_nr) (SUNXI_GPIO_N_START + (_nr))

#define SUNXI_GPAXP0(_nr) (SUNXI_GPIO_AXP0_START + (_nr))

Expand Down Expand Up @@ -187,6 +193,9 @@ enum sunxi_gpio_number {
#define SUN8I_GPL2_R_UART_TX 2
#define SUN8I_GPL3_R_UART_RX 2

#define SUN9I_GPN0_R_RSB_SCK 3
#define SUN9I_GPN1_R_RSB_SDA 3

/* GPIO pin pull-up/down config */
#define SUNXI_GPIO_PULL_DISABLE 0
#define SUNXI_GPIO_PULL_UP 1
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/include/asm/arch-sunxi/rsb.h
Expand Up @@ -37,6 +37,7 @@ struct sunxi_rsb_reg {
#define RSB_STAT_TERR_INT (1 << 1)
#define RSB_STAT_LBSY_INT (1 << 2)

#define RSB_DMCR_DEVICE_MODE_DATA 0x7c3e00
#define RSB_DMCR_DEVICE_MODE_START (1 << 31)

#define RSB_CMD_BYTE_WRITE 0x4e
Expand All @@ -46,8 +47,7 @@ struct sunxi_rsb_reg {
#define RSB_DEVADDR_RUNTIME_ADDR(x) ((x) << 16)
#define RSB_DEVADDR_DEVICE_ADDR(x) ((x) << 0)

void rsb_init(void);
int rsb_set_device_mode(u32 device_mode_data);
int rsb_init(void);
int rsb_set_device_address(u16 device_addr, u16 runtime_addr);
int rsb_write(const u16 runtime_device_addr, const u8 reg_addr, u8 data);
int rsb_read(const u16 runtime_device_addr, const u8 reg_addr, u8 *data);
Expand Down
180 changes: 93 additions & 87 deletions board/sunxi/Kconfig
Expand Up @@ -39,115 +39,105 @@ config DRAM_CLK
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. Note on sun4i / sun5i / sun7i this is only used by boards
which use dram autoconfig.
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. Note on sun4i / sun5i / sun7i this is only
used by boards which use dram autoconfig.
Set the dram zq value.

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. Note this is only used by boards
which use dram autoconfig.
endif

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

choice
prompt "Board"

config TARGET_A10S_OLINUXINO_M
bool "A10S_OLINUXINO_M"
depends on MACH_SUN5I

config TARGET_A13_OLINUXINOM
bool "A13_OLINUXINOM"
depends on MACH_SUN5I

config TARGET_A13_OLINUXINO
bool "A13_OLINUXINO"
depends on MACH_SUN5I

config TARGET_A20_OLINUXINO_L2
bool "A20_OLINUXINO_L2"
depends on MACH_SUN7I

config TARGET_A20_OLINUXINO_L
bool "A20_OLINUXINO_L"
depends on MACH_SUN7I

config TARGET_A20_OLINUXINO_M
bool "A20_OLINUXINO_M"
depends on MACH_SUN7I

config TARGET_AUXTEK_T004
bool "AUXTEK_T004"
depends on MACH_SUN5I

config TARGET_BANANAPI
bool "BANANAPI"
depends on MACH_SUN7I

config TARGET_BANANAPRO
bool "BANANAPRO"
depends on MACH_SUN7I
Set the dram controller emr1 value.

config TARGET_CUBIEBOARD2
bool "CUBIEBOARD2"
depends on MACH_SUN7I

config TARGET_CUBIETRUCK
bool "CUBIETRUCK"
depends on MACH_SUN7I
config DRAM_ODT_EN
int "sunxi dram odt_en value"
default 0
---help---
Set the dram controller odt_en parameter. This can be used to
enable/disable the ODT feature.

config TARGET_PCDUINO3
bool "PCDUINO3"
depends on MACH_SUN7I
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.

config TARGET_MELE_M3
bool "MELE_M3"
depends on MACH_SUN7I
choice
prompt "sunxi dram timings"
default DRAM_TIMINGS_VENDOR_MAGIC
---help---
Select the timings of the DDR3 chips.

config TARGET_MK802_A10S
bool "MK802_A10S"
depends on MACH_SUN5I
config DRAM_TIMINGS_VENDOR_MAGIC
bool "Magic vendor timings from Android"
---help---
The same DRAM timings as in the Allwinner boot0 bootloader.

config TARGET_MSI_PRIMO73
bool "MSI Primo73 (7\" tablet)"
depends on MACH_SUN7I
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---
The MSI Primo73 is an A20 based tablet, with 1G RAM, 16G NAND,
1024x600 TN LCD display, mono speaker, 0.3 MP front camera, 2.0 MP
rear camera, 3000 mAh battery, gt911 touchscreen, mma8452 accelerometer
and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons
(both volume buttons are also connected to the UBOOT_SEL pin). The
external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB
OTG and 3.5mm headphone jack. More details are available at
http://linux-sunxi.org/MSI_Primo73
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.

config TARGET_I12_TVBOX
bool "I12_TVBOX"
depends on MACH_SUN7I
endchoice

config TARGET_R7DONGLE
bool "R7DONGLE"
depends on MACH_SUN5I
endif

endchoice
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

config SYS_BOARD
default "sunxi"
Expand Down Expand Up @@ -270,6 +260,16 @@ config VIDEO_VGA_VIA_LCD
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
Expand Down Expand Up @@ -383,4 +383,10 @@ config USB_KEYBOARD
Say Y here to add support for using a USB keyboard (typically used
in combination with a graphical console).

config GMAC_TX_DELAY
int "GMAC Transmit Clock Delay Chain"
default 0
---help---
Set the GMAC Transmit Clock Delay Chain value.

endif

0 comments on commit be8ddad

Please sign in to comment.