Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6eceb0d4 authored by Meihui Fan's avatar Meihui Fan Committed by Bryan Wu
Browse files

[Blackfin] arch: add support for the rest of the gptimers on the BF54x



Signed-off-by: default avatarMeihui Fan <mhfan@hhcn.com>
Signed-off-by: default avatarMike Frysinger <vapier.adi@gmail.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent a8a46a26
Loading
Loading
Loading
Loading
+16 −8
Original line number Original line Diff line number Diff line
@@ -52,13 +52,15 @@ static volatile GPTIMER_timer_regs *const timer_regs[MAX_BLACKFIN_GPTIMERS] =
	(GPTIMER_timer_regs *)TIMER5_CONFIG,
	(GPTIMER_timer_regs *)TIMER5_CONFIG,
	(GPTIMER_timer_regs *)TIMER6_CONFIG,
	(GPTIMER_timer_regs *)TIMER6_CONFIG,
	(GPTIMER_timer_regs *)TIMER7_CONFIG,
	(GPTIMER_timer_regs *)TIMER7_CONFIG,
#endif
# if (MAX_BLACKFIN_GPTIMERS > 8)
# if (MAX_BLACKFIN_GPTIMERS > 8)
	(GPTIMER_timer_regs *)TIMER8_CONFIG,
	(GPTIMER_timer_regs *)TIMER8_CONFIG,
	(GPTIMER_timer_regs *)TIMER9_CONFIG,
	(GPTIMER_timer_regs *)TIMER9_CONFIG,
	(GPTIMER_timer_regs *)TIMER10_CONFIG,
	(GPTIMER_timer_regs *)TIMER10_CONFIG,
#  if (MAX_BLACKFIN_GPTIMERS > 11)
	(GPTIMER_timer_regs *)TIMER11_CONFIG,
	(GPTIMER_timer_regs *)TIMER11_CONFIG,
#  endif
#  endif
# endif
#endif
};
};


static volatile GPTIMER_group_regs *const group_regs[BFIN_TIMER_NUM_GROUP] =
static volatile GPTIMER_group_regs *const group_regs[BFIN_TIMER_NUM_GROUP] =
@@ -80,13 +82,15 @@ static uint32_t const trun_mask[MAX_BLACKFIN_GPTIMERS] =
	TIMER_STATUS_TRUN5,
	TIMER_STATUS_TRUN5,
	TIMER_STATUS_TRUN6,
	TIMER_STATUS_TRUN6,
	TIMER_STATUS_TRUN7,
	TIMER_STATUS_TRUN7,
#endif
# if (MAX_BLACKFIN_GPTIMERS > 8)
# if (MAX_BLACKFIN_GPTIMERS > 8)
	TIMER_STATUS_TRUN8,
	TIMER_STATUS_TRUN8,
	TIMER_STATUS_TRUN9,
	TIMER_STATUS_TRUN9,
	TIMER_STATUS_TRUN10,
	TIMER_STATUS_TRUN10,
#  if (MAX_BLACKFIN_GPTIMERS > 11)
	TIMER_STATUS_TRUN11,
	TIMER_STATUS_TRUN11,
#  endif
#  endif
# endif
#endif
};
};


static uint32_t const tovf_mask[MAX_BLACKFIN_GPTIMERS] =
static uint32_t const tovf_mask[MAX_BLACKFIN_GPTIMERS] =
@@ -100,13 +104,15 @@ static uint32_t const tovf_mask[MAX_BLACKFIN_GPTIMERS] =
	TIMER_STATUS_TOVF5,
	TIMER_STATUS_TOVF5,
	TIMER_STATUS_TOVF6,
	TIMER_STATUS_TOVF6,
	TIMER_STATUS_TOVF7,
	TIMER_STATUS_TOVF7,
#endif
# if (MAX_BLACKFIN_GPTIMERS > 8)
# if (MAX_BLACKFIN_GPTIMERS > 8)
	TIMER_STATUS_TOVF8,
	TIMER_STATUS_TOVF8,
	TIMER_STATUS_TOVF9,
	TIMER_STATUS_TOVF9,
	TIMER_STATUS_TOVF10,
	TIMER_STATUS_TOVF10,
#  if (MAX_BLACKFIN_GPTIMERS > 11)
	TIMER_STATUS_TOVF11,
	TIMER_STATUS_TOVF11,
#  endif
#  endif
# endif
#endif
};
};


static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] =
static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] =
@@ -120,13 +126,15 @@ static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] =
	TIMER_STATUS_TIMIL5,
	TIMER_STATUS_TIMIL5,
	TIMER_STATUS_TIMIL6,
	TIMER_STATUS_TIMIL6,
	TIMER_STATUS_TIMIL7,
	TIMER_STATUS_TIMIL7,
