Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
bf32eb85
Commit
bf32eb85
authored
Dec 14, 2009
by
Russell King
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pending-l2x0' into cache
parents
f74f7e57
3d107434
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
21 deletions
+72
-21
arch/arm/mm/cache-l2x0.c
arch/arm/mm/cache-l2x0.c
+72
-21
No files found.
arch/arm/mm/cache-l2x0.c
View file @
bf32eb85
...
...
@@ -28,69 +28,120 @@
static
void
__iomem
*
l2x0_base
;
static
DEFINE_SPINLOCK
(
l2x0_lock
);
static
inline
void
sync_writel
(
unsigned
long
val
,
unsigned
long
reg
,
unsigned
long
complete_mask
)
static
inline
void
cache_wait
(
void
__iomem
*
reg
,
unsigned
long
mask
)
{
unsigned
long
flags
;
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
writel
(
val
,
l2x0_base
+
reg
);
/* wait for the operation to complete */
while
(
readl
(
l2x0_base
+
reg
)
&
complete_
mask
)
while
(
readl
(
reg
)
&
mask
)
;
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
static
inline
void
cache_sync
(
void
)
{
sync_writel
(
0
,
L2X0_CACHE_SYNC
,
1
);
void
__iomem
*
base
=
l2x0_base
;
writel
(
0
,
base
+
L2X0_CACHE_SYNC
);
cache_wait
(
base
+
L2X0_CACHE_SYNC
,
1
);
}
static
inline
void
l2x0_inv_all
(
void
)
{
unsigned
long
flags
;
/* invalidate all ways */
sync_writel
(
0xff
,
L2X0_INV_WAY
,
0xff
);
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
writel
(
0xff
,
l2x0_base
+
L2X0_INV_WAY
);
cache_wait
(
l2x0_base
+
L2X0_INV_WAY
,
0xff
);
cache_sync
();
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
static
void
l2x0_inv_range
(
unsigned
long
start
,
unsigned
long
end
)
{
unsigned
long
addr
;
void
__iomem
*
base
=
l2x0_base
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
if
(
start
&
(
CACHE_LINE_SIZE
-
1
))
{
start
&=
~
(
CACHE_LINE_SIZE
-
1
);
sync_writel
(
start
,
L2X0_CLEAN_INV_LINE_PA
,
1
);
cache_wait
(
base
+
L2X0_CLEAN_INV_LINE_PA
,
1
);
writel
(
start
,
base
+
L2X0_CLEAN_INV_LINE_PA
);
start
+=
CACHE_LINE_SIZE
;
}
if
(
end
&
(
CACHE_LINE_SIZE
-
1
))
{
end
&=
~
(
CACHE_LINE_SIZE
-
1
);
sync_writel
(
end
,
L2X0_CLEAN_INV_LINE_PA
,
1
);
cache_wait
(
base
+
L2X0_CLEAN_INV_LINE_PA
,
1
);
writel
(
end
,
base
+
L2X0_CLEAN_INV_LINE_PA
);
}
for
(
addr
=
start
;
addr
<
end
;
addr
+=
CACHE_LINE_SIZE
)
sync_writel
(
addr
,
L2X0_INV_LINE_PA
,
1
);
while
(
start
<
end
)
{
unsigned
long
blk_end
=
start
+
min
(
end
-
start
,
4096UL
);
while
(
start
<
blk_end
)
{
cache_wait
(
base
+
L2X0_INV_LINE_PA
,
1
);
writel
(
start
,
base
+
L2X0_INV_LINE_PA
);
start
+=
CACHE_LINE_SIZE
;
}
if
(
blk_end
<
end
)
{
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
}
}
cache_wait
(
base
+
L2X0_INV_LINE_PA
,
1
);
cache_sync
();
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
static
void
l2x0_clean_range
(
unsigned
long
start
,
unsigned
long
end
)
{
unsigned
long
addr
;
void
__iomem
*
base
=
l2x0_base
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
start
&=
~
(
CACHE_LINE_SIZE
-
1
);
for
(
addr
=
start
;
addr
<
end
;
addr
+=
CACHE_LINE_SIZE
)
sync_writel
(
addr
,
L2X0_CLEAN_LINE_PA
,
1
);
while
(
start
<
end
)
{
unsigned
long
blk_end
=
start
+
min
(
end
-
start
,
4096UL
);
while
(
start
<
blk_end
)
{
cache_wait
(
base
+
L2X0_CLEAN_LINE_PA
,
1
);
writel
(
start
,
base
+
L2X0_CLEAN_LINE_PA
);
start
+=
CACHE_LINE_SIZE
;
}
if
(
blk_end
<
end
)
{
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
}
}
cache_wait
(
base
+
L2X0_CLEAN_LINE_PA
,
1
);
cache_sync
();
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
static
void
l2x0_flush_range
(
unsigned
long
start
,
unsigned
long
end
)
{
unsigned
long
addr
;
void
__iomem
*
base
=
l2x0_base
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
start
&=
~
(
CACHE_LINE_SIZE
-
1
);
for
(
addr
=
start
;
addr
<
end
;
addr
+=
CACHE_LINE_SIZE
)
sync_writel
(
addr
,
L2X0_CLEAN_INV_LINE_PA
,
1
);
while
(
start
<
end
)
{
unsigned
long
blk_end
=
start
+
min
(
end
-
start
,
4096UL
);
while
(
start
<
blk_end
)
{
cache_wait
(
base
+
L2X0_CLEAN_INV_LINE_PA
,
1
);
writel
(
start
,
base
+
L2X0_CLEAN_INV_LINE_PA
);
start
+=
CACHE_LINE_SIZE
;
}
if
(
blk_end
<
end
)
{
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
}
}
cache_wait
(
base
+
L2X0_CLEAN_INV_LINE_PA
,
1
);
cache_sync
();
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
void
__init
l2x0_init
(
void
__iomem
*
base
,
__u32
aux_val
,
__u32
aux_mask
)
...
...
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