Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/arch/arm/mach-ep93xx/micro9.c
0004  *
0005  * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH
0006  *                    Manfred Gruber <m.gruber@tirol.com>
0007  * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH
0008  *                    Hubert Feurstein <hubert.feurstein@contec.at>
0009  */
0010 
0011 #include <linux/kernel.h>
0012 #include <linux/init.h>
0013 #include <linux/platform_device.h>
0014 #include <linux/io.h>
0015 
0016 #include "hardware.h"
0017 
0018 #include <asm/mach-types.h>
0019 #include <asm/mach/arch.h>
0020 
0021 #include "soc.h"
0022 
0023 /*************************************************************************
0024  * Micro9 NOR Flash
0025  *
0026  * Micro9-High has up to 64MB of 32-bit flash on CS1
0027  * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
0028  * Micro9-Lite uses a separate MTD map driver for flash support
0029  * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
0030  *************************************************************************/
0031 static unsigned int __init micro9_detect_bootwidth(void)
0032 {
0033     u32 v;
0034 
0035     /* Detect the bus width of the external flash memory */
0036     v = __raw_readl(EP93XX_SYSCON_SYSCFG);
0037     if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
0038         return 4; /* 32-bit */
0039     else
0040         return 2; /* 16-bit */
0041 }
0042 
0043 static void __init micro9_register_flash(void)
0044 {
0045     unsigned int width;
0046 
0047     if (machine_is_micro9())
0048         width = 4;
0049     else if (machine_is_micro9m() || machine_is_micro9s())
0050         width = micro9_detect_bootwidth();
0051     else
0052         width = 0;
0053 
0054     if (width)
0055         ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
0056 }
0057 
0058 
0059 /*************************************************************************
0060  * Micro9 Ethernet
0061  *************************************************************************/
0062 static struct ep93xx_eth_data __initdata micro9_eth_data = {
0063     .phy_id     = 0x1f,
0064 };
0065 
0066 
0067 static void __init micro9_init_machine(void)
0068 {
0069     ep93xx_init_devices();
0070     ep93xx_register_eth(&micro9_eth_data, 1);
0071     micro9_register_flash();
0072 }
0073 
0074 
0075 #ifdef CONFIG_MACH_MICRO9H
0076 MACHINE_START(MICRO9, "Contec Micro9-High")
0077     /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
0078     .atag_offset    = 0x100,
0079     .nr_irqs    = NR_EP93XX_IRQS,
0080     .map_io     = ep93xx_map_io,
0081     .init_irq   = ep93xx_init_irq,
0082     .init_time  = ep93xx_timer_init,
0083     .init_machine   = micro9_init_machine,
0084     .restart    = ep93xx_restart,
0085 MACHINE_END
0086 #endif
0087 
0088 #ifdef CONFIG_MACH_MICRO9M
0089 MACHINE_START(MICRO9M, "Contec Micro9-Mid")
0090     /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
0091     .atag_offset    = 0x100,
0092     .nr_irqs    = NR_EP93XX_IRQS,
0093     .map_io     = ep93xx_map_io,
0094     .init_irq   = ep93xx_init_irq,
0095     .init_time  = ep93xx_timer_init,
0096     .init_machine   = micro9_init_machine,
0097     .restart    = ep93xx_restart,
0098 MACHINE_END
0099 #endif
0100 
0101 #ifdef CONFIG_MACH_MICRO9L
0102 MACHINE_START(MICRO9L, "Contec Micro9-Lite")
0103     /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
0104     .atag_offset    = 0x100,
0105     .nr_irqs    = NR_EP93XX_IRQS,
0106     .map_io     = ep93xx_map_io,
0107     .init_irq   = ep93xx_init_irq,
0108     .init_time  = ep93xx_timer_init,
0109     .init_machine   = micro9_init_machine,
0110     .restart    = ep93xx_restart,
0111 MACHINE_END
0112 #endif
0113 
0114 #ifdef CONFIG_MACH_MICRO9S
0115 MACHINE_START(MICRO9S, "Contec Micro9-Slim")
0116     /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
0117     .atag_offset    = 0x100,
0118     .nr_irqs    = NR_EP93XX_IRQS,
0119     .map_io     = ep93xx_map_io,
0120     .init_irq   = ep93xx_init_irq,
0121     .init_time  = ep93xx_timer_init,
0122     .init_machine   = micro9_init_machine,
0123     .restart    = ep93xx_restart,
0124 MACHINE_END
0125 #endif