Merge with git://www.denx.de/git/u-boot.git
[platform/kernel/u-boot.git] / board / MAI / AmigaOneG3SE / AmigaOneG3SE.c
1 /*
2  * (C) Copyright 2002
3  * Hyperion Entertainment, ThomasF@hyperion-entertainment.com
4  * (C) Copyright 2006
5  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6  *
7  * See file CREDITS for list of people who contributed to this
8  * project.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License as
12  * published by the Free Software Foundation; either version 2 of
13  * the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23  * MA 02111-1307 USA
24  */
25
26 #include <common.h>
27 #include <command.h>
28 #include <pci.h>
29 #include "articiaS.h"
30 #include "memio.h"
31 #include "via686.h"
32
33 __asm__(" .globl send_kb                                    \n "
34         "send_kb:                                           \n "
35         "       lis     r9, 0xfe00                          \n "
36         "                                                   \n "
37         "       li      r4, 0x10        # retries           \n "
38         "       mtctr   r4                                  \n "
39         "                                                   \n "
40         "idle:                                              \n "
41         "       lbz     r4, 0x64(r9)                        \n "
42         "       andi.   r4, r4, 0x02                        \n "
43         "       bne     idle                                \n "
44
45         "ready:                                             \n "
46         "       stb     r3, 0x60(r9)                        \n "
47         "                                                   \n "
48         "check:                                             \n "
49         "       lbz     r4, 0x64(r9)                        \n "
50         "       andi.   r4, r4, 0x01                        \n "
51         "       beq     check                               \n "
52         "                                                   \n "
53         "       lbz     r4, 0x60(r9)                        \n "
54         "       cmpwi   r4, 0xfa                            \n "
55         "       beq     done                                \n "
56
57         "       bdnz    idle                                \n "
58
59         "       li      r3, 0                               \n "
60         "       blr                                         \n "
61
62         "done:                                              \n "
63         "       li      r3, 1                               \n "
64         "       blr                                         \n "
65
66         ".globl test_kb                                     \n "
67         "test_kb:                                           \n "
68         "       mflr    r10                                 \n "
69         "       li      r3, 0xed                            \n "
70         "       bl      send_kb                             \n "
71         "       li      r3, 0x01                            \n "
72         "       bl      send_kb                             \n "
73         "       mtlr    r10                                 \n "
74         "       blr                                         "
75 );
76
77
78 int checkboard (void)
79 {
80         printf ("Board: AmigaOneG3SE\n");
81         return 0;
82 }
83
84 long initdram (int board_type)
85 {
86         return articiaS_ram_init ();
87 }
88
89
90 void after_reloc (ulong dest_addr, gd_t *gd)
91 {
92         board_init_r (gd, dest_addr);
93 }
94
95
96 int misc_init_r (void)
97 {
98         extern pci_dev_t video_dev;
99         extern void drv_video_init (void);
100
101         if (video_dev != ~0)
102                 drv_video_init ();
103
104         return (0);
105 }
106
107
108 void pci_init_board (void)
109 {
110 #ifndef CONFIG_RAMBOOT
111         articiaS_pci_init ();
112 #endif
113 }