Skip to content

Commit

Permalink
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/gerg/m68knommu

Pull m68knommu updates from Greg Ungerer:
 "The bulk of the changes here are to clean up the ColdFire 5441x SoC
  support so that it can run with MMU enabled. We have only supported it
  with MMU disabled up to now.

  There is also a few individual bug fixes across the ColdFire support
  code"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68k: let clk_disable() return immediately if clk is NULL
  m68knommu: convert printk(KERN_INFO) to pr_info()
  m68knommu: clean up uClinux boot log output
  m68k: generalize uboot command line support
  m68k: don't panic if no hardware FPU defined
  m68k: only generate FPU instructions if CONFIG_FPU enabled
  m68k: always make available dump_fpu()
  m68k: generalize io memory region setup for ColdFire ACR registers
  m68k: move ColdFire _bootmem_alloc code
  m68k: report correct FPU type on ColdFire MMU platforms
  m68k: set appropriate machine type for m5411x SoC platforms
  m68k: move CONFIG_FPU set to per-CPU configuration
  m68knommu: fix IO write size in nettel pin set
  m68knommu: switch to using IO access methods in WildFire board code
  m68knommu: fix early setup to not access variables
  • Loading branch information
Linus Torvalds committed Oct 6, 2016
2 parents d8ea757 + 742859a commit a6930aa
Show file tree
Hide file tree
Showing 20 changed files with 222 additions and 177 deletions.
1 change: 0 additions & 1 deletion arch/m68k/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ config M68K
select GENERIC_IOMAP
select GENERIC_STRNCPY_FROM_USER if MMU
select GENERIC_STRNLEN_USER if MMU
select FPU if MMU
select ARCH_WANT_IPC_PARSE_VERSION
select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
Expand Down
6 changes: 6 additions & 0 deletions arch/m68k/Kconfig.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ config MCPU32
config M68020
bool "68020 support"
depends on MMU
select FPU
select CPU_HAS_ADDRESS_SPACES
help
If you anticipate running this kernel on a computer with a MC68020
Expand All @@ -72,6 +73,7 @@ config M68020
config M68030
bool "68030 support"
depends on MMU && !MMU_SUN3
select FPU
select CPU_HAS_ADDRESS_SPACES
help
If you anticipate running this kernel on a computer with a MC68030
Expand All @@ -81,6 +83,7 @@ config M68030
config M68040
bool "68040 support"
depends on MMU && !MMU_SUN3
select FPU
select CPU_HAS_ADDRESS_SPACES
help
If you anticipate running this kernel on a computer with a MC68LC040
Expand All @@ -91,6 +94,7 @@ config M68040
config M68060
bool "68060 support"
depends on MMU && !MMU_SUN3
select FPU
select CPU_HAS_ADDRESS_SPACES
help
If you anticipate running this kernel on a computer with a MC68060
Expand Down Expand Up @@ -259,6 +263,7 @@ config M547x
bool "MCF547x"
select M54xx
select MMU_COLDFIRE if MMU
select FPU if MMU
select HAVE_CACHE_CB
select HAVE_MBAR
select CPU_NO_EFFICIENT_FFS
Expand All @@ -268,6 +273,7 @@ config M547x
config M548x
bool "MCF548x"
select MMU_COLDFIRE if MMU
select FPU if MMU
select M54xx
select HAVE_CACHE_CB
select HAVE_MBAR
Expand Down
4 changes: 4 additions & 0 deletions arch/m68k/coldfire/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ EXPORT_SYMBOL(clk_enable);
void clk_disable(struct clk *clk)
{
unsigned long flags;

if (!clk)
return;

spin_lock_irqsave(&clk_lock, flags);
if ((--clk->enabled == 0) && clk->clk_ops)
clk->clk_ops->disable(clk);
Expand Down
8 changes: 4 additions & 4 deletions arch/m68k/coldfire/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ _clear_bss:
movel %d0,m68k_cputype /* Mark us as a ColdFire */
movel #MMU_COLDFIRE,%d0
movel %d0,m68k_mmutype
movel #FPU_COLDFIRE,%d0
movel %d0,m68k_fputype
movel #MACH_M54XX,%d0
movel %d0,m68k_machtype /* Mark us as a 54xx machine */
movel #FPUTYPE,%d0
movel %d0,m68k_fputype /* Mark FPU type */
movel #MACHINE,%d0
movel %d0,m68k_machtype /* Mark machine type */
lea init_task,%a2 /* Set "current" init task */
#endif

Expand Down
8 changes: 4 additions & 4 deletions arch/m68k/coldfire/m528x.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ void wildfiremod_halt(void)
printk(KERN_INFO "WildFireMod hibernating...\n");

/* Set portE.5 to Digital IO */
MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2));
writew(readw(MCFGPIO_PEPAR) & ~(1 << (5 * 2)), MCFGPIO_PEPAR);

/* Make portE.5 an output */
MCF5282_GPIO_DDRE |= (1 << 5);
writeb(readb(MCFGPIO_PDDR_E) | (1 << 5), MCFGPIO_PDDR_E);

