Skip to contentSkip to conversation

csb337 board support (ARM at91rm9200)

PATCH New David Brownell 3 participants 7 messages Jun 12, 2009 – Jul 10, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 csb337 board support (ARM at91rm9200)

Add support for csb337, an older at91rm9200 board. These boards originally shipped with MicroMonitor, not U-Boot. This config supports boot from Ethernet, and talks over I2C and console.

Open issues:
- Console refuses to start at 115200 baud, and misbehaves if it's later changed to that speed. So, use 38400 (like MicroMonitor).

- USB didn't work; the software wouldn't detect usb-storage devices. So it's not yet enabled.

- There seems to be some issue copying lots of data from NOR flash. It works OK in chunks of up to 512 KB or so, but copying a kernel (1.4 MB) failed ... copying *way* over 15 MBytes, and trashing the DRAM image of U-Boot that was running. (Compiler issue?)

Sending this along anyway; it basically works, bugs can be fixed later.

---
NOTE: depends on cpu/arm920t/at91rm9200/ether.c patch to change how the Ethernet address is stored in chip registers so it matches the old MicroMonitor bug that Linux is working around.

 MAKEALL                  |    1 
 Makefile                 |    3 
 board/csb337/Makefile    |   49 +++++++++
 board/csb337/config.mk   |    1 
 board/csb337/csb337.c    |   74 +++++++++++++++
 board/csb337/u-boot.lds  |   56 +++++++++++
 include/configs/csb337.h |  222 +++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 406 insertions(+)
MAKEALL +1 -0
@@ -579,6 +579,7 @@ LIST_at91="		\
 	at91sam9g20ek	\
 	at91sam9rlek	\
 	cmc_pu2		\
+	csb337		\
 	csb637		\
 	kb9202		\
 	mp2usb		\
Makefile +3 -0
@@ -2638,6 +2638,9 @@ at91rm9200ek_config	:	unconfig
 cmc_pu2_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t cmc_pu2 NULL at91rm9200
 
+csb337_config	:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm920t csb337 NULL at91rm9200
+
 csb637_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t csb637 NULL at91rm9200
 
board/csb337/Makefile new file +49 -0

49 lines not on this page · raw message

board/csb337/config.mk new file +1 -0
@@ -0,0 +1 @@
+TEXT_BASE = 0x21f00000
board/csb337/csb337.c new file +74 -0

74 lines not on this page · raw message

board/csb337/u-boot.lds new file +56 -0

56 lines not on this page · raw message

include/configs/csb337.h new file +222 -0

222 lines not on this page · raw message

#1 lore raw

PATCH 1/1 csb337 board support (ARM at91rm9200)

Quoted 7 lines · David Brownell

Add support for csb337, an older at91rm9200 board. These boards originally shipped with MicroMonitor, not U-Boot. This config supports boot from Ethernet, and talks over I2C and console.

Open issues:
- Console refuses to start at 115200 baud, and misbehaves if it's later changed to that speed. So, use 38400 (like MicroMonitor).

A co-worker report me the same problem for the csb637 under uMON after trying U-Boot it's work fine
I think there is a problem in the clock configuration I'll take a look later

Quoted 3 lines

- USB didn't work; the software wouldn't detect usb-storage devices. So it's not yet enabled.

what is the power on the USB?

Quoted 5 lines

- There seems to be some issue copying lots of data from NOR flash. It works OK in chunks of up to 512 KB or so, but copying a kernel (1.4 MB) failed ... copying *way* over 15 MBytes, and trashing the DRAM image of U-Boot that was running. (Compiler issue?)

Clock issue ot RAM timing issue

Quoted 9 lines

Sending this along anyway; it basically works, bugs can be fixed later.

---
NOTE: depends on cpu/arm920t/at91rm9200/ether.c patch to change how the Ethernet address is stored in chip registers so it matches the old MicroMonitor bug that Linux is working around.

MAINTAINER entry missing

