1 | /* |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. |
---|
4 | * On-Line Applications Research Corporation (OAR). |
---|
5 | * |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #include <rtems.h> |
---|
10 | #include <assert.h> |
---|
11 | #include <stdio.h> |
---|
12 | |
---|
13 | #include <bsp.h> |
---|
14 | #include "PCI.h" |
---|
15 | /*PAGE |
---|
16 | * |
---|
17 | * SCORE603e_FLASH_Disable |
---|
18 | */ |
---|
19 | |
---|
20 | unsigned int SCORE603e_FLASH_Disable( |
---|
21 | uint32_t area /* IN */ |
---|
22 | ) |
---|
23 | { |
---|
24 | uint8_t value; |
---|
25 | |
---|
26 | value = *SCORE603E_BOARD_CTRL_REG; |
---|
27 | value = value | (~SCORE603E_BRD_FLASH_DISABLE_MASK); |
---|
28 | *SCORE603E_BOARD_CTRL_REG = value; |
---|
29 | |
---|
30 | return RTEMS_SUCCESSFUL; |
---|
31 | } |
---|
32 | |
---|
33 | unsigned int SCORE603e_FLASH_verify_enable() |
---|
34 | { |
---|
35 | volatile uint8_t *Ctrl_Status_Register = |
---|
36 | (void *)SCORE603E_BOARD_CTRL_REG; |
---|
37 | uint8_t ctrl_value; |
---|
38 | uint32_t pci_value; |
---|
39 | |
---|
40 | ctrl_value = *Ctrl_Status_Register; |
---|
41 | if ( ctrl_value & SCORE603E_BRD_FLASH_DISABLE_MASK ) { |
---|
42 | printf ("Flash Writes Disabled by board control register %x\n", |
---|
43 | ctrl_value ); |
---|
44 | assert( 0x0 ); |
---|
45 | } |
---|
46 | |
---|
47 | pci_value = Read_pci_device_register( 0x800000A8 ); |
---|
48 | if (( pci_value & 0x00001000 ) == 0) { |
---|
49 | printf("Error PCI A8 \n"); |
---|
50 | assert( 0x0 ); |
---|
51 | } |
---|
52 | |
---|
53 | pci_value = Read_pci_device_register( 0x800000AC ); |
---|
54 | if ( pci_value & 0x02000000) { |
---|
55 | printf("Error PCI AC \n"); |
---|
56 | assert( 0x0 ); |
---|
57 | } |
---|
58 | return RTEMS_SUCCESSFUL; |
---|
59 | } |
---|
60 | |
---|
61 | unsigned int SCORE603e_FLASH_pci_reset_reg( |
---|
62 | uint8_t reg, |
---|
63 | uint32_t cmask, |
---|
64 | uint32_t mask |
---|
65 | ) |
---|
66 | { |
---|
67 | uint32_t pci_value; |
---|
68 | uint32_t value; |
---|
69 | |
---|
70 | pci_value = Read_pci_device_register( reg ); |
---|
71 | pci_value &= cmask; |
---|
72 | pci_value |= mask; |
---|
73 | Write_pci_device_register( reg, pci_value ); |
---|
74 | value = Read_pci_device_register( reg ); |
---|
75 | if (value != pci_value) { |
---|
76 | printf("Error PCI %x wrote %x read %x\n", reg, pci_value, value); |
---|
77 | } |
---|
78 | return RTEMS_SUCCESSFUL; |
---|
79 | } |
---|
80 | |
---|
81 | /*PAGE |
---|
82 | * |
---|
83 | * SCORE603e_FLASH_Enable_writes |
---|
84 | */ |
---|
85 | unsigned int SCORE603e_FLASH_Enable_writes( |
---|
86 | uint32_t area /* IN */ |
---|
87 | ) |
---|
88 | { |
---|
89 | uint8_t ctrl_value; |
---|
90 | uint32_t pci_value; |
---|
91 | |
---|
92 | ctrl_value = *SCORE603E_BOARD_CTRL_REG; |
---|
93 | ctrl_value = ctrl_value & 0xbf; |
---|
94 | *SCORE603E_BOARD_CTRL_REG = ctrl_value; |
---|
95 | |
---|
96 | pci_value = Read_pci_device_register( 0x800000A8 ); |
---|
97 | pci_value |= 0x00001000; |
---|
98 | Write_pci_device_register( 0x800000A8, pci_value ); |
---|
99 | |
---|
100 | pci_value = Read_pci_device_register( 0x800000AC ); |
---|
101 | pci_value &= (~0x02000000); |
---|
102 | Write_pci_device_register( 0x000000AC, pci_value ); |
---|
103 | |
---|
104 | return RTEMS_SUCCESSFUL; |
---|
105 | } |
---|