]> git.sur5r.net Git - u-boot/blob - board/kup/kup4x/usb.c
* Temporarily disabled John Kerl's extended MII command code because
[u-boot] / board / kup / kup4x / usb.c
1 /*
2  * (C) Copyright 2004
3  * Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23
24 #include <common.h>
25 #include <mpc8xx.h>
26 #include "../common/kup.h"
27
28
29 #define  SL811_ADR (0x50000000)
30 #define  SL811_DAT (0x50000001)
31
32
33 static void sl811_write_index_data (__u8 index, __u8 data)
34 {
35         *(volatile unsigned char *) (SL811_ADR) = index;
36         __asm__ ("eieio");
37         *(volatile unsigned char *) (SL811_DAT) = data;
38         __asm__ ("eieio");
39 }
40
41 static __u8 sl811_read_index_data (__u8 index)
42 {
43         __u8 data;
44
45         *(volatile unsigned char *) (SL811_ADR) = index;
46         __asm__ ("eieio");
47         data = *(volatile unsigned char *) (SL811_DAT);
48         __asm__ ("eieio");
49         return (data);
50 }
51
52 int usb_init_kup4x (void)
53 {
54         volatile immap_t *immap = (immap_t *) CFG_IMMR;
55         volatile memctl8xx_t *memctl = &immap->im_memctl;
56         int i;
57         unsigned char tmp;
58
59         memctl = &immap->im_memctl;
60         memctl->memc_or7 = 0xFFFF8726;
61         memctl->memc_br7 = 0x50000401;  /* start at 0x50000000 */
62         /* BP 14 low = USB ON */
63         immap->im_cpm.cp_pbdat &= ~(BP_USB_VCC);
64         /* PB 14 nomal port */
65         immap->im_cpm.cp_pbpar &= ~(BP_USB_VCC);
66         /* output */
67         immap->im_cpm.cp_pbdir |= (BP_USB_VCC);
68
69         puts ("USB:   ");
70
71         for (i = 0x10; i < 0xff; i++) {
72                 sl811_write_index_data (i, i);
73                 tmp = (sl811_read_index_data (i));
74                 if (tmp != i) {
75                         printf ("SL811 compare error index=0x%02x read=0x%02x\n", i, tmp);
76                         return (-1);
77                 }
78         }
79         printf ("SL811 ready\n");
80         return (0);
81 }