Skip to content

Commit

Permalink
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/gerg/m68knommu

Pull m68k/colfire fixes from Greg Ungerer:
 "Only a couple of patches this time.  One migrating the clock driver
  code to the new set-state interface.  The other cleaning up to use the
  PFN_DOWN macro"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68k/coldfire: use PFN_DOWN macro
  m68k/coldfire/pit: Migrate to new 'set-state' interface
  • Loading branch information
torvalds committed Sep 8, 2015
2 parents b9ffce9 + 50e48bd commit 1c8cc72
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 40 deletions.
9 changes: 5 additions & 4 deletions arch/m68k/coldfire/m54xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <asm/m54xxgpt.h>
#ifdef CONFIG_MMU
#include <asm/mmu_context.h>
#include <linux/pfn.h>
#endif

/***************************************************************************/
Expand Down Expand Up @@ -91,13 +92,13 @@ static void __init mcf54xx_bootmem_alloc(void)
m68k_memory[0].size = _ramend - _rambase;

/* compute total pages in system */
num_pages = (_ramend - _rambase) >> PAGE_SHIFT;
num_pages = PFN_DOWN(_ramend - _rambase);

/* page numbers */
memstart = PAGE_ALIGN(_ramstart);
min_low_pfn = _rambase >> PAGE_SHIFT;
start_pfn = memstart >> PAGE_SHIFT;
max_low_pfn = _ramend >> PAGE_SHIFT;
min_low_pfn = PFN_DOWN(_rambase);
start_pfn = PFN_DOWN(memstart);
max_low_pfn = PFN_DOWN(_ramend);
high_memory = (void *)_ramend;

m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;
Expand Down
66 changes: 30 additions & 36 deletions arch/m68k/coldfire/pit.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,37 +42,28 @@ static u32 pit_cnt;
* This is also called after resume to bring the PIT into operation again.
*/

static void init_cf_pit_timer(enum clock_event_mode mode,
struct clock_event_device *evt)
static int cf_pit_set_periodic(struct clock_event_device *evt)
{
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:

__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
__raw_writew(PIT_CYCLES_PER_JIFFY, TA(MCFPIT_PMR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | \
MCFPIT_PCSR_OVW | MCFPIT_PCSR_RLD | \
MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
break;

case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_UNUSED:

__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
break;

case CLOCK_EVT_MODE_ONESHOT:

__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | \
MCFPIT_PCSR_OVW | MCFPIT_PCSR_CLK64, \
TA(MCFPIT_PCSR));
break;

case CLOCK_EVT_MODE_RESUME:
/* Nothing to do here */
break;
}
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
__raw_writew(PIT_CYCLES_PER_JIFFY, TA(MCFPIT_PMR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE |
MCFPIT_PCSR_OVW | MCFPIT_PCSR_RLD |
MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
return 0;
}

static int cf_pit_set_oneshot(struct clock_event_device *evt)
{
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE |
MCFPIT_PCSR_OVW | MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
return 0;
}

static int cf_pit_shutdown(struct clock_event_device *evt)
{
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
return 0;
}

/*
Expand All @@ -88,12 +79,15 @@ static int cf_pit_next_event(unsigned long delta,
}

struct clock_event_device cf_pit_clockevent = {
.name = "pit",
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
.set_mode = init_cf_pit_timer,
.set_next_event = cf_pit_next_event,
.shift = 32,
.irq = MCF_IRQ_PIT1,
.name = "pit",
.features = CLOCK_EVT_FEAT_PERIODIC |
CLOCK_EVT_FEAT_ONESHOT,
.set_state_shutdown = cf_pit_shutdown,
.set_state_periodic = cf_pit_set_periodic,
.set_state_oneshot = cf_pit_set_oneshot,
.set_next_event = cf_pit_next_event,
.shift = 32,
.irq = MCF_IRQ_PIT1,
};


Expand Down

0 comments on commit 1c8cc72

Please sign in to comment.