Commit f84d595a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'arc-4.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc

Pull ARC fixes from Vineet Gupta:

 - platform updates for setting up clock correctly

 - fixes to accomodate newer gcc (__builtin_trap, removed inline asm
   modifier)

 - other fixes

* tag 'arc-4.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
  ARC: handle gcc generated __builtin_trap for older compiler
  ARC: handle gcc generated __builtin_trap()
  ARC: uaccess: dont use "l" gcc inline asm constraint modifier
  ARC: [plat-axs103] refactor the quad core DT quirk code
  ARC: [plat-axs103]: Set initial core pll output frequency
  ARC: [plat-hsdk]: Get rid of core pll frequency set in platform code
  ARC: [plat-hsdk]: Set initial core pll output frequency
  ARC: [plat-hsdk] Switch DisplayLink driver from fbdev to DRM
  arc: do not use __print_symbol()
  ARC: Fix detection of dual-issue enabled
parents 89876f27 af1be2e2
...@@ -35,6 +35,14 @@ core_clk: core-clk@80 { ...@@ -35,6 +35,14 @@ core_clk: core-clk@80 {
reg = <0x80 0x10>, <0x100 0x10>; reg = <0x80 0x10>, <0x100 0x10>;
#clock-cells = <0>; #clock-cells = <0>;
clocks = <&input_clk>; clocks = <&input_clk>;
/*
* Set initial core pll output frequency to 90MHz.
* It will be applied at the core pll driver probing
* on early boot.
*/
assigned-clocks = <&core_clk>;
assigned-clock-rates = <90000000>;
}; };
core_intc: archs-intc@cpu { core_intc: archs-intc@cpu {
......
...@@ -35,6 +35,14 @@ core_clk: core-clk@80 { ...@@ -35,6 +35,14 @@ core_clk: core-clk@80 {
reg = <0x80 0x10>, <0x100 0x10>; reg = <0x80 0x10>, <0x100 0x10>;
#clock-cells = <0>; #clock-cells = <0>;
clocks = <&input_clk>; clocks = <&input_clk>;
/*
* Set initial core pll output frequency to 100MHz.
* It will be applied at the core pll driver probing
* on early boot.
*/
assigned-clocks = <&core_clk>;
assigned-clock-rates = <100000000>;
}; };
core_intc: archs-intc@cpu { core_intc: archs-intc@cpu {
......
...@@ -114,6 +114,14 @@ core_clk: core-clk@0 { ...@@ -114,6 +114,14 @@ core_clk: core-clk@0 {
reg = <0x00 0x10>, <0x14B8 0x4>; reg = <0x00 0x10>, <0x14B8 0x4>;
#clock-cells = <0>; #clock-cells = <0>;
clocks = <&input_clk>; clocks = <&input_clk>;
/*
* Set initial core pll output frequency to 1GHz.
* It will be applied at the core pll driver probing
* on early boot.
*/
assigned-clocks = <&core_clk>;
assigned-clock-rates = <1000000000>;
}; };
serial: serial@5000 { serial: serial@5000 {
......
...@@ -49,10 +49,11 @@ CONFIG_SERIAL_8250_DW=y ...@@ -49,10 +49,11 @@ CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_HW_RANDOM is not set # CONFIG_HW_RANDOM is not set
# CONFIG_HWMON is not set # CONFIG_HWMON is not set
CONFIG_DRM=y
# CONFIG_DRM_FBDEV_EMULATION is not set
CONFIG_DRM_UDL=y
CONFIG_FB=y CONFIG_FB=y
CONFIG_FB_UDL=y
CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_HCD=y
......
...@@ -668,6 +668,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) ...@@ -668,6 +668,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count)
return 0; return 0;
__asm__ __volatile__( __asm__ __volatile__(
" mov lp_count, %5 \n"
" lp 3f \n" " lp 3f \n"
"1: ldb.ab %3, [%2, 1] \n" "1: ldb.ab %3, [%2, 1] \n"
" breq.d %3, 0, 3f \n" " breq.d %3, 0, 3f \n"
...@@ -684,8 +685,8 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) ...@@ -684,8 +685,8 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count)
" .word 1b, 4b \n" " .word 1b, 4b \n"
" .previous \n" " .previous \n"
: "+r"(res), "+r"(dst), "+r"(src), "=r"(val) : "+r"(res), "+r"(dst), "+r"(src), "=r"(val)
: "g"(-EFAULT), "l"(count) : "g"(-EFAULT), "r"(count)
: "memory"); : "lp_count", "lp_start", "lp_end", "memory");
return res; return res;
} }
......
...@@ -199,7 +199,7 @@ static void read_arc_build_cfg_regs(void) ...@@ -199,7 +199,7 @@ static void read_arc_build_cfg_regs(void)
unsigned int exec_ctrl; unsigned int exec_ctrl;
READ_BCR(AUX_EXEC_CTRL, exec_ctrl); READ_BCR(AUX_EXEC_CTRL, exec_ctrl);
cpu->extn.dual_enb = exec_ctrl & 1; cpu->extn.dual_enb = !(exec_ctrl & 1);
/* dual issue always present for this core */ /* dual issue always present for this core */
cpu->extn.dual = 1; cpu->extn.dual = 1;
......
...@@ -163,7 +163,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, ...@@ -163,7 +163,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
*/ */
static int __print_sym(unsigned int address, void *unused) static int __print_sym(unsigned int address, void *unused)
{ {
__print_symbol(" %s\n", address); printk(" %pS\n", (void *)address);
return 0; return 0;
} }
......
...@@ -83,6 +83,7 @@ DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC) ...@@ -83,6 +83,7 @@ DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC)
DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", __weak do_memory_error, BUS_ADRERR) DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", __weak do_memory_error, BUS_ADRERR)
DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT)
DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN) DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN)
DO_ERROR_INFO(SIGSEGV, "gcc generated __builtin_trap", do_trap5_error, 0)
/* /*
* Entry Point for Misaligned Data access Exception, for emulating in software * Entry Point for Misaligned Data access Exception, for emulating in software
...@@ -115,6 +116,8 @@ void do_machine_check_fault(unsigned long address, struct pt_regs *regs) ...@@ -115,6 +116,8 @@ void do_machine_check_fault(unsigned long address, struct pt_regs *regs)
* Thus TRAP_S <n> can be used for specific purpose * Thus TRAP_S <n> can be used for specific purpose
* -1 used for software breakpointing (gdb) * -1 used for software breakpointing (gdb)
* -2 used by kprobes * -2 used by kprobes
* -5 __builtin_trap() generated by gcc (2018.03 onwards) for toggle such as
* -fno-isolate-erroneous-paths-dereference
*/ */
void do_non_swi_trap(unsigned long address, struct pt_regs *regs) void do_non_swi_trap(unsigned long address, struct pt_regs *regs)
{ {
...@@ -134,6 +137,9 @@ void do_non_swi_trap(unsigned long address, struct pt_regs *regs) ...@@ -134,6 +137,9 @@ void do_non_swi_trap(unsigned long address, struct pt_regs *regs)
kgdb_trap(regs); kgdb_trap(regs);
break; break;
case 5:
do_trap5_error(address, regs);
break;
default: default:
break; break;
} }
...@@ -155,3 +161,11 @@ void do_insterror_or_kprobe(unsigned long address, struct pt_regs *regs) ...@@ -155,3 +161,11 @@ void do_insterror_or_kprobe(unsigned long address, struct pt_regs *regs)
insterror_is_error(address, regs); insterror_is_error(address, regs);
} }
/*
* abort() call generated by older gcc for __builtin_trap()
*/
void abort(void)
{
__asm__ __volatile__("trap_s 5\n");
}
...@@ -163,6 +163,9 @@ static void show_ecr_verbose(struct pt_regs *regs) ...@@ -163,6 +163,9 @@ static void show_ecr_verbose(struct pt_regs *regs)
else else
pr_cont("Bus Error, check PRM\n"); pr_cont("Bus Error, check PRM\n");
#endif #endif
} else if (vec == ECR_V_TRAP) {
if (regs->ecr_param == 5)
pr_cont("gcc generated __builtin_trap\n");
} else { } else {
pr_cont("Check Programmer's Manual\n"); pr_cont("Check Programmer's Manual\n");
} }
......
...@@ -317,25 +317,23 @@ static void __init axs103_early_init(void) ...@@ -317,25 +317,23 @@ static void __init axs103_early_init(void)
* Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack * Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack
* of fudging the freq in DT * of fudging the freq in DT
*/ */
#define AXS103_QUAD_CORE_CPU_FREQ_HZ 50000000
unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F;
if (num_cores > 2) { if (num_cores > 2) {
u32 freq = 50, orig; u32 freq;
/*
* TODO: use cpu node "cpu-freq" param instead of platform-specific
* "/cpu_card/core_clk" as it works only if we use fixed-clock for cpu.
*/
int off = fdt_path_offset(initial_boot_params, "/cpu_card/core_clk"); int off = fdt_path_offset(initial_boot_params, "/cpu_card/core_clk");
const struct fdt_property *prop; const struct fdt_property *prop;
prop = fdt_get_property(initial_boot_params, off, prop = fdt_get_property(initial_boot_params, off,
"clock-frequency", NULL); "assigned-clock-rates", NULL);
orig = be32_to_cpu(*(u32*)(prop->data)) / 1000000; freq = be32_to_cpu(*(u32 *)(prop->data));
/* Patching .dtb in-place with new core clock value */ /* Patching .dtb in-place with new core clock value */
if (freq != orig ) { if (freq != AXS103_QUAD_CORE_CPU_FREQ_HZ) {
freq = cpu_to_be32(freq * 1000000); freq = cpu_to_be32(AXS103_QUAD_CORE_CPU_FREQ_HZ);
fdt_setprop_inplace(initial_boot_params, off, fdt_setprop_inplace(initial_boot_params, off,
"clock-frequency", &freq, sizeof(freq)); "assigned-clock-rates", &freq, sizeof(freq));
} }
} }
#endif #endif
......
...@@ -38,42 +38,6 @@ static void __init hsdk_init_per_cpu(unsigned int cpu) ...@@ -38,42 +38,6 @@ static void __init hsdk_init_per_cpu(unsigned int cpu)
#define CREG_PAE (CREG_BASE + 0x180) #define CREG_PAE (CREG_BASE + 0x180)
#define CREG_PAE_UPDATE (CREG_BASE + 0x194) #define CREG_PAE_UPDATE (CREG_BASE + 0x194)
#define CREG_CORE_IF_CLK_DIV (CREG_BASE + 0x4B8)
#define CREG_CORE_IF_CLK_DIV_2 0x1
#define CGU_BASE ARC_PERIPHERAL_BASE
#define CGU_PLL_STATUS (ARC_PERIPHERAL_BASE + 0x4)
#define CGU_PLL_CTRL (ARC_PERIPHERAL_BASE + 0x0)
#define CGU_PLL_STATUS_LOCK BIT(0)
#define CGU_PLL_STATUS_ERR BIT(1)
#define CGU_PLL_CTRL_1GHZ 0x3A10
#define HSDK_PLL_LOCK_TIMEOUT 500
#define HSDK_PLL_LOCKED() \
!!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_LOCK)
#define HSDK_PLL_ERR() \
!!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_ERR)
static void __init hsdk_set_cpu_freq_1ghz(void)
{
u32 timeout = HSDK_PLL_LOCK_TIMEOUT;
/*
* As we set cpu clock which exceeds 500MHz, the divider for the interface
* clock must be programmed to div-by-2.
*/
iowrite32(CREG_CORE_IF_CLK_DIV_2, (void __iomem *) CREG_CORE_IF_CLK_DIV);
/* Set cpu clock to 1GHz */
iowrite32(CGU_PLL_CTRL_1GHZ, (void __iomem *) CGU_PLL_CTRL);
while (!HSDK_PLL_LOCKED() && timeout--)
cpu_relax();
if (!HSDK_PLL_LOCKED() || HSDK_PLL_ERR())
pr_err("Failed to setup CPU frequency to 1GHz!");
}
#define SDIO_BASE (ARC_PERIPHERAL_BASE + 0xA000) #define SDIO_BASE (ARC_PERIPHERAL_BASE + 0xA000)
#define SDIO_UHS_REG_EXT (SDIO_BASE + 0x108) #define SDIO_UHS_REG_EXT (SDIO_BASE + 0x108)
#define SDIO_UHS_REG_EXT_DIV_2 (2 << 30) #define SDIO_UHS_REG_EXT_DIV_2 (2 << 30)
...@@ -98,12 +62,6 @@ static void __init hsdk_init_early(void) ...@@ -98,12 +62,6 @@ static void __init hsdk_init_early(void)
* minimum possible div-by-2. * minimum possible div-by-2.
*/ */
iowrite32(SDIO_UHS_REG_EXT_DIV_2, (void __iomem *) SDIO_UHS_REG_EXT); iowrite32(SDIO_UHS_REG_EXT_DIV_2, (void __iomem *) SDIO_UHS_REG_EXT);
/*
* Setup CPU frequency to 1GHz.
* TODO: remove it after smart hsdk pll driver will be introduced.
*/
hsdk_set_cpu_freq_1ghz();
} }
static const char *hsdk_compat[] __initconst = { static const char *hsdk_compat[] __initconst = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment