Add support for Bluewater System Snapper 9260 and 9G20 modules
cover Add support for Bluewater System Snapper 9260 and 9G20 modules
Add support for Bluewater Systems Snapper9260/9G20 modules. The modules are based on the AT91SAM9260 and AT91SAM9G20 processors respectively and support NAND flash and Ethernet.
Ryan Mallon (3):
Add AT91SAM9G20 to list of AT91 processors in soft_i2c driver. Add support for Bluewater Systems Snapper 9260 and 9G20 modules Added Bluewater Systems Snapper 9260 and 9G20 module config to
top-level Makefile
Makefile | 13 ++ board/bluewater/snapper9260/Makefile | 55 +++++++++ board/bluewater/snapper9260/config.mk | 1 + board/bluewater/snapper9260/snapper9260.c | 177 +++++++++++++++++++++++++++++ drivers/i2c/soft_i2c.c | 2 +- 5 files changed, 247 insertions(+), 1 deletions(-) create mode 100644 board/bluewater/snapper9260/Makefile create mode 100644 board/bluewater/snapper9260/config.mk create mode 100644 board/bluewater/snapper9260/snapper9260.c
PATCH 1/3 Add AT91SAM9G20 to list of AT91 processors in soft_i2c driver.
--- drivers/i2c/soft_i2c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/soft_i2c.c +1 -1
@@ -32,7 +32,7 @@#endif #if defined(CONFIG_AT91RM9200 ) || \ defined(CONFIG_AT91SAM9260 ) || defined(CONFIG_AT91SAM9261 ) || \ - defined(CONFIG_AT91SAM9263 ) + defined(CONFIG_AT91SAM9263 ) || defined(CONFIG_AT91SAM9G20 )#include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pio.h>
Signature · 1 line
1.7.0.4
PATCH 2/3 Add support for Bluewater Systems Snapper 9260 and 9G20 modules
--- board/bluewater/snapper9260/Makefile | 55 +++++++++ board/bluewater/snapper9260/config.mk | 1 + board/bluewater/snapper9260/snapper9260.c | 177 +++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+), 0 deletions(-) create mode 100644 board/bluewater/snapper9260/Makefile create mode 100644 board/bluewater/snapper9260/config.mk create mode 100644 board/bluewater/snapper9260/snapper9260.c
board/bluewater/snapper9260/Makefile new file +55 -0
@@ -0,0 +1,55 @@ +# +# (C) Copyright 2003-2008 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# (C) Copyright 2011 Bluewater Systems +# +# 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$(BOARD).o + +COBJS-y += snapper9260.o + +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(OBJS) $(SOBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak .depend + +.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) + $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@ + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
board/bluewater/snapper9260/config.mk new file +1 -0
@@ -0,0 +1 @@ +CONFIG_SYS_TEXT_BASE = 0x23f00000
board/bluewater/snapper9260/snapper9260.c new file +177 -0
177 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 3/3 Added Bluewater Systems Snapper 9260 and 9G20 module config to top-level Makefile
--- Makefile | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
Makefile +13 -0
@@ -901,6 +901,19 @@ TNY_A9260_config : unconfig @$(MKCONFIG) -n $@ -a tny_a9260 arm arm926ejs tny_a9260 calao at91 ######################################################################## +## Bluewater Systems Boards +######################################################################## +snapper9260_config \ +snapper9g20_config: unconfig + @mkdir -p $(obj)include + @if [ "$(findstring 9260, $@)" ]; then \ + echo "#define CONFIG_SNAPPER9260 1" >> $(obj)include/config.h ; \ + else \ + echo "#define CONFIG_SNAPPER9G20 1" >> $(obj)include/config.h ; \ + fi; + @$(MKCONFIG) -a snapper9260 arm arm926ejs snapper9260 bluewater at91 + +######################################################################## ## ARM Integrator boards - see doc/README-integrator for more info. integratorap_config \ ap_config \
Signature · 1 line
1.7.0.4
cover Add support for Bluewater System Snapper 9260 and 9G20 modules
In reply to Ryan MallonDear Ryan Mallon,
Quoted 11 lines
Add support for Bluewater Systems Snapper9260/9G20 modules. The modules are based on the AT91SAM9260 and AT91SAM9G20 processors respectively and support NAND flash and Ethernet.
Ryan Mallon (3):
Add AT91SAM9G20 to list of AT91 processors insoft_i2cdriver. Add support for Bluewater Systems Snapper 9260 and 9G20 modules Added Bluewater Systems Snapper 9260 and 9G20 module config to
top-levelMakefileMakefile | 13 ++
No additions to Makefile. New board defines go into boards.cfg
Quoted 2 lines
board/bluewater/snapper9260/Makefile | 55 +++++++++ board/bluewater/snapper9260/config.mk | 1 +
This file is not required. CONFIG_SYS_TEXT_BASE belongs into your board configuration file in include/configs/. By the way, where is this file?
Quoted 1 line
board/bluewater/snapper9260/snapper9260.c | 177 +++++++++++++++++++++++++++++
Seems to be based on very old Code.
See comments there.
Quoted 1 line
drivers/i2c/soft_i2c.c | 2 +-
#if defined(CONFIG_AT91FAMILY) should be used for all AT91, individual AT91 SoCs don't need to be checked anymore. See comment there.
Quoted 4 lines
5 files changed, 247 insertions(+), 1 deletions(-)create mode 100644 board/bluewater/snapper9260/Makefile create mode 100644
board/bluewater/snapper9260/config.mkcreate mode 100644board/bluewater/snapper9260/snapper9260.c
MAINTAINERS entry missing.
Quoted 1 line
Best Regards,
Reinhard
PATCH 1/3 Add AT91SAM9G20 to list of AT91 processors in soft_i2c driver.
In reply to Ryan MallonDear Ryan Mallon,
Quoted 10 lines
Signed-off-by Ryan Mallon<[email protected]>--- drivers/i2c/soft_i2c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/i2c/soft_i2c.c +0
-0
drivers/i2c/soft_i2c.c line 35
Quoted 5 lines
drivers/i2c/soft_i2c.c +1
-1@@ -32,7 +32,7 @@#endif #if defined(CONFIG_AT91RM9200 ) || \ defined(CONFIG_AT91SAM9260 ) || defined(CONFIG_AT91SAM9261 ) || \ - defined(CONFIG_AT91SAM9263 ) + defined(CONFIG_AT91SAM9263 ) || defined(CONFIG_AT91SAM9G20 )
Please replace those individual AT91SAM9* SoC names by a simple #if defined(CONFIG_AT91FAMILY) || defined(CONFIG_AT91RM9200) Sorry that this list has escaped detection so far.
*RM9200 is still needed extra, because it has not yet become a member of AT91FAMILY.
Best Regards,
Reinhard
PATCH 2/3 Add support for Bluewater Systems Snapper 9260 and 9G20 modules
In reply to Ryan MallonDear Ryan Mallon,
Quoted 4 lines
Signed-off-by Ryan Mallon<[email protected]>--- board/bluewater/snapper9260/Makefile | 55 +++++++++ board/bluewater/snapper9260/config.mk | 1 +
See comment in your patch 0/3.
Quoted 39 lines
board/bluewater/snapper9260/snapper9260.c | 177 +++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+), 0 deletions(-)create mode 100644 board/bluewater/snapper9260/Makefile create mode 100644
board/bluewater/snapper9260/config.mkcreate mode 100644board/bluewater/snapper9260/snapper9260.cboard/bluewater/snapper9260/Makefile new file +27
-0@@ -0,0 +1,55 @@ +# +# (C) Copyright 2003-2008 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# (C) Copyright 2011 Bluewater Systems +# +# 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 +
board/bluewater/snapper9260/Makefile line 37
Quoted 10 lines
board/bluewater/snapper9260/Makefile new file +10
-0+LIB = $(obj)lib$(BOARD).o + +COBJS-y += snapper9260.o + +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(OBJS) $(SOBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
This is old code. Libraries are not built anymore. Has this even been built on current top of tree u-boot?
Quoted 68 lines
board/bluewater/snapper9260/Makefile new file +18
-0+ +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak .depend + +.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) + $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c)> $@ + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################board/bluewater/snapper9260/config.mk new file +1
-0@@ -0,0 +1 @@ +CONFIG_SYS_TEXT_BASE = 0x23f00000board/bluewater/snapper9260/snapper9260.c new file +37
-0@@ -0,0 +1,177 @@ +/* +* Bluewater Systems Snapper 9260/9G20 modules +* +* (C) Copyright 2011 Bluewater Systems +* Author: Andre Renaud<[email protected]> +* Author: Ryan Mallon<[email protected]> +* +* 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 <common.h> +#include <asm/sizes.h> +#include <asm/arch/at91sam9260.h> +#include <asm/arch/at91sam9260_matrix.h> +#include <asm/arch/at91sam9_smc.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/at91_rstc.h> +#include <asm/arch/at91_pio.h> +#include <asm/arch/clk.h> +#include <asm/arch/gpio.h> +#include <asm/arch/io.h> +#include <asm/arch/hardware.h> +#include <net.h>
board/bluewater/snapper9260/snapper9260.c line 46
Quoted 10 lines
board/bluewater/snapper9260/snapper9260.c new file +9
-0+#include <netdev.h> + +#include <i2c.h> +#include <pca953x.h> + +DECLARE_GLOBAL_DATA_PTR ; + +/* The mach-type is the same for both Snapper 9260 and 9G20 */ +#define SNAPPER9260_MACH_TYPE 1987
Nope. This is not acceptable. ARM mach types are exclusively defined in mach-types.h. Its already there:
#define MACH_TYPE_SNAPPER_9260 1987
Quoted 115 lines
board/bluewater/snapper9260/snapper9260.c new file +115
-0+ +#define IO_EXP_ETH_RESET (0<< 1) +#define IO_EXP_ETH_POWER (1<< 1) + +static void macb_hw_init (void ) +{ +unsigned long rstc; + +/* Enable clock */ +at91_sys_write (AT91_PMC_PCER ,1 <<AT91SAM9260_ID_EMAC ); + +/* Disable pull-ups to prevent PHY going into test mode */ +writel (pin_to_mask (AT91_PIN_PA14 ) | +pin_to_mask (AT91_PIN_PA15 ) | +pin_to_mask (AT91_PIN_PA18 ), +pin_to_controller (AT91_PIN_PA0 ) +PIO_PUDR ); + +/* Power down ethernet */ +pca953x_set_dir (0x28 ,IO_EXP_ETH_POWER ,PCA953X_DIR_OUT ); +pca953x_set_val (0x28 ,IO_EXP_ETH_POWER ,1 ); + +/* Hold ethernet in reset */ +pca953x_set_dir (0x28 ,IO_EXP_ETH_RESET ,PCA953X_DIR_OUT ); +pca953x_set_val (0x28 ,IO_EXP_ETH_RESET ,0 ); + +/* Enable ethernet power */ +pca953x_set_val (0x28 ,IO_EXP_ETH_POWER ,0 ); + + rstc =at91_sys_read (AT91_RSTC_MR )&AT91_RSTC_ERSTL ; + +/* Need to reset PHY -> 500ms reset */ +at91_sys_write (AT91_RSTC_MR , (AT91_RSTC_KEY | + (AT91_RSTC_ERSTL & (0x0d <<8 )) | +AT91_RSTC_URSTEN )); + +at91_sys_write (AT91_RSTC_CR ,AT91_RSTC_KEY |AT91_RSTC_EXTRST ); + +/* Wait for end hardware reset */ +while (!(at91_sys_read (AT91_RSTC_SR )&AT91_RSTC_NRSTL )); + +/* Restore NRST value */ +at91_sys_write (AT91_RSTC_MR , (rstc |AT91_RSTC_KEY | +AT91_RSTC_URSTEN )); + +/* Bring the ethernet out of reset */ +pca953x_set_val (0x28 ,IO_EXP_ETH_RESET ,1 ); + +/* The phy internal reset take 21ms */ +udelay (21 *1000 ); + +/* Re-enable pull-up */ +writel (pin_to_mask (AT91_PIN_PA14 ) | +pin_to_mask (AT91_PIN_PA15 ) | +pin_to_mask (AT91_PIN_PA18 ), +pin_to_controller (AT91_PIN_PA0 ) +PIO_PUER ); + +at91_macb_hw_init (); +} + +static void nand_hw_init (void ) +{ +unsigned long csa; + +/* Enable CS3 */ + csa =at91_sys_read (AT91_MATRIX_EBICSA ); +at91_sys_write (AT91_MATRIX_EBICSA , + csa |AT91_MATRIX_CS3A_SMC_SMARTMEDIA ); + +/* Configure SMC CS3 for NAND/SmartMedia */ +at91_sys_write (AT91_SMC_SETUP (3 ), +AT91_SMC_NWESETUP_ (2 ) |AT91_SMC_NCS_WRSETUP_ (0 ) | +AT91_SMC_NRDSETUP_ (2 ) |AT91_SMC_NCS_RDSETUP_ (0 )); +at91_sys_write (AT91_SMC_PULSE (3 ), +AT91_SMC_NWEPULSE_ (4 ) |AT91_SMC_NCS_WRPULSE_ (4 ) | +AT91_SMC_NRDPULSE_ (4 ) |AT91_SMC_NCS_RDPULSE_ (4 )); +at91_sys_write (AT91_SMC_CYCLE (3 ), +AT91_SMC_NWECYCLE_ (7 ) |AT91_SMC_NRDCYCLE_ (7 )); +at91_sys_write (AT91_SMC_MODE (3 ), +AT91_SMC_READMODE |AT91_SMC_WRITEMODE | +AT91_SMC_EXNWMODE_DISABLE | +AT91_SMC_DBW_8 | +AT91_SMC_TDF_ (3 )); + +at91_sys_write (AT91_PMC_PCER ,1 <<AT91SAM9260_ID_PIOC ); + +/* Configure RDY/BSY */ +at91_set_gpio_input (CONFIG_SYS_NAND_READY_PIN ,1 ); + +/* Enable NandFlash */ +at91_set_gpio_output (CONFIG_SYS_NAND_ENABLE_PIN ,1 ); +} + +int board_init (void ) +{ +/* Enable Ctrl-c */ +console_init_f (); + + gd->bd->bi_arch_number =SNAPPER9260_MACH_TYPE ; + +/* Address of boot parameters */ + gd->bd->bi_boot_params =PHYS_SDRAM +0x100 ; + +/* Enable PIO clocks */ +at91_sys_write (AT91_PMC_PCER ,1 <<AT91SAM9260_ID_PIOA ); +at91_sys_write (AT91_PMC_PCER ,1 <<AT91SAM9260_ID_PIOB ); +at91_sys_write (AT91_PMC_PCER ,1 <<AT91SAM9260_ID_PIOC ); + +/* Initalise i2c (for IO expander) */ +i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); + +at91_serial_hw_init (); +nand_hw_init (); +macb_hw_init (); + +return 0 ;
board/bluewater/snapper9260/snapper9260.c line 171
Quoted 10 lines
board/bluewater/snapper9260/snapper9260.c new file +10
-0+} + +int board_eth_init (bd_t *bis) +{ +return macb_eth_initialize (0 , (void *)AT91SAM9260_BASE_EMAC ,0x1f ); +} + +int dram_init (void ) +{ + gd->ram_size =CONFIG_SYS_SDRAM_SIZE ;
This is not advisable. Use
gd->ram_size = get_ram_size( (void *)CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_SIZE);
instead.
board/bluewater/snapper9260/snapper9260.c line 177
Quoted 6 lines
board/bluewater/snapper9260/snapper9260.c new file +6
-0+return 0 ; +} + +void reset_phy (void ) +{ +}
This is all based on older (legacy) at91 hardware access. It would be better if you based it on the reworked at91 code atgit://git.denx.de/u-boot-atmel.git rework101229 branch.
For templates see the at91sam9260ek port there.
Best Regards,
Reinhard
PATCH 3/3 Added Bluewater Systems Snapper 9260 and 9G20 module config to top-level Makefile
In reply to Ryan MallonDear Ryan Mallon,
Quoted 4 lines
Signed-off-by Ryan Mallon<[email protected]>--- Makefile | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
New boards must be added to boards.cfg. See how it is done for the at91sam9260ek boards in the rework branch.
Best Regards,
Reinhard