Lines Matching +full:baikal +full:- +full:t1
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
8 * Baikal-T1 AXI-bus driver
35 * struct bt1_axi - Baikal-T1 AXI-bus private data
38 * @sys_regs: Baikal-T1 System Controller registers map.
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()
87 struct platform_device *pdev = to_platform_device(axi->dev); in bt1_axi_clear_data()
94 struct device *dev = &pdev->dev; in bt1_axi_create_data()
100 return ERR_PTR(-ENOMEM); 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()
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()
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()
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()
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()
181 return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&axi->count)); in count_show()
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()
207 return -EINVAL; in inject_error_store()
224 device_remove_groups(axi->dev, bt1_axi_sysfs_groups); in bt1_axi_remove_sysfs()
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()
277 { .compatible = "baikal,bt1-axi" },
285 .name = "bt1-axi",
292 MODULE_DESCRIPTION("Baikal-T1 AXI-bus driver");