From 463837f55aa8cb556969e828e1687eb9f591195f Mon Sep 17 00:00:00 2001 From: Stanislav Vorobiov Date: Tue, 3 Jul 2012 16:21:20 +0400 Subject: [PATCH] Added I/O port support to Tizen VPCI --- arch/arm/Kconfig | 1 + arch/arm/configs/tizen_defconfig | 17 ++++++++++++----- arch/arm/mach-exynos/common.c | 6 ++++++ arch/arm/mach-exynos/include/mach/io.h | 18 ++++++++++++++++++ arch/arm/mach-exynos/tizen-vpci.c | 11 ++++++----- arch/arm/mach-exynos/tizen-vpci.h | 9 +++++---- 6 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 arch/arm/mach-exynos/include/mach/io.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ae53a038e399..86529240951c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -890,6 +890,7 @@ config ARCH_EXYNOS select HAVE_S3C_RTC if RTC_CLASS select HAVE_S3C2410_I2C if I2C select HAVE_S3C2410_WATCHDOG if WATCHDOG + select NEED_MACH_IO_H select NEED_MACH_MEMORY_H help Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5) diff --git a/arch/arm/configs/tizen_defconfig b/arch/arm/configs/tizen_defconfig index c87c98899fd6..e9551caebb57 100644 --- a/arch/arm/configs/tizen_defconfig +++ b/arch/arm/configs/tizen_defconfig @@ -1,3 +1,7 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 3.4.0 Kernel Configuration +# CONFIG_ARM=y CONFIG_MIGHT_HAVE_PCI=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -22,6 +26,7 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_VECTORS_BASE=0xffff0000 CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_NEED_MACH_IO_H=y CONFIG_NEED_MACH_MEMORY_H=y CONFIG_GENERIC_BUG=y CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" @@ -74,7 +79,6 @@ CONFIG_TREE_PREEMPT_RCU=y CONFIG_PREEMPT_RCU=y CONFIG_RCU_FANOUT=32 # CONFIG_RCU_FANOUT_EXACT is not set -# CONFIG_RCU_FAST_NO_HZ is not set # CONFIG_TREE_RCU_TRACE is not set # CONFIG_RCU_BOOST is not set # CONFIG_IKCONFIG is not set @@ -310,6 +314,7 @@ CONFIG_S3C_DEV_HSMMC1=y CONFIG_S3C_DEV_HSMMC2=y CONFIG_S3C_DEV_HSMMC3=y CONFIG_S3C_DEV_I2C1=y +CONFIG_S3C_DEV_I2C3=y CONFIG_S3C_DEV_I2C5=y CONFIG_S3C_DEV_I2C6=y CONFIG_S3C_DEV_I2C7=y @@ -369,7 +374,7 @@ CONFIG_ARCH_EXYNOS4=y CONFIG_CPU_EXYNOS4210=y CONFIG_SOC_EXYNOS4212=y CONFIG_SOC_EXYNOS4412=y -# CONFIG_EXYNOS4_MCT is not set +CONFIG_EXYNOS4_MCT=y CONFIG_TIZEN_PWM=y CONFIG_EXYNOS4_DEV_DMA=y CONFIG_EXYNOS4_DEV_AHCI=y @@ -377,6 +382,7 @@ CONFIG_EXYNOS4_SETUP_FIMD0=y CONFIG_EXYNOS4_DEV_SYSMMU=y CONFIG_EXYNOS4_DEV_USB_OHCI=y CONFIG_EXYNOS4_SETUP_I2C1=y +CONFIG_EXYNOS4_SETUP_I2C3=y CONFIG_EXYNOS4_SETUP_I2C5=y CONFIG_EXYNOS4_SETUP_I2C6=y CONFIG_EXYNOS4_SETUP_I2C7=y @@ -493,7 +499,6 @@ CONFIG_TIZEN_VPCI=y # # Kernel Features # -# CONFIG_TICK_ONESHOT is not set # CONFIG_NO_HZ is not set # CONFIG_HIGH_RES_TIMERS is not set CONFIG_GENERIC_CLOCKEVENTS_BUILD=y @@ -507,7 +512,7 @@ CONFIG_HAVE_ARM_SCU=y # CONFIG_VMSPLIT_3G is not set CONFIG_VMSPLIT_2G=y # CONFIG_VMSPLIT_1G is not set -CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_PAGE_OFFSET=0x80000000 CONFIG_NR_CPUS=2 CONFIG_HOTPLUG_CPU=y # CONFIG_LOCAL_TIMERS is not set @@ -1086,6 +1091,7 @@ CONFIG_NET_CORE=y # CONFIG_EQUALIZER is not set # CONFIG_NET_FC is not set CONFIG_MII=y +# CONFIG_IFB is not set # CONFIG_NET_TEAM is not set # CONFIG_MACVLAN is not set # CONFIG_NETCONSOLE is not set @@ -1264,6 +1270,7 @@ CONFIG_PHYLIB=y # CONFIG_USB_PEGASUS is not set # CONFIG_USB_RTL8150 is not set # CONFIG_USB_USBNET is not set +# CONFIG_USB_CDC_PHONET is not set # CONFIG_USB_IPHETH is not set CONFIG_WLAN=y # CONFIG_ATMEL is not set @@ -1811,6 +1818,7 @@ CONFIG_RADIO_ADAPTERS=y # # Graphics support # +# CONFIG_VGA_ARB is not set CONFIG_DRM=y CONFIG_DRM_KMS_HELPER=y # CONFIG_DRM_LOAD_EDID_FIRMWARE is not set @@ -1925,7 +1933,6 @@ CONFIG_SND_SEQUENCER=y # CONFIG_SND_MIXER_OSS is not set # CONFIG_SND_PCM_OSS is not set # CONFIG_SND_SEQUENCER_OSS is not set -# CONFIG_SND_HRTIMER is not set # CONFIG_SND_DYNAMIC_MINORS is not set CONFIG_SND_SUPPORT_OLD_API=y CONFIG_SND_VERBOSE_PROCFS=y diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index f6bc922fed31..ad64ecb7d007 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -309,6 +309,12 @@ void __init exynos_init_io(struct map_desc *mach_desc, int size) #ifdef CONFIG_TIZEN_VPCI static struct map_desc tizen_vpci_iodesc[] __initdata = { + { + .virtual = (unsigned long)TIZEN_VPCI_IO_VIRT_BASE, + .pfn = __phys_to_pfn(TIZEN_VPCI_IO_BASE), + .length = TIZEN_VPCI_IO_BASE_SIZE, + .type = MT_DEVICE, + }, { .virtual = (unsigned long)TIZEN_VPCI_CFG_VIRT_BASE, .pfn = __phys_to_pfn(TIZEN_VPCI_CFG_BASE), diff --git a/arch/arm/mach-exynos/include/mach/io.h b/arch/arm/mach-exynos/include/mach/io.h new file mode 100644 index 000000000000..38ba4b49a0b2 --- /dev/null +++ b/arch/arm/mach-exynos/include/mach/io.h @@ -0,0 +1,18 @@ +/* + * arch/arm/mach-exynos4/include/mach/io.h + */ + +#ifndef __ASM_ARCH_IO_H +#define __ASM_ARCH_IO_H + +#ifdef CONFIG_TIZEN_VPCI +#define IO_SPACE_LIMIT 0xffffffff + +#define TIZEN_VPCI_IO_VIRT_BASE (void __iomem *)0xf4ff0000ul + +#define __io(a) ((void __iomem *)(TIZEN_VPCI_IO_VIRT_BASE + (a))) +#else +#define __io(a) __typesafe_io(a) +#endif + +#endif diff --git a/arch/arm/mach-exynos/tizen-vpci.c b/arch/arm/mach-exynos/tizen-vpci.c index 1aff9717f900..ea4eff02481c 100644 --- a/arch/arm/mach-exynos/tizen-vpci.c +++ b/arch/arm/mach-exynos/tizen-vpci.c @@ -139,8 +139,8 @@ static struct pci_ops tizen_vpci_ops = { static struct resource io_mem = { .name = "PCI I/O space", - .start = TIZEN_VPCI_MEM_BASE0, - .end = TIZEN_VPCI_MEM_BASE0+TIZEN_VPCI_MEM_BASE0_SIZE-1, + .start = TIZEN_VPCI_IO_OFFSET, + .end = TIZEN_VPCI_IO_BASE_SIZE-1, .flags = IORESOURCE_IO, }; @@ -162,7 +162,7 @@ static int __init tizen_vpci_setup_resources(struct pci_sys_data *sys) { int ret = 0; - ret = request_resource(&iomem_resource, &io_mem); + ret = request_resource(&ioport_resource, &io_mem); if (ret) { printk(KERN_ERR "PCI: unable to allocate I/O " "memory region (%d)\n", ret); @@ -210,6 +210,7 @@ int __init tizen_vpci_setup(int nr, struct pci_sys_data *sys) if (nr == 0) { sys->mem_offset = 0; + sys->io_offset = 0; ret = tizen_vpci_setup_resources(sys); if (ret < 0) { printk("tizen_vpci_setup: resources... oops?\n"); @@ -272,8 +273,8 @@ struct pci_bus * __init tizen_vpci_scan_bus(int nr, struct pci_sys_data *sys) void __init tizen_vpci_preinit(void) { - pcibios_min_io = TIZEN_VPCI_MEM_BASE0_SIZE; - pcibios_min_mem = TIZEN_VPCI_MEM_BASE1_SIZE; + pcibios_min_io = TIZEN_VPCI_IO_OFFSET; + pcibios_min_mem = TIZEN_VPCI_MEM_BASE1; } static int __init tizen_vpci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) diff --git a/arch/arm/mach-exynos/tizen-vpci.h b/arch/arm/mach-exynos/tizen-vpci.h index 752716007325..4a8d6d491a5d 100644 --- a/arch/arm/mach-exynos/tizen-vpci.h +++ b/arch/arm/mach-exynos/tizen-vpci.h @@ -13,14 +13,15 @@ /* PCI space */ #define TIZEN_VPCI_CFG_BASE 0xC2000000 -#define TIZEN_VPCI_MEM_BASE0 0xC3000000 +#define TIZEN_VPCI_IO_BASE 0xC3000000 +#define TIZEN_VPCI_IO_OFFSET 0x00000100 /* 256b */ #define TIZEN_VPCI_MEM_BASE1 0xD0000000 #define TIZEN_VPCI_MEM_BASE2 0xE0000000 /* Sizes of above maps */ #define TIZEN_VPCI_CFG_BASE_SIZE 0x01000000 -#define TIZEN_VPCI_MEM_BASE0_SIZE 0x0C000000 /* 32Mb */ -#define TIZEN_VPCI_MEM_BASE1_SIZE 0x10000000 /* 256Mb */ -#define TIZEN_VPCI_MEM_BASE2_SIZE 0x10000000 /* 256Mb */ +#define TIZEN_VPCI_IO_BASE_SIZE 0x0000FFFF /* 64Kb */ +#define TIZEN_VPCI_MEM_BASE1_SIZE 0x10000000 /* 256Mb */ +#define TIZEN_VPCI_MEM_BASE2_SIZE 0x10000000 /* 256Mb */ /* PCI interrupts */ #define TIZEN_VPCI_IRQ0 IRQ_EINT(8) -- 2.34.1