Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'ux500-dma40-for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson into next/drivers

From Linus Walleij:
This is a set of patches from Lee Jones to start converting
the ux500 to fetch DMA channels from the device tree:
- Full DT support and channel mapping in the DMA40 driver
- Dropping of platform data for migrated devices on the DT
boot path.

* tag 'ux500-dma40-for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson: (36 commits)
ARM: ux500: Register Cryp and Hash platform drivers on Snowball
crypto: ux500/[cryp|hash] - Show successful start-up in the bootlog
ARM: ux500: Stop passing Cryp DMA channel config information though pdata
crypto: ux500/cryp - Set DMA configuration though dma_slave_config()
crypto: ux500/cryp - Prepare clock before enabling it
ARM: ux500: Stop passing Hash DMA channel config information though pdata
crypto: ux500/hash - Set DMA configuration though dma_slave_config()
crypto: ux500/hash - Prepare clock before enabling it
ARM: ux500: Remove unnecessary attributes from DMA channel request pdata
dmaengine: ste_dma40: Correct copy/paste error
ARM: ux500: Remove DMA address look-up table
dmaengine: ste_dma40: Remove redundant address fetching function
dmaengine: ste_dma40: Only use addresses passed as configuration information
ARM: ux500: Stop passing UART's platform data for Device Tree boots
dmaengine: ste_dma40: Don't configure runtime configurable setup during allocate
dmaengine: ste_dma40: Remove unnecessary call to d40_phy_cfg()
dmaengine: ste_dma40: Separate Logical Global Interrupt Mask (GIM) unmasking
ARM: ux500: Pass remnant platform data though to DMA40 driver
dmaengine: ste_dma40: Supply full Device Tree parsing support
dmaengine: ste_dma40: Allow driver to be probe()able when DT is enabled
...

Signed-off-by: Olof Johansson <olof@lixom.net>

