OpenOCD
lpc32xx.c File Reference
Include dependency graph for lpc32xx.c:

Go to the source code of this file.

Data Structures

struct  dmac_ll
 

Macros

#define DATA_OFFS   0x200
 
#define ECC_OFFS   0x120
 
#define SPARE_OFFS   0x140
 

Functions

 COMMAND_HANDLER (handle_lpc32xx_select_command)
 
static int lpc32xx_address (struct nand_device *nand, uint8_t address)
 
static int lpc32xx_command (struct nand_device *nand, uint8_t command)
 
static int lpc32xx_controller_ready (struct nand_device *nand, int timeout)
 
static float lpc32xx_cycle_time (struct nand_device *nand)
 
static int lpc32xx_dma_ready (struct nand_device *nand, int timeout)
 
static void lpc32xx_dump_oob (uint8_t *oob, uint32_t oob_size)
 
static int lpc32xx_init (struct nand_device *nand)
 
static int lpc32xx_make_dma_list (uint32_t target_mem_base, uint32_t page_size, int do_read)
 
static int lpc32xx_nand_ready (struct nand_device *nand, int timeout)
 
static int lpc32xx_pll (int fclkin, uint32_t pll_ctrl)
 
static int lpc32xx_read_data (struct nand_device *nand, void *data)
 