/* Now toggle portE.5 from low to high */
MCF5282_GPIO_PORTE &= ~(1 << 5);
MCF5282_GPIO_PORTE |= (1 << 5);
writeb(readb(MCFGPIO_PODR_E) & ~(1 << 5), MCFGPIO_PODR_E);
writeb(readb(MCFGPIO_PODR_E) | (1 << 5), MCFGPIO_PODR_E);

printk(KERN_EMERG "Failed to hibernate. Halting!\n");
}
Expand Down
8 changes: 2 additions & 6 deletions arch/m68k/coldfire/m53xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,6 @@ void __init config_BSP(char *commandp, int size)

#define NAND_FLASH_ADDRESS (0xD0000000)

int sys_clk_khz = 0;
int sys_clk_mhz = 0;

void wtm_init(void);
void scm_init(void);
void gpio_init(void);
Expand All @@ -286,9 +283,8 @@ int get_sys_clock (void);

asmlinkage void __init sysinit(void)
{
sys_clk_khz = clock_pll(0, 0);
sys_clk_mhz = sys_clk_khz/1000;

clock_pll(0, 0);

wtm_init();
scm_init();
gpio_init();
Expand Down
40 changes: 1 addition & 39 deletions arch/m68k/coldfire/m54xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <asm/m54xxgpt.h>
#ifdef CONFIG_MMU
#include <asm/mmu_context.h>
#include <linux/pfn.h>
#endif

/***************************************************************************/
Expand Down Expand Up @@ -78,47 +77,10 @@ static void mcf54xx_reset(void)

/***************************************************************************/

#ifdef CONFIG_MMU

unsigned long num_pages;

static void __init mcf54xx_bootmem_alloc(void)
{
unsigned long start_pfn;
unsigned long memstart;

/* _rambase and _ramend will be naturally page aligned */
m68k_memory[0].addr = _rambase;
m68k_memory[0].size = _ramend - _rambase;

/* compute total pages in system */
num_pages = PFN_DOWN(_ramend - _rambase);

/* page numbers */
memstart = PAGE_ALIGN(_ramstart);
min_low_pfn = PFN_DOWN(_rambase);
start_pfn = PFN_DOWN(memstart);
max_pfn = max_low_pfn = PFN_DOWN(_ramend);
high_memory = (void *)_ramend;

m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;
module_fixup(NULL, __start_fixup, __stop_fixup);

/* setup bootmem data */
m68k_setup_node(0);
memstart += init_bootmem_node(NODE_DATA(0), start_pfn,
min_low_pfn, max_low_pfn);
free_bootmem_node(NODE_DATA(0), memstart, _ramend - memstart);
}

#endif /* CONFIG_MMU */

/***************************************************************************/

void __init config_BSP(char *commandp, int size)
{
#ifdef CONFIG_MMU
mcf54xx_bootmem_alloc();
cf_bootmem_alloc();
mmu_context_init();
#endif
mach_reset = mcf54xx_reset;
Expand Down
6 changes: 6 additions & 0 deletions arch/m68k/include/asm/bootinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ extern void save_bootinfo(const struct bi_record *bi);
static inline void save_bootinfo(const struct bi_record *bi) {}
#endif

#ifdef CONFIG_UBOOT
void process_uboot_commandline(char *commandp, int size);
#else
static inline void process_uboot_commandline(char *commandp, int size) {}
#endif

#endif /* __ASSEMBLY__ */


Expand Down
4 changes: 4 additions & 0 deletions arch/m68k/include/asm/m5441xsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#define CPU_NAME "COLDFIRE(m5441x)"
#define CPU_INSTR_PER_JIFFY 2
#define MCF_BUSCLK (MCF_CLK / 2)
#define MACHINE MACH_M5441X
#define FPUTYPE 0
#define IOMEMBASE 0xe0000000
#define IOMEMSIZE 0x20000000

#include <asm/m54xxacr.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/include/asm/m54xxacr.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
* register region as non-cacheable. And then we map all our RAM as
* cacheable and supervisor access only.
*/
#define ACR0_MODE (ACR_BA(CONFIG_MBAR)+ACR_ADMSK(0x1000000)+ \
#define ACR0_MODE (ACR_BA(IOMEMBASE)+ACR_ADMSK(IOMEMSIZE)+ \
ACR_ENABLE+ACR_SUPER+ACR_CM_OFF_PRE+ACR_SP)
#if defined(CONFIG_CACHE_COPYBACK)
#define ACR1_MODE (ACR_BA(CONFIG_RAMBASE)+ACR_ADMSK(CONFIG_RAMSIZE)+ \
Expand Down
4 changes: 4 additions & 0 deletions arch/m68k/include/asm/m54xxsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#define CPU_NAME "COLDFIRE(m54xx)"
#define CPU_INSTR_PER_JIFFY 2
#define MCF_BUSCLK (MCF_CLK / 2)
#define MACHINE MACH_M54XX
#define FPUTYPE FPU_COLDFIRE
#define IOMEMBASE MCF_MBAR
#define IOMEMSIZE 0x01000000

#include <asm/m54xxacr.h>

Expand Down
1 change: 1 addition & 0 deletions arch/m68k/include/asm/mcfmmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ static inline void mmu_write(u32 a, u32 v)
__asm__ __volatile__ ("nop");
}

