aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 12:38:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 12:38:59 -0500
commit18656782a820f075cb5c168a2e381a8938b1550a (patch)
treedb431928382a8ae2cc6a153ad28e5bb6a8d5d67e /include/linux/mfd
parenta233bb742aed62fc6164073d9835135f639b8828 (diff)
parent6f4554bdff6870c9e0f0b152bbec71d7a0f366f1 (diff)
Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver updates from Olof Johansson: "These are changes for drivers that are intimately tied to some SoC and for some reason could not get merged through the respective subsystem maintainer tree. This time around, much of this is for at91, with the bulk of it being syscon and udc drivers. Also, there's: - coupled cpuidle support for Samsung Exynos4210 - Renesas 73A0 common-clk work - of/platform changes to tear down DMA mappings on device destruction - a few updates to the TI Keystone knav code" * tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (26 commits) cpuidle: exynos: add coupled cpuidle support for exynos4210 ARM: EXYNOS: apply S5P_CENTRAL_SEQ_OPTION fix only when necessary soc: ti: knav_qmss_queue: change knav_range_setup_acc_irq to static soc: ti: knav_qmss_queue: makefile tweak to build as dynamic module pcmcia: at91_cf: depend on !ARCH_MULTIPLATFORM soc: ti: knav_qmss_queue: export API calls for use by user driver of/platform: teardown DMA mappings on device destruction usb: gadget: at91_udc: Allocate udc instance usb: gadget: at91_udc: Update DT binding documentation usb: gadget: at91_udc: Rework for multi-platform kernel support usb: gadget: at91_udc: Simplify probe and remove functions usb: gadget: at91_udc: Remove non-DT handling code usb: gadget: at91_udc: Document DT clocks and clock-names property usb: gadget: at91_udc: Drop uclk clock usb: gadget: at91_udc: Fix clock names mfd: syscon: Add Atmel SMC binding doc mfd: syscon: Add atmel-smc registers definition mfd: syscon: Add Atmel Matrix bus DT binding documentation mfd: syscon: Add atmel-matrix registers definition clk: shmobile: fix sparse NULL pointer warning ...
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/syscon/atmel-matrix.h117
-rw-r--r--include/linux/mfd/syscon/atmel-smc.h173
2 files changed, 290 insertions, 0 deletions
diff --git a/include/linux/mfd/syscon/atmel-matrix.h b/include/linux/mfd/syscon/atmel-matrix.h
new file mode 100644
index 000000000000..8293c3e2a82a
--- /dev/null
+++ b/include/linux/mfd/syscon/atmel-matrix.h
@@ -0,0 +1,117 @@
1/*
2 * Copyright (C) 2014 Atmel Corporation.
3 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef _LINUX_MFD_SYSCON_ATMEL_MATRIX_H
13#define _LINUX_MFD_SYSCON_ATMEL_MATRIX_H
14
15#define AT91SAM9260_MATRIX_MCFG 0x00
16#define AT91SAM9260_MATRIX_SCFG 0x40
17#define AT91SAM9260_MATRIX_PRS 0x80
18#define AT91SAM9260_MATRIX_MRCR 0x100
19#define AT91SAM9260_MATRIX_EBICSA 0x11c
20
21#define AT91SAM9261_MATRIX_MRCR 0x0
22#define AT91SAM9261_MATRIX_SCFG 0x4
23#define AT91SAM9261_MATRIX_TCR 0x24
24#define AT91SAM9261_MATRIX_EBICSA 0x30
25#define AT91SAM9261_MATRIX_USBPUCR 0x34
26
27#define AT91SAM9263_MATRIX_MCFG 0x00
28#define AT91SAM9263_MATRIX_SCFG 0x40
29#define AT91SAM9263_MATRIX_PRS 0x80
30#define AT91SAM9263_MATRIX_MRCR 0x100
31#define AT91SAM9263_MATRIX_TCR 0x114
32#define AT91SAM9263_MATRIX_EBI0CSA 0x120
33#define AT91SAM9263_MATRIX_EBI1CSA 0x124
34
35#define AT91SAM9RL_MATRIX_MCFG 0x00
36#define AT91SAM9RL_MATRIX_SCFG 0x40
37#define AT91SAM9RL_MATRIX_PRS 0x80
38#define AT91SAM9RL_MATRIX_MRCR 0x100
39#define AT91SAM9RL_MATRIX_TCR 0x114
40#define AT91SAM9RL_MATRIX_EBICSA 0x120
41
42#define AT91SAM9G45_MATRIX_MCFG 0x00
43#define AT91SAM9G45_MATRIX_SCFG 0x40
44#define AT91SAM9G45_MATRIX_PRS 0x80
45#define AT91SAM9G45_MATRIX_MRCR 0x100
46#define AT91SAM9G45_MATRIX_TCR 0x110
47#define AT91SAM9G45_MATRIX_DDRMPR 0x118
48#define AT91SAM9G45_MATRIX_EBICSA 0x128
49
50#define AT91SAM9N12_MATRIX_MCFG 0x00
51#define AT91SAM9N12_MATRIX_SCFG 0x40
52#define AT91SAM9N12_MATRIX_PRS 0x80
53#define AT91SAM9N12_MATRIX_MRCR 0x100
54#define AT91SAM9N12_MATRIX_EBICSA 0x118
55
56#define AT91SAM9X5_MATRIX_MCFG 0x00
57#define AT91SAM9X5_MATRIX_SCFG 0x40
58#define AT91SAM9X5_MATRIX_PRS 0x80
59#define AT91SAM9X5_MATRIX_MRCR 0x100
60#define AT91SAM9X5_MATRIX_EBICSA 0x120
61
62#define SAMA5D3_MATRIX_MCFG 0x00
63#define SAMA5D3_MATRIX_SCFG 0x40
64#define SAMA5D3_MATRIX_PRS 0x80
65#define SAMA5D3_MATRIX_MRCR 0x100
66
67#define AT91_MATRIX_MCFG(o, x) ((o) + ((x) * 0x4))
68#define AT91_MATRIX_ULBT GENMASK(2, 0)
69#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
70#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
71#define AT91_MATRIX_ULBT_FOUR (2 << 0)
72#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
73#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
74
75#define AT91_MATRIX_SCFG(o, x) ((o) + ((x) * 0x4))
76#define AT91_MATRIX_SLOT_CYCLE GENMASK(7, 0)
77#define AT91_MATRIX_DEFMSTR_TYPE GENMASK(17, 16)
78#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
79#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
80#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
81#define AT91_MATRIX_FIXED_DEFMSTR GENMASK(20, 18)
82#define AT91_MATRIX_ARBT GENMASK(25, 24)
83#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
84#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
85
86#define AT91_MATRIX_ITCM_SIZE GENMASK(3, 0)
87#define AT91_MATRIX_ITCM_0 (0 << 0)
88#define AT91_MATRIX_ITCM_16 (5 << 0)
89#define AT91_MATRIX_ITCM_32 (6 << 0)
90#define AT91_MATRIX_ITCM_64 (7 << 0)
91#define AT91_MATRIX_DTCM_SIZE GENMASK(7, 4)
92#define AT91_MATRIX_DTCM_0 (0 << 4)
93#define AT91_MATRIX_DTCM_16 (5 << 4)
94#define AT91_MATRIX_DTCM_32 (6 << 4)
95#define AT91_MATRIX_DTCM_64 (7 << 4)
96
97#define AT91_MATRIX_PRAS(o, x) ((o) + ((x) * 0x8))
98#define AT91_MATRIX_PRBS(o, x) ((o) + ((x) * 0x8) + 0x4)
99#define AT91_MATRIX_MPR(x) GENMASK(((x) * 0x4) + 1, ((x) * 0x4))
100
101#define AT91_MATRIX_RCB(x) BIT(x)
102
103#define AT91_MATRIX_CSA(cs, val) (val << (cs))
104#define AT91_MATRIX_DBPUC BIT(8)
105#define AT91_MATRIX_DBPDC BIT(9)
106#define AT91_MATRIX_VDDIOMSEL BIT(16)
107#define AT91_MATRIX_VDDIOMSEL_1_8V (0 << 16)
108#define AT91_MATRIX_VDDIOMSEL_3_3V (1 << 16)
109#define AT91_MATRIX_EBI_IOSR BIT(17)
110#define AT91_MATRIX_DDR_IOSR BIT(18)
111#define AT91_MATRIX_NFD0_SELECT BIT(24)
112#define AT91_MATRIX_DDR_MP_EN BIT(25)
113#define AT91_MATRIX_EBI_NUM_CS 8
114
115#define AT91_MATRIX_USBPUCR_PUON BIT(30)
116
117#endif /* _LINUX_MFD_SYSCON_ATMEL_MATRIX_H */
diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
new file mode 100644
index 000000000000..be6ebe64eebe
--- /dev/null
+++ b/include/linux/mfd/syscon/atmel-smc.h
@@ -0,0 +1,173 @@
1/*
2 * Atmel SMC (Static Memory Controller) register offsets and bit definitions.
3 *
4 * Copyright (C) 2014 Atmel
5 * Copyright (C) 2014 Free Electrons
6 *
7 * Author: Boris Brezillon <boris.brezillon@free-electrons.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef _LINUX_MFD_SYSCON_ATMEL_SMC_H_
15#define _LINUX_MFD_SYSCON_ATMEL_SMC_H_
16
17#include <linux/kernel.h>
18#include <linux/regmap.h>
19
20#define AT91SAM9_SMC_GENERIC 0x00
21#define AT91SAM9_SMC_GENERIC_BLK_SZ 0x10
22
23#define SAMA5_SMC_GENERIC 0x600
24#define SAMA5_SMC_GENERIC_BLK_SZ 0x14
25
26#define AT91SAM9_SMC_SETUP(o) ((o) + 0x00)
27#define AT91SAM9_SMC_NWESETUP(x) (x)
28#define AT91SAM9_SMC_NCS_WRSETUP(x) ((x) << 8)
29#define AT91SAM9_SMC_NRDSETUP(x) ((x) << 16)
30#define AT91SAM9_SMC_NCS_NRDSETUP(x) ((x) << 24)
31
32#define AT91SAM9_SMC_PULSE(o) ((o) + 0x04)
33#define AT91SAM9_SMC_NWEPULSE(x) (x)
34#define AT91SAM9_SMC_NCS_WRPULSE(x) ((x) << 8)
35#define AT91SAM9_SMC_NRDPULSE(x) ((x) << 16)
36#define AT91SAM9_SMC_NCS_NRDPULSE(x) ((x) << 24)
37
38#define AT91SAM9_SMC_CYCLE(o) ((o) + 0x08)
39#define AT91SAM9_SMC_NWECYCLE(x) (x)
40#define AT91SAM9_SMC_NRDCYCLE(x) ((x) << 16)
41
42#define AT91SAM9_SMC_MODE(o) ((o) + 0x0c)
43#define SAMA5_SMC_MODE(o) ((o) + 0x10)
44#define AT91_SMC_READMODE BIT(0)
45#define AT91_SMC_READMODE_NCS (0 << 0)
46#define AT91_SMC_READMODE_NRD (1 << 0)
47#define AT91_SMC_WRITEMODE BIT(1)
48#define AT91_SMC_WRITEMODE_NCS (0 << 1)
49#define AT91_SMC_WRITEMODE_NWE (1 << 1)
50#define AT91_SMC_EXNWMODE GENMASK(5, 4)
51#define AT91_SMC_EXNWMODE_DISABLE (0 << 4)
52#define AT91_SMC_EXNWMODE_FROZEN (2 << 4)
53#define AT91_SMC_EXNWMODE_READY (3 << 4)
54#define AT91_SMC_BAT BIT(8)
55#define AT91_SMC_BAT_SELECT (0 << 8)
56#define AT91_SMC_BAT_WRITE (1 << 8)
57#define AT91_SMC_DBW GENMASK(13, 12)
58#define AT91_SMC_DBW_8 (0 << 12)
59#define AT91_SMC_DBW_16 (1 << 12)
60#define AT91_SMC_DBW_32 (2 << 12)
61#define AT91_SMC_TDF GENMASK(19, 16)
62#define AT91_SMC_TDF_(x) ((((x) - 1) << 16) & AT91_SMC_TDF)
63#define AT91_SMC_TDF_MAX 16
64#define AT91_SMC_TDFMODE_OPTIMIZED BIT(20)
65#define AT91_SMC_PMEN BIT(24)
66#define AT91_SMC_PS GENMASK(29, 28)
67#define AT91_SMC_PS_4 (0 << 28)
68#define AT91_SMC_PS_8 (1 << 28)
69#define AT91_SMC_PS_16 (2 << 28)
70#define AT91_SMC_PS_32 (3 << 28)
71
72
73/*
74 * This function converts a setup timing expressed in nanoseconds into an
75 * encoded value that can be written in the SMC_SETUP register.
76 *
77 * The following formula is described in atmel datasheets (section
78 * "SMC Setup Register"):
79 *
80 * setup length = (128* SETUP[5] + SETUP[4:0])
81 *
82 * where setup length is the timing expressed in cycles.
83 */
84static inline u32 at91sam9_smc_setup_ns_to_cycles(unsigned int clk_rate,
85 u32 timing_ns)
86{
87 u32 clk_period = DIV_ROUND_UP(NSEC_PER_SEC, clk_rate);
88 u32 coded_cycles = 0;
89 u32 cycles;
90
91 cycles = DIV_ROUND_UP(timing_ns, clk_period);
92 if (cycles / 32) {
93 coded_cycles |= 1 << 5;
94 if (cycles < 128)
95 cycles = 0;
96 }
97
98 coded_cycles |= cycles % 32;
99
100 return coded_cycles;
101}
102
103/*
104 * This function converts a pulse timing expressed in nanoseconds into an
105 * encoded value that can be written in the SMC_PULSE register.
106 *
107 * The following formula is described in atmel datasheets (section
108 * "SMC Pulse Register"):
109 *
110 * pulse length = (256* PULSE[6] + PULSE[5:0])
111 *
112 * where pulse length is the timing expressed in cycles.
113 */
114static inline u32 at91sam9_smc_pulse_ns_to_cycles(unsigned int clk_rate,
115 u32 timing_ns)
116{
117 u32 clk_period = DIV_ROUND_UP(NSEC_PER_SEC, clk_rate);
118 u32 coded_cycles = 0;
119 u32 cycles;
120
121 cycles = DIV_ROUND_UP(timing_ns, clk_period);
122 if (cycles / 64) {
123 coded_cycles |= 1 << 6;
124 if (cycles < 256)
125 cycles = 0;
126 }
127
128 coded_cycles |= cycles % 64;
129
130 return coded_cycles;
131}
132
133/*
134 * This function converts a cycle timing expressed in nanoseconds into an
135 * encoded value that can be written in the SMC_CYCLE register.
136 *
137 * The following formula is described in atmel datasheets (section
138 * "SMC Cycle Register"):
139 *
140 * cycle length = (CYCLE[8:7]*256 + CYCLE[6:0])
141 *
142 * where cycle length is the timing expressed in cycles.
143 */
144static inline u32 at91sam9_smc_cycle_ns_to_cycles(unsigned int clk_rate,
145 u32 timing_ns)
146{
147 u32 clk_period = DIV_ROUND_UP(NSEC_PER_SEC, clk_rate);
148 u32 coded_cycles = 0;
149 u32 cycles;
150
151 cycles = DIV_ROUND_UP(timing_ns, clk_period);
152 if (cycles / 128) {
153 coded_cycles = cycles / 256;
154 cycles %= 256;
155 if (cycles >= 128) {
156 coded_cycles++;
157 cycles = 0;
158 }
159
160 if (coded_cycles > 0x3) {
161 coded_cycles = 0x3;
162 cycles = 0x7f;
163 }
164
165 coded_cycles <<= 7;
166 }
167
168 coded_cycles |= cycles % 128;
169
170 return coded_cycles;
171}
172
173#endif /* _LINUX_MFD_SYSCON_ATMEL_SMC_H_ */