Commit a36274e0184193e393fb82957925c3981a6b0477

Authored by Martin K. Petersen
Committed by Chris Ball
1 parent 7a5ea56abc

mmc: Remove distinction between hw and phys segments

We have deprecated the distinction between hardware and physical
segments in the block layer.  Consolidate the two limits into one in
drivers/mmc/.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Chris Ball <cjb@laptop.org>

Showing 24 changed files with 31 additions and 52 deletions Side-by-side Diff

drivers/mmc/card/queue.c
... ... @@ -146,7 +146,7 @@
146 146 }
147 147  
148 148 #ifdef CONFIG_MMC_BLOCK_BOUNCE
149   - if (host->max_hw_segs == 1) {
  149 + if (host->max_segs == 1) {
150 150 unsigned int bouncesz;
151 151  
152 152 bouncesz = MMC_QUEUE_BOUNCESZ;
153 153  
154 154  
... ... @@ -196,16 +196,16 @@
196 196 blk_queue_bounce_limit(mq->queue, limit);
197 197 blk_queue_max_hw_sectors(mq->queue,
198 198 min(host->max_blk_count, host->max_req_size / 512));
199   - blk_queue_max_segments(mq->queue, host->max_hw_segs);
  199 + blk_queue_max_segments(mq->queue, host->max_segs);
200 200 blk_queue_max_segment_size(mq->queue, host->max_seg_size);
201 201  
202 202 mq->sg = kmalloc(sizeof(struct scatterlist) *
203   - host->max_phys_segs, GFP_KERNEL);
  203 + host->max_segs, GFP_KERNEL);
204 204 if (!mq->sg) {
205 205 ret = -ENOMEM;
206 206 goto cleanup_queue;
207 207 }
208   - sg_init_table(mq->sg, host->max_phys_segs);
  208 + sg_init_table(mq->sg, host->max_segs);
209 209 }
210 210  
211 211 init_MUTEX(&mq->thread_sem);
drivers/mmc/core/host.c
... ... @@ -94,8 +94,7 @@
94 94 * By default, hosts do not support SGIO or large requests.
95 95 * They have to set these according to their abilities.
96 96 */
97   - host->max_hw_segs = 1;
98   - host->max_phys_segs = 1;
  97 + host->max_segs = 1;
99 98 host->max_seg_size = PAGE_CACHE_SIZE;
100 99  
101 100 host->max_req_size = PAGE_CACHE_SIZE;
drivers/mmc/host/at91_mci.c
... ... @@ -947,8 +947,7 @@
947 947 mmc->max_blk_size = MCI_MAXBLKSIZE;
948 948 mmc->max_blk_count = MCI_BLKATONCE;
949 949 mmc->max_req_size = MCI_BUFSIZE;
950   - mmc->max_phys_segs = MCI_BLKATONCE;
951   - mmc->max_hw_segs = MCI_BLKATONCE;
  950 + mmc->max_segs = MCI_BLKATONCE;
952 951 mmc->max_seg_size = MCI_BUFSIZE;
953 952  
954 953 host = mmc_priv(mmc);
drivers/mmc/host/atmel-mci.c
... ... @@ -1618,8 +1618,7 @@
1618 1618 if (slot_data->bus_width >= 4)
1619 1619 mmc->caps |= MMC_CAP_4_BIT_DATA;
1620 1620  
1621   - mmc->max_hw_segs = 64;
1622   - mmc->max_phys_segs = 64;
  1621 + mmc->max_segs = 64;
1623 1622 mmc->max_req_size = 32768 * 512;
1624 1623 mmc->max_blk_size = 32768;
1625 1624 mmc->max_blk_count = 512;
drivers/mmc/host/au1xmmc.c
... ... @@ -998,7 +998,7 @@
998 998 mmc->f_max = 24000000;
999 999  
1000 1000 mmc->max_seg_size = AU1XMMC_DESCRIPTOR_SIZE;
1001   - mmc->max_phys_segs = AU1XMMC_DESCRIPTOR_COUNT;
  1001 + mmc->max_segs = AU1XMMC_DESCRIPTOR_COUNT;
