OpenRISC updates for 5.15

A few cleanups and compiler warning fixes for OpenRISC.  Also, this
 includes dts and defconfig updates to enable Ethernet on OpenRISC/Litex
 FPGA SoC's now that the LiteEth driver has gone upstream.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE2cRzVK74bBA6Je/xw7McLV5mJ+QFAmExPQ0ACgkQw7McLV5m
 J+Qj0Q//bW0kYR8b4TAYm9d1NY0LaUrx6eE0mOIYj5vLMUx4l3vVOiTwsi4UdcCO
 7Pw1x/EyRwZV1pW7jw6w4C+TZS9nniMQeNeJKddFMhdMFotfL2AWvaIaC9VHvKL5
 vusrT3LhF3z73R4QBmDUAE9QghUJlVXyBzGRNKKpuK3kX/1m0X3GLyRWCAjuBhia
 /yqeM8XUFDMUNEdu3Aoc9JckFc62Ri6BYPVk4ePqfTRSW8oTPXgIw2l39aw4sJPM
 fS6BAJvAUIcoXjGK5utzg02Iz5Nf+gT4jYJ/2ZS5MWmbCxy20RK9lFTD/wbHh6F0
 34/xIRjDNWAfbC+w6smnZedheJHe3ca0/ss+JhQ4PRyTQGx4looiYayy5cYUcwqy
 uYTg/+rPJ7JIJBXYS28gFiOBlSGpdGpGUClD4WQc2zuFtmoYN7VNGHnwXuktSuVz
 U3h/g0GmGtiB/8SU/1Hh2F1Ga1U3g4C2ITcP5HUK1RPTzFxGYY/VlzutehUTmWmg
 qnWSE95Ci8PoBVzX44KPvh5HfL3TMtwp3r0zKTysDCfBg0dIH7LHHiadXlDpAMdB
 wdMrReUEetgQZnX8IJZUyWo0AzU/AUOHtjx3P8NW61ObGHCGd9yMQivUVijwtJxV
 a74yxdJh31vEbYbgPpURs88IByXteS/X7M1IqYcocOlpHjQMNIA=
 =md7e
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of git://github.com/openrisc/linux

Pull OpenRISC updates from Stafford Horne:
 "A few cleanups and compiler warning fixes for OpenRISC.

  Also, this includes dts and defconfig updates to enable Ethernet on
  OpenRISC/Litex FPGA SoC's now that the LiteEth driver has gone
  upstream"

* tag 'for-linus' of git://github.com/openrisc/linux:
  openrisc/litex: Update defconfig
  openrisc/litex: Add ethernet device
  openrisc/litex: Update uart address
  openrisc: Fix compiler warnings in setup
  openrisc: rename or32 code & comments to or1k
  openrisc: don't printk() unconditionally
This commit is contained in:
Linus Torvalds 2021-09-03 11:03:00 -07:00
commit 603eefda5f
10 changed files with 58 additions and 40 deletions

View File

@ -41,10 +41,10 @@
interrupt-controller; interrupt-controller;
}; };
serial0: serial@e0002000 { serial0: serial@e0006800 {
device_type = "serial"; device_type = "serial";
compatible = "litex,liteuart"; compatible = "litex,liteuart";
reg = <0xe0002000 0x100>; reg = <0xe0006800 0x100>;
}; };
soc_ctrl0: soc_controller@e0000000 { soc_ctrl0: soc_controller@e0000000 {
@ -52,4 +52,13 @@
reg = <0xe0000000 0xc>; reg = <0xe0000000 0xc>;
status = "okay"; status = "okay";
}; };
ethernet@e0001000 {
compatible = "litex,liteeth";
reg = <0xe0001000 0x7c>,
<0xe0001800 0x0a>,
<0x80000000 0x2000>;
reg-names = "mac", "mdio", "buffer";
interrupts = <2>;
};
}; };

View File

