11dbae815STony Lindgren /* 21dbae815STony Lindgren * Copyright (C) 2005 Nokia Corporation 31dbae815STony Lindgren * Author: Paul Mundt <paul.mundt@nokia.com> 41dbae815STony Lindgren * 58d61649dSBenoit Cousson * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ 61dbae815STony Lindgren * 78d61649dSBenoit Cousson * Modified from the original mach-omap/omap2/board-generic.c did by Paul 88d61649dSBenoit Cousson * to support the OMAP2+ device tree boards with an unique board file. 91dbae815STony Lindgren * 101dbae815STony Lindgren * This program is free software; you can redistribute it and/or modify 111dbae815STony Lindgren * it under the terms of the GNU General Public License version 2 as 121dbae815STony Lindgren * published by the Free Software Foundation. 131dbae815STony Lindgren */ 148d61649dSBenoit Cousson #include <linux/io.h> 15fbf75da7SBenoit Cousson #include <linux/of_irq.h> 168d61649dSBenoit Cousson #include <linux/of_platform.h> 178d61649dSBenoit Cousson #include <linux/irqdomain.h> 18a7cbb9b1SBenoit Cousson #include <linux/i2c/twl.h> 191dbae815STony Lindgren 20a09e64fbSRussell King #include <mach/hardware.h> 21b755706cSBenoit Cousson #include <asm/hardware/gic.h> 221dbae815STony Lindgren #include <asm/mach/arch.h> 231dbae815STony Lindgren 24ce491cf8STony Lindgren #include <plat/board.h> 254e65331cSTony Lindgren #include "common.h" 26a7cbb9b1SBenoit Cousson #include "common-board-devices.h" 271dbae815STony Lindgren 2875a57fe9STony Lindgren #if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)) 2975a57fe9STony Lindgren #define omap_intc_of_init NULL 3075a57fe9STony Lindgren #endif 3175a57fe9STony Lindgren #ifndef CONFIG_ARCH_OMAP4 3275a57fe9STony Lindgren #define gic_of_init NULL 3375a57fe9STony Lindgren #endif 3475a57fe9STony Lindgren 35fbf75da7SBenoit Cousson static struct of_device_id irq_match[] __initdata = { 36fbf75da7SBenoit Cousson { .compatible = "ti,omap2-intc", .data = omap_intc_of_init, }, 37fbf75da7SBenoit Cousson { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, }, 38fbf75da7SBenoit Cousson { } 39fbf75da7SBenoit Cousson }; 40fbf75da7SBenoit Cousson 41fbf75da7SBenoit Cousson static void __init omap_init_irq(void) 42fbf75da7SBenoit Cousson { 43fbf75da7SBenoit Cousson of_irq_init(irq_match); 44fbf75da7SBenoit Cousson } 45fbf75da7SBenoit Cousson 46a7cbb9b1SBenoit Cousson /* 47a7cbb9b1SBenoit Cousson * XXX: Still needed to boot until the i2c & twl driver is adapted to 48a7cbb9b1SBenoit Cousson * device-tree 49a7cbb9b1SBenoit Cousson */ 50c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP4 51a7cbb9b1SBenoit Cousson static struct twl4030_platform_data sdp4430_twldata = { 52a7cbb9b1SBenoit Cousson .irq_base = TWL6030_IRQ_BASE, 53a7cbb9b1SBenoit Cousson .irq_end = TWL6030_IRQ_END, 54a7cbb9b1SBenoit Cousson }; 55a7cbb9b1SBenoit Cousson 56a7cbb9b1SBenoit Cousson static void __init omap4_i2c_init(void) 57a7cbb9b1SBenoit Cousson { 58a7cbb9b1SBenoit Cousson omap4_pmic_init("twl6030", &sdp4430_twldata); 59a7cbb9b1SBenoit Cousson } 60c4e2d245SSanjeev Premi #endif 61a7cbb9b1SBenoit Cousson 62c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP3 63a7cbb9b1SBenoit Cousson static struct twl4030_platform_data beagle_twldata = { 64a7cbb9b1SBenoit Cousson .irq_base = TWL4030_IRQ_BASE, 65a7cbb9b1SBenoit Cousson .irq_end = TWL4030_IRQ_END, 66a7cbb9b1SBenoit Cousson }; 67a7cbb9b1SBenoit Cousson 68a7cbb9b1SBenoit Cousson static void __init omap3_i2c_init(void) 69a7cbb9b1SBenoit Cousson { 70a7cbb9b1SBenoit Cousson omap3_pmic_init("twl4030", &beagle_twldata); 71a7cbb9b1SBenoit Cousson } 72c4e2d245SSanjeev Premi #endif 738d61649dSBenoit Cousson 748d61649dSBenoit Cousson static struct of_device_id omap_dt_match_table[] __initdata = { 758d61649dSBenoit Cousson { .compatible = "simple-bus", }, 768d61649dSBenoit Cousson { .compatible = "ti,omap-infra", }, 778d61649dSBenoit Cousson { } 78b3c6df3aSPaul Walmsley }; 79b3c6df3aSPaul Walmsley 801dbae815STony Lindgren static void __init omap_generic_init(void) 811dbae815STony Lindgren { 82a4ca9dbeSTony Lindgren omap_sdrc_init(NULL, NULL); 838d61649dSBenoit Cousson 848d61649dSBenoit Cousson of_platform_populate(NULL, omap_dt_match_table, NULL, NULL); 851dbae815STony Lindgren } 861dbae815STony Lindgren 87c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP4 88a7cbb9b1SBenoit Cousson static void __init omap4_init(void) 89a7cbb9b1SBenoit Cousson { 90a7cbb9b1SBenoit Cousson omap4_i2c_init(); 91a7cbb9b1SBenoit Cousson omap_generic_init(); 92a7cbb9b1SBenoit Cousson } 93c4e2d245SSanjeev Premi #endif 94a7cbb9b1SBenoit Cousson 95c4e2d245SSanjeev Premi #ifdef CONFIG_ARCH_OMAP3 96a7cbb9b1SBenoit Cousson static void __init omap3_init(void) 97a7cbb9b1SBenoit Cousson { 98a7cbb9b1SBenoit Cousson omap3_i2c_init(); 99a7cbb9b1SBenoit Cousson omap_generic_init(); 100a7cbb9b1SBenoit Cousson } 101c4e2d245SSanjeev Premi #endif 102a7cbb9b1SBenoit Cousson 1030e02a8c1SBenoit Cousson #ifdef CONFIG_SOC_OMAP2420 1048d61649dSBenoit Cousson static const char *omap242x_boards_compat[] __initdata = { 1058d61649dSBenoit Cousson "ti,omap2420", 1068d61649dSBenoit Cousson NULL, 1078d61649dSBenoit Cousson }; 1081dbae815STony Lindgren 1098d61649dSBenoit Cousson DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)") 11071ee7dadSRussell King .reserve = omap_reserve, 1118d61649dSBenoit Cousson .map_io = omap242x_map_io, 1128d61649dSBenoit Cousson .init_early = omap2420_init_early, 113fbf75da7SBenoit Cousson .init_irq = omap_init_irq, 114b755706cSBenoit Cousson .handle_irq = omap2_intc_handle_irq, 1151dbae815STony Lindgren .init_machine = omap_generic_init, 11613340b2aSArnd Bergmann .timer = &omap2_timer, 1178d61649dSBenoit Cousson .dt_compat = omap242x_boards_compat, 118baa95883SRussell King .restart = omap_prcm_restart, 1191dbae815STony Lindgren MACHINE_END 1208d61649dSBenoit Cousson #endif 1218d61649dSBenoit Cousson 1220e02a8c1SBenoit Cousson #ifdef CONFIG_SOC_OMAP2430 1238d61649dSBenoit Cousson static const char *omap243x_boards_compat[] __initdata = { 1248d61649dSBenoit Cousson "ti,omap2430", 1258d61649dSBenoit Cousson NULL, 1268d61649dSBenoit Cousson }; 1278d61649dSBenoit Cousson 1288d61649dSBenoit Cousson DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)") 1298d61649dSBenoit Cousson .reserve = omap_reserve, 1308d61649dSBenoit Cousson .map_io = omap243x_map_io, 1318d61649dSBenoit Cousson .init_early = omap2430_init_early, 132fbf75da7SBenoit Cousson .init_irq = omap_init_irq, 1336b2f55d7SMarc Zyngier .handle_irq = omap2_intc_handle_irq, 1348d61649dSBenoit Cousson .init_machine = omap_generic_init, 1358d61649dSBenoit Cousson .timer = &omap2_timer, 1368d61649dSBenoit Cousson .dt_compat = omap243x_boards_compat, 137baa95883SRussell King .restart = omap_prcm_restart, 1388d61649dSBenoit Cousson MACHINE_END 1398d61649dSBenoit Cousson #endif 1408d61649dSBenoit Cousson 1410e02a8c1SBenoit Cousson #ifdef CONFIG_ARCH_OMAP3 1428d61649dSBenoit Cousson static const char *omap3_boards_compat[] __initdata = { 1438d61649dSBenoit Cousson "ti,omap3", 1448d61649dSBenoit Cousson NULL, 1458d61649dSBenoit Cousson }; 1468d61649dSBenoit Cousson 1478d61649dSBenoit Cousson DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)") 1488d61649dSBenoit Cousson .reserve = omap_reserve, 1498d61649dSBenoit Cousson .map_io = omap3_map_io, 1508d61649dSBenoit Cousson .init_early = omap3430_init_early, 151fbf75da7SBenoit Cousson .init_irq = omap_init_irq, 152b755706cSBenoit Cousson .handle_irq = omap3_intc_handle_irq, 153a7cbb9b1SBenoit Cousson .init_machine = omap3_init, 1548d61649dSBenoit Cousson .timer = &omap3_timer, 1558d61649dSBenoit Cousson .dt_compat = omap3_boards_compat, 156baa95883SRussell King .restart = omap_prcm_restart, 1578d61649dSBenoit Cousson MACHINE_END 1588d61649dSBenoit Cousson #endif 1598d61649dSBenoit Cousson 1600e02a8c1SBenoit Cousson #ifdef CONFIG_ARCH_OMAP4 1618d61649dSBenoit Cousson static const char *omap4_boards_compat[] __initdata = { 1628d61649dSBenoit Cousson "ti,omap4", 1638d61649dSBenoit Cousson NULL, 1648d61649dSBenoit Cousson }; 1658d61649dSBenoit Cousson 1668d61649dSBenoit Cousson DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)") 1678d61649dSBenoit Cousson .reserve = omap_reserve, 1688d61649dSBenoit Cousson .map_io = omap4_map_io, 1698d61649dSBenoit Cousson .init_early = omap4430_init_early, 170fbf75da7SBenoit Cousson .init_irq = omap_init_irq, 171b755706cSBenoit Cousson .handle_irq = gic_handle_irq, 172a7cbb9b1SBenoit Cousson .init_machine = omap4_init, 1738d61649dSBenoit Cousson .timer = &omap4_timer, 1748d61649dSBenoit Cousson .dt_compat = omap4_boards_compat, 175baa95883SRussell King .restart = omap_prcm_restart, 1768d61649dSBenoit Cousson MACHINE_END 1778d61649dSBenoit Cousson #endif 178