#endif
# if (MAX_BLACKFIN_GPTIMERS > 8)
# if (MAX_BLACKFIN_GPTIMERS > 8)
	TIMER_STATUS_TIMIL8,
	TIMER_STATUS_TIMIL8,
	TIMER_STATUS_TIMIL9,
	TIMER_STATUS_TIMIL9,
	TIMER_STATUS_TIMIL10,
	TIMER_STATUS_TIMIL10,
#  if (MAX_BLACKFIN_GPTIMERS > 11)
	TIMER_STATUS_TIMIL11,
	TIMER_STATUS_TIMIL11,
#  endif
#  endif
# endif
#endif
};
};


void set_gptimer_pwidth(int timer_id, uint32_t value)
void set_gptimer_pwidth(int timer_id, uint32_t value)
+65 −85
Original line number Original line Diff line number Diff line
@@ -21,6 +21,18 @@
# define MAX_BLACKFIN_GPTIMERS 8
# define MAX_BLACKFIN_GPTIMERS 8
# define TIMER0_GROUP_REG      TIMER_ENABLE
# define TIMER0_GROUP_REG      TIMER_ENABLE
#endif
#endif
/*
 * BF54x: 11 timers (BF542: 8 timers):
 */
#if defined(BF548_FAMILY)
# ifdef CONFIG_BF542
#  define MAX_BLACKFIN_GPTIMERS 8
# else
#  define MAX_BLACKFIN_GPTIMERS 11
#  define TIMER8_GROUP_REG      TIMER_ENABLE1
# endif
# define TIMER0_GROUP_REG       TIMER_ENABLE0
#endif
/*
/*
 * BF561: 12 timers:
 * BF561: 12 timers:
 */
 */
@@ -44,40 +56,28 @@
#define TIMER0bit  0x0001  /*  0001b */
#define TIMER0bit  0x0001  /*  0001b */
#define TIMER1bit  0x0002  /*  0010b */
#define TIMER1bit  0x0002  /*  0010b */
#define TIMER2bit  0x0004  /*  0100b */
#define TIMER2bit  0x0004  /*  0100b */

#if (MAX_BLACKFIN_GPTIMERS > 3)
#define TIMER3bit  0x0008
#define TIMER3bit  0x0008
#define TIMER4bit  0x0010
#define TIMER4bit  0x0010
#define TIMER5bit  0x0020
#define TIMER5bit  0x0020
#define TIMER6bit  0x0040
#define TIMER6bit  0x0040
#define TIMER7bit  0x0080
#define TIMER7bit  0x0080
#endif

#if (MAX_BLACKFIN_GPTIMERS > 8)
#define TIMER8bit  0x0100
#define TIMER8bit  0x0100
#define TIMER9bit  0x0200
#define TIMER9bit  0x0200
#define TIMER10bit 0x0400
#define TIMER10bit 0x0400
#define TIMER11bit 0x0800
#define TIMER11bit 0x0800
#endif


#define TIMER0_id   0
#define TIMER0_id   0
#define TIMER1_id   1
#define TIMER1_id   1
#define TIMER2_id   2
#define TIMER2_id   2

#if (MAX_BLACKFIN_GPTIMERS > 3)
#define TIMER3_id   3
#define TIMER3_id   3
#define TIMER4_id   4
#define TIMER4_id   4
#define TIMER5_id   5
#define TIMER5_id   5
#define TIMER6_id   6
#define TIMER6_id   6
#define TIMER7_id   7
#define TIMER7_id   7
#endif

#if (MAX_BLACKFIN_GPTIMERS > 8)
#define TIMER8_id   8
#define TIMER8_id   8
#define TIMER9_id   9
#define TIMER9_id   9
#define TIMER10_id 10
#define TIMER10_id 10
#define TIMER11_id 11
#define TIMER11_id 11
#endif


/* associated timers for ppi framesync: */
/* associated timers for ppi framesync: */


