Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d35b93a authored by Matt Fleming's avatar Matt Fleming
Browse files

sh: Add fixed ioremap support



Some devices need to be ioremap'd and accessed very early in the boot
process. It is not possible to use the standard ioremap() function in
this case because that requires kmalloc()'ing some virtual address space
and kmalloc() may not be available so early in boot.

This patch provides fixmap mappings that allow physical address ranges
to be remapped into the kernel address space during the early boot
stages.

Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
parent 07cad4dc
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -60,6 +60,14 @@ enum fixed_addresses {
	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
#endif
	/*
	 * FIX_IOREMAP entries are useful for mapping physical address
	 * space before ioremap() is useable, e.g. really early in boot
	 * before kmalloc() is working.
	 */
#define FIX_N_IOREMAPS	32
	FIX_IOREMAP_BEGIN,
	FIX_IOREMAP_END = FIX_IOREMAP_BEGIN + FIX_N_IOREMAPS,
	__end_of_fixed_addresses
};

+6 −0
Original line number Diff line number Diff line
@@ -237,6 +237,12 @@ void __iomem *__ioremap_caller(unsigned long offset, unsigned long size,
			       unsigned long flags, void *caller);
void __iounmap(void __iomem *addr);

#ifdef CONFIG_IOREMAP_FIXED
extern void __iomem *ioremap_fixed(resource_size_t, unsigned long, pgprot_t);
extern void iounmap_fixed(void __iomem *);
extern void ioremap_fixed_init(void);
#endif

static inline void __iomem *
__ioremap(unsigned long offset, unsigned long size, unsigned long flags)
{
+4 −3
Original line number Diff line number Diff line
@@ -449,14 +449,15 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_DUMMY_CONSOLE
	conswitchp = &dummy_con;
#endif
	paging_init();
	pmb_init();

	ioremap_fixed_init();

	/* Perform the machine specific initialisation */
	if (likely(sh_mv.mv_setup))
		sh_mv.mv_setup(cmdline_p);

	paging_init();
	pmb_init();

#ifdef CONFIG_SMP
	plat_smp_setup();
#endif
+4 −0
Original line number Diff line number Diff line
@@ -169,6 +169,10 @@ config ARCH_MEMORY_PROBE
	def_bool y
	depends on MEMORY_HOTPLUG

config IOREMAP_FIXED
       def_bool y
       depends on X2TLB || SUPERH64

choice
	prompt "Kernel page size"
	default PAGE_SIZE_4KB
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ endif
obj-$(CONFIG_HUGETLB_PAGE)	+= hugetlbpage.o
obj-$(CONFIG_PMB)		+= pmb.o
obj-$(CONFIG_NUMA)		+= numa.o
obj-$(CONFIG_IOREMAP_FIXED)	+= ioremap_fixed.o

# Special flags for fault_64.o.  This puts restrictions on the number of
# caller-save registers that the compiler can target when building this file.
Loading