Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
reform-boundary-uboot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jack Humbert
reform-boundary-uboot
Commits
6177445d
Commit
6177445d
authored
22 years ago
by
Stefan Roese
Browse files
Options
Downloads
Patches
Plain Diff
Added 4MByte and 128MByte onboard SDRAM
parent
aacf9a49
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpu/ppc4xx/sdram.c
+105
-4
105 additions, 4 deletions
cpu/ppc4xx/sdram.c
with
105 additions
and
4 deletions
cpu/ppc4xx/sdram.c
+
105
−
4
View file @
6177445d
...
...
@@ -35,13 +35,17 @@
#define MAGIC2 0x22222222
#define MAGIC3 0x33333333
#define MAGIC4 0x44444444
#define MAGIC5 0x55555555
#define MAGIC6 0x66666666
#define ADDR_ZERO 0x00000000
#define ADDR_400 0x00000400
#define ADDR_01MB 0x00100000
#define ADDR_08MB 0x00800000
#define ADDR_16MB 0x01000000
#define ADDR_32MB 0x02000000
#define ADDR_64MB 0x04000000
#define ADDR_128MB 0x08000000
#define mtsdram0(reg, data) mtdcr(memcfga,reg);mtdcr(memcfgd,data)
...
...
@@ -76,6 +80,59 @@ void sdram_init(void)
rtr
=
0x05f00000
;
}
/*
* Set MB0CF for bank 0. (0-128MB) Address Mode 3 since 13x10(4)
*/
mtsdram0
(
mem_mb0cf
,
0x000A4001
);
mtsdram0
(
mem_sdtr1
,
sdtr1
);
mtsdram0
(
mem_rtr
,
rtr
);
/*
* Wait for 200us
*/
udelay
(
200
);
/*
* Set memory controller options reg, MCOPT1.
* Set DC_EN to '1' and BRD_PRF to '01' for 16 byte PLB Burst
* read/prefetch.
*/
mtsdram0
(
mem_mcopt1
,
0x80800000
);
/*
* Wait for 10ms
*/
udelay
(
10000
);
/*
* Test if 128 MByte are equipped (mirror test)
*/
*
(
volatile
ulong
*
)
ADDR_ZERO
=
MAGIC0
;
*
(
volatile
ulong
*
)
ADDR_08MB
=
MAGIC1
;
*
(
volatile
ulong
*
)
ADDR_16MB
=
MAGIC2
;
*
(
volatile
ulong
*
)
ADDR_32MB
=
MAGIC3
;
*
(
volatile
ulong
*
)
ADDR_64MB
=
MAGIC4
;
if
((
*
(
volatile
ulong
*
)
ADDR_ZERO
==
MAGIC0
)
&&
(
*
(
volatile
ulong
*
)
ADDR_08MB
==
MAGIC1
)
&&
(
*
(
volatile
ulong
*
)
ADDR_16MB
==
MAGIC2
)
&&
(
*
(
volatile
ulong
*
)
ADDR_32MB
==
MAGIC3
))
{
/*
* OK, 128MB detected -> all done
*/
return
;
}
/*
* Now test for 64 MByte...
*/
/*
* Disable memory controller.
*/
mtsdram0
(
mem_mcopt1
,
0x00000000
);
/*
* Set MB0CF for bank 0. (0-64MB) Address Mode 3 since 13x9(4)
*/
...
...
@@ -117,11 +174,11 @@ void sdram_init(void)
*/
return
;
}
/*
* Now test for 32 MByte...
*/
/*
* Disable memory controller.
*/
...
...
@@ -162,9 +219,8 @@ void sdram_init(void)
}
/*
*
Setup
for 16 MByte...
*
Now test
for 16 MByte...
*/
/*
* Disable memory controller.
*/
...
...
@@ -186,6 +242,51 @@ void sdram_init(void)
* Wait for 10ms
*/
udelay
(
10000
);
/*
* Test if 16 MByte are equipped (mirror test)
*/
*
(
volatile
ulong
*
)
ADDR_ZERO
=
MAGIC0
;
*
(
volatile
ulong
*
)
ADDR_400
=
MAGIC1
;
*
(
volatile
ulong
*
)
ADDR_01MB
=
MAGIC5
;
*
(
volatile
ulong
*
)
ADDR_08MB
=
MAGIC2
;
/* *(volatile ulong *)ADDR_16MB = MAGIC3;*/
if
((
*
(
volatile
ulong
*
)
ADDR_ZERO
==
MAGIC0
)
&&
(
*
(
volatile
ulong
*
)
ADDR_400
==
MAGIC1
)
&&
(
*
(
volatile
ulong
*
)
ADDR_01MB
==
MAGIC5
)
&&
(
*
(
volatile
ulong
*
)
ADDR_08MB
==
MAGIC2
))
{
/*
* OK, 16MB detected -> all done
*/
return
;
}
/*
* Setup for 4 MByte...
*/
/*
* Disable memory controller.
*/
mtsdram0
(
mem_mcopt1
,
0x00000000
);
/*
* Set MB0CF for bank 0. (0-4MB) Address Mode 5 since 11x8(2)
*/
mtsdram0
(
mem_mb0cf
,
0x00008001
);
/*
* Set memory controller options reg, MCOPT1.
* Set DC_EN to '1' and BRD_PRF to '01' for 16 byte PLB Burst
* read/prefetch.
*/
mtsdram0
(
mem_mcopt1
,
0x80800000
);
/*
* Wait for 10ms
*/
udelay
(
10000
);
}
#endif
/* CONFIG_SDRAM_BANK0 */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment