Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2022
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
  2. index 0c70eb688a00..f747f34dfd4b 100644
  3. --- a/arch/arm/include/asm/io.h
  4. +++ b/arch/arm/include/asm/io.h
  5. @@ -200,7 +200,7 @@ void __iomem *pci_remap_cfgspace(resource_size_t res_cookie, size_t size);
  6. */
  7. #ifdef CONFIG_NEED_MACH_IO_H
  8. #include <mach/io.h>
  9. -#elif defined(CONFIG_PCI)
  10. +#elif defined(CONFIG_PCI) || IS_ENABLED(CONFIG_PCMCIA_SOC_COMMON)
  11. #define IO_SPACE_LIMIT ((resource_size_t)0xfffff)
  12. #define __io(a) __typesafe_io(PCI_IO_VIRT_BASE + ((a) & IO_SPACE_LIMIT))
  13. #else
  14. @@ -219,9 +219,7 @@ void __iomem *pci_remap_cfgspace(resource_size_t res_cookie, size_t size);
  15. * readb() et.al. on such platforms.
  16. */
  17. #ifndef IO_SPACE_LIMIT
  18. -#if defined(CONFIG_PCMCIA_SOC_COMMON) || defined(CONFIG_PCMCIA_SOC_COMMON_MODULE)
  19. -#define IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
  20. -#elif defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD)
  21. +#if defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD)
  22. #define IO_SPACE_LIMIT ((resource_size_t)0xffff)
  23. #else
  24. #define IO_SPACE_LIMIT ((resource_size_t)0)
  25. diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
  26. index ec977f031bc2..018e852f35d1 100644
  27. --- a/drivers/pcmcia/Kconfig
  28. +++ b/drivers/pcmcia/Kconfig
  29. @@ -174,6 +174,7 @@ config PCMCIA_BCM63XX
  30.  
  31. config PCMCIA_SOC_COMMON
  32. tristate
  33. + select PCI # for pci_remap_iospace
  34.  
  35. config PCMCIA_SA11XX_BASE
  36. tristate
  37. diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
  38. index 9276a628473d..cb80d4848333 100644
  39. --- a/drivers/pcmcia/soc_common.c
  40. +++ b/drivers/pcmcia/soc_common.c
  41. @@ -46,6 +46,7 @@
  42. #include <linux/regulator/consumer.h>
  43. #include <linux/spinlock.h>
  44. #include <linux/timer.h>
  45. +#include <linux/pci.h>
  46.  
  47. #include "soc_common.h"
  48.  
  49. @@ -782,8 +783,7 @@ void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt)
  50. /* should not be required; violates some lowlevel drivers */
  51. soc_common_pcmcia_config_skt(skt, &dead_socket);
  52.  
  53. - iounmap(skt->virt_io);
  54. - skt->virt_io = NULL;
  55. + pci_unmap_iospace(&skt->res_io_io);
  56. release_resource(&skt->res_attr);
  57. release_resource(&skt->res_mem);
  58. release_resource(&skt->res_io);
  59. @@ -816,11 +816,11 @@ int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt)
  60. if (ret)
  61. goto out_err_4;
  62.  
  63. - skt->virt_io = ioremap(skt->res_io.start, 0x10000);
  64. - if (skt->virt_io == NULL) {
  65. - ret = -ENOMEM;
  66. + skt->res_io_io = (struct resource)
  67. + DEFINE_RES_IO_NAMED(skt->nr * 0x10000, 0x10000, "PCMCIA I/O");
  68. + ret = pci_remap_iospace(&skt->res_io_io, skt->res_io.start);
  69. + if (ret)
  70. goto out_err_5;
  71. - }
  72.  
  73. /*
  74. * We initialize default socket timing here, because
  75. @@ -838,7 +838,7 @@ int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt)
  76. skt->socket.resource_ops = &pccard_static_ops;
  77. skt->socket.irq_mask = 0;
  78. skt->socket.map_size = PAGE_SIZE;
  79. - skt->socket.io_offset = (unsigned long)skt->virt_io;
  80. + skt->socket.io_offset = (unsigned long)skt->res_io_io.start;
  81.  
  82. skt->status = soc_common_pcmcia_skt_state(skt);
  83.  
  84. @@ -872,7 +872,7 @@ int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt)
  85. out_err_7:
  86. soc_pcmcia_hw_shutdown(skt);
  87. out_err_6:
  88. - iounmap(skt->virt_io);
  89. + pci_unmap_iospace(&skt->res_io_io);
  90. out_err_5:
  91. release_resource(&skt->res_attr);
  92. out_err_4:
  93. diff --git a/include/pcmcia/soc_common.h b/include/pcmcia/soc_common.h
  94. index 26f1473a06c5..d4f18f4679df 100644
  95. --- a/include/pcmcia/soc_common.h
  96. +++ b/include/pcmcia/soc_common.h
  97. @@ -46,9 +46,9 @@ struct soc_pcmcia_socket {
  98.  
  99. struct resource res_skt;
  100. struct resource res_io;
  101. + struct resource res_io_io;
  102. struct resource res_mem;
  103. struct resource res_attr;
  104. - void __iomem *virt_io;
  105.  
  106. struct {
  107. int gpio;
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement