Skip to content

Commit

Permalink
OMAP2/3: PRCM: split OMAP2/3-specific PRCM code into OMAP2/3-specific…
Browse files Browse the repository at this point in the history
… files

In preparation for adding OMAP4-specific PRCM accessor/mutator
functions, split the existing OMAP2/3 PRCM code into OMAP2/3-specific
files.  Most of what was in mach-omap2/{cm,prm}.{c,h} has now been
moved into mach-omap2/{cm,prm}2xxx_3xxx.{c,h}, since it was
OMAP2xxx/3xxx-specific.

This process also requires the #includes in each of these files to be
changed to reference the new file name.  As part of doing so, add some
comments into plat-omap/sram.c and plat-omap/mcbsp.c, which use
"sideways includes", to indicate that these users of the PRM/CM includes
should not be doing so.

Thanks to Felipe Contreras <felipe.contreras@gmail.com> for comments on this
patch.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Jarkko Nikula <jhnikula@gmail.com>
Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Omar Ramirez Luna <omar.ramirez@ti.com>
Acked-by: Omar Ramirez Luna <omar.ramirez@ti.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Reviewed-by: Kevin Hilman <khilman@deeprootsystems.com>
Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
Tested-by: Rajendra Nayak <rnayak@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
  • Loading branch information
Paul Walmsley committed Dec 22, 2010
1 parent cdb54c4 commit 59fb659
Show file tree
Hide file tree
Showing 60 changed files with 699 additions and 650 deletions.
11 changes: 7 additions & 4 deletions arch/arm/mach-omap2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
common.o gpio.o dma.o wd_timer.o

omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o
omap-2-3-common = irq.o sdrc.o
hwmod-common = omap_hwmod.o \
omap_hwmod_common_data.o
clock-common = clock.o clock_common_data.o \
Expand Down Expand Up @@ -72,9 +72,12 @@ endif
endif

# PRCM
obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm.o
obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm.o
obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm4xxx.o
obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
# XXX The presence of cm2xxx_3xxx.o on the line below is temporary and
# will be removed once the OMAP4 part of the codebase is converted to
# use OMAP4-specific PRCM functions.
obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm2xxx_3xxx.o cm4xxx.o

# OMAP powerdomain framework
powerdomain-common += powerdomain.o powerdomain-common.o
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clkt2xxx_apll.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "clock.h"
#include "clock2xxx.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-24xx.h"

/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clkt2xxx_dpllcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "clock.h"
#include "clock2xxx.h"
#include "opp2xxx.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-24xx.h"

/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clkt2xxx_osc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "clock.h"
#include "clock2xxx.h"
#include "prm.h"
#include "prm2xxx_3xxx.h"
#include "prm-regbits-24xx.h"

static int omap2_enable_osc_ck(struct clk *clk)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clkt2xxx_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "clock.h"
#include "clock2xxx.h"
#include "prm.h"
#include "prm2xxx_3xxx.h"
#include "prm-regbits-24xx.h"

void __iomem *prcm_clksrc_ctrl;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "clock.h"
#include "clock2xxx.h"
#include "opp2xxx.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-24xx.h"

const struct prcm_config *curr_prcm_set;
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-omap2/clkt_dpll.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <plat/clock.h>

#include "clock.h"
#include "cm.h"
#include "cm-regbits-24xx.h"
#include "cm-regbits-34xx.h"

Expand Down
4 changes: 1 addition & 3 deletions arch/arm/mach-omap2/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
#include <plat/prcm.h>

#include "clock.h"
#include "prm.h"
#include "prm-regbits-24xx.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-24xx.h"
#include "cm-regbits-34xx.h"

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/clock2420_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "clock.h"
#include "clock2xxx.h"
#include "opp2xxx.h"
#include "prm.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "prm2xxx_3xxx.h"
#include "prm-regbits-24xx.h"
#include "cm-regbits-24xx.h"
#include "sdrc.h"
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clock2430.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "clock.h"
#include "clock2xxx.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-24xx.h"

