Support for SPEAr SoCs
Subsystems (6)
v5 cover Support for SPEAr SoCs
Hello Tom,
Please consider the patchset version5 for mainline inclusion
This patchset contains the version5 for SPEAr SoCs support Modifications
1. include/configs contins spear3xx.h for SPEAR300, SPEAR310 and SPEAr320 variants
2. include/configs contins spear6xx.h for SPEAR600 and any variants in future
3. Added include/asm-arm/arch-spear/hardware.h for platform specific defines eg. base addresses of devices
4. review feedbacks on v4 patchset applied
Thanks and Regards
Vipin
Vipin (12):
SPEAr : Adding README.spear in doc
SPEAr : Adding basic SPEAr architecture support. SPEAr : i2c driver support added for SPEAr SoCs SPEAr : smi driver support for SPEAr SoCs
SPEAr : nand driver support for SPEAr SoCs
SPEAr : usbd driver support for SPEAr SoCs
SPEAr : Support added for SPEAr600 board
SPEAr : Support for HW mac id read/write from i2c mem SPEAr : Support added for SPEAr300 board
SPEAr : emi controller initialization for CFI driver support SPEAr : Support added for SPEAr310 board
SPEAr : Support added for SPEAr320 board
MAKEALL | 4 + Makefile | 8 + board/spear/common/Makefile | 54 ++ board/spear/common/spr_lowlevel_init.S | 195 +++++ board/spear/common/spr_misc.c | 296 +++++++ board/spear/spear300/Makefile | 51 ++ board/spear/spear300/config.mk | 39 + board/spear/spear300/spear300.c | 58 ++ board/spear/spear310/Makefile | 51 ++ board/spear/spear310/config.mk | 44 + board/spear/spear310/spear310.c | 59 ++ board/spear/spear320/Makefile | 51 ++ board/spear/spear320/config.mk | 44 + board/spear/spear320/spear320.c | 59 ++ board/spear/spear600/Makefile | 51 ++ board/spear/spear600/config.mk | 39 + board/spear/spear600/spear600.c | 53 ++ cpu/arm926ejs/spear/Makefile | 52 ++ cpu/arm926ejs/spear/reset.c | 54 ++ cpu/arm926ejs/spear/timer.c | 153 ++++ doc/README.spear | 48 ++ drivers/i2c/Makefile | 1 + drivers/i2c/spr_i2c.c | 331 ++++++++ drivers/mtd/Makefile | 1 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/spr_nand.c | 124 +++ drivers/mtd/spr_smi.c | 523 +++++++++++++ drivers/serial/usbtty.h | 2 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/spr_udc.c | 998 ++++++++++++++++++++++++ include/asm-arm/arch-spear/hardware.h | 66 ++ include/asm-arm/arch-spear/spr_defs.h | 46 ++ include/asm-arm/arch-spear/spr_emi.h | 54 ++ include/asm-arm/arch-spear/spr_gpt.h | 85 ++ include/asm-arm/arch-spear/spr_i2c.h | 146 ++++ include/asm-arm/arch-spear/spr_misc.h | 130 +++ include/asm-arm/arch-spear/spr_nand.h | 57 ++ include/asm-arm/arch-spear/spr_smi.h | 115 +++ include/asm-arm/arch-spear/spr_syscntl.h | 38 + include/asm-arm/arch-spear/spr_xloader_table.h | 67 ++ include/configs/spear-common.h | 213 +++++ include/configs/spear3xx.h | 131 +++ include/configs/spear6xx.h | 43 + include/usb/spr_udc.h | 230 ++++++ 44 files changed, 4866 insertions(+), 0 deletions(-) create mode 100644 board/spear/common/Makefile 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/spear300.c create mode 100755 board/spear/spear310/Makefile create mode 100755 board/spear/spear310/config.mk create mode 100755 board/spear/spear310/spear310.c create mode 100755 board/spear/spear320/Makefile create mode 100755 board/spear/spear320/config.mk create mode 100755 board/spear/spear320/spear320.c create mode 100755 board/spear/spear600/Makefile create mode 100755 board/spear/spear600/config.mk create mode 100755 board/spear/spear600/spear600.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 doc/README.spear 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/hardware.h create mode 100644 include/asm-arm/arch-spear/spr_defs.h create mode 100644 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 100644 include/configs/spear-common.h create mode 100755 include/configs/spear3xx.h create mode 100755 include/configs/spear6xx.h create mode 100755 include/usb/spr_udc.h
PATCH v5 1/12 SPEAr : Adding README.spear in doc
README.spear contains information about SPEAr architecture and build options etc
--- doc/README.spear | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) create mode 100644 doc/README.spear
doc/README.spear new file +48 -0
@@ -0,0 +1,48 @@ + +SPEAr (Structured Processor Enhanced Architecture). + +SPEAr600 is also known as SPEArPlus and SPEAr300 is also known as SPEArBasic + +The SPEAr SoC family embeds a customizable logic that can 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. + +All 4 SoCs share common peripherals. + +1. ARM926ejs core based (sp600 has two 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 .. + +Everything is supported in Linux. +u-boot is not currently supporting all peripeharls (just a few as listed below). +1. USB Device +2. NAND controller (FSMC) +3. Serial Memory Interface +4. EMI (Parallel NOR interface) +4. I2C +5. UART + +Build options + make spear600_config + make spear300_config + make spear310_config + make spear320_config + +Further options + make ENV=NAND (supported by all 4 SoCs) + - This option generates a uboot image that saves environment inn NAND + + make CONSOLE=USB (supported by all 4 SoCs) + - This option generates a uboot image for using usbdevice as a tty i/f + + make FLASH=PNOR (supported by SPEAr310 and SPEAr320) + - This option generates a uboot image that supports emi controller for + CFI compliant parallel NOR flash
Signature · 1 line
1.6.0.2
PATCH v5 2/12 SPEAr : Adding basic SPEAr architecture support.
SPEAr Architecture support added. It contains the support for following SPEAr blocks
- Timer
- System controller
- Misc registers
--- cpu/arm926ejs/spear/Makefile | 52 ++++++++++ cpu/arm926ejs/spear/reset.c | 54 +++++++++++ cpu/arm926ejs/spear/timer.c | 153 ++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/hardware.h | 66 +++++++++++++ include/asm-arm/arch-spear/spr_gpt.h | 85 +++++++++++++++++ include/asm-arm/arch-spear/spr_misc.h | 130 +++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_syscntl.h | 38 ++++++++ 7 files changed, 578 insertions(+), 0 deletions(-) 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/hardware.h create mode 100755 include/asm-arm/arch-spear/spr_gpt.h create mode 100644 include/asm-arm/arch-spear/spr_misc.h create mode 100644 include/asm-arm/arch-spear/spr_syscntl.h
cpu/arm926ejs/spear/Makefile new file +52 -0
@@ -0,0 +1,52 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).a + +COBJS := reset.o \ + timer.o +SOBJS := + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) $(SOBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
cpu/arm926ejs/spear/reset.c new file +54 -0
54 lines not on this page · raw message
cpu/arm926ejs/spear/timer.c new file +153 -0
153 lines not on this page · raw message
include/asm-arm/arch-spear/hardware.h new file +66 -0
66 lines not on this page · raw message
include/asm-arm/arch-spear/spr_gpt.h new file +85 -0
85 lines not on this page · raw message
include/asm-arm/arch-spear/spr_misc.h new file +130 -0
130 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, [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 +*/ + +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; +};
Signature · 1 line
1.6.0.2
PATCH v5 3/12 SPEAr : i2c driver support added for SPEAr SoCs
SPEAr SoCs contain a synopsys i2c controller.
This patch adds the driver for this IP.
--- drivers/i2c/Makefile | 1 + drivers/i2c/spr_i2c.c | 331 ++++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_i2c.h | 146 +++++++++++++++ 3 files changed, 478 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
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o COBJS-$(CONFIG_S3C44B0_I2C) += s3c44b0_i2c.o COBJS-$(CONFIG_SOFT_I2C) += soft_i2c.o +COBJS-$(CONFIG_SPEAR_I2C) += spr_i2c.o COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o COBJS := $(COBJS-y)
drivers/i2c/spr_i2c.c new file +331 -0
331 lines not on this page · raw message
include/asm-arm/arch-spear/spr_i2c.h new file +146 -0
146 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 4/12 SPEAr : smi driver support for SPEAr SoCs
SPEAr SoCs contain a serial memory interface controller. This controller is used to interface with spi based memories. This patch adds the driver for this IP.
--- drivers/mtd/Makefile | 1 + drivers/mtd/spr_smi.c | 523 ++++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_smi.h | 115 ++++++++ 3 files changed, 639 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 +523 -0
523 lines not on this page · raw message
include/asm-arm/arch-spear/spr_smi.h new file +115 -0
115 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 5/12 SPEAr : nand driver support for SPEAr SoCs
SPEAr SoCs contain an FSMC controller which can be used to interface with a range of memories eg. NAND, SRAM, NOR.
Currently, this driver supports interfacing FSMC with NAND memories
--- drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/spr_nand.c | 124 +++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_nand.h | 57 +++++++++++++++ 3 files changed, 182 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 +124 -0
124 lines not on this page · raw message
include/asm-arm/arch-spear/spr_nand.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 6/12 SPEAr : usbd driver support for SPEAr SoCs
SPEAr SoCs contain a synopsys usb device controller. USB Device IP can work in 2 modes
- DMA mode
- Slave mode
The driver adds support only for slave mode operation of usb device IP. This driver is used along with standard USBTTY driver to obtain a tty interface over USB on the host
--- drivers/serial/usbtty.h | 2 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/spr_udc.c | 998 ++++++++++++++++++++++++++++++++++++++++++ include/usb/spr_udc.h | 230 ++++++++++ 4 files changed, 1231 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 100755 include/usb/spr_udc.h
drivers/serial/usbtty.h +2 -0
@@ -33,6 +33,8 @@#include <usb/musb_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 +998 -0
998 lines not on this page · raw message
include/usb/spr_udc.h new file +230 -0
230 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 7/12 SPEAr : Support added for SPEAr600 board
SPEAr600 SoC support contains basic spear600 support along with the usage of following drivers
- serial driver(UART)
- i2c driver
- smi driver
- nand driver(FSMC)
- usbd driver
--- MAKEALL | 1 + Makefile | 3 + board/spear/common/Makefile | 54 ++++++ board/spear/common/spr_lowlevel_init.S | 195 ++++++++++++++++++++++ board/spear/common/spr_misc.c | 171 +++++++++++++++++++ board/spear/spear600/Makefile | 51 ++++++ board/spear/spear600/config.mk | 39 +++++ board/spear/spear600/spear600.c | 53 ++++++ include/asm-arm/arch-spear/spr_defs.h | 38 +++++ include/asm-arm/arch-spear/spr_xloader_table.h | 67 ++++++++ include/configs/spear-common.h | 213 ++++++++++++++++++++++++ include/configs/spear6xx.h | 43 +++++ 12 files changed, 928 insertions(+), 0 deletions(-) create mode 100644 board/spear/common/Makefile 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/spear600.c create mode 100644 include/asm-arm/arch-spear/spr_defs.h create mode 100755 include/asm-arm/arch-spear/spr_xloader_table.h create mode 100644 include/configs/spear-common.h create mode 100755 include/configs/spear6xx.h
MAKEALL +1 -0
@@ -574,6 +574,7 @@ LIST_ARM9=" \ sheevaplug \ smdk2400 \ smdk2410 \ + spear600 \ trab \ VCMA9 \ versatile \
Makefile +3 -0
@@ -3028,6 +3028,9 @@ smdk2400_config : unconfig smdk2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0 +spear600_config : unconfig + @$(MKCONFIG) -n $@ -t $(@:_config=) spear6xx arm arm926ejs $(@:_config=) spear spear + SX1_stdout_serial_config \ SX1_config: unconfig @mkdir -p $(obj)include
board/spear/common/Makefile new file +54 -0
54 lines not on this page · raw message
board/spear/common/spr_lowlevel_init.S new file +195 -0
195 lines not on this page · raw message
board/spear/common/spr_misc.c new file +171 -0
171 lines not on this page · raw message
board/spear/spear600/Makefile new file +51 -0
51 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 += -DCONFIG_ENV_IS_IN_NAND +else +PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH +endif + +ifeq ($(CONSOLE),USB) +PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY +endif
board/spear/spear600/spear600.c new file +53 -0
53 lines not on this page · raw message
include/asm-arm/arch-spear/spr_defs.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* (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; + +struct chip_data { +int cpufreq; +int dramfreq; +int dramtype; +uchar version[32 ]; +}; + +#endif
include/asm-arm/arch-spear/spr_xloader_table.h new file +67 -0
67 lines not on this page · raw message
include/configs/spear-common.h new file +213 -0
213 lines not on this page · raw message
include/configs/spear6xx.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
This patch adds the support to read and write mac id from i2c memory.
For reading:
if (env contains ethaddr)
pick env ethaddr
else
pick ethaddr from i2c memory
For writing:
chip_config ethaddr XX:XX:XX:XX:XX:XX writes the mac id in i2c memory
--- board/spear/common/spr_misc.c | 68 ++++++++++++++++++++++++++++++++- include/asm-arm/arch-spear/spr_defs.h | 8 ++++ 2 files changed, 75 insertions(+), 1 deletions(-)
board/spear/common/spr_misc.c +67 -1
@@ -67,6 +67,12 @@ int dram_init(void)int misc_init_r (void ) { +#if defined(CONFIG_CMD_NET ) +uchar mac_id[6 ]; + +if (!eth_getenv_enetaddr ("ethaddr" , mac_id) && !i2c_read_mac (mac_id)) +eth_setenv_enetaddr ("ethaddr" , mac_id); +#endif setenv ("verify" ,"n" );#if defined(CONFIG_SPEAR_USBTTY )
@@ -101,12 +107,54 @@ int spear_board_init(ulong mach_type)return 0 ; } +static int i2c_read_mac (uchar *buffer) +{ +u8 buf[2 ]; + +i2c_read (CONFIG_I2C_CHIPADDRESS ,MAGIC_OFF ,1 , buf,MAGIC_LEN ); + +/* Check if mac in i2c memory is valid */ +if ((buf[0 ] ==MAGIC_BYTE0 ) && (buf[1 ] ==MAGIC_BYTE1 )) { +/* Valid mac address is saved in i2c eeprom */ +i2c_read (CONFIG_I2C_CHIPADDRESS ,MAC_OFF ,1 , buffer,MAC_LEN ); +return 0 ; + } + +return -1 ; +} + +static int write_mac (uchar *mac) +{ +u8 buf[2 ]; + + buf[0 ] = (u8 )MAGIC_BYTE0 ; + buf[1 ] = (u8 )MAGIC_BYTE1 ; +i2c_write (CONFIG_I2C_CHIPADDRESS ,MAGIC_OFF ,1 , buf,MAGIC_LEN ); + + buf[0 ] = (u8 )~MAGIC_BYTE0 ; + buf[1 ] = (u8 )~MAGIC_BYTE1 ; + +i2c_read (CONFIG_I2C_CHIPADDRESS ,MAGIC_OFF ,1 , buf,MAGIC_LEN ); + +/* check if valid MAC address is saved in I2C EEPROM or not? */ +if ((buf[0 ] ==MAGIC_BYTE0 ) && (buf[1 ] ==MAGIC_BYTE1 )) { +i2c_write (CONFIG_I2C_CHIPADDRESS ,MAC_OFF ,1 , mac,MAC_LEN ); +puts ("I2C EEPROM written with mac address \n" ); +return 0 ; + } + +puts ("I2C EEPROM writing failed \n" ); +return -1 ; +} +int do_chip_config (cmd_tbl_t *cmdtp,int flag,int argc,char *argv[]) {void (*sram_setfreq) (unsigned int ,unsigned int );struct chip_data *chip = &chip_data;unsigned char mac[6 ]; -unsigned int frequency; +unsigned int reg, frequency; +char *s, *e; +char i2c_mac[20 ];if ((argc >3 ) || (argc <2 )) {cmd_usage (cmdtp);
@@ -137,6 +185,17 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) }return 0 ; + }else if (!strcmp (argv[1 ],"ethaddr" )) { + + s = argv[2 ]; +for (reg =0 ; reg <6 ; ++reg) { + mac[reg] = s ?simple_strtoul (s, &e,16 ) :0 ; +if (s) + s = (*e) ? e +1 : e; + } +write_mac (mac); + +return 0 ; }else if (!strcmp (argv[1 ],"print" )) {if (chip->cpufreq ==-1 )
@@ -156,6 +215,13 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])else printf ("DDR Type = Not Known\n" ); +if (!i2c_read_mac (mac)) { +sprintf (i2c_mac,"%pM" , mac); +printf ("Ethaddr (from i2c mem) = %s\n" , i2c_mac); + }else { +printf ("Ethaddr (from i2c mem) = Not set\n" ); + } +printf ("Xloader Rev = %s\n" , chip->version);return 0 ;
include/asm-arm/arch-spear/spr_defs.h +8 -0
@@ -35,4 +35,12 @@ struct chip_data { uchar version[32]; }; +/* HW mac id in i2c memory definitions */ +#define MAGIC_OFF 0x0 +#define MAGIC_LEN 0x2 +#define MAGIC_BYTE0 0x55 +#define MAGIC_BYTE1 0xAA +#define MAC_OFF 0x2 +#define MAC_LEN 0x6 +#endif
Signature · 1 line
1.6.0.2
PATCH v5 9/12 SPEAr : Support added for SPEAr300 board
SPEAr300 SoC support contains basic spear300 support along with the usage of following drivers
- serial driver(UART)
- i2c driver
- smi driver
- nand driver(FSMC)
- usbd driver
--- MAKEALL | 1 + Makefile | 3 ++ board/spear/spear300/Makefile | 51 ++++++++++++++++++++++++++++++++++ board/spear/spear300/config.mk | 39 ++++++++++++++++++++++++++ board/spear/spear300/spear300.c | 58 +++++++++++++++++++++++++++++++++++++++ include/configs/spear3xx.h | 42 ++++++++++++++++++++++++++++ 6 files changed, 194 insertions(+), 0 deletions(-) create mode 100755 board/spear/spear300/Makefile create mode 100755 board/spear/spear300/config.mk create mode 100755 board/spear/spear300/spear300.c create mode 100755 include/configs/spear3xx.h
MAKEALL +1 -0
@@ -574,6 +574,7 @@ LIST_ARM9=" \ sheevaplug \ smdk2400 \ smdk2410 \ + spear300 \ spear600 \ trab \ VCMA9 \
Makefile +3 -0
@@ -3028,6 +3028,9 @@ smdk2400_config : unconfig smdk2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0 +spear300_config : unconfig + @$(MKCONFIG) -n $@ -t $(@:_config=) spear3xx arm arm926ejs $(@:_config=) spear spear + spear600_config : unconfig @$(MKCONFIG) -n $@ -t $(@:_config=) spear6xx arm arm926ejs $(@:_config=) spear spear
board/spear/spear300/Makefile new file +51 -0
51 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 += -DCONFIG_ENV_IS_IN_NAND +else +PLATFORM_RELFLAGS += -DCONFIG_ENV_IS_IN_FLASH +endif + +ifeq ($(CONSOLE),USB) +PLATFORM_RELFLAGS += -DCONFIG_SPEAR_USBTTY +endif
board/spear/spear300/spear300.c new file +58 -0
58 lines not on this page · raw message
include/configs/spear3xx.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 10/12 SPEAr : emi controller initialization for CFI driver support
SPEAr310 and SPEAr320 SoCs contain an EMI controller to interface Paraller NOR flashes. This patch adds the support for this IP
The standard CFI driver is used to interface with NOR flashes
--- board/spear/common/spr_misc.c | 59 ++++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_emi.h | 54 +++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 0 deletions(-) create mode 100644 include/asm-arm/arch-spear/spr_emi.h
board/spear/common/spr_misc.c +59 -0
@@ -27,6 +27,7 @@#include <net.h> #include <asm/io.h> #include <asm/arch/hardware.h> +#include <asm/arch/spr_emi.h> #include <asm/arch/spr_xloader_table.h> #include <asm/arch/spr_defs.h>
@@ -83,6 +84,61 @@ int misc_init_r(void)return 0 ; } +#ifdef CONFIG_SPEAR_EMI +struct cust_emi_para { +unsigned int tap; +unsigned int tsdp; +unsigned int tdpw; +unsigned int tdpr; +unsigned int tdcs; +}; + +/* EMI timing setting of m28w640hc of linux kernel */ +const struct cust_emi_para emi_timing_m28w640hc = { + .tap =0x10 , + .tsdp =0x05 , + .tdpw =0x0a , + .tdpr =0x0a , + .tdcs =0x05 , +}; + +/* EMI timing setting of bootrom */ +const struct cust_emi_para emi_timing_bootrom = { + .tap =0xf , + .tsdp =0x0 , + .tdpw =0xff , + .tdpr =0x111 , + .tdcs =0x02 , +}; + +void spear_emi_init (void ) +{ +const struct cust_emi_para *p = &emi_timing_m28w640hc; +struct emi_regs *emi_regs_p = (struct emi_regs *)CONFIG_SPEAR_EMIBASE ; +unsigned int cs; +unsigned int val, tmp; + + val =readl (CONFIG_SPEAR_RASBASE ); + +if (val &EMI_ACKMSK ) + tmp =0x3f ; +else + tmp =0x0 ; + +writel (tmp, &emi_regs_p->ack); + +for (cs =0 ; cs <CONFIG_SYS_MAX_FLASH_BANKS ; cs++) { +writel (p->tap, &emi_regs_p->bank_regs[cs].tap); +writel (p->tsdp, &emi_regs_p->bank_regs[cs].tsdp); +writel (p->tdpw, &emi_regs_p->bank_regs[cs].tdpw); +writel (p->tdpr, &emi_regs_p->bank_regs[cs].tdpr); +writel (p->tdcs, &emi_regs_p->bank_regs[cs].tdcs); +writel (EMI_CNTL_ENBBYTERW | ((val &0x18 ) >>3 ), + &emi_regs_p->bank_regs[cs].control); + } +} +#endif +int spear_board_init (ulong mach_type) { struct xloader_table *xloader_tb =
@@ -104,6 +160,9 @@ int spear_board_init(ulong mach_type) sizeof(chip->version)); } +#ifdef CONFIG_SPEAR_EMI +spear_emi_init (); +#endif return 0 ; }
include/asm-arm/arch-spear/spr_emi.h new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 11/12 SPEAr : Support added for SPEAr310 board
SPEAr310 SoC support contains basic spear310 support along with the usage of following drivers
- serial driver(UART)
- i2c driver
- smi driver
- nand driver(FSMC)
- usbd driver
- emi driver(cfi support)
--- MAKEALL | 1 + Makefile | 3 +- board/spear/spear310/Makefile | 51 +++++++++++++++++++++++++++++++++ board/spear/spear310/config.mk | 44 ++++++++++++++++++++++++++++ board/spear/spear310/spear310.c | 59 ++++++++++++++++++++++++++++++++++++++ include/configs/spear3xx.h | 60 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 217 insertions(+), 1 deletions(-) create mode 100755 board/spear/spear310/Makefile create mode 100755 board/spear/spear310/config.mk create mode 100755 board/spear/spear310/spear310.c
MAKEALL +1 -0
@@ -575,6 +575,7 @@ LIST_ARM9=" \ smdk2400 \ smdk2410 \ spear300 \ + spear310 \ spear600 \ trab \ VCMA9 \
Makefile +2 -1
@@ -3028,7 +3028,8 @@ smdk2400_config : unconfig smdk2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0 -spear300_config : unconfig +spear300_config \ +spear310_config : unconfig @$(MKCONFIG) -n $@ -t $(@:_config=) spear3xx arm arm926ejs $(@:_config=) spear spear spear600_config : unconfig
board/spear/spear310/Makefile new file +51 -0
51 lines not on this page · raw message
board/spear/spear310/config.mk new file +44 -0
44 lines not on this page · raw message
board/spear/spear310/spear310.c new file +59 -0
59 lines not on this page · raw message
include/configs/spear3xx.h +60 -0
75 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 12/12 SPEAr : Support added for SPEAr320 board
SPEAr320 SoC support contains basic spear320 support along with the usage of following drivers
- serial driver(UART)
- i2c driver
- smi driver
- nand driver(FSMC)
- usbd driver
- emi driver(cfi support)
--- MAKEALL | 1 + Makefile | 3 +- board/spear/spear320/Makefile | 51 +++++++++++++++++++++++++++++++++ board/spear/spear320/config.mk | 44 +++++++++++++++++++++++++++++ board/spear/spear320/spear320.c | 59 +++++++++++++++++++++++++++++++++++++++ include/configs/spear3xx.h | 29 +++++++++++++++++++ 6 files changed, 186 insertions(+), 1 deletions(-) create mode 100755 board/spear/spear320/Makefile create mode 100755 board/spear/spear320/config.mk create mode 100755 board/spear/spear320/spear320.c
MAKEALL +1 -0
@@ -576,6 +576,7 @@ LIST_ARM9=" \ smdk2410 \ spear300 \ spear310 \ + spear320 \ spear600 \ trab \ VCMA9 \
Makefile +2 -1
@@ -3029,7 +3029,8 @@ smdk2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0 spear300_config \ -spear310_config : unconfig +spear310_config \ +spear320_config : unconfig @$(MKCONFIG) -n $@ -t $(@:_config=) spear3xx arm arm926ejs $(@:_config=) spear spear spear600_config : unconfig
board/spear/spear320/Makefile new file +51 -0
51 lines not on this page · raw message
board/spear/spear320/config.mk new file +44 -0
44 lines not on this page · raw message
board/spear/spear320/spear320.c new file +59 -0
59 lines not on this page · raw message
include/configs/spear3xx.h +29 -0
@@ -34,6 +34,9 @@#elif defined(CONFIG_MK_spear310)#define CONFIG_SPEAR3XX 1#define CONFIG_SPEAR310 1 +#elif defined(CONFIG_MK_spear320) +#define CONFIG_SPEAR3XX 1 +#define CONFIG_SPEAR320 1#endif #include <configs/spear-common.h>
@@ -62,6 +65,18 @@ (void *)CONFIG_SYS_SERIAL3, \ (void *)CONFIG_SYS_SERIAL4, \ (void *)CONFIG_SYS_SERIAL5 } +#elif defined(CONFIG_SPEAR320 ) + +#if (CONFIG_CONS_INDEX ) +#undef CONFIG_PL011_CLOCK +#define CONFIG_PL011_CLOCK (83 * 1000 * 1000) +#endif + +#define CONFIG_SYS_SERIAL1 0xA3000000 +#define CONFIG_SYS_SERIAL2 0xA4000000 +#define CONFIG_PL01x_PORTS {(void *)CONFIG_SYS_SERIAL0, \ + (void *)CONFIG_SYS_SERIAL1, \ + (void *)CONFIG_SYS_SERIAL2 }#endif #if defined(CONFIG_SPEAR_EMI )
@@ -84,6 +99,17 @@ CONFIG_SYS_CS5_FLASH_BASE }#define CONFIG_SYS_MAX_FLASH_BANKS 6 +#elif defined(CONFIG_SPEAR320 ) +#define CONFIG_SYS_FLASH_BASE 0x44000000 +#define CONFIG_SYS_CS1_FLASH_BASE 0x45000000 +#define CONFIG_SYS_CS2_FLASH_BASE 0x46000000 +#define CONFIG_SYS_CS3_FLASH_BASE 0x47000000 +#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \ + CONFIG_SYS_CS1_FLASH_BASE, \ + CONFIG_SYS_CS2_FLASH_BASE, \ + CONFIG_SYS_CS3_FLASH_BASE } +#define CONFIG_SYS_MAX_FLASH_BANKS 4 +#endif #define CONFIG_SYS_MAX_FLASH_SECT (127 + 8)
@@ -97,6 +123,9 @@#elif defined(CONFIG_SPEAR310 )#define CONFIG_SYS_NAND_BASE (0x40000000) +#elif defined(CONFIG_SPEAR320 ) +#define CONFIG_SYS_NAND_BASE (0x50000000) +#endif #endif /* __CONFIG_H */
Signature · 1 line
1.6.0.2
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
In reply to Vipin KUMARHi Vipin,
Sorry for chiming in so late in the review process.
Quoted 22 lines · Vipin KUMAR
This patch adds the support to read and write mac id from i2c memory.
For reading:
if (env contains ethaddr)
pick env ethaddr
else
pick ethaddr from i2c memory
For writing:
chip_configethaddr XX:XX:XX:XX:XX:XX writes the mac id in i2c memorySigned-off-by Vipin <[email protected]>--- board/spear/common/spr_misc.c | 68 ++++++++++++++++++++++++++++++++- include/asm-arm/arch-spear/spr_defs.h | 8 ++++ 2 files changed, 75 insertions(+), 1 deletions(-)board/spear/common/spr_misc.c +0
-0
board/spear/common/spr_misc.c int dram_init(void) · line 75
Quoted 9 lines
board/spear/common/spr_misc.c +5
-0@@ -67,6 +67,12 @@ int dram_init(void)int misc_init_r (void ) { +#if defined(CONFIG_CMD_NET ) +uchar mac_id[6 ]; + +if (!eth_getenv_enetaddr ("ethaddr" , mac_id) && !i2c_read_mac (mac_id)) +eth_setenv_enetaddr ("ethaddr" , mac_id);
It's really not a good idea to programatically set an environment variable like this. Also, there's already a well-defined and documented protocol for how MAC addresses should be read and the precedence between EEPROM storage and environment storage. Please find a way to fit into that model. Since you don't have network support yet, I have no idea which network controller you're using, and recommend waiting until this is really needed.
Quoted 79 lines
board/spear/common/spr_misc.c +1
-0+#endif setenv ("verify" ,"n" );#if
defined(CONFIG_SPEAR_USBTTY)board/spear/common/spr_misc.c +54
-1@@ -101,12 +107,54 @@ int spear_board_init(ulong mach_type)return 0 ; } +static int i2c_read_mac (uchar *buffer) +{ +u8 buf[2 ]; + +i2c_read (CONFIG_I2C_CHIPADDRESS ,MAGIC_OFF ,1 , buf,MAGIC_LEN ); + +/* Check if mac in i2c memory is valid */ +if ((buf[0 ] ==MAGIC_BYTE0 ) && (buf[1 ] ==MAGIC_BYTE1 )) { +/* Valid mac address is saved in i2c eeprom */ +i2c_read (CONFIG_I2C_CHIPADDRESS ,MAC_OFF ,1 , buffer,MAC_LEN ); +return 0 ; + } + +return -1 ; +} + +static int write_mac (uchar *mac) +{ +u8 buf[2 ]; + + buf[0 ] = (u8 )MAGIC_BYTE0 ; + buf[1 ] = (u8 )MAGIC_BYTE1 ; +i2c_write (CONFIG_I2C_CHIPADDRESS ,MAGIC_OFF ,1 , buf,MAGIC_LEN ); + + buf[0 ] = (u8 )~MAGIC_BYTE0 ; + buf[1 ] = (u8 )~MAGIC_BYTE1 ; + +i2c_read (CONFIG_I2C_CHIPADDRESS ,MAGIC_OFF ,1 , buf,MAGIC_LEN ); + +/* check if valid MAC address is saved in I2C EEPROM or not? */ +if ((buf[0 ] ==MAGIC_BYTE0 ) && (buf[1 ] ==MAGIC_BYTE1 )) { +i2c_write (CONFIG_I2C_CHIPADDRESS ,MAC_OFF ,1 , mac,MAC_LEN ); +puts ("I2C EEPROM written with mac address \n" ); +return 0 ; + } + +puts ("I2C EEPROM writing failed \n" ); +return -1 ; +} +int do_chip_config (cmd_tbl_t *cmdtp,int flag,int argc,char *argv[]) {void (*sram_setfreq) (unsigned int ,unsigned int );struct chip_data *chip = &chip_data;unsigned char mac[6 ]; -unsigned int frequency; +unsigned int reg, frequency; +char *s, *e; +char i2c_mac[20 ];if ((argc >3 ) || (argc <2 )) {cmd_usage (cmdtp);@@ -137,6 +185,17 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) }return 0 ; + }else if (!strcmp (argv[1 ],"ethaddr" )) { + + s = argv[2 ]; +for (reg =0 ; reg <6 ; ++reg) { + mac[reg] = s ?simple_strtoul (s, &e,16 ) :0 ; +if (s) + s = (*e) ? e +1 : e; + } +write_mac (mac); + +return 0 ; }else if (!strcmp (argv[1 ],"print" )) {if (chip->cpufreq ==-1 )
board/spear/common/spr_misc.c int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 221
Quoted 7 lines
board/spear/common/spr_misc.c +3
-0@@ -156,6 +215,13 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])else printf ("DDR Type = Not Known\n" ); +if (!i2c_read_mac (mac)) { +sprintf (i2c_mac,"%pM" , mac); +printf ("Ethaddr (from i2c mem) = %s\n" , i2c_mac);
Maybe I'm missing some context, but why's the sprintf needed?
Quoted 15 lines
board/spear/common/spr_misc.c +4
-0+ }else { +printf ("Ethaddr (from i2c mem) = Not set\n" ); + } +printf ("Xloader Rev = %s\n" , chip->version);board/spear/common/spr_misc.c +0
-0return 0 ;include/asm-arm/arch-spear/spr_defs.h +0
-0@@ -35,4 +35,12 @@ struct chip_data {uchar version[32 ]; };
include/asm-arm/arch-spear/spr_defs.h struct chip_data { · line 46
Quoted 10 lines
include/asm-arm/arch-spear/spr_defs.h +8
-0+/* HW mac id in i2c memory definitions */ +#define MAGIC_OFF 0x0 +#define MAGIC_LEN 0x2 +#define MAGIC_BYTE0 0x55 +#define MAGIC_BYTE1 0xAA +#define MAC_OFF 0x2 +#define MAC_LEN 0x6 +#endif
regards,
Ben
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
Quoted 8 lines · Ben Warren
Quoted 8 lines
int
misc_init_r(void)
{board/spear/common/spr_misc.c +4
-0+#if defined(CONFIG_CMD_NET ) +uchar mac_id[6 ]; + + if (!eth_getenv_enetaddr("ethaddr", mac_id) &&!i2c_read_mac(mac_id))
+eth_setenv_enetaddr("ethaddr", mac_id);
Quoted 8 lines
Quoted 1 line
It's really not a good idea to programatically set an environment variable like this. Also, there's already a well-defined and documented protocol for how MAC addresses should be read and the precedence between EEPROM storage and environment storage. Please find a way to fit into that model. Since you don't have network support yet, I have no idea which network controller you're using, and recommend waiting until this is really needed.
I am referring to doc/README.enetaddr in the uboot source. This document says "If the hardware design mandates that the MAC address is stored in some special place (like EEPROM etc...), then the board specific init code (such as the board-specific misc_init_r() function) is responsible for locating the MAC address(es) and initializing the respective environment variable(s) from it. Note that this shall be done if, and only if, the environment does not already contain these environment variables, i.e. existing variable definitions must not be overwritten."
Coming back to the code
if (!eth_getenv_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id))
eth_setenv_enetaddr("ethaddr", mac_id);first I read the env variable "ethaddr" and skip setting it if it already exists
then I read mac id from i2c memory and store the same in env variable
Please let me know if I am missing anything.
Although the patch is not really needed right now, it will be needed soon. I am planning to send the net support patch during the next merging window. Since the current patch does not have any side effects, it can be included as of now.
Quoted 7 lines
Quoted 7 lines
if (chip->cpufreq == -1)board/spear/common/spr_misc.c +0
-0@@ -156,6 +215,13 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) else printf("DDR Type = Not Known\n");
Quoted 5 lines
board/spear/common/spr_misc.c int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 226
Quoted 4 lines
board/spear/common/spr_misc.c +3
-0+if (!i2c_read_mac (mac)) { +sprintf (i2c_mac,"%pM" , mac); +printf ("Ethaddr (from i2c mem) = %s\n" , i2c_mac);Maybe I'm missing some context, but why's the sprintf needed?
Yes, sprintf is not needed here
Thanks for pointing out
Regards
Vipin
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
Vipin,
Quoted 38 lines · Vipin KUMAR
Quoted 9 lines · Ben Warren
Quoted 9 lines
int
misc_init_r(void)
{board/spear/common/spr_misc.c +4
-0+#if defined(CONFIG_CMD_NET ) +uchar mac_id[6 ]; + + if (!eth_getenv_enetaddr("ethaddr", mac_id) &&!i2c_read_mac(mac_id))
+eth_setenv_enetaddr("ethaddr", mac_id);Quoted 9 lines
Quoted 1 line
It's really not a good idea to programatically set an environment variable like this. Also, there's already a well-defined and documented protocol for how MAC addresses should be read and the precedence between EEPROM storage and environment storage. Please find a way to fit into that model. Since you don't have network support yet, I have no idea which network controller you're using, and recommend waiting until this is really needed.
I am referring to doc/README.enetaddr in the uboot source. This document says "If the hardware design mandates that the MAC address is stored in some special place (like EEPROM etc...), then the board specific init code (such as the board-specific
misc_init_r()function) is responsible for locating the MAC address(es) and initializing the respective environment variable(s) from it. Note that this shall be done if, and only if, the environment does not already contain these environment variables, i.e. existing variable definitions must not be overwritten."Coming back to the code
if (!eth_getenv_enetaddr("ethaddr",mac_id) && !i2c_read_mac(mac_id))eth_setenv_enetaddr("ethaddr", mac_id);first I read the env variable "ethaddr" and skip setting it if it already exists
then I read mac id from i2c memory and store the same in env variable
Quoted 8 lines
Please let me know if I am missing anything.
Although the patch is not really needed right now, it will be needed soon. I am planning to send the net support patch during the next merging window. Since the current patch does not have any side effects, it can be included as of now.
You're right. For the sake of keeping networking stuff together, I'd prefer to see this logic in 'board_eth_init()' once you have it coded, but am not going to hold up progress for such a minor point. Sorry for the noise.
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
if (chip->cpufreq == -1)board/spear/common/spr_misc.c +0
-0@@ -156,6 +215,13 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) else printf("DDR Type = Not Known\n");Quoted 7 lines
board/spear/common/spr_misc.c int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
Quoted 5 lines
board/spear/common/spr_misc.c +3
-0+if (!i2c_read_mac (mac)) { +sprintf (i2c_mac,"%pM" , mac); +printf ("Ethaddr (from i2c mem) = %s\n" , i2c_mac);Maybe I'm missing some context, but why's the sprintf needed?
Quoted 6 lines
Yes, sprintf is not needed here
Thanks for pointing outRegards
Vipin
regards,
Ben
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
Quoted 14 lines · Ben Warren
Quoted 14 lines
Quoted 13 lines
board/spear/common/spr_misc.c int do_chip_config(cmd_tbl_t *cmdtp, int flag, · line 222
Quoted 11 lines
if (chip->cpufreq == -1)board/spear/common/spr_misc.c +3
-0@@ -156,6 +215,13 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) else printf("DDR Type = Not Known\n"); +if (!i2c_read_mac (mac)) { +sprintf (i2c_mac,"%pM" , mac); +printf ("Ethaddr (from i2c mem) = %s\n" , i2c_mac);Maybe I'm missing some context, but why's the sprintf needed?
Quoted 3 lines
Quoted 3 lines
Yes, sprintf is not needed here
Thanks for pointing out
Hello Tom,
Should I send the whole patch set again or only the subpatch after removing the sprintf
Regards
Vipin
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
Quoted 14 lines · Vipin KUMAR
Quoted 13 lines · Ben Warren
Quoted 13 lines
Quoted 13 lines
board/spear/common/spr_misc.c int do_chip_config(cmd_tbl_t *cmdtp, int flag, · line 222
Quoted 11 lines
if (chip->cpufreq == -1)board/spear/common/spr_misc.c +3
-0@@ -156,6 +215,13 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) else printf("DDR Type = Not Known\n"); +if (!i2c_read_mac (mac)) { +sprintf (i2c_mac,"%pM" , mac); +printf ("Ethaddr (from i2c mem) = %s\n" , i2c_mac);Maybe I'm missing some context, but why's the sprintf needed?
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Yes, sprintf is not needed here
Thanks for pointing outHello Tom,
Should I send the whole patch set again or only the subpatch after removing the sprintf
Let us wait for feed back from nand and usb subsystem so we can a accumulate them in just one patch set.
Tom
Quoted 3 lines
Regards
Vipin
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
In reply to Ben WarrenQuoted 16 lines · On Monday 18 January 2010 01:15:43 Ben Warren wrote:
Quoted 15 lines · Vipin KUMAR
This patch adds the support to read and write mac id from i2c memory.
For reading:
if (env contains ethaddr)
pick env ethaddr
else
pick ethaddr from i2c memory
For writing:
chip_configethaddr XX:XX:XX:XX:XX:XX writes the mac id in i2c memoryboard/spear/common/spr_misc.c +0
-0@@ -67,6 +67,12 @@ int dram_init(void)
Quoted 15 lines
board/spear/common/spr_misc.c int dram_init(void) · line 74
Quoted 7 lines
board/spear/common/spr_misc.c +5
-0int misc_init_r (void ) { +#if defined(CONFIG_CMD_NET ) +uchar mac_id[6 ]; + +if (!eth_getenv_enetaddr ("ethaddr" , mac_id) && !i2c_read_mac (mac_id)) +eth_setenv_enetaddr ("ethaddr" , mac_id);It's really not a good idea to programatically set an environment variable like this. Also, there's already a well-defined and documented protocol for how MAC addresses should be read and the precedence between EEPROM storage and environment storage. Please find a way to fit into that model. Since you don't have network support yet, I have no idea which network controller you're using, and recommend waiting until this is really needed.
he's doing it the way doc/README.enetaddr suggests ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100118/e56d51d9/attachment.pgp
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
In reply to Vipin KUMARTom,
Quoted 11 lines · Vipin KUMAR
This patch adds the support to read and write mac id from i2c memory.
For reading:
if (env contains ethaddr)
pick env ethaddr
else
pick ethaddr from i2c memory
For writing:
chip_configethaddr XX:XX:XX:XX:XX:XX writes the mac id in i2c memory
Quoted 2 lines
Signed-off-by Vipin <[email protected]>
Quoted 5 lines
--- board/spear/common/spr_misc.c | 68 ++++++++++++++++++++++++++++++++- include/asm-arm/arch-spear/spr_defs.h | 8 ++++ 2 files changed, 75 insertions(+), 1 deletions(-)
I think I told WD I'd apply this, but am unable to do so without all the other SPEAr patches. Please include it in your set.
regards,
Ben
PATCH v5 8/12 SPEAr : Support for HW mac id read/write from i2c mem
Quoted 17 lines · Ben Warren
Tom,
Quoted 11 lines · Vipin KUMAR
This patch adds the support to read and write mac id from i2c memory.
For reading:
if (env contains ethaddr)
pick env ethaddr
else
pick ethaddr from i2c memory
For writing:
chip_configethaddr XX:XX:XX:XX:XX:XX writes the mac id in i2c memoryQuoted 2 lines
Signed-off-by Vipin <[email protected]>Acked-by Ben Warren <[email protected]>
Quoted 8 lines
Quoted 6 lines
--- board/spear/common/spr_misc.c | 68 ++++++++++++++++++++++++++++++++- include/asm-arm/arch-spear/spr_defs.h | 8 ++++ 2 files changed, 75 insertions(+), 1 deletions(-)I think I told WD I'd apply this, but am unable to do so without all the other SPEAr patches. Please include it in your set.
This set has been applied.
Best Regards,
Tom
Quoted 3 lines
regards,
Ben
PATCH v5 5/12 SPEAr : nand driver support for SPEAr SoCs
In reply to Vipin KUMARQuoted 4 lines · Vipin KUMAR
SPEAr SoCs contain an FSMC controller which can be used to interface with a range of memories eg. NAND, SRAM, NOR.
Currently, this driver supports interfacing FSMC with NAND memories
Quoted 8 lines
Signed-off-by Vipin <[email protected]>--- drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/spr_nand.c | 124 +++++++++++++++++++++++++++++++++ include/asm-arm/arch-spear/spr_nand.h | 57 +++++++++++++++ 3 files changed, 182 insertions(+), 0 deletions(-) create mode 100755 drivers/mtd/nand/spr_nand.c create mode 100644 include/asm-arm/arch-spear/spr_nand.h
-Scott
v5 cover Support for SPEAr SoCs
In reply to Vipin KUMARQuoted 14 lines · Vipin KUMAR
Hello Tom,
Please consider the patchset version5 for mainline inclusion
This patchset contains the version5 for SPEAr SoCs support Modifications
1.include/configscontinsspear3xx.hfor SPEAR300, SPEAR310 and SPEAr320 variants
2.include/configscontinsspear6xx.hfor SPEAR600 and any variants in future
3. Addedinclude/asm-arm/arch-spear/hardware.hfor platform specific defines eg. base addresses of devices
4. review feedbacks on v4 patchset applied
Quoted 3 lines
Thanks and Regards
Vipin
This looks good!
Ack-ing the ARM parts.
Outstanding are ack's from subsystem
nand, usb and net.
i2c has been acked
Thanks for the hard work.
Tom
Quoted 13 lines
Vipin (12):
SPEAr : Adding README.spear in doc
SPEAr : Adding basic SPEAr architecture support. SPEAr : i2c driver support added for SPEAr SoCs SPEAr : smi driver support for SPEAr SoCs
SPEAr : nand driver support for SPEAr SoCs
SPEAr : usbd driver support for SPEAr SoCs
SPEAr : Support added for SPEAr600 board
SPEAr : Support for HW mac id read/write from i2c mem SPEAr : Support added for SPEAr300 board
SPEAr : emi controller initialization for CFI driver support SPEAr : Support added for SPEAr310 board
SPEAr : Support added for SPEAr320 board
v5 cover Support for SPEAr SoCs
Quoted 19 lines · Tom
Quoted 14 lines · Vipin KUMAR
Hello Tom,
Please consider the patchset version5 for mainline inclusion
This patchset contains the version5 for SPEAr SoCs support Modifications
1.include/configscontinsspear3xx.hfor SPEAR300, SPEAR310 and SPEAr320 variants
2.include/configscontinsspear6xx.hfor SPEAR600 and any variants in future
3. Addedinclude/asm-arm/arch-spear/hardware.hfor platform specific defines eg. base addresses of devices
4. review feedbacks on v4 patchset appliedQuoted 3 lines
Thanks and Regards
Vipin
Quoted 5 lines
This looks good!
Ack-ing the ARM parts.Outstanding are ack's from subsystem
nand, usb and net.
Please see the following mails for usb and NAND acks NAND subsystem
http://www.mail-archive.com/u-boot at lists.denx.de/msg26992.html
USB subsystem
http://www.mail-archive.com/u-boot at lists.denx.de/msg27163.html
Net subsystem is not supported as of now.
It would be added in the next merge window
The changes as suggested by Remy and Scott are already done in patch set version5
Quoted 3 lines
i2c has been acked
Thanks for the hard work.
Welcome :)
Quoted 1 line
Tom
Regards
Vipin
Quoted 16 lines
Quoted 15 lines
Vipin (12):
SPEAr : Adding README.spear in doc
SPEAr : Adding basic SPEAr architecture support. SPEAr : i2c driver support added for SPEAr SoCs SPEAr : smi driver support for SPEAr SoCs
SPEAr : nand driver support for SPEAr SoCs
SPEAr : usbd driver support for SPEAr SoCs
SPEAr : Support added for SPEAr600 board
SPEAr : Support for HW mac id read/write from i2c mem SPEAr : Support added for SPEAr300 board
SPEAr : emi controller initialization for CFI driver support SPEAr : Support added for SPEAr310 board
SPEAr : Support added for SPEAr320 board
v5 cover Support for SPEAr SoCs
Quoted 25 lines · Vipin KUMAR
Quoted 15 lines · Tom
Quoted 14 lines · Vipin KUMAR
Hello Tom,
Please consider the patchset version5 for mainline inclusion
This patchset contains the version5 for SPEAr SoCs support Modifications
1.include/configscontinsspear3xx.hfor SPEAR300, SPEAR310 and SPEAr320 variants
2.include/configscontinsspear6xx.hfor SPEAR600 and any variants in future
3. Addedinclude/asm-arm/arch-spear/hardware.hfor platform specific defines eg. base addresses of devices
4. review feedbacks on v4 patchset appliedQuoted 8 lines
Quoted 3 lines
Thanks and Regards
VipinThis looks good!
Ack-ing the ARM parts.Outstanding are ack's from subsystem
nand, usb and net.
Quoted 7 lines
Please see the following mails for usb and NAND acks NAND subsystem
http://www.mail-archive.com/u-boot at lists.denx.de/msg26992.htmlUSB subsystem
http://www.mail-archive.com/u-boot at lists.denx.de/msg27163.html
I saw these comments.
I did not see any explicit ack's
Quoted 5 lines
Net subsystem is not supported as of now.
It would be added in the next merge windowQuoted 1 line
Quoted 1 line
SPEAr : Support for HW mac id read/write from i2c mem
This patch touches on net but I see your point,
this is just ground work, real support to follow.
Tom
v5 cover Support for SPEAr SoCs
Hi,
Quoted 6 lines
Quoted 3 lines
USB subsystem
http://www.mail-archive.com/u-boot at lists.denx.de/msg27163.htmlI saw these comments.
I did not see any explicit ack's
I thought it was explicit enough...
so again: Acked-by: Remy Bohmer <[email protected]>
Remy
v5 cover Support for SPEAr SoCs
Tom,
After Remy's and Scott's Acks, are we still in time for merging the patch set into the mainline?
I really count on that....
Thx,
Armando
Quoted 17 lines · Remy Bohmer
Hi,
Quoted 7 lines
Quoted 4 lines
USB subsystem
http://www.mail-archive.com/u-boot at lists.denx.de/msg27163.htmlI saw these comments.
I did not see any explicit ack'sI thought it was explicit enough...
so again: Acked-by: Remy Bohmer <[email protected]>Remy
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
v5 cover Support for SPEAr SoCs
In reply to Vipin KUMARQuoted 17 lines · Vipin KUMAR
Hello Tom,
Please consider the patchset version5 for mainline inclusion
This patchset contains the version5 for SPEAr SoCs support Modifications
1.include/configscontinsspear3xx.hfor SPEAR300, SPEAR310 and SPEAr320 variants
2.include/configscontinsspear6xx.hfor SPEAR600 and any variants in future
3. Addedinclude/asm-arm/arch-spear/hardware.hfor platform specific defines eg. base addresses of devices
4. review feedbacks on v4 patchset appliedThanks and Regards
Vipin
Quoted 13 lines
Vipin (12):
SPEAr : Adding README.spear in doc
SPEAr : Adding basic SPEAr architecture support. SPEAr : i2c driver support added for SPEAr SoCs SPEAr : smi driver support for SPEAr SoCs
SPEAr : nand driver support for SPEAr SoCs
SPEAr : usbd driver support for SPEAr SoCs
SPEAr : Support added for SPEAr600 board
SPEAr : Support for HW mac id read/write from i2c mem SPEAr : Support added for SPEAr300 board
SPEAr : emi controller initialization for CFI driver support SPEAr : Support added for SPEAr310 board
SPEAr : Support added for SPEAr320 board
Applied to u-boot-arm/master
Thanks
Tom
v5 cover Support for SPEAr SoCs
Quoted 32 lines · Tom
Quoted 17 lines · Vipin KUMAR
Hello Tom,
Please consider the patchset version5 for mainline inclusion
This patchset contains the version5 for SPEAr SoCs support Modifications
1.include/configscontinsspear3xx.hfor SPEAR300, SPEAR310 and SPEAr320 variants
2.include/configscontinsspear6xx.hfor SPEAR600 and any variants in future
3. Addedinclude/asm-arm/arch-spear/hardware.hfor platform specific defines eg. base addresses of devices
4. review feedbacks on v4 patchset appliedThanks and Regards
VipinQuoted 13 lines
Vipin (12):
SPEAr : Adding README.spear in doc
SPEAr : Adding basic SPEAr architecture support. SPEAr : i2c driver support added for SPEAr SoCs SPEAr : smi driver support for SPEAr SoCs
SPEAr : nand driver support for SPEAr SoCs
SPEAr : usbd driver support for SPEAr SoCs
SPEAr : Support added for SPEAr600 board
SPEAr : Support for HW mac id read/write from i2c mem SPEAr : Support added for SPEAr300 board
SPEAr : emi controller initialization for CFI driver support SPEAr : Support added for SPEAr310 board
SPEAr : Support added for SPEAr320 board
Quoted 1 line
Applied to u-boot-arm/master
Thanks Tom for your help and review feedbacks