Quoted 6 lines
 MAKEALL                  |    1 
 Makefile                 |    3 
 board/csb337/Makefile    |   49 +++++++++
 board/csb337/config.mk   |    1 
 board/csb337/csb337.c    |   74 +++++++++++++++
 board/csb337/u-boot.lds  |   56 +++++++++++

no need please remove

Quoted 25 lines
 include/configs/csb337.h |  222 +++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 406 insertions(+)
MAKEALL +1 -0
@@ -579,6 +579,7 @@ LIST_at91="		\
 	at91sam9g20ek	\
 	at91sam9rlek	\
 	cmc_pu2		\
+	csb337		\
 	csb637		\
 	kb9202		\
 	mp2usb		\
Makefile +3 -0
@@ -2638,6 +2638,9 @@ at91rm9200ek_config	:	unconfig
 cmc_pu2_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t cmc_pu2 NULL at91rm9200
 
+csb337_config	:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm920t csb337 NULL at91rm9200
+
 csb637_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t csb637 NULL at91rm9200
 

<snip>

Makefile

Quoted 8 lines
Makefile +8 -0
+
+#include <common.h>
+#include <asm/arch/AT91RM9200.h>
+#include <at91rm9200_net.h>
+#include <lxt971a.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+

please remove the blank ine

Makefile

Quoted 5 lines
Makefile +5 -0
+
+int board_init(void)
+{
+	/* Enable Ctrlc */
+	console_init_f();

no need

Quoted 5 lines
Makefile +5 -0
+
+	gd->bd->bi_arch_number = MACH_TYPE_CSB337;
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	return 0;

Makefile

Quoted 10 lines
Makefile +10 -0
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}
+
+#if defined(CONFIG_DRIVER_ETHER) && defined(CONFIG_CMD_NET)

it will be better ot manage this in the config header

Makefile

Quoted 9 lines
Makefile +9 -0
+
+/* The AT91 lxt972 glue modified the original lxt971 code by
+ * changing names and generalizing a bit.  So we use "lxt972"
+ * names here even though the CSB337 has an lxt971 chip.
+ */
+extern unsigned char lxt972_InitPhy(AT91S_EMAC *mac);
+extern unsigned lxt972_IsPhyConnected(AT91S_EMAC *mac);
+extern unsigned char lxt972_GetLinkSpeed(AT91S_EMAC *mac);
+extern unsigned char lxt972_AutoNegotiate(AT91S_EMAC *mac, int *status);

