* [shenki:aspeed-otp 140/140] drivers/soc/aspeed/aspeed-otp.c:213:5: warning: no previous prototype for 'otp_read_conf'
@ 2021-03-30 7:57 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-03-30 7:57 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9689 bytes --]
tree: https://github.com/shenki/linux aspeed-otp
head: 1901faa3a9a68dd9e8e3e81207602d9ff315f2c1
commit: 1901faa3a9a68dd9e8e3e81207602d9ff315f2c1 [140/140] soc: aspeed: Add driver for OTP region
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/shenki/linux/commit/1901faa3a9a68dd9e8e3e81207602d9ff315f2c1
git remote add shenki https://github.com/shenki/linux
git fetch --no-tags shenki aspeed-otp
git checkout 1901faa3a9a68dd9e8e3e81207602d9ff315f2c1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/soc/aspeed/aspeed-otp.c:213:5: warning: no previous prototype for 'otp_read_conf' [-Wmissing-prototypes]
213 | int otp_read_conf(struct aspeed_otp *otp)
| ^~~~~~~~~~~~~
>> drivers/soc/aspeed/aspeed-otp.c:236:5: warning: no previous prototype for 'otp_read_strap' [-Wmissing-prototypes]
236 | int otp_read_strap(struct aspeed_otp *otp)
| ^~~~~~~~~~~~~~
>> drivers/soc/aspeed/aspeed-otp.c:291:5: warning: no previous prototype for 'otp_write_conf' [-Wmissing-prototypes]
291 | int otp_write_conf(struct aspeed_otp *otp, unsigned int word, unsigned int bit)
| ^~~~~~~~~~~~~~
>> drivers/soc/aspeed/aspeed-otp.c:327:5: warning: no previous prototype for 'otp_write_strap' [-Wmissing-prototypes]
327 | int otp_write_strap(struct aspeed_otp *otp, unsigned int bit, unsigned int val)
| ^~~~~~~~~~~~~~~
In file included from include/linux/swab.h:5,
from include/uapi/linux/byteorder/big_endian.h:13,
from include/linux/byteorder/big_endian.h:5,
from arch/arc/include/uapi/asm/byteorder.h:14,
from include/asm-generic/bitops/le.h:6,
from arch/arc/include/asm/bitops.h:373,
from include/linux/bitops.h:29,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from drivers/soc/aspeed/aspeed-otp.c:6:
drivers/soc/aspeed/aspeed-otp.c: In function 'otp_write_strap':
>> drivers/soc/aspeed/aspeed-otp.c:394:22: warning: passing argument 1 of '__fswab32' makes integer from pointer without a cast [-Wint-conversion]
394 | writel(otp->base + OTP_PROTECT_KEY, 0);
include/uapi/linux/swab.h:120:12: note: in definition of macro '__swab32'
120 | __fswab32(x))
| ^
include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
88 | #define cpu_to_le32 __cpu_to_le32
| ^~~~~~~~~~~~~
arch/arc/include/asm/io.h:209:36: note: in expansion of macro 'writel_relaxed'
209 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
| ^~~~~~~~~~~~~~
drivers/soc/aspeed/aspeed-otp.c:394:5: note: in expansion of macro 'writel'
394 | writel(otp->base + OTP_PROTECT_KEY, 0);
| ^~~~~~
include/uapi/linux/swab.h:57:57: note: expected '__u32' {aka 'unsigned int'} but argument is of type 'void *'
57 | static inline __attribute_const__ __u32 __fswab32(__u32 val)
| ~~~~~~^~~
vim +/otp_read_conf +213 drivers/soc/aspeed/aspeed-otp.c
212
> 213 int otp_read_conf(struct aspeed_otp *otp)
214 {
215 uint32_t conf[NUM_OTP_CONF];
216 int i;
217 int rc;
218
219 writel(OTP_PASSWD, otp->base + OTP_PROTECT_KEY);
220
221 for (i = 0; i < NUM_OTP_CONF; ++i) {
222 rc = otp_read_config(otp, i, &conf[i]);
223 if (rc)
224 goto done;
225 }
226
227 dev_dbg(otp->dev, "OTP configuration:\n");
228 for (i = 0; i < NUM_OTP_CONF; ++i)
229 dev_dbg(otp->dev, "%02u: %08x\n", i, conf[i]);
230
231 done:
232 writel(0, otp->base + OTP_PROTECT_KEY);
233 return rc;
234 }
235
> 236 int otp_read_strap(struct aspeed_otp *otp)
237 {
238 uint32_t res[2] = { 0, 0};
239 uint32_t strap[6][2];
240 uint32_t protect[2];
241 uint32_t scu_protect[2];
242 int rc;
243 int i;
244
245 writel(OTP_PASSWD, otp->base + OTP_PROTECT_KEY);
246
247 rc = otp_read_config(otp, 28, &scu_protect[0]);
248 if (rc)
249 goto done;
250
251 rc = otp_read_config(otp, 29, &scu_protect[1]);
252 if (rc)
253 goto done;
254
255 rc = otp_read_config(otp, 30, &protect[0]);
256 if (rc)
257 goto done;
258
259 rc = otp_read_config(otp, 31, &protect[1]);
260 if (rc)
261 goto done;
262
263 for (i = 0; i < 6; ++i) {
264 int o = 16 + (i * 2);
265
266 rc = otp_read_config(otp, o, &strap[i][0]);
267 if (rc)
268 goto done;
269
270 rc = otp_read_config(otp, o + 1, &strap[i][1]);
271 if (rc)
272 goto done;
273
274 res[0] ^= strap[i][0];
275 res[1] ^= strap[i][1];
276 }
277
278 dev_dbg(otp->dev, "OTP straps:\n");
279 dev_dbg(otp->dev, "Protect SCU: %08x %08x\n", scu_protect[0], scu_protect[1]);
280 dev_dbg(otp->dev, "Protect: %08x %08x\n", protect[0], protect[1]);
281
282 for (i = 0; i < 6; ++i)
283 dev_dbg(otp->dev, "Option %u: %08x %08x\n", i, strap[i][0], strap[i][1]);
284
285 dev_dbg(otp->dev, "Result: %08x %08x\n", res[0], res[1]);
286 done:
287 writel(0, otp->base + OTP_PROTECT_KEY);
288 return rc;
289 }
290
> 291 int otp_write_conf(struct aspeed_otp *otp, unsigned int word, unsigned int bit)
292 {
293 int rc;
294 uint32_t conf;
295 uint32_t address;
296 uint32_t bitmask;
297
298 if (word >= NUM_OTP_CONF || bit >= 32)
299 return -EINVAL;
300
301 bitmask = 1 << bit;
302
303 writel(OTP_PASSWD, otp->base + OTP_PROTECT_KEY);
304
305 rc = otp_read_config(otp, word, &conf);
306 if (rc)
307 goto done;
308
309 if (conf & bitmask) {
310 dev_err(otp->dev, "Configuration bit already set\n");
311 rc = -EALREADY;
312 goto done;
313 }
314
315 address = 0x800;
316 address |= (word / 8) * 0x200;
317 address |= (word % 8) * 2;
318
319 dev_dbg(otp->dev, "Writing configuration at OTP %04x with %08x\n", address, bitmask);
320 rc = otp_write(otp, address, bitmask);
321
322 done:
323 writel(0, otp->base + OTP_PROTECT_KEY);
324 return rc;
325 }
326
> 327 int otp_write_strap(struct aspeed_otp *otp, unsigned int bit, unsigned int val)
328 {
329 int i;
330 int rc;
331 int f = -1;
332 uint32_t address;
333 uint32_t bitmask;
334 uint32_t protect;
335 uint32_t res = 0;
336 uint32_t word = 0;
337 uint32_t strap[6];
338
339 if (bit >= 64 || val > 1)
340 return -EINVAL;
341
342 writel(OTP_PASSWD, otp->base + OTP_PROTECT_KEY);
343
344 if (bit > 31) {
345 word = 1;
346 bit -= 32;
347 }
348
349 bitmask = 1 << bit;
350
351 rc = otp_read_config(otp, 30 + word, &protect);
352 if (rc)
353 goto done;
354
355 if (protect & bitmask) {
356 dev_err(otp->dev, "Cannot write strap; bit is protected\n");
357 rc = -EACCES;
358 goto done;
359 }
360
361 for (i = 0; i < 6; ++i) {
362 uint32_t o = 16 + (i * 2);
363
364 rc = otp_read_config(otp, o + word, &strap[i]);
365 if (rc)
366 goto done;
367
368 res ^= strap[i];
369 if (f < 0 && !(strap[i] & bitmask))
370 f = i;
371 }
372
373 if (f < 0) {
374 dev_err(otp->dev, "Strap cannot be configured further\n");
375 rc = -EPERM;
376 goto done;
377 }
378
379 if (((res & bitmask) && val) || (!val && !(res & bitmask))) {
380 dev_err(otp->dev, "Strap already in desired configuration\n");
381 rc = -EALREADY;
382 goto done;
383 }
384
385 i = (16 + (f * 2)) + word;
386 address = 0x800;
387 address |= (i / 8) * 0x200;
388 address |= (i % 8) * 2;
389
390 dev_dbg(otp->dev, "Writing strap at OTP %04x with %08x\n", address, bitmask);
391 rc = otp_write(otp, address, bitmask);
392
393 done:
> 394 writel(otp->base + OTP_PROTECT_KEY, 0);
395 return rc;
396 }
397
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 66521 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-30 7:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-30 7:57 [shenki:aspeed-otp 140/140] drivers/soc/aspeed/aspeed-otp.c:213:5: warning: no previous prototype for 'otp_read_conf' kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.