2010-02-24 00:40:36 -07:00
|
|
|
/* linux/arch/arm/mach-s5pv210/clock.c
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
|
|
|
|
* http://www.samsung.com/
|
|
|
|
*
|
|
|
|
* S5PV210 - Clock 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/init.h>
|
|
|
|
#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/sysdev.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
|
|
|
|
#include <mach/map.h>
|
|
|
|
|
|
|
|
#include <plat/cpu-freq.h>
|
|
|
|
#include <mach/regs-clock.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>
|
|
|
|
|
2010-05-16 17:38:01 -07:00
|
|
|
static struct clksrc_clk clk_mout_apll = {
|
|
|
|
.clk = {
|
|
|
|
.name = "mout_apll",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clk_src_apll,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_mout_epll = {
|
|
|
|
.clk = {
|
|
|
|
.name = "mout_epll",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clk_src_epll,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_mout_mpll = {
|
|
|
|
.clk = {
|
|
|
|
.name = "mout_mpll",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clk_src_mpll,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 },
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:31 -07:00
|
|
|
static struct clk *clkset_armclk_list[] = {
|
|
|
|
[0] = &clk_mout_apll.clk,
|
|
|
|
[1] = &clk_mout_mpll.clk,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_armclk = {
|
|
|
|
.sources = clkset_armclk_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_armclk_list),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_armclk = {
|
|
|
|
.clk = {
|
|
|
|
.name = "armclk",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clkset_armclk,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 },
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 3 },
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:34 -07:00
|
|
|
static struct clksrc_clk clk_hclk_msys = {
|
|
|
|
.clk = {
|
|
|
|
.name = "hclk_msys",
|
|
|
|
.id = -1,
|
|
|
|
.parent = &clk_armclk.clk,
|
|
|
|
},
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 },
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:42 -07:00
|
|
|
static struct clksrc_clk clk_pclk_msys = {
|
|
|
|
.clk = {
|
|
|
|
.name = "pclk_msys",
|
|
|
|
.id = -1,
|
|
|
|
.parent = &clk_hclk_msys.clk,
|
|
|
|
},
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 },
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:37 -07:00
|
|
|
static struct clksrc_clk clk_sclk_a2m = {
|
|
|
|
.clk = {
|
|
|
|
.name = "sclk_a2m",
|
|
|
|
.id = -1,
|
|
|
|
.parent = &clk_mout_apll.clk,
|
|
|
|
},
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk *clkset_hclk_sys_list[] = {
|
|
|
|
[0] = &clk_mout_mpll.clk,
|
|
|
|
[1] = &clk_sclk_a2m.clk,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_hclk_sys = {
|
|
|
|
.sources = clkset_hclk_sys_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_hclk_sys_list),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_hclk_dsys = {
|
|
|
|
.clk = {
|
|
|
|
.name = "hclk_dsys",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clkset_hclk_sys,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 },
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 4 },
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:48 -07:00
|
|
|
static struct clksrc_clk clk_pclk_dsys = {
|
|
|
|
.clk = {
|
|
|
|
.name = "pclk_dsys",
|
|
|
|
.id = -1,
|
|
|
|
.parent = &clk_hclk_dsys.clk,
|
|
|
|
},
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV0, .shift = 20, .size = 3 },
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:40 -07:00
|
|
|
static struct clksrc_clk clk_hclk_psys = {
|
|
|
|
.clk = {
|
|
|
|
.name = "hclk_psys",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clkset_hclk_sys,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 },
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV0, .shift = 24, .size = 4 },
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:50 -07:00
|
|
|
static struct clksrc_clk clk_pclk_psys = {
|
|
|
|
.clk = {
|
|
|
|
.name = "pclk_psys",
|
|
|
|
.id = -1,
|
|
|
|
.parent = &clk_hclk_psys.clk,
|
|
|
|
},
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV0, .shift = 28, .size = 3 },
|
|
|
|
};
|
|
|
|
|
2010-02-24 00:40:36 -07:00
|
|
|
static int s5pv210_clk_ip0_ctrl(struct clk *clk, int enable)
|
|
|
|
{
|
|
|
|
return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int s5pv210_clk_ip1_ctrl(struct clk *clk, int enable)
|
|
|
|
{
|
|
|
|
return s5p_gatectrl(S5P_CLKGATE_IP1, clk, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int s5pv210_clk_ip2_ctrl(struct clk *clk, int enable)
|
|
|
|
{
|
|
|
|
return s5p_gatectrl(S5P_CLKGATE_IP2, clk, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int s5pv210_clk_ip3_ctrl(struct clk *clk, int enable)
|
|
|
|
{
|
|
|
|
return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable);
|
|
|
|
}
|
|
|
|
|
2010-05-16 17:38:52 -07:00
|
|
|
static int s5pv210_clk_mask0_ctrl(struct clk *clk, int enable)
|
|
|
|
{
|
|
|
|
return s5p_gatectrl(S5P_CLK_SRC_MASK0, clk, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct clk clk_sclk_hdmi27m = {
|
|
|
|
.name = "sclk_hdmi27m",
|
|
|
|
.id = -1,
|
|
|
|
.rate = 27000000,
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:55 -07:00
|
|
|
static struct clk clk_sclk_hdmiphy = {
|
|
|
|
.name = "sclk_hdmiphy",
|
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk clk_sclk_usbphy0 = {
|
|
|
|
.name = "sclk_usbphy0",
|
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk clk_sclk_usbphy1 = {
|
|
|
|
.name = "sclk_usbphy1",
|
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:52 -07:00
|
|
|
static struct clk *clkset_vpllsrc_list[] = {
|
|
|
|
[0] = &clk_fin_vpll,
|
|
|
|
[1] = &clk_sclk_hdmi27m,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_vpllsrc = {
|
|
|
|
.sources = clkset_vpllsrc_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_vpllsrc_list),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_vpllsrc = {
|
|
|
|
.clk = {
|
|
|
|
.name = "vpll_src",
|
|
|
|
.id = -1,
|
|
|
|
.enable = s5pv210_clk_mask0_ctrl,
|
|
|
|
.ctrlbit = (1 << 7),
|
|
|
|
},
|
|
|
|
.sources = &clkset_vpllsrc,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC1, .shift = 28, .size = 1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk *clkset_sclk_vpll_list[] = {
|
|
|
|
[0] = &clk_vpllsrc.clk,
|
|
|
|
[1] = &clk_fout_vpll,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_sclk_vpll = {
|
|
|
|
.sources = clkset_sclk_vpll_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_sclk_vpll = {
|
|
|
|
.clk = {
|
|
|
|
.name = "sclk_vpll",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clkset_sclk_vpll,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:44 -07:00
|
|
|
static unsigned long s5pv210_clk_imem_get_rate(struct clk *clk)
|
|
|
|
{
|
|
|
|
return clk_get_rate(clk->parent) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct clk_ops clk_hclk_imem_ops = {
|
|
|
|
.get_rate = s5pv210_clk_imem_get_rate,
|
|
|
|
};
|
|
|
|
|
2010-02-24 00:40:36 -07:00
|
|
|
static struct clk init_clocks_disable[] = {
|
|
|
|
{
|
|
|
|
.name = "rot",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:37 -07:00
|
|
|
.parent = &clk_hclk_dsys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip0_ctrl,
|
|
|
|
.ctrlbit = (1<<29),
|
|
|
|
}, {
|
|
|
|
.name = "otg",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:40 -07:00
|
|
|
.parent = &clk_hclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip1_ctrl,
|
|
|
|
.ctrlbit = (1<<16),
|
|
|
|
}, {
|
|
|
|
.name = "usb-host",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:40 -07:00
|
|
|
.parent = &clk_hclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip1_ctrl,
|
|
|
|
.ctrlbit = (1<<17),
|
|
|
|
}, {
|
|
|
|
.name = "lcd",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:37 -07:00
|
|
|
.parent = &clk_hclk_dsys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip1_ctrl,
|
|
|
|
.ctrlbit = (1<<0),
|
|
|
|
}, {
|
|
|
|
.name = "cfcon",
|
|
|
|
.id = 0,
|
2010-05-16 17:38:40 -07:00
|
|
|
.parent = &clk_hclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip1_ctrl,
|
|
|
|
.ctrlbit = (1<<25),
|
|
|
|
}, {
|
|
|
|
.name = "hsmmc",
|
|
|
|
.id = 0,
|
2010-05-16 17:38:40 -07:00
|
|
|
.parent = &clk_hclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip2_ctrl,
|
|
|
|
.ctrlbit = (1<<16),
|
|
|
|
}, {
|
|
|
|
.name = "hsmmc",
|
|
|
|
.id = 1,
|
2010-05-16 17:38:40 -07:00
|
|
|
.parent = &clk_hclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip2_ctrl,
|
|
|
|
.ctrlbit = (1<<17),
|
|
|
|
}, {
|
|
|
|
.name = "hsmmc",
|
|
|
|
.id = 2,
|
2010-05-16 17:38:40 -07:00
|
|
|
.parent = &clk_hclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip2_ctrl,
|
|
|
|
.ctrlbit = (1<<18),
|
|
|
|
}, {
|
|
|
|
.name = "hsmmc",
|
|
|
|
.id = 3,
|
2010-05-16 17:38:40 -07:00
|
|
|
.parent = &clk_hclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip2_ctrl,
|
|
|
|
.ctrlbit = (1<<19),
|
|
|
|
}, {
|
|
|
|
.name = "systimer",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<16),
|
|
|
|
}, {
|
|
|
|
.name = "watchdog",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<22),
|
|
|
|
}, {
|
|
|
|
.name = "rtc",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<15),
|
|
|
|
}, {
|
|
|
|
.name = "i2c",
|
|
|
|
.id = 0,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<7),
|
|
|
|
}, {
|
|
|
|
.name = "i2c",
|
|
|
|
.id = 1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<8),
|
|
|
|
}, {
|
|
|
|
.name = "i2c",
|
|
|
|
.id = 2,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<9),
|
|
|
|
}, {
|
|
|
|
.name = "spi",
|
|
|
|
.id = 0,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<12),
|
|
|
|
}, {
|
|
|
|
.name = "spi",
|
|
|
|
.id = 1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<13),
|
|
|
|
}, {
|
|
|
|
.name = "spi",
|
|
|
|
.id = 2,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<14),
|
|
|
|
}, {
|
|
|
|
.name = "timers",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<23),
|
|
|
|
}, {
|
|
|
|
.name = "adc",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<24),
|
|
|
|
}, {
|
|
|
|
.name = "keypad",
|
|
|
|
.id = -1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<21),
|
|
|
|
}, {
|
|
|
|
.name = "i2s_v50",
|
|
|
|
.id = 0,
|
|
|
|
.parent = &clk_p,
|
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<4),
|
|
|
|
}, {
|
|
|
|
.name = "i2s_v32",
|
|
|
|
.id = 0,
|
|
|
|
.parent = &clk_p,
|
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<4),
|
|
|
|
}, {
|
|
|
|
.name = "i2s_v32",
|
|
|
|
.id = 1,
|
|
|
|
.parent = &clk_p,
|
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<4),
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk init_clocks[] = {
|
|
|
|
{
|
2010-05-16 17:38:44 -07:00
|
|
|
.name = "hclk_imem",
|
|
|
|
.id = -1,
|
|
|
|
.parent = &clk_hclk_msys.clk,
|
|
|
|
.ctrlbit = (1 << 5),
|
|
|
|
.enable = s5pv210_clk_ip0_ctrl,
|
|
|
|
.ops = &clk_hclk_imem_ops,
|
|
|
|
}, {
|
2010-02-24 00:40:36 -07:00
|
|
|
.name = "uart",
|
|
|
|
.id = 0,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<7),
|
|
|
|
}, {
|
|
|
|
.name = "uart",
|
|
|
|
.id = 1,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<8),
|
|
|
|
}, {
|
|
|
|
.name = "uart",
|
|
|
|
.id = 2,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<9),
|
|
|
|
}, {
|
|
|
|
.name = "uart",
|
|
|
|
.id = 3,
|
2010-05-16 17:38:50 -07:00
|
|
|
.parent = &clk_pclk_psys.clk,
|
2010-02-24 00:40:36 -07:00
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
.ctrlbit = (1<<10),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk *clkset_uart_list[] = {
|
|
|
|
[6] = &clk_mout_mpll.clk,
|
|
|
|
[7] = &clk_mout_epll.clk,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_uart = {
|
|
|
|
.sources = clkset_uart_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_uart_list),
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:55 -07:00
|
|
|
static struct clk *clkset_group1_list[] = {
|
|
|
|
[0] = &clk_sclk_a2m.clk,
|
|
|
|
[1] = &clk_mout_mpll.clk,
|
|
|
|
[2] = &clk_mout_epll.clk,
|
|
|
|
[3] = &clk_sclk_vpll.clk,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_group1 = {
|
|
|
|
.sources = clkset_group1_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_group1_list),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk *clkset_sclk_onenand_list[] = {
|
|
|
|
[0] = &clk_hclk_psys.clk,
|
|
|
|
[1] = &clk_hclk_dsys.clk,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_sclk_onenand = {
|
|
|
|
.sources = clkset_sclk_onenand_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_sclk_onenand_list),
|
|
|
|
};
|
|
|
|
|
2010-05-16 17:38:57 -07:00
|
|
|
static struct clk *clkset_sclk_dac_list[] = {
|
|
|
|
[0] = &clk_sclk_vpll.clk,
|
|
|
|
[1] = &clk_sclk_hdmiphy,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_sclk_dac = {
|
|
|
|
.sources = clkset_sclk_dac_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_sclk_dac = {
|
|
|
|
.clk = {
|
|
|
|
.name = "sclk_dac",
|
|
|
|
.id = -1,
|
|
|
|
.ctrlbit = (1 << 10),
|
|
|
|
.enable = s5pv210_clk_ip1_ctrl,
|
|
|
|
},
|
|
|
|
.sources = &clkset_sclk_dac,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_sclk_pixel = {
|
|
|
|
.clk = {
|
|
|
|
.name = "sclk_pixel",
|
|
|
|
.id = -1,
|
|
|
|
.parent = &clk_sclk_vpll.clk,
|
|
|
|
},
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk *clkset_sclk_hdmi_list[] = {
|
|
|
|
[0] = &clk_sclk_pixel.clk,
|
|
|
|
[1] = &clk_sclk_hdmiphy,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_sclk_hdmi = {
|
|
|
|
.sources = clkset_sclk_hdmi_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_clk clk_sclk_hdmi = {
|
|
|
|
.clk = {
|
|
|
|
.name = "sclk_hdmi",
|
|
|
|
.id = -1,
|
|
|
|
.enable = s5pv210_clk_ip1_ctrl,
|
|
|
|
.ctrlbit = (1 << 11),
|
|
|
|
},
|
|
|
|
.sources = &clkset_sclk_hdmi,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk *clkset_sclk_mixer_list[] = {
|
|
|
|
[0] = &clk_sclk_dac.clk,
|
|
|
|
[1] = &clk_sclk_hdmi.clk,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clksrc_sources clkset_sclk_mixer = {
|
|
|
|
.sources = clkset_sclk_mixer_list,
|
|
|
|
.nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list),
|
|
|
|
};
|
|
|
|
|
2010-02-24 00:40:36 -07:00
|
|
|
static struct clksrc_clk clksrcs[] = {
|
|
|
|
{
|
2010-05-16 17:38:55 -07:00
|
|
|
.clk = {
|
|
|
|
.name = "sclk_dmc",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clkset_group1,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 },
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 },
|
|
|
|
}, {
|
|
|
|
.clk = {
|
|
|
|
.name = "sclk_onenand",
|
|
|
|
.id = -1,
|
|
|
|
},
|
|
|
|
.sources = &clkset_sclk_onenand,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC0, .shift = 28, .size = 1 },
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV6, .shift = 12, .size = 3 },
|
|
|
|
}, {
|
2010-02-24 00:40:36 -07:00
|
|
|
.clk = {
|
|
|
|
.name = "uclk1",
|
|
|
|
.id = -1,
|
|
|
|
.ctrlbit = (1<<17),
|
|
|
|
.enable = s5pv210_clk_ip3_ctrl,
|
|
|
|
},
|
|
|
|
.sources = &clkset_uart,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC4, .shift = 16, .size = 4 },
|
|
|
|
.reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
|
2010-05-16 17:38:57 -07:00
|
|
|
}, {
|
|
|
|
.clk = {
|
|
|
|
.name = "sclk_mixer",
|
|
|
|
.id = -1,
|
|
|
|
.enable = s5pv210_clk_ip1_ctrl,
|
|
|
|
.ctrlbit = (1 << 9),
|
|
|
|
},
|
|
|
|
.sources = &clkset_sclk_mixer,
|
|
|
|
.reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 1 },
|
|
|
|
},
|
2010-02-24 00:40:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Clock initialisation code */
|
2010-05-16 17:38:12 -07:00
|
|
|
static struct clksrc_clk *sysclks[] = {
|
2010-02-24 00:40:36 -07:00
|
|
|
&clk_mout_apll,
|
|
|
|
&clk_mout_epll,
|
|
|
|
&clk_mout_mpll,
|
2010-05-16 17:38:31 -07:00
|
|
|
&clk_armclk,
|
2010-05-16 17:38:34 -07:00
|
|
|
&clk_hclk_msys,
|
2010-05-16 17:38:37 -07:00
|
|
|
&clk_sclk_a2m,
|
|
|
|
&clk_hclk_dsys,
|
2010-05-16 17:38:40 -07:00
|
|
|
&clk_hclk_psys,
|
2010-05-16 17:38:42 -07:00
|
|
|
&clk_pclk_msys,
|
2010-05-16 17:38:48 -07:00
|
|
|
&clk_pclk_dsys,
|
2010-05-16 17:38:50 -07:00
|
|
|
&clk_pclk_psys,
|
2010-05-16 17:38:52 -07:00
|
|
|
&clk_vpllsrc,
|
|
|
|
&clk_sclk_vpll,
|
2010-05-16 17:38:57 -07:00
|
|
|
&clk_sclk_dac,
|
|
|
|
&clk_sclk_pixel,
|
|
|
|
&clk_sclk_hdmi,
|
2010-02-24 00:40:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
void __init_or_cpufreq s5pv210_setup_clocks(void)
|
|
|
|
{
|
|
|
|
struct clk *xtal_clk;
|
|
|
|
unsigned long xtal;
|
2010-05-16 17:38:52 -07:00
|
|
|
unsigned long vpllsrc;
|
2010-02-24 00:40:36 -07:00
|
|
|
unsigned long armclk;
|
2010-05-16 17:38:34 -07:00
|
|
|
unsigned long hclk_msys;
|
2010-05-16 17:38:37 -07:00
|
|
|
unsigned long hclk_dsys;
|
2010-05-16 17:38:40 -07:00
|
|
|
unsigned long hclk_psys;
|
2010-05-16 17:38:42 -07:00
|
|
|
unsigned long pclk_msys;
|
2010-05-16 17:38:48 -07:00
|
|
|
unsigned long pclk_dsys;
|
2010-05-16 17:38:50 -07:00
|
|
|
unsigned long pclk_psys;
|
2010-02-24 00:40:36 -07:00
|
|
|
unsigned long apll;
|
|
|
|
unsigned long mpll;
|
|
|
|
unsigned long epll;
|
2010-05-16 17:38:52 -07:00
|
|
|
unsigned long vpll;
|
2010-02-24 00:40:36 -07:00
|
|
|
unsigned int ptr;
|
|
|
|
u32 clkdiv0, clkdiv1;
|
|
|
|
|
|
|
|
printk(KERN_DEBUG "%s: registering clocks\n", __func__);
|
|
|
|
|
|
|
|
clkdiv0 = __raw_readl(S5P_CLK_DIV0);
|
|
|
|
clkdiv1 = __raw_readl(S5P_CLK_DIV1);
|
|
|
|
|
|
|
|
printk(KERN_DEBUG "%s: clkdiv0 = %08x, clkdiv1 = %08x\n",
|
|
|
|
__func__, clkdiv0, clkdiv1);
|
|
|
|
|
|
|
|
xtal_clk = clk_get(NULL, "xtal");
|
|
|
|
BUG_ON(IS_ERR(xtal_clk));
|
|
|
|
|
|
|
|
xtal = clk_get_rate(xtal_clk);
|
|
|
|
clk_put(xtal_clk);
|
|
|
|
|
|
|
|
printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
|
|
|
|
|
|
|
|
apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508);
|
|
|
|
mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502);
|
|
|
|
epll = s5p_get_pll45xx(xtal, __raw_readl(S5P_EPLL_CON), pll_4500);
|
2010-05-16 17:38:52 -07:00
|
|
|
vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
|
|
|
|
vpll = s5p_get_pll45xx(vpllsrc, __raw_readl(S5P_VPLL_CON), pll_4502);
|
2010-02-24 00:40:36 -07:00
|
|
|
|
2010-05-16 17:38:28 -07:00
|
|
|
clk_fout_apll.rate = apll;
|
|
|
|
clk_fout_mpll.rate = mpll;
|
|
|
|
clk_fout_epll.rate = epll;
|
2010-05-16 17:38:52 -07:00
|
|
|
clk_fout_vpll.rate = vpll;
|
2010-05-16 17:38:28 -07:00
|
|
|
|
2010-05-16 17:38:52 -07:00
|
|
|
printk(KERN_INFO "S5PV210: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
|
|
|
|
apll, mpll, epll, vpll);
|
2010-02-24 00:40:36 -07:00
|
|
|
|
2010-05-16 17:38:31 -07:00
|
|
|
armclk = clk_get_rate(&clk_armclk.clk);
|
2010-05-16 17:38:34 -07:00
|
|
|
hclk_msys = clk_get_rate(&clk_hclk_msys.clk);
|
2010-05-16 17:38:37 -07:00
|
|
|
hclk_dsys = clk_get_rate(&clk_hclk_dsys.clk);
|
2010-05-16 17:38:40 -07:00
|
|
|
hclk_psys = clk_get_rate(&clk_hclk_psys.clk);
|
2010-05-16 17:38:42 -07:00
|
|
|
pclk_msys = clk_get_rate(&clk_pclk_msys.clk);
|
2010-05-16 17:38:48 -07:00
|
|
|
pclk_dsys = clk_get_rate(&clk_pclk_dsys.clk);
|
2010-05-16 17:38:50 -07:00
|
|
|
pclk_psys = clk_get_rate(&clk_pclk_psys.clk);
|
2010-02-24 00:40:36 -07:00
|
|
|
|
2010-05-16 17:38:40 -07:00
|
|
|
printk(KERN_INFO "S5PV210: ARMCLK=%ld, HCLKM=%ld, HCLKD=%ld\n"
|
|
|
|
"HCLKP=%ld, PCLKM=%ld, PCLKD=%ld, PCLKP=%ld\n",
|
|
|
|
armclk, hclk_msys, hclk_dsys, hclk_psys,
|
2010-05-16 17:38:50 -07:00
|
|
|
pclk_msys, pclk_dsys, pclk_psys);
|
2010-02-24 00:40:36 -07:00
|
|
|
|
|
|
|
clk_f.rate = armclk;
|
2010-05-16 17:38:40 -07:00
|
|
|
clk_h.rate = hclk_psys;
|
2010-05-16 17:38:50 -07:00
|
|
|
clk_p.rate = pclk_psys;
|
2010-02-24 00:40:36 -07:00
|
|
|
|
|
|
|
for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
|
|
|
|
s3c_set_clksrc(&clksrcs[ptr], true);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct clk *clks[] __initdata = {
|
2010-05-16 17:38:52 -07:00
|
|
|
&clk_sclk_hdmi27m,
|
2010-05-16 17:38:55 -07:00
|
|
|
&clk_sclk_hdmiphy,
|
|
|
|
&clk_sclk_usbphy0,
|
|
|
|
&clk_sclk_usbphy1,
|
2010-02-24 00:40:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
void __init s5pv210_register_clocks(void)
|
|
|
|
{
|
|
|
|
struct clk *clkp;
|
|
|
|
int ret;
|
|
|
|
int ptr;
|
|
|
|
|
|
|
|
ret = s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
|
|
|
|
if (ret > 0)
|
|
|
|
printk(KERN_ERR "Failed to register %u clocks\n", ret);
|
|
|
|
|
2010-05-16 17:38:12 -07:00
|
|
|
for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
|
|
|
|
s3c_register_clksrc(sysclks[ptr], 1);
|
|
|
|
|
2010-02-24 00:40:36 -07:00
|
|
|
s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
|
|
|
|
s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
|
|
|
|
|
|
|
|
clkp = init_clocks_disable;
|
|
|
|
for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
|
|
|
|
ret = s3c24xx_register_clock(clkp);
|
|
|
|
if (ret < 0) {
|
|
|
|
printk(KERN_ERR "Failed to register clock %s (%d)\n",
|
|
|
|
clkp->name, ret);
|
|
|
|
}
|
|
|
|
(clkp->enable)(clkp, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
s3c_pwmclk_init();
|
|
|
|
}
|