:(
please a header

Quoted 39 lines
Makefile +37 -0
+
+void at91rm9200_GetPhyInterface(AT91S_PhyOps *ops)
+{
+	ops->Init = lxt972_InitPhy;
+	ops->IsPhyConnected = lxt972_IsPhyConnected;
+	ops->GetLinkSpeed = lxt972_GetLinkSpeed;
+	ops->AutoNegotiate = lxt972_AutoNegotiate;
+}
+
+#endif
 
+++ b/include/configs/csb337.h
@@ -0,0 +1,222 @@
+/*
+ * (C) Copyright 2005 REA Elektronik GmbH <www.rea.de>
+ * Anders Larsen <[email protected]>
+ *
+ * Configuation settings for the Cogent CSB337 board.
+ * Modified from CSB637 settings.
+ *
+ * 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
+ */
+

Makefile line 36

Quoted 10 lines
Makefile +10 -0
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/sizes.h>
+
+/* CSB337 board from Cogent */
+#define CONFIG_MACH_CSB337
+#define CONFIG_AT91RM9200
+
+//#define CONFIG_SKIP_LOWLEVEL_INIT

if no need please remove

Quoted 95 lines
Makefile +95 -0
+
+#define AT91_SLOW_CLOCK		32768		/* slow clock crystal */
+#define AT91_MAIN_CLOCK		3686400		/* 3.6864 MHz crystal */
+
+#define CONFIG_SYS_USE_MAIN_OSCILLATOR
+
+/* default timings shipped by Cogent (PLLA --> MCK):
+ *  184.32 MHz for CPU (PLLA)
+ *   46.08 MHz for memory and peripherals (PLL/4)
+ *   96.00 MHz for USB (PLLB)
+ */
+#define AT91_PLLA_DIV		1
+#define AT91_PLLA_MULT		50
+#define AT91_PLLA_CLOCK	((AT91_MAIN_CLOCK / AT91_PLLA_DIV) * AT91_PLLA_MULT)
+
+#define AT91_PLLB_DIV		24
+#define AT91_PLLB_MULT		625
+#define AT91_PLLB_CLOCK	((AT91_MAIN_CLOCK / AT91_PLLB_DIV) * AT91_PLLB_MULT)
+
+#define AT91C_MASTER_CLOCK	(AT91_PLLA_CLOCK / 4)
+
+#define CONFIG_SYS_HZ		1000
+
+/* NOTE:  uses TC0, not system timer. */
+#define CONFIG_SYS_HZ_CLOCK	(AT91C_MASTER_CLOCK / 2)
+
+/* clocks */
+#if 0	/* can't use this from startup.S, sigh */
+#define CONFIG_SYS_PLLAR_VAL \
+	( AT91C_CKGR_SRCA | AT91C_CKGR_OUTA_2 | (0x3e << 8) \
+	| ((AT91_PLLA_MULT - 1) << 16) | (AT91_PLLA_DIV << 0))
+#define CONFIG_SYS_PLLBR_VAL \
+	( AT91C_CKGR_USB_PLL | AT91C_CKGR_OUTB_0 | (0x3e << 8) \
+	| ((AT91_PLLB_MULT - 1) << 16) | (AT91_PLLB_DIV << 0))
+#define CONFIG_SYS_MCKR_VAL \
+	(AT91C_PMC_MDIV_4 | AT91C_PMC_CSS_PLLA_CLK)
+#else
+#define CONFIG_SYS_PLLAR_VAL	0x20313e01	/* 184.32 MHz */
+#define CONFIG_SYS_PLLBR_VAL	0x12703e18	/* 96.00 MHz (+div2) */
+#define CONFIG_SYS_MCKR_VAL	0x00000302	/* 46.00 MHz */
+#endif
+
+#define CONFIG_SYS_MC_PUIA_VAL	0x00000000	/* NOTE:  RESERVED ADDR! */
+#define CONFIG_SYS_MC_PUP_VAL	0x00000000	/* NOTE:  RESERVED ADDR! */
+#define CONFIG_SYS_MC_PUER_VAL	0x00000000	/* NOTE:  RESERVED ADDR! */
+#define CONFIG_SYS_MC_ASR_VAL	0x00000000	/* NOTE:  READ-ONLY REG! */
+#define CONFIG_SYS_MC_AASR_VAL	0x00000000	/* NOTE:  READ-ONLY REG! */
+
+/* 32 bit bus */
+#define CONFIG_SYS_EBI_CSA_VAL	0x00000002	/* CS0=SMC, CS1=SDRAM */
+#define CONFIG_SYS_EBI_CFGR_VAL	0x00000000	/* internal d15..d0 pullups */
+#define CONFIG_SYS_PIOC_ASR_VAL	0Xffff0000	/* pc31..pc16 are d31..d16 */
+#define CONFIG_SYS_PIOC_BSR_VAL	0x00000000
+#define CONFIG_SYS_PIOC_PDR_VAL	0xffff0000	/* internal d31..d16 pullups */
+
+/* CS0 == 16 bit flash */
+#define CONFIG_SYS_SMC_CSR0_VAL	0x1100328b	/* 16 bit, 2 TDF, 10 WS */
+
+/* CS1 == 32 bit SDRAM; timings are a function of the master clock speed */
+#define CONFIG_SYS_SDRC_CR_VAL	0x2188b0d5	/* SDRAM timings */
+#define CONFIG_SYS_SDRC_TR_VAL	0x00000200	/* Write refresh rate */
+
+/* except maybe for SDRAM1, none of these are board-specic */
+#define CONFIG_SYS_SDRAM	0x20000000	/* address of SDRAM */
+#define CONFIG_SYS_SDRAM1	0x20000080	/* address of SDRAM + mode register value */
+#define CONFIG_SYS_SDRAM_VAL	0x00000000	/* scratch value written to SDRAM */
+#define CONFIG_SYS_SDRC_MR_VAL	0x00000002	/* Precharge All */
+#define CONFIG_SYS_SDRC_MR_VAL1	0x00000004	/* refresh */
+#define CONFIG_SYS_SDRC_MR_VAL2	0x00000003	/* Load Mode Register */
+#define CONFIG_SYS_SDRC_MR_VAL3	0x00000000	/* Normal Mode */
+
+/* define one of CONFIG_{DBGU,USART0,USART1} for console */
+#define CONFIG_AT91RM9200_USART
+#define CONFIG_DBGU
+
+#define CONFIG_BAUDRATE			38400
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200, 57600, 38400, 19200, 9600,}
+
+/* RAM info */
+#define CONFIG_NR_DRAM_BANKS 1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			SZ_32M
+
+/* NOR flash (boot device) */
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_SYS_FLASH_CFI
+#define CONFIG_SYS_FLASH_EMPTY_INFO
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
+
+/* NOR FLASH - one 28F640J03A, 16 bits */
+#define PHYS_FLASH_SIZE			SZ_8M
+#define CONFIG_SYS_FLASH_BASE		0x10000000
+#define CONFIG_SYS_FLASH_CFI_WIDTH      FLASH_CFI_16BIT
+#define CONFIG_SYS_FLASH_PROTECTION	1	/* hardware protection	*/
+#define CONFIG_SYS_MAX_FLASH_BANKS	1

