1/* 2 * linux/arch/arm/mach-sa1100/adsbitsy.c 3 * 4 * Author: Woojung Huh 5 * 6 * Pieces specific to the ADS Bitsy 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License version 2 as 10 * published by the Free Software Foundation. 11 */ 12 13#include <linux/init.h> 14#include <linux/sched.h> 15#include <linux/interrupt.h> 16#include <linux/ptrace.h> 17#include <linux/serial_core.h> 18 19#include <asm/hardware.h> 20#include <asm/setup.h> 21#include <asm/irq.h> 22 23#include <asm/mach/irq.h> 24#include <asm/mach/arch.h> 25#include <asm/mach/map.h> 26#include <asm/mach/serial_sa1100.h> 27 28#include <asm/arch/irq.h> 29 30#include "generic.h" 31#include "sa1111.h" 32 33static int __init adsbitsy_init(void) 34{ 35 int ret; 36 37 if (!machine_is_adsbitsy()) 38 return -ENODEV; 39 40 /* 41 * Ensure that the memory bus request/grant signals are setup, 42 * and the grant is held in its inactive state 43 */ 44 sa1110_mb_disable(); 45 46 /* 47 * Reset SA1111 48 */ 49 GPCR |= GPIO_GPIO26; 50 udelay(1000); 51 GPSR |= GPIO_GPIO26; 52 53 /* 54 * Probe for SA1111. 55 */ 56 ret = sa1111_probe(ADSBITSY_SA1111_BASE); 57 if (ret < 0) 58 return ret; 59 60 /* 61 * We found it. Wake the chip up. 62 */ 63 sa1111_wake(); 64 65 /* 66 * The SDRAM configuration of the SA1110 and the SA1111 must 67 * match. This is very important to ensure that SA1111 accesses 68 * don't corrupt the SDRAM. Note that this ungates the SA1111's 69 * MBGNT signal, so we must have called sa1110_mb_disable() 70 * beforehand. 71 */ 72 sa1111_configure_smc(1, 73 FExtr(MDCNFG, MDCNFG_SA1110_DRAC0), 74 FExtr(MDCNFG, MDCNFG_SA1110_TDL0)); 75 76 /* 77 * Enable PWM control for LCD 78 */ 79 SKPCR |= SKPCR_PWMCLKEN; 80 SKPWM0 = 0x7F; // VEE 81 SKPEN0 = 1; 82 SKPWM1 = 0x01; // Backlight 83 SKPEN1 = 1; 84 85 /* 86 * We only need to turn on DCLK whenever we want to use the 87 * DMA. It can otherwise be held firmly in the off position. 88 */ 89 SKPCR |= SKPCR_DCLKEN; 90 91 /* 92 * Enable the SA1110 memory bus request and grant signals. 93 */ 94 sa1110_mb_enable(); 95 96 set_GPIO_IRQ_edge(GPIO_GPIO0, GPIO_RISING_EDGE); 97 sa1111_init_irq(IRQ_GPIO0); 98 99 return 0; 100} 101 102__initcall(adsbitsy_init); 103 104static void __init adsbitsy_init_irq(void) 105{ 106 /* First the standard SA1100 IRQs */ 107 sa1100_init_irq(); 108} 109 110 111/* 112 * Initialization fixup 113 */ 114 115static void __init 116fixup_adsbitsy(struct machine_desc *desc, struct param_struct *params, 117 char **cmdline, struct meminfo *mi) 118{ 119 SET_BANK( 0, 0xc0000000, 32*1024*1024 ); 120 mi->nr_banks = 1; 121 122 ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); 123 setup_ramdisk( 1, 0, 0, 8192 ); 124 setup_initrd( __phys_to_virt(0xc0800000), 4*1024*1024 ); 125} 126 127static struct map_desc adsbitsy_io_desc[] __initdata = { 128 /* virtual physical length domain r w c b */ 129 { 0xe8000000, 0x08000000, 0x01000000, DOMAIN_IO, 0, 1, 0, 0 }, /* Flash bank 1 */ 130 { 0xf4000000, 0x18000000, 0x00800000, DOMAIN_IO, 0, 1, 0, 0 }, /* SA1111 */ 131 LAST_DESC 132}; 133 134static int adsbitsy_uart_open(struct uart_port *port, struct uart_info *info) 135{ 136 if (port->mapbase == _Ser1UTCR0) { 137 Ser1SDCR0 |= SDCR0_UART; 138#error Fixme // Set RTS High (should be done in the set_mctrl fn) 139 GPCR = GPIO_GPIO15; 140 } else if (port->mapbase == _Ser2UTCR0) { 141 Ser2UTCR4 = Ser2HSCR0 = 0; 142#error Fixme // Set RTS High (should be done in the set_mctrl fn) 143 GPCR = GPIO_GPIO17; 144 } else if (port->mapbase == _Ser2UTCR0) { 145#error Fixme // Set RTS High (should be done in the set_mctrl fn) 146 GPCR = GPIO_GPIO19; 147 } 148 return 0; 149} 150 151static struct sa1100_port_fns adsbitsy_port_fns __initdata = { 152 open: adsbitsy_uart_open, 153}; 154 155static void __init adsbitsy_map_io(void) 156{ 157 sa1100_map_io(); 158 iotable_init(adsbitsy_io_desc); 159 160 sa1100_register_uart_fns(&adsbitsy_port_fns); 161 sa1100_register_uart(0, 3); 162 sa1100_register_uart(1, 1); 163 sa1100_register_uart(2, 2); 164 GPDR |= GPIO_GPIO15 | GPIO_GPIO17 | GPIO_GPIO19; 165 GPDR &= ~(GPIO_GPIO14 | GPIO_GPIO16 | GPIO_GPIO18); 166} 167 168MACHINE_START(ADSBITSY, "ADS Bitsy") 169 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) 170 FIXUP(fixup_adsbitsy) 171 MAPIO(adsbitsy_map_io) 172 INITIRQ(adsbitsy_init_irq) 173MACHINE_END 174