fbdev: claim Cyber2000 SPARC I/O aperture before ioremap
Subsystems (2)
PATCH v3 1/1 fbdev: claim Cyber2000 SPARC I/O aperture before ioremap
Claim the memory resource associated with the Cyber2000 SPARC MMIO aperture before accessing it.
This is part of the effort to request memory regions in fbdev drivers.
---
v3:
- Use pr_err() instead of pci_err()
v2:
- Use pci_err() for error reporting instead of printk().
drivers/video/fbdev/cyber2000fb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/video/fbdev/cyber2000fb.c +8 -1
@@ -47,6 +47,7 @@#include <linux/io.h> #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> +#include <linux/ioport.h> #ifdef __arm__#include <asm/mach-types.h>
@@ -1620,9 +1621,14 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)*/ unsigned char __iomem *iop; +if (!request_mem_region (0x3000000 ,0x5000 ,"cyber2000fb iop" )) { +pr_err ("iga5000: cannot reserve I/O area 0x3000000\n" ); +return -EBUSY ; + } iop =ioremap (0x3000000 ,0x5000 );if (iop ==NULL ) { -printk (KERN_ERR "iga5000: cannot map I/O\n" ); +pr_err ("iga5000: cannot map I/O area\n" ); +release_mem_region (0x3000000 ,0x5000 );return -ENOMEM ; }
@@ -1633,6 +1639,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)writeb (EXT_BIU_MISC_LIN_ENABLE , iop +0x3cf );iounmap (iop); +release_mem_region (0x3000000 ,0x5000 );#else /* * Most other machine types are "normal", so
Signature · 1 line
2.43.0
Helge Deller
maintainerQuoted 4 lines · Chintan Patel
Claim the memory resource associated with the Cyber2000 SPARC MMIO aperture before accessing it.
This is part of the effort to request memory regions in fbdev drivers.
IMHO this patch doesn't make much sense.
The PCI regions (e.g. for x86) are already requested one level higher and are being kept reserved.
This patch here only touches the SPARC code inside a path which is e.g. being used everytime the machine wakes up from sleep (does sparc even suspends?). So, instead here, I think (if you want to make this robust) the region should be reserved e.g. in cyberpro_common_probe(), but I'm not sure if this is even worth the effort....?
Helge
Quoted 47 lines
Signed-off-by Chintan Patel <[email protected]>---
v3:
- Usepr_err()instead ofpci_err()
v2:
- Usepci_err()for error reporting instead ofprintk().drivers/video/fbdev/cyber2000fb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/video/fbdev/cyber2000fb.c +8
-1@@ -47,6 +47,7 @@#include <linux/io.h> #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> +#include <linux/ioport.h> #ifdef __arm__#include <asm/mach-types.h> @@ -1620,9 +1621,14 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)*/ unsigned char __iomem *iop; +if (!request_mem_region (0x3000000 ,0x5000 ,"cyber2000fb iop" )) { +pr_err ("iga5000: cannot reserve I/O area 0x3000000\n" ); +return -EBUSY ; + } iop =ioremap (0x3000000 ,0x5000 );if (iop ==NULL ) { -printk (KERN_ERR "iga5000: cannot map I/O\n" ); +pr_err ("iga5000: cannot map I/O area\n" ); +release_mem_region (0x3000000 ,0x5000 );return -ENOMEM ; }@@ -1633,6 +1639,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)writeb (EXT_BIU_MISC_LIN_ENABLE , iop +0x3cf );iounmap (iop); +release_mem_region (0x3000000 ,0x5000 );#else /* * Most other machine types are "normal", so
Quoted 11 lines · Helge Deller
Quoted 4 lines · Chintan Patel
Claim the memory resource associated with the Cyber2000 SPARC MMIO aperture before accessing it.
This is part of the effort to request memory regions in fbdev drivers.
IMHO this patch doesn't make much sense.
The PCI regions (e.g. for x86) are already requested one level higher and are being kept reserved.
This patch here only touches the SPARC code inside a path which is e.g. being used everytime the machine wakes up from sleep (does sparc even suspends?). So, instead here, I think (if you want to make this robust) the region should be reserved e.g. incyberpro_common_probe(), but I'm not sure if this is even worth the effort....?Helge
Hi Helge,
Thanks for the explanation.
That makes sense. I was following the fbdev TODO item to request memory regions, but I agree that reserving and releasing the region in cyberpro_pci_enable_mmio() isn't the right lifetime if the function can be called multiple times.
I'll take a closer look at whether the reservation belongs in cyberpro_common_probe(). If not, I'll drop this patch.
Thanks,
Chintan