void cf_bootmem_alloc(void);
int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word);

#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/include/asm/nettel.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static __inline__ unsigned int mcf_getppdata(void)

static __inline__ void mcf_setppdata(unsigned int mask, unsigned int bits)
{
write((readw(MCFSIM_PBDAT) & ~mask) | bits, MCFSIM_PBDAT);
writew((readw(MCFSIM_PBDAT) & ~mask) | bits, MCFSIM_PBDAT);
}
#endif

Expand Down
1 change: 1 addition & 0 deletions arch/m68k/include/uapi/asm/bootinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ struct mem_info {
#define MACH_Q40 10
#define MACH_SUN3X 11
#define MACH_M54XX 12
#define MACH_M5441X 13


/*
Expand Down
1 change: 1 addition & 0 deletions arch/m68k/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ obj-$(CONFIG_HAS_DMA) += dma.o

obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
obj-$(CONFIG_BOOTINFO_PROC) += bootinfo_proc.o
obj-$(CONFIG_UBOOT) += uboot.o

obj-$(CONFIG_EARLY_PRINTK) += early_printk.o

56 changes: 28 additions & 28 deletions arch/m68k/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
}

/* Fill in the fpu structure for a core dump. */
#ifdef CONFIG_FPU
int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
{
char fpustate[216];

if (FPU_IS_EMU) {
int i;

Expand All @@ -222,37 +219,40 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
return 1;
}

/* First dump the fpu context to avoid protocol violation. */
asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
return 0;
if (IS_ENABLED(CONFIG_FPU)) {
char fpustate[216];

if (CPU_IS_COLDFIRE) {
asm volatile ("fmovel %/fpiar,%0\n\t"
"fmovel %/fpcr,%1\n\t"
"fmovel %/fpsr,%2\n\t"
"fmovemd %/fp0-%/fp7,%3"
:
: "m" (fpu->fpcntl[0]),
"m" (fpu->fpcntl[1]),
"m" (fpu->fpcntl[2]),
"m" (fpu->fpregs[0])
: "memory");
} else {
asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
:
: "m" (fpu->fpcntl[0])
: "memory");
asm volatile ("fmovemx %/fp0-%/fp7,%0"
:
: "m" (fpu->fpregs[0])
: "memory");
/* First dump the fpu context to avoid protocol violation. */
asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
return 0;

if (CPU_IS_COLDFIRE) {
asm volatile ("fmovel %/fpiar,%0\n\t"
"fmovel %/fpcr,%1\n\t"
"fmovel %/fpsr,%2\n\t"
"fmovemd %/fp0-%/fp7,%3"
:
: "m" (fpu->fpcntl[0]),
"m" (fpu->fpcntl[1]),
"m" (fpu->fpcntl[2]),
"m" (fpu->fpregs[0])
: "memory");
} else {
asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
:
: "m" (fpu->fpcntl[0])
: "memory");
asm volatile ("fmovemx %/fp0-%/fp7,%0"
:
: "m" (fpu->fpregs[0])
: "memory");
}
}

return 1;
}
EXPORT_SYMBOL(dump_fpu);
#endif /* CONFIG_FPU */

unsigned long get_wchan(struct task_struct *p)
{
Expand Down
6 changes: 4 additions & 2 deletions arch/m68k/kernel/setup_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)
* We should really do our own FPU check at startup.
* [what do we do with buggy 68LC040s? if we have problems
* with them, we should add a test to check_bugs() below] */
#ifndef CONFIG_M68KFPU_EMU_ONLY
#if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU_ONLY)
/* clear the fpu if we have one */
if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060|FPU_COLDFIRE)) {
volatile int zero = 0;
Expand Down Expand Up @@ -274,6 +274,7 @@ void __init setup_arch(char **cmdline_p)
strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE);
m68k_command_line[CL_SIZE - 1] = 0;
#endif /* CONFIG_BOOTPARAM */
process_uboot_commandline(&m68k_command_line[0], CL_SIZE);
*cmdline_p = m68k_command_line;
memcpy(boot_command_line, *cmdline_p, CL_SIZE);

Expand Down Expand Up @@ -341,6 +342,7 @@ void __init setup_arch(char **cmdline_p)
#endif
#ifdef CONFIG_COLDFIRE
case MACH_M54XX:
case MACH_M5441X:
config_BSP(NULL, 0);
break;
#endif
Expand Down Expand Up @@ -548,7 +550,7 @@ module_init(proc_hardware_init);

void check_bugs(void)
{
#ifndef CONFIG_M68KFPU_EMU
#if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU)
if (m68k_fputype == 0) {
pr_emerg("*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
"WHICH IS REQUIRED BY LINUX/M68K ***\n");
Expand Down
Loading

0 comments on commit a6930aa

Please sign in to comment.