diff options
author | wdenk <wdenk> | 2004-03-25 19:29:38 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2004-03-25 19:29:38 +0000 |
commit | 0608e04da9d0df5d00cf48a1d9141e2ea1bc9635 (patch) | |
tree | 28fa0ea5f1d70d9bae2eaca42643804235141d12 /board/kup/kup4x/usb.c | |
parent | b79a11cc2bda7a4d5e00444427a0d06b4e86a990 (diff) | |
download | u-boot-imx-0608e04da9d0df5d00cf48a1d9141e2ea1bc9635.zip u-boot-imx-0608e04da9d0df5d00cf48a1d9141e2ea1bc9635.tar.gz u-boot-imx-0608e04da9d0df5d00cf48a1d9141e2ea1bc9635.tar.bz2 |
* Patch by Klaus Heydeck, 13 Mar 2003:
Add support for KUP4X Board
Diffstat (limited to 'board/kup/kup4x/usb.c')
-rw-r--r-- | board/kup/kup4x/usb.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/board/kup/kup4x/usb.c b/board/kup/kup4x/usb.c new file mode 100644 index 0000000..5444008 --- /dev/null +++ b/board/kup/kup4x/usb.c @@ -0,0 +1,81 @@ +/* + * (C) Copyright 2004 + * Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.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 + */ + +#include <common.h> +#include <mpc8xx.h> +#include "../common/kup.h" + + +#define SL811_ADR (0x50000000) +#define SL811_DAT (0x50000001) + + +static void sl811_write_index_data (__u8 index, __u8 data) +{ + *(volatile unsigned char *) (SL811_ADR) = index; + __asm__ ("eieio"); + *(volatile unsigned char *) (SL811_DAT) = data; + __asm__ ("eieio"); +} + +static __u8 sl811_read_index_data (__u8 index) +{ + __u8 data; + + *(volatile unsigned char *) (SL811_ADR) = index; + __asm__ ("eieio"); + data = *(volatile unsigned char *) (SL811_DAT); + __asm__ ("eieio"); + return (data); +} + +int usb_init_kup4x (void) +{ + volatile immap_t *immap = (immap_t *) CFG_IMMR; + volatile memctl8xx_t *memctl = &immap->im_memctl; + int i; + unsigned char tmp; + + memctl = &immap->im_memctl; + memctl->memc_or7 = 0xFFFF8726; + memctl->memc_br7 = 0x50000401; /* start at 0x50000000 */ + /* BP 14 low = USB ON */ + immap->im_cpm.cp_pbdat &= ~(BP_USB_VCC); + /* PB 14 nomal port */ + immap->im_cpm.cp_pbpar &= ~(BP_USB_VCC); + /* output */ + immap->im_cpm.cp_pbdir |= (BP_USB_VCC); + + puts ("USB: "); + + for (i = 0x10; i < 0xff; i++) { + sl811_write_index_data (i, i); + tmp = (sl811_read_index_data (i)); + if (tmp != i) { + printf ("SL811 compare error index=0x%02x read=0x%02x\n", i, tmp); + return (-1); + } + } + printf ("SL811 ready\n"); + return (0); +} |