140-bcma-only-map-wrap-if-it-is-not-null.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From c6516d2c672450fb27783866397a487511d90bba Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <[email protected]>
  3. Date: Fri, 22 Aug 2014 08:44:52 +0200
  4. Subject: [PATCH 08/17] bcma: only map wrapper if its address is available
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The Chipcommon B core does not have a wrap address and it would fail here.
  9. Signed-off-by: Hauke Mehrtens <[email protected]>
  10. Signed-off-by: Rafał Miłecki <[email protected]>
  11. ---
  12. drivers/bcma/host_soc.c | 4 ++++
  13. drivers/bcma/scan.c | 11 +++++++----
  14. 2 files changed, 11 insertions(+), 4 deletions(-)
  15. --- a/drivers/bcma/host_soc.c
  16. +++ b/drivers/bcma/host_soc.c
  17. @@ -137,12 +137,16 @@ static void bcma_host_soc_block_write(st
  18. static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset)
  19. {
  20. + if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n"))
  21. + return ~0;
  22. return readl(core->io_wrap + offset);
  23. }
  24. static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset,
  25. u32 value)
  26. {
  27. + if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n"))
  28. + return;
  29. writel(value, core->io_wrap + offset);
  30. }
  31. --- a/drivers/bcma/scan.c
  32. +++ b/drivers/bcma/scan.c
  33. @@ -421,10 +421,13 @@ static int bcma_get_next_core(struct bcm
  34. core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE);
  35. if (!core->io_addr)
  36. return -ENOMEM;
  37. - core->io_wrap = ioremap_nocache(core->wrap, BCMA_CORE_SIZE);
  38. - if (!core->io_wrap) {
  39. - iounmap(core->io_addr);
  40. - return -ENOMEM;
  41. + if (core->wrap) {
  42. + core->io_wrap = ioremap_nocache(core->wrap,
  43. + BCMA_CORE_SIZE);
  44. + if (!core->io_wrap) {
  45. + iounmap(core->io_addr);
  46. + return -ENOMEM;
  47. + }
  48. }
  49. }
  50. return 0;