1 From 78c8c8dc7e27c4502504cb4daa07bc9762f54de9 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Thu, 14 Nov 2013 18:25:33 -0300
4 Subject: [PATCH 147/203] mtd: nand: pxa3xx: Split prepare_command_pool() in
7 This commit splits the prepare_command_pool() function into two
8 stages: prepare_start_command() / prepare_set_command().
10 This is a preparation patch without any functionality changes,
11 and is meant to allow support for multiple page reading/writing
14 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
15 Tested-by: Daniel Mack <zonque@gmail.com>
16 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
18 drivers/mtd/nand/pxa3xx_nand.c | 44 ++++++++++++++++++++++++------------------
19 1 file changed, 25 insertions(+), 19 deletions(-)
21 --- a/drivers/mtd/nand/pxa3xx_nand.c
22 +++ b/drivers/mtd/nand/pxa3xx_nand.c
23 @@ -607,18 +607,8 @@ static void set_command_address(struct p
27 -static int prepare_command_pool(struct pxa3xx_nand_info *info, int command,
28 - uint16_t column, int page_addr)
29 +static void prepare_start_command(struct pxa3xx_nand_info *info, int command)
31 - int addr_cycle, exec_cmd;
32 - struct pxa3xx_nand_host *host;
33 - struct mtd_info *mtd;
35 - host = info->host[info->cs];
40 /* reset data and oob column point to handle data */
43 @@ -627,10 +617,6 @@ static int prepare_command_pool(struct p
45 info->retcode = ERR_NONE;
48 - info->ndcb0 = NDCB0_CSEL;
54 @@ -642,14 +628,32 @@ static int prepare_command_pool(struct p
58 - case NAND_CMD_SEQIN:
68 +static int prepare_set_command(struct pxa3xx_nand_info *info, int command,
69 + uint16_t column, int page_addr)
71 + int addr_cycle, exec_cmd;
72 + struct pxa3xx_nand_host *host;
73 + struct mtd_info *mtd;
75 + host = info->host[info->cs];
81 + info->ndcb0 = NDCB0_CSEL;
85 + if (command == NAND_CMD_SEQIN)
88 addr_cycle = NDCB0_ADDR_CYC(host->row_addr_cycles
89 + host->col_addr_cycles);
90 @@ -784,8 +788,10 @@ static void pxa3xx_nand_cmdfunc(struct m
91 nand_writel(info, NDTR1CS0, info->ndtr1cs0);
94 + prepare_start_command(info, command);
96 info->state = STATE_PREPARED;
97 - exec_cmd = prepare_command_pool(info, command, column, page_addr);
98 + exec_cmd = prepare_set_command(info, command, column, page_addr);
100 init_completion(&info->cmd_complete);
101 init_completion(&info->dev_ready);