Change return value on error.
[fw/openocd] / src / flash / nand / lpc32xx.c
index 963dd13120a19f0735b99c29a3aef2b324cca7c6..addc323b132599ce5d6be7de8b1e413cd3ae7d84 100644 (file)
@@ -75,8 +75,7 @@ static dmac_ll_t dmalist[(2048/256) * 2 + 1];
 NAND_DEVICE_COMMAND_HANDLER(lpc32xx_nand_device_command)
 {
        if (CMD_ARGC < 3) {
-               LOG_WARNING("incomplete 'lpc32xx' nand flash configuration");
-               return ERROR_FLASH_BANK_INVALID;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        uint32_t osc_freq;
@@ -214,7 +213,7 @@ static int lpc32xx_init(struct nand_device *nand)
        /* inform calling code about selected bus width */
        nand->bus_width = bus_width;
 
-       if ((address_cycles != 3) && (address_cycles != 4)) {
+       if ((address_cycles < 3) || (address_cycles > 5)) {
                LOG_ERROR("LPC32xx driver doesn't support %i address cycles", address_cycles);
                return ERROR_NAND_OPERATION_NOT_SUPPORTED;
        }
@@ -227,8 +226,8 @@ static int lpc32xx_init(struct nand_device *nand)
        /* select MLC controller if none is currently selected */
        if (lpc32xx_info->selected_controller == LPC32xx_NO_CONTROLLER) {
                LOG_DEBUG("no LPC32xx NAND flash controller selected, "
-                         "using default 'mlc'");
-               lpc32xx_info->selected_controller = LPC32xx_MLC_CONTROLLER;
+                         "using default 'slc'");
+               lpc32xx_info->selected_controller = LPC32xx_SLC_CONTROLLER;
        }
 
        if (lpc32xx_info->selected_controller == LPC32xx_MLC_CONTROLLER) {