Support for SPEAr SoCs
Subsystems (6)
cover Support for SPEAr SoCs
This patchset contains the support for 4 SoCs from SPEAr family SPEAr300
SPEAr310
SPEAr320
SPEAr600
It also contains the drivers needed for spear devices
Regards
Vipin Kumar
Vipin (9):
i2c driver support for SPEAr SoCs
smi driver support for SPEAr SoCs
nand driver support for SPEAr SoCs
usbd driver and usb boot firmware support for SPEAr SoCs SPEAr600 SoC support added
SPEAr300 SoC support added
SPEAr310 SoC support added
SPEAr320 SoC support added
SPEAr600 build support added
MAKEALL | 4 + Makefile | 12 + board/spear/common/spr_lowlevel_init.S | 202 +++++ board/spear/common/spr_misc.c | 270 +++++++ board/spear/spear300/Makefile | 52 ++ board/spear/spear300/config.mk | 39 + board/spear/spear300/spr300_board.c | 57 ++ board/spear/spear310/Makefile | 52 ++ board/spear/spear310/config.mk | 42 + board/spear/spear310/spr310_board.c | 58 ++ board/spear/spear320/Makefile | 52 ++ board/spear/spear320/config.mk | 42 + board/spear/spear320/spr320_board.c | 58 ++ board/spear/spear600/Makefile | 52 ++ board/spear/spear600/config.mk | 39 + board/spear/spear600/spr600_board.c | 53 ++ common/cmd_bdinfo.c | 20 + common/main.c | 2 + cpu/arm926ejs/spear/Makefile | 52 ++ cpu/arm926ejs/spear/reset.c | 49 ++ cpu/arm926ejs/spear/timer.c | 148 ++++ drivers/i2c/Makefile | 1 + drivers/i2c/spr_i2c.c | 321 ++++++++ drivers/mtd/Makefile | 1 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/spr_nand.c | 126 +++ drivers/mtd/spr_smi.c | 548 +++++++++++++ drivers/serial/usbtty.h | 2 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/spr_udc.c | 996 ++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_defs.h | 31 + include/asm-arm/arch-spear/spr_emi.h | 55 ++ include/asm-arm/arch-spear/spr_gpt.h | 83 ++ include/asm-arm/arch-spear/spr_i2c.h | 143 ++++ include/asm-arm/arch-spear/spr_misc.h | 126 +++ include/asm-arm/arch-spear/spr_nand.h | 58 ++ include/asm-arm/arch-spear/spr_smi.h | 112 +++ include/asm-arm/arch-spear/spr_syscntl.h | 38 + include/asm-arm/arch-spear/spr_xloader_table.h | 67 ++ include/asm-arm/u-boot.h | 5 + include/configs/spear300.h | 260 ++++++ include/configs/spear310.h | 353 +++++++++ include/configs/spear320.h | 336 ++++++++ include/configs/spear600.h | 260 ++++++ include/usb/spr_udc.h | 227 ++++++ 45 files changed, 5506 insertions(+), 0 deletions(-) create mode 100755 board/spear/common/spr_lowlevel_init.S create mode 100755 board/spear/common/spr_misc.c create mode 100755 board/spear/spear300/Makefile create mode 100755 board/spear/spear300/config.mk create mode 100755 board/spear/spear300/spr300_board.c create mode 100755 board/spear/spear310/Makefile create mode 100755 board/spear/spear310/config.mk create mode 100755 board/spear/spear310/spr310_board.c create mode 100755 board/spear/spear320/Makefile create mode 100755 board/spear/spear320/config.mk create mode 100755 board/spear/spear320/spr320_board.c create mode 100755 board/spear/spear600/Makefile create mode 100755 board/spear/spear600/config.mk create mode 100755 board/spear/spear600/spr600_board.c create mode 100755 cpu/arm926ejs/spear/Makefile create mode 100755 cpu/arm926ejs/spear/reset.c create mode 100755 cpu/arm926ejs/spear/timer.c mode change 100644 => 100755 drivers/i2c/Makefile create mode 100755 drivers/i2c/spr_i2c.c mode change 100644 => 100755 drivers/mtd/Makefile create mode 100755 drivers/mtd/nand/spr_nand.c create mode 100755 drivers/mtd/spr_smi.c mode change 100644 => 100755 drivers/serial/usbtty.h mode change 100644 => 100755 drivers/usb/gadget/Makefile create mode 100755 drivers/usb/gadget/spr_udc.c create mode 100644 include/asm-arm/arch-spear/spr_defs.h create mode 100755 include/asm-arm/arch-spear/spr_emi.h create mode 100755 include/asm-arm/arch-spear/spr_gpt.h create mode 100755 include/asm-arm/arch-spear/spr_i2c.h create mode 100644 include/asm-arm/arch-spear/spr_misc.h create mode 100644 include/asm-arm/arch-spear/spr_nand.h create mode 100755 include/asm-arm/arch-spear/spr_smi.h create mode 100644 include/asm-arm/arch-spear/spr_syscntl.h create mode 100755 include/asm-arm/arch-spear/spr_xloader_table.h create mode 100755 include/configs/spear300.h create mode 100755 include/configs/spear310.h create mode 100755 include/configs/spear320.h create mode 100755 include/configs/spear600.h create mode 100755 include/usb/spr_udc.h
PATCH 1/9 i2c driver support for SPEAr SoCs
--- drivers/i2c/Makefile | 1 + drivers/i2c/spr_i2c.c | 321 ++++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_i2c.h | 143 +++++++++++++++ 3 files changed, 465 insertions(+), 0 deletions(-) mode change 100644 => 100755 drivers/i2c/Makefile create mode 100755 drivers/i2c/spr_i2c.c create mode 100755 include/asm-arm/arch-spear/spr_i2c.h
drivers/i2c/Makefile +1 -0
@@ -38,6 +38,7 @@ COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o COBJS-$(CONFIG_S3C44B0_I2C) += s3c44b0_i2c.o COBJS-$(CONFIG_SOFT_I2C) += soft_i2c.o COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o +COBJS-$(CONFIG_SPEARI2C) += spr_i2c.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/i2c/spr_i2c.c new file +321 -0
321 lines not on this page · raw message
include/asm-arm/arch-spear/spr_i2c.h new file +143 -0
143 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 2/9 smi driver support for SPEAr SoCs
--- drivers/mtd/Makefile | 1 + drivers/mtd/spr_smi.c | 548 ++++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_smi.h | 112 +++++++ 3 files changed, 661 insertions(+), 0 deletions(-) mode change 100644 => 100755 drivers/mtd/Makefile create mode 100755 drivers/mtd/spr_smi.c create mode 100755 include/asm-arm/arch-spear/spr_smi.h
drivers/mtd/Makefile +1 -0
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_FLASH_CFI_MTD) += cfi_mtd.o COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o COBJS-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o COBJS-$(CONFIG_MW_EEPROM) += mw_eeprom.o +COBJS-$(CONFIG_SPEARSMI) += spr_smi.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/mtd/spr_smi.c new file +548 -0
548 lines not on this page · raw message
include/asm-arm/arch-spear/spr_smi.h new file +112 -0
112 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 3/9 nand driver support for SPEAr SoCs
--- drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/spr_nand.c | 126 +++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_nand.h | 58 +++++++++++++++ 3 files changed, 185 insertions(+), 0 deletions(-) create mode 100755 drivers/mtd/nand/spr_nand.c create mode 100644 include/asm-arm/arch-spear/spr_nand.h
drivers/mtd/nand/Makefile +1 -0
@@ -47,6 +47,7 @@ COBJS-$(CONFIG_NAND_NDFC) += ndfc.o COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o +COBJS-$(CONFIG_NAND_SPEAR) += spr_nand.o COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o endif
drivers/mtd/nand/spr_nand.c new file +126 -0
126 lines not on this page · raw message
include/asm-arm/arch-spear/spr_nand.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 4/9 usbd driver and usb boot firmware support for SPEAr SoCs
--- common/main.c | 2 + drivers/serial/usbtty.h | 2 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/spr_udc.c | 996 +++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_misc.h | 126 +++++ include/usb/spr_udc.h | 227 ++++++++ 6 files changed, 1354 insertions(+), 0 deletions(-) mode change 100644 => 100755 drivers/serial/usbtty.h mode change 100644 => 100755 drivers/usb/gadget/Makefile create mode 100755 drivers/usb/gadget/spr_udc.c create mode 100644 include/asm-arm/arch-spear/spr_misc.h create mode 100755 include/usb/spr_udc.h
common/main.c +2 -0
@@ -397,6 +397,7 @@ void main_loop (void)debug ("### main_loop: bootcmd=\"%s\"\n" , s ? s :"<UNDEFINED>" ); +#if !defined(CONFIG_SPEAR_USBTTY )if (bootdelay >=0 && s && !abortboot (bootdelay)) {# ifdef CONFIG_AUTOBOOT_KEYED int prev =disable_ctrlc (1 );/* disable Control C checking */
@@ -413,6 +414,7 @@ void main_loop (void)disable_ctrlc (prev);/* restore Control C checking */ # endif } +# endif # ifdef CONFIG_MENUKEY if (menukey ==CONFIG_MENUKEY ) {
drivers/serial/usbtty.h +2 -0
@@ -31,6 +31,8 @@#include <usb/omap1510_udc.h> #elif defined(CONFIG_PXA27X )#include <usb/pxa27x_udc.h> +#elif defined(CONFIG_SPEAR3XX ) || defined(CONFIG_SPEAR600 ) +#include <usb/spr_udc.h> #endif #include <version_autogenerated.h>
drivers/usb/gadget/Makefile +1 -0
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_OMAP1510) += omap1510_udc.o COBJS-$(CONFIG_OMAP1610) += omap1510_udc.o COBJS-$(CONFIG_MPC885_FAMILY) += mpc8xx_udc.o COBJS-$(CONFIG_PXA27X) += pxa27x_udc.o +COBJS-$(CONFIG_SPEARUDC) += spr_udc.o endif COBJS := $(COBJS-y)
drivers/usb/gadget/spr_udc.c new file +996 -0
996 lines not on this page · raw message
include/asm-arm/arch-spear/spr_misc.h new file +126 -0
126 lines not on this page · raw message
include/usb/spr_udc.h new file +227 -0
227 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 5/9 SPEAr600 SoC support added
--- board/spear/common/spr_lowlevel_init.S | 202 ++++++++++++++++++ board/spear/common/spr_misc.c | 270 ++++++++++++++++++++++++ board/spear/spear600/Makefile | 52 +++++ board/spear/spear600/config.mk | 39 ++++ board/spear/spear600/spr600_board.c | 53 +++++ common/cmd_bdinfo.c | 20 ++ cpu/arm926ejs/spear/Makefile | 52 +++++ cpu/arm926ejs/spear/reset.c | 49 +++++ cpu/arm926ejs/spear/timer.c | 148 +++++++++++++ include/asm-arm/arch-spear/spr_defs.h | 31 +++ include/asm-arm/arch-spear/spr_emi.h | 55 +++++ include/asm-arm/arch-spear/spr_gpt.h | 83 ++++++++ include/asm-arm/arch-spear/spr_syscntl.h | 38 ++++ include/asm-arm/arch-spear/spr_xloader_table.h | 67 ++++++ include/asm-arm/u-boot.h | 5 + include/configs/spear600.h | 260 +++++++++++++++++++++++ 16 files changed, 1424 insertions(+), 0 deletions(-) create mode 100755 board/spear/common/spr_lowlevel_init.S create mode 100755 board/spear/common/spr_misc.c create mode 100755 board/spear/spear600/Makefile create mode 100755 board/spear/spear600/config.mk create mode 100755 board/spear/spear600/spr600_board.c create mode 100755 cpu/arm926ejs/spear/Makefile create mode 100755 cpu/arm926ejs/spear/reset.c create mode 100755 cpu/arm926ejs/spear/timer.c create mode 100644 include/asm-arm/arch-spear/spr_defs.h create mode 100755 include/asm-arm/arch-spear/spr_emi.h create mode 100755 include/asm-arm/arch-spear/spr_gpt.h create mode 100644 include/asm-arm/arch-spear/spr_syscntl.h create mode 100755 include/asm-arm/arch-spear/spr_xloader_table.h create mode 100755 include/configs/spear600.h
board/spear/common/spr_lowlevel_init.S new file +202 -0
@@ -0,0 +1,202 @@ +/* + * (C) Copyright 2006 + * Vipin Kumar, ST Micoelectronics, vipin.kumar at st.com. + * + * 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 + */ + +#include <config.h> + +/* + * platform specific initializations are already done in Xloader + * Initializations already done include + * DDR, PLLs, IP's clock enable and reset release etc + */ +.globl lowlevel_init +lowlevel_init: + /* By default, U-Boot switches CPU to low-vector */ + /* Revert this as we work in high vector even in U-Boot */ + mrc p15, 0, r0, c1, c0, 0 + orr r0, r0, #0x00002000 + mcr p15, 0, r0, c1, c0, 0 + mov pc, lr + +#if defined (CONFIG_CMD_SETFREQ) + +/* ;void setfreq(unsigned int device, unsigned int frequency) */ +.global setfreq +setfreq: + stmfd sp!,{r14} + stmfd sp!,{r0-r12} + + mov r8,sp + ldr sp,SRAM_STACK_V + + /* ;Saving the function arguements for later use */ + mov r4,r0 + mov r5,r1 + + /* ;Putting DDR into self refresh */ + ldr r0,DDR_07_V + ldr r1,[r0] + ldr r2,DDR_ACTIVE_V + bic r1, r1, r2 + str r1,[r0] + ldr r0,DDR_57_V + ldr r1,[r0] + ldr r2,CYCLES_MASK_V + bic r1, r1, r2 + ldr r2,REFRESH_CYCLES_V + orr r1, r1, r2, lsl #16 + str r1,[r0] + ldr r0,DDR_07_V + ldr r1,[r0] + ldr r2,SREFRESH_MASK_V + orr r1, r1, r2 + str r1,[r0] + + b 1f + .align 5 +1: + /* ;Delay to ensure self refresh mode */ + ldr r0,SREFRESH_DELAY_V +1: + sub r0,r0,#1 + cmp r0,#0 + bne 1b + + /* ;Putting system in slow mode */ + ldr r0,SCCTRL_V + mov r1,#2 + str r1,[r0] + + /* ;Changing PLL(1/2) frequency */ + mov r0,r4 + mov r1,r5 + + cmp r4,#0 + beq 1f + + /* ;Change PLL2 (DDR frequency) */ + ldr r6,PLL2_FREQ_V + ldr r7,PLL2_CNTL_V + b 2f + +1: + /* ;Change PLL1 (CPU frequency) */ + ldr r6,PLL1_FREQ_V + ldr r7,PLL1_CNTL_V + +2: + mov r0,r6 + ldr r1,[r0] + ldr r2,PLLFREQ_MASK_V + bic r1,r1,r2 + mov r2,r5,lsr#1 + orr r1,r1,r2,lsl#24 + str r1,[r0] + + mov r0,r7 + ldr r1,P1C0A_V + str r1,[r0] + /* ;ldr r0,r7 */ + ldr r1,P1C0E_V + str r1,[r0] + /* ;ldr r0,r7 */ + ldr r1,P1C06_V + str r1,[r0] + /* ;ldr r0,r7 */ + ldr r1,P1C0E_V + str r1,[r0] + +1: + ldr r1,[r0] + and r1,r1,#1 + cmp r1,#0 + beq 1b + + /* ;Putting system back to normal mode */ + ldr r0,SCCTRL_V + mov r1,#4 + str r1,[r0] + + /* ;Putting DDR back to normal */ + ldr r0,DDR_07_V + ldr r1,[R0] + ldr r2,SREFRESH_MASK_V + bic r1, r1, r2 + str r1,[r0] + ldr r2,DDR_ACTIVE_V + orr r1, r1, r2 + str r1,[r0] + + /* ;Delay to ensure self refresh mode */ + ldr r0,SREFRESH_DELAY_V +1: + sub r0,r0,#1 + cmp r0,#0 + bne 1b + + mov sp,r8 + /* ;Resuming back to code */ + ldmia sp!,{r0-r12} + ldmia sp!,{pc} + +SCCTRL_V: + .word 0xfca00000 +PLL1_FREQ_V: + .word 0xfca8000C +PLL1_CNTL_V: + .word 0xfca80008 +PLL2_FREQ_V: + .word 0xfca80018 +PLL2_CNTL_V: + .word 0xfca80014 +PLLFREQ_MASK_V: + .word 0xff000000 +P1C0A_V: + .word 0x1C0A +P1C0E_V: + .word 0x1C0E +P1C06_V: + .word 0x1C06 + +SREFRESH_DELAY_V: + .word 0x9999 +SRAM_STACK_V: + .word 0xD2800600 +DDR_07_V: + .word 0xfc60001c +DDR_ACTIVE_V: + .word 0x01000000 +DDR_57_V: + .word 0xfc6000e4 +CYCLES_MASK_V: + .word 0xffff0000 +REFRESH_CYCLES_V: + .word 0xf0f0 +SREFRESH_MASK_V: + .word 0x00010000 + +.global setfreq_sz +setfreq_sz: + .word setfreq_sz - setfreq + +#endif +
board/spear/common/spr_misc.c new file +270 -0
270 lines not on this page · raw message
board/spear/spear600/Makefile new file +52 -0
52 lines not on this page · raw message
board/spear/spear600/config.mk new file +39 -0
@@ -0,0 +1,39 @@ +# +# (C) Copyright 2009 +# Vipin Kumar, ST Microelectronics <[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 +# + +######################################################################### + +TEXT_BASE = 0x00700000 + +ALL += $(obj)u-boot.img + +# Environment variables in NAND +ifeq ($(ENV),NAND) +PLATFORM_RELFLAGS += -DENV_IN_NAND +endif + +# Compile uboot as USB boot firmware +ifeq ($(CONSOLE),USB) +PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY +endif +
board/spear/spear600/spr600_board.c new file +53 -0
53 lines not on this page · raw message
common/cmd_bdinfo.c +20 -0
@@ -27,6 +27,10 @@#include <common.h> #include <command.h> +#if defined(CONFIG_SPEAR600 ) || defined(CONFIG_SPEAR3XX ) +#include <asm/arch/spr_xloader_table.h> +#endif +DECLARE_GLOBAL_DATA_PTR ;static void print_num (const char *,ulong );
@@ -339,6 +343,22 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])#endif printf ("baudrate = %d bps\n" , bd->bi_baudrate); +#if defined(CONFIG_SPEAR600 ) || defined(CONFIG_SPEAR3XX ) +if (bd->dramfreq ==-1 ) +printf ("DDR Freq = Not Known\n" ); +else +printf ("DDR Freq = %d\n" , bd->dramfreq); + +if (bd->dramtype ==DDRMOBILE ) +printf ("DDR Type = MOBILE\n" ); +else if (bd->dramtype ==DDR2 ) +printf ("DDR Type = DDR2\n" ); +else +printf ("DDR Type = Not Known\n" ); + +printf ("Xloader Rev = %s\n" , bd->version); +#endif +return 0 ; }
cpu/arm926ejs/spear/Makefile new file +52 -0
52 lines not on this page · raw message
cpu/arm926ejs/spear/reset.c new file +49 -0
49 lines not on this page · raw message
cpu/arm926ejs/spear/timer.c new file +148 -0
148 lines not on this page · raw message
include/asm-arm/arch-spear/spr_defs.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* (C) Copyright 2009 +* Vipin Kumar, ST Micoelectronics, vipin.kumar at st.com. +* +* 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 __SPR_DEFS_H__ +#define __SPR_DEFS_H__ + +extern int spear_board_init (ulong ); +extern void setfreq (unsigned int ,unsigned int ); +extern unsigned int setfreq_sz; + +#endif
include/asm-arm/arch-spear/spr_emi.h new file +55 -0
55 lines not on this page · raw message
include/asm-arm/arch-spear/spr_gpt.h new file +83 -0
83 lines not on this page · raw message
include/asm-arm/arch-spear/spr_syscntl.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* (C) Copyright 2009 +* Ryan CHEN, ST Micoelectronics, ryan.chen at st.com +* +* 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 +*/ + +struct syscntl_regs { +u32 scctrl; +u32 scsysstat; +u32 scimctrl; +u32 scimsysstat; +u32 scxtalctrl; +u32 scpllctrl; +u32 scpllfctrl; +u32 scperctrl0; +u32 scperctrl1; +u32 scperen; +u32 scperdis; +const u32 scperclken; +const u32 scperstat; +};
include/asm-arm/arch-spear/spr_xloader_table.h new file +67 -0
67 lines not on this page · raw message
include/asm-arm/u-boot.h +5 -0
@@ -47,6 +47,11 @@ typedef struct bd_info {ulong start;ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS ]; +#if defined(CONFIG_SPEAR600 ) || defined(CONFIG_SPEAR3XX ) +unsigned char version[32 ]; +int dramfreq; +int dramtype; +#endif } bd_t;#define bi_env_data bi_env->data
include/configs/spear600.h new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 6/9 SPEAr300 SoC support added
--- MAKEALL | 1 + Makefile | 3 + board/spear/spear300/Makefile | 52 +++++++ board/spear/spear300/config.mk | 39 +++++ board/spear/spear300/spr300_board.c | 57 ++++++++ include/configs/spear300.h | 260 +++++++++++++++++++++++++++++++++++ 6 files changed, 412 insertions(+), 0 deletions(-) create mode 100755 board/spear/spear300/Makefile create mode 100755 board/spear/spear300/config.mk create mode 100755 board/spear/spear300/spr300_board.c create mode 100755 include/configs/spear300.h
MAKEALL +1 -0
@@ -572,6 +572,7 @@ LIST_ARM9=" \ sheevaplug \ smdk2400 \ smdk2410 \ + spear300 \ trab \ VCMA9 \ versatile \
Makefile +3 -0
@@ -3056,6 +3056,9 @@ smdk2400_config : unconfig smdk2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0 +spear300_config : unconfig + @$(MKCONFIG) $(@:_config=) arm arm926ejs spear300 spear spear + SX1_stdout_serial_config \ SX1_config: unconfig @mkdir -p $(obj)include
board/spear/spear300/Makefile new file +52 -0
52 lines not on this page · raw message
board/spear/spear300/config.mk new file +39 -0
@@ -0,0 +1,39 @@ +# +# (C) Copyright 2009 +# Vipin Kumar, ST Microelectronics <[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 +# + +######################################################################### + +TEXT_BASE = 0x00700000 + +ALL += $(obj)u-boot.img + +# Environment variables in NAND +ifeq ($(ENV),NAND) +PLATFORM_RELFLAGS += -DENV_IN_NAND +endif + +# Compile uboot as USB boot firmware +ifeq ($(CONSOLE),USB) +PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY +endif +
board/spear/spear300/spr300_board.c new file +57 -0
57 lines not on this page · raw message
include/configs/spear300.h new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 7/9 SPEAr310 SoC support added
--- MAKEALL | 1 + Makefile | 3 + board/spear/spear310/Makefile | 52 +++++ board/spear/spear310/config.mk | 42 ++++ board/spear/spear310/spr310_board.c | 58 ++++++ include/configs/spear310.h | 353 +++++++++++++++++++++++++++++++++++ 6 files changed, 509 insertions(+), 0 deletions(-) create mode 100755 board/spear/spear310/Makefile create mode 100755 board/spear/spear310/config.mk create mode 100755 board/spear/spear310/spr310_board.c create mode 100755 include/configs/spear310.h
MAKEALL +1 -0
@@ -573,6 +573,7 @@ LIST_ARM9=" \ smdk2400 \ smdk2410 \ spear300 \ + spear310 \ trab \ VCMA9 \ versatile \
Makefile +3 -0
@@ -3059,6 +3059,9 @@ smdk2410_config : unconfig spear300_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm926ejs spear300 spear spear +spear310_config : unconfig + @$(MKCONFIG) $(@:_config=) arm arm926ejs spear310 spear spear + SX1_stdout_serial_config \ SX1_config: unconfig @mkdir -p $(obj)include
board/spear/spear310/Makefile new file +52 -0
52 lines not on this page · raw message
board/spear/spear310/config.mk new file +42 -0
42 lines not on this page · raw message
board/spear/spear310/spr310_board.c new file +58 -0
58 lines not on this page · raw message
include/configs/spear310.h new file +353 -0
353 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 8/9 SPEAr320 SoC support added
--- MAKEALL | 1 + Makefile | 3 + board/spear/spear320/Makefile | 52 ++++++ board/spear/spear320/config.mk | 42 +++++ board/spear/spear320/spr320_board.c | 58 ++++++ include/configs/spear320.h | 336 +++++++++++++++++++++++++++++++++++ 6 files changed, 492 insertions(+), 0 deletions(-) create mode 100755 board/spear/spear320/Makefile create mode 100755 board/spear/spear320/config.mk create mode 100755 board/spear/spear320/spr320_board.c create mode 100755 include/configs/spear320.h
MAKEALL +1 -0
@@ -574,6 +574,7 @@ LIST_ARM9=" \ smdk2410 \ spear300 \ spear310 \ + spear320 \ trab \ VCMA9 \ versatile \
Makefile +3 -0
@@ -3062,6 +3062,9 @@ spear300_config : unconfig spear310_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm926ejs spear310 spear spear +spear320_config : unconfig + @$(MKCONFIG) $(@:_config=) arm arm926ejs spear320 spear spear + SX1_stdout_serial_config \ SX1_config: unconfig @mkdir -p $(obj)include
board/spear/spear320/Makefile new file +52 -0
52 lines not on this page · raw message
board/spear/spear320/config.mk new file +42 -0
42 lines not on this page · raw message
board/spear/spear320/spr320_board.c new file +58 -0
58 lines not on this page · raw message
include/configs/spear320.h new file +336 -0
336 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 9/9 SPEAr600 build support added
--- MAKEALL | 1 + Makefile | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-)
MAKEALL +1 -0
@@ -575,6 +575,7 @@ LIST_ARM9=" \ spear300 \ spear310 \ spear320 \ + spear600 \ trab \ VCMA9 \ versatile \
Makefile +3 -0
@@ -3065,6 +3065,9 @@ spear310_config : unconfig spear320_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm926ejs spear320 spear spear +spear600_config : unconfig + @$(MKCONFIG) $(@:_config=) arm arm926ejs spear600 spear spear + SX1_stdout_serial_config \ SX1_config: unconfig @mkdir -p $(obj)include
Signature · 1 line
1.6.0.2
PATCH 9/9 SPEAr600 build support added
Dear Vipin KUMAR,
Quoted 6 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>--- MAKEALL | 1 + Makefile | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-)
This patch must be merged with the one adding the actual code for this board.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The only way to learn a new programming language is by writing pro- grams in it. - Brian Kernighan
PATCH 9/9 SPEAr600 build support added
Dear Wolfgang,
Quoted 9 lines
Quoted 6 lines
Signed-off-by Vipin <[email protected]>---
?MAKEALL ?| ? ?1 +
?Makefile | ? ?3 +++
?2 files changed, 4 insertions(+), 0 deletions(-)This patch must be merged with the one adding the actual code for this board.
Ok. Patch merged with the previous one where actual code for SPEAr600 is added
Regards
Vipin
PATCH 8/9 SPEAr320 SoC support added
In reply to Vipin KUMARDear Vipin KUMAR,
Quoted 14 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>--- MAKEALL | 1 + Makefile | 3 + board/spear/spear320/Makefile | 52 ++++++ board/spear/spear320/config.mk | 42 +++++ board/spear/spear320/spr320_board.c | 58 ++++++ include/configs/spear320.h | 336 +++++++++++++++++++++++++++++++++++ 6 files changed, 492 insertions(+), 0 deletions(-) create mode 100755 board/spear/spear320/Makefile create mode 100755 board/spear/spear320/config.mk create mode 100755 board/spear/spear320/spr320_board.c create mode 100755 include/configs/spear320.h
Again: you seem to be adding just a new board, not a new SoC - please fix commit message.
See review comments for previous patch; they all apply here, too.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There's nothing disgusting about it [the Companion]. It's just another life form, that's all. You get used to those things. -- McCoy, "Metamorphosis", stardate 3219.8
PATCH 8/9 SPEAr320 SoC support added
Dear Wolfgang,
Quoted 14 lines
Quoted 8 lines
Signed-off-by Vipin <[email protected]>---
?MAKEALL ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 + ?Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?3 + ?board/spear/spear320/Makefile ? ? ? | ? 52 ++++++ ?board/spear/spear320/config.mk ? ? ?| ? 42 +++++ ?board/spear/spear320/spr320_board.c | ? 58 ++++++ ?include/configs/spear320.h ? ? ? ? ?| ?336 +++++++++++++++++++++++++++++++++++Quoted 5 lines
?6 files changed, 492 insertions(+), 0 deletions(-) ?create mode 100755 board/spear/spear320/Makefile ?create mode 100755
board/spear/spear320/config.mk?create mode 100755board/spear/spear320/spr320_board.c?create mode 100755include/configs/spear320.h
Quoted 4 lines
Again: you seem to be adding just a new board, not a new SoC - please fix commit message.
See review comments for previous patch; they all apply here, too.
Ok. Changed according to previous patch comments
Best Regards
Vipin
PATCH 7/9 SPEAr310 SoC support added
In reply to Vipin KUMARDear Vipin KUMAR,
Quoted 9 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>--- MAKEALL | 1 + Makefile | 3 + board/spear/spear310/Makefile | 52 +++++ board/spear/spear310/config.mk | 42 ++++ board/spear/spear310/spr310_board.c | 58 ++++++ include/configs/spear310.h | 353 +++++++++++++++++++++++++++++++++++
The commit message seems wrong. You just add a new board, not a new SoC.
Quoted 5 lines
board/spear/spear310/config.mk new file +0
-0
...
board/spear/spear310/config.mk line 42
Quoted 4 lines
board/spear/spear310/config.mk new file +4
-0+ifeq ($(CONSOLE),USB) +PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY +endif +
No trailing empty lines, please.
Quoted 4 lines
board/spear/spear310/config.mk new file +4
-0+int board_nand_init(struct nand_chip *nand) +{ + struct misc_regs *const misc_regs_p = + (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
board/spear/spear310/config.mk
Quoted 10 lines
board/spear/spear310/config.mk new file +10
-0+ + if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) == + MISC_SOCCFG30) || + ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) == + MISC_SOCCFG31)) { + + return spear_nand_init(nand); + } else { + return -1; + }
No else, unindent the "return -1;".
board/spear/spear310/config.mk
Quoted 7 lines
board/spear/spear310/config.mk new file +7
-0+/* + * Ethernet MAC driver configuration + */ +/* #define CONFIG_SPEAR_SMII */ +/* #define CONFIG_SPEARMAC */ +/* #define CONFIG_ETHAUTONEG */ +/* #define CONFIG_ETHDEBUG */
Don't add dead code (fix globally).
board/spear/spear310/config.mk
Quoted 12 lines
board/spear/spear310/config.mk new file +12
-0+ +#define CONFIG_SYS_SERIAL1 0xB2000000 +#define CONFIG_SYS_SERIAL2 0xB2080000 +#define CONFIG_SYS_SERIAL3 0xB2100000 +#define CONFIG_SYS_SERIAL4 0xB2180000 +#define CONFIG_SYS_SERIAL5 0xB2200000 +#define CONFIG_PL01x_PORTS { (void *)CONFIG_SYS_SERIAL0, \ + (void *)CONFIG_SYS_SERIAL1, \ + (void *)CONFIG_SYS_SERIAL2, \ + (void *)CONFIG_SYS_SERIAL3, \ + (void *)CONFIG_SYS_SERIAL4, \ + (void *)CONFIG_SYS_SERIAL5}
Indentation / avertical alignment by TABs, please. [Globally.]
Quoted 1 line
+#define
CONFIG_BOOTARGS"console=ttyS0 mem=128M " \
...
Quoted 1 line
+#define
CONFIG_ENV_ADDR(CONFIG_SYS_MONITOR_BASE+ \
etc.: Lines too long.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The explanation requiring the fewest assumptions is the most likely to be correct. -- William of Occam
PATCH 7/9 SPEAr310 SoC support added
Dear Wolfgang,
Quoted 10 lines
Quoted 9 lines
Signed-off-by Vipin <[email protected]>---
?MAKEALL ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 + ?Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?3 + ?board/spear/spear310/Makefile ? ? ? | ? 52 +++++ ?board/spear/spear310/config.mk ? ? ?| ? 42 ++++ ?board/spear/spear310/spr310_board.c | ? 58 ++++++ ?include/configs/spear310.h ? ? ? ? ?| ?353 +++++++++++++++++++++++++++++++++++
Quoted 2 lines
The commit message seems wrong. You just add a new board, not a new SoC.
SPEAr310 is a new SoC but it has a lot in common with SPEAr300 Offcourse, since only the common IP's are supported in uboot, there is no new driver required for SPEAr310.
Quoted 6 lines
Quoted 5 lines
board/spear/spear310/config.mk new file +0
-0...
Quoted 6 lines
board/spear/spear310/config.mk line 42
Quoted 4 lines
board/spear/spear310/config.mk new file +4
-0+ifeq ($(CONSOLE),USB) +PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY +endif +No trailing empty lines, please.
Ok. Trailing empty lines removed globally
Quoted 8 lines
Quoted 8 lines
board/spear/spear310/config.mk new file +8
-0+int board_nand_init(struct nand_chip *nand) +{ + ? ? struct misc_regs *const misc_regs_p = + ? ? ? ? ? ? (struct misc_regs *)CONFIG_SPEAR_MISCBASE; + + ? ? if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) == + ? ? ? ? ? ? ? ? ? ? ? ? ? ? MISC_SOCCFG30) || + ? ? ? ?((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
Quoted 8 lines
Quoted 6 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ?
MISC_SOCCFG31)) {
+
+ ? ? ? ? ? ? returnspear_nand_init(nand);
+ ? ? } else {
+ ? ? ? ? ? ? return -1;
+ ? ? }No else, unindent the "return -1;".
Ok. else removed and return -1 unindented
Quoted 9 lines
board/spear/spear310/config.mk
Quoted 7 lines
board/spear/spear310/config.mk new file +7
-0+/* + * Ethernet MAC driver configuration + */ +/* #define CONFIG_SPEAR_SMII */ +/* #define CONFIG_SPEARMAC */ +/* #define CONFIG_ETHAUTONEG */ +/* #define CONFIG_ETHDEBUG */Don't add dead code (fix globally).
Fixed globally
Quoted 6 lines
Quoted 6 lines
board/spear/spear310/config.mk new file +6
-0+ +#define CONFIG_SYS_SERIAL1 ? ? ? ? ? ? ? ? ? ? ?0xB2000000 +#define CONFIG_SYS_SERIAL2 ? ? ? ? ? ? ? ? ? ? ?0xB2080000 +#define CONFIG_SYS_SERIAL3 ? ? ? ? ? ? ? ? ? ? ?0xB2100000 +#define CONFIG_SYS_SERIAL4 ? ? ? ? ? ? ? ? ? ? ?0xB2180000 +#define CONFIG_SYS_SERIAL5 ? ? ? ? ? ? ? ? ? ? ?0xB2200000
Quoted 8 lines
Quoted 6 lines
+#define
CONFIG_PL01x_PORTS? ? ? ? ? ? ? ? ? ? ?{ (void *)CONFIG_SYS_SERIAL0, ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (void *)CONFIG_SYS_SERIAL1, ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (void *)CONFIG_SYS_SERIAL2, ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (void *)CONFIG_SYS_SERIAL3, ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (void *)CONFIG_SYS_SERIAL4, ? ?\
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (void *)CONFIG_SYS_SERIAL5}Indentation / avertical alignment by TABs, please. [Globally.]
Changed to use tabs for indenting and vertical alignment
Quoted 5 lines
Quoted 1 line
+#define
CONFIG_BOOTARGS? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"console=ttyS0 mem=128M " ?\...
Quoted 1 line
+#define
CONFIG_ENV_ADDR? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(CONFIG_SYS_MONITOR_BASE + \etc.: Lines too long.
Long lines curtailed globally
Best Regards
Vipin
PATCH 6/9 SPEAr300 SoC support added
In reply to Vipin KUMARDear Vipin KUMAR,
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>
...
Quoted 5 lines
board/spear/spear300/config.mk new file +0
-0
...
board/spear/spear300/config.mk line 39
Quoted 3 lines
board/spear/spear300/config.mk new file +3
-0+PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY +endif +
Please do not add trailing empty lines. [Please check globally.]
board/spear/spear300/spr300_board.c
Quoted 5 lines
board/spear/spear300/spr300_board.c new file +0
-0
Usually the file name is the same as the board config name.
board/spear/spear300/spr300_board.c line 55
Quoted 13 lines
board/spear/spear300/spr300_board.c new file +13
-0+int board_nand_init (struct nand_chip *nand) +{ +struct misc_regs *const misc_regs_p = + (struct misc_regs *)CONFIG_SPEAR_MISCBASE ; + +if (((readl (&misc_regs_p->auto_cfg_reg) &MISC_SOCCFGMSK ) == +MISC_SOCCFG30 ) || + ((readl (&misc_regs_p->auto_cfg_reg) &MISC_SOCCFGMSK ) == +MISC_SOCCFG31 )) { + +return spear_nand_init (nand); + }else { +return -1 ;
"else" not needed. Unindent the "return -1;".
Quoted 5 lines
include/configs/spear300.h new file +0
-0
...
include/configs/spear300.h line 39
Quoted 6 lines
include/configs/spear300.h new file +6
-0+/* +* Ethernet MAC driver configuration +*/ +/* #define CONFIG_SPEARMAC */ +/* #define CONFIG_ETHAUTONEG */ +/* #define CONFIG_ETHDEBUG */
Don't add dead code.
include/configs/spear300.h line 53
Quoted 5 lines
include/configs/spear300.h new file +5
-0+#define CONFIG_SYS_FIFO_BASE (0xE1000800) +#define CONFIG_USBD_PRODUCT_NAME "SPEAr SoC" +#define CONFIG_USBD_MANUFACTURER "ST Microelectronics" + +#define CONFIG_EXTRA_ENV_SETTINGS "usbtty=cdc_acm"
Vertial alignment by TABs only, please.
include/configs/spear300.h line 65
Quoted 2 lines
include/configs/spear300.h new file +2
-0+/* #define CONFIG_SYS_I2C_MULTI_EEPROMS */ +/* #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 0x1 */
Don't add dead code. Please fix globally.
include/configs/spear300.h line 71
Quoted 5 lines
include/configs/spear300.h new file +5
-0+/* +* SMI driver configuration +*/ +#define CONFIG_SPEARSMI +#undef CONFIG_SYS_NO_FLASH
Don't undef what is not defined anyway.
Quoted 1 line
+#define
CONFIG_SYS_HZ(26000)
CONFIG_SYS_HZ _must_ be defined as 1000.
include/configs/spear300.h line 168
Quoted 6 lines
include/configs/spear300.h new file +6
-0+/* #define CONFIG_ETHADDR 00:11:22:33:44:55 */ + +/* #define CONFIG_NETMASK 255.255.255.0 */ +/* #define CONFIG_IPADDR 192.168.1.10 */ +/* #define CONFIG_SERVERIP 192.168.1.1 */ +/* #define CONFIG_GATEWAYIP 192.168.1.1 */
Get rid of all this stuff.
include/configs/spear300.h line 188
Quoted 4 lines
include/configs/spear300.h new file +4
-0+#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + \ + CONFIG_SYS_MONITOR_LEN) + +#define CONFIG_BOOTARGS "console=ttyS0 mem=128M " \
Lines too long.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de But it's real. And if it's real it can be affected ... we may not be able to break it, but, I'll bet you credits to Navy Beans we can put a dent in it. -- deSalle, "Catspaw", stardate 3018.2
PATCH 6/9 SPEAr300 SoC support added
Dear Wolfgang,
Quoted 9 lines
Quoted 2 lines
Signed-off-by Vipin <[email protected]>...
Quoted 5 lines
board/spear/spear300/config.mk new file +0
-0...
Quoted 5 lines
board/spear/spear300/config.mk line 39
Quoted 3 lines
board/spear/spear300/config.mk new file +3
-0+PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY +endif +Please do not add trailing empty lines. [Please check globally.]
Ok. Corrected globally
Quoted 7 lines
board/spear/spear300/spr300_board.c
Quoted 5 lines
board/spear/spear300/spr300_board.c new file +0
-0Usually the file name is the same as the board config name.
Ok. filename corrected
Quoted 7 lines
Quoted 7 lines
board/spear/spear300/spr300_board.c new file +7
-0+int board_nand_init (struct nand_chip *nand) +{ + ? ? struct misc_regs *const misc_regs_p = + ? ? ? ? ? ? (struct misc_regs *)CONFIG_SPEAR_MISCBASE; + + ? ? if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) == + ? ? ? ? ? ? ? ? ? ? ? ? ? ? MISC_SOCCFG30) ||
Quoted 8 lines
Quoted 6 lines
+ ? ? ? ?((readl(&misc_regs_p->auto_cfg_reg) &
MISC_SOCCFGMSK) ==
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ?MISC_SOCCFG31)) {
+
+ ? ? ? ? ? ? returnspear_nand_init(nand);
+ ? ? } else {
+ ? ? ? ? ? ? return -1;"else" not needed. Unindent the "return -1;".
Ok.
Removed else and unindented
Quoted 6 lines
Quoted 5 lines
include/configs/spear300.h new file +0
-0...
Quoted 8 lines
include/configs/spear300.h line 39
Quoted 6 lines
include/configs/spear300.h new file +6
-0+/* +* Ethernet MAC driver configuration +*/ +/* #define CONFIG_SPEARMAC */ +/* #define CONFIG_ETHAUTONEG */ +/* #define CONFIG_ETHDEBUG */ Don't add dead code.
Ok. dead code removed
Quoted 7 lines
include/configs/spear300.h
Quoted 5 lines
include/configs/spear300.h new file +5
-0+#define CONFIG_SYS_FIFO_BASE ? ? ? ? ? ? ? ? (0xE1000800) +#define CONFIG_USBD_PRODUCT_NAME ? ? ? ? ? ? "SPEAr SoC" +#define CONFIG_USBD_MANUFACTURER ? ? ? ? ? ? "ST Microelectronics" + +#define CONFIG_EXTRA_ENV_SETTINGS ? ? ? ? ? ? ? "usbtty=cdc_acm"Vertial alignment by TABs only, please.
Ok. Used tabs for vertical alignment
Quoted 4 lines
include/configs/spear300.h
Quoted 2 lines
include/configs/spear300.h new file +2
-0+/* #define CONFIG_SYS_I2C_MULTI_EEPROMS */ +/* #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN ? ? ? ?0x1 */ Don't add dead code. Please fix globally.
Ok. Corrected globally
Quoted 7 lines
include/configs/spear300.h
Quoted 5 lines
include/configs/spear300.h new file +5
-0+/* +* SMI driver configuration +*/ +#define CONFIG_SPEARSMI +#undef ?CONFIG_SYS_NO_FLASHDon't undef what is not defined anyway.
Ok. undef removed
Quoted 3 lines
Quoted 1 line
+#define
CONFIG_SYS_HZ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(26000)
CONFIG_SYS_HZ_must_ be defined as 1000.
Could not understand the reason why it is necessary
Quoted 8 lines
include/configs/spear300.h
Quoted 6 lines
include/configs/spear300.h new file +6
-0+/* #define CONFIG_ETHADDR ? ? ? ? ? ? ? ? ? ?00:11:22:33:44:55 */ + +/* #define CONFIG_NETMASK ? ? ? ? ? ? ? ? ? ?255.255.255.0 */ +/* #define CONFIG_IPADDR ? ? ? ? ? ? ? ? ? ? 192.168.1.10 */ +/* #define CONFIG_SERVERIP ? ? ? ? ? ? ? ? ? 192.168.1.1 */ +/* #define CONFIG_GATEWAYIP ? ? ? ? ? ? ? ? ?192.168.1.1 */ Get rid of all this stuff.
Ok. Dead code removed
Quoted 6 lines
include/configs/spear300.h
Quoted 4 lines
include/configs/spear300.h new file +4
-0+#define CONFIG_ENV_ADDR ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(CONFIG_SYS_MONITOR_BASE + \ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CONFIG_SYS_MONITOR_LEN) + +#define CONFIG_BOOTARGS ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"console=ttyS0 mem=128M " ?\Lines too long.
Ok. Corrected.
Best Regards
Vipin
PATCH 6/9 SPEAr300 SoC support added
Dear Vipin Kumar,
Quoted 4 lines · In message <[email protected]> you…
Quoted 2 lines
CONFIG_SYS_HZ_must_ be defined as 1000.Could not understand the reason why it is necessary
Some parts of the code rely on this. It has been a bad idea to ever make this a config variable (but that's history, and we cannot change it).
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If you hear an onion ring, answer it.
PATCH 6/9 SPEAr300 SoC support added
Dear Wolfgang,
Quoted 10 lines
Quoted 4 lines · In message <[email protected]> you…
Quoted 2 lines
CONFIG_SYS_HZ_must_ be defined as 1000.Could not understand the reason why it is necessary
Some parts of the code rely on this. It has been a bad idea to ever make this a config variable (but that's history, and we cannot change it).
Ok. change accepted
Best Regards
Vipin
PATCH 5/9 SPEAr600 SoC support added
In reply to Vipin KUMARQuoted 7 lines · Vipin KUMAR
Signed-off-by Vipin <[email protected]>--- board/spear/common/spr_lowlevel_init.S | 202 ++++++++++++++++++ board/spear/common/spr_misc.c | 270 ++++++++++++++++++++++++ board/spear/spear600/Makefile | 52 +++++ board/spear/spear600/config.mk | 39 ++++ board/spear/spear600/spr600_board.c | 53 +++++
The changes to board/* should be moved out of this patch and into patch 9 "SPEAr600 build support added". Same comment for include/configs/spear600.h.
Quoted 11 lines
common/cmd_bdinfo.c | 20 ++ cpu/arm926ejs/spear/Makefile | 52 +++++ cpu/arm926ejs/spear/reset.c | 49 +++++ cpu/arm926ejs/spear/timer.c | 148 +++++++++++++ include/asm-arm/arch-spear/spr_defs.h | 31 +++ include/asm-arm/arch-spear/spr_emi.h | 55 +++++ include/asm-arm/arch-spear/spr_gpt.h | 83 ++++++++ include/asm-arm/arch-spear/spr_syscntl.h | 38 ++++ include/asm-arm/arch-spear/spr_xloader_table.h | 67 ++++++ include/asm-arm/u-boot.h | 5 + include/configs/spear600.h | 260 +++++++++++++++++++++++
It'd also be nice to give a description of each board and SOC you add. Eg what's the difference between the 300, 310, 320, 600? What peripherals do they support? What does SPEAr stand for? More commit messages in general wouldn't hurt:)
Best,
Peter
PATCH 5/9 SPEAr600 SoC support added
Ciao Peter,
Quoted 4 lines
The changes to board/* should be moved out of this patch and into patch 9 "SPEAr600 build support added". Same comment for
include/configs/spear600.h.
Tomorrow we will resend patch_5 and patch_9.
Quoted 5 lines
It'd also be nice to give a description of each board and SOC you add. Eg what's the difference between the 300, 310, 320, 600? What peripherals do they support? What does SPEAr stand for? More commit messages in general wouldn't hurt:)
SPEAr (Structured Processor Enhanced Architecture).
You can find some description throughout Internet, for example here:
http://embedded-system.net/spear-basic-customizable-arm-based-soc-stmicroelectronics.html
(SPEARBasic means SPEAr300.)
As you can see this SoC family embeds a customizable logic that could be programmed one-time by a customer at silicon mask level (i.e. not at runtime!).
We are now adding the support in u-boot for two SoC: SPEAr600 and SPEAr3xx. Pls note that SPEAr300/310/320 differs only for the default customization.
All 4 SoCs share common peripherals.
1. ARM926ejs core based (sp600 has two AMP cores, the 2nd handled only in Linux)
2. FastEthernet (sp600 has Gbit version, but same controller - GMAC)
3. USB Host
4. USB Device
5. NAND controller (FSMC)
6. Serial NOR ctrl
7. I2C
8. SPI
9. CLCD
10. others ..
sp600 is not customized by default.
sp3xx are differently customized...
sp300 is more oriented to TELECOM/video (it has tdm, i2s, ITU i/f support) sp310 for networking (a part GMAC in fixed part, it has 5 MACB ctrls in custom)
sp320 for industrial (SPP ctrl, CAN ctrl, 2 MACBs, ...)
Everything is supported in Linux.
u-boot is not currently supporting all peripeharls (just a few).
Regards,
Arm
Quoted 41 lines · Peter Tyser
Quoted 8 lines · Vipin KUMAR
Signed-off-by Vipin <[email protected]>--- board/spear/common/spr_lowlevel_init.S | 202 ++++++++++++++++++ board/spear/common/spr_misc.c | 270 ++++++++++++++++++++++++ board/spear/spear600/Makefile | 52 +++++ board/spear/spear600/config.mk | 39 ++++ board/spear/spear600/spr600_board.c | 53 +++++The changes to board/* should be moved out of this patch and into patch 9 "SPEAr600 build support added". Same comment for
include/configs/spear600.h.Quoted 12 lines
common/cmd_bdinfo.c | 20 ++ cpu/arm926ejs/spear/Makefile | 52 +++++ cpu/arm926ejs/spear/reset.c | 49 +++++ cpu/arm926ejs/spear/timer.c | 148 +++++++++++++ include/asm-arm/arch-spear/spr_defs.h | 31 +++ include/asm-arm/arch-spear/spr_emi.h | 55 +++++ include/asm-arm/arch-spear/spr_gpt.h | 83 ++++++++ include/asm-arm/arch-spear/spr_syscntl.h | 38 ++++ include/asm-arm/arch-spear/spr_xloader_table.h | 67 ++++++ include/asm-arm/u-boot.h | 5 + include/configs/spear600.h | 260 +++++++++++++++++++++++It'd also be nice to give a description of each board and SOC you add. Eg what's the difference between the 300, 310, 320, 600? What peripherals do they support? What does SPEAr stand for? More commit messages in general wouldn't hurt:)
Best,
Peter_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 8 lines
-- "Every step appears to be the unavoidable consequence of the -- preceding one." (A. Einstein) -- Armando Visconti Mobile: (+39) 346 8879146 Senior SW Engineer Fax: (+39) 02 93519290 CPG Work: (+39) 02 93519683 Computer System Division e-mail: armando.visconti at st.com ST Microelectronics TINA: 051 4683
PATCH 5/9 SPEAr600 SoC support added
Hi Arm,
<snip>
Quoted 34 lines
Quoted 5 lines
It'd also be nice to give a description of each board and SOC you add. Eg what's the difference between the 300, 310, 320, 600? What peripherals do they support? What does SPEAr stand for? More commit messages in general wouldn't hurt:)
SPEAr (Structured Processor Enhanced Architecture).
You can find some description throughout Internet, for example here:http://embedded-system.net/spear-basic-customizable-arm-based-soc-stmicroelectronics.html
(SPEARBasic means SPEAr300.)As you can see this SoC family embeds a customizable logic that could be programmed one-time by a customer at silicon mask level (i.e. not at runtime!).
We are now adding the support in u-boot for two SoC: SPEAr600 and SPEAr3xx. Pls note that SPEAr300/310/320 differs only for the default customization.
All 4 SoCs share common peripherals.
1. ARM926ejs core based (sp600 has two AMP cores, the 2nd handled only in Linux)
2. FastEthernet (sp600 has Gbit version, but same controller - GMAC)
3. USB Host
4. USB Device
5. NAND controller (FSMC)
6. Serial NOR ctrl
7. I2C
8. SPI
9. CLCD
10. others ..sp600 is not customized by default.
Quoted 8 lines
sp3xx are differently customized...
sp300 is more oriented to TELECOM/video (it has tdm, i2s, ITU i/f support) sp310 for networking (a part GMAC in fixed part, it has 5 MACB ctrls in custom)
sp320 for industrial (SPP ctrl, CAN ctrl, 2 MACBs, ...)Everything is supported in Linux.
u-boot is not currently supporting all peripeharls (just a few).
I see. It'd be nice to put some of the above information in the U-Boot commit logs to give people an idea about what's going on without having to use google, etc.
I haven't looked at the code differences between the sp3xx boards, but you might be able to use 1 common board file/header file to support them all. For example, take a look at the M5475AFE_config rule in U-Boot's ./Makefile. Some extra code in the Makefile and some #ifdefs in the sp3xx code might accommodate all 3 boards.
Best,
Peter
PATCH 5/9 SPEAr600 SoC support added
Dear Peter Tyser,
Quoted 4 lines · In message <[email protected]> you wrote:
I see. It'd be nice to put some of the above information in the U-Boot commit logs to give people an idea about what's going on without having to use google, etc.
...and even better in some doc/README.??? so it is part of the source code.
Quoted 5 lines
I haven't looked at the code differences between the sp3xx boards, but you might be able to use 1 common board file/header file to support them all. For example, take a look at the
M5475AFE_configrule in U-Boot's ./Makefile. Some extra code in theMakefileand some #ifdefs in the sp3xx code might accommodate all 3 boards.
Extra code in the Makefile should not be needed any more.
Best regards,
Wolfgang Denk
Signature · 12 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Zero is an enigmatic value. It can mean success (fclose) or failure (scanf). It can mean black or white. It can mean no permissions (chmod) or all permissions (umask). It can mean now (setjmp) or later (atexit). It can mean the beginning (lseek) or the end (read). It can mean myself (getpgrp) or child (fork). It can mean all (kill's 1st argument) or nothing (kill's 2nd argument). It can mean `default' (SIG_IGN) or `I don't care' (waitpid) or `try to guess' (strtol). Indeed 0 lets you talk to God (setuid). Verily is 0 all things to all people.
PATCH 5/9 SPEAr600 SoC support added
Hi Wolfgang,
<snip>
Quoted 7 lines
Quoted 5 lines
I haven't looked at the code differences between the sp3xx boards, but you might be able to use 1 common board file/header file to support them all. For example, take a look at the
M5475AFE_configrule in U-Boot's ./Makefile. Some extra code in theMakefileand some #ifdefs in the sp3xx code might accommodate all 3 boards.Extra code in the
Makefileshould not be needed any more.
To be clear, you still think its a good idea to look into combining the similar boards, correct? I haven't dealt with the MKCONFIG voodoo, so maybe I chose a poor example. Perhaps the CPCI405 and friends is a better example?
Best,
Peter
PATCH 5/9 SPEAr600 SoC support added
Dear Peter Tyser,
Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 6 lines
I haven't looked at the code differences between the sp3xx boards, but you might be able to use 1 common board file/header file to support them all. For example, take a look at the
M5475AFE_configrule in U-Boot's ./Makefile. Some extra code in theMakefileand some #ifdefs in the sp3xx code might accommodate all 3 boards.Extra code in the
Makefileshould not be needed any more.To be clear, you still think its a good idea to look into combining the similar boards, correct? I haven't dealt with the MKCONFIG voodoo, so
Yes, of course.
Quoted 2 lines
maybe I chose a poor example. Perhaps the CPCI405 and friends is a better example?
Or this:
2485 P1011RDB_config \
2486 P1011RDB_NAND_config \
2487 P1011RDB_SDCARD_config \
2488 P1011RDB_SPIFLASH_config \
2489 P1020RDB_config \
2490 P1020RDB_NAND_config \
2491 P1020RDB_SDCARD_config \
2492 P1020RDB_SPIFLASH_config \
2493 P2010RDB_config \
2494 P2010RDB_NAND_config \
2495 P2010RDB_SDCARD_config \
2496 P2010RDB_SPIFLASH_config \
2497 P2020RDB_config \
2498 P2020RDB_NAND_config \
2499 P2020RDB_SDCARD_config \
2500 P2020RDB_SPIFLASH_config: unconfig
2501 @$(MKCONFIG) -t $(@:_config=) P1_P2_RDB ppc mpc85xx p1_p2_rdb freescale
No scripting any more in the Makefile :-)
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Vulcans worship peace above all. -- McCoy, "Return to Tomorrow", stardate 4768.3
PATCH 5/9 SPEAr600 SoC support added
Dear Wolfgang,
Quoted 39 lines
Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 6 lines
I haven't looked at the code differences between the sp3xx boards, but you might be able to use 1 common board file/header file to support them all. ?For example, take a look at the
M5475AFE_configrule in U-Boot's ./Makefile. ?Some extra code in theMakefileand some #ifdefs in the sp3xx code might accommodate all 3 boards.Extra code in the
Makefileshould not be needed any more.To be clear, you still think its a good idea to look into combining the similar boards, correct? ?I haven't dealt with the MKCONFIG voodoo, so
Yes, of course.
Quoted 2 lines
maybe I chose a poor example. ?Perhaps the CPCI405 and friends is a better example?
Or this:
2485
P1011RDB_config\
2486P1011RDB_NAND_config\
2487P1011RDB_SDCARD_config\
2488P1011RDB_SPIFLASH_config\
2489P1020RDB_config\
2490P1020RDB_NAND_config\
2491P1020RDB_SDCARD_config\
2492P1020RDB_SPIFLASH_config\
2493P2010RDB_config\
2494P2010RDB_NAND_config\
2495P2010RDB_SDCARD_config\
2496P2010RDB_SPIFLASH_config\
2497P2020RDB_config\
2498P2020RDB_NAND_config\
2499P2020RDB_SDCARD_config\
2500P2020RDB_SPIFLASH_config: ? ? ? unconfig
2501 ? ? ? ? @$(MKCONFIG) -t $(@:_config=)P1_P2_RDBppc mpc85xxp1_p2_rdbfreescale
Quoted 1 line
No scripting any more in the
Makefile:-)
Ok. Used the above example to combine SPEAr boards
Best Regards
Vipin
Wolfgang Denk
NAKPATCH 5/9 SPEAr600 SoC support added
In reply to Vipin KUMARDear Vipin KUMAR,
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>
...
board/spear/common/spr_misc.c line 70
Quoted 9 lines
board/spear/common/spr_misc.c new file +9
-0+int misc_init_r (void ) +{ +#if defined(CONFIG_CMD_NET ) +uchar mac_id[6 ]; + +if (!i2c_read_mac (mac_id)) +eth_setenv_enetaddr ("ethaddr" , mac_id); +#endif +setenv ("verify" ,"n" );
NAK.
Please do not enforce such a policy on all your users. Let them decide if they want this, or not.
...
Quoted 26 lines
board/spear/common/spr_misc.c new file +26
-0+int do_setfreq (cmd_tbl_t *cmdtp,int flag,int argc,char *argv[]) +{ +void (*sram_setfreq) (unsigned int ,unsigned int ); +unsigned int frequency; + +if (argc !=3 ) { +printf ("Usage:\n%s\n" , cmdtp->usage); +return 1 ; + } + + frequency =simple_strtoul (argv[2 ],NULL ,0 ); + +if (frequency >333 ) { +printf ("Frequency is limited to 333MHz\n" ); +return 1 ; + } + sram_setfreq =memcpy ((void *)0xD2801000 , setfreq, setfreq_sz); + +if (!strcmp (argv[1 ],"ddr" )) { +sram_setfreq (DDR , frequency); +printf ("DDR frequency changed to %u\n" , frequency); + + }else if (!strcmp (argv[1 ],"cpu" )) { +sram_setfreq (CPU , frequency); +printf ("CPU frequency changed to %u\n" , frequency); + }else {
board/spear/common/spr_misc.c line 199
Quoted 10 lines
board/spear/common/spr_misc.c new file +10
-0+printf ("Usage:\n%s\n" , cmdtp->usage); + return 1; + } + +return 0 ; +} + +U_BOOT_CMD (setfreq,3 ,1 , do_setfreq, +"change ddr/cpu frequency" ,"device[ddr/cpu] frequency" ); +#endif
Do we need a new custom command for this? Either allow setting by environment variable only ("cpuclk" is already used by a number of systems), or use a common command name ("chip_config" was chosen for this after some discussion a while ago).
Also, is no further checking needed? Can I set arbitrary frequencies, like 307 for CPU and 277 for DDR?
board/spear/common/spr_misc.c line 212
Quoted 4 lines
board/spear/common/spr_misc.c new file +4
-0+if ((buf[0 ] ==0x55 ) && (buf[1 ] ==0xAA )) { +/* Valid MAC address is saved in I2C EEPROM, +read the MAC address from the +EEPROM & update the buffer */
Incorrect multiline comment once more.
board/spear/common/spr_misc.c line 245
Quoted 7 lines
board/spear/common/spr_misc.c new file +7
-0+ buf[0 ] =0x55 ; + buf[1 ] =0xAA ; +i2c_write (0x50 ,/* Chip address */ +0x0 ,/* Offset */ +1 ,/* Address length */ + buf,/* buffer */ +2 );/* Length */
Argh. Please do not do this.
board/spear/common/spr_misc.c line 254
Quoted 8 lines
board/spear/common/spr_misc.c new file +8
-0+ buf[0 ] =0x44 ; + buf[1 ] =0x66 ; + +i2c_read (0x50 ,/* Chip address */ +0x0 ,/* Offset */ +1 ,/* Address length */ + buf,/* buffer */ +2 );/* Length */
Ditto.
Quoted 27 lines
common/cmd_bdinfo.c +12
-0@@ -27,6 +27,10 @@#include <common.h> #include <command.h> +#if defined(CONFIG_SPEAR600 ) || defined(CONFIG_SPEAR3XX ) +#include <asm/arch/spr_xloader_table.h> +#endif +DECLARE_GLOBAL_DATA_PTR ;static void print_num (const char *,ulong );@@ -339,6 +343,22 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])#endif printf ("baudrate = %d bps\n" , bd->bi_baudrate); +#if defined(CONFIG_SPEAR600 ) || defined(CONFIG_SPEAR3XX ) +if (bd->dramfreq ==-1 ) +printf ("DDR Freq = Not Known\n" ); +else +printf ("DDR Freq = %d\n" , bd->dramfreq); + +if (bd->dramtype ==DDRMOBILE ) +printf ("DDR Type = MOBILE\n" );
common/cmd_bdinfo.c int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 363
Quoted 10 lines
common/cmd_bdinfo.c +8
-0+ else if (bd->dramtype == DDR2) + printf("DDR Type = DDR2\n"); + else + printf("DDR Type = Not Known\n"); + +printf ("Xloader Rev = %s\n" , bd->version); +#endif +return 0 ; }
I don't like such board-specific code in this common file.
Quoted 3 lines
include/configs/spear600.h new file +0
-0
...
include/configs/spear600.h line 169
Quoted 6 lines
include/configs/spear600.h new file +6
-0+/* #define CONFIG_ETHADDR 00:11:22:33:44:55 */ + +/* #define CONFIG_NETMASK 255.255.255.0 */ +/* #define CONFIG_IPADDR 192.168.1.10 */ +/* #define CONFIG_SERVERIP 192.168.1.1 */ +/* #define CONFIG_GATEWAYIP 192.168.1.1 */
Please remove.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "A witty saying proves nothing." - Voltaire
PATCH 5/9 SPEAr600 SoC support added
Dear Wolfgang,
Quoted 16 lines
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>...
board/spear/common/spr_misc.c
Quoted 9 lines
board/spear/common/spr_misc.c new file +9
-0+int misc_init_r (void ) +{ +#if defined(CONFIG_CMD_NET ) + ? ? uchar mac_id[6]; + + ? ? if (!i2c_read_mac(mac_id)) + ? ? ? ? ? ? eth_setenv_enetaddr("ethaddr", mac_id); +#endif + ? ? setenv("verify", "n");NAK.
Quoted 4 lines
Please do not enforce such a policy on all your users. ?Let them decide if they want this, or not.
...
Source modified to
if (ethaddr from environment fails)
read mac from i2c memory
This should be ok. Right
Quoted 33 lines
Quoted 33 lines
(quoted diff) +33
-0+int do_setfreq(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + ? ? void (*sram_setfreq) (unsigned int, unsigned int); + ? ? unsigned int frequency; + + ? ? if (argc != 3) { + ? ? ? ? ? ? printf("Usage:\n%s\n", cmdtp->usage); + ? ? ? ? ? ? return 1; + ? ? } + + ? ? frequency = simple_strtoul(argv[2], NULL, 0); + + ? ? if (frequency > 333) { + ? ? ? ? ? ? printf("Frequency is limited to 333MHz\n"); + ? ? ? ? ? ? return 1; + ? ? } + ? ? sram_setfreq = memcpy((void *)0xD2801000, setfreq, setfreq_sz); + + ? ? if (!strcmp(argv[1], "ddr")) { + ? ? ? ? ? ? sram_setfreq(DDR, frequency); + ? ? ? ? ? ? printf("DDR frequency changed to %u\n", frequency); + + ? ? } else if (!strcmp(argv[1], "cpu")) { + ? ? ? ? ? ? sram_setfreq(CPU, frequency); + ? ? ? ? ? ? printf("CPU frequency changed to %u\n", frequency); + ? ? } else { + ? ? ? ? ? ? printf("Usage:\n%s\n", cmdtp->usage); + ? ? ? ? ? ? return 1; + ? ? } + + ? ? return 0; +} +
Quoted 9 lines
board/spear/common/spr_misc.c line 199
Quoted 3 lines
board/spear/common/spr_misc.c new file +3
-0+U_BOOT_CMD (setfreq,3 ,1 , do_setfreq, + ? ? ? ?"change ddr/cpu frequency", "device[ddr/cpu] frequency"); +#endif Do we need a new custom command for this? Either allow setting by environment variable only ("cpuclk" is already used by a number of systems), or use a common command name ("
chip_config" was chosen for this after some discussion a while ago).
Code modified to use chip_config. this command is implemented in board specific file. I guess that should be ok since there is no standard interface for the command
Quoted 3 lines
Also, is no further checking needed? Can I set arbitrary frequencies, like 307 for CPU and 277 for DDR?
Yes, all values below 333 are acceptable. This command is added for testing purposes only so no further checking is required
Quoted 6 lines
Quoted 4 lines
+ ? ? if ((buf[0] ==
0x55) && (buf[1] ==0xAA)) {
+ ? ? ? ? ? ? /* Valid MAC address is saved in I2C EEPROM,
+ ? ? ? ? ? ? ? ?read the MAC address from the
+ ? ? ? ? ? ? ? ?EEPROM & update the buffer */Incorrect multiline comment once more.
Corrected multiline comments globally
Quoted 10 lines
Quoted 8 lines
+ ? ? buf[0] =
0x55;
+ ? ? buf[1] =0xAA;
+ ? ? i2c_write(0x50, ? ? ? ? /* Chip address */
+ ? ? ? ? ? ? ?0x0, ? ? ? ? ?/* Offset */
+ ? ? ? ? ? ? ? 1, ? ? ? ? ? ?/* Address length */
+ ? ? ? ? ? ? ? buf, ? ? ? ? ?/* buffer */
+ ? ? ? ? ? ? ? 2); ? ? ? ? ? /* Length */Argh. Please do not do this.
Ok, modified to single line function call
Quoted 9 lines
Quoted 8 lines
+ ? ? buf[0] =
0x44;
+ ? ? buf[1] =0x66;
+
+ ? ? i2c_read(0x50, ? ? ? ? ?/* Chip address */
+ ? ? ? ? ? ? ?0x0, ? ? ? ? ? /* Offset */
+ ? ? ? ? ? ? ?1, ? ? ? ? ? ? /* Address length */
+ ? ? ? ? ? ? ?buf, ? ? ? ? ? /* buffer */
+ ? ? ? ? ? ? ?2); ? ? ? ? ? ?/* Length */
Ok, modified to single line function call
Quoted 31 lines
Quoted 31 lines
common/cmd_bdinfo.c +0
-0@@ -27,6 +27,10 @@?#include <
common.h>
?#include <command.h>common/cmd_bdinfo.c +4
-0+#if defined(CONFIG_SPEAR600 ) || defined(CONFIG_SPEAR3XX ) +#include <asm/arch/spr_xloader_table.h> +#endif +?DECLARE_GLOBAL_DATA_PTR;
?static void
print_num(const char *, ulong);common/cmd_bdinfo.c +0
-0@@ -339,6 +343,22 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])?#endif
? ? ? printf ("baudrate ? ?= %d bps\n",bd->bi_baudrate);common/cmd_bdinfo.c +12
-0+#if defined(CONFIG_SPEAR600 ) || defined(CONFIG_SPEAR3XX ) + ? ? if (bd->dramfreq == -1) + ? ? ? ? ? ? printf("DDR Freq ? ?= Not Known\n"); + ? ? else + ? ? ? ? ? ? printf("DDR Freq ? ?= %d\n", bd->dramfreq); + + ? ? if (bd->dramtype == DDRMOBILE) + ? ? ? ? ? ? printf("DDR Type ? ?= MOBILE\n"); + ? ? else if (bd->dramtype == DDR2) + ? ? ? ? ? ? printf("DDR Type ? ?= DDR2\n"); + ? ? else + ? ? ? ? ? ? printf("DDR Type ? ?= Not Known\n");
Quoted 8 lines
Quoted 6 lines
common/cmd_bdinfo.c +4
-0+ + ? ? printf("Xloader Rev = %s\n", bd->version); +#endif +? ? ? return 0;
?}I don't like such board-specific code in this common file.
Ok. But then bdinfo should ideally contain a generic callback to be implemented by board specific code.
Quoted 4 lines
Quoted 3 lines
include/configs/spear600.h new file +0
-0...
Quoted 8 lines
include/configs/spear600.h
Quoted 6 lines
include/configs/spear600.h new file +6
-0+/* #define CONFIG_ETHADDR ? ? ? ? ? ? ? ? ? ?00:11:22:33:44:55 */ + +/* #define CONFIG_NETMASK ? ? ? ? ? ? ? ? ? ?255.255.255.0 */ +/* #define CONFIG_IPADDR ? ? ? ? ? ? ? ? ? ? 192.168.1.10 */ +/* #define CONFIG_SERVERIP ? ? ? ? ? ? ? ? ? 192.168.1.1 */ +/* #define CONFIG_GATEWAYIP ? ? ? ? ? ? ? ? ?192.168.1.1 */ Please remove.
Ok.removed commented code
Regards
Vipin
PATCH 4/9 usbd driver and usb boot firmware support for SPEAr SoCs
In reply to Vipin KUMARDear Vipin KUMAR,
Quoted 15 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>--- common/main.c | 2 + drivers/serial/usbtty.h | 2 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/spr_udc.c | 996 +++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_misc.h | 126 +++++ include/usb/spr_udc.h | 227 ++++++++ 6 files changed, 1354 insertions(+), 0 deletions(-) mode change 100644 => 100755 drivers/serial/usbtty.h mode change 100644 => 100755 drivers/usb/gadget/Makefile create mode 100755 drivers/usb/gadget/spr_udc.c create mode 100644 include/asm-arm/arch-spear/spr_misc.h create mode 100755 include/usb/spr_udc.h
Please split into two patches: one with generic usbd driver, and the second adding support for SPEAr.
Quoted 13 lines
common/main.c +1
-0@@ -397,6 +397,7 @@ void main_loop (void)debug ("### main_loop: bootcmd=\"%s\"\n" , s ? s :"<UNDEFINED>" ); +#if !defined(CONFIG_SPEAR_USBTTY )if (bootdelay >=0 && s && !abortboot (bootdelay)) {# ifdef CONFIG_AUTOBOOT_KEYED int prev =disable_ctrlc (1 );/* disable Control C checking */
common/main.c void main_loop (void) · line 417
Quoted 4 lines
common/main.c +1
-0@@ -413,6 +414,7 @@ void main_loop (void)disable_ctrlc (prev);/* restore Control C checking */ # endif } +# endif
Why would this be needed?
Quoted 5 lines
drivers/usb/gadget/spr_udc.c new file +0
-0
...
drivers/usb/gadget/spr_udc.c line 44
Quoted 8 lines
drivers/usb/gadget/spr_udc.c new file +8
-0+/* Some kind of debugging output... */ +#if 1 +#define UDCDBG (str) +#define UDCDBGA(fmt, args...) +#else +#define UDCDBG (str) serial_printf(str "\n") +#define UDCDBGA(fmt, args...) serial_printf(fmt "\n", ##args) +#endif
This looks wrong. Should that be a "#ifndef DEBUG" instead of "#if 1"?
And cannot we use standard debug facilities?
Quoted 55 lines
drivers/usb/gadget/spr_udc.c new file +55
-0+static struct udc_endp_regs *const outep_regs_p = + &((struct udc_regs *const )CONFIG_SYS_USBD_BASE )->out_regs[0 ]; +static struct udc_endp_regs *const inep_regs_p = + &((struct udc_regs *const )CONFIG_SYS_USBD_BASE )->in_regs[0 ]; + +/* +* udc_state_transition - Write the next packet to TxFIFO. +* @initial: Initial state. +* @final: Final state. +* +* Helper function to implement device state changes. The device states and +* the events that transition between them are: +* +* STATE_ATTACHED +* || /\ +* \/ || +* DEVICE_HUB_CONFIGURED DEVICE_HUB_RESET +* || /\ +* \/ || +* STATE_POWERED +* || /\ +* \/ || +* DEVICE_RESET DEVICE_POWER_INTERRUPTION +* || /\ +* \/ || +* STATE_DEFAULT +* || /\ +* \/ || +* DEVICE_ADDRESS_ASSIGNED DEVICE_RESET +* || /\ +* \/ || +* STATE_ADDRESSED +* || /\ +* \/ || +* DEVICE_CONFIGURED DEVICE_DE_CONFIGURED +* || /\ +* \/ || +* STATE_CONFIGURED +* +* udc_state_transition transitions up (in the direction from STATE_ATTACHED +* to STATE_CONFIGURED) from the specified initial state to the specified final +* state, passing through each intermediate state on the way. If the initial +* state is at or above (i.e. nearer to STATE_CONFIGURED) the final state, then +* no state transitions will take place. +* +* udc_state_transition also transitions down (in the direction from +* STATE_CONFIGURED to STATE_ATTACHED) from the specified initial state to the +* specified final state, passing through each intermediate state on the way. +* If the initial state is at or below (i.e. nearer to STATE_ATTACHED) the final +* state, then no state transitions will take place. +* +* This function must only be called with interrupts disabled. +*/ +static void udc_state_transition (usb_device_state_t initial, +usb_device_state_t final)
...
Quoted 2 lines
drivers/usb/gadget/spr_udc.c new file +2
-0+/* Stall endpoint */ +static void udc_stall_ep (u32 ep_num)
...
Quoted 1 line
+static void *get_fifo(int
ep_num, int in)
...
Quoted 1 line
+static short
usbgetpckfromfifo(int epNum, u8 *bufp, u32 len)
...
Quoted 1 line
+static void
usbputpcktofifo(int epNum, u8 *bufp, u32 len)
...
So far this code looks pretty generic to me.
Quoted 5 lines
drivers/usb/gadget/spr_udc.c new file +5
-0+/* +* spear_write_noniso_tx_fifo - Write the next packet to TxFIFO. +* @endpoint: Endpoint pointer. +* +* If the endpoint has an active tx_urb, then the next packet of data from the
drivers/usb/gadget/spr_udc.c line 266
Quoted 10 lines
drivers/usb/gadget/spr_udc.c new file +10
-0+* URB is written to the tx FIFO. The total amount of data in the urb is given +* by urb->actual_length. The maximum amount of data that can be sent in any +* one packet is given by endpoint->tx_packetSize. The number of data bytes +* from this URB that have already been transmitted is given by endpoint->sent. +* endpoint->last is updated by this routine with the number of data bytes +* transmitted in this packet. +* +*/ +static void spear_write_noniso_tx_fifo (struct usb_endpoint_instance + *endpoint)
Now her eit becomes clearly SPEAr-specific. Should this not be split into separate source files to allow reuse of the common code by other processors?
drivers/usb/gadget/spr_udc.c line 286
Quoted 5 lines
drivers/usb/gadget/spr_udc.c new file +5
-0+ +/* This ensures that USBD packet fifo is accessed +:- through word aligned pointer or +:- through non word aligned pointer but only with a +max length to make the next packet word aligned */
Incorrect multiline comment style.
Too long lines.
drivers/usb/gadget/spr_udc.c line 371
Quoted 6 lines
drivers/usb/gadget/spr_udc.c new file +6
-0+/* This rx interrupt must be for a control write data +* stage packet. +* +* We don't support control write data stages. +* We should never end up here. +*/
Incorrect multiline comment style. Please fix globally.
Quoted 1 line
+struct
misc_regs{
...
Quoted 2 lines
drivers/usb/gadget/spr_udc.c new file +2
-0+u32 BIST5_RSLT_REG ;/* 0x118 */ +u32 SYST_ERROR_REG ;/* 0x11C */
...
drivers/usb/gadget/spr_udc.c
Quoted 1 line
drivers/usb/gadget/spr_udc.c new file +1
-0+u32 RAS_GPP1_IN ;/* 0x8000 */
Variable names must be lower case.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Now here's something you're really going to like!" - Rocket J. Squirrel
PATCH 4/9 usbd driver and usb boot firmware support for SPEAr SoCs
Dear Wolfgang,
Quoted 16 lines
Quoted 9 lines
Signed-off-by Vipin <[email protected]>---
?common/main.c ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 + ?drivers/serial/usbtty.h ? ? ? ? ? ? ? | ? ?2 + ?drivers/usb/gadget/Makefile ? ? ? ? ? | ? ?1 + ?drivers/usb/gadget/spr_udc.c ? ? ? ? ?| ?996 +++++++++++++++++++++++++++++++++ ?include/asm-arm/arch-spear/spr_misc.h | ?126 +++++ ?include/usb/spr_udc.h ? ? ? ? ? ? ? ? | ?227 ++++++++Quoted 6 lines
?6 files changed, 1354 insertions(+), 0 deletions(-) ?mode change 100644 => 100755
drivers/serial/usbtty.h?mode change 100644 => 100755drivers/usb/gadget/Makefile?create mode 100755drivers/usb/gadget/spr_udc.c?create mode 100644include/asm-arm/arch-spear/spr_misc.h?create mode 100755include/usb/spr_udc.h
Quoted 3 lines
Please split into two patches: one with generic usbd driver, and the second adding support for SPEAr.
Ok. Accepted.
patch-set v2 would contain the changes
Quoted 8 lines
Quoted 8 lines
common/main.c +0
-0@@ -397,6 +397,7 @@ void main_loop (void) ? ? ? debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
Quoted 11 lines
Quoted 9 lines
common/main.c +1
-0+#if !defined(CONFIG_SPEAR_USBTTY ) ? ? ? if (bootdelay >= 0 && s && !abortboot (bootdelay)) {?# ifdef
CONFIG_AUTOBOOT_KEYED
? ? ? ? ? ? ? int prev =disable_ctrlc(1); ? ?/* disable Control C checking */common/main.c +0
-0@@ -413,6 +414,7 @@ void main_loop (void)? ? ? ? ? ? ?
disable_ctrlc(prev); ? ?/* restore Control C checking */ ?# endif
? ? ? }
+# endifWhy would this be needed?
We also use u-boot as a firmware which runs on the board in a special mode in which the firmware fetches and burns images into NOR/NAND flashes. Under this mode, we would like to always jump to u-boot prompt.
Also, the bootdelay variable should remain unchanged as we save default environment variables as well.
Quoted 19 lines
Quoted 7 lines
drivers/usb/gadget/spr_udc.c new file +0
-0...
drivers/usb/gadget/spr_udc.c line 44
Quoted 8 lines
drivers/usb/gadget/spr_udc.c new file +8
-0+/* Some kind of debugging output... */ +#if 1 +#define UDCDBG (str) +#define UDCDBGA(fmt, args...) +#else +#define UDCDBG (str) serial_printf(str "\n") +#define UDCDBGA(fmt, args...) serial_printf(fmt "\n", ##args) +#endif This looks wrong. Should that be a "#ifndef DEBUG" instead of "#if 1"?
Quoted 2 lines
And cannot we use standard debug facilities?
Ok, changed to #ifndef DEBUG
The standard debug facilities use printf and we also test and use this for usbtty feature. So, a serial_printf is required
Quoted 59 lines
Quoted 55 lines
drivers/usb/gadget/spr_udc.c new file +55
-0+static struct udc_endp_regs *const outep_regs_p = + ? ? ? ? ? ? &((struct udc_regs *const)CONFIG_SYS_USBD_BASE)->out_regs[0]; +static struct udc_endp_regs *const inep_regs_p = + ? ? ? ? ? ? &((struct udc_regs *const)CONFIG_SYS_USBD_BASE)->in_regs[0]; + +/* +* udc_state_transition - Write the next packet to TxFIFO. +* @initial: Initial state. +* @final: ? Final state. +* +* Helper function to implement device state changes. The device states and +* the events that transition between them are: +* +* ? ? ? ? ? ? ? ? ? ? ? ? ? STATE_ATTACHED +* ? ? ? ? ? ? ? ? ? ? ? ? ? || ? ? ?/\ +* ? ? ? ? ? ? ? ? ? ? ? ? ? \/ ? ? ?|| +* ? DEVICE_HUB_CONFIGURED ? ? ? ? ? ? ? ? ? DEVICE_HUB_RESET +* ? ? ? ? ? ? ? ? ? ? ? ? ? || ? ? ?/\ +* ? ? ? ? ? ? ? ? ? ? ? ? ? \/ ? ? ?|| +* ? ? ? ? ? ? ? ? ? ? ? ? ? STATE_POWERED +* ? ? ? ? ? ? ? ? ? ? ? ? ? || ? ? ?/\ +* ? ? ? ? ? ? ? ? ? ? ? ? ? \/ ? ? ?|| +* ? DEVICE_RESET ? ? ? ? ? ? ? ? ? ? ? ? ? ?DEVICE_POWER_INTERRUPTION +* ? ? ? ? ? ? ? ? ? ? ? ? ? || ? ? ?/\ +* ? ? ? ? ? ? ? ? ? ? ? ? ? \/ ? ? ?|| +* ? ? ? ? ? ? ? ? ? ? ? ? ? STATE_DEFAULT +* ? ? ? ? ? ? ? ? ? ? ? ? ? || ? ? ?/\ +* ? ? ? ? ? ? ? ? ? ? ? ? ? \/ ? ? ?|| +* ? DEVICE_ADDRESS_ASSIGNED ? ? ? ? ? ? ? ? DEVICE_RESET +* ? ? ? ? ? ? ? ? ? ? ? ? ? || ? ? ?/\ +* ? ? ? ? ? ? ? ? ? ? ? ? ? \/ ? ? ?|| +* ? ? ? ? ? ? ? ? ? ? ? ? ? STATE_ADDRESSED +* ? ? ? ? ? ? ? ? ? ? ? ? ? || ? ? ?/\ +* ? ? ? ? ? ? ? ? ? ? ? ? ? \/ ? ? ?|| +* ? DEVICE_CONFIGURED ? ? ? ? ? ? ? ? ? ? ? DEVICE_DE_CONFIGURED +* ? ? ? ? ? ? ? ? ? ? ? ? ? || ? ? ?/\ +* ? ? ? ? ? ? ? ? ? ? ? ? ? \/ ? ? ?|| +* ? ? ? ? ? ? ? ? ? ? ? ? ? STATE_CONFIGURED +* +* udc_state_transition transitions up (in the direction from STATE_ATTACHED +* to STATE_CONFIGURED) from the specified initial state to the specified final +* state, passing through each intermediate state on the way. If the initial +* state is at or above (i.e. nearer to STATE_CONFIGURED) the final state, then +* no state transitions will take place. +* +* udc_state_transition also transitions down (in the direction from +* STATE_CONFIGURED to STATE_ATTACHED) from the specified initial state to the +* specified final state, passing through each intermediate state on the way. +* If the initial state is at or below (i.e. nearer to STATE_ATTACHED) the final +* state, then no state transitions will take place. +* +* This function must only be called with interrupts disabled. +*/ +static void udc_state_transition (usb_device_state_t initial, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?usb_device_state_t final)...
Quoted 2 lines
drivers/usb/gadget/spr_udc.c new file +2
-0+/* Stall endpoint */ +static void udc_stall_ep (u32 ep_num)...
Quoted 8 lines
Quoted 1 line
+static void *get_fifo(int
ep_num, int in)...
Quoted 1 line
+static short
usbgetpckfromfifo(int epNum, u8 *bufp, u32 len)...
Quoted 1 line
+static void
usbputpcktofifo(int epNum, u8 *bufp, u32 len)...
So far this code looks pretty generic to me.
No, this code is not generic.
Quoted 11 lines
Quoted 11 lines
+/*
+ *spear_write_noniso_tx_fifo- Write the next packet to TxFIFO.
+ * @endpoint: ? ? ? ? ? ? ? ?Endpoint pointer.
+ *
+ * If the endpoint has an activetx_urb, then the next packet of data from the
+ * URB is written to the tx FIFO. ?The total amount of data in the urb is given
+ * byurb->actual_length. ?The maximum amount of data that can be sent in any
+ * one packet is given byendpoint->tx_packetSize. ?The number of data bytes
+ * from this URB that have already been transmitted is given byendpoint->sent.
+ *endpoint->lastis updated by this routine with the number of data bytes
+ * transmitted in this packet.
Quoted 9 lines
Quoted 4 lines
+ *
+ */
+static void spear_write_noniso_tx_fifo(structusb_endpoint_instance
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*endpoint)Now her eit becomes clearly SPEAr-specific. Should this not be split into separate source files to allow reuse of the common code by other processors?
Again, all the code is spear specific. Probably, only the unction names are confusing
Quoted 8 lines
Quoted 5 lines
+
+ ? ? ? ? ? ? ? ? ? ? /* This ensures that USBD packet fifo is accessed
+ ? ? ? ? ? ? ? ? ? ? ? ?:- through word aligned pointer or
+ ? ? ? ? ? ? ? ? ? ? ? ?:- through non word aligned pointer but only with a
+ ? ? ? ? ? ? ? ? ? ? ? ?max length to make the next packet word aligned */Incorrect multiline comment style.
Ok. Corrected globally
Quoted 2 lines
Too long lines.
I assume line length of 80 is acceptable. Right?
Quoted 8 lines
Quoted 6 lines
+ ? ? ? ? ? ? /* This rx interrupt must be for a control write data
+ ? ? ? ? ? ? ?* stage packet.
+ ? ? ? ? ? ? ?*
+ ? ? ? ? ? ? ?* We don't support control write data stages.
+ ? ? ? ? ? ? ?* We should never end up here.
+ ? ? ? ? ? ? ?*/Incorrect multiline comment style. Please fix globally.
Ok. Corrected globally
Quoted 10 lines
Quoted 2 lines
+struct
misc_regs{...
Quoted 2 lines
+ ? ? u32
BIST5_RSLT_REG; ? ? ? ? ? ? /*0x118*/
+ ? ? u32SYST_ERROR_REG; ? ? ? ? ? ? /*0x11C*/...
Quoted 1 line
+ ? ? u32
RAS_GPP1_IN; ? ? ? ? ? ? ? ?/*0x8000*/Variable names must be lower case.
Ok. Corrected globally
Best Reagrds
Vipin Kumar
PATCH 4/9 usbd driver and usb boot firmware support for SPEAr SoCs
Dear Vipin Kumar,
Quoted 19 lines · In message <[email protected]> you…
Quoted 7 lines
Quoted 7 lines
common/main.c +0
-0@@ -397,6 +397,7 @@ void main_loop (void)debug ("### main_loop: bootcmd=\"%s\"\n" , s ? s :"<UNDEFI> NED>" );Quoted 11 lines
common/main.c void main_loop (void) · line 417
Quoted 9 lines
common/main.c +2
-0+#if !defined(CONFIG_SPEAR_USBTTY )if (bootdelay >=0 && s && !abortboot (bootdelay)) {# ifdef CONFIG_AUTOBOOT_KEYED int prev =disable_ctrlc (1 );/* dis> able Control C checking */ @@ -413,6 +414,7 @@ void main_loop (void)disable_ctrlc (prev);/* restore Contr> ol C checking */ # endif } +# endif Why would this be needed?
Quoted 4 lines
We also use u-boot as a firmware which runs on the board in a special mode in which the firmware fetches and burns images into NOR/NAND flashes. Under this mode, we would like to always jump to u-boot prompt.
This can be done by plain config settings. No need to chang ethe code.
Quoted 2 lines
Also, the bootdelay variable should remain unchanged as we save default environment variables as well.
Think of a different way to switch modes, please. I don't accept this change to common code.
Quoted 3 lines
Quoted 1 line
Too long lines.
I assume line length of 80 is acceptable. Right?
Maximum, right.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
What is mind? No matter. What is matter? Never mind.
-- Thomas Hewitt Key, 1799-1875PATCH 4/9 usbd driver and usb boot firmware support for SPEAr SoCs
Dear Wolfgang,
Quoted 20 lines
Quoted 19 lines · In message <[email protected]> you…
Quoted 18 lines
Quoted 12 lines
common/main.c +1
-0@@ -397,6 +397,7 @@ void main_loop (void) ? ? ? debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFI> NED>"); +#if !defined(CONFIG_SPEAR_USBTTY ) ? ? ? if (bootdelay >= 0 && s && !abortboot (bootdelay)) {?# ifdef
CONFIG_AUTOBOOT_KEYED
? ? ? ? ? ? ? int prev =disable_ctrlc(1); ? ?/* dis> able Control C checking */common/main.c +0
-0@@ -413,6 +414,7 @@ void main_loop (void)Quoted 4 lines
? ? ? ? ? ? ?
disable_ctrlc(prev); ? ?/* restore Contr> ol C checking */ ?# endif
? ? ? }
+# endifWhy would this be needed?
Quoted 6 lines
Quoted 4 lines
We also use u-boot as a firmware which runs on the board in a special mode in which the firmware fetches and burns images into NOR/NAND flashes. Under this mode, we would like to always jump to u-boot prompt.
This can be done by plain config settings. No need to chang ethe code.
I didn't get this. I want the uboot behavior as if bootdelay is set to -1. And offcourse without changing bootdelay. I could not get if this can be done by any plain config setting
Please let me know if I am missing something
Quoted 7 lines
Quoted 3 lines
Also, the bootdelay variable should remain unchanged as we save default environment variables as well.
Think of a different way to switch modes, please. I don't accept this change to common code.
Regards
Vipin
PATCH 3/9 nand driver support for SPEAr SoCs
In reply to Vipin KUMARQuoted 2 lines · Vipin KUMAR
Signed-off-by Vipin <[email protected]>
Some of the whitespace is a bit inconsistent, though:
drivers/mtd/nand/spr_nand.c line 110
Quoted 6 lines
drivers/mtd/nand/spr_nand.c new file +6
-0+int spear_nand_init (struct nand_chip *nand) +{ +writel (FSMC_DEVWID_8 |FSMC_DEVTYPE_NAND |FSMC_ENABLE |FSMC_WAITON , + &fsmc_regs_p->genmemctrl_pc); +writel (readl (&fsmc_regs_p->genmemctrl_pc) |FSMC_TCLR_1 |FSMC_TAR_1 , + &fsmc_regs_p->genmemctrl_pc);
Here you continue with two tabs...
drivers/mtd/nand/spr_nand.c line 114
Quoted 4 lines
drivers/mtd/nand/spr_nand.c new file +4
-0+writel (FSMC_THIZ_1 |FSMC_THOLD_4 |FSMC_TWAIT_6 |FSMC_TSET_0 , + &fsmc_regs_p->genmemctrl_comm); +writel (FSMC_THIZ_1 |FSMC_THOLD_4 |FSMC_TWAIT_6 |FSMC_TSET_0 , + &fsmc_regs_p->genmemctrl_attrib);
...and here with one tab plus 7 spaces.
drivers/mtd/nand/spr_nand.c line 118
Quoted 1 line
drivers/mtd/nand/spr_nand.c new file +1
-0+ nand->ecc.layout = &spear_nand_ecclayout;
There's an extra space before '=' here.
-Scott
PATCH 3/9 nand driver support for SPEAr SoCs
Hello Scott,
Quoted 9 lines
Acked-by Scott Wood <[email protected]>Some of the whitespace is a bit inconsistent, though:
drivers/mtd/nand/spr_nand.c
Quoted 3 lines
drivers/mtd/nand/spr_nand.c new file +3
-0+int spear_nand_init (struct nand_chip *nand) +{ + writel(FSMC_DEVWID_8 | FSMC_DEVTYPE_NAND | FSMC_ENABLE |
FSMC_WAITON,
Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ &fsmc_regs_p->genmemctrl_pc); + writel(readl(&fsmc_regs_p->genmemctrl_pc) | FSMC_TCLR_1 |
FSMC_TAR_1,Review
Quoted 1 line
(quoted diff) +1
-0+ &fsmc_regs_p->genmemctrl_pc);Here you continue with two tabs...
Thanks for pointing out. I would correct this in next revision of patch-set
Quoted 11 lines
drivers/mtd/nand/spr_nand.c line 114
Quoted 4 lines
drivers/mtd/nand/spr_nand.c new file +4
-0+writel (FSMC_THIZ_1 |FSMC_THOLD_4 |FSMC_TWAIT_6 |FSMC_TSET_0 , + &fsmc_regs_p->genmemctrl_comm); +writel (FSMC_THIZ_1 |FSMC_THOLD_4 |FSMC_TWAIT_6 |FSMC_TSET_0 , + &fsmc_regs_p->genmemctrl_attrib);...and here with one tab plus 7 spaces.
drivers/mtd/nand/spr_nand.c line 118
Quoted 1 line
drivers/mtd/nand/spr_nand.c new file +1
-0+ nand->ecc.layout = &spear_nand_ecclayout;There's an extra space before '=' here.
Corrected.
Thanks for reviewing
Best Regards
Vipin
PATCH 2/9 smi driver support for SPEAr SoCs
In reply to Vipin KUMARDear Vipin KUMAR,
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>
...
drivers/mtd/spr_smi.c line 92
Quoted 5 lines
drivers/mtd/spr_smi.c new file +5
-0+static ulong flash_get_size (ulong base,int banknum) +{ +flash_info_t *info = &flash_info[banknum]; +unsigned int value =0 ; +unsigned int density =0 ;
remove useless initialization.
Quoted 35 lines
drivers/mtd/spr_smi.c new file +35
-0+int i; + + value =smi_read_id (info, banknum); + density = (value >>16 ) &0xff ; + +switch (density) { +case 0x10 : + info->size =64 *1024 ; + info->sector_count =2 ; +break ; +case 0x11 : + info->size =128 *1024 ; + info->sector_count =4 ; +break ; +case 0x12 : + info->size =256 *1024 ; + info->sector_count =4 ; +break ; +case 0x13 : + info->size =512 *1024 ; + info->sector_count =8 ; +break ; +case 0x14 : + info->size =1 *1024 *1024 ; + info->sector_count =16 ; +break ; +case 0x15 : + info->size =2 *1024 *1024 ; + info->sector_count =32 ; +break ; +case 0x16 : + info->size =4 *1024 *1024 ; + info->sector_count =64 ; +break ; +case 0x17 :
drivers/mtd/spr_smi.c line 137
Quoted 10 lines
drivers/mtd/spr_smi.c new file +10
-0+ info->size =8 *1024 *1024 ; + info->sector_count =128 ; +break ; +case 0x18 : + info->size =16 *1024 *1024 ; + info->sector_count =64 ; +break ; +default : +return 0x0 ; + }
Consider using lookup tables?
drivers/mtd/spr_smi.c line 145
Quoted 3 lines
drivers/mtd/spr_smi.c new file +3
-0+/* Assume that all sectors are unprotected by default */ +for (i =0 ; i <CONFIG_SYS_MAX_FLASH_SECT ; i++) + info->protect[i] =0 ;
Um... is this assumption correct?
drivers/mtd/spr_smi.c line 200
Quoted 13 lines
drivers/mtd/spr_smi.c new file +13
-0+static int smi_wait_till_ready (int bank,int timeout) +{ +int count; +int sr; + +/* One chip guarantees max 5 msec wait here after page writes, +but potentially three seconds (!) after page erase. */ +for (count =0 ; count < timeout; count++) { + sr =smi_read_sr (bank); +if (sr <0 ) +break ; +else if (!(sr &WIP_BIT )) +return 0 ;
Use braces here.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The IQ of the group is the lowest IQ of a member of the group divided by the number of people in the group.
PATCH 2/9 smi driver support for SPEAr SoCs
Dear Wolfgang,
Quoted 9 lines
Quoted 1 line
Signed-off-by Vipin <[email protected]>...
Review
Quoted 5 lines
(quoted diff) +5
-0+static ulong flash_get_size(ulong base, int banknum) +{ + ? ? flash_info_t *info = &flash_info[banknum]; + ? ? unsigned int value = 0; + ? ? unsigned int density = 0;remove useless initialization.
Ok
I will send out a fresh patchset v2 with your review comments incorporated.
Please let me know if it is ok
Quoted 39 lines
Quoted 39 lines
+ ? ? int i;
(quoted diff) +38
-0+ + ? ? value = smi_read_id(info, banknum); + ? ? density = (value >> 16) & 0xff; + + ? ? switch (density) { + ? ? case 0x10: + ? ? ? ? ? ? info->size = 64 * 1024; + ? ? ? ? ? ? info->sector_count = 2; + ? ? ? ? ? ? break; + ? ? case 0x11: + ? ? ? ? ? ? info->size = 128 * 1024; + ? ? ? ? ? ? info->sector_count = 4; + ? ? ? ? ? ? break; + ? ? case 0x12: + ? ? ? ? ? ? info->size = 256 * 1024; + ? ? ? ? ? ? info->sector_count = 4; + ? ? ? ? ? ? break; + ? ? case 0x13: + ? ? ? ? ? ? info->size = 512 * 1024; + ? ? ? ? ? ? info->sector_count = 8; + ? ? ? ? ? ? break; + ? ? case 0x14: + ? ? ? ? ? ? info->size = 1 * 1024 * 1024; + ? ? ? ? ? ? info->sector_count = 16; + ? ? ? ? ? ? break; + ? ? case 0x15: + ? ? ? ? ? ? info->size = 2 * 1024 * 1024; + ? ? ? ? ? ? info->sector_count = 32; + ? ? ? ? ? ? break; + ? ? case 0x16: + ? ? ? ? ? ? info->size = 4 * 1024 * 1024; + ? ? ? ? ? ? info->sector_count = 64; + ? ? ? ? ? ? break; + ? ? case 0x17: + ? ? ? ? ? ? info->size = 8 * 1024 * 1024; + ? ? ? ? ? ? info->sector_count = 128; + ? ? ? ? ? ? break; + ? ? case 0x18:
Quoted 8 lines
Quoted 6 lines
+ ? ? ? ? ? ?
info->size= 16 * 1024 * 1024;
+ ? ? ? ? ? ?info->sector_count= 64;
+ ? ? ? ? ? ? break;
+ ? ? default:
+ ? ? ? ? ? ? return0x0;
+ ? ? }Consider using lookup tables?
Currently supported flashes have consequent values of density. It may have random values supported in future. That's the reason I feel it's better to keep the code this way
Quoted 5 lines
Quoted 3 lines
+ ? ? /* Assume that all sectors are unprotected by default */
+ ? ? for (i = 0; i <CONFIG_SYS_MAX_FLASH_SECT; i++)
+ ? ? ? ? ? ? info->protect[i] = 0;Um... is this assumption correct?
It is intentional
Quoted 16 lines
Quoted 4 lines
(quoted diff) +3
-0+static int smi_wait_till_ready(int bank, int timeout) +{ + ? ? int count;Review
Quoted 10 lines
(quoted diff) +10
-0+ ? ? int sr; + + ? ? /* One chip guarantees max 5 msec wait here after page writes, + ? ? ? ?but potentially three seconds (!) after page erase. */ + ? ? for (count = 0; count < timeout; count++) { + ? ? ? ? ? ? sr = smi_read_sr(bank); + ? ? ? ? ? ? if (sr < 0) + ? ? ? ? ? ? ? ? ? ? break; + ? ? ? ? ? ? else if (!(sr & WIP_BIT)) + ? ? ? ? ? ? ? ? ? ? return 0;Use braces here.
Ok. braces added
Best Regards
Vipin
PATCH 2/9 smi driver support for SPEAr SoCs
Dear Vipin Kumar,
Quoted 42 lines · In message <[email protected]> you…
Quoted 42 lines
Quoted 41 lines
drivers/mtd/spr_smi.c new file +40
-0+switch (density) { +case 0x10 : + info->size =64 *1024 ; + info->sector_count =2 ; +break ; +case 0x11 : + info->size =128 *1024 ; + info->sector_count =4 ; +break ; +case 0x12 : + info->size =256 *1024 ; + info->sector_count =4 ; +break ; +case 0x13 : + info->size =512 *1024 ; + info->sector_count =8 ; +break ; +case 0x14 : + info->size =1 *1024 *1024 ; + info->sector_count =16 ; +break ; +case 0x15 : + info->size =2 *1024 *1024 ; + info->sector_count =32 ; +break ; +case 0x16 : + info->size =4 *1024 *1024 ; + info->sector_count =64 ; +break ; +case 0x17 : + info->size =8 *1024 *1024 ; + info->sector_count =128 ; +break ; +case 0x18 : + info->size =16 *1024 *1024 ; + info->sector_count =64 ; +break ; +default : +return 0x0 ; + }
Quoted 5 lines
Quoted 1 line
Consider using lookup tables?
Currently supported flashes have consequent values of density. It may have random values supported in future. That's the reason I feel it's better to keep the code this way
That's why I did not recommend to calculate this witha simple formula, (which would be trivially possible for "size", but not so for "sector_count"), but using a lookup table - this is independent of the actual values.
Quoted 7 lines
Quoted 5 lines
drivers/mtd/spr_smi.c line 145
Quoted 3 lines
drivers/mtd/spr_smi.c new file +3
-0+/* Assume that all sectors are unprotected by default */ +for (i =0 ; i <CONFIG_SYS_MAX_FLASH_SECT ; i++) + info->protect[i] =0 ;Um... is this assumption correct?
It is intentional
Why don;t you protect sectors where the U-Bootimage and environment are stored?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If you fail to plan, plan to fail.
PATCH 2/9 smi driver support for SPEAr SoCs
Dear Wolfgang,
Quoted 45 lines
Quoted 44 lines · In message <[email protected]> you…
Quoted 43 lines
Quoted 33 lines
+ ? ? switch (density) {
+ ? ? case0x10:
+ ? ? ? ? ? ?info->size= 64 * 1024;
+ ? ? ? ? ? ?info->sector_count= 2;
+ ? ? ? ? ? ? break;
+ ? ? case0x11:
+ ? ? ? ? ? ?info->size= 128 * 1024;
+ ? ? ? ? ? ?info->sector_count= 4;
+ ? ? ? ? ? ? break;
+ ? ? case0x12:
+ ? ? ? ? ? ?info->size= 256 * 1024;
+ ? ? ? ? ? ?info->sector_count= 4;
+ ? ? ? ? ? ? break;
+ ? ? case0x13:
+ ? ? ? ? ? ?info->size= 512 * 1024;
+ ? ? ? ? ? ?info->sector_count= 8;
+ ? ? ? ? ? ? break;
+ ? ? case0x14:
+ ? ? ? ? ? ?info->size= 1 * 1024 * 1024;
+ ? ? ? ? ? ?info->sector_count= 16;
+ ? ? ? ? ? ? break;
+ ? ? case0x15:
+ ? ? ? ? ? ?info->size= 2 * 1024 * 1024;
+ ? ? ? ? ? ?info->sector_count= 32;
+ ? ? ? ? ? ? break;
+ ? ? case0x16:
+ ? ? ? ? ? ?info->size= 4 * 1024 * 1024;
+ ? ? ? ? ? ?info->sector_count= 64;
+ ? ? ? ? ? ? break;
+ ? ? case0x17:
+ ? ? ? ? ? ?info->size= 8 * 1024 * 1024;
+ ? ? ? ? ? ?info->sector_count= 128;Quoted 8 lines
+ ? ? ? ? ? ? break;
+ ? ? case0x18:
+ ? ? ? ? ? ?info->size= 16 * 1024 * 1024;
+ ? ? ? ? ? ?info->sector_count= 64;
+ ? ? ? ? ? ? break;
+ ? ? default:
+ ? ? ? ? ? ? return0x0;
+ ? ? }Consider using lookup tables?
Quoted 8 lines
Quoted 3 lines
Currently supported flashes have consequent values of density. It may have random values supported in future. That's the reason I feel it's better to keep the code this way
That's why I did not recommend to calculate this witha simple formula, (which would be trivially possible for "size", but not so for "
sector_count"), but using a lookup table - this is independent of the actual values.
Ok. I would implement the code using lookup tables
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
+ ? ? /* Assume that all sectors are unprotected by default */
+ ? ? for (i = 0; i <CONFIG_SYS_MAX_FLASH_SECT; i++)
+ ? ? ? ? ? ? info->protect[i] = 0;Um... is this assumption correct?
It is intentional
Why don;t you protect sectors where the U-Bootimage and environment are stored?
Since the code is being developed for a development board, erasing and flashing the uboot is frequent. This is done only to save unprotect every time before erasing/flashing uboot
Best Regards
Vipin
PATCH 2/9 smi driver support for SPEAr SoCs
Vipin Kumar a ?crit :
Quoted 6 lines
Quoted 2 lines
Why don;t you protect sectors where the U-Bootimage and environment are stored?
Since the code is being developed for a development board, erasing and flashing the uboot is frequent. This is done only to save unprotect every time before erasing/flashing uboot
You could protect the sectors and then have a script in the default environment that automates unprotecting as well as erasing, loading new u-boot and flashing. This way you get the best of both worlds, protection against accidental erasures and simplicity of reflashing.
Amicalement,
Signature · 1 line
Albert.
PATCH 2/9 smi driver support for SPEAr SoCs
Hi Albert,
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Why don;t you protect sectors where the U-Bootimage and environment are stored?
Quoted 9 lines
Quoted 3 lines
Since the code is being developed for a development board, erasing and flashing the uboot is frequent. This is done only to save unprotect every time before erasing/flashing uboot
You could protect the sectors and then have a script in the default environment that automates unprotecting as well as erasing, loading new u-boot and flashing. This way you get the best of both worlds, protection against accidental erasures and simplicity of reflashing.
Yes, I also tend to think this way is better. Thanks
Regards
Vipin
PATCH 2/9 smi driver support for SPEAr SoCs
In reply to Vipin KumarDear Vipin Kumar,
Quoted 7 lines · In message <[email protected]> you…
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/mtd/spr_smi.c line 145
Quoted 4 lines
drivers/mtd/spr_smi.c new file +3
-0+/* Assume that all sectors are unprotected by default */ +for (i =0 ; i <CONFIG_SYS_MAX_FLASH_SECT ; i++) + info->protect[i] =0 ;Um... is this assumption correct?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It is intentional
Why don;t you protect sectors where the U-Bootimage and environment are stored?
Since the code is being developed for a development board, erasing and flashing the uboot is frequent. This is done only to save unprotect every time before erasing/flashing uboot
That's what I expected. Please do add proper protection, so that everybody who copies the code for a real production board has a sane implementation.
If you are worried about having to type too many commands for update, please consider pre-defining useful macros like we do in so many other boards; for example:
"include/configs/aria.h":
"u-boot=aria/u-boot.bin\0"
...
"load=tftp ${u-boot_addr_r} ${u-boot}\0"
...
"update=protect off ${u-boot_addr} +${filesize};" \
"era ${u-boot_addr} +${filesize};" \
"cp.b ${u-boot_addr_r} ${u-boot_addr} ${filesize}\0"so you only have to type "run load update".
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Unix is simple, but it takes a genius to understand the simplicity." - Dennis Ritchie
PATCH 1/9 i2c driver support for SPEAr SoCs
In reply to Vipin KUMARDear Vipin KUMAR,
Quoted 10 lines · In message <[email protected]> you wrote:
Signed-off-by Vipin <[email protected]>--- drivers/i2c/Makefile | 1 + drivers/i2c/spr_i2c.c | 321 ++++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_i2c.h | 143 +++++++++++++++ 3 files changed, 465 insertions(+), 0 deletions(-) mode change 100644 => 100755 drivers/i2c/Makefile create mode 100755 drivers/i2c/spr_i2c.c create mode 100755 include/asm-arm/arch-spear/spr_i2c.h
Your patch order is, um, sub-optimal.
You start adding an I2C driver for a non-existing CPU here.
This makes no sense, please reorder.
drivers/i2c/Makefile COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o · line 41
Quoted 7 lines
drivers/i2c/Makefile +1
-0@@ -38,6 +38,7 @@ COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o COBJS-$(CONFIG_S3C44B0_I2C) += s3c44b0_i2c.o COBJS-$(CONFIG_SOFT_I2C) += soft_i2c.o COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o +COBJS-$(CONFIG_SPEARI2C) += spr_i2c.o
Please keep lists sorted (fix globally).
drivers/i2c/Makefile COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o
Quoted 5 lines
drivers/i2c/Makefile +5
-0+/** + * i2c_setfreq - Set i2c working mode frequency + * + * Set i2c working mode frequency + */
Incorrect multiline comment style. Please fix globally.
Quoted 12 lines
drivers/i2c/Makefile +12
-0+static void set_speed(int i2c_spd) +{ + unsigned int cntl; + + if (i2c_spd == IC_SPEED_MODE_MAX) { + cntl = readl(&i2c_regs_p->ic_con); + cntl |= IC_CON_SPH | IC_CON_SPL; + writel(cntl, &i2c_regs_p->ic_con); + i2c_setfreq(MIN_HS_SCL_HIGHTIME, MIN_HS_SCL_LOWTIME); + } else if (i2c_spd == IC_SPEED_MODE_FAST) { + cntl = readl(&i2c_regs_p->ic_con); + cntl |= IC_CON_SPH;
drivers/i2c/Makefile
Quoted 10 lines
drivers/i2c/Makefile +10
-0+ cntl &= ~IC_CON_SPL; + writel(cntl, &i2c_regs_p->ic_con); + i2c_setfreq(MIN_FS_SCL_HIGHTIME, MIN_FS_SCL_LOWTIME); + } else if (i2c_spd == IC_SPEED_MODE_STANDARD) { + cntl = readl(&i2c_regs_p->ic_con); + cntl |= IC_CON_SPF; + cntl &= ~IC_CON_SPL; + writel(cntl, &i2c_regs_p->ic_con); + i2c_setfreq(MIN_SS_SCL_HIGHTIME, MIN_SS_SCL_LOWTIME); + }
It seems you can move the lines
writel(cntl, &i2c_regs_p->ic_con); i2c_setfreq(MIN_FS_SCL_HIGHTIME, MIN_FS_SCL_LOWTIME);
out of the if/else blocks and make them common code.
drivers/i2c/Makefile
Quoted 6 lines
drivers/i2c/Makefile +6
-0+void i2c_set_bus_speed(int speed) +{ + if (speed >= I2C_MAX_SPEED) + set_speed(IC_SPEED_MODE_MAX); + else + if (speed >= I2C_FAST_SPEED)
Missing braces (mandatory for multiline statements).
Quoted 14 lines
drivers/i2c/Makefile +13
-0+ set_speed(IC_SPEED_MODE_FAST); + else + set_speed(IC_SPEED_MODE_STANDARD); +} +/** + * i2c_get_bus_speed - Gets the i2c speed + * + * Gets the i2c speed. + */ +int i2c_get_bus_speed(void) +{ + if (((readl(&i2c_regs_p->ic_con) & IC_CON_SPH) == IC_CON_SPH) && + ((readl(&i2c_regs_p->ic_con) & IC_CON_SPL) == IC_CON_SPL)) {
drivers/i2c/Makefile
Quoted 10 lines
drivers/i2c/Makefile +10
-0+ return I2C_MAX_SPEED; + + } else if (((readl(&i2c_regs_p->ic_con) & IC_CON_SPH) == IC_CON_SPH) && + ((readl(&i2c_regs_p->ic_con) & IC_CON_SPL) == 0)) { + return I2C_FAST_SPEED; + + } else if (((readl(&i2c_regs_p->ic_con) & IC_CON_SPF) == IC_CON_SPF) && + ((readl(&i2c_regs_p->ic_con) & IC_CON_SPL) == 0)) { + return I2C_STANDARD_SPEED; + }
It makes no sense to run "readl(&i2c_regs_p->ic_con)" six times - run it once and latch the value.
Also I tend to think the logic can be written clearer.
drivers/i2c/Makefile
Quoted 12 lines
drivers/i2c/Makefile +12
-0+void i2c_init(int speed, int slaveadd) +{ + unsigned int enbl; + + /* Disable i2c */ + enbl = readl(&i2c_regs_p->ic_enable); + enbl &= ~IC_ENABLE_0B; + writel(enbl, &i2c_regs_p->ic_enable); + + writel((IC_CON_SD | IC_CON_SPF | IC_CON_MM), &i2c_regs_p->ic_con); + writel(IC_TL0, &i2c_regs_p->ic_rx_tl); + writel(IC_TL0, &i2c_regs_p->ic_tx_tl);
Is this duplication intentional? If so, a comment is needed to explain why.
drivers/i2c/Makefile
Quoted 9 lines
drivers/i2c/Makefile +9
-0+/** + * i2c_probe - Probe the i2c chip + * + * TBD + */ +int i2c_probe(uchar chip) +{ + return 0; +}
Please do not add dead code.
Quoted 11 lines
drivers/i2c/Makefile +11
-0+int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) +{ + unsigned long start_time_rx; + + if (buffer == NULL) { + printf("I2C read: buffer is invalid\n"); + return 1; + } + + if (alen > 1) { + printf("I2C read: addr len %d not supported\n", alen);
drivers/i2c/Makefile
Quoted 10 lines
drivers/i2c/Makefile +10
-0+ return 1; + } + + if (addr + len > 256) { + printf("I2C read: address out of range\n"); + return 1; + } + + if (i2c_wait_for_bb()) + return 1;
Why no error message here?
Quoted 4 lines
drivers/i2c/Makefile +4
-0+ i2c_setaddress(chip); + writel(addr, &i2c_regs_p->ic_cmd_data); + + start_time_rx = get_timer_masked();
drivers/i2c/Makefile
Quoted 10 lines
drivers/i2c/Makefile +10
-0+ while (len) { + writel(IC_CMD, &i2c_regs_p->ic_cmd_data); + if ((readl(&i2c_regs_p->ic_status) & IC_STATUS_RFNE) == + IC_STATUS_RFNE) { + *buffer++ = (uchar)readl(&i2c_regs_p->ic_cmd_data); + len--; + start_time_rx = get_timer_masked(); + } else { + if (get_timer(start_time_rx) > I2C_BYTE_TO) + return 1;
Why no error message here?
drivers/i2c/Makefile
Quoted 1 line
drivers/i2c/Makefile +1
-0+ udelay(4000);
Why is this needed?
drivers/i2c/Makefile
Quoted 5 lines
drivers/i2c/Makefile +5
-0+ if ((readl(&i2c_regs_p->ic_raw_intr_stat) & IC_STOP_DET)) + readl(&i2c_regs_p->ic_clr_stop_det); + + if (i2c_wait_for_bb()) + return 1;
Why no error message here?
Quoted 57 lines
drivers/i2c/Makefile +57
-0+ i2c_flush_rxfifo(); + + return 0; +} + +/** + * i2c_write - Write to i2c memory + * @chip: target i2c address + * @addr: address to read from + * @alen: + * @buffer: buffer for read data + * @len: no of bytes to be read + * + * Write to i2c memory. + */ +int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) +{ + int nb = len; + unsigned long start_time_tx; + + if (buffer == NULL) { + printf("I2C write: buffer is invalid\n"); + return 1; + } + + if (alen > 1) { + printf("I2C write: addr len %d not supported\n", alen); + return 1; + } + + if (addr + len > 256) { + printf("I2C write: address out of range\n"); + return 1; + } + + if (i2c_wait_for_bb()) + return 1; + + i2c_setaddress(chip); + + writel(addr, &i2c_regs_p->ic_cmd_data); + + start_time_tx = get_timer_masked(); + while (len) { + if ((readl(&i2c_regs_p->ic_status) & IC_STATUS_TFNF) + == IC_STATUS_TFNF) { + writel(*buffer, &i2c_regs_p->ic_cmd_data); + buffer++; + len--; + start_time_tx = get_timer_masked(); + } else { + if (get_timer(start_time_tx) > (nb * I2C_BYTE_TO)) + return 1; + } + } + + udelay(4000);
drivers/i2c/Makefile
Quoted 10 lines
drivers/i2c/Makefile +10
-0+ if ((readl(&i2c_regs_p->ic_raw_intr_stat) & IC_STOP_DET)) + readl(&i2c_regs_p->ic_clr_stop_det); + + if (i2c_wait_for_bb()) + return 1; + + i2c_flush_rxfifo(); + + return 0; +}
This shares a _lot_ of common code with i2c_read() - factor out?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I have a theory that it's impossible to prove anything, but I can't prove it.
cover Support for SPEAr SoCs
In reply to Vipin KUMARAll,
Just fyi SPEAr is an ARM based family of SoC designed by us here in STMicro. THx for your help in reviewing.
Regards,
Arm
Quoted 109 lines · Vipin KUMAR
This patchset contains the support for 4 SoCs from SPEAr family SPEAr300
SPEAr310
SPEAr320
SPEAr600It also contains the drivers needed for spear devices
Regards
Vipin KumarVipin (9):
i2c driver support for SPEAr SoCs
smi driver support for SPEAr SoCs
nand driver support for SPEAr SoCs
usbd driver and usb boot firmware support for SPEAr SoCs SPEAr600 SoC support added
SPEAr300 SoC support added
SPEAr310 SoC support added
SPEAr320 SoC support added
SPEAr600 build support addedMAKEALL | 4 + Makefile | 12 + board/spear/common/spr_lowlevel_init.S | 202 +++++ board/spear/common/spr_misc.c | 270 +++++++ board/spear/spear300/Makefile | 52 ++ board/spear/spear300/config.mk | 39 + board/spear/spear300/spr300_board.c | 57 ++ board/spear/spear310/Makefile | 52 ++ board/spear/spear310/config.mk | 42 + board/spear/spear310/spr310_board.c | 58 ++ board/spear/spear320/Makefile | 52 ++ board/spear/spear320/config.mk | 42 + board/spear/spear320/spr320_board.c | 58 ++ board/spear/spear600/Makefile | 52 ++ board/spear/spear600/config.mk | 39 + board/spear/spear600/spr600_board.c | 53 ++ common/cmd_bdinfo.c | 20 + common/main.c | 2 + cpu/arm926ejs/spear/Makefile | 52 ++ cpu/arm926ejs/spear/reset.c | 49 ++ cpu/arm926ejs/spear/timer.c | 148 ++++ drivers/i2c/Makefile | 1 + drivers/i2c/spr_i2c.c | 321 ++++++++ drivers/mtd/Makefile | 1 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/spr_nand.c | 126 +++ drivers/mtd/spr_smi.c | 548 +++++++++++++ drivers/serial/usbtty.h | 2 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/spr_udc.c | 996 ++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_defs.h | 31 + include/asm-arm/arch-spear/spr_emi.h | 55 ++ include/asm-arm/arch-spear/spr_gpt.h | 83 ++ include/asm-arm/arch-spear/spr_i2c.h | 143 ++++ include/asm-arm/arch-spear/spr_misc.h | 126 +++ include/asm-arm/arch-spear/spr_nand.h | 58 ++ include/asm-arm/arch-spear/spr_smi.h | 112 +++ include/asm-arm/arch-spear/spr_syscntl.h | 38 + include/asm-arm/arch-spear/spr_xloader_table.h | 67 ++ include/asm-arm/u-boot.h | 5 + include/configs/spear300.h | 260 ++++++ include/configs/spear310.h | 353 +++++++++ include/configs/spear320.h | 336 ++++++++ include/configs/spear600.h | 260 ++++++ include/usb/spr_udc.h | 227 ++++++ 45 files changed, 5506 insertions(+), 0 deletions(-) create mode 100755 board/spear/common/spr_lowlevel_init.S create mode 100755 board/spear/common/spr_misc.c create mode 100755 board/spear/spear300/Makefile create mode 100755 board/spear/spear300/config.mk create mode 100755 board/spear/spear300/spr300_board.c create mode 100755 board/spear/spear310/Makefile create mode 100755 board/spear/spear310/config.mk create mode 100755 board/spear/spear310/spr310_board.c create mode 100755 board/spear/spear320/Makefile create mode 100755 board/spear/spear320/config.mk create mode 100755 board/spear/spear320/spr320_board.c create mode 100755 board/spear/spear600/Makefile create mode 100755 board/spear/spear600/config.mk create mode 100755 board/spear/spear600/spr600_board.c create mode 100755 cpu/arm926ejs/spear/Makefile create mode 100755 cpu/arm926ejs/spear/reset.c create mode 100755 cpu/arm926ejs/spear/timer.c mode change 100644 => 100755 drivers/i2c/Makefile create mode 100755 drivers/i2c/spr_i2c.c mode change 100644 => 100755 drivers/mtd/Makefile create mode 100755 drivers/mtd/nand/spr_nand.c create mode 100755 drivers/mtd/spr_smi.c mode change 100644 => 100755 drivers/serial/usbtty.h mode change 100644 => 100755 drivers/usb/gadget/Makefile create mode 100755 drivers/usb/gadget/spr_udc.c create mode 100644 include/asm-arm/arch-spear/spr_defs.h create mode 100755 include/asm-arm/arch-spear/spr_emi.h create mode 100755 include/asm-arm/arch-spear/spr_gpt.h create mode 100755 include/asm-arm/arch-spear/spr_i2c.h create mode 100644 include/asm-arm/arch-spear/spr_misc.h create mode 100644 include/asm-arm/arch-spear/spr_nand.h create mode 100755 include/asm-arm/arch-spear/spr_smi.h create mode 100644 include/asm-arm/arch-spear/spr_syscntl.h create mode 100755 include/asm-arm/arch-spear/spr_xloader_table.h create mode 100755 include/configs/spear300.h create mode 100755 include/configs/spear310.h create mode 100755 include/configs/spear320.h create mode 100755 include/configs/spear600.h create mode 100755 include/usb/spr_udc.h