]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-net
authorTom Rini <trini@konsulko.com>
Mon, 1 Jun 2015 20:47:23 +0000 (16:47 -0400)
committerTom Rini <trini@konsulko.com>
Tue, 2 Jun 2015 12:53:41 +0000 (08:53 -0400)
Fixup include/configs/unipher.h to not set CONFIG_LIB_RAND

Signed-off-by: Tom Rini <trini@konsulko.com>
113 files changed:
Kconfig
arch/arm/Kconfig
arch/arm/cpu/armv7/rmobile/Kconfig
arch/arm/cpu/armv7/sunxi/Makefile
arch/arm/cpu/armv7/sunxi/board.c
arch/arm/cpu/armv7/sunxi/cpu_info.c
arch/arm/cpu/armv7/sunxi/psci.S [deleted file]
arch/arm/cpu/armv7/sunxi/psci_sun6i.S [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/psci_sun7i.S [new file with mode: 0644]
arch/arm/include/asm/arch-rmobile/r8a7794.h
arch/arm/include/asm/arch-sunxi/clock_sun4i.h
arch/arm/include/asm/arch-sunxi/clock_sun6i.h
arch/arm/include/asm/arch-sunxi/clock_sun9i.h
arch/arm/include/asm/arch-sunxi/dma.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/dma_sun4i.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/gpio.h
arch/arm/include/asm/arch-sunxi/nand.h [new file with mode: 0644]
arch/arm/mach-uniphier/Kconfig
arch/arm/mach-uniphier/board_late_init.c
arch/arm/mach-uniphier/cache_uniphier.c
arch/arm/mach-uniphier/cmd_ddrphy.c
arch/arm/mach-uniphier/cpu_info.c
arch/arm/mach-uniphier/ddrphy_training.c
arch/arm/mach-uniphier/include/mach/ddrphy-regs.h
arch/arm/mach-uniphier/include/mach/debug-uart.S
arch/arm/mach-uniphier/include/mach/led.h
arch/arm/mach-uniphier/include/mach/sbc-regs.h
arch/arm/mach-uniphier/include/mach/sg-regs.h
arch/arm/mach-uniphier/lowlevel_init.S
arch/arm/mach-uniphier/memconf.c
arch/arm/mach-uniphier/ph1-ld4/bcu_init.c
arch/arm/mach-uniphier/ph1-ld4/clkrst_init.c
arch/arm/mach-uniphier/ph1-ld4/ddrphy_init.c
arch/arm/mach-uniphier/ph1-ld4/pinctrl.c
arch/arm/mach-uniphier/ph1-ld4/pll_init.c
arch/arm/mach-uniphier/ph1-ld4/sbc_init.c
arch/arm/mach-uniphier/ph1-ld4/sbc_init_3cs.c
arch/arm/mach-uniphier/ph1-ld4/sg_init.c
arch/arm/mach-uniphier/ph1-ld4/umc_init.c
arch/arm/mach-uniphier/ph1-pro4/boot-mode.c
arch/arm/mach-uniphier/ph1-pro4/clkrst_init.c
arch/arm/mach-uniphier/ph1-pro4/ddrphy_init.c
arch/arm/mach-uniphier/ph1-pro4/early_clkrst_init.c
arch/arm/mach-uniphier/ph1-pro4/early_pinctrl.c
arch/arm/mach-uniphier/ph1-pro4/pinctrl.c
arch/arm/mach-uniphier/ph1-pro4/pll_init.c
arch/arm/mach-uniphier/ph1-pro4/pll_spectrum.c
arch/arm/mach-uniphier/ph1-pro4/sbc_init.c
arch/arm/mach-uniphier/ph1-pro4/sbc_init_3cs.c
arch/arm/mach-uniphier/ph1-pro4/sg_init.c
arch/arm/mach-uniphier/ph1-pro4/umc_init.c
arch/arm/mach-uniphier/ph1-sld8/ddrphy_init.c
arch/arm/mach-uniphier/ph1-sld8/pinctrl.c
arch/arm/mach-uniphier/ph1-sld8/pll_init.c
arch/arm/mach-uniphier/ph1-sld8/sbc_init_3cs.c
arch/arm/mach-uniphier/ph1-sld8/umc_init.c
arch/arm/mach-uniphier/reset.c
arch/arm/mach-uniphier/support_card.c
arch/arm/mach-uniphier/timer.c
board/BuR/common/bur_common.h
board/BuR/common/common.c
board/BuR/kwb/MAINTAINERS
board/BuR/kwb/Makefile
board/BuR/kwb/board.c
board/BuR/kwb/mux.c
board/BuR/tseries/MAINTAINERS
board/BuR/tseries/Makefile
board/BuR/tseries/board.c
board/BuR/tseries/mux.c
board/renesas/alt/Kconfig
board/renesas/alt/alt.c
board/renesas/alt/qos.c
board/renesas/gose/qos.c
board/renesas/koelsch/qos.c
board/renesas/lager/qos.c
board/sunxi/Kconfig
board/sunxi/MAINTAINERS
board/sunxi/board.c
common/usb.c
common/usb_kbd.c
configs/Merrii_A80_Optimus_defconfig [new file with mode: 0644]
configs/ph1_ld4_defconfig
configs/ph1_pro4_defconfig
configs/ph1_sld8_defconfig
drivers/i2c/Kconfig
drivers/i2c/i2c-uniphier-f.c
drivers/i2c/i2c-uniphier.c
drivers/i2c/omap24xx_i2c.c
drivers/mtd/nand/Makefile
drivers/mtd/nand/sunxi_nand_spl.c [new file with mode: 0644]
drivers/serial/Kconfig
drivers/serial/serial_uniphier.c
drivers/usb/gadget/ci_udc.c
drivers/usb/gadget/ci_udc.h
drivers/usb/host/Kconfig
drivers/usb/host/dwc2.c
drivers/usb/host/dwc2.h
drivers/usb/host/ehci-uniphier.c
drivers/usb/host/xhci-uniphier.c
drivers/video/am335x-fb.c
drivers/video/am335x-fb.h
include/configs/bur_am335x_common.h
include/configs/kwb.h
include/configs/sun4i.h
include/configs/sun5i.h
include/configs/sun6i.h
include/configs/sun7i.h
include/configs/sun8i.h
include/configs/sun9i.h [new file with mode: 0644]
include/configs/sunxi-common.h
include/configs/tseries.h
include/configs/uniphier.h
tools/mksunxiboot.c

diff --git a/Kconfig b/Kconfig
index 85faff78c8dd3df1da2860906ca0d663d5aa521a..15e15af5b3c59510614b9e6cef03bdd1968a49ed 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -178,7 +178,7 @@ config SYS_EXTRA_OPTIONS
          new boards should not use this option.
 
 config SYS_TEXT_BASE
-       depends on SPARC || ARC || X86
+       depends on SPARC || ARC || X86 || ARCH_UNIPHIER
        hex "Text Base"
        help
          TODO: Move CONFIG_SYS_TEXT_BASE for all the architecture
index b62842f3dc816f54a40bcd5d9ecd38c3e941ea0e..2985e6e065975876f3a3c6d984745da5756b4d32 100644 (file)
@@ -786,7 +786,7 @@ config TARGET_JORNADA
        select CPU_SA1100
 
 config ARCH_UNIPHIER
-       bool "Panasonic UniPhier platform"
+       bool "Socionext UniPhier SoCs"
        select CPU_V7
        select SUPPORT_SPL
        select SPL
@@ -794,6 +794,9 @@ config ARCH_UNIPHIER
        select DM
        select DM_SERIAL
        select DM_I2C
+       help
+         Support for UniPhier SoC family developed by Socionext Inc.
+         (formerly, System LSI Business Division of Panasonic Corporation)
 
 config TARGET_STM32F429_DISCOVERY
        bool "Support STM32F429 Discovery"
index ae23078395e8af71317f43399401cb72d03f2d3f..ef5628671531f6cf93bfd94a8f3f9d452cceca23 100644 (file)
@@ -50,6 +50,28 @@ config RMOBILE_EXTRAM_BOOT
        depends on TARGET_ALT || TARGET_KOELSCH || TARGET_LAGER || TARGET_PORTER || TARGET_SILK
        default n
 
+choice
+       prompt "Qos setting primary"
+       depends on TARGET_ALT || TARGET_GOSE || TARGET_KOELSCH || TARGET_LAGER
+       default QOS_PRI_NORMAL
+
+config QOS_PRI_NORMAL
+       bool "Non primary"
+       help
+          Select normal mode for QoS setting.
+
+config QOS_PRI_MEDIA
+       bool "Media primary"
+       help
+          Select multimedia primary mode for QoS setting.
+
+config QOS_PRI_GFX
+       bool "GFX primary"
+       help
+          Select GFX(graphics) primary mode for QoS setting.
+
+endchoice
+
 source "board/atmark-techno/armadillo-800eva/Kconfig"
 source "board/renesas/gose/Kconfig"
 source "board/renesas/koelsch/Kconfig"
index 6a0299fe1cd8fe1bbeaf92561b7244ff5b8e4a36..76c7e555f1d79e55f37ae12cb5fd539ef6cbc4c0 100644 (file)
@@ -13,7 +13,9 @@ obj-y += clock.o
 obj-y  += cpu_info.o
 obj-y  += dram_helpers.o
 obj-y  += pinmux.o
+ifndef CONFIG_MACH_SUN9I
 obj-y  += usb_phy.o
+endif
 obj-$(CONFIG_MACH_SUN6I)       += prcm.o
 obj-$(CONFIG_MACH_SUN8I)       += prcm.o
 obj-$(CONFIG_MACH_SUN9I)       += prcm.o
@@ -33,7 +35,9 @@ obj-$(CONFIG_AXP221_POWER)    += pmic_bus.o
 
 ifndef CONFIG_SPL_BUILD
 ifdef CONFIG_ARMV7_PSCI
-obj-y  += psci.o
+obj-$(CONFIG_MACH_SUN6I)       += psci_sun6i.o
+obj-$(CONFIG_MACH_SUN7I)       += psci_sun7i.o
+obj-$(CONFIG_MACH_SUN8I)       += psci_sun6i.o
 endif
 endif
 
index e6730c0dfa1acdb0bda88406f32de0e6c42c31ae..a82c8b9d4460cd1ccc43d30b8a179e6f6e6ecfb3 100644 (file)
@@ -64,6 +64,10 @@ static int gpio_init(void)
        sunxi_gpio_set_cfgpin(SUNXI_GPH(20), SUN6I_GPH_UART0);
        sunxi_gpio_set_cfgpin(SUNXI_GPH(21), SUN6I_GPH_UART0);
        sunxi_gpio_set_pull(SUNXI_GPH(21), SUNXI_GPIO_PULL_UP);
+#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN9I)
+       sunxi_gpio_set_cfgpin(SUNXI_GPH(12), SUN9I_GPH_UART0);
+       sunxi_gpio_set_cfgpin(SUNXI_GPH(13), SUN9I_GPH_UART0);
+       sunxi_gpio_set_pull(SUNXI_GPH(13), SUNXI_GPIO_PULL_UP);
 #elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I)
        sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG_UART1);
        sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG_UART1);
