[U-Boot] [PATCH] Support for Embedtronics/MRFSA board.

Sami Kantoluoto sami.kantoluoto at embedtronics.fi
Sun Aug 30 00:47:26 CEST 2009


On Sat, Aug 29, 2009 at 10:15:23PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 20:22 Sat 29 Aug     , Sami Kantoluoto wrote:
> > Adds support for Embedtronics Oy's MRFSA board. Board features

[snip]

> > ---
> >  Makefile                             |   13 +
> >  board/embedtronics/mrfsa/Makefile    |   60 +++++
> >  board/embedtronics/mrfsa/config.mk   |    1 +
> >  board/embedtronics/mrfsa/iopins.h    |   36 +++
> >  board/embedtronics/mrfsa/ks8995ma.h  |  255 ++++++++++++++++++
> >  board/embedtronics/mrfsa/mrfsa.c     |  481 ++++++++++++++++++++++++++++++++++
> >  board/embedtronics/mrfsa/partition.c |   44 +++
> >  board/embedtronics/mrfsa/watchdog.c  |   62 +++++
> >  common/console.c                     |    6 +
> >  cpu/arm926ejs/at91/timer.c           |    7 +-
> >  drivers/net/macb.c                   |    4 +
> >  include/asm-arm/mach-types.h         |   13 +
> >  include/configs/mrfsa.h              |  197 ++++++++++++++
> >  lib_arm/bootm.c                      |   13 +
> >  14 files changed, 1191 insertions(+), 1 deletions(-)
> >  create mode 100644 board/embedtronics/mrfsa/Makefile
> >  create mode 100644 board/embedtronics/mrfsa/config.mk
> >  create mode 100644 board/embedtronics/mrfsa/iopins.h
> >  create mode 100644 board/embedtronics/mrfsa/ks8995ma.h
> >  create mode 100644 board/embedtronics/mrfsa/mrfsa.c
> >  create mode 100644 board/embedtronics/mrfsa/partition.c
> >  create mode 100644 board/embedtronics/mrfsa/watchdog.c
> >  create mode 100644 include/configs/mrfsa.h
> first please split this patch in ortogonal changeset
> as
> 1) patch for macb
> 2) patch for your switch
> 3) patch for the watchdog
> 4) patch for your board
> please put the the sync request of the mach-types.h about your
> board after the ---
> I'll handle it myself before apply your board

Ok.

----------------------------------------------------

> > +++ b/board/embedtronics/mrfsa/ks8995ma.h
> please be awre that I've start to work on the adding of a phylib
> http://git.denx.de/?p=u-boot/u-boot-arm.git;a=shortlog;h=refs/heads/phylib
> 
> which will simplify phy and switch support so please take a look on it

I'll check that out.

----------------------------------------------------

> > +#ifdef	CONFIG_ATMEL_MCI
> > +static void mrfsa_mci_hw_init (void)
> > +{
> > +	/* Enable clock */
> > +	at91_sys_write (AT91_PMC_PCER, 1 << AT91SAM9260_ID_MCI);
> > +
> > +	/* configure I/O */
> > +	at91_set_A_periph (AT91_PIN_PA6, 1);
> > +	at91_set_A_periph (AT91_PIN_PA7, 1);
> > +	at91_set_A_periph (AT91_PIN_PA8, 1);
> > +	at91_set_A_periph (AT91_PIN_PA9, 1);
> > +	at91_set_A_periph (AT91_PIN_PA10, 1);
> > +	at91_set_A_periph (AT91_PIN_PA11, 1);
> > +}
> > +#endif	/* CONFIG_ATMEL_MCI */
> the one must move to cpu/arm926ejs/at91/soc_devices
> please add it at the time of the mci support for all socs

Ok.. Is this acceptable interface:

void at91_mci0_hw_init (unsigned mcda_bits, unsigned mcdb_bits);

mcda_bits tells the bus width (0 = not used, 1 = one bit, 4 = four bits)
of slot A and mcdb_bits for slot B. This is needed because at91_mci_hw_init()
needs to know which I/O pins to configure.