@ -1,18 +1,24 @@
CONFIG_BLK_DEV_INITRD=y CONFIG_BLK_DEV_INITRD=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_BUG_ON_DATA_CORRUPTION=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_EMBEDDED=y
CONFIG_OPENRISC_BUILTIN_DTB="or1klitex"
CONFIG_HZ_100=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y CONFIG_DEVTMPFS_MOUNT=y
CONFIG_EMBEDDED=y
CONFIG_HZ_100=y
CONFIG_INITRAMFS_SOURCE="openrisc-rootfs.cpio.gz"
CONFIG_OF_OVERLAY=y CONFIG_OF_OVERLAY=y
CONFIG_OPENRISC_BUILTIN_DTB="or1klitex" CONFIG_NETDEVICES=y
CONFIG_PANIC_ON_OOPS=y CONFIG_LITEX_LITEETH=y
CONFIG_PRINTK_TIME=y
CONFIG_LITEX_SOC_CONTROLLER=y
CONFIG_SERIAL_LITEUART=y CONFIG_SERIAL_LITEUART=y
CONFIG_SERIAL_LITEUART_CONSOLE=y CONFIG_SERIAL_LITEUART_CONSOLE=y
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_TTY_PRINTK=y CONFIG_TTY_PRINTK=y
CONFIG_LITEX_SOC_CONTROLLER=y
CONFIG_TMPFS=y
CONFIG_PRINTK_TIME=y
CONFIG_PANIC_ON_OOPS=y
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_BUG_ON_DATA_CORRUPTION=y

View File

@ -12,7 +12,7 @@
* et al. * et al.
*/ */
/* or32 pgtable.h - macros and functions to manipulate page tables /* or1k pgtable.h - macros and functions to manipulate page tables
* *
* Based on: * Based on:
* include/asm-cris/pgtable.h * include/asm-cris/pgtable.h
@ -29,14 +29,14 @@
/* /*
* The Linux memory management assumes a three-level page table setup. On * The Linux memory management assumes a three-level page table setup. On
* or32, we use that, but "fold" the mid level into the top-level page * or1k, we use that, but "fold" the mid level into the top-level page
* table. Since the MMU TLB is software loaded through an interrupt, it * table. Since the MMU TLB is software loaded through an interrupt, it
* supports any page table structure, so we could have used a three-level * supports any page table structure, so we could have used a three-level
* setup, but for the amounts of memory we normally use, a two-level is * setup, but for the amounts of memory we normally use, a two-level is
* probably more efficient. * probably more efficient.
* *
* This file contains the functions and defines necessary to modify and use * This file contains the functions and defines necessary to modify and use
* the or32 page table tree. * the or1k page table tree.
*/ */
extern void paging_init(void); extern void paging_init(void);

View File

@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2021 Stafford Horne
*/
#ifndef _ASM_OR1K_SETUP_H
#define _ASM_OR1K_SETUP_H
#include <linux/init.h>
#include <asm-generic/setup.h>
#ifndef __ASSEMBLY__
void __init or1k_early_setup(void *fdt);
#endif
#endif /* _ASM_OR1K_SETUP_H */

View File

@ -25,7 +25,7 @@
/* THREAD_SIZE is the size of the task_struct/kernel_stack combo. /* THREAD_SIZE is the size of the task_struct/kernel_stack combo.
* normally, the stack is found by doing something like p + THREAD_SIZE * normally, the stack is found by doing something like p + THREAD_SIZE
* in or32, a page is 8192 bytes, which seems like a sane size * in or1k, a page is 8192 bytes, which seems like a sane size
*/ */
#define THREAD_SIZE_ORDER 0 #define THREAD_SIZE_ORDER 0

View File

