[U-Boot-Users] [PATCH 0/4] Some patches for the TQM885D board

The following series implements some patches and updates for the TQM885D board.

After the patch from Markus Klotzbuecher (Bugfix in FEC initialisation from 12. July 2006) FEC2 on the TQM885D board is not working after boot. Only after a 'mii info' command FEC2 could be used. The reason for this is that the PHY for FEC2 is not recognized properly.
This patch changes the TQM885D configuration from automatic PHY detection to predefined (fix) PHY types. With this FEC2 (and FEC + SCC) works without problems.
Signed-off-by: Martin Kraues martin.krause@tqs.de ---
include/configs/TQM885D.h | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/include/configs/TQM885D.h b/include/configs/TQM885D.h index d470ade..8bbac4c 100644 --- a/include/configs/TQM885D.h +++ b/include/configs/TQM885D.h @@ -479,7 +479,15 @@ #define CONFIG_ETHER_ON_FEC2 /* ... for FEC2 */
#if (CONFIG_COMMANDS & CFG_CMD_MII) -#define CFG_DISCOVER_PHY +/* + * The used PHYs are defined by fix values, because the automatic PHY + * detection (over #define CFG_DISCOVER_PHY) does not work properly. The + * reason for this is unknown. Maybe it has somthing to do with the fact, that + * the TQM885D has two PHYs and not only one. + */ +#define PHY_ID_LXT971 0x001378e0 /* LXT971 and 972 */ +#define CONFIG_FEC1_PHY PHY_ID_LXT971 +#define CONFIG_FEC2_PHY PHY_ID_LXT971 #endif
#define CONFIG_NET_RETRY_COUNT 1 /* reduce max. timeout before

In message 20070724085834.20151.98087.stgit@tq-sewsrv-4.tq-net.de you wrote:
After the patch from Markus Klotzbuecher (Bugfix in FEC initialisation from 12. July 2006) FEC2 on the TQM885D board is not working after boot. Only after a 'mii info' command FEC2 could be used. The reason for this is that the PHY for FEC2 is not recognized properly.
Do you know why this is a problem?
This patch changes the TQM885D configuration from automatic PHY detection to predefined (fix) PHY types. With this FEC2 (and FEC + SCC) works without problems.
I understand that you want to have a running system with as little effort as possible, but it seems to me that automatic PHY detection should work as well. If it does not, we should address this issue rather than work around it...
Best regards,
Wolfgang Denk

