3 * Copyright (C) 2013 Texas Instruments Incorporated
5 * Hwmod common for AM335x and AM43x
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <linux/types.h>
19 #include "omap_hwmod.h"
22 #include "omap_hwmod_33xx_43xx_common_data.h"
26 #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
27 #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
28 #define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
29 #define PRCM_FLAGS(oh, flag) ((oh).prcm.omap4.flags = (flag))
33 * instance(s): l3_main, l3_s, l3_instr
35 static struct omap_hwmod_class am33xx_l3_hwmod_class
= {
39 struct omap_hwmod am33xx_l3_main_hwmod
= {
41 .class = &am33xx_l3_hwmod_class
,
42 .clkdm_name
= "l3_clkdm",
43 .flags
= HWMOD_INIT_NO_IDLE
,
44 .main_clk
= "l3_gclk",
47 .modulemode
= MODULEMODE_SWCTRL
,
53 struct omap_hwmod am33xx_l3_s_hwmod
= {
55 .class = &am33xx_l3_hwmod_class
,
56 .clkdm_name
= "l3s_clkdm",
60 struct omap_hwmod am33xx_l3_instr_hwmod
= {
62 .class = &am33xx_l3_hwmod_class
,
63 .clkdm_name
= "l3_clkdm",
64 .flags
= HWMOD_INIT_NO_IDLE
,
65 .main_clk
= "l3_gclk",
68 .modulemode
= MODULEMODE_SWCTRL
,
75 * instance(s): l4_ls, l4_hs, l4_wkup, l4_fw
77 struct omap_hwmod_class am33xx_l4_hwmod_class
= {
82 struct omap_hwmod am33xx_l4_ls_hwmod
= {
84 .class = &am33xx_l4_hwmod_class
,
85 .clkdm_name
= "l4ls_clkdm",
86 .flags
= HWMOD_INIT_NO_IDLE
,
87 .main_clk
= "l4ls_gclk",
90 .modulemode
= MODULEMODE_SWCTRL
,
96 struct omap_hwmod am33xx_l4_wkup_hwmod
= {
98 .class = &am33xx_l4_hwmod_class
,
99 .clkdm_name
= "l4_wkup_clkdm",
100 .flags
= HWMOD_INIT_NO_IDLE
,
103 .modulemode
= MODULEMODE_SWCTRL
,
111 static struct omap_hwmod_class am33xx_mpu_hwmod_class
= {
115 struct omap_hwmod am33xx_mpu_hwmod
= {
117 .class = &am33xx_mpu_hwmod_class
,
118 .clkdm_name
= "mpu_clkdm",
119 .flags
= HWMOD_INIT_NO_IDLE
,
120 .main_clk
= "dpll_mpu_m2_ck",
123 .modulemode
= MODULEMODE_SWCTRL
,
130 * Wakeup controller sub-system under wakeup domain
132 struct omap_hwmod_class am33xx_wkup_m3_hwmod_class
= {
138 * Programmable Real-Time Unit and Industrial Communication Subsystem
140 static struct omap_hwmod_class am33xx_pruss_hwmod_class
= {
144 static struct omap_hwmod_rst_info am33xx_pruss_resets
[] = {
145 { .name
= "pruss", .rst_shift
= 1 },
149 /* Pseudo hwmod for reset control purpose only */
150 struct omap_hwmod am33xx_pruss_hwmod
= {
152 .class = &am33xx_pruss_hwmod_class
,
153 .clkdm_name
= "pruss_ocp_clkdm",
154 .main_clk
= "pruss_ocp_gclk",
157 .modulemode
= MODULEMODE_SWCTRL
,
160 .rst_lines
= am33xx_pruss_resets
,
161 .rst_lines_cnt
= ARRAY_SIZE(am33xx_pruss_resets
),
165 /* Pseudo hwmod for reset control purpose only */
166 static struct omap_hwmod_class am33xx_gfx_hwmod_class
= {
170 static struct omap_hwmod_rst_info am33xx_gfx_resets
[] = {
171 { .name
= "gfx", .rst_shift
= 0, .st_shift
= 0},
174 struct omap_hwmod am33xx_gfx_hwmod
= {
176 .class = &am33xx_gfx_hwmod_class
,
177 .clkdm_name
= "gfx_l3_clkdm",
178 .main_clk
= "gfx_fck_div_ck",
181 .modulemode
= MODULEMODE_SWCTRL
,
184 .rst_lines
= am33xx_gfx_resets
,
185 .rst_lines_cnt
= ARRAY_SIZE(am33xx_gfx_resets
),
190 * power and reset manager (whole prcm infrastructure)
192 static struct omap_hwmod_class am33xx_prcm_hwmod_class
= {
197 struct omap_hwmod am33xx_prcm_hwmod
= {
199 .class = &am33xx_prcm_hwmod_class
,
200 .clkdm_name
= "l4_wkup_clkdm",
207 static struct omap_hwmod_class_sysconfig am33xx_emif_sysc
= {
211 struct omap_hwmod_class am33xx_emif_hwmod_class
= {
213 .sysc
= &am33xx_emif_sysc
,
219 static struct omap_hwmod_class am33xx_ocmcram_hwmod_class
= {
223 struct omap_hwmod am33xx_ocmcram_hwmod
= {
225 .class = &am33xx_ocmcram_hwmod_class
,
226 .clkdm_name
= "l3_clkdm",
227 .flags
= HWMOD_INIT_NO_IDLE
,
228 .main_clk
= "l3_gclk",
231 .modulemode
= MODULEMODE_SWCTRL
,
236 /* 'smartreflex' class */
237 static struct omap_hwmod_class am33xx_smartreflex_hwmod_class
= {
238 .name
= "smartreflex",
242 struct omap_hwmod am33xx_smartreflex0_hwmod
= {
243 .name
= "smartreflex0",
244 .class = &am33xx_smartreflex_hwmod_class
,
245 .clkdm_name
= "l4_wkup_clkdm",
246 .main_clk
= "smartreflex0_fck",
249 .modulemode
= MODULEMODE_SWCTRL
,
255 struct omap_hwmod am33xx_smartreflex1_hwmod
= {
256 .name
= "smartreflex1",
257 .class = &am33xx_smartreflex_hwmod_class
,
258 .clkdm_name
= "l4_wkup_clkdm",
259 .main_clk
= "smartreflex1_fck",
262 .modulemode
= MODULEMODE_SWCTRL
,
268 * 'control' module class
270 struct omap_hwmod_class am33xx_control_hwmod_class
= {
276 static struct omap_hwmod_class_sysconfig gpmc_sysc
= {
280 .sysc_flags
= (SYSC_HAS_AUTOIDLE
| SYSC_HAS_SIDLEMODE
|
281 SYSC_HAS_SOFTRESET
| SYSS_HAS_RESET_STATUS
),
282 .idlemodes
= (SIDLE_FORCE
| SIDLE_NO
| SIDLE_SMART
),
283 .sysc_fields
= &omap_hwmod_sysc_type1
,
286 static struct omap_hwmod_class am33xx_gpmc_hwmod_class
= {
291 struct omap_hwmod am33xx_gpmc_hwmod
= {
293 .class = &am33xx_gpmc_hwmod_class
,
294 .clkdm_name
= "l3s_clkdm",
295 /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */
296 .flags
= DEBUG_OMAP_GPMC_HWMOD_FLAGS
,
297 .main_clk
= "l3s_gclk",
300 .modulemode
= MODULEMODE_SWCTRL
,
310 static struct omap_hwmod_class_sysconfig am33xx_rtc_sysc
= {
313 .sysc_flags
= SYSC_HAS_SIDLEMODE
,
314 .idlemodes
= (SIDLE_FORCE
| SIDLE_NO
|
315 SIDLE_SMART
| SIDLE_SMART_WKUP
),
316 .sysc_fields
= &omap_hwmod_sysc_type3
,
319 static struct omap_hwmod_class am33xx_rtc_hwmod_class
= {
321 .sysc
= &am33xx_rtc_sysc
,
322 .unlock
= &omap_hwmod_rtc_unlock
,
323 .lock
= &omap_hwmod_rtc_lock
,
326 struct omap_hwmod am33xx_rtc_hwmod
= {
328 .class = &am33xx_rtc_hwmod_class
,
329 .clkdm_name
= "l4_rtc_clkdm",
330 .main_clk
= "clk_32768_ck",
333 .modulemode
= MODULEMODE_SWCTRL
,
338 /* 'timer 2-7' class */
339 static struct omap_hwmod_class_sysconfig am33xx_timer_sysc
= {
343 .sysc_flags
= SYSC_HAS_SIDLEMODE
| SYSC_HAS_SOFTRESET
|
344 SYSC_HAS_RESET_STATUS
,
345 .idlemodes
= (SIDLE_FORCE
| SIDLE_NO
| SIDLE_SMART
|
347 .sysc_fields
= &omap_hwmod_sysc_type2
,
350 struct omap_hwmod_class am33xx_timer_hwmod_class
= {
352 .sysc
= &am33xx_timer_sysc
,
356 static struct omap_hwmod_class_sysconfig am33xx_timer1ms_sysc
= {
360 .sysc_flags
= (SYSC_HAS_CLOCKACTIVITY
| SYSC_HAS_SIDLEMODE
|
361 SYSC_HAS_SOFTRESET
| SYSC_HAS_AUTOIDLE
|
362 SYSS_HAS_RESET_STATUS
),
363 .idlemodes
= (SIDLE_FORCE
| SIDLE_NO
| SIDLE_SMART
),
364 .sysc_fields
= &omap_hwmod_sysc_type1
,
367 static struct omap_hwmod_class am33xx_timer1ms_hwmod_class
= {
369 .sysc
= &am33xx_timer1ms_sysc
,
372 struct omap_hwmod am33xx_timer1_hwmod
= {
374 .class = &am33xx_timer1ms_hwmod_class
,
375 .clkdm_name
= "l4_wkup_clkdm",
376 .main_clk
= "timer1_fck",
379 .modulemode
= MODULEMODE_SWCTRL
,
384 struct omap_hwmod am33xx_timer2_hwmod
= {
386 .class = &am33xx_timer_hwmod_class
,
387 .clkdm_name
= "l4ls_clkdm",
388 .main_clk
= "timer2_fck",
391 .modulemode
= MODULEMODE_SWCTRL
,
397 static struct omap_hwmod_class am33xx_tpcc_hwmod_class
= {
401 struct omap_hwmod am33xx_tpcc_hwmod
= {
403 .class = &am33xx_tpcc_hwmod_class
,
404 .clkdm_name
= "l3_clkdm",
405 .main_clk
= "l3_gclk",
408 .modulemode
= MODULEMODE_SWCTRL
,
413 static struct omap_hwmod_class_sysconfig am33xx_tptc_sysc
= {
416 .sysc_flags
= (SYSC_HAS_SIDLEMODE
| SYSC_HAS_SOFTRESET
|
418 .idlemodes
= (SIDLE_FORCE
| SIDLE_SMART
| MSTANDBY_FORCE
),
419 .sysc_fields
= &omap_hwmod_sysc_type2
,
423 static struct omap_hwmod_class am33xx_tptc_hwmod_class
= {
425 .sysc
= &am33xx_tptc_sysc
,
429 struct omap_hwmod am33xx_tptc0_hwmod
= {
431 .class = &am33xx_tptc_hwmod_class
,
432 .clkdm_name
= "l3_clkdm",
433 .flags
= HWMOD_SWSUP_SIDLE
| HWMOD_SWSUP_MSTANDBY
,
434 .main_clk
= "l3_gclk",
437 .modulemode
= MODULEMODE_SWCTRL
,
443 struct omap_hwmod am33xx_tptc1_hwmod
= {
445 .class = &am33xx_tptc_hwmod_class
,
446 .clkdm_name
= "l3_clkdm",
447 .flags
= (HWMOD_SWSUP_SIDLE
| HWMOD_SWSUP_MSTANDBY
),
448 .main_clk
= "l3_gclk",
451 .modulemode
= MODULEMODE_SWCTRL
,
457 struct omap_hwmod am33xx_tptc2_hwmod
= {
459 .class = &am33xx_tptc_hwmod_class
,
460 .clkdm_name
= "l3_clkdm",
461 .flags
= (HWMOD_SWSUP_SIDLE
| HWMOD_SWSUP_MSTANDBY
),
462 .main_clk
= "l3_gclk",
465 .modulemode
= MODULEMODE_SWCTRL
,
470 static void omap_hwmod_am33xx_clkctrl(void)
472 CLKCTRL(am33xx_timer2_hwmod
, AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET
);
473 CLKCTRL(am33xx_smartreflex0_hwmod
,
474 AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET
);
475 CLKCTRL(am33xx_smartreflex1_hwmod
,
476 AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET
);
477 CLKCTRL(am33xx_timer1_hwmod
, AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET
);
478 CLKCTRL(am33xx_rtc_hwmod
, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET
);
479 PRCM_FLAGS(am33xx_rtc_hwmod
, HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET
);
480 CLKCTRL(am33xx_gpmc_hwmod
, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET
);
481 CLKCTRL(am33xx_l4_ls_hwmod
, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET
);
482 CLKCTRL(am33xx_l4_wkup_hwmod
, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET
);
483 CLKCTRL(am33xx_l3_main_hwmod
, AM33XX_CM_PER_L3_CLKCTRL_OFFSET
);
484 CLKCTRL(am33xx_tpcc_hwmod
, AM33XX_CM_PER_TPCC_CLKCTRL_OFFSET
);
485 CLKCTRL(am33xx_tptc0_hwmod
, AM33XX_CM_PER_TPTC0_CLKCTRL_OFFSET
);
486 CLKCTRL(am33xx_tptc1_hwmod
, AM33XX_CM_PER_TPTC1_CLKCTRL_OFFSET
);
487 CLKCTRL(am33xx_tptc2_hwmod
, AM33XX_CM_PER_TPTC2_CLKCTRL_OFFSET
);
488 CLKCTRL(am33xx_gfx_hwmod
, AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET
);
489 CLKCTRL(am33xx_pruss_hwmod
, AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET
);
490 CLKCTRL(am33xx_mpu_hwmod
, AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET
);
491 CLKCTRL(am33xx_l3_instr_hwmod
, AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET
);
492 CLKCTRL(am33xx_ocmcram_hwmod
, AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET
);
495 static void omap_hwmod_am33xx_rst(void)
497 RSTCTRL(am33xx_pruss_hwmod
, AM33XX_RM_PER_RSTCTRL_OFFSET
);
498 RSTCTRL(am33xx_gfx_hwmod
, AM33XX_RM_GFX_RSTCTRL_OFFSET
);
499 RSTST(am33xx_gfx_hwmod
, AM33XX_RM_GFX_RSTST_OFFSET
);
502 void omap_hwmod_am33xx_reg(void)
504 omap_hwmod_am33xx_clkctrl();
505 omap_hwmod_am33xx_rst();
508 static void omap_hwmod_am43xx_clkctrl(void)
510 CLKCTRL(am33xx_timer2_hwmod
, AM43XX_CM_PER_TIMER2_CLKCTRL_OFFSET
);
511 CLKCTRL(am33xx_smartreflex0_hwmod
,
512 AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET
);
513 CLKCTRL(am33xx_smartreflex1_hwmod
,
514 AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET
);
515 CLKCTRL(am33xx_timer1_hwmod
, AM43XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET
);
516 CLKCTRL(am33xx_rtc_hwmod
, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET
);
517 CLKCTRL(am33xx_gpmc_hwmod
, AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET
);
518 CLKCTRL(am33xx_l4_ls_hwmod
, AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET
);
519 CLKCTRL(am33xx_l4_wkup_hwmod
, AM43XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET
);
520 CLKCTRL(am33xx_l3_main_hwmod
, AM43XX_CM_PER_L3_CLKCTRL_OFFSET
);
521 CLKCTRL(am33xx_tpcc_hwmod
, AM43XX_CM_PER_TPCC_CLKCTRL_OFFSET
);
522 CLKCTRL(am33xx_tptc0_hwmod
, AM43XX_CM_PER_TPTC0_CLKCTRL_OFFSET
);
523 CLKCTRL(am33xx_tptc1_hwmod
, AM43XX_CM_PER_TPTC1_CLKCTRL_OFFSET
);
524 CLKCTRL(am33xx_tptc2_hwmod
, AM43XX_CM_PER_TPTC2_CLKCTRL_OFFSET
);
525 CLKCTRL(am33xx_gfx_hwmod
, AM43XX_CM_GFX_GFX_CLKCTRL_OFFSET
);
526 CLKCTRL(am33xx_pruss_hwmod
, AM43XX_CM_PER_PRUSS_CLKCTRL_OFFSET
);
527 CLKCTRL(am33xx_mpu_hwmod
, AM43XX_CM_MPU_MPU_CLKCTRL_OFFSET
);
528 CLKCTRL(am33xx_l3_instr_hwmod
, AM43XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET
);
529 CLKCTRL(am33xx_ocmcram_hwmod
, AM43XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET
);
532 static void omap_hwmod_am43xx_rst(void)
534 RSTCTRL(am33xx_pruss_hwmod
, AM43XX_RM_PER_RSTCTRL_OFFSET
);
535 RSTCTRL(am33xx_gfx_hwmod
, AM43XX_RM_GFX_RSTCTRL_OFFSET
);
536 RSTST(am33xx_pruss_hwmod
, AM43XX_RM_PER_RSTST_OFFSET
);
537 RSTST(am33xx_gfx_hwmod
, AM43XX_RM_GFX_RSTST_OFFSET
);
540 void omap_hwmod_am43xx_reg(void)
542 omap_hwmod_am43xx_clkctrl();
543 omap_hwmod_am43xx_rst();