Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
arch
avr32
mach-at32ap
hmatrix.c
Go to the documentation of this file.
1
/*
2
* High-Speed Bus Matrix helper functions
3
*
4
* Copyright (C) 2008 Atmel Corporation
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*/
10
#include <
linux/clk.h
>
11
#include <
linux/io.h
>
12
13
#include <
mach/chip.h
>
14
#include <
mach/hmatrix.h
>
15
16
static
inline
void
__hmatrix_write_reg(
unsigned
long
offset
,
u32
value
)
17
{
18
__raw_writel
(value, (
void
__iomem
__force
*)(
HMATRIX_BASE
+ offset));
19
}
20
21
static
inline
u32
__hmatrix_read_reg(
unsigned
long
offset)
22
{
23
return
__raw_readl
((
void
__iomem
__force
*)(
HMATRIX_BASE
+ offset));
24
}
25
31
void
hmatrix_write_reg
(
unsigned
long
offset,
u32
value)
32
{
33
clk_enable
(&
at32_hmatrix_clk
);
34
__hmatrix_write_reg(offset, value);
35
__hmatrix_read_reg(offset);
36
clk_disable
(&
at32_hmatrix_clk
);
37
}
38
45
u32
hmatrix_read_reg
(
unsigned
long
offset)
46
{
47
u32
value
;
48
49
clk_enable
(&
at32_hmatrix_clk
);
50
value = __hmatrix_read_reg(offset);
51
clk_disable
(&
at32_hmatrix_clk
);
52
53
return
value
;
54
}
55
61
void
hmatrix_sfr_set_bits
(
unsigned
int
slave_id,
u32
mask
)
62
{
63
u32
value
;
64
65
clk_enable
(&
at32_hmatrix_clk
);
66
value = __hmatrix_read_reg(
HMATRIX_SFR
(slave_id));
67
value |=
mask
;
68
__hmatrix_write_reg(
HMATRIX_SFR
(slave_id), value);
69
__hmatrix_read_reg(
HMATRIX_SFR
(slave_id));
70
clk_disable
(&
at32_hmatrix_clk
);
71
}
72
78
void
hmatrix_sfr_clear_bits
(
unsigned
int
slave_id,
u32
mask
)
79
{
80
u32
value
;
81
82
clk_enable
(&
at32_hmatrix_clk
);
83
value = __hmatrix_read_reg(
HMATRIX_SFR
(slave_id));
84
value &= ~mask;
85
__hmatrix_write_reg(
HMATRIX_SFR
(slave_id), value);
86
__hmatrix_read_reg(
HMATRIX_SFR
(slave_id));
87
clk_disable
(&
at32_hmatrix_clk
);
88
}
Generated on Thu Jan 10 2013 13:03:50 for Linux Kernel by
1.8.2