diff options
Diffstat (limited to 'arch/arm')
71 files changed, 267 insertions, 2148 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 6d4d4385848..884768cb533 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -273,7 +273,7 @@ config ARCH_INTEGRATOR  	select ARM_AMBA  	select ARCH_HAS_CPUFREQ  	select COMMON_CLK -	select CLK_VERSATILE +	select COMMON_CLK_VERSATILE  	select HAVE_TCM  	select ICST  	select GENERIC_CLOCKEVENTS @@ -288,13 +288,12 @@ config ARCH_INTEGRATOR  config ARCH_REALVIEW  	bool "ARM Ltd. RealView family"  	select ARM_AMBA -	select CLKDEV_LOOKUP -	select HAVE_MACH_CLKDEV +	select COMMON_CLK +	select COMMON_CLK_VERSATILE  	select ICST  	select GENERIC_CLOCKEVENTS  	select ARCH_WANT_OPTIONAL_GPIOLIB  	select PLAT_VERSATILE -	select PLAT_VERSATILE_CLOCK  	select PLAT_VERSATILE_CLCD  	select ARM_TIMER_SP804  	select GPIO_PL061 if GPIOLIB @@ -2290,7 +2289,7 @@ menu "Power management options"  source "kernel/power/Kconfig"  config ARCH_SUSPEND_POSSIBLE -	depends on !ARCH_S5PC100 && !ARCH_TEGRA +	depends on !ARCH_S5PC100  	depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \  		CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK  	def_bool y diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 81769c1341f..bc67cbff394 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -653,6 +653,7 @@ __armv7_mmu_cache_on:  		mcrne	p15, 0, r0, c8, c7, 0	@ flush I,D TLBs  #endif  		mrc	p15, 0, r0, c1, c0, 0	@ read control reg +		bic	r0, r0, #1 << 28	@ clear SCTLR.TRE  		orr	r0, r0, #0x5000		@ I-cache enable, RR cache replacement  		orr	r0, r0, #0x003c		@ write buffer  #ifdef CONFIG_MMU diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi index 66389c1c6f6..7c95f76398d 100644 --- a/arch/arm/boot/dts/at91sam9260.dtsi +++ b/arch/arm/boot/dts/at91sam9260.dtsi @@ -104,6 +104,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioB: gpio@fffff600 { @@ -113,6 +114,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioC: gpio@fffff800 { @@ -122,6 +124,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			dbgu: serial@fffff200 { diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index b460d6ce9eb..195019b7ca0 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi @@ -95,6 +95,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioB: gpio@fffff400 { @@ -104,6 +105,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioC: gpio@fffff600 { @@ -113,6 +115,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioD: gpio@fffff800 { @@ -122,6 +125,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioE: gpio@fffffa00 { @@ -131,6 +135,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			dbgu: serial@ffffee00 { diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index bafa8806fc1..63751b1e744 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -113,6 +113,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioB: gpio@fffff400 { @@ -122,6 +123,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioC: gpio@fffff600 { @@ -131,6 +133,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioD: gpio@fffff800 { @@ -140,6 +143,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioE: gpio@fffffa00 { @@ -149,6 +153,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			dbgu: serial@ffffee00 { diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index bfac0dfc332..ef9336ae961 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi @@ -107,6 +107,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioB: gpio@fffff600 { @@ -116,6 +117,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioC: gpio@fffff800 { @@ -125,6 +127,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioD: gpio@fffffa00 { @@ -134,6 +137,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			dbgu: serial@fffff200 { diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 4a18c393b13..8a387a8d61b 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi @@ -115,6 +115,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioB: gpio@fffff600 { @@ -124,6 +125,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioC: gpio@fffff800 { @@ -133,6 +135,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			pioD: gpio@fffffa00 { @@ -142,6 +145,7 @@  				#gpio-cells = <2>;  				gpio-controller;  				interrupt-controller; +				#interrupt-cells = <2>;  			};  			dbgu: serial@fffff200 { diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index 0cab47d4a83..2fde5fd1acc 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h @@ -404,6 +404,7 @@  #define __NR_setns			(__NR_SYSCALL_BASE+375)  #define __NR_process_vm_readv		(__NR_SYSCALL_BASE+376)  #define __NR_process_vm_writev		(__NR_SYSCALL_BASE+377) +					/* 378 for kcmp */  /*   * The following SWIs are ARM private. @@ -483,6 +484,7 @@   */  #define __IGNORE_fadvise64_64  #define __IGNORE_migrate_pages +#define __IGNORE_kcmp  #endif /* __KERNEL__ */  #endif /* __ASM_ARM_UNISTD_H */ diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index b244696de1a..9b722612553 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -271,15 +271,6 @@ static void __devinit pci_fixup_it8152(struct pci_dev *dev)  }  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8152, pci_fixup_it8152); - - -void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) -{ -	if (debug_pci) -		printk("PCI: Assigning IRQ %02d to %s\n", irq, pci_name(dev)); -	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); -} -  /*   * If the bus contains any of these devices, then we must not turn on   * parity checking of any kind.  Currently this is CyberPro 20x0 only. diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 463ff4a0ec8..e337879595e 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S @@ -387,6 +387,7 @@  /* 375 */	CALL(sys_setns)  		CALL(sys_process_vm_readv)  		CALL(sys_process_vm_writev) +		CALL(sys_ni_syscall)	/* reserved for sys_kcmp */  #ifndef syscalls_counted  .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls  #define syscalls_counted diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index fef42b21cec..e1f906989bb 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -11,7 +11,6 @@  #include <linux/init.h>  #include <linux/kernel.h>  #include <linux/clk.h> -#include <linux/cpufreq.h>  #include <linux/delay.h>  #include <linux/device.h>  #include <linux/err.h> @@ -96,7 +95,52 @@ static void twd_timer_stop(struct clock_event_device *clk)  	disable_percpu_irq(clk->irq);  } -#ifdef CONFIG_CPU_FREQ +#ifdef CONFIG_COMMON_CLK + +/* + * Updates clockevent frequency when the cpu frequency changes. + * Called on the cpu that is changing frequency with interrupts disabled. + */ +static void twd_update_frequency(void *new_rate) +{ +	twd_timer_rate = *((unsigned long *) new_rate); + +	clockevents_update_freq(*__this_cpu_ptr(twd_evt), twd_timer_rate); +} + +static int twd_rate_change(struct notifier_block *nb, +	unsigned long flags, void *data) +{ +	struct clk_notifier_data *cnd = data; + +	/* +	 * The twd clock events must be reprogrammed to account for the new +	 * frequency.  The timer is local to a cpu, so cross-call to the +	 * changing cpu. +	 */ +	if (flags == POST_RATE_CHANGE) +		smp_call_function(twd_update_frequency, +				  (void *)&cnd->new_rate, 1); + +	return NOTIFY_OK; +} + +static struct notifier_block twd_clk_nb = { +	.notifier_call = twd_rate_change, +}; + +static int twd_clk_init(void) +{ +	if (twd_evt && *__this_cpu_ptr(twd_evt) && !IS_ERR(twd_clk)) +		return clk_notifier_register(twd_clk, &twd_clk_nb); + +	return 0; +} +core_initcall(twd_clk_init); + +#elif defined (CONFIG_CPU_FREQ) + +#include <linux/cpufreq.h>  /*   * Updates clockevent frequency when the cpu frequency changes. diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c index a472777e9eb..41383bf03d4 100644 --- a/arch/arm/mach-ep93xx/adssphere.c +++ b/arch/arm/mach-ep93xx/adssphere.c @@ -13,6 +13,7 @@  #include <linux/kernel.h>  #include <linux/init.h>  #include <linux/platform_device.h> +#include <linux/sizes.h>  #include <mach/hardware.h> diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c index 437c3411115..7fd705b5efe 100644 --- a/arch/arm/mach-ep93xx/gesbc9312.c +++ b/arch/arm/mach-ep93xx/gesbc9312.c @@ -13,6 +13,7 @@  #include <linux/kernel.h>  #include <linux/init.h>  #include <linux/platform_device.h> +#include <linux/sizes.h>  #include <mach/hardware.h> diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c index 75cab2d7ec7..3c4c233391d 100644 --- a/arch/arm/mach-ep93xx/ts72xx.c +++ b/arch/arm/mach-ep93xx/ts72xx.c @@ -21,7 +21,6 @@  #include <linux/mtd/partitions.h>  #include <mach/hardware.h> -#include <mach/ts72xx.h>  #include <asm/hardware/vic.h>  #include <asm/mach-types.h> @@ -29,30 +28,31 @@  #include <asm/mach/arch.h>  #include "soc.h" +#include "ts72xx.h"  static struct map_desc ts72xx_io_desc[] __initdata = {  	{ -		.virtual	= TS72XX_MODEL_VIRT_BASE, +		.virtual	= (unsigned long)TS72XX_MODEL_VIRT_BASE,  		.pfn		= __phys_to_pfn(TS72XX_MODEL_PHYS_BASE),  		.length		= TS72XX_MODEL_SIZE,  		.type		= MT_DEVICE,  	}, { -		.virtual	= TS72XX_OPTIONS_VIRT_BASE, +		.virtual	= (unsigned long)TS72XX_OPTIONS_VIRT_BASE,  		.pfn		= __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE),  		.length		= TS72XX_OPTIONS_SIZE,  		.type		= MT_DEVICE,  	}, { -		.virtual	= TS72XX_OPTIONS2_VIRT_BASE, +		.virtual	= (unsigned long)TS72XX_OPTIONS2_VIRT_BASE,  		.pfn		= __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE),  		.length		= TS72XX_OPTIONS2_SIZE,  		.type		= MT_DEVICE,  	}, { -		.virtual	= TS72XX_RTC_INDEX_VIRT_BASE, +		.virtual	= (unsigned long)TS72XX_RTC_INDEX_VIRT_BASE,  		.pfn		= __phys_to_pfn(TS72XX_RTC_INDEX_PHYS_BASE),  		.length		= TS72XX_RTC_INDEX_SIZE,  		.type		= MT_DEVICE,  	}, { -		.virtual	= TS72XX_RTC_DATA_VIRT_BASE, +		.virtual	= (unsigned long)TS72XX_RTC_DATA_VIRT_BASE,  		.pfn		= __phys_to_pfn(TS72XX_RTC_DATA_PHYS_BASE),  		.length		= TS72XX_RTC_DATA_SIZE,  		.type		= MT_DEVICE, diff --git a/arch/arm/mach-ep93xx/include/mach/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h index f1397a13e76..071feaa30ad 100644 --- a/arch/arm/mach-ep93xx/include/mach/ts72xx.h +++ b/arch/arm/mach-ep93xx/ts72xx.h @@ -14,7 +14,7 @@   */  #define TS72XX_MODEL_PHYS_BASE		0x22000000 -#define TS72XX_MODEL_VIRT_BASE		0xfebff000 +#define TS72XX_MODEL_VIRT_BASE		IOMEM(0xfebff000)  #define TS72XX_MODEL_SIZE		0x00001000  #define TS72XX_MODEL_TS7200		0x00 @@ -26,7 +26,7 @@  #define TS72XX_OPTIONS_PHYS_BASE	0x22400000 -#define TS72XX_OPTIONS_VIRT_BASE	0xfebfe000 +#define TS72XX_OPTIONS_VIRT_BASE	IOMEM(0xfebfe000)  #define TS72XX_OPTIONS_SIZE		0x00001000  #define TS72XX_OPTIONS_COM2_RS485	0x02 @@ -34,18 +34,18 @@  #define TS72XX_OPTIONS2_PHYS_BASE	0x22800000 -#define TS72XX_OPTIONS2_VIRT_BASE	0xfebfd000 +#define TS72XX_OPTIONS2_VIRT_BASE	IOMEM(0xfebfd000)  #define TS72XX_OPTIONS2_SIZE		0x00001000  #define TS72XX_OPTIONS2_TS9420		0x04  #define TS72XX_OPTIONS2_TS9420_BOOT	0x02 -#define TS72XX_RTC_INDEX_VIRT_BASE	0xfebf9000 +#define TS72XX_RTC_INDEX_VIRT_BASE	IOMEM(0xfebf9000)  #define TS72XX_RTC_INDEX_PHYS_BASE	0x10800000  #define TS72XX_RTC_INDEX_SIZE		0x00001000 -#define TS72XX_RTC_DATA_VIRT_BASE	0xfebf8000 +#define TS72XX_RTC_DATA_VIRT_BASE	IOMEM(0xfebf8000)  #define TS72XX_RTC_DATA_PHYS_BASE	0x11700000  #define TS72XX_RTC_DATA_SIZE		0x00001000 diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 9d1f3ac86db..6d33f50c2e5 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h @@ -89,7 +89,7 @@  #define EXYNOS4_PA_L2CC			0x10502000  #define EXYNOS4_PA_MDMA0		0x10810000 -#define EXYNOS4_PA_MDMA1		0x12840000 +#define EXYNOS4_PA_MDMA1		0x12850000  #define EXYNOS4_PA_PDMA0		0x12680000  #define EXYNOS4_PA_PDMA1		0x12690000  #define EXYNOS5_PA_MDMA0		0x10800000 diff --git a/arch/arm/mach-exynos/include/mach/sysmmu.h b/arch/arm/mach-exynos/include/mach/sysmmu.h index 998daf2add9..88a4543b000 100644 --- a/arch/arm/mach-exynos/include/mach/sysmmu.h +++ b/arch/arm/mach-exynos/include/mach/sysmmu.h @@ -58,7 +58,7 @@ static inline void platform_set_sysmmu(  #endif  #else /* !CONFIG_EXYNOS_DEV_SYSMMU */ -#define platform_set_sysmmu(dev, sysmmu) do { } while (0) +#define platform_set_sysmmu(sysmmu, dev) do { } while (0)  #endif  #define SYSMMU_CLOCK_DEVNAME(ipname, id) (SYSMMU_DEVNAME_BASE "." #id) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index 4431a62fff5..d20d4795f4e 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -241,6 +241,6 @@ int __init mx25_clocks_init(void)  	clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma");  	clk_register_clkdev(clk[iim_ipg], "iim", NULL); -	mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); +	mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), MX25_INT_GPT1);  	return 0;  } diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c index 2c6ab3273f9..5985ed1b8c9 100644 --- a/arch/arm/mach-imx/mach-armadillo5x0.c +++ b/arch/arm/mach-imx/mach-armadillo5x0.c @@ -526,7 +526,8 @@ static void __init armadillo5x0_init(void)  	imx31_add_mxc_nand(&armadillo5x0_nand_board_info);  	/* set NAND page size to 2k if not configured via boot mode pins */ -	__raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR); +	__raw_writel(__raw_readl(mx3_ccm_base + MXC_CCM_RCSR) | +					(1 << 30), mx3_ccm_base + MXC_CCM_RCSR);  	/* RTC */  	/* Get RTC IRQ and register the chip */ diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig index 7fddd01b85b..d697d07a1bf 100644 --- a/arch/arm/mach-mmp/Kconfig +++ b/arch/arm/mach-mmp/Kconfig @@ -108,18 +108,21 @@ endmenu  config CPU_PXA168  	bool  	select CPU_MOHAWK +	select COMMON_CLK  	help  	  Select code specific to PXA168  config CPU_PXA910  	bool  	select CPU_MOHAWK +	select COMMON_CLK  	help  	  Select code specific to PXA910  config CPU_MMP2  	bool  	select CPU_PJ4 +	select COMMON_CLK  	help  	  Select code specific to MMP2. MMP2 is ARMv7 compatible. diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c index e37a724cd1e..06003b4ccb1 100644 --- a/arch/arm/mach-msm/board-msm8x60.c +++ b/arch/arm/mach-msm/board-msm8x60.c @@ -93,11 +93,6 @@ static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {  static void __init msm8x60_dt_init(void)  { -	if (of_machine_is_compatible("qcom,msm8660-surf")) { -		printk(KERN_INFO "Init surf UART registers\n"); -		msm8x60_init_uart12dm(); -	} -  	of_platform_populate(NULL, of_default_bus_match_table,  			msm_auxdata_lookup, NULL);  } diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h index a1752c0284f..facf434d09b 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h @@ -46,7 +46,7 @@  #define MSM8960_TMR0_SIZE	SZ_4K  #ifdef CONFIG_DEBUG_MSM8960_UART -#define MSM_DEBUG_UART_BASE	0xE1040000 +#define MSM_DEBUG_UART_BASE	0xF0040000  #define MSM_DEBUG_UART_PHYS	0x16440000  #endif diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h index 5aed57dc808..21a2a8859a9 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h @@ -63,7 +63,7 @@  #define MSM8X60_TMR0_SIZE	SZ_4K  #ifdef CONFIG_DEBUG_MSM8660_UART -#define MSM_DEBUG_UART_BASE	0xE1040000 +#define MSM_DEBUG_UART_BASE	0xF0040000  #define MSM_DEBUG_UART_PHYS	0x19C40000  #endif diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c index 97042331cfc..3cb4f4c3571 100644 --- a/arch/arm/mach-msm/io.c +++ b/arch/arm/mach-msm/io.c @@ -29,29 +29,30 @@  #include <mach/board.h> -#define MSM_CHIP_DEVICE(name, chip) {			      \ +#define MSM_CHIP_DEVICE_TYPE(name, chip, mem_type) {			      \  		.virtual = (unsigned long) MSM_##name##_BASE, \  		.pfn = __phys_to_pfn(chip##_##name##_PHYS), \  		.length = chip##_##name##_SIZE, \ -		.type = MT_DEVICE_NONSHARED, \ +		.type = mem_type, \  	 } +#define MSM_DEVICE_TYPE(name, mem_type) \ +		MSM_CHIP_DEVICE_TYPE(name, MSM, mem_type) +#define MSM_CHIP_DEVICE(name, chip) \ +		MSM_CHIP_DEVICE_TYPE(name, chip, MT_DEVICE)  #define MSM_DEVICE(name) MSM_CHIP_DEVICE(name, MSM)  #if defined(CONFIG_ARCH_MSM7X00A)  static struct map_desc msm_io_desc[] __initdata = { -	MSM_DEVICE(VIC), -	MSM_CHIP_DEVICE(CSR, MSM7X00), -	MSM_DEVICE(DMOV), -	MSM_CHIP_DEVICE(GPIO1, MSM7X00), -	MSM_CHIP_DEVICE(GPIO2, MSM7X00), -	MSM_DEVICE(CLK_CTL), +	MSM_DEVICE_TYPE(VIC, MT_DEVICE_NONSHARED), +	MSM_CHIP_DEVICE_TYPE(CSR, MSM7X00, MT_DEVICE_NONSHARED), +	MSM_DEVICE_TYPE(DMOV, MT_DEVICE_NONSHARED), +	MSM_CHIP_DEVICE_TYPE(GPIO1, MSM7X00, MT_DEVICE_NONSHARED), +	MSM_CHIP_DEVICE_TYPE(GPIO2, MSM7X00, MT_DEVICE_NONSHARED), +	MSM_DEVICE_TYPE(CLK_CTL, MT_DEVICE_NONSHARED),  #if defined(CONFIG_DEBUG_MSM_UART1) || defined(CONFIG_DEBUG_MSM_UART2) || \  	defined(CONFIG_DEBUG_MSM_UART3) -	MSM_DEVICE(DEBUG_UART), -#endif -#ifdef CONFIG_ARCH_MSM7X30 -	MSM_DEVICE(GCC), +	MSM_DEVICE_TYPE(DEBUG_UART, MT_DEVICE_NONSHARED),  #endif  	{  		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE, diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 8dabfe81d07..ff886e01a0b 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c @@ -261,7 +261,7 @@ static void __init apx4devkit_init(void)  	enable_clk_enet_out();  	if (IS_BUILTIN(CONFIG_PHYLIB)) -		phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, +		phy_register_fixup_for_uid(PHY_ID_KSZ8051, MICREL_PHY_ID_MASK,  					   apx4devkit_phy_fixup);  	mxsfb_pdata.mode_list = apx4devkit_video_modes; diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c index f4535a7dadf..c3841a9a8fa 100644 --- a/arch/arm/mach-nomadik/board-nhk8815.c +++ b/arch/arm/mach-nomadik/board-nhk8815.c @@ -112,8 +112,7 @@ static struct mtd_partition nhk8815_partitions[] = {  static struct nomadik_nand_platform_data nhk8815_nand_data = {  	.parts		= nhk8815_partitions,  	.nparts		= ARRAY_SIZE(nhk8815_partitions), -	.options	= NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \ -			| NAND_NO_READRDY, +	.options	= NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING,  	.init		= nhk8815_nand_init,  }; diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 3fe5f0f69c7..c64e565bdef 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -32,6 +32,7 @@  #include <linux/spi/ads7846.h>  #include <linux/i2c/twl.h>  #include <linux/usb/otg.h> +#include <linux/usb/nop-usb-xceiv.h>  #include <linux/smsc911x.h>  #include <linux/wl12xx.h> diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index e7b246da02d..d1058f16fb4 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -123,6 +123,7 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)  		break;  	default:  		WARN(1, "Invalid gpio bank_type\n"); +		kfree(pdata->regs);  		kfree(pdata);  		return -EINVAL;  	} diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c index b3275babf19..5d3b4f4f81a 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.c +++ b/arch/arm/mach-omap2/omap-wakeupgen.c @@ -230,13 +230,7 @@ static inline void omap4_irq_save_context(void)  	/* Save AuxBoot* registers */  	val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);  	__raw_writel(val, sar_base + AUXCOREBOOT0_OFFSET); -	val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); -	__raw_writel(val, sar_base + AUXCOREBOOT1_OFFSET); - -	/* Save SyncReq generation logic */ -	val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); -	__raw_writel(val, sar_base + AUXCOREBOOT0_OFFSET); -	val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); +	val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_1);  	__raw_writel(val, sar_base + AUXCOREBOOT1_OFFSET);  	/* Save SyncReq generation logic */ diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index f9bcb24cd51..c7dcb606cd0 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5889,6 +5889,12 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {  		.pa_end		= 0x4a0ab003,  		.flags		= ADDR_TYPE_RT  	}, +	{ +		/* XXX: Remove this once control module driver is in place */ +		.pa_start	= 0x4a00233c, +		.pa_end		= 0x4a00233f, +		.flags		= ADDR_TYPE_RT +	},  	{ }  }; diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c index 593eaea35ce..d992db8ff0b 100644 --- a/arch/arm/mach-omap2/omap_phy_internal.c +++ b/arch/arm/mach-omap2/omap_phy_internal.c @@ -33,144 +33,6 @@  #include "soc.h"  #include "control.h" -/* OMAP control module register for UTMI PHY */ -#define CONTROL_DEV_CONF		0x300 -#define PHY_PD				0x1 - -#define USBOTGHS_CONTROL		0x33c -#define	AVALID				BIT(0) -#define	BVALID				BIT(1) -#define	VBUSVALID			BIT(2) -#define	SESSEND				BIT(3) -#define	IDDIG				BIT(4) - -static struct clk *phyclk, *clk48m, *clk32k; -static void __iomem *ctrl_base; -static int usbotghs_control; - -int omap4430_phy_init(struct device *dev) -{ -	ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K); -	if (!ctrl_base) { -		pr_err("control module ioremap failed\n"); -		return -ENOMEM; -	} -	/* Power down the phy */ -	__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); - -	if (!dev) { -		iounmap(ctrl_base); -		return 0; -	} - -	phyclk = clk_get(dev, "ocp2scp_usb_phy_ick"); -	if (IS_ERR(phyclk)) { -		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n"); -		iounmap(ctrl_base); -		return PTR_ERR(phyclk); -	} - -	clk48m = clk_get(dev, "ocp2scp_usb_phy_phy_48m"); -	if (IS_ERR(clk48m)) { -		dev_err(dev, "cannot clk_get ocp2scp_usb_phy_phy_48m\n"); -		clk_put(phyclk); -		iounmap(ctrl_base); -		return PTR_ERR(clk48m); -	} - -	clk32k = clk_get(dev, "usb_phy_cm_clk32k"); -	if (IS_ERR(clk32k)) { -		dev_err(dev, "cannot clk_get usb_phy_cm_clk32k\n"); -		clk_put(phyclk); -		clk_put(clk48m); -		iounmap(ctrl_base); -		return PTR_ERR(clk32k); -	} -	return 0; -} - -int omap4430_phy_set_clk(struct device *dev, int on) -{ -	static int state; - -	if (on && !state) { -		/* Enable the phy clocks */ -		clk_enable(phyclk); -		clk_enable(clk48m); -		clk_enable(clk32k); -		state = 1; -	} else if (state) { -		/* Disable the phy clocks */ -		clk_disable(phyclk); -		clk_disable(clk48m); -		clk_disable(clk32k); -		state = 0; -	} -	return 0; -} - -int omap4430_phy_power(struct device *dev, int ID, int on) -{ -	if (on) { -		if (ID) -			/* enable VBUS valid, IDDIG groung */ -			__raw_writel(AVALID | VBUSVALID, ctrl_base + -							USBOTGHS_CONTROL); -		else -			/* -			 * Enable VBUS Valid, AValid and IDDIG -			 * high impedance -			 */ -			__raw_writel(IDDIG | AVALID | VBUSVALID, -						ctrl_base + USBOTGHS_CONTROL); -	} else { -		/* Enable session END and IDIG to high impedance. */ -		__raw_writel(SESSEND | IDDIG, ctrl_base + -					USBOTGHS_CONTROL); -	} -	return 0; -} - -int omap4430_phy_suspend(struct device *dev, int suspend) -{ -	if (suspend) { -		/* Disable the clocks */ -		omap4430_phy_set_clk(dev, 0); -		/* Power down the phy */ -		__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); - -		/* save the context */ -		usbotghs_control = __raw_readl(ctrl_base + USBOTGHS_CONTROL); -	} else { -		/* Enable the internel phy clcoks */ -		omap4430_phy_set_clk(dev, 1); -		/* power on the phy */ -		if (__raw_readl(ctrl_base + CONTROL_DEV_CONF) & PHY_PD) { -			__raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF); -			mdelay(200); -		} - -		/* restore the context */ -		__raw_writel(usbotghs_control, ctrl_base + USBOTGHS_CONTROL); -	} - -	return 0; -} - -int omap4430_phy_exit(struct device *dev) -{ -	if (ctrl_base) -		iounmap(ctrl_base); -	if (phyclk) -		clk_put(phyclk); -	if (clk48m) -		clk_put(clk48m); -	if (clk32k) -		clk_put(clk32k); - -	return 0; -} -  void am35x_musb_reset(void)  {  	u32	regval; diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index af93acccc70..45f77413c21 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -237,11 +237,6 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,  #if defined(CONFIG_ARCH_OMAP4)  static struct twl4030_usb_data omap4_usb_pdata = { -	.phy_init	= omap4430_phy_init, -	.phy_exit	= omap4430_phy_exit, -	.phy_power	= omap4430_phy_power, -	.phy_set_clock	= omap4430_phy_set_clk, -	.phy_suspend	= omap4430_phy_suspend,  };  static struct regulator_init_data omap4_vdac_idata = { diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c index 136c64bc902..51da21cb78f 100644 --- a/arch/arm/mach-omap2/usb-musb.c +++ b/arch/arm/mach-omap2/usb-musb.c @@ -116,7 +116,4 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)  	dev->dma_mask = &musb_dmamask;  	dev->coherent_dma_mask = musb_dmamask;  	put_device(dev); - -	if (cpu_is_omap44xx()) -		omap4430_phy_init(dev);  } diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 87a6cdabcad..2fdd4e4f559 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c @@ -194,6 +194,13 @@ void __init orion5x_wdt_init(void)  void __init orion5x_init_early(void)  {  	orion_time_set_base(TIMER_VIRT_BASE); + +	/* +	 * Some Orion5x devices allocate their coherent buffers from atomic +	 * context. Increase size of atomic coherent pool to make sure such +	 * the allocations won't fail. +	 */ +	init_dma_coherent_pool_size(SZ_1M);  }  int orion5x_tclk; diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c index 30b1b0b3c7f..0701ca79e7d 100644 --- a/arch/arm/mach-pxa/stargate2.c +++ b/arch/arm/mach-pxa/stargate2.c @@ -52,7 +52,7 @@  #include <linux/spi/spi.h>  #include <linux/spi/pxa2xx_spi.h>  #include <linux/mfd/da903x.h> -#include <linux/sht15.h> +#include <linux/platform_data/sht15.h>  #include "devices.h"  #include "generic.h" diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 45868bb43cb..ff007d15e0e 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -30,7 +30,6 @@  #include <linux/ata_platform.h>  #include <linux/amba/mmci.h>  #include <linux/gfp.h> -#include <linux/clkdev.h>  #include <linux/mtd/physmap.h>  #include <mach/hardware.h> @@ -226,115 +225,10 @@ struct mmci_platform_data realview_mmc1_plat_data = {  	.cd_invert	= true,  }; -/* - * Clock handling - */ -static const struct icst_params realview_oscvco_params = { -	.ref		= 24000000, -	.vco_max	= ICST307_VCO_MAX, -	.vco_min	= ICST307_VCO_MIN, -	.vd_min		= 4 + 8, -	.vd_max		= 511 + 8, -	.rd_min		= 1 + 2, -	.rd_max		= 127 + 2, -	.s2div		= icst307_s2div, -	.idx2s		= icst307_idx2s, -}; - -static void realview_oscvco_set(struct clk *clk, struct icst_vco vco) -{ -	void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; -	u32 val; - -	val = readl(clk->vcoreg) & ~0x7ffff; -	val |= vco.v | (vco.r << 9) | (vco.s << 16); - -	writel(0xa05f, sys_lock); -	writel(val, clk->vcoreg); -	writel(0, sys_lock); -} - -static const struct clk_ops oscvco_clk_ops = { -	.round	= icst_clk_round, -	.set	= icst_clk_set, -	.setvco	= realview_oscvco_set, -}; - -static struct clk oscvco_clk = { -	.ops	= &oscvco_clk_ops, -	.params	= &realview_oscvco_params, -}; - -/* - * These are fixed clocks. - */ -static struct clk ref24_clk = { -	.rate	= 24000000, -}; - -static struct clk sp804_clk = { -	.rate	= 1000000, -}; - -static struct clk dummy_apb_pclk; - -static struct clk_lookup lookups[] = { -	{	/* Bus clock */ -		.con_id		= "apb_pclk", -		.clk		= &dummy_apb_pclk, -	}, {	/* UART0 */ -		.dev_id		= "dev:uart0", -		.clk		= &ref24_clk, -	}, {	/* UART1 */ -		.dev_id		= "dev:uart1", -		.clk		= &ref24_clk, -	}, {	/* UART2 */ -		.dev_id		= "dev:uart2", -		.clk		= &ref24_clk, -	}, {	/* UART3 */ -		.dev_id		= "fpga:uart3", -		.clk		= &ref24_clk, -	}, {	/* UART3 is on the dev chip in PB1176 */ -		.dev_id		= "dev:uart3", -		.clk		= &ref24_clk, -	}, {	/* UART4 only exists in PB1176 */ -		.dev_id		= "fpga:uart4", -		.clk		= &ref24_clk, -	}, {	/* KMI0 */ -		.dev_id		= "fpga:kmi0", -		.clk		= &ref24_clk, -	}, {	/* KMI1 */ -		.dev_id		= "fpga:kmi1", -		.clk		= &ref24_clk, -	}, {	/* MMC0 */ -		.dev_id		= "fpga:mmc0", -		.clk		= &ref24_clk, -	}, {	/* CLCD is in the PB1176 and EB DevChip */ -		.dev_id		= "dev:clcd", -		.clk		= &oscvco_clk, -	}, {	/* PB:CLCD */ -		.dev_id		= "issp:clcd", -		.clk		= &oscvco_clk, -	}, {	/* SSP */ -		.dev_id		= "dev:ssp0", -		.clk		= &ref24_clk, -	}, {	/* SP804 timers */ -		.dev_id		= "sp804", -		.clk		= &sp804_clk, -	}, -}; -  void __init realview_init_early(void)  {  	void __iomem *sys = __io_address(REALVIEW_SYS_BASE); -	if (machine_is_realview_pb1176()) -		oscvco_clk.vcoreg = sys + REALVIEW_SYS_OSC0_OFFSET; -	else -		oscvco_clk.vcoreg = sys + REALVIEW_SYS_OSC4_OFFSET; - -	clkdev_add_table(lookups, ARRAY_SIZE(lookups)); -  	versatile_sched_clock_init(sys + REALVIEW_SYS_24MHz_OFFSET, 24000000);  } diff --git a/arch/arm/mach-realview/include/mach/clkdev.h b/arch/arm/mach-realview/include/mach/clkdev.h deleted file mode 100644 index e58d0771b64..00000000000 --- a/arch/arm/mach-realview/include/mach/clkdev.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __ASM_MACH_CLKDEV_H -#define __ASM_MACH_CLKDEV_H - -#include <plat/clock.h> - -struct clk { -	unsigned long		rate; -	const struct clk_ops	*ops; -	const struct icst_params *params; -	void __iomem		*vcoreg; -}; - -#define __clk_get(clk) ({ 1; }) -#define __clk_put(clk) do { } while (0) - -#endif diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index d7a6e9cebba..ce7747692c8 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -27,6 +27,7 @@  #include <linux/amba/mmci.h>  #include <linux/amba/pl022.h>  #include <linux/io.h> +#include <linux/platform_data/clk-realview.h>  #include <mach/hardware.h>  #include <asm/irq.h> @@ -413,6 +414,7 @@ static void __init realview_eb_timer_init(void)  	else  		timer_irq = IRQ_EB_TIMER0_1; +	realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);  	realview_timer_init(timer_irq);  	realview_eb_twd_init();  } diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c index 361f898884c..e21711d72ee 100644 --- a/arch/arm/mach-realview/realview_pb1176.c +++ b/arch/arm/mach-realview/realview_pb1176.c @@ -29,6 +29,7 @@  #include <linux/mtd/physmap.h>  #include <linux/mtd/partitions.h>  #include <linux/io.h> +#include <linux/platform_data/clk-realview.h>  #include <mach/hardware.h>  #include <asm/irq.h> @@ -325,6 +326,7 @@ static void __init realview_pb1176_timer_init(void)  	timer2_va_base = __io_address(REALVIEW_PB1176_TIMER2_3_BASE);  	timer3_va_base = __io_address(REALVIEW_PB1176_TIMER2_3_BASE) + 0x20; +	realview_clk_init(__io_address(REALVIEW_SYS_BASE), true);  	realview_timer_init(IRQ_DC1176_TIMER0);  } diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c index c56bc8d4d11..b442fb276d5 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c @@ -27,6 +27,7 @@  #include <linux/amba/mmci.h>  #include <linux/amba/pl022.h>  #include <linux/io.h> +#include <linux/platform_data/clk-realview.h>  #include <mach/hardware.h>  #include <asm/irq.h> @@ -311,6 +312,7 @@ static void __init realview_pb11mp_timer_init(void)  	timer2_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE);  	timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20; +	realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);  	realview_timer_init(IRQ_TC11MP_TIMER0_1);  	realview_pb11mp_twd_init();  } diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c index 04093758245..1435cd86396 100644 --- a/arch/arm/mach-realview/realview_pba8.c +++ b/arch/arm/mach-realview/realview_pba8.c @@ -27,6 +27,7 @@  #include <linux/amba/mmci.h>  #include <linux/amba/pl022.h>  #include <linux/io.h> +#include <linux/platform_data/clk-realview.h>  #include <asm/irq.h>  #include <asm/leds.h> @@ -260,6 +261,7 @@ static void __init realview_pba8_timer_init(void)  	timer2_va_base = __io_address(REALVIEW_PBA8_TIMER2_3_BASE);  	timer3_va_base = __io_address(REALVIEW_PBA8_TIMER2_3_BASE) + 0x20; +	realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);  	realview_timer_init(IRQ_PBA8_TIMER0_1);  } diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c index 97885dc11e8..5d2c8bebb06 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c @@ -26,6 +26,7 @@  #include <linux/amba/mmci.h>  #include <linux/amba/pl022.h>  #include <linux/io.h> +#include <linux/platform_data/clk-realview.h>  #include <asm/irq.h>  #include <asm/leds.h> @@ -319,6 +320,7 @@ static void __init realview_pbx_timer_init(void)  	timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE);  	timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20; +	realview_clk_init(__io_address(REALVIEW_SYS_BASE), false);  	realview_timer_init(IRQ_PBX_TIMER0_1);  	realview_pbx_twd_init();  } diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index bb8d008d5a5..7e15cc43068 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c @@ -380,7 +380,7 @@ int h1940_led_blink_set(unsigned gpio, int state,  	default:  		blink_gpio = S3C2410_GPA(3);  		check_gpio1 = S3C2410_GPA(1); -		check_gpio1 = S3C2410_GPA(7); +		check_gpio2 = S3C2410_GPA(7);  		break;  	} @@ -460,7 +460,7 @@ static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)  		break;  	default:  		break; -	}; +	}  }  static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = { diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 5ffafc1adf9..99ae066b87e 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c @@ -346,11 +346,11 @@ static struct resource sh_mmcif_resources[] = {  		.flags	= IORESOURCE_MEM,  	},  	[1] = { -		.start	= gic_spi(141), +		.start	= gic_spi(140),  		.flags	= IORESOURCE_IRQ,  	},  	[2] = { -		.start	= gic_spi(140), +		.start	= gic_spi(141),  		.flags	= IORESOURCE_IRQ,  	},  }; diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 0974ace4555..191d973122a 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -20,7 +20,6 @@ obj-$(CONFIG_SMP)                       += reset.o  obj-$(CONFIG_HOTPLUG_CPU)               += hotplug.o  obj-$(CONFIG_CPU_FREQ)                  += cpu-tegra.o  obj-$(CONFIG_TEGRA_PCI)			+= pcie.o -obj-$(CONFIG_USB_SUPPORT)		+= usb_phy.o  obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= board-dt-tegra20.o  obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= board-dt-tegra30.o diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c index 61e9603744a..63cc2800dcf 100644 --- a/arch/arm/mach-tegra/devices.c +++ b/arch/arm/mach-tegra/devices.c @@ -26,7 +26,7 @@  #include <mach/irqs.h>  #include <mach/iomap.h>  #include <mach/dma.h> -#include <mach/usb_phy.h> +#include <linux/usb/tegra_usb_phy.h>  #include "gpio-names.h"  #include "devices.h" diff --git a/arch/arm/mach-tegra/devices.h b/arch/arm/mach-tegra/devices.h index 4f505272649..906a61f340c 100644 --- a/arch/arm/mach-tegra/devices.h +++ b/arch/arm/mach-tegra/devices.h @@ -22,7 +22,7 @@  #include <linux/platform_device.h>  #include <linux/platform_data/tegra_usb.h> -#include <mach/usb_phy.h> +#include <linux/usb/tegra_usb_phy.h>  extern struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config; diff --git a/arch/arm/mach-tegra/include/mach/usb_phy.h b/arch/arm/mach-tegra/include/mach/usb_phy.h deleted file mode 100644 index 935ce9f6559..00000000000 --- a/arch/arm/mach-tegra/include/mach/usb_phy.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * arch/arm/mach-tegra/include/mach/usb_phy.h - * - * Copyright (C) 2010 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that 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. - * - */ - -#ifndef __MACH_USB_PHY_H -#define __MACH_USB_PHY_H - -#include <linux/clk.h> -#include <linux/usb/otg.h> - -struct tegra_utmip_config { -	u8 hssync_start_delay; -	u8 elastic_limit; -	u8 idle_wait_delay; -	u8 term_range_adj; -	u8 xcvr_setup; -	u8 xcvr_lsfslew; -	u8 xcvr_lsrslew; -}; - -struct tegra_ulpi_config { -	int reset_gpio; -	const char *clk; -}; - -enum tegra_usb_phy_port_speed { -	TEGRA_USB_PHY_PORT_SPEED_FULL = 0, -	TEGRA_USB_PHY_PORT_SPEED_LOW, -	TEGRA_USB_PHY_PORT_SPEED_HIGH, -}; - -enum tegra_usb_phy_mode { -	TEGRA_USB_PHY_MODE_DEVICE, -	TEGRA_USB_PHY_MODE_HOST, -}; - -struct tegra_xtal_freq; - -struct tegra_usb_phy { -	int instance; -	const struct tegra_xtal_freq *freq; -	void __iomem *regs; -	void __iomem *pad_regs; -	struct clk *clk; -	struct clk *pll_u; -	struct clk *pad_clk; -	enum tegra_usb_phy_mode mode; -	void *config; -	struct usb_phy *ulpi; -}; - -struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, -	void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); - -int tegra_usb_phy_power_on(struct tegra_usb_phy *phy); - -void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy); - -void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy); - -void tegra_usb_phy_power_off(struct tegra_usb_phy *phy); - -void tegra_usb_phy_preresume(struct tegra_usb_phy *phy); - -void tegra_usb_phy_postresume(struct tegra_usb_phy *phy); - -void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, -				 enum tegra_usb_phy_port_speed port_speed); - -void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy); - -void tegra_usb_phy_close(struct tegra_usb_phy *phy); - -#endif /* __MACH_USB_PHY_H */ diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c index 3463fb5b79c..a8dba6489c9 100644 --- a/arch/arm/mach-tegra/pcie.c +++ b/arch/arm/mach-tegra/pcie.c @@ -352,17 +352,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf1, tegra_pcie_fixup_class);  /* Tegra PCIE requires relaxed ordering */  static void __devinit tegra_pcie_relax_enable(struct pci_dev *dev)  { -	u16 val16; -	int pos = pci_find_capability(dev, PCI_CAP_ID_EXP); - -	if (pos <= 0) { -		dev_err(&dev->dev, "skipping relaxed ordering fixup\n"); -		return; -	} - -	pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &val16); -	val16 |= PCI_EXP_DEVCTL_RELAX_EN; -	pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, val16); +	pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN);  }  DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tegra_pcie_relax_enable); diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c index 15d506501cc..de0662de28a 100644 --- a/arch/arm/mach-tegra/powergate.c +++ b/arch/arm/mach-tegra/powergate.c @@ -199,7 +199,9 @@ int __init tegra_powergate_init(void)  #ifdef CONFIG_DEBUG_FS -static const char * const powergate_name[] = { +static const char * const *powergate_name; + +static const char * const powergate_name_t20[] = {  	[TEGRA_POWERGATE_CPU]	= "cpu",  	[TEGRA_POWERGATE_3D]	= "3d",  	[TEGRA_POWERGATE_VENC]	= "venc", @@ -209,6 +211,23 @@ static const char * const powergate_name[] = {  	[TEGRA_POWERGATE_MPE]	= "mpe",  }; +static const char * const powergate_name_t30[] = { +	[TEGRA_POWERGATE_CPU]	= "cpu0", +	[TEGRA_POWERGATE_3D]	= "3d0", +	[TEGRA_POWERGATE_VENC]	= "venc", +	[TEGRA_POWERGATE_VDEC]	= "vdec", +	[TEGRA_POWERGATE_PCIE]	= "pcie", +	[TEGRA_POWERGATE_L2]	= "l2", +	[TEGRA_POWERGATE_MPE]	= "mpe", +	[TEGRA_POWERGATE_HEG]	= "heg", +	[TEGRA_POWERGATE_SATA]	= "sata", +	[TEGRA_POWERGATE_CPU1]	= "cpu1", +	[TEGRA_POWERGATE_CPU2]	= "cpu2", +	[TEGRA_POWERGATE_CPU3]	= "cpu3", +	[TEGRA_POWERGATE_CELP]	= "celp", +	[TEGRA_POWERGATE_3D1]	= "3d1", +}; +  static int powergate_show(struct seq_file *s, void *data)  {  	int i; @@ -237,14 +256,24 @@ static const struct file_operations powergate_fops = {  int __init tegra_powergate_debugfs_init(void)  {  	struct dentry *d; -	int err = -ENOMEM; -	d = debugfs_create_file("powergate", S_IRUGO, NULL, NULL, -		&powergate_fops); -	if (!d) -		return -ENOMEM; +	switch (tegra_chip_id) { +	case TEGRA20: +		powergate_name = powergate_name_t20; +		break; +	case TEGRA30: +		powergate_name = powergate_name_t30; +		break; +	} + +	if (powergate_name) { +		d = debugfs_create_file("powergate", S_IRUGO, NULL, NULL, +			&powergate_fops); +		if (!d) +			return -ENOMEM; +	} -	return err; +	return 0;  }  #endif diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c deleted file mode 100644 index 022b33a05c3..00000000000 --- a/arch/arm/mach-tegra/usb_phy.c +++ /dev/null @@ -1,817 +0,0 @@ -/* - * arch/arm/mach-tegra/usb_phy.c - * - * Copyright (C) 2010 Google, Inc. - * - * Author: - *	Erik Gilling <konkers@google.com> - *	Benoit Goby <benoit@android.com> - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that 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. - * - */ - -#include <linux/resource.h> -#include <linux/delay.h> -#include <linux/slab.h> -#include <linux/err.h> -#include <linux/export.h> -#include <linux/platform_device.h> -#include <linux/io.h> -#include <linux/gpio.h> -#include <linux/of_gpio.h> -#include <linux/usb/otg.h> -#include <linux/usb/ulpi.h> -#include <asm/mach-types.h> -#include <mach/gpio-tegra.h> -#include <mach/usb_phy.h> -#include <mach/iomap.h> - -#define ULPI_VIEWPORT		0x170 - -#define USB_PORTSC1		0x184 -#define   USB_PORTSC1_PTS(x)	(((x) & 0x3) << 30) -#define   USB_PORTSC1_PSPD(x)	(((x) & 0x3) << 26) -#define   USB_PORTSC1_PHCD	(1 << 23) -#define   USB_PORTSC1_WKOC	(1 << 22) -#define   USB_PORTSC1_WKDS	(1 << 21) -#define   USB_PORTSC1_WKCN	(1 << 20) -#define   USB_PORTSC1_PTC(x)	(((x) & 0xf) << 16) -#define   USB_PORTSC1_PP	(1 << 12) -#define   USB_PORTSC1_SUSP	(1 << 7) -#define   USB_PORTSC1_PE	(1 << 2) -#define   USB_PORTSC1_CCS	(1 << 0) - -#define USB_SUSP_CTRL		0x400 -#define   USB_WAKE_ON_CNNT_EN_DEV	(1 << 3) -#define   USB_WAKE_ON_DISCON_EN_DEV	(1 << 4) -#define   USB_SUSP_CLR		(1 << 5) -#define   USB_PHY_CLK_VALID	(1 << 7) -#define   UTMIP_RESET			(1 << 11) -#define   UHSIC_RESET			(1 << 11) -#define   UTMIP_PHY_ENABLE		(1 << 12) -#define   ULPI_PHY_ENABLE	(1 << 13) -#define   USB_SUSP_SET		(1 << 14) -#define   USB_WAKEUP_DEBOUNCE_COUNT(x)	(((x) & 0x7) << 16) - -#define USB1_LEGACY_CTRL	0x410 -#define   USB1_NO_LEGACY_MODE			(1 << 0) -#define   USB1_VBUS_SENSE_CTL_MASK		(3 << 1) -#define   USB1_VBUS_SENSE_CTL_VBUS_WAKEUP	(0 << 1) -#define   USB1_VBUS_SENSE_CTL_AB_SESS_VLD_OR_VBUS_WAKEUP \ -						(1 << 1) -#define   USB1_VBUS_SENSE_CTL_AB_SESS_VLD	(2 << 1) -#define   USB1_VBUS_SENSE_CTL_A_SESS_VLD	(3 << 1) - -#define ULPI_TIMING_CTRL_0	0x424 -#define   ULPI_OUTPUT_PINMUX_BYP	(1 << 10) -#define   ULPI_CLKOUT_PINMUX_BYP	(1 << 11) - -#define ULPI_TIMING_CTRL_1	0x428 -#define   ULPI_DATA_TRIMMER_LOAD	(1 << 0) -#define   ULPI_DATA_TRIMMER_SEL(x)	(((x) & 0x7) << 1) -#define   ULPI_STPDIRNXT_TRIMMER_LOAD	(1 << 16) -#define   ULPI_STPDIRNXT_TRIMMER_SEL(x)	(((x) & 0x7) << 17) -#define   ULPI_DIR_TRIMMER_LOAD		(1 << 24) -#define   ULPI_DIR_TRIMMER_SEL(x)	(((x) & 0x7) << 25) - -#define UTMIP_PLL_CFG1		0x804 -#define   UTMIP_XTAL_FREQ_COUNT(x)		(((x) & 0xfff) << 0) -#define   UTMIP_PLLU_ENABLE_DLY_COUNT(x)	(((x) & 0x1f) << 27) - -#define UTMIP_XCVR_CFG0		0x808 -#define   UTMIP_XCVR_SETUP(x)			(((x) & 0xf) << 0) -#define   UTMIP_XCVR_LSRSLEW(x)			(((x) & 0x3) << 8) -#define   UTMIP_XCVR_LSFSLEW(x)			(((x) & 0x3) << 10) -#define   UTMIP_FORCE_PD_POWERDOWN		(1 << 14) -#define   UTMIP_FORCE_PD2_POWERDOWN		(1 << 16) -#define   UTMIP_FORCE_PDZI_POWERDOWN		(1 << 18) -#define   UTMIP_XCVR_HSSLEW_MSB(x)		(((x) & 0x7f) << 25) - -#define UTMIP_BIAS_CFG0		0x80c -#define   UTMIP_OTGPD			(1 << 11) -#define   UTMIP_BIASPD			(1 << 10) - -#define UTMIP_HSRX_CFG0		0x810 -#define   UTMIP_ELASTIC_LIMIT(x)	(((x) & 0x1f) << 10) -#define   UTMIP_IDLE_WAIT(x)		(((x) & 0x1f) << 15) - -#define UTMIP_HSRX_CFG1		0x814 -#define   UTMIP_HS_SYNC_START_DLY(x)	(((x) & 0x1f) << 1) - -#define UTMIP_TX_CFG0		0x820 -#define   UTMIP_FS_PREABMLE_J		(1 << 19) -#define   UTMIP_HS_DISCON_DISABLE	(1 << 8) - -#define UTMIP_MISC_CFG0		0x824 -#define   UTMIP_DPDM_OBSERVE		(1 << 26) -#define   UTMIP_DPDM_OBSERVE_SEL(x)	(((x) & 0xf) << 27) -#define   UTMIP_DPDM_OBSERVE_SEL_FS_J	UTMIP_DPDM_OBSERVE_SEL(0xf) -#define   UTMIP_DPDM_OBSERVE_SEL_FS_K	UTMIP_DPDM_OBSERVE_SEL(0xe) -#define   UTMIP_DPDM_OBSERVE_SEL_FS_SE1 UTMIP_DPDM_OBSERVE_SEL(0xd) -#define   UTMIP_DPDM_OBSERVE_SEL_FS_SE0 UTMIP_DPDM_OBSERVE_SEL(0xc) -#define   UTMIP_SUSPEND_EXIT_ON_EDGE	(1 << 22) - -#define UTMIP_MISC_CFG1		0x828 -#define   UTMIP_PLL_ACTIVE_DLY_COUNT(x)	(((x) & 0x1f) << 18) -#define   UTMIP_PLLU_STABLE_COUNT(x)	(((x) & 0xfff) << 6) - -#define UTMIP_DEBOUNCE_CFG0	0x82c -#define   UTMIP_BIAS_DEBOUNCE_A(x)	(((x) & 0xffff) << 0) - -#define UTMIP_BAT_CHRG_CFG0	0x830 -#define   UTMIP_PD_CHRG			(1 << 0) - -#define UTMIP_SPARE_CFG0	0x834 -#define   FUSE_SETUP_SEL		(1 << 3) - -#define UTMIP_XCVR_CFG1		0x838 -#define   UTMIP_FORCE_PDDISC_POWERDOWN	(1 << 0) -#define   UTMIP_FORCE_PDCHRP_POWERDOWN	(1 << 2) -#define   UTMIP_FORCE_PDDR_POWERDOWN	(1 << 4) -#define   UTMIP_XCVR_TERM_RANGE_ADJ(x)	(((x) & 0xf) << 18) - -#define UTMIP_BIAS_CFG1		0x83c -#define   UTMIP_BIAS_PDTRK_COUNT(x)	(((x) & 0x1f) << 3) - -static DEFINE_SPINLOCK(utmip_pad_lock); -static int utmip_pad_count; - -struct tegra_xtal_freq { -	int freq; -	u8 enable_delay; -	u8 stable_count; -	u8 active_delay; -	u8 xtal_freq_count; -	u16 debounce; -}; - -static const struct tegra_xtal_freq tegra_freq_table[] = { -	{ -		.freq = 12000000, -		.enable_delay = 0x02, -		.stable_count = 0x2F, -		.active_delay = 0x04, -		.xtal_freq_count = 0x76, -		.debounce = 0x7530, -	}, -	{ -		.freq = 13000000, -		.enable_delay = 0x02, -		.stable_count = 0x33, -		.active_delay = 0x05, -		.xtal_freq_count = 0x7F, -		.debounce = 0x7EF4, -	}, -	{ -		.freq = 19200000, -		.enable_delay = 0x03, -		.stable_count = 0x4B, -		.active_delay = 0x06, -		.xtal_freq_count = 0xBB, -		.debounce = 0xBB80, -	}, -	{ -		.freq = 26000000, -		.enable_delay = 0x04, -		.stable_count = 0x66, -		.active_delay = 0x09, -		.xtal_freq_count = 0xFE, -		.debounce = 0xFDE8, -	}, -}; - -static struct tegra_utmip_config utmip_default[] = { -	[0] = { -		.hssync_start_delay = 9, -		.idle_wait_delay = 17, -		.elastic_limit = 16, -		.term_range_adj = 6, -		.xcvr_setup = 9, -		.xcvr_lsfslew = 1, -		.xcvr_lsrslew = 1, -	}, -	[2] = { -		.hssync_start_delay = 9, -		.idle_wait_delay = 17, -		.elastic_limit = 16, -		.term_range_adj = 6, -		.xcvr_setup = 9, -		.xcvr_lsfslew = 2, -		.xcvr_lsrslew = 2, -	}, -}; - -static inline bool phy_is_ulpi(struct tegra_usb_phy *phy) -{ -	return (phy->instance == 1); -} - -static int utmip_pad_open(struct tegra_usb_phy *phy) -{ -	phy->pad_clk = clk_get_sys("utmip-pad", NULL); -	if (IS_ERR(phy->pad_clk)) { -		pr_err("%s: can't get utmip pad clock\n", __func__); -		return PTR_ERR(phy->pad_clk); -	} - -	if (phy->instance == 0) { -		phy->pad_regs = phy->regs; -	} else { -		phy->pad_regs = ioremap(TEGRA_USB_BASE, TEGRA_USB_SIZE); -		if (!phy->pad_regs) { -			pr_err("%s: can't remap usb registers\n", __func__); -			clk_put(phy->pad_clk); -			return -ENOMEM; -		} -	} -	return 0; -} - -static void utmip_pad_close(struct tegra_usb_phy *phy) -{ -	if (phy->instance != 0) -		iounmap(phy->pad_regs); -	clk_put(phy->pad_clk); -} - -static void utmip_pad_power_on(struct tegra_usb_phy *phy) -{ -	unsigned long val, flags; -	void __iomem *base = phy->pad_regs; - -	clk_prepare_enable(phy->pad_clk); - -	spin_lock_irqsave(&utmip_pad_lock, flags); - -	if (utmip_pad_count++ == 0) { -		val = readl(base + UTMIP_BIAS_CFG0); -		val &= ~(UTMIP_OTGPD | UTMIP_BIASPD); -		writel(val, base + UTMIP_BIAS_CFG0); -	} - -	spin_unlock_irqrestore(&utmip_pad_lock, flags); - -	clk_disable_unprepare(phy->pad_clk); -} - -static int utmip_pad_power_off(struct tegra_usb_phy *phy) -{ -	unsigned long val, flags; -	void __iomem *base = phy->pad_regs; - -	if (!utmip_pad_count) { -		pr_err("%s: utmip pad already powered off\n", __func__); -		return -EINVAL; -	} - -	clk_prepare_enable(phy->pad_clk); - -	spin_lock_irqsave(&utmip_pad_lock, flags); - -	if (--utmip_pad_count == 0) { -		val = readl(base + UTMIP_BIAS_CFG0); -		val |= UTMIP_OTGPD | UTMIP_BIASPD; -		writel(val, base + UTMIP_BIAS_CFG0); -	} - -	spin_unlock_irqrestore(&utmip_pad_lock, flags); - -	clk_disable_unprepare(phy->pad_clk); - -	return 0; -} - -static int utmi_wait_register(void __iomem *reg, u32 mask, u32 result) -{ -	unsigned long timeout = 2000; -	do { -		if ((readl(reg) & mask) == result) -			return 0; -		udelay(1); -		timeout--; -	} while (timeout); -	return -1; -} - -static void utmi_phy_clk_disable(struct tegra_usb_phy *phy) -{ -	unsigned long val; -	void __iomem *base = phy->regs; - -	if (phy->instance == 0) { -		val = readl(base + USB_SUSP_CTRL); -		val |= USB_SUSP_SET; -		writel(val, base + USB_SUSP_CTRL); - -		udelay(10); - -		val = readl(base + USB_SUSP_CTRL); -		val &= ~USB_SUSP_SET; -		writel(val, base + USB_SUSP_CTRL); -	} - -	if (phy->instance == 2) { -		val = readl(base + USB_PORTSC1); -		val |= USB_PORTSC1_PHCD; -		writel(val, base + USB_PORTSC1); -	} - -	if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0) -		pr_err("%s: timeout waiting for phy to stabilize\n", __func__); -} - -static void utmi_phy_clk_enable(struct tegra_usb_phy *phy) -{ -	unsigned long val; -	void __iomem *base = phy->regs; - -	if (phy->instance == 0) { -		val = readl(base + USB_SUSP_CTRL); -		val |= USB_SUSP_CLR; -		writel(val, base + USB_SUSP_CTRL); - -		udelay(10); - -		val = readl(base + USB_SUSP_CTRL); -		val &= ~USB_SUSP_CLR; -		writel(val, base + USB_SUSP_CTRL); -	} - -	if (phy->instance == 2) { -		val = readl(base + USB_PORTSC1); -		val &= ~USB_PORTSC1_PHCD; -		writel(val, base + USB_PORTSC1); -	} - -	if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, -						     USB_PHY_CLK_VALID)) -		pr_err("%s: timeout waiting for phy to stabilize\n", __func__); -} - -static int utmi_phy_power_on(struct tegra_usb_phy *phy) -{ -	unsigned long val; -	void __iomem *base = phy->regs; -	struct tegra_utmip_config *config = phy->config; - -	val = readl(base + USB_SUSP_CTRL); -	val |= UTMIP_RESET; -	writel(val, base + USB_SUSP_CTRL); - -	if (phy->instance == 0) { -		val = readl(base + USB1_LEGACY_CTRL); -		val |= USB1_NO_LEGACY_MODE; -		writel(val, base + USB1_LEGACY_CTRL); -	} - -	val = readl(base + UTMIP_TX_CFG0); -	val &= ~UTMIP_FS_PREABMLE_J; -	writel(val, base + UTMIP_TX_CFG0); - -	val = readl(base + UTMIP_HSRX_CFG0); -	val &= ~(UTMIP_IDLE_WAIT(~0) | UTMIP_ELASTIC_LIMIT(~0)); -	val |= UTMIP_IDLE_WAIT(config->idle_wait_delay); -	val |= UTMIP_ELASTIC_LIMIT(config->elastic_limit); -	writel(val, base + UTMIP_HSRX_CFG0); - -	val = readl(base + UTMIP_HSRX_CFG1); -	val &= ~UTMIP_HS_SYNC_START_DLY(~0); -	val |= UTMIP_HS_SYNC_START_DLY(config->hssync_start_delay); -	writel(val, base + UTMIP_HSRX_CFG1); - -	val = readl(base + UTMIP_DEBOUNCE_CFG0); -	val &= ~UTMIP_BIAS_DEBOUNCE_A(~0); -	val |= UTMIP_BIAS_DEBOUNCE_A(phy->freq->debounce); -	writel(val, base + UTMIP_DEBOUNCE_CFG0); - -	val = readl(base + UTMIP_MISC_CFG0); -	val &= ~UTMIP_SUSPEND_EXIT_ON_EDGE; -	writel(val, base + UTMIP_MISC_CFG0); - -	val = readl(base + UTMIP_MISC_CFG1); -	val &= ~(UTMIP_PLL_ACTIVE_DLY_COUNT(~0) | UTMIP_PLLU_STABLE_COUNT(~0)); -	val |= UTMIP_PLL_ACTIVE_DLY_COUNT(phy->freq->active_delay) | -		UTMIP_PLLU_STABLE_COUNT(phy->freq->stable_count); -	writel(val, base + UTMIP_MISC_CFG1); - -	val = readl(base + UTMIP_PLL_CFG1); -	val &= ~(UTMIP_XTAL_FREQ_COUNT(~0) | UTMIP_PLLU_ENABLE_DLY_COUNT(~0)); -	val |= UTMIP_XTAL_FREQ_COUNT(phy->freq->xtal_freq_count) | -		UTMIP_PLLU_ENABLE_DLY_COUNT(phy->freq->enable_delay); -	writel(val, base + UTMIP_PLL_CFG1); - -	if (phy->mode == TEGRA_USB_PHY_MODE_DEVICE) { -		val = readl(base + USB_SUSP_CTRL); -		val &= ~(USB_WAKE_ON_CNNT_EN_DEV | USB_WAKE_ON_DISCON_EN_DEV); -		writel(val, base + USB_SUSP_CTRL); -	} - -	utmip_pad_power_on(phy); - -	val = readl(base + UTMIP_XCVR_CFG0); -	val &= ~(UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | -		 UTMIP_FORCE_PDZI_POWERDOWN | UTMIP_XCVR_SETUP(~0) | -		 UTMIP_XCVR_LSFSLEW(~0) | UTMIP_XCVR_LSRSLEW(~0) | -		 UTMIP_XCVR_HSSLEW_MSB(~0)); -	val |= UTMIP_XCVR_SETUP(config->xcvr_setup); -	val |= UTMIP_XCVR_LSFSLEW(config->xcvr_lsfslew); -	val |= UTMIP_XCVR_LSRSLEW(config->xcvr_lsrslew); -	writel(val, base + UTMIP_XCVR_CFG0); - -	val = readl(base + UTMIP_XCVR_CFG1); -	val &= ~(UTMIP_FORCE_PDDISC_POWERDOWN | UTMIP_FORCE_PDCHRP_POWERDOWN | -		 UTMIP_FORCE_PDDR_POWERDOWN | UTMIP_XCVR_TERM_RANGE_ADJ(~0)); -	val |= UTMIP_XCVR_TERM_RANGE_ADJ(config->term_range_adj); -	writel(val, base + UTMIP_XCVR_CFG1); - -	val = readl(base + UTMIP_BAT_CHRG_CFG0); -	val &= ~UTMIP_PD_CHRG; -	writel(val, base + UTMIP_BAT_CHRG_CFG0); - -	val = readl(base + UTMIP_BIAS_CFG1); -	val &= ~UTMIP_BIAS_PDTRK_COUNT(~0); -	val |= UTMIP_BIAS_PDTRK_COUNT(0x5); -	writel(val, base + UTMIP_BIAS_CFG1); - -	if (phy->instance == 0) { -		val = readl(base + UTMIP_SPARE_CFG0); -		if (phy->mode == TEGRA_USB_PHY_MODE_DEVICE) -			val &= ~FUSE_SETUP_SEL; -		else -			val |= FUSE_SETUP_SEL; -		writel(val, base + UTMIP_SPARE_CFG0); -	} - -	if (phy->instance == 2) { -		val = readl(base + USB_SUSP_CTRL); -		val |= UTMIP_PHY_ENABLE; -		writel(val, base + USB_SUSP_CTRL); -	} - -	val = readl(base + USB_SUSP_CTRL); -	val &= ~UTMIP_RESET; -	writel(val, base + USB_SUSP_CTRL); - -	if (phy->instance == 0) { -		val = readl(base + USB1_LEGACY_CTRL); -		val &= ~USB1_VBUS_SENSE_CTL_MASK; -		val |= USB1_VBUS_SENSE_CTL_A_SESS_VLD; -		writel(val, base + USB1_LEGACY_CTRL); - -		val = readl(base + USB_SUSP_CTRL); -		val &= ~USB_SUSP_SET; -		writel(val, base + USB_SUSP_CTRL); -	} - -	utmi_phy_clk_enable(phy); - -	if (phy->instance == 2) { -		val = readl(base + USB_PORTSC1); -		val &= ~USB_PORTSC1_PTS(~0); -		writel(val, base + USB_PORTSC1); -	} - -	return 0; -} - -static void utmi_phy_power_off(struct tegra_usb_phy *phy) -{ -	unsigned long val; -	void __iomem *base = phy->regs; - -	utmi_phy_clk_disable(phy); - -	if (phy->mode == TEGRA_USB_PHY_MODE_DEVICE) { -		val = readl(base + USB_SUSP_CTRL); -		val &= ~USB_WAKEUP_DEBOUNCE_COUNT(~0); -		val |= USB_WAKE_ON_CNNT_EN_DEV | USB_WAKEUP_DEBOUNCE_COUNT(5); -		writel(val, base + USB_SUSP_CTRL); -	} - -	val = readl(base + USB_SUSP_CTRL); -	val |= UTMIP_RESET; -	writel(val, base + USB_SUSP_CTRL); - -	val = readl(base + UTMIP_BAT_CHRG_CFG0); -	val |= UTMIP_PD_CHRG; -	writel(val, base + UTMIP_BAT_CHRG_CFG0); - -	val = readl(base + UTMIP_XCVR_CFG0); -	val |= UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | -	       UTMIP_FORCE_PDZI_POWERDOWN; -	writel(val, base + UTMIP_XCVR_CFG0); - -	val = readl(base + UTMIP_XCVR_CFG1); -	val |= UTMIP_FORCE_PDDISC_POWERDOWN | UTMIP_FORCE_PDCHRP_POWERDOWN | -	       UTMIP_FORCE_PDDR_POWERDOWN; -	writel(val, base + UTMIP_XCVR_CFG1); - -	utmip_pad_power_off(phy); -} - -static void utmi_phy_preresume(struct tegra_usb_phy *phy) -{ -	unsigned long val; -	void __iomem *base = phy->regs; - -	val = readl(base + UTMIP_TX_CFG0); -	val |= UTMIP_HS_DISCON_DISABLE; -	writel(val, base + UTMIP_TX_CFG0); -} - -static void utmi_phy_postresume(struct tegra_usb_phy *phy) -{ -	unsigned long val; -	void __iomem *base = phy->regs; - -	val = readl(base + UTMIP_TX_CFG0); -	val &= ~UTMIP_HS_DISCON_DISABLE; -	writel(val, base + UTMIP_TX_CFG0); -} - -static void utmi_phy_restore_start(struct tegra_usb_phy *phy, -				   enum tegra_usb_phy_port_speed port_speed) -{ -	unsigned long val; -	void __iomem *base = phy->regs; - -	val = readl(base + UTMIP_MISC_CFG0); -	val &= ~UTMIP_DPDM_OBSERVE_SEL(~0); -	if (port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) -		val |= UTMIP_DPDM_OBSERVE_SEL_FS_K; -	else -		val |= UTMIP_DPDM_OBSERVE_SEL_FS_J; -	writel(val, base + UTMIP_MISC_CFG0); -	udelay(1); - -	val = readl(base + UTMIP_MISC_CFG0); -	val |= UTMIP_DPDM_OBSERVE; -	writel(val, base + UTMIP_MISC_CFG0); -	udelay(10); -} - -static void utmi_phy_restore_end(struct tegra_usb_phy *phy) -{ -	unsigned long val; -	void __iomem *base = phy->regs; - -	val = readl(base + UTMIP_MISC_CFG0); -	val &= ~UTMIP_DPDM_OBSERVE; -	writel(val, base + UTMIP_MISC_CFG0); -	udelay(10); -} - -static int ulpi_phy_power_on(struct tegra_usb_phy *phy) -{ -	int ret; -	unsigned long val; -	void __iomem *base = phy->regs; -	struct tegra_ulpi_config *config = phy->config; - -	gpio_direction_output(config->reset_gpio, 0); -	msleep(5); -	gpio_direction_output(config->reset_gpio, 1); - -	clk_prepare_enable(phy->clk); -	msleep(1); - -	val = readl(base + USB_SUSP_CTRL); -	val |= UHSIC_RESET; -	writel(val, base + USB_SUSP_CTRL); - -	val = readl(base + ULPI_TIMING_CTRL_0); -	val |= ULPI_OUTPUT_PINMUX_BYP | ULPI_CLKOUT_PINMUX_BYP; -	writel(val, base + ULPI_TIMING_CTRL_0); - -	val = readl(base + USB_SUSP_CTRL); -	val |= ULPI_PHY_ENABLE; -	writel(val, base + USB_SUSP_CTRL); - -	val = 0; -	writel(val, base + ULPI_TIMING_CTRL_1); - -	val |= ULPI_DATA_TRIMMER_SEL(4); -	val |= ULPI_STPDIRNXT_TRIMMER_SEL(4); -	val |= ULPI_DIR_TRIMMER_SEL(4); -	writel(val, base + ULPI_TIMING_CTRL_1); -	udelay(10); - -	val |= ULPI_DATA_TRIMMER_LOAD; -	val |= ULPI_STPDIRNXT_TRIMMER_LOAD; -	val |= ULPI_DIR_TRIMMER_LOAD; -	writel(val, base + ULPI_TIMING_CTRL_1); - -	/* Fix VbusInvalid due to floating VBUS */ -	ret = usb_phy_io_write(phy->ulpi, 0x40, 0x08); -	if (ret) { -		pr_err("%s: ulpi write failed\n", __func__); -		return ret; -	} - -	ret = usb_phy_io_write(phy->ulpi, 0x80, 0x0B); -	if (ret) { -		pr_err("%s: ulpi write failed\n", __func__); -		return ret; -	} - -	val = readl(base + USB_PORTSC1); -	val |= USB_PORTSC1_WKOC | USB_PORTSC1_WKDS | USB_PORTSC1_WKCN; -	writel(val, base + USB_PORTSC1); - -	val = readl(base + USB_SUSP_CTRL); -	val |= USB_SUSP_CLR; -	writel(val, base + USB_SUSP_CTRL); -	udelay(100); - -	val = readl(base + USB_SUSP_CTRL); -	val &= ~USB_SUSP_CLR; -	writel(val, base + USB_SUSP_CTRL); - -	return 0; -} - -static void ulpi_phy_power_off(struct tegra_usb_phy *phy) -{ -	unsigned long val; -	void __iomem *base = phy->regs; -	struct tegra_ulpi_config *config = phy->config; - -	/* Clear WKCN/WKDS/WKOC wake-on events that can cause the USB -	 * Controller to immediately bring the ULPI PHY out of low power -	 */ -	val = readl(base + USB_PORTSC1); -	val &= ~(USB_PORTSC1_WKOC | USB_PORTSC1_WKDS | USB_PORTSC1_WKCN); -	writel(val, base + USB_PORTSC1); - -	gpio_direction_output(config->reset_gpio, 0); -	clk_disable(phy->clk); -} - -struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, -	void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode) -{ -	struct tegra_usb_phy *phy; -	struct tegra_ulpi_config *ulpi_config; -	unsigned long parent_rate; -	int i; -	int err; - -	phy = kmalloc(sizeof(struct tegra_usb_phy), GFP_KERNEL); -	if (!phy) -		return ERR_PTR(-ENOMEM); - -	phy->instance = instance; -	phy->regs = regs; -	phy->config = config; -	phy->mode = phy_mode; - -	if (!phy->config) { -		if (phy_is_ulpi(phy)) { -			pr_err("%s: ulpi phy configuration missing", __func__); -			err = -EINVAL; -			goto err0; -		} else { -			phy->config = &utmip_default[instance]; -		} -	} - -	phy->pll_u = clk_get_sys(NULL, "pll_u"); -	if (IS_ERR(phy->pll_u)) { -		pr_err("Can't get pll_u clock\n"); -		err = PTR_ERR(phy->pll_u); -		goto err0; -	} -	clk_prepare_enable(phy->pll_u); - -	parent_rate = clk_get_rate(clk_get_parent(phy->pll_u)); -	for (i = 0; i < ARRAY_SIZE(tegra_freq_table); i++) { -		if (tegra_freq_table[i].freq == parent_rate) { -			phy->freq = &tegra_freq_table[i]; -			break; -		} -	} -	if (!phy->freq) { -		pr_err("invalid pll_u parent rate %ld\n", parent_rate); -		err = -EINVAL; -		goto err1; -	} - -	if (phy_is_ulpi(phy)) { -		ulpi_config = config; -		phy->clk = clk_get_sys(NULL, ulpi_config->clk); -		if (IS_ERR(phy->clk)) { -			pr_err("%s: can't get ulpi clock\n", __func__); -			err = -ENXIO; -			goto err1; -		} -		if (!gpio_is_valid(ulpi_config->reset_gpio)) -			ulpi_config->reset_gpio = -				of_get_named_gpio(dev->of_node, -						  "nvidia,phy-reset-gpio", 0); -		if (!gpio_is_valid(ulpi_config->reset_gpio)) { -			pr_err("%s: invalid reset gpio: %d\n", __func__, -			       ulpi_config->reset_gpio); -			err = -EINVAL; -			goto err1; -		} -		gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b"); -		gpio_direction_output(ulpi_config->reset_gpio, 0); -		phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); -		phy->ulpi->io_priv = regs + ULPI_VIEWPORT; -	} else { -		err = utmip_pad_open(phy); -		if (err < 0) -			goto err1; -	} - -	return phy; - -err1: -	clk_disable_unprepare(phy->pll_u); -	clk_put(phy->pll_u); -err0: -	kfree(phy); -	return ERR_PTR(err); -} -EXPORT_SYMBOL_GPL(tegra_usb_phy_open); - -int tegra_usb_phy_power_on(struct tegra_usb_phy *phy) -{ -	if (phy_is_ulpi(phy)) -		return ulpi_phy_power_on(phy); -	else -		return utmi_phy_power_on(phy); -} -EXPORT_SYMBOL_GPL(tegra_usb_phy_power_on); - -void tegra_usb_phy_power_off(struct tegra_usb_phy *phy) -{ -	if (phy_is_ulpi(phy)) -		ulpi_phy_power_off(phy); -	else -		utmi_phy_power_off(phy); -} -EXPORT_SYMBOL_GPL(tegra_usb_phy_power_off); - -void tegra_usb_phy_preresume(struct tegra_usb_phy *phy) -{ -	if (!phy_is_ulpi(phy)) -		utmi_phy_preresume(phy); -} -EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume); - -void tegra_usb_phy_postresume(struct tegra_usb_phy *phy) -{ -	if (!phy_is_ulpi(phy)) -		utmi_phy_postresume(phy); -} -EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume); - -void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, -				 enum tegra_usb_phy_port_speed port_speed) -{ -	if (!phy_is_ulpi(phy)) -		utmi_phy_restore_start(phy, port_speed); -} -EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start); - -void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy) -{ -	if (!phy_is_ulpi(phy)) -		utmi_phy_restore_end(phy); -} -EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end); - -void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy) -{ -	if (!phy_is_ulpi(phy)) -		utmi_phy_clk_disable(phy); -} -EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_disable); - -void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy) -{ -	if (!phy_is_ulpi(phy)) -		utmi_phy_clk_enable(phy); -} -EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_enable); - -void tegra_usb_phy_close(struct tegra_usb_phy *phy) -{ -	if (phy_is_ulpi(phy)) -		clk_put(phy->clk); -	else -		utmip_pad_close(phy); -	clk_disable_unprepare(phy->pll_u); -	clk_put(phy->pll_u); -	kfree(phy); -} -EXPORT_SYMBOL_GPL(tegra_usb_phy_close); diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index 53d3d46dec1..c77c86c4736 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig @@ -11,6 +11,7 @@ config UX500_SOC_COMMON  	select CACHE_L2X0  	select PINCTRL  	select PINCTRL_NOMADIK +	select COMMON_CLK  config UX500_SOC_DB8500  	bool @@ -28,6 +29,7 @@ config MACH_MOP500  	select I2C  	select I2C_NOMADIK  	select SOC_BUS +	select REGULATOR_FIXED_VOLTAGE  	help  	  Include support for the MOP500 development platform. diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 026086ff9e6..5691ef679d0 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -2,7 +2,7 @@  # Makefile for the linux kernel, U8500 machine.  # -obj-y				:= clock.o cpu.o devices.o devices-common.o \ +obj-y				:= cpu.o devices.o devices-common.o \  				   id.o usb.o timer.o  obj-$(CONFIG_CPU_IDLE)          += cpuidle.o  obj-$(CONFIG_CACHE_L2X0)	+= cache-l2x0.o diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c index 52426a42578..2a17bc506cf 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.c +++ b/arch/arm/mach-ux500/board-mop500-regulators.c @@ -13,6 +13,21 @@  #include <linux/regulator/ab8500.h>  #include "board-mop500-regulators.h" +static struct regulator_consumer_supply gpio_en_3v3_consumers[] = { +       REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), +}; + +struct regulator_init_data gpio_en_3v3_regulator = { +       .constraints = { +               .name = "EN-3V3", +               .min_uV = 3300000, +               .max_uV = 3300000, +               .valid_ops_mask = REGULATOR_CHANGE_STATUS, +       }, +       .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers), +       .consumer_supplies = gpio_en_3v3_consumers, +}; +  /*   * TPS61052 regulator   */ diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h index 94992158d96..78a0642a220 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.h +++ b/arch/arm/mach-ux500/board-mop500-regulators.h @@ -18,5 +18,6 @@ extern struct ab8500_regulator_reg_init  ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS];  extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS];  extern struct regulator_init_data tps61052_regulator; +extern struct regulator_init_data gpio_en_3v3_regulator;  #endif diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 1d2e3c6f8b5..c8922bca68a 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -23,6 +23,7 @@  #include <linux/spi/spi.h>  #include <linux/mfd/abx500/ab8500.h>  #include <linux/regulator/ab8500.h> +#include <linux/regulator/fixed.h>  #include <linux/mfd/tc3589x.h>  #include <linux/mfd/tps6105x.h>  #include <linux/mfd/abx500/ab8500-gpio.h> @@ -76,6 +77,23 @@ static struct platform_device snowball_led_dev = {  	},  }; +static struct fixed_voltage_config snowball_gpio_en_3v3_data = { +       .supply_name            = "EN-3V3", +       .gpio                   = SNOWBALL_EN_3V3_ETH_GPIO, +       .microvolts             = 3300000, +       .enable_high            = 1, +       .init_data              = &gpio_en_3v3_regulator, +       .startup_delay          = 5000, /* 1200us */ +}; + +static struct platform_device snowball_gpio_en_3v3_regulator_dev = { +       .name   = "reg-fixed-voltage", +       .id     = 1, +       .dev    = { +               .platform_data  = &snowball_gpio_en_3v3_data, +       }, +}; +  static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {  	.gpio_base		= MOP500_AB8500_PIN_GPIO(1),  	.irq_base		= MOP500_AB8500_VIR_GPIO_IRQ_BASE, @@ -565,6 +583,7 @@ static struct platform_device *snowball_platform_devs[] __initdata = {  	&snowball_led_dev,  	&snowball_key_dev,  	&snowball_sbnet_dev, +	&snowball_gpio_en_3v3_regulator_dev,  };  static void __init mop500_init_machine(void) diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c deleted file mode 100644 index 8d73b066a18..00000000000 --- a/arch/arm/mach-ux500/clock.c +++ /dev/null @@ -1,715 +0,0 @@ -/* - *  Copyright (C) 2009 ST-Ericsson - *  Copyright (C) 2009 STMicroelectronics - * - * 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/module.h> -#include <linux/kernel.h> -#include <linux/list.h> -#include <linux/errno.h> -#include <linux/err.h> -#include <linux/clk.h> -#include <linux/io.h> -#include <linux/clkdev.h> -#include <linux/cpufreq.h> - -#include <plat/mtu.h> -#include <mach/hardware.h> -#include "clock.h" - -#ifdef CONFIG_DEBUG_FS -#include <linux/debugfs.h> -#include <linux/uaccess.h>	/* for copy_from_user */ -static LIST_HEAD(clk_list); -#endif - -#define PRCC_PCKEN		0x00 -#define PRCC_PCKDIS		0x04 -#define PRCC_KCKEN		0x08 -#define PRCC_KCKDIS		0x0C - -#define PRCM_YYCLKEN0_MGT_SET	0x510 -#define PRCM_YYCLKEN1_MGT_SET	0x514 -#define PRCM_YYCLKEN0_MGT_CLR	0x518 -#define PRCM_YYCLKEN1_MGT_CLR	0x51C -#define PRCM_YYCLKEN0_MGT_VAL	0x520 -#define PRCM_YYCLKEN1_MGT_VAL	0x524 - -#define PRCM_SVAMMDSPCLK_MGT	0x008 -#define PRCM_SIAMMDSPCLK_MGT	0x00C -#define PRCM_SGACLK_MGT		0x014 -#define PRCM_UARTCLK_MGT	0x018 -#define PRCM_MSP02CLK_MGT	0x01C -#define PRCM_MSP1CLK_MGT	0x288 -#define PRCM_I2CCLK_MGT		0x020 -#define PRCM_SDMMCCLK_MGT	0x024 -#define PRCM_SLIMCLK_MGT	0x028 -#define PRCM_PER1CLK_MGT	0x02C -#define PRCM_PER2CLK_MGT	0x030 -#define PRCM_PER3CLK_MGT	0x034 -#define PRCM_PER5CLK_MGT	0x038 -#define PRCM_PER6CLK_MGT	0x03C -#define PRCM_PER7CLK_MGT	0x040 -#define PRCM_LCDCLK_MGT		0x044 -#define PRCM_BMLCLK_MGT		0x04C -#define PRCM_HSITXCLK_MGT	0x050 -#define PRCM_HSIRXCLK_MGT	0x054 -#define PRCM_HDMICLK_MGT	0x058 -#define PRCM_APEATCLK_MGT	0x05C -#define PRCM_APETRACECLK_MGT	0x060 -#define PRCM_MCDECLK_MGT	0x064 -#define PRCM_IPI2CCLK_MGT	0x068 -#define PRCM_DSIALTCLK_MGT	0x06C -#define PRCM_DMACLK_MGT		0x074 -#define PRCM_B2R2CLK_MGT	0x078 -#define PRCM_TVCLK_MGT		0x07C -#define PRCM_TCR		0x1C8 -#define PRCM_TCR_STOPPED	(1 << 16) -#define PRCM_TCR_DOZE_MODE	(1 << 17) -#define PRCM_UNIPROCLK_MGT	0x278 -#define PRCM_SSPCLK_MGT		0x280 -#define PRCM_RNGCLK_MGT		0x284 -#define PRCM_UICCCLK_MGT	0x27C - -#define PRCM_MGT_ENABLE		(1 << 8) - -static DEFINE_SPINLOCK(clocks_lock); - -static void __clk_enable(struct clk *clk) -{ -	if (clk->enabled++ == 0) { -		if (clk->parent_cluster) -			__clk_enable(clk->parent_cluster); - -		if (clk->parent_periph) -			__clk_enable(clk->parent_periph); - -		if (clk->ops && clk->ops->enable) -			clk->ops->enable(clk); -	} -} - -int clk_enable(struct clk *clk) -{ -	unsigned long flags; - -	spin_lock_irqsave(&clocks_lock, flags); -	__clk_enable(clk); -	spin_unlock_irqrestore(&clocks_lock, flags); - -	return 0; -} -EXPORT_SYMBOL(clk_enable); - -static void __clk_disable(struct clk *clk) -{ -	if (--clk->enabled == 0) { -		if (clk->ops && clk->ops->disable) -			clk->ops->disable(clk); - -		if (clk->parent_periph) -			__clk_disable(clk->parent_periph); - -		if (clk->parent_cluster) -			__clk_disable(clk->parent_cluster); -	} -} - -void clk_disable(struct clk *clk) -{ -	unsigned long flags; - -	WARN_ON(!clk->enabled); - -	spin_lock_irqsave(&clocks_lock, flags); -	__clk_disable(clk); -	spin_unlock_irqrestore(&clocks_lock, flags); -} -EXPORT_SYMBOL(clk_disable); - -/* - * The MTU has a separate, rather complex muxing setup - * with alternative parents (peripheral cluster or - * ULP or fixed 32768 Hz) depending on settings - */ -static unsigned long clk_mtu_get_rate(struct clk *clk) -{ -	void __iomem *addr; -	u32 tcr; -	int mtu = (int) clk->data; -	/* -	 * One of these is selected eventually -	 * TODO: Replace the constant with a reference -	 * to the ULP source once this is modeled. -	 */ -	unsigned long clk32k = 32768; -	unsigned long mturate; -	unsigned long retclk; - -	if (cpu_is_u8500_family()) -		addr = __io_address(U8500_PRCMU_BASE); -	else -		ux500_unknown_soc(); - -	/* -	 * On a startup, always conifgure the TCR to the doze mode; -	 * bootloaders do it for us. Do this in the kernel too. -	 */ -	writel(PRCM_TCR_DOZE_MODE, addr + PRCM_TCR); - -	tcr = readl(addr + PRCM_TCR); - -	/* Get the rate from the parent as a default */ -	if (clk->parent_periph) -		mturate = clk_get_rate(clk->parent_periph); -	else if (clk->parent_cluster) -		mturate = clk_get_rate(clk->parent_cluster); -	else -		/* We need to be connected SOMEWHERE */ -		BUG(); - -	/* Return the clock selected for this MTU */ -	if (tcr & (1 << mtu)) -		retclk = clk32k; -	else -		retclk = mturate; - -	pr_info("MTU%d clock rate: %lu Hz\n", mtu, retclk); -	return retclk; -} - -unsigned long clk_get_rate(struct clk *clk) -{ -	unsigned long rate; - -	/* -	 * If there is a custom getrate callback for this clock, -	 * it will take precedence. -	 */ -	if (clk->get_rate) -		return clk->get_rate(clk); - -	if (clk->ops && clk->ops->get_rate) -		return clk->ops->get_rate(clk); - -	rate = clk->rate; -	if (!rate) { -		if (clk->parent_periph) -			rate = clk_get_rate(clk->parent_periph); -		else if (clk->parent_cluster) -			rate = clk_get_rate(clk->parent_cluster); -	} - -	return rate; -} -EXPORT_SYMBOL(clk_get_rate); - -long clk_round_rate(struct clk *clk, unsigned long rate) -{ -	/*TODO*/ -	return rate; -} -EXPORT_SYMBOL(clk_round_rate); - -int clk_set_rate(struct clk *clk, unsigned long rate) -{ -	clk->rate = rate; -	return 0; -} -EXPORT_SYMBOL(clk_set_rate); - -int clk_set_parent(struct clk *clk, struct clk *parent) -{ -	/*TODO*/ -	return -ENOSYS; -} -EXPORT_SYMBOL(clk_set_parent); - -static void clk_prcmu_enable(struct clk *clk) -{ -	void __iomem *cg_set_reg = __io_address(U8500_PRCMU_BASE) -				   + PRCM_YYCLKEN0_MGT_SET + clk->prcmu_cg_off; - -	writel(1 << clk->prcmu_cg_bit, cg_set_reg); -} - -static void clk_prcmu_disable(struct clk *clk) -{ -	void __iomem *cg_clr_reg = __io_address(U8500_PRCMU_BASE) -				   + PRCM_YYCLKEN0_MGT_CLR + clk->prcmu_cg_off; - -	writel(1 << clk->prcmu_cg_bit, cg_clr_reg); -} - -static struct clkops clk_prcmu_ops = { -	.enable = clk_prcmu_enable, -	.disable = clk_prcmu_disable, -}; - -static unsigned int clkrst_base[] = { -	[1] = U8500_CLKRST1_BASE, -	[2] = U8500_CLKRST2_BASE, -	[3] = U8500_CLKRST3_BASE, -	[5] = U8500_CLKRST5_BASE, -	[6] = U8500_CLKRST6_BASE, -}; - -static void clk_prcc_enable(struct clk *clk) -{ -	void __iomem *addr = __io_address(clkrst_base[clk->cluster]); - -	if (clk->prcc_kernel != -1) -		writel(1 << clk->prcc_kernel, addr + PRCC_KCKEN); - -	if (clk->prcc_bus != -1) -		writel(1 << clk->prcc_bus, addr + PRCC_PCKEN); -} - -static void clk_prcc_disable(struct clk *clk) -{ -	void __iomem *addr = __io_address(clkrst_base[clk->cluster]); - -	if (clk->prcc_bus != -1) -		writel(1 << clk->prcc_bus, addr + PRCC_PCKDIS); - -	if (clk->prcc_kernel != -1) -		writel(1 << clk->prcc_kernel, addr + PRCC_KCKDIS); -} - -static struct clkops clk_prcc_ops = { -	.enable = clk_prcc_enable, -	.disable = clk_prcc_disable, -}; - -static struct clk clk_32khz = { -	.name =  "clk_32khz", -	.rate = 32000, -}; - -/* - * PRCMU level clock gating - */ - -/* Bank 0 */ -static DEFINE_PRCMU_CLK(svaclk,		0x0, 2, SVAMMDSPCLK); -static DEFINE_PRCMU_CLK(siaclk,		0x0, 3, SIAMMDSPCLK); -static DEFINE_PRCMU_CLK(sgaclk,		0x0, 4, SGACLK); -static DEFINE_PRCMU_CLK_RATE(uartclk,	0x0, 5, UARTCLK, 38400000); -static DEFINE_PRCMU_CLK(msp02clk,	0x0, 6, MSP02CLK); -static DEFINE_PRCMU_CLK(msp1clk,	0x0, 7, MSP1CLK); /* v1 */ -static DEFINE_PRCMU_CLK_RATE(i2cclk,	0x0, 8, I2CCLK, 48000000); -static DEFINE_PRCMU_CLK_RATE(sdmmcclk,	0x0, 9, SDMMCCLK, 100000000); -static DEFINE_PRCMU_CLK(slimclk,	0x0, 10, SLIMCLK); -static DEFINE_PRCMU_CLK(per1clk,	0x0, 11, PER1CLK); -static DEFINE_PRCMU_CLK(per2clk,	0x0, 12, PER2CLK); -static DEFINE_PRCMU_CLK(per3clk,	0x0, 13, PER3CLK); -static DEFINE_PRCMU_CLK(per5clk,	0x0, 14, PER5CLK); -static DEFINE_PRCMU_CLK_RATE(per6clk,	0x0, 15, PER6CLK, 133330000); -static DEFINE_PRCMU_CLK(lcdclk,		0x0, 17, LCDCLK); -static DEFINE_PRCMU_CLK(bmlclk,		0x0, 18, BMLCLK); -static DEFINE_PRCMU_CLK(hsitxclk,	0x0, 19, HSITXCLK); -static DEFINE_PRCMU_CLK(hsirxclk,	0x0, 20, HSIRXCLK); -static DEFINE_PRCMU_CLK(hdmiclk,	0x0, 21, HDMICLK); -static DEFINE_PRCMU_CLK(apeatclk,	0x0, 22, APEATCLK); -static DEFINE_PRCMU_CLK(apetraceclk,	0x0, 23, APETRACECLK); -static DEFINE_PRCMU_CLK(mcdeclk,	0x0, 24, MCDECLK); -static DEFINE_PRCMU_CLK(ipi2clk,	0x0, 25, IPI2CCLK); -static DEFINE_PRCMU_CLK(dsialtclk,	0x0, 26, DSIALTCLK); /* v1 */ -static DEFINE_PRCMU_CLK(dmaclk,		0x0, 27, DMACLK); -static DEFINE_PRCMU_CLK(b2r2clk,	0x0, 28, B2R2CLK); -static DEFINE_PRCMU_CLK(tvclk,		0x0, 29, TVCLK); -static DEFINE_PRCMU_CLK(uniproclk,	0x0, 30, UNIPROCLK); /* v1 */ -static DEFINE_PRCMU_CLK_RATE(sspclk,	0x0, 31, SSPCLK, 48000000); /* v1 */ - -/* Bank 1 */ -static DEFINE_PRCMU_CLK(rngclk,		0x4, 0, RNGCLK); /* v1 */ -static DEFINE_PRCMU_CLK(uiccclk,	0x4, 1, UICCCLK); /* v1 */ - -/* - * PRCC level clock gating - * Format: per#, clk, PCKEN bit, KCKEN bit, parent - */ - -/* Peripheral Cluster #1 */ -static DEFINE_PRCC_CLK(1, msp3,		11, 10, &clk_msp1clk); -static DEFINE_PRCC_CLK(1, i2c4,		10, 9, &clk_i2cclk); -static DEFINE_PRCC_CLK(1, gpio0,	9, -1, NULL); -static DEFINE_PRCC_CLK(1, slimbus0,	8,  8, &clk_slimclk); -static DEFINE_PRCC_CLK(1, spi3,		7, -1, NULL); -static DEFINE_PRCC_CLK(1, i2c2,		6,  6, &clk_i2cclk); -static DEFINE_PRCC_CLK(1, sdi0,		5,  5, &clk_sdmmcclk); -static DEFINE_PRCC_CLK(1, msp1,		4,  4, &clk_msp1clk); -static DEFINE_PRCC_CLK(1, msp0,		3,  3, &clk_msp02clk); -static DEFINE_PRCC_CLK(1, i2c1,		2,  2, &clk_i2cclk); -static DEFINE_PRCC_CLK(1, uart1,	1,  1, &clk_uartclk); -static DEFINE_PRCC_CLK(1, uart0,	0,  0, &clk_uartclk); - -/* Peripheral Cluster #2 */ -static DEFINE_PRCC_CLK(2, gpio1,	11, -1, NULL); -static DEFINE_PRCC_CLK(2, ssitx,	10,  7, NULL); -static DEFINE_PRCC_CLK(2, ssirx,	 9,  6, NULL); -static DEFINE_PRCC_CLK(2, spi0,		8, -1, NULL); -static DEFINE_PRCC_CLK(2, sdi3,		7,  5, &clk_sdmmcclk); -static DEFINE_PRCC_CLK(2, sdi1,		6,  4, &clk_sdmmcclk); -static DEFINE_PRCC_CLK(2, msp2,		5,  3, &clk_msp02clk); -static DEFINE_PRCC_CLK(2, sdi4,		4,  2, &clk_sdmmcclk); -static DEFINE_PRCC_CLK(2, pwl,		3,  1, NULL); -static DEFINE_PRCC_CLK(2, spi1,		2, -1, NULL); -static DEFINE_PRCC_CLK(2, spi2,		1, -1, NULL); -static DEFINE_PRCC_CLK(2, i2c3,		0,  0, &clk_i2cclk); - -/* Peripheral Cluster #3 */ -static DEFINE_PRCC_CLK(3, gpio2,	8, -1, NULL); -static DEFINE_PRCC_CLK(3, sdi5,		7,  7, &clk_sdmmcclk); -static DEFINE_PRCC_CLK(3, uart2,	6,  6, &clk_uartclk); -static DEFINE_PRCC_CLK(3, ske,		5,  5, &clk_32khz); -static DEFINE_PRCC_CLK(3, sdi2,		4,  4, &clk_sdmmcclk); -static DEFINE_PRCC_CLK(3, i2c0,		3,  3, &clk_i2cclk); -static DEFINE_PRCC_CLK(3, ssp1,		2,  2, &clk_sspclk); -static DEFINE_PRCC_CLK(3, ssp0,		1,  1, &clk_sspclk); -static DEFINE_PRCC_CLK(3, fsmc,		0, -1, NULL); - -/* Peripheral Cluster #4 is in the always on domain */ - -/* Peripheral Cluster #5 */ -static DEFINE_PRCC_CLK(5, gpio3,	1, -1, NULL); -static DEFINE_PRCC_CLK(5, usb,		0,  0, NULL); - -/* Peripheral Cluster #6 */ - -/* MTU ID in data */ -static DEFINE_PRCC_CLK_CUSTOM(6, mtu1, 9, -1, NULL, clk_mtu_get_rate, 1); -static DEFINE_PRCC_CLK_CUSTOM(6, mtu0, 8, -1, NULL, clk_mtu_get_rate, 0); -static DEFINE_PRCC_CLK(6, cfgreg,	7,  7, NULL); -static DEFINE_PRCC_CLK(6, hash1,	6, -1, NULL); -static DEFINE_PRCC_CLK(6, unipro,	5,  1, &clk_uniproclk); -static DEFINE_PRCC_CLK(6, pka,		4, -1, NULL); -static DEFINE_PRCC_CLK(6, hash0,	3, -1, NULL); -static DEFINE_PRCC_CLK(6, cryp0,	2, -1, NULL); -static DEFINE_PRCC_CLK(6, cryp1,    1, -1, NULL); -static DEFINE_PRCC_CLK(6, rng,	0,  0, &clk_rngclk); - -static struct clk clk_dummy_apb_pclk = { -	.name = "apb_pclk", -}; - -static struct clk_lookup u8500_clks[] = { -	CLK(dummy_apb_pclk, NULL,	"apb_pclk"), - -	/* Peripheral Cluster #1 */ -	CLK(gpio0,	"gpio.0",	NULL), -	CLK(gpio0,	"gpio.1",	NULL), -	CLK(slimbus0,	"slimbus0",	NULL), -	CLK(i2c2,	"nmk-i2c.2",	NULL), -	CLK(sdi0,	"sdi0",		NULL), -	CLK(msp0,	"ux500-msp-i2s.0",	NULL), -	CLK(i2c1,	"nmk-i2c.1",	NULL), -	CLK(uart1,	"uart1",	NULL), -	CLK(uart0,	"uart0",	NULL), - -	/* Peripheral Cluster #3 */ -	CLK(gpio2,	"gpio.2",	NULL), -	CLK(gpio2,	"gpio.3",	NULL), -	CLK(gpio2,	"gpio.4",	NULL), -	CLK(gpio2,	"gpio.5",	NULL), -	CLK(sdi5,	"sdi5",		NULL), -	CLK(uart2,	"uart2",	NULL), -	CLK(ske,	"ske",		NULL), -	CLK(ske,	"nmk-ske-keypad",	NULL), -	CLK(sdi2,	"sdi2",		NULL), -	CLK(i2c0,	"nmk-i2c.0",	NULL), -	CLK(fsmc,	"fsmc",		NULL), - -	/* Peripheral Cluster #5 */ -	CLK(gpio3,	"gpio.8",	NULL), - -	/* Peripheral Cluster #6 */ -	CLK(hash1,	"hash1",	NULL), -	CLK(pka,	"pka",		NULL), -	CLK(hash0,	"hash0",	NULL), -	CLK(cryp0,	"cryp0",	NULL), -	CLK(cryp1,  "cryp1",    NULL), - -	/* PRCMU level clock gating */ - -	/* Bank 0 */ -	CLK(svaclk,	"sva",		NULL), -	CLK(siaclk,	"sia",		NULL), -	CLK(sgaclk,	"sga",		NULL), -	CLK(slimclk,	"slim",		NULL), -	CLK(lcdclk,	"lcd",		NULL), -	CLK(bmlclk,	"bml",		NULL), -	CLK(hsitxclk,	"stm-hsi.0",	NULL), -	CLK(hsirxclk,	"stm-hsi.1",	NULL), -	CLK(hdmiclk,	"hdmi",		NULL), -	CLK(apeatclk,	"apeat",	NULL), -	CLK(apetraceclk,	"apetrace",	NULL), -	CLK(mcdeclk,	"mcde",		NULL), -	CLK(ipi2clk,	"ipi2",		NULL), -	CLK(dmaclk,	"dma40.0",	NULL), -	CLK(b2r2clk,	"b2r2",		NULL), -	CLK(tvclk,	"tv",		NULL), - -	/* Peripheral Cluster #1 */ -	CLK(i2c4,	"nmk-i2c.4",	NULL), -	CLK(spi3,	"spi3",		NULL), -	CLK(msp1,	"ux500-msp-i2s.1",	NULL), -	CLK(msp3,	"ux500-msp-i2s.3",	NULL), - -	/* Peripheral Cluster #2 */ -	CLK(gpio1,	"gpio.6",	NULL), -	CLK(gpio1,	"gpio.7",	NULL), -	CLK(ssitx,	"ssitx",	NULL), -	CLK(ssirx,	"ssirx",	NULL), -	CLK(spi0,	"spi0",		NULL), -	CLK(sdi3,	"sdi3",		NULL), -	CLK(sdi1,	"sdi1",		NULL), -	CLK(msp2,	"ux500-msp-i2s.2",	NULL), -	CLK(sdi4,	"sdi4",		NULL), -	CLK(pwl,	"pwl",		NULL), -	CLK(spi1,	"spi1",		NULL), -	CLK(spi2,	"spi2",		NULL), -	CLK(i2c3,	"nmk-i2c.3",	NULL), - -	/* Peripheral Cluster #3 */ -	CLK(ssp1,	"ssp1",		NULL), -	CLK(ssp0,	"ssp0",		NULL), - -	/* Peripheral Cluster #5 */ -	CLK(usb,	"musb-ux500.0",	"usb"), - -	/* Peripheral Cluster #6 */ -	CLK(mtu1,	"mtu1",		NULL), -	CLK(mtu0,	"mtu0",		NULL), -	CLK(cfgreg,	"cfgreg",	NULL), -	CLK(hash1,	"hash1",	NULL), -	CLK(unipro,	"unipro",	NULL), -	CLK(rng,	"rng",		NULL), - -	/* PRCMU level clock gating */ - -	/* Bank 0 */ -	CLK(uniproclk,	"uniproclk",	NULL), -	CLK(dsialtclk,	"dsialt",	NULL), - -	/* Bank 1 */ -	CLK(rngclk,	"rng",		NULL), -	CLK(uiccclk,	"uicc",		NULL), -}; - -#ifdef CONFIG_DEBUG_FS -/* - *	debugfs support to trace clock tree hierarchy and attributes with - *	powerdebug - */ -static struct dentry *clk_debugfs_root; - -void __init clk_debugfs_add_table(struct clk_lookup *cl, size_t num) -{ -	while (num--) { -		/* Check that the clock has not been already registered */ -		if (!(cl->clk->list.prev != cl->clk->list.next)) -			list_add_tail(&cl->clk->list, &clk_list); - -		cl++; -	} -} - -static ssize_t usecount_dbg_read(struct file *file, char __user *buf, -						  size_t size, loff_t *off) -{ -	struct clk *clk = file->f_dentry->d_inode->i_private; -	char cusecount[128]; -	unsigned int len; - -	len = sprintf(cusecount, "%u\n", clk->enabled); -	return simple_read_from_buffer(buf, size, off, cusecount, len); -} - -static ssize_t rate_dbg_read(struct file *file, char __user *buf, -					  size_t size, loff_t *off) -{ -	struct clk *clk = file->f_dentry->d_inode->i_private; -	char crate[128]; -	unsigned int rate; -	unsigned int len; - -	rate = clk_get_rate(clk); -	len = sprintf(crate, "%u\n", rate); -	return simple_read_from_buffer(buf, size, off, crate, len); -} - -static const struct file_operations usecount_fops = { -	.read = usecount_dbg_read, -}; - -static const struct file_operations set_rate_fops = { -	.read = rate_dbg_read, -}; - -static struct dentry *clk_debugfs_register_dir(struct clk *c, -						struct dentry *p_dentry) -{ -	struct dentry *d, *clk_d; -	const char *p = c->name; - -	if (!p) -		p = "BUG"; - -	clk_d = debugfs_create_dir(p, p_dentry); -	if (!clk_d) -		return NULL; - -	d = debugfs_create_file("usecount", S_IRUGO, -				clk_d, c, &usecount_fops); -	if (!d) -		goto err_out; -	d = debugfs_create_file("rate", S_IRUGO, -				clk_d, c, &set_rate_fops); -	if (!d) -		goto err_out; -	/* -	 * TODO : not currently available in ux500 -	 * d = debugfs_create_x32("flags", S_IRUGO, clk_d, (u32 *)&c->flags); -	 * if (!d) -	 *	goto err_out; -	 */ - -	return clk_d; - -err_out: -	debugfs_remove_recursive(clk_d); -	return NULL; -} - -static int clk_debugfs_register_one(struct clk *c) -{ -	struct clk *pa = c->parent_periph; -	struct clk *bpa = c->parent_cluster; - -	if (!(bpa && !pa)) { -		c->dent = clk_debugfs_register_dir(c, -				pa ? pa->dent : clk_debugfs_root); -		if (!c->dent) -			return -ENOMEM; -	} - -	if (bpa) { -		c->dent_bus = clk_debugfs_register_dir(c, -				bpa->dent_bus ? bpa->dent_bus : bpa->dent); -		if ((!c->dent_bus) &&  (c->dent)) { -			debugfs_remove_recursive(c->dent); -			c->dent = NULL; -			return -ENOMEM; -		} -	} -	return 0; -} - -static int clk_debugfs_register(struct clk *c) -{ -	int err; -	struct clk *pa = c->parent_periph; -	struct clk *bpa = c->parent_cluster; - -	if (pa && (!pa->dent && !pa->dent_bus)) { -		err = clk_debugfs_register(pa); -		if (err) -			return err; -	} - -	if (bpa && (!bpa->dent && !bpa->dent_bus)) { -		err = clk_debugfs_register(bpa); -		if (err) -			return err; -	} - -	if ((!c->dent) && (!c->dent_bus)) { -		err = clk_debugfs_register_one(c); -		if (err) -			return err; -	} -	return 0; -} - -int __init clk_debugfs_init(void) -{ -	struct clk *c; -	struct dentry *d; -	int err; - -	d = debugfs_create_dir("clock", NULL); -	if (!d) -		return -ENOMEM; -	clk_debugfs_root = d; - -	list_for_each_entry(c, &clk_list, list) { -		err = clk_debugfs_register(c); -		if (err) -			goto err_out; -	} -	return 0; -err_out: -	debugfs_remove_recursive(clk_debugfs_root); -	return err; -} - -#endif /* defined(CONFIG_DEBUG_FS) */ - -unsigned long clk_smp_twd_rate = 500000000; - -unsigned long clk_smp_twd_get_rate(struct clk *clk) -{ -	return clk_smp_twd_rate; -} - -static struct clk clk_smp_twd = { -	.get_rate = clk_smp_twd_get_rate, -	.name =  "smp_twd", -}; - -static struct clk_lookup clk_smp_twd_lookup = { -	.dev_id = "smp_twd", -	.clk = &clk_smp_twd, -}; - -#ifdef CONFIG_CPU_FREQ - -static int clk_twd_cpufreq_transition(struct notifier_block *nb, -				      unsigned long state, void *data) -{ -	struct cpufreq_freqs *f = data; - -	if (state == CPUFREQ_PRECHANGE) { -		/* Save frequency in simple Hz */ -		clk_smp_twd_rate = (f->new * 1000) / 2; -	} - -	return NOTIFY_OK; -} - -static struct notifier_block clk_twd_cpufreq_nb = { -	.notifier_call = clk_twd_cpufreq_transition, -}; - -int clk_init_smp_twd_cpufreq(void) -{ -	return cpufreq_register_notifier(&clk_twd_cpufreq_nb, -				  CPUFREQ_TRANSITION_NOTIFIER); -} - -#endif - -int __init clk_init(void) -{ -	clkdev_add_table(u8500_clks, ARRAY_SIZE(u8500_clks)); -	clkdev_add(&clk_smp_twd_lookup); - -#ifdef CONFIG_DEBUG_FS -	clk_debugfs_add_table(u8500_clks, ARRAY_SIZE(u8500_clks)); -#endif -	return 0; -} diff --git a/arch/arm/mach-ux500/clock.h b/arch/arm/mach-ux500/clock.h deleted file mode 100644 index 65d27a13f46..00000000000 --- a/arch/arm/mach-ux500/clock.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - *  Copyright (C) 2010 ST-Ericsson - *  Copyright (C) 2009 STMicroelectronics - * - * 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. - */ - -/** - * struct clkops - ux500 clock operations - * @enable:	function to enable the clock - * @disable:	function to disable the clock - * @get_rate:	function to get the current clock rate - * - * This structure contains function pointers to functions that will be used to - * control the clock.  All of these functions are optional.  If get_rate is - * NULL, the rate in the struct clk will be used. - */ -struct clkops { -	void (*enable) (struct clk *); -	void (*disable) (struct clk *); -	unsigned long (*get_rate) (struct clk *); -	int (*set_parent)(struct clk *, struct clk *); -}; - -/** - * struct clk - ux500 clock structure - * @ops:		pointer to clkops struct used to control this clock - * @name:		name, for debugging - * @enabled:		refcount. positive if enabled, zero if disabled - * @get_rate:		custom callback for getting the clock rate - * @data:		custom per-clock data for example for the get_rate - *			callback - * @rate:		fixed rate for clocks which don't implement - * 			ops->getrate - * @prcmu_cg_off:	address offset of the combined enable/disable register - * 			(used on u8500v1) - * @prcmu_cg_bit:	bit in the combined enable/disable register (used on - * 			u8500v1) - * @prcmu_cg_mgt:	address of the enable/disable register (used on - * 			u8500ed) - * @cluster:		peripheral cluster number - * @prcc_bus:		bit for the bus clock in the peripheral's CLKRST - * @prcc_kernel:	bit for the kernel clock in the peripheral's CLKRST. - * 			-1 if no kernel clock exists. - * @parent_cluster:	pointer to parent's cluster clk struct - * @parent_periph:	pointer to parent's peripheral clk struct - * - * Peripherals are organised into clusters, and each cluster has an associated - * bus clock.  Some peripherals also have a parent peripheral clock. - * - * In order to enable a clock for a peripheral, we need to enable: - * 	(1) the parent cluster (bus) clock at the PRCMU level - * 	(2) the parent peripheral clock (if any) at the PRCMU level - * 	(3) the peripheral's bus & kernel clock at the PRCC level - * - * (1) and (2) are handled by defining clk structs (DEFINE_PRCMU_CLK) for each - * of the cluster and peripheral clocks, and hooking these as the parents of - * the individual peripheral clocks. - * - * (3) is handled by specifying the bits in the PRCC control registers required - * to enable these clocks and modifying them in the ->enable and - * ->disable callbacks of the peripheral clocks (DEFINE_PRCC_CLK). - * - * This structure describes both the PRCMU-level clocks and PRCC-level clocks. - * The prcmu_* fields are only used for the PRCMU clocks, and the cluster, - * prcc, and parent pointers are only used for the PRCC-level clocks. - */ -struct clk { -	const struct clkops	*ops; -	const char 		*name; -	unsigned int		enabled; -	unsigned long		(*get_rate)(struct clk *); -	void			*data; - -	unsigned long		rate; -	struct list_head	list; - -	/* These three are only for PRCMU clks */ - -	unsigned int		prcmu_cg_off; -	unsigned int		prcmu_cg_bit; -	unsigned int		prcmu_cg_mgt; - -	/* The rest are only for PRCC clks */ - -	int			cluster; -	unsigned int		prcc_bus; -	unsigned int		prcc_kernel; - -	struct clk		*parent_cluster; -	struct clk		*parent_periph; -#if defined(CONFIG_DEBUG_FS) -	struct dentry		*dent;		/* For visible tree hierarchy */ -	struct dentry		*dent_bus;	/* For visible tree hierarchy */ -#endif -}; - -#define DEFINE_PRCMU_CLK(_name, _cg_off, _cg_bit, _reg)		\ -struct clk clk_##_name = {					\ -		.name		= #_name,			\ -		.ops    	= &clk_prcmu_ops, 		\ -		.prcmu_cg_off	= _cg_off, 			\ -		.prcmu_cg_bit	= _cg_bit,			\ -		.prcmu_cg_mgt	= PRCM_##_reg##_MGT		\ -	} - -#define DEFINE_PRCMU_CLK_RATE(_name, _cg_off, _cg_bit, _reg, _rate)	\ -struct clk clk_##_name = {						\ -		.name		= #_name,				\ -		.ops    	= &clk_prcmu_ops, 			\ -		.prcmu_cg_off	= _cg_off, 				\ -		.prcmu_cg_bit	= _cg_bit,				\ -		.rate		= _rate,				\ -		.prcmu_cg_mgt	= PRCM_##_reg##_MGT			\ -	} - -#define DEFINE_PRCC_CLK(_pclust, _name, _bus_en, _kernel_en, _kernclk)	\ -struct clk clk_##_name = {						\ -		.name		= #_name,				\ -		.ops    	= &clk_prcc_ops, 			\ -		.cluster 	= _pclust,				\ -		.prcc_bus 	= _bus_en, 				\ -		.prcc_kernel 	= _kernel_en, 				\ -		.parent_cluster = &clk_per##_pclust##clk,		\ -		.parent_periph 	= _kernclk				\ -	} - -#define DEFINE_PRCC_CLK_CUSTOM(_pclust, _name, _bus_en, _kernel_en, _kernclk, _callback, _data) \ -struct clk clk_##_name = {						\ -		.name		= #_name,				\ -		.ops		= &clk_prcc_ops,			\ -		.cluster	= _pclust,				\ -		.prcc_bus	= _bus_en,				\ -		.prcc_kernel	= _kernel_en,				\ -		.parent_cluster = &clk_per##_pclust##clk,		\ -		.parent_periph	= _kernclk,				\ -		.get_rate	= _callback,				\ -		.data		= (void *) _data			\ -	} - - -#define CLK(_clk, _devname, _conname)			\ -	{						\ -		.clk	= &clk_##_clk,			\ -		.dev_id	= _devname,			\ -		.con_id = _conname,			\ -	} - -int __init clk_db8500_ed_fixup(void); -int __init clk_init(void); - -#ifdef CONFIG_DEBUG_FS -int clk_debugfs_init(void); -#else -static inline int clk_debugfs_init(void) { return 0; } -#endif - -#ifdef CONFIG_CPU_FREQ -int clk_init_smp_twd_cpufreq(void); -#else -static inline int clk_init_smp_twd_cpufreq(void) { return 0; } -#endif diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 3ee761d3a86..7e6c384881a 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -18,6 +18,7 @@  #include <linux/io.h>  #include <linux/mfd/abx500/ab8500.h> +#include <asm/pmu.h>  #include <asm/mach/map.h>  #include <plat/gpio-nomadik.h>  #include <mach/hardware.h> diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index e2360e7c770..8e755638aa7 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c @@ -8,7 +8,6 @@  #include <linux/platform_device.h>  #include <linux/io.h> -#include <linux/clk.h>  #include <linux/mfd/db8500-prcmu.h>  #include <linux/clksrc-dbx500-prcmu.h>  #include <linux/sys_soc.h> @@ -17,6 +16,7 @@  #include <linux/stat.h>  #include <linux/of.h>  #include <linux/of_irq.h> +#include <linux/platform_data/clk-ux500.h>  #include <asm/hardware/gic.h>  #include <asm/mach/map.h> @@ -25,8 +25,6 @@  #include <mach/setup.h>  #include <mach/devices.h> -#include "clock.h" -  void __iomem *_PRCMU_BASE;  /* @@ -51,6 +49,8 @@ void __init ux500_init_irq(void)  	void __iomem *dist_base;  	void __iomem *cpu_base; +	gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; +  	if (cpu_is_u8500_family()) {  		dist_base = __io_address(U8500_GIC_DIST_BASE);  		cpu_base = __io_address(U8500_GIC_CPU_BASE); @@ -70,13 +70,17 @@ void __init ux500_init_irq(void)  	 */  	if (cpu_is_u8500_family())  		db8500_prcmu_early_init(); -	clk_init(); + +	if (cpu_is_u8500_family()) +		u8500_clk_init(); +	else if (cpu_is_u9540()) +		u9540_clk_init(); +	else if (cpu_is_u8540()) +		u8540_clk_init();  }  void __init ux500_init_late(void)  { -	clk_debugfs_init(); -	clk_init_smp_twd_cpufreq();  }  static const char * __init ux500_get_machine(void) diff --git a/arch/arm/mach-vt8500/bv07.c b/arch/arm/mach-vt8500/bv07.c index f9fbeb2d10e..6fd9d609eba 100644 --- a/arch/arm/mach-vt8500/bv07.c +++ b/arch/arm/mach-vt8500/bv07.c @@ -33,6 +33,7 @@ static struct platform_device *devices[] __initdata = {  	&vt8500_device_uart0,  	&vt8500_device_lcdc,  	&vt8500_device_ehci, +	&vt8500_device_uhci,  	&vt8500_device_ge_rops,  	&vt8500_device_pwm,  	&vt8500_device_pwmbl, diff --git a/arch/arm/mach-vt8500/devices-vt8500.c b/arch/arm/mach-vt8500/devices-vt8500.c index 19519aeecf3..def7fe393a2 100644 --- a/arch/arm/mach-vt8500/devices-vt8500.c +++ b/arch/arm/mach-vt8500/devices-vt8500.c @@ -48,6 +48,11 @@ void __init vt8500_set_resources(void)  	tmp[1] = wmt_irq_res(IRQ_EHCI);  	wmt_res_add(&vt8500_device_ehci, tmp, 2); +	/* vt8500 uses a single IRQ for both EHCI and UHCI controllers */ +	tmp[0] = wmt_mmio_res(VT8500_UHCI_BASE, SZ_512); +	tmp[1] = wmt_irq_res(IRQ_EHCI); +	wmt_res_add(&vt8500_device_uhci, tmp, 2); +  	tmp[0] = wmt_mmio_res(VT8500_GEGEA_BASE, SZ_256);  	wmt_res_add(&vt8500_device_ge_rops, tmp, 1); diff --git a/arch/arm/mach-vt8500/devices-wm8505.c b/arch/arm/mach-vt8500/devices-wm8505.c index db4594e029f..c810454178d 100644 --- a/arch/arm/mach-vt8500/devices-wm8505.c +++ b/arch/arm/mach-vt8500/devices-wm8505.c @@ -55,6 +55,10 @@ void __init wm8505_set_resources(void)  	tmp[1] = wmt_irq_res(IRQ_EHCI);  	wmt_res_add(&vt8500_device_ehci, tmp, 2); +	tmp[0] = wmt_mmio_res(WM8505_UHCI_BASE, SZ_512); +	tmp[1] = wmt_irq_res(IRQ_UHCI); +	wmt_res_add(&vt8500_device_uhci, tmp, 2); +  	tmp[0] = wmt_mmio_res(WM8505_GEGEA_BASE, SZ_256);  	wmt_res_add(&vt8500_device_ge_rops, tmp, 1); diff --git a/arch/arm/mach-vt8500/devices.c b/arch/arm/mach-vt8500/devices.c index 1fcdc36b358..46ff82dad54 100644 --- a/arch/arm/mach-vt8500/devices.c +++ b/arch/arm/mach-vt8500/devices.c @@ -204,6 +204,17 @@ struct platform_device vt8500_device_ehci = {  	},  }; +static u64 uhci_dma_mask = DMA_BIT_MASK(32); + +struct platform_device vt8500_device_uhci = { +	.name		= "platform-uhci", +	.id		= 0, +	.dev		= { +		.dma_mask	= &uhci_dma_mask, +		.coherent_dma_mask = DMA_BIT_MASK(32), +	}, +}; +  struct platform_device vt8500_device_ge_rops = {  	.name		= "wmt_ge_rops",  	.id		= -1, diff --git a/arch/arm/mach-vt8500/devices.h b/arch/arm/mach-vt8500/devices.h index 188d4e17f35..0e6d9f904c7 100644 --- a/arch/arm/mach-vt8500/devices.h +++ b/arch/arm/mach-vt8500/devices.h @@ -81,6 +81,7 @@ extern struct platform_device vt8500_device_uart5;  extern struct platform_device vt8500_device_lcdc;  extern struct platform_device vt8500_device_wm8505_fb;  extern struct platform_device vt8500_device_ehci; +extern struct platform_device vt8500_device_uhci;  extern struct platform_device vt8500_device_ge_rops;  extern struct platform_device vt8500_device_pwm;  extern struct platform_device vt8500_device_pwmbl; diff --git a/arch/arm/mach-vt8500/wm8505_7in.c b/arch/arm/mach-vt8500/wm8505_7in.c index db19886caf7..4804e2a4557 100644 --- a/arch/arm/mach-vt8500/wm8505_7in.c +++ b/arch/arm/mach-vt8500/wm8505_7in.c @@ -32,6 +32,7 @@ static void __iomem *pmc_hiber;  static struct platform_device *devices[] __initdata = {  	&vt8500_device_uart0,  	&vt8500_device_ehci, +	&vt8500_device_uhci,  	&vt8500_device_wm8505_fb,  	&vt8500_device_ge_rops,  	&vt8500_device_pwm, diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 2a8e380501e..577baf7d0a8 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c @@ -554,7 +554,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {  int __init l2x0_of_init(u32 aux_val, u32 aux_mask)  {  	struct device_node *np; -	struct l2x0_of_data *data; +	const struct l2x0_of_data *data;  	struct resource res;  	np = of_find_matching_node(NULL, l2x0_ids); diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index e59c4ab71bc..13f555d6249 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -346,6 +346,8 @@ static int __init atomic_pool_init(void)  		       (unsigned)pool->size / 1024);  		return 0;  	} + +	kfree(pages);  no_pages:  	kfree(bitmap);  no_bitmap: diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h index 627d94f1b01..ec466400a20 100644 --- a/arch/arm/plat-mxc/include/mach/mx25.h +++ b/arch/arm/plat-mxc/include/mach/mx25.h @@ -98,6 +98,7 @@  #define MX25_INT_UART1		(NR_IRQS_LEGACY + 45)  #define MX25_INT_GPIO2		(NR_IRQS_LEGACY + 51)  #define MX25_INT_GPIO1		(NR_IRQS_LEGACY + 52) +#define MX25_INT_GPT1		(NR_IRQS_LEGACY + 54)  #define MX25_INT_FEC		(NR_IRQS_LEGACY + 57)  #define MX25_DMA_REQ_SSI2_RX1	22 diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 65c5eca475e..d1116e2dfbe 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c @@ -144,6 +144,7 @@ long clk_round_rate(struct clk *clk, unsigned long rate)  int clk_set_rate(struct clk *clk, unsigned long rate)  { +	unsigned long flags;  	int ret;  	if (IS_ERR(clk)) @@ -159,9 +160,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)  	if (clk->ops == NULL || clk->ops->set_rate == NULL)  		return -EINVAL; -	spin_lock(&clocks_lock); +	spin_lock_irqsave(&clocks_lock, flags);  	ret = (clk->ops->set_rate)(clk, rate); -	spin_unlock(&clocks_lock); +	spin_unlock_irqrestore(&clocks_lock, flags);  	return ret;  } @@ -173,17 +174,18 @@ struct clk *clk_get_parent(struct clk *clk)  int clk_set_parent(struct clk *clk, struct clk *parent)  { +	unsigned long flags;  	int ret = 0;  	if (IS_ERR(clk))  		return -EINVAL; -	spin_lock(&clocks_lock); +	spin_lock_irqsave(&clocks_lock, flags);  	if (clk->ops && clk->ops->set_parent)  		ret = (clk->ops->set_parent)(clk, parent); -	spin_unlock(&clocks_lock); +	spin_unlock_irqrestore(&clocks_lock, flags);  	return ret;  } diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 6ff45d53362..fed07d27e0c 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c @@ -1590,6 +1590,8 @@ struct platform_device s3c64xx_device_spi1 = {  void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,  						int num_cs)  { +	struct s3c64xx_spi_info pd; +  	/* Reject invalid configuration */  	if (!num_cs || src_clk_nr < 0) {  		pr_err("%s: Invalid SPI configuration\n", __func__);  |