2009-11-16 13:34:24 -06:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009 by David Brownell
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
2013-06-02 14:32:36 -05:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-11-16 13:34:24 -06:00
|
|
|
*/
|
2009-09-03 03:23:39 -05:00
|
|
|
#ifndef __ARM_NANDIO_H
|
2009-11-16 12:47:45 -06:00
|
|
|
#define __ARM_NANDIO_H
|
2009-09-03 03:23:39 -05:00
|
|
|
|
2009-11-16 13:34:24 -06:00
|
|
|
/**
|
|
|
|
* Available operational states the arm_nand_data struct can be in.
|
|
|
|
*/
|
|
|
|
enum arm_nand_op {
|
2012-01-31 05:07:53 -06:00
|
|
|
ARM_NAND_NONE, /**< No operation performed. */
|
|
|
|
ARM_NAND_READ, /**< Read operation performed. */
|
|
|
|
ARM_NAND_WRITE, /**< Write operation performed. */
|
2009-11-16 13:34:24 -06:00
|
|
|
};
|
|
|
|
|
2009-11-16 12:47:45 -06:00
|
|
|
/**
|
|
|
|
* The arm_nand_data struct is used for defining NAND I/O operations on an ARM
|
|
|
|
* core.
|
|
|
|
*/
|
2009-09-03 03:23:39 -05:00
|
|
|
struct arm_nand_data {
|
2009-11-16 13:34:24 -06:00
|
|
|
/** Target is proxy for some ARM core. */
|
|
|
|
struct target *target;
|
2009-09-03 03:23:39 -05:00
|
|
|
|
2009-11-16 13:34:24 -06:00
|
|
|
/** The copy area holds code loop and data for I/O operations. */
|
2012-01-31 05:07:53 -06:00
|
|
|
struct working_area *copy_area;
|
2009-09-03 03:23:39 -05:00
|
|
|
|
2009-11-16 13:34:24 -06:00
|
|
|
/** The chunk size is the page size or ECC chunk. */
|
|
|
|
unsigned chunk_size;
|
|
|
|
|
|
|
|
/** Where data is read from or written to. */
|
|
|
|
uint32_t data;
|
2009-09-03 03:23:39 -05:00
|
|
|
|
2009-11-16 13:34:24 -06:00
|
|
|
/** Last operation executed using this struct. */
|
|
|
|
enum arm_nand_op op;
|
2009-09-03 03:23:39 -05:00
|
|
|
|
|
|
|
/* currently implicit: data width == 8 bits (not 16) */
|
|
|
|
};
|
|
|
|
|
|
|
|
int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size);
|
2009-11-15 02:32:38 -06:00
|
|
|
int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size);
|
2009-09-03 03:23:39 -05:00
|
|
|
|
2012-01-31 05:07:53 -06:00
|
|
|
#endif /* __ARM_NANDIO_H */
|