@ -326,7 +326,7 @@ EXCEPTION_ENTRY(_data_page_fault_handler)
1: l.ori r6,r0,0x0 // !write access 1: l.ori r6,r0,0x0 // !write access
2: 2:
/* call fault.c handler in or32/mm/fault.c */ /* call fault.c handler in openrisc/mm/fault.c */
l.jal do_page_fault l.jal do_page_fault
l.nop l.nop
l.j _ret_from_exception l.j _ret_from_exception
@ -348,7 +348,7 @@ EXCEPTION_ENTRY(_insn_page_fault_handler)
/* r4 set be EXCEPTION_HANDLE */ // effective address of fault /* r4 set be EXCEPTION_HANDLE */ // effective address of fault
l.ori r6,r0,0x0 // !write access l.ori r6,r0,0x0 // !write access
/* call fault.c handler in or32/mm/fault.c */ /* call fault.c handler in openrisc/mm/fault.c */
l.jal do_page_fault l.jal do_page_fault
l.nop l.nop
l.j _ret_from_exception l.j _ret_from_exception
@ -547,6 +547,7 @@ EXCEPTION_ENTRY(_external_irq_handler)
l.bnf 1f // ext irq enabled, all ok. l.bnf 1f // ext irq enabled, all ok.
l.nop l.nop
#ifdef CONFIG_PRINTK
l.addi r1,r1,-0x8 l.addi r1,r1,-0x8
l.movhi r3,hi(42f) l.movhi r3,hi(42f)
l.ori r3,r3,lo(42f) l.ori r3,r3,lo(42f)
@ -560,6 +561,7 @@ EXCEPTION_ENTRY(_external_irq_handler)
.string "\n\rESR interrupt bug: in _external_irq_handler (ESR %x)\n\r" .string "\n\rESR interrupt bug: in _external_irq_handler (ESR %x)\n\r"
.align 4 .align 4
.previous .previous
#endif
l.ori r4,r4,SPR_SR_IEE // fix the bug l.ori r4,r4,SPR_SR_IEE // fix the bug
// l.sw PT_SR(r1),r4 // l.sw PT_SR(r1),r4

View File

@ -599,7 +599,7 @@ flush_tlb:
l.jal _flush_tlb l.jal _flush_tlb
l.nop l.nop
/* The MMU needs to be enabled before or32_early_setup is called */ /* The MMU needs to be enabled before or1k_early_setup is called */
enable_mmu: enable_mmu:
/* /*
@ -641,9 +641,9 @@ enable_mmu:
/* magic number mismatch, set fdt pointer to null */ /* magic number mismatch, set fdt pointer to null */
l.or r25,r0,r0 l.or r25,r0,r0
_fdt_found: _fdt_found:
/* pass fdt pointer to or32_early_setup in r3 */ /* pass fdt pointer to or1k_early_setup in r3 */
l.or r3,r0,r25 l.or r3,r0,r25
LOAD_SYMBOL_2_GPR(r24, or32_early_setup) LOAD_SYMBOL_2_GPR(r24, or1k_early_setup)
l.jalr r24 l.jalr r24
l.nop l.nop

View File

@ -209,7 +209,8 @@ void __init setup_cpuinfo(void)
} }
/** /**
* or32_early_setup * or1k_early_setup
* @fdt: pointer to the start of the device tree in memory or NULL
* *
* Handles the pointer to the device tree that this kernel is to use * Handles the pointer to the device tree that this kernel is to use
* for establishing the available platform devices. * for establishing the available platform devices.
@ -217,7 +218,7 @@ void __init setup_cpuinfo(void)
* Falls back on built-in device tree in case null pointer is passed. * Falls back on built-in device tree in case null pointer is passed.
*/ */
void __init or32_early_setup(void *fdt) void __init or1k_early_setup(void *fdt)
{ {
if (fdt) if (fdt)
pr_info("FDT at %p\n", fdt); pr_info("FDT at %p\n", fdt);
@ -243,21 +244,6 @@ static inline unsigned long extract_value(unsigned long reg, unsigned long mask)
return mask & reg; return mask & reg;
} }
void __init detect_unit_config(unsigned long upr, unsigned long mask,
char *text, void (*func) (void))
{
if (text != NULL)
printk("%s", text);
if (upr & mask) {
if (func != NULL)
func();
else
printk("present\n");
} else
printk("not present\n");
}
/* /*
* calibrate_delay * calibrate_delay
* *

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# #
# Makefile for or32 specific library files.. # Makefile for or1k specific library files..
# #
obj-y := delay.o string.o memset.o memcpy.o obj-y := delay.o string.o memset.o memcpy.o

View File

@ -28,7 +28,7 @@ unsigned long pte_misses; /* updated by do_page_fault() */
unsigned long pte_errors; /* updated by do_page_fault() */ unsigned long pte_errors; /* updated by do_page_fault() */
/* __PHX__ :: - check the vmalloc_fault in do_page_fault() /* __PHX__ :: - check the vmalloc_fault in do_page_fault()
* - also look into include/asm-or32/mmu_context.h * - also look into include/asm/mmu_context.h
*/ */
volatile pgd_t *current_pgd[NR_CPUS]; volatile pgd_t *current_pgd[NR_CPUS];