S3c64xx: Switch all I/O to use readl/writel function
Subsystems (7)
This serial patch intent to:
1. Switch all I/O to use readl/writel function
2. Change nand_spl to use SPL framework
3. S3C64XX serial includes s3c6400 and s3c6410,
Here seprate cpu and board file to support to board's of s3c6410.
I test this patch on my s3c6410 development board. the log as following:
U-Boot 2012.04.01-10905-g9fa0c77 (Jul 07 2012 - 15:50:57) for SMDK6400
CPU: S3C64XX at 532MHz
Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode) Board: DMATEK6410 DRAM: 128 MiB WARNING: Caches not enabled NAND: 128 MiB
*** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Net: dm9000 Hit any key to stop autoboot: 0
DMATEK6410 #
PATCH 1/13 smdk6400: Move smdk6400 board from Makefile to boards.cfg
From: Zhong Hongbo <[email protected]>
--- Makefile | 20 -------------------- board/samsung/smdk6400/config.mk | 4 +--- boards.cfg | 2 ++ include/configs/smdk6400.h | 2 +- 4 files changed, 4 insertions(+), 24 deletions(-)
Makefile +0 -20
@@ -695,26 +695,6 @@ SX1_config: unconfig fi; @$(MKCONFIG) -n $@ SX1 arm arm925t sx1 -######################################################################### -## ARM1176 Systems -######################################################################### -smdk6400_noUSB_config \ -smdk6400_config : unconfig - @mkdir -p $(obj)include $(obj)board/samsung/smdk6400 - @mkdir -p $(obj)nand_spl/board/samsung/smdk6400 - @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h - @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk - @if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then \ - echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\ - else \ - echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\ - fi - @$(MKCONFIG) smdk6400 arm arm1176 smdk6400 samsung s3c64xx - @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk - -######################################################################### -######################################################################### - clean: @rm -f $(obj)examples/standalone/82559_eeprom \ $(obj)examples/standalone/atmel_df_pow2 \
board/samsung/smdk6400/config.mk +1 -3
@@ -21,10 +21,8 @@ # # download area is 0x5000c000 -sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp - ifndef CONFIG_NAND_SPL -CONFIG_SYS_TEXT_BASE = $(RAM_TEXT) +CONFIG_SYS_TEXT_BASE = $(CONFIG_RAM_TEXT) else CONFIG_SYS_TEXT_BASE = 0 endif
boards.cfg +2 -0
@@ -47,6 +47,8 @@ flea3 arm arm1136 - CarMedi mx35pdk arm arm1136 - freescale mx35 apollon arm arm1136 apollon - omap24xx omap2420h4 arm arm1136 - ti omap24xx +smdk6400 arm arm1176 smdk6400 samsung s3c64xx smdk6400:NAND_U_BOOT,RAM_TEXT=0xc7e00000 +smdk6400_nousb arm arm1176 smdk6400 samsung s3c64xx smdk6400:NAND_U_BOOT,RAM_TEXT=0x57e00000 tnetv107x_evm arm arm1176 tnetv107xevm ti tnetv107x integratorap_cm720t arm arm720t integrator armltd - integratorap:CM720T integratorap_cm920t arm arm920t integrator armltd - integratorap:CM920T
include/configs/smdk6400.h +1 -1
@@ -54,7 +54,7 @@/* input clock of PLL: SMDK6400 has 12MHz input clock */ #define CONFIG_SYS_CLK_FREQ 12000000 -#if !defined(CONFIG_NAND_SPL ) && (CONFIG_SYS_TEXT_BASE >=0xc0000000 ) +#if !defined(CONFIG_NAND_U_BOOT ) && (CONFIG_SYS_TEXT_BASE >=0xc0000000 )#define CONFIG_ENABLE_MMU #endif
Signature · 1 line
1.7.5.4
PATCH 2/13 S3C64XX: Switch to use readl/writel to operate nand flash
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
--- arch/arm/include/asm/arch-s3c64xx/nand.h | 69 +++++++++++++++++++++++ arch/arm/include/asm/arch-s3c64xx/s3c6400.h | 79 ++------------------------- board/samsung/smdk6400/lowlevel_init.S | 8 ++-- drivers/mtd/nand/s3c64xx.c | 58 +++++++++++++------- 4 files changed, 116 insertions(+), 98 deletions(-) create mode 100644 arch/arm/include/asm/arch-s3c64xx/nand.h
arch/arm/include/asm/arch-s3c64xx/nand.h new file +69 -0
@@ -0,0 +1,69 @@ +/* +* (C) Copyright 2012 +* Zhong Hongbo <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __ASM_ARCH_NAND_H__ +#define __ASM_ARCH_NAND_H__ + +#define NFCONF_ECC_4BIT (1<<24) + +#define NFCONT_ECC_ENC (1<<18) +#define NFCONT_WP (1<<16) +#define NFCONT_MECCLOCK (1<<7) +#define NFCONT_SECCLOCK (1<<6) +#define NFCONT_INITMECC (1<<5) +#define NFCONT_INITSECC (1<<4) +#define NFCONT_INITECC (NFCONT_INITMECC | NFCONT_INITSECC) +#define NFCONT_CS_ALT (1<<2) +#define NFCONT_CS (1<<1) +#define NFCONT_ENABLE (1<<0) + +#define NFSTAT_ECCENCDONE (1<<7) +#define NFSTAT_ECCDECDONE (1<<6) +#define NFSTAT_RnB (1<<0) + +#define NFESTAT0_ECCBUSY (1<<31) + +#ifndef __ASSEMBLY__ +/* NAND FLASH */ +struct s3c64xx_nand { +u32 nfconf; +u32 nfcont; +u32 nfcmmd; +u32 nfaddr; +u32 nfdata; +u32 nfmeccdata0; +u32 nfmeccdata1; +u32 nfseccdata0; +u32 nfsblk; +u32 nfeblk; +u32 nfstat; +u32 nfestat0; +u32 nfestat1; +u32 nfmecc0; +u32 nfmecc1; +u32 nfsecc; +u32 nfmlcbitpt; +}; +#endif + +#endif
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +5 -74
91 lines not on this page · raw message
board/samsung/smdk6400/lowlevel_init.S +4 -4
@@ -269,14 +269,14 @@ uart_asm_init: */ nand_asm_init: ldr r0, =ELFIN_NAND_BASE - ldr r1, [r0, #NFCONF_OFFSET] + ldr r1, [r0, #0x0] @NFCONF_OFFSET orr r1, r1, #0x70 orr r1, r1, #0x7700 - str r1, [r0, #NFCONF_OFFSET] + str r1, [r0, #0x0] - ldr r1, [r0, #NFCONT_OFFSET] + ldr r1, [r0, #0x04] @NFCONT_OFFSET orr r1, r1, #0x07 - str r1, [r0, #NFCONT_OFFSET] + str r1, [r0, #0x04] mov pc, lr #endif
drivers/mtd/nand/s3c64xx.c +38 -20
158 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 2/13 S3C64XX: Switch to use readl/writel to operate nand flash
arch/arm/include/asm/arch-s3c64xx/s3c6400.h static inline s3c64xx_uart *s3c64xx_get_base_uart(enum s3c64xx_uarts_nr nr) · line 823
Quoted 4 lines · Zhong Hongbo
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +4
-0+static inline unsigned int s3c64xx_get_base_nand (void ) +{ +return ELFIN_NAND_BASE ; +}
unsigned long or uintptr_t would be more appropriate, even if U-Boot is unlikely to be 64-bit any time soon.
Or better, "struct s3c64xx_nand *".
drivers/mtd/nand/s3c64xx.c static void s3c_nand_select_chip(struct mtd_info *mtd, int chip) · line 99
Quoted 5 lines
drivers/mtd/nand/s3c64xx.c +1
-0@@ -89,15 +96,16 @@ static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)*/ static void s3c_nand_hwcontrol (struct mtd_info *mtd,int cmd,unsigned int ctrl) { +struct s3c64xx_nand *const nand =s3c_get_base_nand ();
Is there any benefit to declaring local variables const like this? Why this one and not all the others that never get altered?
-Scott
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/13 S3C64XX: Switch to use readl/writel to operate nand flash
Quoted 25 lines · Zhong Hongbo
Quoted 8 lines · Scott Wood
arch/arm/include/asm/arch-s3c64xx/s3c6400.h static inline s3c64xx_uart *s3c64xx_get_base_uart(enum s3c64xx_uarts_nr nr) · line 823
Quoted 4 lines · Zhong Hongbo
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +4
-0+static inline unsigned int s3c64xx_get_base_nand (void ) +{ +return ELFIN_NAND_BASE ; +}unsigned long or
uintptr_twould be more appropriate, even if U-Boot is unlikely to be 64-bit any time soon.Ok, I will fix it in V2.
Thanks,
hongboQuoted 10 lines
Or better, "struct
s3c64xx_nand*".drivers/mtd/nand/s3c64xx.c static void s3c_nand_select_chip(struct mtd_info *mtd, int chip) · line 99
Quoted 5 lines
drivers/mtd/nand/s3c64xx.c +1
-0@@ -89,15 +96,16 @@ static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)*/ static void s3c_nand_hwcontrol (struct mtd_info *mtd,int cmd,unsigned int ctrl) { +struct s3c64xx_nand *const nand =s3c_get_base_nand ();Is there any benefit to declaring local variables const like this?
Quoted 1 line
I reference the nand driver of S5PXX CPU. So ...
Sorry, I make a mistake, The S5PXX have not nand flash support. When i do the patch, I use the format as following?
struct s3c64xx_nand *nand = s3c_get_base_nand();
But when I use checkpatch.pl script to check the patch. more and more waring about the line, it said that you should add 'const' before nand variable.
Thanks,
hongbo
Quoted 17 lines
Why
Quoted 1 line
this one and not all the others that never get altered?
Ok, I will change it. And i just found the S3c64XX is orphaned board. So Thanks you for the foucus it!
Thanks,
hongboQuoted 4 lines
-Scott
PATCH 2/13 S3C64XX: Switch to use readl/writel to operate nand flash
Quoted 12 lines · Zhong Hongbo
Quoted 11 lines · Zhong Hongbo
Quoted 8 lines · Scott Wood
drivers/mtd/nand/s3c64xx.c static void s3c_nand_select_chip(struct mtd_info *mtd, int chip) · line 99
Quoted 5 lines · Zhong Hongbo
drivers/mtd/nand/s3c64xx.c +1
-0@@ -89,15 +96,16 @@ static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)*/ static void s3c_nand_hwcontrol (struct mtd_info *mtd,int cmd,unsigned int ctrl) { +struct s3c64xx_nand *const nand =s3c_get_base_nand ();Is there any benefit to declaring local variables const like this?
I reference the nand driver of S5PXX CPU. So ...
Quoted 8 lines
Sorry, I make a mistake, The S5PXX have not nand flash support. When i do the patch, I use the format as following?
struct
s3c64xx_nand*nand =s3c_get_base_nand();But when I use checkpatch.pl script to check the patch. more and more waring about the line, it said that you should add 'const' before nand variable.
Could you paste the exact output from checkpatch.pl?
-Scott
PATCH 2/13 S3C64XX: Switch to use readl/writel to operate nand flash
Hi Scott,
Quoted 16 lines · Scott Wood
Quoted 15 lines · Zhong Hongbo
Quoted 11 lines · Zhong Hongbo
Quoted 8 lines · Scott Wood
drivers/mtd/nand/s3c64xx.c static void s3c_nand_select_chip(struct mtd_info *mtd, int chip) · line 99
Quoted 5 lines · Zhong Hongbo
drivers/mtd/nand/s3c64xx.c +1
-0@@ -89,15 +96,16 @@ static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)*/ static void s3c_nand_hwcontrol (struct mtd_info *mtd,int cmd,unsigned int ctrl) { +struct s3c64xx_nand *const nand =s3c_get_base_nand ();Is there any benefit to declaring local variables const like this?
I reference the nand driver of S5PXX CPU. So ...
Sorry, I make a mistake, The S5PXX have not nand flash support. When i do the patch, I use the format as following?
Quoted 7 lines
Quoted 5 lines
struct
s3c64xx_nand*nand =s3c_get_base_nand();But when I use checkpatch.pl script to check the patch. more and more waring about the line, it said that you should add 'const' before nand variable.
Could you paste the exact output from checkpatch.pl?
Just redo the patch, I can not reproduce the issue. Thank you for your point.
Thanks,
hongbo
Quoted 5 lines
-Scott
PATCH 3/13 S3C64XX: Use readl/writel to operate uart
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
--- arch/arm/include/asm/arch-s3c64xx/s3c6400.h | 65 +-------------------------- arch/arm/include/asm/arch-s3c64xx/s3c64x0.h | 31 ------------- arch/arm/include/asm/arch-s3c64xx/uart.h | 54 ++++++++++++++++++++++ board/samsung/smdk6400/lowlevel_init.S | 8 --- drivers/serial/s3c64xx.c | 50 +++++++++++++-------- 5 files changed, 87 insertions(+), 121 deletions(-) create mode 100644 arch/arm/include/asm/arch-s3c64xx/uart.h
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +2 -63
@@ -582,62 +582,6 @@*/ #define ELFIN_UART_BASE 0x7F005000 -#define ELFIN_UART0_OFFSET 0x0000 -#define ELFIN_UART1_OFFSET 0x0400 -#define ELFIN_UART2_OFFSET 0x0800 - -#define ULCON_OFFSET 0x00 -#define UCON_OFFSET 0x04 -#define UFCON_OFFSET 0x08 -#define UMCON_OFFSET 0x0C -#define UTRSTAT_OFFSET 0x10 -#define UERSTAT_OFFSET 0x14 -#define UFSTAT_OFFSET 0x18 -#define UMSTAT_OFFSET 0x1C -#define UTXH_OFFSET 0x20 -#define URXH_OFFSET 0x24 -#define UBRDIV_OFFSET 0x28 -#define UDIVSLOT_OFFSET 0x2C -#define UINTP_OFFSET 0x30 -#define UINTSP_OFFSET 0x34 -#define UINTM_OFFSET 0x38 - -#define ULCON0_REG __REG(0x7F005000) -#define UCON0_REG __REG(0x7F005004) -#define UFCON0_REG __REG(0x7F005008) -#define UMCON0_REG __REG(0x7F00500C) -#define UTRSTAT0_REG __REG(0x7F005010) -#define UERSTAT0_REG __REG(0x7F005014) -#define UFSTAT0_REG __REG(0x7F005018) -#define UMSTAT0_REG __REG(0x7F00501c) -#define UTXH0_REG __REG(0x7F005020) -#define URXH0_REG __REG(0x7F005024) -#define UBRDIV0_REG __REG(0x7F005028) -#define UDIVSLOT0_REG __REG(0x7F00502c) -#define UINTP0_REG __REG(0x7F005030) -#define UINTSP0_REG __REG(0x7F005034) -#define UINTM0_REG __REG(0x7F005038) - -#define ULCON1_REG __REG(0x7F005400) -#define UCON1_REG __REG(0x7F005404) -#define UFCON1_REG __REG(0x7F005408) -#define UMCON1_REG __REG(0x7F00540C) -#define UTRSTAT1_REG __REG(0x7F005410) -#define UERSTAT1_REG __REG(0x7F005414) -#define UFSTAT1_REG __REG(0x7F005418) -#define UMSTAT1_REG __REG(0x7F00541c) -#define UTXH1_REG __REG(0x7F005420) -#define URXH1_REG __REG(0x7F005424) -#define UBRDIV1_REG __REG(0x7F005428) -#define UDIVSLOT1_REG __REG(0x7F00542c) -#define UINTP1_REG __REG(0x7F005430) -#define UINTSP1_REG __REG(0x7F005434) -#define UINTM1_REG __REG(0x7F005438) - -#define UTRSTAT_TX_EMPTY (1 << 2) -#define UTRSTAT_RX_READY (1 << 0) -#define UART_ERR_MASK 0xF -/* * PWM timer */
@@ -804,17 +748,12 @@#define DMC_DDR_USER_CONFIG 1#ifndef __ASSEMBLY__ -enum s3c64xx_uarts_nr { -S3C64XX_UART0 , -S3C64XX_UART1 , -S3C64XX_UART2 , -};#include "s3c64x0.h" -static inline s3c64xx_uart *s3c64xx_get_base_uart (enum s3c64xx_uarts_nr nr) +static inline unsigned int s3c64xx_get_base_uart (void ) { -return (s3c64xx_uart *)(ELFIN_UART_BASE + (nr *0x400 )); +return ELFIN_UART_BASE ; }static inline unsigned int s3c64xx_get_base_nand (void )
arch/arm/include/asm/arch-s3c64xx/s3c64x0.h +0 -31
@@ -40,37 +40,6 @@#include <asm/types.h> -/* UART (see manual chapter 11) */ -typedef struct { -volatile u32 ULCON; -volatile u32 UCON; -volatile u32 UFCON; -volatile u32 UMCON; -volatile u32 UTRSTAT; -volatile u32 UERSTAT; -volatile u32 UFSTAT; -volatile u32 UMSTAT; -#ifdef __BIG_ENDIAN -volatile u8 res1[3 ]; -volatile u8 UTXH; -volatile u8 res2[3 ]; -volatile u8 URXH; -#else /* Little Endian */ -volatile u8 UTXH; -volatile u8 res1[3 ]; -volatile u8 URXH; -volatile u8 res2[3 ]; -#endif -volatile u32 UBRDIV; -#ifdef __BIG_ENDIAN -volatile u8 res3[2 ]; -volatile u16 UDIVSLOT; -#else -volatile u16 UDIVSLOT; -volatile u8 res3[2 ]; -#endif -}s3c64xx_uart ; -/* PWM TIMER (see manual chapter 10) */ typedef struct { volatile u32 TCNTB;
arch/arm/include/asm/arch-s3c64xx/uart.h new file +54 -0
54 lines not on this page · raw message
board/samsung/smdk6400/lowlevel_init.S +0 -8
@@ -36,14 +36,6 @@ #include <asm/arch/s3c6400.h> -#ifdef CONFIG_SERIAL1 -#define ELFIN_UART_CONSOLE_BASE (ELFIN_UART_BASE + ELFIN_UART0_OFFSET) -#elif defined(CONFIG_SERIAL2) -#define ELFIN_UART_CONSOLE_BASE (ELFIN_UART_BASE + ELFIN_UART1_OFFSET) -#else -#define ELFIN_UART_CONSOLE_BASE (ELFIN_UART_BASE + ELFIN_UART2_OFFSET) -#endif - _TEXT_BASE: .word CONFIG_SYS_TEXT_BASE
drivers/serial/s3c64xx.c +31 -19
113 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 4/13 S3C64XX: add pwm for s3c64xx support
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
--- arch/arm/cpu/arm1176/s3c64xx/Makefile | 1 + arch/arm/cpu/arm1176/s3c64xx/pwm.c | 189 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-s3c64xx/pwm.h | 70 ++++++++++ arch/arm/include/asm/arch-s3c64xx/s3c6400.h | 57 ++------- arch/arm/include/asm/arch-s3c64xx/s3c64x0.h | 59 --------- include/configs/smdk6400.h | 3 + 6 files changed, 272 insertions(+), 107 deletions(-) create mode 100644 arch/arm/cpu/arm1176/s3c64xx/pwm.c create mode 100644 arch/arm/include/asm/arch-s3c64xx/pwm.h delete mode 100644 arch/arm/include/asm/arch-s3c64xx/s3c64x0.h
arch/arm/cpu/arm1176/s3c64xx/Makefile +1 -0
@@ -32,6 +32,7 @@ SOBJS = reset.o COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o COBJS-y += timer.o +COBJS-$(CONFIG_PWM) += pwm.o OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
arch/arm/cpu/arm1176/s3c64xx/pwm.c new file +189 -0
189 lines not on this page · raw message
arch/arm/include/asm/arch-s3c64xx/pwm.h new file +70 -0
70 lines not on this page · raw message
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +9 -48
81 lines not on this page · raw message
arch/arm/include/asm/arch-s3c64xx/s3c64x0.h deleted +0 -59
59 lines not on this page · raw message
include/configs/smdk6400.h +3 -0
@@ -141,6 +141,9 @@#define CONFIG_SYS_HZ 1000 +/* PWM */ +#define CONFIG_PWM 1 +/*----------------------------------------------------------------------- * Stack sizes *
Signature · 1 line
1.7.5.4
PATCH 5/13 S3C64XX: reference s5p cpu time system for s3c64xx timer
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
The old s3c64xx timer is not work normal, Adopt s5p time design, It work perfect.
--- arch/arm/cpu/arm1176/s3c64xx/timer.c | 195 ++++++++++++++++------------------ 1 files changed, 94 insertions(+), 101 deletions(-)
arch/arm/cpu/arm1176/s3c64xx/timer.c +94 -101
@@ -1,23 +1,8 @@/* -* (C) Copyright 2003 -* Texas Instruments <www.ti.com> -* -* (C) Copyright 2002 -* Sysgo Real-Time Solutions, GmbH <www.elinos.com> -* Marius Groeger <[email protected]> -* -* (C) Copyright 2002 -* Sysgo Real-Time Solutions, GmbH <www.elinos.com> -* Alex Zuepke <[email protected]> -* -* (C) Copyright 2002-2004 -* Gary Jennejohn, DENX Software Engineering, <[email protected]> -* -* (C) Copyright 2004 -* Philippe Robin, ARM Ltd. <[email protected]> -* -* (C) Copyright 2008 -* Guennadi Liakhovetki, DENX Software Engineering, <[email protected]> +* Copyright (C) 2009 Samsung Electronics +* Heungjun Kim <[email protected]> +* Inki Dae <[email protected]> +* Minkyu Kang <[email protected]> * * See file CREDITS for list of people who contributed to this * project.
@@ -39,64 +24,29 @@*/ #include <common.h> -#include <asm/proc-armv/ptrace.h> +#include <asm/io.h> #include <asm/arch/s3c6400.h> -#include <div64.h> - -static ulong timer_load_val; +#include <asm/arch/pwm.h> +#include <pwm.h> -#define PRESCALER 167 +DECLARE_GLOBAL_DATA_PTR ; -static s3c64xx_timers *s3c64xx_get_base_timers (void ) -{ -return (s3c64xx_timers *)ELFIN_TIMER_BASE ; -} +static unsigned long get_current_tick (void );/* macro to read the 16 bit timer */ -static inline ulong read_timer (void ) +static inline struct s3c_timer *s3c_get_base_timer (void ) { -s3c64xx_timers *const timers =s3c64xx_get_base_timers (); - -return timers->TCNTO4; +return (struct s3c_timer *)s3c64xx_get_base_timer (); } -/* Internal tick units */ -/* Last decremneter snapshot */ -static unsigned long lastdec; -/* Monotonic incrementing timer */ -static unsigned long long timestamp; -int timer_init (void ) { -s3c64xx_timers *const timers =s3c64xx_get_base_timers (); - -/* use PWM Timer 4 because it has no output */ -/* -* We use the following scheme for the timer: -* Prescaler is hard fixed at 167, divider at 1/4. -* This gives at PCLK frequency 66MHz approx. 10us ticks -* The timer is set to wrap after 100s, at 66MHz this obviously -* happens after 10,000,000 ticks. A long variable can thus -* keep values up to 40,000s, i.e., 11 hours. This should be -* enough for most uses:-) Possible optimizations: select a -* binary-friendly frequency, e.g., 1ms / 128. Also calculate -* the prescaler automatically for other PCLK frequencies. -*/ - timers->TCFG0 =PRESCALER <<8 ; -if (timer_load_val ==0 ) { - timer_load_val =get_PCLK () /PRESCALER * (100 /4 );/* 100s */ - timers->TCFG1 = (timers->TCFG1 & ~0xf0000 ) |0x20000 ; - } - -/* load value for 10 ms timeout */ - lastdec = timers->TCNTB4 = timer_load_val; -/* auto load, manual update of Timer 4 */ - timers->TCON = (timers->TCON & ~0x00700000 ) |TCON_4_AUTO | -TCON_4_UPDATE ; +/* PWM Timer 4 */ +pwm_init (4 ,MUX_DIV_2 ,0 ); +pwm_config (4 ,0 ,0 ); +pwm_enable (4 ); -/* auto load, start Timer 4 */ - timers->TCON = (timers->TCON & ~0x00700000 ) |TCON_4_AUTO |COUNT_4_ON ; - timestamp =0 ; +reset_timer_masked ();return 0 ; }
@@ -104,57 +54,100 @@ int timer_init(void)/* * timer without interrupts */ - -/* -* This function is derived from PowerPC code (read timebase as long long). -* On ARM it just returns the timer value. -*/ -unsigned long long get_ticks (void ) +unsigned long get_timer (unsigned long base) { -ulong now =read_timer (); +return get_timer_masked () - base; +} -if (lastdec >= now) { -/* normal mode */ - timestamp += lastdec - now; +/* delay x useconds */ +void __udelay (unsigned long usec) +{ +struct s3c_timer *const timer =s3c_get_base_timer (); +unsigned long tmo, tmp, count_value; + + count_value =readl (&timer->tcntb4); + +if (usec >=1000 ) { +/* +* if "big" number, spread normalization +* to seconds +* 1. start to normalize for usec to ticks per sec +* 2. find number of "ticks" to wait to achieve target +* 3. finish normalize. +*/ + tmo = usec /1000 ; + tmo *= (CONFIG_SYS_HZ * count_value); + tmo /=1000 ; }else { -/* we have an overflow ... */ - timestamp += lastdec + timer_load_val - now; +/* else small number, don't kill it prior to HZ multiply */ + tmo = usec *CONFIG_SYS_HZ * count_value; + tmo /= (1000 *1000 ); } - lastdec = now; -return timestamp; +/* get current timestamp */ + tmp =get_current_tick (); + +/* if setting this fordward will roll time stamp */ +/* reset "advancing" timestamp to 0, set lastinc value */ +/* else, set advancing stamp wake up time */ +if ((tmo + tmp +1 ) < tmp) +reset_timer_masked (); +else + tmo += tmp; + +/* loop till event */ +while (get_current_tick () < tmo) + + ;/* nop */ } -/* -* This function is derived from PowerPC code (timebase clock frequency). -* On ARM it returns the number of timer ticks per second. -*/ -ulong get_tbclk (void ) +void reset_timer_masked (void ) { -/* We overrun in 100s */ -return (ulong)(timer_load_val /100 ); +struct s3c_timer *const timer =s3c_get_base_timer (); + +/* reset time */ + gd->lastinc =readl (&timer->tcnto4); + gd->tbl =0 ; } -ulong get_timer_masked (void ) +unsigned long get_timer_masked (void ) { -unsigned long long res =get_ticks (); -do_div (res, (timer_load_val / (100 *CONFIG_SYS_HZ ))); -return res; +struct s3c_timer *const timer =s3c_get_base_timer (); +unsigned long count_value =readl (&timer->tcntb4); + +return get_current_tick () / count_value; } -ulong get_timer (ulong base) +static unsigned long get_current_tick (void ) { -return get_timer_masked () - base; +struct s3c_timer *const timer =s3c_get_base_timer (); +unsigned long now =readl (&timer->tcnto4); +unsigned long count_value =readl (&timer->tcntb4); + +if (gd->lastinc >= now) + gd->tbl += gd->lastinc - now; +else + gd->tbl += gd->lastinc + count_value - now; + + gd->lastinc = now; + +return gd->tbl; } -void __udelay (unsigned long usec) +/* +* This function is derived from PowerPC code (read timebase as long long). +* On ARM it just returns the timer value. +*/ +unsigned long long get_ticks (void ) { -unsigned long long tmp; -ulong tmo; - - tmo = (usec +9 ) /10 ; - tmp =get_ticks () + tmo;/* get current timestamp */ +return get_timer (0 ); +} -while (get_ticks () < tmp)/* loop till event */ -/*NOP*/ ; +/* +* This function is derived from PowerPC code (timebase clock frequency). +* On ARM it returns the number of timer ticks per second. +*/ +unsigned long get_tbclk (void ) +{ +return CONFIG_SYS_HZ ; }
Signature · 1 line
1.7.5.4
PATCH 6/13 S3C64xx: mov cpu_init.S to the board directory
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
It just only do the memory init. The memory depend on the design of board.
--- arch/arm/cpu/arm1176/s3c64xx/Makefile | 2 +- arch/arm/cpu/arm1176/s3c64xx/cpu_init.S | 135 ------------------------------- board/samsung/smdk6400/Makefile | 2 +- board/samsung/smdk6400/mem_init.S | 135 +++++++++++++++++++++++++++++++ 4 files changed, 137 insertions(+), 137 deletions(-) delete mode 100644 arch/arm/cpu/arm1176/s3c64xx/cpu_init.S create mode 100644 board/samsung/smdk6400/mem_init.S
arch/arm/cpu/arm1176/s3c64xx/Makefile +1 -1
@@ -30,7 +30,7 @@ LIB = $(obj)lib$(SOC).o SOBJS = reset.o -COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o +COBJS-$(CONFIG_S3C64XX) += speed.o COBJS-y += timer.o COBJS-$(CONFIG_PWM) += pwm.o
arch/arm/cpu/arm1176/s3c64xx/cpu_init.S deleted +0 -135
135 lines not on this page · raw message
board/samsung/smdk6400/Makefile +1 -1
@@ -29,7 +29,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o COBJS-y := smdk6400.o -SOBJS := lowlevel_init.o +SOBJS := lowlevel_init.o mem_init.o SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(COBJS-y))
board/samsung/smdk6400/mem_init.S new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 7/13 S3C6400: Delete nand_spl for S3C6400
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
The old spl use nand_spl directory file to support nand flash boot. We will adopt the new SPL framework to implement it.
--- board/samsung/smdk6400/config.mk | 28 ------- boards.cfg | 4 +- include/configs/smdk6400.h | 4 +- nand_spl/board/samsung/smdk6400/Makefile | 117 ---------------------------- nand_spl/board/samsung/smdk6400/config.mk | 40 ---------- nand_spl/board/samsung/smdk6400/u-boot.lds | 78 ------------------ 6 files changed, 4 insertions(+), 267 deletions(-) delete mode 100644 board/samsung/smdk6400/config.mk delete mode 100644 nand_spl/board/samsung/smdk6400/Makefile delete mode 100644 nand_spl/board/samsung/smdk6400/config.mk delete mode 100644 nand_spl/board/samsung/smdk6400/u-boot.lds
board/samsung/smdk6400/config.mk deleted +0 -28
@@ -1,28 +0,0 @@ -# -# (C) Copyright 2002 -# Gary Jennejohn, DENX Software Engineering, <[email protected]> -# David Mueller, ELSOFT AG, <[email protected]> -# -# (C) Copyright 2008 -# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]> -# -# SAMSUNG SMDK6400 board with mDirac3 (ARM1176) cpu -# -# see http://www.samsung.com/ for more information on SAMSUNG - -# On SMDK6400 we use the 64 MB SDRAM bank at -# -# 0x50000000 to 0x58000000 -# -# Linux-Kernel is expected to be at 0x50008000, entry 0x50008000 -# -# we load ourselves to 0x57e00000 without MMU -# with MMU, load address is changed to 0xc7e00000 -# -# download area is 0x5000c000 - -ifndef CONFIG_NAND_SPL -CONFIG_SYS_TEXT_BASE = $(CONFIG_RAM_TEXT) -else -CONFIG_SYS_TEXT_BASE = 0 -endif
boards.cfg +2 -2
@@ -47,8 +47,8 @@ flea3 arm arm1136 - CarMedi mx35pdk arm arm1136 - freescale mx35 apollon arm arm1136 apollon - omap24xx omap2420h4 arm arm1136 - ti omap24xx -smdk6400 arm arm1176 smdk6400 samsung s3c64xx smdk6400:NAND_U_BOOT,RAM_TEXT=0xc7e00000 -smdk6400_nousb arm arm1176 smdk6400 samsung s3c64xx smdk6400:NAND_U_BOOT,RAM_TEXT=0x57e00000 +smdk6400 arm arm1176 smdk6400 samsung s3c64xx smdk6400:SYS_TEXT_BASE=0x57e00000 +smdk6400_nousb arm arm1176 smdk6400 samsung s3c64xx smdk6400:SYS_TEXT_BASE=0xc7e00000 tnetv107x_evm arm arm1176 tnetv107xevm ti tnetv107x integratorap_cm720t arm arm720t integrator armltd - integratorap:CM720T integratorap_cm920t arm arm920t integrator armltd - integratorap:CM920T
include/configs/smdk6400.h +2 -2
@@ -54,7 +54,7 @@/* input clock of PLL: SMDK6400 has 12MHz input clock */ #define CONFIG_SYS_CLK_FREQ 12000000 -#if !defined(CONFIG_NAND_U_BOOT ) && (CONFIG_SYS_TEXT_BASE >=0xc0000000 ) +#if !defined(CONFIG_SPL_BUILD ) && (CONFIG_SYS_TEXT_BASE >=0xc0000000 )#define CONFIG_ENABLE_MMU #endif
@@ -113,7 +113,6 @@#define CONFIG_CMD_PING #define CONFIG_CMD_ELF #define CONFIG_CMD_FAT -#define CONFIG_CMD_EXT2 #define CONFIG_BOOTDELAY 3
@@ -288,6 +287,7 @@#if !defined(CONFIG_ENABLE_MMU )#define CONFIG_CMD_USB 1 +#define CONFIG_CMD_EXT2 #define CONFIG_USB_S3C64XX #define CONFIG_USB_OHCI_NEW 1#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x74300000
nand_spl/board/samsung/smdk6400/Makefile deleted +0 -117
117 lines not on this page · raw message
nand_spl/board/samsung/smdk6400/config.mk deleted +0 -40
@@ -1,40 +0,0 @@ -# -# (C) Copyright 2006 -# Stefan Roese, DENX Software Engineering, sr at denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This 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, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# -# -# Samsung S3C64xx Reference Platform (smdk6400) board - -# CONFIG_SYS_TEXT_BASE for SPL: -# -# On S3C64xx platforms the SPL is located in SRAM@0. -# -# CONFIG_SYS_TEXT_BASE = 0 - -include $(TOPDIR)/board/$(BOARDDIR)/config.mk - -# PAD_TO used to generate a 4kByte binary needed for the combined image -# -> PAD_TO = CONFIG_SYS_TEXT_BASE + 4096 -PAD_TO := $(shell expr $$[$(CONFIG_SYS_TEXT_BASE) + 4096]) - -ifeq ($(debug),1) -PLATFORM_CPPFLAGS += -DDEBUG -endif
nand_spl/board/samsung/smdk6400/u-boot.lds deleted +0 -78
78 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 7/13 S3C6400: Delete nand_spl for S3C6400
Quoted 7 lines · Zhong Hongbo
From: Zhong Hongbo <[email protected]>
The old spl use
nand_spldirectory file to support nand flash boot. We will adopt the new SPL framework to implement it.Signed-off-by Zhong Hongbo <[email protected]>
Quoted 12 lines
--- board/samsung/smdk6400/config.mk | 28 ------- boards.cfg | 4 +- include/configs/smdk6400.h | 4 +- nand_spl/board/samsung/smdk6400/Makefile | 117 ---------------------------- nand_spl/board/samsung/smdk6400/config.mk | 40 ---------- nand_spl/board/samsung/smdk6400/u-boot.lds | 78 ------------------ 6 files changed, 4 insertions(+), 267 deletions(-) delete mode 100644 board/samsung/smdk6400/config.mk delete mode 100644 nand_spl/board/samsung/smdk6400/Makefile delete mode 100644 nand_spl/board/samsung/smdk6400/config.mk delete mode 100644 nand_spl/board/samsung/smdk6400/u-boot.lds
Shouldn't this come after the introduction of new SPL support, to preserve bisectability?
Quoted 9 lines
include/configs/smdk6400.h +0
-1@@ -113,7 +113,6 @@#define CONFIG_CMD_PING #define CONFIG_CMD_ELF #define CONFIG_CMD_FAT -#define CONFIG_CMD_EXT2 #define CONFIG_BOOTDELAY 3
include/configs/smdk6400.h line 293
Quoted 7 lines
include/configs/smdk6400.h +1
-0@@ -288,6 +287,7 @@#if !defined(CONFIG_ENABLE_MMU )#define CONFIG_CMD_USB 1 +#define CONFIG_CMD_EXT2 #define CONFIG_USB_S3C64XX #define CONFIG_USB_OHCI_NEW 1#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x74300000
I'm not sure how this is relevant.
-Scott
PATCH 8/13 S3C6400: Adopt SPL framwork to support spl for nand flash
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
Adopt the new SPL framework to implement the SPL booting of the nand flash for S3C6400.
--- arch/arm/cpu/arm1176/start.S | 17 +--- board/samsung/smdk6400/Makefile | 29 +++++- board/samsung/smdk6400/lowlevel_init.S | 4 +- board/samsung/smdk6400/smdk6400_nand_spl.c | 61 ++++++++++-- board/samsung/smdk6400/tools/mksmdk6400_image.c | 117 +++++++++++++++++++++++ drivers/mtd/nand/s3c64xx.c | 4 +- include/configs/smdk6400.h | 34 ++----- 7 files changed, 211 insertions(+), 55 deletions(-) create mode 100644 board/samsung/smdk6400/tools/mksmdk6400_image.c
arch/arm/cpu/arm1176/start.S +5 -12
@@ -51,7 +51,7 @@ .globl _start _start: b reset -#ifndef CONFIG_NAND_SPL +#ifndef CONFIG_SPL_BUILD ldr pc, _undefined_instruction ldr pc, _software_interrupt ldr pc, _prefetch_abort
@@ -164,7 +164,7 @@ cpu_init_crit: * When booting from NAND - it has definitely been a reset, so, no need * to flush caches and disable the MMU */ -#ifndef CONFIG_NAND_SPL +#ifndef CONFIG_SPL_BUILD /* * flush v4 I/D caches */
@@ -252,6 +252,7 @@ stack_setup: adr r0, _start cmp r0, r6 + mov r9, #0 beq clear_bss /* skip relocation */ mov r1, r6 /* r1 <- scratch for copy_loop */ ldr r3, _bss_start_ofs
@@ -356,21 +357,14 @@ clbss_l:str r2, [r0] /* clear loop... */ cmp r0, r1 bne clbss_l -#ifndef CONFIG_NAND_SPL bl coloured_LED_init bl red_led_on #endif -#endif /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ -#ifdef CONFIG_NAND_SPL - ldr pc, _nand_boot - -_nand_boot: .word nand_boot -#else ldr r0, _board_init_r_ofs adr r1, _start add lr, r0, r1
@@ -383,7 +377,6 @@ _nand_boot: .word nand_boot _board_init_r_ofs: .word board_init_r - _start -#endif _rel_dyn_start_ofs: .word __rel_dyn_start - _start
@@ -397,7 +390,7 @@ _mmu_table_base: .word mmu_table #endif -#ifndef CONFIG_NAND_SPL +#ifndef CONFIG_SPL_BUILD /* * we assume that cache operation is done before. (eg. cleanup_before_linux()) * actually, we don't need to do anything about cache if not use d-cache in
@@ -575,4 +568,4 @@ fiq: get_bad_stack bad_save_user_regs bl do_fiq -#endif /* CONFIG_NAND_SPL */ +#endif /* CONFIG_SPL_BUILD */
board/samsung/smdk6400/Makefile +24 -5
@@ -28,15 +28,34 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o +ifndef CONFIG_SPL_BUILD COBJS-y := smdk6400.o +endif + SOBJS := lowlevel_init.o mem_init.o -SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS-y)) -SOBJS := $(addprefix $(obj),$(SOBJS)) +ifdef CONFIG_SPL_BUILD +COBJS-y += smdk6400_nand_spl.o +endif + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS)) + +ALL := $(obj).depend $(LIB) + +ifdef CONFIG_SPL_BUILD +ALL += $(OBJTREE)/tools/mk$(BOARD)spl +endif + +all: $(ALL) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) -$(LIB): $(obj).depend $(SOBJS) $(OBJS) - $(call cmd_link_o_target, $(SOBJS) $(OBJS)) +ifdef CONFIG_SPL_BUILD +$(OBJTREE)/tools/mk$(BOARD)spl: tools/mksmdk6400_image.c + $(HOSTCC) tools/mksmdk6400_image.c -o $(OBJTREE)/tools/mk$(BOARD)spl +endif #########################################################################
board/samsung/smdk6400/lowlevel_init.S +2 -2
@@ -86,7 +86,7 @@ lowlevel_init: /* init system clock */ bl system_clock_init -#ifndef CONFIG_NAND_SPL +#ifndef CONFIG_SPL_BUILD /* for UART */ bl uart_asm_init #endif
@@ -243,7 +243,7 @@ wait_for_async: mov pc, lr -#ifndef CONFIG_NAND_SPL +#ifndef CONFIG_SPL_BUILD /* * uart_asm_init: Initialize UART's pins */
board/samsung/smdk6400/smdk6400_nand_spl.c +50 -11
72 lines not on this page · raw message
board/samsung/smdk6400/tools/mksmdk6400_image.c new file +117 -0
117 lines not on this page · raw message
drivers/mtd/nand/s3c64xx.c +2 -2
@@ -39,7 +39,7 @@#define MAX_CHIPS 2static int nand_cs[MAX_CHIPS ] = {0 ,1 }; -#ifdef CONFIG_NAND_SPL +#ifdef CONFIG_SPL_BUILD #define printf(arg...) do {} while (0)#endif
@@ -285,7 +285,7 @@ int board_nand_init(struct nand_chip *nand) nand->dev_ready = s3c_nand_device_ready; nand->select_chip = s3c_nand_select_chip; nand->options =0 ; -#ifdef CONFIG_NAND_SPL +#ifdef CONFIG_SPL_BUILD nand->read_byte = nand_read_byte; nand->write_buf = nand_write_buf; nand->read_buf = nand_read_buf;
include/configs/smdk6400.h +11 -23
@@ -107,9 +107,6 @@#define CONFIG_CMD_LOADB #define CONFIG_CMD_SAVEENV #define CONFIG_CMD_NAND -#if defined(CONFIG_BOOT_ONENAND ) -#define CONFIG_CMD_ONENAND -#endif #define CONFIG_CMD_PING #define CONFIG_CMD_ELF #define CONFIG_CMD_FAT
@@ -237,11 +234,10 @@#define CONFIG_SYS_NAND_YAFFS_WRITE 1/* support yaffs write */ #define CONFIG_SYS_NAND_BBT_2NDPAGE 1/* bad-block markers in 1st and 2nd pages */ -#define CONFIG_SYS_NAND_U_BOOT_DST CONFIG_SYS_PHY_UBOOT_BASE/* NUB load-addr */ -#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST/* NUB start-addr */ - -#define CONFIG_SYS_NAND_U_BOOT_OFFS (4 * 1024)/* Offset to RAM U-Boot image */ -#define CONFIG_SYS_NAND_U_BOOT_SIZE (252 * 1024)/* Size of RAM U-Boot image */ +/* Offset to RAM U-Boot image */ +#define CONFIG_SYS_NAND_U_BOOT_OFFS (16 * 1024) +/* Size of RAM U-Boot image */ +#define CONFIG_SYS_NAND_U_BOOT_SIZE (252 * 1024)/* NAND chip page size */ #define CONFIG_SYS_NAND_PAGE_SIZE 2048
@@ -265,26 +261,18 @@ 48, 49, 50, 51, 52, 53, 54, 55, \ 56, 57, 58, 59, 60, 61, 62, 63} -/* Boot configuration (define only one of next 3) */ -#define CONFIG_BOOT_NAND -/* None of these are currently implemented. Left from the original Samsung -* version for reference -#define CONFIG_BOOT_NOR -#define CONFIG_BOOT_MOVINAND -#define CONFIG_BOOT_ONENAND -*/ +#define CONFIG_SPL +#define CONFIG_SPL_NAND +#define CONFIG_SPL_NAND_SIMPLE +#define CONFIG_SPL_NAND_SUPPORT -#define CONFIG_NAND +#define CONFIG_SPL_TEXT_BASE 0xd0020000 +#define CONFIG_SPL_STACK CONFIG_SYS_PHY_UBOOT_BASE - CONFIG_SYS_MALLOC_LEN#define CONFIG_NAND_S3C64XX -/* Unimplemented or unsupported. See comment above. -#define CONFIG_ONENAND -#define CONFIG_MOVINAND -*/ - +#define CONFIG_SPL_LIBGENERIC_SUPPORT /* Settings as above boot configuration */ #define CONFIG_ENV_IS_IN_NAND #define CONFIG_BOOTARGS "console=ttySAC,115200" -#if !defined(CONFIG_ENABLE_MMU )#define CONFIG_CMD_USB 1#define CONFIG_CMD_EXT2
Signature · 1 line
1.7.5.4
PATCH 9/13 S3C64XX: Change SROM init to use read/write operation
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
--- arch/arm/cpu/arm1176/s3c64xx/Makefile | 2 +- arch/arm/cpu/arm1176/s3c64xx/srom.c | 52 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-s3c64xx/s3c6400.h | 13 +++---- arch/arm/include/asm/arch-s3c64xx/sromc.h | 49 +++++++++++++++++++++++++ board/samsung/smdk6400/smdk6400.c | 38 ++++++++++++++------ include/configs/smdk6400.h | 1 + 6 files changed, 135 insertions(+), 20 deletions(-) create mode 100644 arch/arm/cpu/arm1176/s3c64xx/srom.c create mode 100644 arch/arm/include/asm/arch-s3c64xx/sromc.h
arch/arm/cpu/arm1176/s3c64xx/Makefile +1 -1
@@ -30,7 +30,7 @@ LIB = $(obj)lib$(SOC).o SOBJS = reset.o -COBJS-$(CONFIG_S3C64XX) += speed.o +COBJS-$(CONFIG_S3C64XX) += speed.o srom.o COBJS-y += timer.o COBJS-$(CONFIG_PWM) += pwm.o
arch/arm/cpu/arm1176/s3c64xx/srom.c new file +52 -0
52 lines not on this page · raw message
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +5 -8
@@ -471,14 +471,6 @@*/ #define ELFIN_SROM_BASE 0x70000000 -#define SROM_BW_REG __REG(ELFIN_SROM_BASE + 0x0) -#define SROM_BC0_REG __REG(ELFIN_SROM_BASE + 0x4) -#define SROM_BC1_REG __REG(ELFIN_SROM_BASE + 0x8) -#define SROM_BC2_REG __REG(ELFIN_SROM_BASE + 0xC) -#define SROM_BC3_REG __REG(ELFIN_SROM_BASE + 0x10) -#define SROM_BC4_REG __REG(ELFIN_SROM_BASE + 0x14) -#define SROM_BC5_REG __REG(ELFIN_SROM_BASE + 0x18) -/* * SDRAM Controller */
@@ -721,6 +713,11 @@ static inline unsigned int s3c64xx_get_base_timer(void) {return ELFIN_TIMER_BASE ; } + +static inline unsigned int s3c64xx_get_base_sromc (void ) +{ +return ELFIN_SROM_BASE ; +}#endif #endif /*__S3C6400_H__*/
arch/arm/include/asm/arch-s3c64xx/sromc.h new file +49 -0
49 lines not on this page · raw message
board/samsung/smdk6400/smdk6400.c +27 -11
@@ -30,6 +30,7 @@#include <common.h> #include <netdev.h> +#include <asm/arch/sromc.h> #include <asm/arch/s3c6400.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -53,25 +54,40 @@ static inline void delay(unsigned long loops)/* * Miscellaneous platform dependent initialisations */ - +#ifdef CONFIG_CS8900 static void cs8900_pre_init (void ) { -SROM_BW_REG &= ~(0xf <<4 ); -SROM_BW_REG |= (1 <<7 ) | (1 <<6 ) | (1 <<4 ); -SROM_BC1_REG = ((CS8900_Tacs <<28 ) + (CS8900_Tcos <<24 ) + - (CS8900_Tacc <<16 ) + (CS8900_Tcoh <<12 ) + - (CS8900_Tah <<8 ) + (CS8900_Tacp <<4 ) +CS8900_PMC ); +u32 smc_bw_conf, smc_bc_conf; + +/* Ethernet needs bus width of 16 bits */ + smc_bw_conf =SROMC_DATA16_WIDTH (CONFIG_ENV_SROM_BANK ) + |SROMC_WAIT_ENABLE (CONFIG_ENV_SROM_BANK ) + |SROMC_BYTE_ENABLE (CONFIG_ENV_SROM_BANK ); + smc_bc_conf =SROMC_BC_TACS (CS8900_Tacs) + |SROMC_BC_TCOS (CS8900_Tcos) + |SROMC_BC_TACC (CS8900_Tacc) + |SROMC_BC_TCOH (CS8900_Tcoh) + |SROMC_BC_TAH (CS8900_Tah) + |SROMC_BC_TACP (CS8900_Tacp) + |SROMC_BC_PMC (CS8900_PMC ); + +/* Select and configure the SROMC bank */ +s3c64xx_config_sromc (CONFIG_ENV_SROM_BANK , smc_bw_conf, smc_bc_conf); + +} +#else +#define cs8900_pre_init () do {} while (0) +#endif + +static void norflash_srom_init (void ) +{ +u32 smc_bw_conf, smc_bc_conf; }int board_init (void ) {cs8900_pre_init (); -/* NOR-flash in SROM0 */ - -/* Enable WAIT */ -SROM_BW_REG |=4 |8 |1 ; - gd->bd->bi_boot_params =PHYS_SDRAM_1 +0x100 ;return 0 ;
include/configs/smdk6400.h +1 -0
@@ -78,6 +78,7 @@/* * Hardware drivers */ +#define CONFIG_ENV_SROM_BANK 2/* Select SROM Bank-2 for Ethernet*/ #define CONFIG_CS8900 /* we have a CS8900 on-board */ #define CONFIG_CS8900_BASE 0x18800300#define CONFIG_CS8900_BUS16 /* follow the Linux driver */
Signature · 1 line
1.7.5.4
PATCH 10/13 S3C64XX: Switch to use read/writel to operation clock system
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
--- arch/arm/cpu/arm1176/s3c64xx/reset.S | 4 +- arch/arm/cpu/arm1176/s3c64xx/speed.c | 50 ++++++--- arch/arm/include/asm/arch-s3c64xx/clock.h | 147 +++++++++++++++++++++++ arch/arm/include/asm/arch-s3c64xx/s3c6400.h | 167 +-------------------------- board/samsung/smdk6400/lowlevel_init.S | 58 ++++------ drivers/usb/host/s3c64xx-hcd.c | 30 +++++- 6 files changed, 240 insertions(+), 216 deletions(-) create mode 100644 arch/arm/include/asm/arch-s3c64xx/clock.h
arch/arm/cpu/arm1176/s3c64xx/reset.S +2 -2
@@ -26,9 +26,9 @@ .globl reset_cpu reset_cpu: ldr r1, =ELFIN_CLOCK_POWER_BASE - ldr r2, [r1, #SYS_ID_OFFSET] + ldr r2, [r1, #0x118] @ SYS_ID_OFFSET ldr r3, =0xffff and r2, r3, r2, lsr #12 - str r2, [r1, #SW_RST_OFFSET] + str r2, [r1, #0x114] @ SW_RST_OFFSET _loop_forever: b _loop_forever
arch/arm/cpu/arm1176/s3c64xx/speed.c +35 -15
114 lines not on this page · raw message
arch/arm/include/asm/arch-s3c64xx/clock.h new file +147 -0
147 lines not on this page · raw message
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +5 -162
179 lines not on this page · raw message
board/samsung/smdk6400/lowlevel_init.S +24 -34
143 lines not on this page · raw message
drivers/usb/host/s3c64xx-hcd.c +27 -3
@@ -25,21 +25,45 @@*/ #include <common.h> +#include <asm/io.h> #include <asm/arch/s3c6400.h> +#include <asm/arch/clock.h> int usb_cpu_init (void ) { -OTHERS_REG |=0x10000 ; +unsigned int val; +struct s3c64xx_clock *clk = + (struct s3c64xx_clock *)s3c64xx_get_base_clock (); + + val =readl (&clk->others); + val |=0x10000 ; +writel (val, &clk->others); +return 0 ; }int usb_cpu_stop (void ) { -OTHERS_REG &= ~0x10000 ; +unsigned int val; +struct s3c64xx_clock *clk = + (struct s3c64xx_clock *)s3c64xx_get_base_clock (); + + val =readl (&clk->others); + val &= ~0x10000 ; +writel (val, &clk->others); +return 0 ; }void usb_cpu_init_fail (void ) { -OTHERS_REG &= ~0x10000 ; +unsigned int val; +struct s3c64xx_clock *clk = + (struct s3c64xx_clock *)s3c64xx_get_base_clock (); + + val =readl (&clk->others); + val &= ~0x10000 ; +writel (val, &clk->others); + +return 0 ; }
Signature · 1 line
1.7.5.4
PATCH 11/13 S3c64xx: clear GPIO, Interrupt, Watchdog flag.
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
--- arch/arm/include/asm/arch-s3c64xx/s3c6400.h | 294 +-------------------------- board/samsung/smdk6400/lowlevel_init.S | 50 ++--- board/samsung/smdk6400/mem_init.S | 4 + 3 files changed, 30 insertions(+), 318 deletions(-)
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +4 -290
@@ -47,172 +47,6 @@*/ #define ELFIN_GPIO_BASE 0x7f008000 -#define GPACON_OFFSET 0x00 -#define GPADAT_OFFSET 0x04 -#define GPAPUD_OFFSET 0x08 -#define GPACONSLP_OFFSET 0x0C -#define GPAPUDSLP_OFFSET 0x10 -#define GPBCON_OFFSET 0x20 -#define GPBDAT_OFFSET 0x24 -#define GPBPUD_OFFSET 0x28 -#define GPBCONSLP_OFFSET 0x2C -#define GPBPUDSLP_OFFSET 0x30 -#define GPCCON_OFFSET 0x40 -#define GPCDAT_OFFSET 0x44 -#define GPCPUD_OFFSET 0x48 -#define GPCCONSLP_OFFSET 0x4C -#define GPCPUDSLP_OFFSET 0x50 -#define GPDCON_OFFSET 0x60 -#define GPDDAT_OFFSET 0x64 -#define GPDPUD_OFFSET 0x68 -#define GPDCONSLP_OFFSET 0x6C -#define GPDPUDSLP_OFFSET 0x70 -#define GPECON_OFFSET 0x80 -#define GPEDAT_OFFSET 0x84 -#define GPEPUD_OFFSET 0x88 -#define GPECONSLP_OFFSET 0x8C -#define GPEPUDSLP_OFFSET 0x90 -#define GPFCON_OFFSET 0xA0 -#define GPFDAT_OFFSET 0xA4 -#define GPFPUD_OFFSET 0xA8 -#define GPFCONSLP_OFFSET 0xAC -#define GPFPUDSLP_OFFSET 0xB0 -#define GPGCON_OFFSET 0xC0 -#define GPGDAT_OFFSET 0xC4 -#define GPGPUD_OFFSET 0xC8 -#define GPGCONSLP_OFFSET 0xCC -#define GPGPUDSLP_OFFSET 0xD0 -#define GPHCON0_OFFSET 0xE0 -#define GPHCON1_OFFSET 0xE4 -#define GPHDAT_OFFSET 0xE8 -#define GPHPUD_OFFSET 0xEC -#define GPHCONSLP_OFFSET 0xF0 -#define GPHPUDSLP_OFFSET 0xF4 -#define GPICON_OFFSET 0x100 -#define GPIDAT_OFFSET 0x104 -#define GPIPUD_OFFSET 0x108 -#define GPICONSLP_OFFSET 0x10C -#define GPIPUDSLP_OFFSET 0x110 -#define GPJCON_OFFSET 0x120 -#define GPJDAT_OFFSET 0x124 -#define GPJPUD_OFFSET 0x128 -#define GPJCONSLP_OFFSET 0x12C -#define GPJPUDSLP_OFFSET 0x130 -#define MEM0DRVCON_OFFSET 0x1D0 -#define MEM1DRVCON_OFFSET 0x1D4 -#define GPKCON0_OFFSET 0x800 -#define GPKCON1_OFFSET 0x804 -#define GPKDAT_OFFSET 0x808 -#define GPKPUD_OFFSET 0x80C -#define GPLCON0_OFFSET 0x810 -#define GPLCON1_OFFSET 0x814 -#define GPLDAT_OFFSET 0x818 -#define GPLPUD_OFFSET 0x81C -#define GPMCON_OFFSET 0x820 -#define GPMDAT_OFFSET 0x824 -#define GPMPUD_OFFSET 0x828 -#define GPNCON_OFFSET 0x830 -#define GPNDAT_OFFSET 0x834 -#define GPNPUD_OFFSET 0x838 -#define GPOCON_OFFSET 0x140 -#define GPODAT_OFFSET 0x144 -#define GPOPUD_OFFSET 0x148 -#define GPOCONSLP_OFFSET 0x14C -#define GPOPUDSLP_OFFSET 0x150 -#define GPPCON_OFFSET 0x160 -#define GPPDAT_OFFSET 0x164 -#define GPPPUD_OFFSET 0x168 -#define GPPCONSLP_OFFSET 0x16C -#define GPPPUDSLP_OFFSET 0x170 -#define GPQCON_OFFSET 0x180 -#define GPQDAT_OFFSET 0x184 -#define GPQPUD_OFFSET 0x188 -#define GPQCONSLP_OFFSET 0x18C -#define GPQPUDSLP_OFFSET 0x190 - -#define EINTPEND_OFFSET 0x924 - -#define GPACON_REG __REG(ELFIN_GPIO_BASE + GPACON_OFFSET) -#define GPADAT_REG __REG(ELFIN_GPIO_BASE + GPADAT_OFFSET) -#define GPAPUD_REG __REG(ELFIN_GPIO_BASE + GPAPUD_OFFSET) -#define GPACONSLP_REG __REG(ELFIN_GPIO_BASE + GPACONSLP_OFFSET) -#define GPAPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPAPUDSLP_OFFSET) -#define GPBCON_REG __REG(ELFIN_GPIO_BASE + GPBCON_OFFSET) -#define GPBDAT_REG __REG(ELFIN_GPIO_BASE + GPBDAT_OFFSET) -#define GPBPUD_REG __REG(ELFIN_GPIO_BASE + GPBPUD_OFFSET) -#define GPBCONSLP_REG __REG(ELFIN_GPIO_BASE + GPBCONSLP_OFFSET) -#define GPBPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPBPUDSLP_OFFSET) -#define GPCCON_REG __REG(ELFIN_GPIO_BASE + GPCCON_OFFSET) -#define GPCDAT_REG __REG(ELFIN_GPIO_BASE + GPCDAT_OFFSET) -#define GPCPUD_REG __REG(ELFIN_GPIO_BASE + GPCPUD_OFFSET) -#define GPCCONSLP_REG __REG(ELFIN_GPIO_BASE + GPCCONSLP_OFFSET) -#define GPCPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPCPUDSLP_OFFSET) -#define GPDCON_REG __REG(ELFIN_GPIO_BASE + GPDCON_OFFSET) -#define GPDDAT_REG __REG(ELFIN_GPIO_BASE + GPDDAT_OFFSET) -#define GPDPUD_REG __REG(ELFIN_GPIO_BASE + GPDPUD_OFFSET) -#define GPDCONSLP_REG __REG(ELFIN_GPIO_BASE + GPDCONSLP_OFFSET) -#define GPDPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPDPUDSLP_OFFSET) -#define GPECON_REG __REG(ELFIN_GPIO_BASE + GPECON_OFFSET) -#define GPEDAT_REG __REG(ELFIN_GPIO_BASE + GPEDAT_OFFSET) -#define GPEPUD_REG __REG(ELFIN_GPIO_BASE + GPEPUD_OFFSET) -#define GPECONSLP_REG __REG(ELFIN_GPIO_BASE + GPECONSLP_OFFSET) -#define GPEPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPEPUDSLP_OFFSET) -#define GPFCON_REG __REG(ELFIN_GPIO_BASE + GPFCON_OFFSET) -#define GPFDAT_REG __REG(ELFIN_GPIO_BASE + GPFDAT_OFFSET) -#define GPFPUD_REG __REG(ELFIN_GPIO_BASE + GPFPUD_OFFSET) -#define GPFCONSLP_REG __REG(ELFIN_GPIO_BASE + GPFCONSLP_OFFSET) -#define GPFPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPFPUDSLP_OFFSET) -#define GPGCON_REG __REG(ELFIN_GPIO_BASE + GPGCON_OFFSET) -#define GPGDAT_REG __REG(ELFIN_GPIO_BASE + GPGDAT_OFFSET) -#define GPGPUD_REG __REG(ELFIN_GPIO_BASE + GPGPUD_OFFSET) -#define GPGCONSLP_REG __REG(ELFIN_GPIO_BASE + GPGCONSLP_OFFSET) -#define GPGPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPGPUDSLP_OFFSET) -#define GPHCON0_REG __REG(ELFIN_GPIO_BASE + GPHCON0_OFFSET) -#define GPHCON1_REG __REG(ELFIN_GPIO_BASE + GPHCON1_OFFSET) -#define GPHDAT_REG __REG(ELFIN_GPIO_BASE + GPHDAT_OFFSET) -#define GPHPUD_REG __REG(ELFIN_GPIO_BASE + GPHPUD_OFFSET) -#define GPHCONSLP_REG __REG(ELFIN_GPIO_BASE + GPHCONSLP_OFFSET) -#define GPHPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPHPUDSLP_OFFSET) -#define GPICON_REG __REG(ELFIN_GPIO_BASE + GPICON_OFFSET) -#define GPIDAT_REG __REG(ELFIN_GPIO_BASE + GPIDAT_OFFSET) -#define GPIPUD_REG __REG(ELFIN_GPIO_BASE + GPIPUD_OFFSET) -#define GPICONSLP_REG __REG(ELFIN_GPIO_BASE + GPICONSLP_OFFSET) -#define GPIPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPIPUDSLP_OFFSET) -#define GPJCON_REG __REG(ELFIN_GPIO_BASE + GPJCON_OFFSET) -#define GPJDAT_REG __REG(ELFIN_GPIO_BASE + GPJDAT_OFFSET) -#define GPJPUD_REG __REG(ELFIN_GPIO_BASE + GPJPUD_OFFSET) -#define GPJCONSLP_REG __REG(ELFIN_GPIO_BASE + GPJCONSLP_OFFSET) -#define GPJPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPJPUDSLP_OFFSET) -#define GPKCON0_REG __REG(ELFIN_GPIO_BASE + GPKCON0_OFFSET) -#define GPKCON1_REG __REG(ELFIN_GPIO_BASE + GPKCON1_OFFSET) -#define GPKDAT_REG __REG(ELFIN_GPIO_BASE + GPKDAT_OFFSET) -#define GPKPUD_REG __REG(ELFIN_GPIO_BASE + GPKPUD_OFFSET) -#define GPLCON0_REG __REG(ELFIN_GPIO_BASE + GPLCON0_OFFSET) -#define GPLCON1_REG __REG(ELFIN_GPIO_BASE + GPLCON1_OFFSET) -#define GPLDAT_REG __REG(ELFIN_GPIO_BASE + GPLDAT_OFFSET) -#define GPLPUD_REG __REG(ELFIN_GPIO_BASE + GPLPUD_OFFSET) -#define GPMCON_REG __REG(ELFIN_GPIO_BASE + GPMCON_OFFSET) -#define GPMDAT_REG __REG(ELFIN_GPIO_BASE + GPMDAT_OFFSET) -#define GPMPUD_REG __REG(ELFIN_GPIO_BASE + GPMPUD_OFFSET) -#define GPNCON_REG __REG(ELFIN_GPIO_BASE + GPNCON_OFFSET) -#define GPNDAT_REG __REG(ELFIN_GPIO_BASE + GPNDAT_OFFSET) -#define GPNPUD_REG __REG(ELFIN_GPIO_BASE + GPNPUD_OFFSET) -#define GPOCON_REG __REG(ELFIN_GPIO_BASE + GPOCON_OFFSET) -#define GPODAT_REG __REG(ELFIN_GPIO_BASE + GPODAT_OFFSET) -#define GPOPUD_REG __REG(ELFIN_GPIO_BASE + GPOPUD_OFFSET) -#define GPOCONSLP_REG __REG(ELFIN_GPIO_BASE + GPOCONSLP_OFFSET) -#define GPOPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPOPUDSLP_OFFSET) -#define GPPCON_REG __REG(ELFIN_GPIO_BASE + GPPCON_OFFSET) -#define GPPDAT_REG __REG(ELFIN_GPIO_BASE + GPPDAT_OFFSET) -#define GPPPUD_REG __REG(ELFIN_GPIO_BASE + GPPPUD_OFFSET) -#define GPPCONSLP_REG __REG(ELFIN_GPIO_BASE + GPPCONSLP_OFFSET) -#define GPPPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPPPUDSLP_OFFSET) -#define GPQCON_REG __REG(ELFIN_GPIO_BASE + GPQCON_OFFSET) -#define GPQDAT_REG __REG(ELFIN_GPIO_BASE + GPQDAT_OFFSET) -#define GPQPUD_REG __REG(ELFIN_GPIO_BASE + GPQPUD_OFFSET) -#define GPQCONSLP_REG __REG(ELFIN_GPIO_BASE + GPQCONSLP_OFFSET) -#define GPQPUDSLP_REG __REG(ELFIN_GPIO_BASE + GPQPUDSLP_OFFSET) -/* * Bus Matrix */
@@ -220,90 +54,6 @@#define S3C64XX_MEM_SYS_CFG_16BIT (1 << 12) -#define S3C64XX_MEM_SYS_CFG_NAND 0x0008 -#define S3C64XX_MEM_SYS_CFG_ONENAND S3C64XX_MEM_SYS_CFG_16BIT - -#define GPACON (ELFIN_GPIO_BASE + GPACON_OFFSET) -#define GPADAT (ELFIN_GPIO_BASE + GPADAT_OFFSET) -#define GPAPUD (ELFIN_GPIO_BASE + GPAPUD_OFFSET) -#define GPACONSLP (ELFIN_GPIO_BASE + GPACONSLP_OFFSET) -#define GPAPUDSLP (ELFIN_GPIO_BASE + GPAPUDSLP_OFFSET) -#define GPBCON (ELFIN_GPIO_BASE + GPBCON_OFFSET) -#define GPBDAT (ELFIN_GPIO_BASE + GPBDAT_OFFSET) -#define GPBPUD (ELFIN_GPIO_BASE + GPBPUD_OFFSET) -#define GPBCONSLP (ELFIN_GPIO_BASE + GPBCONSLP_OFFSET) -#define GPBPUDSLP (ELFIN_GPIO_BASE + GPBPUDSLP_OFFSET) -#define GPCCON (ELFIN_GPIO_BASE + GPCCON_OFFSET) -#define GPCDAT (ELFIN_GPIO_BASE + GPCDAT_OFFSET) -#define GPCPUD (ELFIN_GPIO_BASE + GPCPUD_OFFSET) -#define GPCCONSLP (ELFIN_GPIO_BASE + GPCCONSLP_OFFSET) -#define GPCPUDSLP (ELFIN_GPIO_BASE + GPCPUDSLP_OFFSET) -#define GPDCON (ELFIN_GPIO_BASE + GPDCON_OFFSET) -#define GPDDAT (ELFIN_GPIO_BASE + GPDDAT_OFFSET) -#define GPDPUD (ELFIN_GPIO_BASE + GPDPUD_OFFSET) -#define GPDCONSLP (ELFIN_GPIO_BASE + GPDCONSLP_OFFSET) -#define GPDPUDSLP (ELFIN_GPIO_BASE + GPDPUDSLP_OFFSET) -#define GPECON (ELFIN_GPIO_BASE + GPECON_OFFSET) -#define GPEDAT (ELFIN_GPIO_BASE + GPEDAT_OFFSET) -#define GPEPUD (ELFIN_GPIO_BASE + GPEPUD_OFFSET) -#define GPECONSLP (ELFIN_GPIO_BASE + GPECONSLP_OFFSET) -#define GPEPUDSLP (ELFIN_GPIO_BASE + GPEPUDSLP_OFFSET) -#define GPFCON (ELFIN_GPIO_BASE + GPFCON_OFFSET) -#define GPFDAT (ELFIN_GPIO_BASE + GPFDAT_OFFSET) -#define GPFPUD (ELFIN_GPIO_BASE + GPFPUD_OFFSET) -#define GPFCONSLP (ELFIN_GPIO_BASE + GPFCONSLP_OFFSET) -#define GPFPUDSLP (ELFIN_GPIO_BASE + GPFPUDSLP_OFFSET) -#define GPGCON (ELFIN_GPIO_BASE + GPGCON_OFFSET) -#define GPGDAT (ELFIN_GPIO_BASE + GPGDAT_OFFSET) -#define GPGPUD (ELFIN_GPIO_BASE + GPGPUD_OFFSET) -#define GPGCONSLP (ELFIN_GPIO_BASE + GPGCONSLP_OFFSET) -#define GPGPUDSLP (ELFIN_GPIO_BASE + GPGPUDSLP_OFFSET) -#define GPHCON0 (ELFIN_GPIO_BASE + GPHCON0_OFFSET) -#define GPHCON1 (ELFIN_GPIO_BASE + GPHCON1_OFFSET) -#define GPHDAT (ELFIN_GPIO_BASE + GPHDAT_OFFSET) -#define GPHPUD (ELFIN_GPIO_BASE + GPHPUD_OFFSET) -#define GPHCONSLP (ELFIN_GPIO_BASE + GPHCONSLP_OFFSET) -#define GPHPUDSLP (ELFIN_GPIO_BASE + GPHPUDSLP_OFFSET) -#define GPICON (ELFIN_GPIO_BASE + GPICON_OFFSET) -#define GPIDAT (ELFIN_GPIO_BASE + GPIDAT_OFFSET) -#define GPIPUD (ELFIN_GPIO_BASE + GPIPUD_OFFSET) -#define GPICONSLP (ELFIN_GPIO_BASE + GPICONSLP_OFFSET) -#define GPIPUDSLP (ELFIN_GPIO_BASE + GPIPUDSLP_OFFSET) -#define GPJCON (ELFIN_GPIO_BASE + GPJCON_OFFSET) -#define GPJDAT (ELFIN_GPIO_BASE + GPJDAT_OFFSET) -#define GPJPUD (ELFIN_GPIO_BASE + GPJPUD_OFFSET) -#define GPJCONSLP (ELFIN_GPIO_BASE + GPJCONSLP_OFFSET) -#define GPJPUDSLP (ELFIN_GPIO_BASE + GPJPUDSLP_OFFSET) -#define GPKCON0 (ELFIN_GPIO_BASE + GPKCON0_OFFSET) -#define GPKCON1 (ELFIN_GPIO_BASE + GPKCON1_OFFSET) -#define GPKDAT (ELFIN_GPIO_BASE + GPKDAT_OFFSET) -#define GPKPUD (ELFIN_GPIO_BASE + GPKPUD_OFFSET) -#define GPLCON0 (ELFIN_GPIO_BASE + GPLCON0_OFFSET) -#define GPLCON1 (ELFIN_GPIO_BASE + GPLCON1_OFFSET) -#define GPLDAT (ELFIN_GPIO_BASE + GPLDAT_OFFSET) -#define GPLPUD (ELFIN_GPIO_BASE + GPLPUD_OFFSET) -#define GPMCON (ELFIN_GPIO_BASE + GPMCON_OFFSET) -#define GPMDAT (ELFIN_GPIO_BASE + GPMDAT_OFFSET) -#define GPMPUD (ELFIN_GPIO_BASE + GPMPUD_OFFSET) -#define GPNCON (ELFIN_GPIO_BASE + GPNCON_OFFSET) -#define GPNDAT (ELFIN_GPIO_BASE + GPNDAT_OFFSET) -#define GPNPUD (ELFIN_GPIO_BASE + GPNPUD_OFFSET) -#define GPOCON (ELFIN_GPIO_BASE + GPOCON_OFFSET) -#define GPODAT (ELFIN_GPIO_BASE + GPODAT_OFFSET) -#define GPOPUD (ELFIN_GPIO_BASE + GPOPUD_OFFSET) -#define GPOCONSLP (ELFIN_GPIO_BASE + GPOCONSLP_OFFSET) -#define GPOPUDSLP (ELFIN_GPIO_BASE + GPOPUDSLP_OFFSET) -#define GPPCON (ELFIN_GPIO_BASE + GPPCON_OFFSET) -#define GPPDAT (ELFIN_GPIO_BASE + GPPDAT_OFFSET) -#define GPPPUD (ELFIN_GPIO_BASE + GPPPUD_OFFSET) -#define GPPCONSLP (ELFIN_GPIO_BASE + GPPCONSLP_OFFSET) -#define GPPPUDSLP (ELFIN_GPIO_BASE + GPPPUDSLP_OFFSET) -#define GPQCON (ELFIN_GPIO_BASE + GPQCON_OFFSET) -#define GPQDAT (ELFIN_GPIO_BASE + GPQDAT_OFFSET) -#define GPQPUD (ELFIN_GPIO_BASE + GPQPUD_OFFSET) -#define GPQCONSLP (ELFIN_GPIO_BASE + GPQCONSLP_OFFSET) -#define GPQPUDSLP (ELFIN_GPIO_BASE + GPQPUDSLP_OFFSET) -/* * Memory controller */
@@ -395,22 +145,12 @@*/ #define ELFIN_VIC0_BASE_ADDR 0x71200000#define ELFIN_VIC1_BASE_ADDR 0x71300000 -#define oINTMOD 0x0C/* VIC INT SELECT (IRQ or FIQ) */ -#define oINTUNMSK 0x10/* VIC INT EN (write 1 to unmask) */ -#define oINTMSK 0x14/* VIC INT EN CLEAR (write 1 to mask) */ -#define oINTSUBMSK 0x1C/* VIC SOFT INT CLEAR */ -#define oVECTADDR 0xF00/* VIC ADDRESS */ /* * Watchdog timer */ #define ELFIN_WATCHDOG_BASE 0x7E004000 -#define WTCON_REG __REG(0x7E004004) -#define WTDAT_REG __REG(0x7E004008) -#define WTCNT_REG __REG(0x7E00400C) - -/* * UART */
@@ -421,27 +161,10 @@*/ #define ELFIN_TIMER_BASE 0x7F006000 -#if defined(CONFIG_CLK_400_100_50 ) -#define STARTUP_AMDIV 400 -#define STARTUP_MDIV 400 -#define STARTUP_PDIV 6 -#define STARTUP_SDIV 1 -#elif defined(CONFIG_CLK_400_133_66 ) -#define STARTUP_AMDIV 400 -#define STARTUP_MDIV 533 -#define STARTUP_PDIV 6 -#define STARTUP_SDIV 1 -#elif defined(CONFIG_CLK_533_133_66 )#define STARTUP_AMDIV 533#define STARTUP_MDIV 533#define STARTUP_PDIV 6#define STARTUP_SDIV 1 -#elif defined(CONFIG_CLK_667_133_66 ) -#define STARTUP_AMDIV 667 -#define STARTUP_MDIV 533 -#define STARTUP_PDIV 6 -#define STARTUP_SDIV 1 -#endif #define STARTUP_PCLKDIV 3#define STARTUP_HCLKX2DIV 1
@@ -456,21 +179,12 @@#define STARTUP_MPLL (((CONFIG_SYS_CLK_FREQ >> STARTUP_SDIV) / \ STARTUP_PDIV) * STARTUP_MDIV) -#if defined(CONFIG_SYNC_MODE ) -#define APLL_VAL ((1 << 31) | (STARTUP_MDIV << 16) | \ - (STARTUP_PDIV << 8) | STARTUP_SDIV) -#define STARTUP_APLL (((CONFIG_SYS_CLK_FREQ >> STARTUP_SDIV) / \ - STARTUP_PDIV) * STARTUP_MDIV) -#define STARTUP_HCLK (STARTUP_MPLL / (STARTUP_HCLKX2DIV + 1) / \ - (STARTUP_HCLKDIV + 1)) -#else #define APLL_VAL ((1 << 31) | (STARTUP_AMDIV << 16) | \ (STARTUP_PDIV << 8) | STARTUP_SDIV)#define STARTUP_APLL (((CONFIG_SYS_CLK_FREQ >> STARTUP_SDIV) / \ STARTUP_PDIV) * STARTUP_AMDIV)#define STARTUP_HCLK (STARTUP_MPLL / (STARTUP_HCLKX2DIV + 1) / \ (STARTUP_HCLKDIV + 1)) -#endif /*-----------------------------------------------------------------------
@@ -552,14 +266,14 @@ static inline unsigned int s3c64xx_get_base_timer(void) return ELFIN_TIMER_BASE; } -static inline unsigned int s3c64xx_get_base_sromc (void ) +static inline unsigned int s3c64xx_get_base_clock (void ) { -return ELFIN_SROM_BASE ; +return ELFIN_CLOCK_POWER_BASE ; } -static inline unsigned int s3c64xx_get_base_clock (void ) +static inline unsigned int s3c64xx_get_base_sromc (void ) { -return ELFIN_CLOCK_POWER_BASE ; +return ELFIN_SROM_BASE ; }#endif
board/samsung/smdk6400/lowlevel_init.S +22 -28
100 lines not on this page · raw message
board/samsung/smdk6400/mem_init.S +4 -0
@@ -28,6 +28,10 @@ .globl mem_ctrl_asm_init mem_ctrl_asm_init: + ldr r0, =ELFIN_MEM_SYS_CFG @Memory sussystem address 0x7e00f120 + mov r1, #0xd @ Xm0CSn2 = NFCON CS0, Xm0CSn3 = NFCON + str r1, [r0] + /* DMC1 base address 0x7e001000 */ ldr r0, =ELFIN_DMC1_BASE
Signature · 1 line
1.7.5.4
PATCH 12/13 S3C6400: clear memory init variable
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
--- arch/arm/include/asm/arch-s3c64xx/s3c6400.h | 173 +-------------------------- board/samsung/smdk6400/mem_init.S | 110 +++++++++--------- 2 files changed, 56 insertions(+), 227 deletions(-)
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +1 -172
@@ -41,124 +41,16 @@#include <asm/hardware.h> #define ELFIN_CLOCK_POWER_BASE 0x7e00f000 - -/* -* GPIO -*/ #define ELFIN_GPIO_BASE 0x7f008000 - -/* -* Bus Matrix -*/ -#define ELFIN_MEM_SYS_CFG 0x7e00f120 - -#define S3C64XX_MEM_SYS_CFG_16BIT (1 << 12) - -/* -* Memory controller -*/ #define ELFIN_SROM_BASE 0x70000000 - -/* -* SDRAM Controller -*/ #define ELFIN_DMC0_BASE 0x7e000000#define ELFIN_DMC1_BASE 0x7e001000 - -#define INDEX_DMC_MEMC_STATUS 0x00 -#define INDEX_DMC_MEMC_CMD 0x04 -#define INDEX_DMC_DIRECT_CMD 0x08 -#define INDEX_DMC_MEMORY_CFG 0x0C -#define INDEX_DMC_REFRESH_PRD 0x10 -#define INDEX_DMC_CAS_LATENCY 0x14 -#define INDEX_DMC_T_DQSS 0x18 -#define INDEX_DMC_T_MRD 0x1C -#define INDEX_DMC_T_RAS 0x20 -#define INDEX_DMC_T_RC 0x24 -#define INDEX_DMC_T_RCD 0x28 -#define INDEX_DMC_T_RFC 0x2C -#define INDEX_DMC_T_RP 0x30 -#define INDEX_DMC_T_RRD 0x34 -#define INDEX_DMC_T_WR 0x38 -#define INDEX_DMC_T_WTR 0x3C -#define INDEX_DMC_T_XP 0x40 -#define INDEX_DMC_T_XSR 0x44 -#define INDEX_DMC_T_ESR 0x48 -#define INDEX_DMC_MEMORY_CFG2 0x4C -#define INDEX_DMC_CHIP_0_CFG 0x200 -#define INDEX_DMC_CHIP_1_CFG 0x204 -#define INDEX_DMC_CHIP_2_CFG 0x208 -#define INDEX_DMC_CHIP_3_CFG 0x20C -#define INDEX_DMC_USER_STATUS 0x300 -#define INDEX_DMC_USER_CONFIG 0x304 - -/* -* Memory Chip direct command -*/ -#define DMC_NOP0 0x0c0000 -#define DMC_NOP1 0x1c0000 -#define DMC_PA0 0x000000/* Precharge all */ -#define DMC_PA1 0x100000 -#define DMC_AR0 0x040000/* Autorefresh */ -#define DMC_AR1 0x140000 -#define DMC_SDR_MR0 0x080032/* MRS, CAS 3, Burst Length 4 */ -#define DMC_SDR_MR1 0x180032 -#define DMC_DDR_MR0 0x080162 -#define DMC_DDR_MR1 0x180162 -#define DMC_mDDR_MR0 0x080032/* CAS 3, Burst Length 4 */ -#define DMC_mDDR_MR1 0x180032 -#define DMC_mSDR_EMR0 0x0a0000/* EMRS, DS:Full, PASR:Full Array */ -#define DMC_mSDR_EMR1 0x1a0000 -#define DMC_DDR_EMR0 0x090000 -#define DMC_DDR_EMR1 0x190000 -#define DMC_mDDR_EMR0 0x0a0000/* DS:Full, PASR:Full Array */ -#define DMC_mDDR_EMR1 0x1a0000 - -/* -* Definitions for memory configuration -* Set memory configuration -* active_chips = 1'b0 (1 chip) -* qos_master_chip = 3'b000(ARID[3:0]) -* memory burst = 3'b010(burst 4) -* stop_mem_clock = 1'b0(disable dynamical stop) -* auto_power_down = 1'b0(disable auto power-down mode) -* power_down_prd = 6'b00_0000(0 cycle for auto power-down) -* ap_bit = 1'b0 (bit position of auto-precharge is 10) -* row_bits = 3'b010(# row address 13) -* column_bits = 3'b010(# column address 10 ) -* -* Set user configuration -* 2'b10=SDRAM/mSDRAM, 2'b11=DDR, 2'b01=mDDR -* -* Set chip select for chip [n] -* row bank control, bank address 0x3000_0000 ~ 0x37ff_ffff -* CHIP_[n]_CFG=0x30F8, 30: ADDR[31:24], F8: Mask[31:24] -*/ - -/* -* Nand flash controller -*/ +#define ELFIN_MEM_SYS_CFG 0x7e00f120#define ELFIN_NAND_BASE 0x70200000 - -/* -* Interrupt -*/ #define ELFIN_VIC0_BASE_ADDR 0x71200000#define ELFIN_VIC1_BASE_ADDR 0x71300000 - -/* -* Watchdog timer -*/ #define ELFIN_WATCHDOG_BASE 0x7E004000 - -/* -* UART -*/ #define ELFIN_UART_BASE 0x7F005000 - -/* -* PWM timer -*/ #define ELFIN_TIMER_BASE 0x7F006000#define STARTUP_AMDIV 533
@@ -187,69 +79,6 @@ (STARTUP_HCLKDIV + 1)) -/*----------------------------------------------------------------------- -* Physical Memory Map -*/ -#define DMC1_MEM_CFG 0x00010012/* burst 4, 13-bit row, 10-bit col */ -#define DMC1_MEM_CFG2 0xB45 -#define DMC1_CHIP0_CFG 0x150F8/* 0x5000_0000~0x57ff_ffff (128 MiB) */ -#define DMC_DDR_32_CFG 0x0/* 32bit, DDR */ - -/* Memory Parameters */ -/* DDR Parameters */ -#define DDR_tREFRESH 7800/* ns */ -#define DDR_tRAS 45/* ns (min: 45ns)*/ -#define DDR_tRC 68/* ns (min: 67.5ns)*/ -#define DDR_tRCD 23/* ns (min: 22.5ns)*/ -#define DDR_tRFC 80/* ns (min: 80ns)*/ -#define DDR_tRP 23/* ns (min: 22.5ns)*/ -#define DDR_tRRD 15/* ns (min: 15ns)*/ -#define DDR_tWR 15/* ns (min: 15ns)*/ -#define DDR_tXSR 120/* ns (min: 120ns)*/ -#define DDR_CASL 3/* CAS Latency 3 */ - -/* -* mDDR memory configuration -*/ - -#define NS_TO_CLK (t) ((STARTUP_HCLK / 1000 * (t) - 1) / 1000000) - -#define DMC_DDR_BA_EMRS 2 -#define DMC_DDR_MEM_CASLAT 3 -/* 6 Set Cas Latency to 3 */ -#define DMC_DDR_CAS_LATENCY (DDR_CASL << 1) -/* Min 0.75 ~ 1.25 */ -#define DMC_DDR_t_DQSS 1 -/* Min 2 tck */ -#define DMC_DDR_t_MRD 2 -/* 7, Min 45ns */ -#define DMC_DDR_t_RAS (NS_TO_CLK(DDR_tRAS) + 1) -/* 10, Min 67.5ns */ -#define DMC_DDR_t_RC (NS_TO_CLK(DDR_tRC) + 1) -/* 4,5(TRM), Min 22.5ns */ -#define DMC_DDR_t_RCD (NS_TO_CLK(DDR_tRCD) + 1) -#define DMC_DDR_schedule_RCD ((DMC_DDR_t_RCD - 3) << 3) -/* 11,18(TRM) Min 80ns */ -#define DMC_DDR_t_RFC (NS_TO_CLK(DDR_tRFC) + 1) -#define DMC_DDR_schedule_RFC ((DMC_DDR_t_RFC - 3) << 5) -/* 4, 5(TRM) Min 22.5ns */ -#define DMC_DDR_t_RP (NS_TO_CLK(DDR_tRP) + 1) -#define DMC_DDR_schedule_RP ((DMC_DDR_t_RP - 3) << 3) -/* 3, Min 15ns */ -#define DMC_DDR_t_RRD (NS_TO_CLK(DDR_tRRD) + 1) -/* Min 15ns */ -#define DMC_DDR_t_WR (NS_TO_CLK(DDR_tWR) + 1) -#define DMC_DDR_t_WTR 2 -/* 1tck + tIS(1.5ns) */ -#define DMC_DDR_t_XP 2 -/* 17, Min 120ns */ -#define DMC_DDR_t_XSR (NS_TO_CLK(DDR_tXSR) + 1) -#define DMC_DDR_t_ESR DMC_DDR_t_XSR -/* TRM 2656 */ -#define DMC_DDR_REFRESH_PRD (NS_TO_CLK(DDR_tREFRESH)) -/* 2b01 : mDDR */ -#define DMC_DDR_USER_CONFIG 1 -#ifndef __ASSEMBLY__static inline unsigned int s3c64xx_get_base_uart (void ) {
board/samsung/smdk6400/mem_init.S +55 -55
153 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 13/13 S3C6400: Clear system clock variable
In reply to Zhong HongboFrom: Zhong Hongbo <[email protected]>
--- arch/arm/include/asm/arch-s3c64xx/s3c6400.h | 26 -------------------------- board/samsung/smdk6400/lowlevel_init.S | 6 +++--- 2 files changed, 3 insertions(+), 29 deletions(-)
arch/arm/include/asm/arch-s3c64xx/s3c6400.h +0 -26
@@ -53,32 +53,6 @@#define ELFIN_UART_BASE 0x7F005000#define ELFIN_TIMER_BASE 0x7F006000 -#define STARTUP_AMDIV 533 -#define STARTUP_MDIV 533 -#define STARTUP_PDIV 6 -#define STARTUP_SDIV 1 - -#define STARTUP_PCLKDIV 3 -#define STARTUP_HCLKX2DIV 1 -#define STARTUP_HCLKDIV 1 -#define STARTUP_MPLLDIV 1 -#define STARTUP_APLLDIV 0 - -#define CLK_DIV_VAL ((STARTUP_PCLKDIV << 12) | (STARTUP_HCLKX2DIV << 9) | \ - (STARTUP_HCLKDIV << 8) | (STARTUP_MPLLDIV<<4) | STARTUP_APLLDIV) -#define MPLL_VAL ((1 << 31) | (STARTUP_MDIV << 16) | \ - (STARTUP_PDIV << 8) | STARTUP_SDIV) -#define STARTUP_MPLL (((CONFIG_SYS_CLK_FREQ >> STARTUP_SDIV) / \ - STARTUP_PDIV) * STARTUP_MDIV) - -#define APLL_VAL ((1 << 31) | (STARTUP_AMDIV << 16) | \ - (STARTUP_PDIV << 8) | STARTUP_SDIV) -#define STARTUP_APLL (((CONFIG_SYS_CLK_FREQ >> STARTUP_SDIV) / \ - STARTUP_PDIV) * STARTUP_AMDIV) -#define STARTUP_HCLK (STARTUP_MPLL / (STARTUP_HCLKX2DIV + 1) / \ - (STARTUP_HCLKDIV + 1)) - -#ifndef __ASSEMBLY__static inline unsigned int s3c64xx_get_base_uart (void ) {
board/samsung/smdk6400/lowlevel_init.S +3 -3
@@ -199,13 +199,13 @@ wait_for_async: bic r1, r1, #0x30000 bic r1, r1, #0xff00 bic r1, r1, #0xff - ldr r2, =CLK_DIV_VAL + ldr r2, =0x3310 orr r1, r1, r2 str r1, [r0, #0x20] - ldr r1, =APLL_VAL + ldr r1, =0x82150601 str r1, [r0, #0x0c] @ APLL_CON_OFFSET - ldr r1, =MPLL_VAL + ldr r1, =0x82150601 str r1, [r0, #0x10] @ MPLL_CON_OFFSET /* FOUT of EPLL is 96MHz */
Signature · 1 line
1.7.5.4
Add Guennadi to the loop.
Thanks,
hongbo
Quoted 28 lines · Zhong Hongbo
This serial patch intent to:
1. Switch all I/O to use readl/writel function
2. Changenand_splto use SPL framework
3. S3C64XX serial includes s3c6400 and s3c6410,
Here seprate cpu and board file to support to board's of s3c6410.I test this patch on my s3c6410 development board. the log as following:
U-Boot 2012.04.01-10905-g9fa0c77 (Jul 07 2012 - 15:50:57) for SMDK6400
CPU: S3C64XX at 532MHz
Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode) Board: DMATEK6410 DRAM: 128 MiB WARNING: Caches not enabled NAND: 128 MiB*** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Net: dm9000 Hit any key to stop autoboot: 0DMATEK6410 #