forked from Minki/linux
4305f42401
Pull MIPS updates from Ralf Baechle: "This is the main pull request for MIPS for 4.8. Also includes is a minor SSB cleanup as SSB code traditionally is merged through the MIPS tree: ATH25: - MIPS: Add default configuration for ath25 Boot: - For zboot, copy appended dtb to the end of the kernel - store the appended dtb address in a variable BPF: - Fix off by one error in offset allocation Cobalt code: - Fix typos Core code: - debugfs_create_file returns NULL on error, so don't use IS_ERR for testing for errors. - Fix double locking issue in RM7000 S-cache code. This would only affect RM7000 ARC systems on reboot. - Fix page table corruption on THP permission changes. - Use compat_sys_keyctl for 32 bit userspace on 64 bit kernels. David says, there are no compatibility issues raised by this fix. - Move some signal code around. - Rewrite r4k count/compare clockevent device registration such that min_delta_ticks/max_delta_ticks files are guaranteed to be initialized. - Only register r4k count/compare as clockevent device if we can assume the clock to be constant. - Fix MSA asm warnings in control reg accessors - uasm and tlbex fixes and tweaking. - Print segment physical address when EU=1. - Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO. - CP: Allow booting by VP other than VP 0 - Cache handling fixes and optimizations for r4k class caches - Add hotplug support for R6 processors - Cleanup hotplug bits in kconfig - traps: return correct si code for accessing nonmapped addresses - Remove cpu_has_safe_index_cacheops Lantiq: - Register IRQ handler for virtual IRQ number - Fix EIU interrupt loading code - Use the real EXIN count - Fix build error. Loongson 3: - Increase HPET_MIN_PROG_DELTA and decrease HPET_MIN_CYCLES Octeon: - Delete built-in DTB pruning code for D-Link DSR-1000N. - Clean up GPIO definitions in dlink_dsr-1000n.dts. - Add more LEDs to the DSR-100n DTS - Fix off by one in octeon_irq_gpio_map() - Typo fixes - Enable SATA by default in cavium_octeon_defconfig - Support readq/writeq() - Remove forced mappings of USB interrupts. - Ensure DMA descriptors are always in the low 4GB - Improve USB reset code for OCTEON II. Pistachio: - Add maintainers entry for pistachio SoC Support - Remove plat_setup_iocoherency Ralink: - Fix pwm UART in spis group pinmux. SSB: - Change bare unsigned to unsigned int to suit coding style Tools: - Fix reloc tool compiler warnings. Other: - Delete use of ARCH_WANT_OPTIONAL_GPIOLIB" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (61 commits) MIPS: mm: Fix definition of R6 cache instruction MIPS: tools: Fix relocs tool compiler warnings MIPS: Cobalt: Fix typo MIPS: Octeon: Fix typo MIPS: Lantiq: Fix build failure MIPS: Use CPHYSADDR to implement mips32 __pa MIPS: Octeon: Dlink_dsr-1000n.dts: add more leds. MIPS: Octeon: Clean up GPIO definitions in dlink_dsr-1000n.dts. MIPS: Octeon: Delete built-in DTB pruning code for D-Link DSR-1000N. MIPS: store the appended dtb address in a variable MIPS: ZBOOT: copy appended dtb to the end of the kernel MIPS: ralink: fix spis group pinmux MIPS: Factor o32 specific code into signal_o32.c MIPS: non-exec stack & heap when non-exec PT_GNU_STACK is present MIPS: Use per-mm page to execute branch delay slot instructions MIPS: Modify error handling MIPS: c-r4k: Use SMP calls for CM indexed cache ops MIPS: c-r4k: Avoid small flush_icache_range SMP calls MIPS: c-r4k: Local flush_icache_range cache op override MIPS: c-r4k: Split r4k_flush_kernel_vmap_range() ...
156 lines
3.4 KiB
C
156 lines
3.4 KiB
C
/*
|
|
* Joshua Henderson, joshua.henderson@microchip.com
|
|
* Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
|
|
*
|
|
* This program is free software; you can distribute it and/or modify it
|
|
* under the terms of the GNU General Public License (Version 2) as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* for more details.
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/of_fdt.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/platform_data/sdhci-pic32.h>
|
|
|
|
#include <asm/fw/fw.h>
|
|
#include <asm/mips-boards/generic.h>
|
|
#include <asm/prom.h>
|
|
|
|
#include "pic32mzda.h"
|
|
|
|
const char *get_system_type(void)
|
|
{
|
|
return "PIC32MZDA";
|
|
}
|
|
|
|
static ulong get_fdtaddr(void)
|
|
{
|
|
ulong ftaddr = 0;
|
|
|
|
if (fw_passed_dtb && !fw_arg2 && !fw_arg3)
|
|
return (ulong)fw_passed_dtb;
|
|
|
|
if (__dtb_start < __dtb_end)
|
|
ftaddr = (ulong)__dtb_start;
|
|
|
|
return ftaddr;
|
|
}
|
|
|
|
void __init plat_mem_setup(void)
|
|
{
|
|
void *dtb;
|
|
|
|
dtb = (void *)get_fdtaddr();
|
|
if (!dtb) {
|
|
pr_err("pic32: no DTB found.\n");
|
|
return;
|
|
}
|
|
|
|
/*
|
|
* Load the builtin device tree. This causes the chosen node to be
|
|
* parsed resulting in our memory appearing.
|
|
*/
|
|
__dt_setup_arch(dtb);
|
|
|
|
pr_info("Found following command lines\n");
|
|
pr_info(" boot_command_line: %s\n", boot_command_line);
|
|
pr_info(" arcs_cmdline : %s\n", arcs_cmdline);
|
|
#ifdef CONFIG_CMDLINE_BOOL
|
|
pr_info(" builtin_cmdline : %s\n", CONFIG_CMDLINE);
|
|
#endif
|
|
if (dtb != __dtb_start)
|
|
strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
|
|
|
|
#ifdef CONFIG_EARLY_PRINTK
|
|
fw_init_early_console(-1);
|
|
#endif
|
|
pic32_config_init();
|
|
}
|
|
|
|
static __init void pic32_init_cmdline(int argc, char *argv[])
|
|
{
|
|
unsigned int count = COMMAND_LINE_SIZE - 1;
|
|
int i;
|
|
char *dst = &(arcs_cmdline[0]);
|
|
char *src;
|
|
|
|
for (i = 1; i < argc && count; ++i) {
|
|
src = argv[i];
|
|
while (*src && count) {
|
|
*dst++ = *src++;
|
|
--count;
|
|
}
|
|
*dst++ = ' ';
|
|
}
|
|
if (i > 1)
|
|
--dst;
|
|
|
|
*dst = 0;
|
|
}
|
|
|
|
void __init prom_init(void)
|
|
{
|
|
pic32_init_cmdline((int)fw_arg0, (char **)fw_arg1);
|
|
}
|
|
|
|
void __init prom_free_prom_memory(void)
|
|
{
|
|
}
|
|
|
|
void __init device_tree_init(void)
|
|
{
|
|
if (!initial_boot_params)
|
|
return;
|
|
|
|
unflatten_and_copy_device_tree();
|
|
}
|
|
|
|
static struct pic32_sdhci_platform_data sdhci_data = {
|
|
.setup_dma = pic32_set_sdhci_adma_fifo_threshold,
|
|
};
|
|
|
|
static struct of_dev_auxdata pic32_auxdata_lookup[] __initdata = {
|
|
OF_DEV_AUXDATA("microchip,pic32mzda-sdhci", 0, "sdhci", &sdhci_data),
|
|
{ /* sentinel */}
|
|
};
|
|
|
|
static int __init pic32_of_prepare_platform_data(struct of_dev_auxdata *lookup)
|
|
{
|
|
struct device_node *root, *np;
|
|
struct resource res;
|
|
|
|
root = of_find_node_by_path("/");
|
|
|
|
for (; lookup->compatible; lookup++) {
|
|
np = of_find_compatible_node(NULL, NULL, lookup->compatible);
|
|
if (np) {
|
|
lookup->name = (char *)np->name;
|
|
if (lookup->phys_addr)
|
|
continue;
|
|
if (!of_address_to_resource(np, 0, &res))
|
|
lookup->phys_addr = res.start;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int __init plat_of_setup(void)
|
|
{
|
|
if (!of_have_populated_dt())
|
|
panic("Device tree not present");
|
|
|
|
pic32_of_prepare_platform_data(pic32_auxdata_lookup);
|
|
if (of_platform_default_populate(NULL, pic32_auxdata_lookup, NULL))
|
|
panic("Failed to populate DT");
|
|
|
|
return 0;
|
|
}
|
|
arch_initcall(plat_of_setup);
|