18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/arch/arm/mach-ep93xx/micro9.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH 68c2ecf20Sopenharmony_ci * Manfred Gruber <m.gruber@tirol.com> 78c2ecf20Sopenharmony_ci * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH 88c2ecf20Sopenharmony_ci * Hubert Feurstein <hubert.feurstein@contec.at> 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/kernel.h> 128c2ecf20Sopenharmony_ci#include <linux/init.h> 138c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 148c2ecf20Sopenharmony_ci#include <linux/io.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include "hardware.h" 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 198c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include "soc.h" 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/************************************************************************* 248c2ecf20Sopenharmony_ci * Micro9 NOR Flash 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci * Micro9-High has up to 64MB of 32-bit flash on CS1 278c2ecf20Sopenharmony_ci * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1 288c2ecf20Sopenharmony_ci * Micro9-Lite uses a separate MTD map driver for flash support 298c2ecf20Sopenharmony_ci * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1 308c2ecf20Sopenharmony_ci *************************************************************************/ 318c2ecf20Sopenharmony_cistatic unsigned int __init micro9_detect_bootwidth(void) 328c2ecf20Sopenharmony_ci{ 338c2ecf20Sopenharmony_ci u32 v; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci /* Detect the bus width of the external flash memory */ 368c2ecf20Sopenharmony_ci v = __raw_readl(EP93XX_SYSCON_SYSCFG); 378c2ecf20Sopenharmony_ci if (v & EP93XX_SYSCON_SYSCFG_LCSN7) 388c2ecf20Sopenharmony_ci return 4; /* 32-bit */ 398c2ecf20Sopenharmony_ci else 408c2ecf20Sopenharmony_ci return 2; /* 16-bit */ 418c2ecf20Sopenharmony_ci} 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cistatic void __init micro9_register_flash(void) 448c2ecf20Sopenharmony_ci{ 458c2ecf20Sopenharmony_ci unsigned int width; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci if (machine_is_micro9()) 488c2ecf20Sopenharmony_ci width = 4; 498c2ecf20Sopenharmony_ci else if (machine_is_micro9m() || machine_is_micro9s()) 508c2ecf20Sopenharmony_ci width = micro9_detect_bootwidth(); 518c2ecf20Sopenharmony_ci else 528c2ecf20Sopenharmony_ci width = 0; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci if (width) 558c2ecf20Sopenharmony_ci ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M); 568c2ecf20Sopenharmony_ci} 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci/************************************************************************* 608c2ecf20Sopenharmony_ci * Micro9 Ethernet 618c2ecf20Sopenharmony_ci *************************************************************************/ 628c2ecf20Sopenharmony_cistatic struct ep93xx_eth_data __initdata micro9_eth_data = { 638c2ecf20Sopenharmony_ci .phy_id = 0x1f, 648c2ecf20Sopenharmony_ci}; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_cistatic void __init micro9_init_machine(void) 688c2ecf20Sopenharmony_ci{ 698c2ecf20Sopenharmony_ci ep93xx_init_devices(); 708c2ecf20Sopenharmony_ci ep93xx_register_eth(µ9_eth_data, 1); 718c2ecf20Sopenharmony_ci micro9_register_flash(); 728c2ecf20Sopenharmony_ci} 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#ifdef CONFIG_MACH_MICRO9H 768c2ecf20Sopenharmony_ciMACHINE_START(MICRO9, "Contec Micro9-High") 778c2ecf20Sopenharmony_ci /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ 788c2ecf20Sopenharmony_ci .atag_offset = 0x100, 798c2ecf20Sopenharmony_ci .map_io = ep93xx_map_io, 808c2ecf20Sopenharmony_ci .init_irq = ep93xx_init_irq, 818c2ecf20Sopenharmony_ci .init_time = ep93xx_timer_init, 828c2ecf20Sopenharmony_ci .init_machine = micro9_init_machine, 838c2ecf20Sopenharmony_ci .init_late = ep93xx_init_late, 848c2ecf20Sopenharmony_ci .restart = ep93xx_restart, 858c2ecf20Sopenharmony_ciMACHINE_END 868c2ecf20Sopenharmony_ci#endif 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci#ifdef CONFIG_MACH_MICRO9M 898c2ecf20Sopenharmony_ciMACHINE_START(MICRO9M, "Contec Micro9-Mid") 908c2ecf20Sopenharmony_ci /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ 918c2ecf20Sopenharmony_ci .atag_offset = 0x100, 928c2ecf20Sopenharmony_ci .map_io = ep93xx_map_io, 938c2ecf20Sopenharmony_ci .init_irq = ep93xx_init_irq, 948c2ecf20Sopenharmony_ci .init_time = ep93xx_timer_init, 958c2ecf20Sopenharmony_ci .init_machine = micro9_init_machine, 968c2ecf20Sopenharmony_ci .init_late = ep93xx_init_late, 978c2ecf20Sopenharmony_ci .restart = ep93xx_restart, 988c2ecf20Sopenharmony_ciMACHINE_END 998c2ecf20Sopenharmony_ci#endif 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#ifdef CONFIG_MACH_MICRO9L 1028c2ecf20Sopenharmony_ciMACHINE_START(MICRO9L, "Contec Micro9-Lite") 1038c2ecf20Sopenharmony_ci /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ 1048c2ecf20Sopenharmony_ci .atag_offset = 0x100, 1058c2ecf20Sopenharmony_ci .map_io = ep93xx_map_io, 1068c2ecf20Sopenharmony_ci .init_irq = ep93xx_init_irq, 1078c2ecf20Sopenharmony_ci .init_time = ep93xx_timer_init, 1088c2ecf20Sopenharmony_ci .init_machine = micro9_init_machine, 1098c2ecf20Sopenharmony_ci .init_late = ep93xx_init_late, 1108c2ecf20Sopenharmony_ci .restart = ep93xx_restart, 1118c2ecf20Sopenharmony_ciMACHINE_END 1128c2ecf20Sopenharmony_ci#endif 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#ifdef CONFIG_MACH_MICRO9S 1158c2ecf20Sopenharmony_ciMACHINE_START(MICRO9S, "Contec Micro9-Slim") 1168c2ecf20Sopenharmony_ci /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ 1178c2ecf20Sopenharmony_ci .atag_offset = 0x100, 1188c2ecf20Sopenharmony_ci .map_io = ep93xx_map_io, 1198c2ecf20Sopenharmony_ci .init_irq = ep93xx_init_irq, 1208c2ecf20Sopenharmony_ci .init_time = ep93xx_timer_init, 1218c2ecf20Sopenharmony_ci .init_machine = micro9_init_machine, 1228c2ecf20Sopenharmony_ci .init_late = ep93xx_init_late, 1238c2ecf20Sopenharmony_ci .restart = ep93xx_restart, 1248c2ecf20Sopenharmony_ciMACHINE_END 1258c2ecf20Sopenharmony_ci#endif 126