aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/gpmi-nand/gpmi-lib.c')
-rw-r--r--drivers/mtd/nand/gpmi-nand/gpmi-lib.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
index 7db6555ed3ba..e8ea7107932e 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
@@ -835,7 +835,7 @@ int gpmi_send_command(struct gpmi_nand_data *this)
835 | BM_GPMI_CTRL0_ADDRESS_INCREMENT 835 | BM_GPMI_CTRL0_ADDRESS_INCREMENT
836 | BF_GPMI_CTRL0_XFER_COUNT(this->command_length); 836 | BF_GPMI_CTRL0_XFER_COUNT(this->command_length);
837 pio[1] = pio[2] = 0; 837 pio[1] = pio[2] = 0;
838 desc = channel->device->device_prep_slave_sg(channel, 838 desc = dmaengine_prep_slave_sg(channel,
839 (struct scatterlist *)pio, 839 (struct scatterlist *)pio,
840 ARRAY_SIZE(pio), DMA_TRANS_NONE, 0); 840 ARRAY_SIZE(pio), DMA_TRANS_NONE, 0);
841 if (!desc) { 841 if (!desc) {
@@ -848,8 +848,10 @@ int gpmi_send_command(struct gpmi_nand_data *this)
848 848
849 sg_init_one(sgl, this->cmd_buffer, this->command_length); 849 sg_init_one(sgl, this->cmd_buffer, this->command_length);
850 dma_map_sg(this->dev, sgl, 1, DMA_TO_DEVICE); 850 dma_map_sg(this->dev, sgl, 1, DMA_TO_DEVICE);
851 desc = channel->device->device_prep_slave_sg(channel, 851 desc = dmaengine_prep_slave_sg(channel,
852 sgl, 1, DMA_MEM_TO_DEV, 1); 852 sgl, 1, DMA_MEM_TO_DEV,
853 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
854
853 if (!desc) { 855 if (!desc) {
854 pr_err("step 2 error\n"); 856 pr_err("step 2 error\n");
855 return -1; 857 return -1;
@@ -880,8 +882,7 @@ int gpmi_send_data(struct gpmi_nand_data *this)
880 | BF_GPMI_CTRL0_ADDRESS(address) 882 | BF_GPMI_CTRL0_ADDRESS(address)
881 | BF_GPMI_CTRL0_XFER_COUNT(this->upper_len); 883 | BF_GPMI_CTRL0_XFER_COUNT(this->upper_len);
882 pio[1] = 0; 884 pio[1] = 0;
883 desc = channel->device->device_prep_slave_sg(channel, 885 desc = dmaengine_prep_slave_sg(channel, (struct scatterlist *)pio,
884 (struct scatterlist *)pio,
885 ARRAY_SIZE(pio), DMA_TRANS_NONE, 0); 886 ARRAY_SIZE(pio), DMA_TRANS_NONE, 0);
886 if (!desc) { 887 if (!desc) {
887 pr_err("step 1 error\n"); 888 pr_err("step 1 error\n");
@@ -890,8 +891,9 @@ int gpmi_send_data(struct gpmi_nand_data *this)
890 891
891 /* [2] send DMA request */ 892 /* [2] send DMA request */
892 prepare_data_dma(this, DMA_TO_DEVICE); 893 prepare_data_dma(this, DMA_TO_DEVICE);
893 desc = channel->device->device_prep_slave_sg(channel, &this->data_sgl, 894 desc = dmaengine_prep_slave_sg(channel, &this->data_sgl,
894 1, DMA_MEM_TO_DEV, 1); 895 1, DMA_MEM_TO_DEV,
896 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
895 if (!desc) { 897 if (!desc) {
896 pr_err("step 2 error\n"); 898 pr_err("step 2 error\n");
897 return -1; 899 return -1;
@@ -916,7 +918,7 @@ int gpmi_read_data(struct gpmi_nand_data *this)
916 | BF_GPMI_CTRL0_ADDRESS(BV_GPMI_CTRL0_ADDRESS__NAND_DATA) 918 | BF_GPMI_CTRL0_ADDRESS(BV_GPMI_CTRL0_ADDRESS__NAND_DATA)
917 | BF_GPMI_CTRL0_XFER_COUNT(this->upper_len); 919 | BF_GPMI_CTRL0_XFER_COUNT(this->upper_len);
918 pio[1] = 0; 920 pio[1] = 0;
919 desc = channel->device->device_prep_slave_sg(channel, 921 desc = dmaengine_prep_slave_sg(channel,
920 (struct scatterlist *)pio, 922 (struct scatterlist *)pio,
921 ARRAY_SIZE(pio), DMA_TRANS_NONE, 0); 923 ARRAY_SIZE(pio), DMA_TRANS_NONE, 0);
922 if (!desc) { 924 if (!desc) {
@@ -926,8 +928,9 @@ int gpmi_read_data(struct gpmi_nand_data *this)
926 928
927 /* [2] : send DMA request */ 929 /* [2] : send DMA request */
928 prepare_data_dma(this, DMA_FROM_DEVICE); 930 prepare_data_dma(this, DMA_FROM_DEVICE);
929 desc = channel->device->device_prep_slave_sg(channel, &this->data_sgl, 931 desc = dmaengine_prep_slave_sg(channel, &this->data_sgl,
930 1, DMA_DEV_TO_MEM, 1); 932 1, DMA_DEV_TO_MEM,
933 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
931 if (!desc) { 934 if (!desc) {
932 pr_err("step 2 error\n"); 935 pr_err("step 2 error\n");
933 return -1; 936 return -1;
@@ -972,9 +975,10 @@ int gpmi_send_page(struct gpmi_nand_data *this,
972 pio[4] = payload; 975 pio[4] = payload;
973 pio[5] = auxiliary; 976 pio[5] = auxiliary;
974 977
975 desc = channel->device->device_prep_slave_sg(channel, 978 desc = dmaengine_prep_slave_sg(channel,
976 (struct scatterlist *)pio, 979 (struct scatterlist *)pio,
977 ARRAY_SIZE(pio), DMA_TRANS_NONE, 0); 980 ARRAY_SIZE(pio), DMA_TRANS_NONE,
981 DMA_CTRL_ACK);
978 if (!desc) { 982 if (!desc) {
979 pr_err("step 2 error\n"); 983 pr_err("step 2 error\n");
980 return -1; 984 return -1;
@@ -1007,7 +1011,7 @@ int gpmi_read_page(struct gpmi_nand_data *this,
1007 | BF_GPMI_CTRL0_ADDRESS(address) 1011 | BF_GPMI_CTRL0_ADDRESS(address)
1008 | BF_GPMI_CTRL0_XFER_COUNT(0); 1012 | BF_GPMI_CTRL0_XFER_COUNT(0);
1009 pio[1] = 0; 1013 pio[1] = 0;
1010 desc = channel->device->device_prep_slave_sg(channel, 1014 desc = dmaengine_prep_slave_sg(channel,
1011 (struct scatterlist *)pio, 2, 1015 (struct scatterlist *)pio, 2,
1012 DMA_TRANS_NONE, 0); 1016 DMA_TRANS_NONE, 0);
1013 if (!desc) { 1017 if (!desc) {
@@ -1036,9 +1040,10 @@ int gpmi_read_page(struct gpmi_nand_data *this,
1036 pio[3] = geo->page_size; 1040 pio[3] = geo->page_size;
1037 pio[4] = payload; 1041 pio[4] = payload;
1038 pio[5] = auxiliary; 1042 pio[5] = auxiliary;
1039 desc = channel->device->device_prep_slave_sg(channel, 1043 desc = dmaengine_prep_slave_sg(channel,
1040 (struct scatterlist *)pio, 1044 (struct scatterlist *)pio,
1041 ARRAY_SIZE(pio), DMA_TRANS_NONE, 1); 1045 ARRAY_SIZE(pio), DMA_TRANS_NONE,
1046 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
1042 if (!desc) { 1047 if (!desc) {
1043 pr_err("step 2 error\n"); 1048 pr_err("step 2 error\n");
1044 return -1; 1049 return -1;
@@ -1055,9 +1060,11 @@ int gpmi_read_page(struct gpmi_nand_data *this,
1055 | BF_GPMI_CTRL0_ADDRESS(address) 1060 | BF_GPMI_CTRL0_ADDRESS(address)
1056 | BF_GPMI_CTRL0_XFER_COUNT(geo->page_size); 1061 | BF_GPMI_CTRL0_XFER_COUNT(geo->page_size);
1057 pio[1] = 0; 1062 pio[1] = 0;
1058 desc = channel->device->device_prep_slave_sg(channel, 1063 pio[2] = 0; /* clear GPMI_HW_GPMI_ECCCTRL, disable the BCH. */
1059 (struct scatterlist *)pio, 2, 1064 desc = dmaengine_prep_slave_sg(channel,
1060 DMA_TRANS_NONE, 1); 1065 (struct scatterlist *)pio, 3,
1066 DMA_TRANS_NONE,
1067 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
1061 if (!desc) { 1068 if (!desc) {
1062 pr_err("step 3 error\n"); 1069 pr_err("step 3 error\n");
1063 return -1; 1070 return -1;