hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/memory/mvebu-devbus.c
....@@ -1,21 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Marvell EBU SoC Device Bus Controller
34 * (memory controller for NOR/NAND/SRAM/FPGA devices)
45 *
56 * Copyright (C) 2013-2014 Marvell
6
- *
7
- * This program is free software: you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation version 2 of the License.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- *
197 */
208
219 #include <linux/kernel.h>
....@@ -136,32 +124,32 @@
136124 * The bus width is encoded into the register as 0 for 8 bits,
137125 * and 1 for 16 bits, so we do the necessary conversion here.
138126 */
139
- if (r->bus_width == 8)
127
+ if (r->bus_width == 8) {
140128 r->bus_width = 0;
141
- else if (r->bus_width == 16)
129
+ } else if (r->bus_width == 16) {
142130 r->bus_width = 1;
143
- else {
131
+ } else {
144132 dev_err(devbus->dev, "invalid bus width %d\n", r->bus_width);
145133 return -EINVAL;
146134 }
147135
148136 err = get_timing_param_ps(devbus, node, "devbus,badr-skew-ps",
149
- &r->badr_skew);
137
+ &r->badr_skew);
150138 if (err < 0)
151139 return err;
152140
153141 err = get_timing_param_ps(devbus, node, "devbus,turn-off-ps",
154
- &r->turn_off);
142
+ &r->turn_off);
155143 if (err < 0)
156144 return err;
157145
158146 err = get_timing_param_ps(devbus, node, "devbus,acc-first-ps",
159
- &r->acc_first);
147
+ &r->acc_first);
160148 if (err < 0)
161149 return err;
162150
163151 err = get_timing_param_ps(devbus, node, "devbus,acc-next-ps",
164
- &r->acc_next);
152
+ &r->acc_next);
165153 if (err < 0)
166154 return err;
167155
....@@ -187,17 +175,17 @@
187175 }
188176
189177 err = get_timing_param_ps(devbus, node, "devbus,ale-wr-ps",
190
- &w->ale_wr);
178
+ &w->ale_wr);
191179 if (err < 0)
192180 return err;
193181
194182 err = get_timing_param_ps(devbus, node, "devbus,wr-low-ps",
195
- &w->wr_low);
183
+ &w->wr_low);
196184 if (err < 0)
197185 return err;
198186
199187 err = get_timing_param_ps(devbus, node, "devbus,wr-high-ps",
200
- &w->wr_high);
188
+ &w->wr_high);
201189 if (err < 0)
202190 return err;
203191
....@@ -279,7 +267,6 @@
279267 struct devbus_read_params r;
280268 struct devbus_write_params w;
281269 struct devbus *devbus;
282
- struct resource *res;
283270 struct clk *clk;
284271 unsigned long rate;
285272 int err;
....@@ -289,15 +276,13 @@
289276 return -ENOMEM;
290277
291278 devbus->dev = dev;
292
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
293
- devbus->base = devm_ioremap_resource(&pdev->dev, res);
279
+ devbus->base = devm_platform_ioremap_resource(pdev, 0);
294280 if (IS_ERR(devbus->base))
295281 return PTR_ERR(devbus->base);
296282
297
- clk = devm_clk_get(&pdev->dev, NULL);
283
+ clk = devm_clk_get_enabled(&pdev->dev, NULL);
298284 if (IS_ERR(clk))
299285 return PTR_ERR(clk);
300
- clk_prepare_enable(clk);
301286
302287 /*
303288 * Obtain clock period in picoseconds,