blob: 060aecedefe1e966e013ee815f6046713e443b77 [file] [log] [blame]
Heiko Schocherca43ba12007-01-11 15:44:44 +01001/*
2 * (C) Copyright 2000
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.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/**
25 * hcWriteWord - write a 16 bit value into the USB controller
26 * @base: base address to access the chip registers
27 * @value: 16 bit value to write into register @offset
28 * @offset: register to write the @value into
29 *
30 */
31static void inline hcWriteWord (unsigned long base, unsigned int value,
32 unsigned int offset)
33{
34 out_le16 ((volatile u16*)(base + 2), offset | 0x80);
35 out_le16 ((volatile u16*)base, value);
36}
37
38/**
39 * hcWriteDWord - write a 32 bit value into the USB controller
40 * @base: base address to access the chip registers
41 * @value: 32 bit value to write into register @offset
42 * @offset: register to write the @value into
43 *
44 */
45
46static void inline hcWriteDWord (unsigned long base, unsigned long value,
47 unsigned int offset)
48{
49 out_le16 ((volatile u16*)(base + 2), offset | 0x80);
50 out_le16 ((volatile u16*)base, value);
51 out_le16 ((volatile u16*)base, value >> 16);
52}
53
54/**
55 * hcReadWord - read a 16 bit value from the USB controller
56 * @base: base address to access the chip registers
57 * @offset: register to read from
58 *
59 * Returns the readed register value
60 */
61
62static unsigned int inline hcReadWord (unsigned long base, unsigned int offset)
63{
64 out_le16 ((volatile u16*)(base + 2), offset);
65 return (in_le16 ((volatile u16*)base));
66}
67
68/**
69 * hcReadDWord - read a 32 bit value from the USB controller
70 * @base: base address to access the chip registers
71 * @offset: register to read from
72 *
73 * Returns the readed register value
74 */
75
76static unsigned long inline hcReadDWord (unsigned long base, unsigned int offset)
77{
78 unsigned long val, val16;
79
80 out_le16 ((volatile u16*)(base + 2), offset);
81 val = in_le16((volatile u16*)base);
82 val16 = in_le16((volatile u16*)base);
83 return (val | (val16 << 16));
84}
85
86/* control and status registers isp1161 */
87#define HcRevision 0x00
Wolfgang Denk53677ef2008-05-20 16:00:29 +020088#define HcControl 0x01
Heiko Schocherca43ba12007-01-11 15:44:44 +010089#define HcCommandStatus 0x02
90#define HcInterruptStatus 0x03
91#define HcInterruptEnable 0x04
92#define HcInterruptDisable 0x05
93#define HcFmInterval 0x0D
94#define HcFmRemaining 0x0E
95#define HcFmNumber 0x0F
96#define HcLSThreshold 0x11
97#define HcRhDescriptorA 0x12
98#define HcRhDescriptorB 0x13
99#define HcRhStatus 0x14
100#define HcRhPortStatus1 0x15
101#define HcRhPortStatus2 0x16
102
103#define HcHardwareConfiguration 0x20
104#define HcDMAConfiguration 0x21
105#define HcTransferCounter 0x22
106#define HcuPInterrupt 0x24
107#define HcuPInterruptEnable 0x25
108#define HcChipID 0x27
109#define HcScratch 0x28
110#define HcSoftwareReset 0x29
111#define HcITLBufferLength 0x2A
112#define HcATLBufferLength 0x2B
113#define HcBufferStatus 0x2C
114#define HcReadBackITL0Length 0x2D
115#define HcReadBackITL1Length 0x2E
116#define HcITLBufferPort 0x40
117#define HcATLBufferPort 0x41