bt1-apb.c (a23e1966932464e1c5226cb9ac4ce1d5fc10ba22) | bt1-apb.c (6c4cdf4e126675d8ce0ead810c30831ee1c0997f) |
---|---|
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 --- 171 unchanged lines hidden (view full) --- 180 181 ret = reset_control_deassert(apb->prst); 182 if (ret) 183 dev_err(apb->dev, "Failed to deassert the reset line\n"); 184 185 return ret; 186} 187 | 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 --- 171 unchanged lines hidden (view full) --- 180 181 ret = reset_control_deassert(apb->prst); 182 if (ret) 183 dev_err(apb->dev, "Failed to deassert the reset line\n"); 184 185 return ret; 186} 187 |
188static void bt1_apb_disable_clk(void *data) 189{ 190 struct bt1_apb *apb = data; 191 192 clk_disable_unprepare(apb->pclk); 193} 194 | |
195static int bt1_apb_request_clk(struct bt1_apb *apb) 196{ | 188static int bt1_apb_request_clk(struct bt1_apb *apb) 189{ |
197 int ret; 198 199 apb->pclk = devm_clk_get(apb->dev, "pclk"); | 190 apb->pclk = devm_clk_get_enabled(apb->dev, "pclk"); |
200 if (IS_ERR(apb->pclk)) 201 return dev_err_probe(apb->dev, PTR_ERR(apb->pclk), 202 "Couldn't get APB clock descriptor\n"); 203 | 191 if (IS_ERR(apb->pclk)) 192 return dev_err_probe(apb->dev, PTR_ERR(apb->pclk), 193 "Couldn't get APB clock descriptor\n"); 194 |
204 ret = clk_prepare_enable(apb->pclk); 205 if (ret) { 206 dev_err(apb->dev, "Couldn't enable the APB clock\n"); 207 return ret; 208 } 209 210 ret = devm_add_action_or_reset(apb->dev, bt1_apb_disable_clk, apb); 211 if (ret) { 212 dev_err(apb->dev, "Can't add APB EHB clocks disable action\n"); 213 return ret; 214 } 215 | |
216 apb->rate = clk_get_rate(apb->pclk); 217 if (!apb->rate) { 218 dev_err(apb->dev, "Invalid clock rate\n"); 219 return -EINVAL; 220 } 221 222 return 0; 223} --- 194 unchanged lines hidden --- | 195 apb->rate = clk_get_rate(apb->pclk); 196 if (!apb->rate) { 197 dev_err(apb->dev, "Invalid clock rate\n"); 198 return -EINVAL; 199 } 200 201 return 0; 202} --- 194 unchanged lines hidden --- |