]> git.sur5r.net Git - openocd/blobdiff - src/flash/nand.c
ocd_flash_banks now returns empty list when no flash banks are configured instead...
[openocd] / src / flash / nand.c
index 5cfc27662699ebbfe7d1228c1b9f1e022f889dc4..f55a81bb657b5ec1389dc5b0b96a5db5897a07f3 100644 (file)
@@ -204,10 +204,10 @@ int handle_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, cha
                if (strcmp(args[0], nand_flash_controllers[i]->name) == 0)
                {
                        /* register flash specific commands */
-                       if (nand_flash_controllers[i]->register_commands(cmd_ctx) != ERROR_OK)
+                       if ((retval = nand_flash_controllers[i]->register_commands(cmd_ctx)) != ERROR_OK)
                        {
                                LOG_ERROR("couldn't register '%s' commands", args[0]);
-                               exit(-1);
+                               return retval;
                        }
        
                        c = malloc(sizeof(nand_device_t));
@@ -355,7 +355,7 @@ int nand_read_status(struct nand_device_s *device, u8 *status)
        /* Send read status command */
        device->controller->command(device, NAND_CMD_STATUS);
        
-       usleep(1000);
+       alive_sleep(1);
        
        /* read status */
        if (device->device->options & NAND_BUSWIDTH_16)
@@ -806,7 +806,10 @@ int nand_read_page_raw(struct nand_device_s *device, u32 page, u8 *data, u32 dat
                 * or 2048 for the beginning of OOB area)
                 */
                device->controller->address(device, 0x0);
-               device->controller->address(device, 0x8);
+               if (data)
+                       device->controller->address(device, 0x0);
+               else
+                       device->controller->address(device, 0x8);
                
                /* row */
                device->controller->address(device, page & 0xff);