Makefile line 141

Quoted 10 lines
Makefile +10 -0
+#define CONFIG_SYS_MAX_FLASH_SECT	64
+
+#define NOR_SECTOR_SIZE			SZ_128K
+
+#define CONFIG_MTD_PARTITIONS
+
+/* Ethernet, using full MII */
+#define CONFIG_DRIVER_ETHER
+
+#if 0

please
if CONFIG_CMD_USB

Quoted 13 lines
Makefile +13 -0
+/* REVISIT:  USB failed to enumerate devices of any kind ... sw issues */
+
+/* allow loading from USB media */
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
+#define CONFIG_SYS_USB_OHCI_REGS_BASE		AT91_USB_HOST_BASE
+#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"at91-ohci"
+#define CONFIG_USB_STORAGE
+#endif
+
+/* I2C, RTC */
+#define CONFIG_HARD_I2C
+#define CONFIG_SYS_I2C_SPEED	100000

Makefile line 164

Quoted 10 lines
Makefile +10 -0
+#define CONFIG_SYS_I2C_SLAVE	0x08		/* SMBus host address */
+
+#define CONFIG_RTC_DS1307
+
+/* basic commands; and ones that need driver support */
+#include <config_cmd_default.h>
+
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_XIMG

Best Regards,
J.

#2 lore raw

PATCH 1/1 csb337 board support (ARM at91rm9200)

Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · David Brownell

Add support for csb337, an older at91rm9200 board. These boards originally shipped with MicroMonitor, not U-Boot. This config supports boot from Ethernet, and talks over I2C and console.

Quoted 8 lines
Quoted 3 lines

Open issues:
- Console refuses to start at 115200 baud, and misbehaves if it's later changed to that speed. So, use 38400 (like MicroMonitor).

A co-worker report me the same problem for the csb637 under uMON after trying U-Boot it's work fine
I think there is a problem in the clock configuration I'll take a look later

Hmm, could be. This replicates the original clock settings and DRAM timings. DRAM is underclocked -- could be another 20 MHz faster or so (use divide-by-3 not divide-by-4). But changing that would mean re-computing *all* memory timings.

