2009-04-10 18:15:10 +02:00
|
|
|
/*
|
|
|
|
mini - a Free Software replacement for the Nintendo/BroadOn IOS.
|
2009-05-11 07:53:16 +02:00
|
|
|
low-level NAND support
|
2009-04-10 18:15:10 +02:00
|
|
|
|
|
|
|
Copyright (C) 2008, 2009 Hector Martin "marcan" <marcan@marcansoft.com>
|
2009-04-13 23:13:51 +02:00
|
|
|
Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
|
2009-04-10 18:15:10 +02:00
|
|
|
|
2009-05-11 07:53:16 +02:00
|
|
|
# This code is licensed to you under the terms of the GNU GPL, version 2;
|
|
|
|
# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
2009-04-10 18:15:10 +02:00
|
|
|
*/
|
2009-05-11 07:53:16 +02:00
|
|
|
|
2009-01-17 15:05:13 +01:00
|
|
|
#ifndef __NAND_H__
|
|
|
|
#define __NAND_H__
|
|
|
|
|
|
|
|
#include "types.h"
|
2009-01-27 18:12:41 +01:00
|
|
|
#include "ipc.h"
|
2009-01-17 15:05:13 +01:00
|
|
|
|
2009-05-11 08:36:36 +02:00
|
|
|
#define PAGE_SIZE 2048
|
2009-03-18 18:18:14 +01:00
|
|
|
#define PAGE_SPARE_SIZE 64
|
|
|
|
#define ECC_BUFFER_SIZE (PAGE_SPARE_SIZE+16)
|
|
|
|
#define ECC_BUFFER_ALLOC (PAGE_SPARE_SIZE+32)
|
2009-05-11 08:36:36 +02:00
|
|
|
#define BLOCK_SIZE 64
|
2009-03-18 18:18:14 +01:00
|
|
|
#define NAND_MAX_PAGE 0x40000
|
|
|
|
|
2009-01-17 15:05:13 +01:00
|
|
|
void nand_irq(void);
|
|
|
|
|
|
|
|
void nand_send_command(u32 command, u32 bitmask, u32 flags, u32 num_bytes);
|
|
|
|
int nand_reset(void);
|
2009-02-01 10:34:11 +01:00
|
|
|
void nand_get_id(u8 *);
|
|
|
|
void nand_get_status(u8 *);
|
2009-01-17 15:05:13 +01:00
|
|
|
void nand_read_page(u32 pageno, void *data, void *ecc);
|
|
|
|
void nand_write_page(u32 pageno, void *data, void *ecc);
|
|
|
|
void nand_erase_block(u32 pageno);
|
2009-02-24 16:20:28 +01:00
|
|
|
void nand_wait(void);
|
2009-01-17 15:05:13 +01:00
|
|
|
|
|
|
|
void nand_read_cluster(u32 clusterno, void *data);
|
|
|
|
|
2009-03-07 17:31:45 +01:00
|
|
|
#define NAND_ECC_OK 0
|
|
|
|
#define NAND_ECC_CORRECTED 1
|
|
|
|
#define NAND_ECC_UNCORRECTABLE -1
|
|
|
|
|
|
|
|
int nand_correct(u32 pageno, void *data, void *ecc);
|
2009-05-11 08:36:36 +02:00
|
|
|
void nand_initialize(void);
|
2009-01-27 18:12:41 +01:00
|
|
|
void nand_ipc(volatile ipc_request *req);
|
|
|
|
|
2009-01-17 15:05:13 +01:00
|
|
|
#endif
|
2009-04-13 22:13:45 +02:00
|
|
|
|