Skip to content

Commit

Permalink
Merge branch 'next-s5pv310' into for-next
Browse files Browse the repository at this point in the history
Conflicts:
	arch/arm/mach-s5pv310/Kconfig
	arch/arm/mach-s5pv310/Makefile
	arch/arm/mach-s5pv310/mach-smdkc210.c
	arch/arm/mach-s5pv310/mach-smdkv310.c
	arch/arm/plat-samsung/include/plat/devs.h
  • Loading branch information
Kukjin Kim committed Dec 31, 2010
2 parents 0ae9a22 + fa353e9 commit 285dee7
Show file tree
Hide file tree
Showing 13 changed files with 317 additions and 10 deletions.
11 changes: 11 additions & 0 deletions arch/arm/mach-s5pv310/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ config CPU_S5PV310
help
Enable S5PV310 CPU support

config S5PV310_DEV_PD
bool
help
Compile in platform device definitions for Power Domain

config S5PV310_SETUP_I2C1
bool
help
Expand Down Expand Up @@ -75,6 +80,7 @@ config MACH_SMDKC210
select S3C_DEV_HSMMC1
select S3C_DEV_HSMMC2
select S3C_DEV_HSMMC3
select S5PV310_DEV_PD
select S5PV310_SETUP_I2C1
select S5PV310_SETUP_SDHCI
help
Expand All @@ -85,6 +91,10 @@ config MACH_UNIVERSAL_C210
bool "Mobile UNIVERSAL_C210 Board"
select CPU_S5PV310
select S5P_DEV_ONENAND
select S3C_DEV_HSMMC
select S3C_DEV_HSMMC2
select S3C_DEV_HSMMC3
select S5PV310_SETUP_SDHCI
select S3C_DEV_I2C1
select S5PV310_SETUP_I2C1
help
Expand All @@ -105,6 +115,7 @@ config MACH_SMDKV310
select S3C_DEV_HSMMC1
select S3C_DEV_HSMMC2
select S3C_DEV_HSMMC3
select S5PV310_DEV_PD
select S5PV310_SETUP_I2C1
select S5PV310_SETUP_SDHCI
help
Expand Down
4 changes: 3 additions & 1 deletion arch/arm/mach-s5pv310/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o

# device support

obj-y += dev-audio.o
obj-y += dev-audio.o
obj-$(CONFIG_S5PV310_DEV_PD) += dev-pd.o

obj-$(CONFIG_S5PV310_SETUP_I2C1) += setup-i2c1.o
obj-$(CONFIG_S5PV310_SETUP_I2C2) += setup-i2c2.o
obj-$(CONFIG_S5PV310_SETUP_I2C3) += setup-i2c3.o
Expand Down
16 changes: 15 additions & 1 deletion arch/arm/mach-s5pv310/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
.pfn = __phys_to_pfn(S5PV310_PA_CMU),
.length = SZ_128K,
.type = MT_DEVICE,
}, {
.virtual = (unsigned long)S5P_VA_PMU,
.pfn = __phys_to_pfn(S5PV310_PA_PMU),
.length = SZ_64K,
.type = MT_DEVICE,
}, {
.virtual = (unsigned long)S5P_VA_COMBINER_BASE,
.pfn = __phys_to_pfn(S5PV310_PA_COMBINER),
Expand Down Expand Up @@ -127,6 +132,15 @@ void __init s5pv310_init_irq(void)
gic_cpu_init(0, S5P_VA_GIC_CPU);

for (irq = 0; irq < MAX_COMBINER_NR; irq++) {

/*
* From SPI(0) to SPI(39) and SPI(51), SPI(53) are
* connected to the interrupt combiner. These irqs
* should be initialized to support cascade interrupt.
*/
if ((irq >= 40) && !(irq == 51) && !(irq == 53))
continue;

combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
COMBINER_IRQ(irq, 0));
combiner_cascade_irq(irq, IRQ_SPI(irq));
Expand Down Expand Up @@ -168,7 +182,7 @@ static int __init s5pv310_l2x0_cache_init(void)
__raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN,
S5P_VA_L2CC + L2X0_POWER_CTRL);

l2x0_init(S5P_VA_L2CC, 0x7C070001, 0xC200ffff);
l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff);