And I don't think I have copies of that old Strataflash stuff any more...

Quoted 4 lines
Quoted 2 lines

- USB didn't work; the software wouldn't detect usb-storage devices. So it's not yet enabled.

what is the power on the USB?

I don't understand the question. 5V of course. Not switchable.

Quoted 6 lines
Quoted 4 lines

- There seems to be some issue copying lots of data from NOR flash. It works OK in chunks of up to 512 KB or so, but copying a kernel (1.4 MB) failed ... copying *way* over 15 MBytes, and trashing the DRAM image of U-Boot that was running. (Compiler issue?)

Clock issue ot RAM timing issue

Doesn't quite make sense. Something clobbered a termination condition, which would be in a register, or at worst in cache.

How would RAM timing cause breakage? The data copied was correct, in smaller chunks, and the termination condition wasn't stored in RAM. Or a clock issue, considering all the relevant cycles are inside the arm920t core?

I like the "compiler issue" theory better. :(

Quoted 3 lines
Quoted 1 line
 board/csb337/u-boot.lds  |   56 +++++++++++

no need please remove

In mainline u-boot it seems to be needed. Can you maybe push your first set of patches to Wolfgang, which consolidate all that stuff?

Quoted 2 lines
Quoted 1 line

+#if defined(CONFIG_DRIVER_ETHER) && defined(CONFIG_CMD_NET)

it will be better ot manage this in the config header

You mean by defining an otherwise needless symbol, along the lines of CONFIG_SYS_AT91RM9200_LXT_PHY?

Probably simpler just always include those few lines, and not support building without Ethernet.

Quoted 11 lines

board/csb337/csb337.c line 64

Quoted 9 lines
board/csb337/csb337.c new file +9 -0
+
+/* The AT91 lxt972 glue modified the original lxt971 code by
+ * changing names and generalizing a bit.  So we use "lxt972"
+ * names here even though the CSB337 has an lxt971 chip.
+ */
+extern unsigned char lxt972_InitPhy(AT91S_EMAC *mac);
+extern unsigned lxt972_IsPhyConnected(AT91S_EMAC *mac);
+extern unsigned char lxt972_GetLinkSpeed(AT91S_EMAC *mac);
+extern unsigned char lxt972_AutoNegotiate(AT91S_EMAC *mac, int *status);

:(
please a header

I'll stick it in hardware.h ... you can remove similar decls from other rm9200 boards then.

Quoted 5 lines

include/configs/csb337.h line 141

Quoted 2 lines
include/configs/csb337.h new file +2 -0
+
+#if 0

please
if CONFIG_CMD_USB

Quoted 1 line

+/* REVISIT: USB failed to enumerate devices of any kind ... sw issues */

An #if 0 won't work without completely re-whacking things.

Right now the commands kick in *MUCH LATER* depending on whether the driver is available. And here, the driver (CONFIG_USB_OHCI_NEW driver) and its support is disabled since it's not working...

Quoted 10 lines
Quoted 10 lines
include/configs/csb337.h new file +10 -0
+
+/* allow loading from USB media */
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
+#define CONFIG_SYS_USB_OHCI_REGS_BASE		AT91_USB_HOST_BASE
+#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"at91-ohci"
+#define CONFIG_USB_STORAGE
+#endif
+
+/* I2C, RTC */
Quoted 8 lines

include/configs/csb337.h line 160

Quoted 8 lines
include/configs/csb337.h new file +8 -0
+#define CONFIG_HARD_I2C
+#define CONFIG_SYS_I2C_SPEED	100000
+#define CONFIG_SYS_I2C_SLAVE	0x08		/* SMBus host address */
+
+#define CONFIG_RTC_DS1307
+
+/* basic commands; and ones that need driver support */
+#include <config_cmd_default.h>

... and commands get configured starting here.

#3 lore raw

PATCH 1/1 csb337 board support (ARM at91rm9200)

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

- USB didn't work; the software wouldn't detect usb-storage devices. So it's not yet enabled.

what is the power on the USB?

I don't understand the question. 5V of course. Not switchable.

is the usb provide enough power to supply the usb key

Quoted 20 lines
Quoted 8 lines
Quoted 6 lines

- There seems to be some issue copying lots of data from NOR flash. It works OK in chunks of up to 512 KB or so, but copying a kernel (1.4 MB) failed ... copying *way* over 15 MBytes, and trashing the DRAM image of U-Boot that was running. (Compiler issue?)

Clock issue ot RAM timing issue

Doesn't quite make sense. Something clobbered a termination condition, which would be in a register, or at worst in cache.

How would RAM timing cause breakage? The data copied was correct, in smaller chunks, and the termination condition wasn't stored in RAM. Or a clock issue, considering all the relevant cycles are inside the arm920t core?

I like the "compiler issue" theory better. :(

Quoted 7 lines
Quoted 3 lines
Quoted 1 line
 board/csb337/u-boot.lds  |   56 +++++++++++

no need please remove

In mainline u-boot it seems to be needed. Can you maybe push your first set of patches to Wolfgang, which consolidate all that stuff?

the arm work need to be based on u-boot-arm tree

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

+#if defined(CONFIG_DRIVER_ETHER) && defined(CONFIG_CMD_NET)

it will be better ot manage this in the config header

You mean by defining an otherwise needless symbol, along the lines of CONFIG_SYS_AT91RM9200_LXT_PHY?

CONFIG_DRIVER_EHTER will be enough

Quoted 17 lines

Probably simpler just always include those few lines, and not support building without Ethernet.

Quoted 11 lines

board/csb337/csb337.c line 64

Quoted 9 lines
board/csb337/csb337.c new file +9 -0
+
+/* The AT91 lxt972 glue modified the original lxt971 code by
+ * changing names and generalizing a bit.  So we use "lxt972"
+ * names here even though the CSB337 has an lxt971 chip.
+ */
+extern unsigned char lxt972_InitPhy(AT91S_EMAC *mac);
+extern unsigned lxt972_IsPhyConnected(AT91S_EMAC *mac);
+extern unsigned char lxt972_GetLinkSpeed(AT91S_EMAC *mac);
+extern unsigned char lxt972_AutoNegotiate(AT91S_EMAC *mac, int *status);

:(
please a header

Quoted 2 lines

I'll stick it in hardware.h ... you can remove similar decls from other rm9200 boards then.

a phy header will be better IMHO

Quoted 5 lines
Quoted 5 lines

include/configs/csb337.h line 141

Quoted 3 lines
include/configs/csb337.h new file +2 -0
+
+#if 0

please
if CONFIG_CMD_USB

Quoted 8 lines
Quoted 1 line
Quoted 1 line

+/* REVISIT: USB failed to enumerate devices of any kind ... sw issues */

An #if 0 won't work without completely re-whacking things.

Right now the commands kick in *MUCH LATER* depending on whether the driver is available. And here, the driver (CONFIG_USB_OHCI_NEW driver) and its support is disabled since it's not working...

so move it

Best Regards,
J.

#4 lore raw

PATCH 1/1 csb337 board support (ARM at91rm9200)

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

- USB didn't work; the software wouldn't detect usb-storage devices. So it's not yet enabled.

what is the power on the USB?

I don't understand the question. 5V of course. Not switchable.

is the usb provide enough power to supply the usb key

Well all the devices run on Linux just fine. Two were flash devices, one was an honest-to-gosh 200 MByte disk.

So it's fairly clear the issue relates to OHCI support in u-boot, perhaps specific to the rm9200. Not hardware.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

+#if 0

please
if CONFIG_CMD_USB

Quoted 1 line

+/* REVISIT: USB failed to enumerate devices of any kind ... sw issues */

Quoted 7 lines
Quoted 6 lines

An #if 0 won't work without completely re-whacking things.

Right now the commands kick in *MUCH LATER* depending on whether the driver is available. And here, the driver (CONFIG_USB_OHCI_NEW driver) and its support is disabled since it's not working...

so move it

That's what we call "way too much work". It involves completely restructuring things ... so that instead of enabling commands based on driver support (which may not be viable) it enables drivers (which may not work) based on commands (which should never have been enabled unless the relevant driver works).

#5 lore raw

PATCH 1/1 csb337 board support (ARM at91rm9200)

Quoted 8 lines · David Brownell
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

- USB didn't work; the software wouldn't detect usb-storage devices. So it's not yet enabled.

what is the power on the USB?

I don't understand the question. 5V of course. Not switchable.

Quoted 7 lines
Quoted 1 line

is the usb provide enough power to supply the usb key

Well all the devices run on Linux just fine. Two were flash devices, one was an honest-to-gosh 200 MByte disk.

So it's fairly clear the issue relates to OHCI support in u-boot, perhaps specific to the rm9200. Not hardware.

IIRC it's work on my rm9200ek

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 6 lines
Quoted 3 lines

+#if 0

please
if CONFIG_CMD_USB

Quoted 1 line

+/* REVISIT: USB failed to enumerate devices of any kind ... sw issues */

An #if 0 won't work without completely re-whacking things.

Right now the commands kick in *MUCH LATER* depending on whether the driver is available. And here, the driver (CONFIG_USB_OHCI_NEW driver) and its support is disabled since it's not working...

Quoted 8 lines
Quoted 1 line

so move it

That's what we call "way too much work". It involves completely restructuring things ... so that instead of enabling commands based on driver support (which may not be viable) it enables drivers (which may not work) based on commands (which should never have been enabled unless the relevant driver works).

so remove it until it will work

Best Regards,
J.

#6 lore raw

PATCH 1/1 csb337 board support (ARM at91rm9200)

In reply to David Brownell

Dear David Brownell,

Quoted 24 lines · In message <[email protected]> you wrote:

Add support for csb337, an older at91rm9200 board. These boards originally shipped with MicroMonitor, not U-Boot. This config supports boot from Ethernet, and talks over I2C and console.

Open issues:
- Console refuses to start at 115200 baud, and misbehaves if it's later changed to that speed. So, use 38400 (like MicroMonitor).

- USB didn't work; the software wouldn't detect usb-storage devices. So it's not yet enabled.

- There seems to be some issue copying lots of data from NOR flash. It works OK in chunks of up to 512 KB or so, but copying a kernel (1.4 MB) failed ... copying *way* over 15 MBytes, and trashing the DRAM image of U-Boot that was running. (Compiler issue?)

Sending this along anyway; it basically works, bugs can be fixed later.

---
NOTE: depends on cpu/arm920t/at91rm9200/ether.c patch to change how the Ethernet address is stored in chip registers so it matches the old MicroMonitor bug that Linux is working around.

Quoted 8 lines
 MAKEALL                  |    1 
 Makefile                 |    3 
 board/csb337/Makefile    |   49 +++++++++
 board/csb337/config.mk   |    1 
 board/csb337/csb337.c    |   74 +++++++++++++++
 board/csb337/u-boot.lds  |   56 +++++++++++
 include/configs/csb337.h |  222 +++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 406 insertions(+)

Entry to MAINTAINERS missing.

Quoted 24 lines
MAKEALL +1 -0
@@ -579,6 +579,7 @@ LIST_at91="		\
 	at91sam9g20ek	\
 	at91sam9rlek	\
 	cmc_pu2		\
+	csb337		\
 	csb637		\
 	kb9202		\
 	mp2usb		\
Makefile +3 -0
@@ -2638,6 +2638,9 @@ at91rm9200ek_config	:	unconfig
 cmc_pu2_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t cmc_pu2 NULL at91rm9200
 
+csb337_config	:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm920t csb337 NULL at91rm9200
+
 csb637_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t csb637 NULL at91rm9200
 
board/csb337/Makefile new file +0 -0

...

board/csb337/Makefile line 49

Quoted 7 lines
board/csb337/Makefile new file +7 -0
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+

Please don't add trailing empty lines.

Quoted 2 lines
board/csb337/csb337.c new file +0 -0

...

board/csb337/csb337.c line 36

Quoted 8 lines
board/csb337/csb337.c new file +8 -0
+#include <common.h>
+#include <asm/arch/AT91RM9200.h>
+#include <at91rm9200_net.h>
+#include <lxt971a.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+

Only one blank line here.

board/csb337/csb337.c line 53

Quoted 6 lines
board/csb337/csb337.c new file +6 -0
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}

How about using get_ram_size() to auto-detect the size and test the memory?

board/csb337/csb337.c line 64

Quoted 10 lines
board/csb337/csb337.c new file +10 -0
+#if defined(CONFIG_DRIVER_ETHER) && defined(CONFIG_CMD_NET)
+
+/* The AT91 lxt972 glue modified the original lxt971 code by
+ * changing names and generalizing a bit.  So we use "lxt972"
+ * names here even though the CSB337 has an lxt971 chip.
+ */
+extern unsigned char lxt972_InitPhy(AT91S_EMAC *mac);
+extern unsigned lxt972_IsPhyConnected(AT91S_EMAC *mac);
+extern unsigned char lxt972_GetLinkSpeed(AT91S_EMAC *mac);
+extern unsigned char lxt972_AutoNegotiate(AT91S_EMAC *mac, int *status);

Move prototypes to some header file, please.

Quoted 2 lines
include/configs/csb337.h new file +0 -0

...

Quoted 5 lines

+/* default timings shipped by Cogent (PLLA --> MCK):
+ * 184.32 MHz for CPU (PLLA)
+ * 46.08 MHz for memory and peripherals (PLL/4)
+ * 96.00 MHz for USB (PLLB)
+ */

Incorrect multiline comment style.

include/configs/csb337.h line 73

Quoted 10 lines
include/configs/csb337.h new file +10 -0
+#if 0	/* can't use this from startup.S, sigh */
+#define CONFIG_SYS_PLLAR_VAL \
+	( AT91C_CKGR_SRCA | AT91C_CKGR_OUTA_2 | (0x3e << 8) \
+	| ((AT91_PLLA_MULT - 1) << 16) | (AT91_PLLA_DIV << 0))
+#define CONFIG_SYS_PLLBR_VAL \
+	( AT91C_CKGR_USB_PLL | AT91C_CKGR_OUTB_0 | (0x3e << 8) \
+	| ((AT91_PLLB_MULT - 1) << 16) | (AT91_PLLB_DIV << 0))
+#define CONFIG_SYS_MCKR_VAL \
+	(AT91C_PMC_MDIV_4 | AT91C_PMC_CSS_PLLA_CLK)
+#else

Please do not add dead code.

...

include/configs/csb337.h line 101

Quoted 3 lines
include/configs/csb337.h new file +3 -0
+/* except maybe for SDRAM1, none of these are board-specic */
+#define CONFIG_SYS_SDRAM	0x20000000	/* address of SDRAM */
+#define CONFIG_SYS_SDRAM1	0x20000080	/* address of SDRAM + mode register value */

Line too long. (Please check globally).

include/configs/csb337.h line 150

Quoted 10 lines
include/configs/csb337.h new file +10 -0
+#if 0
+/* REVISIT:  USB failed to enumerate devices of any kind ... sw issues */
+
+/* allow loading from USB media */
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
+#define CONFIG_SYS_USB_OHCI_REGS_BASE		AT91_USB_HOST_BASE
+#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"at91-ohci"
+#define CONFIG_USB_STORAGE
+#endif

Please do not add dead code.

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
Until you walk a mile in another man's moccasins, you  can't  imagine
the smell.