diff options
author | codeworkx <daniel.hillenbrand@codeworkx.de> | 2012-06-02 13:09:29 +0200 |
---|---|---|
committer | codeworkx <daniel.hillenbrand@codeworkx.de> | 2012-06-02 13:09:29 +0200 |
commit | c6da2cfeb05178a11c6d062a06f8078150ee492f (patch) | |
tree | f3b4021d252c52d6463a9b3c1bb7245e399b009c /arch/arm/mach-s5pv210 | |
parent | c6d7c4dbff353eac7919342ae6b3299a378160a6 (diff) | |
download | kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.zip kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.gz kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.bz2 |
samsung update 1
Diffstat (limited to 'arch/arm/mach-s5pv210')
25 files changed, 1656 insertions, 143 deletions
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 37b5a97..057a850 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig @@ -18,6 +18,11 @@ config CPU_S5PV210 help Enable S5PV210 CPU support +config CPU_S5PC110 + bool + help + S5PC110(MCP) is one of package option of S5PV210. + config S5PV210_SETUP_I2C1 bool help @@ -105,14 +110,29 @@ config MACH_GONI config MACH_SMDKC110 bool "SMDKC110" select CPU_S5PV210 + select CPU_S5PC110 + select S3C_DEV_FB + select S3C_DEV_HSMMC + select S3C_DEV_HSMMC1 + select S3C_DEV_HSMMC2 + select S3C_DEV_HSMMC3 select S3C_DEV_I2C1 select S3C_DEV_I2C2 select S3C_DEV_RTC select S3C_DEV_WDT + select SAMSUNG_DEV_ADC + select SAMSUNG_DEV_BACKLIGHT select SAMSUNG_DEV_IDE + select SAMSUNG_DEV_KEYPAD + select SAMSUNG_DEV_PWM + select SAMSUNG_DEV_TS + select S5PV210_SETUP_FB_24BPP select S5PV210_SETUP_I2C1 select S5PV210_SETUP_I2C2 select S5PV210_SETUP_IDE + select S5PV210_SETUP_KEYPAD + select S5PV210_SETUP_SDHCI + select HAVE_PWM help Machine support for Samsung SMDKC110 S5PC110(MCP) is one of package option of S5PV210 @@ -134,6 +154,7 @@ config MACH_SMDKV210 select S3C_DEV_RTC select S3C_DEV_WDT select SAMSUNG_DEV_ADC + select SAMSUNG_DEV_BACKLIGHT select SAMSUNG_DEV_IDE select SAMSUNG_DEV_KEYPAD select SAMSUNG_DEV_PWM @@ -144,6 +165,7 @@ config MACH_SMDKV210 select S5PV210_SETUP_IDE select S5PV210_SETUP_KEYPAD select S5PV210_SETUP_SDHCI + select HAVE_PWM help Machine support for Samsung SMDKV210 diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile index 50907ac..c3cd02a 100644 --- a/arch/arm/mach-s5pv210/Makefile +++ b/arch/arm/mach-s5pv210/Makefile @@ -5,7 +5,7 @@ # # Licensed under GPLv2 -obj-y := +obj-y := reserve_mem-s5pv210.o obj-m := obj-n := obj- := @@ -15,7 +15,7 @@ obj- := obj-$(CONFIG_CPU_S5PV210) += cpu.o init.o clock.o dma.o obj-$(CONFIG_CPU_S5PV210) += setup-i2c0.o obj-$(CONFIG_S5PV210_PM) += pm.o sleep.o -obj-$(CONFIG_CPU_FREQ) += cpufreq.o +obj-$(CONFIG_CPU_FREQ) += cpufreq.o dev-cpufreq.o # machine support diff --git a/arch/arm/mach-s5pv210/Makefile.boot b/arch/arm/mach-s5pv210/Makefile.boot index ff90aa1..7e1ea1f 100644 --- a/arch/arm/mach-s5pv210/Makefile.boot +++ b/arch/arm/mach-s5pv210/Makefile.boot @@ -1,2 +1,5 @@ zreladdr-y := 0x20008000 params_phys-y := 0x20000100 + + zreladdr-$(CONFIG_CPU_S5PC110) := 0x30008000 +params_phys-$(CONFIG_CPU_S5PC110) := 0x30000100 diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c index 2d59949..5ea790f 100644 --- a/arch/arm/mach-s5pv210/clock.c +++ b/arch/arm/mach-s5pv210/clock.c @@ -24,12 +24,14 @@ #include <plat/cpu-freq.h> #include <mach/regs-clock.h> +#include <mach/regs-audss.h> #include <plat/clock.h> #include <plat/cpu.h> #include <plat/pll.h> #include <plat/s5p-clock.h> #include <plat/clock-clksrc.h> #include <plat/s5pv210.h> +#include <plat/devs.h> static unsigned long xtal; @@ -185,6 +187,11 @@ static int s5pv210_clk_mask1_ctrl(struct clk *clk, int enable) return s5p_gatectrl(S5P_CLK_SRC_MASK1, clk, enable); } +static int s5pv210_clk_audss_ctrl(struct clk *clk, int enable) +{ + return s5p_gatectrl(S5P_CLKGATE_AUDSS, clk, enable); +} + static struct clk clk_sclk_hdmi27m = { .name = "sclk_hdmi27m", .id = -1, @@ -311,18 +318,6 @@ static struct clk_ops clk_fout_apll_ops = { static struct clk init_clocks_off[] = { { - .name = "pdma", - .id = 0, - .parent = &clk_hclk_psys.clk, - .enable = s5pv210_clk_ip0_ctrl, - .ctrlbit = (1 << 3), - }, { - .name = "pdma", - .id = 1, - .parent = &clk_hclk_psys.clk, - .enable = s5pv210_clk_ip0_ctrl, - .ctrlbit = (1 << 4), - }, { .name = "rot", .id = -1, .parent = &clk_hclk_dsys.clk, @@ -490,6 +485,37 @@ static struct clk init_clocks_off[] = { .parent = &clk_p, .enable = s5pv210_clk_ip3_ctrl, .ctrlbit = (1 << 0), + }, { + .name = "secss", + .id = -1, + .parent = &clk_hclk_psys.clk, + .enable = &s5pv210_clk_ip2_ctrl, + .ctrlbit = (1 << 0), + } +}; + +static struct clk init_dmaclocks[] = { + { + .name = "pdma", + .id = 0, + .parent = &clk_hclk_dsys.clk, + .enable = s5pv210_clk_ip0_ctrl, + .ctrlbit = (1 << 2), + .dev = &s5pv210_device_mdma.dev, + }, { + .name = "pdma", + .id = 1, + .parent = &clk_hclk_psys.clk, + .enable = s5pv210_clk_ip0_ctrl, + .ctrlbit = (1 << 3), + .dev = &s5pv210_device_pdma0.dev, + }, { + .name = "pdma", + .id = 2, + .parent = &init_dmaclocks[1], + .enable = s5pv210_clk_ip0_ctrl, + .ctrlbit = (1 << 4), + .dev = &s5pv210_device_pdma1.dev, }, }; @@ -656,6 +682,59 @@ static struct clksrc_clk clk_sclk_audio0 = { .reg_div = { .reg = S5P_CLK_DIV6, .shift = 0, .size = 4 }, }; +static struct clk *clkset_mout_audss_list[] = { + [0] = &clk_ext_xtal_mux, + [1] = &clk_fout_epll, +}; + +static struct clksrc_sources clkset_mout_audss = { + .sources = clkset_mout_audss_list, + .nr_sources = ARRAY_SIZE(clkset_mout_audss_list), +}; + +static struct clksrc_clk clk_mout_audss = { + .clk = { + .name = "mout_audss", + .id = -1, + }, + .sources = &clkset_mout_audss, + .reg_src = { .reg = S5P_CLKSRC_AUDSS, .shift = 0, .size = 1 }, +}; + +static struct clk *clkset_mout_i2s_a_list[] = { + &clk_mout_audss.clk, + &clk_pcmcdclk0, + &clk_sclk_audio0.clk, +}; + +static struct clksrc_sources clkset_mout_i2s_a = { + .sources = clkset_mout_i2s_a_list, + .nr_sources = ARRAY_SIZE(clkset_mout_i2s_a_list), +}; + +static struct clksrc_clk clk_mout_i2s_a = { + .clk = { + .name = "audio-bus", + .id = 0, + .enable = s5pv210_clk_audss_ctrl, + .ctrlbit = (1 << 6), + }, + .sources = &clkset_mout_i2s_a, + .reg_src = { .reg = S5P_CLKSRC_AUDSS, .shift = 2, .size = 2 }, + .reg_div = { .reg = S5P_CLKDIV_AUDSS, .shift = 4, .size = 4 }, +}; + +static struct clksrc_clk clk_dout_audio_bus_clk_i2s = { + .clk = { + .name = "dout_audio_bus_clk_i2s", + .id = -1, + .parent = &clk_mout_audss.clk, + .enable = s5pv210_clk_audss_ctrl, + .ctrlbit = (1 << 5), + }, + .reg_div = { .reg = S5P_CLKDIV_AUDSS, .shift = 0, .size = 4 }, +}; + static struct clk *clkset_sclk_audio1_list[] = { [0] = &clk_ext_xtal_mux, [1] = &clk_pcmcdclk1, @@ -725,48 +804,13 @@ static struct clksrc_sources clkset_sclk_spdif = { .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list), }; -static int s5pv210_spdif_set_rate(struct clk *clk, unsigned long rate) -{ - struct clk *pclk; - int ret; - - pclk = clk_get_parent(clk); - if (IS_ERR(pclk)) - return -EINVAL; - - ret = pclk->ops->set_rate(pclk, rate); - clk_put(pclk); - - return ret; -} - -static unsigned long s5pv210_spdif_get_rate(struct clk *clk) -{ - struct clk *pclk; - int rate; - - pclk = clk_get_parent(clk); - if (IS_ERR(pclk)) - return -EINVAL; - - rate = pclk->ops->get_rate(clk); - clk_put(pclk); - - return rate; -} - -static struct clk_ops s5pv210_sclk_spdif_ops = { - .set_rate = s5pv210_spdif_set_rate, - .get_rate = s5pv210_spdif_get_rate, -}; - static struct clksrc_clk clk_sclk_spdif = { .clk = { .name = "sclk_spdif", .id = -1, .enable = s5pv210_clk_mask0_ctrl, .ctrlbit = (1 << 27), - .ops = &s5pv210_sclk_spdif_ops, + .ops = &s5p_sclk_spdif_ops, }, .sources = &clkset_sclk_spdif, .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 }, @@ -1062,6 +1106,9 @@ static struct clksrc_clk *sysclks[] = { &clk_sclk_audio1, &clk_sclk_audio2, &clk_sclk_spdif, + &clk_mout_audss, + &clk_mout_i2s_a, + &clk_dout_audio_bus_clk_i2s, }; static u32 epll_div[][6] = { @@ -1159,7 +1206,6 @@ void __init_or_cpufreq s5pv210_setup_clocks(void) u32 clkdiv0, clkdiv1; /* Set functions for clk_fout_epll */ - clk_fout_epll.enable = s5p_epll_enable; clk_fout_epll.ops = &s5pv210_epll_ops; printk(KERN_DEBUG "%s: registering clocks\n", __func__); @@ -1239,5 +1285,9 @@ void __init s5pv210_register_clocks(void) s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); + /* Register DMA Clock */ + s3c_register_clocks(init_dmaclocks, ARRAY_SIZE(init_dmaclocks)); + s3c_disable_clocks(init_dmaclocks, ARRAY_SIZE(init_dmaclocks)); + s3c_pwmclk_init(); } diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c index 61e6c24..d4a8605 100644 --- a/arch/arm/mach-s5pv210/cpu.c +++ b/arch/arm/mach-s5pv210/cpu.c @@ -38,9 +38,9 @@ #include <plat/ata-core.h> #include <plat/fimc-core.h> #include <plat/iic-core.h> -#include <plat/keypad-core.h> #include <plat/sdhci.h> #include <plat/reset.h> +#include <plat/ace-core.h> /* Initial IO mappings */ @@ -91,6 +91,11 @@ static struct map_desc s5pv210_iodesc[] __initdata = { .length = SZ_4K, .type = MT_DEVICE, }, { + .virtual = (unsigned long)S5P_VA_AUDSS, + .pfn = __phys_to_pfn(S5PV210_PA_AUDSS), + .length = SZ_1M, + .type = MT_DEVICE, + }, { .virtual = (unsigned long)S3C_VA_USB_HSPHY, .pfn =__phys_to_pfn(S5PV210_PA_HSPHY), .length = SZ_4K, @@ -126,7 +131,7 @@ void __init s5pv210_map_io(void) s5pv210_default_sdhci2(); s5pv210_default_sdhci3(); - s3c_adc_setname("s3c64xx-adc"); + s3c_adc_setname("samsung-adc-v3"); s3c_cfcon_setname("s5pv210-pata"); @@ -141,8 +146,9 @@ void __init s5pv210_map_io(void) s3c_fb_setname("s5pv210-fb"); - /* Use s5pv210-keypad instead of samsung-keypad */ - samsung_keypad_setname("s5pv210-keypad"); +#ifdef CONFIG_S5P_DEV_ACE + s5p_ace_setname("s5pv210-ace"); +#endif } void __init s5pv210_init_clocks(int xtal) diff --git a/arch/arm/mach-s5pv210/cpufreq.c b/arch/arm/mach-s5pv210/cpufreq.c index 153af8b..f18a574 100644..100755 --- a/arch/arm/mach-s5pv210/cpufreq.c +++ b/arch/arm/mach-s5pv210/cpufreq.c @@ -16,20 +16,39 @@ #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h> +#include <linux/suspend.h> +#include <linux/reboot.h> +#include <linux/regulator/consumer.h> #include <linux/cpufreq.h> +#include <linux/platform_device.h> #include <mach/map.h> #include <mach/regs-clock.h> +#include <mach/cpu-freq-v210.h> static struct clk *cpu_clk; static struct clk *dmc0_clk; static struct clk *dmc1_clk; static struct cpufreq_freqs freqs; +static DEFINE_MUTEX(set_freq_lock); /* APLL M,P,S values for 1G/800Mhz */ #define APLL_VAL_1000 ((1 << 31) | (125 << 16) | (3 << 8) | 1) #define APLL_VAL_800 ((1 << 31) | (100 << 16) | (3 << 8) | 1) +#define SLEEP_FREQ (800 * 1000) /* Use 800MHz when entering sleep */ + +/* + * relation has an additional symantics other than the standard of cpufreq + * DISALBE_FURTHER_CPUFREQ: disable further access to target until being re-enabled. + * ENABLE_FURTUER_CPUFREQ: re-enable access to target +*/ +enum cpufreq_access { + DISABLE_FURTHER_CPUFREQ = 0x10, + ENABLE_FURTHER_CPUFREQ = 0x20, +}; +static bool no_cpufreq_access; + /* * DRAM configurations to calculate refresh counter for changing * frequency of memory. @@ -66,6 +85,40 @@ static struct cpufreq_frequency_table s5pv210_freq_table[] = { {0, CPUFREQ_TABLE_END}, }; +static struct regulator *arm_regulator; +static struct regulator *internal_regulator; + +struct s5pv210_dvs_conf { + unsigned long arm_volt; /* uV */ + unsigned long int_volt; /* uV */ +}; + +const unsigned long arm_volt_max = 1350000; +const unsigned long int_volt_max = 1250000; + +static struct s5pv210_dvs_conf dvs_conf[] = { + [L0] = { + .arm_volt = 1250000, + .int_volt = 1100000, + }, + [L1] = { + .arm_volt = 1200000, + .int_volt = 1100000, + }, + [L2] = { + .arm_volt = 1050000, + .int_volt = 1100000, + }, + [L3] = { + .arm_volt = 950000, + .int_volt = 1100000, + }, + [L4] = { + .arm_volt = 950000, + .int_volt = 1000000, + }, +}; + static u32 clkdiv_val[5][11] = { /* * Clock divider value for following @@ -146,30 +199,66 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index, priv_index; unsigned int pll_changing = 0; unsigned int bus_speed_changing = 0; + unsigned int arm_volt, int_volt; + int ret = 0; + + mutex_lock(&set_freq_lock); + + if (relation & ENABLE_FURTHER_CPUFREQ) + no_cpufreq_access = false; + if (no_cpufreq_access) { +#ifdef CONFIG_PM_VERBOSE + pr_err("%s:%d denied access to %s as it is disabled" + "temporarily\n", __FILE__, __LINE__, __func__); +#endif + ret = -EINVAL; + goto out; + } + if (relation & DISABLE_FURTHER_CPUFREQ) + no_cpufreq_access = true; + relation &= ~(ENABLE_FURTHER_CPUFREQ | DISABLE_FURTHER_CPUFREQ); freqs.old = s5pv210_getspeed(0); if (cpufreq_frequency_table_target(policy, s5pv210_freq_table, - target_freq, relation, &index)) - return -EINVAL; + target_freq, relation, &index)) { + ret = -EINVAL; + goto out; + } freqs.new = s5pv210_freq_table[index].frequency; freqs.cpu = 0; if (freqs.new == freqs.old) - return 0; + goto out; /* Finding current running level index */ if (cpufreq_frequency_table_target(policy, s5pv210_freq_table, - freqs.old, relation, &priv_index)) - return -EINVAL; + freqs.old, relation, &priv_index)) { + ret = -EINVAL; + goto out; + } - cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + arm_volt = dvs_conf[index].arm_volt; + int_volt = dvs_conf[index].int_volt; if (freqs.new > freqs.old) { - /* Voltage up: will be implemented */ + /* Voltage up code: increase ARM first */ + if (!IS_ERR_OR_NULL(arm_regulator) && + !IS_ERR_OR_NULL(internal_regulator)) { + ret = regulator_set_voltage(arm_regulator, + arm_volt, arm_volt_max); + if (ret) + goto out; + ret = regulator_set_voltage(internal_regulator, + int_volt, int_volt_max); + if (ret) + goto out; + } } + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + /* Check if there need to change PLL */ if ((index == L0) || (priv_index == L0)) pll_changing = 1; @@ -380,15 +469,24 @@ static int s5pv210_target(struct cpufreq_policy *policy, } } + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + if (freqs.new < freqs.old) { - /* Voltage down: will be implemented */ + /* Voltage down: decrease INT first */ + if (!IS_ERR_OR_NULL(arm_regulator) && + !IS_ERR_OR_NULL(internal_regulator)) { + regulator_set_voltage(internal_regulator, + int_volt, int_volt_max); + regulator_set_voltage(arm_regulator, + arm_volt, arm_volt_max); + } } - cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); - printk(KERN_DEBUG "Perf changed[L%d]\n", index); - return 0; +out: + mutex_unlock(&set_freq_lock); + return ret; } #ifdef CONFIG_PM @@ -464,6 +562,40 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy) return cpufreq_frequency_table_cpuinfo(policy, s5pv210_freq_table); } +static int s5pv210_cpufreq_notifier_event(struct notifier_block *this, + unsigned long event, void *ptr) +{ + int ret; + + switch (event) { + case PM_SUSPEND_PREPARE: + ret = cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ, + DISABLE_FURTHER_CPUFREQ); + if (ret < 0) + return NOTIFY_BAD; + return NOTIFY_OK; + case PM_POST_RESTORE: + case PM_POST_SUSPEND: + cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ, + ENABLE_FURTHER_CPUFREQ); + return NOTIFY_OK; + } + return NOTIFY_DONE; +} + +static int s5pv210_cpufreq_reboot_notifier_event(struct notifier_block *this, + unsigned long event, void *ptr) +{ + int ret = 0; + + ret = cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ, + DISABLE_FURTHER_CPUFREQ); + if (ret < 0) + return NOTIFY_BAD; + + return NOTIFY_DONE; +} + static struct cpufreq_driver s5pv210_driver = { .flags = CPUFREQ_STICKY, .verify = s5pv210_verify_speed, @@ -477,9 +609,71 @@ static struct cpufreq_driver s5pv210_driver = { #endif }; -static int __init s5pv210_cpufreq_init(void) +static struct notifier_block s5pv210_cpufreq_notifier = { + .notifier_call = s5pv210_cpufreq_notifier_event, +}; + +static struct notifier_block s5pv210_cpufreq_reboot_notifier = { + .notifier_call = s5pv210_cpufreq_reboot_notifier_event, +}; + +static int __init s5pv210_cpufreq_probe(struct platform_device *pdev) { + struct s5pv210_cpufreq_data *pdata = dev_get_platdata(&pdev->dev); + int i, j; + + if (pdata && pdata->size) { + for (i = 0; i < pdata->size; i++) { + j = 0; + while (s5pv210_freq_table[j].frequency != CPUFREQ_TABLE_END) { + if (s5pv210_freq_table[j].frequency == pdata->volt[i].freq) { + dvs_conf[j].arm_volt = pdata->volt[i].varm; + dvs_conf[j].int_volt = pdata->volt[i].vint; + break; + } + j++; + } + } + } + + arm_regulator = regulator_get(NULL, "vddarm"); + if (IS_ERR(arm_regulator)) { + pr_err("failed to get regulater resource vddarm\n"); + goto error; + } + internal_regulator = regulator_get(NULL, "vddint"); + if (IS_ERR(internal_regulator)) { + pr_err("failed to get regulater resource vddint\n"); + goto error; + } + goto finish; +error: + pr_warn("Cannot get vddarm or vddint. CPUFREQ Will not" + " change the voltage.\n"); +finish: + register_pm_notifier(&s5pv210_cpufreq_notifier); + register_reboot_notifier(&s5pv210_cpufreq_reboot_notifier); + return cpufreq_register_driver(&s5pv210_driver); } +static struct platform_driver s5pv210_cpufreq_drv = { + .probe = s5pv210_cpufreq_probe, + .driver = { + .owner = THIS_MODULE, + .name = "s5pv210-cpufreq", + }, +}; + +static int __init s5pv210_cpufreq_init(void) +{ + int ret; + + ret = platform_driver_register(&s5pv210_cpufreq_drv); + if (!ret) + pr_info("%s: S5PV210 cpu-freq driver\n", __func__); + + return ret; +} + late_initcall(s5pv210_cpufreq_init); diff --git a/arch/arm/mach-s5pv210/dev-audio.c b/arch/arm/mach-s5pv210/dev-audio.c index 8d58f19..31a965e 100644 --- a/arch/arm/mach-s5pv210/dev-audio.c +++ b/arch/arm/mach-s5pv210/dev-audio.c @@ -49,8 +49,11 @@ static struct s3c_audio_pdata i2sv5_pdata = { .cfg_gpio = s5pv210_cfg_i2s, .type = { .i2s = { - .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI - | QUIRK_NEED_RSTCLR, + .quirks = QUIRK_PRI_6CHAN +#ifdef CONFIG_SND_SOC_SAMSUNG_I2S_SEC + | QUIRK_SEC_DAI +#endif + | QUIRK_NEED_RSTCLR, .src_clk = rclksrc, }, }, diff --git a/arch/arm/mach-s5pv210/dev-cpufreq.c b/arch/arm/mach-s5pv210/dev-cpufreq.c new file mode 100644 index 0000000..ff0e0f1 --- /dev/null +++ b/arch/arm/mach-s5pv210/dev-cpufreq.c @@ -0,0 +1,28 @@ +/* + * linux/arch/arm/mach-s5pv210/dev-cpufreq.c + * + * Copyright (c) 2008-2010 Samsung Electronics + * Taekki Kim <taekki.kim@samsung.com> + * + * S5PV210 series device definition for cpufreq devices + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/platform_device.h> + +#include <mach/cpu-freq-v210.h> + +struct platform_device s5pv210_device_cpufreq = { + .name = "s5pv210-cpufreq", + .id = -1, +}; + +void s5pv210_cpufreq_set_platdata(struct s5pv210_cpufreq_data *pdata) +{ + s5pv210_device_cpufreq.dev.platform_data = pdata; +} + diff --git a/arch/arm/mach-s5pv210/dma.c b/arch/arm/mach-s5pv210/dma.c index 497d343..34cfacc 100644 --- a/arch/arm/mach-s5pv210/dma.c +++ b/arch/arm/mach-s5pv210/dma.c @@ -30,6 +30,71 @@ static u64 dma_dmamask = DMA_BIT_MASK(32); +static struct resource s5pv210_mdma_resource[] = { + [0] = { + .start = S5PV210_PA_MDMA, + .end = S5PV210_PA_MDMA + SZ_4K, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_MDMA, + .end = IRQ_MDMA, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct s3c_pl330_platdata s5pv210_mdma_pdata = { + .peri = { + /* The DMAC can have max 8 channel so there + * can be 8 M<->M requests served at any time. + */ + [0] = DMACH_MTOM_0, + [1] = DMACH_MTOM_1, + [2] = DMACH_MTOM_2, + [3] = DMACH_MTOM_3, + [4] = DMACH_MTOM_4, + [5] = DMACH_MTOM_5, + [6] = DMACH_MTOM_6, + [7] = DMACH_MTOM_7, + [8] = DMACH_MAX, + [9] = DMACH_MAX, + [10] = DMACH_MAX, + [11] = DMACH_MAX, + [12] = DMACH_MAX, + [13] = DMACH_MAX, + [14] = DMACH_MAX, + [15] = DMACH_MAX, + [16] = DMACH_MAX, + [17] = DMACH_MAX, + [18] = DMACH_MAX, + [19] = DMACH_MAX, + [20] = DMACH_MAX, + [21] = DMACH_MAX, + [22] = DMACH_MAX, + [23] = DMACH_MAX, + [24] = DMACH_MAX, + [25] = DMACH_MAX, + [26] = DMACH_MAX, + [27] = DMACH_MAX, + [28] = DMACH_MAX, + [29] = DMACH_MAX, + [30] = DMACH_MAX, + [31] = DMACH_MAX, + }, +}; + +struct platform_device s5pv210_device_mdma = { + .name = "s3c-pl330", + .id = 0, + .num_resources = ARRAY_SIZE(s5pv210_mdma_resource), + .resource = s5pv210_mdma_resource, + .dev = { + .dma_mask = &dma_dmamask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &s5pv210_mdma_pdata, + }, +}; + static struct resource s5pv210_pdma0_resource[] = { [0] = { .start = S5PV210_PA_PDMA0, @@ -80,9 +145,9 @@ static struct s3c_pl330_platdata s5pv210_pdma0_pdata = { }, }; -static struct platform_device s5pv210_device_pdma0 = { +struct platform_device s5pv210_device_pdma0 = { .name = "s3c-pl330", - .id = 0, + .id = 1, .num_resources = ARRAY_SIZE(s5pv210_pdma0_resource), .resource = s5pv210_pdma0_resource, .dev = { @@ -142,9 +207,9 @@ static struct s3c_pl330_platdata s5pv210_pdma1_pdata = { }, }; -static struct platform_device s5pv210_device_pdma1 = { +struct platform_device s5pv210_device_pdma1 = { .name = "s3c-pl330", - .id = 1, + .id = 2, .num_resources = ARRAY_SIZE(s5pv210_pdma1_resource), .resource = s5pv210_pdma1_resource, .dev = { @@ -155,6 +220,7 @@ static struct platform_device s5pv210_device_pdma1 = { }; static struct platform_device *s5pv210_dmacs[] __initdata = { + &s5pv210_device_mdma, &s5pv210_device_pdma0, &s5pv210_device_pdma1, }; diff --git a/arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h b/arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h new file mode 100644 index 0000000..8274a01 --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h @@ -0,0 +1,31 @@ +/* arch/arm/mach-s5pv210/include/mach/cpu-freq-v210.h + * + * Copyright (c) 2010 Samsung Electronics Co., Ltd. + * + * S5PV210/S5PC110 CPU frequency scaling 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. +*/ + +#ifndef __ASM_ARCH_CPU_FREQ_H +#define __ASM_ARCH_CPU_FREQ_H + +#include <linux/cpufreq.h> + +/* For cpu-freq driver */ +struct s5pv210_cpufreq_voltage { + unsigned int freq; /* kHz */ + unsigned long varm; /* uV */ + unsigned long vint; /* uV */ +}; + +struct s5pv210_cpufreq_data { + struct s5pv210_cpufreq_voltage *volt; + unsigned int size; +}; + +extern void s5pv210_cpufreq_set_platdata(struct s5pv210_cpufreq_data *pdata); + +#endif /* __ASM_ARCH_CPU_FREQ_H */ diff --git a/arch/arm/mach-s5pv210/include/mach/irqs.h b/arch/arm/mach-s5pv210/include/mach/irqs.h index b9f9ec3..1e3ad87 100644 --- a/arch/arm/mach-s5pv210/include/mach/irqs.h +++ b/arch/arm/mach-s5pv210/include/mach/irqs.h @@ -99,8 +99,8 @@ #define IRQ_TC IRQ_PENDN #define IRQ_KEYPAD S5P_IRQ_VIC2(25) #define IRQ_CG S5P_IRQ_VIC2(26) -#define IRQ_SSS_INT S5P_IRQ_VIC2(27) -#define IRQ_SSS_HASH S5P_IRQ_VIC2(28) +#define IRQ_SSS_HASH S5P_IRQ_VIC2(27) +#define IRQ_SSS_INT S5P_IRQ_VIC2(28) #define IRQ_PCM2 S5P_IRQ_VIC2(29) #define IRQ_SDMIRQ S5P_IRQ_VIC2(30) #define IRQ_SDMFIQ S5P_IRQ_VIC2(31) diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h index 1dd5883..4f09492 100644 --- a/arch/arm/mach-s5pv210/include/mach/map.h +++ b/arch/arm/mach-s5pv210/include/mach/map.h @@ -16,7 +16,11 @@ #include <plat/map-base.h> #include <plat/map-s5p.h> +#ifdef CONFIG_CPU_S5PC110 +#define S5PV210_PA_SDRAM 0x30000000 +#else #define S5PV210_PA_SDRAM 0x20000000 +#endif #define S5PV210_PA_SROM_BANK5 0xA8000000 @@ -59,11 +63,15 @@ #define S5PV210_PA_CFCON 0xE8200000 +#define S5PV210_PA_ACE 0xEA000000 + #define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000)) #define S5PV210_PA_HSOTG 0xEC000000 #define S5PV210_PA_HSPHY 0xEC100000 +#define S5PV210_PA_AUDSS 0xEEE10000 + #define S5PV210_PA_IIS0 0xEEE30000 #define S5PV210_PA_IIS1 0xE2100000 #define S5PV210_PA_IIS2 0xE2A00000 @@ -99,8 +107,8 @@ #define S3C_PA_IIC1 S5PV210_PA_IIC1 #define S3C_PA_IIC2 S5PV210_PA_IIC2 #define S3C_PA_RTC S5PV210_PA_RTC -#define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG #define S3C_PA_WDT S5PV210_PA_WATCHDOG +#define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG #define S5P_PA_CHIPID S5PV210_PA_CHIPID #define S5P_PA_FIMC0 S5PV210_PA_FIMC0 @@ -113,11 +121,15 @@ #define S5P_PA_SROMC S5PV210_PA_SROMC #define S5P_PA_SYSCON S5PV210_PA_SYSCON #define S5P_PA_TIMER S5PV210_PA_TIMER +#define S5P_PA_HSOTG S5PV210_PA_HSOTG +#define S5P_PA_HSPHY S5PV210_PA_HSPHY #define SAMSUNG_PA_ADC S5PV210_PA_ADC #define SAMSUNG_PA_CFCON S5PV210_PA_CFCON #define SAMSUNG_PA_KEYPAD S5PV210_PA_KEYPAD +#define S5P_PA_ACE S5PV210_PA_ACE + /* UART */ #define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) diff --git a/arch/arm/mach-s5pv210/include/mach/media.h b/arch/arm/mach-s5pv210/include/mach/media.h new file mode 100644 index 0000000..573cd8f --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/media.h @@ -0,0 +1,26 @@ +/* linux/arch/arm/mach-s5pv210/include/mach/media.h + * + * Copyright (c) 2010 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * Samsung Media device descriptions for s5pv210 + * + * 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 _S5PV210_MEDIA_H +#define _S5PV210_MEDIA_H + +#define S5P_MDEV_FIMC0 0 +#define S5P_MDEV_FIMC1 1 +#define S5P_MDEV_FIMC2 2 +#define S5P_MDEV_MFC 4 +#define S5P_MDEV_JPEG 5 +#define S5P_MDEV_FIMD 6 +#define S5P_MDEV_FIMG2D 7 +#define S5P_MDEV_TEXSTREAM 8 + +#define S5P_RANGE_MFC SZ_256M +#endif diff --git a/arch/arm/mach-s5pv210/include/mach/memory.h b/arch/arm/mach-s5pv210/include/mach/memory.h index 7b5fcf0..5c42a7a 100644 --- a/arch/arm/mach-s5pv210/include/mach/memory.h +++ b/arch/arm/mach-s5pv210/include/mach/memory.h @@ -13,7 +13,11 @@ #ifndef __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H +#ifdef CONFIG_CPU_S5PC110 +#define PLAT_PHYS_OFFSET UL(0x30000000) +#else #define PLAT_PHYS_OFFSET UL(0x20000000) +#endif #define CONSISTENT_DMA_SIZE (SZ_8M + SZ_4M + SZ_2M) /* diff --git a/arch/arm/mach-s5pv210/include/mach/pm-core.h b/arch/arm/mach-s5pv210/include/mach/pm-core.h index e8d394f..3e22109 100644 --- a/arch/arm/mach-s5pv210/include/mach/pm-core.h +++ b/arch/arm/mach-s5pv210/include/mach/pm-core.h @@ -41,3 +41,6 @@ static inline void s3c_pm_arch_update_uart(void __iomem *regs, { /* nothing here yet */ } + +static inline void s3c_pm_restored_gpios(void) { } +static inline void s3c_pm_saved_gpios(void) { } diff --git a/arch/arm/mach-s5pv210/include/mach/regs-audss.h b/arch/arm/mach-s5pv210/include/mach/regs-audss.h new file mode 100644 index 0000000..cb6ccd1 --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/regs-audss.h @@ -0,0 +1,44 @@ +/* arch/arm/mach-s5pv210/include/mach/regs-audss.h + * + * Copyright 2011 Samsung Electronics + * + * S5PV2XX Audio SubSystem clock register definitions + * + * 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 __MACH_REGS_AUDSS_H +#define __MACH_REGS_AUDSS_H __FILE__ + +#define S5P_AUDSSREG(x) (S5P_VA_AUDSS + (x)) + +#define S5P_CLKSRC_AUDSS S5P_AUDSSREG(0x0) +#define S5P_CLKDIV_AUDSS S5P_AUDSSREG(0x4) +#define S5P_CLKGATE_AUDSS S5P_AUDSSREG(0x8) + +/* CLKSRC0 */ +#define S5P_AUDSS_CLKSRC_MAIN_MASK (0x1<<0) +#define S5P_AUDSS_CLKSRC_MAIN_SHIFT (0) +#define S5P_AUDSS_CLKSRC_BUSCLK_MASK (0x1<<1) +#define S5P_AUDSS_CLKSRC_BUSCLK_SHIFT (1) +#define S5P_AUDSS_CLKSRC_I2SCLK_MASK (0x3<<2) +#define S5P_AUDSS_CLKSRC_I2SCLK_SHIFT (2) + +/* CLKDIV0 */ +#define S5P_AUDSS_CLKDIV_BUSCLK_MASK (0xf<<0) +#define S5P_AUDSS_CLKDIV_BUSCLK_SHIFT (0) +#define S5P_AUDSS_CLKDIV_I2SCLK_MASK (0xf<<4) +#define S5P_AUDSS_CLKDIV_I2SCLK_SHIFT (4) + +/* IP Clock Gate 0 Registers */ +#define S5P_AUDSS_CLKGATE_HCLKRP (1<<0) +#define S5P_AUDSS_CLKGATE_HCLKBUF (1<<1) +#define S5P_AUDSS_CLKGATE_HCLKDMA (1<<2) +#define S5P_AUDSS_CLKGATE_HCLKHWA (1<<3) +#define S5P_AUDSS_CLKGATE_HCLKUART (1<<4) +#define S5P_AUDSS_CLKGATE_HCLKI2S (1<<5) +#define S5P_AUDSS_CLKGATE_CLKI2S (1<<6) + +#endif /* _MACH_REGS_AUDSS_H */ diff --git a/arch/arm/mach-s5pv210/include/mach/regs-clock.h b/arch/arm/mach-s5pv210/include/mach/regs-clock.h index 78925c5..7a843d1 100644 --- a/arch/arm/mach-s5pv210/include/mach/regs-clock.h +++ b/arch/arm/mach-s5pv210/include/mach/regs-clock.h @@ -118,6 +118,32 @@ #define S5P_CLKDIV6_ONEDRAM_SHIFT (28) #define S5P_CLKDIV6_ONEDRAM_MASK (0xF << S5P_CLKDIV6_ONEDRAM_SHIFT) +/* CLK_OUT register */ +#define S5P_CLKOUT_DIVVAL_SHIFT (20) +#define S5P_CLKOUT_DIVVAL_MASK (0xF << S5P_CLKOUT_DIVVAL_SHIFT) +#define S5P_CLKOUT_CLKSEL_SHIFT (12) +#define S5P_CLKOUT_CLKSEL_MASK (0x1F << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_APLL (0 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_MPLL (1 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_EPLL (2 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_VPLL (3 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_SCLK_USBPHY0 (4 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_SCLK_USBPHY1 (5 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_SCLK_HDMIPHY (6 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_RTC (7 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_TICK (8 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_HCLK200 (9 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_PCLK100 (10 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_HCLK166 (11 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_PCLK83 (12 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_HCLK133 (13 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_PCLK66 (14 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_ARMCLK (15 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_SCLK_HPM (16 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_XXTI (17 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_XUSBXTI (18 << S5P_CLKOUT_CLKSEL_SHIFT) +#define S5P_CLKOUT_CLKSEL_DOUT (19 << S5P_CLKOUT_CLKSEL_SHIFT) + #define S5P_SWRESET S5P_CLKREG(0x2000) #define S5P_ARM_MCS_CON S5P_CLKREG(0x6100) @@ -197,6 +223,11 @@ #define S5P_OTHERS_RET_MMC (1 << 29) #define S5P_OTHERS_RET_UART (1 << 28) #define S5P_OTHERS_USB_SIG_MASK (1 << 16) +#define S5P_OTHERS_CLKOUT_SHIFT (8) +#define S5P_OTHERS_CLKOUT_MASK (0x3 << S5P_OTHERS_CLKOUT_SHIFT) +#define S5P_OTHERS_CLKOUT_SYSCON (0 << S5P_OTHERS_CLKOUT_SHIFT) +#define S5P_OTHERS_CLKOUT_XXIT (2 << S5P_OTHERS_CLKOUT_SHIFT) +#define S5P_OTHERS_CLKOUT_XUSBXTI (3 << S5P_OTHERS_CLKOUT_SHIFT) /* S5P_DAC_CONTROL */ #define S5P_DAC_ENABLE (1) diff --git a/arch/arm/mach-s5pv210/include/mach/regs-fb.h b/arch/arm/mach-s5pv210/include/mach/regs-fb.h deleted file mode 100644 index 60d9929..0000000 --- a/arch/arm/mach-s5pv210/include/mach/regs-fb.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2010 Ben Dooks <ben-linux@fluff.org> - * - * Dummy framebuffer to allow build for the moment. - * - * 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_MACH_REGS_FB_H -#define __ASM_ARCH_MACH_REGS_FB_H __FILE__ - -#include <plat/regs-fb-v4.h> - -static inline unsigned int s3c_fb_pal_reg(unsigned int window, int reg) -{ - return 0x2400 + (window * 256 *4 ) + reg; -} - -#endif /* __ASM_ARCH_MACH_REGS_FB_H */ diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c index 4e1d8ff..509627f 100644 --- a/arch/arm/mach-s5pv210/mach-aquila.c +++ b/arch/arm/mach-s5pv210/mach-aquila.c @@ -29,7 +29,6 @@ #include <mach/map.h> #include <mach/regs-clock.h> -#include <mach/regs-fb.h> #include <plat/gpio-cfg.h> #include <plat/regs-serial.h> @@ -40,6 +39,7 @@ #include <plat/fimc-core.h> #include <plat/sdhci.h> #include <plat/s5p-time.h> +#include <plat/regs-fb-v4.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index 31d5aa7..e0c4d06 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c @@ -34,7 +34,6 @@ #include <mach/map.h> #include <mach/regs-clock.h> -#include <mach/regs-fb.h> #include <plat/gpio-cfg.h> #include <plat/regs-serial.h> @@ -47,6 +46,7 @@ #include <plat/sdhci.h> #include <plat/clock.h> #include <plat/s5p-time.h> +#include <plat/regs-fb-v4.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c index 6c412c8..85d1b73 100644 --- a/arch/arm/mach-s5pv210/mach-smdkc110.c +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c @@ -10,27 +10,51 @@ #include <linux/kernel.h> #include <linux/types.h> +#include <linux/i2c.h> +#include <linux/regulator/consumer.h> +#include <linux/regulator/fixed.h> +#include <linux/regulator/machine.h> +#include <linux/mfd/max8698.h> #include <linux/init.h> #include <linux/serial_core.h> -#include <linux/i2c.h> #include <linux/sysdev.h> +#include <linux/dm9000.h> +#include <linux/fb.h> +#include <linux/gpio.h> +#include <linux/gpio_event.h> +#include <linux/delay.h> +#include <linux/pwm_backlight.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/setup.h> #include <asm/mach-types.h> +#include <video/platform_lcd.h> + #include <mach/map.h> +#include <mach/gpio.h> #include <mach/regs-clock.h> +#include <mach/cpu-freq-v210.h> +#include <mach/media.h> #include <plat/regs-serial.h> +#include <plat/regs-srom.h> +#include <plat/gpio-cfg.h> #include <plat/s5pv210.h> #include <plat/devs.h> #include <plat/cpu.h> +#include <plat/adc.h> +#include <plat/ts.h> #include <plat/ata.h> #include <plat/iic.h> +#include <plat/keypad.h> #include <plat/pm.h> +#include <plat/fb.h> #include <plat/s5p-time.h> +#include <plat/media.h> +#include <plat/backlight.h> +#include <plat/regs-fb-v4.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define SMDKC110_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ @@ -77,23 +101,511 @@ static struct s3c2410_uartcfg smdkv210_uartcfgs[] __initdata = { }, }; +#ifdef CONFIG_CPU_FREQ +static struct s5pv210_cpufreq_voltage smdkc110_cpufreq_volt[] = { + { + .freq = 1000000, + .varm = 1275000, + .vint = 1100000, + }, { + .freq = 800000, + .varm = 1200000, + .vint = 1100000, + }, { + .freq = 400000, + .varm = 1050000, + .vint = 1100000, + }, { + .freq = 200000, + .varm = 950000, + .vint = 1100000, + }, { + .freq = 100000, + .varm = 950000, + .vint = 1000000, + }, +}; + +static struct s5pv210_cpufreq_data smdkc110_cpufreq_plat = { + .volt = smdkc110_cpufreq_volt, + .size = ARRAY_SIZE(smdkc110_cpufreq_volt), +}; +#endif + +#if defined(CONFIG_REGULATOR_MAX8698) +/* LDO */ +static struct regulator_consumer_supply smdkc110_ldo3_consumer[] = { + REGULATOR_SUPPLY("pd_io", "s3c-usbgadget") +}; + +static struct regulator_consumer_supply smdkc110_ldo5_consumer[] = { + REGULATOR_SUPPLY("AVDD", "0-001b"), + REGULATOR_SUPPLY("DVDD", "0-001b"), +}; + +static struct regulator_consumer_supply smdkc110_ldo8_consumer[] = { + REGULATOR_SUPPLY("pd_core", "s3c-usbgadget") +}; + +static struct regulator_init_data smdkc110_ldo2_data = { + .constraints = { + .name = "VALIVE_1.1V", + .min_uV = 1100000, + .max_uV = 1100000, + .apply_uV = 1, + .always_on = 1, + .state_mem = { + .enabled = 1, + }, + }, +}; + +static struct regulator_init_data smdkc110_ldo3_data = { + .constraints = { + .name = "VUOTG_D+VUHOST_D_1.1V", + .min_uV = 1100000, + .max_uV = 1100000, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = 1, + }, + }, + .num_consumer_supplies = ARRAY_SIZE(smdkc110_ldo3_consumer), + .consumer_supplies = smdkc110_ldo3_consumer, +}; + +static struct regulator_init_data smdkc110_ldo4_data = { + .constraints = { + .name = "V_MIPI_1.8V", + .min_uV = 1800000, + .max_uV = 1800000, + .apply_uV = 1, + .always_on = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = 1, + }, + }, +}; + +static struct regulator_init_data smdkc110_ldo5_data = { + .constraints = { + .name = "VMMC+VEXT_2.8V", + .min_uV = 2800000, + .max_uV = 2800000, + .apply_uV = 1, + .always_on = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .enabled = 1, + }, + }, + .num_consumer_supplies = ARRAY_SIZE(smdkc110_ldo5_consumer), + .consumer_supplies = smdkc110_ldo5_consumer, +}; + +static struct regulator_init_data smdkc110_ldo6_data = { + .constraints = { + .name = "VCC_2.6V", + .min_uV = 2600000, + .max_uV = 2600000, + .apply_uV = 1, + .always_on = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = 1, + }, + }, +}; + +static struct regulator_init_data smdkc110_ldo7_data = { + .constraints = { + .name = "VDAC_2.8V", + .min_uV = 2800000, + .max_uV = 2800000, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .enabled = 1, + }, + }, +}; + +static struct regulator_init_data smdkc110_ldo8_data = { + .constraints = { + .name = "VUOTG_A+VUHOST_A_3.3V", + .min_uV = 3300000, + .max_uV = 3300000, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = 1, + }, + }, + .num_consumer_supplies = ARRAY_SIZE(smdkc110_ldo8_consumer), + .consumer_supplies = smdkc110_ldo8_consumer, +}; + +static struct regulator_init_data smdkc110_ldo9_data = { + .constraints = { + .name = "VADC+VSYS+VKEY_2.8V", + .min_uV = 2800000, + .max_uV = 2800000, + .apply_uV = 1, + .always_on = 1, + .state_mem = { + .enabled = 1, + }, + }, +}; + +/* BUCK */ +static struct regulator_consumer_supply smdkc110_buck1_consumer = + REGULATOR_SUPPLY("vddarm", NULL); + +static struct regulator_consumer_supply smdkc110_buck2_consumer = + REGULATOR_SUPPLY("vddint", NULL); + +static struct regulator_init_data smdkc110_buck1_data = { + .constraints = { + .name = "VCC_ARM", + .min_uV = 750000, + .max_uV = 1500000, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | + REGULATOR_CHANGE_STATUS, + .state_mem = { + .uV = 1250000, + .mode = REGULATOR_MODE_NORMAL, + .disabled = 1, + }, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &smdkc110_buck1_consumer, +}; + +static struct regulator_init_data smdkc110_buck2_data = { + .constraints = { + .name = "VCC_INTERNAL", + .min_uV = 950000, + .max_uV = 1200000, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | + REGULATOR_CHANGE_STATUS, + .state_mem = { + .uV = 1100000, + .mode = REGULATOR_MODE_NORMAL, + .disabled = 1, + }, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &smdkc110_buck2_consumer, +}; + +static struct regulator_init_data smdkc110_buck3_data = { + .constraints = { + .name = "VCC_MEM", + .min_uV = 1800000, + .max_uV = 1800000, + .always_on = 1, + .apply_uV = 1, + .state_mem = { + .uV = 1800000, + .mode = REGULATOR_MODE_NORMAL, + .enabled = 1, + }, + }, +}; + +static struct max8698_regulator_data smdkc110_regulators[] = { + { MAX8698_LDO2, &smdkc110_ldo2_data }, + { MAX8698_LDO3, &smdkc110_ldo3_data }, + { MAX8698_LDO4, &smdkc110_ldo4_data }, + { MAX8698_LDO5, &smdkc110_ldo5_data }, + { MAX8698_LDO6, &smdkc110_ldo6_data }, + { MAX8698_LDO7, &smdkc110_ldo7_data }, + { MAX8698_LDO8, &smdkc110_ldo8_data }, + { MAX8698_LDO9, &smdkc110_ldo9_data }, + { MAX8698_BUCK1, &smdkc110_buck1_data }, + { MAX8698_BUCK2, &smdkc110_buck2_data }, + { MAX8698_BUCK3, &smdkc110_buck3_data }, +}; + +static struct max8698_platform_data smdkc110_max8698_pdata = { + .num_regulators = ARRAY_SIZE(smdkc110_regulators), + .regulators = smdkc110_regulators, + + /* 1GHz default voltage */ + .dvsarm1 = 0xa, /* 1.25v */ + .dvsarm2 = 0x9, /* 1.20V */ + .dvsarm3 = 0x6, /* 1.05V */ + .dvsarm4 = 0x4, /* 0.95V */ + .dvsint1 = 0x7, /* 1.10v */ + .dvsint2 = 0x5, /* 1.00V */ + + .set1 = S5PV210_GPH1(6), + .set2 = S5PV210_GPH1(7), + .set3 = S5PV210_GPH0(4), +}; +#endif + static struct s3c_ide_platdata smdkc110_ide_pdata __initdata = { .setup_gpio = s5pv210_ide_setup_gpio, }; +static uint32_t smdkc110_keymap[] __initdata = { + /* KEY(row, col, keycode) */ + KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3), + KEY(0, 6, KEY_4), KEY(0, 7, KEY_5), + KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C), + KEY(1, 6, KEY_D), KEY(1, 7, KEY_E) +}; + +static struct matrix_keymap_data smdkc110_keymap_data __initdata = { + .keymap = smdkc110_keymap, + .keymap_size = ARRAY_SIZE(smdkc110_keymap), +}; + +static struct samsung_keypad_platdata smdkc110_keypad_data __initdata = { + .keymap_data = &smdkc110_keymap_data, + .rows = 2, + .cols = 8, +}; + +static struct resource smdkc110_dm9000_resources[] = { + [0] = { + .start = S5PV210_PA_SROM_BANK5, + .end = S5PV210_PA_SROM_BANK5, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = S5PV210_PA_SROM_BANK5 + 2, + .end = S5PV210_PA_SROM_BANK5 + 2, + .flags = IORESOURCE_MEM, + }, + [2] = { + .start = IRQ_EINT(9), + .end = IRQ_EINT(9), + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, + }, +}; + +static struct dm9000_plat_data smdkc110_dm9000_platdata = { + .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM, + .dev_addr = { 0x00, 0x09, 0xc0, 0xff, 0xec, 0x48 }, +}; + +struct platform_device smdkc110_dm9000 = { + .name = "dm9000", + .id = -1, + .num_resources = ARRAY_SIZE(smdkc110_dm9000_resources), + .resource = smdkc110_dm9000_resources, + .dev = { + .platform_data = &smdkc110_dm9000_platdata, + }, +}; + +#ifdef CONFIG_REGULATOR +static struct regulator_consumer_supply smdkc110_b_pwr_5v_consumers[] = { + { + /* WM8580 */ + .supply = "PVDD", + .dev_name = "0-001b", + }, +}; + +static struct regulator_init_data smdkc110_b_pwr_5v_data = { + .constraints = { + .always_on = 1, + }, + .num_consumer_supplies = ARRAY_SIZE(smdkc110_b_pwr_5v_consumers), + .consumer_supplies = smdkc110_b_pwr_5v_consumers, +}; + +static struct fixed_voltage_config smdkc110_b_pwr_5v_pdata = { + .supply_name = "B_PWR_5V", + .microvolts = 5000000, + .init_data = &smdkc110_b_pwr_5v_data, +}; + +static struct platform_device smdkc110_b_pwr_5v = { + .name = "reg-fixed-voltage", + .id = -1, + .dev = { + .platform_data = &smdkc110_b_pwr_5v_pdata, + }, +}; +#endif + +static void smdkc110_lte480wv_set_power(struct plat_lcd_data *pd, + unsigned int power) +{ + if (power) { +#if !defined(CONFIG_BACKLIGHT_PWM) + gpio_request(S5PV210_GPD0(3), "GPD0"); + gpio_direction_output(S5PV210_GPD0(3), 1); + gpio_free(S5PV210_GPD0(3)); +#endif + + /* fire nRESET on power up */ + gpio_request(S5PV210_GPH0(6), "GPH0"); + + gpio_direction_output(S5PV210_GPH0(6), 1); + + gpio_set_value(S5PV210_GPH0(6), 0); + mdelay(10); + + gpio_set_value(S5PV210_GPH0(6), 1); + mdelay(10); + + gpio_free(S5PV210_GPH0(6)); + } else { +#if !defined(CONFIG_BACKLIGHT_PWM) + gpio_request(S5PV210_GPD0(3), "GPD0"); + gpio_direction_output(S5PV210_GPD0(3), 0); + gpio_free(S5PV210_GPD0(3)); +#endif + } +} + +static struct plat_lcd_data smdkc110_lcd_lte480wv_data = { + .set_power = smdkc110_lte480wv_set_power, +}; + +static struct platform_device smdkc110_lcd_lte480wv = { + .name = "platform-lcd", + .dev.parent = &s3c_device_fb.dev, + .dev.platform_data = &smdkc110_lcd_lte480wv_data, +}; + +static struct s3c_fb_pd_win smdkc110_fb_win0 = { + .win_mode = { + .left_margin = 13, + .right_margin = 8, + .upper_margin = 7, + .lower_margin = 5, + .hsync_len = 3, + .vsync_len = 1, + .xres = 800, + .yres = 480, + }, + .max_bpp = 32, + .default_bpp = 24, +}; + +static struct s3c_fb_platdata smdkc110_lcd0_pdata __initdata = { + .win[0] = &smdkc110_fb_win0, + .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, + .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, + .setup_gpio = s5pv210_fb_gpio_setup_24bpp, +}; + +static struct gpio_event_direct_entry smdkc110_keypad_key_map[] = { + { + .gpio = S5PV210_GPH3(7), + .code = KEY_POWER, + } +}; + +static struct gpio_event_input_info smdkc110_keypad_key_info = { + .info.func = gpio_event_input_func, + .info.no_suspend = true, + .debounce_time.tv64 = 5 * NSEC_PER_MSEC, + .type = EV_KEY, + .keymap = smdkc110_keypad_key_map, + .keymap_size = ARRAY_SIZE(smdkc110_keypad_key_map) +}; + +static struct gpio_event_info *smdkc110_input_info[] = { + &smdkc110_keypad_key_info.info, +}; + +static struct gpio_event_platform_data smdkc110_input_data = { + .names = { + "smdkc110-keypad", + NULL, + }, + .info = smdkc110_input_info, + .info_count = ARRAY_SIZE(smdkc110_input_info), +}; + +static struct platform_device smdkc110_input_device = { + .name = GPIO_EVENT_DEV_NAME, + .id = 0, + .dev = { + .platform_data = &smdkc110_input_data, + }, +}; + +#ifdef CONFIG_BATTERY_SAMSUNG +static struct platform_device samsung_device_battery = { + .name = "samsung-fake-battery", + .id = -1, +}; +#endif + static struct platform_device *smdkc110_devices[] __initdata = { - &samsung_asoc_dma, - &s5pv210_device_iis0, - &s5pv210_device_ac97, - &s5pv210_device_spdif, + &s3c_device_adc, &s3c_device_cfcon, + &s3c_device_fb, + &s3c_device_hsmmc0, + &s3c_device_hsmmc1, + &s3c_device_hsmmc2, + &s3c_device_hsmmc3, &s3c_device_i2c0, &s3c_device_i2c1, &s3c_device_i2c2, &s3c_device_rtc, + &s3c_device_ts, &s3c_device_wdt, + &s5pv210_device_ac97, + &s5pv210_device_iis0, + &s5pv210_device_spdif, +#ifdef CONFIG_CPU_FREQ + &s5pv210_device_cpufreq, +#endif + &samsung_asoc_dma, + &samsung_device_keypad, +#ifdef CONFIG_BATTERY_SAMSUNG + &samsung_device_battery, +#endif + &smdkc110_dm9000, + &smdkc110_lcd_lte480wv, + &smdkc110_input_device, +#ifdef CONFIG_REGULATOR + &smdkc110_b_pwr_5v, +#endif +#ifdef CONFIG_CRYPTO_S5P_DEV_ACE + &s5p_device_ace, +#endif }; +static void __init smdkc110_button_init(void) +{ + s3c_gpio_cfgpin(S5PV210_GPH3(7), (0xf << 28)); + s3c_gpio_setpull(S5PV210_GPH3(7), S3C_GPIO_PULL_NONE); + + s3c_gpio_cfgpin(S5PV210_GPH0(4), (0xf << 16)); + s3c_gpio_setpull(S5PV210_GPH0(4), S3C_GPIO_PULL_NONE); +} + +static void __init smdkc110_dm9000_init(void) +{ + unsigned int tmp; + + gpio_request(S5PV210_MP01(5), "nCS5"); + s3c_gpio_cfgpin(S5PV210_MP01(5), S3C_GPIO_SFN(2)); + gpio_free(S5PV210_MP01(5)); + + tmp = (5 << S5P_SROM_BCX__TACC__SHIFT); + __raw_writel(tmp, S5P_SROM_BC5); + + tmp = __raw_readl(S5P_SROM_BW); + tmp &= (S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS5__SHIFT); + tmp |= (1 << S5P_SROM_BW__NCS5__SHIFT); + __raw_writel(tmp, S5P_SROM_BW); +} + static struct i2c_board_info smdkc110_i2c_devs0[] __initdata = { { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */ { I2C_BOARD_INFO("wm8580", 0x1b), }, @@ -104,7 +616,51 @@ static struct i2c_board_info smdkc110_i2c_devs1[] __initdata = { }; static struct i2c_board_info smdkc110_i2c_devs2[] __initdata = { - /* To Be Updated */ +#if defined(CONFIG_REGULATOR_MAX8698) + { + I2C_BOARD_INFO("max8698", 0xCC >> 1), + .platform_data = &smdkc110_max8698_pdata, + }, +#endif +}; + +static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { + .delay = 10000, + .presc = 49, + .oversampling_shift = 2, + .cal_x_max = 800, + .cal_y_max = 480, + .cal_param = { + -13357, -85, 53858048, -95, -8493, 32809514, 65536 + }, +}; + +static void smdkc110_sound_init(void) +{ + u32 reg; + + reg = __raw_readl(S5P_CLK_OUT); + reg &= ~S5P_CLKOUT_CLKSEL_MASK; + reg &= ~S5P_CLKOUT_DIVVAL_MASK; + reg |= S5P_CLKOUT_CLKSEL_XUSBXTI; + reg |= 0x1 << S5P_CLKOUT_DIVVAL_SHIFT; + __raw_writel(reg, S5P_CLK_OUT); + + reg = __raw_readl(S5P_OTHERS); + reg &= ~S5P_OTHERS_CLKOUT_MASK; + reg |= S5P_OTHERS_CLKOUT_SYSCON; + __raw_writel(reg, S5P_OTHERS); +} + +/* LCD Backlight data */ +static struct samsung_bl_gpio_info smdkc110_bl_gpio_info = { + .no = S5PV210_GPD0(3), + .func = S3C_GPIO_SFN(2), +}; + +static struct platform_pwm_backlight_data smdkc110_bl_data = { + .pwm_id = 3, + .pwm_period_ns = 1000, }; static void __init smdkc110_map_io(void) @@ -112,13 +668,21 @@ static void __init smdkc110_map_io(void) s5p_init_io(NULL, 0, S5P_VA_CHIPID); s3c24xx_init_clocks(24000000); s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); - s5p_set_timer_source(S5P_PWM3, S5P_PWM4); + s5p_set_timer_source(S5P_PWM2, S5P_PWM4); + + s5p_reserve_mem(S5P_RANGE_MFC); } static void __init smdkc110_machine_init(void) { s3c_pm_init(); + smdkc110_button_init(); + smdkc110_dm9000_init(); + + samsung_keypad_set_platdata(&smdkc110_keypad_data); + s3c24xx_ts_set_platdata(&s3c_ts_platform); + s3c_i2c0_set_platdata(NULL); s3c_i2c1_set_platdata(NULL); s3c_i2c2_set_platdata(NULL); @@ -131,6 +695,17 @@ static void __init smdkc110_machine_init(void) s3c_ide_set_platdata(&smdkc110_ide_pdata); + s3c_fb_set_platdata(&smdkc110_lcd0_pdata); + +#ifdef CONFIG_CPU_FREQ + s5pv210_cpufreq_set_platdata(&smdkc110_cpufreq_plat); +#endif + + /* SOUND */ + smdkc110_sound_init(); + + samsung_bl_set(&smdkc110_bl_gpio_info, &smdkc110_bl_data); + platform_add_devices(smdkc110_devices, ARRAY_SIZE(smdkc110_devices)); } diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c index c6a9e86..614ac9a 100644 --- a/arch/arm/mach-s5pv210/mach-smdkv210.c +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c @@ -11,12 +11,17 @@ #include <linux/kernel.h> #include <linux/types.h> #include <linux/i2c.h> +#include <linux/regulator/consumer.h> +#include <linux/regulator/fixed.h> +#include <linux/regulator/machine.h> +#include <linux/mfd/max8698.h> #include <linux/init.h> #include <linux/serial_core.h> #include <linux/sysdev.h> #include <linux/dm9000.h> #include <linux/fb.h> #include <linux/gpio.h> +#include <linux/gpio_event.h> #include <linux/delay.h> #include <linux/pwm_backlight.h> @@ -28,8 +33,9 @@ #include <video/platform_lcd.h> #include <mach/map.h> +#include <mach/gpio.h> #include <mach/regs-clock.h> -#include <mach/regs-fb.h> +#include <mach/media.h> #include <plat/regs-serial.h> #include <plat/regs-srom.h> @@ -45,6 +51,9 @@ #include <plat/pm.h> #include <plat/fb.h> #include <plat/s5p-time.h> +#include <plat/media.h> +#include <plat/backlight.h> +#include <plat/regs-fb-v4.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ @@ -91,6 +100,223 @@ static struct s3c2410_uartcfg smdkv210_uartcfgs[] __initdata = { }, }; +#if defined(CONFIG_REGULATOR_MAX8698) +/* LDO */ +static struct regulator_consumer_supply smdkv210_ldo3_consumer[] = { + REGULATOR_SUPPLY("pd_io", "s3c-usbgadget") +}; + +static struct regulator_consumer_supply smdkv210_ldo5_consumer[] = { + REGULATOR_SUPPLY("AVDD", "0-001b"), + REGULATOR_SUPPLY("DVDD", "0-001b"), +}; + +static struct regulator_consumer_supply smdkv210_ldo8_consumer[] = { + REGULATOR_SUPPLY("pd_core", "s3c-usbgadget") +}; + +static struct regulator_init_data smdkv210_ldo2_data = { + .constraints = { + .name = "VALIVE_1.1V", + .min_uV = 1100000, + .max_uV = 1100000, + .apply_uV = 1, + .always_on = 1, + .state_mem = { + .enabled = 1, + }, + }, +}; + +static struct regulator_init_data smdkv210_ldo3_data = { + .constraints = { + .name = "VUOTG_D+VUHOST_D_1.1V", + .min_uV = 1100000, + .max_uV = 1100000, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = 1, + }, + }, + .num_consumer_supplies = ARRAY_SIZE(smdkv210_ldo3_consumer), + .consumer_supplies = smdkv210_ldo3_consumer, +}; + +static struct regulator_init_data smdkv210_ldo4_data = { + .constraints = { + .name = "V_MIPI_1.8V", + .min_uV = 1800000, + .max_uV = 1800000, + .apply_uV = 1, + .always_on = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = 1, + }, + }, +}; + +static struct regulator_init_data smdkv210_ldo5_data = { + .constraints = { + .name = "VMMC+VEXT_2.8V", + .min_uV = 2800000, + .max_uV = 2800000, + .apply_uV = 1, + .always_on = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .enabled = 1, + }, + }, + .num_consumer_supplies = ARRAY_SIZE(smdkv210_ldo5_consumer), + .consumer_supplies = smdkv210_ldo5_consumer, +}; + +static struct regulator_init_data smdkv210_ldo6_data = { + .constraints = { + .name = "VCC_2.6V", + .min_uV = 2600000, + .max_uV = 2600000, + .apply_uV = 1, + .always_on = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = 1, + }, + }, +}; + +static struct regulator_init_data smdkv210_ldo7_data = { + .constraints = { + .name = "VDAC_2.8V", + .min_uV = 2800000, + .max_uV = 2800000, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .enabled = 1, + }, + }, +}; + +static struct regulator_init_data smdkv210_ldo8_data = { + .constraints = { + .name = "VUOTG_A+VUHOST_A_3.3V", + .min_uV = 3300000, + .max_uV = 3300000, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .state_mem = { + .disabled = 1, + }, + }, + .num_consumer_supplies = ARRAY_SIZE(smdkv210_ldo8_consumer), + .consumer_supplies = smdkv210_ldo8_consumer, +}; + +static struct regulator_init_data smdkv210_ldo9_data = { + .constraints = { + .name = "VADC+VSYS+VKEY_2.8V", + .min_uV = 2800000, + .max_uV = 2800000, + .apply_uV = 1, + .always_on = 1, + .state_mem = { + .enabled = 1, + }, + }, +}; + +/* BUCK */ +static struct regulator_consumer_supply smdkv210_buck1_consumer = + REGULATOR_SUPPLY("vddarm", NULL); + +static struct regulator_consumer_supply smdkv210_buck2_consumer = + REGULATOR_SUPPLY("vddint", NULL); + +static struct regulator_init_data smdkv210_buck1_data = { + .constraints = { + .name = "VCC_ARM", + .min_uV = 750000, + .max_uV = 1500000, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | + REGULATOR_CHANGE_STATUS, + .state_mem = { + .uV = 1250000, + .mode = REGULATOR_MODE_NORMAL, + .disabled = 1, + }, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &smdkv210_buck1_consumer, +}; + +static struct regulator_init_data smdkv210_buck2_data = { + .constraints = { + .name = "VCC_INTERNAL", + .min_uV = 950000, + .max_uV = 1200000, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | + REGULATOR_CHANGE_STATUS, + .state_mem = { + .uV = 1100000, + .mode = REGULATOR_MODE_NORMAL, + .disabled = 1, + }, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &smdkv210_buck2_consumer, +}; + +static struct regulator_init_data smdkv210_buck3_data = { + .constraints = { + .name = "VCC_MEM", + .min_uV = 1800000, + .max_uV = 1800000, + .always_on = 1, + .apply_uV = 1, + .state_mem = { + .uV = 1800000, + .mode = REGULATOR_MODE_NORMAL, + .enabled = 1, + }, + }, +}; + +static struct max8698_regulator_data smdkv210_regulators[] = { + { MAX8698_LDO2, &smdkv210_ldo2_data }, + { MAX8698_LDO3, &smdkv210_ldo3_data }, + { MAX8698_LDO4, &smdkv210_ldo4_data }, + { MAX8698_LDO5, &smdkv210_ldo5_data }, + { MAX8698_LDO6, &smdkv210_ldo6_data }, + { MAX8698_LDO7, &smdkv210_ldo7_data }, + { MAX8698_LDO8, &smdkv210_ldo8_data }, + { MAX8698_LDO9, &smdkv210_ldo9_data }, + { MAX8698_BUCK1, &smdkv210_buck1_data }, + { MAX8698_BUCK2, &smdkv210_buck2_data }, + { MAX8698_BUCK3, &smdkv210_buck3_data }, +}; + +static struct max8698_platform_data smdkv210_max8698_pdata = { + .num_regulators = ARRAY_SIZE(smdkv210_regulators), + .regulators = smdkv210_regulators, + + /* 1GHz default voltage */ + .dvsarm1 = 0xa, /* 1.25v */ + .dvsarm2 = 0x9, /* 1.20V */ + .dvsarm3 = 0x6, /* 1.05V */ + .dvsarm4 = 0x4, /* 0.95V */ + .dvsint1 = 0x7, /* 1.10v */ + .dvsint2 = 0x5, /* 1.00V */ + + .set1 = S5PV210_GPH1(6), + .set2 = S5PV210_GPH1(7), + .set3 = S5PV210_GPH0(4), +}; +#endif + static struct s3c_ide_platdata smdkv210_ide_pdata __initdata = { .setup_gpio = s5pv210_ide_setup_gpio, }; @@ -110,7 +336,7 @@ static struct matrix_keymap_data smdkv210_keymap_data __initdata = { static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = { .keymap_data = &smdkv210_keymap_data, - .rows = 8, + .rows = 2, .cols = 8, }; @@ -147,6 +373,38 @@ struct platform_device smdkv210_dm9000 = { }, }; +#ifdef CONFIG_REGULATOR +static struct regulator_consumer_supply smdkv210_b_pwr_5v_consumers[] = { + { + /* WM8580 */ + .supply = "PVDD", + .dev_name = "0-001b", + }, +}; + +static struct regulator_init_data smdkv210_b_pwr_5v_data = { + .constraints = { + .always_on = 1, + }, + .num_consumer_supplies = ARRAY_SIZE(smdkv210_b_pwr_5v_consumers), + .consumer_supplies = smdkv210_b_pwr_5v_consumers, +}; + +static struct fixed_voltage_config smdkv210_b_pwr_5v_pdata = { + .supply_name = "B_PWR_5V", + .microvolts = 5000000, + .init_data = &smdkv210_b_pwr_5v_data, +}; + +static struct platform_device smdkv210_b_pwr_5v = { + .name = "reg-fixed-voltage", + .id = -1, + .dev = { + .platform_data = &smdkv210_b_pwr_5v_pdata, + }, +}; +#endif + static void smdkv210_lte480wv_set_power(struct plat_lcd_data *pd, unsigned int power) { @@ -210,45 +468,50 @@ static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = { .setup_gpio = s5pv210_fb_gpio_setup_24bpp, }; -static int smdkv210_backlight_init(struct device *dev) -{ - int ret; - - ret = gpio_request(S5PV210_GPD0(3), "Backlight"); - if (ret) { - printk(KERN_ERR "failed to request GPD for PWM-OUT 3\n"); - return ret; +static struct gpio_event_direct_entry smdkv210_keypad_key_map[] = { + { + .gpio = S5PV210_GPH3(7), + .code = KEY_POWER, } +}; - /* Configure GPIO pin with S5PV210_GPD_0_3_TOUT_3 */ - s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_SFN(2)); - - return 0; -} +static struct gpio_event_input_info smdkv210_keypad_key_info = { + .info.func = gpio_event_input_func, + .info.no_suspend = true, + .debounce_time.tv64 = 5 * NSEC_PER_MSEC, + .type = EV_KEY, + .keymap = smdkv210_keypad_key_map, + .keymap_size = ARRAY_SIZE(smdkv210_keypad_key_map) +}; -static void smdkv210_backlight_exit(struct device *dev) -{ - s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_OUTPUT); - gpio_free(S5PV210_GPD0(3)); -} +static struct gpio_event_info *smdkv210_input_info[] = { + &smdkv210_keypad_key_info.info, +}; -static struct platform_pwm_backlight_data smdkv210_backlight_data = { - .pwm_id = 3, - .max_brightness = 255, - .dft_brightness = 255, - .pwm_period_ns = 78770, - .init = smdkv210_backlight_init, - .exit = smdkv210_backlight_exit, +static struct gpio_event_platform_data smdkv210_input_data = { + .names = { + "smdkv210-keypad", + NULL, + }, + .info = smdkv210_input_info, + .info_count = ARRAY_SIZE(smdkv210_input_info), }; -static struct platform_device smdkv210_backlight_device = { - .name = "pwm-backlight", - .dev = { - .parent = &s3c_device_timer[3].dev, - .platform_data = &smdkv210_backlight_data, +static struct platform_device smdkv210_input_device = { + .name = GPIO_EVENT_DEV_NAME, + .id = 0, + .dev = { + .platform_data = &smdkv210_input_data, }, }; +#ifdef CONFIG_BATTERY_SAMSUNG +static struct platform_device samsung_device_battery = { + .name = "samsung-fake-battery", + .id = -1, +}; +#endif + static struct platform_device *smdkv210_devices[] __initdata = { &s3c_device_adc, &s3c_device_cfcon, @@ -268,12 +531,26 @@ static struct platform_device *smdkv210_devices[] __initdata = { &s5pv210_device_spdif, &samsung_asoc_dma, &samsung_device_keypad, +#ifdef CONFIG_BATTERY_SAMSUNG + &samsung_device_battery, +#endif &smdkv210_dm9000, &smdkv210_lcd_lte480wv, - &s3c_device_timer[3], - &smdkv210_backlight_device, + &smdkv210_input_device, +#ifdef CONFIG_REGULATOR + &smdkv210_b_pwr_5v, +#endif }; +static void __init smdkv210_button_init(void) +{ + s3c_gpio_cfgpin(S5PV210_GPH3(7), (0xf << 28)); + s3c_gpio_setpull(S5PV210_GPH3(7), S3C_GPIO_PULL_NONE); + + s3c_gpio_cfgpin(S5PV210_GPH0(4), (0xf << 16)); + s3c_gpio_setpull(S5PV210_GPH0(4), S3C_GPIO_PULL_NONE); +} + static void __init smdkv210_dm9000_init(void) { unsigned int tmp; @@ -301,13 +578,51 @@ static struct i2c_board_info smdkv210_i2c_devs1[] __initdata = { }; static struct i2c_board_info smdkv210_i2c_devs2[] __initdata = { - /* To Be Updated */ +#if defined(CONFIG_REGULATOR_MAX8698) + { + I2C_BOARD_INFO("max8698", 0xCC >> 1), + .platform_data = &smdkv210_max8698_pdata, + }, +#endif }; static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { .delay = 10000, .presc = 49, .oversampling_shift = 2, + .cal_x_max = 800, + .cal_y_max = 480, + .cal_param = { + -13357, -85, 53858048, -95, -8493, 32809514, 65536 + }, +}; + +static void smdkv210_sound_init(void) +{ + u32 reg; + + reg = __raw_readl(S5P_CLK_OUT); + reg &= ~S5P_CLKOUT_CLKSEL_MASK; + reg &= ~S5P_CLKOUT_DIVVAL_MASK; + reg |= S5P_CLKOUT_CLKSEL_XUSBXTI; + reg |= 0x1 << S5P_CLKOUT_DIVVAL_SHIFT; + __raw_writel(reg, S5P_CLK_OUT); + + reg = __raw_readl(S5P_OTHERS); + reg &= ~S5P_OTHERS_CLKOUT_MASK; + reg |= S5P_OTHERS_CLKOUT_SYSCON; + __raw_writel(reg, S5P_OTHERS); +} + +/* LCD Backlight data */ +static struct samsung_bl_gpio_info smdkv210_bl_gpio_info = { + .no = S5PV210_GPD0(3), + .func = S3C_GPIO_SFN(2), +}; + +static struct platform_pwm_backlight_data smdkv210_bl_data = { + .pwm_id = 3, + .pwm_period_ns = 1000, }; static void __init smdkv210_map_io(void) @@ -316,12 +631,15 @@ static void __init smdkv210_map_io(void) s3c24xx_init_clocks(24000000); s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); s5p_set_timer_source(S5P_PWM2, S5P_PWM4); + + s5p_reserve_mem(S5P_RANGE_MFC); } static void __init smdkv210_machine_init(void) { s3c_pm_init(); + smdkv210_button_init(); smdkv210_dm9000_init(); samsung_keypad_set_platdata(&smdkv210_keypad_data); @@ -341,6 +659,11 @@ static void __init smdkv210_machine_init(void) s3c_fb_set_platdata(&smdkv210_lcd0_pdata); + /* SOUND */ + smdkv210_sound_init(); + + samsung_bl_set(&smdkv210_bl_gpio_info, &smdkv210_bl_data); + platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices)); } diff --git a/arch/arm/mach-s5pv210/reserve_mem-s5pv210.c b/arch/arm/mach-s5pv210/reserve_mem-s5pv210.c new file mode 100644 index 0000000..d5a7d0a --- /dev/null +++ b/arch/arm/mach-s5pv210/reserve_mem-s5pv210.c @@ -0,0 +1,113 @@ +/* linux/arch/arm/mach-s5pv210/reserve_mem-s5pv210.c + * + * Copyright (c) 2011 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * reserve_mem helper functions for S5PV210 + * + * 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/mm.h> +#include <linux/swap.h> +#include <asm/setup.h> +#include <linux/io.h> +#include <mach/memory.h> +#include <plat/media.h> +#include <mach/media.h> + +struct s5p_media_device media_devs[] = { +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 + { + .id = S5P_MDEV_MFC, + .name = "mfc", + .bank = 0, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 * SZ_1K, + .paddr = 0, + }, +#endif + +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 + { + .id = S5P_MDEV_MFC, + .name = "mfc", + .bank = 1, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 * SZ_1K, + .paddr = 0, + }, +#endif + +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD + { + .id = S5P_MDEV_FIMD, + .name = "fimd", + .bank = 1, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD * SZ_1K, + .paddr = 0, + }, +#endif + +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0 + { + .id = S5P_MDEV_FIMC0, + .name = "fimc0", + .bank = 1, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0 * SZ_1K, + .paddr = 0, + }, +#endif + +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1 + { + .id = S5P_MDEV_FIMC1, + .name = "fimc1", + .bank = 1, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1 * SZ_1K, + .paddr = 0, + }, +#endif + +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2 + { + .id = S5P_MDEV_FIMC2, + .name = "fimc2", + .bank = 1, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2 * SZ_1K, + .paddr = 0, + }, +#endif + +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMG2D + { + .id = S5P_MDEV_FIMG2D, + .name = "fimg2d", + .bank = 0, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMG2D * SZ_1K, + .paddr = 0, + }, +#endif + +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG + { + .id = S5P_MDEV_JPEG, + .name = "jpeg", + .bank = 0, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG * SZ_1K, + .paddr = 0, + }, +#endif + +#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_TEXSTREAM + { + .id = S5P_MDEV_TEXSTREAM, + .name = "texstream", + .bank = 1, + .memsize = CONFIG_VIDEO_SAMSUNG_MEMSIZE_TEXSTREAM * SZ_1K, + .paddr = 0, + }, +#endif +}; + +int nr_media_devs = (sizeof(media_devs) / sizeof(media_devs[0])); diff --git a/arch/arm/mach-s5pv210/setup-fb-24bpp.c b/arch/arm/mach-s5pv210/setup-fb-24bpp.c index e932ebf..55103c8 100644 --- a/arch/arm/mach-s5pv210/setup-fb-24bpp.c +++ b/arch/arm/mach-s5pv210/setup-fb-24bpp.c @@ -15,7 +15,6 @@ #include <linux/fb.h> #include <linux/gpio.h> -#include <mach/regs-fb.h> #include <mach/map.h> #include <plat/fb.h> #include <mach/regs-clock.h> diff --git a/arch/arm/mach-s5pv210/setup-keypad.c b/arch/arm/mach-s5pv210/setup-keypad.c index c56420a..d631917 100644 --- a/arch/arm/mach-s5pv210/setup-keypad.c +++ b/arch/arm/mach-s5pv210/setup-keypad.c @@ -17,7 +17,8 @@ void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) { /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */ - s3c_gpio_cfgrange_nopull(S5PV210_GPH3(0), rows, S3C_GPIO_SFN(3)); + s3c_gpio_cfgall_range(S5PV210_GPH3(0), rows, + S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP); /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */ s3c_gpio_cfgrange_nopull(S5PV210_GPH2(0), cols, S3C_GPIO_SFN(3)); |