aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2017-12-15 12:41:05 -0500
committerTony Lindgren <tony@atomide.com>2017-12-21 10:28:54 -0500
commit49a0a3d805df3b7b4f8a04db6dbf55aa36fd762c (patch)
treefa107287f9d83dfa994e90658c18dee1b9f46fe3
parentbf80705222987ea4c75d75af2c404373765b77c6 (diff)
bus: ti-sysc: Make omap_hwmod_sysc_fields into sysc_regbits platform data
We want to be able to configure hwmod sysc data from ti-sysc driver using platform data callbacks. So let's make struct omap_hwmod_sysc_fields into struct sysc_data and have it available for both ti-sysc driver and hwmod code. Note that we can make it use s8 instead of u8 as the hwmod code uses the feature flags to check for this field. However, for ti-sysc we can use -ENODEV to indicate a feature is not supported in the hardware and can simplify the code that way. And let's add also emufree_shift as the dts files will be describing the hardware for the SYSCONFIG register capbilities mask. Cc: Paul Walmsley <paul@pwsan.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h40
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.c21
-rw-r--r--include/linux/platform_data/ti-sysc.h29
4 files changed, 53 insertions, 39 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 104256a5f0f7..fbc738c844b3 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -143,6 +143,8 @@
143#include <linux/of_address.h> 143#include <linux/of_address.h>
144#include <linux/bootmem.h> 144#include <linux/bootmem.h>
145 145
146#include <linux/platform_data/ti-sysc.h>
147
146#include <asm/system_misc.h> 148#include <asm/system_misc.h>
147 149
148#include "clock.h" 150#include "clock.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 610cdb318005..b7eeb6193504 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -37,15 +37,15 @@
37 37
38struct omap_device; 38struct omap_device;
39 39
40extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type1; 40extern struct sysc_regbits omap_hwmod_sysc_type1;
41extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2; 41extern struct sysc_regbits omap_hwmod_sysc_type2;
42extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type3; 42extern struct sysc_regbits omap_hwmod_sysc_type3;
43extern struct omap_hwmod_sysc_fields omap34xx_sr_sysc_fields; 43extern struct sysc_regbits omap34xx_sr_sysc_fields;
44extern struct omap_hwmod_sysc_fields omap36xx_sr_sysc_fields; 44extern struct sysc_regbits omap36xx_sr_sysc_fields;
45extern struct omap_hwmod_sysc_fields omap3_sham_sysc_fields; 45extern struct sysc_regbits omap3_sham_sysc_fields;
46extern struct omap_hwmod_sysc_fields omap3xxx_aes_sysc_fields; 46extern struct sysc_regbits omap3xxx_aes_sysc_fields;
47extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type_mcasp; 47extern struct sysc_regbits omap_hwmod_sysc_type_mcasp;
48extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type_usb_host_fs; 48extern struct sysc_regbits omap_hwmod_sysc_type_usb_host_fs;
49 49
50/* 50/*
51 * OCP SYSCONFIG bit shifts/masks TYPE1. These are for IPs compliant 51 * OCP SYSCONFIG bit shifts/masks TYPE1. These are for IPs compliant
@@ -291,26 +291,6 @@ struct omap_hwmod_ocp_if {
291#define CLOCKACT_TEST_NONE 0x3 291#define CLOCKACT_TEST_NONE 0x3
292 292
293/** 293/**
294 * struct omap_hwmod_sysc_fields - hwmod OCP_SYSCONFIG register field offsets.
295 * @midle_shift: Offset of the midle bit
296 * @clkact_shift: Offset of the clockactivity bit
297 * @sidle_shift: Offset of the sidle bit
298 * @enwkup_shift: Offset of the enawakeup bit
299 * @srst_shift: Offset of the softreset bit
300 * @autoidle_shift: Offset of the autoidle bit
301 * @dmadisable_shift: Offset of the dmadisable bit
302 */
303struct omap_hwmod_sysc_fields {
304 u8 midle_shift;
305 u8 clkact_shift;
306 u8 sidle_shift;
307 u8 enwkup_shift;
308 u8 srst_shift;
309 u8 autoidle_shift;
310 u8 dmadisable_shift;
311};
312
313/**
314 * struct omap_hwmod_class_sysconfig - hwmod class OCP_SYS* data 294 * struct omap_hwmod_class_sysconfig - hwmod class OCP_SYS* data
315 * @rev_offs: IP block revision register offset (from module base addr) 295 * @rev_offs: IP block revision register offset (from module base addr)
316 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) 296 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr)
@@ -341,7 +321,7 @@ struct omap_hwmod_class_sysconfig {
341 u32 sysc_offs; 321 u32 sysc_offs;
342 u32 syss_offs; 322 u32 syss_offs;
343 u16 sysc_flags; 323 u16 sysc_flags;
344 struct omap_hwmod_sysc_fields *sysc_fields; 324 struct sysc_regbits *sysc_fields;
345 u8 srst_udelay; 325 u8 srst_udelay;
346 u8 idlemodes; 326 u8 idlemodes;
347}; 327};
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.c b/arch/arm/mach-omap2/omap_hwmod_common_data.c
index 4fb5fcacdf1d..77c0b7618ea2 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.c
@@ -16,6 +16,9 @@
16 * data and their integration with other OMAP modules and Linux. 16 * data and their integration with other OMAP modules and Linux.
17 */ 17 */
18 18
19#include <linux/types.h>
20#include <linux/platform_data/ti-sysc.h>
21
19#include "omap_hwmod.h" 22#include "omap_hwmod.h"
20 23
21#include "omap_hwmod_common_data.h" 24#include "omap_hwmod_common_data.h"
@@ -27,7 +30,7 @@
27 * if the device ip is compliant with the original PRCM protocol 30 * if the device ip is compliant with the original PRCM protocol
28 * defined for OMAP2420. 31 * defined for OMAP2420.
29 */ 32 */
30struct omap_hwmod_sysc_fields omap_hwmod_sysc_type1 = { 33struct sysc_regbits omap_hwmod_sysc_type1 = {
31 .midle_shift = SYSC_TYPE1_MIDLEMODE_SHIFT, 34 .midle_shift = SYSC_TYPE1_MIDLEMODE_SHIFT,
32 .clkact_shift = SYSC_TYPE1_CLOCKACTIVITY_SHIFT, 35 .clkact_shift = SYSC_TYPE1_CLOCKACTIVITY_SHIFT,
33 .sidle_shift = SYSC_TYPE1_SIDLEMODE_SHIFT, 36 .sidle_shift = SYSC_TYPE1_SIDLEMODE_SHIFT,
@@ -43,7 +46,7 @@ struct omap_hwmod_sysc_fields omap_hwmod_sysc_type1 = {
43 * device ip is compliant with the new PRCM protocol defined for new 46 * device ip is compliant with the new PRCM protocol defined for new
44 * OMAP4 IPs. 47 * OMAP4 IPs.
45 */ 48 */
46struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2 = { 49struct sysc_regbits omap_hwmod_sysc_type2 = {
47 .midle_shift = SYSC_TYPE2_MIDLEMODE_SHIFT, 50 .midle_shift = SYSC_TYPE2_MIDLEMODE_SHIFT,
48 .sidle_shift = SYSC_TYPE2_SIDLEMODE_SHIFT, 51 .sidle_shift = SYSC_TYPE2_SIDLEMODE_SHIFT,
49 .srst_shift = SYSC_TYPE2_SOFTRESET_SHIFT, 52 .srst_shift = SYSC_TYPE2_SOFTRESET_SHIFT,
@@ -54,7 +57,7 @@ struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2 = {
54 * struct omap_hwmod_sysc_type3 - TYPE3 sysconfig scheme. 57 * struct omap_hwmod_sysc_type3 - TYPE3 sysconfig scheme.
55 * Used by some IPs on AM33xx 58 * Used by some IPs on AM33xx
56 */ 59 */
57struct omap_hwmod_sysc_fields omap_hwmod_sysc_type3 = { 60struct sysc_regbits omap_hwmod_sysc_type3 = {
58 .midle_shift = SYSC_TYPE3_MIDLEMODE_SHIFT, 61 .midle_shift = SYSC_TYPE3_MIDLEMODE_SHIFT,
59 .sidle_shift = SYSC_TYPE3_SIDLEMODE_SHIFT, 62 .sidle_shift = SYSC_TYPE3_SIDLEMODE_SHIFT,
60}; 63};
@@ -64,32 +67,32 @@ struct omap_dss_dispc_dev_attr omap2_3_dss_dispc_dev_attr = {
64 .has_framedonetv_irq = 0 67 .has_framedonetv_irq = 0
65}; 68};
66 69
67struct omap_hwmod_sysc_fields omap34xx_sr_sysc_fields = { 70struct sysc_regbits omap34xx_sr_sysc_fields = {
68 .clkact_shift = 20, 71 .clkact_shift = 20,
69}; 72};
70 73
71struct omap_hwmod_sysc_fields omap36xx_sr_sysc_fields = { 74struct sysc_regbits omap36xx_sr_sysc_fields = {
72 .sidle_shift = 24, 75 .sidle_shift = 24,
73 .enwkup_shift = 26, 76 .enwkup_shift = 26,
74}; 77};
75 78
76struct omap_hwmod_sysc_fields omap3_sham_sysc_fields = { 79struct sysc_regbits omap3_sham_sysc_fields = {
77 .sidle_shift = 4, 80 .sidle_shift = 4,
78 .srst_shift = 1, 81 .srst_shift = 1,
79 .autoidle_shift = 0, 82 .autoidle_shift = 0,
80}; 83};
81 84
82struct omap_hwmod_sysc_fields omap3xxx_aes_sysc_fields = { 85struct sysc_regbits omap3xxx_aes_sysc_fields = {
83 .sidle_shift = 6, 86 .sidle_shift = 6,
84 .srst_shift = 1, 87 .srst_shift = 1,
85 .autoidle_shift = 0, 88 .autoidle_shift = 0,
86}; 89};
87 90
88struct omap_hwmod_sysc_fields omap_hwmod_sysc_type_mcasp = { 91struct sysc_regbits omap_hwmod_sysc_type_mcasp = {
89 .sidle_shift = 0, 92 .sidle_shift = 0,
90}; 93};
91 94
92struct omap_hwmod_sysc_fields omap_hwmod_sysc_type_usb_host_fs = { 95struct sysc_regbits omap_hwmod_sysc_type_usb_host_fs = {
93 .midle_shift = 4, 96 .midle_shift = 4,
94 .sidle_shift = 2, 97 .sidle_shift = 2,
95 .srst_shift = 1, 98 .srst_shift = 1,
diff --git a/include/linux/platform_data/ti-sysc.h b/include/linux/platform_data/ti-sysc.h
new file mode 100644
index 000000000000..280466099b76
--- /dev/null
+++ b/include/linux/platform_data/ti-sysc.h
@@ -0,0 +1,29 @@
1#ifndef __TI_SYSC_DATA_H__
2#define __TI_SYSC_DATA_H__
3
4/**
5 * struct sysc_regbits - TI OCP_SYSCONFIG register field offsets
6 * @midle_shift: Offset of the midle bit
7 * @clkact_shift: Offset of the clockactivity bit
8 * @sidle_shift: Offset of the sidle bit
9 * @enwkup_shift: Offset of the enawakeup bit
10 * @srst_shift: Offset of the softreset bit
11 * @autoidle_shift: Offset of the autoidle bit
12 * @dmadisable_shift: Offset of the dmadisable bit
13 * @emufree_shift; Offset of the emufree bit
14 *
15 * Note that 0 is a valid shift, and for ti-sysc.c -ENODEV can be used if a
16 * feature is not available.
17 */
18struct sysc_regbits {
19 s8 midle_shift;
20 s8 clkact_shift;
21 s8 sidle_shift;
22 s8 enwkup_shift;
23 s8 srst_shift;
24 s8 autoidle_shift;
25 s8 dmadisable_shift;
26 s8 emufree_shift;
27};
28
29#endif /* __TI_SYSC_DATA_H__ */