Commit d9a16f9ab9332b7cf1c95086a4efb98a0d13a57a

Authored by Paul Walmsley
1 parent 5b78e61b1c

ARM: OMAP2+: PRCM: split and relocate the PRM/CM globals setup

Split omap2_set_globals_prcm() into PRM, CM, and PRCM_MPU variants, since
these are all separate IP blocks.  This should make it easier to move the
PRM, CM, PRCM_MPU code into drivers/ in future patchsets.

At this point arch/arm/plat-omap/include/plat/prcm.h is empty; a
subsequent patch will remove it, and remove the #include from all the
files that #include it.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Vaibhav Hiremath <hvaibhav@ti.com>

Showing 17 changed files with 111 additions and 72 deletions Side-by-side Diff

arch/arm/mach-omap2/clkt2xxx_dpllcore.c
... ... @@ -30,7 +30,7 @@
30 30 #include "clock.h"
31 31 #include "clock2xxx.h"
32 32 #include "opp2xxx.h"
33   -#include "cm2xxx_3xxx.h"
  33 +#include "cm2xxx.h"
34 34 #include "cm-regbits-24xx.h"
35 35 #include "sdrc.h"
36 36  
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
... ... @@ -39,7 +39,7 @@
39 39 #include "clock.h"
40 40 #include "clock2xxx.h"
41 41 #include "opp2xxx.h"
42   -#include "cm2xxx_3xxx.h"
  42 +#include "cm2xxx.h"
43 43 #include "cm-regbits-24xx.h"
44 44 #include "sdrc.h"
45 45  
arch/arm/mach-omap2/cm.h
1 1 /*
2 2 * OMAP2+ Clock Management prototypes
3 3 *
4   - * Copyright (C) 2007-2009 Texas Instruments, Inc.
  4 + * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 5 * Copyright (C) 2007-2009 Nokia Corporation
6 6 *
7 7 * Written by Paul Walmsley
... ... @@ -21,6 +21,12 @@
21 21 * module to reach the functionnal state from an inactive state.
22 22 */
23 23 #define MAX_MODULE_READY_TIME 2000
  24 +
  25 +# ifndef __ASSEMBLER__
  26 +extern void __iomem *cm_base;
  27 +extern void __iomem *cm2_base;
  28 +extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
  29 +# endif
24 30  
25 31 /*
26 32 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
arch/arm/mach-omap2/cm2xxx_3xxx.h
... ... @@ -16,7 +16,7 @@
16 16 #ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
17 17 #define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
18 18  
19   -#include "prcm-common.h"
  19 +#include "cm.h"
20 20  
21 21 /*
22 22 * Module specific CM register offsets from CM_BASE + domain offset
arch/arm/mach-omap2/cm_common.c
... ... @@ -2,7 +2,7 @@
2 2 * OMAP2+ common Clock Management (CM) IP block functions
3 3 *
4 4 * Copyright (C) 2012 Texas Instruments, Inc.
5   - * Paul Walmsley <paul@pwsan.com>
  5 + * Paul Walmsley
6 6 *
7 7 * This program is free software; you can redistribute it and/or modify
8 8 * it under the terms of the GNU General Public License version 2 as
... ... @@ -17,6 +17,7 @@
17 17 #include "cm2xxx.h"
18 18 #include "cm3xxx.h"
19 19 #include "cm44xx.h"
  20 +#include "common.h"
20 21  
21 22 /*
22 23 * cm_ll_data: function pointers to SoC-specific implementations of
... ... @@ -24,6 +25,25 @@
24 25 */
25 26 static struct cm_ll_data null_cm_ll_data;
26 27 static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
  28 +
  29 +/* cm_base: base virtual address of the CM IP block */
  30 +void __iomem *cm_base;
  31 +
  32 +/* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */
  33 +void __iomem *cm2_base;
  34 +
  35 +/**
  36 + * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use)
  37 + * @cm: CM base virtual address
  38 + * @cm2: CM2 base virtual address (if present on the booted SoC)
  39 + *
  40 + * XXX Will be replaced when the PRM/CM drivers are completed.
  41 + */
  42 +void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2)
  43 +{
  44 + cm_base = cm;
  45 + cm2_base = cm2;
  46 +}