@@ -115,17 +119,19 @@ void s_init(void)
 #ifdef CONFIG_SPL_BUILD
 /* The sunxi internal brom will try to loader external bootloader
  * from mmc0, nand flash, mmc2.
- * Unfortunately we can't check how SPL was loaded so assume
- * it's always the first SD/MMC controller
+ *
+ * Unfortunately we can't check how SPL was loaded so assume it's
+ * always the first SD/MMC controller, unless it was explicitly
+ * stated that SPL is on nand flash.
  */
 u32 spl_boot_device(void)
 {
-#ifdef CONFIG_SPL_FEL
+#if defined(CONFIG_SPL_NAND_SUPPORT)
        /*
-        * This is the legacy compile time configuration for a special FEL
-        * enabled build. It has many restrictions and can only boot over USB.
+        * This is compile time configuration informing SPL, that it
+        * was loaded from nand flash.
         */
-       return BOOT_DEVICE_BOARD;
+       return BOOT_DEVICE_NAND;
 #else
        /*
         * When booting from the SD card, the "eGON.BT0" signature is expected
index 30ec4ac4f01733bea7608d199dcbc80477a436e0..a276fad3164a7c3a1a72b6a8e4660c294dad1642 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/clock.h>
 #include <axp221.h>
+#include <errno.h>
 
 #ifdef CONFIG_MACH_SUN6I
 int sunxi_get_ss_bonding_id(void)
@@ -68,6 +69,8 @@ int print_cpuinfo(void)
        puts("CPU:   Allwinner A23 (SUN8I)\n");
 #elif defined CONFIG_MACH_SUN8I_A33
        puts("CPU:   Allwinner A33 (SUN8I)\n");
+#elif defined CONFIG_MACH_SUN9I
+       puts("CPU:   Allwinner A80 (SUN9I)\n");
 #else
 #warning Please update cpu_info.c with correct CPU information
        puts("CPU:   SUNXI Family\n");
@@ -78,18 +81,16 @@ int print_cpuinfo(void)
 
 int sunxi_get_sid(unsigned int *sid)
 {
-#if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_A23
 #ifdef CONFIG_AXP221_POWER
        return axp221_get_sid(sid);
-#else
-       return -ENODEV;
-#endif
-#else
+#elif defined SUNXI_SID_BASE
        int i;
 
        for (i = 0; i< 4; i++)
                sid[i] = readl(SUNXI_SID_BASE + 4 * i);
 
        return 0;
+#else
+       return -ENODEV;
 #endif
 }
diff --git a/arch/arm/cpu/armv7/sunxi/psci.S b/arch/arm/cpu/armv7/sunxi/psci.S
deleted file mode 100644 (file)
index 7ec0500..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2013 - ARM Ltd
- * Author: Marc Zyngier <marc.zyngier@arm.com>
- *
- * Based on code by Carl van Schaik <carl@ok-labs.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-#include <asm/gic.h>
-#include <asm/macro.h>
-#include <asm/psci.h>
-#include <asm/arch/cpu.h>
-
-/*
- * Memory layout:
- *
- * SECURE_RAM to text_end :
- *     ._secure_text section
- * text_end to ALIGN_PAGE(text_end):
- *     nothing
- * ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x1000)
- *     1kB of stack per CPU (4 CPUs max).
- */
-
-       .pushsection ._secure.text, "ax"
-
-       .arch_extension sec
-
-#define        ONE_MS                  (CONFIG_TIMER_CLK_FREQ / 1000)
-#define        TEN_MS                  (10 * ONE_MS)
-#define        GICD_BASE               0x1c81000
-#define        GICC_BASE               0x1c82000
-
-.macro timer_wait      reg, ticks
-       @ Program CNTP_TVAL
-       movw    \reg, #(\ticks & 0xffff)
-       movt    \reg, #(\ticks >> 16)
-       mcr     p15, 0, \reg, c14, c2, 0
-       isb
-       @ Enable physical timer, mask interrupt
-       mov     \reg, #3
-       mcr     p15, 0, \reg, c14, c2, 1
-       @ Poll physical timer until ISTATUS is on
-1:     isb
-       mrc     p15, 0, \reg, c14, c2, 1
-       ands    \reg, \reg, #4
-       bne     1b
-       @ Disable timer
-       mov     \reg, #0
-       mcr     p15, 0, \reg, c14, c2, 1
-       isb
-.endm
-
-.globl psci_fiq_enter
-psci_fiq_enter:
-       push    {r0-r12}
-
-       @ Switch to secure
-       mrc     p15, 0, r7, c1, c1, 0
-       bic     r8, r7, #1
-       mcr     p15, 0, r8, c1, c1, 0
-       isb
-
-       @ Validate reason based on IAR and acknowledge
-       movw    r8, #(GICC_BASE & 0xffff)
-       movt    r8, #(GICC_BASE >> 16)
-       ldr     r9, [r8, #GICC_IAR]
-       movw    r10, #0x3ff
-       movt    r10, #0
-       cmp     r9, r10                 @ skip spurious interrupt 1023
-       beq     out
-       movw    r10, #0x3fe             @ ...and 1022
-       cmp     r9, r10
-       beq     out
-       str     r9, [r8, #GICC_EOIR]    @ acknowledge the interrupt
-       dsb
-
-       @ Compute CPU number
-       lsr     r9, r9, #10
-       and     r9, r9, #0xf
-
-       movw    r8, #(SUN7I_CPUCFG_BASE & 0xffff)
-       movt    r8, #(SUN7I_CPUCFG_BASE >> 16)
-
-       @ Wait for the core to enter WFI
-       lsl     r11, r9, #6             @ x64
-       add     r11, r11, r8
-
-1:     ldr     r10, [r11, #0x48]
-       tst     r10, #(1 << 2)
-       bne     2f
-       timer_wait r10, ONE_MS
-       b       1b
-
-       @ Reset CPU
-2:     mov     r10, #0
-       str     r10, [r11, #0x40]
-
-       @ Lock CPU
-       mov     r10, #1
-       lsl     r9, r10, r9             @ r9 is now CPU mask
-       ldr     r10, [r8, #0x1e4]
-       bic     r10, r10, r9
-       str     r10, [r8, #0x1e4]
-
-       @ Set power gating
-       ldr     r10, [r8, #0x1b4]
-       orr     r10, r10, #1
-       str     r10, [r8, #0x1b4]
-       timer_wait r10, ONE_MS
-
-       @ Activate power clamp
-       mov     r10, #1
-1:     str     r10, [r8, #0x1b0]
-       lsl     r10, r10, #1
-       orr     r10, r10, #1
-       tst     r10, #0x100
-       beq     1b
-
-       @ Restore security level
-out:   mcr     p15, 0, r7, c1, c1, 0
-
-       pop     {r0-r12}
-       subs    pc, lr, #4
-
-       @ r1 = target CPU
-       @ r2 = target PC
-.globl psci_cpu_on
-psci_cpu_on:
-       push    {lr}
-
-       mov     r0, r1
-       bl      psci_get_cpu_stack_top  @ get stack top of target CPU
-       str     r2, [r0]                @ store target PC at stack top
-       dsb
-
-       movw    r0, #(SUN7I_CPUCFG_BASE & 0xffff)
-       movt    r0, #(SUN7I_CPUCFG_BASE >> 16)
-
-       @ CPU mask
-       and     r1, r1, #3      @ only care about first cluster
-       mov     r4, #1
-       lsl     r4, r4, r1
-
-       ldr     r6, =psci_cpu_entry
-       str     r6, [r0, #0x1a4] @ PRIVATE_REG (boot vector)
-
-       @ Assert reset on target CPU
-       mov     r6, #0
-       lsl     r5, r1, #6      @ 64 bytes per CPU
-       add     r5, r5, #0x40   @ Offset from base
-       add     r5, r5, r0      @ CPU control block
-       str     r6, [r5]        @ Reset CPU
-
-       @ l1 invalidate
-       ldr     r6, [r0, #0x184]
-       bic     r6, r6, r4
-       str     r6, [r0, #0x184]
-
-       @ Lock CPU
-       ldr     r6, [r0, #0x1e4]
-       bic     r6, r6, r4
-       str     r6, [r0, #0x1e4]
-
-       @ Release power clamp
-       movw    r6, #0x1ff
-       movt    r6, #0
-1:     lsrs    r6, r6, #1
-       str     r6, [r0, #0x1b0]
-       bne     1b
-
-       timer_wait r1, TEN_MS
-
-       @ Clear power gating
-       ldr     r6, [r0, #0x1b4]
-       bic     r6, r6, #1
-       str     r6, [r0, #0x1b4]
-
-       @ Deassert reset on target CPU
-       mov     r6, #3
-       str     r6, [r5]
-
-       @ Unlock CPU
-       ldr     r6, [r0, #0x1e4]
-       orr     r6, r6, r4
-       str     r6, [r0, #0x1e4]
-
-       mov     r0, #ARM_PSCI_RET_SUCCESS       @ Return PSCI_RET_SUCCESS
-       pop     {pc}
-
-.globl psci_cpu_off
-psci_cpu_off:
-       bl      psci_cpu_off_common
-
-       @ Ask CPU0 to pull the rug...
-       movw    r0, #(GICD_BASE & 0xffff)
-       movt    r0, #(GICD_BASE >> 16)
-       movw    r1, #15                         @ SGI15
-       movt    r1, #1                          @ Target is CPU0
-       str     r1, [r0, #GICD_SGIR]
-       dsb
-
-1:     wfi
-       b       1b
-
-.globl psci_arch_init
-psci_arch_init:
-       mov     r6, lr
-
-       movw    r4, #(GICD_BASE & 0xffff)
-       movt    r4, #(GICD_BASE >> 16)
-
-       ldr     r5, [r4, #GICD_IGROUPRn]
-       bic     r5, r5, #(1 << 15)      @ SGI15 as Group-0
-       str     r5, [r4, #GICD_IGROUPRn]
-
-       mov     r5, #0                  @ Set SGI15 priority to 0
-       strb    r5, [r4, #(GICD_IPRIORITYRn + 15)]
-
-       add     r4, r4, #0x1000         @ GICC address
-
-       mov     r5, #0xff
-       str     r5, [r4, #GICC_PMR]     @ Be cool with non-secure
-
-       ldr     r5, [r4, #GICC_CTLR]
-       orr     r5, r5, #(1 << 3)       @ Switch FIQEn on
-       str     r5, [r4, #GICC_CTLR]
-
-       mrc     p15, 0, r5, c1, c1, 0   @ Read SCR
-       orr     r5, r5, #4              @ Enable FIQ in monitor mode
-       bic     r5, r5, #1              @ Secure mode
-       mcr     p15, 0, r5, c1, c1, 0   @ Write SCR
-       isb
-
-       bl      psci_get_cpu_id         @ CPU ID => r0
-       bl      psci_get_cpu_stack_top  @ stack top => r0
-       mov     sp, r0
-
-       bx      r6
-
-       .globl psci_text_end
-psci_text_end:
-       .popsection
diff --git a/arch/arm/cpu/armv7/sunxi/psci_sun6i.S b/arch/arm/cpu/armv7/sunxi/psci_sun6i.S
new file mode 100644 (file)
index 0000000..d4cb51e
--- /dev/null
@@ -0,0 +1,280 @@
+/*
+ * Copyright (C) 2015 - Chen-Yu Tsai
+ * Author: Chen-Yu Tsai <wens@csie.org>
+ *
+ * Based on psci_sun7i.S by Marc Zyngier <marc.zyngier@arm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <asm/gic.h>
+#include <asm/macro.h>
+#include <asm/psci.h>
+#include <asm/arch/cpu.h>
+
+/*
+ * Memory layout:
+ *
+ * SECURE_RAM to text_end :
+ *     ._secure_text section
+ * text_end to ALIGN_PAGE(text_end):
+ *     nothing
+ * ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x1000)
+ *     1kB of stack per CPU (4 CPUs max).
+ */
+
+       .pushsection ._secure.text, "ax"
+
+       .arch_extension sec
+
+#define        ONE_MS                  (CONFIG_TIMER_CLK_FREQ / 1000)
+#define        TEN_MS                  (10 * ONE_MS)
+#define        GICD_BASE               0x1c81000
+#define        GICC_BASE               0x1c82000
+
+.macro timer_wait      reg, ticks
+       @ Program CNTP_TVAL
+       movw    \reg, #(\ticks & 0xffff)
+       movt    \reg, #(\ticks >> 16)
+       mcr     p15, 0, \reg, c14, c2, 0
+       isb
+       @ Enable physical timer, mask interrupt
+       mov     \reg, #3
+       mcr     p15, 0, \reg, c14, c2, 1
+       @ Poll physical timer until ISTATUS is on
+1:     isb
+       mrc     p15, 0, \reg, c14, c2, 1
+       ands    \reg, \reg, #4
+       bne     1b
+       @ Disable timer
+       mov     \reg, #0
+       mcr     p15, 0, \reg, c14, c2, 1
+       isb
+.endm
+
+.globl psci_fiq_enter
+psci_fiq_enter:
+       push    {r0-r12}
+
+       @ Switch to secure
+       mrc     p15, 0, r7, c1, c1, 0
+       bic     r8, r7, #1
+       mcr     p15, 0, r8, c1, c1, 0
+       isb
+
+       @ Validate reason based on IAR and acknowledge
+       movw    r8, #(GICC_BASE & 0xffff)
+       movt    r8, #(GICC_BASE >> 16)
+       ldr     r9, [r8, #GICC_IAR]
+       movw    r10, #0x3ff
+       movt    r10, #0
+       cmp     r9, r10                 @ skip spurious interrupt 1023
+       beq     out
+       movw    r10, #0x3fe             @ ...and 1022
+       cmp     r9, r10
+       beq     out
+       str     r9, [r8, #GICC_EOIR]    @ acknowledge the interrupt
+       dsb
+
+       @ Compute CPU number
+       lsr     r9, r9, #10
+       and     r9, r9, #0xf
+
+       movw    r8, #(SUN6I_CPUCFG_BASE & 0xffff)
+       movt    r8, #(SUN6I_CPUCFG_BASE >> 16)
+
+       @ Wait for the core to enter WFI
+       lsl     r11, r9, #6             @ x64
+       add     r11, r11, r8
+
+1:     ldr     r10, [r11, #0x48]
+       tst     r10, #(1 << 2)
+       bne     2f
+       timer_wait r10, ONE_MS
+       b       1b
+
+       @ Reset CPU
+2:     mov     r10, #0
+       str     r10, [r11, #0x40]
+
+       @ Lock CPU
+       mov     r10, #1
+       lsl     r11, r10, r9            @ r11 is now CPU mask
+       ldr     r10, [r8, #0x1e4]
+       bic     r10, r10, r11
+       str     r10, [r8, #0x1e4]
+
+       movw    r8, #(SUNXI_PRCM_BASE & 0xffff)
+       movt    r8, #(SUNXI_PRCM_BASE >> 16)
+
+       @ Set power gating
+       ldr     r10, [r8, #0x100]
+       orr     r10, r10, r11
+       str     r10, [r8, #0x100]
+       timer_wait r10, ONE_MS
+
+#ifdef CONFIG_MACH_SUN6I
+       @ Activate power clamp
+       lsl     r12, r9, #2             @ x4
+       add     r12, r12, r8
+       mov     r10, #0xff
+       str     r10, [r12, #0x140]
+#endif
+
+       movw    r8, #(SUN6I_CPUCFG_BASE & 0xffff)
+       movt    r8, #(SUN6I_CPUCFG_BASE >> 16)
+
+       @ Unlock CPU
+       ldr     r10, [r8, #0x1e4]
+       orr     r10, r10, r11
+       str     r10, [r8, #0x1e4]
+
+       @ Restore security level
+out:   mcr     p15, 0, r7, c1, c1, 0
+
+       pop     {r0-r12}
+       subs    pc, lr, #4
+
+       @ r1 = target CPU
+       @ r2 = target PC
+.globl psci_cpu_on
+psci_cpu_on:
+       push    {lr}
+
+       mov     r0, r1
+       bl      psci_get_cpu_stack_top  @ get stack top of target CPU
+       str     r2, [r0]                @ store target PC at stack top
+       dsb
+
+       movw    r0, #(SUN6I_CPUCFG_BASE & 0xffff)
+       movt    r0, #(SUN6I_CPUCFG_BASE >> 16)
+
+       @ CPU mask
+       and     r1, r1, #3      @ only care about first cluster
+       mov     r4, #1
+       lsl     r4, r4, r1
+
+       ldr     r6, =psci_cpu_entry
+       str     r6, [r0, #0x1a4] @ PRIVATE_REG (boot vector)
+
+       @ Assert reset on target CPU
+       mov     r6, #0
+       lsl     r5, r1, #6      @ 64 bytes per CPU
+       add     r5, r5, #0x40   @ Offset from base
+       add     r5, r5, r0      @ CPU control block
+       str     r6, [r5]        @ Reset CPU
+
+       @ l1 invalidate
+       ldr     r6, [r0, #0x184] @ CPUCFG_GEN_CTRL_REG
+       bic     r6, r6, r4
+       str     r6, [r0, #0x184]
+
+       @ Lock CPU (Disable external debug access)
+       ldr     r6, [r0, #0x1e4] @ CPUCFG_DBG_CTL1_REG
+       bic     r6, r6, r4
+       str     r6, [r0, #0x1e4]
+
+       movw    r0, #(SUNXI_PRCM_BASE & 0xffff)
+       movt    r0, #(SUNXI_PRCM_BASE >> 16)
+
+#ifdef CONFIG_MACH_SUN6I
+       @ Release power clamp
+       lsl     r5, r1, #2      @ 1 register per CPU
+       add     r5, r5, r0      @ PRCM
+       movw    r6, #0x1ff
+       movt    r6, #0
+1:     lsrs    r6, r6, #1
+       str     r6, [r5, #0x140] @ CPUx_PWR_CLAMP
+       bne     1b
+#endif
+
+       timer_wait r6, TEN_MS
+
+       @ Clear power gating
+       ldr     r6, [r0, #0x100] @ CPU_PWROFF_GATING
+       bic     r6, r6, r4
+       str     r6, [r0, #0x100]
+
+       @ re-calculate CPU control register address
+       movw    r0, #(SUN6I_CPUCFG_BASE & 0xffff)
+       movt    r0, #(SUN6I_CPUCFG_BASE >> 16)
+
+       @ Deassert reset on target CPU
+       mov     r6, #3
+       lsl     r5, r1, #6      @ 64 bytes per CPU
+       add     r5, r5, #0x40   @ Offset from base
+       add     r5, r5, r0      @ CPU control block
+       str     r6, [r5]
+
+       @ Unlock CPU (Enable external debug access)
+       ldr     r6, [r0, #0x1e4] @ CPUCFG_DBG_CTL1_REG
+       orr     r6, r6, r4
+       str     r6, [r0, #0x1e4]
+
+       mov     r0, #ARM_PSCI_RET_SUCCESS       @ Return PSCI_RET_SUCCESS
+       pop     {pc}
+
+.globl psci_cpu_off
+psci_cpu_off:
+       bl      psci_cpu_off_common
+
+       @ Ask CPU0 to pull the rug...
+       movw    r0, #(GICD_BASE & 0xffff)
+       movt    r0, #(GICD_BASE >> 16)
+       movw    r1, #15                         @ SGI15
+       movt    r1, #1                          @ Target is CPU0
+       str     r1, [r0, #GICD_SGIR]
+       dsb
+
+1:     wfi
+       b       1b
+
+.globl psci_arch_init
+psci_arch_init:
+       mov     r6, lr
+
+       movw    r4, #(GICD_BASE & 0xffff)
+       movt    r4, #(GICD_BASE >> 16)
+
+       ldr     r5, [r4, #GICD_IGROUPRn]
+       bic     r5, r5, #(1 << 15)      @ SGI15 as Group-0
+       str     r5, [r4, #GICD_IGROUPRn]
+
+       mov     r5, #0                  @ Set SGI15 priority to 0
+       strb    r5, [r4, #(GICD_IPRIORITYRn + 15)]
+
+       add     r4, r4, #0x1000         @ GICC address
+
+       mov     r5, #0xff
+       str     r5, [r4, #GICC_PMR]     @ Be cool with non-secure
+
+       ldr     r5, [r4, #GICC_CTLR]
+       orr     r5, r5, #(1 << 3)       @ Switch FIQEn on
+       str     r5, [r4, #GICC_CTLR]
+
+       mrc     p15, 0, r5, c1, c1, 0   @ Read SCR
+       orr     r5, r5, #4              @ Enable FIQ in monitor mode
+       bic     r5, r5, #1              @ Secure mode
+       mcr     p15, 0, r5, c1, c1, 0   @ Write SCR
+       isb
+
+       bl      psci_get_cpu_id         @ CPU ID => r0
+       bl      psci_get_cpu_stack_top  @ stack top => r0
+       mov     sp, r0
+
+       bx      r6
+
+       .globl psci_text_end
+psci_text_end:
+       .popsection
diff --git a/arch/arm/cpu/armv7/sunxi/psci_sun7i.S b/arch/arm/cpu/armv7/sunxi/psci_sun7i.S
new file mode 100644 (file)
index 0000000..bbfeec8
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2013 - ARM Ltd
+ * Author: Marc Zyngier <marc.zyngier@arm.com>
+ *
+ * Based on code by Carl van Schaik <carl@ok-labs.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <asm/gic.h>
+#include <asm/macro.h>
+#include <asm/psci.h>
+#include <asm/arch/cpu.h>
+
+/*
+ * Memory layout:
+ *
+ * SECURE_RAM to text_end :
+ *     ._secure_text section
+ * text_end to ALIGN_PAGE(text_end):
+ *     nothing
+ * ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x1000)
+ *     1kB of stack per CPU (4 CPUs max).
+ */
+
+       .pushsection ._secure.text, "ax"
+
+       .arch_extension sec
+
+#define        ONE_MS                  (CONFIG_TIMER_CLK_FREQ / 1000)
+#define        TEN_MS                  (10 * ONE_MS)
+#define        GICD_BASE               0x1c81000
+#define        GICC_BASE               0x1c82000
+
+.macro timer_wait      reg, ticks
+       @ Program CNTP_TVAL
+       movw    \reg, #(\ticks & 0xffff)
+       movt    \reg, #(\ticks >> 16)
+       mcr     p15, 0, \reg, c14, c2, 0
+       isb
+       @ Enable physical timer, mask interrupt
+       mov     \reg, #3
+       mcr     p15, 0, \reg, c14, c2, 1
+       @ Poll physical timer until ISTATUS is on
+1:     isb
+       mrc     p15, 0, \reg, c14, c2, 1
+       ands    \reg, \reg, #4
+       bne     1b
+       @ Disable timer
+       mov     \reg, #0
+       mcr     p15, 0, \reg, c14, c2, 1
+       isb
+.endm
+
+.globl psci_fiq_enter
+psci_fiq_enter:
+       push    {r0-r12}
+
+       @ Switch to secure
+       mrc     p15, 0, r7, c1, c1, 0
+       bic     r8, r7, #1
+       mcr     p15, 0, r8, c1, c1, 0
+       isb
+
+       @ Validate reason based on IAR and acknowledge
+       movw    r8, #(GICC_BASE & 0xffff)
+       movt    r8, #(GICC_BASE >> 16)
+       ldr     r9, [r8, #GICC_IAR]
+       movw    r10, #0x3ff
+       movt    r10, #0
+       cmp     r9, r10                 @ skip spurious interrupt 1023
+       beq     out
+       movw    r10, #0x3fe             @ ...and 1022
+       cmp     r9, r10
+       beq     out
+       str     r9, [r8, #GICC_EOIR]    @ acknowledge the interrupt
+       dsb
+
+       @ Compute CPU number
+       lsr     r9, r9, #10
+       and     r9, r9, #0xf
+
+       movw    r8, #(SUN7I_CPUCFG_BASE & 0xffff)
+       movt    r8, #(SUN7I_CPUCFG_BASE >> 16)
+
+       @ Wait for the core to enter WFI
+       lsl     r11, r9, #6             @ x64
+       add     r11, r11, r8
+
+1:     ldr     r10, [r11, #0x48]
+       tst     r10, #(1 << 2)
+       bne     2f
+       timer_wait r10, ONE_MS
+       b       1b
+
+       @ Reset CPU
+2:     mov     r10, #0
+       str     r10, [r11, #0x40]
+
+       @ Lock CPU
+       mov     r10, #1
+       lsl     r9, r10, r9             @ r9 is now CPU mask
+       ldr     r10, [r8, #0x1e4]
+       bic     r10, r10, r9
+       str     r10, [r8, #0x1e4]
+
+       @ Set power gating
+       ldr     r10, [r8, #0x1b4]
+       orr     r10, r10, #1
+       str     r10, [r8, #0x1b4]
+       timer_wait r10, ONE_MS
+
+       @ Activate power clamp
+       mov     r10, #1
+1:     str     r10, [r8, #0x1b0]
+       lsl     r10, r10, #1
+       orr     r10, r10, #1
+       tst     r10, #0x100
+       beq     1b
+
+       @ Restore security level
+out:   mcr     p15, 0, r7, c1, c1, 0
+
+       pop     {r0-r12}
+       subs    pc, lr, #4
+
+       @ r1 = target CPU
+       @ r2 = target PC
+.globl psci_cpu_on
+psci_cpu_on:
+       push    {lr}
+
+       mov     r0, r1
+       bl      psci_get_cpu_stack_top  @ get stack top of target CPU
+       str     r2, [r0]                @ store target PC at stack top
+       dsb
+
+       movw    r0, #(SUN7I_CPUCFG_BASE & 0xffff)
+       movt    r0, #(SUN7I_CPUCFG_BASE >> 16)
+
+       @ CPU mask
+       and     r1, r1, #3      @ only care about first cluster
+       mov     r4, #1
+       lsl     r4, r4, r1
+
+       ldr     r6, =psci_cpu_entry
+       str     r6, [r0, #0x1a4] @ PRIVATE_REG (boot vector)
+
+       @ Assert reset on target CPU
+       mov     r6, #0
+       lsl     r5, r1, #6      @ 64 bytes per CPU
+       add     r5, r5, #0x40   @ Offset from base
+       add     r5, r5, r0      @ CPU control block
+       str     r6, [r5]        @ Reset CPU
+
+       @ l1 invalidate
+       ldr     r6, [r0, #0x184] @ CPUCFG_GEN_CTRL_REG
+       bic     r6, r6, r4
+       str     r6, [r0, #0x184]
+
+       @ Lock CPU (Disable external debug access)
+       ldr     r6, [r0, #0x1e4] @ CPUCFG_DBG_CTL1_REG
+       bic     r6, r6, r4
+       str     r6, [r0, #0x1e4]
+
+       @ Release power clamp
+       movw    r6, #0x1ff
+       movt    r6, #0
+1:     lsrs    r6, r6, #1
+       str     r6, [r0, #0x1b0] @ CPU1_PWR_CLAMP
+       bne     1b
+
+       timer_wait r1, TEN_MS
+
+       @ Clear power gating
+       ldr     r6, [r0, #0x1b4] @ CPU1_PWROFF_REG
+       bic     r6, r6, #1
+       str     r6, [r0, #0x1b4]
+
+       @ Deassert reset on target CPU
+       mov     r6, #3
+       str     r6, [r5]
+
+       @ Unlock CPU (Enable external debug access)
+       ldr     r6, [r0, #0x1e4] @ CPUCFG_DBG_CTL1_REG
+       orr     r6, r6, r4
+       str     r6, [r0, #0x1e4]
+
+       mov     r0, #ARM_PSCI_RET_SUCCESS       @ Return PSCI_RET_SUCCESS
+       pop     {pc}
+
+.globl psci_cpu_off
+psci_cpu_off:
+       bl      psci_cpu_off_common
+
+       @ Ask CPU0 to pull the rug...
+       movw    r0, #(GICD_BASE & 0xffff)
+       movt    r0, #(GICD_BASE >> 16)
+       movw    r1, #15                         @ SGI15
+       movt    r1, #1                          @ Target is CPU0
+       str     r1, [r0, #GICD_SGIR]
+       dsb
+
+1:     wfi
+       b       1b
+
+.globl psci_arch_init
+psci_arch_init:
+       mov     r6, lr
+
+       movw    r4, #(GICD_BASE & 0xffff)
+       movt    r4, #(GICD_BASE >> 16)
+
+       ldr     r5, [r4, #GICD_IGROUPRn]
+       bic     r5, r5, #(1 << 15)      @ SGI15 as Group-0
+       str     r5, [r4, #GICD_IGROUPRn]
+
+       mov     r5, #0                  @ Set SGI15 priority to 0
+       strb    r5, [r4, #(GICD_IPRIORITYRn + 15)]
+
+       add     r4, r4, #0x1000         @ GICC address
+
+       mov     r5, #0xff
+       str     r5, [r4, #GICC_PMR]     @ Be cool with non-secure
+
+       ldr     r5, [r4, #GICC_CTLR]
+       orr     r5, r5, #(1 << 3)       @ Switch FIQEn on
+       str     r5, [r4, #GICC_CTLR]
+
+       mrc     p15, 0, r5, c1, c1, 0   @ Read SCR
+       orr     r5, r5, #4              @ Enable FIQ in monitor mode
+       bic     r5, r5, #1              @ Secure mode
+       mcr     p15, 0, r5, c1, c1, 0   @ Write SCR
+       isb
+
+       bl      psci_get_cpu_id         @ CPU ID => r0
+       bl      psci_get_cpu_stack_top  @ stack top => r0
+       mov     sp, r0
+
+       bx      r6
+
+       .globl psci_text_end
+psci_text_end:
+       .popsection
index 6d11fa479b7d7340629bed8718f871020418f5f1..ea7dc4c0730821bfdc1978036b926f3ebf0871b5 100644 (file)
@@ -32,4 +32,8 @@
 #define CONFIG_SYS_SH_SDHI2_BASE 0xEE160000
 #define CONFIG_SYS_SH_SDHI_NR_CHANNEL 3
 
+#define R8A7794_CUT_ES2                2
+#define IS_R8A7794_ES2()       \
+       (rmobile_get_cpu_rev_integer() == R8A7794_CUT_ES2)
+
 #endif /* __ASM_ARCH_R8A7794_H */
index 63c33190b8cd5a036d799a4265c90a13e866f7cc..58aff1687af357eca4439d1c55243def8cc8dc56 100644 (file)
@@ -39,7 +39,7 @@ struct sunxi_ccm_reg {
        u32 apb0_gate;          /* 0x68 apb0 module clock gating */
        u32 apb1_gate;          /* 0x6c apb1 module clock gating */
        u8 res4[0x10];
-       u32 nand_sclk_cfg;      /* 0x80 nand sub clock control */
+       u32 nand0_clk_cfg;      /* 0x80 nand sub clock control */
        u32 ms_sclk_cfg;        /* 0x84 memory stick sub clock control */
        u32 sd0_clk_cfg;        /* 0x88 sd0 clock control */
        u32 sd1_clk_cfg;        /* 0x8c sd1 clock control */
@@ -177,7 +177,7 @@ struct sunxi_ccm_reg {
 #define AHB_GATE_OFFSET_ACE            16
 #define AHB_GATE_OFFSET_DLL            15
 #define AHB_GATE_OFFSET_SDRAM          14
-#define AHB_GATE_OFFSET_NAND           13
+#define AHB_GATE_OFFSET_NAND0          13
 #define AHB_GATE_OFFSET_MS             12
 #define AHB_GATE_OFFSET_MMC3           11
 #define AHB_GATE_OFFSET_MMC2           10
index 6465f215e8a01252239bc2ce027e983424e9d285..8a26b9fc51ab280f2e2870aa9419d8b070755a1f 100644 (file)
@@ -215,11 +215,14 @@ struct sunxi_ccm_reg {
 #define AHB_GATE_OFFSET_USB0           24
 #define AHB_GATE_OFFSET_MCTL           14
 #define AHB_GATE_OFFSET_GMAC           17
+#define AHB_GATE_OFFSET_NAND0          13
+#define AHB_GATE_OFFSET_NAND1          12
 #define AHB_GATE_OFFSET_MMC3           11
 #define AHB_GATE_OFFSET_MMC2           10
 #define AHB_GATE_OFFSET_MMC1           9
 #define AHB_GATE_OFFSET_MMC0           8
 #define AHB_GATE_OFFSET_MMC(n)         (AHB_GATE_OFFSET_MMC0 + (n))
+#define AHB_GATE_OFFSET_DMA            6
 #define AHB_GATE_OFFSET_SS             5
 
 /* ahb_gate1 offsets */
index c506b0a98f4f927cffea964929906a0c1e4164ee..a61934fb366173ca2682d880d9386091a5123c2f 100644 (file)
@@ -42,7 +42,7 @@ struct sunxi_ccm_reg {
        u32 clk_output_b;       /* 0x184 clk_output_a */
        u8 reserved5[0x278];    /* 0x188 */
 
-       u32 nand0_clk_cfg0;     /* 0x400 nand0 clock configuration0 */
+       u32 nand0_clk_cfg     /* 0x400 nand0 clock configuration0 */
        u32 nand0_clk_cfg1;     /* 0x404 nand1 clock configuration */
        u8 reserved6[0x08];     /* 0x408 */
        u32 sd0_clk_cfg;        /* 0x410 sd0 clock configuration */
@@ -113,8 +113,12 @@ struct sunxi_ccm_reg {
 
 /* ahb_gate0 fields */
 /* On sun9i all sdc-s share their ahb gate, so ignore (x) */
+#define AHB_GATE_OFFSET_NAND0          13
 #define AHB_GATE_OFFSET_MMC(x)         8
 
+/* ahb gate1 field */
+#define AHB_GATE_OFFSET_DMA            24
+
 /* apb1_gate fields */
 #define APB1_GATE_UART_SHIFT           16
 #define APB1_GATE_UART_MASK            (0xff << APB1_GATE_UART_SHIFT)
diff --git a/arch/arm/include/asm/arch-sunxi/dma.h b/arch/arm/include/asm/arch-sunxi/dma.h
new file mode 100644 (file)
index 0000000..e54a2ba
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * (C) Copyright 2015 Roy Spliet <rspliet@ultimaker.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_DMA_H
+#define _SUNXI_DMA_H
+
+#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN5I) || defined(CONFIG_MACH_SUN7I)
+#include <asm/arch/dma_sun4i.h>
+#else
+#error "DMA definition not available for this architecture"
+#endif
+
+#endif /* _SUNXI_DMA_H */
diff --git a/arch/arm/include/asm/arch-sunxi/dma_sun4i.h b/arch/arm/include/asm/arch-sunxi/dma_sun4i.h
new file mode 100644 (file)
index 0000000..778a04b
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * (C) Copyright 2015 Roy Spliet <rspliet@ultimaker.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_DMA_SUN4I_H
+#define _SUNXI_DMA_SUN4I_H
+
+struct sunxi_dma_cfg
+{
+       u32 ctl;                /* 0x00 Control */
+       u32 src_addr;           /* 0x04 Source address */
+       u32 dst_addr;           /* 0x08 Destination address */
+       u32 bc;                 /* 0x0C Byte counter */
+       u32 res0[2];
+       u32 ddma_para;          /* 0x18 extra parameter (dedicated DMA only) */
+       u32 res1;
+};
+
+struct sunxi_dma
+{
+       u32 irq_en;                     /* 0x000 IRQ enable */
+       u32 irq_pend;                   /* 0x004 IRQ pending */
+       u32 auto_gate;                  /* 0x008 auto gating */
+       u32 res0[61];
+       struct sunxi_dma_cfg ndma[8];   /* 0x100 Normal DMA */
+       u32 res1[64];
+       struct sunxi_dma_cfg ddma[8];   /* 0x300 Dedicated DMA */
+};
+
+enum ddma_drq_type {
+       DDMA_DST_DRQ_SRAM = 0,
+       DDMA_SRC_DRQ_SRAM = 0,
+       DDMA_DST_DRQ_SDRAM = 1,
+       DDMA_SRC_DRQ_SDRAM = 1,
+       DDMA_DST_DRQ_PATA = 2,
+       DDMA_SRC_DRQ_PATA = 2,
+       DDMA_DST_DRQ_NAND = 3,
+       DDMA_SRC_DRQ_NAND = 3,
+       DDMA_DST_DRQ_USB0 = 4,
+       DDMA_SRC_DRQ_USB0 = 4,
+       DDMA_DST_DRQ_ETHERNET_MAC_TX = 6,
+       DDMA_SRC_DRQ_ETHERNET_MAC_RX = 7,
+       DDMA_DST_DRQ_SPI1_TX = 8,
+       DDMA_SRC_DRQ_SPI1_RX = 9,
+       DDMA_DST_DRQ_SECURITY_SYS_TX = 10,
+       DDMA_SRC_DRQ_SECURITY_SYS_RX = 11,
+       DDMA_DST_DRQ_TCON0 = 14,
+       DDMA_DST_DRQ_TCON1 = 15,
+       DDMA_DST_DRQ_MSC = 23,
+       DDMA_SRC_DRQ_MSC = 23,
+       DDMA_DST_DRQ_SPI0_TX = 26,
+       DDMA_SRC_DRQ_SPI0_RX = 27,
+       DDMA_DST_DRQ_SPI2_TX = 28,
+       DDMA_SRC_DRQ_SPI2_RX = 29,
+       DDMA_DST_DRQ_SPI3_TX = 30,
+       DDMA_SRC_DRQ_SPI3_RX = 31,
+};
+
+#define SUNXI_DMA_CTL_SRC_DRQ(a)               ((a) & 0x1f)
+#define SUNXI_DMA_CTL_MODE_IO                  (1 << 5)
+#define SUNXI_DMA_CTL_SRC_DATA_WIDTH_32                (2 << 9)
+#define SUNXI_DMA_CTL_DST_DRQ(a)               (((a) & 0x1f) << 16)
+#define SUNXI_DMA_CTL_DST_DATA_WIDTH_32                (2 << 25)
+#define SUNXI_DMA_CTL_TRIGGER                  (1 << 31)
+
+#endif /* _SUNXI_DMA_SUN4I_H */
index 148123a87f3288c07dbf41d0fe7d115d2f47c287..b628fee3ea910a017b4762a61f6789c7c772ce89 100644 (file)
@@ -157,6 +157,8 @@ enum sunxi_gpio_number {
 #define SUN5I_GPB_UART0                2
 #define SUN8I_GPB_UART2                2
 
+#define SUNXI_GPC_NAND         2
+
 #define SUNXI_GPC_SDC2         3
 #define SUN6I_GPC_SDC3         4
 
@@ -185,6 +187,7 @@ enum sunxi_gpio_number {
 #define SUN8I_GPH_TWI1         2
 #define SUN6I_GPH_TWI2         2
 #define SUN6I_GPH_UART0                2
+#define SUN9I_GPH_UART0                2
 
 #define SUNXI_GPI_SDC3         2
 #define SUN7I_GPI_TWI3         3
diff --git a/arch/arm/include/asm/arch-sunxi/nand.h b/arch/arm/include/asm/arch-sunxi/nand.h
new file mode 100644 (file)
index 0000000..22844d8
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * (C) Copyright 2015 Roy Spliet <rspliet@ultimaker.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_NAND_H
+#define _SUNXI_NAND_H
+
+#include <linux/types.h>
+
+struct sunxi_nand
+{
+       u32 ctl;                /* 0x000 Configure and control */
+       u32 st;                 /* 0x004 Status information */
+       u32 intr;               /* 0x008 Interrupt control */
+       u32 timing_ctl;         /* 0x00C Timing control */
+       u32 timing_cfg;         /* 0x010 Timing configure */
+       u32 addr_low;           /* 0x014 Low word address */
+       u32 addr_high;          /* 0x018 High word address */
+       u32 block_num;          /* 0x01C Data block number */
+       u32 data_cnt;           /* 0x020 Data counter for transfer */
+       u32 cmd;                /* 0x024 NDFC commands */
+       u32 rcmd_set;           /* 0x028 Read command set for vendor NAND mem */
+       u32 wcmd_set;           /* 0x02C Write command set */
+       u32 io_data;            /* 0x030 IO data */
+       u32 ecc_ctl;            /* 0x034 ECC configure and control */
+       u32 ecc_st;             /* 0x038 ECC status and operation info */
+       u32 efr;                /* 0x03C Enhanced feature */
+       u32 err_cnt0;           /* 0x040 Corrected error bit counter 0 */
+       u32 err_cnt1;           /* 0x044 Corrected error bit counter 1 */
+       u32 user_data[16];      /* 0x050[16] User data field */
+       u32 efnand_st;          /* 0x090 EFNAND status */
+       u32 res0[3];
+       u32 spare_area;         /* 0x0A0 Spare area configure */
+       u32 pat_id;             /* 0x0A4 Pattern ID register */
+       u32 rdata_sta_ctl;      /* 0x0A8 Read data status control */
+       u32 rdata_sta_0;        /* 0x0AC Read data status 0 */
+       u32 rdata_sta_1;        /* 0x0B0 Read data status 1 */
+       u32 res1[3];
+       u32 mdma_addr;          /* 0x0C0 MBUS DMA Address */
+       u32 mdma_cnt;           /* 0x0C4 MBUS DMA data counter */
+};
+
+#define SUNXI_NAND_CTL_EN                      (1 << 0)
+#define SUNXI_NAND_CTL_RST                     (1 << 1)
+#define SUNXI_NAND_CTL_PAGE_SIZE(a)            ((fls(a) - 11) << 8)
+#define SUNXI_NAND_CTL_RAM_METHOD_DMA          (1 << 14)
+
+#define SUNXI_NAND_ST_CMD_INT                  (1 << 1)
+#define SUNXI_NAND_ST_DMA_INT                  (1 << 2)
+#define SUNXI_NAND_ST_FIFO_FULL                        (1 << 3)
+
+#define SUNXI_NAND_CMD_ADDR_CYCLES(a)          ((a - 1) << 16);
+#define SUNXI_NAND_CMD_SEND_CMD1               (1 << 22)
+#define SUNXI_NAND_CMD_WAIT_FLAG               (1 << 23)
+#define SUNXI_NAND_CMD_ORDER_INTERLEAVE                0
+#define SUNXI_NAND_CMD_ORDER_SEQ               (1 << 25)
+
+#define SUNXI_NAND_ECC_CTL_ECC_EN              (1 << 0)
+#define SUNXI_NAND_ECC_CTL_PIPELINE            (1 << 3)
+#define SUNXI_NAND_ECC_CTL_BS_512B             (1 << 5)
+#define SUNXI_NAND_ECC_CTL_RND_EN              (1 << 9)
+#define SUNXI_NAND_ECC_CTL_MODE(a)             ((a) << 12)
+#define SUNXI_NAND_ECC_CTL_RND_SEED(a)         ((a) << 16)
+
+#endif /* _SUNXI_NAND_H */
index 2d27c49673bb14fcf5f4508ccefa56bd56c415d2..feda49e0a69fad06db12cfb741a6e191dd590dfa 100644 (file)
@@ -1,5 +1,4 @@
-menu "Panasonic UniPhier platform"
-       depends on ARCH_UNIPHIER
+if ARCH_UNIPHIER
 
 config SYS_CONFIG_NAME
        default "uniphier"
@@ -9,7 +8,7 @@ config UNIPHIER_SMP
 
 choice
        prompt "UniPhier SoC select"
-       optional
+       default MACH_PH1_PRO4
 
 config MACH_PH1_PRO4
        bool "PH1-Pro4"
@@ -78,4 +77,4 @@ config DDR_FREQ
        default 1333 if DDR_FREQ_1333
        default 1600 if DDR_FREQ_1600
 
-endmenu
+endif
index 0622a1e16e0dfc3a63b04fa46f962538958eca66..a7530eb23b5292fe8a59abc1b2b6d67ffb415e31 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -8,7 +7,7 @@
 #include <common.h>
 #include <spl.h>
 #include <nand.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <../drivers/mtd/nand/denali.h>
 
 static void nand_denali_wp_disable(void)
index d8b82288537e6ef18a56b428091ce15006ead667..bf85ad6fd9aa8b9fb1709e16fc97ac97ee26b9c0 100644 (file)
@@ -1,13 +1,11 @@
 /*
- * Copyright (C) 2012-2014 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/armv7.h>
 #include <mach/ssc-regs.h>
 
index 5f44927b171ecd7719f47e623e91762142967389..dbbefd424b9abec52d5eb8b012b7d66affbfc5ae 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/ddrphy-regs.h>
 
 /* Select either decimal or hexadecimal */
index 13a0b1e48fbcf5503f7b7742f135ca61aa4f7a6a..c4ba6d249eb212dfdd35f8963dc0bac140f5f3cc 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2013-2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2013-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sg-regs.h>
 
 int print_cpuinfo(void)
index b1d46cf627f7931702b4c5569edff07937eabf3b..a98b814df07f343d145c0a2ef116311f0f7b452f 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/ddrphy-regs.h>
 
 void ddrphy_prepare_training(struct ddrphy __iomem *phy, int rank)
@@ -116,10 +115,8 @@ int ddrphy_training(struct ddrphy __iomem *phy)
 
        do {
                if (--timeout < 0) {
-#ifndef CONFIG_SPL_BUILD
                        printf("%s: error: timeout during DDR training\n",
                                                                __func__);
-#endif
                        return -1;
                }
                udelay(1);
@@ -128,10 +125,8 @@ int ddrphy_training(struct ddrphy __iomem *phy)
 
        for (i = 0; i < ARRAY_SIZE(init_sequence); i++) {
                if (pgsr0 & init_sequence[i].err_flag) {
-#ifndef CONFIG_SPL_BUILD
                        printf("%s: error: %s failed\n", __func__,
                                                init_sequence[i].description);
-#endif
                        return -1;
                }
        }
index 6b7d600a9c624cab1c71f46659badb1db3a1aad0..fce0c01246b097f6b6bbe1a27709f9a4a99317ed 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * UniPhier DDR PHY registers
  *
- * Copyright (C) 2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -37,7 +36,10 @@ struct ddrphy {
        u32 dtar[4];            /* Data Training Address Register */
        u32 dtdr[2];            /* Data Training Data Register */
        u32 dtedr[2];           /* Data Training Eye Data Register */
-       u32 rsv0[13];           /* Reserved */
+       u32 pgcr2;              /* PHY General Configuration Register 2 */
+       u32 rsv0[8];            /* Reserved */
+       u32 rdimmgcr[2];        /* RDIMM General Configuration Register */
+       u32 rdimmcr0[2];        /* RDIMM Control Register */
        u32 dcuar;              /* DCU Address Register */
        u32 dcudr;              /* DCU Data Register */
        u32 dcurr;              /* DCU Run Register */
@@ -70,7 +72,8 @@ struct ddrphy {
                u32 lcdlr[3];   /* Local Calibrated Delay Line Register */
                u32 mdlr;       /* Master Delay Line Register */
                u32 gtr;        /* General Timing Register */
-               u32 rsv[3];     /* Reserved */
+               u32 gsr2;       /* General Status Register 2 */
+               u32 rsv[2];     /* Reserved */
        } dx[9];
 };
 
index af55feed04799b3bf013dc0095c096f496ef1cee..d2b431f5443ffd68864218dc7486fbe6d8f2a73d 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -17,8 +16,8 @@
 
        .macro          init_debug_uart, ra, rb, rc
        addruart        \ra, \rb, \rc
-       mov             \rb, #UART_LCR_WLEN8
-       strb            \rb, [\ra, #0x11]
+       mov             \rb, #UART_LCR_WLEN8 << 8
+       str             \rb, [\ra, #0x10]
        ldr             \rb, =DIVISOR
        str             \rb, [\ra, #0x24]
        .endm
index 21277dac76729ca216eb840181738d3312093f72..f7749b486017337600623c435f59ea6d3588642c 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2012-2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -77,7 +76,7 @@
 
 #else /* __ASSEMBLY__ */
 
-#include <asm/io.h>
+#include <linux/io.h>
 
 #define led_write(C0, C1, C2, C3)              \
 do {                                           \
index efb68e8564944216b6e1abc5c4935d66f239cd3a..493363bb6427be87ee9cdbb5edf76a5c741b636b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * UniPhier SBC (System Bus Controller) registers
  *
- * Copyright (C) 2011-2014 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -99,7 +99,7 @@
 #define ROM_BOOT_ROMRSV2               0x59801208
 
 #ifndef __ASSEMBLY__
-#include <asm/io.h>
+#include <linux/io.h>
 static inline int boot_is_swapped(void)
 {
        return !(readl(SBBASE0) & SBBASE_BANK_ENABLE);
index 63408d5ba74cca755ff470b2ac71170d08c28d23..a65f058ee2321b00a1bfcceb54b3f0587b54967e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * UniPhier SG (SoC Glue) block registers
  *
- * Copyright (C) 2011-2015 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #else
 
 #include <linux/types.h>
-#include <asm/io.h>
+#include <linux/io.h>
 
 static inline void sg_set_pinsel(int n, int value)
 {
index 825b16076245be7fdb1f74c55a3ea6da4c3929b1..fd34a4a32193c361d669fb890b45b82a7e381777 100644 (file)
@@ -1,7 +1,5 @@
 /*
- * Copyright (C) 2012-2015 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -67,20 +65,6 @@ secondary_startup:
         *  jump to Linux
         *  kick secondaries   ---(sev)--->    jump to Linux
         */
-       /*
-        * ACTLR (Auxiliary Control Register) for Cortex-A9
-        * bit[9]  Parity on
-        * bit[8]  Alloc in one way
-        * bit[7]  EXCL (Exclusive cache bit)
-        * bit[6]  SMP
-        * bit[3]  Write full line of zeros mode
-        * bit[2]  L1 prefetch enable
-        * bit[1]  L2 prefetch enable
-        * bit[0]  FW (Cache and TLB maintenance broadcast)
-        */
-       mrc     p15, 0, r0, c1, c0, 1   @ ACTLR (Auxiliary Control Register)
-       orr     r0, r0, #0x41           @ enable SMP, FW bit
-       mcr     p15, 0, r0, c1, c0, 1
 
        /* branch by CPU ID */
        mrc     p15, 0, r0, c0, c0, 5   @ MPIDR (Multiprocessor Affinity Register)
@@ -112,12 +96,6 @@ primary_cpu:
        str     r0, [r1]
        ldr     r0, [r1]                @ make sure str is complete before sev
        sev                             @ kick the secondary CPU
-       mrc     p15, 4, r1, c15, c0, 0  @ Configuration Base Address Register
-       bfc     r1, #0, #13             @ clear bit 12-0
-       mov     r0, #-1
-       str     r0, [r1, #SCU_INV_ALL]  @ SCU Invalidate All Register
-       mov     r0, #1                  @ SCU enable
-       str     r0, [r1, #SCU_CTRL]     @ SCU Control Register
 #endif
 
        bl      setup_init_ram          @ RAM area for temporary stack pointer
index bf3c177ed9ea6218e6285ce42d9f0a11cc4246a2..59ed0b5dd8f4dc7c2a662da2ed6b67087c309863 100644 (file)
@@ -1,13 +1,12 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <linux/sizes.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sg-regs.h>
 
 static inline u32 sg_memconf_val_ch0(unsigned long size, int num)
index 837e0d1fcc20684170b1814c0167c25e670d7cf8..a7bc15e7e068cd8aaea08d06621949558d7cc917 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/bcu-regs.h>
 
 #define ch(x) ((x) >= 32 ? 0 : (x) < 0 ? 0x11111111 : 0x11111111 << (x))
index 4ac5411562ad5cc4dd5ef32fb915a8737090d18e..2de81f0a5609c7de807724d1fcea43ed0798a31b 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sc-regs.h>
 
 void clkrst_init(void)
index a47e87a71493f797cfdd8a283caa1e54294a1a96..2add8fa691f9164c11fd0170a53a79f07d1a794c 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <linux/types.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/ddrphy-regs.h>
 
 void ddrphy_init(struct ddrphy __iomem *phy, int freq, int size)
index 3074d0a8d243410a659ae125fe9d30cc0ea00fad..20cc7b30c4dcd0bc03b48bd080afff0fc1d42f57 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sg-regs.h>
 
 void pin_init(void)
index 985e14f4a9062ddd69f2e4fa4009052e2aea577c..f8ec2b61fb443d7fe57febd94da986b1b9c5556e 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sc-regs.h>
 #include <mach/sg-regs.h>
 
index 00f84614f68174d6285fc8cd1082dccd075d2e88..8e25792b501e97e9b4df17ea23c992aa3f3dbd8e 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sbc-regs.h>
 #include <mach/sg-regs.h>
 
index 374a8c06800bc5632b940b9324961d02c7f37138..5b5958be053272db436dcceec915c3099ce942ae 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sbc-regs.h>
 #include <mach/sg-regs.h>
 
index 93e44afd1906e4e6600e7152bec916e6fefacf7a..dab56e949c1de2f9b8a8faab4fc66e1c71bf5d9a 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sg-regs.h>
 
 void sg_init(void)
index 081b028c0cec263a8fd4020f8457315a167ae074..a7a4157e793982954f960ac324b909f3957452d1 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/umc-regs.h>
 #include <mach/ddrphy-regs.h>
 
index 9894c1a9c0168340042e928d1f0ee1b30d016bad..54a2510b97f7cf770e147de300d89e92c455461e 100644 (file)
@@ -1,13 +1,12 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <spl.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/boot-device.h>
 #include <mach/sg-regs.h>
 #include <mach/sbc-regs.h>
index 054efa653773a9249dfebb173ef820fc4459d634..46cace77e54127ccda9dda0bcbecfa862864d82f 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sc-regs.h>
 
 void clkrst_init(void)
index 7df5aea0f30b9520f85f81181b67be936667c97c..61ddcf4ec632efe105b2e89868d159982cdf4c85 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <linux/types.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/ddrphy-regs.h>
 
 void ddrphy_init(struct ddrphy __iomem *phy, int freq, int size)
index 37bb79e25a11c955aa8db9110f7415beae44f3f2..60204b53ba5abddaaa2d94ddc6b116db9c5d8eea 100644 (file)
@@ -1,13 +1,12 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <spl.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sc-regs.h>
 
 void early_clkrst_init(void)
index 85bb6a0b9c9b60f59502b457829b5e2aa11e498b..e78d6ab501f8f0c2a5bef49f67c0250a59e657ba 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sg-regs.h>
 
 void early_pin_init(void)
index 4df9098ef07fd694cde3234cd341fea071ad248c..2a5a296f882e83c3e1cb6d89ab5c953218ffbbf3 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sg-regs.h>
 
 void pin_init(void)
@@ -28,6 +27,8 @@ void pin_init(void)
        sg_set_pinsel(52, 0);   /* XNFWP  -> XNFWP */
        sg_set_pinsel(53, 0);   /* XNFCE0 -> XNFCE0 */
        sg_set_pinsel(54, 0);   /* NRYBY0 -> NRYBY0 */
+       /* sg_set_pinsel(131, 1); */    /* RXD2   -> NRYBY1 */
+       /* sg_set_pinsel(132, 1); */    /* TXD2   -> XNFCE1 */
 #endif
 
 #ifdef CONFIG_USB_XHCI_UNIPHIER
index 2a965a5e67397c167db4f4f4d1c1a77a6203bcdc..d693368816c8670fd6bc132e72edd25974ccdd55 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sc-regs.h>
 #include <mach/sg-regs.h>
 
index ff9c73ff21d5a6f5b42dac85cecc6ebcd5e0485b..fcf2ad282a76f08fc90047229db1e300349847e2 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sc-regs.h>
 
 void enable_dpll_ssc(void)
index 5e75454dcb178cbcc2118709f76cde4e420c65ba..533739c364d534850e83992856fce5ad649967c9 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sbc-regs.h>
 #include <mach/sg-regs.h>
 
index 67e6d8245b26fd6fd1798f9b7f64c9a4a96b0a50..877ba79f68dd85e51ee7aa608e2317fd22bb7cbe 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sbc-regs.h>
 #include <mach/sg-regs.h>
 
index 8677666323d1c0f5f33e9766da2a378d53193c14..d6ccffbbc3e002af43978a632e844c5df11b9cdf 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sg-regs.h>
 
 void sg_init(void)
index 6cbb6b2473b6d18f67808e23f185ba9a6366b867..bd8b9d83b2bd4bd950c9f3399dfc9c9981b13bc3 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/umc-regs.h>
 #include <mach/ddrphy-regs.h>
 
index 304edfb482ba165e77c9ba7689be2c03acba2044..21efe62da6b29fae66feae8bb4bd2847b58d897b 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <config.h>
 #include <linux/types.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/ddrphy-regs.h>
 
 void ddrphy_init(struct ddrphy __iomem *phy, int freq, int size)
index 57a80930482b0900aa70196f9102d47c4c9af905..130c8317366df4f3c44d7cc6ab8fd5ad018cf373 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sg-regs.h>
 
 void pin_init(void)
@@ -46,7 +45,7 @@ void pin_init(void)
        sg_set_pinsel(42, 0);   /* USB0OD   -> USB0OD */
        sg_set_pinsel(43, 0);   /* USB1VBUS -> USB1VBUS */
        sg_set_pinsel(44, 0);   /* USB1OD   -> USB1OD */
-       /* sg_set_pinsel(114, 4); */ /* TXD1 -> USB2VBUS (shared with UART) */
-       /* sg_set_pinsel(115, 4); */ /* RXD1 -> USB2OD */
+       /* sg_set_pinsel(114, 1); */ /* TXD1 -> USB2VBUS (shared with UART) */
+       /* sg_set_pinsel(115, 1); */ /* RXD1 -> USB2OD */
 #endif
 }
index 885100747dc1fce21961bf14e5eb192f616e45f1..109cb5fee08af68be9885e0fd1abde61cb9d5e68 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sc-regs.h>
 #include <mach/sg-regs.h>
 
index fdef88e1268a7e132469b6c20249a9cb8dba69ed..c2267c73eeb053aaf67016e3311b4c9c1cdc58f1 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2011-2015 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sbc-regs.h>
 #include <mach/sg-regs.h>
 
index 302611e5d2a9ea04fb39492a467867b8dc6b0330..7baea7e8528089a454a9c009be188e96735619cd 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (C) 2011-2014 Panasonic Corporation
+ * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/umc-regs.h>
 #include <mach/ddrphy-regs.h>
 
index 005fbcf0b8ef8bfd264ad751f0c5231f725c0447..4c825116f745890ddff3d7de6a413a6442a84921 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2012-2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/sc-regs.h>
 
 void reset_cpu(unsigned long ignored)
index 77cc794e61a6dc6f279f677f4f0aeebd619c4aab..ea85b20e979c02749a83360d102d6b1abc91a0d4 100644 (file)
@@ -1,13 +1,11 @@
 /*
- * Copyright (C) 2012-2015 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/board.h>
 
 #if defined(CONFIG_PFC_MICRO_SUPPORT_CARD)
index adef08d2ded76a5e8d259b0fd00c797b6a684e31..27ada2924c9577c4cb0a96fcf834a109d0e5f035 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2012-2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <mach/arm-mpcore.h>
 
 #define PERIPHCLK (50 * 1000 * 1000) /* 50 MHz */
index e4896fba14087766ba874e81154f902357fdd81f..ded69e7785b676e64c1091b6099b9dc458579aeb 100644 (file)
@@ -3,7 +3,7 @@
  *
  * common board information header for B&R boards
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at>
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:    GPL-2.0+
index 5b356fbbbdf6da1b5174e27250301706fe6777bc..7830d1a200e1b0334e9f292c24693a09f016e3a0 100644 (file)
@@ -3,7 +3,7 @@
  *
  * common board functions for B&R boards
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at>
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:    GPL-2.0+
index c28fb49fe4db0a8157054deb137b408236071fe9..ca7d329144dc24d0b3430b550018e7dbbe105aae 100644 (file)
@@ -1,5 +1,5 @@
 KWB BOARD
-M:     Hannes Petermaier <hannes.petermaier@br-automation.com>
+M:     Hannes Schmelzer <hannes.schmelzer@br-automation.com>
 S:     Maintained
 F:     board/BuR/kwb/
 F:     include/configs/kwb.h
index 7b04b26ae4e9ebab3c0ef9da25ff1bf83f678400..782664c36e506107fd59d94790ecb356c7fbe1d4 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Makefile
 #
-# Copyright (C) 2014 Hannes Petermaier <oe5hpm@oevsv.at> -
+# Copyright (C) 2014 Hannes Schmelzer <oe5hpm@oevsv.at> -
 # Bernecker & Rainer Industrielektronik GmbH - http://www.br-automation.com/
 #
 # SPDX-License-Identifier:     GPL-2.0+
index 01dd1d9915bd54a5c82a13503272e9176db63e4f..640aca4cdec12eca25905b8334ba319a7d9f6577 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Board functions for B&R KWB Board
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at>
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:    GPL-2.0+
index 2b1d8d3b1db458006a0e2bd99b5672649d575f04..40224f76f675e49c58613e9d223ee98035829a98 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Pinmux Setting for B&R LEIT Board(s)
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at>
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:    GPL-2.0+
index e57326aaf3f36a716dc0a614cb2834dd75d1a452..e2e67e6bbf4d1927628629aafa941e114c04e075 100644 (file)
@@ -1,5 +1,5 @@
 TSERIES BOARD
-M:     Hannes Petermaier <hannes.petermaier@br-automation.com>
+M:     Hannes Schmelzer <hannes.schmelzer@br-automation.com>
 S:     Maintained
 F:     board/BuR/tseries/
 F:     include/configs/tseries.h
index ec0d27a7aa8bd9dd4530f6b4cfc2004681ee58ef..43945d285d5e441e5071ea140287e6cea43694e0 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Makefile
 #
-# Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at>
+# Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
 # Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
 #
 # SPDX-License-Identifier:     GPL-2.0+
index d1d698e7d2489603d079037d77fc8d51a44b81b4..bc119e69736edcfd90620cf97caeb726140e7c62 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Board functions for B&R LEIT Board
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at>
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:    GPL-2.0+
index c5dc4b762524122d2f579f8d505d36f77128408d..349788a83570c7617718652e8e85da13f51dddd5 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Pinmux Setting for B&R LEIT Board(s)
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at>
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:    GPL-2.0+
index 957962de20e03d15360db04c633221fbf80e7891..39d53c185b2616c865c8505a57ded448a33c7dab 100644 (file)
@@ -9,4 +9,13 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
        default "alt"
 
+config R8A7794_ETHERNET_B
+       bool "Use ethernet B function"
+       depends on TARGET_ALT
+       default n
+       help
+         ALT board can use default ethernet and etnernet B function.
+         This config set pin function of ethenet B. You also needt to change
+         DIP switch of board in order to use this function.
+
 endif
index f0010db814a83aced0566223a88147076c7ac6b1..3501a170442c2c2ef2ee3356cd44399fdf21463c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * board/renesas/alt/alt.c
  *
- * Copyright (C) 2014 Renesas Electronics Corporation
+ * Copyright (C) 2014, 2015 Renesas Electronics Corporation
  *
  * SPDX-License-Identifier: GPL-2.0
  */
@@ -94,6 +94,20 @@ int board_init(void)
        r8a7794_pinmux_init();
 
        /* Ether Enable */
+#if defined(CONFIG_R8A7794_ETHERNET_B)
+       gpio_request(GPIO_FN_ETH_CRS_DV_B, NULL);
+       gpio_request(GPIO_FN_ETH_RX_ER_B, NULL);
+       gpio_request(GPIO_FN_ETH_RXD0_B, NULL);
+       gpio_request(GPIO_FN_ETH_RXD1_B, NULL);
+       gpio_request(GPIO_FN_ETH_LINK_B, NULL);
+       gpio_request(GPIO_FN_ETH_REFCLK_B, NULL);
+       gpio_request(GPIO_FN_ETH_MDIO_B, NULL);
+       gpio_request(GPIO_FN_ETH_TXD1_B, NULL);
+       gpio_request(GPIO_FN_ETH_TX_EN_B, NULL);
+       gpio_request(GPIO_FN_ETH_MAGIC_B, NULL);
+       gpio_request(GPIO_FN_ETH_TXD0_B, NULL);
+       gpio_request(GPIO_FN_ETH_MDC_B, NULL);
+#else
        gpio_request(GPIO_FN_ETH_CRS_DV, NULL);
        gpio_request(GPIO_FN_ETH_RX_ER, NULL);
        gpio_request(GPIO_FN_ETH_RXD0, NULL);
@@ -106,6 +120,7 @@ int board_init(void)
        gpio_request(GPIO_FN_ETH_MAGIC, NULL);
        gpio_request(GPIO_FN_ETH_TXD0, NULL);
        gpio_request(GPIO_FN_ETH_MDC, NULL);
+#endif
        gpio_request(GPIO_FN_IRQ8, NULL);
 
        /* PHY reset */
index f0b349f18f5fc91cc353ff2bbecd8f6f68e23575..b6324c8fd7cf15ae1e32dc88824fc967cca2d5ee 100644 (file)
@@ -14,7 +14,7 @@
 #include <asm/arch/rmobile.h>
 
 #if defined(CONFIG_RMOBILE_EXTRAM_BOOT)
-/* QoS version 0.11 */
+/* QoS version 0.311 for ES1 and version 0.321 for ES2 */
 
 enum {
        DBSC3_00, DBSC3_01, DBSC3_02, DBSC3_03, DBSC3_04,
@@ -62,6 +62,24 @@ static u32 dbsc3_0_w_qos_addr[DBSC3_NR] = {
        [DBSC3_15] = DBSC3_0_QOS_W15_BASE,
 };
 
+#if defined(CONFIG_QOS_PRI_MEDIA)
+#define is_qos_pri_media()     1
+#else
+#define is_qos_pri_media()     0
+#endif
+
+#if defined(CONFIG_QOS_PRI_NORMAL)
+#define is_qos_pri_normal()    1
+#else
+#define is_qos_pri_normal()    0
+#endif
+
+#if defined(CONFIG_QOS_PRI_GFX)
+#define is_qos_pri_gfx()       1
+#else
+#define is_qos_pri_gfx()       0
+#endif
+
 void qos_init(void)
 {
        int i;
@@ -77,30 +95,57 @@ void qos_init(void)
 
        /* S3C -QoS */
        s3c = (struct rcar_s3c *)S3C_BASE;
-       writel(0x1F0D0B0A, &s3c->s3crorr);
-       writel(0x1F0D0B09, &s3c->s3cworr);
-
+       if (is_qos_pri_media()) {
+               writel(0x1F0B0604, &s3c->s3crorr);
+               writel(0x1F0E0705, &s3c->s3cworr);
+       } else if (is_qos_pri_normal()) {
+               writel(0x1F0B0908, &s3c->s3crorr);
+               writel(0x1F0E0A08, &s3c->s3cworr);
+       } else if (is_qos_pri_media()) {
+               writel(0x1F0B0B0B, &s3c->s3crorr);
+               writel(0x1F0E0C0C, &s3c->s3cworr);
+       }
        /* QoS Control Registers */
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_CCI0_BASE;
        writel(0x00890089, &s3c_qos->s3cqos0);
        writel(0x20960010, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
-       writel(0x20AA2200, &s3c_qos->s3cqos3);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_media())
+               writel(0x20AA2100, &s3c_qos->s3cqos3);
        writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x20960010, &s3c_qos->s3cqos5);
        writel(0x20302030, &s3c_qos->s3cqos6);
-       writel(0x20AA2200, &s3c_qos->s3cqos7);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos7);
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_CCI1_BASE;
        writel(0x00890089, &s3c_qos->s3cqos0);
        writel(0x20960010, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
-       writel(0x20AA2200, &s3c_qos->s3cqos3);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos3);
        writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x20960010, &s3c_qos->s3cqos5);
        writel(0x20302030, &s3c_qos->s3cqos6);
-       writel(0x20AA2200, &s3c_qos->s3cqos7);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_media())
+               writel(0x20AA2200, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_media())
+               writel(0x20AA2100, &s3c_qos->s3cqos7);
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_MXI_BASE;
@@ -115,7 +160,7 @@ void qos_init(void)
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_AXI_BASE;
-       writel(0x00820082, &s3c_qos->s3cqos0);
+       writel(0x00820092, &s3c_qos->s3cqos0);
        writel(0x20960020, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
        writel(0x20AA20FA, &s3c_qos->s3cqos3);
@@ -157,8 +202,13 @@ void qos_init(void)
        }
 
        /* CCI-400 -QoS */
-       writel(0x20000800, CCI_400_MAXOT_1);
-       writel(0x20000800, CCI_400_MAXOT_2);
+       if (IS_R8A7794_ES2()) {
+               writel(0x20001000, CCI_400_MAXOT_1);
+               writel(0x20001000, CCI_400_MAXOT_2);
+       } else {
+               writel(0x20000800, CCI_400_MAXOT_1);
+               writel(0x20000800, CCI_400_MAXOT_2);
+       }
        writel(0x0000000C, CCI_400_QOSCNTL_1);
        writel(0x0000000C, CCI_400_QOSCNTL_2);
 
@@ -166,7 +216,7 @@ void qos_init(void)
        /* Transaction Control (MXI) */
        mxi = (struct rcar_mxi *)MXI_BASE;
        writel(0x00000013, &mxi->mxrtcr);
-       writel(0x00000013, &mxi->mxwtcr);
+       writel(0x00000016, &mxi->mxwtcr);
        writel(0x00780080, &mxi->mxsaar0);
        writel(0x02000800, &mxi->mxsaar1);
 
@@ -449,7 +499,7 @@ void qos_init(void)
 
        /* QoS Register (RT-AXI) */
        axi_qos = (struct rcar_axi_qos *)RT_AXI_SHX_BASE;
-       writel(0x00000000, &axi_qos->qosconf);
+       writel(0x00000001, &axi_qos->qosconf);
        writel(0x00002053, &axi_qos->qosctset0);
        writel(0x00002096, &axi_qos->qosctset1);
        writel(0x00002030, &axi_qos->qosctset2);
index 64e52cf3a426e01074e22f37a837a70479469530..413ad1124bb4fb4f10d971898b5946692158a623 100644 (file)
@@ -14,7 +14,7 @@
 #include <asm/arch/rmobile.h>
 
 #if defined(CONFIG_RMOBILE_EXTRAM_BOOT)
-/* QoS version 0.20 */
+/* QoS version 0.311 */
 enum {
        DBSC3_00, DBSC3_01, DBSC3_02, DBSC3_03, DBSC3_04,
        DBSC3_05, DBSC3_06, DBSC3_07, DBSC3_08, DBSC3_09,
@@ -61,6 +61,24 @@ static u32 dbsc3_0_w_qos_addr[DBSC3_NR] = {
        [DBSC3_15] = DBSC3_0_QOS_W15_BASE,
 };
 
+#if defined(CONFIG_QOS_PRI_MEDIA)
+#define is_qos_pri_media()     1
+#else
+#define is_qos_pri_media()     0
+#endif
+
+#if defined(CONFIG_QOS_PRI_NORMAL)
+#define is_qos_pri_normal()    1
+#else
+#define is_qos_pri_normal()    0
+#endif
+
+#if defined(CONFIG_QOS_PRI_GFX)
+#define is_qos_pri_gfx()       1
+#else
+#define is_qos_pri_gfx()       0
+#endif
+
 void qos_init(void)
 {
        int i;
@@ -77,34 +95,62 @@ void qos_init(void)
        /* S3C -QoS */
        s3c = (struct rcar_s3c *)S3C_BASE;
        writel(0x00000000, &s3c->s3cadsplcr);
-       writel(0x1F0B0908, &s3c->s3crorr);
-       writel(0x1F0C0A08, &s3c->s3cworr);
-
+       if (is_qos_pri_media()) {
+               writel(0x1F0B0604, &s3c->s3crorr);
+               writel(0x1F0E0705, &s3c->s3cworr);
+       } else if (is_qos_pri_normal()) {
+               writel(0x1F0B0908, &s3c->s3crorr);
+               writel(0x1F0C0A08, &s3c->s3cworr);
+       } else if (is_qos_pri_gfx()) {
+               writel(0x1F0B0B0B, &s3c->s3crorr);
+               writel(0x1F0E0C0C, &s3c->s3cworr);
+       }
        /* QoS Control Registers */
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_CCI0_BASE;
        writel(0x00890089, &s3c_qos->s3cqos0);
        writel(0x20960010, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
-       writel(0x20AA2200, &s3c_qos->s3cqos3);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos3);
        writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x20960010, &s3c_qos->s3cqos5);
        writel(0x20302030, &s3c_qos->s3cqos6);
-       writel(0x20AA2200, &s3c_qos->s3cqos7);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos7);
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_CCI1_BASE;
        writel(0x00890089, &s3c_qos->s3cqos0);
        writel(0x20960010, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
-       writel(0x20AA2200, &s3c_qos->s3cqos3);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos3);
        writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x20960010, &s3c_qos->s3cqos5);
        writel(0x20302030, &s3c_qos->s3cqos6);
-       writel(0x20AA2200, &s3c_qos->s3cqos7);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos7);
+       writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_MXI_BASE;
-       writel(0x00820082, &s3c_qos->s3cqos0);
+       writel(0x00820092, &s3c_qos->s3cqos0);
        writel(0x20960020, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
        writel(0x20AA20DC, &s3c_qos->s3cqos3);
@@ -115,7 +161,7 @@ void qos_init(void)
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_AXI_BASE;
-       writel(0x00820082, &s3c_qos->s3cqos0);
+       writel(0x00820092, &s3c_qos->s3cqos0);
        writel(0x20960020, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
        writel(0x20AA20FA, &s3c_qos->s3cqos3);
@@ -166,11 +212,13 @@ void qos_init(void)
        /* Transaction Control (MXI) */
        mxi = (struct rcar_mxi *)MXI_BASE;
        writel(0x00000013, &mxi->mxrtcr);
-       writel(0x00000013, &mxi->mxwtcr);
+       writel(0x00000016, &mxi->mxwtcr);
        writel(0x00200000, &mxi->mxs3cracr);
        writel(0x00200000, &mxi->mxs3cwacr);
        writel(0x00200000, &mxi->mxaxiracr);
        writel(0x00200000, &mxi->mxaxiwacr);
+       writel(0x00780080, &mxi->mxsaar0);
+       writel(0x02000800, &mxi->mxsaar1);
 
        /* QoS Control (MXI) */
        mxi_qos = (struct rcar_mxi_qos *)MXI_QOS_BASE;
@@ -554,7 +602,7 @@ void qos_init(void)
 
        /* QoS Register (RT-AXI) */
        axi_qos = (struct rcar_axi_qos *)RT_AXI_SHX_BASE;
-       writel(0x00000000, &axi_qos->qosconf);
+       writel(0x00000001, &axi_qos->qosconf);
        writel(0x00002053, &axi_qos->qosctset0);
        writel(0x00002096, &axi_qos->qosctset1);
        writel(0x00002030, &axi_qos->qosctset2);
index d293e3d7fcc86acdb489f9b2bd116fb41b93b26e..8cb2b48f574571f390cfdeaab11441ff92893740 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/io.h>
 #include <asm/arch/rmobile.h>
 
-/* QoS version 0.240 for ES1 and version 0.334 for ES2 */
+/* QoS version 0.240 for ES1 and version 0.411 for ES2 */
 #if defined(CONFIG_RMOBILE_EXTRAM_BOOT)
 enum {
        DBSC3_00, DBSC3_01, DBSC3_02, DBSC3_03, DBSC3_04,
@@ -99,6 +99,24 @@ static u32 dbsc3_1_w_qos_addr[DBSC3_NR] = {
        [DBSC3_15] = DBSC3_1_QOS_W15_BASE,
 };
 
+#if defined(CONFIG_QOS_PRI_MEDIA)
+#define is_qos_pri_media()     1
+#else
+#define is_qos_pri_media()     0
+#endif
+
+#if defined(CONFIG_QOS_PRI_NORMAL)
+#define is_qos_pri_normal()    1
+#else
+#define is_qos_pri_normal()    0
+#endif
+
+#if defined(CONFIG_QOS_PRI_GFX)
+#define is_qos_pri_gfx()       1
+#else
+#define is_qos_pri_gfx()       0
+#endif
+
 void qos_init(void)
 {
        int i;
@@ -124,8 +142,17 @@ void qos_init(void)
                /* writel(0x00DF1B0C, &s3c->s3cadsplcr); */
                /* Ssplit All mode */
                /* writel(0x00FF1B0C, &s3c->s3cadsplcr); */
-               writel(0x1F0B0908, &s3c->s3crorr);
-               writel(0x1F0C0A08, &s3c->s3cworr);
+
+               if (is_qos_pri_media()) {
+                       writel(0x1F0B0604, &s3c->s3crorr);
+                       writel(0x1F0E0705, &s3c->s3cworr);
+               } else if (is_qos_pri_normal()) {
+                       writel(0x1F0B0908, &s3c->s3crorr);
+                       writel(0x1F0E0A08, &s3c->s3cworr);
+               } else if (is_qos_pri_gfx()) {
+                       writel(0x1F0B0B0B, &s3c->s3crorr);
+                       writel(0x1F0E0C0C, &s3c->s3cworr);
+               }
        } else {
                writel(0x00FF1B1D, &s3c->s3cadsplcr);
                writel(0x1F0D0C0C, &s3c->s3crorr);
@@ -136,26 +163,67 @@ void qos_init(void)
        writel(0x00890089, &s3c_qos->s3cqos0);
        writel(0x20960010, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
-       writel(0x20AA2200, &s3c_qos->s3cqos3);
+
+       if (IS_R8A7791_ES2()) {
+               if (is_qos_pri_media())
+                       writel(0x20AA2300, &s3c_qos->s3cqos3);
+               else if (is_qos_pri_normal())
+                       writel(0x20AA2200, &s3c_qos->s3cqos3);
+               else if (is_qos_pri_gfx())
+                       writel(0x20AA2100, &s3c_qos->s3cqos3);
+       } else {
+               writel(0x20AA2200, &s3c_qos->s3cqos3);
+       }
        writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x20960010, &s3c_qos->s3cqos5);
        writel(0x20302030, &s3c_qos->s3cqos6);
-       writel(0x20AA2200, &s3c_qos->s3cqos7);
+
+       if (IS_R8A7791_ES2()) {
+               if (is_qos_pri_media())
+                       writel(0x20AA2300, &s3c_qos->s3cqos7);
+               else if (is_qos_pri_normal())
+                       writel(0x20AA2200, &s3c_qos->s3cqos7);
+               else if (is_qos_pri_gfx())
+                       writel(0x20AA2100, &s3c_qos->s3cqos7);
+       } else {
+               writel(0x20AA2200, &s3c_qos->s3cqos7);
+       }
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_CCI1_BASE;
        writel(0x00890089, &s3c_qos->s3cqos0);
        writel(0x20960010, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
-       writel(0x20AA2200, &s3c_qos->s3cqos3);
+       if (IS_R8A7791_ES2()) {
+               if (is_qos_pri_media())
+                       writel(0x20AA2300, &s3c_qos->s3cqos3);
+               else if (is_qos_pri_normal())
+                       writel(0x20AA2200, &s3c_qos->s3cqos3);
+               else if (is_qos_pri_gfx())
+                       writel(0x20AA2100, &s3c_qos->s3cqos3);
+       } else {
+               writel(0x20AA2200, &s3c_qos->s3cqos3);
+       }
        writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x20960010, &s3c_qos->s3cqos5);
        writel(0x20302030, &s3c_qos->s3cqos6);
-       writel(0x20AA2200, &s3c_qos->s3cqos7);
+       if (IS_R8A7791_ES2()) {
+               if (is_qos_pri_media())
+                       writel(0x20AA2300, &s3c_qos->s3cqos7);
+               else if (is_qos_pri_normal())
+                       writel(0x20AA2200, &s3c_qos->s3cqos7);
+               else if (is_qos_pri_gfx())
+                       writel(0x20AA2100, &s3c_qos->s3cqos7);
+       } else {
+               writel(0x20AA2200, &s3c_qos->s3cqos7);
+       }
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_MXI_BASE;
-       writel(0x00820082, &s3c_qos->s3cqos0);
+       if (IS_R8A7791_ES2())
+               writel(0x80928092, &s3c_qos->s3cqos0);
+       else
+               writel(0x00820082, &s3c_qos->s3cqos0);
        writel(0x20960020, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
        writel(0x20AA20DC, &s3c_qos->s3cqos3);
@@ -166,7 +234,10 @@ void qos_init(void)
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_AXI_BASE;
-       writel(0x00820082, &s3c_qos->s3cqos0);
+       if (IS_R8A7791_ES2())
+               writel(0x80928092, &s3c_qos->s3cqos0);
+       else
+               writel(0x00820082, &s3c_qos->s3cqos0);
        writel(0x20960020, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
        writel(0x20AA20FA, &s3c_qos->s3cqos3);
@@ -245,9 +316,15 @@ void qos_init(void)
 
        /* MXI -QoS */
        /* Transaction Control (MXI) */
-       mxi = (struct rcar_mxi *)MXI_BASE;
+       mxi = (struct rcar_mxi *)XI_BASE;
        writel(0x00000013, &mxi->mxrtcr);
-       writel(0x00000013, &mxi->mxwtcr);
+       if (IS_R8A7791_ES2()) {
+               writel(0x00000016, &mxi->mxwtcr);
+               writel(0x00780080, &mxi->mxsaar0);
+               writel(0x02000800, &mxi->mxsaar1);
+       } else {
+               writel(0x00000013, &mxi->mxwtcr);
+       }
 
        /* QoS Control (MXI) */
        mxi_qos = (struct rcar_mxi_qos *)MXI_QOS_BASE;
@@ -632,7 +709,10 @@ void qos_init(void)
 
        /* QoS Register (RT-AXI) */
        axi_qos = (struct rcar_axi_qos *)RT_AXI_SHX_BASE;
-       writel(0x00000000, &axi_qos->qosconf);
+       if (IS_R8A7791_ES2())
+               writel(0x00000001, &axi_qos->qosconf);
+       else
+               writel(0x00000000, &axi_qos->qosconf);
        writel(0x00002053, &axi_qos->qosctset0);
        writel(0x00002096, &axi_qos->qosctset1);
        writel(0x00002030, &axi_qos->qosctset2);
index dec37d2bf9c9fe9e547e718af7e17c14436b65d5..ae155512f58a35fdc4dfa3455e19302f83924459 100644 (file)
@@ -12,7 +12,7 @@
 #include <asm/io.h>
 #include <asm/arch/rmobile.h>
 
-/* QoS version 0.955 for ES1 and version 0.963 for ES2 */
+/* QoS version 0.955 for ES1 and version 0.973 for ES2 */
 #if defined(CONFIG_RMOBILE_EXTRAM_BOOT)
 enum {
        DBSC3_00, DBSC3_01, DBSC3_02, DBSC3_03, DBSC3_04,
@@ -1133,6 +1133,24 @@ static void qos_init_es1(void)
        writel(0x00000000, &axi_qos->qosqon);
 }
 
+#if defined(CONFIG_QOS_PRI_MEDIA)
+#define is_qos_pri_media()     1
+#else
+#define is_qos_pri_media()     0
+#endif
+
+#if defined(CONFIG_QOS_PRI_NORMAL)
+#define is_qos_pri_normal()    1
+#else
+#define is_qos_pri_normal()    0
+#endif
+
+#if defined(CONFIG_QOS_PRI_GFX)
+#define is_qos_pri_gfx()       1
+#else
+#define is_qos_pri_gfx()       0
+#endif
+
 /* QoS version 0.963 for ES2 */
 static void qos_init_es2(void)
 {
@@ -1150,30 +1168,57 @@ static void qos_init_es2(void)
        /* S3C -QoS */
        s3c = (struct rcar_s3c *)S3C_BASE;
        writel(0x80000000, &s3c->s3cadsplcr);
-       writel(0x1F060504, &s3c->s3crorr);
-       writel(0x1F060503, &s3c->s3cworr);
-
+       if (is_qos_pri_media()) {
+               writel(0x1F060302, &s3c->s3crorr);
+               writel(0x07070302, &s3c->s3cworr);
+       } else if (is_qos_pri_normal()) {
+               writel(0x1F060504, &s3c->s3crorr);
+               writel(0x07070503, &s3c->s3cworr);
+       } else if (is_qos_pri_gfx()) {
+               writel(0x1F060606, &s3c->s3crorr);
+               writel(0x07070606, &s3c->s3cworr);
+       }
        /* QoS Control Registers */
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_CCI0_BASE;
        writel(0x00890089, &s3c_qos->s3cqos0);
        writel(0x20960010, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
-       writel(0x20AA2200, &s3c_qos->s3cqos3);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos3);
        writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x20960010, &s3c_qos->s3cqos5);
        writel(0x20302030, &s3c_qos->s3cqos6);
-       writel(0x20AA2200, &s3c_qos->s3cqos7);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos7);
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_CCI1_BASE;
        writel(0x00890089, &s3c_qos->s3cqos0);
        writel(0x20960010, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
-       writel(0x20AA2200, &s3c_qos->s3cqos3);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos3);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos3);
        writel(0x00002032, &s3c_qos->s3cqos4);
        writel(0x20960010, &s3c_qos->s3cqos5);
        writel(0x20302030, &s3c_qos->s3cqos6);
-       writel(0x20AA2200, &s3c_qos->s3cqos7);
+       if (is_qos_pri_media())
+               writel(0x20AA2300, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_normal())
+               writel(0x20AA2200, &s3c_qos->s3cqos7);
+       else if (is_qos_pri_gfx())
+               writel(0x20AA2100, &s3c_qos->s3cqos7);
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_MXI_BASE;
@@ -1188,7 +1233,7 @@ static void qos_init_es2(void)
        writel(0x00002032, &s3c_qos->s3cqos8);
 
        s3c_qos = (struct rcar_s3c_qos *)S3C_QOS_AXI_BASE;
-       writel(0x00820082, &s3c_qos->s3cqos0);
+       writel(0x00828092, &s3c_qos->s3cqos0);
        writel(0x20960020, &s3c_qos->s3cqos1);
        writel(0x20302030, &s3c_qos->s3cqos2);
        writel(0x20AA20FA, &s3c_qos->s3cqos3);
@@ -1198,7 +1243,7 @@ static void qos_init_es2(void)
        writel(0x20AA20FA, &s3c_qos->s3cqos7);
        writel(0x00002032, &s3c_qos->s3cqos8);
 
-       writel(0x00200808, &s3c->s3carcr11);
+       writel(0x00310808, &s3c->s3carcr11);
 
        /* DBSC -QoS */
        /* DBSC0 - Read */
@@ -1235,7 +1280,7 @@ static void qos_init_es2(void)
        /* Transaction Control (MXI) */
        mxi = (struct rcar_mxi *)MXI_BASE;
        writel(0x00000013, &mxi->mxrtcr);
-       writel(0x00000013, &mxi->mxwtcr);
+       writel(0x00000016, &mxi->mxwtcr);
        writel(0x00B800C0, &mxi->mxsaar0);
        writel(0x02000800, &mxi->mxsaar1);
 
@@ -1622,7 +1667,7 @@ static void qos_init_es2(void)
 
        /* QoS Register (RT-AXI) */
        axi_qos = (struct rcar_axi_qos *)RT_AXI_SHX_BASE;
-       writel(0x00000000, &axi_qos->qosconf);
+       writel(0x00000001, &axi_qos->qosconf);
        writel(0x00002053, &axi_qos->qosctset0);
        writel(0x00002096, &axi_qos->qosctset1);
        writel(0x00002030, &axi_qos->qosctset2);
index a5ffc671a9b5cd05f423c063e30363abc9e12e6c..e744d4af4e434f8e224902b6989974d4e497d39a 100644 (file)
@@ -35,8 +35,11 @@ config MACH_SUN5I
 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)"
@@ -50,14 +53,25 @@ config MACH_SUN7I
 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_SUN9I
+       bool "sun9i (Allwinner A80)"
+       select CPU_V7
+       select SUNXI_GEN_SUN6I
 
 endchoice
 
@@ -187,6 +201,7 @@ config SYS_CONFIG_NAME
        default "sun6i" if MACH_SUN6I
        default "sun7i" if MACH_SUN7I
        default "sun8i" if MACH_SUN8I
+       default "sun9i" if MACH_SUN9I
 
 config SYS_BOARD
        default "sunxi"
@@ -194,24 +209,8 @@ config SYS_BOARD
 config SYS_SOC
        default "sunxi"
 
-config SPL_FEL
-       bool "SPL/FEL mode support"
-       depends on SPL
-       default n
-       help
-         This enables support for Fast Early Loader (FEL) mode. This
-         allows U-Boot to be loaded to the board over USB by the on-chip
-         boot rom. U-Boot should be sent in two parts: SPL first, with
-         'fel write 0x2000 u-boot-spl.bin; fel exe 0x2000' then U-Boot with
-         'fel write 0x4a000000 u-boot.bin; fel exe 0x4a000000'. This option
-         shrinks the amount of SRAM available to SPL, so only enable it if
-         you need FEL. Note that enabling this option only allows FEL to be
-         used; it is still possible to boot U-Boot from boot media. U-Boot
-         SPL detects when it is being loaded using FEL.
-
 config UART0_PORT_F
        bool "UART0 on MicroSD breakout board"
-       depends on SPL_FEL
        default n
        ---help---
        Repurpose the SD card slot for getting access to the UART0 serial
@@ -281,6 +280,18 @@ config MMC_SUNXI_SLOT_EXTRA
        slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable
        support for this.
 
+config SPL_NAND_SUPPORT
+       bool "SPL/NAND mode support"
+       depends on SPL
+       default n
+       ---help---
+         This enables support for booting from NAND internal
+         memory. U-Boot SPL doesn't detect where is it load from,
+         therefore this option is needed to properly load image from
+         flash. Option also disables MMC functionality on U-Boot due to
+         initialization errors encountered, when both controllers are
+         enabled.
+
 config USB0_VBUS_PIN
        string "Vbus enable pin for usb0 (otg)"
        default ""
index a65055493838be8d2458c0a683435c97e122e0a2..22d560a2334281155fd58a39571e836bbafa0d8f 100644 (file)
@@ -40,6 +40,8 @@ F:    include/configs/sun8i.h
 F:     configs/ga10h_v1_1_defconfig
 F:     configs/Ippo_q8h_v1_2_defconfig
 F:     configs/Ippo_q8h_v1_2_a33_1024x600_defconfig
+F:     include/configs/sun9i.h
+F:     configs/Merrii_A80_Optimus_defconfig
 
 A20-OLINUXINO-LIME BOARD
 M:     FUKAUMI Naoki <naobsd@gmail.com>
index 5f79cc1bb8249987ddc19bc5a58d8032a5f75b30..f27967bbf418faa32e136e4c764eb29fc7281a46 100644 (file)
@@ -22,6 +22,9 @@
 #ifdef CONFIG_AXP221_POWER
 #include <axp221.h>
 #endif
+#ifdef CONFIG_NAND_SUNXI
+#include <nand.h>
+#endif
 #include <asm/arch/clock.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/display.h>
@@ -315,6 +318,21 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#ifdef CONFIG_NAND
+void board_nand_init(void)
+{
+       unsigned int pin;
+       static u8 ports[] = CONFIG_NAND_SUNXI_GPC_PORTS;
+
+       /* Configure AHB muxes to connect output pins with NAND controller */
+       for (pin = 0; pin < 16; pin++)
+               sunxi_gpio_set_cfgpin(SUNXI_GPC(pin), SUNXI_GPC_NAND);
+
+       for (pin = 0; pin < ARRAY_SIZE(ports); pin++)
+               sunxi_gpio_set_cfgpin(SUNXI_GPC(ports[pin]), SUNXI_GPC_NAND);
+}
+#endif
+
 void i2c_init_board(void)
 {
 #ifdef CONFIG_I2C0_ENABLE
@@ -530,10 +548,11 @@ int misc_init_r(void)
                }
        }
 
+#ifndef CONFIG_MACH_SUN9I
        ret = sunxi_usb_phy_probe();
        if (ret)
                return ret;
-
+#endif
 #if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET)
        musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE);
 #endif
index 6283f3992c7cde77d8af62143c7671a4a427cbcd..7ff8ac5df364f6cb78ec3e522948402c969f3104 100644 (file)
@@ -959,8 +959,6 @@ static int get_descriptor_len(struct usb_device *dev, int len, int expect_len)
 
 static int usb_setup_descriptor(struct usb_device *dev, bool do_read)
 {
-       __maybe_unused struct usb_device_descriptor *desc;
-
        /*
         * This is a Windows scheme of initialization sequence, with double
         * reset of the device (Linux uses the same sequence)
index 24a1a5614118d2140ca5b225180a3ab2eadb18f9..49bfc096e40904f03cdf978f37f040d81150fa65 100644 (file)
@@ -31,7 +31,7 @@ int overwrite_console(void)
 #endif
 
 /* Keyboard sampling rate */
-#define REPEAT_RATE    (40 / 4)        /* 40msec -> 25cps */
+#define REPEAT_RATE    40              /* 40msec -> 25cps */
 #define REPEAT_DELAY   10              /* 10 x REPEAT_RATE = 400msec */
 
 #define NUM_LOCK       0x53
@@ -103,6 +103,7 @@ struct usb_kbd_pdata {
        unsigned long   intpipe;
        int             intpktsize;
        int             intinterval;
+       unsigned long   last_report;
        struct int_queue *intq;
 
        uint32_t        repeat_delay;
@@ -310,7 +311,7 @@ static int usb_kbd_irq(struct usb_device *dev)
 /* Interrupt polling */
 static inline void usb_kbd_poll_for_event(struct usb_device *dev)
 {
-#if    defined(CONFIG_SYS_USB_EVENT_POLL)
+#if defined(CONFIG_SYS_USB_EVENT_POLL)
        struct usb_kbd_pdata *data = dev->privptr;
 
        /* Submit a interrupt transfer request */
@@ -318,15 +319,17 @@ static inline void usb_kbd_poll_for_event(struct usb_device *dev)
                           data->intinterval);
 
        usb_kbd_irq_worker(dev);
-#elif  defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
+#elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) || \
+      defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
+#if defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
        struct usb_interface *iface;
        struct usb_kbd_pdata *data = dev->privptr;
        iface = &dev->config.if_desc[0];
        usb_get_report(dev, iface->desc.bInterfaceNumber,
                       1, 0, data->new, USB_KBD_BOOT_REPORT_SIZE);
-       if (memcmp(data->old, data->new, USB_KBD_BOOT_REPORT_SIZE))
+       if (memcmp(data->old, data->new, USB_KBD_BOOT_REPORT_SIZE)) {
                usb_kbd_irq_worker(dev);
-#elif  defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
+#else
        struct usb_kbd_pdata *data = dev->privptr;
        if (poll_int_queue(dev, data->intq)) {
                usb_kbd_irq_worker(dev);
@@ -335,6 +338,13 @@ static inline void usb_kbd_poll_for_event(struct usb_device *dev)
                data->intq = create_int_queue(dev, data->intpipe, 1,
                                      USB_KBD_BOOT_REPORT_SIZE, data->new,
                                      data->intinterval);
+#endif
+               data->last_report = get_timer(0);
+       /* Repeat last usb hid report every REPEAT_RATE ms for keyrepeat */
+       } else if (data->last_report != -1 &&
+                  get_timer(data->last_report) > REPEAT_RATE) {
+               usb_kbd_irq_worker(dev);
+               data->last_report = get_timer(0);
        }
 #endif
 }
@@ -445,12 +455,16 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
        data->intpktsize = min(usb_maxpacket(dev, data->intpipe),
                               USB_KBD_BOOT_REPORT_SIZE);
        data->intinterval = ep->bInterval;
+       data->last_report = -1;
 
        /* We found a USB Keyboard, install it. */
        usb_set_protocol(dev, iface->desc.bInterfaceNumber, 0);
 
+#if !defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) && \
+    !defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
        debug("USB KBD: found set idle...\n");
-       usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE, 0);
+       usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE / 4, 0);
+#endif
 
        debug("USB KBD: enable interrupt pipe...\n");
 #ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
diff --git a/configs/Merrii_A80_Optimus_defconfig b/configs/Merrii_A80_Optimus_defconfig
new file mode 100644 (file)
index 0000000..6bd5273
--- /dev/null
@@ -0,0 +1,11 @@
+CONFIG_DEFAULT_DEVICE_TREE="sun9i-a80-optimus"
+CONFIG_VIDEO=n
+CONFIG_USB_KEYBOARD=n
+CONFIG_MMC0_CD_PIN="PH18"
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN9I=y
+# these are unused atm but we must set them to something
+CONFIG_DRAM_CLK=360
+CONFIG_DRAM_ZQ=123
+CONFIG_SYS_CLK_FREQ=1008000000
index 036e2d1c6986bb9989636a76d362c96c255e186e..82ce8c79b7d6f359e1be8189a17ad2354a209518 100644 (file)
@@ -3,6 +3,8 @@ CONFIG_ARCH_UNIPHIER=y
 CONFIG_SPL_DM=y
 CONFIG_MACH_PH1_LD4=y
 CONFIG_PFC_MICRO_SUPPORT_CARD=y
+CONFIG_NET=y
+CONFIG_SYS_TEXT_BASE=0x84000000
 CONFIG_DEFAULT_DEVICE_TREE="uniphier-ph1-ld4-ref"
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
@@ -30,6 +32,7 @@ CONFIG_CMD_TFTPPUT=y
 CONFIG_CMD_NFS=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_TIME=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_NAND_DENALI=y
 CONFIG_SYS_NAND_DENALI_64BIT=y
 CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8
index 9a010ee9134298603e94ead1444cc69df7f7e125..671d9cc46df9ee50217785f262b6e804f2729031 100644 (file)
@@ -1,8 +1,9 @@
 CONFIG_ARM=y
 CONFIG_ARCH_UNIPHIER=y
 CONFIG_SPL_DM=y
-CONFIG_MACH_PH1_PRO4=y
 CONFIG_PFC_MICRO_SUPPORT_CARD=y
+CONFIG_NET=y
+CONFIG_SYS_TEXT_BASE=0x84000000
 CONFIG_DEFAULT_DEVICE_TREE="uniphier-ph1-pro4-ref"
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
@@ -30,6 +31,7 @@ CONFIG_CMD_TFTPPUT=y
 CONFIG_CMD_NFS=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_TIME=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_NAND_DENALI=y
 CONFIG_SYS_NAND_DENALI_64BIT=y
 CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8
index 29fe0e8063d1618a268cb3b7999e6f84f49fdf8d..3e763dc5abcbba09f5f1955e5c92d1e622e3934a 100644 (file)
@@ -3,6 +3,8 @@ CONFIG_ARCH_UNIPHIER=y
 CONFIG_SPL_DM=y
 CONFIG_MACH_PH1_SLD8=y
 CONFIG_PFC_MICRO_SUPPORT_CARD=y
+CONFIG_NET=y
+CONFIG_SYS_TEXT_BASE=0x84000000
 CONFIG_DEFAULT_DEVICE_TREE="uniphier-ph1-sld8-ref"
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
@@ -30,6 +32,7 @@ CONFIG_CMD_TFTPPUT=y
 CONFIG_CMD_NFS=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_TIME=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_NAND_DENALI=y
 CONFIG_SYS_NAND_DENALI_64BIT=y
 CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8
index ba43019ab99afd15d3086432f8861b5462a7b819..86fb36b5d4c0266fc609a69803588f9d5067eaf0 100644 (file)
@@ -63,13 +63,13 @@ config SYS_I2C_UNIPHIER
        depends on ARCH_UNIPHIER && DM_I2C
        default y
        help
-         Support for Panasonic UniPhier I2C controller driver.  This I2C
-         controller is used on PH1-LD4, PH1-sLD8 or older UniPhier SoCs.
+         Support for UniPhier I2C controller driver.  This I2C controller
+         is used on PH1-LD4, PH1-sLD8 or older UniPhier SoCs.
 
 config SYS_I2C_UNIPHIER_F
        bool "UniPhier FIFO-builtin I2C driver"
        depends on ARCH_UNIPHIER && DM_I2C
        default y
        help
-         Support for Panasonic UniPhier FIFO-builtin I2C controller driver.
+         Support for UniPhier FIFO-builtin I2C controller driver.
          This I2C controller is used on PH1-Pro4 or newer UniPhier SoCs.
index d29dd4565d7de6b711f6adb476bb8e126c9d8899..b3349af9e184cc05477494be00e4dd1d566318ac 100644 (file)
@@ -1,14 +1,12 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
- * Copyright (C) 2015 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <linux/types.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/errno.h>
 #include <dm/device.h>
 #include <dm/root.h>
index c4972ff5012bcc5110c1c15beaf0f010ce7d1796..85b9eff5f81e7fa7e4b22450418a24c4a755f41f 100644 (file)
@@ -1,14 +1,12 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
- * Copyright (C) 2015 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <linux/types.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/errno.h>
 #include <dm/device.h>
 #include <dm/root.h>
index 0f1e35c460ca375aa517dcb4a9d098927ef91d37..79a5c94f1cd045094557fca6b564464b64084c96 100644 (file)
@@ -33,7 +33,7 @@
  *   (except for OMAP243X and OMAP34XX).
  * - Driver now supports up to I2C5 (OMAP5).
  *
- * Copyright (c) 2014 Hannes Petermaier <oe5hpm@oevsv.at>, B&R
+ * Copyright (c) 2014 Hannes Schmelzer <oe5hpm@oevsv.at>, B&R
  * - Added support for set_speed
  *
  */
index 347ea62e0b3d3fa5a33eb8097d01ce40d642be49..a0cf4d5fe4d7de12c0d81c801d18360a593c0bdd 100644 (file)
@@ -73,5 +73,6 @@ obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o
 obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_spl.o
 obj-$(CONFIG_NAND_MXC) += mxc_nand_spl.o
 obj-$(CONFIG_NAND_MXS) += mxs_nand_spl.o mxs_nand.o
+obj-$(CONFIG_NAND_SUNXI) += sunxi_nand_spl.o
 
 endif # drivers
diff --git a/drivers/mtd/nand/sunxi_nand_spl.c b/drivers/mtd/nand/sunxi_nand_spl.c
new file mode 100644 (file)
index 0000000..75982f5
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2014, Antmicro Ltd <www.antmicro.com>
+ * Copyright (c) 2015, Turtle Solutions <www.turtle-solutions.eu>
+ * Copyright (c) 2015, Roy Spliet <rspliet@ultimaker.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ *
+ * \todo Detect chip parameters (page size, ECC mode, randomisation...)
+ */
+
+#include <common.h>
+#include <config.h>
+#include <asm/io.h>
+#include <nand.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/dma.h>
+#include <asm/arch/nand.h>
+
+void
+nand_init(void)
+{
+       struct sunxi_ccm_reg * const ccm =
+                       (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+       struct sunxi_nand * const nand = (struct sunxi_nand *)SUNXI_NFC_BASE;
+       u32 val;
+
+       board_nand_init();
+
+       /* "un-gate" NAND clock and clock source
+        * This assumes that the clock was already correctly configured by
+        * BootROM */
+       setbits_le32(&ccm->ahb_gate0, (1 << 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, 0x80000000);
+
+       val = readl(&nand->ctl);
+       val |= SUNXI_NAND_CTL_RST;
+       writel(val, &nand->ctl);
+
+       /* Wait until reset pin is deasserted */
+       do {
+               val = readl(&nand->ctl);
+               if (!(val & SUNXI_NAND_CTL_RST))
+                       break;
+       } while (1);
+
+       /** \todo Chip select, currently kind of static */
+       val = readl(&nand->ctl);
+       val &= 0xf0fff0f2;
+       val |= SUNXI_NAND_CTL_EN;
+       val |= SUNXI_NAND_CTL_PAGE_SIZE(CONFIG_NAND_SUNXI_PAGE_SIZE);
+       writel(val, &nand->ctl);
+
+       writel(0x100, &nand->timing_ctl);
+       writel(0x7ff, &nand->timing_cfg);
+
+       /* reset CMD  */
+       val = SUNXI_NAND_CMD_SEND_CMD1 | SUNXI_NAND_CMD_WAIT_FLAG |
+                       NAND_CMD_RESET;
+       writel(val, &nand->cmd);
+       do {
+               val = readl(&nand->st);
+               if (val & (1<<1))
+                       break;
+               udelay(1000);
+       } while (1);
+
+       printf("Nand initialised\n");
+}
+
+int
+nand_wait_timeout(u32 *reg, u32 mask, u32 val)
+{
+       unsigned long tmo = timer_get_us() + 1000000; /* 1s */
+
+       while ((readl(reg) & mask) != val) {
+               if (timer_get_us() > tmo)
+                       return -ETIMEDOUT;
+       }
+
+       return 0;
+}
+
+/* random seed */
+static const uint16_t random_seed[128] = {
+       0x2b75, 0x0bd0, 0x5ca3, 0x62d1, 0x1c93, 0x07e9, 0x2162, 0x3a72,
+       0x0d67, 0x67f9, 0x1be7, 0x077d, 0x032f, 0x0dac, 0x2716, 0x2436,
+       0x7922, 0x1510, 0x3860, 0x5287, 0x480f, 0x4252, 0x1789, 0x5a2d,
+       0x2a49, 0x5e10, 0x437f, 0x4b4e, 0x2f45, 0x216e, 0x5cb7, 0x7130,
+       0x2a3f, 0x60e4, 0x4dc9, 0x0ef0, 0x0f52, 0x1bb9, 0x6211, 0x7a56,
+       0x226d, 0x4ea7, 0x6f36, 0x3692, 0x38bf, 0x0c62, 0x05eb, 0x4c55,
+       0x60f4, 0x728c, 0x3b6f, 0x2037, 0x7f69, 0x0936, 0x651a, 0x4ceb,
+       0x6218, 0x79f3, 0x383f, 0x18d9, 0x4f05, 0x5c82, 0x2912, 0x6f17,
+       0x6856, 0x5938, 0x1007, 0x61ab, 0x3e7f, 0x57c2, 0x542f, 0x4f62,
+       0x7454, 0x2eac, 0x7739, 0x42d4, 0x2f90, 0x435a, 0x2e52, 0x2064,
+       0x637c, 0x66ad, 0x2c90, 0x0bad, 0x759c, 0x0029, 0x0986, 0x7126,
+       0x1ca7, 0x1605, 0x386a, 0x27f5, 0x1380, 0x6d75, 0x24c3, 0x0f8e,
+       0x2b7a, 0x1418, 0x1fd1, 0x7dc1, 0x2d8e, 0x43af, 0x2267, 0x7da3,
+       0x4e3d, 0x1338, 0x50db, 0x454d, 0x764d, 0x40a3, 0x42e6, 0x262b,
+       0x2d2e, 0x1aea, 0x2e17, 0x173d, 0x3a6e, 0x71bf, 0x25f9, 0x0a5d,
+       0x7c57, 0x0fbe, 0x46ce, 0x4939, 0x6b17, 0x37bb, 0x3e91, 0x76db,
+};
+
+uint32_t ecc_errors = 0;
+
+static void
+nand_config_ecc(struct sunxi_nand *nand, uint32_t page, int syndrome)
+{
+       static u8 strength[] = {16, 24, 28, 32, 40, 48, 56, 60, 64};
+       int i;
+       uint32_t ecc_mode;
+       u32 ecc;
+       u16 seed = 0;
+
+       for (i = 0; i < ARRAY_SIZE(strength); i++) {
+               if (CONFIG_NAND_SUNXI_ECC_STRENGTH == strength[i]) {
+                       ecc_mode = i;
+                       break;
+               }
+       }
+
+       if (i == ARRAY_SIZE(strength)) {
+               printf("ECC strength unsupported\n");
+               return;
+       }
+
+       ecc =   SUNXI_NAND_ECC_CTL_ECC_EN |
+               SUNXI_NAND_ECC_CTL_PIPELINE |
+               SUNXI_NAND_ECC_CTL_RND_EN |
+               SUNXI_NAND_ECC_CTL_MODE(ecc_mode);
+
+       if (CONFIG_NAND_SUNXI_ECC_STEP == 512)
+               ecc |= SUNXI_NAND_ECC_CTL_BS_512B;
+
+       if (syndrome)
+               seed = 0x4A80;
+       else
+               seed = random_seed[page % ARRAY_SIZE(random_seed)];
+
+       ecc |= SUNXI_NAND_ECC_CTL_RND_SEED(seed);
+
+       writel(ecc, &nand->ecc_ctl);
+}
+
+/* read CONFIG_NAND_SUNXI_ECC_STEP bytes from real_addr to temp_buf */
+void
+nand_read_block(struct sunxi_nand *nand, phys_addr_t src, dma_addr_t dst,
+               int syndrome)
+{
+       struct sunxi_dma * const dma = (struct sunxi_dma *)SUNXI_DMA_BASE;
+       struct sunxi_dma_cfg * const dma_cfg = &dma->ddma[0];
+
+       uint32_t shift;
+       uint32_t page;
+       uint32_t addr;
+       uint32_t oob_offset;
+       uint32_t ecc_bytes;
+       u32 val;
+       u32 cmd;
+
+       page = src / CONFIG_NAND_SUNXI_PAGE_SIZE;
+       if (page > 0xFFFF) {
+               /* TODO: currently this is not supported */
+               printf("Reading from address >= %08X is not allowed.\n",
+                      0xFFFF * CONFIG_NAND_SUNXI_PAGE_SIZE);
+               return;
+       }
+
+       shift = src % CONFIG_NAND_SUNXI_PAGE_SIZE;
+       writel(0, &nand->ecc_st);
+
+       /* ECC_CTL, randomization */
+       ecc_bytes = CONFIG_NAND_SUNXI_ECC_STRENGTH *
+                       fls(CONFIG_NAND_SUNXI_ECC_STEP * 8);
+       ecc_bytes = DIV_ROUND_UP(ecc_bytes, 8);
+       ecc_bytes += (ecc_bytes & 1); /* Align to 2-bytes */
+       ecc_bytes += 4;
+
+       nand_config_ecc(nand, page, syndrome);
+       if (syndrome) {
+               /* shift every 1kB in syndrome */
+               shift += (shift / CONFIG_NAND_SUNXI_ECC_STEP) * ecc_bytes;
+               oob_offset = CONFIG_NAND_SUNXI_ECC_STEP + shift;
+       } else {
+               oob_offset = CONFIG_NAND_SUNXI_PAGE_SIZE  +
+                       (shift / CONFIG_NAND_SUNXI_ECC_STEP) * ecc_bytes;
+       }
+
+       addr = (page << 16) | shift;
+
+       /* DMA */
+       val = readl(&nand->ctl);
+       writel(val | SUNXI_NAND_CTL_RAM_METHOD_DMA, &nand->ctl);
+
+       writel(oob_offset, &nand->spare_area);
+
+       /* DMAC
+        * \todo Separate this into a tidy driver */
+       writel(0x0, &dma->irq_en); /* clear dma interrupts */
+       writel((uint32_t) &nand->io_data , &dma_cfg->src_addr);
+       writel(dst            , &dma_cfg->dst_addr);
+       writel(0x00007F0F     , &dma_cfg->ddma_para);
+       writel(CONFIG_NAND_SUNXI_ECC_STEP, &dma_cfg->bc);
+
+       val =   SUNXI_DMA_CTL_SRC_DRQ(DDMA_SRC_DRQ_NAND) |
+               SUNXI_DMA_CTL_MODE_IO |
+               SUNXI_DMA_CTL_SRC_DATA_WIDTH_32 |
+               SUNXI_DMA_CTL_DST_DRQ(DDMA_DST_DRQ_SDRAM) |
+               SUNXI_DMA_CTL_DST_DATA_WIDTH_32 |
+               SUNXI_DMA_CTL_TRIGGER;
+       writel(val, &dma_cfg->ctl);
+
+       writel(0x00E00530, &nand->rcmd_set);
+       nand_wait_timeout(&nand->st, SUNXI_NAND_ST_FIFO_FULL, 0);
+
+       writel(1   , &nand->block_num);
+       writel(addr, &nand->addr_low);
+       writel(0   , &nand->addr_high);
+
+       /* CMD (PAGE READ) */
+       cmd = 0x85E80000;
+       cmd |= SUNXI_NAND_CMD_ADDR_CYCLES(CONFIG_NAND_SUNXI_ADDR_CYCLES);
+       cmd |= (syndrome ? SUNXI_NAND_CMD_ORDER_SEQ :
+                       SUNXI_NAND_CMD_ORDER_INTERLEAVE);
+       writel(cmd, &nand->cmd);
+
+       if(nand_wait_timeout(&nand->st, SUNXI_NAND_ST_DMA_INT,
+                       SUNXI_NAND_ST_DMA_INT)) {
+               printf("NAND timeout reading data\n");
+               return;
+       }
+
+       if(nand_wait_timeout(&dma_cfg->ctl, SUNXI_DMA_CTL_TRIGGER, 0)) {
+               printf("NAND timeout reading data\n");
+               return;
+       }
+
+       if (readl(&nand->ecc_st))
+               ecc_errors++;
+}
+
+int
+nand_spl_load_image(uint32_t offs, unsigned int size, void *dest)
+{
+       struct sunxi_nand * const nand = (struct sunxi_nand *)SUNXI_NFC_BASE;
+       dma_addr_t dst_block;
+       dma_addr_t dst_end;
+       phys_addr_t addr = offs;
+
+       dst_end = ((dma_addr_t) dest) + size;
+
+       memset((void *)dest, 0x0, size);
+       ecc_errors = 0;
+       for (dst_block = (dma_addr_t) dest; dst_block < dst_end;
+                       dst_block += CONFIG_NAND_SUNXI_ECC_STEP,
+                       addr += CONFIG_NAND_SUNXI_ECC_STEP) {
+               /* syndrome read first 4MiB to match Allwinner BootROM */
+               nand_read_block(nand, addr, dst_block, addr < 0x400000);
+       }
+
+       if (ecc_errors)
+               printf("Error: %d ECC failures detected\n", ecc_errors);
+       return ecc_errors == 0;
+}
+
+void
+nand_deselect(void)
+{}
index 54e6f26d38d00a9a5b6781148f9fc1cd2d03b4b2..5611fac0dc46793bfc23f08573eddb89a7ce2a91 100644 (file)
@@ -77,7 +77,8 @@ config DEBUG_UART_SHIFT
          registers, 2=32-bit word registers, etc.
 
 config UNIPHIER_SERIAL
-       bool "UniPhier on-chip UART support"
+       bool "Support for UniPhier on-chip UART"
        depends on ARCH_UNIPHIER && DM_SERIAL
        help
-         Support for the on-chip UARTs on the Panasonic UniPhier platform.
+         If you have a UniPhier based board and want to use the on-chip
+         serial ports, say Y to this option. If unsure, say N.
index 74547eb692b19eedfbe9de2aabb30aafaebe3595..f21098607862062782bc61fc1fb9f234747ef582 100644 (file)
@@ -1,13 +1,11 @@
 /*
- * Copyright (C) 2012-2015 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+#include <linux/io.h>
 #include <linux/serial_reg.h>
-#include <asm/io.h>
 #include <asm/errno.h>
 #include <dm/device.h>
 #include <dm/platform_data/serial-uniphier.h>
index 22d288c711c8266b158e21973ea4110d893e706a..aadff42a9cdc66ea1879b05d9017d893f4c634d2 100644 (file)
@@ -50,6 +50,8 @@
 /* For each endpoint, we need 2 QTDs, one for each of IN and OUT */
 #define ILIST_SZ               (NUM_ENDPOINTS * 2 * ILIST_ENT_SZ)
 
+#define EP_MAX_LENGTH_TRANSFER 0x4000
+
 #ifndef DEBUG
 #define DBG(x...) do {} while (0)
 #else
@@ -102,13 +104,28 @@ static struct usb_ep_ops ci_ep_ops = {
 };
 
 /* Init values for USB endpoints. */
-static const struct usb_ep ci_ep_init[2] = {
+static const struct usb_ep ci_ep_init[5] = {
        [0] = { /* EP 0 */
                .maxpacket      = 64,
                .name           = "ep0",
                .ops            = &ci_ep_ops,
        },
-       [1] = { /* EP 1..n */
+       [1] = {
+               .maxpacket      = 512,
+               .name           = "ep1in-bulk",
+               .ops            = &ci_ep_ops,
+       },
+       [2] = {
+               .maxpacket      = 512,
+               .name           = "ep2out-bulk",
+               .ops            = &ci_ep_ops,
+       },
+       [3] = {
+               .maxpacket      = 512,
+               .name           = "ep3in-int",
+               .ops            = &ci_ep_ops,
+       },
+       [4] = {
                .maxpacket      = 512,
                .name           = "ep-",
                .ops            = &ci_ep_ops,
@@ -196,6 +213,19 @@ static void ci_flush_qtd(int ep_num)
        flush_dcache_range(start, end);
 }
 
+/**
+ * ci_flush_td - flush cache over queue item
+ * @td:        td pointer
+ *
+ * This function flushes cache for particular transfer descriptor.
+ */
+static void ci_flush_td(struct ept_queue_item *td)
+{
+       const uint32_t  start = (uint32_t)td;
+       const uint32_t end = (uint32_t) td + ILIST_ENT_SZ;
+       flush_dcache_range(start, end);
+}
+
 /**
  * ci_invalidate_qtd - invalidate cache over queue item
  * @ep_num:    Endpoint number
@@ -211,6 +241,19 @@ static void ci_invalidate_qtd(int ep_num)
        invalidate_dcache_range(start, end);
 }
 
+/**
+ * ci_invalidate_td - invalidate cache over queue item
+ * @td:        td pointer
+ *
+ * This function invalidates cache for particular transfer descriptor.
+ */
+static void ci_invalidate_td(struct ept_queue_item *td)
+{
+       const uint32_t start = (uint32_t)td;
+       const uint32_t end = start + ILIST_ENT_SZ;
+       invalidate_dcache_range(start, end);
+}
+
 static struct usb_request *
 ci_ep_alloc_request(struct usb_ep *ep, unsigned int gfp_flags)
 {
@@ -376,6 +419,9 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep)
        struct ept_queue_head *head;
        int bit, num, len, in;
        struct ci_req *ci_req;
+       u8 *buf;
+       uint32_t length, actlen;
+       struct ept_queue_item *dtd, *qtd;
 
        ci_ep->req_primed = true;
 
@@ -387,16 +433,41 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep)
        ci_req = list_first_entry(&ci_ep->queue, struct ci_req, queue);
        len = ci_req->req.length;
 
-       item->info = INFO_BYTES(len) | INFO_ACTIVE;
-       item->page0 = (unsigned long)ci_req->hw_buf;
-       item->page1 = ((unsigned long)ci_req->hw_buf & 0xfffff000) + 0x1000;
-       item->page2 = ((unsigned long)ci_req->hw_buf & 0xfffff000) + 0x2000;
-       item->page3 = ((unsigned long)ci_req->hw_buf & 0xfffff000) + 0x3000;
-       item->page4 = ((unsigned long)ci_req->hw_buf & 0xfffff000) + 0x4000;
-
        head->next = (unsigned long)item;
        head->info = 0;
 
+       ci_req->dtd_count = 0;
+       buf = ci_req->hw_buf;
+       actlen = 0;
+       dtd = item;
+
+       do {
+               length = min(ci_req->req.length - actlen,
+                            (unsigned)EP_MAX_LENGTH_TRANSFER);
+
+               dtd->info = INFO_BYTES(length) | INFO_ACTIVE;
+               dtd->page0 = (unsigned long)buf;
+               dtd->page1 = ((unsigned long)buf & 0xfffff000) + 0x1000;
+               dtd->page2 = ((unsigned long)buf & 0xfffff000) + 0x2000;
+               dtd->page3 = ((unsigned long)buf & 0xfffff000) + 0x3000;
+               dtd->page4 = ((unsigned long)buf & 0xfffff000) + 0x4000;
+
+               len -= length;
+               actlen += length;
+               buf += length;
+
+               if (len) {
+                       qtd = (struct ept_queue_item *)
+                              memalign(ILIST_ALIGN, ILIST_ENT_SZ);
+                       dtd->next = (uint32_t)qtd;
+                       dtd = qtd;
+                       memset(dtd, 0, ILIST_ENT_SZ);
+               }
+
+               ci_req->dtd_count++;
+       } while (len);
+
+       item = dtd;
        /*
         * When sending the data for an IN transaction, the attached host
         * knows that all data for the IN is sent when one of the following
@@ -432,6 +503,12 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep)
 
        ci_flush_qtd(num);
 
+       item = (struct ept_queue_item *)head->next;
+       while (item->next != TERMINATE) {
+               ci_flush_td((struct ept_queue_item *)item->next);
+               item = (struct ept_queue_item *)item->next;
+       }
+
        DBG("ept%d %s queue len %x, req %p, buffer %p\n",
            num, in ? "in" : "out", len, ci_req, ci_req->hw_buf);
        ci_flush_qh(num);
@@ -497,21 +574,31 @@ static void flip_ep0_direction(void)
 
 static void handle_ep_complete(struct ci_ep *ci_ep)
 {
-       struct ept_queue_item *item;
-       int num, in, len;
+       struct ept_queue_item *item, *next_td;
+       int num, in, len, j;
        struct ci_req *ci_req;
 
        num = ci_ep->desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
        in = (ci_ep->desc->bEndpointAddress & USB_DIR_IN) != 0;
        item = ci_get_qtd(num, in);
        ci_invalidate_qtd(num);
+       ci_req = list_first_entry(&ci_ep->queue, struct ci_req, queue);
 
-       len = (item->info >> 16) & 0x7fff;
-       if (item->info & 0xff)
-               printf("EP%d/%s FAIL info=%x pg0=%x\n",
-                      num, in ? "in" : "out", item->info, item->page0);
+       next_td = item;
+       len = 0;
+       for (j = 0; j < ci_req->dtd_count; j++) {
+               ci_invalidate_td(next_td);
+               item = next_td;
+               len += (item->info >> 16) & 0x7fff;
+               if (item->info & 0xff)
+                       printf("EP%d/%s FAIL info=%x pg0=%x\n",
+                              num, in ? "in" : "out", item->info, item->page0);
+               if (j != ci_req->dtd_count - 1)
+                       next_td = (struct ept_queue_item *)item->next;
+               if (j != 0)
+                       free(item);
+       }
 
-       ci_req = list_first_entry(&ci_ep->queue, struct ci_req, queue);
        list_del_init(&ci_req->queue);
        ci_ep->req_primed = false;
 
@@ -852,9 +939,19 @@ static int ci_udc_probe(void)
        controller.gadget.ep0 = &controller.ep[0].ep;
        INIT_LIST_HEAD(&controller.gadget.ep0->ep_list);
 
-       /* Init EP 1..n */
-       for (i = 1; i < NUM_ENDPOINTS; i++) {
-               memcpy(&controller.ep[i].ep, &ci_ep_init[1],
+       /* Init EP 1..3 */
+       for (i = 1; i < 4; i++) {
+               memcpy(&controller.ep[i].ep, &ci_ep_init[i],
+                      sizeof(*ci_ep_init));
+               INIT_LIST_HEAD(&controller.ep[i].queue);
+               controller.ep[i].req_primed = false;
+               list_add_tail(&controller.ep[i].ep.ep_list,
+                             &controller.gadget.ep_list);
+       }
+
+       /* Init EP 4..n */
+       for (i = 4; i < NUM_ENDPOINTS; i++) {
+               memcpy(&controller.ep[i].ep, &ci_ep_init[4],
                       sizeof(*ci_ep_init));
                INIT_LIST_HEAD(&controller.ep[i].queue);
                controller.ep[i].req_primed = false;
index 346164a641329981b6c187dbdf44d609f36208cf..95cc07992b412ae92495dfab3252059ed64c0c64 100644 (file)
@@ -86,6 +86,7 @@ struct ci_req {
        /* Buffer for the current transfer. Either req.buf/len or b_buf/len */
        uint8_t *hw_buf;
        uint32_t hw_len;
+       uint32_t dtd_count;
 };
 
 struct ci_ep {
index 24a595fb42619aa3eced61402d14e4eb3c5d20b2..8705c7c44c2742c5d2dc0190deec46177fdc18e2 100644 (file)
@@ -18,12 +18,11 @@ config USB_XHCI
 if USB_XHCI_HCD
 
 config USB_XHCI_UNIPHIER
-       bool "Support for Panasonic UniPhier on-chip xHCI USB controller"
+       bool "Support for UniPhier on-chip xHCI USB controller"
        depends on ARCH_UNIPHIER
        default y
        ---help---
-         Enables support for the on-chip xHCI controller on Panasonic
-         UniPhier SoCs.
+         Enables support for the on-chip xHCI controller on UniPhier SoCs.
 
 endif
 
@@ -54,11 +53,10 @@ config USB_EHCI
 if USB_EHCI_HCD
 
 config USB_EHCI_UNIPHIER
-       bool "Support for Panasonic UniPhier on-chip EHCI USB controller"
+       bool "Support for UniPhier on-chip EHCI USB controller"
        depends on ARCH_UNIPHIER && OF_CONTROL
        default y
        ---help---
-         Enables support for the on-chip EHCI controller on Panasonic
-         UniPhier SoCs.
+         Enables support for the on-chip EHCI controller on UniPhier SoCs.
 
 endif
index 2ac00177a20c1b3b00da029d251388939b1e0930..eee60a2b039a247b8c1282d1c2e92294a2377ae8 100644 (file)
@@ -932,7 +932,8 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
        snpsid = readl(&regs->gsnpsid);
        printf("Core Release: %x.%03x\n", snpsid >> 12 & 0xf, snpsid & 0xfff);
 
-       if ((snpsid & DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_2xx) {
+       if ((snpsid & DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_2xx &&
+           (snpsid & DWC2_SNPSID_DEVID_MASK) != DWC2_SNPSID_DEVID_VER_3xx) {
                printf("SNPSID invalid (not DWC2 OTG device): %08x\n", snpsid);
                return -ENODEV;
        }
index 45408c6f5cc19946fb66c27b9ca190ab6012f103..f69372e6b418fca6825dfba48560b9dad1c2e0db 100644 (file)
@@ -732,6 +732,7 @@ struct dwc2_core_regs {
 #define DWC2_PCGCCTL_DEEP_SLEEP                                (1 << 7)
 #define DWC2_PCGCCTL_DEEP_SLEEP_OFFSET                 7
 #define DWC2_SNPSID_DEVID_VER_2xx                      (0x4f542 << 12)
+#define DWC2_SNPSID_DEVID_VER_3xx                      (0x4f543 << 12)
 #define DWC2_SNPSID_DEVID_MASK                         (0xfffff << 12)
 #define DWC2_SNPSID_DEVID_OFFSET                       12
 
index 846bf509d67cded50bcf31f9b06510a89a8d3435..c3f827ca0ae517ada98d3cb3e982beaae27b858b 100644 (file)
@@ -1,14 +1,12 @@
 /*
- * Copyright (C) 2014 Panasonic Corporation
- * Copyright (C) 2015 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <linux/err.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <usb.h>
 #include <mach/mio-regs.h>
 #include <fdtdec.h>
index e0ef3221727981546a3e6e1306f24a1c2739dc17..1b3f3d22de115768b57a93f30bbd3b76efc6f5d7 100644 (file)
@@ -1,13 +1,12 @@
 /*
- * Copyright (C) 2015 Panasonic Corporation
- * Copyright (C) 2015 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <usb.h>
 #include <fdtdec.h>
 #include "xhci.h"
index 6f956499d75332c1185afda7683210a212c7530b..e23d1720018f8820a3d963c943c8a5ebc025f62c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at>
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * minimal framebuffer driver for TI's AM335x SoC to be compatible with
index 7f799d1f31c2f8713f3e4d7191c24131dd15dd54..3f4b567ce2d5dd8d663a159d20dd6f0667aecf90 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at> -
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at> -
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:    GPL-2.0+
index 2508c166510e3822927aff23d55f42f3923b441c..99c142ae02d4c6c0a1d53387832f41832222bb40 100644 (file)
@@ -3,7 +3,7 @@
  *
  * common parts used by B&R AM335x based boards
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at> -
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at> -
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:        GPL-2.0+
index d1c745e6ab605c68afd857a47d072f33921b3e17..acff5b9f89df10c2ce3dfd21ed67a027fb06fb35 100644 (file)
@@ -3,7 +3,7 @@
  *
  * specific parts for B&R KWB Motherboard
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at> -
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at> -
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:        GPL-2.0+
index ea079eb5f78b721cc9c69ebd69c42cac633ff106..a3c94085182a7e9aa8e259aa082ebbe5a8b035b2 100644 (file)
@@ -18,6 +18,7 @@
 #endif
 
 #define CONFIG_SUNXI_USB_PHYS  3
+#define CONFIG_NAND_SUNXI_GPC_PORTS    {16, 17, 18, 19, 20, 21, 22, 24}
 
 /*
  * Include common sunxi configuration where most the settings are
index d2576599036a3fee56cfdaa7944c11ef3390685d..8e13df58bd54cabe4310585e6bb3d81e6d995271 100644 (file)
@@ -19,6 +19,9 @@
 
 #define CONFIG_SUNXI_USB_PHYS  2
 
+/* \todo A13 only defines port 19, whereas A10s requires each of these */
+#define CONFIG_NAND_SUNXI_GPC_PORTS    {16, 17, 18, 19}
+
 /*
  * Include common sunxi configuration where most the settings are
  */
index 2c24bd2312ddb35a88ff84ce8747c4552e79eb4d..a0ebc7e97705f6b6cc40b2367090f5535e507031 100644 (file)
 
 #define CONFIG_SUNXI_USB_PHYS  3
 
+#define CONFIG_ARMV7_PSCI              1
+#define CONFIG_ARMV7_PSCI_NR_CPUS      4
+#define CONFIG_ARMV7_SECURE_BASE       SUNXI_SRAM_B_BASE
+#define CONFIG_TIMER_CLK_FREQ          24000000
+
+#define CONFIG_NAND_SUNXI_GPC_PORTS    {24, 25, 26}
+
 /*
  * Include common sunxi configuration where most the settings are
  */
index 56101a9ffcd27532a81fb721476dbaf43e9519d9..3d26ce8d4a4d183c7500d8f5f48d4837b5ab0e31 100644 (file)
@@ -24,6 +24,8 @@
 #define CONFIG_ARMV7_SECURE_BASE       SUNXI_SRAM_B_BASE
 #define CONFIG_TIMER_CLK_FREQ          24000000
 
+#define CONFIG_NAND_SUNXI_GPC_PORTS    {16, 17, 18, 19, 20, 21, 22, 24}
+
 /*
  * Include common sunxi configuration where most the settings are
  */
index 7111c635c152d06c9684eecb5e1fc94d427fd3cc..fe8c511448b517d5a617ce30ba84c94c213d2a3c 100644 (file)
 
 #define CONFIG_SUNXI_USB_PHYS  2
 
+#define CONFIG_ARMV7_PSCI              1
+#if defined(CONFIG_MACH_SUN8I_A23)
+#define CONFIG_ARMV7_PSCI_NR_CPUS      2
+#define CONFIG_NAND_SUNXI_GPC_PORTS    {16, 17, 18}
+#elif defined(CONFIG_MACH_SUN8I_A33)
+#define CONFIG_ARMV7_PSCI_NR_CPUS      4
+#define CONFIG_NAND_SUNXI_GPC_PORTS    {16}
+#else
+#error Unsupported sun8i variant
+#endif
+#define CONFIG_TIMER_CLK_FREQ          24000000
+
 /*
  * Include common sunxi configuration where most the settings are
  */
diff --git a/include/configs/sun9i.h b/include/configs/sun9i.h
new file mode 100644 (file)
index 0000000..cd9e08d
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * (C) Copyright 2015 Hans de Goede <hdegoede@redhat.com>
+ *
+ * Configuration settings for the Allwinner A80 (sun9i) CPU
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * A80 specific configuration
+ */
+
+/*
+ * Include common sunxi configuration where most the settings are
+ */
+#include <configs/sunxi-common.h>
+
+#endif /* __CONFIG_H */
index a0e21ea3bf937c0d5eee027ea876556fff9f579f..07db736d3162f98280b35cdd526bfdf78a5debbf 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef _SUNXI_COMMON_CONFIG_H
 #define _SUNXI_COMMON_CONFIG_H
 
+#include <linux/stringify.h>
+
 #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
 /*
  * The U-Boot workarounds bugs in the outdated buggy sunxi-3.4 kernels at the
@@ -39,8 +41,6 @@
 
 #include <asm/arch/cpu.h>      /* get chip and board defs */
 
-#define CONFIG_SYS_TEXT_BASE           0x4a000000
-
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_SERIAL)
 # define CONFIG_DW_SERIAL
 #endif
 /* CPU */
 #define CONFIG_SYS_CACHELINE_SIZE      64
 
-/* DRAM Base */
+/*
+ * The DRAM Base differs between some models. We cannot use macros for the
+ * CONFIG_FOO defines which contain the DRAM base address since they end
+ * up unexpanded in include/autoconf.mk .
+ *
+ * So we have to have this #ifdef #else #endif block for these.
+ */
+#ifdef CONFIG_MACH_SUN9I
+#define SDRAM_OFFSET(x) 0x2##x
+#define CONFIG_SYS_SDRAM_BASE          0x20000000
+#define CONFIG_SYS_LOAD_ADDR           0x22000000 /* default load address */
+#define CONFIG_SYS_TEXT_BASE           0x2a000000
+#define CONFIG_PRE_CON_BUF_ADDR                0x2f000000
+#define CONFIG_SYS_SPL_MALLOC_START    0x2ff00000
+#define CONFIG_SPL_BSS_START_ADDR      0x2ff80000
+#else
+#define SDRAM_OFFSET(x) 0x4##x
 #define CONFIG_SYS_SDRAM_BASE          0x40000000
+#define CONFIG_SYS_LOAD_ADDR           0x42000000 /* default load address */
+#define CONFIG_SYS_TEXT_BASE           0x4a000000
+#define CONFIG_PRE_CON_BUF_ADDR                0x4f000000
+#define CONFIG_SYS_SPL_MALLOC_START    0x4ff00000
+#define CONFIG_SPL_BSS_START_ADDR      0x4ff80000
+#endif
+
+#define CONFIG_SPL_BSS_MAX_SIZE                0x00080000 /* 512 KiB */
+#define CONFIG_SYS_SPL_MALLOC_SIZE     0x00080000 /* 512 KiB */
+
+#ifdef CONFIG_MACH_SUN9I
+/*
+ * The A80's A1 sram starts at 0x00010000 rather then at 0x00000000 and is
+ * slightly bigger. Note that it is possible to map the first 32 KiB of the
+ * A1 at 0x00000000 like with older SoCs by writing 0x16aa0001 to the
+ * undocumented 0x008000e0 SYS_CTRL register. Where the 16aa is a key and
+ * the 1 actually activates the mapping of the first 32 KiB to 0x00000000.
+ */
+#define CONFIG_SYS_INIT_RAM_ADDR       0x10000
+#define CONFIG_SYS_INIT_RAM_SIZE       0x0a000 /* 40 KiB */
+#else
 #define CONFIG_SYS_INIT_RAM_ADDR       0x0
 #define CONFIG_SYS_INIT_RAM_SIZE       0x8000  /* 32 KiB */
+#endif
 
 #define CONFIG_SYS_INIT_SP_OFFSET \
        (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
 #define CONFIG_CMD_MMC
 #define CONFIG_MMC_SUNXI
 #define CONFIG_MMC_SUNXI_SLOT          0
+#if !defined(CONFIG_SPL_NAND_SUPPORT)
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV         0       /* first detected MMC controller */
+#endif /* CONFIG_SPL_NAND_SUPPORT */
 #endif
 
 /* 4MB of malloc() pool */
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
 
-#define CONFIG_SYS_LOAD_ADDR           0x42000000 /* default load address */
-
 /* standalone support */
-#define CONFIG_STANDALONE_LOAD_ADDR    0x42000000
+#define CONFIG_STANDALONE_LOAD_ADDR    CONFIG_SYS_LOAD_ADDR
 
 /* baudrate */
 #define CONFIG_BAUDRATE                        115200
 
 #define CONFIG_SPL_BOARD_LOAD_IMAGE
 
-#ifdef CONFIG_SPL_FEL
-
-#define CONFIG_SPL_TEXT_BASE           0x2000
-#define CONFIG_SPL_MAX_SIZE            0x4000          /* 16 KiB */
-
-#else /* CONFIG_SPL */
-
-#define CONFIG_SPL_BSS_START_ADDR      0x4ff80000
-#define CONFIG_SPL_BSS_MAX_SIZE                0x80000         /* 512 KiB */
-
 #define CONFIG_SPL_TEXT_BASE           0x20            /* sram start+header */
 #define CONFIG_SPL_MAX_SIZE            0x5fe0          /* 24KB on sun4i/sun7i */
 
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        80      /* 40KiB */
 #define CONFIG_SPL_PAD_TO              32768           /* decimal for 'dd' */
 
-#endif /* CONFIG_SPL */
-
 /* end of 32 KiB in sram */
 #define LOW_LEVEL_SRAM_STACK           0x00008000 /* End of sram */
 #define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
-#define CONFIG_SYS_SPL_MALLOC_START    0x4ff00000
-#define CONFIG_SYS_SPL_MALLOC_SIZE     0x00080000      /* 512 KiB */
 
 /* I2C */
 #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER
@@ -332,6 +356,24 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_ENV_IS_NOWHERE
 #endif
 
+#ifdef CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_NAND
+#define CONFIG_SYS_NAND_SELF_INIT
+#define CONFIG_NAND_SUNXI
+#define CONFIG_CMD_SPL_WRITE_SIZE              0x000400
+#define CONFIG_SYS_NAND_U_BOOT_OFFS            0x008000
+
+/* \todo Make these parameterisable in kernel config ? */
+#define CONFIG_NAND_SUNXI_PAGE_SIZE            8192
+#define CONFIG_NAND_SUNXI_ECC_STEP             1024
+#define CONFIG_NAND_SUNXI_ECC_STRENGTH         40
+#define CONFIG_NAND_SUNXI_ADDR_CYCLES          5
+
+#ifndef CONFIG_NAND_SUNXI_GPC_PORTS
+#error "No NAND GPC ports defined, NAND unsupported"
+#endif
+#endif /* CONFIG_SPL_NAND_SUPPORT */
+
 #define CONFIG_MISC_INIT_R
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 
@@ -341,8 +383,6 @@ extern int soft_i2c_gpio_scl;
 /* Enable pre-console buffer to get complete log on the VGA console */
 #define CONFIG_PRE_CONSOLE_BUFFER
 #define CONFIG_PRE_CON_BUF_SZ          4096 /* Aprox 2 80*25 screens */
-/* Use the room between the end of bootm_size and the framebuffer */
-#define CONFIG_PRE_CON_BUF_ADDR                0x4f000000
 
 /*
  * 240M RAM (256M minimum minus space for the framebuffer),
@@ -351,11 +391,11 @@ extern int soft_i2c_gpio_scl;
  */
 #define MEM_LAYOUT_ENV_SETTINGS \
        "bootm_size=0xf000000\0" \
-       "kernel_addr_r=0x42000000\0" \
-       "fdt_addr_r=0x43000000\0" \
-       "scriptaddr=0x43100000\0" \
-       "pxefile_addr_r=0x43200000\0" \
-       "ramdisk_addr_r=0x43300000\0"
+       "kernel_addr_r=" __stringify(SDRAM_OFFSET(2000000)) "\0" \
+       "fdt_addr_r=" __stringify(SDRAM_OFFSET(3000000)) "\0" \
+       "scriptaddr=" __stringify(SDRAM_OFFSET(3100000)) "\0" \
+       "pxefile_addr_r=" __stringify(SDRAM_OFFSET(3200000)) "\0" \
+       "ramdisk_addr_r=" __stringify(SDRAM_OFFSET(3300000)) "\0"
 
 #ifdef CONFIG_MMC
 #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
index 92185333884706e138d04aaf58947567b1be856e..f3f71f11a6ee85eb3c2feff594ec660c746ad6e3 100644 (file)
@@ -3,7 +3,7 @@
  *
  * specific parts for B&R T-Series Motherboard
  *
- * Copyright (C) 2013 Hannes Petermaier <oe5hpm@oevsv.at> -
+ * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at> -
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:        GPL-2.0+
index 331df6251a4db7fbe992413345b465ab466275d5..8510472d95e74a6d7dbed7fbda031b67f301945e 100644 (file)
@@ -1,7 +1,5 @@
 /*
- * Copyright (C) 2012-2015 Panasonic Corporation
- * Copyright (C) 2015      Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #define CONFIG_SYS_SDRAM_SIZE  (CONFIG_SDRAM0_SIZE)
 #endif
 
-#define CONFIG_SYS_TEXT_BASE           0x84000000
-
 #if defined(CONFIG_MACH_PH1_LD4) || defined(CONFIG_MACH_PH1_SLD8)
 #define CONFIG_SPL_TEXT_BASE           0x00040000
 #endif
index 0035f6ea265d926837ed576418dc81fbed3970c9..3361251c8e7fffcb4ccbc3e29eb5e2e956608b0c 100644 (file)
@@ -65,7 +65,13 @@ int gen_check_sum(struct boot_file_head *head_p)
 
 #define SUN4I_SRAM_SIZE 0x7600 /* 0x7748+ is used by BROM */
 #define SRAM_LOAD_MAX_SIZE (SUN4I_SRAM_SIZE - sizeof(struct boot_file_head))
-#define BLOCK_SIZE 512
+
+/*
+ * BROM (at least on A10 and A20) requires NAND-images to be explicitly aligned
+ * to a multiple of 8K, and rejects the image otherwise. MMC-images are fine
+ * with 512B blocks. To cater for both, align to the largest of the two.
+ */
+#define BLOCK_SIZE 0x2000
 
 struct boot_img {
        struct boot_file_head header;