1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// powerpc_pati_flash.c
|
4 |
|
|
//
|
5 |
|
|
// Flash programming for INTEL device on PowerPC MPC555 MPL PATI
|
6 |
|
|
// board
|
7 |
|
|
//
|
8 |
|
|
//==========================================================================
|
9 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
10 |
|
|
// -------------------------------------------
|
11 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
12 |
|
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
13 |
|
|
//
|
14 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
15 |
|
|
// the terms of the GNU General Public License as published by the Free
|
16 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
17 |
|
|
// version.
|
18 |
|
|
//
|
19 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
20 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
21 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
22 |
|
|
// for more details.
|
23 |
|
|
//
|
24 |
|
|
// You should have received a copy of the GNU General Public License
|
25 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
26 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
27 |
|
|
//
|
28 |
|
|
// As a special exception, if other files instantiate templates or use
|
29 |
|
|
// macros or inline functions from this file, or you compile this file
|
30 |
|
|
// and link it with other works to produce a work based on this file,
|
31 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
32 |
|
|
// the GNU General Public License. However the source code for this file
|
33 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
34 |
|
|
// General Public License v2.
|
35 |
|
|
//
|
36 |
|
|
// This exception does not invalidate any other reasons why a work based
|
37 |
|
|
// on this file might be covered by the GNU General Public License.
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
//==========================================================================
|
41 |
|
|
//#####DESCRIPTIONBEGIN####
|
42 |
|
|
//
|
43 |
|
|
// Author(s): Steven Clugston
|
44 |
|
|
// Original: jskov
|
45 |
|
|
// Contributors:
|
46 |
|
|
// Date: 2008-06-18
|
47 |
|
|
// Purpose:
|
48 |
|
|
// Description:
|
49 |
|
|
//
|
50 |
|
|
//####DESCRIPTIONEND####
|
51 |
|
|
//
|
52 |
|
|
//==========================================================================
|
53 |
|
|
#include <cyg/hal/hal_intr.h>
|
54 |
|
|
#include <cyg/hal/plf_misc.h>
|
55 |
|
|
|
56 |
|
|
//--------------------------------------------------------------------------
|
57 |
|
|
// Device properties
|
58 |
|
|
|
59 |
|
|
// One 28F320C3T part used on the board
|
60 |
|
|
/// 32Mbit top boot block
|
61 |
|
|
#define CYGNUM_FLASH_INTERLEAVE (1)
|
62 |
|
|
#define CYGNUM_FLASH_SERIES (1)
|
63 |
|
|
#define CYGNUM_FLASH_WIDTH (16)
|
64 |
|
|
#define CYGNUM_FLASH_BASE (CYGMEM_REGION_eflash)
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
//--------------------------------------------------------------------------
|
68 |
|
|
// Platform specific extras
|
69 |
|
|
|
70 |
|
|
// The programming voltage is switched on/off by setting a register bit in
|
71 |
|
|
// the on board EPLD.
|
72 |
|
|
#define CYGHWR_FLASH_WRITE_ENABLE() \
|
73 |
|
|
{cyg_uint32 epld_misc; \
|
74 |
|
|
HAL_READ_UINT32(CYGPLF_REG_PLD_MISC_CONFIG, epld_misc); \
|
75 |
|
|
epld_misc |= CYGPLF_REG_PLD_MISC_EXT_VPP; \
|
76 |
|
|
HAL_WRITE_UINT32(CYGPLF_REG_PLD_MISC_CONFIG, epld_misc);}\
|
77 |
|
|
|
78 |
|
|
#define CYGHWR_FLASH_WRITE_DISABLE() \
|
79 |
|
|
{cyg_uint32 epld_misc; \
|
80 |
|
|
HAL_READ_UINT32(CYGPLF_REG_PLD_MISC_CONFIG, epld_misc); \
|
81 |
|
|
epld_misc &= ~(CYGPLF_REG_PLD_MISC_EXT_VPP); \
|
82 |
|
|
HAL_WRITE_UINT32(CYGPLF_REG_PLD_MISC_CONFIG, epld_misc);}\
|
83 |
|
|
|
84 |
|
|
// Force a reset of the flash to keep driver happy
|
85 |
|
|
# define CYGHWR_FLASH_28FXXX_PLF_INIT() \
|
86 |
|
|
HAL_WRITE_UINT16(CYGNUM_FLASH_BASE,0xFF); \
|
87 |
|
|
HAL_DELAY_US(10); \
|
88 |
|
|
|
89 |
|
|
//--------------------------------------------------------------------------
|
90 |
|
|
// Now include the driver code.
|
91 |
|
|
#include "cyg/io/flash_28fxxx.inl"
|
92 |
|
|
|
93 |
|
|
// ------------------------------------------------------------------------
|
94 |
|
|
// EOF powerpc_pati_flash.c
|