> > +
> > +void mrfsa_wdt_init (void);
> > +
> > +int board_init (void)
> > +{

[snip]

> > +#ifdef CONFIG_HW_WATCHDOG
> > +	mrfsa_wdt_init ();
> > +#endif
> why?

Just to make sure the hardware (external to CPU) watchdog doesn't reset
us.

> > +int board_late_init (void)
> > +{
> > +	/* prepare CSR(3) for shift registers */
> > +	writel (AT91_SPI_NCPHA
> > +		| AT91_SPI_BITS_8
> > +		| ((AT91C_MASTER_CLOCK / 10000000) << 8),
> > +		AT91_BASE_SPI + AT91_SPI_CSR (3));
> > +
> > +	/* set shift registers */
> > +	shreg_wr(0xfe, 0x30);
> why?

To configure state of leds and outputs behind the shift register. I'll
add some comments (and modify to use the present spi interface).

> > +}
> > +
> 
> > +
> > +#ifdef CONFIG_RESET_PHY_R
> please create a phy driver

Ok.

> > diff --git a/board/embedtronics/mrfsa/partition.c b/board/embedtronics/mrfsa/partition.c

[snip]

> > +AT91S_DATAFLASH_INFO dataflash_info[CONFIG_SYS_MAX_DATAFLASH_BANKS];
> > +
> > +struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS] = {
> > +	{CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress,
> CS */
> > +	{CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1, 1}
> > +};
> > +
> > +/*define the area offsets*/
> > +dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
> > +	{0x00000000, 0x000041FF, FLAG_PROTECT_CLEAR /*SET*/, 0, "Bootstrap"},
> > +	{0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"},
> > +	{0x00008400, 0x00041FFF, FLAG_PROTECT_CLEAR /*SET*/, 0, "U-Boot"},
> > +	{0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR, 0, "Kernel"},
> > +	{0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR, 0, "FS"},
> > +};
> NACK the DATAFLASH driver is deprecated please use spi flash framework

Ok.

> > diff --git a/board/embedtronics/mrfsa/watchdog.c b/board/embedtronics/mrfsa/watchdog.c
> > +
> > +/*
> > + * MRFSA board level hardware watchdog.
> > + */
> why don't you use the generic watch dog driver?

We've external watchdog chip (CAT1023 or so) because Atmel had/has bug in
boot code that disabled the internal watchdog..

> > diff --git a/common/console.c b/common/console.c
> > index 867c12c..fb6e409 100644
> > --- a/common/console.c
> > +++ b/common/console.c
> > @@ -311,6 +311,12 @@ int getc(void)
> >  
> >  int tstc(void)
> >  {
> > +#ifdef  CONFIG_HW_WATCHDOG
> > +	hw_watchdog_reset();
> > +#endif
> > +#ifdef  CONFIG_WATCHDOG
> > +	watchdog_reset();
> > +#endif
> why?

Well, the CAT1023 (watchdog chip) requires to be signaled quite often
and at least older version of U-boot (used v1.3.4 originally) did not
meet that requirement (at least under boot delay and maybe some other
cases).

> >  #ifdef CONFIG_DISABLE_CONSOLE
> >  	if (gd->flags & GD_FLG_DISABLE_CONSOLE)
> >  		return 0;
> > diff --git a/cpu/arm926ejs/at91/timer.c b/cpu/arm926ejs/at91/timer.c
> > index 811bb3c..03fce54 100644
> > --- a/cpu/arm926ejs/at91/timer.c
> > +++ b/cpu/arm926ejs/at91/timer.c
> > @@ -83,7 +83,12 @@ int timer_init(void)
> >  unsigned long long get_ticks(void)
> >  {
> >  	ulong now = READ_TIMER;
> > -
> > +#ifdef  CONFIG_HW_WATCHDOG
> > +	hw_watchdog_reset();
> > +#endif
> > +#ifdef  CONFIG_WATCHDOG
> > +	watchdog_reset();
> > +#endif
> why?

Quite the same reason as above.. Can't remember the exact case anymore
but some loops (that used timeouts but did not use tstc() directly or
indrectly) were too long for watchdog.

> Best Regards,
> J.

Thank you for comments. I'll fix things and post a new patch..


      -sk


More information about the U-Boot mailing list