[ARM] Fix sa11x0 SDRAM selection
Avoid folk having to edit cpu-sa1110.c to select their RAM type; instead, allow the SDRAM type to be selected via the kernel command line. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
committed by
Russell King
parent
8799ee9f49
commit
ba53201180
@@ -15,7 +15,10 @@
|
|||||||
* SDRAM reads (rev A0, B0, B1)
|
* SDRAM reads (rev A0, B0, B1)
|
||||||
*
|
*
|
||||||
* We ignore rev. A0 and B0 devices; I don't think they're worth supporting.
|
* We ignore rev. A0 and B0 devices; I don't think they're worth supporting.
|
||||||
|
*
|
||||||
|
* The SDRAM type can be passed on the command line as cpu_sa1110.sdram=type
|
||||||
*/
|
*/
|
||||||
|
#include <linux/moduleparam.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
@@ -35,6 +38,7 @@
|
|||||||
static struct cpufreq_driver sa1110_driver;
|
static struct cpufreq_driver sa1110_driver;
|
||||||
|
|
||||||
struct sdram_params {
|
struct sdram_params {
|
||||||
|
const char name[16];
|
||||||
u_char rows; /* bits */
|
u_char rows; /* bits */
|
||||||
u_char cas_latency; /* cycles */
|
u_char cas_latency; /* cycles */
|
||||||
u_char tck; /* clock cycle time (ns) */
|
u_char tck; /* clock cycle time (ns) */
|
||||||
@@ -50,54 +54,53 @@ struct sdram_info {
|
|||||||
u_int mdcas[3];
|
u_int mdcas[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sdram_params tc59sm716_cl2_params __initdata = {
|
static struct sdram_params sdram_tbl[] __initdata = {
|
||||||
.rows = 12,
|
{ /* Toshiba TC59SM716 CL2 */
|
||||||
.tck = 10,
|
.name = "TC59SM716-CL2",
|
||||||
.trcd = 20,
|
.rows = 12,
|
||||||
.trp = 20,
|
.tck = 10,
|
||||||
.twr = 10,
|
.trcd = 20,
|
||||||
.refresh = 64000,
|
.trp = 20,
|
||||||
.cas_latency = 2,
|
.twr = 10,
|
||||||
};
|
.refresh = 64000,
|
||||||
|
.cas_latency = 2,
|
||||||
static struct sdram_params tc59sm716_cl3_params __initdata = {
|
}, { /* Toshiba TC59SM716 CL3 */
|
||||||
.rows = 12,
|
.name = "TC59SM716-CL3",
|
||||||
.tck = 8,
|
.rows = 12,
|
||||||
.trcd = 20,
|
.tck = 8,
|
||||||
.trp = 20,
|
.trcd = 20,
|
||||||
.twr = 8,
|
.trp = 20,
|
||||||
.refresh = 64000,
|
.twr = 8,
|
||||||
.cas_latency = 3,
|
.refresh = 64000,
|
||||||
};
|
.cas_latency = 3,
|
||||||
|
}, { /* Samsung K4S641632D TC75 */
|
||||||
static struct sdram_params samsung_k4s641632d_tc75 __initdata = {
|
.name = "K4S641632D",
|
||||||
.rows = 14,
|
.rows = 14,
|
||||||
.tck = 9,
|
.tck = 9,
|
||||||
.trcd = 27,
|
.trcd = 27,
|
||||||
.trp = 20,
|
.trp = 20,
|
||||||
.twr = 9,
|
.twr = 9,
|
||||||
.refresh = 64000,
|
.refresh = 64000,
|
||||||
.cas_latency = 3,
|
.cas_latency = 3,
|
||||||
};
|
}, { /* Samsung KM416S4030CT */
|
||||||
|
.name = "KM416S4030CT",
|
||||||
static struct sdram_params samsung_km416s4030ct __initdata = {
|
.rows = 13,
|
||||||
.rows = 13,
|
.tck = 8,
|
||||||
.tck = 8,
|
.trcd = 24, /* 3 CLKs */
|
||||||
.trcd = 24, /* 3 CLKs */
|
.trp = 24, /* 3 CLKs */
|
||||||
.trp = 24, /* 3 CLKs */
|
.twr = 16, /* Trdl: 2 CLKs */
|
||||||
.twr = 16, /* Trdl: 2 CLKs */
|
.refresh = 64000,
|
||||||
.refresh = 64000,
|
.cas_latency = 3,
|
||||||
.cas_latency = 3,
|
}, { /* Winbond W982516AH75L CL3 */
|
||||||
};
|
.name = "W982516AH75L",
|
||||||
|
.rows = 16,
|
||||||
static struct sdram_params wbond_w982516ah75l_cl3_params __initdata = {
|
.tck = 8,
|
||||||
.rows = 16,
|
.trcd = 20,
|
||||||
.tck = 8,
|
.trp = 20,
|
||||||
.trcd = 20,
|
.twr = 8,
|
||||||
.trp = 20,
|
.refresh = 64000,
|
||||||
.twr = 8,
|
.cas_latency = 3,
|
||||||
.refresh = 64000,
|
},
|
||||||
.cas_latency = 3,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sdram_params sdram_params;
|
static struct sdram_params sdram_params;
|
||||||
@@ -336,19 +339,36 @@ static struct cpufreq_driver sa1110_driver = {
|
|||||||
.name = "sa1110",
|
.name = "sa1110",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct sdram_params *sa1110_find_sdram(const char *name)
|
||||||
|
{
|
||||||
|
struct sdram_params *sdram;
|
||||||
|
|
||||||
|
for (sdram = sdram_tbl; sdram < sdram_tbl + ARRAY_SIZE(sdram_tbl); sdram++)
|
||||||
|
if (strcmp(name, sdram->name) == 0)
|
||||||
|
return sdram;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char sdram_name[16];
|
||||||
|
|
||||||
static int __init sa1110_clk_init(void)
|
static int __init sa1110_clk_init(void)
|
||||||
{
|
{
|
||||||
struct sdram_params *sdram = NULL;
|
struct sdram_params *sdram;
|
||||||
|
const char *name = sdram_name;
|
||||||
|
|
||||||
if (machine_is_assabet())
|
if (!name[0]) {
|
||||||
sdram = &tc59sm716_cl3_params;
|
if (machine_is_assabet())
|
||||||
|
name = "TC59SM716-CL3";
|
||||||
|
|
||||||
if (machine_is_pt_system3())
|
if (machine_is_pt_system3())
|
||||||
sdram = &samsung_k4s641632d_tc75;
|
name = "K4S641632D";
|
||||||
|
|
||||||
if (machine_is_h3100())
|
if (machine_is_h3100())
|
||||||
sdram = &samsung_km416s4030ct;
|
name = "KM416S4030CT";
|
||||||
|
}
|
||||||
|
|
||||||
|
sdram = sa1110_find_sdram(name);
|
||||||
if (sdram) {
|
if (sdram) {
|
||||||
printk(KERN_DEBUG "SDRAM: tck: %d trcd: %d trp: %d"
|
printk(KERN_DEBUG "SDRAM: tck: %d trcd: %d trp: %d"
|
||||||
" twr: %d refresh: %d cas_latency: %d\n",
|
" twr: %d refresh: %d cas_latency: %d\n",
|
||||||
@@ -363,4 +383,5 @@ static int __init sa1110_clk_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_param_string(sdram, sdram_name, sizeof(sdram_name), 0);
|
||||||
arch_initcall(sa1110_clk_init);
|
arch_initcall(sa1110_clk_init);
|
||||||
|
Reference in New Issue
Block a user