aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/prm_common.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:45:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:45:16 -0500
commit8287361abca36504da813638310d2547469283eb (patch)
tree8d98e9a910885efdb09ae5390a3ae44040557e2f /arch/arm/mach-omap2/prm_common.c
parent2989950cea13711f0cc573c26cde8fe08a36be03 (diff)
parent8556650dd3370a927217f16444aac5cc0c71e61b (diff)
Merge tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC Header cleanups from Olof Johansson: "This is a collection of header file cleanups, mostly for OMAP and AT91, that keeps moving the platforms in the direction of multiplatform by removing the need for mach-dependent header files used in drivers and other places." Fix up mostly trivial conflicts as per Olof. * tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (106 commits) ARM: OMAP2+: Move iommu/iovmm headers to platform_data ARM: OMAP2+: Make some definitions local ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h ARM: OMAP2+: Move iopgtable header to drivers/iommu/ ARM: OMAP: Merge iommu2.h into iommu.h atmel: move ATMEL_MAX_UART to platform_data/atmel.h ARM: OMAP: Remove omap_init_consistent_dma_size() arm: at91: move at91rm9200 rtc header in drivers/rtc arm: at91: move reset controller header to arm/arm/mach-at91 arm: at91: move pit define to the driver arm: at91: move at91_shdwc.h to arch/arm/mach-at91 arm: at91: move board header to arch/arm/mach-at91 arn: at91: move at91_tc.h to arch/arm/mach-at91 arm: at91 move at91_aic.h to arch/arm/mach-at91 arm: at91 move board.h to arch/arm/mach-at91 arm: at91: move platfarm_data to include/linux/platform_data/atmel.h arm: at91: drop machine defconfig ARM: OMAP: Remove NEED_MACH_GPIO_H ARM: OMAP: Remove unnecessary mach and plat includes ...
Diffstat (limited to 'arch/arm/mach-omap2/prm_common.c')
-rw-r--r--arch/arm/mach-omap2/prm_common.c105
1 files changed, 60 insertions, 45 deletions
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 6b4d332be2f6..945b4ad6ab84 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -24,10 +24,11 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <plat/common.h>
28#include <plat/prcm.h> 27#include <plat/prcm.h>
29 28
30#include "prm2xxx_3xxx.h" 29#include "prm2xxx_3xxx.h"
30#include "prm2xxx.h"
31#include "prm3xxx.h"
31#include "prm44xx.h" 32#include "prm44xx.h"
32 33
33/* 34/*
@@ -53,6 +54,13 @@ static struct irq_chip_generic **prcm_irq_chips;
53 */ 54 */
54static struct omap_prcm_irq_setup *prcm_irq_setup; 55static struct omap_prcm_irq_setup *prcm_irq_setup;
55 56
57/*
58 * prm_ll_data: function pointers to SoC-specific implementations of
59 * common PRM functions
60 */
61static struct prm_ll_data null_prm_ll_data;
62static struct prm_ll_data *prm_ll_data = &null_prm_ll_data;
63
56/* Private functions */ 64/* Private functions */
57 65
58/* 66/*
@@ -319,64 +327,71 @@ err:
319 return -ENOMEM; 327 return -ENOMEM;
320} 328}
321 329
322/* 330/**
323 * Stubbed functions so that common files continue to build when 331 * prm_read_reset_sources - return the sources of the SoC's last reset
324 * custom builds are used 332 *
325 * XXX These are temporary and should be removed at the earliest possible 333 * Return a u32 bitmask representing the reset sources that caused the
326 * opportunity 334 * SoC to reset. The low-level per-SoC functions called by this
335 * function remap the SoC-specific reset source bits into an
336 * OMAP-common set of reset source bits, defined in
337 * arch/arm/mach-omap2/prm.h. Returns the standardized reset source
338 * u32 bitmask from the hardware upon success, or returns (1 <<
339 * OMAP_UNKNOWN_RST_SRC_ID_SHIFT) if no low-level read_reset_sources()
340 * function was registered.
327 */ 341 */
328u32 __weak omap2_prm_read_mod_reg(s16 module, u16 idx) 342u32 prm_read_reset_sources(void)
329{ 343{
330 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 344 u32 ret = 1 << OMAP_UNKNOWN_RST_SRC_ID_SHIFT;
331 return 0;
332}
333 345
334void __weak omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) 346 if (prm_ll_data->read_reset_sources)
335{ 347 ret = prm_ll_data->read_reset_sources();
336 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 348 else
337} 349 WARN_ONCE(1, "prm: %s: no mapping function defined for reset sources\n", __func__);
338 350
339u32 __weak omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, 351 return ret;
340 s16 module, s16 idx)
341{
342 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
343 return 0;
344} 352}
345 353
346u32 __weak omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) 354/**
355 * prm_register - register per-SoC low-level data with the PRM
356 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
357 *
358 * Register per-SoC low-level OMAP PRM data and function pointers with
359 * the OMAP PRM common interface. The caller must keep the data
360 * pointed to by @pld valid until it calls prm_unregister() and
361 * it returns successfully. Returns 0 upon success, -EINVAL if @pld
362 * is NULL, or -EEXIST if prm_register() has already been called
363 * without an intervening prm_unregister().
364 */
365int prm_register(struct prm_ll_data *pld)
347{ 366{
348 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 367 if (!pld)
349 return 0; 368 return -EINVAL;
350}
351 369
352u32 __weak omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) 370 if (prm_ll_data != &null_prm_ll_data)
353{ 371 return -EEXIST;
354 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
355 return 0;
356}
357 372
358u32 __weak omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) 373 prm_ll_data = pld;
359{
360 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
361 return 0;
362}
363 374
364int __weak omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
365{
366 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
367 return 0; 375 return 0;
368} 376}
369 377
370int __weak omap2_prm_assert_hardreset(s16 prm_mod, u8 shift) 378/**
379 * prm_unregister - unregister per-SoC low-level data & function pointers
380 * @pld: low-level per-SoC OMAP PRM data & function pointers to unregister
381 *
382 * Unregister per-SoC low-level OMAP PRM data and function pointers
383 * that were previously registered with prm_register(). The
384 * caller may not destroy any of the data pointed to by @pld until
385 * this function returns successfully. Returns 0 upon success, or
386 * -EINVAL if @pld is NULL or if @pld does not match the struct
387 * prm_ll_data * previously registered by prm_register().
388 */
389int prm_unregister(struct prm_ll_data *pld)
371{ 390{
372 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 391 if (!pld || prm_ll_data != pld)
373 return 0; 392 return -EINVAL;
374} 393
394 prm_ll_data = &null_prm_ll_data;
375 395
376int __weak omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift,
377 u8 st_shift)
378{
379 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
380 return 0; 396 return 0;
381} 397}
382