]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mpc52xx: add support for tqm52xx based board charon
authorHeiko Schocher <hs@denx.de>
Sat, 4 Dec 2010 07:34:04 +0000 (08:34 +0100)
committerWolfgang Denk <wd@denx.de>
Thu, 16 Dec 2010 21:58:59 +0000 (22:58 +0100)
- serial console in PSC1
- 128MiB DRAM
- 32MiB Flash
- FEC Ethernet
- 2 I2C busses
- FPGA on CS3
- IDE
- VGA SMI501

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Wolfgang Denk <wd@denx.de>
MAINTAINERS
board/tqc/tqm5200/tqm5200.c
boards.cfg
include/configs/TQM5200.h
include/configs/charon.h [new file with mode: 0644]

index 986e0dc6141711fa697fcba018a19fc8442608f8..fc6bae90495201384147b14113e390ba2cf3bd6a 100644 (file)
@@ -414,6 +414,7 @@ Georg Schardt <schardt@team-ctech.de>
 
 Heiko Schocher <hs@denx.de>
 
+       charon          MPC5200
        ids8247         MPC8247
        jupiter         MPC5200
        kmeter1         MPC8360
index 263a2af9b4b54f7b9eae5c823f1fb88ec584b367..7cbcd433ea800b318f442bdedf9eb7b17bf2c6cf 100644 (file)
@@ -54,6 +54,47 @@ DECLARE_GLOBAL_DATA_PTR;
 void ps2mult_early_init(void);
 #endif
 
+#if defined(CONFIG_VIDEO)
+/*
+ * EDID block has been generated using Phoenix EDID Designer 1.3.
+ * This tool creates a text file containing:
+ *
+ * EDID BYTES:
+ *
+ * 0x   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ *     ------------------------------------------------
+ *     00 | 00 FF FF FF FF FF FF 00 04 21 00 00 00 00 00 00
+ *     10 | 01 00 01 03 00 00 00 00 00 00 00 00 00 00 00 00
+ *     20 | 00 00 00 21 00 00 01 01 01 01 01 01 01 01 01 01
+ *     30 | 01 01 01 01 01 01 64 00 00 00 00 00 00 00 00 00
+ *     40 | 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00
+ *     50 | 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00
+ *     60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10
+ *     70 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17
+ *
+ * Then this data has been manually converted to the char
+ * array below.
+ */
+static unsigned char edid_buf[128] = {
+       0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
+       0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x01, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x64, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
+};
+#endif
+
 #ifndef CONFIG_SYS_RAMBOOT
 static void sdram_start (int hi_addr)
 {
@@ -251,6 +292,8 @@ int checkboard (void)
 # define CARRIER_NAME  "CAM5200"
 #elif defined(CONFIG_FO300)
 # define CARRIER_NAME  "FO300"
+#elif defined(CONFIG_CHARON)
+# define CARRIER_NAME  "CHARON"
 #else
 # error "UNKNOWN"
 #endif
@@ -429,6 +472,111 @@ int board_early_init_f (void)
 }
 #endif /* CONFIG_FO300 */
 
