]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/include/asm/immap_83xx.h
Driver/DDR: Moving Freescale DDR driver to a common driver
[karo-tx-uboot.git] / arch / powerpc / include / asm / immap_83xx.h
index 3a9cdc4f8df1eaa14d1d26da4eb21eb10d1d3843..1042b0c308d9e3053ecef8ccef2f232aed395310 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2009 Freescale Semiconductor, Inc.
+ * Copyright 2004-2011 Freescale Semiconductor, Inc.
  *
  * MPC83xx Internal Memory Map
  *
@@ -9,21 +9,7 @@
  *     Mandy Lavi <mandy.lavi@freescale.com>
  *     Eran Liberty <liberty@freescale.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 #ifndef __IMMAP_83xx__
 #define __IMMAP_83xx__
@@ -73,12 +59,19 @@ typedef struct sysconf83xx {
        u32 obir;               /* Output Buffer Impedance Register */
        u8 res8[0xC];
        u32 pecr1;              /* PCI Express control register 1 */
-#ifdef CONFIG_MPC8308
-       u32 sdhccr;             /* eSDHC Control Registers for MPC8308 */
+#if defined(CONFIG_MPC830x)
+       u32 sdhccr;             /* eSDHC Control Registers for MPC830x */
 #else
        u32 pecr2;              /* PCI Express control register 2 */
 #endif
+#if defined(CONFIG_MPC8309)
+       u32 can_dbg_ctrl;
+       u32 res9a;
+       u32 gpr1;
+       u8 res9b[0xAC];
+#else
        u8 res9[0xB8];
+#endif
 } sysconf83xx_t;
 
 /*
@@ -113,7 +106,7 @@ typedef struct gtm83xx {
        u8 cfr1;                /* Timer1/2 Configuration */
        u8 res0[3];
        u8 cfr2;                /* Timer3/4 Configuration */
-       u8 res1[10];
+       u8 res1[11];
        u16 mdr1;               /* Timer1 Mode Register */
        u16 mdr2;               /* Timer2 Mode Register */
        u16 rfr1;               /* Timer1 Reference Register */
