Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
b700a3d5
Commit
b700a3d5
authored
Feb 20, 2004
by
Yoshinori Sato
Committed by
Benjamin Herrenschmidt
Feb 20, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] H8/300 io.h bussizing problem fix
- fix warning - byte swap miss fix - 16bit bus access problem fix
parent
26d5929e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
50 deletions
+77
-50
arch/h8300/platform/h8300h/aki3068net/timer.c
arch/h8300/platform/h8300h/aki3068net/timer.c
+3
-3
arch/h8300/platform/h8300h/generic/timer.c
arch/h8300/platform/h8300h/generic/timer.c
+12
-11
arch/h8300/platform/h8300h/h8max/timer.c
arch/h8300/platform/h8300h/h8max/timer.c
+3
-3
arch/h8300/platform/h8s/edosk2674/timer.c
arch/h8300/platform/h8s/edosk2674/timer.c
+5
-5
arch/h8300/platform/h8s/generic/timer.c
arch/h8300/platform/h8s/generic/timer.c
+3
-3
include/asm-h8300/io.h
include/asm-h8300/io.h
+51
-25
No files found.
arch/h8300/platform/h8300h/aki3068net/timer.c
View file @
b700a3d5
...
@@ -27,10 +27,10 @@
...
@@ -27,10 +27,10 @@
void
__init
platform_timer_setup
(
irqreturn_t
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
void
__init
platform_timer_setup
(
irqreturn_t
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
{
{
outb
(
H8300_TIMER_COUNT_DATA
,
TCORA2
);
ctrl_
outb
(
H8300_TIMER_COUNT_DATA
,
TCORA2
);
outb
(
0x00
,
_8TCSR2
);
ctrl_
outb
(
0x00
,
_8TCSR2
);
request_irq
(
40
,
timer_int
,
0
,
"timer"
,
0
);
request_irq
(
40
,
timer_int
,
0
,
"timer"
,
0
);
outb
(
0x40
|
0x08
|
0x03
,
_8TCR2
);
ctrl_
outb
(
0x40
|
0x08
|
0x03
,
_8TCR2
);
}
}
void
platform_timer_eoi
(
void
)
void
platform_timer_eoi
(
void
)
...
...
arch/h8300/platform/h8300h/generic/timer.c
View file @
b700a3d5
...
@@ -29,13 +29,14 @@ extern int request_irq_boot(unsigned int,
...
@@ -29,13 +29,14 @@ extern int request_irq_boot(unsigned int,
#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
#include <asm/regs306x.h>
#include <asm/regs306x.h>
#define CMFA 6
int
platform_timer_setup
(
void
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
int
platform_timer_setup
(
void
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
{
{
outb
(
H8300_TIMER_COUNT_DATA
,
TMR8CM
A2
);
ctrl_outb
(
H8300_TIMER_COUNT_DATA
,
TCOR
A2
);
outb
(
0x00
,
TMR
8TCSR2
);
ctrl_outb
(
0x00
,
_
8TCSR2
);
request_irq
_boot
(
40
,
timer_int
,
0
,
"timer"
,
0
);
request_irq
(
40
,
timer_int
,
0
,
"timer"
,
0
);
outb
(
0x40
|
0x08
|
0x03
,
TMR8TCNT
2
);
ctrl_outb
(
0x40
|
0x08
|
0x03
,
_8TCR
2
);
return
0
;
return
0
;
}
}
...
@@ -65,19 +66,19 @@ int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *))
...
@@ -65,19 +66,19 @@ int platform_timer_setup(void (*timer_int)(int, void *, struct pt_regs *))
{
{
*
(
unsigned
short
*
)
GRA
=
H8300_TIMER_COUNT_DATA
;
*
(
unsigned
short
*
)
GRA
=
H8300_TIMER_COUNT_DATA
;
*
(
unsigned
short
*
)
TCNT
=
0
;
*
(
unsigned
short
*
)
TCNT
=
0
;
outb
(
0x23
,
TCR
);
ctrl_
outb
(
0x23
,
TCR
);
outb
(
0x00
,
TIOR
);
ctrl_
outb
(
0x00
,
TIOR
);
request_timer_irq
(
26
,
timer_int
,
0
,
"timer"
,
0
);
request_timer_irq
(
26
,
timer_int
,
0
,
"timer"
,
0
);
outb
(
inb
(
TIER
)
|
0x01
,
TIER
);
ctrl_
outb
(
inb
(
TIER
)
|
0x01
,
TIER
);
outb
(
inb
(
TSNC
)
&
~
0x01
,
TSNC
);
ctrl_
outb
(
inb
(
TSNC
)
&
~
0x01
,
TSNC
);
outb
(
inb
(
TMDR
)
&
~
0x01
,
TMDR
);
ctrl_
outb
(
inb
(
TMDR
)
&
~
0x01
,
TMDR
);
outb
(
inb
(
TSTR
)
|
0x01
,
TSTR
);
ctrl_
outb
(
inb
(
TSTR
)
|
0x01
,
TSTR
);
return
0
;
return
0
;
}
}
void
platform_timer_eoi
(
void
)
void
platform_timer_eoi
(
void
)
{
{
outb
(
inb
(
TSR
)
&
~
0x01
,
TSR
);
ctrl_
outb
(
inb
(
TSR
)
&
~
0x01
,
TSR
);
}
}
#endif
#endif
...
...
arch/h8300/platform/h8300h/h8max/timer.c
View file @
b700a3d5
...
@@ -27,10 +27,10 @@
...
@@ -27,10 +27,10 @@
void
__init
platform_timer_setup
(
irqreturn_t
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
void
__init
platform_timer_setup
(
irqreturn_t
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
{
{
outb
(
H8300_TIMER_COUNT_DATA
,
TCORA2
);
ctrl_
outb
(
H8300_TIMER_COUNT_DATA
,
TCORA2
);
outb
(
0x00
,
_8TCSR2
);
ctrl_
outb
(
0x00
,
_8TCSR2
);
request_irq
(
40
,
timer_int
,
0
,
"timer"
,
0
);
request_irq
(
40
,
timer_int
,
0
,
"timer"
,
0
);
outb
(
0x40
|
0x08
|
0x03
,
_8TCR2
);
ctrl_
outb
(
0x40
|
0x08
|
0x03
,
_8TCR2
);
}
}
void
platform_timer_eoi
(
void
)
void
platform_timer_eoi
(
void
)
...
...
arch/h8300/platform/h8s/edosk2674/timer.c
View file @
b700a3d5
...
@@ -29,13 +29,13 @@
...
@@ -29,13 +29,13 @@
int
__init
platform_timer_setup
(
irqreturn_t
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
int
__init
platform_timer_setup
(
irqreturn_t
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
{
{
unsigned
char
mstpcrl
;
unsigned
char
mstpcrl
;
mstpcrl
=
inb
(
MSTPCRL
);
/* Enable timer */
mstpcrl
=
ctrl_
inb
(
MSTPCRL
);
/* Enable timer */
mstpcrl
&=
~
0x01
;
mstpcrl
&=
~
0x01
;
outb
(
mstpcrl
,
MSTPCRL
);
ctrl_
outb
(
mstpcrl
,
MSTPCRL
);
outb
(
H8300_TIMER_COUNT_DATA
,
_8TCORA1
);
ctrl_
outb
(
H8300_TIMER_COUNT_DATA
,
_8TCORA1
);
outb
(
0x00
,
_8TCSR1
);
ctrl_
outb
(
0x00
,
_8TCSR1
);
request_irq
(
76
,
timer_int
,
0
,
"timer"
,
0
);
request_irq
(
76
,
timer_int
,
0
,
"timer"
,
0
);
outb
(
0x40
|
0x08
|
0x03
,
_8TCR1
);
ctrl_
outb
(
0x40
|
0x08
|
0x03
,
_8TCR1
);
return
0
;
return
0
;
}
}
...
...
arch/h8300/platform/h8s/generic/timer.c
View file @
b700a3d5
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
int
platform_timer_setup
(
irqreturn_t
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
int
platform_timer_setup
(
irqreturn_t
(
*
timer_int
)(
int
,
void
*
,
struct
pt_regs
*
))
{
{
outb
(
H8300_TIMER_COUNT_DATA
,
_8TCORA1
);
ctrl_
outb
(
H8300_TIMER_COUNT_DATA
,
_8TCORA1
);
outb
(
0x00
,
_8TCSR1
);
ctrl_
outb
(
0x00
,
_8TCSR1
);
request_irq
(
76
,
timer_int
,
0
,
"timer"
,
0
);
request_irq
(
76
,
timer_int
,
0
,
"timer"
,
0
);
outb
(
0x40
|
0x08
|
0x03
,
_8TCR1
);
ctrl_
outb
(
0x40
|
0x08
|
0x03
,
_8TCR1
);
return
0
;
return
0
;
}
}
...
...
include/asm-h8300/io.h
View file @
b700a3d5
...
@@ -6,6 +6,15 @@
...
@@ -6,6 +6,15 @@
#include <linux/config.h>
#include <linux/config.h>
#include <asm/virtconvert.h>
#include <asm/virtconvert.h>
#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
#include <asm/regs306x.h>
#elif defined(CONFIG_H8S2678)
#include <asm/regs2678.h>
#else
#error UNKNOWN CPU TYPE
#endif
/*
/*
* These are for ISA/PCI shared memory _only_ and should never be used
* These are for ISA/PCI shared memory _only_ and should never be used
* on any other type of memory, including Zorro memory. They are meant to
* on any other type of memory, including Zorro memory. They are meant to
...
@@ -30,6 +39,7 @@
...
@@ -30,6 +39,7 @@
* 020325 Added some #define's for the COBRA5272 board
* 020325 Added some #define's for the COBRA5272 board
* (hede)
* (hede)
*/
*/
static
inline
unsigned
short
_swapw
(
volatile
unsigned
short
v
)
static
inline
unsigned
short
_swapw
(
volatile
unsigned
short
v
)
{
{
return
((
v
<<
8
)
|
(
v
>>
8
));
return
((
v
<<
8
)
|
(
v
>>
8
));
...
@@ -41,20 +51,19 @@ static inline unsigned int _swapl(volatile unsigned long v)
...
@@ -41,20 +51,19 @@ static inline unsigned int _swapl(volatile unsigned long v)
}
}
#define readb(addr) \
#define readb(addr) \
({ unsigned char __v = (*(volatile unsigned char *) (
addr
& 0x00ffffff)); __v; })
({ unsigned char __v = (*(volatile unsigned char *) (
(addr)
& 0x00ffffff)); __v; })
#define readw(addr) \
#define readw(addr) \
({ unsigned short __v = (*(volatile unsigned short *) (
addr
& 0x00ffffff)); __v; })
({ unsigned short __v = (*(volatile unsigned short *) (
(addr)
& 0x00ffffff)); __v; })
#define readl(addr) \
#define readl(addr) \
({ unsigned int __v = (*(volatile unsigned int *) (
addr
& 0x00ffffff)); __v; })
({ unsigned int __v = (*(volatile unsigned int *) (
(addr)
& 0x00ffffff)); __v; })
#define writeb(b,addr) (void)((*(volatile unsigned char *) ((addr) & 0x00ffffff)) = (b))
#define writew(b,addr) (void)((*(volatile unsigned short *) ((addr) & 0x00ffffff)) = (b))
#define writel(b,addr) (void)((*(volatile unsigned int *) ((addr) & 0x00ffffff)) = (b))
#define readb_relaxed(addr) readb(addr)
#define readb_relaxed(addr) readb(addr)
#define readw_relaxed(addr) readw(addr)
#define readw_relaxed(addr) readw(addr)
#define readl_relaxed(addr) readl(addr)
#define readl_relaxed(addr) readl(addr)
#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr & 0x00ffffff)) = (b))
#define writew(b,addr) (void)((*(volatile unsigned short *) (addr & 0x00ffffff)) = (b))
#define writel(b,addr) (void)((*(volatile unsigned int *) (addr & 0x00ffffff)) = (b))
#define __raw_readb readb
#define __raw_readb readb
#define __raw_readw readw
#define __raw_readw readw
#define __raw_readl readl
#define __raw_readl readl
...
@@ -62,12 +71,24 @@ static inline unsigned int _swapl(volatile unsigned long v)
...
@@ -62,12 +71,24 @@ static inline unsigned int _swapl(volatile unsigned long v)
#define __raw_writew writew
#define __raw_writew writew
#define __raw_writel writel
#define __raw_writel writel
static
inline
int
h8300_buswidth
(
unsigned
int
addr
)
{
return
(
*
(
volatile
unsigned
char
*
)
ABWCR
&
(
1
<<
(
addr
>>
21
)
&
7
))
==
0
;
}
static
inline
void
io_outsb
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
static
inline
void
io_outsb
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
{
{
volatile
unsigned
char
*
ap
=
(
volatile
unsigned
char
*
)
addr
;
volatile
unsigned
char
*
ap_b
=
(
volatile
unsigned
char
*
)
addr
;
volatile
unsigned
short
*
ap_w
=
(
volatile
unsigned
short
*
)
addr
;
unsigned
char
*
bp
=
(
unsigned
char
*
)
buf
;
unsigned
char
*
bp
=
(
unsigned
char
*
)
buf
;
while
(
len
--
)
*
ap
=
*
bp
++
;
if
(
h8300_buswidth
(
addr
)
&&
(
addr
&
1
))
{
while
(
len
--
)
*
ap_w
=
*
bp
++
;
}
else
{
while
(
len
--
)
*
ap_b
=
*
bp
++
;
}
}
}
static
inline
void
io_outsw
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
static
inline
void
io_outsw
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
...
@@ -75,7 +96,7 @@ static inline void io_outsw(unsigned int addr, void *buf, int len)
...
@@ -75,7 +96,7 @@ static inline void io_outsw(unsigned int addr, void *buf, int len)
volatile
unsigned
short
*
ap
=
(
volatile
unsigned
short
*
)
addr
;
volatile
unsigned
short
*
ap
=
(
volatile
unsigned
short
*
)
addr
;
unsigned
short
*
bp
=
(
unsigned
short
*
)
buf
;
unsigned
short
*
bp
=
(
unsigned
short
*
)
buf
;
while
(
len
--
)
while
(
len
--
)
*
ap
=
_swapw
(
*
bp
++
)
;
*
ap
=
*
bp
++
;
}
}
static
inline
void
io_outsl
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
static
inline
void
io_outsl
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
...
@@ -83,13 +104,18 @@ static inline void io_outsl(unsigned int addr, void *buf, int len)
...
@@ -83,13 +104,18 @@ static inline void io_outsl(unsigned int addr, void *buf, int len)
volatile
unsigned
int
*
ap
=
(
volatile
unsigned
int
*
)
addr
;
volatile
unsigned
int
*
ap
=
(
volatile
unsigned
int
*
)
addr
;
unsigned
int
*
bp
=
(
unsigned
int
*
)
buf
;
unsigned
int
*
bp
=
(
unsigned
int
*
)
buf
;
while
(
len
--
)
while
(
len
--
)
*
ap
=
_swapl
(
*
bp
++
)
;
*
ap
=
*
bp
++
;
}
}
static
inline
void
io_insb
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
static
inline
void
io_insb
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
{
{
volatile
unsigned
char
*
ap
=
(
volatile
unsigned
char
*
)
addr
;
volatile
unsigned
char
*
ap
;
unsigned
char
*
bp
=
(
unsigned
char
*
)
buf
;
unsigned
char
*
bp
=
(
unsigned
char
*
)
buf
;
if
(
h8300_buswidth
(
addr
))
ap
=
(
volatile
unsigned
char
*
)(
addr
^
1
);
else
ap
=
(
volatile
unsigned
char
*
)
addr
;
while
(
len
--
)
while
(
len
--
)
*
bp
++
=
*
ap
;
*
bp
++
=
*
ap
;
}
}
...
@@ -99,7 +125,7 @@ static inline void io_insw(unsigned int addr, void *buf, int len)
...
@@ -99,7 +125,7 @@ static inline void io_insw(unsigned int addr, void *buf, int len)
volatile
unsigned
short
*
ap
=
(
volatile
unsigned
short
*
)
addr
;
volatile
unsigned
short
*
ap
=
(
volatile
unsigned
short
*
)
addr
;
unsigned
short
*
bp
=
(
unsigned
short
*
)
buf
;
unsigned
short
*
bp
=
(
unsigned
short
*
)
buf
;
while
(
len
--
)
while
(
len
--
)
*
bp
++
=
_swapw
(
*
ap
)
;
*
bp
++
=
*
ap
;
}
}
static
inline
void
io_insl
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
static
inline
void
io_insl
(
unsigned
int
addr
,
void
*
buf
,
int
len
)
...
@@ -107,7 +133,7 @@ static inline void io_insl(unsigned int addr, void *buf, int len)
...
@@ -107,7 +133,7 @@ static inline void io_insl(unsigned int addr, void *buf, int len)
volatile
unsigned
int
*
ap
=
(
volatile
unsigned
int
*
)
addr
;
volatile
unsigned
int
*
ap
=
(
volatile
unsigned
int
*
)
addr
;
unsigned
int
*
bp
=
(
unsigned
int
*
)
buf
;
unsigned
int
*
bp
=
(
unsigned
int
*
)
buf
;
while
(
len
--
)
while
(
len
--
)
*
bp
++
=
_swapl
(
*
ap
)
;
*
bp
++
=
*
ap
;
}
}
/*
/*
...
@@ -119,12 +145,12 @@ static inline void io_insl(unsigned int addr, void *buf, int len)
...
@@ -119,12 +145,12 @@ static inline void io_insl(unsigned int addr, void *buf, int len)
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
#define inb(addr)
readb(addr
)
#define inb(addr)
((h8300_buswidth(addr))?readb(addr ^ 1) & 0xff:readb(addr)
)
#define inw(addr)
readw(addr
)
#define inw(addr)
_swapw(readw(addr)
)
#define inl(addr)
readl(addr
)
#define inl(addr)
_swapl(readl(addr)
)
#define outb(x,addr) ((void)
writeb(x,addr
))
#define outb(x,addr) ((void)
((h8300_buswidth(addr) && (addr & 1))?writew(x,addr):writeb(x,addr)
))
#define outw(x,addr) ((void) writew(
x
,addr))
#define outw(x,addr) ((void) writew(
_swapw(x)
,addr))
#define outl(x,addr) ((void) writel(
x
,addr))
#define outl(x,addr) ((void) writel(
_swapl(x)
,addr))
#define inb_p(addr) inb(addr)
#define inb_p(addr) inb(addr)
#define inw_p(addr) inw(addr)
#define inw_p(addr) inw(addr)
...
@@ -153,19 +179,19 @@ static inline void io_insl(unsigned int addr, void *buf, int len)
...
@@ -153,19 +179,19 @@ static inline void io_insl(unsigned int addr, void *buf, int len)
extern
void
*
__ioremap
(
unsigned
long
physaddr
,
unsigned
long
size
,
int
cacheflag
);
extern
void
*
__ioremap
(
unsigned
long
physaddr
,
unsigned
long
size
,
int
cacheflag
);
extern
void
__iounmap
(
void
*
addr
,
unsigned
long
size
);
extern
void
__iounmap
(
void
*
addr
,
unsigned
long
size
);
extern
inline
void
*
ioremap
(
unsigned
long
physaddr
,
unsigned
long
size
)
static
inline
void
*
ioremap
(
unsigned
long
physaddr
,
unsigned
long
size
)
{
{
return
__ioremap
(
physaddr
,
size
,
IOMAP_NOCACHE_SER
);
return
__ioremap
(
physaddr
,
size
,
IOMAP_NOCACHE_SER
);
}
}
extern
inline
void
*
ioremap_nocache
(
unsigned
long
physaddr
,
unsigned
long
size
)
static
inline
void
*
ioremap_nocache
(
unsigned
long
physaddr
,
unsigned
long
size
)
{
{
return
__ioremap
(
physaddr
,
size
,
IOMAP_NOCACHE_SER
);
return
__ioremap
(
physaddr
,
size
,
IOMAP_NOCACHE_SER
);
}
}
extern
inline
void
*
ioremap_writethrough
(
unsigned
long
physaddr
,
unsigned
long
size
)
static
inline
void
*
ioremap_writethrough
(
unsigned
long
physaddr
,
unsigned
long
size
)
{
{
return
__ioremap
(
physaddr
,
size
,
IOMAP_WRITETHROUGH
);
return
__ioremap
(
physaddr
,
size
,
IOMAP_WRITETHROUGH
);
}
}
extern
inline
void
*
ioremap_fullcache
(
unsigned
long
physaddr
,
unsigned
long
size
)
static
inline
void
*
ioremap_fullcache
(
unsigned
long
physaddr
,
unsigned
long
size
)
{
{
return
__ioremap
(
physaddr
,
size
,
IOMAP_FULL_CACHING
);
return
__ioremap
(
physaddr
,
size
,
IOMAP_FULL_CACHING
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment