Skip to contentSkip to conversation

Some patches for the TQM885D board

PATCH New Martin Krause 2 participants 19 messages Jul 24, 2007 – Oct 5, 2007

lore
Share & tools
lore
#0 lore raw

cover Some patches for the TQM885D board

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

Signature · 1 line
Martin Krause
#1 lore raw

PATCH 1/4 TQM885D: fix problem with PHY on FEC2

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.

---

 include/configs/TQM885D.h |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
include/configs/TQM885D.h +9 -1
index d470ade..8bbac4c 100644
@@ -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
#2 lore raw

PATCH 1/4 TQM885D: fix problem with PHY on FEC2

Quoted 4 lines · In message <[email protected]> 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?

Quoted 2 lines

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

Signature · 4 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
Overdrawn?  But I still have checks left!
#3 lore raw

PATCH 2/4 TQM885D: adjust for doubled flash sector size + some minor fixes

In reply to Martin Krause

---

 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(-)
board/tqm8xx/tqm8xx.c +2 -2
index 6b206f8..ed1d692 100644
@@ -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
include/common.h +5 -4
index 23f9390..a17f1ac 100644
@@ -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
include/commproc.h +0 -4
index 12400e3..8cb2986 100644
@@ -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  *********************/
include/configs/TQM885D.h +13 -7
index 8bbac4c..17b2070 100644
@@ -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 */
 
#4 lore raw

PATCH 2/4 TQM885D: adjust for doubled flash sector size + some minor fixes

Quoted 2 lines · In message <[email protected]> you wrote:
include/common.h +0 -0

...

include/common.h typedef void (interrupt_handler_t)(void *); · line 129

Quoted 8 lines
include/common.h +1 -1
@@ -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

include/common.h typedef void (interrupt_handler_t)(void *); · line 135

Quoted 8 lines
include/common.h +2 -2
  * - 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.

