diff options
Diffstat (limited to 'drivers/mtd/nand/gpmi-nand')
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 43 | ||||
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 14 | ||||
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.h | 2 |
3 files changed, 33 insertions, 26 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; |
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 493ec2fcf97f..75b1dde16358 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
@@ -1124,7 +1124,7 @@ static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
1124 | chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1); | 1124 | chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1); |
1125 | 1125 | ||
1126 | /* Do we have a flash based bad block table ? */ | 1126 | /* Do we have a flash based bad block table ? */ |
1127 | if (chip->options & NAND_BBT_USE_FLASH) | 1127 | if (chip->bbt_options & NAND_BBT_USE_FLASH) |
1128 | ret = nand_update_bbt(mtd, ofs); | 1128 | ret = nand_update_bbt(mtd, ofs); |
1129 | else { | 1129 | else { |
1130 | chipnr = (int)(ofs >> chip->chip_shift); | 1130 | chipnr = (int)(ofs >> chip->chip_shift); |
@@ -1155,7 +1155,7 @@ static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
1155 | return ret; | 1155 | return ret; |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | static int __devinit nand_boot_set_geometry(struct gpmi_nand_data *this) | 1158 | static int nand_boot_set_geometry(struct gpmi_nand_data *this) |
1159 | { | 1159 | { |
1160 | struct boot_rom_geometry *geometry = &this->rom_geometry; | 1160 | struct boot_rom_geometry *geometry = &this->rom_geometry; |
1161 | 1161 | ||
@@ -1182,7 +1182,7 @@ static int __devinit nand_boot_set_geometry(struct gpmi_nand_data *this) | |||
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | static const char *fingerprint = "STMP"; | 1184 | static const char *fingerprint = "STMP"; |
1185 | static int __devinit mx23_check_transcription_stamp(struct gpmi_nand_data *this) | 1185 | static int mx23_check_transcription_stamp(struct gpmi_nand_data *this) |
1186 | { | 1186 | { |
1187 | struct boot_rom_geometry *rom_geo = &this->rom_geometry; | 1187 | struct boot_rom_geometry *rom_geo = &this->rom_geometry; |
1188 | struct device *dev = this->dev; | 1188 | struct device *dev = this->dev; |
@@ -1239,7 +1239,7 @@ static int __devinit mx23_check_transcription_stamp(struct gpmi_nand_data *this) | |||
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | /* Writes a transcription stamp. */ | 1241 | /* Writes a transcription stamp. */ |
1242 | static int __devinit mx23_write_transcription_stamp(struct gpmi_nand_data *this) | 1242 | static int mx23_write_transcription_stamp(struct gpmi_nand_data *this) |
1243 | { | 1243 | { |
1244 | struct device *dev = this->dev; | 1244 | struct device *dev = this->dev; |
1245 | struct boot_rom_geometry *rom_geo = &this->rom_geometry; | 1245 | struct boot_rom_geometry *rom_geo = &this->rom_geometry; |
@@ -1322,7 +1322,7 @@ static int __devinit mx23_write_transcription_stamp(struct gpmi_nand_data *this) | |||
1322 | return 0; | 1322 | return 0; |
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | static int __devinit mx23_boot_init(struct gpmi_nand_data *this) | 1325 | static int mx23_boot_init(struct gpmi_nand_data *this) |
1326 | { | 1326 | { |
1327 | struct device *dev = this->dev; | 1327 | struct device *dev = this->dev; |
1328 | struct nand_chip *chip = &this->nand; | 1328 | struct nand_chip *chip = &this->nand; |
@@ -1391,7 +1391,7 @@ static int __devinit mx23_boot_init(struct gpmi_nand_data *this) | |||
1391 | return 0; | 1391 | return 0; |
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | static int __devinit nand_boot_init(struct gpmi_nand_data *this) | 1394 | static int nand_boot_init(struct gpmi_nand_data *this) |
1395 | { | 1395 | { |
1396 | nand_boot_set_geometry(this); | 1396 | nand_boot_set_geometry(this); |
1397 | 1397 | ||
@@ -1401,7 +1401,7 @@ static int __devinit nand_boot_init(struct gpmi_nand_data *this) | |||
1401 | return 0; | 1401 | return 0; |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | static int __devinit gpmi_set_geometry(struct gpmi_nand_data *this) | 1404 | static int gpmi_set_geometry(struct gpmi_nand_data *this) |
1405 | { | 1405 | { |
1406 | int ret; | 1406 | int ret; |
1407 | 1407 | ||
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h index e023bccb7781..ec6180d4ff8f 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/mtd/nand.h> | 20 | #include <linux/mtd/nand.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/dma-mapping.h> | 22 | #include <linux/dma-mapping.h> |
23 | #include <mach/dma.h> | 23 | #include <linux/fsl/mxs-dma.h> |
24 | 24 | ||
25 | struct resources { | 25 | struct resources { |
26 | void *gpmi_regs; | 26 | void *gpmi_regs; |