blob: 2418d59d866c6a0b945321eadd6da87671e9d76f [file] [log] [blame]
wdenk65faef92004-03-25 19:29:38 +00001/*
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 "kup.h"
27
28int misc_init_f (void)
29{
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020030 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
wdenk65faef92004-03-25 19:29:38 +000031 volatile sysconf8xx_t *siu = &immap->im_siu_conf;
32
33 while (siu->sc_sipend & 0x20000000) {
34 /* printf("waiting for 5V VCC\n"); */
35 ;
36 }
37
38 /* RS232 / RS485 default is RS232 */
39 immap->im_ioport.iop_padat &= ~(PA_RS485);
40 immap->im_ioport.iop_papar &= ~(PA_RS485);
41 immap->im_ioport.iop_paodr &= ~(PA_RS485);
42 immap->im_ioport.iop_padir |= (PA_RS485);
43 return (0);
44}
45
46
47#ifdef CONFIG_IDE_LED
48void ide_led (uchar led, uchar status)
49{
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020050 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
wdenk65faef92004-03-25 19:29:38 +000051
52 /* We have one led for both pcmcia slots */
53 if (status) { /* led on */
54 immap->im_ioport.iop_padat &= ~(PA_LED_YELLOW);
55 } else {
56 immap->im_ioport.iop_padat |= (PA_LED_YELLOW);
57 }
58}
59#endif
60
61void poweron_key (void)
62{
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020063 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
wdenk65faef92004-03-25 19:29:38 +000064
65 immap->im_ioport.iop_pcpar &= ~(PC_SWITCH1);
66 immap->im_ioport.iop_pcdir &= ~(PC_SWITCH1);
67
68 if (immap->im_ioport.iop_pcdat & (PC_SWITCH1))
69 setenv ("key1", "off");
70 else
71 setenv ("key1", "on");
72}