return 0;
}
Expand Down
139 changes: 139 additions & 0 deletions arch/arm/mach-s5pv310/dev-pd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/* linux/arch/arm/mach-s5pv310/dev-pd.c
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* S5PV310 - Power Domain support
*
* 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/io.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/delay.h>

#include <mach/regs-pmu.h>

#include <plat/pd.h>

static int s5pv310_pd_enable(struct device *dev)
{
struct samsung_pd_info *pdata = dev->platform_data;
u32 timeout;

__raw_writel(S5P_INT_LOCAL_PWR_EN, pdata->base);

/* Wait max 1ms */
timeout = 10;
while ((__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN)
!= S5P_INT_LOCAL_PWR_EN) {
if (timeout == 0) {
printk(KERN_ERR "Power domain %s enable failed.\n",
dev_name(dev));
return -ETIMEDOUT;
}
timeout--;
udelay(100);
}

return 0;
}

static int s5pv310_pd_disable(struct device *dev)
{
struct samsung_pd_info *pdata = dev->platform_data;
u32 timeout;

__raw_writel(0, pdata->base);

/* Wait max 1ms */
timeout = 10;
while (__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN) {
if (timeout == 0) {
printk(KERN_ERR "Power domain %s disable failed.\n",
dev_name(dev));
return -ETIMEDOUT;
}
timeout--;
udelay(100);
}

return 0;
}

struct platform_device s5pv310_device_pd[] = {
{
.name = "samsung-pd",
.id = 0,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable = s5pv310_pd_disable,
.base = S5P_PMU_MFC_CONF,
},
},
}, {
.name = "samsung-pd",
.id = 1,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable = s5pv310_pd_disable,
.base = S5P_PMU_G3D_CONF,
},
},
}, {
.name = "samsung-pd",
.id = 2,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable = s5pv310_pd_disable,
.base = S5P_PMU_LCD0_CONF,
},
},
}, {
.name = "samsung-pd",
.id = 3,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable = s5pv310_pd_disable,
.base = S5P_PMU_LCD1_CONF,
},
},
}, {
.name = "samsung-pd",
.id = 4,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable = s5pv310_pd_disable,
.base = S5P_PMU_TV_CONF,
},
},
}, {
.name = "samsung-pd",
.id = 5,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable = s5pv310_pd_disable,
.base = S5P_PMU_CAM_CONF,
},
},
}, {
.name = "samsung-pd",
.id = 6,
.dev = {
.platform_data = &(struct samsung_pd_info) {
.enable = s5pv310_pd_enable,
.disable = s5pv310_pd_disable,
.base = S5P_PMU_GPS_CONF,
},
},
},
};
13 changes: 10 additions & 3 deletions arch/arm/mach-s5pv310/include/mach/irqs.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#define IRQ_SPI(x) S5P_IRQ(x+32)

#define IRQ_MCT1 IRQ_SPI(35)

#define IRQ_EINT0 IRQ_SPI(40)
#define IRQ_EINT1 IRQ_SPI(41)
#define IRQ_EINT2 IRQ_SPI(42)
Expand All @@ -36,9 +38,8 @@
#define IRQ_JPEG IRQ_SPI(48)
#define IRQ_2D IRQ_SPI(49)
#define IRQ_PCIE IRQ_SPI(50)
#define IRQ_SYSTEM_TIMER IRQ_SPI(51)
#define IRQ_MCT0 IRQ_SPI(51)
#define IRQ_MFC IRQ_SPI(52)
#define IRQ_WDT IRQ_SPI(53)
#define IRQ_AUDIO_SS IRQ_SPI(54)
#define IRQ_AC97 IRQ_SPI(55)
#define IRQ_SPDIF IRQ_SPI(56)
Expand Down Expand Up @@ -91,6 +92,8 @@

#define IRQ_ONENAND_AUDI COMBINER_IRQ(34, 0)

#define IRQ_MCT_L1 COMBINER_IRQ(35, 3)

#define IRQ_EINT4 COMBINER_IRQ(37, 0)
#define IRQ_EINT5 COMBINER_IRQ(37, 1)
#define IRQ_EINT6 COMBINER_IRQ(37, 2)
Expand All @@ -107,7 +110,11 @@

#define IRQ_EINT16_31 COMBINER_IRQ(39, 0)

