diff options
| author | Simon Horman <horms+renesas@verge.net.au> | 2013-06-11 01:58:57 -0400 |
|---|---|---|
| committer | Simon Horman <horms+renesas@verge.net.au> | 2013-06-11 01:58:57 -0400 |
| commit | ae8b378faea7f04d4517b22f5d70d824adcbc4dc (patch) | |
| tree | 54f50bcbd0baa55be24ac7ffbf547b4b55d046a4 | |
| parent | 5fcf4a3c3a5bc08bf72a50ef1332501a3c1b96bb (diff) | |
| parent | 413bfd0e67894c930242482cd15ac09a800e2ab8 (diff) | |
Merge branches 'heads/pinmux' and 'heads/soc' into phy-rcar-usb-base
This branch acts as a base for adding USB support to
r8A7778/BOCK-W and r8A7779/Marzen.
It includes the soc branch to provide dependencies in
the r8A7778 clock code.
It includes pinmux to provide pinmux initialisation for Bock-W
which is a dependency.
Conflicts:
arch/arm/mach-shmobile/Kconfig
arch/arm/mach-shmobile/include/mach/r8a7778.h
arch/arm/mach-shmobile/setup-r8a7778.c
| -rw-r--r-- | arch/arm/mach-shmobile/Kconfig | 4 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/clock-r8a73a4.c | 375 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7740.c | 11 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7778.c | 156 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7779.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7790.c | 238 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/clock-sh73a0.c | 111 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/include/mach/clock.h | 8 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/include/mach/r8a7778.h | 2 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/setup-r8a7778.c | 52 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/setup-sh73a0.c | 95 |
11 files changed, 924 insertions, 132 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 06da4d36bc7c..5414402938a5 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
| @@ -36,7 +36,7 @@ config ARCH_R8A7740 | |||
| 36 | select RENESAS_INTC_IRQPIN | 36 | select RENESAS_INTC_IRQPIN |
| 37 | 37 | ||
| 38 | config ARCH_R8A7778 | 38 | config ARCH_R8A7778 |
| 39 | bool "R-Car M1 (R8A77780)" | 39 | bool "R-Car M1A (R8A77781)" |
| 40 | select ARCH_WANT_OPTIONAL_GPIOLIB | 40 | select ARCH_WANT_OPTIONAL_GPIOLIB |
| 41 | select CPU_V7 | 41 | select CPU_V7 |
| 42 | select SH_CLK_CPG | 42 | select SH_CLK_CPG |
| @@ -170,6 +170,8 @@ config MACH_KZM9D | |||
| 170 | config MACH_KZM9G | 170 | config MACH_KZM9G |
| 171 | bool "KZM-A9-GT board" | 171 | bool "KZM-A9-GT board" |
| 172 | depends on ARCH_SH73A0 | 172 | depends on ARCH_SH73A0 |
| 173 | select ARCH_HAS_CPUFREQ | ||
| 174 | select ARCH_HAS_OPP | ||
| 173 | select ARCH_REQUIRE_GPIOLIB | 175 | select ARCH_REQUIRE_GPIOLIB |
| 174 | select REGULATOR_FIXED_VOLTAGE if REGULATOR | 176 | select REGULATOR_FIXED_VOLTAGE if REGULATOR |
| 175 | select SND_SOC_AK4642 if SND_SIMPLE_CARD | 177 | select SND_SOC_AK4642 if SND_SIMPLE_CARD |
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c index e710c00c3822..f6227bb10aca 100644 --- a/arch/arm/mach-shmobile/clock-r8a73a4.c +++ b/arch/arm/mach-shmobile/clock-r8a73a4.c | |||
| @@ -22,15 +22,43 @@ | |||
| 22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
| 23 | #include <linux/sh_clk.h> | 23 | #include <linux/sh_clk.h> |
| 24 | #include <linux/clkdev.h> | 24 | #include <linux/clkdev.h> |
| 25 | #include <mach/clock.h> | ||
| 25 | #include <mach/common.h> | 26 | #include <mach/common.h> |
| 26 | 27 | ||
| 27 | #define CPG_BASE 0xe6150000 | 28 | #define CPG_BASE 0xe6150000 |
| 28 | #define CPG_LEN 0x270 | 29 | #define CPG_LEN 0x270 |
| 29 | 30 | ||
| 30 | #define MPCKCR 0xe6150080 | ||
| 31 | #define SMSTPCR2 0xe6150138 | 31 | #define SMSTPCR2 0xe6150138 |
| 32 | #define SMSTPCR5 0xe6150144 | 32 | #define SMSTPCR5 0xe6150144 |
| 33 | 33 | ||
| 34 | #define FRQCRA 0xE6150000 | ||
| 35 | #define FRQCRB 0xE6150004 | ||
| 36 | #define VCLKCR1 0xE6150008 | ||
| 37 | #define VCLKCR2 0xE615000C | ||
| 38 | #define VCLKCR3 0xE615001C | ||
| 39 | #define VCLKCR4 0xE6150014 | ||
| 40 | #define VCLKCR5 0xE6150034 | ||
| 41 | #define ZBCKCR 0xE6150010 | ||
| 42 | #define SD0CKCR 0xE6150074 | ||
| 43 | #define SD1CKCR 0xE6150078 | ||
| 44 | #define SD2CKCR 0xE615007C | ||
| 45 | #define MMC0CKCR 0xE6150240 | ||
| 46 | #define MMC1CKCR 0xE6150244 | ||
| 47 | #define FSIACKCR 0xE6150018 | ||
| 48 | #define FSIBCKCR 0xE6150090 | ||
| 49 | #define MPCKCR 0xe6150080 | ||
| 50 | #define SPUVCKCR 0xE6150094 | ||
| 51 | #define HSICKCR 0xE615026C | ||
| 52 | #define M4CKCR 0xE6150098 | ||
| 53 | #define PLLECR 0xE61500D0 | ||
| 54 | #define PLL1CR 0xE6150028 | ||
| 55 | #define PLL2CR 0xE615002C | ||
| 56 | #define PLL2SCR 0xE61501F4 | ||
| 57 | #define PLL2HCR 0xE61501E4 | ||
| 58 | #define CKSCR 0xE61500C0 | ||
| 59 | |||
| 60 | #define CPG_MAP(o) ((o - CPG_BASE) + cpg_mapping.base) | ||
| 61 | |||
| 34 | static struct clk_mapping cpg_mapping = { | 62 | static struct clk_mapping cpg_mapping = { |
| 35 | .phys = CPG_BASE, | 63 | .phys = CPG_BASE, |
| 36 | .len = CPG_LEN, | 64 | .len = CPG_LEN, |
| @@ -51,29 +79,326 @@ static struct clk extal2_clk = { | |||
| 51 | .mapping = &cpg_mapping, | 79 | .mapping = &cpg_mapping, |
| 52 | }; | 80 | }; |
| 53 | 81 | ||
| 82 | static struct sh_clk_ops followparent_clk_ops = { | ||
| 83 | .recalc = followparent_recalc, | ||
| 84 | }; | ||
| 85 | |||
| 86 | static struct clk main_clk = { | ||
| 87 | /* .parent will be set r8a73a4_clock_init */ | ||
| 88 | .ops = &followparent_clk_ops, | ||
| 89 | }; | ||
| 90 | |||
| 91 | SH_CLK_RATIO(div2, 1, 2); | ||
| 92 | SH_CLK_RATIO(div4, 1, 4); | ||
| 93 | |||
| 94 | SH_FIXED_RATIO_CLK(main_div2_clk, main_clk, div2); | ||
| 95 | SH_FIXED_RATIO_CLK(extal1_div2_clk, extal1_clk, div2); | ||
| 96 | SH_FIXED_RATIO_CLK(extal2_div2_clk, extal2_clk, div2); | ||
| 97 | SH_FIXED_RATIO_CLK(extal2_div4_clk, extal2_clk, div4); | ||
| 98 | |||
| 99 | /* External FSIACK/FSIBCK clock */ | ||
| 100 | static struct clk fsiack_clk = { | ||
| 101 | }; | ||
| 102 | |||
| 103 | static struct clk fsibck_clk = { | ||
| 104 | }; | ||
| 105 | |||
| 106 | /* | ||
| 107 | * PLL clocks | ||
| 108 | */ | ||
| 109 | static struct clk *pll_parent_main[] = { | ||
| 110 | [0] = &main_clk, | ||
| 111 | [1] = &main_div2_clk | ||
| 112 | }; | ||
| 113 | |||
| 114 | static struct clk *pll_parent_main_extal[8] = { | ||
| 115 | [0] = &main_div2_clk, | ||
| 116 | [1] = &extal2_div2_clk, | ||
| 117 | [3] = &extal2_div4_clk, | ||
| 118 | [4] = &main_clk, | ||
| 119 | [5] = &extal2_clk, | ||
| 120 | }; | ||
| 121 | |||
| 122 | static unsigned long pll_recalc(struct clk *clk) | ||
| 123 | { | ||
| 124 | unsigned long mult = 1; | ||
| 125 | |||
| 126 | if (ioread32(CPG_MAP(PLLECR)) & (1 << clk->enable_bit)) | ||
| 127 | mult = (((ioread32(clk->mapped_reg) >> 24) & 0x7f) + 1); | ||
| 128 | |||
| 129 | return clk->parent->rate * mult; | ||
| 130 | } | ||
| 131 | |||
| 132 | static int pll_set_parent(struct clk *clk, struct clk *parent) | ||
| 133 | { | ||
| 134 | u32 val; | ||
| 135 | int i, ret; | ||
| 136 | |||
| 137 | if (!clk->parent_table || !clk->parent_num) | ||
| 138 | return -EINVAL; | ||
| 139 | |||
| 140 | /* Search the parent */ | ||
| 141 | for (i = 0; i < clk->parent_num; i++) | ||
| 142 | if (clk->parent_table[i] == parent) | ||
| 143 | break; | ||
| 144 | |||
| 145 | if (i == clk->parent_num) | ||
| 146 | return -ENODEV; | ||
| 147 | |||
| 148 | ret = clk_reparent(clk, parent); | ||
| 149 | if (ret < 0) | ||
| 150 | return ret; | ||
| 151 | |||
| 152 | val = ioread32(clk->mapped_reg) & | ||
| 153 | ~(((1 << clk->src_width) - 1) << clk->src_shift); | ||
| 154 | |||
| 155 | iowrite32(val | i << clk->src_shift, clk->mapped_reg); | ||
| 156 | |||
| 157 | return 0; | ||
| 158 | } | ||
| 159 | |||
| 160 | static struct sh_clk_ops pll_clk_ops = { | ||
| 161 | .recalc = pll_recalc, | ||
| 162 | .set_parent = pll_set_parent, | ||
| 163 | }; | ||
| 164 | |||
| 165 | #define PLL_CLOCK(name, p, pt, w, s, reg, e) \ | ||
| 166 | static struct clk name = { \ | ||
| 167 | .ops = &pll_clk_ops, \ | ||
| 168 | .flags = CLK_ENABLE_ON_INIT, \ | ||
| 169 | .parent = p, \ | ||
| 170 | .parent_table = pt, \ | ||
| 171 | .parent_num = ARRAY_SIZE(pt), \ | ||
| 172 | .src_width = w, \ | ||
