aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-x3proto/ilsel.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/mach-x3proto/ilsel.c')
-rw-r--r--arch/sh/boards/mach-x3proto/ilsel.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/arch/sh/boards/mach-x3proto/ilsel.c b/arch/sh/boards/mach-x3proto/ilsel.c
index b5c673c39337..95e346139515 100644
--- a/arch/sh/boards/mach-x3proto/ilsel.c
+++ b/arch/sh/boards/mach-x3proto/ilsel.c
@@ -1,20 +1,22 @@
1/* 1/*
2 * arch/sh/boards/renesas/x3proto/ilsel.c 2 * arch/sh/boards/mach-x3proto/ilsel.c
3 * 3 *
4 * Helper routines for SH-X3 proto board ILSEL. 4 * Helper routines for SH-X3 proto board ILSEL.
5 * 5 *
6 * Copyright (C) 2007 Paul Mundt 6 * Copyright (C) 2007 - 2010 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details. 10 * for more details.
11 */ 11 */
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
12#include <linux/init.h> 14#include <linux/init.h>
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/module.h> 16#include <linux/module.h>
15#include <linux/bitmap.h> 17#include <linux/bitmap.h>
16#include <linux/io.h> 18#include <linux/io.h>
17#include <asm/ilsel.h> 19#include <mach/ilsel.h>
18 20
19/* 21/*
20 * ILSEL is split across: 22 * ILSEL is split across:
@@ -64,16 +66,18 @@ static void __ilsel_enable(ilsel_source_t set, unsigned int bit)
64 unsigned int tmp, shift; 66 unsigned int tmp, shift;
65 unsigned long addr; 67 unsigned long addr;
66 68
69 pr_notice("enabling ILSEL set %d\n", set);
70
67 addr = mk_ilsel_addr(bit); 71 addr = mk_ilsel_addr(bit);
68 shift = mk_ilsel_shift(bit); 72 shift = mk_ilsel_shift(bit);
69 73
70 pr_debug("%s: bit#%d: addr - 0x%08lx (shift %d, set %d)\n", 74 pr_debug("%s: bit#%d: addr - 0x%08lx (shift %d, set %d)\n",
71 __func__, bit, addr, shift, set); 75 __func__, bit, addr, shift, set);
72 76
73 tmp = ctrl_inw(addr); 77 tmp = __raw_readw(addr);
74 tmp &= ~(0xf << shift); 78 tmp &= ~(0xf << shift);
75 tmp |= set << shift; 79 tmp |= set << shift;
76 ctrl_outw(tmp, addr); 80 __raw_writew(tmp, addr);
77} 81}
78 82
79/** 83/**
@@ -92,8 +96,10 @@ int ilsel_enable(ilsel_source_t set)
92{ 96{
93 unsigned int bit; 97 unsigned int bit;
94 98
95 /* Aliased sources must use ilsel_enable_fixed() */ 99 if (unlikely(set > ILSEL_KEY)) {
96 BUG_ON(set > ILSEL_KEY); 100 pr_err("Aliased sources must use ilsel_enable_fixed()\n");
101 return -EINVAL;
102 }
97 103
98 do { 104 do {
99 bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS); 105 bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS);
@@ -140,11 +146,13 @@ void ilsel_disable(unsigned int irq)
140 unsigned long addr; 146 unsigned long addr;
141 unsigned int tmp; 147 unsigned int tmp;
142 148
149 pr_notice("disabling ILSEL set %d\n", irq);
150
143 addr = mk_ilsel_addr(irq); 151 addr = mk_ilsel_addr(irq);
144 152
145 tmp = ctrl_inw(addr); 153 tmp = __raw_readw(addr);
146 tmp &= ~(0xf << mk_ilsel_shift(irq)); 154 tmp &= ~(0xf << mk_ilsel_shift(irq));
147 ctrl_outw(tmp, addr); 155 __raw_writew(tmp, addr);
148 156
149 clear_bit(irq, &ilsel_level_map); 157 clear_bit(irq, &ilsel_level_map);
150} 158}