/* * Carsten Langgaard, carstenl@mips.com * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved. * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. * * OHIO specific setup. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include #include struct _hw_boot *OHIO_hw_boot = (struct _hw_boot *)OHIO_DEVICE_CONFIG_BASE; struct _hw_clock *OHIO_hw_clock = (struct _hw_clock *)OHIO_CLOCK_BASE; struct EMIF_register_memory_map *OHIO_EMIF_register_memory_map = (struct EMIF_register_memory_map *)OHIO_EMIF_BASE; struct _hw_gpio *OHIO_hw_gpio = (struct _hw_gpio *)OHIO_GPIO_BASE; struct _hw_i2c *OHIO_hw_i2c = (struct _hw_i2c *)OHIO_I2C_BASE; struct _irq_hw *OHIO_irq_hw = (struct _irq_hw *)OHIO_IRQ_CTRL_BASE; union _hw_non_reset *OHIO_hw_non_reset = (union _hw_non_reset *)OHIO_RESET_BASE; struct _timer_hw *OHIO_timer_hw[2] = { (struct _timer_hw *)OHIO_TIMER1_BASE, (struct _timer_hw *)OHIO_TIMER1_BASE }; struct _hw_uart *OHIO_hw_uart = (struct _hw_uart *)OHIO_UART0_BASE; struct _usb_hw *OHIO_usb_hw = (struct _usb_hw *)OHIO_USB_BASE; struct _usbdma_hw *OHIO_usbdma_hw = (struct _usbdma_hw *)OHIO_USBDMA_BASE; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #if defined(CONFIG_VLYNQ_SUPPORT) #include #include struct _vlynq_registers *OHIO_vlynq_registers = (struct _vlynq_registers *)OHIO_VLYNQ0_CTRL_BASE; #endif /*--- #if defined(CONFIG_VLYNQ_SUPPORT) ---*/ /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ extern void mips_reboot_setup(void); extern void mips_time_init(void); extern void mips_timer_setup(struct irqaction *irq); extern void ohio_clk_init(void); static void __init ohio_serial_init(void); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ const char *get_system_type(void) { return "MIPS OHIO"; } /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ static int __init ohio_setup(void) { ioport_resource.end = 0x7fffffff; /*--- prom_printf("[ohio_setup]\n"); ---*/ /*--- { ---*/ /*--- unsigned char test[] = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"; ---*/ /*--- printk("%% 12B: % 12B\n", test); ---*/ /*--- printk("%% 12.2B: % 12.2B\n", test); ---*/ /*--- printk("%%# 12.4B: %# 12.4B\n", test); ---*/ /*--- printk("little endian %%#- 12.4B: %#- 12.4B\n", test); ---*/ /*--- printk("big endian %%#+- 12.4B: %#+- 12.4B\n", test); ---*/ /*--- printk("%%-:12B: %-:12B\n", test); ---*/ /*--- } ---*/ ohio_reset_init(); ohio_clk_init(); ohio_serial_init(); #if defined(CONFIG_VLYNQ_SUPPORT) /*--- ohio_vlynq_init(); ---*/ #endif /*--- #if defined(CONFIG_VLYNQ_SUPPORT) ---*/ ohio_gpio_init(); board_time_init = mips_time_init; board_timer_setup = mips_timer_setup; mips_reboot_setup(); return 0; } early_initcall(ohio_setup); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ static void __init ohio_serial_init(void) { #ifdef CONFIG_SERIAL_8250 struct uart_port s; /*--- prom_printf("[ohio_serial_init]\n"); ---*/ memset(&s, 0, sizeof(s)); #ifdef CONFIG_CPU_LITTLE_ENDIAN /*--- s.membase = CPHYSADDR(OHIO_UART0_BASE); ---*/ s.membase = (unsigned char *)CKSEG1ADDR(OHIO_UART0_BASE); #else s.membase = CPHYSADDR(OHIO_UART0_BASE+3); #endif s.irq = OHIOINT_UART0; s.uartclk = ohio_get_clock(avm_clock_id_peripheral); /*--- s.fifosize = 1; ---*/ s.fifosize = 16; s.x_char = 'S' - ' '; /*--- s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; ---*/ s.flags = 0; s.line = 0; /*--- erster UART ---*/ s.type = PORT_OHIO; s.iotype = UPIO_MEM32; s.regshift = 2; if (early_serial_setup(&s) != 0) { printk(KERN_ERR "Serial setup failed!\n"); } #endif } /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #if defined(CONFIG_OHIO_CLOCK_SWITCH) unsigned int ohio_pre_init_system_clock_change(enum _avm_clock_id clock_id, unsigned int new_clk) { struct _hw_uart *U = (struct _hw_uart *)OHIO_UART0_BASE; unsigned int baud = ((new_clk / 2 / 38400) + 8) >> 4; /*--- printk("[ohio_pre_init_system_clock_change] called new_clk = %u start\n", new_clk); ---*/ U->lc.Register |= (1 << 7); /* dlab bit setzen */ U->data.tx.data = baud; U->ie.Register = baud >> 8; U->lc.Register &= ~(1 << 7); /* dlab bit setzen */ /*--- printk("[ohio_pre_init_system_clock_change] called new_clk = %u done\n", new_clk); ---*/ return 0; } #endif /*--- #if defined(CONFIG_OHIO_CLOCK_SWITCH) ---*/ /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ static int ohio_late_init(void) { printk("[ohio_late_init] \n"); #if defined(CONFIG_OHIO_CLOCK_SWITCH) ohio_get_clock_notify(avm_clock_id_system, ohio_pre_init_system_clock_change); #endif /*--- #if defined(CONFIG_OHIO_CLOCK_SWITCH) ---*/ return 0; } late_initcall(ohio_late_init); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ void ohio_pre_init(void) { struct _hw_uart *U = (struct _hw_uart *)OHIO_UART0_BASE; struct _hw_gpio *G = (struct _hw_gpio *)OHIO_GPIO_BASE; union _hw_non_reset *R = (union _hw_non_reset *)OHIO_RESET_BASE; struct _hw_clock *C = (struct _hw_clock *)OHIO_CLOCK_BASE; unsigned int baud = ((ohio_get_clock(avm_clock_id_peripheral) / 38400) + 8) >> 4; prom_printf("[ohio_pre_init] System Clk = %u Hz \n", ohio_get_clock(avm_clock_id_peripheral)); C->PDCR.Bits.ut0p = 0; C->PDCR.Bits.gpiop = 0; R->Bits.uart0_unreset = 1; R->Bits.gpio_unreset = 1; G->Direction.Bits.uart0_rd = 0; /*--- output ---*/ G->Direction.Bits.uart0_td = 0; /*--- output ---*/ G->Enable.Bits.uart0_rd = 0; /*--- funktion ---*/ G->Enable.Bits.uart0_td = 0; /*--- funktion ---*/ U->lc.Bits.ws = 3; /*--- 8 Bit ---*/ U->lc.Bits.dlab = 1; U->data.tx.data = baud; U->ie.Register = baud >> 8; U->lc.Bits.dlab = 0; board_time_init = mips_time_init; board_timer_setup = mips_timer_setup; memset((char *)0xA0000000, 0, 4096); /*--- internal ram loeschen ---*/ } /*--- Kernel-Schnittstelle für das neue LED-Modul ---*/ int (*led_event_action)(int, enum _led_event , unsigned int ) = NULL; EXPORT_SYMBOL(led_event_action);