diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-s5pv210/clock.c | 138 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/cpu.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/dev-audio.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/map.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-s5p/include/plat/map-s5p.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-s5p/include/plat/pll.h | 2 |
6 files changed, 156 insertions, 7 deletions
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c index 23fd3e3..1aaeb68 100644 --- a/arch/arm/mach-s5pv210/clock.c +++ b/arch/arm/mach-s5pv210/clock.c @@ -30,6 +30,7 @@ #include <plat/s5p-clock.h> #include <plat/clock-clksrc.h> #include <plat/s5pv210.h> +#include <mach/regs-audss.h> static unsigned long xtal; @@ -185,6 +186,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, @@ -493,6 +499,14 @@ static struct clk init_clocks_off[] = { }, }; +static int s5pc11x_clk_out_set_rate(struct clk *clk, unsigned long rate); +static int s5pc11x_clk_out_set_parent(struct clk *clk, struct clk *parent); + +static struct clk_ops s5pc11x_clkout_ops = { + .set_parent = s5pc11x_clk_out_set_parent, + .set_rate = s5pc11x_clk_out_set_rate, +}; + static struct clk init_clocks[] = { { .name = "hclk_imem", @@ -537,6 +551,16 @@ static struct clk init_clocks[] = { .parent = &clk_hclk_msys.clk, .enable = s5pv210_clk_ip0_ctrl, .ctrlbit = (1<<16), + }, { + .name = "i2s_v50", + .id = 0, + .parent = &clk_p, + .enable = s5pv210_clk_ip3_ctrl, + .ctrlbit = S5P_CLKGATE_IP3_I2S0 | S5P_CLKGATE_IP3_PCM0, /* I2S0 is v5.0 */ + },{ + .name = "clk_out", + .id = -1, + .ops = &s5pc11x_clkout_ops, }, }; @@ -633,6 +657,64 @@ static struct clksrc_sources clkset_sclk_mixer = { .nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list), }; +static int s5pc11x_clk_out_set_rate(struct clk *clk, unsigned long rate) +{ + u32 val = 0, div = 0, rate_div = 1; + int err = -EINVAL; + if(rate && clk->parent) + { + if(clk->parent == &clk_fout_apll) + rate_div = 4; + if(clk->parent == &clk_fout_mpll) + rate_div = 2; + + div = clk_get_rate(clk->parent) / rate/ rate_div; + val = __raw_readl(S5P_CLK_OUT); + val &= (~(0xF << 20)); + val |= (div - 1) << 20; + __raw_writel(val, S5P_CLK_OUT); + err = 0; + } + return err; +} + +static int s5pc11x_clk_out_set_parent(struct clk *clk, struct clk *parent) +{ + u32 val = 0; + int err = 0; + clk->parent = parent; + val = __raw_readl(S5P_CLK_OUT); + + if(parent == &clk_fout_apll)// rate is APLL/4 + { + val = val & (~(0x1F << 12)); + val |= (0x0 << 12); + } + else if(parent == &clk_fout_mpll)// rate is MPLL/2 + { + val = val & (~(0x1F << 12)); + val |= (0x1 << 12); + } + else if(parent == &clk_fout_epll) + { + val = val & (~(0x1F << 12)); + val |= (0x2 << 12); + } + else if(parent == &clk_sclk_vpll.clk) + { + val = val & (~(0x1F << 12)); + val |= (0x3 << 12); + } + else + { + err = -EINVAL; + } + + __raw_writel(val, S5P_CLK_OUT); + return err; +} + + static struct clk *clkset_sclk_audio0_list[] = { [0] = &clk_ext_xtal_mux, [1] = &clk_pcmcdclk0, @@ -662,6 +744,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[] = { + NULL, + &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, + .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, @@ -1089,6 +1224,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] = { diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c index 400d6d8..0e22b86 100644 --- a/arch/arm/mach-s5pv210/cpu.c +++ b/arch/arm/mach-s5pv210/cpu.c @@ -112,8 +112,14 @@ static struct map_desc s5pv210_iodesc[] __initdata = { .pfn = __phys_to_pfn(S5PV210_PA_RTC), .length = SZ_4K, .type = MT_DEVICE, - } + }, #endif + { + .virtual = (unsigned long)S5P_VA_AUDSS, + .pfn = __phys_to_pfn(S5PV210_PA_AUDSS), + .length = SZ_1M, + .type = MT_DEVICE, + }, }; static void s5pv210_idle(void) diff --git a/arch/arm/mach-s5pv210/dev-audio.c b/arch/arm/mach-s5pv210/dev-audio.c index 8d58f19..f4d14a4 100644 --- a/arch/arm/mach-s5pv210/dev-audio.c +++ b/arch/arm/mach-s5pv210/dev-audio.c @@ -63,13 +63,13 @@ static struct resource s5pv210_iis0_resource[] = { .flags = IORESOURCE_MEM, }, [1] = { - .start = DMACH_I2S0_TX, - .end = DMACH_I2S0_TX, + .start = DMACH_I2S0_OUT, + .end = DMACH_I2S0_OUT, .flags = IORESOURCE_DMA, }, [2] = { - .start = DMACH_I2S0_RX, - .end = DMACH_I2S0_RX, + .start = DMACH_I2S0_IN, + .end = DMACH_I2S0_IN, .flags = IORESOURCE_DMA, }, [3] = { @@ -80,8 +80,8 @@ static struct resource s5pv210_iis0_resource[] = { }; struct platform_device s5pv210_device_iis0 = { - .name = "samsung-i2s", - .id = 0, + .name = "s5pc1xx-iis", + .id = 0, .num_resources = ARRAY_SIZE(s5pv210_iis0_resource), .resource = s5pv210_iis0_resource, .dev = { diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h index 45f7683..e007587 100644 --- a/arch/arm/mach-s5pv210/include/mach/map.h +++ b/arch/arm/mach-s5pv210/include/mach/map.h @@ -87,6 +87,8 @@ #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 diff --git a/arch/arm/plat-s5p/include/plat/map-s5p.h b/arch/arm/plat-s5p/include/plat/map-s5p.h index d973d39..56b0432 100644 --- a/arch/arm/plat-s5p/include/plat/map-s5p.h +++ b/arch/arm/plat-s5p/include/plat/map-s5p.h @@ -25,6 +25,7 @@ #define S5P_VA_DMC0 S3C_ADDR(0x02440000) #define S5P_VA_DMC1 S3C_ADDR(0x02480000) #define S5P_VA_SROMC S3C_ADDR(0x024C0000) +#define S5P_VA_AUDSS S3C_ADDR(0X01600000) #define S5P_VA_SYSTIMER S3C_ADDR(0x02500000) #define S5P_VA_L2CC S3C_ADDR(0x02600000) diff --git a/arch/arm/plat-s5p/include/plat/pll.h b/arch/arm/plat-s5p/include/plat/pll.h index bf28fad..9c2332f 100644 --- a/arch/arm/plat-s5p/include/plat/pll.h +++ b/arch/arm/plat-s5p/include/plat/pll.h @@ -94,10 +94,12 @@ static inline unsigned long s5p_get_pll46xx(unsigned long baseclk, return result; } +#define PLL90XX_VDIV_MASK (0x1) #define PLL90XX_MDIV_MASK (0xFF) #define PLL90XX_PDIV_MASK (0x3F) #define PLL90XX_SDIV_MASK (0x7) #define PLL90XX_KDIV_MASK (0xffff) +#define PLL90XX_VDIV_SHIFT (27) #define PLL90XX_MDIV_SHIFT (16) #define PLL90XX_PDIV_SHIFT (8) #define PLL90XX_SDIV_SHIFT (0) |