static int lpc32xx_read_page (struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
 
static int lpc32xx_read_page_mlc (struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
 
static int lpc32xx_read_page_slc (struct nand_device *nand, struct working_area *pworking_area, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
 
static int lpc32xx_reset (struct nand_device *nand)
 
static int lpc32xx_start_slc_dma (struct nand_device *nand, uint32_t count, int do_wait)
 
static int lpc32xx_tc_ready (struct nand_device *nand, int timeout)
 
static int lpc32xx_write_data (struct nand_device *nand, uint16_t data)
 
static int lpc32xx_write_page (struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
 
static int lpc32xx_write_page_mlc (struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
 
static int lpc32xx_write_page_slc (struct nand_device *nand, struct working_area *pworking_area, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
 
 NAND_DEVICE_COMMAND_HANDLER (lpc32xx_nand_device_command)
 
static uint32_t slc_ecc_copy_to_buffer (uint8_t *spare, const uint32_t *ecc, int count)
 

Variables

static struct dmac_ll dmalist [(2048/256) *2+1]
 
static const int lp_ooblayout []
 
static const struct command_registration lpc32xx_command_handler []
 
static const struct command_registration lpc32xx_exec_command_handlers []
 
struct nand_flash_controller lpc32xx_nand_controller
 
static const int sp_ooblayout []
 

Macro Definition Documentation

◆ DATA_OFFS

#define DATA_OFFS   0x200

Definition at line 38 of file lpc32xx.c.

◆ ECC_OFFS

#define ECC_OFFS   0x120

Definition at line 36 of file lpc32xx.c.

◆ SPARE_OFFS

#define SPARE_OFFS   0x140

Definition at line 37 of file lpc32xx.c.

Function Documentation

◆ COMMAND_HANDLER()

◆ lpc32xx_address()

◆ lpc32xx_command()

◆ lpc32xx_controller_ready()

◆ lpc32xx_cycle_time()

static float lpc32xx_cycle_time ( struct nand_device nand)
static

◆ lpc32xx_dma_ready()

static int lpc32xx_dma_ready ( struct nand_device nand,
int  timeout 
)
static

Definition at line 951 of file lpc32xx.c.

References alive_sleep(), ERROR_OK, LOG_DEBUG, LOG_ERROR, nand_device::target, and target_read_u32().

Referenced by lpc32xx_write_page_slc().

◆ lpc32xx_dump_oob()

static void lpc32xx_dump_oob ( uint8_t *  oob,
uint32_t  oob_size 
)
static

Definition at line 1005 of file lpc32xx.c.

References addr, and LOG_DEBUG.

Referenced by lpc32xx_read_page_slc(), and lpc32xx_write_page_slc().

◆ lpc32xx_init()

◆ lpc32xx_make_dma_list()

static int lpc32xx_make_dma_list ( uint32_t  target_mem_base,
uint32_t  page_size,
int  do_read 
)
static

◆ lpc32xx_nand_ready()

◆ lpc32xx_pll()

static int lpc32xx_pll ( int  fclkin,
uint32_t  pll_ctrl 
)
static

Definition at line 88 of file lpc32xx.c.

References LOG_WARNING.

Referenced by lpc32xx_cycle_time().

◆ lpc32xx_read_data()

◆ lpc32xx_read_page()

◆ lpc32xx_read_page_mlc()

static int lpc32xx_read_page_mlc ( struct nand_device nand,
uint32_t  page,
uint8_t *  data,
uint32_t  data_size,
uint8_t *  oob,
uint32_t  oob_size 
)
static

◆ lpc32xx_read_page_slc()

static int lpc32xx_read_page_slc ( struct nand_device nand,
struct working_area pworking_area,
uint32_t  page,
uint8_t *  data,
uint32_t  data_size,
uint8_t *  oob,
uint32_t  oob_size 
)
static

◆ lpc32xx_reset()

◆ lpc32xx_start_slc_dma()

static int lpc32xx_start_slc_dma ( struct nand_device nand,
uint32_t  count,
int  do_wait 
)
static

◆ lpc32xx_tc_ready()

static int lpc32xx_tc_ready ( struct nand_device nand,
int  timeout 
)
static

◆ lpc32xx_write_data()

◆ lpc32xx_write_page()

◆ lpc32xx_write_page_mlc()

static int lpc32xx_write_page_mlc ( struct nand_device nand,
uint32_t  page,
uint8_t *  data,
uint32_t  data_size,
uint8_t *  oob,
uint32_t  oob_size 
)
static

◆ lpc32xx_write_page_slc()

◆ NAND_DEVICE_COMMAND_HANDLER()

◆ slc_ecc_copy_to_buffer()

static uint32_t slc_ecc_copy_to_buffer ( uint8_t *  spare,
const uint32_t *  ecc,
int  count 
)
static

Definition at line 991 of file lpc32xx.c.

References count.

Referenced by lpc32xx_read_page_slc(), and lpc32xx_write_page_slc().

Variable Documentation

◆ dmalist

struct dmac_ll dmalist[(2048/256) *2+1]
static

Definition at line 43 of file lpc32xx.c.

Referenced by lpc32xx_make_dma_list(), lpc32xx_read_page_slc(), and lpc32xx_write_page_slc().

◆ lp_ooblayout

const int lp_ooblayout[]
static
Initial value:
= {
40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63
}

Definition at line 43 of file lpc32xx.c.

Referenced by lpc32xx_read_page_slc(), and lpc32xx_write_page_slc().

◆ lpc32xx_command_handler

const struct command_registration lpc32xx_command_handler[]
static
Initial value:
= {
{
.name = "lpc32xx",
.mode = COMMAND_ANY,
.help = "LPC32xx NAND flash controller commands",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:253
@ COMMAND_ANY
Definition: command.h:42
static const struct command_registration lpc32xx_exec_command_handlers[]
Definition: lpc32xx.c:1774

Definition at line 1736 of file lpc32xx.c.

◆ lpc32xx_exec_command_handlers

const struct command_registration lpc32xx_exec_command_handlers[]
static
Initial value:
= {
{
.name = "select",
.handler = handle_lpc32xx_select_command,
.mode = COMMAND_EXEC,
.help = "select MLC or SLC controller (default is MLC)",
.usage = "bank_id ['mlc'|'slc' ]",
},
}
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 1736 of file lpc32xx.c.

◆ lpc32xx_nand_controller

Initial value:
= {
.name = "lpc32xx",
.nand_device_command = lpc32xx_nand_device_command,
.init = lpc32xx_init,
.reset = lpc32xx_reset,
.command = lpc32xx_command,
.address = lpc32xx_address,
.write_data = lpc32xx_write_data,
.read_data = lpc32xx_read_data,
.write_page = lpc32xx_write_page,
.read_page = lpc32xx_read_page,
.nand_ready = lpc32xx_nand_ready,
}
static const struct command_registration lpc32xx_command_handler[]
Definition: lpc32xx.c:1784
static int lpc32xx_write_page(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
Definition: lpc32xx.c:1209
static int lpc32xx_read_page(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
Definition: lpc32xx.c:1560
static int lpc32xx_address(struct nand_device *nand, uint8_t address)
Definition: lpc32xx.c:459
static int lpc32xx_read_data(struct nand_device *nand, void *data)
Definition: lpc32xx.c:527
static int lpc32xx_init(struct nand_device *nand)
Definition: lpc32xx.c:177
static int lpc32xx_write_data(struct nand_device *nand, uint16_t data)
Definition: lpc32xx.c:493
static int lpc32xx_reset(struct nand_device *nand)
Definition: lpc32xx.c:379
static int lpc32xx_nand_ready(struct nand_device *nand, int timeout)
Definition: lpc32xx.c:1656
static int lpc32xx_command(struct nand_device *nand, uint8_t command)
Definition: lpc32xx.c:425

Definition at line 1736 of file lpc32xx.c.

◆ sp_ooblayout

const int sp_ooblayout[]
static
Initial value:
= {
10, 11, 12, 13, 14, 15
}

Definition at line 40 of file lpc32xx.c.

Referenced by lpc32xx_read_page_slc(), and lpc32xx_write_page_slc().