From: Antonio Borneo Date: Fri, 31 Dec 2010 11:18:08 +0000 (+0800) Subject: flash/nand: review NAND driver interface X-Git-Tag: v0.5.0-rc1~249 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b0759dfc538b973cce67df93f8a7fe239bfb4c74;p=openocd flash/nand: review NAND driver interface From struct nand_flash_controller : - remove unused field register_commands; - remove field controller_ready, exported but never referenced. Remove dead code pointed by controller_ready. Signed-off-by: Antonio Borneo --- diff --git a/src/flash/nand/driver.h b/src/flash/nand/driver.h index deb41b2a..4edce9fa 100644 --- a/src/flash/nand/driver.h +++ b/src/flash/nand/driver.h @@ -42,9 +42,6 @@ struct nand_flash_controller /** NAND device command called when driver is instantiated during configuration. */ __NAND_DEVICE_COMMAND((*nand_device_command)); - /** Register controller specific commands as a TCL interface to the driver. */ - int (*register_commands)(struct command_context *cmd_ctx); - /** Initialize the NAND device. */ int (*init)(struct nand_device *nand); @@ -75,9 +72,6 @@ struct nand_flash_controller /** Read a page from the NAND device. */ int (*read_page)(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size); - /** Check if the controller is ready for more instructions with timeout. */ - int (*controller_ready)(struct nand_device *nand, int timeout); - /** Check if the NAND device is ready for more instructions with timeout. */ int (*nand_ready)(struct nand_device *nand, int timeout); }; diff --git a/src/flash/nand/lpc3180.c b/src/flash/nand/lpc3180.c index d81443d1..3285c42f 100644 --- a/src/flash/nand/lpc3180.c +++ b/src/flash/nand/lpc3180.c @@ -1363,6 +1363,5 @@ struct nand_flash_controller lpc3180_nand_controller = { .read_data = lpc3180_read_data, .write_page = lpc3180_write_page, .read_page = lpc3180_read_page, - .controller_ready = lpc3180_controller_ready, .nand_ready = lpc3180_nand_ready, }; diff --git a/src/flash/nand/mx2.c b/src/flash/nand/mx2.c index 147546d7..42bb0720 100644 --- a/src/flash/nand/mx2.c +++ b/src/flash/nand/mx2.c @@ -73,7 +73,6 @@ static int do_data_output(struct nand_device *nand); static int imx27_command(struct nand_device *nand, uint8_t command); static int imx27_address(struct nand_device *nand, uint8_t address); -static int imx27_controller_ready(struct nand_device *nand, int tout); NAND_DEVICE_COMMAND_HANDLER(imx27_nand_device_command) { @@ -229,11 +228,6 @@ static int imx27_write_data(struct nand_device *nand, uint16_t data) return ERROR_NAND_OPERATION_FAILED; } -static int imx27_nand_ready(struct nand_device *nand, int timeout) -{ - return imx27_controller_ready(nand, timeout); -} - static int imx27_reset(struct nand_device *nand) { /* @@ -342,7 +336,7 @@ static int imx27_address(struct nand_device *nand, uint8_t address) return ERROR_OK; } -static int imx27_controller_ready(struct nand_device *nand, int tout) +static int imx27_nand_ready(struct nand_device *nand, int tout) { uint16_t poll_complete_status; struct mx2_nf_controller *mx2_nf_info = nand->controller_priv; @@ -771,6 +765,5 @@ struct nand_flash_controller imx27_nand_flash_controller = { .read_data = &imx27_read_data, .write_page = &imx27_write_page, .read_page = &imx27_read_page, - .controller_ready = &imx27_controller_ready, .nand_ready = &imx27_nand_ready, }; diff --git a/src/flash/nand/mx3.c b/src/flash/nand/mx3.c index 7d9cc8b9..7676d1b8 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) { @@ -312,11 +311,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) { /* @@ -438,7 +432,7 @@ 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; @@ -876,6 +870,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, }; diff --git a/src/flash/nand/nonce.c b/src/flash/nand/nonce.c index ab490aea..565ad727 100644 --- a/src/flash/nand/nonce.c +++ b/src/flash/nand/nonce.c @@ -52,11 +52,6 @@ static int nonce_nand_reset(struct nand_device *nand) return nonce_nand_command(nand, NAND_CMD_RESET); } -static int nonce_nand_controller_ready(struct nand_device *nand, int timeout) -{ - return true; -} - NAND_DEVICE_COMMAND_HANDLER(nonce_nand_device_command) { return ERROR_OK; @@ -79,5 +74,4 @@ struct nand_flash_controller nonce_nand_controller = .read_data = &nonce_nand_read, .write_data = &nonce_nand_write, .write_block_data = &nonce_nand_fast_block_write, - .controller_ready = &nonce_nand_controller_ready, }; diff --git a/src/flash/nand/orion.c b/src/flash/nand/orion.c index b46ffaed..3ab2364d 100644 --- a/src/flash/nand/orion.c +++ b/src/flash/nand/orion.c @@ -116,11 +116,6 @@ static int orion_nand_reset(struct nand_device *nand) return orion_nand_command(nand, NAND_CMD_RESET); } -static int orion_nand_controller_ready(struct nand_device *nand, int timeout) -{ - return 1; -} - NAND_DEVICE_COMMAND_HANDLER(orion_nand_device_command) { struct orion_nand_controller *hw; @@ -175,7 +170,6 @@ struct nand_flash_controller orion_nand_controller = .write_data = orion_nand_write, .write_block_data = orion_nand_fast_block_write, .reset = orion_nand_reset, - .controller_ready = orion_nand_controller_ready, .nand_device_command = orion_nand_device_command, .init = orion_nand_init, }; diff --git a/src/flash/nand/s3c2410.c b/src/flash/nand/s3c2410.c index 3c391bce..1827c74e 100644 --- a/src/flash/nand/s3c2410.c +++ b/src/flash/nand/s3c2410.c @@ -118,6 +118,5 @@ struct nand_flash_controller s3c2410_nand_controller = { .read_data = &s3c2410_read_data, .write_page = s3c24xx_write_page, .read_page = s3c24xx_read_page, - .controller_ready = &s3c24xx_controller_ready, .nand_ready = &s3c2410_nand_ready, }; diff --git a/src/flash/nand/s3c2412.c b/src/flash/nand/s3c2412.c index 57843053..f43f8a69 100644 --- a/src/flash/nand/s3c2412.c +++ b/src/flash/nand/s3c2412.c @@ -74,6 +74,5 @@ struct nand_flash_controller s3c2412_nand_controller = { .read_page = s3c24xx_read_page, .write_block_data = &s3c2440_write_block_data, .read_block_data = &s3c2440_read_block_data, - .controller_ready = &s3c24xx_controller_ready, .nand_ready = &s3c2440_nand_ready, }; diff --git a/src/flash/nand/s3c2440.c b/src/flash/nand/s3c2440.c index d1a421e3..797ce242 100644 --- a/src/flash/nand/s3c2440.c +++ b/src/flash/nand/s3c2440.c @@ -166,6 +166,5 @@ struct nand_flash_controller s3c2440_nand_controller = { .read_page = s3c24xx_read_page, .write_block_data = &s3c2440_write_block_data, .read_block_data = &s3c2440_read_block_data, - .controller_ready = &s3c24xx_controller_ready, .nand_ready = &s3c2440_nand_ready, }; diff --git a/src/flash/nand/s3c2443.c b/src/flash/nand/s3c2443.c index d3414771..5fb2d927 100644 --- a/src/flash/nand/s3c2443.c +++ b/src/flash/nand/s3c2443.c @@ -75,6 +75,5 @@ struct nand_flash_controller s3c2443_nand_controller = { .read_page = s3c24xx_read_page, .write_block_data = &s3c2440_write_block_data, .read_block_data = &s3c2440_read_block_data, - .controller_ready = &s3c24xx_controller_ready, .nand_ready = &s3c2440_nand_ready, }; diff --git a/src/flash/nand/s3c24xx.c b/src/flash/nand/s3c24xx.c index d305b221..e3b5c2e2 100644 --- a/src/flash/nand/s3c24xx.c +++ b/src/flash/nand/s3c24xx.c @@ -126,8 +126,3 @@ int s3c24xx_read_data(struct nand_device *nand, void *data) target_read_u8(target, s3c24xx_info->data, data); return ERROR_OK; } - -int s3c24xx_controller_ready(struct nand_device *nand, int timeout) -{ - return 1; -} diff --git a/src/flash/nand/s3c24xx.h b/src/flash/nand/s3c24xx.h index 9424cb3e..059c84d9 100644 --- a/src/flash/nand/s3c24xx.h +++ b/src/flash/nand/s3c24xx.h @@ -68,8 +68,6 @@ int s3c24xx_address(struct nand_device *nand, uint8_t address); int s3c24xx_write_data(struct nand_device *nand, uint16_t data); int s3c24xx_read_data(struct nand_device *nand, void *data); -int s3c24xx_controller_ready(struct nand_device *nand, int tout); - #define s3c24xx_write_page NULL #define s3c24xx_read_page NULL diff --git a/src/flash/nand/s3c6400.c b/src/flash/nand/s3c6400.c index 20b6cc17..960447d9 100644 --- a/src/flash/nand/s3c6400.c +++ b/src/flash/nand/s3c6400.c @@ -71,6 +71,5 @@ struct nand_flash_controller s3c6400_nand_controller = { .read_page = s3c24xx_read_page, .write_block_data = &s3c2440_write_block_data, .read_block_data = &s3c2440_read_block_data, - .controller_ready = &s3c24xx_controller_ready, .nand_ready = &s3c2440_nand_ready, };