OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-arm/] [hc_sl811-hw.h] - Blame information for rev 1276

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/*
2
File: include/asm-arm/hc_sl811-hw.h
3
*/
4
 
5
/* The base_addr, data_reg_addr, and irq number are board specific.
6
 * The current values are design to run on the Accelent SA1110 IDP
7
 * NOTE: values need to modify for different development boards
8
 */
9
 
10
#define SIZEOF_IO_REGION        256     /* Size for request/release region */
11
static int base_addr     = 0xd3800000;
12
static int data_reg_addr = 0xd3810000;
13
static int irq           = 34;          /* Also change SL811_SET_GPDR! */
14
static int gprd          = 13;          /* also change irq  !!! */
15
 
16
MODULE_PARM (base_addr, "i");
17
MODULE_PARM_DESC (base_addr, "sl811 base address 0xd3800000");
18
MODULE_PARM (data_reg_addr, "i");
19
MODULE_PARM_DESC (data_reg_addr, "sl811 data register address 0xd3810000");
20
MODULE_PARM (irq, "i");
21
MODULE_PARM_DESC (irq, "IRQ 34 (default)");
22
MODULE_PARM(gprd,"i");
23
MODULE_PARM_DESC(gprd,"sl811 GPRD port 13(default)");
24
 
25
/*
26
 * Low level: Read from Data port [arm]
27
 */
28
static __u8 inline sl811_read_data (hcipriv_t *hp)
29
{
30
        __u8 data;
31
        data = readb (hp->hcport2);
32
        rmb ();
33
        return (data);
34
}
35
 
36
/*
37
 * Low level: Write to index register [arm]
38
 */
39
static void inline sl811_write_index (hcipriv_t *hp, __u8 index)
40
{
41
        writeb (offset, hp->hcport);
42
        wmb ();
43
}
44
 
45
/*
46
 * Low level: Write to Data port [arm]
47
 */
48
static void inline sl811_write_data (hcipriv_t *hp, __u8 data)
49
{
50
        writeb (data, hp->hcport2);
51
}
52
 
53
/*
54
 * Low level: Write to index register and data port [arm]
55
 */
56
static void inline sl811_write_index_data (hcipriv_t *hp, __u8 index, __u8 data)
57
{
58
        writeb (offset, hp->hcport);
59
        writeb (data, hp->hcport2);
60
        wmb ();
61
}
62
 
63
/*****************************************************************
64
 *
65
 * Function Name: init_irq [arm]
66
 *
67
 * This function is board specific.  It sets up the interrupt to
68
 * be an edge trigger and trigger on the rising edge
69
 *
70
 * Input: none
71
 *
72
 * Return value  : none
73
 *
74
 *****************************************************************/
75
static void inline init_irq (void)
76
{
77
        GPDR &= ~(1 << gprd);
78
        set_GPIO_IRQ_edge (1 << gprd, GPIO_RISING_EDGE);
79
}
80
 
81
/*****************************************************************
82
 *
83
 * Function Name: release_regions [arm]
84
 *
85
 * This function is board specific.  It frees all io address.
86
 *
87
 * Input: hcipriv_t *
88
 *
89
 * Return value  : none
90
 *
91
 *****************************************************************/
92
static void inline release_regions (hcipriv_t *hp)
93
{
94
        if (hp->hcport > 0) {
95
                release_region (hp->hcport, SIZEOF_IO_REGION);
96
                hp->hcport = 0;
97
        }
98
 
99
        if (hp->hcport2 > 0) {
100
                release_region (hp->hcport2, SIZEOF_IO_REGION);
101
                hp->hcport2 = 0;
102
        }
103
}
104
 
105
/*****************************************************************
106
 *
107
 * Function Name: request_regions [arm]
108
 *
109
 * This function is board specific. It request all io address and
110
 * maps into memory (if can).
111
 *
112
 * Input: hcipriv_t *
113
 *
114
 * Return value  : 0 = OK
115
 *
116
 *****************************************************************/
117
static int inline request_regions (hcipriv_t *hp, int addr1, int addr2)
118
{
119
        if (!request_region (addr1, SIZEOF_IO_REGION, "SL811 USB HOST")) {
120
                DBGERR ("request address %d failed", addr1);
121
                return -EBUSY;
122
        }
123
        hp->hcport = addr1;
124
        if (!hp->hcport) {
125
                DBGERR ("Error mapping SL811 Memory 0x%x", addr1);
126
        }
127
 
128
        if (!request_region (addr2, SIZEOF_IO_REGION, "SL811 USB HOST")) {
129
                DBGERR ("request address %d failed", addr2);
130
                return -EBUSY;
131
        }
132
        hp->hcport2 = addr2;
133
        if (!hp->hcport2) {
134
                DBGERR ("Error mapping SL811 Memory 0x%x", addr2);
135
        }
136
 
137
        return 0;
138
}
139
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.