Signed-off-by: Martin Krause martin.krause@tqs.de ---
board/tqm8xx/tqm8xx.c | 4 ++-- include/common.h | 9 +++++---- include/commproc.h | 4 ---- include/configs/TQM885D.h | 20 +++++++++++++------- 4 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/board/tqm8xx/tqm8xx.c b/board/tqm8xx/tqm8xx.c index 6b206f8..ed1d692 100644 --- a/board/tqm8xx/tqm8xx.c +++ b/board/tqm8xx/tqm8xx.c @@ -183,7 +183,7 @@ long int initdram (int board_type) #ifndef CONFIG_CAN_DRIVER if ((board_type != 'L') && (board_type != 'M') && - (board_type != 'D') ) { /* "L" and "M" type boards have only one bank SDRAM */ + (board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */ memctl->memc_or3 = CFG_OR3_PRELIM; memctl->memc_br3 = CFG_BR3_PRELIM; } @@ -259,7 +259,7 @@ long int initdram (int board_type) #ifndef CONFIG_CAN_DRIVER if ((board_type != 'L') && (board_type != 'M') && - (board_type != 'D') ) { /* "L" and "M" type boards have only one bank SDRAM */ + (board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */ /* * Check Bank 1 Memory Size * use current column settings diff --git a/include/common.h b/include/common.h index 23f9390..a17f1ac 100644 --- a/include/common.h +++ b/include/common.h @@ -126,20 +126,21 @@ typedef void (interrupt_handler_t)(void *);
/* * enable common handling for all TQM8xxL/M boards: - * - CONFIG_TQM8xxM will be defined for all TQM8xxM and TQM885D boards + * - CONFIG_TQM8xxM will be defined for all TQM8xxM * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards + * and for the TQM885D board */ #if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \ defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \ - defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M) || \ - defined(CONFIG_TQM885D) + defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M) # ifndef CONFIG_TQM8xxM # define CONFIG_TQM8xxM # endif #endif #if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \ defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \ - defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) + defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) || \ + defined(CONFIG_TQM885D) # ifndef CONFIG_TQM8xxL # define CONFIG_TQM8xxL # endif diff --git a/include/commproc.h b/include/commproc.h index 12400e3..8cb2986 100644 --- a/include/commproc.h +++ b/include/commproc.h @@ -1440,10 +1440,6 @@ typedef struct scc_enet { #define SICR_ENET_MASK ((uint)0x0000ff00) #define SICR_ENET_CLKRT ((uint)0x00002600)
-# ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */ -#define FEC_ENET -# endif /* CONFIG_FEC_ENET */ - #endif /* CONFIG_MVS v1, CONFIG_TQM823L/M, CONFIG_TQM850L/M, etc. */
/*** TQM855L/M, TQM860L/M, TQM862L/M, TQM866L/M *********************/ diff --git a/include/configs/TQM885D.h b/include/configs/TQM885D.h index 8bbac4c..17b2070 100644 --- a/include/configs/TQM885D.h +++ b/include/configs/TQM885D.h @@ -84,8 +84,13 @@ "net_nfs=tftp 200000 ${bootfile};run nfsargs addip;bootm\0" \ "rootpath=/opt/eldk/ppc_8xx\0" \ "bootfile=/tftpboot/TQM866M/uImage\0" \ - "kernel_addr=40080000\0" \ - "ramdisk_addr=40180000\0" \ + "kernel_addr=400C0000\0" \ + "ramdisk_addr=401C0000\0" \ + "load=tftp 200000 ${u-boot}\0" \ + "update=protect off 40000000 4003FFFF;" \ + "erase 40000000 4003FFFF;" \ + "cp.b 200000 40000000 ${filesize};" \ + "protect on 40000000 4003FFFF\0" \ "" #define CONFIG_BOOTCOMMAND "run flash_self"
@@ -218,9 +223,9 @@ */ #define CFG_SDRAM_BASE 0x00000000 #define CFG_FLASH_BASE 0x40000000 -#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ +#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #define CFG_MONITOR_BASE CFG_FLASH_BASE -#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ +#define CFG_MALLOC_LEN (256 << 10) /* Reserve 128 kB for malloc() */
/* * For booting Linux, the board info and command line data @@ -239,9 +244,9 @@ #define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CFG_ENV_IS_IN_FLASH 1 -#define CFG_ENV_OFFSET 0x40000 /* Offset of Environment Sector */ -#define CFG_ENV_SIZE 0x08000 /* Total Size of Environment Sector */ -#define CFG_ENV_SECT_SIZE 0x20000 /* Total Size of Environment Sector */ +#define CFG_ENV_OFFSET 0x40000 /* Offset of Environment Sector */ +#define CFG_ENV_SIZE 0x08000 /* Total Size of Environment */ +#define CFG_ENV_SECT_SIZE 0x40000 /* Total Size of Environment Sector */
/* Address and size of Redundant Environment Sector */ #define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE) @@ -475,6 +480,7 @@ */ #define CONFIG_SCC2_ENET /* enable ethernet on SCC2 */ #define CONFIG_FEC_ENET /* enable ethernet on FEC */ +#define FEC_ENET /* enable the FEC driver */ #define CONFIG_ETHER_ON_FEC1 /* ... for FEC1 */ #define CONFIG_ETHER_ON_FEC2 /* ... for FEC2 */

