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 dev_warn(axi->dev, "Couldn't get reset control line\n"); in bt1_axi_request_rst()
140 return PTR_ERR(axi->arst); in bt1_axi_request_rst()
143 ret = reset_control_deassert(axi->arst); in bt1_axi_request_rst()
145 dev_err(axi->dev, "Failed to deassert the reset line\n"); in bt1_axi_request_rst()
154 clk_disable_unprepare(axi->aclk); in bt1_axi_disable_clk()
161 axi->aclk = devm_clk_get(axi->dev, "aclk"); in bt1_axi_request_clk()
162 if (IS_ERR(axi->aclk)) { in bt1_axi_request_clk()
163 dev_err(axi->dev, "Couldn't get AXI Interconnect clock\n"); in bt1_axi_request_clk()
164 return PTR_ERR(axi->aclk); in bt1_axi_request_clk()
167 ret = clk_prepare_enable(axi->aclk); in bt1_axi_request_clk()
169 dev_err(axi->dev, "Couldn't enable the AXI clock\n"); in bt1_axi_request_clk()
173 ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi); in bt1_axi_request_clk()
175 dev_err(axi->dev, "Can't add AXI clock disable action\n"); in bt1_axi_request_clk()
182 struct platform_device *pdev = to_platform_device(axi->dev); in bt1_axi_request_irq()
185 axi->irq = platform_get_irq(pdev, 0); in bt1_axi_request_irq()
186 if (axi->irq < 0) in bt1_axi_request_irq()
187 return axi->irq; in bt1_axi_request_irq()
189 ret = devm_request_irq(axi->dev, axi->irq, bt1_axi_isr, IRQF_SHARED, in bt1_axi_request_irq()
190 "bt1-axi", axi); in bt1_axi_request_irq()
192 dev_err(axi->dev, "Couldn't request AXI EHB IRQ\n"); in bt1_axi_request_irq()
202 return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&axi->count)); in count_show()
220 * error while unaligned writing - the AXI bus write error handled in inject_error_store()
224 readb(axi->qos_regs); in inject_error_store()
226 writeb(0, axi->qos_regs); in inject_error_store()
228 return -EINVAL; in inject_error_store()
245 device_remove_groups(axi->dev, bt1_axi_sysfs_groups); in bt1_axi_remove_sysfs()
252 ret = device_add_groups(axi->dev, bt1_axi_sysfs_groups); in bt1_axi_init_sysfs()
254 dev_err(axi->dev, "Failed to add sysfs files group\n"); in bt1_axi_init_sysfs()
258 ret = devm_add_action_or_reset(axi->dev, bt1_axi_remove_sysfs, axi); in bt1_axi_init_sysfs()
260 dev_err(axi->dev, "Can't add AXI EHB sysfs remove action\n"); in bt1_axi_init_sysfs()
298 { .compatible = "baikal,bt1-axi" },
306 .name = "bt1-axi",
313 MODULE_DESCRIPTION("Baikal-T1 AXI-bus driver");