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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [sh/] [se77x9/] [v2_0/] [src/] [smsc37c93x.c] - Blame information for rev 249

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

Line No. Rev Author Line
1 27 unneback
//=============================================================================
2
//
3
//      smsc37c93x.c
4
//
5
//      Init code for SMSC 37C93x super IO controller
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 Red Hat, 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 version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//=============================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):   jskov
44
// Contributors:jskov
45
// Date:        2001-05-30
46
// Description: Init code for SMSC 37C93x super IO controller
47
//
48
//####DESCRIPTIONEND####
49
//
50
//=============================================================================
51
 
52
#include <pkgconf/hal.h>
53
#include CYGBLD_HAL_PLATFORM_H
54
 
55
#include <cyg/hal/hal_arch.h>           // SAVE/RESTORE GP macros
56
#include <cyg/hal/hal_io.h>             // IO macros
57
#include <cyg/hal/hal_intr.h>           // interrupt vectors
58
 
59
 
60
// From page 137+ in SMSC-37C93x.pdf
61
#define SMSC_CONFIG              0xb04007e0
62
#define SMSC_CONFIG_DATA         0xb04007e2
63
 
64
#define SMSC_CONFIG_DEV          0x0700
65
#define SMSC_CONFIG_POWER        0x2200
66
#define SMSC_CONFIG_ACTIVATE     0x3000
67
#define SMSC_CONFIG_ENTER        0x5500
68
#define SMSC_CONFIG_BASE_HIGH    0x6000
69
#define SMSC_CONFIG_BASE_LOW     0x6100
70
#define SMSC_CONFIG_IRQ          0x7000
71
#define SMSC_CONFIG_EXIT         0xaa00
72
#define SMSC_CONFIG_MODE         0xf000
73
 
74
#define SMSC_CONFIG_DEV_COM1     0x0400
75
#define SMSC_CONFIG_DEV_COM2     0x0500
76
 
77
#define SMSC_CONFIG_MODE_HIGH    0x0200
78
 
79
#define SMSC_CONFIG_ACTIVATE_ENABLE 0x0100
80
 
81
#define SMSC_CONFIG_POWER_COM1   0x1000
82
#define SMSC_CONFIG_POWER_COM2   0x2000
83
 
84
void
85
cyg_hal_init_superIO(void)
86
{
87
    // Note: two writes unlike the 37m81x!
88
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_ENTER);
89
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_ENTER);
90
 
91
    // Power ON COM1
92
    HAL_WRITE_UINT16(SMSC_CONFIG_POWER, SMSC_CONFIG_POWER_COM1);
93
 
94
    // Configure and enable COM1
95
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_DEV);
96
    HAL_WRITE_UINT16(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_COM1);
97
 
98
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_BASE_HIGH);
99
    HAL_WRITE_UINT16(SMSC_CONFIG_DATA, 0x0300);
100
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_BASE_LOW);
101
    HAL_WRITE_UINT16(SMSC_CONFIG_DATA, 0xf800);
102
 
103
    // Select IRQ 4 (see chap 8. Interrupt Controller)
104
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_IRQ);
105
    HAL_WRITE_UINT16(SMSC_CONFIG_DATA, 4<<8);
106
 
107
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_MODE);
108
    HAL_WRITE_UINT16(SMSC_CONFIG_DATA, SMSC_CONFIG_MODE_HIGH);
109
 
110
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE);
111
    HAL_WRITE_UINT16(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE);
112
 
113
    // Exit setup mode
114
    HAL_WRITE_UINT16(SMSC_CONFIG, SMSC_CONFIG_EXIT);
115
}
116
 
117
//-----------------------------------------------------------------------------
118
// end of smsc37c93x.c

powered by: WebSVN 2.1.0

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