1002 1002  
1003 1003 mmc->max_blk_size = 2048;
1004 1004 mmc->max_blk_count = 512;
drivers/mmc/host/bfin_sdh.c
... ... @@ -469,7 +469,7 @@
469 469 }
470 470  
471 471 mmc->ops = &sdh_ops;
472   - mmc->max_phys_segs = 32;
  472 + mmc->max_segs = 32;
473 473 mmc->max_seg_size = 1 << 16;
474 474 mmc->max_blk_size = 1 << 11;
475 475 mmc->max_blk_count = 1 << 11;
drivers/mmc/host/davinci_mmc.c
... ... @@ -138,7 +138,7 @@
138 138 /*
139 139 * One scatterlist dma "segment" is at most MAX_CCNT rw_threshold units,
140 140 * and we handle up to MAX_NR_SG segments. MMC_BLOCK_BOUNCE kicks in only
141   - * for drivers with max_hw_segs == 1, making the segments bigger (64KB)
  141 + * for drivers with max_segs == 1, making the segments bigger (64KB)
142 142 * than the page or two that's otherwise typical. nr_sg (passed from
143 143 * platform data) == 16 gives at least the same throughput boost, using
144 144 * EDMA transfer linkage instead of spending CPU time copying pages.
... ... @@ -1239,8 +1239,7 @@
1239 1239 * Each hw_seg uses one EDMA parameter RAM slot, always one
1240 1240 * channel and then usually some linked slots.
1241 1241 */
1242   - mmc->max_hw_segs = 1 + host->n_link;
1243   - mmc->max_phys_segs = mmc->max_hw_segs;
  1242 + mmc->max_segs = 1 + host->n_link;
1244 1243  
1245 1244 /* EDMA limit per hw segment (one or two MBytes) */
1246 1245 mmc->max_seg_size = MAX_CCNT * rw_threshold;
... ... @@ -1250,8 +1249,7 @@
1250 1249 mmc->max_blk_count = 65535; /* NBLK is 16 bits */
1251 1250 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
1252 1251  
1253   - dev_dbg(mmc_dev(host->mmc), "max_phys_segs=%d\n", mmc->max_phys_segs);
1254   - dev_dbg(mmc_dev(host->mmc), "max_hw_segs=%d\n", mmc->max_hw_segs);
  1252 + dev_dbg(mmc_dev(host->mmc), "max_segs=%d\n", mmc->max_segs);
1255 1253 dev_dbg(mmc_dev(host->mmc), "max_blk_size=%d\n", mmc->max_blk_size);
1256 1254 dev_dbg(mmc_dev(host->mmc), "max_req_size=%d\n", mmc->max_req_size);
1257 1255 dev_dbg(mmc_dev(host->mmc), "max_seg_size=%d\n", mmc->max_seg_size);
drivers/mmc/host/imxmmc.c
... ... @@ -966,8 +966,7 @@
966 966 mmc->caps = MMC_CAP_4_BIT_DATA;
967 967  
968 968 /* MMC core transfer sizes tunable parameters */
969   - mmc->max_hw_segs = 64;
970   - mmc->max_phys_segs = 64;
  969 + mmc->max_segs = 64;
971 970 mmc->max_seg_size = 64*512; /* default PAGE_CACHE_SIZE */
972 971 mmc->max_req_size = 64*512; /* default PAGE_CACHE_SIZE */
973 972 mmc->max_blk_size = 2048;
drivers/mmc/host/jz4740_mmc.c
... ... @@ -876,8 +876,7 @@
876 876 mmc->max_blk_count = (1 << 15) - 1;
877 877 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
878 878  
879   - mmc->max_phys_segs = 128;
880   - mmc->max_hw_segs = 128;
  879 + mmc->max_segs = 128;
881 880 mmc->max_seg_size = mmc->max_req_size;
882 881  
883 882 host->mmc = mmc;
drivers/mmc/host/mmc_spi.c
... ... @@ -1345,8 +1345,7 @@
1345 1345  
1346 1346 mmc->ops = &mmc_spi_ops;
1347 1347 mmc->max_blk_size = MMC_SPI_BLOCKSIZE;
1348   - mmc->max_hw_segs = MMC_SPI_BLOCKSATONCE;
1349   - mmc->max_phys_segs = MMC_SPI_BLOCKSATONCE;
  1348 + mmc->max_segs = MMC_SPI_BLOCKSATONCE;
