aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/amba-pl08x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/amba-pl08x.c')
-rw-r--r--drivers/dma/amba-pl08x.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 06fe45c74de5..bff41d4848e5 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -133,6 +133,8 @@ struct pl08x_bus_data {
133 u8 buswidth; 133 u8 buswidth;
134}; 134};
135 135
136#define IS_BUS_ALIGNED(bus) IS_ALIGNED((bus)->addr, (bus)->buswidth)
137
136/** 138/**
137 * struct pl08x_phy_chan - holder for the physical channels 139 * struct pl08x_phy_chan - holder for the physical channels
138 * @id: physical index to this channel 140 * @id: physical index to this channel
@@ -845,10 +847,13 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
845 847
846 pl08x_choose_master_bus(&bd, &mbus, &sbus, cctl); 848 pl08x_choose_master_bus(&bd, &mbus, &sbus, cctl);
847 849
848 dev_vdbg(&pl08x->adev->dev, "src=0x%08x%s/%u dst=0x%08x%s/%u len=%zu\n", 850 dev_vdbg(&pl08x->adev->dev,
849 bd.srcbus.addr, cctl & PL080_CONTROL_SRC_INCR ? "+" : "", 851 "src=0x%08llx%s/%u dst=0x%08llx%s/%u len=%zu\n",
852 (u64)bd.srcbus.addr,
853 cctl & PL080_CONTROL_SRC_INCR ? "+" : "",
850 bd.srcbus.buswidth, 854 bd.srcbus.buswidth,
851 bd.dstbus.addr, cctl & PL080_CONTROL_DST_INCR ? "+" : "", 855 (u64)bd.dstbus.addr,
856 cctl & PL080_CONTROL_DST_INCR ? "+" : "",
852 bd.dstbus.buswidth, 857 bd.dstbus.buswidth,
853 bd.remainder); 858 bd.remainder);
854 dev_vdbg(&pl08x->adev->dev, "mbus=%s sbus=%s\n", 859 dev_vdbg(&pl08x->adev->dev, "mbus=%s sbus=%s\n",
@@ -886,8 +891,8 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
886 return 0; 891 return 0;
887 } 892 }
888 893
889 if ((bd.srcbus.addr % bd.srcbus.buswidth) || 894 if (!IS_BUS_ALIGNED(&bd.srcbus) ||
890 (bd.dstbus.addr % bd.dstbus.buswidth)) { 895 !IS_BUS_ALIGNED(&bd.dstbus)) {
891 dev_err(&pl08x->adev->dev, 896 dev_err(&pl08x->adev->dev,
892 "%s src & dst address must be aligned to src" 897 "%s src & dst address must be aligned to src"
893 " & dst width if peripheral is flow controller", 898 " & dst width if peripheral is flow controller",
@@ -908,9 +913,9 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
908 */ 913 */
909 if (bd.remainder < mbus->buswidth) 914 if (bd.remainder < mbus->buswidth)
910 early_bytes = bd.remainder; 915 early_bytes = bd.remainder;
911 else if ((mbus->addr) % (mbus->buswidth)) { 916 else if (!IS_BUS_ALIGNED(mbus)) {
912 early_bytes = mbus->buswidth - (mbus->addr) % 917 early_bytes = mbus->buswidth -
913 (mbus->buswidth); 918 (mbus->addr & (mbus->buswidth - 1));
914 if ((bd.remainder - early_bytes) < mbus->buswidth) 919 if ((bd.remainder - early_bytes) < mbus->buswidth)
915 early_bytes = bd.remainder; 920 early_bytes = bd.remainder;
916 } 921 }
@@ -928,7 +933,7 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
928 * Master now aligned 933 * Master now aligned
929 * - if slave is not then we must set its width down 934 * - if slave is not then we must set its width down
930 */ 935 */
931 if (sbus->addr % sbus->buswidth) { 936 if (!IS_BUS_ALIGNED(sbus)) {
932 dev_dbg(&pl08x->adev->dev, 937 dev_dbg(&pl08x->adev->dev,
933 "%s set down bus width to one byte\n", 938 "%s set down bus width to one byte\n",
934 __func__); 939 __func__);