Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * linux/arch/arm/mach-sa1100/shannon.c
0004  */
0005 
0006 #include <linux/init.h>
0007 #include <linux/device.h>
0008 #include <linux/gpio/machine.h>
0009 #include <linux/kernel.h>
0010 #include <linux/platform_data/sa11x0-serial.h>
0011 #include <linux/tty.h>
0012 #include <linux/mtd/mtd.h>
0013 #include <linux/mtd/partitions.h>
0014 #include <linux/regulator/fixed.h>
0015 #include <linux/regulator/machine.h>
0016 
0017 #include <video/sa1100fb.h>
0018 
0019 #include <mach/hardware.h>
0020 #include <asm/mach-types.h>
0021 #include <asm/setup.h>
0022 
0023 #include <asm/mach/arch.h>
0024 #include <asm/mach/flash.h>
0025 #include <asm/mach/map.h>
0026 #include <linux/platform_data/mfd-mcp-sa11x0.h>
0027 #include <mach/shannon.h>
0028 #include <mach/irqs.h>
0029 
0030 #include "generic.h"
0031 
0032 static struct mtd_partition shannon_partitions[] = {
0033     {
0034         .name       = "BLOB boot loader",
0035         .offset     = 0,
0036         .size       = 0x20000
0037     },
0038     {
0039         .name       = "kernel",
0040         .offset     = MTDPART_OFS_APPEND,
0041         .size       = 0xe0000
0042     },
0043     {
0044         .name       = "initrd",
0045         .offset     = MTDPART_OFS_APPEND,   
0046         .size       = MTDPART_SIZ_FULL
0047     }
0048 };
0049 
0050 static struct flash_platform_data shannon_flash_data = {
0051     .map_name   = "cfi_probe",
0052     .parts      = shannon_partitions,
0053     .nr_parts   = ARRAY_SIZE(shannon_partitions),
0054 };
0055 
0056 static struct resource shannon_flash_resource =
0057     DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_4M);
0058 
0059 static struct mcp_plat_data shannon_mcp_data = {
0060     .mccr0      = MCCR0_ADM,
0061     .sclk_rate  = 11981000,
0062 };
0063 
0064 static struct sa1100fb_mach_info shannon_lcd_info = {
0065     .pixclock   = 152500,   .bpp        = 8,
0066     .xres       = 640,      .yres       = 480,
0067 
0068     .hsync_len  = 4,        .vsync_len  = 3,
0069     .left_margin    = 2,        .upper_margin   = 0,
0070     .right_margin   = 1,        .lower_margin   = 0,
0071 
0072     .sync       = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
0073 
0074     .lccr0      = LCCR0_Color | LCCR0_Dual | LCCR0_Pas,
0075     .lccr3      = LCCR3_ACBsDiv(512),
0076 };
0077 
0078 static struct gpiod_lookup_table shannon_pcmcia0_gpio_table = {
0079     .dev_id = "sa11x0-pcmcia.0",
0080     .table = {
0081         GPIO_LOOKUP("gpio", 24, "detect", GPIO_ACTIVE_LOW),
0082         GPIO_LOOKUP("gpio", 26, "ready", GPIO_ACTIVE_HIGH),
0083         { },
0084     },
0085 };
0086 
0087 static struct gpiod_lookup_table shannon_pcmcia1_gpio_table = {
0088     .dev_id = "sa11x0-pcmcia.1",
0089     .table = {
0090         GPIO_LOOKUP("gpio", 25, "detect", GPIO_ACTIVE_LOW),
0091         GPIO_LOOKUP("gpio", 27, "ready", GPIO_ACTIVE_HIGH),
0092         { },
0093     },
0094 };
0095 
0096 static struct regulator_consumer_supply shannon_cf_vcc_consumers[] = {
0097     REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.0"),
0098     REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.1"),
0099 };
0100 
0101 static struct fixed_voltage_config shannon_cf_vcc_pdata __initdata = {
0102     .supply_name = "cf-power",
0103     .microvolts = 3300000,
0104     .enabled_at_boot = 1,
0105 };
0106 
0107 static struct gpiod_lookup_table shannon_display_gpio_table = {
0108     .dev_id = "sa11x0-fb",
0109     .table = {
0110         GPIO_LOOKUP("gpio", 22, "shannon-lcden", GPIO_ACTIVE_HIGH),
0111         { },
0112     },
0113 };
0114 
0115 static void __init shannon_init(void)
0116 {
0117     sa11x0_register_fixed_regulator(0, &shannon_cf_vcc_pdata,
0118                     shannon_cf_vcc_consumers,
0119                     ARRAY_SIZE(shannon_cf_vcc_consumers),
0120                     false);
0121     sa11x0_register_pcmcia(0, &shannon_pcmcia0_gpio_table);
0122     sa11x0_register_pcmcia(1, &shannon_pcmcia1_gpio_table);
0123     sa11x0_ppc_configure_mcp();
0124     gpiod_add_lookup_table(&shannon_display_gpio_table);
0125     sa11x0_register_lcd(&shannon_lcd_info);
0126     sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1);
0127     sa11x0_register_mcp(&shannon_mcp_data);
0128 }
0129 
0130 static void __init shannon_map_io(void)
0131 {
0132     sa1100_map_io();
0133 
0134     sa1100_register_uart(0, 3);
0135     sa1100_register_uart(1, 1);
0136 
0137     Ser1SDCR0 |= SDCR0_SUS;
0138     GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
0139     GPDR |= GPIO_UART_TXD | SHANNON_GPIO_CODEC_RESET;
0140     GPDR &= ~GPIO_UART_RXD;
0141     PPAR |= PPAR_UPR;
0142 
0143     /* reset the codec */
0144     GPCR = SHANNON_GPIO_CODEC_RESET;
0145     GPSR = SHANNON_GPIO_CODEC_RESET;
0146 }
0147 
0148 MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)")
0149     .atag_offset    = 0x100,
0150     .map_io     = shannon_map_io,
0151     .nr_irqs    = SA1100_NR_IRQS,
0152     .init_irq   = sa1100_init_irq,
0153     .init_time  = sa1100_timer_init,
0154     .init_machine   = shannon_init,
0155     .init_late  = sa11x0_init_late,
0156     .restart    = sa11x0_restart,
0157 MACHINE_END