]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/eltec/elppc/elppc.c
mpc8xx: remove unused linker script
[karo-tx-uboot.git] / board / eltec / elppc / elppc.c
1 /*
2  * (C) Copyright 2002 ELTEC Elektronik AG
3  * Frank Gottschling <fgottschling@eltec.de>
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <common.h>
9 #include <command.h>
10 #include <mpc106.h>
11 #include <video_fb.h>
12 #include <netdev.h>
13
14 DECLARE_GLOBAL_DATA_PTR;
15
16 /* ------------------------------------------------------------------------- */
17
18 int checkboard (void)
19 {
20         puts ("Board: ELTEC PowerPC\n");
21         return (0);
22 }
23
24 /* ------------------------------------------------------------------------- */
25
26 int checkflash (void)
27 {
28         /* TODO */
29         printf ("Test not implemented !\n");
30         return (0);
31 }
32
33 /* ------------------------------------------------------------------------- */
34
35 static unsigned int mpc106_read_cfg_dword (unsigned int reg)
36 {
37         unsigned int reg_addr = MPC106_REG | (reg & 0xFFFFFFFC);
38
39         out32r (MPC106_REG_ADDR, reg_addr);
40
41         return (in32r (MPC106_REG_DATA | (reg & 0x3)));
42 }
43
44 /* ------------------------------------------------------------------------- */
45
46 long int dram_size (int board_type)
47 {
48         /*
49          * No actual initialisation to do - done when setting up
50          * PICRs MCCRs ME/SARs etc in asm_init.S.
51          */
52
53         register unsigned long i, msar1, mear1, memSize;
54
55 #if defined(CONFIG_SYS_MEMTEST)
56         register unsigned long reg;
57
58         printf ("Testing DRAM\n");
59
60         /* write each mem addr with it's address */
61         for (reg = CONFIG_SYS_MEMTEST_START; reg < CONFIG_SYS_MEMTEST_END; reg += 4)
62                 *reg = reg;
63
64         for (reg = CONFIG_SYS_MEMTEST_START; reg < CONFIG_SYS_MEMTEST_END; reg += 4) {
65                 if (*reg != reg)
66                         return -1;
67         }
68 #endif
69
70         /*
71          * Since MPC107 memory controller chip has already been set to
72          * control all memory, just read and interpret its memory boundery register.
73          */
74         memSize = 0;
75         msar1 = mpc106_read_cfg_dword (MPC106_MSAR1);
76         mear1 = mpc106_read_cfg_dword (MPC106_MEAR1);
77         i = mpc106_read_cfg_dword (MPC106_MBER) & 0xf;
78
79         do {
80                 if (i & 0x01)                   /* is bank enabled ? */
81                         memSize += (mear1 & 0xff) - (msar1 & 0xff) + 1;
82                 msar1 >>= 8;
83                 mear1 >>= 8;
84                 i >>= 1;
85         } while (i);
86
87         return (memSize * 0x100000);
88 }
89
90 /* ------------------------------------------------------------------------- */
91
92 phys_size_t initdram (int board_type)
93 {
94         return dram_size (board_type);
95 }
96
97 /* ------------------------------------------------------------------------- */
98
99 /*
100  * The BAB 911 can be reset by writing bit 0 of the Processor Initialization
101  * Register PI in the MPC 107 (at offset 0x41090 of the Embedded Utilities
102  * Memory Block).
103  */
104 int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
105 {
106         out8 (MPC107_EUMB_PI, 1);
107         return (0);
108 }
109
110 /* ------------------------------------------------------------------------- */
111
112 #if defined(CONFIG_WATCHDOG)
113
114 /*
115  * Since the 7xx CPUs don't have an internal watchdog, this function is
116  * board specific.
117  */
118 void watchdog_reset (void)
119 {
120 }
121 #endif                                                  /* CONFIG_WATCHDOG */
122
123 /* ------------------------------------------------------------------------- */
124
125 void after_reloc (ulong dest_addr)
126 {
127         /*
128          * Jump to the main U-Boot board init code
129          */
130         board_init_r ((gd_t *)gd, dest_addr);
131 }
132
133 /* ------------------------------------------------------------------------- */
134
135 #ifdef CONFIG_CONSOLE_EXTRA_INFO
136 extern GraphicDevice smi;
137
138 void video_get_info_str (int line_number, char *info)
139 {
140         /* init video info strings for graphic console */
141         switch (line_number) {
142         case 1:
143                 sprintf (info, " MPC7xx V%d.%d at %d / %d MHz",
144                                  (get_pvr () >> 8) & 0xFF, get_pvr () & 0xFF, 400, 100);
145                 return;
146         case 2:
147                 sprintf (info, " ELTEC ELPPC with %ld MB DRAM and %ld MB FLASH",
148                                  dram_size (0) / 0x100000, flash_init () / 0x100000);
149                 return;
150         case 3:
151                 sprintf (info, " %s", smi.modeIdent);
152                 return;
153         }
154
155         /* no more info lines */
156         *info = 0;
157         return;
158 }
159 #endif
160
161 int board_eth_init(bd_t *bis)
162 {
163         return pci_eth_init(bis);
164 }