include/commproc.h typedef struct scc_enet { · line 1443

Quoted 13 lines
include/commproc.h +0 -4
index 12400e3..8cb2986 100644
@@ -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...

include/commproc.h typedef struct scc_enet {

Quoted 4 lines
include/commproc.h +4 -0
+	"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.

include/commproc.h

Quoted 6 lines

#define CFG_FLASH_BASE 0x40000000

include/commproc.h +2 -2
-#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.

include/commproc.h line 249

Quoted 12 lines

/*
* For booting Linux, the board info and command line data

include/commproc.h +3 -3
@@ -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?

include/commproc.h line 483

Quoted 7 lines
include/commproc.h +1 -0
 /* 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

Signature · 7 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
Es ist offensichtlich, dass das menschliche Gehirn wie  ein  Computer
funktioniert.  Da  es  keine  dummen Computer gibt, gibt es also auch
keine dummen Menschen. Nur ein paar Leute, die unter DOS laufen.
                                                       -- <unbekannt>
#5 lore raw

PATCH 2/4 TQM885D: adjust for doubled flash sector size + some minor fixes

wd at denx.de wrote on Monday, July 30, 2007 5:42 PM:

Quoted 12 lines

In message <[email protected]>

Quoted 7 lines · you

#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.

Quoted 15 lines
Quoted 13 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

#6 lore raw

PATCH 2/4 TQM885D: adjust for doubled flash sector size + some minor fixes

Quoted 2 lines · In message <[email protected]> you…

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.

Quoted 4 lines

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.

Quoted 2 lines

#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

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
Nothing ever becomes real till it is experienced -- even a proverb is
no proverb to you till your life has illustrated it.     - John Keats
#7 lore raw

PATCH 3/4 TQM885D: fix SDRAM refresh

In reply to Martin Krause

From: Jens Gehrlein <[email protected]>

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.

---

 include/configs/TQM885D.h |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)
include/configs/TQM885D.h +20 -16
index 17b2070..9ef0abe 100644
@@ -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
#8 lore raw

PATCH 4/4 TQM885D: Use the OSCM, feeded by EXTAL = 10 MHz.

In reply to Martin Krause

From: Jens Gehrlein <[email protected]>

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.

---

 cpu/mpc8xx/speed.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
cpu/mpc8xx/speed.c +13 -1
index 101d5f9..4173092 100644
@@ -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
 	 */
#9 lore raw

PATCH 4/4 TQM885D: Use the OSCM, feeded by EXTAL = 10 MHz.

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

From: Jens Gehrlein <[email protected]>

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.

NAK by Wolfgang Denk.

cpu/mpc8xx/speed.c unsigned long measure_gclk(void) · line 96

Quoted 9 lines
cpu/mpc8xx/speed.c +1 -0
index 101d5f9..4173092 100644
@@ -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

Signature · 7 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
"The glory of creation is in its infinite diversity." "And in the way
our differences combine to create meaning and beauty."
	-- Dr. Miranda Jones and Spock, "Is There in Truth No Beauty?",
	   stardate 5630.8
#10 lore raw

PATCH 4/4 TQM885D: Use the OSCM, feeded by EXTAL = 10 MHz.

wd at denx.de wrote on Monday, July 30, 2007 5:42 PM:

Quoted 23 lines

In message <[email protected]>

Quoted 11 lines · you

From: Jens Gehrlein <[email protected]>

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.

NAK by Wolfgang Denk.

Quoted 7 lines
cpu/mpc8xx/speed.c +0 -0
index 101d5f9..4173092 100644
@@ -93,11 +93,23 @@ unsigned long measure_gclk(void)  	ulong
 msr_val; 
 
Quoted 4 lines

cpu/mpc8xx/speed.c unsigned long measure_gclk(void) · line 96

Quoted 2 lines
cpu/mpc8xx/speed.c +1 -0
 #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

#11 lore raw

PATCH 4/4 TQM885D: Use the OSCM, feeded by EXTAL = 10 MHz.

u-boot-users-bounces at lists.sourceforge.net wrote on :

Quoted 30 lines

wd at denx.de wrote on Monday, July 30, 2007 5:42 PM:

Quoted 23 lines

In message <[email protected]>

Quoted 11 lines · you

From: Jens Gehrlein <[email protected]>

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.

NAK by Wolfgang Denk.

Quoted 7 lines
cpu/mpc8xx/speed.c +0 -0
index 101d5f9..4173092 100644
@@ -93,11 +93,23 @@ unsigned long measure_gclk(void)  	ulong
 msr_val; 
 
Quoted 5 lines

cpu/mpc8xx/speed.c unsigned long measure_gclk(void) · line 96

Quoted 2 lines
cpu/mpc8xx/speed.c +1 -0
 #ifdef CFG_8XX_XIN
+#ifdef CONFIG_TQM885D

I don't allow for board specific code in that file (and please get rid

Quoted 7 lines

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

#12 lore raw

PATCH 1/1 Resend: some patches for the TQM885D board

In reply to Martin Krause

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

#13 lore raw

PATCH 1/6 TQM885D: Exchanged SDRAM timing by a more relaxed timing.

In reply to Martin Krause

From: Jens Gehrlein <[email protected]>

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.

---
 board/tqm8xx/tqm8xx.c     |   11 ++++++-----
 cpu/mpc8xx/speed.c        |    5 +----
 include/configs/TQM885D.h |    2 +-
 3 files changed, 8 insertions(+), 10 deletions(-)
board/tqm8xx/tqm8xx.c +6 -5
index 6b206f8..7d1c63d 100644
@@ -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_,
 };
 
cpu/mpc8xx/speed.c +1 -4
index 101d5f9..11b0893 100644
@@ -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 {
include/configs/TQM885D.h +1 -1
index f36b729..af138c1 100644
@@ -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)	*/
 
Signature · 1 line
1.5.3.rc6.g1911
#14 lore raw

PATCH 3/6 TQM885D: adjust for doubled flash sector size + some minor fixes

In reply to Martin Krause
---
 board/tqm8xx/tqm8xx.c     |    4 ++--
 include/common.h          |    9 +++++----
 include/configs/TQM885D.h |   20 +++++++++++++-------
 3 files changed, 20 insertions(+), 13 deletions(-)
board/tqm8xx/tqm8xx.c +2 -2
index 06bf5f8..fcd941e 100644
@@ -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
include/common.h +5 -4
index aca281b..6e1e1f3 100644
@@ -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
include/configs/TQM885D.h +13 -7
index af138c1..3c11da7 100644
@@ -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)
Signature · 1 line
1.5.3.rc6.g1911
#15 lore raw

PATCH 4/6 TQM885D: use calculated cpuclk instead of measuring it

In reply to Martin Krause

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.

---
 include/configs/TQM885D.h |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
include/configs/TQM885D.h +0 -7
index 3c11da7..95ab1c9 100644
@@ -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	*/
Signature · 1 line
1.5.3.rc6.g1911
#16 lore raw

PATCH 4/6 TQM885D: use calculated cpuclk instead of measuring it

Quoted 2 lines · In message <[email protected]> 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?

Quoted 2 lines

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

Signature · 4 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
You can only live once, but if you do it right, once is enough.
#17 lore raw

PATCH 4/6 TQM885D: use calculated cpuclk instead of measuring it

wd at denx.de wrote on Friday, October 05, 2007 1:10 PM:

Quoted 7 lines

In message <[email protected]> you

Quoted 2 lines · 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.

Quoted 6 lines
Quoted 2 lines

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

#18 lore raw

PATCH 4/6 TQM885D: use calculated cpuclk instead of measuring it

Quoted 8 lines · In message <[email protected]> you…
Quoted 3 lines

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.

Quoted 5 lines

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.

Quoted 5 lines

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

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
It would seem that evil retreats when forcibly confronted
	-- Yarnek of Excalbia, "The Savage Curtain", stardate 5906.5