Lines Matching full:axi

8  * Baikal-T1 AXI-bus driver
35 * struct bt1_axi - Baikal-T1 AXI-bus private data
37 * @qos_regs: AXI Interconnect QoS tuning registers.
40 * @aclk: AXI reference clock.
41 * @arst: AXI Interconnect reset line.
60 struct bt1_axi *axi = data; in bt1_axi_isr() local
63 regmap_read(axi->sys_regs, BT1_AXI_WERRL, &low); in bt1_axi_isr()
64 regmap_read(axi->sys_regs, BT1_AXI_WERRH, &high); in bt1_axi_isr()
66 dev_crit_ratelimited(axi->dev, in bt1_axi_isr()
67 "AXI-bus fault %d: %s at 0x%x%08x\n", in bt1_axi_isr()
68 atomic_inc_return(&axi->count), in bt1_axi_isr()
86 struct bt1_axi *axi = data; in bt1_axi_clear_data() local
87 struct platform_device *pdev = to_platform_device(axi->dev); in bt1_axi_clear_data()
95 struct bt1_axi *axi; in bt1_axi_create_data() local
98 axi = devm_kzalloc(dev, sizeof(*axi), GFP_KERNEL); in bt1_axi_create_data()
99 if (!axi) in bt1_axi_create_data()
102 ret = devm_add_action(dev, bt1_axi_clear_data, axi); in bt1_axi_create_data()
104 dev_err(dev, "Can't add AXI EHB data clear action\n"); in bt1_axi_create_data()
108 axi->dev = dev; in bt1_axi_create_data()
109 atomic_set(&axi->count, 0); in bt1_axi_create_data()
110 platform_set_drvdata(pdev, axi); in bt1_axi_create_data()
112 return axi; in bt1_axi_create_data()
115 static int bt1_axi_request_regs(struct bt1_axi *axi) in bt1_axi_request_regs() argument
117 struct platform_device *pdev = to_platform_device(axi->dev); in bt1_axi_request_regs()
118 struct device *dev = axi->dev; in bt1_axi_request_regs()
120 axi->sys_regs = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); in bt1_axi_request_regs()
121 if (IS_ERR(axi->sys_regs)) { in bt1_axi_request_regs()
123 return PTR_ERR(axi->sys_regs); in bt1_axi_request_regs()
126 axi->qos_regs = devm_platform_ioremap_resource_byname(pdev, "qos"); in bt1_axi_request_regs()
127 if (IS_ERR(axi->qos_regs)) in bt1_axi_request_regs()
128 dev_err(dev, "Couldn't map AXI-bus QoS registers\n"); in bt1_axi_request_regs()
130 return PTR_ERR_OR_ZERO(axi->qos_regs); in bt1_axi_request_regs()
133 static int bt1_axi_request_rst(struct bt1_axi *axi) in bt1_axi_request_rst() argument
137 axi->arst = devm_reset_control_get_optional_exclusive(axi->dev, "arst"); in bt1_axi_request_rst()
138 if (IS_ERR(axi->arst)) in bt1_axi_request_rst()
139 return dev_err_probe(axi->dev, PTR_ERR(axi->arst), in bt1_axi_request_rst()
142 ret = reset_control_deassert(axi->arst); in bt1_axi_request_rst()
144 dev_err(axi->dev, "Failed to deassert the reset line\n"); in bt1_axi_request_rst()
149 static int bt1_axi_request_clk(struct bt1_axi *axi) in bt1_axi_request_clk() argument
151 axi->aclk = devm_clk_get_enabled(axi->dev, "aclk"); in bt1_axi_request_clk()
152 if (IS_ERR(axi->aclk)) in bt1_axi_request_clk()
153 return dev_err_probe(axi->dev, PTR_ERR(axi->aclk), in bt1_axi_request_clk()
154 "Couldn't get AXI Interconnect clock\n"); in bt1_axi_request_clk()
159 static int bt1_axi_request_irq(struct bt1_axi *axi) in bt1_axi_request_irq() argument
161 struct platform_device *pdev = to_platform_device(axi->dev); in bt1_axi_request_irq()
164 axi->irq = platform_get_irq(pdev, 0); in bt1_axi_request_irq()
165 if (axi->irq < 0) in bt1_axi_request_irq()
166 return axi->irq; in bt1_axi_request_irq()
168 ret = devm_request_irq(axi->dev, axi->irq, bt1_axi_isr, IRQF_SHARED, in bt1_axi_request_irq()
169 "bt1-axi", axi); in bt1_axi_request_irq()
171 dev_err(axi->dev, "Couldn't request AXI EHB IRQ\n"); in bt1_axi_request_irq()
179 struct bt1_axi *axi = dev_get_drvdata(dev); in count_show() local
181 return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&axi->count)); in count_show()
195 struct bt1_axi *axi = dev_get_drvdata(dev); in inject_error_store() local
199 * error while unaligned writing - the AXI bus write error handled in inject_error_store()
203 readb(axi->qos_regs); in inject_error_store()
205 writeb(0, axi->qos_regs); in inject_error_store()
222 struct bt1_axi *axi = data; in bt1_axi_remove_sysfs() local
224 device_remove_groups(axi->dev, bt1_axi_sysfs_groups); in bt1_axi_remove_sysfs()
227 static int bt1_axi_init_sysfs(struct bt1_axi *axi) in bt1_axi_init_sysfs() argument
231 ret = device_add_groups(axi->dev, bt1_axi_sysfs_groups); in bt1_axi_init_sysfs()
233 dev_err(axi->dev, "Failed to add sysfs files group\n"); in bt1_axi_init_sysfs()
237 ret = devm_add_action_or_reset(axi->dev, bt1_axi_remove_sysfs, axi); in bt1_axi_init_sysfs()
239 dev_err(axi->dev, "Can't add AXI EHB sysfs remove action\n"); in bt1_axi_init_sysfs()
246 struct bt1_axi *axi; in bt1_axi_probe() local
249 axi = bt1_axi_create_data(pdev); in bt1_axi_probe()
250 if (IS_ERR(axi)) in bt1_axi_probe()
251 return PTR_ERR(axi); in bt1_axi_probe()
253 ret = bt1_axi_request_regs(axi); in bt1_axi_probe()
257 ret = bt1_axi_request_rst(axi); in bt1_axi_probe()
261 ret = bt1_axi_request_clk(axi); in bt1_axi_probe()
265 ret = bt1_axi_request_irq(axi); in bt1_axi_probe()
269 ret = bt1_axi_init_sysfs(axi); in bt1_axi_probe()
277 { .compatible = "baikal,bt1-axi" },
285 .name = "bt1-axi",
292 MODULE_DESCRIPTION("Baikal-T1 AXI-bus driver");