Changes in 4.9.335 wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support audit: fix undefined behavior in bit shift for AUDIT_BIT wifi: mac80211: Fix ack frame idr leak when mesh has no route MIPS: pic32: treat port as signed integer af_key: Fix send_acquire race with pfkey_register bus: sunxi-rsb: Support atomic transfers ARM: dts: at91: sam9g20ek: enable udc vbus gpio pinctrl nfc/nci: fix race with opening and closing net: pch_gbe: fix potential memleak in pch_gbe_tx_queue() 9p/fd: fix issue of list_del corruption in p9_fd_cancel() ARM: mxs: fix memory leak in mxs_machine_init() net/mlx4: Check retval of mlx4_bitmap_init net/qla3xxx: fix potential memleak in ql3xxx_send() xfrm: Fix ignored return value in xfrm6_init() NFC: nci: fix memory leak in nci_rx_data_packet() nfc: st-nci: fix incorrect validating logic in EVT_TRANSACTION nfc: st-nci: fix memory leaks in EVT_TRANSACTION net: thunderx: Fix the ACPI memory leak s390/crashdump: fix TOD programmable field size iio: light: apds9960: fix wrong register for gesture gain iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails kconfig: display recursive dependency resolution hint just once nios2: add FORCE for vmlinuz.gz nilfs2: fix nilfs_sufile_mark_dirty() not set segment usage as dirty serial: 8250: 8250_omap: Avoid RS485 RTS glitch on ->set_termios() xen/platform-pci: add missing free_irq() in error path platform/x86: asus-wmi: add missing pci_dev_put() in asus_wmi_set_xusb2pr() tcp: configurable source port perturb table size net: usb: qmi_wwan: add Telit 0x103a composition drm/amdgpu: always register an MMU notifier for userptr iio: health: afe4403: Fix oob read in afe4403_read_raw iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw hwmon: (i5500_temp) fix missing pci_disable_device() hwmon: (ibmpex) Fix possible UAF when ibmpex_register_bmc() fails net/mlx5: Fix uninitialized variable bug in outlen_write() can: sja1000_isa: sja1000_isa_probe(): add missing free_sja1000dev() can: cc770: cc770_isa_probe(): add missing free_cc770dev() qlcnic: fix sleep-in-atomic-context bugs caused by msleep net: phy: fix null-ptr-deref while probe() failed net: net_netdev: Fix error handling in ntb_netdev_init_module() net/9p: Fix a potential socket leak in p9_socket_open net: hsr: Fix potential use-after-free packet: do not set TP_STATUS_CSUM_VALID on CHECKSUM_COMPLETE net: ethernet: renesas: ravb: Fix promiscuous mode after system resumed hwmon: (coretemp) Check for null before removing sysfs attrs hwmon: (coretemp) fix pci device refcount leak in nv1a_ram_new() btrfs: qgroup: fix sleep from invalid context bug in btrfs_qgroup_inherit() tools/vm/slabinfo-gnuplot: use "grep -E" instead of "egrep" nilfs2: fix NULL pointer dereference in nilfs_palloc_commit_free_entry() arm64: Fix panic() when Spectre-v2 causes Spectre-BHB to re-allocate KVM vectors arm64: errata: Fix KVM Spectre-v2 mitigation selection for Cortex-A57/A72 ASoC: ops: Fix bounds check for _sx controls pinctrl: single: Fix potential division by zero iommu/vt-d: Fix PCI device refcount leak in dmar_dev_scope_init() tcp/udp: Fix memory leak in ipv6_renew_options(). Revert "fbdev: fb_pm2fb: Avoid potential divide by zero error" x86/tsx: Add a feature bit for TSX control MSR support x86/pm: Add enumeration check before spec MSRs save/restore setup Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM x86/ioremap: Fix page aligned size calculation in __ioremap_caller() proc: avoid integer type confusion in get_proc_long proc: proc_skip_spaces() shouldn't think it is working on C strings v4l2: don't fall back to follow_pfn() if pin_user_pages_fast() fails Linux 4.9.335 Change-Id: I5a99e366191f445d4de1039f5e82812b37787842 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
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();
|
|
#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);
|