X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fflash%2Fnand%2Fmx3.c;h=45591e3930f4692fc7c6a9a05d4fcffb94be9a0a;hb=9bb3a05f0e53ca824ccfb5828c8c9399e375de8b;hp=7d9cc8b93255c10002590ca1103a189ddebf4fa4;hpb=aaf848596c13f26026bcbd1071f7614e818ea766;p=openocd diff --git a/src/flash/nand/mx3.c b/src/flash/nand/mx3.c index 7d9cc8b9..45591e39 100644 --- a/src/flash/nand/mx3.c +++ b/src/flash/nand/mx3.c @@ -61,7 +61,6 @@ static int do_data_output (struct nand_device *nand); static int imx31_command (struct nand_device *nand, uint8_t command); static int imx31_address (struct nand_device *nand, uint8_t address); -static int imx31_controller_ready (struct nand_device *nand, int tout); NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) { @@ -75,12 +74,6 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) nand->controller_priv = mx3_nf_info; - mx3_nf_info->target = get_target (CMD_ARGV[1]); - if (mx3_nf_info->target == NULL) - { - LOG_ERROR ("target '%s' not defined", CMD_ARGV[1]); - return ERROR_FAIL; - } if (CMD_ARGC < 3) { LOG_ERROR ("use \"nand device imx31 target noecc|hwecc\""); @@ -105,9 +98,9 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) mx3_nf_info->optype = MX3_NF_DATAOUT_PAGE; mx3_nf_info->fin = MX3_NF_FIN_NONE; mx3_nf_info->flags.target_little_endian = - (mx3_nf_info->target->endianness == TARGET_LITTLE_ENDIAN); + (nand->target->endianness == TARGET_LITTLE_ENDIAN); /* - * testing host endianess + * testing host endianness */ { int x = 1; @@ -126,7 +119,7 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) static int imx31_init (struct nand_device *nand) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; { /* @@ -268,8 +261,7 @@ static int imx31_init (struct nand_device *nand) static int imx31_read_data (struct nand_device *nand, void *data) { - struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; { /* * validate target state @@ -312,11 +304,6 @@ static int imx31_write_data (struct nand_device *nand, uint16_t data) return ERROR_NAND_OPERATION_FAILED; } -static int imx31_nand_ready (struct nand_device *nand, int timeout) -{ - return imx31_controller_ready (nand, timeout); -} - static int imx31_reset (struct nand_device *nand) { /* @@ -335,7 +322,7 @@ static int imx31_reset (struct nand_device *nand) static int imx31_command (struct nand_device *nand, uint8_t command) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; { /* * validate target state @@ -408,8 +395,7 @@ static int imx31_command (struct nand_device *nand, uint8_t command) static int imx31_address (struct nand_device *nand, uint8_t address) { - struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; { /* * validate target state @@ -438,11 +424,10 @@ static int imx31_address (struct nand_device *nand, uint8_t address) return ERROR_OK; } -static int imx31_controller_ready (struct nand_device *nand, int tout) +static int imx31_nand_ready (struct nand_device *nand, int tout) { uint16_t poll_complete_status; - struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; { /* @@ -474,7 +459,7 @@ static int imx31_write_page (struct nand_device *nand, uint32_t page, uint32_t oob_size) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; if (data_size % 2) { @@ -580,8 +565,7 @@ static int imx31_read_page (struct nand_device *nand, uint32_t page, uint8_t * data, uint32_t data_size, uint8_t * oob, uint32_t oob_size) { - struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; if (data_size % 2) { @@ -656,7 +640,7 @@ static int test_iomux_settings (struct target * target, uint32_t address, static int initialize_nf_controller (struct nand_device *nand) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; /* * resets NAND flash controller in zero time ? I dont know. */ @@ -784,7 +768,7 @@ static int poll_for_complete_op (struct target * target, const char *text) static int validate_target_state (struct nand_device *nand) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; if (target->state != TARGET_HALTED) { @@ -806,7 +790,7 @@ static int validate_target_state (struct nand_device *nand) static int do_data_output (struct nand_device *nand) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - struct target *target = mx3_nf_info->target; + struct target *target = nand->target; switch (mx3_nf_info->fin) { case MX3_NF_FIN_DATAOUT: @@ -876,6 +860,5 @@ struct nand_flash_controller imx31_nand_flash_controller = { .read_data = &imx31_read_data, .write_page = &imx31_write_page, .read_page = &imx31_read_page, - .controller_ready = &imx31_controller_ready, .nand_ready = &imx31_nand_ready, };