+#if defined(CONFIG_CHARON)
+#include <i2c.h>
+#include <asm/io.h>
+
+/* The TFP410 registers */
+#define TFP410_REG_VEN_ID_L 0x00
+#define TFP410_REG_VEN_ID_H 0x01
+#define TFP410_REG_DEV_ID_L 0x02
+#define TFP410_REG_DEV_ID_H 0x03
+#define TFP410_REG_REV_ID 0x04
+
+#define TFP410_REG_CTL_1_MODE 0x08
+#define TFP410_REG_CTL_2_MODE 0x09
+#define TFP410_REG_CTL_3_MODE 0x0A
+
+#define TFP410_REG_CFG 0x0B
+
+#define TFP410_REG_DE_DLY 0x32
+#define TFP410_REG_DE_CTL 0x33
+#define TFP410_REG_DE_TOP 0x34
+#define TFP410_REG_DE_CNT_L 0x36
+#define TFP410_REG_DE_CNT_H 0x37
+#define TFP410_REG_DE_LIN_L 0x38
+#define TFP410_REG_DE_LIN_H 0x39
+
+#define TFP410_REG_H_RES_L 0x3A
+#define TFP410_REG_H_RES_H 0x3B
+#define TFP410_REG_V_RES_L 0x3C
+#define TFP410_REG_V_RES_H 0x3D
+
+static int tfp410_read_reg(int reg, uchar *buf)
+{
+       if (i2c_read(CONFIG_SYS_TFP410_ADDR, reg, 1, buf, 1) != 0) {
+               puts ("Error reading the chip.\n");
+               return 1;
+       }
+       return 0;
+}
+
+static int tfp410_write_reg(int reg, uchar buf)
+{
+       if (i2c_write(CONFIG_SYS_TFP410_ADDR, reg, 1, &buf, 1) != 0) {
+               puts ("Error writing the chip.\n");
+               return 1;
+       }
+       return 0;
+}
+
+typedef struct _tfp410_config {
+       int     reg;
+       uchar   val;
+}TFP410_CONFIG;
+
+static TFP410_CONFIG tfp410_configtbl[] = {
+       {TFP410_REG_CTL_1_MODE, 0x37},
+       {TFP410_REG_CTL_2_MODE, 0x20},
+       {TFP410_REG_CTL_3_MODE, 0x80},
+       {TFP410_REG_DE_DLY, 0x90},
+       {TFP410_REG_DE_CTL, 0x00},
+       {TFP410_REG_DE_TOP, 0x23},
+       {TFP410_REG_DE_CNT_H, 0x02},
+       {TFP410_REG_DE_CNT_L, 0x80},
+       {TFP410_REG_DE_LIN_H, 0x01},
+       {TFP410_REG_DE_LIN_L, 0xe0},
+       {-1, 0},
+};
+
+static int charon_last_stage_init(void)
+{
+       volatile struct mpc5xxx_lpb *lpb =
+               (struct mpc5xxx_lpb *) MPC5XXX_LPB;
+       int     oldbus = i2c_get_bus_num();
+       uchar   buf;
+       int     i = 0;
+
+       i2c_set_bus_num(CONFIG_SYS_TFP410_BUS);
+
+       /* check version */
+       if (tfp410_read_reg(TFP410_REG_DEV_ID_H, &buf) != 0)
+               return -1;
+       if (!(buf & 0x04))
+               return -1;
+       if (tfp410_read_reg(TFP410_REG_DEV_ID_L, &buf) != 0)
+               return -1;
+       if (!(buf & 0x10))
+               return -1;
+       /* OK, now init the chip */
+       while (tfp410_configtbl[i].reg != -1) {
+               int ret;
+
+               ret = tfp410_write_reg(tfp410_configtbl[i].reg,
+                               tfp410_configtbl[i].val);
+               if (ret != 0)
+                       return -1;
+               i++;
+       }
+       printf("TFP410 initialized.\n");
+       i2c_set_bus_num(oldbus);
+
+       /* set deadcycle for cs3 to 0 */
+       setbits_be32(&lpb->cs_deadcycle, 0xffffcfff);
+       return 0;
+}
+#endif
+
 int last_stage_init (void)
 {
        /*
@@ -530,6 +678,9 @@ int last_stage_init (void)
 #endif
 #endif /* !CONFIG_TQM5200S */
 
+#if defined(CONFIG_CHARON)
+       charon_last_stage_init();
+#endif
        return 0;
 }
 
@@ -625,8 +776,12 @@ void video_get_info_str (int line_number, char *info)
 {
        if (line_number == 1) {
        strcpy (info, " Board: TQM5200 (TQ-Components GmbH)");
-#if defined (CONFIG_STK52XX) || defined (CONFIG_TB5200) || defined(CONFIG_FO300)
+#if defined (CONFIG_CHARON) || defined (CONFIG_FO300) || \
+       defined(CONFIG_STK52XX) || defined(CONFIG_TB5200)
        } else if (line_number == 2) {
+#if defined (CONFIG_CHARON)
+               strcpy (info, "        on a CHARON carrier board");
+#endif
 #if defined (CONFIG_STK52XX)
                strcpy (info, "        on a STK52xx carrier board");
 #endif
@@ -726,9 +881,22 @@ int board_get_height (void)
 void ft_board_setup(void *blob, bd_t *bd)
 {
        ft_cpu_setup(blob, bd);
+#if defined(CONFIG_VIDEO)
+       fdt_add_edid(blob, "smi,sm501", edid_buf);
+#endif
 }
 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
 
+#if defined(CONFIG_RESET_PHY_R)
+#include <miiphy.h>
+
+void reset_phy(void)
+{
+       /* init Micrel KSZ8993 PHY */
+       miiphy_write("FEC", CONFIG_PHY_ADDR, 0x01, 0x09);
+}
+#endif
+
 int board_eth_init(bd_t *bis)
 {
        cpu_eth_init(bis); /* Built in FEC comes first */
index 6da9959a0b086a8efbe96a612f6ede2c5e6f7749..6258eb2322cf252a4a9118e0136eacf74c27ff81 100644 (file)
@@ -294,6 +294,7 @@ pcm030_LOWBOOT               powerpc     mpc5xxx     pcm030              phytec
 aev                          powerpc     mpc5xxx     tqm5200             tqc
 cam5200                      powerpc     mpc5xxx     tqm5200             tqc            -           TQM5200:CAM5200,TQM5200S,TQM5200_B
 cam5200_niosflash            powerpc     mpc5xxx     tqm5200             tqc            -           TQM5200:CAM5200,TQM5200S,TQM5200_B,CAM5200_NIOSFLASH
+charon                       powerpc     mpc5xxx     tqm5200             tqc            -           charon
 fo300                        powerpc     mpc5xxx     tqm5200             tqc            -           TQM5200:FO300
 MiniFAP                      powerpc     mpc5xxx     tqm5200             tqc            -           TQM5200:MINIFAP
 TB5200                       powerpc     mpc5xxx     tqm5200             tqc
index c2f6b8a7b391d7e0e19563dcbc8355df4da47e08..e822a5939ccc0377af9ec36b6344b7863807df8e 100644 (file)
@@ -49,7 +49,8 @@
 #endif
 
 /* On a Cameron or on a FO300 board or ...                             */
-#if !defined(CONFIG_CAM5200) && !defined(CONFIG_FO300)
+#if !defined(CONFIG_CAM5200) && !defined(CONFIG_CHARON) \
+       && !defined(CONFIG_FO300)
 #define CONFIG_STK52XX         1       /* ... on a STK52XX board               */
 #endif
 
@@ -79,7 +80,7 @@
                                                        /* switch is open */
 #endif /* CONFIG_FO300 */
 
-#ifdef CONFIG_STK52XX
+#if defined(CONFIG_CHARON) || defined(CONFIG_STK52XX)
 #define CONFIG_PS2KBD                  /* AT-PS/2 Keyboard             */
 #define CONFIG_PS2MULT                 /* .. on PS/2 Multiplexer       */
 #define CONFIG_PS2SERIAL       6       /* .. on PSC6                   */
@@ -92,7 +93,7 @@
  * 0x40000000 - 0x4fffffff - PCI Memory
  * 0x50000000 - 0x50ffffff - PCI IO Space
  */
-#ifdef CONFIG_STK52XX
+#if defined(CONFIG_CHARON) || defined(CONFIG_STK52XX)
 #define CONFIG_PCI             1
 #define CONFIG_PCI_PNP         1
 /* #define CONFIG_PCI_SCAN_SHOW        1 */
 #define CONFIG_ISO_PARTITION
 
 /* USB */
-#if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
+#if defined(CONFIG_CHARON) || defined(CONFIG_FO300) || \
+    defined(CONFIG_STK52XX)
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_SYS_OHCI_BE_CONTROLLER
 #define CONFIG_USB_STORAGE
 #define CONFIG_PCIAUTO_SKIP_HOST_BRIDGE        1
 #endif
 
-#if defined(CONFIG_MINIFAP) || defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
+#if defined(CONFIG_CHARON) || defined(CONFIG_FO300) || \
+       defined(CONFIG_MINIFAP) || defined(CONFIG_STK52XX)
     #define CONFIG_CMD_IDE
     #define CONFIG_CMD_FAT
     #define CONFIG_CMD_EXT2
 #endif
 
-#if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
+#if defined(CONFIG_CHARON) || defined(CONFIG_FO300) || \
+       defined(CONFIG_STK52XX)
     #define CONFIG_CFG_USB
     #define CONFIG_CFG_FAT
 #endif
                ":${hostname}:${netdev}:off panic=1\0"                  \
        "addcons=setenv bootargs ${bootargs} "                          \
                "console=${console},${baudrate}\0"                      \
-       "flash_self_old=sete console ttyS0; run ramargs addip addcons;" \
+       "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"              \
+       "flash_self_old=sete console ttyS0; "                           \
+               "run ramargs addip addcons addmtd; "                    \
                "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
        "flash_self=run ramargs addip addcons;"                         \
                "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"    \
                "sete console ttyS0; run nfsargs addip addcons;bootm\0" \
        "net_nfs=tftp ${kernel_addr_r} ${bootfile}; "                   \
                "tftp ${fdt_addr_r} ${fdt_file}; "                      \
-               "run nfsargs addip addcons; "                           \
+               "run nfsargs addip addcons addmtd; "                    \
                "bootm ${kernel_addr_r} - ${fdt_addr_r}\0"              \
        CUSTOM_ENV_SETTINGS                                             \
        "load=tftp 200000 ${u-boot}\0"                                  \
 #define CONFIG_MTD_DEVICE              /* needed for mtdparts commands */
 #define MTDIDS_DEFAULT         "nor0=TQM5200-0"
 
-#ifdef CONFIG_STK52XX
+#if defined(CONFIG_CHARON) || defined(CONFIG_STK52XX)
 # if defined(CONFIG_TQM5200_B)
 #  if defined(CONFIG_SYS_LOWBOOT)
 #   define MTDPARTS_DEFAULT    "mtdparts=TQM5200-0:1m(firmware),"      \
  * use PSC1: Bits 29-31 (mask: 0x00000007):
  *      100 -> UART (on all boards).
  */
+#if !defined(CONFIG_SYS_GPS_PORT_CONFIG)
 #if defined (CONFIG_MINIFAP)
 # define CONFIG_SYS_GPS_PORT_CONFIG    0x91000004
 #elif defined (CONFIG_STK52XX)
 #else  /* TMQ5200 Inbetriebnahme-Board */
 # define CONFIG_SYS_GPS_PORT_CONFIG    0x81000004
 #endif
+#endif
 
 /*
  * RTC configuration
diff --git a/include/configs/charon.h b/include/configs/charon.h
new file mode 100644 (file)
index 0000000..80a273c
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * (C) Copyright 2003-2005
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * (C) Copyright 2004-2006
+ * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
+ *
+ * (C) Copyright 2010
+ * Heiko Schocher, DENX Software Engineering, hs@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#ifndef __CONFIG_CHARON_H
+#define __CONFIG_CHARON_H
+
+#define CONFIG_CHARON
+#define CONFIG_HOSTNAME                charon
+
+#define CONFIG_SYS_GPS_PORT_CONFIG     0x81550414
+
+/* include common defines/options for TQM52xx boards */
+#include "TQM5200.h"
+
+/* defines special on charon board */
+#undef CONFIG_RTC_MPC5200
+#undef CONFIG_CMD_DATE
+
+#undef CUSTOM_ENV_SETTINGS
+#define CUSTOM_ENV_SETTINGS                                    \
+       "bootfile=/tftpboot/charon/uImage\0"                    \
+       "fdt_file=/tftpboot/charon/charon.dtb\0"                \
+       "u-boot=/tftpboot/charon/u-boot.bin\0"                  \
+       "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"
+
+
+/* additional features on charon board */
+#define CONFIG_RESET_PHY_R
+
+/*
+ * I2C configuration
+ */
+#define CONFIG_I2C_MULTI_BUS
+
+#define CONFIG_SYS_TFP410_ADDR 0x38
+#define CONFIG_SYS_TFP410_BUS  0
+
+/*
+ * FPGA configuration
+ */
+#define CONFIG_SYS_CS3_START           0xE8000000
+#define CONFIG_SYS_CS3_SIZE            0x80000 /* 512 KByte */
+
+/*
+ * CS3 Config Register Init:
+ *     CS3 Enabled
+ *     AddrBus: 8bits
+ *     DataBus: 4bytes
+ *     Multiplexed: Yes
+ *     MuxBank: 00
+ */
+#define CONFIG_SYS_CS3_CFG             0x00009310
+
+#endif /* __CONFIG_CHARON_H */