blob: fa19e39f5207e9f6142414402b1a5ca611b87bad [file] [log] [blame]
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that 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/err.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/memory.h>
#include <asm/hardware/gic.h>
#include <asm/mach/map.h>
#include <asm/mach/arch.h>
#include <mach/board.h>
#include <mach/gpiomux.h>
#include <mach/msm_iomap.h>
#include <mach/msm_memtypes.h>
#include <mach/msm_smd.h>
#include <mach/restart.h>
#include <mach/socinfo.h>
#include <mach/clk-provider.h>
#include "board-dt.h"
#include "clock.h"
#include "devices.h"
#include "platsmp.h"
static struct memtype_reserve msmzinc_reserve_table[] __initdata = {
[MEMTYPE_SMI] = {
},
[MEMTYPE_EBI0] = {
.flags = MEMTYPE_FLAGS_1M_ALIGN,
},
[MEMTYPE_EBI1] = {
.flags = MEMTYPE_FLAGS_1M_ALIGN,
},
};
static int msmzinc_paddr_to_memtype(unsigned int paddr)
{
return MEMTYPE_EBI1;
}
static struct reserve_info msmzinc_reserve_info __initdata = {
.memtype_reserve_table = msmzinc_reserve_table,
.paddr_to_memtype = msmzinc_paddr_to_memtype,
};
void __init msmzinc_reserve(void)
{
reserve_info = &msmzinc_reserve_info;
of_scan_flat_dt(dt_scan_for_memory_reserve, msmzinc_reserve_table);
msm_reserve();
}
static void __init msmzinc_early_memory(void)
{
reserve_info = &msmzinc_reserve_info;
of_scan_flat_dt(dt_scan_for_memory_hole, msmzinc_reserve_table);
}
static struct clk_lookup msm_clocks_dummy[] = {
CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
};
static struct clock_init_data msm_dummy_clock_init_data __initdata = {
.table = msm_clocks_dummy,
.size = ARRAY_SIZE(msm_clocks_dummy),
};
/*
* Used to satisfy dependencies for devices that need to be
* run early or in a particular order. Most likely your device doesn't fall
* into this category, and thus the driver should not be added here. The
* EPROBE_DEFER can satisfy most dependency problems.
*/
void __init msmzinc_add_drivers(void)
{
msm_smd_init();
msm_clock_init(&msm_dummy_clock_init_data);
}
static void __init msmzinc_map_io(void)
{
msm_map_zinc_io();
}
void __init msmzinc_init(void)
{
if (socinfo_init() < 0)
pr_err("%s: socinfo_init() failed\n", __func__);
msmzinc_init_gpiomux();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
msmzinc_add_drivers();
}
void __init msmzinc_init_very_early(void)
{
msmzinc_early_memory();
}
static const char *msmzinc_dt_match[] __initconst = {
"qcom,msmzinc",
NULL
};
DT_MACHINE_START(MSMZINC_DT, "Qualcomm MSM ZINC (Flattened Device Tree)")
.map_io = msmzinc_map_io,
.init_irq = msm_dt_init_irq,
.init_machine = msmzinc_init,
.handle_irq = gic_handle_irq,
.timer = &msm_dt_timer,
.dt_compat = msmzinc_dt_match,
.reserve = msmzinc_reserve,
.init_very_early = msmzinc_init_very_early,
.restart = msm_restart,
.smp = &msm8974_smp_ops,
MACHINE_END