1*cbab9cadSchs /* $NetBSD: flashvar.h,v 1.3 2012/10/27 17:17:55 chs Exp $ */ 2f8bc0014Sigy 3f8bc0014Sigy /* 4f8bc0014Sigy * Copyright (c) 2002 The NetBSD Foundation, Inc. 5f8bc0014Sigy * All rights reserved. 6f8bc0014Sigy * 7f8bc0014Sigy * This code is derived from software contributed to The NetBSD Foundation 8f8bc0014Sigy * by Naoto Shimazaki of YOKOGAWA Electric Corporation. 9f8bc0014Sigy * 10f8bc0014Sigy * Redistribution and use in source and binary forms, with or without 11f8bc0014Sigy * modification, are permitted provided that the following conditions 12f8bc0014Sigy * are met: 13f8bc0014Sigy * 1. Redistributions of source code must retain the above copyright 14f8bc0014Sigy * notice, this list of conditions and the following disclaimer. 15f8bc0014Sigy * 2. Redistributions in binary form must reproduce the above copyright 16f8bc0014Sigy * notice, this list of conditions and the following disclaimer in the 17f8bc0014Sigy * documentation and/or other materials provided with the distribution. 18f8bc0014Sigy * 19f8bc0014Sigy * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20f8bc0014Sigy * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21f8bc0014Sigy * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22f8bc0014Sigy * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23f8bc0014Sigy * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24f8bc0014Sigy * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25f8bc0014Sigy * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26f8bc0014Sigy * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27f8bc0014Sigy * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28f8bc0014Sigy * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29f8bc0014Sigy * POSSIBILITY OF SUCH DAMAGE. 30f8bc0014Sigy */ 31f8bc0014Sigy 32f8bc0014Sigy /* 33f8bc0014Sigy * Intel 28F128 Flash Memory driver variables 34f8bc0014Sigy */ 35f8bc0014Sigy 36f8bc0014Sigy #define FLASH_RESET 0xff 37f8bc0014Sigy 38f8bc0014Sigy 39f8bc0014Sigy #define FLASH_ST_BUSY 0x01 40f8bc0014Sigy 41f8bc0014Sigy struct flash_softc { 42f8bc0014Sigy bus_space_tag_t sc_iot; 43f8bc0014Sigy bus_space_handle_t sc_ioh; 44f8bc0014Sigy size_t sc_size; 45f8bc0014Sigy size_t sc_block_size; 46f8bc0014Sigy int sc_status; 47f8bc0014Sigy u_int8_t *sc_buf; 48f8bc0014Sigy const struct flashops { 49f8bc0014Sigy const char *fo_name; 50f8bc0014Sigy int (*fo_erase) (struct flash_softc *, bus_size_t); 51f8bc0014Sigy int (*fo_write) (struct flash_softc *, bus_size_t); 52f8bc0014Sigy } *sc_ops; 53f8bc0014Sigy 54f8bc0014Sigy int sc_write_buffer_size; 55f8bc0014Sigy int sc_typ_word_prog_timo; 56f8bc0014Sigy int sc_max_word_prog_timo; 57f8bc0014Sigy int sc_typ_buffer_write_timo; 58f8bc0014Sigy int sc_max_buffer_write_timo; 59f8bc0014Sigy int sc_typ_block_erase_timo; 60f8bc0014Sigy int sc_max_block_erase_timo; 61f8bc0014Sigy u_int8_t sc_cfi_raw[CFI_TOTAL_SIZE]; 62f8bc0014Sigy }; 63f8bc0014Sigy 64f8bc0014Sigy #define flash_block_erase(sc, off) (sc)->sc_ops->fo_erase((sc), (off)) 65f8bc0014Sigy #define flash_block_write(sc, off) (sc)->sc_ops->fo_write((sc), (off)) 66f8bc0014Sigy 67f8bc0014Sigy #define FLASH_TIMEOUT 0x40000000 68