/**
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/clock2430_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "clock.h"
#include "clock2xxx.h"
#include "opp2xxx.h"
#include "prm.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "prm2xxx_3xxx.h"
#include "prm-regbits-24xx.h"
#include "cm-regbits-24xx.h"
#include "sdrc.h"
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clock34xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "clock.h"
#include "clock34xx.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-34xx.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clock3517.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "clock.h"
#include "clock3517.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-34xx.h"

/*
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/clock3xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

#include "clock.h"
#include "clock3xxx.h"
#include "prm.h"
#include "prm2xxx_3xxx.h"
#include "prm-regbits-34xx.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-34xx.h"

/*
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/clock3xxx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#include "clock36xx.h"
#include "clock3517.h"

#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-34xx.h"
#include "prm.h"
#include "prm2xxx_3xxx.h"
#include "prm-regbits-34xx.h"
#include "control.h"

Expand Down
6 changes: 5 additions & 1 deletion arch/arm/mach-omap2/clock44xx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@
#include "cm1_44xx.h"
#include "cm2_44xx.h"
#include "cm-regbits-44xx.h"
#include "prm.h"
#include "prm44xx.h"
#include "prm44xx.h"
#include "prm-regbits-44xx.h"
#include "control.h"

/* OMAP4 modulemode control */
#define OMAP4430_MODULEMODE_HWCTRL 0
#define OMAP4430_MODULEMODE_SWCTRL 1

/* Root clocks */