27 47  
28 48 /**
29 49 * cm_split_idlest_reg - split CM_IDLEST reg addr into its components
arch/arm/mach-omap2/cminst44xx.h
... ... @@ -38,5 +38,7 @@
38 38 extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
39 39 u32 mask);
40 40  
  41 +extern void omap_cm_base_init(void);
  42 +
41 43 #endif
arch/arm/mach-omap2/io.c
... ... @@ -47,7 +47,11 @@
47 47 #include "serial.h"
48 48 #include "cm2xxx.h"
49 49 #include "cm3xxx.h"
50   -
  50 +#include "prm.h"
  51 +#include "cm.h"
  52 +#include "prcm_mpu44xx.h"
  53 +#include "prminst44xx.h"
  54 +#include "cminst44xx.h"
51 55 /*
52 56 * The machine specific code may provide the extra mapping besides the
53 57 * default mapping provided here.
... ... @@ -386,9 +390,8 @@
386 390 OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
387 391 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
388 392 NULL);
389   - omap2_set_globals_prcm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
390   - OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
391   - NULL, NULL);
  393 + omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
  394 + omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
392 395 omap2xxx_check_revision();
393 396 omap2xxx_cm_init();
394 397 omap_common_init_early();
... ... @@ -416,9 +419,8 @@
416 419 OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
417 420 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
418 421 NULL);
419   - omap2_set_globals_prcm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
420   - OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
421   - NULL, NULL);
  422 + omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
  423 + omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
422 424 omap2xxx_check_revision();
423 425 omap2xxx_cm_init();
424 426 omap_common_init_early();
... ... @@ -450,9 +452,8 @@
450 452 OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
451 453 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
452 454 NULL);
453   - omap2_set_globals_prcm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
454   - OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
455   - NULL, NULL);
  455 + omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
  456 + omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
456 457 omap3xxx_check_revision();
457 458 omap3xxx_check_features();
458 459 omap3xxx_cm_init();
... ... @@ -491,9 +492,8 @@
491 492 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
492 493 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
493 494 NULL);
494   - omap2_set_globals_prcm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
495   - OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
496   - NULL, NULL);
  495 + omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
  496 + omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
497 497 omap3xxx_check_revision();
498 498 ti81xx_check_features();
499 499 omap_common_init_early();
... ... @@ -555,9 +555,8 @@
555 555 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
556 556 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
557 557 NULL);
558   - omap2_set_globals_prcm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
559   - AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
560   - NULL, NULL);
  558 + omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
  559 + omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
561 560 omap3xxx_check_revision();
562 561 ti81xx_check_features();
563 562 omap_common_init_early();
... ... @@ -577,10 +576,12 @@
577 576 OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
578 577 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
579 578 OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
580   - omap2_set_globals_prcm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
581   - OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
582   - OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
583   - OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  579 + omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
  580 + omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
  581 + OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
  582 + omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  583 + omap_prm_base_init();
  584 + omap_cm_base_init();
584 585 omap4xxx_check_revision();
585 586 omap4xxx_check_features();
586 587 omap_common_init_early();
... ... @@ -607,10 +608,12 @@
607 608 OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
608 609 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
609 610 OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
610   - omap2_set_globals_prcm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE),
611   - OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
612   - OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE),
613   - OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  611 + omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  612 + omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
  613 + OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  614 + omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  615 + omap_prm_base_init();
  616 + omap_cm_base_init();
614 617 omap5xxx_check_revision();
615 618 omap_common_init_early();
616 619 }
arch/arm/mach-omap2/mcbsp.c
... ... @@ -29,7 +29,7 @@
29 29 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
30 30 * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
31 31 */
32   -#include "cm2xxx_3xxx.h"
  32 +#include "cm3xxx.h"
33 33 #include "cm-regbits-34xx.h"
34 34  
35 35 static int omap3_enable_st_clock(unsigned int id, bool enable)
arch/arm/mach-omap2/omap4-common.c
... ... @@ -34,6 +34,7 @@
34 34 #include "mmc.h"
35 35 #include "hsmmc.h"
36 36 #include "prminst44xx.h"
  37 +#include "prcm_mpu44xx.h"
37 38 #include "omap4-sar-layout.h"
38 39 #include "omap-secure.h"
39 40  
arch/arm/mach-omap2/prcm-common.h
... ... @@ -421,22 +421,6 @@
421 421 #define MAX_IOPAD_LATCH_TIME 100
422 422  
423 423 # ifndef __ASSEMBLER__
424   -extern void __iomem *prm_base;
425   -extern void __iomem *cm_base;
426   -extern void __iomem *cm2_base;
427   -extern void __iomem *prcm_mpu_base;
428   -
429   -#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
430   -extern void omap_prm_base_init(void);
431   -extern void omap_cm_base_init(void);
432   -#else
433   -static inline void omap_prm_base_init(void)
434   -{
435   -}
436   -static inline void omap_cm_base_init(void)
437   -{
438   -}
439   -#endif
440 424  
441 425 /**
442 426 * struct omap_prcm_irq - describes a PRCM interrupt bit
arch/arm/mach-omap2/prcm.c
... ... @@ -40,25 +40,6 @@
40 40 #include "prm-regbits-44xx.h"
41 41 #include "control.h"
42 42  
43   -void __iomem *prm_base;
44   -void __iomem *cm_base;
45   -void __iomem *cm2_base;
46   -void __iomem *prcm_mpu_base;
47   -
48   -
49   -void __init omap2_set_globals_prcm(void __iomem *prm, void __iomem *cm,
50   - void __iomem *cm2, void __iomem *prcm_mpu)
51   -{
52   - prm_base = prm;
53   - cm_base = cm;
54   - cm2_base = cm2;
55   - prcm_mpu_base = prcm_mpu;
56   -
57   - if (cpu_is_omap44xx() || soc_is_omap54xx()) {
58   - omap_prm_base_init();
59   - omap_cm_base_init();
60   - }
61   -}
62 43  
63 44 /*
64 45 * Stubbed functions so that common files continue to build when
arch/arm/mach-omap2/prcm_mpu44xx.c
... ... @@ -20,6 +20,12 @@
20 20 #include "prcm_mpu44xx.h"
21 21 #include "cm-regbits-44xx.h"
22 22  
  23 +/*
  24 + * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP
  25 + * block registers
  26 + */
  27 +void __iomem *prcm_mpu_base;
  28 +