#define MAX_COMBINER_NR 40
#define IRQ_MCT_L0 COMBINER_IRQ(51, 0)

#define IRQ_WDT COMBINER_IRQ(53, 0)

#define MAX_COMBINER_NR 54

#define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0)

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-s5pv310/include/mach/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#define S5PV310_PA_SYSCON (0x10010000)
#define S5P_PA_SYSCON S5PV310_PA_SYSCON

#define S5PV310_PA_PMU (0x10020000)

#define S5PV310_PA_CMU (0x10030000)

#define S5PV310_PA_WATCHDOG (0x10060000)
Expand Down
30 changes: 30 additions & 0 deletions arch/arm/mach-s5pv310/include/mach/regs-pmu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* linux/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* S5PV310 - Power management unit definition
*
* 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.
*/

#ifndef __ASM_ARCH_REGS_PMU_H
#define __ASM_ARCH_REGS_PMU_H __FILE__

#include <mach/map.h>

#define S5P_PMUREG(x) (S5P_VA_PMU + (x))

#define S5P_PMU_CAM_CONF S5P_PMUREG(0x3C00)
#define S5P_PMU_TV_CONF S5P_PMUREG(0x3C20)
#define S5P_PMU_MFC_CONF S5P_PMUREG(0x3C40)
#define S5P_PMU_G3D_CONF S5P_PMUREG(0x3C60)
#define S5P_PMU_LCD0_CONF S5P_PMUREG(0x3C80)
#define S5P_PMU_LCD1_CONF S5P_PMUREG(0x3CA0)
#define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0)

#define S5P_INT_LOCAL_PWR_EN 0x7

#endif /* __ASM_ARCH_REGS_PMU_H */
6 changes: 5 additions & 1 deletion arch/arm/mach-s5pv310/irq-combiner.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ static DEFINE_SPINLOCK(irq_controller_lock);

struct combiner_chip_data {
unsigned int irq_offset;
unsigned int irq_mask;
void __iomem *base;
};

Expand Down Expand Up @@ -62,6 +63,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
spin_lock(&irq_controller_lock);
status = __raw_readl(chip_data->base + COMBINER_INT_STATUS);
spin_unlock(&irq_controller_lock);
status &= chip_data->irq_mask;

if (status == 0)
goto out;
Expand Down Expand Up @@ -104,10 +106,12 @@ void __init combiner_init(unsigned int combiner_nr, void __iomem *base,

combiner_data[combiner_nr].base = base;
combiner_data[combiner_nr].irq_offset = irq_start;
combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3);

/* Disable all interrupts */

__raw_writel(0xffffffff, base + COMBINER_ENABLE_CLEAR);
__raw_writel(combiner_data[combiner_nr].irq_mask,
base + COMBINER_ENABLE_CLEAR);

/* Setup the Linux IRQ subsystem */

Expand Down
12 changes: 10 additions & 2 deletions arch/arm/mach-s5pv310/mach-smdkc210.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <plat/devs.h>
#include <plat/sdhci.h>
#include <plat/iic.h>
#include <plat/pd.h>

#include <mach/map.h>

Expand Down Expand Up @@ -146,16 +147,23 @@ static struct i2c_board_info i2c_devs1[] __initdata = {
};

static struct platform_device *smdkc210_devices[] __initdata = {
&s3c_device_i2c1,
&s3c_device_hsmmc0,
&s3c_device_hsmmc1,
&s3c_device_hsmmc2,
&s3c_device_hsmmc3,
&s3c_device_i2c1,
&s3c_device_rtc,
&s3c_device_wdt,
&smdkc210_smsc911x,
&s5pv310_device_ac97,
&s5pv310_device_i2s0,
&s5pv310_device_pd[PD_MFC],
&s5pv310_device_pd[PD_G3D],
&s5pv310_device_pd[PD_LCD0],
&s5pv310_device_pd[PD_LCD1],
&s5pv310_device_pd[PD_CAM],
&s5pv310_device_pd[PD_TV],
&s5pv310_device_pd[PD_GPS],
&smdkc210_smsc911x,
};

static void __init smdkc210_smsc911x_init(void)
Expand Down
Loading

0 comments on commit 285dee7

Please sign in to comment.