static struct clk extalt_clkin_ck = {
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/mach-omap2/clockdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@

#include <linux/bitops.h>

#include "prm.h"
#include "prm2xxx_3xxx.h"
#include "prm-regbits-24xx.h"
#include "cm.h"
#include "cm2xxx_3xxx.h"
#include "cm2xxx_3xxx.h"

#include <plat/clock.h>
#include <plat/powerdomain.h>
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#include <linux/io.h>

#include <plat/clockdomain.h>
#include "cm.h"
#include "prm.h"
#include "prm2xxx_3xxx.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-24xx.h"
#include "cm-regbits-34xx.h"
#include "cm-regbits-44xx.h"
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-omap2/clockdomains44xx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <linux/io.h>

#include <plat/clockdomain.h>
#include "cm1_44xx.h"
#include "cm2_44xx.h"

#include "cm1_44xx.h"
#include "cm2_44xx.h"
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/mach-omap2/cm-regbits-24xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* published by the Free Software Foundation.
*/

#include "cm.h"

/* Bits shared between registers */

/* CM_FCLKEN1_CORE and CM_ICLKEN1_CORE shared bits */
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/mach-omap2/cm-regbits-34xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* published by the Free Software Foundation.
*/

#include "cm.h"

/* Bits shared between registers */

/* CM_FCLKEN1_CORE and CM_ICLKEN1_CORE shared bits */
Expand Down
3 changes: 0 additions & 3 deletions arch/arm/mach-omap2/cm-regbits-44xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#ifndef __ARCH_ARM_MACH_OMAP2_CM_REGBITS_44XX_H
#define __ARCH_ARM_MACH_OMAP2_CM_REGBITS_44XX_H

#include "cm.h"


/*
* Used by CM_L3_1_DYNAMICDEP, CM_L3_1_DYNAMICDEP_RESTORE, CM_MPU_DYNAMICDEP,
* CM_TESLA_DYNAMICDEP
Expand Down
134 changes: 3 additions & 131 deletions arch/arm/mach-omap2/cm.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#ifndef __ARCH_ASM_MACH_OMAP2_CM_H
#define __ARCH_ASM_MACH_OMAP2_CM_H

/*
* OMAP2/3 Clock Management (CM) register definitions
* OMAP2+ Clock Management prototypes
*
* Copyright (C) 2007-2009 Texas Instruments, Inc.
* Copyright (C) 2007-2009 Nokia Corporation
Expand All @@ -13,133 +10,8 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#include "prcm-common.h"

#define OMAP2420_CM_REGADDR(module, reg) \
OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
#define OMAP2430_CM_REGADDR(module, reg) \
OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
#define OMAP34XX_CM_REGADDR(module, reg) \
OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))


#include "cm44xx.h"

/*
* Architecture-specific global CM registers
* Use cm_{read,write}_reg() with these registers.
* These registers appear once per CM module.
*/

#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)

#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)

/*
* Module specific CM registers from CM_BASE + domain offset
* Use cm_{read,write}_mod_reg() with these registers.
* These register offsets generally appear in more than one PRCM submodule.
*/

/* Common between 24xx and 34xx */

#define CM_FCLKEN 0x0000
#define CM_FCLKEN1 CM_FCLKEN
#define CM_CLKEN CM_FCLKEN
#define CM_ICLKEN 0x0010
#define CM_ICLKEN1 CM_ICLKEN
#define CM_ICLKEN2 0x0014
#define CM_ICLKEN3 0x0018
#define CM_IDLEST 0x0020
#define CM_IDLEST1 CM_IDLEST
#define CM_IDLEST2 0x0024
#define CM_AUTOIDLE 0x0030
#define CM_AUTOIDLE1 CM_AUTOIDLE
#define CM_AUTOIDLE2 0x0034
#define CM_AUTOIDLE3 0x0038
#define CM_CLKSEL 0x0040
#define CM_CLKSEL1 CM_CLKSEL
#define CM_CLKSEL2 0x0044
#define OMAP2_CM_CLKSTCTRL 0x0048
#define OMAP4_CM_CLKSTCTRL 0x0000


/* Architecture-specific registers */

#define OMAP24XX_CM_FCLKEN2 0x0004
#define OMAP24XX_CM_ICLKEN4 0x001c
#define OMAP24XX_CM_AUTOIDLE4 0x003c

#define OMAP2430_CM_IDLEST3 0x0028

#define OMAP3430_CM_CLKEN_PLL 0x0004
#define OMAP3430ES2_CM_CLKEN2 0x0004
#define OMAP3430ES2_CM_FCLKEN3 0x0008
#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
#define OMAP3430_CM_CLKSTST 0x004c
#define OMAP3430ES2_CM_CLKSEL4 0x004c
#define OMAP3430ES2_CM_CLKSEL5 0x0050
#define OMAP3430_CM_CLKSEL2_EMU 0x0050
#define OMAP3430_CM_CLKSEL3_EMU 0x0054

/* CM2.CEFUSE_CM2 register offsets */

/* OMAP4 modulemode control */
#define OMAP4430_MODULEMODE_HWCTRL 0
#define OMAP4430_MODULEMODE_SWCTRL 1

/* Clock management domain register get/set */

#ifndef __ASSEMBLER__

extern u32 cm_read_mod_reg(s16 module, u16 idx);
extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);

extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
u8 idlest_shift);
extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);

static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
{
return cm_rmw_mod_reg_bits(bits, bits, module, idx);
}

static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
{
return cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
}

#endif

/* CM register bits shared between 24XX and 3430 */

/* CM_CLKSEL_GFX */
#define OMAP_CLKSEL_GFX_SHIFT 0
#define OMAP_CLKSEL_GFX_MASK (0x7 << 0)

/* CM_ICLKEN_GFX */
#define OMAP_EN_GFX_SHIFT 0
#define OMAP_EN_GFX_MASK (1 << 0)

/* CM_IDLEST_GFX */
#define OMAP_ST_GFX_MASK (1 << 0)


/* CM_IDLEST indicator */
#define OMAP24XX_CM_IDLEST_VAL 0
#define OMAP34XX_CM_IDLEST_VAL 1
#ifndef __ARCH_ASM_MACH_OMAP2_CM_H
#define __ARCH_ASM_MACH_OMAP2_CM_H

/*
* MAX_MODULE_READY_TIME: max duration in microseconds to wait for the
Expand Down
Loading

0 comments on commit 59fb659

Please sign in to comment.