@@ -150,11 +143,12 @@ typedef struct ipic83xx {
        u32 sipnr_h;            /* System Internal Interrupt Pending Register - High */
        u32 sipnr_l;            /* System Internal Interrupt Pending Register - Low */
        u32 siprr_a;            /* System Internal Interrupt Group A Priority Register */
-       u8 res0[8];
+       u32 siprr_b;            /* System Internal Interrupt Group B Priority Register */
+       u32 siprr_c;            /* System Internal Interrupt Group C Priority Register */
        u32 siprr_d;            /* System Internal Interrupt Group D Priority Register */
        u32 simsr_h;            /* System Internal Interrupt Mask Register - High */
        u32 simsr_l;            /* System Internal Interrupt Mask Register - Low */
-       u8 res1[4];
+       u32 sicnr;              /* System Internal Interrupt Control Register */
        u32 sepnr;              /* System External Interrupt Pending Register */
        u32 smprr_a;            /* System Mixed Interrupt Group A Priority Register */
        u32 smprr_b;            /* System Mixed Interrupt Group B Priority Register */
@@ -163,14 +157,14 @@ typedef struct ipic83xx {
        u32 sersr;              /* System Error Status Register */
        u32 sermr;              /* System Error Mask Register */
        u32 sercr;              /* System Error Control Register */
-       u8 res2[4];
+       u32 sepcr;              /* System External Interrupt Polarity Control Register */
        u32 sifcr_h;            /* System Internal Interrupt Force Register - High */
        u32 sifcr_l;            /* System Internal Interrupt Force Register - Low */
        u32 sefcr;              /* System External Interrupt Force Register */
        u32 serfr;              /* System Error Force Register */
        u32 scvcr;              /* System Critical Interrupt Vector Register */
        u32 smvcr;              /* System Management Interrupt Vector Register */
-       u8 res3[0x98];
+       u8 res[0x98];
 } ipic83xx_t;
 
 /*
@@ -285,6 +279,105 @@ typedef struct qesba83xx {
 /*
  * DDR Memory Controller Memory Map
  */
+#if defined(CONFIG_SYS_FSL_DDR2) || defined(CONFIG_SYS_FSL_DDR3)
+typedef struct ccsr_ddr {
+       u32     cs0_bnds;               /* Chip Select 0 Memory Bounds */
+       u8      res1[4];
+       u32     cs1_bnds;               /* Chip Select 1 Memory Bounds */
+       u8      res2[4];
+       u32     cs2_bnds;               /* Chip Select 2 Memory Bounds */
+       u8      res3[4];
+       u32     cs3_bnds;               /* Chip Select 3 Memory Bounds */
+       u8      res4[100];
+       u32     cs0_config;             /* Chip Select Configuration */
+       u32     cs1_config;             /* Chip Select Configuration */
+       u32     cs2_config;             /* Chip Select Configuration */
+       u32     cs3_config;             /* Chip Select Configuration */
+       u8      res4a[48];
+       u32     cs0_config_2;           /* Chip Select Configuration 2 */
+       u32     cs1_config_2;           /* Chip Select Configuration 2 */
+       u32     cs2_config_2;           /* Chip Select Configuration 2 */
+       u32     cs3_config_2;           /* Chip Select Configuration 2 */
+       u8      res5[48];
+       u32     timing_cfg_3;           /* SDRAM Timing Configuration 3 */
+       u32     timing_cfg_0;           /* SDRAM Timing Configuration 0 */
+       u32     timing_cfg_1;           /* SDRAM Timing Configuration 1 */
+       u32     timing_cfg_2;           /* SDRAM Timing Configuration 2 */
+       u32     sdram_cfg;              /* SDRAM Control Configuration */
+       u32     sdram_cfg_2;            /* SDRAM Control Configuration 2 */
+       u32     sdram_mode;             /* SDRAM Mode Configuration */
+       u32     sdram_mode_2;           /* SDRAM Mode Configuration 2 */
+       u32     sdram_md_cntl;          /* SDRAM Mode Control */
+       u32     sdram_interval;         /* SDRAM Interval Configuration */
+       u32     sdram_data_init;        /* SDRAM Data initialization */
+       u8      res6[4];
+       u32     sdram_clk_cntl;         /* SDRAM Clock Control */
+       u8      res7[20];
+       u32     init_addr;              /* training init addr */
+       u32     init_ext_addr;          /* training init extended addr */
+       u8      res8_1[16];
+       u32     timing_cfg_4;           /* SDRAM Timing Configuration 4 */
+       u32     timing_cfg_5;           /* SDRAM Timing Configuration 5 */
+       u8      reg8_1a[8];
+       u32     ddr_zq_cntl;            /* ZQ calibration control*/
+       u32     ddr_wrlvl_cntl;         /* write leveling control*/
+       u8      reg8_1aa[4];
+       u32     ddr_sr_cntr;            /* self refresh counter */
+       u32     ddr_sdram_rcw_1;        /* Control Words 1 */
+       u32     ddr_sdram_rcw_2;        /* Control Words 2 */
+       u8      reg_1ab[8];
+       u32     ddr_wrlvl_cntl_2;       /* write leveling control 2 */
+       u32     ddr_wrlvl_cntl_3;       /* write leveling control 3 */
+       u8      res8_1b[104];
+       u32     sdram_mode_3;           /* SDRAM Mode Configuration 3 */
+       u32     sdram_mode_4;           /* SDRAM Mode Configuration 4 */
+       u32     sdram_mode_5;           /* SDRAM Mode Configuration 5 */
+       u32     sdram_mode_6;           /* SDRAM Mode Configuration 6 */
+       u32     sdram_mode_7;           /* SDRAM Mode Configuration 7 */
+       u32     sdram_mode_8;           /* SDRAM Mode Configuration 8 */
+       u8      res8_1ba[0x908];
+       u32     ddr_dsr1;               /* Debug Status 1 */
+       u32     ddr_dsr2;               /* Debug Status 2 */
+       u32     ddr_cdr1;               /* Control Driver 1 */
+       u32     ddr_cdr2;               /* Control Driver 2 */
+       u8      res8_1c[200];
+       u32     ip_rev1;                /* IP Block Revision 1 */
+       u32     ip_rev2;                /* IP Block Revision 2 */
+       u32     eor;                    /* Enhanced Optimization Register */
+       u8      res8_2[252];
+       u32     mtcr;                   /* Memory Test Control Register */
+       u8      res8_3[28];
+       u32     mtp1;                   /* Memory Test Pattern 1 */
+       u32     mtp2;                   /* Memory Test Pattern 2 */
+       u32     mtp3;                   /* Memory Test Pattern 3 */
+       u32     mtp4;                   /* Memory Test Pattern 4 */
+       u32     mtp5;                   /* Memory Test Pattern 5 */
+       u32     mtp6;                   /* Memory Test Pattern 6 */
+       u32     mtp7;                   /* Memory Test Pattern 7 */
+       u32     mtp8;                   /* Memory Test Pattern 8 */
+       u32     mtp9;                   /* Memory Test Pattern 9 */
+       u32     mtp10;                  /* Memory Test Pattern 10 */
+       u8      res8_4[184];
+       u32     data_err_inject_hi;     /* Data Path Err Injection Mask High */
+       u32     data_err_inject_lo;     /* Data Path Err Injection Mask Low */
+       u32     ecc_err_inject;         /* Data Path Err Injection Mask ECC */
+       u8      res9[20];
+       u32     capture_data_hi;        /* Data Path Read Capture High */
+       u32     capture_data_lo;        /* Data Path Read Capture Low */
+       u32     capture_ecc;            /* Data Path Read Capture ECC */
+       u8      res10[20];
+       u32     err_detect;             /* Error Detect */
+       u32     err_disable;            /* Error Disable */
+       u32     err_int_en;
+       u32     capture_attributes;     /* Error Attrs Capture */
+       u32     capture_address;        /* Error Addr Capture */
+       u32     capture_ext_address;    /* Error Extended Addr Capture */
+       u32     err_sbe;                /* Single-Bit ECC Error Management */
+       u8      res11[164];
+       u32     debug[32];              /* debug_1 to debug_32 */
+       u8      res12[128];
+} ccsr_ddr_t;
+#else
 typedef struct ddr_cs_bnds {
        u32 csbnds;
        u8 res0[4];
@@ -334,6 +427,7 @@ typedef struct ddr83xx {
        u32 debug_reg;
        u8 res9[0xFC];
 } ddr83xx_t;
+#endif
 
 /*
  * DUART
@@ -607,7 +701,11 @@ typedef struct serdes83xx {
  * On Chip ROM
  */
 typedef struct rom83xx {
+#if defined(CONFIG_MPC8309)
+       u8 mem[0x8000];
+#else
        u8 mem[0x10000];
+#endif
 } rom83xx_t;
 
 /*
@@ -641,12 +739,16 @@ typedef struct immap {
        u8                      dll_ddr[0x100];
        u8                      dll_lbc[0x100];
        u8                      res1[0xE00];
-       ddr83xx_t               ddr;            /* DDR Memory Controller Memory */
+#if defined(CONFIG_SYS_FSL_DDR2) || defined(CONFIG_SYS_FSL_DDR3)
+       ccsr_ddr_t              ddr;    /* DDR Memory Controller Memory */
+#else
+       ddr83xx_t               ddr;    /* DDR Memory Controller Memory */
+#endif
        fsl_i2c_t               i2c[2];         /* I2C Controllers */
        u8                      res2[0x1300];
        duart83xx_t             duart[2];       /* DUART */
        u8                      res3[0x900];
-       fsl_lbus_t              lbus;   /* Local Bus Controller Registers */
+       fsl_lbc_t               im_lbc;         /* Local Bus Controller Regs */
        u8                      res4[0x1000];
        spi8xxx_t               spi;            /* Serial Peripheral Interface */
        dma83xx_t               dma;            /* DMA */
@@ -661,10 +763,17 @@ typedef struct immap {
        u8                      res7[0xC0000];
 } immap_t;
 
+#ifndef        CONFIG_MPC834x
 #ifdef CONFIG_HAS_FSL_MPH_USB
-#define CONFIG_SYS_MPC83xx_USB_OFFSET  0x22000 /* use the MPH controller */
+#define CONFIG_SYS_MPC83xx_USB1_OFFSET  0x22000        /* use the MPH controller */
+#define CONFIG_SYS_MPC83xx_USB2_OFFSET 0
 #else
-#define CONFIG_SYS_MPC83xx_USB_OFFSET  0x23000 /* use the DR controller */
+#define CONFIG_SYS_MPC83xx_USB1_OFFSET 0
+#define CONFIG_SYS_MPC83xx_USB2_OFFSET  0x23000        /* use the DR controller */
+#endif
+#else
+#define CONFIG_SYS_MPC83xx_USB1_OFFSET 0x22000
+#define CONFIG_SYS_MPC83xx_USB2_OFFSET  0x23000
 #endif
 
 #elif defined(CONFIG_MPC8313)
@@ -686,7 +795,7 @@ typedef struct immap {
        u8                      res1[0x1300];
        duart83xx_t             duart[2];       /* DUART */
        u8                      res2[0x900];
-       fsl_lbus_t              lbus;   /* Local Bus Controller Registers */
+       fsl_lbc_t               im_lbc;         /* Local Bus Controller Regs */
        u8                      res3[0x1000];
        spi8xxx_t               spi;            /* Serial Peripheral Interface */
        dma83xx_t               dma;            /* DMA */
@@ -721,7 +830,7 @@ typedef struct immap {
        u8                      res1[0x1300];
        duart83xx_t             duart[2];       /* DUART */
        u8                      res2[0x900];
-       fsl_lbus_t              lbus;   /* Local Bus Controller Registers */
+       fsl_lbc_t               im_lbc;         /* Local Bus Controller Regs */
        u8                      res3[0x1000];
        spi8xxx_t               spi;            /* Serial Peripheral Interface */
        dma83xx_t               dma;            /* DMA */
@@ -766,7 +875,7 @@ typedef struct immap {
        u8                      res1[0x1300];
        duart83xx_t             duart[2];       /* DUART */
        u8                      res2[0x900];
-       fsl_lbus_t              lbus;   /* Local Bus Controller Registers */
+       fsl_lbc_t               im_lbc;         /* Local Bus Controller Regs */
        u8                      res3[0x1000];
        spi8xxx_t               spi;            /* Serial Peripheral Interface */
        dma83xx_t               dma;            /* DMA */
@@ -816,7 +925,7 @@ typedef struct immap {
        u8                      res4[0x1300];
        duart83xx_t             duart[2];       /* DUART */
        u8                      res5[0x900];
-       fsl_lbus_t              lbus;   /* Local Bus Controller Registers */
+       fsl_lbc_t               im_lbc;         /* Local Bus Controller Regs */
        u8                      res6[0x2000];
        dma83xx_t               dma;            /* DMA */
        pciconf83xx_t           pci_conf[1];    /* PCI Software Configuration Registers */
@@ -855,7 +964,7 @@ typedef struct immap {
        u8                      res3[0x1300];
        duart83xx_t             duart[2];       /* DUART */
        u8                      res4[0x900];
-       fsl_lbus_t              lbus;   /* Local Bus Controller Registers */
+       fsl_lbc_t               im_lbc;         /* Local Bus Controller Regs */
        u8                      res5[0x2000];
        dma83xx_t               dma;            /* DMA */
        pciconf83xx_t           pci_conf[1];    /* PCI Software Configuration Registers */
@@ -867,18 +976,78 @@ typedef struct immap {
        u8                      res8[0xC0000];
        u8                      qe[0x100000];   /* QE block */
 } immap_t;
+#elif defined(CONFIG_MPC8309)
+typedef struct immap {
+       sysconf83xx_t           sysconf;        /* System configuration */
+       wdt83xx_t               wdt;            /* Watch Dog Timer (WDT) Registers */
+       rtclk83xx_t             rtc;            /* Real Time Clock Module Registers */
+       rtclk83xx_t             pit;            /* Periodic Interval Timer */
+       gtm83xx_t               gtm[2];         /* Global Timers Module */
+       ipic83xx_t              ipic;           /* Integrated Programmable Interrupt Controller */
+       arbiter83xx_t           arbiter;        /* System Arbiter Registers */
+       reset83xx_t             reset;          /* Reset Module */
+       clk83xx_t               clk;            /* System Clock Module */
+       pmc83xx_t               pmc;            /* Power Management Control Module */
+       gpio83xx_t              gpio[2];        /* General purpose I/O module */
+       u8                      res0[0x500];    /* res0 1.25 KBytes added for 8309 */
+       qepi83xx_t              qepi;           /* QE Ports Interrupts Registers */
+       qepio83xx_t             qepio;          /* QE Parallel I/O ports */
+       u8                      res1[0x800];
+       ddr83xx_t               ddr;            /* DDR Memory Controller Memory */
+       fsl_i2c_t               i2c[2];         /* I2C Controllers */
+       u8                      res2[0x1300];
+       duart83xx_t             duart[2];       /* DUART */
+       u8                      res3[0x200];
+       duart83xx_t             duart1[2];      /* DUART */
+       u8                      res4[0x500];
+       fsl_lbc_t               im_lbc;         /* Local Bus Controller Regs */
+       u8                      res5[0x1000];
+       u8                      spi[0x100];
+       u8                      res6[0xf00];
+       dma83xx_t               dma;            /* DMA */
+       pciconf83xx_t           pci_conf[1];    /* PCI Configuration Registers */
+       u8                      res7[0x80];
+       ios83xx_t               ios;            /* Sequencer (IOS) */
+       pcictrl83xx_t           pci_ctrl[1];    /* PCI Control & Status Registers */
+       u8                      res8[0x13A00];
+       u8                      can1[0x1000];   /* Flexcan 1 */
+       u8                      can2[0x1000];   /* Flexcan 2 */
+       u8                      res9[0x5000];
+       usb83xx_t               usb;
+       u8                      res10[0x5000];
+       u8                      can3[0x1000];   /* Flexcan 3 */
+       u8                      can4[0x1000];   /* Flexcan 4 */
+       u8                      res11[0x1000];
+       u8                      dma1[0x2000];   /* DMA */
+       sdhc83xx_t              sdhc;           /* SDHC Controller */
+       u8                      res12[0xC1000];
+       rom83xx_t               rom;            /* On Chip ROM */
+       u8                      res13[0x8000];
+       u8                      qe[0x100000];   /* QE block */
+       u8                      res14[0xE00000];/* Added for 8309 */
+} immap_t;
 #endif
 
+#define CONFIG_SYS_MPC8xxx_DDR_OFFSET  (0x2000)
+#define CONFIG_SYS_FSL_DDR_ADDR \
+                       (CONFIG_SYS_IMMR + CONFIG_SYS_MPC8xxx_DDR_OFFSET)
 #define CONFIG_SYS_MPC83xx_DMA_OFFSET  (0x8000)
-#define CONFIG_SYS_MPC83xx_DMA_ADDR    (CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_DMA_OFFSET)
+#define CONFIG_SYS_MPC83xx_DMA_ADDR \
+                       (CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_DMA_OFFSET)
 #define CONFIG_SYS_MPC83xx_ESDHC_OFFSET        (0x2e000)
-#define CONFIG_SYS_MPC83xx_ESDHC_ADDR  (CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_ESDHC_OFFSET)
+#define CONFIG_SYS_MPC83xx_ESDHC_ADDR \
+                       (CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_ESDHC_OFFSET)
 
-#ifndef CONFIG_SYS_MPC83xx_USB_OFFSET
-#define CONFIG_SYS_MPC83xx_USB_OFFSET  0x23000
+#ifndef CONFIG_SYS_MPC83xx_USB1_OFFSET
+#define CONFIG_SYS_MPC83xx_USB1_OFFSET  0x23000
+#endif
+#define CONFIG_SYS_MPC83xx_USB1_ADDR \
+                       (CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_USB1_OFFSET)
+#if defined(CONFIG_MPC834x)
+#define CONFIG_SYS_MPC83xx_USB2_ADDR \
+                       (CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_USB2_OFFSET)
 #endif
-#define CONFIG_SYS_MPC83xx_USB_ADDR \
-                       (CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_USB_OFFSET)
+#define CONFIG_SYS_LBC_ADDR (&((immap_t *)CONFIG_SYS_IMMR)->im_lbc)
 
 #define CONFIG_SYS_TSEC1_OFFSET                0x24000
 #define CONFIG_SYS_MDIO1_OFFSET                0x24000