@@ -127,42 +127,28 @@
#define TIMER_STATUS_TIMIL0  0x0001
#define TIMER_STATUS_TIMIL0  0x0001
#define TIMER_STATUS_TIMIL1  0x0002
#define TIMER_STATUS_TIMIL1  0x0002
#define TIMER_STATUS_TIMIL2  0x0004
#define TIMER_STATUS_TIMIL2  0x0004
#if (MAX_BLACKFIN_GPTIMERS > 3)
#define TIMER_STATUS_TIMIL3  0x00000008
#define TIMER_STATUS_TIMIL3  0x00000008
#define TIMER_STATUS_TIMIL4  0x00010000
#define TIMER_STATUS_TIMIL4  0x00010000
#define TIMER_STATUS_TIMIL5  0x00020000
#define TIMER_STATUS_TIMIL5  0x00020000
#define TIMER_STATUS_TIMIL6  0x00040000
#define TIMER_STATUS_TIMIL6  0x00040000
#define TIMER_STATUS_TIMIL7  0x00080000
#define TIMER_STATUS_TIMIL7  0x00080000
# if (MAX_BLACKFIN_GPTIMERS > 8)
#define TIMER_STATUS_TIMIL8  0x0001
#define TIMER_STATUS_TIMIL8  0x0001
#define TIMER_STATUS_TIMIL9  0x0002
#define TIMER_STATUS_TIMIL9  0x0002
#define TIMER_STATUS_TIMIL10 0x0004
#define TIMER_STATUS_TIMIL10 0x0004
#define TIMER_STATUS_TIMIL11 0x0008
#define TIMER_STATUS_TIMIL11 0x0008
# endif
# define TIMER_STATUS_INTR   0x000F000F
#else
# define TIMER_STATUS_INTR   0x0007	/* any timer interrupt */
#endif


#define TIMER_STATUS_TOVF0   0x0010	/* timer 0 overflow error */
#define TIMER_STATUS_TOVF0   0x0010	/* timer 0 overflow error */
#define TIMER_STATUS_TOVF1   0x0020
#define TIMER_STATUS_TOVF1   0x0020
#define TIMER_STATUS_TOVF2   0x0040
#define TIMER_STATUS_TOVF2   0x0040
#if (MAX_BLACKFIN_GPTIMERS > 3)
#define TIMER_STATUS_TOVF3   0x00000080
#define TIMER_STATUS_TOVF3   0x00000080
#define TIMER_STATUS_TOVF4   0x00100000
#define TIMER_STATUS_TOVF4   0x00100000
#define TIMER_STATUS_TOVF5   0x00200000
#define TIMER_STATUS_TOVF5   0x00200000
#define TIMER_STATUS_TOVF6   0x00400000
#define TIMER_STATUS_TOVF6   0x00400000
#define TIMER_STATUS_TOVF7   0x00800000
#define TIMER_STATUS_TOVF7   0x00800000
# if (MAX_BLACKFIN_GPTIMERS > 8)
#define TIMER_STATUS_TOVF8   0x0010
#define TIMER_STATUS_TOVF8   0x0010
#define TIMER_STATUS_TOVF9   0x0020
#define TIMER_STATUS_TOVF9   0x0020
#define TIMER_STATUS_TOVF10  0x0040
#define TIMER_STATUS_TOVF10  0x0040
#define TIMER_STATUS_TOVF11  0x0080
#define TIMER_STATUS_TOVF11  0x0080
# endif
# define TIMER_STATUS_OFLOW  0x00F000F0
#else
# define TIMER_STATUS_OFLOW  0x0070	/* any timer overflow */
#endif


/*
/*
 * Timer Slave Enable Status : write 1 to clear
 * Timer Slave Enable Status : write 1 to clear
@@ -170,22 +156,16 @@
#define TIMER_STATUS_TRUN0  0x1000
#define TIMER_STATUS_TRUN0  0x1000
#define TIMER_STATUS_TRUN1  0x2000
#define TIMER_STATUS_TRUN1  0x2000
#define TIMER_STATUS_TRUN2  0x4000
#define TIMER_STATUS_TRUN2  0x4000
#if (MAX_BLACKFIN_GPTIMERS > 3)
#define TIMER_STATUS_TRUN3  0x00008000
#define TIMER_STATUS_TRUN3  0x00008000
#define TIMER_STATUS_TRUN4  0x10000000
#define TIMER_STATUS_TRUN4  0x10000000
#define TIMER_STATUS_TRUN5  0x20000000
#define TIMER_STATUS_TRUN5  0x20000000
#define TIMER_STATUS_TRUN6  0x40000000
#define TIMER_STATUS_TRUN6  0x40000000
#define TIMER_STATUS_TRUN7  0x80000000
#define TIMER_STATUS_TRUN7  0x80000000
#define TIMER_STATUS_TRUN   0xF000F000
#define TIMER_STATUS_TRUN   0xF000F000
# if (MAX_BLACKFIN_GPTIMERS > 8)
#define TIMER_STATUS_TRUN8  0x1000
#define TIMER_STATUS_TRUN8  0x1000
#define TIMER_STATUS_TRUN9  0x2000
#define TIMER_STATUS_TRUN9  0x2000
#define TIMER_STATUS_TRUN10 0x4000
#define TIMER_STATUS_TRUN10 0x4000
#define TIMER_STATUS_TRUN11 0x8000
#define TIMER_STATUS_TRUN11 0x8000
# endif
#else
# define TIMER_STATUS_TRUN   0x7000
#endif


/* The actual gptimer API */
/* The actual gptimer API */