bt1-apb.c (4b4193256c8d3bc3a5397b5cd9494c2ad386317d) bt1-apb.c (be5cddef05f519a321a543906f255ac247246074)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
4 *
5 * Authors:
6 * Serge Semin <Sergey.Semin@baikalelectronics.ru>
7 *
8 * Baikal-T1 APB-bus driver

--- 161 unchanged lines hidden (view full) ---

170 return PTR_ERR_OR_ZERO(apb->res);
171}
172
173static int bt1_apb_request_rst(struct bt1_apb *apb)
174{
175 int ret;
176
177 apb->prst = devm_reset_control_get_optional_exclusive(apb->dev, "prst");
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
4 *
5 * Authors:
6 * Serge Semin <Sergey.Semin@baikalelectronics.ru>
7 *
8 * Baikal-T1 APB-bus driver

--- 161 unchanged lines hidden (view full) ---

170 return PTR_ERR_OR_ZERO(apb->res);
171}
172
173static int bt1_apb_request_rst(struct bt1_apb *apb)
174{
175 int ret;
176
177 apb->prst = devm_reset_control_get_optional_exclusive(apb->dev, "prst");
178 if (IS_ERR(apb->prst)) {
179 dev_warn(apb->dev, "Couldn't get reset control line\n");
180 return PTR_ERR(apb->prst);
181 }
178 if (IS_ERR(apb->prst))
179 return dev_err_probe(apb->dev, PTR_ERR(apb->prst),
180 "Couldn't get reset control line\n");
182
183 ret = reset_control_deassert(apb->prst);
184 if (ret)
185 dev_err(apb->dev, "Failed to deassert the reset line\n");
186
187 return ret;
188}
189

--- 4 unchanged lines hidden (view full) ---

194 clk_disable_unprepare(apb->pclk);
195}
196
197static int bt1_apb_request_clk(struct bt1_apb *apb)
198{
199 int ret;
200
201 apb->pclk = devm_clk_get(apb->dev, "pclk");
181
182 ret = reset_control_deassert(apb->prst);
183 if (ret)
184 dev_err(apb->dev, "Failed to deassert the reset line\n");
185
186 return ret;
187}
188

--- 4 unchanged lines hidden (view full) ---

193 clk_disable_unprepare(apb->pclk);
194}
195
196static int bt1_apb_request_clk(struct bt1_apb *apb)
197{
198 int ret;
199
200 apb->pclk = devm_clk_get(apb->dev, "pclk");
202 if (IS_ERR(apb->pclk)) {
203 dev_err(apb->dev, "Couldn't get APB clock descriptor\n");
204 return PTR_ERR(apb->pclk);
205 }
201 if (IS_ERR(apb->pclk))
202 return dev_err_probe(apb->dev, PTR_ERR(apb->pclk),
203 "Couldn't get APB clock descriptor\n");
206
207 ret = clk_prepare_enable(apb->pclk);
208 if (ret) {
209 dev_err(apb->dev, "Couldn't enable the APB clock\n");
210 return ret;
211 }
212
213 ret = devm_add_action_or_reset(apb->dev, bt1_apb_disable_clk, apb);

--- 208 unchanged lines hidden ---
204
205 ret = clk_prepare_enable(apb->pclk);
206 if (ret) {
207 dev_err(apb->dev, "Couldn't enable the APB clock\n");
208 return ret;
209 }
210
211 ret = devm_add_action_or_reset(apb->dev, bt1_apb_disable_clk, apb);

--- 208 unchanged lines hidden ---