Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: xilfpga: Add mipsfpga platform code

The xilfpga platform will be DT only.

Add required platform code.
DT files have already been added separately.

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Cc: robh+dt@kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/11364/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Zubair Lutfullah Kakakhel and committed by
Ralf Baechle
9937f5ff 552b8b36

+184
+1
arch/mips/Kbuild.platforms
··· 33 33 platforms += sni 34 34 platforms += txx9 35 35 platforms += vr41xx 36 + platforms += xilfpga 36 37 37 38 # include the platform specific files 38 39 include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms))
+23
arch/mips/Kconfig
··· 404 404 help 405 405 This enables support for the IMG Pistachio SoC platform. 406 406 407 + config MACH_XILFPGA 408 + bool "MIPSfpga Xilinx based boards" 409 + select ARCH_REQUIRE_GPIOLIB 410 + select BOOT_ELF32 411 + select BOOT_RAW 412 + select BUILTIN_DTB 413 + select CEVT_R4K 414 + select COMMON_CLK 415 + select CSRC_R4K 416 + select IRQ_MIPS_CPU 417 + select LIBFDT 418 + select MIPS_CPU_SCACHE 419 + select SYS_HAS_EARLY_PRINTK 420 + select SYS_HAS_CPU_MIPS32_R2 421 + select SYS_SUPPORTS_32BIT_KERNEL 422 + select SYS_SUPPORTS_LITTLE_ENDIAN 423 + select SYS_SUPPORTS_ZBOOT_UART16550 424 + select USE_OF 425 + select USE_GENERIC_EARLY_PRINTK_8250 426 + help 427 + This enables support for the IMG University Program MIPSfpga platform. 428 + 407 429 config MIPS_MALTA 408 430 bool "MIPS Malta board" 409 431 select ARCH_MAY_HAVE_PC_FDC ··· 992 970 source "arch/mips/loongson64/Kconfig" 993 971 source "arch/mips/netlogic/Kconfig" 994 972 source "arch/mips/paravirt/Kconfig" 973 + source "arch/mips/xilfpga/Kconfig" 995 974 996 975 endmenu 997 976
+18
arch/mips/include/asm/mach-xilfpga/irq.h
··· 1 + /* 2 + * Copyright (C) 2015 Imagination Technologies 3 + * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms of the GNU General Public License as published by the 7 + * Free Software Foundation; either version 2 of the License, or (at your 8 + * option) any later version. 9 + */ 10 + 11 + #ifndef __MIPS_ASM_MACH_XILFPGA_IRQ_H__ 12 + #define __MIPS_ASM_MACH_XILFPGA_IRQ_H__ 13 + 14 + #define NR_IRQS 32 15 + 16 + #include_next <irq.h> 17 + 18 + #endif /* __MIPS_ASM_MACH_XILFPGA_IRQ_H__ */
+9
arch/mips/xilfpga/Kconfig
··· 1 + choice 2 + prompt "Machine type" 3 + depends on MACH_XILFPGA 4 + default XILFPGA_NEXYS4DDR 5 + 6 + config XILFPGA_NEXYS4DDR 7 + bool "Nexys4DDR by Digilent" 8 + 9 + endchoice
+7
arch/mips/xilfpga/Makefile
··· 1 + # 2 + # Makefile for the Xilfpga 3 + # 4 + 5 + obj-y += init.o 6 + obj-y += intc.o 7 + obj-y += time.o
+3
arch/mips/xilfpga/Platform
··· 1 + platform-$(CONFIG_MACH_XILFPGA) += xilfpga/ 2 + cflags-$(CONFIG_MACH_XILFPGA) += -I$(srctree)/arch/mips/include/asm/mach-xilfpga 3 + load-$(CONFIG_MACH_XILFPGA) += 0xffffffff80100000
+57
arch/mips/xilfpga/init.c
··· 1 + /* 2 + * Xilfpga platform setup 3 + * 4 + * Copyright (C) 2015 Imagination Technologies 5 + * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms and conditions of the GNU General Public License, 9 + * version 2, as published by the Free Software Foundation. 10 + */ 11 + 12 + #include <linux/of_fdt.h> 13 + #include <linux/of_platform.h> 14 + 15 + #include <asm/prom.h> 16 + 17 + #define XILFPGA_UART_BASE 0xb0401000 18 + 19 + const char *get_system_type(void) 20 + { 21 + return "MIPSfpga"; 22 + } 23 + 24 + void __init plat_mem_setup(void) 25 + { 26 + __dt_setup_arch(__dtb_start); 27 + strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); 28 + } 29 + 30 + void __init prom_init(void) 31 + { 32 + setup_8250_early_printk_port(XILFPGA_UART_BASE, 2, 50000); 33 + } 34 + 35 + void __init prom_free_prom_memory(void) 36 + { 37 + } 38 + 39 + void __init device_tree_init(void) 40 + { 41 + if (!initial_boot_params) 42 + return; 43 + 44 + unflatten_and_copy_device_tree(); 45 + } 46 + 47 + static int __init plat_of_setup(void) 48 + { 49 + if (!of_have_populated_dt()) 50 + panic("Device tree not present"); 51 + 52 + if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL)) 53 + panic("Failed to populate DT"); 54 + 55 + return 0; 56 + } 57 + arch_initcall(plat_of_setup);
+25
arch/mips/xilfpga/intc.c
··· 1 + /* 2 + * Xilfpga interrupt controller setup 3 + * 4 + * Copyright (C) 2015 Imagination Technologies 5 + * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms and conditions of the GNU General Public License, 9 + * version 2, as published by the Free Software Foundation. 10 + */ 11 + 12 + #include <linux/of.h> 13 + #include <linux/of_irq.h> 14 + 15 + #include <asm/irq_cpu.h> 16 + 17 + static struct of_device_id of_irq_ids[] __initdata = { 18 + { .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_irq_of_init }, 19 + {}, 20 + }; 21 + 22 + void __init arch_init_irq(void) 23 + { 24 + of_irq_init(of_irq_ids); 25 + }
+41
arch/mips/xilfpga/time.c
··· 1 + /* 2 + * Xilfpga clocksource/timer setup 3 + * 4 + * Copyright (C) 2015 Imagination Technologies 5 + * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms and conditions of the GNU General Public License, 9 + * version 2, as published by the Free Software Foundation. 10 + */ 11 + 12 + #include <linux/clk.h> 13 + #include <linux/clk-provider.h> 14 + #include <linux/clocksource.h> 15 + #include <linux/of.h> 16 + 17 + #include <asm/time.h> 18 + 19 + void __init plat_time_init(void) 20 + { 21 + struct device_node *np; 22 + struct clk *clk; 23 + 24 + of_clk_init(NULL); 25 + clocksource_of_init(); 26 + 27 + np = of_get_cpu_node(0, NULL); 28 + if (!np) { 29 + pr_err("Failed to get CPU node\n"); 30 + return; 31 + } 32 + 33 + clk = of_clk_get(np, 0); 34 + if (IS_ERR(clk)) { 35 + pr_err("Failed to get CPU clock: %ld\n", PTR_ERR(clk)); 36 + return; 37 + } 38 + 39 + mips_hpt_frequency = clk_get_rate(clk) / 2; 40 + clk_put(clk); 41 + }