Lines Matching refs:axi

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()
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()
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()
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()
151 struct bt1_axi *axi = data; in bt1_axi_disable_clk() local
153 clk_disable_unprepare(axi->aclk); in bt1_axi_disable_clk()
156 static int bt1_axi_request_clk(struct bt1_axi *axi) in bt1_axi_request_clk() argument
160 axi->aclk = devm_clk_get(axi->dev, "aclk"); in bt1_axi_request_clk()
161 if (IS_ERR(axi->aclk)) in bt1_axi_request_clk()
162 return dev_err_probe(axi->dev, PTR_ERR(axi->aclk), in bt1_axi_request_clk()
165 ret = clk_prepare_enable(axi->aclk); in bt1_axi_request_clk()
167 dev_err(axi->dev, "Couldn't enable the AXI clock\n"); in bt1_axi_request_clk()
171 ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi); in bt1_axi_request_clk()
173 dev_err(axi->dev, "Can't add AXI clock disable action\n"); in bt1_axi_request_clk()
178 static int bt1_axi_request_irq(struct bt1_axi *axi) in bt1_axi_request_irq() argument
180 struct platform_device *pdev = to_platform_device(axi->dev); in bt1_axi_request_irq()
183 axi->irq = platform_get_irq(pdev, 0); in bt1_axi_request_irq()
184 if (axi->irq < 0) in bt1_axi_request_irq()
185 return axi->irq; in bt1_axi_request_irq()
187 ret = devm_request_irq(axi->dev, axi->irq, bt1_axi_isr, IRQF_SHARED, in bt1_axi_request_irq()
188 "bt1-axi", axi); in bt1_axi_request_irq()
190 dev_err(axi->dev, "Couldn't request AXI EHB IRQ\n"); in bt1_axi_request_irq()
198 struct bt1_axi *axi = dev_get_drvdata(dev); in count_show() local
200 return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&axi->count)); in count_show()
214 struct bt1_axi *axi = dev_get_drvdata(dev); in inject_error_store() local
222 readb(axi->qos_regs); in inject_error_store()
224 writeb(0, axi->qos_regs); in inject_error_store()
241 struct bt1_axi *axi = data; in bt1_axi_remove_sysfs() local
243 device_remove_groups(axi->dev, bt1_axi_sysfs_groups); in bt1_axi_remove_sysfs()
246 static int bt1_axi_init_sysfs(struct bt1_axi *axi) in bt1_axi_init_sysfs() argument
250 ret = device_add_groups(axi->dev, bt1_axi_sysfs_groups); in bt1_axi_init_sysfs()
252 dev_err(axi->dev, "Failed to add sysfs files group\n"); in bt1_axi_init_sysfs()
256 ret = devm_add_action_or_reset(axi->dev, bt1_axi_remove_sysfs, axi); in bt1_axi_init_sysfs()
258 dev_err(axi->dev, "Can't add AXI EHB sysfs remove action\n"); in bt1_axi_init_sysfs()
265 struct bt1_axi *axi; in bt1_axi_probe() local
268 axi = bt1_axi_create_data(pdev); in bt1_axi_probe()
269 if (IS_ERR(axi)) in bt1_axi_probe()
270 return PTR_ERR(axi); in bt1_axi_probe()
272 ret = bt1_axi_request_regs(axi); in bt1_axi_probe()
276 ret = bt1_axi_request_rst(axi); in bt1_axi_probe()
280 ret = bt1_axi_request_clk(axi); in bt1_axi_probe()
284 ret = bt1_axi_request_irq(axi); in bt1_axi_probe()
288 ret = bt1_axi_init_sysfs(axi); in bt1_axi_probe()