.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Marvell EBU SoC Device Bus Controller |
---|
3 | 4 | * (memory controller for NOR/NAND/SRAM/FPGA devices) |
---|
4 | 5 | * |
---|
5 | 6 | * 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 | | - * |
---|
19 | 7 | */ |
---|
20 | 8 | |
---|
21 | 9 | #include <linux/kernel.h> |
---|
.. | .. |
---|
136 | 124 | * The bus width is encoded into the register as 0 for 8 bits, |
---|
137 | 125 | * and 1 for 16 bits, so we do the necessary conversion here. |
---|
138 | 126 | */ |
---|
139 | | - if (r->bus_width == 8) |
---|
| 127 | + if (r->bus_width == 8) { |
---|
140 | 128 | r->bus_width = 0; |
---|
141 | | - else if (r->bus_width == 16) |
---|
| 129 | + } else if (r->bus_width == 16) { |
---|
142 | 130 | r->bus_width = 1; |
---|
143 | | - else { |
---|
| 131 | + } else { |
---|
144 | 132 | dev_err(devbus->dev, "invalid bus width %d\n", r->bus_width); |
---|
145 | 133 | return -EINVAL; |
---|
146 | 134 | } |
---|
147 | 135 | |
---|
148 | 136 | err = get_timing_param_ps(devbus, node, "devbus,badr-skew-ps", |
---|
149 | | - &r->badr_skew); |
---|
| 137 | + &r->badr_skew); |
---|
150 | 138 | if (err < 0) |
---|
151 | 139 | return err; |
---|
152 | 140 | |
---|
153 | 141 | err = get_timing_param_ps(devbus, node, "devbus,turn-off-ps", |
---|
154 | | - &r->turn_off); |
---|
| 142 | + &r->turn_off); |
---|
155 | 143 | if (err < 0) |
---|
156 | 144 | return err; |
---|
157 | 145 | |
---|
158 | 146 | err = get_timing_param_ps(devbus, node, "devbus,acc-first-ps", |
---|
159 | | - &r->acc_first); |
---|
| 147 | + &r->acc_first); |
---|
160 | 148 | if (err < 0) |
---|
161 | 149 | return err; |
---|
162 | 150 | |
---|
163 | 151 | err = get_timing_param_ps(devbus, node, "devbus,acc-next-ps", |
---|
164 | | - &r->acc_next); |
---|
| 152 | + &r->acc_next); |
---|
165 | 153 | if (err < 0) |
---|
166 | 154 | return err; |
---|
167 | 155 | |
---|
.. | .. |
---|
187 | 175 | } |
---|
188 | 176 | |
---|
189 | 177 | err = get_timing_param_ps(devbus, node, "devbus,ale-wr-ps", |
---|
190 | | - &w->ale_wr); |
---|
| 178 | + &w->ale_wr); |
---|
191 | 179 | if (err < 0) |
---|
192 | 180 | return err; |
---|
193 | 181 | |
---|
194 | 182 | err = get_timing_param_ps(devbus, node, "devbus,wr-low-ps", |
---|
195 | | - &w->wr_low); |
---|
| 183 | + &w->wr_low); |
---|
196 | 184 | if (err < 0) |
---|
197 | 185 | return err; |
---|
198 | 186 | |
---|
199 | 187 | err = get_timing_param_ps(devbus, node, "devbus,wr-high-ps", |
---|
200 | | - &w->wr_high); |
---|
| 188 | + &w->wr_high); |
---|
201 | 189 | if (err < 0) |
---|
202 | 190 | return err; |
---|
203 | 191 | |
---|
.. | .. |
---|
279 | 267 | struct devbus_read_params r; |
---|
280 | 268 | struct devbus_write_params w; |
---|
281 | 269 | struct devbus *devbus; |
---|
282 | | - struct resource *res; |
---|
283 | 270 | struct clk *clk; |
---|
284 | 271 | unsigned long rate; |
---|
285 | 272 | int err; |
---|
.. | .. |
---|
289 | 276 | return -ENOMEM; |
---|
290 | 277 | |
---|
291 | 278 | 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); |
---|
294 | 280 | if (IS_ERR(devbus->base)) |
---|
295 | 281 | return PTR_ERR(devbus->base); |
---|
296 | 282 | |
---|
297 | | - clk = devm_clk_get(&pdev->dev, NULL); |
---|
| 283 | + clk = devm_clk_get_enabled(&pdev->dev, NULL); |
---|
298 | 284 | if (IS_ERR(clk)) |
---|
299 | 285 | return PTR_ERR(clk); |
---|
300 | | - clk_prepare_enable(clk); |
---|
301 | 286 | |
---|
302 | 287 | /* |
---|
303 | 288 | * Obtain clock period in picoseconds, |
---|