1350 1349 mmc->max_req_size = MMC_SPI_BLOCKSATONCE * MMC_SPI_BLOCKSIZE;
1351 1350 mmc->max_blk_count = MMC_SPI_BLOCKSATONCE;
1352 1351  
drivers/mmc/host/mmci.c
... ... @@ -734,8 +734,7 @@
734 734 /*
735 735 * We can do SGIO
736 736 */
737   - mmc->max_hw_segs = 16;
738   - mmc->max_phys_segs = NR_SG;
  737 + mmc->max_segs = NR_SG;
739 738  
740 739 /*
741 740 * Since only a certain number of bits are valid in the data length
drivers/mmc/host/msm_sdcc.c
... ... @@ -1164,8 +1164,7 @@
1164 1164 mmc->caps |= MMC_CAP_SDIO_IRQ;
1165 1165 mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
1166 1166  
1167   - mmc->max_phys_segs = NR_SG;
1168   - mmc->max_hw_segs = NR_SG;
  1167 + mmc->max_segs = NR_SG;
1169 1168 mmc->max_blk_size = 4096; /* MCI_DATA_CTL BLOCKSIZE up to 4096 */
1170 1169 mmc->max_blk_count = 65536;
1171 1170  
drivers/mmc/host/mvsdio.c
... ... @@ -742,8 +742,7 @@
742 742 mmc->max_blk_size = 2048;
743 743 mmc->max_blk_count = 65535;
744 744  
745   - mmc->max_hw_segs = 1;
746   - mmc->max_phys_segs = 1;
  745 + mmc->max_segs = 1;
747 746 mmc->max_seg_size = mmc->max_blk_size * mmc->max_blk_count;
748 747 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
749 748  
drivers/mmc/host/mxcmmc.c
... ... @@ -790,8 +790,7 @@
790 790 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;
791 791  
792 792 /* MMC core transfer sizes tunable parameters */
793   - mmc->max_hw_segs = 64;
794   - mmc->max_phys_segs = 64;
  793 + mmc->max_segs = 64;
795 794 mmc->max_blk_size = 2048;
796 795 mmc->max_blk_count = 65535;
797 796 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
drivers/mmc/host/omap.c
... ... @@ -1335,8 +1335,7 @@
1335 1335 * NOTE max_seg_size assumption that small blocks aren't
1336 1336 * normally used (except e.g. for reading SD registers).
1337 1337 */
1338   - mmc->max_phys_segs = 32;
1339   - mmc->max_hw_segs = 32;
  1338 + mmc->max_segs = 32;
1340 1339 mmc->max_blk_size = 2048; /* BLEN is 11 bits (+1) */
1341 1340 mmc->max_blk_count = 2048; /* NBLK is 11 bits (+1) */
1342 1341 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
drivers/mmc/host/omap_hsmmc.c
... ... @@ -2105,8 +2105,7 @@
2105 2105  
2106 2106 /* Since we do only SG emulation, we can have as many segs
2107 2107 * as we want. */
2108   - mmc->max_phys_segs = 1024;
2109   - mmc->max_hw_segs = 1024;
  2108 + mmc->max_segs = 1024;
2110 2109  
2111 2110 mmc->max_blk_size = 512; /* Block Length at max can be 1024 */
2112 2111 mmc->max_blk_count = 0xFFFF; /* No. of Blocks is 16 bits */
drivers/mmc/host/pxamci.c
... ... @@ -576,7 +576,7 @@
576 576 * We can do SG-DMA, but we don't because we never know how much
577 577 * data we successfully wrote to the card.
578 578 */
579   - mmc->max_phys_segs = NR_SG;
  579 + mmc->max_segs = NR_SG;