+498 -660
+62
Documentation/devicetree/bindings/dma/ste-dma40.txt
··· 1 + * DMA40 DMA Controller 2 + 3 + Required properties: 4 + - compatible: "stericsson,dma40" 5 + - reg: Address range of the DMAC registers 6 + - reg-names: Names of the above areas to use during resource look-up 7 + - interrupt: Should contain the DMAC interrupt number 8 + - #dma-cells: must be <3> 9 + 10 + Optional properties: 11 + - dma-channels: Number of channels supported by hardware - if not present 12 + the driver will attempt to obtain the information from H/W 13 + 14 + Example: 15 + 16 + dma: dma-controller@801C0000 { 17 + compatible = "stericsson,db8500-dma40", "stericsson,dma40"; 18 + reg = <0x801C0000 0x1000 0x40010000 0x800>; 19 + reg-names = "base", "lcpa"; 20 + interrupt-parent = <&intc>; 21 + interrupts = <0 25 0x4>; 22 + 23 + #dma-cells = <2>; 24 + dma-channels = <8>; 25 + }; 26 + 27 + Clients 28 + Required properties: 29 + - dmas: Comma separated list of dma channel requests 30 + - dma-names: Names of the aforementioned requested channels 31 + 32 + Each dmas request consists of 4 cells: 33 + 1. A phandle pointing to the DMA controller 34 + 2. Device Type 35 + 3. The DMA request line number (only when 'use fixed channel' is set) 36 + 4. A 32bit mask specifying; mode, direction and endianess [NB: This list will grow] 37 + 0x00000001: Mode: 38 + Logical channel when unset 39 + Physical channel when set 40 + 0x00000002: Direction: 41 + Memory to Device when unset 42 + Device to Memory when set 43 + 0x00000004: Endianess: 44 + Little endian when unset 45 + Big endian when set 46 + 0x00000008: Use fixed channel: 47 + Use automatic channel selection when unset 48 + Use DMA request line number when set 49 + 50 + Example: 51 + 52 + uart@80120000 { 53 + compatible = "arm,pl011", "arm,primecell"; 54 + reg = <0x80120000 0x1000>; 55 + interrupts = <0 11 0x4>; 56 + 57 + dmas = <&dma 13 0 0x2>, /* Logical - DevToMem */ 58 + <&dma 13 0 0x0>; /* Logical - MemToDev */ 59 + dma-names = "rx", "rx"; 60 + 61 + status = "disabled"; 62 + };
+6 -50
arch/arm/mach-ux500/board-mop500-audio.c
··· 22 22 static struct stedma40_chan_cfg msp0_dma_rx = { 23 23 .high_priority = true, 24 24 .dir = STEDMA40_PERIPH_TO_MEM, 25 - 26 - .src_dev_type = DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX, 27 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 28 - 29 - .src_info.psize = STEDMA40_PSIZE_LOG_4, 30 - .dst_info.psize = STEDMA40_PSIZE_LOG_4, 31 - 32 - /* data_width is set during configuration */ 25 + .dev_type = DB8500_DMA_DEV31_MSP0_SLIM0_CH0, 33 26 }; 34 27 35 28 static struct stedma40_chan_cfg msp0_dma_tx = { 36 29 .high_priority = true, 37 30 .dir = STEDMA40_MEM_TO_PERIPH, 38 - 39 - .src_dev_type = STEDMA40_DEV_DST_MEMORY, 40 - .dst_dev_type = DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX, 41 - 42 - .src_info.psize = STEDMA40_PSIZE_LOG_4, 43 - .dst_info.psize = STEDMA40_PSIZE_LOG_4, 44 - 45 - /* data_width is set during configuration */ 31 + .dev_type = DB8500_DMA_DEV31_MSP0_SLIM0_CH0, 46 32 }; 47 33 48 34 struct msp_i2s_platform_data msp0_platform_data = { ··· 40 54 static struct stedma40_chan_cfg msp1_dma_rx = { 41 55 .high_priority = true, 42 56 .dir = STEDMA40_PERIPH_TO_MEM, 43 - 44 - .src_dev_type = DB8500_DMA_DEV30_MSP3_RX, 45 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 46 - 47 - .src_info.psize = STEDMA40_PSIZE_LOG_4, 48 - .dst_info.psize = STEDMA40_PSIZE_LOG_4, 49 - 50 - /* data_width is set during configuration */ 57 + .dev_type = DB8500_DMA_DEV30_MSP3, 51 58 }; 52 59 53 60 static struct stedma40_chan_cfg msp1_dma_tx = { 54 61 .high_priority = true, 55 62 .dir = STEDMA40_MEM_TO_PERIPH, 56 - 57 - .src_dev_type = STEDMA40_DEV_DST_MEMORY, 58 - .dst_dev_type = DB8500_DMA_DEV30_MSP1_TX, 59 - 60 - .src_info.psize = STEDMA40_PSIZE_LOG_4, 61 - .dst_info.psize = STEDMA40_PSIZE_LOG_4, 62 - 63 - /* data_width is set during configuration */ 63 + .dev_type = DB8500_DMA_DEV30_MSP1, 64 64 }; 65 65 66 66 struct msp_i2s_platform_data msp1_platform_data = { ··· 58 86 static struct stedma40_chan_cfg msp2_dma_rx = { 59 87 .high_priority = true, 60 88 .dir = STEDMA40_PERIPH_TO_MEM, 61 - 62 - .src_dev_type = DB8500_DMA_DEV14_MSP2_RX, 63 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 64 - 65 - /* MSP2 DMA doesn't work with PSIZE == 4 on DB8500v2 */ 66 - .src_info.psize = STEDMA40_PSIZE_LOG_1, 67 - .dst_info.psize = STEDMA40_PSIZE_LOG_1, 68 - 69 - /* data_width is set during configuration */ 89 + .dev_type = DB8500_DMA_DEV14_MSP2, 70 90 }; 71 91 72 92 static struct stedma40_chan_cfg msp2_dma_tx = { 73 93 .high_priority = true, 74 94 .dir = STEDMA40_MEM_TO_PERIPH, 75 - 76 - .src_dev_type = STEDMA40_DEV_DST_MEMORY, 77 - .dst_dev_type = DB8500_DMA_DEV14_MSP2_TX, 78 - 79 - .src_info.psize = STEDMA40_PSIZE_LOG_4, 80 - .dst_info.psize = STEDMA40_PSIZE_LOG_4, 81 - 95 + .dev_type = DB8500_DMA_DEV14_MSP2, 82 96 .use_fixed_channel = true, 83 97 .phy_channel = 1, 84 - 85 - /* data_width is set during configuration */ 86 98 }; 87 99 88 100 static struct platform_device *db8500_add_msp_i2s(struct device *parent,
+8 -32
arch/arm/mach-ux500/board-mop500-sdi.c
··· 35 35 struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = { 36 36 .mode = STEDMA40_MODE_LOGICAL, 37 37 .dir = STEDMA40_PERIPH_TO_MEM, 38 - .src_dev_type = DB8500_DMA_DEV29_SD_MM0_RX, 39 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 40 - .src_info.data_width = STEDMA40_WORD_WIDTH, 41 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 38 + .dev_type = DB8500_DMA_DEV29_SD_MM0, 42 39 }; 43 40 44 41 static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = { 45 42 .mode = STEDMA40_MODE_LOGICAL, 46 43 .dir = STEDMA40_MEM_TO_PERIPH, 47 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 48 - .dst_dev_type = DB8500_DMA_DEV29_SD_MM0_TX, 49 - .src_info.data_width = STEDMA40_WORD_WIDTH, 50 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 44 + .dev_type = DB8500_DMA_DEV29_SD_MM0, 51 45 }; 52 46 #endif 53 47 ··· 82 88 static struct stedma40_chan_cfg sdi1_dma_cfg_rx = { 83 89 .mode = STEDMA40_MODE_LOGICAL, 84 90 .dir = STEDMA40_PERIPH_TO_MEM, 85 - .src_dev_type = DB8500_DMA_DEV32_SD_MM1_RX, 86 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 87 - .src_info.data_width = STEDMA40_WORD_WIDTH, 88 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 91 + .dev_type = DB8500_DMA_DEV32_SD_MM1, 89 92 }; 90 93 91 94 static struct stedma40_chan_cfg sdi1_dma_cfg_tx = { 92 95 .mode = STEDMA40_MODE_LOGICAL, 93 96 .dir = STEDMA40_MEM_TO_PERIPH, 94 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 95 - .dst_dev_type = DB8500_DMA_DEV32_SD_MM1_TX, 96 - .src_info.data_width = STEDMA40_WORD_WIDTH, 97 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 97 + .dev_type = DB8500_DMA_DEV32_SD_MM1, 98 98 }; 99 99 #endif 100 100 ··· 113 125 struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = { 114 126 .mode = STEDMA40_MODE_LOGICAL, 115 127 .dir = STEDMA40_PERIPH_TO_MEM, 116 - .src_dev_type = DB8500_DMA_DEV28_SD_MM2_RX, 117 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 118 - .src_info.data_width = STEDMA40_WORD_WIDTH, 119 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 128 + .dev_type = DB8500_DMA_DEV28_SD_MM2, 120 129 }; 121 130 122 131 static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = { 123 132 .mode = STEDMA40_MODE_LOGICAL, 124 133 .dir = STEDMA40_MEM_TO_PERIPH, 125 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 126 - .dst_dev_type = DB8500_DMA_DEV28_SD_MM2_TX, 127 - .src_info.data_width = STEDMA40_WORD_WIDTH, 128 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 134 + .dev_type = DB8500_DMA_DEV28_SD_MM2, 129 135 }; 130 136 #endif 131 137 ··· 145 163 struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = { 146 164 .mode = STEDMA40_MODE_LOGICAL, 147 165 .dir = STEDMA40_PERIPH_TO_MEM, 148 - .src_dev_type = DB8500_DMA_DEV42_SD_MM4_RX, 149 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 150 - .src_info.data_width = STEDMA40_WORD_WIDTH, 151 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 166 + .dev_type = DB8500_DMA_DEV42_SD_MM4, 152 167 }; 153 168 154 169 static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = { 155 170 .mode = STEDMA40_MODE_LOGICAL, 156 171 .dir = STEDMA40_MEM_TO_PERIPH, 157 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 158 - .dst_dev_type = DB8500_DMA_DEV42_SD_MM4_TX, 159 - .src_info.data_width = STEDMA40_WORD_WIDTH, 160 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 172 + .dev_type = DB8500_DMA_DEV42_SD_MM4, 161 173 }; 162 174 #endif 163 175
+13 -50
arch/arm/mach-ux500/board-mop500.c
··· 425 425 static struct cryp_platform_data u8500_cryp1_platform_data = { 426 426 .mem_to_engine = { 427 427 .dir = STEDMA40_MEM_TO_PERIPH, 428 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 429 - .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX, 430 - .src_info.data_width = STEDMA40_WORD_WIDTH, 431 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 428 + .dev_type = DB8500_DMA_DEV48_CAC1, 432 429 .mode = STEDMA40_MODE_LOGICAL, 433 - .src_info.psize = STEDMA40_PSIZE_LOG_4, 434 - .dst_info.psize = STEDMA40_PSIZE_LOG_4, 435 430 }, 436 431 .engine_to_mem = { 437 432 .dir = STEDMA40_PERIPH_TO_MEM, 438 - .src_dev_type = DB8500_DMA_DEV48_CAC1_RX, 439 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 440 - .src_info.data_width = STEDMA40_WORD_WIDTH, 441 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 433 + .dev_type = DB8500_DMA_DEV48_CAC1, 442 434 .mode = STEDMA40_MODE_LOGICAL, 443 - .src_info.psize = STEDMA40_PSIZE_LOG_4, 444 - .dst_info.psize = STEDMA40_PSIZE_LOG_4, 445 435 } 446 436 }; 447 437 448 438 static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = { 449 439 .dir = STEDMA40_MEM_TO_PERIPH, 450 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 451 - .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX, 452 - .src_info.data_width = STEDMA40_WORD_WIDTH, 453 - .dst_info.data_width = STEDMA40_WORD_WIDTH, 440 + .dev_type = DB8500_DMA_DEV50_HAC1_TX, 454 441 .mode = STEDMA40_MODE_LOGICAL, 455 - .src_info.psize = STEDMA40_PSIZE_LOG_16, 456 - .dst_info.psize = STEDMA40_PSIZE_LOG_16, 457 442 }; 458 443 459 444 static struct hash_platform_data u8500_hash1_platform_data = { ··· 456 471 static struct stedma40_chan_cfg ssp0_dma_cfg_rx = { 457 472 .mode = STEDMA40_MODE_LOGICAL, 458 473 .dir = STEDMA40_PERIPH_TO_MEM, 459 - .src_dev_type = DB8500_DMA_DEV8_SSP0_RX, 460 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 461 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 462 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 474 + .dev_type = DB8500_DMA_DEV8_SSP0, 463 475 }; 464 476 465 477 static struct stedma40_chan_cfg ssp0_dma_cfg_tx = { 466 478 .mode = STEDMA40_MODE_LOGICAL, 467 479 .dir = STEDMA40_MEM_TO_PERIPH, 468 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 469 - .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX, 470 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 471 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 480 + .dev_type = DB8500_DMA_DEV8_SSP0, 472 481 }; 473 482 #endif 474 483 ··· 491 512 static struct stedma40_chan_cfg uart0_dma_cfg_rx = { 492 513 .mode = STEDMA40_MODE_LOGICAL, 493 514 .dir = STEDMA40_PERIPH_TO_MEM, 494 - .src_dev_type = DB8500_DMA_DEV13_UART0_RX, 495 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 496 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 497 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 515 + .dev_type = DB8500_DMA_DEV13_UART0, 498 516 }; 499 517 500 518 static struct stedma40_chan_cfg uart0_dma_cfg_tx = { 501 519 .mode = STEDMA40_MODE_LOGICAL, 502 520 .dir = STEDMA40_MEM_TO_PERIPH, 503 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 504 - .dst_dev_type = DB8500_DMA_DEV13_UART0_TX, 505 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 506 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 521 + .dev_type = DB8500_DMA_DEV13_UART0, 507 522 }; 508 523 509 524 static struct stedma40_chan_cfg uart1_dma_cfg_rx = { 510 525 .mode = STEDMA40_MODE_LOGICAL, 511 526 .dir = STEDMA40_PERIPH_TO_MEM, 512 - .src_dev_type = DB8500_DMA_DEV12_UART1_RX, 513 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 514 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 515 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 527 + .dev_type = DB8500_DMA_DEV12_UART1, 516 528 }; 517 529 518 530 static struct stedma40_chan_cfg uart1_dma_cfg_tx = { 519 531 .mode = STEDMA40_MODE_LOGICAL, 520 532 .dir = STEDMA40_MEM_TO_PERIPH, 521 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 522 - .dst_dev_type = DB8500_DMA_DEV12_UART1_TX, 523 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 524 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 533 + .dev_type = DB8500_DMA_DEV12_UART1, 525 534 }; 526 535 527 536 static struct stedma40_chan_cfg uart2_dma_cfg_rx = { 528 537 .mode = STEDMA40_MODE_LOGICAL, 529 538 .dir = STEDMA40_PERIPH_TO_MEM, 530 - .src_dev_type = DB8500_DMA_DEV11_UART2_RX, 531 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, 532 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 533 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 539 + .dev_type = DB8500_DMA_DEV11_UART2, 534 540 }; 535 541 536 542 static struct stedma40_chan_cfg uart2_dma_cfg_tx = { 537 543 .mode = STEDMA40_MODE_LOGICAL, 538 544 .dir = STEDMA40_MEM_TO_PERIPH, 539 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 540 - .dst_dev_type = DB8500_DMA_DEV11_UART2_TX, 541 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 542 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 545 + .dev_type = DB8500_DMA_DEV11_UART2, 543 546 }; 544 547 #endif 545 548 ··· 636 675 mop500_uart_init(parent); 637 676 638 677 mop500_snowball_ethernet_clock_enable(); 678 + 679 + u8500_cryp1_hash1_init(parent); 639 680 640 681 /* This board has full regulator constraints */ 641 682 regulator_has_full_constraints();
+1
arch/arm/mach-ux500/board-mop500.h
··· 93 93 extern struct amba_pl011_data uart1_plat; 94 94 extern struct amba_pl011_data uart2_plat; 95 95 extern struct pl022_ssp_controller ssp0_plat; 96 + extern struct stedma40_platform_data dma40_plat_data; 96 97 97 98 extern void mop500_sdi_init(struct device *parent); 98 99 extern void snowball_sdi_init(struct device *parent);
+17 -35
arch/arm/mach-ux500/cpu-db8500.c
··· 162 162 dbx500_add_pinctrl(parent, "pinctrl-db8500", U8500_PRCMU_BASE); 163 163 } 164 164 165 - static int usb_db8500_rx_dma_cfg[] = { 166 - DB8500_DMA_DEV38_USB_OTG_IEP_1_9, 167 - DB8500_DMA_DEV37_USB_OTG_IEP_2_10, 168 - DB8500_DMA_DEV36_USB_OTG_IEP_3_11, 169 - DB8500_DMA_DEV19_USB_OTG_IEP_4_12, 170 - DB8500_DMA_DEV18_USB_OTG_IEP_5_13, 171 - DB8500_DMA_DEV17_USB_OTG_IEP_6_14, 172 - DB8500_DMA_DEV16_USB_OTG_IEP_7_15, 173 - DB8500_DMA_DEV39_USB_OTG_IEP_8 174 - }; 175 - 176 - static int usb_db8500_tx_dma_cfg[] = { 177 - DB8500_DMA_DEV38_USB_OTG_OEP_1_9, 178 - DB8500_DMA_DEV37_USB_OTG_OEP_2_10, 179 - DB8500_DMA_DEV36_USB_OTG_OEP_3_11, 180 - DB8500_DMA_DEV19_USB_OTG_OEP_4_12, 181 - DB8500_DMA_DEV18_USB_OTG_OEP_5_13, 182 - DB8500_DMA_DEV17_USB_OTG_OEP_6_14, 183 - DB8500_DMA_DEV16_USB_OTG_OEP_7_15, 184 - DB8500_DMA_DEV39_USB_OTG_OEP_8 165 + static int usb_db8500_dma_cfg[] = { 166 + DB8500_DMA_DEV38_USB_OTG_IEP_AND_OEP_1_9, 167 + DB8500_DMA_DEV37_USB_OTG_IEP_AND_OEP_2_10, 168 + DB8500_DMA_DEV36_USB_OTG_IEP_AND_OEP_3_11, 169 + DB8500_DMA_DEV19_USB_OTG_IEP_AND_OEP_4_12, 170 + DB8500_DMA_DEV18_USB_OTG_IEP_AND_OEP_5_13, 171 + DB8500_DMA_DEV17_USB_OTG_IEP_AND_OEP_6_14, 172 + DB8500_DMA_DEV16_USB_OTG_IEP_AND_OEP_7_15, 173 + DB8500_DMA_DEV39_USB_OTG_IEP_AND_OEP_8 185 174 }; 186 175 187 176 static const char *db8500_read_soc_id(void) ··· 204 215 205 216 db8500_add_rtc(parent); 206 217 db8500_add_gpios(parent); 207 - db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 218 + db8500_add_usb(parent, usb_db8500_dma_cfg, usb_db8500_dma_cfg); 208 219 209 220 for (i = 0; i < ARRAY_SIZE(platform_devs); i++) 210 221 platform_devs[i]->dev.parent = parent; ··· 221 232 { 222 233 struct device *parent = db8500_soc_device_init(); 223 234 224 - db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 225 - 226 - u8500_dma40_device.dev.parent = parent; 227 - 228 - /* 229 - * Devices to be DT:ed: 230 - * u8500_dma40_device = todo 231 - * db8500_pmu_device = done 232 - * db8500_prcmu_device = done 233 - */ 234 - platform_device_register(&u8500_dma40_device); 235 + db8500_add_usb(parent, usb_db8500_dma_cfg, usb_db8500_dma_cfg); 235 236 236 237 return parent; 237 238 } ··· 230 251 /* Requires call-back bindings. */ 231 252 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), 232 253 /* Requires DMA bindings. */ 233 - OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat), 234 - OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat), 235 - OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat), 254 + OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", NULL), 255 + OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", NULL), 256 + OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", NULL), 236 257 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat), 237 258 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data), 238 259 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data), ··· 268 289 "ux500-msp-i2s.2", &msp2_platform_data), 269 290 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000, 270 291 "ux500-msp-i2s.3", &msp3_platform_data), 292 + /* Requires clock name bindings and channel address lookup table. */ 293 + OF_DEV_AUXDATA("stericsson,db8500-dma40", 0x801C0000, 294 + "dma40.0", &dma40_plat_data), 271 295 {}, 272 296 }; 273 297
+1 -122
arch/arm/mach-ux500/devices-db8500.c
··· 42 42 } 43 43 }; 44 44 45 - /* Default configuration for physcial memcpy */ 46 - struct stedma40_chan_cfg dma40_memcpy_conf_phy = { 47 - .mode = STEDMA40_MODE_PHYSICAL, 48 - .dir = STEDMA40_MEM_TO_MEM, 49 - 50 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 51 - .src_info.psize = STEDMA40_PSIZE_PHY_1, 52 - .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, 53 - 54 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 55 - .dst_info.psize = STEDMA40_PSIZE_PHY_1, 56 - .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, 57 - }; 58 - /* Default configuration for logical memcpy */ 59 - struct stedma40_chan_cfg dma40_memcpy_conf_log = { 60 - .dir = STEDMA40_MEM_TO_MEM, 61 - 62 - .src_info.data_width = STEDMA40_BYTE_WIDTH, 63 - .src_info.psize = STEDMA40_PSIZE_LOG_1, 64 - .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, 65 - 66 - .dst_info.data_width = STEDMA40_BYTE_WIDTH, 67 - .dst_info.psize = STEDMA40_PSIZE_LOG_1, 68 - .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, 69 - }; 70 - 71 - /* 72 - * Mapping between destination event lines and physical device address. 73 - * The event line is tied to a device and therefore the address is constant. 74 - * When the address comes from a primecell it will be configured in runtime 75 - * and we set the address to -1 as a placeholder. 76 - */ 77 - static const dma_addr_t dma40_tx_map[DB8500_DMA_NR_DEV] = { 78 - /* MUSB - these will be runtime-reconfigured */ 79 - [DB8500_DMA_DEV39_USB_OTG_OEP_8] = -1, 80 - [DB8500_DMA_DEV16_USB_OTG_OEP_7_15] = -1, 81 - [DB8500_DMA_DEV17_USB_OTG_OEP_6_14] = -1, 82 - [DB8500_DMA_DEV18_USB_OTG_OEP_5_13] = -1, 83 - [DB8500_DMA_DEV19_USB_OTG_OEP_4_12] = -1, 84 - [DB8500_DMA_DEV36_USB_OTG_OEP_3_11] = -1, 85 - [DB8500_DMA_DEV37_USB_OTG_OEP_2_10] = -1, 86 - [DB8500_DMA_DEV38_USB_OTG_OEP_1_9] = -1, 87 - /* PrimeCells - run-time configured */ 88 - [DB8500_DMA_DEV0_SPI0_TX] = -1, 89 - [DB8500_DMA_DEV1_SD_MMC0_TX] = -1, 90 - [DB8500_DMA_DEV2_SD_MMC1_TX] = -1, 91 - [DB8500_DMA_DEV3_SD_MMC2_TX] = -1, 92 - [DB8500_DMA_DEV8_SSP0_TX] = -1, 93 - [DB8500_DMA_DEV9_SSP1_TX] = -1, 94 - [DB8500_DMA_DEV11_UART2_TX] = -1, 95 - [DB8500_DMA_DEV12_UART1_TX] = -1, 96 - [DB8500_DMA_DEV13_UART0_TX] = -1, 97 - [DB8500_DMA_DEV28_SD_MM2_TX] = -1, 98 - [DB8500_DMA_DEV29_SD_MM0_TX] = -1, 99 - [DB8500_DMA_DEV32_SD_MM1_TX] = -1, 100 - [DB8500_DMA_DEV33_SPI2_TX] = -1, 101 - [DB8500_DMA_DEV35_SPI1_TX] = -1, 102 - [DB8500_DMA_DEV40_SPI3_TX] = -1, 103 - [DB8500_DMA_DEV41_SD_MM3_TX] = -1, 104 - [DB8500_DMA_DEV42_SD_MM4_TX] = -1, 105 - [DB8500_DMA_DEV43_SD_MM5_TX] = -1, 106 - [DB8500_DMA_DEV14_MSP2_TX] = U8500_MSP2_BASE + MSP_TX_RX_REG_OFFSET, 107 - [DB8500_DMA_DEV30_MSP1_TX] = U8500_MSP1_BASE + MSP_TX_RX_REG_OFFSET, 108 - [DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX] = U8500_MSP0_BASE + MSP_TX_RX_REG_OFFSET, 109 - [DB8500_DMA_DEV48_CAC1_TX] = U8500_CRYP1_BASE + CRYP1_TX_REG_OFFSET, 110 - [DB8500_DMA_DEV50_HAC1_TX] = U8500_HASH1_BASE + HASH1_TX_REG_OFFSET, 111 - }; 112 - 113 - /* Mapping between source event lines and physical device address */ 114 - static const dma_addr_t dma40_rx_map[DB8500_DMA_NR_DEV] = { 115 - /* MUSB - these will be runtime-reconfigured */ 116 - [DB8500_DMA_DEV39_USB_OTG_IEP_8] = -1, 117 - [DB8500_DMA_DEV16_USB_OTG_IEP_7_15] = -1, 118 - [DB8500_DMA_DEV17_USB_OTG_IEP_6_14] = -1, 119 - [DB8500_DMA_DEV18_USB_OTG_IEP_5_13] = -1, 120 - [DB8500_DMA_DEV19_USB_OTG_IEP_4_12] = -1, 121 - [DB8500_DMA_DEV36_USB_OTG_IEP_3_11] = -1, 122 - [DB8500_DMA_DEV37_USB_OTG_IEP_2_10] = -1, 123 - [DB8500_DMA_DEV38_USB_OTG_IEP_1_9] = -1, 124 - /* PrimeCells */ 125 - [DB8500_DMA_DEV0_SPI0_RX] = -1, 126 - [DB8500_DMA_DEV1_SD_MMC0_RX] = -1, 127 - [DB8500_DMA_DEV2_SD_MMC1_RX] = -1, 128 - [DB8500_DMA_DEV3_SD_MMC2_RX] = -1, 129 - [DB8500_DMA_DEV8_SSP0_RX] = -1, 130 - [DB8500_DMA_DEV9_SSP1_RX] = -1, 131 - [DB8500_DMA_DEV11_UART2_RX] = -1, 132 - [DB8500_DMA_DEV12_UART1_RX] = -1, 133 - [DB8500_DMA_DEV13_UART0_RX] = -1, 134 - [DB8500_DMA_DEV28_SD_MM2_RX] = -1, 135 - [DB8500_DMA_DEV29_SD_MM0_RX] = -1, 136 - [DB8500_DMA_DEV32_SD_MM1_RX] = -1, 137 - [DB8500_DMA_DEV33_SPI2_RX] = -1, 138 - [DB8500_DMA_DEV35_SPI1_RX] = -1, 139 - [DB8500_DMA_DEV40_SPI3_RX] = -1, 140 - [DB8500_DMA_DEV41_SD_MM3_RX] = -1, 141 - [DB8500_DMA_DEV42_SD_MM4_RX] = -1, 142 - [DB8500_DMA_DEV43_SD_MM5_RX] = -1, 143 - [DB8500_DMA_DEV14_MSP2_RX] = U8500_MSP2_BASE + MSP_TX_RX_REG_OFFSET, 144 - [DB8500_DMA_DEV30_MSP3_RX] = U8500_MSP3_BASE + MSP_TX_RX_REG_OFFSET, 145 - [DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX] = U8500_MSP0_BASE + MSP_TX_RX_REG_OFFSET, 146 - [DB8500_DMA_DEV48_CAC1_RX] = U8500_CRYP1_BASE + CRYP1_RX_REG_OFFSET, 147 - }; 148 - 149 - /* Reserved event lines for memcpy only */ 150 - static int dma40_memcpy_event[] = { 151 - DB8500_DMA_MEMCPY_TX_0, 152 - DB8500_DMA_MEMCPY_TX_1, 153 - DB8500_DMA_MEMCPY_TX_2, 154 - DB8500_DMA_MEMCPY_TX_3, 155 - DB8500_DMA_MEMCPY_TX_4, 156 - DB8500_DMA_MEMCPY_TX_5, 157 - }; 158 - 159 - static struct stedma40_platform_data dma40_plat_data = { 160 - .dev_len = DB8500_DMA_NR_DEV, 161 - .dev_rx = dma40_rx_map, 162 - .dev_tx = dma40_tx_map, 163 - .memcpy = dma40_memcpy_event, 164 - .memcpy_len = ARRAY_SIZE(dma40_memcpy_event), 165 - .memcpy_conf_phy = &dma40_memcpy_conf_phy, 166 - .memcpy_conf_log = &dma40_memcpy_conf_log, 45 + struct stedma40_platform_data dma40_plat_data = { 167 46 .disabled_channels = {-1}, 168 47 }; 169 48
+67 -126
arch/arm/mach-ux500/ste-dma40-db8500.h
··· 12 12 13 13 #define DB8500_DMA_NR_DEV 64 14 14 15 - enum dma_src_dev_type { 16 - DB8500_DMA_DEV0_SPI0_RX = 0, 17 - DB8500_DMA_DEV1_SD_MMC0_RX = 1, 18 - DB8500_DMA_DEV2_SD_MMC1_RX = 2, 19 - DB8500_DMA_DEV3_SD_MMC2_RX = 3, 20 - DB8500_DMA_DEV4_I2C1_RX = 4, 21 - DB8500_DMA_DEV5_I2C3_RX = 5, 22 - DB8500_DMA_DEV6_I2C2_RX = 6, 23 - DB8500_DMA_DEV7_I2C4_RX = 7, /* Only on V1 and later */ 24 - DB8500_DMA_DEV8_SSP0_RX = 8, 25 - DB8500_DMA_DEV9_SSP1_RX = 9, 26 - DB8500_DMA_DEV10_MCDE_RX = 10, 27 - DB8500_DMA_DEV11_UART2_RX = 11, 28 - DB8500_DMA_DEV12_UART1_RX = 12, 29 - DB8500_DMA_DEV13_UART0_RX = 13, 30 - DB8500_DMA_DEV14_MSP2_RX = 14, 31 - DB8500_DMA_DEV15_I2C0_RX = 15, 32 - DB8500_DMA_DEV16_USB_OTG_IEP_7_15 = 16, 33 - DB8500_DMA_DEV17_USB_OTG_IEP_6_14 = 17, 34 - DB8500_DMA_DEV18_USB_OTG_IEP_5_13 = 18, 35 - DB8500_DMA_DEV19_USB_OTG_IEP_4_12 = 19, 36 - DB8500_DMA_DEV20_SLIM0_CH0_RX_HSI_RX_CH0 = 20, 37 - DB8500_DMA_DEV21_SLIM0_CH1_RX_HSI_RX_CH1 = 21, 38 - DB8500_DMA_DEV22_SLIM0_CH2_RX_HSI_RX_CH2 = 22, 39 - DB8500_DMA_DEV23_SLIM0_CH3_RX_HSI_RX_CH3 = 23, 40 - DB8500_DMA_DEV24_SRC_SXA0_RX_TX = 24, 41 - DB8500_DMA_DEV25_SRC_SXA1_RX_TX = 25, 42 - DB8500_DMA_DEV26_SRC_SXA2_RX_TX = 26, 43 - DB8500_DMA_DEV27_SRC_SXA3_RX_TX = 27, 44 - DB8500_DMA_DEV28_SD_MM2_RX = 28, 45 - DB8500_DMA_DEV29_SD_MM0_RX = 29, 46 - DB8500_DMA_DEV30_MSP1_RX = 30, 15 + /* 16 + * Unless otherwise specified, all channels numbers are used for 17 + * TX & RX, and can be used for either source or destination 18 + * channels. 19 + */ 20 + enum dma_dev_type { 21 + DB8500_DMA_DEV0_SPI0 = 0, 22 + DB8500_DMA_DEV1_SD_MMC0 = 1, 23 + DB8500_DMA_DEV2_SD_MMC1 = 2, 24 + DB8500_DMA_DEV3_SD_MMC2 = 3, 25 + DB8500_DMA_DEV4_I2C1 = 4, 26 + DB8500_DMA_DEV5_I2C3 = 5, 27 + DB8500_DMA_DEV6_I2C2 = 6, 28 + DB8500_DMA_DEV7_I2C4 = 7, /* Only on V1 and later */ 29 + DB8500_DMA_DEV8_SSP0 = 8, 30 + DB8500_DMA_DEV9_SSP1 = 9, 31 + DB8500_DMA_DEV10_MCDE_RX = 10, /* RX only */ 32 + DB8500_DMA_DEV11_UART2 = 11, 33 + DB8500_DMA_DEV12_UART1 = 12, 34 + DB8500_DMA_DEV13_UART0 = 13, 35 + DB8500_DMA_DEV14_MSP2 = 14, 36 + DB8500_DMA_DEV15_I2C0 = 15, 37 + DB8500_DMA_DEV16_USB_OTG_IEP_AND_OEP_7_15 = 16, 38 + DB8500_DMA_DEV17_USB_OTG_IEP_AND_OEP_6_14 = 17, 39 + DB8500_DMA_DEV18_USB_OTG_IEP_AND_OEP_5_13 = 18, 40 + DB8500_DMA_DEV19_USB_OTG_IEP_AND_OEP_4_12 = 19, 41 + DB8500_DMA_DEV20_SLIM0_CH0_HSI_CH0 = 20, 42 + DB8500_DMA_DEV21_SLIM0_CH1_HSI_CH1 = 21, 43 + DB8500_DMA_DEV22_SLIM0_CH2_HSI_CH2 = 22, 44 + DB8500_DMA_DEV23_SLIM0_CH3_HSI_CH3 = 23, 45 + DB8500_DMA_DEV24_SXA0 = 24, 46 + DB8500_DMA_DEV25_SXA1 = 25, 47 + DB8500_DMA_DEV26_SXA2 = 26, 48 + DB8500_DMA_DEV27_SXA3 = 27, 49 + DB8500_DMA_DEV28_SD_MM2 = 28, 50 + DB8500_DMA_DEV29_SD_MM0 = 29, 51 + DB8500_DMA_DEV30_MSP1 = 30, 47 52 /* On DB8500v2, MSP3 RX replaces MSP1 RX */ 48 - DB8500_DMA_DEV30_MSP3_RX = 30, 49 - DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX = 31, 50 - DB8500_DMA_DEV32_SD_MM1_RX = 32, 51 - DB8500_DMA_DEV33_SPI2_RX = 33, 52 - DB8500_DMA_DEV34_I2C3_RX2 = 34, 53 - DB8500_DMA_DEV35_SPI1_RX = 35, 54 - DB8500_DMA_DEV36_USB_OTG_IEP_3_11 = 36, 55 - DB8500_DMA_DEV37_USB_OTG_IEP_2_10 = 37, 56 - DB8500_DMA_DEV38_USB_OTG_IEP_1_9 = 38, 57 - DB8500_DMA_DEV39_USB_OTG_IEP_8 = 39, 58 - DB8500_DMA_DEV40_SPI3_RX = 40, 59 - DB8500_DMA_DEV41_SD_MM3_RX = 41, 60 - DB8500_DMA_DEV42_SD_MM4_RX = 42, 61 - DB8500_DMA_DEV43_SD_MM5_RX = 43, 62 - DB8500_DMA_DEV44_SRC_SXA4_RX_TX = 44, 63 - DB8500_DMA_DEV45_SRC_SXA5_RX_TX = 45, 64 - DB8500_DMA_DEV46_SLIM0_CH8_RX_SRC_SXA6_RX_TX = 46, 65 - DB8500_DMA_DEV47_SLIM0_CH9_RX_SRC_SXA7_RX_TX = 47, 66 - DB8500_DMA_DEV48_CAC1_RX = 48, 67 - /* 49, 50 and 51 are not used */ 68 - DB8500_DMA_DEV52_SLIM0_CH4_RX_HSI_RX_CH4 = 52, 69 - DB8500_DMA_DEV53_SLIM0_CH5_RX_HSI_RX_CH5 = 53, 70 - DB8500_DMA_DEV54_SLIM0_CH6_RX_HSI_RX_CH6 = 54, 71 - DB8500_DMA_DEV55_SLIM0_CH7_RX_HSI_RX_CH7 = 55, 72 - /* 56, 57, 58, 59 and 60 are not used */ 73 - DB8500_DMA_DEV61_CAC0_RX = 61, 74 - /* 62 and 63 are not used */ 75 - }; 76 - 77 - enum dma_dest_dev_type { 78 - DB8500_DMA_DEV0_SPI0_TX = 0, 79 - DB8500_DMA_DEV1_SD_MMC0_TX = 1, 80 - DB8500_DMA_DEV2_SD_MMC1_TX = 2, 81 - DB8500_DMA_DEV3_SD_MMC2_TX = 3, 82 - DB8500_DMA_DEV4_I2C1_TX = 4, 83 - DB8500_DMA_DEV5_I2C3_TX = 5, 84 - DB8500_DMA_DEV6_I2C2_TX = 6, 85 - DB8500_DMA_DEV7_I2C4_TX = 7, /* Only on V1 and later */ 86 - DB8500_DMA_DEV8_SSP0_TX = 8, 87 - DB8500_DMA_DEV9_SSP1_TX = 9, 88 - /* 10 is not used*/ 89 - DB8500_DMA_DEV11_UART2_TX = 11, 90 - DB8500_DMA_DEV12_UART1_TX = 12, 91 - DB8500_DMA_DEV13_UART0_TX = 13, 92 - DB8500_DMA_DEV14_MSP2_TX = 14, 93 - DB8500_DMA_DEV15_I2C0_TX = 15, 94 - DB8500_DMA_DEV16_USB_OTG_OEP_7_15 = 16, 95 - DB8500_DMA_DEV17_USB_OTG_OEP_6_14 = 17, 96 - DB8500_DMA_DEV18_USB_OTG_OEP_5_13 = 18, 97 - DB8500_DMA_DEV19_USB_OTG_OEP_4_12 = 19, 98 - DB8500_DMA_DEV20_SLIM0_CH0_TX_HSI_TX_CH0 = 20, 99 - DB8500_DMA_DEV21_SLIM0_CH1_TX_HSI_TX_CH1 = 21, 100 - DB8500_DMA_DEV22_SLIM0_CH2_TX_HSI_TX_CH2 = 22, 101 - DB8500_DMA_DEV23_SLIM0_CH3_TX_HSI_TX_CH3 = 23, 102 - DB8500_DMA_DEV24_DST_SXA0_RX_TX = 24, 103 - DB8500_DMA_DEV25_DST_SXA1_RX_TX = 25, 104 - DB8500_DMA_DEV26_DST_SXA2_RX_TX = 26, 105 - DB8500_DMA_DEV27_DST_SXA3_RX_TX = 27, 106 - DB8500_DMA_DEV28_SD_MM2_TX = 28, 107 - DB8500_DMA_DEV29_SD_MM0_TX = 29, 108 - DB8500_DMA_DEV30_MSP1_TX = 30, 109 - DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX = 31, 110 - DB8500_DMA_DEV32_SD_MM1_TX = 32, 111 - DB8500_DMA_DEV33_SPI2_TX = 33, 112 - DB8500_DMA_DEV34_I2C3_TX2 = 34, 113 - DB8500_DMA_DEV35_SPI1_TX = 35, 114 - DB8500_DMA_DEV36_USB_OTG_OEP_3_11 = 36, 115 - DB8500_DMA_DEV37_USB_OTG_OEP_2_10 = 37, 116 - DB8500_DMA_DEV38_USB_OTG_OEP_1_9 = 38, 117 - DB8500_DMA_DEV39_USB_OTG_OEP_8 = 39, 118 - DB8500_DMA_DEV40_SPI3_TX = 40, 119 - DB8500_DMA_DEV41_SD_MM3_TX = 41, 120 - DB8500_DMA_DEV42_SD_MM4_TX = 42, 121 - DB8500_DMA_DEV43_SD_MM5_TX = 43, 122 - DB8500_DMA_DEV44_DST_SXA4_RX_TX = 44, 123 - DB8500_DMA_DEV45_DST_SXA5_RX_TX = 45, 124 - DB8500_DMA_DEV46_SLIM0_CH8_TX_DST_SXA6_RX_TX = 46, 125 - DB8500_DMA_DEV47_SLIM0_CH9_TX_DST_SXA7_RX_TX = 47, 126 - DB8500_DMA_DEV48_CAC1_TX = 48, 127 - DB8500_DMA_DEV49_CAC1_TX_HAC1_TX = 49, 128 - DB8500_DMA_DEV50_HAC1_TX = 50, 129 - DB8500_DMA_MEMCPY_TX_0 = 51, 130 - DB8500_DMA_DEV52_SLIM1_CH4_TX_HSI_TX_CH4 = 52, 131 - DB8500_DMA_DEV53_SLIM1_CH5_TX_HSI_TX_CH5 = 53, 132 - DB8500_DMA_DEV54_SLIM1_CH6_TX_HSI_TX_CH6 = 54, 133 - DB8500_DMA_DEV55_SLIM1_CH7_TX_HSI_TX_CH7 = 55, 134 - DB8500_DMA_MEMCPY_TX_1 = 56, 135 - DB8500_DMA_MEMCPY_TX_2 = 57, 136 - DB8500_DMA_MEMCPY_TX_3 = 58, 137 - DB8500_DMA_MEMCPY_TX_4 = 59, 138 - DB8500_DMA_MEMCPY_TX_5 = 60, 139 - DB8500_DMA_DEV61_CAC0_TX = 61, 140 - DB8500_DMA_DEV62_CAC0_TX_HAC0_TX = 62, 141 - DB8500_DMA_DEV63_HAC0_TX = 63, 53 + DB8500_DMA_DEV30_MSP3 = 30, 54 + DB8500_DMA_DEV31_MSP0_SLIM0_CH0 = 31, 55 + DB8500_DMA_DEV32_SD_MM1 = 32, 56 + DB8500_DMA_DEV33_SPI2 = 33, 57 + DB8500_DMA_DEV34_I2C3_RX2_TX2 = 34, 58 + DB8500_DMA_DEV35_SPI1 = 35, 59 + DB8500_DMA_DEV36_USB_OTG_IEP_AND_OEP_3_11 = 36, 60 + DB8500_DMA_DEV37_USB_OTG_IEP_AND_OEP_2_10 = 37, 61 + DB8500_DMA_DEV38_USB_OTG_IEP_AND_OEP_1_9 = 38, 62 + DB8500_DMA_DEV39_USB_OTG_IEP_AND_OEP_8 = 39, 63 + DB8500_DMA_DEV40_SPI3 = 40, 64 + DB8500_DMA_DEV41_SD_MM3 = 41, 65 + DB8500_DMA_DEV42_SD_MM4 = 42, 66 + DB8500_DMA_DEV43_SD_MM5 = 43, 67 + DB8500_DMA_DEV44_SXA4 = 44, 68 + DB8500_DMA_DEV45_SXA5 = 45, 69 + DB8500_DMA_DEV46_SLIM0_CH8_SRC_SXA6 = 46, 70 + DB8500_DMA_DEV47_SLIM0_CH9_SRC_SXA7 = 47, 71 + DB8500_DMA_DEV48_CAC1 = 48, 72 + DB8500_DMA_DEV49_CAC1_TX_HAC1_TX = 49, /* TX only */ 73 + DB8500_DMA_DEV50_HAC1_TX = 50, /* TX only */ 74 + DB8500_DMA_MEMCPY_TX_0 = 51, /* TX only */ 75 + DB8500_DMA_DEV52_SLIM0_CH4_HSI_CH4 = 52, 76 + DB8500_DMA_DEV53_SLIM0_CH5_HSI_CH5 = 53, 77 + DB8500_DMA_DEV54_SLIM0_CH6_HSI_CH6 = 54, 78 + DB8500_DMA_DEV55_SLIM0_CH7_HSI_CH7 = 55, 79 + /* 56 -> 60 are channels reserved for memcpy only */ 80 + DB8500_DMA_DEV61_CAC0 = 61, 81 + DB8500_DMA_DEV62_CAC0_TX_HAC0_TX = 62, /* TX only */ 82 + DB8500_DMA_DEV63_HAC0_TX = 63, /* TX only */ 142 83 }; 143 84 144 85 #endif
+4 -14
arch/arm/mach-ux500/usb.c
··· 15 15 #define MUSB_DMA40_RX_CH { \ 16 16 .mode = STEDMA40_MODE_LOGICAL, \ 17 17 .dir = STEDMA40_PERIPH_TO_MEM, \ 18 - .dst_dev_type = STEDMA40_DEV_DST_MEMORY, \ 19 - .src_info.data_width = STEDMA40_WORD_WIDTH, \ 20 - .dst_info.data_width = STEDMA40_WORD_WIDTH, \ 21 - .src_info.psize = STEDMA40_PSIZE_LOG_16, \ 22 - .dst_info.psize = STEDMA40_PSIZE_LOG_16, \ 23 18 } 24 19 25 20 #define MUSB_DMA40_TX_CH { \ 26 21 .mode = STEDMA40_MODE_LOGICAL, \ 27 22 .dir = STEDMA40_MEM_TO_PERIPH, \ 28 - .src_dev_type = STEDMA40_DEV_SRC_MEMORY, \ 29 - .src_info.data_width = STEDMA40_WORD_WIDTH, \ 30 - .dst_info.data_width = STEDMA40_WORD_WIDTH, \ 31 - .src_info.psize = STEDMA40_PSIZE_LOG_16, \ 32 - .dst_info.psize = STEDMA40_PSIZE_LOG_16, \ 33 23 } 34 24 35 25 static struct stedma40_chan_cfg musb_dma_rx_ch[UX500_MUSB_DMA_NUM_RX_CHANNELS] ··· 115 125 .resource = usb_resources, 116 126 }; 117 127 118 - static inline void ux500_usb_dma_update_rx_ch_config(int *src_dev_type) 128 + static inline void ux500_usb_dma_update_rx_ch_config(int *dev_type) 119 129 { 120 130 u32 idx; 121 131 122 132 for (idx = 0; idx < UX500_MUSB_DMA_NUM_RX_CHANNELS; idx++) 123 - musb_dma_rx_ch[idx].src_dev_type = src_dev_type[idx]; 133 + musb_dma_rx_ch[idx].dev_type = dev_type[idx]; 124 134 } 125 135 126 - static inline void ux500_usb_dma_update_tx_ch_config(int *dst_dev_type) 136 + static inline void ux500_usb_dma_update_tx_ch_config(int *dev_type) 127 137 { 128 138 u32 idx; 129 139 130 140 for (idx = 0; idx < UX500_MUSB_DMA_NUM_TX_CHANNELS; idx++) 131 - musb_dma_tx_ch[idx].dst_dev_type = dst_dev_type[idx]; 141 + musb_dma_tx_ch[idx].dev_type = dev_type[idx]; 132 142 } 133 143 134 144 void ux500_add_usb(struct device *parent, resource_size_t base, int irq,
+6 -1
drivers/crypto/ux500/cryp/cryp.h
··· 114 114 }; 115 115 116 116 /* Cryp DMA interface */ 117 + #define CRYP_DMA_TX_FIFO 0x08 118 + #define CRYP_DMA_RX_FIFO 0x10 119 + 117 120 enum cryp_dma_req_type { 118 121 CRYP_DMA_DISABLE_BOTH, 119 122 CRYP_DMA_ENABLE_IN_DATA, ··· 220 217 221 218 /** 222 219 * struct cryp_device_data - structure for a cryp device. 223 - * @base: Pointer to the hardware base address. 220 + * @base: Pointer to virtual base address of the cryp device. 221 + * @phybase: Pointer to physical memory location of the cryp device. 224 222 * @dev: Pointer to the devices dev structure. 225 223 * @clk: Pointer to the device's clock control. 226 224 * @pwr_regulator: Pointer to the device's power control. ··· 236 232 */ 237 233 struct cryp_device_data { 238 234 struct cryp_register __iomem *base; 235 + phys_addr_t phybase; 239 236 struct device *dev; 240 237 struct clk *clk; 241 238 struct regulator *pwr_regulator;
+30 -1
drivers/crypto/ux500/cryp/cryp_core.c
··· 475 475 static void cryp_dma_setup_channel(struct cryp_device_data *device_data, 476 476 struct device *dev) 477 477 { 478 + struct dma_slave_config mem2cryp = { 479 + .direction = DMA_MEM_TO_DEV, 480 + .dst_addr = device_data->phybase + CRYP_DMA_TX_FIFO, 481 + .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, 482 + .dst_maxburst = 4, 483 + }; 484 + struct dma_slave_config cryp2mem = { 485 + .direction = DMA_DEV_TO_MEM, 486 + .src_addr = device_data->phybase + CRYP_DMA_RX_FIFO, 487 + .src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, 488 + .src_maxburst = 4, 489 + }; 490 + 478 491 dma_cap_zero(device_data->dma.mask); 479 492 dma_cap_set(DMA_SLAVE, device_data->dma.mask); 480 493 ··· 502 489 dma_request_channel(device_data->dma.mask, 503 490 stedma40_filter, 504 491 device_data->dma.cfg_cryp2mem); 492 + 493 + dmaengine_slave_config(device_data->dma.chan_mem2cryp, &mem2cryp); 494 + dmaengine_slave_config(device_data->dma.chan_cryp2mem, &cryp2mem); 505 495 506 496 init_completion(&device_data->dma.cryp_dma_complete); 507 497 } ··· 1447 1431 goto out_kfree; 1448 1432 } 1449 1433 1434 + device_data->phybase = res->start; 1450 1435 device_data->base = ioremap(res->start, resource_size(res)); 1451 1436 if (!device_data->base) { 1452 1437 dev_err(dev, "[%s]: ioremap failed!", __func__); ··· 1475 1458 goto out_regulator; 1476 1459 } 1477 1460 1461 + ret = clk_prepare(device_data->clk); 1462 + if (ret) { 1463 + dev_err(dev, "[%s]: clk_prepare() failed!", __func__); 1464 + goto out_clk; 1465 + } 1466 + 1478 1467 /* Enable device power (and clock) */ 1479 1468 ret = cryp_enable_power(device_data->dev, device_data, false); 1480 1469 if (ret) { 1481 1470 dev_err(dev, "[%s]: cryp_enable_power() failed!", __func__); 1482 - goto out_clk; 1471 + goto out_clk_unprepare; 1483 1472 } 1484 1473 1485 1474 cryp_error = cryp_check(device_data); ··· 1541 1518 goto out_power; 1542 1519 } 1543 1520 1521 + dev_info(dev, "successfully registered\n"); 1522 + 1544 1523 return 0; 1545 1524 1546 1525 out_power: 1547 1526 cryp_disable_power(device_data->dev, device_data, false); 1527 + 1528 + out_clk_unprepare: 1529 + clk_unprepare(device_data->clk); 1548 1530 1549 1531 out_clk: 1550 1532 clk_put(device_data->clk); ··· 1621 1593 dev_err(&pdev->dev, "[%s]: cryp_disable_power() failed", 1622 1594 __func__); 1623 1595 1596 + clk_unprepare(device_data->clk); 1624 1597 clk_put(device_data->clk); 1625 1598 regulator_put(device_data->pwr_regulator); 1626 1599
+4 -1
drivers/crypto/ux500/hash/hash_alg.h
··· 11 11 #include <linux/bitops.h> 12 12 13 13 #define HASH_BLOCK_SIZE 64 14 + #define HASH_DMA_FIFO 4 14 15 #define HASH_DMA_ALIGN_SIZE 4 15 16 #define HASH_DMA_PERFORMANCE_MIN_SIZE 1024 16 17 #define HASH_BYTES_PER_WORD 4 ··· 348 347 349 348 /** 350 349 * struct hash_device_data - structure for a hash device. 351 - * @base: Pointer to the hardware base address. 350 + * @base: Pointer to virtual base address of the hash device. 351 + * @phybase: Pointer to physical memory location of the hash device. 352 352 * @list_node: For inclusion in klist. 353 353 * @dev: Pointer to the device dev structure. 354 354 * @ctx_lock: Spinlock for current_ctx. ··· 363 361 */ 364 362 struct hash_device_data { 365 363 struct hash_register __iomem *base; 364 + phys_addr_t phybase; 366 365 struct klist_node list_node; 367 366 struct device *dev; 368 367 struct spinlock ctx_lock;
+22 -2
drivers/crypto/ux500/hash/hash_core.c
··· 122 122 struct device *dev) 123 123 { 124 124 struct hash_platform_data *platform_data = dev->platform_data; 125 + struct dma_slave_config conf = { 126 + .direction = DMA_MEM_TO_DEV, 127 + .dst_addr = device_data->phybase + HASH_DMA_FIFO, 128 + .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, 129 + .dst_maxburst = 16, 130 + }; 131 + 125 132 dma_cap_zero(device_data->dma.mask); 126 133 dma_cap_set(DMA_SLAVE, device_data->dma.mask); 127 134 ··· 137 130 dma_request_channel(device_data->dma.mask, 138 131 platform_data->dma_filter, 139 132 device_data->dma.cfg_mem2hash); 133 + 134 + dmaengine_slave_config(device_data->dma.chan_mem2hash, &conf); 140 135 141 136 init_completion(&device_data->dma.complete); 142 137 } ··· 1708 1699 goto out_kfree; 1709 1700 } 1710 1701 1702 + device_data->phybase = res->start; 1711 1703 device_data->base = ioremap(res->start, resource_size(res)); 1712 1704 if (!device_data->base) { 1713 1705 dev_err(dev, "[%s] ioremap() failed!", ··· 1736 1726 goto out_regulator; 1737 1727 } 1738 1728 1729 + ret = clk_prepare(device_data->clk); 1730 + if (ret) { 1731 + dev_err(dev, "[%s] clk_prepare() failed!", __func__); 1732 + goto out_clk; 1733 + } 1734 + 1739 1735 /* Enable device power (and clock) */ 1740 1736 ret = hash_enable_power(device_data, false); 1741 1737 if (ret) { 1742 1738 dev_err(dev, "[%s]: hash_enable_power() failed!", __func__); 1743 - goto out_clk; 1739 + goto out_clk_unprepare; 1744 1740 } 1745 1741 1746 1742 ret = hash_check_hw(device_data); ··· 1772 1756 goto out_power; 1773 1757 } 1774 1758 1775 - dev_info(dev, "[%s] successfully probed\n", __func__); 1759 + dev_info(dev, "successfully registered\n"); 1776 1760 return 0; 1777 1761 1778 1762 out_power: 1779 1763 hash_disable_power(device_data, false); 1764 + 1765 + out_clk_unprepare: 1766 + clk_unprepare(device_data->clk); 1780 1767 1781 1768 out_clk: 1782 1769 clk_put(device_data->clk); ··· 1845 1826 dev_err(dev, "[%s]: hash_disable_power() failed", 1846 1827 __func__); 1847 1828 1829 + clk_unprepare(device_data->clk); 1848 1830 clk_put(device_data->clk); 1849 1831 regulator_put(device_data->regulator); 1850 1832
+211 -155
drivers/dma/ste_dma40.c
··· 17 17 #include <linux/pm.h> 18 18 #include <linux/pm_runtime.h> 19 19 #include <linux/err.h> 20 + #include <linux/of.h> 21 + #include <linux/of_dma.h> 20 22 #include <linux/amba/bus.h> 21 23 #include <linux/regulator/consumer.h> 22 24 #include <linux/platform_data/dma-ste-dma40.h> ··· 47 45 #define D40_LCLA_LINK_PER_EVENT_GRP 128 48 46 #define D40_LCLA_END D40_LCLA_LINK_PER_EVENT_GRP 49 47 48 + /* Max number of logical channels per physical channel */ 49 + #define D40_MAX_LOG_CHAN_PER_PHY 32 50 + 50 51 /* Attempts before giving up to trying to get pages that are aligned */ 51 52 #define MAX_LCLA_ALLOC_ATTEMPTS 256 52 53 ··· 58 53 #define D40_ALLOC_PHY (1 << 30) 59 54 #define D40_ALLOC_LOG_FREE 0 60 55 61 - #define MAX(a, b) (((a) < (b)) ? (b) : (a)) 56 + /* Reserved event lines for memcpy only. */ 57 + #define DB8500_DMA_MEMCPY_EV_0 51 58 + #define DB8500_DMA_MEMCPY_EV_1 56 59 + #define DB8500_DMA_MEMCPY_EV_2 57 60 + #define DB8500_DMA_MEMCPY_EV_3 58 61 + #define DB8500_DMA_MEMCPY_EV_4 59 62 + #define DB8500_DMA_MEMCPY_EV_5 60 63 + 64 + static int dma40_memcpy_channels[] = { 65 + DB8500_DMA_MEMCPY_EV_0, 66 + DB8500_DMA_MEMCPY_EV_1, 67 + DB8500_DMA_MEMCPY_EV_2, 68 + DB8500_DMA_MEMCPY_EV_3, 69 + DB8500_DMA_MEMCPY_EV_4, 70 + DB8500_DMA_MEMCPY_EV_5, 71 + }; 72 + 73 + /* Default configuration for physcial memcpy */ 74 + struct stedma40_chan_cfg dma40_memcpy_conf_phy = { 75 + .mode = STEDMA40_MODE_PHYSICAL, 76 + .dir = STEDMA40_MEM_TO_MEM, 77 + 78 + .src_info.data_width = STEDMA40_BYTE_WIDTH, 79 + .src_info.psize = STEDMA40_PSIZE_PHY_1, 80 + .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, 81 + 82 + .dst_info.data_width = STEDMA40_BYTE_WIDTH, 83 + .dst_info.psize = STEDMA40_PSIZE_PHY_1, 84 + .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, 85 + }; 86 + 87 + /* Default configuration for logical memcpy */ 88 + struct stedma40_chan_cfg dma40_memcpy_conf_log = { 89 + .mode = STEDMA40_MODE_LOGICAL, 90 + .dir = STEDMA40_MEM_TO_MEM, 91 + 92 + .src_info.data_width = STEDMA40_BYTE_WIDTH, 93 + .src_info.psize = STEDMA40_PSIZE_LOG_1, 94 + .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, 95 + 96 + .dst_info.data_width = STEDMA40_BYTE_WIDTH, 97 + .dst_info.psize = STEDMA40_PSIZE_LOG_1, 98 + .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, 99 + }; 62 100 63 101 /** 64 102 * enum 40_command - The different commands and/or statuses. ··· 218 170 D40_CHAN_REG_SDPTR, 219 171 D40_CHAN_REG_SDLNK, 220 172 }; 173 + 174 + #define BACKUP_REGS_SZ_MAX ((BACKUP_REGS_SZ_V4A > BACKUP_REGS_SZ_V4B) ? \ 175 + BACKUP_REGS_SZ_V4A : BACKUP_REGS_SZ_V4B) 221 176 222 177 /** 223 178 * struct d40_interrupt_lookup - lookup table for interrupt handler ··· 585 534 resource_size_t lcpa_size; 586 535 struct kmem_cache *desc_slab; 587 536 u32 reg_val_backup[BACKUP_REGS_SZ]; 588 - u32 reg_val_backup_v4[MAX(BACKUP_REGS_SZ_V4A, BACKUP_REGS_SZ_V4B)]; 537 + u32 reg_val_backup_v4[BACKUP_REGS_SZ_MAX]; 589 538 u32 *reg_val_backup_chan; 590 539 u16 gcc_pwr_off_mask; 591 540 bool initialized; ··· 1308 1257 static void d40_config_set_event(struct d40_chan *d40c, 1309 1258 enum d40_events event_type) 1310 1259 { 1260 + u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dev_type); 1261 + 1311 1262 /* Enable event line connected to device (or memcpy) */ 1312 1263 if ((d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) || 1313 - (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) { 1314 - u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.src_dev_type); 1315 - 1264 + (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) 1316 1265 __d40_config_set_event(d40c, event_type, event, 1317 1266 D40_CHAN_REG_SSLNK); 1318 - } 1319 1267 1320 - if (d40c->dma_cfg.dir != STEDMA40_PERIPH_TO_MEM) { 1321 - u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); 1322 - 1268 + if (d40c->dma_cfg.dir != STEDMA40_PERIPH_TO_MEM) 1323 1269 __d40_config_set_event(d40c, event_type, event, 1324 1270 D40_CHAN_REG_SDLNK); 1325 - } 1326 1271 } 1327 1272 1328 1273 static u32 d40_chan_has_events(struct d40_chan *d40c) ··· 1760 1713 struct stedma40_chan_cfg *conf) 1761 1714 { 1762 1715 int res = 0; 1763 - u32 dst_event_group = D40_TYPE_TO_GROUP(conf->dst_dev_type); 1764 - u32 src_event_group = D40_TYPE_TO_GROUP(conf->src_dev_type); 1765 1716 bool is_log = conf->mode == STEDMA40_MODE_LOGICAL; 1766 1717 1767 1718 if (!conf->dir) { ··· 1767 1722 res = -EINVAL; 1768 1723 } 1769 1724 1770 - if (conf->dst_dev_type != STEDMA40_DEV_DST_MEMORY && 1771 - d40c->base->plat_data->dev_tx[conf->dst_dev_type] == 0 && 1772 - d40c->runtime_addr == 0) { 1773 - 1774 - chan_err(d40c, "Invalid TX channel address (%d)\n", 1775 - conf->dst_dev_type); 1776 - res = -EINVAL; 1777 - } 1778 - 1779 - if (conf->src_dev_type != STEDMA40_DEV_SRC_MEMORY && 1780 - d40c->base->plat_data->dev_rx[conf->src_dev_type] == 0 && 1781 - d40c->runtime_addr == 0) { 1782 - chan_err(d40c, "Invalid RX channel address (%d)\n", 1783 - conf->src_dev_type); 1784 - res = -EINVAL; 1785 - } 1786 - 1787 - if (conf->dir == STEDMA40_MEM_TO_PERIPH && 1788 - dst_event_group == STEDMA40_DEV_DST_MEMORY) { 1789 - chan_err(d40c, "Invalid dst\n"); 1790 - res = -EINVAL; 1791 - } 1792 - 1793 - if (conf->dir == STEDMA40_PERIPH_TO_MEM && 1794 - src_event_group == STEDMA40_DEV_SRC_MEMORY) { 1795 - chan_err(d40c, "Invalid src\n"); 1796 - res = -EINVAL; 1797 - } 1798 - 1799 - if (src_event_group == STEDMA40_DEV_SRC_MEMORY && 1800 - dst_event_group == STEDMA40_DEV_DST_MEMORY && is_log) { 1801 - chan_err(d40c, "No event line\n"); 1802 - res = -EINVAL; 1803 - } 1804 - 1805 - if (conf->dir == STEDMA40_PERIPH_TO_PERIPH && 1806 - (src_event_group != dst_event_group)) { 1807 - chan_err(d40c, "Invalid event group\n"); 1725 + if ((is_log && conf->dev_type > d40c->base->num_log_chans) || 1726 + (!is_log && conf->dev_type > d40c->base->num_phy_chans) || 1727 + (conf->dev_type < 0)) { 1728 + chan_err(d40c, "Invalid device type (%d)\n", conf->dev_type); 1808 1729 res = -EINVAL; 1809 1730 } 1810 1731 ··· 1891 1880 1892 1881 static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user) 1893 1882 { 1894 - int dev_type; 1883 + int dev_type = d40c->dma_cfg.dev_type; 1895 1884 int event_group; 1896 1885 int event_line; 1897 1886 struct d40_phy_res *phys; ··· 1906 1895 num_phy_chans = d40c->base->num_phy_chans; 1907 1896 1908 1897 if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) { 1909 - dev_type = d40c->dma_cfg.src_dev_type; 1910 1898 log_num = 2 * dev_type; 1911 1899 is_src = true; 1912 1900 } else if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH || 1913 1901 d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) { 1914 1902 /* dst event lines are used for logical memcpy */ 1915 - dev_type = d40c->dma_cfg.dst_dev_type; 1916 1903 log_num = 2 * dev_type + 1; 1917 1904 is_src = false; 1918 1905 } else ··· 2021 2012 dma_cap_mask_t cap = d40c->chan.device->cap_mask; 2022 2013 2023 2014 if (dma_has_cap(DMA_MEMCPY, cap) && !dma_has_cap(DMA_SLAVE, cap)) { 2024 - d40c->dma_cfg = *d40c->base->plat_data->memcpy_conf_log; 2025 - d40c->dma_cfg.src_dev_type = STEDMA40_DEV_SRC_MEMORY; 2026 - d40c->dma_cfg.dst_dev_type = d40c->base->plat_data-> 2027 - memcpy[d40c->chan.chan_id]; 2015 + d40c->dma_cfg = dma40_memcpy_conf_log; 2016 + d40c->dma_cfg.dev_type = dma40_memcpy_channels[d40c->chan.chan_id]; 2017 + 2018 + d40_log_cfg(&d40c->dma_cfg, 2019 + &d40c->log_def.lcsp1, &d40c->log_def.lcsp3); 2028 2020 2029 2021 } else if (dma_has_cap(DMA_MEMCPY, cap) && 2030 2022 dma_has_cap(DMA_SLAVE, cap)) { 2031 - d40c->dma_cfg = *d40c->base->plat_data->memcpy_conf_phy; 2023 + d40c->dma_cfg = dma40_memcpy_conf_phy; 2024 + 2025 + /* Generate interrrupt at end of transfer or relink. */ 2026 + d40c->dst_def_cfg |= BIT(D40_SREG_CFG_TIM_POS); 2027 + 2028 + /* Generate interrupt on error. */ 2029 + d40c->src_def_cfg |= BIT(D40_SREG_CFG_EIM_POS); 2030 + d40c->dst_def_cfg |= BIT(D40_SREG_CFG_EIM_POS); 2031 + 2032 2032 } else { 2033 2033 chan_err(d40c, "No memcpy\n"); 2034 2034 return -EINVAL; ··· 2050 2032 { 2051 2033 2052 2034 int res = 0; 2053 - u32 event; 2035 + u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dev_type); 2054 2036 struct d40_phy_res *phy = d40c->phy_chan; 2055 2037 bool is_src; 2056 2038 ··· 2069 2051 } 2070 2052 2071 2053 if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH || 2072 - d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) { 2073 - event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); 2054 + d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) 2074 2055 is_src = false; 2075 - } else if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) { 2076 - event = D40_TYPE_TO_EVENT(d40c->dma_cfg.src_dev_type); 2056 + else if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) 2077 2057 is_src = true; 2078 - } else { 2058 + else { 2079 2059 chan_err(d40c, "Unknown direction\n"); 2080 2060 return -EINVAL; 2081 2061 } ··· 2114 2098 unsigned long flags; 2115 2099 void __iomem *active_reg; 2116 2100 u32 status; 2117 - u32 event; 2101 + u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dev_type); 2118 2102 2119 2103 spin_lock_irqsave(&d40c->lock, flags); 2120 2104 ··· 2135 2119 2136 2120 if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH || 2137 2121 d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) { 2138 - event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); 2139 2122 status = readl(chanbase + D40_CHAN_REG_SDLNK); 2140 2123 } else if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) { 2141 - event = D40_TYPE_TO_EVENT(d40c->dma_cfg.src_dev_type); 2142 2124 status = readl(chanbase + D40_CHAN_REG_SSLNK); 2143 2125 } else { 2144 2126 chan_err(d40c, "Unknown direction\n"); ··· 2267 2253 return NULL; 2268 2254 } 2269 2255 2270 - static dma_addr_t 2271 - d40_get_dev_addr(struct d40_chan *chan, enum dma_transfer_direction direction) 2272 - { 2273 - struct stedma40_platform_data *plat = chan->base->plat_data; 2274 - struct stedma40_chan_cfg *cfg = &chan->dma_cfg; 2275 - dma_addr_t addr = 0; 2276 - 2277 - if (chan->runtime_addr) 2278 - return chan->runtime_addr; 2279 - 2280 - if (direction == DMA_DEV_TO_MEM) 2281 - addr = plat->dev_rx[cfg->src_dev_type]; 2282 - else if (direction == DMA_MEM_TO_DEV) 2283 - addr = plat->dev_tx[cfg->dst_dev_type]; 2284 - 2285 - return addr; 2286 - } 2287 - 2288 2256 static struct dma_async_tx_descriptor * 2289 2257 d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src, 2290 2258 struct scatterlist *sg_dst, unsigned int sg_len, ··· 2293 2297 if (sg_next(&sg_src[sg_len - 1]) == sg_src) 2294 2298 desc->cyclic = true; 2295 2299 2296 - if (direction != DMA_TRANS_NONE) { 2297 - dma_addr_t dev_addr = d40_get_dev_addr(chan, direction); 2298 - 2299 - if (direction == DMA_DEV_TO_MEM) 2300 - src_dev_addr = dev_addr; 2301 - else if (direction == DMA_MEM_TO_DEV) 2302 - dst_dev_addr = dev_addr; 2303 - } 2300 + if (direction == DMA_DEV_TO_MEM) 2301 + src_dev_addr = chan->runtime_addr; 2302 + else if (direction == DMA_MEM_TO_DEV) 2303 + dst_dev_addr = chan->runtime_addr; 2304 2304 2305 2305 if (chan_is_logical(chan)) 2306 2306 ret = d40_prep_sg_log(chan, desc, sg_src, sg_dst, ··· 2389 2397 2390 2398 if ((d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) || 2391 2399 (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) 2392 - __d40_set_prio_rt(d40c, d40c->dma_cfg.src_dev_type, true); 2400 + __d40_set_prio_rt(d40c, d40c->dma_cfg.dev_type, true); 2393 2401 2394 2402 if ((d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH) || 2395 2403 (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) 2396 - __d40_set_prio_rt(d40c, d40c->dma_cfg.dst_dev_type, false); 2404 + __d40_set_prio_rt(d40c, d40c->dma_cfg.dev_type, false); 2405 + } 2406 + 2407 + #define D40_DT_FLAGS_MODE(flags) ((flags >> 0) & 0x1) 2408 + #define D40_DT_FLAGS_DIR(flags) ((flags >> 1) & 0x1) 2409 + #define D40_DT_FLAGS_BIG_ENDIAN(flags) ((flags >> 2) & 0x1) 2410 + #define D40_DT_FLAGS_FIXED_CHAN(flags) ((flags >> 3) & 0x1) 2411 + 2412 + static struct dma_chan *d40_xlate(struct of_phandle_args *dma_spec, 2413 + struct of_dma *ofdma) 2414 + { 2415 + struct stedma40_chan_cfg cfg; 2416 + dma_cap_mask_t cap; 2417 + u32 flags; 2418 + 2419 + memset(&cfg, 0, sizeof(struct stedma40_chan_cfg)); 2420 + 2421 + dma_cap_zero(cap); 2422 + dma_cap_set(DMA_SLAVE, cap); 2423 + 2424 + cfg.dev_type = dma_spec->args[0]; 2425 + flags = dma_spec->args[2]; 2426 + 2427 + switch (D40_DT_FLAGS_MODE(flags)) { 2428 + case 0: cfg.mode = STEDMA40_MODE_LOGICAL; break; 2429 + case 1: cfg.mode = STEDMA40_MODE_PHYSICAL; break; 2430 + } 2431 + 2432 + switch (D40_DT_FLAGS_DIR(flags)) { 2433 + case 0: 2434 + cfg.dir = STEDMA40_MEM_TO_PERIPH; 2435 + cfg.dst_info.big_endian = D40_DT_FLAGS_BIG_ENDIAN(flags); 2436 + break; 2437 + case 1: 2438 + cfg.dir = STEDMA40_PERIPH_TO_MEM; 2439 + cfg.src_info.big_endian = D40_DT_FLAGS_BIG_ENDIAN(flags); 2440 + break; 2441 + } 2442 + 2443 + if (D40_DT_FLAGS_FIXED_CHAN(flags)) { 2444 + cfg.phy_channel = dma_spec->args[1]; 2445 + cfg.use_fixed_channel = true; 2446 + } 2447 + 2448 + return dma_request_channel(cap, stedma40_filter, &cfg); 2397 2449 } 2398 2450 2399 2451 /* DMA ENGINE functions */ ··· 2469 2433 } 2470 2434 2471 2435 pm_runtime_get_sync(d40c->base->dev); 2472 - /* Fill in basic CFG register values */ 2473 - d40_phy_cfg(&d40c->dma_cfg, &d40c->src_def_cfg, 2474 - &d40c->dst_def_cfg, chan_is_logical(d40c)); 2475 2436 2476 2437 d40_set_prio_realtime(d40c); 2477 2438 2478 2439 if (chan_is_logical(d40c)) { 2479 - d40_log_cfg(&d40c->dma_cfg, 2480 - &d40c->log_def.lcsp1, &d40c->log_def.lcsp3); 2481 - 2482 2440 if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) 2483 2441 d40c->lcpa = d40c->base->lcpa_base + 2484 - d40c->dma_cfg.src_dev_type * D40_LCPA_CHAN_SIZE; 2442 + d40c->dma_cfg.dev_type * D40_LCPA_CHAN_SIZE; 2485 2443 else 2486 2444 d40c->lcpa = d40c->base->lcpa_base + 2487 - d40c->dma_cfg.dst_dev_type * 2445 + d40c->dma_cfg.dev_type * 2488 2446 D40_LCPA_CHAN_SIZE + D40_LCPA_CHAN_DST_DELTA; 2447 + 2448 + /* Unmask the Global Interrupt Mask. */ 2449 + d40c->src_def_cfg |= BIT(D40_SREG_CFG_LOG_GIM_POS); 2450 + d40c->dst_def_cfg |= BIT(D40_SREG_CFG_LOG_GIM_POS); 2489 2451 } 2490 2452 2491 2453 dev_dbg(chan2dev(d40c), "allocated %s channel (phy %d%s)\n", ··· 2744 2710 dst_maxburst = config->dst_maxburst; 2745 2711 2746 2712 if (config->direction == DMA_DEV_TO_MEM) { 2747 - dma_addr_t dev_addr_rx = 2748 - d40c->base->plat_data->dev_rx[cfg->src_dev_type]; 2749 - 2750 2713 config_addr = config->src_addr; 2751 - if (dev_addr_rx) 2752 - dev_dbg(d40c->base->dev, 2753 - "channel has a pre-wired RX address %08x " 2754 - "overriding with %08x\n", 2755 - dev_addr_rx, config_addr); 2714 + 2756 2715 if (cfg->dir != STEDMA40_PERIPH_TO_MEM) 2757 2716 dev_dbg(d40c->base->dev, 2758 2717 "channel was not configured for peripheral " ··· 2760 2733 dst_maxburst = src_maxburst; 2761 2734 2762 2735 } else if (config->direction == DMA_MEM_TO_DEV) { 2763 - dma_addr_t dev_addr_tx = 2764 - d40c->base->plat_data->dev_tx[cfg->dst_dev_type]; 2765 - 2766 2736 config_addr = config->dst_addr; 2767 - if (dev_addr_tx) 2768 - dev_dbg(d40c->base->dev, 2769 - "channel has a pre-wired TX address %08x " 2770 - "overriding with %08x\n", 2771 - dev_addr_tx, config_addr); 2737 + 2772 2738 if (cfg->dir != STEDMA40_MEM_TO_PERIPH) 2773 2739 dev_dbg(d40c->base->dev, 2774 2740 "channel was not configured for memory " ··· 2778 2758 dev_err(d40c->base->dev, 2779 2759 "unrecognized channel direction %d\n", 2780 2760 config->direction); 2761 + return -EINVAL; 2762 + } 2763 + 2764 + if (config_addr <= 0) { 2765 + dev_err(d40c->base->dev, "no address supplied\n"); 2781 2766 return -EINVAL; 2782 2767 } 2783 2768 ··· 2820 2795 if (chan_is_logical(d40c)) 2821 2796 d40_log_cfg(cfg, &d40c->log_def.lcsp1, &d40c->log_def.lcsp3); 2822 2797 else 2823 - d40_phy_cfg(cfg, &d40c->src_def_cfg, 2824 - &d40c->dst_def_cfg, false); 2798 + d40_phy_cfg(cfg, &d40c->src_def_cfg, &d40c->dst_def_cfg); 2825 2799 2826 2800 /* These settings will take precedence later */ 2827 2801 d40c->runtime_addr = config_addr; ··· 2951 2927 } 2952 2928 2953 2929 d40_chan_init(base, &base->dma_memcpy, base->log_chans, 2954 - base->num_log_chans, base->plat_data->memcpy_len); 2930 + base->num_log_chans, ARRAY_SIZE(dma40_memcpy_channels)); 2955 2931 2956 2932 dma_cap_zero(base->dma_memcpy.cap_mask); 2957 2933 dma_cap_set(DMA_MEMCPY, base->dma_memcpy.cap_mask); ··· 3145 3121 3146 3122 static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) 3147 3123 { 3148 - struct stedma40_platform_data *plat_data; 3124 + struct stedma40_platform_data *plat_data = pdev->dev.platform_data; 3149 3125 struct clk *clk = NULL; 3150 3126 void __iomem *virtbase = NULL; 3151 3127 struct resource *res = NULL; ··· 3211 3187 * DB8540v1 has revision 4 3212 3188 */ 3213 3189 rev = AMBA_REV_BITS(pid); 3214 - 3215 - plat_data = pdev->dev.platform_data; 3190 + if (rev < 2) { 3191 + d40_err(&pdev->dev, "hardware revision: %d is not supported", rev); 3192 + goto failure; 3193 + } 3216 3194 3217 3195 /* The number of physical channels on this HW */ 3218 3196 if (plat_data->num_of_phy_chans) ··· 3222 3196 else 3223 3197 num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4; 3224 3198 3225 - dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n", 3226 - rev, res->start, num_phy_chans); 3199 + num_log_chans = num_phy_chans * D40_MAX_LOG_CHAN_PER_PHY; 3227 3200 3228 - if (rev < 2) { 3229 - d40_err(&pdev->dev, "hardware revision: %d is not supported", 3230 - rev); 3231 - goto failure; 3232 - } 3233 - 3234 - /* Count the number of logical channels in use */ 3235 - for (i = 0; i < plat_data->dev_len; i++) 3236 - if (plat_data->dev_rx[i] != 0) 3237 - num_log_chans++; 3238 - 3239 - for (i = 0; i < plat_data->dev_len; i++) 3240 - if (plat_data->dev_tx[i] != 0) 3241 - num_log_chans++; 3201 + dev_info(&pdev->dev, 3202 + "hardware rev: %d @ 0x%x with %d physical and %d logical channels\n", 3203 + rev, res->start, num_phy_chans, num_log_chans); 3242 3204 3243 3205 base = kzalloc(ALIGN(sizeof(struct d40_base), 4) + 3244 - (num_phy_chans + num_log_chans + plat_data->memcpy_len) * 3206 + (num_phy_chans + num_log_chans + ARRAY_SIZE(dma40_memcpy_channels)) * 3245 3207 sizeof(struct d40_chan), GFP_KERNEL); 3246 3208 3247 3209 if (base == NULL) { ··· 3290 3276 if (!base->lookup_phy_chans) 3291 3277 goto failure; 3292 3278 3293 - if (num_log_chans + plat_data->memcpy_len) { 3294 - /* 3295 - * The max number of logical channels are event lines for all 3296 - * src devices and dst devices 3297 - */ 3298 - base->lookup_log_chans = kzalloc(plat_data->dev_len * 2 * 3299 - sizeof(struct d40_chan *), 3300 - GFP_KERNEL); 3301 - if (!base->lookup_log_chans) 3302 - goto failure; 3303 - } 3279 + base->lookup_log_chans = kzalloc(num_log_chans * 3280 + sizeof(struct d40_chan *), 3281 + GFP_KERNEL); 3282 + if (!base->lookup_log_chans) 3283 + goto failure; 3304 3284 3305 3285 base->reg_val_backup_chan = kmalloc(base->num_phy_chans * 3306 3286 sizeof(d40_backup_regs_chan), ··· 3478 3470 return ret; 3479 3471 } 3480 3472 3473 + static int __init d40_of_probe(struct platform_device *pdev, 3474 + struct device_node *np) 3475 + { 3476 + struct stedma40_platform_data *pdata; 3477 + 3478 + /* 3479 + * FIXME: Fill in this routine as more support is added. 3480 + * First platform enabled (u8500) doens't need any extra 3481 + * properties to run, so this is fairly sparce currently. 3482 + */ 3483 + 3484 + pdata = devm_kzalloc(&pdev->dev, 3485 + sizeof(struct stedma40_platform_data), 3486 + GFP_KERNEL); 3487 + if (!pdata) 3488 + return -ENOMEM; 3489 + 3490 + pdev->dev.platform_data = pdata; 3491 + 3492 + return 0; 3493 + } 3494 + 3481 3495 static int __init d40_probe(struct platform_device *pdev) 3482 3496 { 3497 + struct stedma40_platform_data *plat_data = pdev->dev.platform_data; 3498 + struct device_node *np = pdev->dev.of_node; 3483 3499 int err; 3484 3500 int ret = -ENOENT; 3485 - struct d40_base *base; 3501 + struct d40_base *base = NULL; 3486 3502 struct resource *res = NULL; 3487 3503 int num_reserved_chans; 3488 3504 u32 val; 3489 3505 3490 - base = d40_hw_detect_init(pdev); 3506 + if (!plat_data) { 3507 + if (np) { 3508 + if(d40_of_probe(pdev, np)) { 3509 + ret = -ENOMEM; 3510 + goto failure; 3511 + } 3512 + } else { 3513 + d40_err(&pdev->dev, "No pdata or Device Tree provided\n"); 3514 + goto failure; 3515 + } 3516 + } 3491 3517 3518 + base = d40_hw_detect_init(pdev); 3492 3519 if (!base) 3493 3520 goto failure; 3494 3521 ··· 3644 3601 3645 3602 d40_hw_init(base); 3646 3603 3604 + if (np) { 3605 + err = of_dma_controller_register(np, d40_xlate, NULL); 3606 + if (err && err != -ENODEV) 3607 + dev_err(&pdev->dev, 3608 + "could not register of_dma_controller\n"); 3609 + } 3610 + 3647 3611 dev_info(base->dev, "initialized\n"); 3648 3612 return 0; 3649 3613 ··· 3704 3654 return ret; 3705 3655 } 3706 3656 3657 + static const struct of_device_id d40_match[] = { 3658 + { .compatible = "stericsson,dma40", }, 3659 + {} 3660 + }; 3661 + 3707 3662 static struct platform_driver d40_driver = { 3708 3663 .driver = { 3709 3664 .owner = THIS_MODULE, 3710 3665 .name = D40_NAME, 3711 3666 .pm = DMA40_PM_OPS, 3667 + .of_match_table = d40_match, 3712 3668 }, 3713 3669 }; 3714 3670
+42 -52
drivers/dma/ste_dma40_ll.c
··· 50 50 51 51 } 52 52 53 - /* Sets up SRC and DST CFG register for both logical and physical channels */ 54 - void d40_phy_cfg(struct stedma40_chan_cfg *cfg, 55 - u32 *src_cfg, u32 *dst_cfg, bool is_log) 53 + void d40_phy_cfg(struct stedma40_chan_cfg *cfg, u32 *src_cfg, u32 *dst_cfg) 56 54 { 57 55 u32 src = 0; 58 56 u32 dst = 0; 59 57 60 - if (!is_log) { 61 - /* Physical channel */ 62 - if ((cfg->dir == STEDMA40_PERIPH_TO_MEM) || 63 - (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 64 - /* Set master port to 1 */ 65 - src |= 1 << D40_SREG_CFG_MST_POS; 66 - src |= D40_TYPE_TO_EVENT(cfg->src_dev_type); 58 + if ((cfg->dir == STEDMA40_PERIPH_TO_MEM) || 59 + (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 60 + /* Set master port to 1 */ 61 + src |= 1 << D40_SREG_CFG_MST_POS; 62 + src |= D40_TYPE_TO_EVENT(cfg->dev_type); 67 63 68 - if (cfg->src_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 69 - src |= 1 << D40_SREG_CFG_PHY_TM_POS; 70 - else 71 - src |= 3 << D40_SREG_CFG_PHY_TM_POS; 72 - } 73 - if ((cfg->dir == STEDMA40_MEM_TO_PERIPH) || 74 - (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 75 - /* Set master port to 1 */ 76 - dst |= 1 << D40_SREG_CFG_MST_POS; 77 - dst |= D40_TYPE_TO_EVENT(cfg->dst_dev_type); 64 + if (cfg->src_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 65 + src |= 1 << D40_SREG_CFG_PHY_TM_POS; 66 + else 67 + src |= 3 << D40_SREG_CFG_PHY_TM_POS; 68 + } 69 + if ((cfg->dir == STEDMA40_MEM_TO_PERIPH) || 70 + (cfg->dir == STEDMA40_PERIPH_TO_PERIPH)) { 71 + /* Set master port to 1 */ 72 + dst |= 1 << D40_SREG_CFG_MST_POS; 73 + dst |= D40_TYPE_TO_EVENT(cfg->dev_type); 78 74 79 - if (cfg->dst_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 80 - dst |= 1 << D40_SREG_CFG_PHY_TM_POS; 81 - else 82 - dst |= 3 << D40_SREG_CFG_PHY_TM_POS; 83 - } 84 - /* Interrupt on end of transfer for destination */ 85 - dst |= 1 << D40_SREG_CFG_TIM_POS; 75 + if (cfg->dst_info.flow_ctrl == STEDMA40_NO_FLOW_CTRL) 76 + dst |= 1 << D40_SREG_CFG_PHY_TM_POS; 77 + else 78 + dst |= 3 << D40_SREG_CFG_PHY_TM_POS; 79 + } 80 + /* Interrupt on end of transfer for destination */ 81 + dst |= 1 << D40_SREG_CFG_TIM_POS; 86 82 87 - /* Generate interrupt on error */ 88 - src |= 1 << D40_SREG_CFG_EIM_POS; 89 - dst |= 1 << D40_SREG_CFG_EIM_POS; 83 + /* Generate interrupt on error */ 84 + src |= 1 << D40_SREG_CFG_EIM_POS; 85 + dst |= 1 << D40_SREG_CFG_EIM_POS; 90 86 91 - /* PSIZE */ 92 - if (cfg->src_info.psize != STEDMA40_PSIZE_PHY_1) { 93 - src |= 1 << D40_SREG_CFG_PHY_PEN_POS; 94 - src |= cfg->src_info.psize << D40_SREG_CFG_PSIZE_POS; 95 - } 96 - if (cfg->dst_info.psize != STEDMA40_PSIZE_PHY_1) { 97 - dst |= 1 << D40_SREG_CFG_PHY_PEN_POS; 98 - dst |= cfg->dst_info.psize << D40_SREG_CFG_PSIZE_POS; 99 - } 87 + /* PSIZE */ 88 + if (cfg->src_info.psize != STEDMA40_PSIZE_PHY_1) { 89 + src |= 1 << D40_SREG_CFG_PHY_PEN_POS; 90 + src |= cfg->src_info.psize << D40_SREG_CFG_PSIZE_POS; 91 + } 92 + if (cfg->dst_info.psize != STEDMA40_PSIZE_PHY_1) { 93 + dst |= 1 << D40_SREG_CFG_PHY_PEN_POS; 94 + dst |= cfg->dst_info.psize << D40_SREG_CFG_PSIZE_POS; 95 + } 100 96 101 - /* Element size */ 102 - src |= cfg->src_info.data_width << D40_SREG_CFG_ESIZE_POS; 103 - dst |= cfg->dst_info.data_width << D40_SREG_CFG_ESIZE_POS; 97 + /* Element size */ 98 + src |= cfg->src_info.data_width << D40_SREG_CFG_ESIZE_POS; 99 + dst |= cfg->dst_info.data_width << D40_SREG_CFG_ESIZE_POS; 104 100 105 - /* Set the priority bit to high for the physical channel */ 106 - if (cfg->high_priority) { 107 - src |= 1 << D40_SREG_CFG_PRI_POS; 108 - dst |= 1 << D40_SREG_CFG_PRI_POS; 109 - } 110 - 111 - } else { 112 - /* Logical channel */ 113 - dst |= 1 << D40_SREG_CFG_LOG_GIM_POS; 114 - src |= 1 << D40_SREG_CFG_LOG_GIM_POS; 101 + /* Set the priority bit to high for the physical channel */ 102 + if (cfg->high_priority) { 103 + src |= 1 << D40_SREG_CFG_PRI_POS; 104 + dst |= 1 << D40_SREG_CFG_PRI_POS; 115 105 } 116 106 117 107 if (cfg->src_info.big_endian)
+1 -2
drivers/dma/ste_dma40_ll.h
··· 432 432 433 433 void d40_phy_cfg(struct stedma40_chan_cfg *cfg, 434 434 u32 *src_cfg, 435 - u32 *dst_cfg, 436 - bool is_log); 435 + u32 *dst_cfg); 437 436 438 437 void d40_log_cfg(struct stedma40_chan_cfg *cfg, 439 438 u32 *lcsp1,
+3 -17
include/linux/platform_data/dma-ste-dma40.h
··· 86 86 87 87 88 88 /** 89 - * struct stedma40_chan_cfg - dst/src channel configuration 89 + * struct stedma40_half_channel_info - dst/src channel configuration 90 90 * 91 91 * @big_endian: true if the src/dst should be read as big endian 92 92 * @data_width: Data width of the src/dst hardware ··· 109 109 * version 3+, i.e DB8500v2+ 110 110 * @mode: channel mode: physical, logical, or operation 111 111 * @mode_opt: options for the chosen channel mode 112 - * @src_dev_type: Src device type 113 - * @dst_dev_type: Dst device type 112 + * @dev_type: src/dst device type (driver uses dir to figure out which) 114 113 * @src_info: Parameters for dst half channel 115 114 * @dst_info: Parameters for dst half channel 116 115 * @use_fixed_channel: if true, use physical channel specified by phy_channel ··· 125 126 bool realtime; 126 127 enum stedma40_mode mode; 127 128 enum stedma40_mode_opt mode_opt; 128 - int src_dev_type; 129 - int dst_dev_type; 129 + int dev_type; 130 130 struct stedma40_half_channel_info src_info; 131 131 struct stedma40_half_channel_info dst_info; 132 132 ··· 136 138 /** 137 139 * struct stedma40_platform_data - Configuration struct for the dma device. 138 140 * 139 - * @dev_len: length of dev_tx and dev_rx 140 141 * @dev_tx: mapping between destination event line and io address 141 142 * @dev_rx: mapping between source event line and io address 142 - * @memcpy: list of memcpy event lines 143 - * @memcpy_len: length of memcpy 144 - * @memcpy_conf_phy: default configuration of physical channel memcpy 145 - * @memcpy_conf_log: default configuration of logical channel memcpy 146 143 * @disabled_channels: A vector, ending with -1, that marks physical channels 147 144 * that are for different reasons not available for the driver. 148 145 * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW ··· 152 159 * for 'multiple of 4' channels, like 8. 153 160 */ 154 161 struct stedma40_platform_data { 155 - u32 dev_len; 156 - const dma_addr_t *dev_tx; 157 - const dma_addr_t *dev_rx; 158 - int *memcpy; 159 - u32 memcpy_len; 160 - struct stedma40_chan_cfg *memcpy_conf_phy; 161 - struct stedma40_chan_cfg *memcpy_conf_log; 162 162 int disabled_channels[STEDMA40_MAX_PHYS]; 163 163 int *soft_lli_chans; 164 164 int num_of_soft_lli_chans;