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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [xscale/] [grg/] [current/] [src/] [grg_pci.c] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      grg_pci.c
4
//
5
//      HAL PCI board support code for Intel XScale GRG
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):    msalter
43
// Contributors: msalter
44
// Date:         2003-02-05
45
// Purpose:      HAL PCI board support
46
// Description:  Implementations of HAL board interfaces
47
//
48
//####DESCRIPTIONEND####
49
//
50
//========================================================================*/
51
#include <pkgconf/hal.h>
52
#include <pkgconf/system.h>
53
#include CYGBLD_HAL_PLATFORM_H
54
 
55
#ifdef CYGPKG_IO_PCI
56
 
57
#include <cyg/infra/cyg_type.h>         // base types
58
#include <cyg/infra/cyg_trac.h>         // tracing macros
59
#include <cyg/infra/cyg_ass.h>          // assertion macros
60
 
61
#include <cyg/hal/hal_io.h>             // IO macros
62
#include <cyg/hal/hal_if.h>             // calling interface API
63
#include <cyg/hal/hal_arch.h>           // Register state info
64
#include <cyg/hal/hal_diag.h>
65
#include <cyg/hal/hal_intr.h>           // Interrupt names
66
#include <cyg/hal/hal_cache.h>
67
#include <cyg/io/pci_hw.h>
68
#include <cyg/io/pci.h>
69
 
70
 
71
#define IXP425_PCI_MAX_DEV      4
72
#define IXP425_PCI_IRQ_LINES    4
73
 
74
// PCI pin mappings
75
#define PCI_CLK_GPIO     14  // CLK0
76
#define PCI_RESET_GPIO   12
77
#define PCI_INTA_GPIO    11
78
 
79
#define INTA    CYGNUM_HAL_INTERRUPT_GPIO11
80
 
81
void
82
cyg_hal_plf_pci_translate_interrupt(cyg_uint32 bus, cyg_uint32 devfn,
83
                                    CYG_ADDRWORD *vec, cyg_bool *valid)
84
{
85
    *vec = INTA;
86
    *valid = true;
87
}
88
 
89
 
90
#define HAL_PCI_CLOCK_ENABLE() \
91
    *IXP425_GPCLKR |= GPCLKR_CLK0_ENABLE;  // GPIO(0) used for PCI clock
92
 
93
#define HAL_PCI_CLOCK_DISABLE() \
94
    *IXP425_GPCLKR &= ~GPCLKR_CLK0_ENABLE;  // GPIO(0) used for PCI clock
95
 
96
#define HAL_PCI_CLOCK_CONFIG() \
97
    *IXP425_GPCLKR |= GPCLKR_CLK0_PCLK2;
98
 
99
#define HAL_PCI_RESET_ASSERT() \
100
    HAL_GPIO_OUTPUT_CLEAR(PCI_RESET_GPIO);
101
 
102
#define HAL_PCI_RESET_DEASSERT() \
103
    HAL_GPIO_OUTPUT_SET(PCI_RESET_GPIO);
104
 
105
void
106
hal_plf_pci_init(void)
107
{
108
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
109
    HAL_PCI_RESET_ASSERT();
110
    HAL_PCI_CLOCK_DISABLE();
111
 
112
    // Set GPIO line direction
113
    HAL_GPIO_OUTPUT_ENABLE(PCI_CLK_GPIO);
114
    HAL_GPIO_OUTPUT_ENABLE(PCI_RESET_GPIO);
115
    HAL_GPIO_OUTPUT_DISABLE(PCI_INTA_GPIO);
116
 
117
    // configure PCI interrupt lines for active low irq
118
    HAL_INTERRUPT_CONFIGURE(INTA, 1, 0);
119
 
120
    // wait 1ms to satisfy "minimum reset assertion time" of the PCI spec.
121
    HAL_DELAY_US(1000);
122
    HAL_PCI_CLOCK_CONFIG();
123
    HAL_PCI_CLOCK_ENABLE();
124
 
125
    // wait 100us to satisfy "minimum reset assertion time from clock stable" 
126
    // requirement of the PCI spec.
127
    HAL_DELAY_US(100);
128
    HAL_PCI_RESET_DEASSERT();
129
#endif
130
}
131
 
132
#endif // CYGPKG_IO_PCI

powered by: WebSVN 2.1.0

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