MIPS: Loongson64: Reserve legacy MMIO space according to bridge type
Subsystems (2)
PATCH v2 1/1 MIPS: Loongson64: Reserve legacy MMIO space according to bridge type
Define MMIO_LOWER_RESERVED as a constant is incorrect, because different PCHs (bridge types) have different legacy MMIO space size. According to the datasheets, the legacy MMIO space size of LS7A is 0x20000, and which of other PCHs is 0x4000. So it is necessary to reserve legacy MMIO space according to the bridge type.
Currently IO_SPACE_LIMIT is defined as 0xffff which is too small for the LS7A bridge, so increase it to 0xfffff for LOONGSON64.
--- arch/mips/include/asm/io.h | 2 -- arch/mips/include/asm/mach-generic/spaces.h | 4 ++++ arch/mips/include/asm/mach-loongson64/spaces.h | 3 +-- arch/mips/loongson64/init.c | 18 ++++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-)
arch/mips/include/asm/io.h +0 -2
@@ -51,8 +51,6 @@/* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */ -#define IO_SPACE_LIMIT 0xffff -/* * On MIPS I/O ports are memory mapped, so we access them using normal * load/store instructions. mips_io_port_base is the virtual address to
arch/mips/include/asm/mach-generic/spaces.h +4 -0
@@ -103,4 +103,8 @@#endif #endif +#ifndef IO_SPACE_LIMIT +#define IO_SPACE_LIMIT 0xffff +#endif +#endif /* __ASM_MACH_GENERIC_SPACES_H */
arch/mips/include/asm/mach-loongson64/spaces.h +1 -2
@@ -11,8 +11,7 @@#define PCI_IOSIZE SZ_16M#define MAP_BASE (PCI_IOBASE + PCI_IOSIZE) -/* Reserved at the start of PCI_IOBASE for legacy drivers */ -#define MMIO_LOWER_RESERVED 0x10000 +#define IO_SPACE_LIMIT 0xfffff#include <asm/mach-generic/spaces.h> #endif
arch/mips/loongson64/init.c +14 -4
@@ -65,14 +65,25 @@ void __init prom_free_prom_memory(void)static __init void reserve_pio_range (void ) { +/* Reserved at the start of PCI_IOBASE for legacy drivers */ +int mmio_lower_reserved;struct logic_pio_hwaddr *range; range =kzalloc (sizeof (*range),GFP_ATOMIC );if (!range)return ; +switch (loongson_sysconf.bridgetype) { +case LS7A : + mmio_lower_reserved =0x20000 ; +break ; +default : + mmio_lower_reserved =0x4000 ; +break ; + } + range->fwnode = &of_root->fwnode; - range->size =MMIO_LOWER_RESERVED ; + range->size = mmio_lower_reserved; range->hw_start =LOONGSON_PCIIO_BASE ; range->flags =LOGIC_PIO_CPU_MMIO ;
@@ -89,9 +100,8 @@ static __init void reserve_pio_range(void)* i8259 would access I/O space, so mapping must be done here. * Please remove it when all drivers can be managed by logic_pio. */ -ioremap_page_range (PCI_IOBASE ,PCI_IOBASE +MMIO_LOWER_RESERVED , -LOONGSON_PCIIO_BASE , -pgprot_device (PAGE_KERNEL )); +ioremap_page_range (PCI_IOBASE ,PCI_IOBASE + mmio_lower_reserved, +LOONGSON_PCIIO_BASE ,pgprot_device (PAGE_KERNEL ));return ; unregister:
Signature · 1 line
2.7.0
Thomas Bogendoerfer
maintainerQuoted 9 lines · Huacai Chen
Define
MMIO_LOWER_RESERVEDas a constant is incorrect, because different PCHs (bridge types) have different legacy MMIO space size. According to the datasheets, the legacy MMIO space size of LS7A is0x20000, and which of other PCHs is0x4000. So it is necessary to reserve legacy MMIO space according to the bridge type.Currently
IO_SPACE_LIMITis defined as0xffffwhich is too small for the LS7A bridge, so increase it to0xffffffor LOONGSON64.
Quoted 7 lines
Signed-off-by Huacai Chen <[email protected]>--- arch/mips/include/asm/io.h | 2 -- arch/mips/include/asm/mach-generic/spaces.h | 4 ++++ arch/mips/include/asm/mach-loongson64/spaces.h | 3 +-- arch/mips/loongson64/init.c | 18 ++++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-)
thank you for the changes. With the new patchset from Jiaxun I'm wondering which way you want to go ? Should I apply this patch or should I wait until the new patchset is finalized ?
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Hi, Thomas,
Quoted 19 lines · Thomas Bogendoerfer
Quoted 9 lines · Huacai Chen
Define
MMIO_LOWER_RESERVEDas a constant is incorrect, because different PCHs (bridge types) have different legacy MMIO space size. According to the datasheets, the legacy MMIO space size of LS7A is0x20000, and which of other PCHs is0x4000. So it is necessary to reserve legacy MMIO space according to the bridge type.Currently
IO_SPACE_LIMITis defined as0xffffwhich is too small for the LS7A bridge, so increase it to0xffffffor LOONGSON64.Quoted 7 lines
Signed-off-by Huacai Chen <[email protected]>--- arch/mips/include/asm/io.h | 2 -- arch/mips/include/asm/mach-generic/spaces.h | 4 ++++ arch/mips/include/asm/mach-loongson64/spaces.h | 3 +-- arch/mips/loongson64/init.c | 18 ++++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-)
Quoted 3 lines
thank you for the changes. With the new patchset from Jiaxun I'm wondering which way you want to go ? Should I apply this patch or should I wait until the new patchset is finalized ?
I prefer Jiaxun's patches.
Quoted 6 lines
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]