X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnand%2Fnuc910.c;h=1a2dd5968cb4f4a5b7a4037fb0363441dbdd1434;hb=5be455a710c57bbbbd49c2d671b42098db7be5dc;hp=e7e78556ecedf12308b7cc8756445bebe05535dc;hpb=5e27647e2227368d3a81bb682dd736c575e55568;p=openocd.git
diff --git a/src/flash/nand/nuc910.c b/src/flash/nand/nuc910.c
index e7e78556ec..1a2dd5968c 100644
--- a/src/flash/nand/nuc910.c
+++ b/src/flash/nand/nuc910.c
@@ -13,9 +13,7 @@
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * along with this program. If not, see . *
***************************************************************************/
/*
@@ -31,8 +29,7 @@
#include "arm_io.h"
#include
-struct nuc910_nand_controller
-{
+struct nuc910_nand_controller {
struct arm_nand_data io;
};
@@ -53,7 +50,8 @@ static int nuc910_nand_command(struct nand_device *nand, uint8_t command)
struct target *target = nand->target;
int result;
- if ((result = validate_target_state(nand)) != ERROR_OK)
+ result = validate_target_state(nand);
+ if (result != ERROR_OK)
return result;
target_write_u8(target, NUC910_SMCMD, command);
@@ -65,7 +63,8 @@ static int nuc910_nand_address(struct nand_device *nand, uint8_t address)
struct target *target = nand->target;
int result;
- if ((result = validate_target_state(nand)) != ERROR_OK)
+ result = validate_target_state(nand);
+ if (result != ERROR_OK)
return result;
target_write_u32(target, NUC910_SMADDR, ((address & 0xff) | NUC910_SMADDR_EOA));
@@ -77,7 +76,8 @@ static int nuc910_nand_read(struct nand_device *nand, void *data)
struct target *target = nand->target;
int result;
- if ((result = validate_target_state(nand)) != ERROR_OK)
+ result = validate_target_state(nand);
+ if (result != ERROR_OK)
return result;
target_read_u8(target, NUC910_SMDATA, data);
@@ -89,7 +89,8 @@ static int nuc910_nand_write(struct nand_device *nand, uint16_t data)
struct target *target = nand->target;
int result;
- if ((result = validate_target_state(nand)) != ERROR_OK)
+ result = validate_target_state(nand);
+ if (result != ERROR_OK)
return result;
target_write_u8(target, NUC910_SMDATA, data);
@@ -102,7 +103,8 @@ static int nuc910_nand_read_block_data(struct nand_device *nand,
struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
int result;
- if ((result = validate_target_state(nand)) != ERROR_OK)
+ result = validate_target_state(nand);
+ if (result != ERROR_OK)
return result;
nuc910_nand->io.chunk_size = nand->page_size;
@@ -125,7 +127,8 @@ static int nuc910_nand_write_block_data(struct nand_device *nand,
struct nuc910_nand_controller *nuc910_nand = nand->controller_priv;
int result;
- if ((result = validate_target_state(nand)) != ERROR_OK)
+ result = validate_target_state(nand);
+ if (result != ERROR_OK)
return result;
nuc910_nand->io.chunk_size = nand->page_size;
@@ -154,9 +157,8 @@ static int nuc910_nand_ready(struct nand_device *nand, int timeout)
do {
target_read_u32(target, NUC910_SMISR, &status);
- if (status & NUC910_SMISR_RB_) {
+ if (status & NUC910_SMISR_RB_)
return 1;
- }
alive_sleep(1);
} while (timeout-- > 0);
@@ -169,7 +171,7 @@ NAND_DEVICE_COMMAND_HANDLER(nuc910_nand_device_command)
nuc910_nand = calloc(1, sizeof(struct nuc910_nand_controller));
if (!nuc910_nand) {
- LOG_ERROR("no memory for nand controller\n");
+ LOG_ERROR("no memory for nand controller");
return ERROR_NAND_DEVICE_INVALID;
}
@@ -184,12 +186,12 @@ static int nuc910_nand_init(struct nand_device *nand)
int bus_width = nand->bus_width ? : 8;
int result;
- if ((result = validate_target_state(nand)) != ERROR_OK)
+ result = validate_target_state(nand);
+ if (result != ERROR_OK)
return result;
/* nuc910 only supports 8bit */
- if (bus_width != 8)
- {
+ if (bus_width != 8) {
LOG_ERROR("nuc910 only supports 8 bit bus width, not %i", bus_width);
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
@@ -210,8 +212,7 @@ static int nuc910_nand_init(struct nand_device *nand)
return ERROR_OK;
}
-struct nand_flash_controller nuc910_nand_controller =
-{
+struct nand_flash_controller nuc910_nand_controller = {
.name = "nuc910",
.command = nuc910_nand_command,
.address = nuc910_nand_address,