diff --git a/arch/arm/mach-meson8b/Kconfig.boards b/arch/arm/mach-meson8b/Kconfig.boards index 1825fc0f0345..07628dcf27be 100644 --- a/arch/arm/mach-meson8b/Kconfig.boards +++ b/arch/arm/mach-meson8b/Kconfig.boards @@ -3,4 +3,11 @@ config MACH_MESON8B_COMMON_BOARD bool "Meson8 baby common board" default y help - Support for Amlogic Meson8 baby common development platform. \ No newline at end of file + Support for Amlogic Meson8 baby common development platform. + +config MACH_MESON8B_ODROIDC + depends on ARCH_MESON8B + bool "Hardkernel's ODROID-C board" + default y + help + Support for Hardkernel's ODROID-C development platform. diff --git a/arch/arm/mach-meson8b/Makefile b/arch/arm/mach-meson8b/Makefile index c1747faac38c..1351e94ae3ac 100755 --- a/arch/arm/mach-meson8b/Makefile +++ b/arch/arm/mach-meson8b/Makefile @@ -13,6 +13,7 @@ obj- := # Board support obj-$(CONFIG_MACH_MESON8B_COMMON_BOARD) += board-meson8b-common.o +obj-$(CONFIG_MACH_MESON8B_ODROIDC) += board-meson8b-odroidc.o # Cache config obj-$(CONFIG_CACHE_L2X0) += cache.o diff --git a/arch/arm/mach-meson8b/board-meson8b-odroidc.c b/arch/arm/mach-meson8b/board-meson8b-odroidc.c new file mode 100644 index 000000000000..c0fdb9ff891a --- /dev/null +++ b/arch/arm/mach-meson8b/board-meson8b-odroidc.c @@ -0,0 +1,152 @@ +/* + * arch/arm/mach-meson8b/board-meson8b-odroidc.c + * + * Copyright (C) 2011-2013 Amlogic, Inc. + * Copyright (C) 2014 Hardkernel,. Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_SMP +#include +#endif +#include +#include + +#include + +extern void meson_common_restart(char mode,const char *cmd); +static void meson_map_board_io(void); +extern unsigned long long aml_reserved_start; +extern unsigned long long aml_reserved_end; +extern void __init meson_timer_init(void); + +static __init void meson8b_reserve(void) +{ + /* + * Reserved memory for hotplug: + * start address: PHYS_OFFSET, size 0x4000, + * toprevent other getting logical address 0xc0000000 and + * flushing valid data on "zero address" + */ + memblock_reserve(PHYS_OFFSET,__pa(swapper_pg_dir) - PHYS_OFFSET); +} + +__initdata struct map_desc meson_board_io_desc[1]; + +static __init void meson_map_board_io(void) +{ + meson_board_io_desc[0].virtual = PAGE_ALIGN(__phys_to_virt(aml_reserved_start)); + meson_board_io_desc[0].pfn = __phys_to_pfn(aml_reserved_start); + meson_board_io_desc[0].length = aml_reserved_end + - aml_reserved_start + 1; + meson_board_io_desc[0].type = MT_MEMORY_NONCACHED; + iotable_init(meson_board_io_desc,ARRAY_SIZE(meson_board_io_desc)); +} + +static void __init meson_map_io(void) +{ + meson_map_default_io(); + meson_map_board_io(); +} + +static struct of_device_id m8_of_platform_bus_ids[] = { + { + .compatible = "simple-bus", + }, + {}, +}; +static struct of_device_id m8_of_lm_bus_ids[] = { + { + .compatible = "logicmodule-bus", + }, + {}, +}; + +static __init void meson_init_machine_devicetree(void) +{ + struct device *parent; + + parent = get_device(&platform_bus); + + of_platform_populate(NULL,m8_of_platform_bus_ids,NULL,parent); +#ifdef CONFIG_OF_LM + of_lm_populate(NULL,m8_of_lm_bus_ids,NULL,NULL); +#endif +} + +int meson_cache_of_init(void); + +static __init void meson_init_early(void) +{ + int rev; + + meson_cpu_version_init(); + /* + * Mali or some USB devices allocate their coherent buffers from atomic + * context. Increase size of atomic coherent pool to make sure such + * the allocations won't fail. + */ + init_dma_coherent_pool_size(SZ_4M); + + rev = get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR); + rev <<= 24; + system_serial_high = rev; + rev = get_meson_cpu_version(MESON_CPU_VERSION_LVL_MINOR); + system_rev = rev; +} + +static void __init meson_init_irq(void) +{ + meson_init_gic_irq(); +} + +static const char *m8_common_board_compat[] __initdata = { + "AMLOGIC,8726_M8B", + NULL, +}; + +DT_MACHINE_START(AML8726_M8, "ODROIDC") + .reserve = meson8b_reserve, + .smp = smp_ops(meson_smp_ops), + .map_io = meson_map_io, + .init_early = meson_init_early, + .init_irq = meson_init_irq, + .init_time = meson_timer_init, + .init_machine = meson_init_machine_devicetree, + .restart = meson_common_restart, + .dt_compat = m8_common_board_compat, +MACHINE_END