APM82xxx: Add Common register definitions
PATCH 2/8 APM82xxx: Add Common register definitions
From: Tirumala Marri <[email protected]>
This patch adds APM82XXX specific definitions, which include clock and boot strap.
--- include/ppc440.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++- include/ppc4xx.h | 7 +++-- 2 files changed, 59 insertions(+), 5 deletions(-)
include/ppc440.h +55 -2
@@ -58,6 +58,25 @@| Clocking Controller +----------------------------------------------------------------------------*/ /* values for clkcfga register - indirect addressing of these regs */ +#if defined(CONFIG_APM82XXX ) +#define CPR0_CLKUPD 0x0020 +#define CPR0_PLLC 0x0040 +#define CPR0_PLLC_SEL (pllc) (((pllc) & 0x01000000) >> 24) +#define CPR0_PLLD 0x0060 +#define CPR0_PLLD_FDV (plld) (((plld) & 0xff000000) >> 24) +#define CPR0_PLLD_FWDVA (plld) (((plld) & 0x000f0000) >> 16) +#define CPR0_CPUD 0x0080 +#define CPR0_CPUD_CPUDV (cpud) (((cpud) & 0x07000000) >> 24) +#define CPR0_PLB2D 0x00a0 +#define CPR0_PLB2D_PLB2DV (plb2d) (((plb2d) & 0x06000000) >> 25) +#define CPR0_OPBD 0x00c0 +#define CPR0_OPBD_OPBDV (opbd) (((opbd) & 0x03000000) >> 24) +#define CPR0_PERD 0x00e0 +#define CPR0_PERD_PERDV (perd) (((perd) & 0x03000000) >> 24) +#define CPR0_DDR2D 0x0100 +#define CPR0_DDR2D_DDR2DV (ddr2d) (((ddr2d) & 0x06000000) >> 25) +#define CLK_ICFG 0x0140 +#else #define CPR0_PLLC 0x0040#define CPR0_PLLD 0x0060#define CPR0_PRIMAD0 0x0080
@@ -67,6 +86,7 @@#define CPR0_MALD 0x0100#define CPR0_SPCID 0x0120#define CPR0_ICFG 0x0140 +#endif /*if defined(CONFIG_APM82XXX) */ /* 440EPX boot strap options */ #define BOOT_STRAP_OPTION_A 0x00000000
@@ -1275,7 +1295,36 @@#define SDR0_AHB_CFG 0x370#define SDR0_USB2HOST_CFG 0x371#endif /* CONFIG_460EX || CONFIG_460GT */ +#if defined(CONFIG_APM82XXX ) + +#define SDR0_DDR0 0x00E1 +#define SDR0_DDR0_DDRM_ENCODE (n) ((((unsigned long)(n))&0x03)<<29) +#define SDR0_DDR0_DDRM_DECODE (n) ((((unsigned long)(n))>>29)&0x03) +#define SDR0_DDR0_TUNE_ENCODE (n) ((((unsigned long)(n))&0x2FF)<<0) +#define SDR0_DDR0_TUNE_DECODE (n) ((((unsigned long)(n))>>0)&0x2FF) +#define SDR_SDSTP1_RL_DECODE (x) ((x & 0x000C0000) >> 18) +#define SDR_SDSTP1_RL_EBC 0x0 +#define SDR_SDSTP1_RL_NDFC 0x2 + +/* ECID */ +#define SDR0_ECID0 0x0080 +#define SDR0_ECID1 0x0081 +#define SDR0_ECID2 0x0082 +#define SDR0_ECID3 0x0083 + +/* AHB config. */ +#define AHB_TOP 0xA4 +#define AHB_BOT 0xA5 +#define SDR0_AHB_CFG 0x370 + +/* DDR SDRAM Controller clock (CPR register)*/ +#define SDR0_DDRCE 0x00E0/* SDR register */ +#define CPR0_DDR2D 0x0100/* CPR register */ +#define CPR0_DDR2D_DDR2DV_ENCODE (n) ((((unsigned long)(n))&0x03)<<25) +#define CPR0_DDR2D_DDR2DV_DECODE (n) ((((unsigned long)(n))>>25)&0x03) + +#endif #define SDR0_SDCS_SDD (0x80000000 >> 31)#if defined(CONFIG_440GP )
@@ -1517,7 +1566,8 @@#define SDR0_EBC0 0x00000100#define SDR0_SDSTP2 0x00004001#define SDR0_SDSTP3 0x00004001 -#elif defined(CONFIG_460EX ) || defined(CONFIG_460GT ) +#elif defined(CONFIG_460EX ) || defined(CONFIG_460GT ) ||\ + defined(CONFIG_APM82XXX )#define SDR0_SRST0 SDR0_SRST/* for compatability reasons */ #define SDR0_SRST0_BGO 0x80000000/* PLB to OPB bridge */
@@ -1909,9 +1959,12 @@#if defined(CONFIG_440EP ) || defined(CONFIG_440GR ) || \ defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ - defined(CONFIG_460EX ) || defined(CONFIG_460GT ) + defined(CONFIG_460EX ) || defined(CONFIG_460GT ) || \ + defined(CONFIG_APM82XXX )#define GPIO0_BASE (CONFIG_SYS_PERIPHERAL_BASE+0x00000B00) +#if !defined(CONFIG_APM82XXX )#define GPIO1_BASE (CONFIG_SYS_PERIPHERAL_BASE+0x00000C00) +#endif #define GPIO0_OR (GPIO0_BASE+0x0)#define GPIO0_TCR (GPIO0_BASE+0x4)
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 2/8 APM82xxx: Add Common register definitions
Hi Marri,
Quoted 4 lines · On Thursday 26 August 2010 23:05:49 tmarri at apm.com wrote:
From: Tirumala Marri <[email protected]>
This patch adds APM82XXX specific definitions, which include clock and boot strap.
Please find some comments below.
Quoted 49 lines
Signed-off-by Tirumala R Marri <[email protected]>--- include/ppc440.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++- include/ppc4xx.h | 7 +++-- 2 files changed, 59 insertions(+), 5 deletions(-)include/ppc440.h +20
-1@@ -58,6 +58,25 @@ | Clocking Controller +------------------------------------------------------------------------- ---*/ /* values for clkcfga register - indirect addressing of these regs */ +#if defined(CONFIG_APM82XXX) +#define CPR0_CLKUPD 0x0020 +#define CPR0_PLLC 0x0040 +#define CPR0_PLLC_SEL (pllc) (((pllc) & 0x01000000) >> 24) +#define CPR0_PLLD 0x0060 +#define CPR0_PLLD_FDV (plld) (((plld) & 0xff000000) >> 24) +#define CPR0_PLLD_FWDVA (plld) (((plld) & 0x000f0000) >> 16) +#define CPR0_CPUD 0x0080 +#define CPR0_CPUD_CPUDV (cpud) (((cpud) & 0x07000000) >> 24) +#define CPR0_PLB2D 0x00a0 +#define CPR0_PLB2D_PLB2DV (plb2d) (((plb2d) & 0x06000000) >> 25) +#define CPR0_OPBD 0x00c0 +#define CPR0_OPBD_OPBDV (opbd) (((opbd) & 0x03000000) >> 24) +#define CPR0_PERD 0x00e0 +#define CPR0_PERD_PERDV (perd) (((perd) & 0x03000000) >> 24) +#define CPR0_DDR2D 0x0100 +#define CPR0_DDR2D_DDR2DV (ddr2d) (((ddr2d) & 0x06000000) >> 25) +#define CLK_ICFG 0x0140 +#else #define CPR0_PLLC 0x0040#define
CPR0_PLLD0x0060
#defineCPR0_PRIMAD00x0080include/ppc440.h +1
-0@@ -67,6 +86,7 @@#define CPR0_MALD 0x0100#define CPR0_SPCID 0x0120#define CPR0_ICFG 0x0140 +#endif /*if defined(CONFIG_APM82XXX) */ /* 440EPX boot strap options */ #define BOOT_STRAP_OPTION_A 0x00000000
include/ppc440.h line 1304
Quoted 10 lines
include/ppc440.h +7
-0@@ -1275,7 +1295,36 @@#define SDR0_AHB_CFG 0x370#define SDR0_USB2HOST_CFG 0x371#endif /* CONFIG_460EX || CONFIG_460GT */ +#if defined(CONFIG_APM82XXX ) + +#define SDR0_DDR0 0x00E1 +#define SDR0_DDR0_DDRM_ENCODE (n) ((((unsigned long)(n))&0x03)<<29) +#define SDR0_DDR0_DDRM_DECODE (n) ((((unsigned long)(n))>>29)&0x03) +#define SDR0_DDR0_TUNE_ENCODE (n) ((((unsigned long)(n))&0x2FF)<<0) +#define SDR0_DDR0_TUNE_DECODE (n) ((((unsigned long)(n))>>0)&0x2FF)
Add spaces around the operators. I suggest to replace "unsigned int" with "u32" to reduce the line-size resulting in this:
#define SDR0_DDR0_DDRM_ENCODE(n) ((((u32)(n)) & 0x03) << 29)
#define SDR0_DDR0_DDRM_DECODE(n) ((((u32)(n)) >> 29) & 0x03)
#define SDR0_DDR0_TUNE_ENCODE(n) ((((u32)(n)) & 0x2FF) << 0)
#define SDR0_DDR0_TUNE_DECODE(n) ((((u32)(n)) >> 0) & 0x2FF)
BTW: I couldn't find any reference to this SDR0_DDR0 register (0xe1) in the APM8xxx users manual. You might want to add this description there.
include/ppc440.h line 1306
Quoted 1 line
include/ppc440.h +1
-0+#define SDR_SDSTP1_RL_DECODE (x) ((x & 0x000C0000) >> 18)
Missing braces around "x".
Quoted 9 lines
include/ppc440.h +9
-0+#define SDR_SDSTP1_RL_EBC 0x0 +#define SDR_SDSTP1_RL_NDFC 0x2 + +/* ECID */ +#define SDR0_ECID0 0x0080 +#define SDR0_ECID1 0x0081 +#define SDR0_ECID2 0x0082 +#define SDR0_ECID3 0x0083 +
include/ppc440.h line 1325
Quoted 10 lines
include/ppc440.h +10
-0+/* AHB config. */ +#define AHB_TOP 0xA4 +#define AHB_BOT 0xA5 +#define SDR0_AHB_CFG 0x370 + +/* DDR SDRAM Controller clock (CPR register)*/ +#define SDR0_DDRCE 0x00E0/* SDR register */ +#define CPR0_DDR2D 0x0100/* CPR register */ +#define CPR0_DDR2D_DDR2DV_ENCODE (n) ((((unsigned long)(n))&0x03)<<25) +#define CPR0_DDR2D_DDR2DV_DECODE (n) ((((unsigned long)(n))>>25)&0x03)
Again, please add spaces and change to u32.
Please change and resubmit. Thanks.
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 2/8 APM82xxx: Add Common register definitions
In reply to tmarri at apm.comDear tmarri at apm.com,
Quoted 10 lines · In message <[email protected]> you wrote:
From: Tirumala Marri <[email protected]>
This patch adds APM82XXX specific definitions, which include clock and boot strap.
Signed-off-by Tirumala R Marri <[email protected]>--- include/ppc440.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++- include/ppc4xx.h | 7 +++-- 2 files changed, 59 insertions(+), 5 deletions(-)
It makes no sense to split this into a spearate patch. Please squash into the commit where these defines are first referenced.
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 How does a project get to be a year late? ... One day at a time.
PATCH 2/8 APM82xxx: Add Common register definitions
Quoted 20 lines
-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Sunday, August 29, 2010 1:57 AM
To: tmarri at apm.com
Cc: u-boot at lists.denx.de; open-source-review at apm.com
Subject: Re: [U-Boot] [PATCH 2/8] APM82xxx: Add Common register definitionsDear tmarri at apm.com,
In message <[email protected]> you
Quoted 8 lines · wrote:
From: Tirumala Marri <[email protected]>
This patch adds APM82XXX specific definitions, which include clock and boot strap.
Signed-off-by Tirumala R Marri <[email protected]>--- include/ppc440.h | 57
Quoted 7 lines
++++++++++++++++++++++++++++++++++++++++++++++++++++-
Quoted 2 lines
include/ppc4xx.h | 7 +++-- 2 files changed, 59 insertions(+), 5 deletions(-)It makes no sense to split this into a spearate patch. Please squash into the commit where these defines are first referenced.
Mr Wolfgang,
Sure will fix it.
Regards,
Marri