]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/commitdiff
ATA: CEVA: Add SMMU support for SATA IP
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Tue, 4 Jul 2017 14:33:42 +0000 (20:03 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 10 Jul 2017 07:37:57 +0000 (09:37 +0200)
AXI master interface in CEVA AHCI controller requires two unique
Write/Read ID tags per port. This is because, ahci controller uses
different AXI ID[3:0] bits for identifying non-data transfers(like
reading descriptors, updating PRD tables, etc) and data transfers
(like sending/receiving FIS).To make SMMU work with SATA we need to
add correct SMMU stream id for SATA. SMMU stream id for SATA is
determined based on the AXI ID[1:0] as shown below

SATA SMMU ID =  <TBU number>, 0011, 00, 00, AXI ID[1:0]
Note: SATA in  ZynqMp uses TBU1 so TBU number = 0x1, so
      SMMU ID = 001, 0011, 00, 00, AXI ID[1:0]

Since we have four different AXI ID[3:0] (2 for port0 & 2 for port1
as said above) we get four different SMMU stream id's combinations
for SATA. These AXI ID can be configured using PAXIC register.
In this patch we assumed the below AXI ID values

 Read ID/ Write ID for Non-Data Port0 transfers = 0
 Read ID/ Write ID for Data Port0 transfers = 1
 Read ID/ Write ID for Non-Data Port1 transfers = 2
 Read ID/ Write ID for Data Port1 transfers = 3

Based on the above values,SMMU stream ID's for SATA will be 0x4c0 &
0x4c1 for PORT0, 0x4c2 & 0x4c3 for PORT1. These values needed to be
added to iommus dts property. This patch does the same.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm64/boot/dts/xilinx/zynqmp.dtsi
drivers/ata/ahci_ceva.c

index 5eee2ca161d9eef86c82a261db78b45102864539..b37ecad92e3c85546d031d8e4c1f29165491a85d 100644 (file)
                        interrupt-parent = <&gic>;
                        interrupts = <0 133 4>;
                        power-domains = <&pd_sata>;
+                       #stream-id-cells = <4>;
+                       iommus = <&smmu 0x4c0>, <&smmu 0x4c1>,
+                                <&smmu 0x4c2>, <&smmu 0x4c3>;
                        /* dma-coherent; */
                };
 
index 55c6eac48cde90f960c70da7d7e6e43f4d853774..e81650b84182b6b8dce2b33082650aad290937a8 100644 (file)
 
 /* Vendor Specific Register bit definitions */
 #define PAXIC_ADBW_BW64 0x1
-#define PAXIC_MAWIDD   (1 << 8)
-#define PAXIC_MARIDD   (1 << 16)
+#define PAXIC_MAWID(i) (((i) * 2) << 4)
+#define PAXIC_MARID(i) (((i) * 2) << 12)
+#define PAXIC_MARIDD(i)        ((((i) * 2) + 1) << 16)
+#define PAXIC_MAWIDD(i)        ((((i) * 2) + 1) << 8)
 #define PAXIC_OTL      (0x4 << 20)
 
 /* Register bit definitions for cache control */
@@ -147,9 +149,11 @@ static void ahci_ceva_setup(struct ahci_host_priv *hpriv)
                /*
                 * AXI Data bus width to 64
                 * Set Mem Addr Read, Write ID for data transfers
+                * Set Mem Addr Read ID, Write ID for non-data transfers
                 * Transfer limit to 72 DWord
                 */
-               tmp = PAXIC_ADBW_BW64 | PAXIC_MAWIDD | PAXIC_MARIDD | PAXIC_OTL;
+               tmp = PAXIC_ADBW_BW64 | PAXIC_MAWIDD(i) | PAXIC_MARIDD(i) |
+                       PAXIC_MAWID(i) | PAXIC_MARID(i) | PAXIC_OTL;
                writel(tmp, mmio + AHCI_VEND_PAXIC);
 
                /* Set AXI cache control register if CCi is enabled */