APM82xxx: Add CPU and other peripheral support
PATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
From: Tirumala Marri <[email protected]>
APM82XXX is a new line of SoCs which are derivatives of PPC44X family of processors.
This patch adds support of CPU, cache,
tlb, 32k ocm, bootstraps, PLB AHB bus, DDR and Some common register definitions.
---
V1:
* Squash some of the patches.
* add space between "||" and "\".
* Add spaces around operators.
* Unsigned int to u32.
* Add empty line which was removed.
* remove warning "unused variable" in cpu_init.c
V2:
* Removed Defines added to 405ex.
--- arch/powerpc/cpu/ppc4xx/cpu.c | 35 ++++++++++++- arch/powerpc/cpu/ppc4xx/cpu_init.c | 8 ++- arch/powerpc/cpu/ppc4xx/speed.c | 85 ++++++++++++++++++++++++++++++- arch/powerpc/cpu/ppc4xx/start.S | 10 +++- arch/powerpc/include/asm/ppc4xx-ebc.h | 4 ++ arch/powerpc/include/asm/ppc4xx-isram.h | 8 ++- arch/powerpc/include/asm/ppc4xx-sdram.h | 12 ++-- arch/powerpc/include/asm/ppc4xx-uic.h | 5 +- arch/powerpc/include/asm/processor.h | 1 + include/ppc440.h | 57 ++++++++++++++++++++- include/ppc4xx.h | 7 ++- 11 files changed, 207 insertions(+), 25 deletions(-)
arch/powerpc/cpu/ppc4xx/cpu.c +32 -3
@@ -80,7 +80,8 @@ static int pci_async_enabled(void)#endif /* CONFIG_PCI */ #if defined(CONFIG_PCI ) && !defined(CONFIG_IOP480 ) && \ - !defined(CONFIG_405 ) && !defined(CONFIG_405EX ) + !defined(CONFIG_405 ) && !defined(CONFIG_405EX ) && \ + !defined(CONFIG_APM82XXX )int pci_arbiter_enabled (void ) {#if defined(CONFIG_405GP )
@@ -250,6 +251,21 @@ static char *bootstrap_str[] = { };static char bootstrap_char[] = {'A' ,'B' ,'C' ,'D' ,'E' ,'G' ,'F' ,'H' };#endif +#if defined(CONFIG_APM82XXX ) +#define SDR0_PINSTP_SHIFT 29 +static char *bootstrap_str[] = { +"RESERVED" , +"RESERVED" , +"RESERVED" , +"NAND (8 bits)" , +"NOR (8 bits)" , +"NOR (8 bits) w/PLL Bypassed" , +"I2C (Addr 0x54)" , +"I2C (Addr 0x52)" , +}; +static char bootstrap_char[] = {'A' ,'B' ,'C' ,'D' ,'E' ,'F' ,'G' ,'H' }; +#endif +#if defined(SDR0_PINSTP_SHIFT )static int bootstrap_option (void )
@@ -285,7 +301,7 @@ int checkcpu (void)uint pvr =get_pvr ();ulong clock = gd->cpu_clk;char buf[32 ]; -#if defined(CONFIG_460EX ) || defined(CONFIG_460GT ) +#if defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || defined(CONFIG_APM82XXX )u32 reg;#endif
@@ -304,6 +320,8 @@ int checkcpu (void)#if defined(CONFIG_XILINX_440 )puts ("IBM PowerPC 4" ); +#elif defined(CONFIG_APM82XXX ) +puts ("APM PowerPC APM82" );#else puts ("AMCC PowerPC 4" );#endif
@@ -316,7 +334,7 @@ int checkcpu (void)#if defined(CONFIG_440 )#if defined(CONFIG_460EX ) || defined(CONFIG_460GT )puts ("60" ); -#else +#elif !defined(CONFIG_APM82XXX )puts ("40" );#endif #endif
@@ -598,7 +616,18 @@ int checkcpu (void)puts ("GX Rev. A" );strcpy (addstr,"No Security support" );break ; +#if defined(CONFIG_APM82XXX ) +case PVR_APM82XXX_RA : +mfsdr (SDR0_ECID3 , reg); +if (reg &0x00200000 ) +puts ("181 Rev. A" ); +if (reg &0x00100000 ) +strcpy (addstr,"No Security support" ); +else +strcpy (addstr,"Security support" ); +break ; +#endif case PVR_VIRTEX5 :puts ("x5 VIRTEX5" );break ;
arch/powerpc/cpu/ppc4xx/cpu_init.c +5 -3
@@ -222,13 +222,15 @@ void reconfigure_pll(u32 new_cpu_freq)void cpu_init_f (void ) { -#if defined(CONFIG_WATCHDOG ) || defined(CONFIG_440GX ) || defined(CONFIG_460EX ) +#if defined(CONFIG_WATCHDOG ) || defined(CONFIG_440GX ) || \ + defined(CONFIG_460EX )u32 val;#endif reconfigure_pll (CONFIG_SYS_PLL_RECONFIG ); -#if (defined(CONFIG_405EP ) || defined (CONFIG_405EX )) && !defined(CONFIG_SYS_4xx_GPIO_TABLE) +#if (defined(CONFIG_405EP ) || defined(CONFIG_405EX )) && \ + !defined(CONFIG_SYS_4xx_GPIO_TABLE) && !defined(CONFIG_APM82XXX )/* * GPIO0 setup (select GPIO or alternate function) */
@@ -384,7 +386,7 @@ cpu_init_f (void)#if defined(CONFIG_405EX ) || \ defined(CONFIG_440SP ) || defined(CONFIG_440SPE ) || \ defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ - defined(CONFIG_460SX ) + defined(CONFIG_460SX ) || defined(CONFIG_APM82XXX )/* * Set PLB4 arbiter (Segment 0 and 1) to 4 deep pipeline read */
arch/powerpc/cpu/ppc4xx/speed.c +84 -1
103 lines not on this page · raw message
arch/powerpc/cpu/ppc4xx/start.S +8 -2
@@ -700,7 +700,8 @@ _start: defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \ defined(CONFIG_460SX) mtdcr L2_CACHE_CFG,r0 /* Ensure L2 Cache is off */ -#elif defined(CONFIG_460EX) || defined(CONFIG_460GT) +#elif defined(CONFIG_460EX) || defined(CONFIG_460GT) || \ + defined(CONFIG_APM82XXX) lis r1, 0x0000 ori r1,r1,0x0008 /* Set L2_CACHE_CFG[RDBW]=1 */ mtdcr L2_CACHE_CFG,r1
@@ -728,7 +729,8 @@ _start: lis r1, 0x8003 ori r1,r1, 0x0980 /* fourth 64k */ mtdcr ISRAM0_SB3CR,r1 -#elif defined(CONFIG_440SPE) || defined(CONFIG_460EX) || defined(CONFIG_460GT) +#elif defined(CONFIG_440SPE) || defined(CONFIG_460EX) || \ + defined(CONFIG_460GT) || defined(CONFIG_APM82XXX) lis r1,0x0000 /* BAS = X_0000_0000 */ ori r1,r1,0x0984 /* first 64k */ mtdcr ISRAM0_SB0CR,r1
@@ -752,7 +754,11 @@ _start: mtdcr ISRAM1_PMEG,r1 lis r1,0x0004 /* BAS = 4_0004_0000 */ +#if defined(CONFIG_APM82XXX) /* APM82XXX only has 32KB of OCM */ + ori r1,r1,0x0784 /* 32k */ +#else ori r1,r1,0x0984 /* 64k */ +#endif mtdcr ISRAM1_SB0CR,r1 #endif #elif defined(CONFIG_460SX)
arch/powerpc/include/asm/ppc4xx-ebc.h +4 -0
@@ -73,6 +73,10 @@#define EBC_NUM_BANKS 3#endif +#if defined(CONFIG_APM82XXX ) +#define EBC_NUM_BANKS 3 +#endif +/* Bank Configuration Register */ #define EBC_BXCR (n) (n)#define EBC_BXCR_BANK_SIZE (n) (0x100000 << (((n) & EBC_BXCR_BS_MASK) >> 17))
arch/powerpc/include/asm/ppc4xx-isram.h +5 -3
@@ -25,7 +25,8 @@/* * Internal SRAM */ -#if defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) +#if defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ + defined(CONFIG_APM82XXX )#define ISRAM0_DCR_BASE 0x380#else #define ISRAM0_DCR_BASE 0x020
@@ -42,7 +43,8 @@#define ISRAM0_REVID (ISRAM0_DCR_BASE+0x09)/* SRAM bus revision id reg */ #define ISRAM0_DPC (ISRAM0_DCR_BASE+0x0a)/* SRAM data parity check reg */ -#if defined(CONFIG_460EX ) || defined(CONFIG_460GT ) +#if defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ + defined(CONFIG_APM82XXX )#define ISRAM1_DCR_BASE 0x0B0#define ISRAM1_SB0CR (ISRAM1_DCR_BASE+0x00)/* SRAM1 bank config 0*/ #define ISRAM1_BEAR (ISRAM1_DCR_BASE+0x04)/* SRAM1 bus error addr reg */
@@ -60,7 +62,7 @@#if defined (CONFIG_440GX ) || \ defined(CONFIG_440SP ) || defined(CONFIG_440SPE ) || \ defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ - defined(CONFIG_460SX ) + defined(CONFIG_460SX ) || defined(CONFIG_APM82XXX )#define L2_CACHE_BASE 0x030#define L2_CACHE_CFG (L2_CACHE_BASE+0x00)/* L2 Cache Config */ #define L2_CACHE_CMD (L2_CACHE_BASE+0x01)/* L2 Cache Command */
arch/powerpc/include/asm/ppc4xx-sdram.h +6 -6
@@ -292,7 +292,7 @@*/ #if defined(CONFIG_440SPE ) || \ defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ - defined(CONFIG_460SX ) + defined(CONFIG_460SX ) || defined(CONFIG_APM82XXX )#define SDRAM_RXBAS_SDBA_MASK 0xFFE00000/* Base address */ #define SDRAM_RXBAS_SDBA_ENCODE (n) ((u32)(((phys_size_t)(n) >> 2) & 0xFFE00000))#define SDRAM_RXBAS_SDBA_DECODE (n) ((((phys_size_t)(n)) & 0xFFE00000) << 2)
@@ -365,7 +365,7 @@/* * Memory controller registers */ -#ifdef CONFIG_405EX +#if defined(CONFIG_405EX ) || defined(CONFIG_APM82XXX )#define SDRAM_BESR 0x00/* PLB bus error status (read/clear) */ #define SDRAM_BESRT 0x01/* PLB bus error status (test/set) */ #define SDRAM_BEARL 0x02/* PLB bus error address low */
@@ -375,9 +375,9 @@#define SDRAM_PLBOPT 0x08/* PLB slave options */ #define SDRAM_PUABA 0x09/* PLB upper address base */ #define SDRAM_MCSTAT 0x1F/* memory controller status */ -#else /* CONFIG_405EX */ +#else /* CONFIG_405EX || CONFIG_APM82XXX */ #define SDRAM_MCSTAT 0x14/* memory controller status */ -#endif /* CONFIG_405EX */ +#endif /* CONFIG_405EX || CONFIG_APM82XXX */ #define SDRAM_MCOPT1 0x20/* memory controller options 1 */ #define SDRAM_MCOPT2 0x21/* memory controller options 2 */ #define SDRAM_MODT0 0x22/* on die termination for bank 0 */
@@ -423,12 +423,12 @@#define SDRAM_MEMODE 0x89/* memory extended mode */ #define SDRAM_ECCES 0x98/* ECC error status */ #define SDRAM_CID 0xA4/* core ID */ -#ifndef CONFIG_405EX +#if !defined(CONFIG_405EX ) && !defined(CONFIG_APM82XXX )#define SDRAM_RID 0xA8/* revision ID */ #endif #define SDRAM_FCSR 0xB0/* feedback calibration status */ #define SDRAM_RTSR 0xB1/* run time status tracking */ -#ifdef CONFIG_405EX +#if defined(CONFIG_405EX ) || defined(CONFIG_APM82XXX )#define SDRAM_RID 0xF8/* revision ID */ #endif
arch/powerpc/include/asm/ppc4xx-uic.h +3 -2
@@ -31,7 +31,7 @@*/ #if defined(CONFIG_440GX ) || defined(CONFIG_440SPE ) || \ defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ - defined(CONFIG_460SX ) + defined(CONFIG_460SX ) || defined(CONFIG_APM82XXX )#define UIC_MAX 4#elif defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ defined(CONFIG_405EX )
@@ -252,7 +252,8 @@#define VECNUM_ETH0 (32 + 28)#endif /* CONFIG_440SPE */ -#if defined(CONFIG_460EX ) || defined(CONFIG_460GT ) +#if defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ + defined(CONFIG_APM82XXX )/* UIC 0 */ #define VECNUM_UIC2NCI 10#define VECNUM_UIC2CI 11
arch/powerpc/include/asm/processor.h +1 -0
@@ -916,6 +916,7 @@#define PVR_460SX_RA_V1 0x13541801/* 460SX rev A Variant 1 Security disabled */ #define PVR_460GX_RA 0x13541802/* 460GX rev A */ #define PVR_460GX_RA_V1 0x13541803/* 460GX rev A Variant 1 Security disabled */ +#define PVR_APM82XXX_RA 0x12C41C80/* APM82XXX rev A */ #define PVR_601 0x00010000#define PVR_602 0x00050000#define PVR_603 0x00030000
include/ppc440.h +55 -2
90 lines not on this page · raw message
include/ppc4xx.h +4 -3
@@ -44,14 +44,15 @@#if defined(CONFIG_405EX ) || \ defined(CONFIG_440SP ) || defined(CONFIG_440SPE ) || \ defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ - defined(CONFIG_460SX ) + defined(CONFIG_460SX ) || defined(CONFIG_APM82XXX )#define CONFIG_SDRAM_PPC4xx_IBM_DDR2/* IBM DDR(2) controller */ #endif #if defined(CONFIG_440EP ) || defined(CONFIG_440GR ) || \ defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ defined(CONFIG_405EZ ) || defined(CONFIG_405EX ) || \ - defined(CONFIG_460EX ) || defined(CONFIG_460GT ) + defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ + defined(CONFIG_APM82XXX )#define CONFIG_NAND_NDFC #endif
@@ -61,7 +62,7 @@defined (CONFIG_440GR ) ||defined (CONFIG_440GRX ) || \defined (CONFIG_440SP ) ||defined (CONFIG_440SPE ) || \defined (CONFIG_460EX ) ||defined (CONFIG_460GT ) || \ - defined(CONFIG_460SX) + defined(CONFIG_460SX) || defined(CONFIG_APM82XXX)#define PLB_ARBITER_BASE 0x80
Signature · 1 line
1.6.1.rc3
PATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
Dear tmarri at apm.com,
Quoted 8 lines · In message <[email protected]> you wrote:
From: Tirumala Marri <[email protected]>
APM82XXX is a new line of SoCs which are derivatives of PPC44X family of processors.
This patch adds support of CPU, cache,
tlb, 32k ocm, bootstraps, PLB AHB bus, DDR and Some common register definitions.
...
arch/powerpc/cpu/ppc4xx/cpu.c int checkcpu (void) · line 324
Quoted 4 lines
#if
defined(CONFIG_XILINX_440)arch/powerpc/cpu/ppc4xx/cpu.c +2
-0puts ("IBM PowerPC 4" ); +#elif defined(CONFIG_APM82XXX ) +puts ("APM PowerPC APM82" );
Hm... is this APM82? Official press releases refer to this as APM821xx? Or ist it APM82xxx?
On the other hand, this seems to be a 464 core, so should we not print 464 here?
arch/powerpc/cpu/ppc4xx/cpu.c int checkcpu (void) · line 338
Quoted 10 lines
#else
arch/powerpc/cpu/ppc4xx/cpu.c +1
-1puts ("AMCC PowerPC 4" );#endif @@ -316,7 +334,7 @@ int checkcpu (void)#if defined(CONFIG_440 )#if defined(CONFIG_460EX ) || defined(CONFIG_460GT )puts ("60" ); -#else +#elif !defined(CONFIG_APM82XXX )puts ("40" );
This gets confusing.
If you don't decide to print "64" here, then please pull all the APM82??? code into a separate #ifdef block.
arch/powerpc/cpu/ppc4xx/cpu_init.c void reconfigure_pll(u32 new_cpu_freq) · line 226
Quoted 9 lines
arch/powerpc/cpu/ppc4xx/cpu_init.c +2
-1@@ -222,13 +222,15 @@ void reconfigure_pll(u32 new_cpu_freq)void cpu_init_f (void ) { -#if defined(CONFIG_WATCHDOG ) || defined(CONFIG_440GX ) || defined(CONFIG_460EX ) +#if defined(CONFIG_WATCHDOG ) || defined(CONFIG_440GX ) || \ + defined(CONFIG_460EX )
Why do you modify this line? Coding style fixes should go separate.
arch/powerpc/cpu/ppc4xx/cpu_init.c void reconfigure_pll(u32 new_cpu_freq) · line 233
Quoted 3 lines
arch/powerpc/cpu/ppc4xx/cpu_init.c +2
-1-#if (defined(CONFIG_405EP ) || defined (CONFIG_405EX )) && !defined(CONFIG_SYS_4xx_GPIO_TABLE) +#if (defined(CONFIG_405EP ) || defined(CONFIG_405EX )) && \ + !defined(CONFIG_SYS_4xx_GPIO_TABLE) && !defined(CONFIG_APM82XXX )
Please keep list sorted.
arch/powerpc/cpu/ppc4xx/cpu_init.c void reconfigure_pll(u32 new_cpu_freq)
Quoted 11 lines
arch/powerpc/cpu/ppc4xx/cpu_init.c +11
-0+#if defined(CONFIG_APM82XXX ) + +/* +* Specific for APM82XXX +* Change: +* PLL registers reflect the current PLL setting of the chip. +* So unlike previous implementation that reads bootstrap +* registers to determine system clocking information, this +* implementation directly extracts the information from +* current PLL registers values. +*/
Please remove references to "previous implementation" which is unknown here anyway.
arch/powerpc/cpu/ppc4xx/cpu_init.c
Quoted 5 lines
arch/powerpc/cpu/ppc4xx/cpu_init.c +2
-1-#elif defined(CONFIG_440SPE ) || defined(CONFIG_460EX ) || defined(CONFIG_460GT ) +#elif defined(CONFIG_440SPE ) || defined(CONFIG_460EX ) || \ + defined(CONFIG_460GT ) || defined(CONFIG_APM82XXX ) lis r1,0x0000 /* BAS = X_0000_0000 */ ori r1,r1,0x0984 /* first 64k */
Should the size be adjusted here, too?
arch/powerpc/cpu/ppc4xx/cpu_init.c _start: · line 760
Quoted 9 lines
arch/powerpc/cpu/ppc4xx/cpu_init.c +3
-0mtdcr ISRAM0_SB0CR ,r1@@ -752,7 +754,11 @@ _start: mtdcr ISRAM1_PMEG,r1 lis r1,0x0004 /* BAS = 4_0004_0000 */ +#if defined(CONFIG_APM82XXX )/* APM82XXX only has 32KB of OCM */ + ori r1,r1,0x0784 /* 32k */ +#else ori r1,r1,0x0984 /* 64k */
Please get rid of these magic numbers and add a #define for a symbolic constant so the code becomes readable, and the selection can be done on a per-CPU base, i. e. without needing #ifdef's here.
include/ppc440.h
Quoted 4 lines
include/ppc440.h +0
-0
Hm... you are adding a number of large blocks of code, all #ifdef'ed.
This is ugly, difficult to read and difficult to maintain.
Why not adding a new file include/apm82xxx.h instead?
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 Due to lack of disk space, this fortune database has been discontinued.
PATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
Mr Wolfgang,
Quoted 3 lines
On the other hand, this seems to be a 464 core, so should we not print 464 here?
[Marri] Interesting point, For all other processors we were printing SoC name not the CPU core name.
APM82xxx is SoC name.
Quoted 11 lines
include/ppc440.h
Quoted 4 lines
include/ppc440.h +0
-0Hm... you are adding a number of large blocks of code, all #ifdef'ed.
This is ugly, difficult to read and difficult to maintain.
Why not adding a new file
include/apm82xxx.hinstead?
[Marri] If we create new file it would cause too many changes in the common files.
When more and more APM8xxxx processors with new registers definitions being released
At that point we can create separate file. Please suggest ?
Regards,
Marri
PATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
Dear Tirumala Marri,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines
On the other hand, this seems to be a 464 core, so should we not print 464 here?
[Marri] Interesting point, For all other processors we were printing SoC name not the CPU core name.
APM82xxx is SoC name.
OK.
Hm.., the whole CPU ID code in "arch/powerpc/cpu/ppc4xx/cpu.c" has become a mess.
Stefan:
is there any deeper logic for the repeated #ifdef's there, when we finally do a switch on the PVR anyway?
Instead of painstakingly concatenating "AMCC PowerPC 4" with "05" and later "GP Rev. B" we could shrink this into a plain
case PVR_405GP_RB:
puts("AMCC PowerPC 405GP Rev. B");
break;Or am I missing something?
Let's get rid of all these nested #ifdef's...
Quoted 9 lines
Quoted 9 lines
include/ppc440.h
Quoted 4 lines
include/ppc440.h +0
-0Hm... you are adding a number of large blocks of code, all #ifdef'ed.
This is ugly, difficult to read and difficult to maintain.
Quoted 7 lines
Quoted 2 lines
Why not adding a new file
include/apm82xxx.hinstead?[Marri] If we create new file it would cause too many changes in the common files.
When more and more APM8xxxx processors with new registers definitions being released
At that point we can create separate file. Please suggest ?
If there are plans for more and more APM8xxxx processors with new registers definitions to be released we should not create a mess now and later go into efforts to clean it up again, but start with a separate register definitions file apm82xxx.h now.
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 The more sins you confess, the more books you will sell.
PATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
Hi Wolfgang,
Quoted 8 lines · On Thursday 02 September 2010 21:01:37 Wolfgang Denk wrote:
Hm.., the whole CPU ID code in "
arch/powerpc/cpu/ppc4xx/cpu.c" has become a mess.Stefan:
is there any deeper logic for the repeated #ifdef's there, when we finally do a switch on the PVR anyway?
Quoted 8 lines
Instead of painstakingly concatenating "AMCC PowerPC 4" with "05" and later "GP Rev. B" we could shrink this into a plain
case PVR_405GP_RB: puts("AMCC PowerPC 405GP Rev. B"); break;Or am I missing something?
IIRC, then the main reason for this is the code size reduction. Using your version would increase the code size quite a bit. But I concur, it would be much better readable. So just let me know, and I'll try to come up with a patch cleaning this up a bit.
Quoted 1 line
Let's get rid of all these nested #ifdef's...
As described in some comments, the problem is that some SoC's have the same PVR (for example 440EP rev C and 440GR rev B have same PVR). I have no idea how this identification could be solved without such ifdef's.
But you are right. Some of the ifdef's can be removed. Again, this would also result in a bigger image size though.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
PATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
Dear Stefan Roese,
Quoted 5 lines · In message <[email protected]> you wrote:
IIRC, then the main reason for this is the code size reduction. Using your version would increase the code size quite a bit. But I concur, it would be much better readable. So just let me know, and I'll try to come up with a patch cleaning this up a bit.
Maybe some common parts (like "AMCC PowerPC ") could be split off.
For the rest, the compelex code needs also space, so I'm not sure about the end result.
Quoted 3 lines
As described in some comments, the problem is that some SoC's have the same PVR (for example 440EP rev C and 440GR rev B have same PVR). I have no idea how this identification could be solved without such ifdef's.
I see.
Quoted 2 lines
But you are right. Some of the ifdef's can be removed. Again, this would also result in a bigger image size though.
Really? We should measure the effect.
Best regards,
Wolfgang Denk
Signature · 6 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 most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
-- Isaac AsimovPATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
Hi Wolfgang,
Quoted 9 lines · On Friday 03 September 2010 10:32:53 Wolfgang Denk wrote:
Dear Stefan Roese,
Quoted 4 lines · In message <[email protected]> you wrote:
IIRC, then the main reason for this is the code size reduction. Using your version would increase the code size quite a bit. But I concur, it would be much better readable. So just let me know, and I'll try to come up with a patch cleaning this up a bit.
Maybe some common parts (like "AMCC PowerPC ") could be split off.
Yes, this would help a bit. I'll add this on list.
Quoted 7 lines
For the rest, the compelex code needs also space, so I'm not sure about the end result.
Quoted 3 lines
As described in some comments, the problem is that some SoC's have the same PVR (for example 440EP rev C and 440GR rev B have same PVR). I have no idea how this identification could be solved without such ifdef's.
Quoted 6 lines
I see.
Quoted 2 lines
But you are right. Some of the ifdef's can be removed. Again, this would also result in a bigger image size though.
Really? We should measure the effect.
I'll work on this a bit in the near future and will post my findings.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
PATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
In reply to Wolfgang DenkMr Wolfgang,
Quoted 2 lines
Hm... is this APM82? Official press releases refer to this as APM821xx? Or ist it APM82xxx?
[Marri] You are correct APM821XX is right name.
Quoted 4 lines
If you don't decide to print "64" here, then please pull all the APM82???
code into a separate #ifdef block.
[Marri] Sure will do.
Quoted 9 lines
Quoted 2 lines
-#elif
defined(CONFIG_440SPE)||defined(CONFIG_460EX)||
defined(CONFIG_460GT)arch/powerpc/cpu/ppc4xx/start.S _start: · line 735
Quoted 4 lines
arch/powerpc/cpu/ppc4xx/start.S +2
-0+#elif defined(CONFIG_440SPE) || defined(CONFIG_460EX) || \ + defined(CONFIG_460GT) || defined(CONFIG_APM82XXX) lis r1,0x0000 /* BAS = X_0000_0000 */ ori r1,r1,0x0984 /* first 64k */Should the size be adjusted here, too?
[Marri] No, It is same as other SoCs.
Quoted 5 lines
Quoted 5 lines
arch/powerpc/cpu/ppc4xx/start.S +0
-0mtdcr ISRAM0_SB0CR,r1@@ -752,7 +754,11 @@ _start: mtdcr ISRAM1_PMEG,r1
Quoted 9 lines
arch/powerpc/cpu/ppc4xx/start.S _start: · line 760
Quoted 5 lines
arch/powerpc/cpu/ppc4xx/start.S +3
-0lis r1,0x0004 /* BAS = 4_0004_0000 */ +#if defined(CONFIG_APM82XXX) /* APM82XXX only has 32KB of OCM */ + ori r1,r1,0x0784 /* 32k */ +#else ori r1,r1,0x0984 /* 64k */Please get rid of these magic numbers and add a #define for a symbolic constant so the code becomes readable, and the selection can be done on a per-CPU base, i. e. without needing #ifdef's here.
[Marri] I will define CONFIG_SYS_OCM_SIZE . But for now this is only added
Bluestone.h. I need to remove "#if defined(CONFIG_APM821XX) I will have to
Add CONFIG_SYS_OCM_SIZE to all the board config files which are based on 460Ex and 460GT.
I think that would be completely different patch.
Quoted 9 lines
include/ppc440.h
Quoted 6 lines
include/ppc440.h +0
-0Hm... you are adding a number of large blocks of code, all #ifdef'ed.
Quoted 4 lines
This is ugly, difficult to read and difficult to maintain.
Why not adding a new file
include/apm82xxx.hinstead?
[Marri] I will work on this .
Regards,
Marri
PATCH v2 1/2 APM82xxx: Add CPU and other peripheral support
Hi Marri,
Quoted 17 lines · On Friday 03 September 2010 03:48:44 Tirumala Marri wrote:
Quoted 11 lines
Quoted 11 lines
arch/powerpc/cpu/ppc4xx/start.S +3
-0mtdcr ISRAM0_SB0CR,r1@@ -752,7 +754,11 @@ _start: mtdcr ISRAM1_PMEG,r1 lis r1,0x0004 /* BAS = 4_0004_0000 */ +#if defined(CONFIG_APM82XXX) /* APM82XXX only has 32KB of OCM */ + ori r1,r1,0x0784 /* 32k */ +#elseQuoted 5 lines
arch/powerpc/cpu/ppc4xx/start.S _start: · line 760
Quoted 1 line
arch/powerpc/cpu/ppc4xx/start.S +0
-0ori r1,r1,0x0984 /* 64k */Please get rid of these magic numbers and add a #define for a symbolic constant so the code becomes readable, and the selection can be done on a per-CPU base, i. e. without needing #ifdef's here.
Quoted 6 lines
[Marri] I will define
CONFIG_SYS_OCM_SIZE. But for now this is only addedBluestone.h. I need to remove "#ifdefined(CONFIG_APM821XX)I will have to
AddCONFIG_SYS_OCM_SIZEto all the board config files which are based on 460Ex and 460GT.
I think that would be completely different patch.
Since the OCM size is SoC specific, I would prefer not to put such a define in each and every board config header, but in a SoC header. There you could automatically select the OCM size depending on the SoC type. No change in the board config header needed.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de