Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i.MX2 family: Add basic mach support (sources)

This patch adds basic mach support for the mx2 processor family, based
on the original freescale code and adapted to mainline kernel coding
style.

Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>

authored by

Juergen Beisert and committed by
Robert Schwebel
eea643f7 aa10abd3

+152
+5
arch/arm/mach-mx2/Kconfig
··· 1 + comment "MX2 family CPU support" 2 + depends on ARCH_MX2 3 + 4 + comment "MX2 Platforms" 5 + depends on ARCH_MX2
+7
arch/arm/mach-mx2/Makefile
··· 1 + # 2 + # Makefile for the linux kernel. 3 + # 4 + 5 + # Object file lists. 6 + 7 + obj-y := system.o generic.o
+3
arch/arm/mach-mx2/Makefile.boot
··· 1 + zreladdr-y := 0xA0008000 2 + params_phys-y := 0xA0000100 3 + initrd_phys-y := 0xA0800000
+74
arch/arm/mach-mx2/generic.c
··· 1 + /* 2 + * generic.c 3 + * 4 + * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License 8 + * as published by the Free Software Foundation; either version 2 9 + * of the License, or (at your option) any later version. 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, write to the Free Software 17 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 18 + * MA 02110-1301, USA. 19 + */ 20 + 21 + #include <linux/mm.h> 22 + #include <linux/init.h> 23 + #include <asm/hardware.h> 24 + #include <asm/pgtable.h> 25 + #include <asm/mach/map.h> 26 + 27 + /* MX27 memory map definition */ 28 + static struct map_desc mxc_io_desc[] __initdata = { 29 + /* 30 + * this fixed mapping covers: 31 + * - AIPI1 32 + * - AIPI2 33 + * - AITC 34 + * - ROM Patch 35 + * - and some reserved space 36 + */ 37 + { 38 + .virtual = AIPI_BASE_ADDR_VIRT, 39 + .pfn = __phys_to_pfn(AIPI_BASE_ADDR), 40 + .length = AIPI_SIZE, 41 + .type = MT_DEVICE 42 + }, 43 + /* 44 + * this fixed mapping covers: 45 + * - CSI 46 + * - ATA 47 + */ 48 + { 49 + .virtual = SAHB1_BASE_ADDR_VIRT, 50 + .pfn = __phys_to_pfn(SAHB1_BASE_ADDR), 51 + .length = SAHB1_SIZE, 52 + .type = MT_DEVICE 53 + }, 54 + /* 55 + * this fixed mapping covers: 56 + * - EMI 57 + */ 58 + { 59 + .virtual = X_MEMC_BASE_ADDR_VIRT, 60 + .pfn = __phys_to_pfn(X_MEMC_BASE_ADDR), 61 + .length = X_MEMC_SIZE, 62 + .type = MT_DEVICE 63 + } 64 + }; 65 + 66 + /* 67 + * Initialize the memory map. It is called during the 68 + * system startup to create static physical to virtual 69 + * memory map for the IO modules. 70 + */ 71 + void __init mxc_map_io(void) 72 + { 73 + iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 74 + }
+63
arch/arm/mach-mx2/system.c
··· 1 + /* 2 + * Copyright (C) 1999 ARM Limited 3 + * Copyright (C) 2000 Deep Blue Solutions Ltd 4 + * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved. 5 + * Copyright 2008 Juergen Beisert, kernel@pengutronix.de 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + * 17 + * You should have received a copy of the GNU General Public License 18 + * along with this program; if not, write to the Free Software 19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 + */ 21 + 22 + #include <linux/kernel.h> 23 + #include <linux/clk.h> 24 + #include <linux/io.h> 25 + 26 + #include <asm/arch/hardware.h> 27 + #include <asm/proc-fns.h> 28 + #include <asm/system.h> 29 + 30 + /* 31 + * Put the CPU into idle mode. It is called by default_idle() 32 + * in process.c file. 33 + */ 34 + void arch_idle(void) 35 + { 36 + /* 37 + * This should do all the clock switching 38 + * and wait for interrupt tricks. 39 + */ 40 + cpu_do_idle(); 41 + } 42 + 43 + #define WDOG_WCR_REG IO_ADDRESS(WDOG_BASE_ADDR) 44 + #define WDOG_WCR_SRS (1 << 4) 45 + 46 + /* 47 + * Reset the system. It is called by machine_restart(). 48 + */ 49 + void arch_reset(char mode) 50 + { 51 + struct clk *clk; 52 + 53 + clk = clk_get(NULL, "wdog_clk"); 54 + if (!clk) { 55 + printk(KERN_ERR"Cannot activate the watchdog. Giving up\n"); 56 + return; 57 + } 58 + 59 + clk_enable(clk); 60 + 61 + /* Assert SRS signal */ 62 + __raw_writew(__raw_readw(WDOG_WCR_REG) & ~WDOG_WCR_SRS, WDOG_WCR_REG); 63 + }