23 29 /* PRCM_MPU low-level functions */
24 30  
25 31 u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
... ... @@ -42,5 +48,16 @@
42 48 omap4_prcm_mpu_write_inst_reg(v, inst, reg);
43 49  
44 50 return v;
  51 +}
  52 +
  53 +/**
  54 + * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use)
  55 + * @prcm_mpu: PRCM_MPU base virtual address
  56 + *
  57 + * XXX Will be replaced when the PRM/CM drivers are completed.
  58 + */
  59 +void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu)
  60 +{
  61 + prcm_mpu_base = prcm_mpu;
45 62 }
arch/arm/mach-omap2/prcm_mpu44xx.h
1 1 /*
2 2 * OMAP44xx PRCM MPU instance offset macros
3 3 *
4   - * Copyright (C) 2010 Texas Instruments, Inc.
  4 + * Copyright (C) 2010, 2012 Texas Instruments, Inc.
5 5 * Copyright (C) 2010 Nokia Corporation
6 6 *
7 7 * Paul Walmsley (paul@pwsan.com)
... ... @@ -25,6 +25,12 @@
25 25 #ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
26 26 #define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
27 27  
  28 +#include "common.h"
  29 +
  30 +# ifndef __ASSEMBLER__
  31 +extern void __iomem *prcm_mpu_base;
  32 +# endif
  33 +
28 34 #define OMAP4430_PRCM_MPU_BASE 0x48243000
29 35  
30 36 #define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \
... ... @@ -98,6 +104,7 @@
98 104 extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
99 105 extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
100 106 s16 idx);
  107 +extern void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu);
101 108 # endif
102 109  
103 110 #endif
arch/arm/mach-omap2/prm.h
1 1 /*
2 2 * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions
3 3 *
4   - * Copyright (C) 2007-2009 Texas Instruments, Inc.
  4 + * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 5 * Copyright (C) 2010 Nokia Corporation
6 6 *
7 7 * Paul Walmsley
... ... @@ -14,6 +14,11 @@
14 14 #define __ARCH_ARM_MACH_OMAP2_PRM_H
15 15  
16 16 #include "prcm-common.h"
  17 +
  18 +# ifndef __ASSEMBLER__
  19 +extern void __iomem *prm_base;
  20 +extern void omap2_set_globals_prm(void __iomem *prm);
  21 +# endif
17 22  
18 23 /*
19 24 * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP
arch/arm/mach-omap2/prm_common.c
... ... @@ -31,6 +31,7 @@
31 31 #include "prm2xxx.h"
32 32 #include "prm3xxx.h"
33 33 #include "prm44xx.h"
  34 +#include "common.h"
34 35  
35 36 /*
36 37 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs
... ... @@ -55,6 +56,9 @@
55 56 */
56 57 static struct omap_prcm_irq_setup *prcm_irq_setup;
57 58  
  59 +/* prm_base: base virtual address of the PRM IP block */
  60 +void __iomem *prm_base;
  61 +
58 62 /*
59 63 * prm_ll_data: function pointers to SoC-specific implementations of
60 64 * common PRM functions
... ... @@ -326,6 +330,17 @@
326 330 err:
327 331 omap_prcm_irq_cleanup();
328 332 return -ENOMEM;
  333 +}
  334 +
  335 +/**
  336 + * omap2_set_globals_prm - set the PRM base address (for early use)
  337 + * @prm: PRM base virtual address
  338 + *
  339 + * XXX Will be replaced when the PRM/CM drivers are completed.
  340 + */
  341 +void __init omap2_set_globals_prm(void __iomem *prm)
  342 +{
  343 + prm_base = prm;
329 344 }
330 345  
331 346 /**
arch/arm/mach-omap2/prminst44xx.h
... ... @@ -30,5 +30,7 @@
30 30 extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
31 31 u16 rstctrl_offs);
32 32  
  33 +extern void omap_prm_base_init(void);
  34 +
33 35 #endif
arch/arm/plat-omap/include/plat/prcm.h
... ... @@ -27,11 +27,7 @@
27 27 #ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
28 28 #define __ASM_ARM_ARCH_OMAP_PRCM_H
29 29  
30   -#include <linux/kernel.h>
31   -#include <linux/io.h>
32   -
33   -void __init omap2_set_globals_prcm(void __iomem *prm, void __iomem *cm,
34   - void __iomem *cm2, void __iomem *prcm_mpu);
  30 +/* XXX To be removed */
35 31  
36 32 #endif