580 580  
581 581 /*
582 582 * Our hardware DMA can handle a maximum of one page per SG entry.
drivers/mmc/host/s3cmci.c
... ... @@ -1736,8 +1736,7 @@
1736 1736 mmc->max_req_size = 4095 * 512;
1737 1737 mmc->max_seg_size = mmc->max_req_size;
1738 1738  
1739   - mmc->max_phys_segs = 128;
1740   - mmc->max_hw_segs = 128;
  1739 + mmc->max_segs = 128;
1741 1740  
1742 1741 dbg(host, dbg_debug,
1743 1742 "probe: mode:%s mapped mci_base:%p irq:%u irq_cd:%u dma:%u.\n",
drivers/mmc/host/sdhci.c
... ... @@ -1850,12 +1850,11 @@
1850 1850 * can do scatter/gather or not.
1851 1851 */
1852 1852 if (host->flags & SDHCI_USE_ADMA)
1853   - mmc->max_hw_segs = 128;
  1853 + mmc->max_segs = 128;
1854 1854 else if (host->flags & SDHCI_USE_SDMA)
1855   - mmc->max_hw_segs = 1;
  1855 + mmc->max_segs = 1;
1856 1856 else /* PIO */
1857   - mmc->max_hw_segs = 128;
1858   - mmc->max_phys_segs = 128;
  1857 + mmc->max_segs = 128;
1859 1858  
1860 1859 /*
1861 1860 * Maximum number of sectors in one transfer. Limited by DMA boundary
drivers/mmc/host/sh_mmcif.c
... ... @@ -846,8 +846,7 @@
846 846 mmc->caps = MMC_CAP_MMC_HIGHSPEED;
847 847 if (pd->caps)
848 848 mmc->caps |= pd->caps;
849   - mmc->max_phys_segs = 128;
850   - mmc->max_hw_segs = 128;
  849 + mmc->max_segs = 128;
851 850 mmc->max_blk_size = 512;
852 851 mmc->max_blk_count = 65535;
853 852 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
drivers/mmc/host/tifm_sd.c
... ... @@ -978,11 +978,10 @@
978 978 mmc->f_max = 24000000;
979 979  
980 980 mmc->max_blk_count = 2048;
981   - mmc->max_hw_segs = mmc->max_blk_count;
  981 + mmc->max_segs = mmc->max_blk_count;
982 982 mmc->max_blk_size = min(TIFM_MMCSD_MAX_BLOCK_SIZE, PAGE_SIZE);
983 983 mmc->max_seg_size = mmc->max_blk_count * mmc->max_blk_size;
984 984 mmc->max_req_size = mmc->max_seg_size;
985   - mmc->max_phys_segs = mmc->max_hw_segs;
986 985  
987 986 sock->card_event = tifm_sd_card_event;
988 987 sock->data_event = tifm_sd_data_event;
drivers/mmc/host/via-sdmmc.c
... ... @@ -1050,8 +1050,7 @@
1050 1050 mmc->ops = &via_sdc_ops;
1051 1051  
1052 1052 /*Hardware cannot do scatter lists*/
1053   - mmc->max_hw_segs = 1;
1054   - mmc->max_phys_segs = 1;
  1053 + mmc->max_segs = 1;
1055 1054  
1056 1055 mmc->max_blk_size = VIA_CRDR_MAX_BLOCK_LENGTH;
1057 1056 mmc->max_blk_count = VIA_CRDR_MAX_BLOCK_COUNT;
drivers/mmc/host/wbsd.c
... ... @@ -1235,8 +1235,7 @@
1235 1235 * Maximum number of segments. Worst case is one sector per segment
1236 1236 * so this will be 64kB/512.
1237 1237 */
1238   - mmc->max_hw_segs = 128;
1239   - mmc->max_phys_segs = 128;
  1238 + mmc->max_segs = 128;
1240 1239  
1241 1240 /*
1242 1241 * Maximum request size. Also limited by 64KiB buffer.
include/linux/mmc/host.h
... ... @@ -162,8 +162,7 @@
162 162  
163 163 /* host specific block data */
164 164 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
165   - unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */
166   - unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */
  165 + unsigned short max_segs; /* see blk_queue_max_segments */
167 166 unsigned short unused;
168 167 unsigned int max_req_size; /* maximum number of bytes in one req */
169 168 unsigned int max_blk_size; /* maximum size of one mmc block */