Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*  linux/arch/arm/mach-pxa/xcep.c
0003  *
0004  *  Support for the Iskratel Electronics XCEP platform as used in
0005  *  the Libera instruments from Instrumentation Technologies.
0006  *
0007  *  Author:     Ales Bardorfer <ales@i-tech.si>
0008  *  Contributions by: Abbott, MG (Michael) <michael.abbott@diamond.ac.uk>
0009  *  Contributions by: Matej Kenda <matej.kenda@i-tech.si>
0010  *  Created:    June 2006
0011  *  Copyright:  (C) 2006-2009 Instrumentation Technologies
0012  */
0013 
0014 #include <linux/platform_device.h>
0015 #include <linux/i2c.h>
0016 #include <linux/platform_data/i2c-pxa.h>
0017 #include <linux/smc91x.h>
0018 #include <linux/mtd/mtd.h>
0019 #include <linux/mtd/partitions.h>
0020 #include <linux/mtd/physmap.h>
0021 
0022 #include <asm/mach-types.h>
0023 #include <asm/mach/arch.h>
0024 #include <asm/mach/irq.h>
0025 #include <asm/mach/map.h>
0026 
0027 #include "pxa25x.h"
0028 #include "addr-map.h"
0029 #include "smemc.h"
0030 
0031 #include "generic.h"
0032 #include "devices.h"
0033 
0034 #define XCEP_ETH_PHYS       (PXA_CS3_PHYS + 0x00000300)
0035 #define XCEP_ETH_PHYS_END   (PXA_CS3_PHYS + 0x000fffff)
0036 #define XCEP_ETH_ATTR       (PXA_CS3_PHYS + 0x02000000)
0037 #define XCEP_ETH_ATTR_END   (PXA_CS3_PHYS + 0x020fffff)
0038 #define XCEP_ETH_IRQ        IRQ_GPIO0
0039 
0040 /*  XCEP CPLD base */
0041 #define XCEP_CPLD_BASE      0xf0000000
0042 
0043 
0044 /* Flash partitions. */
0045 
0046 static struct mtd_partition xcep_partitions[] = {
0047     {
0048         .name =     "Bootloader",
0049         .size =     0x00040000,
0050         .offset =   0,
0051         .mask_flags =   MTD_WRITEABLE
0052     }, {
0053         .name =     "Bootloader ENV",
0054         .size =     0x00040000,
0055         .offset =   0x00040000,
0056         .mask_flags =   MTD_WRITEABLE
0057     }, {
0058         .name =     "Kernel",
0059         .size =     0x00100000,
0060         .offset =   0x00080000,
0061     }, {
0062         .name =     "Rescue fs",
0063         .size =     0x00280000,
0064         .offset =   0x00180000,
0065     }, {
0066         .name =     "Filesystem",
0067         .size =     MTDPART_SIZ_FULL,
0068         .offset =   0x00400000
0069     }
0070 };
0071 
0072 static struct physmap_flash_data xcep_flash_data[] = {
0073     {
0074         .width      = 4,        /* bankwidth in bytes */
0075         .parts      = xcep_partitions,
0076         .nr_parts   = ARRAY_SIZE(xcep_partitions)
0077     }
0078 };
0079 
0080 static struct resource flash_resource = {
0081     .start  = PXA_CS0_PHYS,
0082     .end    = PXA_CS0_PHYS + SZ_32M - 1,
0083     .flags  = IORESOURCE_MEM,
0084 };
0085 
0086 static struct platform_device flash_device = {
0087     .name   = "physmap-flash",
0088     .id = 0,
0089     .dev    = {
0090         .platform_data = xcep_flash_data,
0091     },
0092     .resource = &flash_resource,
0093     .num_resources = 1,
0094 };
0095 
0096 
0097 
0098 /* SMC LAN91C111 network controller. */
0099 
0100 static struct resource smc91x_resources[] = {
0101     [0] = {
0102         .name   = "smc91x-regs",
0103         .start  = XCEP_ETH_PHYS,
0104         .end    = XCEP_ETH_PHYS_END,
0105         .flags  = IORESOURCE_MEM,
0106     },
0107     [1] = {
0108         .start  = XCEP_ETH_IRQ,
0109         .end    = XCEP_ETH_IRQ,
0110         .flags  = IORESOURCE_IRQ,
0111     },
0112     [2] = {
0113         .name   = "smc91x-attrib",
0114         .start  = XCEP_ETH_ATTR,
0115         .end    = XCEP_ETH_ATTR_END,
0116         .flags  = IORESOURCE_MEM,
0117     },
0118 };
0119 
0120 static struct smc91x_platdata xcep_smc91x_info = {
0121     .flags  = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT |
0122           SMC91X_NOWAIT | SMC91X_USE_DMA,
0123 };
0124 
0125 static struct platform_device smc91x_device = {
0126     .name       = "smc91x",
0127     .id     = -1,
0128     .num_resources  = ARRAY_SIZE(smc91x_resources),
0129     .resource   = smc91x_resources,
0130     .dev        = {
0131         .platform_data = &xcep_smc91x_info,
0132     },
0133 };
0134 
0135 
0136 static struct platform_device *devices[] __initdata = {
0137     &flash_device,
0138     &smc91x_device,
0139 };
0140 
0141 
0142 /* We have to state that there are HWMON devices on the I2C bus on XCEP.
0143  * Drivers for HWMON verify capabilities of the adapter when loading and
0144  * refuse to attach if the adapter doesn't support HWMON class of devices. */
0145 static struct i2c_pxa_platform_data xcep_i2c_platform_data  = {
0146     .class = I2C_CLASS_HWMON
0147 };
0148 
0149 
0150 static mfp_cfg_t xcep_pin_config[] __initdata = {
0151     GPIO79_nCS_3,   /* SMC 91C111 chip select. */
0152     GPIO80_nCS_4,   /* CPLD chip select. */
0153     /* SSP communication to MSP430 */
0154     GPIO23_SSP1_SCLK,
0155     GPIO24_SSP1_SFRM,
0156     GPIO25_SSP1_TXD,
0157     GPIO26_SSP1_RXD,
0158     GPIO27_SSP1_EXTCLK
0159 };
0160 
0161 static void __init xcep_init(void)
0162 {
0163     pxa2xx_mfp_config(ARRAY_AND_SIZE(xcep_pin_config));
0164 
0165     pxa_set_ffuart_info(NULL);
0166     pxa_set_btuart_info(NULL);
0167     pxa_set_stuart_info(NULL);
0168     pxa_set_hwuart_info(NULL);
0169 
0170     /* See Intel XScale Developer's Guide for details */
0171     /* Set RDF and RDN to appropriate values (chip select 3 (smc91x)) */
0172     __raw_writel((__raw_readl(MSC1) & 0xffff) | 0xD5540000, MSC1);
0173     /* Set RDF and RDN to appropriate values (chip select 5 (fpga)) */
0174     __raw_writel((__raw_readl(MSC2) & 0xffff) | 0x72A00000, MSC2);
0175 
0176     platform_add_devices(ARRAY_AND_SIZE(devices));
0177     pxa_set_i2c_info(&xcep_i2c_platform_data);
0178 }
0179 
0180 MACHINE_START(XCEP, "Iskratel XCEP")
0181     .atag_offset    = 0x100,
0182     .init_machine   = xcep_init,
0183     .map_io     = pxa25x_map_io,
0184     .nr_irqs    = PXA_NR_IRQS,
0185     .init_irq   = pxa25x_init_irq,
0186     .handle_irq = pxa25x_handle_irq,
0187     .init_time  = pxa_timer_init,
0188     .restart    = pxa_restart,
0189 MACHINE_END
0190