diff options
author | Yunhong Jiang <yunhong.jiang@intel.com> | 2015-08-04 12:17:53 -0700 |
---|---|---|
committer | Yunhong Jiang <yunhong.jiang@intel.com> | 2015-08-04 15:44:42 -0700 |
commit | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch) | |
tree | 1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/arch/arm/mach-gemini/devices.c | |
parent | 98260f3884f4a202f9ca5eabed40b1354c489b29 (diff) |
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base.
It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and
the base is:
commit 0917f823c59692d751951bf5ea699a2d1e2f26a2
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Sat Jul 25 12:13:34 2015 +0200
Prepare v4.1.3-rt3
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
We lose all the git history this way and it's not good. We
should apply another opnfv project repo in future.
Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/arch/arm/mach-gemini/devices.c')
-rw-r--r-- | kernel/arch/arm/mach-gemini/devices.c | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/kernel/arch/arm/mach-gemini/devices.c b/kernel/arch/arm/mach-gemini/devices.c new file mode 100644 index 000000000..5cff29818 --- /dev/null +++ b/kernel/arch/arm/mach-gemini/devices.c @@ -0,0 +1,118 @@ +/* + * Common devices definition for Gemini + * + * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/platform_device.h> +#include <linux/serial_8250.h> +#include <linux/mtd/physmap.h> + +#include <mach/irqs.h> +#include <mach/hardware.h> +#include <mach/global_reg.h> + +static struct plat_serial8250_port serial_platform_data[] = { + { + .membase = (void *)IO_ADDRESS(GEMINI_UART_BASE), + .mapbase = GEMINI_UART_BASE, + .irq = IRQ_UART, + .uartclk = UART_CLK, + .regshift = 2, + .iotype = UPIO_MEM, + .type = PORT_16550A, + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_FIXED_TYPE, + }, + {}, +}; + +static struct platform_device serial_device = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM, + .dev = { + .platform_data = serial_platform_data, + }, +}; + +int platform_register_uart(void) +{ + return platform_device_register(&serial_device); +} + +static struct resource flash_resource = { + .start = GEMINI_FLASH_BASE, + .flags = IORESOURCE_MEM, +}; + +static struct physmap_flash_data pflash_platform_data = {}; + +static struct platform_device pflash_device = { + .name = "physmap-flash", + .id = 0, + .dev = { + .platform_data = &pflash_platform_data, + }, + .resource = &flash_resource, + .num_resources = 1, +}; + +int platform_register_pflash(unsigned int size, struct mtd_partition *parts, + unsigned int nr_parts) +{ + unsigned int reg; + + reg = __raw_readl(IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_STATUS); + + if ((reg & FLASH_TYPE_MASK) != FLASH_TYPE_PARALLEL) + return -ENXIO; + + if (reg & FLASH_WIDTH_16BIT) + pflash_platform_data.width = 2; + else + pflash_platform_data.width = 1; + + /* enable parallel flash pins and disable others */ + reg = __raw_readl(IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL); + reg &= ~PFLASH_PADS_DISABLE; + reg |= SFLASH_PADS_DISABLE | NAND_PADS_DISABLE; + __raw_writel(reg, IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL); + + flash_resource.end = flash_resource.start + size - 1; + + pflash_platform_data.parts = parts; + pflash_platform_data.nr_parts = nr_parts; + + return platform_device_register(&pflash_device); +} + +static struct resource gemini_rtc_resources[] = { + [0] = { + .start = GEMINI_RTC_BASE, + .end = GEMINI_RTC_BASE + 0x24, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_RTC, + .end = IRQ_RTC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device gemini_rtc_device = { + .name = "rtc-gemini", + .id = 0, + .num_resources = ARRAY_SIZE(gemini_rtc_resources), + .resource = gemini_rtc_resources, +}; + +int __init platform_register_rtc(void) +{ + return platform_device_register(&gemini_rtc_device); +} + |