23 #include <linux/kernel.h>
24 #include <linux/module.h>
28 #define DRV_NAME "tegra-ahb"
30 #define AHB_ARBITRATION_DISABLE 0x00
31 #define AHB_ARBITRATION_PRIORITY_CTRL 0x04
32 #define AHB_PRIORITY_WEIGHT(x) (((x) & 0x7) << 29)
33 #define PRIORITY_SELECT_USB BIT(6)
34 #define PRIORITY_SELECT_USB2 BIT(18)
35 #define PRIORITY_SELECT_USB3 BIT(17)
37 #define AHB_GIZMO_AHB_MEM 0x0c
38 #define ENB_FAST_REARBITRATE BIT(2)
39 #define DONT_SPLIT_AHB_WR BIT(7)
41 #define AHB_GIZMO_APB_DMA 0x10
42 #define AHB_GIZMO_IDE 0x18
43 #define AHB_GIZMO_USB 0x1c
44 #define AHB_GIZMO_AHB_XBAR_BRIDGE 0x20
45 #define AHB_GIZMO_CPU_AHB_BRIDGE 0x24
46 #define AHB_GIZMO_COP_AHB_BRIDGE 0x28
47 #define AHB_GIZMO_XBAR_APB_CTLR 0x2c
48 #define AHB_GIZMO_VCP_AHB_BRIDGE 0x30
49 #define AHB_GIZMO_NAND 0x3c
50 #define AHB_GIZMO_SDMMC4 0x44
51 #define AHB_GIZMO_XIO 0x48
52 #define AHB_GIZMO_BSEV 0x60
53 #define AHB_GIZMO_BSEA 0x70
54 #define AHB_GIZMO_NOR 0x74
55 #define AHB_GIZMO_USB2 0x78
56 #define AHB_GIZMO_USB3 0x7c
57 #define IMMEDIATE BIT(18)
59 #define AHB_GIZMO_SDMMC1 0x80
60 #define AHB_GIZMO_SDMMC2 0x84
61 #define AHB_GIZMO_SDMMC3 0x88
62 #define AHB_MEM_PREFETCH_CFG_X 0xd8
63 #define AHB_ARBITRATION_XBAR_CTRL 0xdc
64 #define AHB_MEM_PREFETCH_CFG3 0xe0
65 #define AHB_MEM_PREFETCH_CFG4 0xe4
66 #define AHB_MEM_PREFETCH_CFG1 0xec
67 #define AHB_MEM_PREFETCH_CFG2 0xf0
68 #define PREFETCH_ENB BIT(31)
69 #define MST_ID(x) (((x) & 0x1f) << 26)
70 #define AHBDMA_MST_ID MST_ID(5)
71 #define USB_MST_ID MST_ID(6)
72 #define USB2_MST_ID MST_ID(18)
73 #define USB3_MST_ID MST_ID(17)
74 #define ADDR_BNDRY(x) (((x) & 0xf) << 21)
75 #define INACTIVITY_TIMEOUT(x) (((x) & 0xffff) << 0)
77 #define AHB_ARBITRATION_AHB_MEM_WRQUE_MST_ID 0xf8
79 #define AHB_ARBITRATION_XBAR_CTRL_SMMU_INIT_DONE BIT(17)
83 static const u32 tegra_ahb_gizmo[] = {
131 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
132 static int tegra_ahb_match_by_smmu(
struct device *
dev,
void *
data)
137 return (ahb->
dev->of_node == dn) ? 1 : 0;
147 tegra_ahb_match_by_smmu);
159 static int tegra_ahb_suspend(
struct device *dev)
164 for (i = 0; i <
ARRAY_SIZE(tegra_ahb_gizmo); i++)
165 ahb->
ctx[i] = gizmo_readl(ahb, tegra_ahb_gizmo[i]);
169 static int tegra_ahb_resume(
struct device *dev)
174 for (i = 0; i <
ARRAY_SIZE(tegra_ahb_gizmo); i++)
175 gizmo_writel(ahb, ahb->
ctx[i], tegra_ahb_gizmo[i]);
181 tegra_ahb_resume,
NULL);
183 static void tegra_ahb_gizmo_init(
struct tegra_ahb *ahb)
249 bytes =
sizeof(*ahb) +
sizeof(
u32) *
ARRAY_SIZE(tegra_ahb_gizmo);
262 platform_set_drvdata(pdev, ahb);
263 tegra_ahb_gizmo_init(ahb);
268 { .compatible =
"nvidia,tegra30-ahb", },
269 { .compatible =
"nvidia,tegra20-ahb", },
274 .probe = tegra_ahb_probe,
278 .of_match_table = tegra_ahb_of_match,