android_kernel_xiaomi_sm8350/include/asm-powerpc/fsl_gtm.h
Anton Vorontsov 83ff9dcf37 powerpc/sysdev: implement FSL GTM support
GTM stands for General-purpose Timers Module and able to generate
timer{1,2,3,4} interrupts. These timers are used by the drivers that
need time precise interrupts (like for USB transactions scheduling for
the Freescale USB Host controller as found in some QE and CPM chips),
or these timers could be used as wakeup events from the CPU deep-sleep
mode.

Things unimplemented:
1. Cascaded (32 bit) timers (1-2, 3-4).
   This is straightforward to implement when needed, two timers should
   be marked as "requested" and configured as appropriate.
2. Super-cascaded (64 bit) timers (1-2-3-4).
   This is also straightforward to implement when needed, all timers
   should be marked as "requested" and configured as appropriate.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2008-06-10 10:38:50 -05:00

48 lines
1.4 KiB
C

/*
* Freescale General-purpose Timers Module
*
* Copyright (c) Freescale Semicondutor, Inc. 2006.
* Shlomi Gridish <gridish@freescale.com>
* Jerry Huang <Chang-Ming.Huang@freescale.com>
* Copyright (c) MontaVista Software, Inc. 2008.
* Anton Vorontsov <avorontsov@ru.mvista.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef __ASM_FSL_GTM_H
#define __ASM_FSL_GTM_H
#include <linux/types.h>
struct gtm;
struct gtm_timer {
unsigned int irq;
struct gtm *gtm;
bool requested;
u8 __iomem *gtcfr;
__be16 __iomem *gtmdr;
__be16 __iomem *gtpsr;
__be16 __iomem *gtcnr;
__be16 __iomem *gtrfr;
__be16 __iomem *gtevr;
};
extern struct gtm_timer *gtm_get_timer16(void);
extern struct gtm_timer *gtm_get_specific_timer16(struct gtm *gtm,
unsigned int timer);
extern void gtm_put_timer16(struct gtm_timer *tmr);
extern int gtm_set_timer16(struct gtm_timer *tmr, unsigned long usec,
bool reload);
extern int gtm_set_exact_timer16(struct gtm_timer *tmr, u16 usec,
bool reload);
extern void gtm_stop_timer16(struct gtm_timer *tmr);
extern void gtm_ack_timer16(struct gtm_timer *tmr, u16 events);
#endif /* __ASM_FSL_GTM_H */