In message 20070724085839.20151.56293.stgit@tq-sewsrv-4.tq-net.de you wrote:
diff --git a/include/common.h b/include/common.h
...
--- a/include/common.h +++ b/include/common.h @@ -126,20 +126,21 @@ typedef void (interrupt_handler_t)(void *);
/*
- enable common handling for all TQM8xxL/M boards:
- CONFIG_TQM8xxM will be defined for all TQM8xxM and TQM885D boards
- CONFIG_TQM8xxM will be defined for all TQM8xxM
... boards
- CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
*/
and for the TQM885D board
#if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \ defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
- defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M) || \
- defined(CONFIG_TQM885D)
- defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M)
Please keep lists sorted, i. e. TQM885 sorts after all others.
diff --git a/include/commproc.h b/include/commproc.h index 12400e3..8cb2986 100644 --- a/include/commproc.h +++ b/include/commproc.h @@ -1440,10 +1440,6 @@ typedef struct scc_enet { #define SICR_ENET_MASK ((uint)0x0000ff00) #define SICR_ENET_CLKRT ((uint)0x00002600)
-# ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */ -#define FEC_ENET -# endif /* CONFIG_FEC_ENET */
#endif /* CONFIG_MVS v1, CONFIG_TQM823L/M, CONFIG_TQM850L/M, etc. */
I think this will break a couple of boards...
- "ramdisk_addr=401C0000\0" \
- "load=tftp 200000 ${u-boot}\0" \
- "update=protect off 40000000 4003FFFF;" \
"erase 40000000 4003FFFF;" \
I recommend to use "protect off 40000000 +${filesize}" and "erase 40000000 +${filesize}" instead.
#define CFG_FLASH_BASE 0x40000000 -#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ +#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #define CFG_MONITOR_BASE CFG_FLASH_BASE -#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ +#define CFG_MALLOC_LEN (256 << 10) /* Reserve 128 kB for malloc() */
Why do you destroy the nice alignement of the closing comments? Don't do that.
/*
- For booting Linux, the board info and command line data
@@ -239,9 +244,9 @@ #define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CFG_ENV_IS_IN_FLASH 1 -#define CFG_ENV_OFFSET 0x40000 /* Offset of Environment Sector */ -#define CFG_ENV_SIZE 0x08000 /* Total Size of Environment Sector */ -#define CFG_ENV_SECT_SIZE 0x20000 /* Total Size of Environment Sector */ +#define CFG_ENV_OFFSET 0x40000 /* Offset of Environment Sector */ +#define CFG_ENV_SIZE 0x08000 /* Total Size of Environment */ +#define CFG_ENV_SECT_SIZE 0x40000 /* Total Size of Environment Sector */
Again, why such reformatting which makes things only worse?
/* Address and size of Redundant Environment Sector */ #define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE) @@ -475,6 +480,7 @@ */ #define CONFIG_SCC2_ENET /* enable ethernet on SCC2 */ #define CONFIG_FEC_ENET /* enable ethernet on FEC */ +#define FEC_ENET /* enable the FEC driver */
This is not a good idea. You should only use CFG_ and CONFIG_ #defines in your board config file. Please don;t mess around with internal definitions (even if other boards do this as well).
Best regards,
Wolfgang Denk

wd@denx.de wrote on Monday, July 30, 2007 5:42 PM:
In message 20070724085839.20151.56293.stgit@tq-sewsrv-4.tq-net.de you wrote:
#define CFG_FLASH_BASE 0x40000000 -#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ +#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #define CFG_MONITOR_BASE CFG_FLASH_BASE -#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ +#define CFG_MALLOC_LEN (256 << 10) /* Reserve 128 kB for malloc() */
Why do you destroy the nice alignement of the closing comments? Don't do that.
Oh, on my editor this lines looked rather odd, because they exceeded 80 columns and my editor brakes it into two lines.
-239,9 +244,9 @@ #define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CFG_ENV_IS_IN_FLASH 1 -#define CFG_ENV_OFFSET 0x40000 /* Offset of Environment Sector */ -#define CFG_ENV_SIZE 0x08000 /* Total Size of Environment Sector */ -#define CFG_ENV_SECT_SIZE 0x20000 /* Total Size of Environment Sector */ +#define CFG_ENV_OFFSET 0x40000 /* Offset of Environment Sector */ +#define CFG_ENV_SIZE 0x08000 /* Total Size of Environment */ +#define CFG_ENV_SECT_SIZE 0x40000 /* Total Size of Environment Sector */
Again, why such reformatting which makes things only worse?
Sorry for that! Doing this I had Linus CodingStyle in mind, which states "The limit on the length of lines is 80 columns and this is a hard limit". I reduced the line length in the believe of making it more coding style conform. It seems I achieved the contrary :(
Is it OK for comment lines to exceed 80 columns in general? I'm quite often not sure, where to place comments correctly: At the end of a coded line, although the 80 column limit is exceeded? Or better in the line before? Or at the end of the coded line, but with the comment splittet to several lines to not exceed 80 collums:
#define CFG_ENV_SECT_SIZE 0x40000 /* Total Size of Environment Sector */
Best Regards,
Martin Krause
-- TQ-Systems GmbH Muehlstrasse 2, Gut Delling, D-82229 Seefeld Amtsgericht Muenchen, HRB 105 018, UST-IdNr. DE 811 607 913 Geschaeftsfuehrer: Dipl.-Ing. (FH) Detlef Schneider, Dipl.-Ing. (FH) Ruediger Stahl http://www.tq-group.com

In message 47F3F98010FF784EBEE6526EAAB078D1024F8672@tq-mailsrv.tq-net.de you wrote:
Is it OK for comment lines to exceed 80 columns in general? I'm quite
It should be avoided, but please do't just reformat text because of that, espeially when the result is more ugly.
often not sure, where to place comments correctly: At the end of a coded line, although the 80 column limit is exceeded? Or better in the line before? Or at the end of the coded line, but with the comment splittet to several lines to not exceed 80 collums:
There is no genral rule.
#define CFG_ENV_SECT_SIZE 0x40000 /* Total Size of Environment Sector */
That should always be avoided. There are some broken compilers around which will see an unclosed comment here... ALways make sure to terminate the comment on the same line in #define's:
#define CFG_ENV_SECT_SIZE 0x40000 /* Total Size of */ /* Environment Sector */
Now think of it - is this readable? Not good. And what if you need to edit it? A nightmare. So it's probably better to but the commend in a line above the #define.
Best regards,
Wolfgang Denk

From: Jens Gehrlein jens.gehrlein@tqs.de
At 133 MHz the current SDRAM refresh rate is too fast (measured 4 * 1.17 us). CFG_MAMR_PTA changes from 39 to 128. This result in a refresh rate of 4 * 7.8 us at the default clock 66 MHz. At 133 MHz the value will be then 4 * 3.8 us. This is a compromise until a new method is found to adjust the refresh rate.
Signed-off-by: Jens Gehrlein jens.gehrlein@tqs.de ---
include/configs/TQM885D.h | 36 ++++++++++++++++++++---------------- 1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/include/configs/TQM885D.h b/include/configs/TQM885D.h index 17b2070..9ef0abe 100644 --- a/include/configs/TQM885D.h +++ b/include/configs/TQM885D.h @@ -429,26 +429,30 @@ #define CFG_PTA_PER_CLK ((4096 * 64 * 1000) / (4 * 64))
/* - * Memory Periodic Timer Prescaler - * Periodic timer for refresh, start with refresh rate for 40 MHz clock - * (CFG_8xx_CPUCLK_MIN / CFG_PTA_PER_CLK) + * Periodic timer (MAMR[PTx]) for 4 * 7.8 us refresh (= 31.2 us per quad) + * + * CPUclock(MHz) * 31.2 + * CFG_MAMR_PTA = ----------------------------------- with DFBRG = 0 + * 2^(2*SCCR[DFBRG]) * MPTPR_PTP_DIV16 + * + * CPU clock = 15 MHz: CFG_MAMR_PTA = 29 -> 4 * 7.73 us + * CPU clock = 50 MHz: CFG_MAMR_PTA = 97 -> 4 * 7.76 us + * CPU clock = 66 MHz: CFG_MAMR_PTA = 128 -> 4 * 7.75 us + * CPU clock = 133 MHz: CFG_MAMR_PTA = 255 -> 4 * 7.67 us + * + * Value 97 is for 4 * 7.8 us at 50 MHz. So the refresh cycle requirement will + * be met also in the default configuration, i.e. if environment variable + * 'cpuclk' is not set. */ -#define CFG_MAMR_PTA 39 +#define CFG_MAMR_PTA 128
/* - * For 16 MBit, refresh rates could be 31.3 us - * (= 64 ms / 2K = 125 / quad bursts). - * For a simpler initialization, 15.6 us is used instead. - * - * #define CFG_MPTPR_2BK_2K MPTPR_PTP_DIV32 for 2 banks - * #define CFG_MPTPR_1BK_2K MPTPR_PTP_DIV64 for 1 bank + * Memory Periodic Timer Prescaler Register (MPTPR) values. */ -#define CFG_MPTPR_2BK_4K MPTPR_PTP_DIV16 /* setting for 2 banks */ -#define CFG_MPTPR_1BK_4K MPTPR_PTP_DIV32 /* setting for 1 bank */ - -/* refresh rate 7.8 us (= 64 ms / 8K = 31.2 / quad bursts) for 256 MBit */ -#define CFG_MPTPR_2BK_8K MPTPR_PTP_DIV8 /* setting for 2 banks */ -#define CFG_MPTPR_1BK_8K MPTPR_PTP_DIV16 /* setting for 1 bank */ +/* 4 * 7.8 us refresh (= 31.2 us per quad) at 50 MHz and PTA = 97 */ +#define CFG_MPTPR_2BK_4K MPTPR_PTP_DIV16 +/* 4 * 3.9 us refresh (= 15.6 us per quad) at 50 MHz and PTA = 97 */ +#define CFG_MPTPR_2BK_8K MPTPR_PTP_DIV8
/* * MAMR settings for SDRAM

From: Jens Gehrlein jens.gehrlein@tqs.de
This makes it necessary to prescale PITCLK by 512.
This patch is necessary for revision 102 and above of the TQM885D. Revisions 100 and 101 of the TQM885D will not work with this patch applied. But this should not be a problem, since there are only a few prototypes of this revisions floating around.
Signed-off-by: Jens Gehrlein jens.gehrlein@tqs.de Signed-off-by: Martin Krause martin.krause@tqs.de ---
cpu/mpc8xx/speed.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/cpu/mpc8xx/speed.c b/cpu/mpc8xx/speed.c index 101d5f9..4173092 100644 --- a/cpu/mpc8xx/speed.c +++ b/cpu/mpc8xx/speed.c @@ -93,11 +93,23 @@ unsigned long measure_gclk(void) ulong msr_val;
#ifdef CFG_8XX_XIN +#ifdef CONFIG_TQM885D + /* TQM885D uses the OSCM (MODCK[1:2]=00, SCCR[PTSEL]=0, SCCR[PTDIV]=0). + * The clock on the EXTAL input is 10 MHz (instead of 32768 Hz as + * on some other TQM8xx), so SCCR[PTDIV] must be set to achieve a + * PITCLK prescaler of 512. + */ + ulong sccr_val; + sccr_val = immr->im_clkrst.car_sccr & ~SCCR_RTSEL; + sccr_val |= SCCR_RTDIV; + immr->im_clkrst.car_sccr = sccr_val; +#else /* dont use OSCM, only use EXTCLK/512 */ immr->im_clkrst.car_sccr |= SCCR_RTSEL | SCCR_RTDIV; +#endif /* CONFIG_TQM885D */ #else immr->im_clkrst.car_sccr &= ~(SCCR_RTSEL | SCCR_RTDIV); -#endif +#endif /* CFG_8XX_XIN */
/* Reset + Stop Timer 2, no cascading */

In message 20070724085849.20151.20950.stgit@tq-sewsrv-4.tq-net.de you wrote:
From: Jens Gehrlein jens.gehrlein@tqs.de
This makes it necessary to prescale PITCLK by 512.
This patch is necessary for revision 102 and above of the TQM885D. Revisions 100 and 101 of the TQM885D will not work with this patch applied. But this should not be a problem, since there are only a few prototypes of this revisions floating around.
Signed-off-by: Jens Gehrlein jens.gehrlein@tqs.de Signed-off-by: Martin Krause martin.krause@tqs.de
NAK by Wolfgang Denk.
diff --git a/cpu/mpc8xx/speed.c b/cpu/mpc8xx/speed.c index 101d5f9..4173092 100644 --- a/cpu/mpc8xx/speed.c +++ b/cpu/mpc8xx/speed.c @@ -93,11 +93,23 @@ unsigned long measure_gclk(void) ulong msr_val;
#ifdef CFG_8XX_XIN +#ifdef CONFIG_TQM885D
I don't allow for board specific code in that file (and please get rid of the other "#if defined(CONFIG_TQM885D)" that's already there while you are at it).
Thanks.
Best regards,
Wolfgang Denk

wd@denx.de wrote on Monday, July 30, 2007 5:42 PM:
In message 20070724085849.20151.20950.stgit@tq-sewsrv-4.tq-net.de you wrote:
From: Jens Gehrlein jens.gehrlein@tqs.de
This makes it necessary to prescale PITCLK by 512.
This patch is necessary for revision 102 and above of the TQM885D. Revisions 100 and 101 of the TQM885D will not work with this patch applied. But this should not be a problem, since there are only a few prototypes of this revisions floating around.
Signed-off-by: Jens Gehrlein jens.gehrlein@tqs.de Signed-off-by: Martin Krause martin.krause@tqs.de
NAK by Wolfgang Denk.
diff --git a/cpu/mpc8xx/speed.c b/cpu/mpc8xx/speed.c index 101d5f9..4173092 100644 --- a/cpu/mpc8xx/speed.c +++ b/cpu/mpc8xx/speed.c @@ -93,11 +93,23 @@ unsigned long measure_gclk(void) ulong msr_val;
#ifdef CFG_8XX_XIN +#ifdef CONFIG_TQM885D
I don't allow for board specific code in that file (and please get rid
Does this mean, I should make the code cpu specific instead (like #ifdef CONFIG_MPC885)?
Our TQM885D board uses an external 10 MHz oscillator on EXTAL (-> OSCM = 10 MHz). But measure_gclk() is assumeing that, if OSCM is used as clock source, it has a frequency of 32768 Hz (wich seems to be true for all other MPC8xx boards).
Best Regards, Martin Krause
-- TQ-Systems GmbH Muehlstrasse 2, Gut Delling, D-82229 Seefeld Amtsgericht Muenchen, HRB 105 018, UST-IdNr. DE 811 607 913 Geschaeftsfuehrer: Dipl.-Ing. (FH) Detlef Schneider, Dipl.-Ing. (FH) Ruediger Stahl http://www.tq-group.com

u-boot-users-bounces@lists.sourceforge.net wrote on :
wd@denx.de wrote on Monday, July 30, 2007 5:42 PM:
In message 20070724085849.20151.20950.stgit@tq-sewsrv-4.tq-net.de you wrote:
From: Jens Gehrlein jens.gehrlein@tqs.de
This makes it necessary to prescale PITCLK by 512.
This patch is necessary for revision 102 and above of the TQM885D. Revisions 100 and 101 of the TQM885D will not work with this patch applied. But this should not be a problem, since there are only a few prototypes of this revisions floating around.
Signed-off-by: Jens Gehrlein jens.gehrlein@tqs.de Signed-off-by: Martin Krause martin.krause@tqs.de
NAK by Wolfgang Denk.
diff --git a/cpu/mpc8xx/speed.c b/cpu/mpc8xx/speed.c index 101d5f9..4173092 100644 --- a/cpu/mpc8xx/speed.c +++ b/cpu/mpc8xx/speed.c @@ -93,11 +93,23 @@ unsigned long measure_gclk(void) ulong msr_val;
#ifdef CFG_8XX_XIN +#ifdef CONFIG_TQM885D
I don't allow for board specific code in that file (and please get rid
Does this mean, I should make the code cpu specific instead (like #ifdef CONFIG_MPC885)?
Our TQM885D board uses an external 10 MHz oscillator on EXTAL (-> OSCM = 10 MHz). But measure_gclk() is assumeing that, if OSCM is used as clock source, it has a frequency of 32768 Hz (wich seems to be true for all other MPC8xx boards).
I found a solution, where we don't need to modify speed.c at all. We don't need to measure cpuclk - the value could be calculated by the PLL configuration registers.
Best Regards, Martin Krause
-- TQ-Systems GmbH Muehlstrasse 2, Gut Delling, D-82229 Seefeld Amtsgericht Muenchen, HRB 105 018, UST-IdNr. DE 811 607 913 Geschaeftsfuehrer: Dipl.-Ing. (FH) Detlef Schneider, Dipl.-Ing. (FH) Ruediger Stahl http://www.tq-group.com

Hi,
here I resend the updated patches for the TQM885D board which received a NAK in the first try, some weeks ago (time is running ... *sigh*).
If the patches are ok this time, or I didn't receive a NAK, I will push it to the u-boot-tq-group.git custodian tree and send a please-pull request once the merge window is open again.
Best Regards, Martin Krause

From: Jens Gehrlein jens.gehrlein@tqs.de
CAS-Latency=2, Write Recovery Time tWR=2 The max. supported bus frequency is 66 MHz. Therefore, changed threshold to switch from 1:1 mode to 2:1 from 80 MHz to 66 MHz.
Signed-off-by: Martin Krause martin.krause@tqs.de --- board/tqm8xx/tqm8xx.c | 11 ++++++----- cpu/mpc8xx/speed.c | 5 +---- include/configs/TQM885D.h | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/board/tqm8xx/tqm8xx.c b/board/tqm8xx/tqm8xx.c index 6b206f8..7d1c63d 100644 --- a/board/tqm8xx/tqm8xx.c +++ b/board/tqm8xx/tqm8xx.c @@ -37,6 +37,7 @@ static long int dram_size (long int, long int *, long int);
#define _NOT_USED_ 0xFFFFFFFF
+/* UPM initialization table for SDRAM: 40, 50, 66 MHz CLKOUT @ CAS latency 2, tWR=2 */ const uint sdram_table[] = { /* @@ -63,14 +64,14 @@ const uint sdram_table[] = /* * Single Write. (Offset 18 in UPMA RAM) */ - 0x1F0DFC04, 0xEEABBC00, 0x01B27C04, 0x1FF5FC47, /* last */ - _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, + 0x1F0DFC04, 0xEEABBC00, 0x11B77C04, 0xEFFAFC44, + 0x1FF5FC47, /* last */ + _NOT_USED_, _NOT_USED_, _NOT_USED_, /* * Burst Write. (Offset 20 in UPMA RAM) */ 0x1F0DFC04, 0xEEABBC00, 0x10A77C00, 0xF0AFFC00, - 0xF0AFFC00, 0xE1BAFC04, 0x1FF5FC47, /* last */ - _NOT_USED_, + 0xF0AFFC00, 0xF0AFFC04, 0xE1BAFC44, 0x1FF5FC47, /* last */ _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, /* @@ -83,7 +84,7 @@ const uint sdram_table[] = /* * Exception. (Offset 3c in UPMA RAM) */ - 0x7FFFFC07, /* last */ + 0xFFFFFC07, /* last */ _NOT_USED_, _NOT_USED_, _NOT_USED_, };
diff --git a/cpu/mpc8xx/speed.c b/cpu/mpc8xx/speed.c index 101d5f9..11b0893 100644 --- a/cpu/mpc8xx/speed.c +++ b/cpu/mpc8xx/speed.c @@ -259,11 +259,8 @@ int get_clocks_866 (void) */ sccr_reg = immr->im_clkrst.car_sccr; sccr_reg &= ~SCCR_EBDF11; -#if defined(CONFIG_TQM885D) - if (gd->cpu_clk <= 80000000) { -#else + if (gd->cpu_clk <= 66000000) { -#endif sccr_reg |= SCCR_EBDF00; /* bus division factor = 1 */ gd->bus_clk = gd->cpu_clk; } else { diff --git a/include/configs/TQM885D.h b/include/configs/TQM885D.h index f36b729..af138c1 100644 --- a/include/configs/TQM885D.h +++ b/include/configs/TQM885D.h @@ -42,7 +42,7 @@ #define CONFIG_8xx_OSCLK 10000000 /* 10 MHz - PLL input clock */ #define CFG_8xx_CPUCLK_MIN 15000000 /* 15 MHz - CPU minimum clock */ #define CFG_8xx_CPUCLK_MAX 133000000 /* 133 MHz - CPU maximum clock */ -#define CONFIG_8xx_CPUCLK_DEFAULT 66000000 /* 50 MHz - CPU default clock */ +#define CONFIG_8xx_CPUCLK_DEFAULT 66000000 /* 66 MHz - CPU default clock */ /* (it will be used if there is no */ /* 'cpuclk' variable with valid value) */

Signed-off-by: Martin Krause martin.krause@tqs.de --- board/tqm8xx/tqm8xx.c | 4 ++-- include/common.h | 9 +++++---- include/configs/TQM885D.h | 20 +++++++++++++------- 3 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/board/tqm8xx/tqm8xx.c b/board/tqm8xx/tqm8xx.c index 06bf5f8..fcd941e 100644 --- a/board/tqm8xx/tqm8xx.c +++ b/board/tqm8xx/tqm8xx.c @@ -184,7 +184,7 @@ long int initdram (int board_type) #ifndef CONFIG_CAN_DRIVER if ((board_type != 'L') && (board_type != 'M') && - (board_type != 'D') ) { /* "L" and "M" type boards have only one bank SDRAM */ + (board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */ memctl->memc_or3 = CFG_OR3_PRELIM; memctl->memc_br3 = CFG_BR3_PRELIM; } @@ -260,7 +260,7 @@ long int initdram (int board_type) #ifndef CONFIG_CAN_DRIVER if ((board_type != 'L') && (board_type != 'M') && - (board_type != 'D') ) { /* "L" and "M" type boards have only one bank SDRAM */ + (board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */ /* * Check Bank 1 Memory Size * use current column settings diff --git a/include/common.h b/include/common.h index aca281b..6e1e1f3 100644 --- a/include/common.h +++ b/include/common.h @@ -137,20 +137,21 @@ typedef void (interrupt_handler_t)(void *);
/* * enable common handling for all TQM8xxL/M boards: - * - CONFIG_TQM8xxM will be defined for all TQM8xxM and TQM885D boards + * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards + * and for the TQM885D board */ #if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \ defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \ - defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M) || \ - defined(CONFIG_TQM885D) + defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M) # ifndef CONFIG_TQM8xxM # define CONFIG_TQM8xxM # endif #endif #if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \ defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \ - defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) + defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) || \ + defined(CONFIG_TQM885D) # ifndef CONFIG_TQM8xxL # define CONFIG_TQM8xxL # endif diff --git a/include/configs/TQM885D.h b/include/configs/TQM885D.h index af138c1..3c11da7 100644 --- a/include/configs/TQM885D.h +++ b/include/configs/TQM885D.h @@ -83,9 +83,15 @@ "bootm ${kernel_addr} ${ramdisk_addr}\0" \ "net_nfs=tftp 200000 ${bootfile};run nfsargs addip;bootm\0" \ "rootpath=/opt/eldk/ppc_8xx\0" \ - "bootfile=/tftpboot/TQM866M/uImage\0" \ - "kernel_addr=40080000\0" \ - "ramdisk_addr=40180000\0" \ + "bootfile=/tftpboot/TQM885D/uImage\0" \ + "fdt_addr=400C0000\0" \ + "kernel_addr=40100000\0" \ + "ramdisk_addr=40280000\0" \ + "load=tftp 200000 ${u-boot}\0" \ + "update=protect off 40000000 +${filesize};" \ + "erase 40000000 +${filesize};" \ + "cp.b 200000 40000000 ${filesize};" \ + "protect on 40000000 +${filesize}\0" \ "" #define CONFIG_BOOTCOMMAND "run flash_self"
@@ -144,7 +150,7 @@ #define CONFIG_MAC_PARTITION #define CONFIG_DOS_PARTITION
-#undef CONFIG_RTC_MPC8xx /* MPC866 does not support RTC */ +#undef CONFIG_RTC_MPC8xx /* MPC885 does not support RTC */
#define CONFIG_TIMESTAMP /* but print image timestmps */
@@ -230,7 +236,7 @@ #define CFG_FLASH_BASE 0x40000000 #define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */ #define CFG_MONITOR_BASE CFG_FLASH_BASE -#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */ +#define CFG_MALLOC_LEN (256 << 10) /* Reserve 128 kB for malloc() */
/* * For booting Linux, the board info and command line data @@ -250,8 +256,8 @@
#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_OFFSET 0x40000 /* Offset of Environment Sector */ -#define CFG_ENV_SIZE 0x08000 /* Total Size of Environment Sector */ -#define CFG_ENV_SECT_SIZE 0x20000 /* Total Size of Environment Sector */ +#define CFG_ENV_SIZE 0x08000 /* Total Size of Environment */ +#define CFG_ENV_SECT_SIZE 0x40000 /* Total Size of Environment Sector */
/* Address and size of Redundant Environment Sector */ #define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SECT_SIZE)

On the TQM885D the measurement of cpuclk with the PIT reference timer ist not necessary. Since all module variants use the same external 10 MHz oscillator, the cpuclk only depends on the PLL configuration - which is readable by software.
Signed-off-by: Martin Krause martin.krause@tqs.de --- include/configs/TQM885D.h | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/include/configs/TQM885D.h b/include/configs/TQM885D.h index 3c11da7..95ab1c9 100644 --- a/include/configs/TQM885D.h +++ b/include/configs/TQM885D.h @@ -46,13 +46,6 @@ /* (it will be used if there is no */ /* 'cpuclk' variable with valid value) */
-#define CFG_MEASURE_CPUCLK /* Measure real cpu clock */ - /* (function measure_gclk() */ - /* will be called) */ -#ifdef CFG_MEASURE_CPUCLK -#define CFG_8XX_XIN 10000000 /* measure_gclk() needs this */ -#endif - #define CONFIG_8xx_CONS_SMC1 1 /* Console is on SMC1 */
#define CONFIG_BAUDRATE 115200 /* console baudrate = 115kbps */

In message 11915787621757-git-send-email-martin.krause@tqs.de you wrote:
On the TQM885D the measurement of cpuclk with the PIT reference timer ist not necessary. Since all module variants use the same
Ummm.. it may not be strictly necessary - but does it hurt? Or is it not working?
external 10 MHz oscillator, the cpuclk only depends on the PLL configuration - which is readable by software.
If it's working as expected, I recommend to leave the measurement as is - it allows for example to easily detect clocking problems for example because of a broken or wrong quartz.
Best regards,
Wolfgang Denk

wd@denx.de wrote on Friday, October 05, 2007 1:10 PM:
In message 11915787621757-git-send-email-martin.krause@tqs.de you wrote:
On the TQM885D the measurement of cpuclk with the PIT reference timer ist not necessary. Since all module variants use the same
Ummm.. it may not be strictly necessary - but does it hurt? Or is it not working?
To make it work, changes in /cpu/mpc8xx/speed.c would be necessary. I send a patch some weeks ago ("TQM885D: Use the OSCM,feeded by EXTAL = 10 MHz"), which wasn't accepted, because board specific code is not allowed in this file.
external 10 MHz oscillator, the cpuclk only depends on the PLL configuration - which is readable by software.
If it's working as expected, I recommend to leave the measurement as is - it allows for example to easily detect clocking problems for example because of a broken or wrong quartz.
Since we only have one quartz on the TQM885D, we could not do reference measurements like on the other TQM8xx boards (which have two independent external clock sources). So Measuring the clock with the PIT will produce the same result as calculating the clock from the PLL register values.
Another point is, that older TQM885D boards use EXTCLK as clock source and newer versions EXTAL. If the cpuclk is calculated, the same u-boot Image could be used for the older and the newer board versions. If cpuclk is measured two different U-Boot images would be necessary.
Best Regards, Martin Krause

In message 47F3F98010FF784EBEE6526EAAB078D1024F874D@tq-mailsrv.tq-net.de you wrote:
Ummm.. it may not be strictly necessary - but does it hurt? Or is it not working?
To make it work, changes in /cpu/mpc8xx/speed.c would be necessary. I send a patch some weeks ago ("TQM885D: Use the OSCM,feeded by EXTAL =3D 10 MHz"), which wasn't accepted, because board specific code is not allowed in this file.
I asked you to change it in a way that is not board specific, but feature-specific.
Since we only have one quartz on the TQM885D, we could not do reference measurements like on the other TQM8xx boards (which have two independent external clock sources). So Measuring the clock with the PIT will produce the same result as calculating the clock from the PLL register values.
So it's not working at all and cannot be fixed. So drop it.
Another point is, that older TQM885D boards use EXTCLK as clock source and newer versions EXTAL. If the cpuclk is calculated, the same u-boot Image could be used for the older and the newer board versions. If cpuclk is measured two different U-Boot images would be necessary.
Understood.
Best regards,
Wolfgang Denk
participants (3)
-
Martin Krause
-
Martin Krause
-
Wolfgang Denk