Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/arch/arm/mach-pxa/pcm027.c
0004  *  Support for the Phytec phyCORE-PXA270 CPU card (aka PCM-027).
0005  *
0006  *  Refer
0007  *   http://www.phytec.com/products/sbc/ARM-XScale/phyCORE-XScale-PXA270.html
0008  *  for additional hardware info
0009  *
0010  *  Author: Juergen Kilb
0011  *  Created:    April 05, 2005
0012  *  Copyright:  Phytec Messtechnik GmbH
0013  *  e-Mail: armlinux@phytec.de
0014  *
0015  *  based on Intel Mainstone Board
0016  *
0017  *  Copyright 2007 Juergen Beisert @ Pengutronix (j.beisert@pengutronix.de)
0018  */
0019 
0020 #include <linux/irq.h>
0021 #include <linux/platform_device.h>
0022 #include <linux/mtd/physmap.h>
0023 #include <linux/spi/spi.h>
0024 #include <linux/spi/max7301.h>
0025 #include <linux/spi/pxa2xx_spi.h>
0026 #include <linux/leds.h>
0027 
0028 #include <asm/mach-types.h>
0029 #include <asm/mach/arch.h>
0030 #include "pxa27x.h"
0031 #include "pcm027.h"
0032 #include "generic.h"
0033 
0034 /*
0035  * ABSTRACT:
0036  *
0037  * The PXA270 processor comes with a bunch of hardware on its silicon.
0038  * Not all of this hardware can be used at the same time and not all
0039  * is routed to module's connectors. Also it depends on the baseboard, what
0040  * kind of hardware can be used in which way.
0041  * -> So this file supports the main devices on the CPU card only!
0042  * Refer pcm990-baseboard.c how to extend this features to get a full
0043  * blown system with many common interfaces.
0044  *
0045  * The PCM-027 supports the following interfaces through its connectors and
0046  * will be used in pcm990-baseboard.c:
0047  *
0048  * - LCD support
0049  * - MMC support
0050  * - IDE/CF card
0051  * - FFUART
0052  * - BTUART
0053  * - IRUART
0054  * - AC97
0055  * - SSP
0056  * - SSP3
0057  *
0058  * Claimed GPIOs:
0059  * GPIO0 -> IRQ input from RTC
0060  * GPIO2 -> SYS_ENA*)
0061  * GPIO3 -> PWR_SCL
0062  * GPIO4 -> PWR_SDA
0063  * GPIO5 -> PowerCap0*)
0064  * GPIO6 -> PowerCap1*)
0065  * GPIO7 -> PowerCap2*)
0066  * GPIO8 -> PowerCap3*)
0067  * GPIO15 -> /CS1
0068  * GPIO20 -> /CS2
0069  * GPIO21 -> /CS3
0070  * GPIO33 -> /CS5 network controller select
0071  * GPIO52 -> IRQ from network controller
0072  * GPIO78 -> /CS2
0073  * GPIO80 -> /CS4
0074  * GPIO90 -> LED0
0075  * GPIO91 -> LED1
0076  * GPIO114 -> IRQ from CAN controller
0077  * GPIO117 -> SCL
0078  * GPIO118 -> SDA
0079  *
0080  * *) CPU internal use only
0081  */
0082 
0083 static unsigned long pcm027_pin_config[] __initdata = {
0084     /* Chip Selects */
0085     GPIO20_nSDCS_2,
0086     GPIO21_nSDCS_3,
0087     GPIO15_nCS_1,
0088     GPIO78_nCS_2,
0089     GPIO80_nCS_4,
0090     GPIO33_nCS_5,   /* Ethernet */
0091 
0092     /* I2C */
0093     GPIO117_I2C_SCL,
0094     GPIO118_I2C_SDA,
0095 
0096     /* GPIO */
0097     GPIO52_GPIO,    /* IRQ from network controller */
0098 #ifdef CONFIG_LEDS_GPIO
0099     GPIO90_GPIO,    /* PCM027_LED_CPU */
0100     GPIO91_GPIO,    /* PCM027_LED_HEART_BEAT */
0101 #endif
0102     GPIO114_GPIO,   /* IRQ from CAN controller */
0103 };
0104 
0105 /*
0106  * SMC91x network controller specific stuff
0107  */
0108 static struct resource smc91x_resources[] = {
0109     [0] = {
0110         .start  = PCM027_ETH_PHYS + 0x300,
0111         .end    = PCM027_ETH_PHYS + PCM027_ETH_SIZE,
0112         .flags  = IORESOURCE_MEM,
0113     },
0114     [1] = {
0115         .start  = PCM027_ETH_IRQ,
0116         .end    = PCM027_ETH_IRQ,
0117         /* note: smc91x's driver doesn't use the trigger bits yet */
0118         .flags  = IORESOURCE_IRQ | PCM027_ETH_IRQ_EDGE,
0119     }
0120 };
0121 
0122 static struct platform_device smc91x_device = {
0123     .name       = "smc91x",
0124     .id     = 0,
0125     .num_resources  = ARRAY_SIZE(smc91x_resources),
0126     .resource   = smc91x_resources,
0127 };
0128 
0129 /*
0130  * SPI host and devices
0131  */
0132 static struct pxa2xx_spi_controller pxa_ssp_master_info = {
0133     .num_chipselect = 1,
0134 };
0135 
0136 static struct max7301_platform_data max7301_info = {
0137     .base = -1,
0138 };
0139 
0140 /* bus_num must match id in pxa2xx_set_spi_info() call */
0141 static struct spi_board_info spi_board_info[] __initdata = {
0142     {
0143         .modalias   = "max7301",
0144         .platform_data  = &max7301_info,
0145         .max_speed_hz   = 13000000,
0146         .bus_num    = 1,
0147         .chip_select    = 0,
0148         .mode       = SPI_MODE_0,
0149     },
0150 };
0151 
0152 /*
0153  * NOR flash
0154  */
0155 static struct physmap_flash_data pcm027_flash_data = {
0156     .width  = 4,
0157 };
0158 
0159 static struct resource pcm027_flash_resource = {
0160     .start          = PCM027_FLASH_PHYS,
0161     .end            = PCM027_FLASH_PHYS + PCM027_FLASH_SIZE - 1 ,
0162     .flags          = IORESOURCE_MEM,
0163 };
0164 
0165 static struct platform_device pcm027_flash = {
0166     .name           = "physmap-flash",
0167     .id             = 0,
0168     .dev            = {
0169         .platform_data  = &pcm027_flash_data,
0170     },
0171     .resource       = &pcm027_flash_resource,
0172     .num_resources  = 1,
0173 };
0174 
0175 #ifdef CONFIG_LEDS_GPIO
0176 
0177 static struct gpio_led pcm027_led[] = {
0178     {
0179         .name = "led0:red", /* FIXME */
0180         .gpio = PCM027_LED_CPU
0181     },
0182     {
0183         .name = "led1:green",   /* FIXME */
0184         .gpio = PCM027_LED_HEARD_BEAT
0185     },
0186 };
0187 
0188 static struct gpio_led_platform_data pcm027_led_data = {
0189     .num_leds   = ARRAY_SIZE(pcm027_led),
0190     .leds       = pcm027_led
0191 };
0192 
0193 static struct platform_device pcm027_led_dev = {
0194     .name       = "leds-gpio",
0195     .id     = 0,
0196     .dev        = {
0197         .platform_data  = &pcm027_led_data,
0198     },
0199 };
0200 
0201 #endif /* CONFIG_LEDS_GPIO */
0202 
0203 /*
0204  * declare the available device resources on this board
0205  */
0206 static struct platform_device *devices[] __initdata = {
0207     &smc91x_device,
0208     &pcm027_flash,
0209 #ifdef CONFIG_LEDS_GPIO
0210     &pcm027_led_dev
0211 #endif
0212 };
0213 
0214 /*
0215  * pcm027_init - breath some life into the board
0216  */
0217 static void __init pcm027_init(void)
0218 {
0219     /* system bus arbiter setting
0220      * - Core_Park
0221      * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
0222      */
0223     ARB_CNTRL = ARB_CORE_PARK | 0x234;
0224 
0225     pxa2xx_mfp_config(pcm027_pin_config, ARRAY_SIZE(pcm027_pin_config));
0226 
0227     pxa_set_ffuart_info(NULL);
0228     pxa_set_btuart_info(NULL);
0229     pxa_set_stuart_info(NULL);
0230 
0231     platform_add_devices(devices, ARRAY_SIZE(devices));
0232 
0233     /* at last call the baseboard to initialize itself */
0234 #ifdef CONFIG_MACH_PCM990_BASEBOARD
0235     pcm990_baseboard_init();
0236 #endif
0237 
0238     pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
0239     spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
0240 }
0241 
0242 static void __init pcm027_map_io(void)
0243 {
0244     pxa27x_map_io();
0245 
0246     /* initialize sleep mode regs (wake-up sources, etc) */
0247     PGSR0 = 0x01308000;
0248     PGSR1 = 0x00CF0002;
0249     PGSR2 = 0x0E294000;
0250     PGSR3 = 0x0000C000;
0251     PWER  = 0x40000000 | PWER_GPIO0 | PWER_GPIO1;
0252     PRER  = 0x00000000;
0253     PFER  = 0x00000003;
0254 }
0255 
0256 MACHINE_START(PCM027, "Phytec Messtechnik GmbH phyCORE-PXA270")
0257     /* Maintainer: Pengutronix */
0258     .atag_offset    = 0x100,
0259     .map_io     = pcm027_map_io,
0260     .nr_irqs    = PCM027_NR_IRQS,
0261     .init_irq   = pxa27x_init_irq,
0262     .handle_irq = pxa27x_handle_irq,
0263     .init_time  = pxa_timer_init,
0264     .init_machine   = pcm027_init,
0265     .restart    = pxa_restart,
0266 MACHINE_END