aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/platforms/radstone_ppc7d.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc/platforms/radstone_ppc7d.c')
-rw-r--r--arch/ppc/platforms/radstone_ppc7d.c60
1 files changed, 54 insertions, 6 deletions
diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c
index 2a99b43737a8..c30607a972d8 100644
--- a/arch/ppc/platforms/radstone_ppc7d.c
+++ b/arch/ppc/platforms/radstone_ppc7d.c
@@ -68,6 +68,7 @@
68#define PPC7D_RST_PIN 17 /* GPP17 */ 68#define PPC7D_RST_PIN 17 /* GPP17 */
69 69
70extern u32 mv64360_irq_base; 70extern u32 mv64360_irq_base;
71extern spinlock_t rtc_lock;
71 72
72static struct mv64x60_handle bh; 73static struct mv64x60_handle bh;
73static int ppc7d_has_alma; 74static int ppc7d_has_alma;
@@ -75,6 +76,11 @@ static int ppc7d_has_alma;
75extern void gen550_progress(char *, unsigned short); 76extern void gen550_progress(char *, unsigned short);
76extern void gen550_init(int, struct uart_port *); 77extern void gen550_init(int, struct uart_port *);
77 78
79/* FIXME - move to h file */
80extern int ds1337_do_command(int id, int cmd, void *arg);
81#define DS1337_GET_DATE 0
82#define DS1337_SET_DATE 1
83
78/* residual data */ 84/* residual data */
79unsigned char __res[sizeof(bd_t)]; 85unsigned char __res[sizeof(bd_t)];
80 86
@@ -253,6 +259,8 @@ static int ppc7d_show_cpuinfo(struct seq_file *m)
253 u8 val1, val2; 259 u8 val1, val2;
254 static int flash_sizes[4] = { 64, 32, 0, 16 }; 260 static int flash_sizes[4] = { 64, 32, 0, 16 };
255 static int flash_banks[4] = { 4, 3, 2, 1 }; 261 static int flash_banks[4] = { 4, 3, 2, 1 };
262 static int sdram_bank_sizes[4] = { 128, 256, 512, 1 };
263 int sdram_num_banks = 2;
256 static char *pci_modes[] = { "PCI33", "PCI66", 264 static char *pci_modes[] = { "PCI33", "PCI66",
257 "Unknown", "Unknown", 265 "Unknown", "Unknown",
258 "PCIX33", "PCIX66", 266 "PCIX33", "PCIX66",
@@ -279,13 +287,17 @@ static int ppc7d_show_cpuinfo(struct seq_file *m)
279 (val1 == PPC7D_CPLD_MB_TYPE_PLL_100) ? 100 : 287 (val1 == PPC7D_CPLD_MB_TYPE_PLL_100) ? 100 :
280 (val1 == PPC7D_CPLD_MB_TYPE_PLL_64) ? 64 : 0); 288 (val1 == PPC7D_CPLD_MB_TYPE_PLL_64) ? 64 : 0);
281 289
290 val = inb(PPC7D_CPLD_MEM_CONFIG);
291 if (val & PPC7D_CPLD_SDRAM_BANK_NUM_MASK) sdram_num_banks--;
292
282 val = inb(PPC7D_CPLD_MEM_CONFIG_EXTEND); 293 val = inb(PPC7D_CPLD_MEM_CONFIG_EXTEND);
283 val1 = val & PPC7D_CPLD_SDRAM_BANK_SIZE_MASK; 294 val1 = (val & PPC7D_CPLD_SDRAM_BANK_SIZE_MASK) >> 6;
284 seq_printf(m, "SDRAM\t\t: %d%c", 295 seq_printf(m, "SDRAM\t\t: %d banks of %d%c, total %d%c",
285 (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_128M) ? 128 : 296 sdram_num_banks,
286 (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_256M) ? 256 : 297 sdram_bank_sizes[val1],
287 (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_512M) ? 512 : 1, 298 (sdram_bank_sizes[val1] < 128) ? 'G' : 'M',
288 (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_1G) ? 'G' : 'M'); 299 sdram_num_banks * sdram_bank_sizes[val1],
300 (sdram_bank_sizes[val1] < 128) ? 'G' : 'M');
289 if (val2 & PPC7D_CPLD_MB_TYPE_ECC_FITTED_MASK) { 301 if (val2 & PPC7D_CPLD_MB_TYPE_ECC_FITTED_MASK) {
290 seq_printf(m, " [ECC %sabled]", 302 seq_printf(m, " [ECC %sabled]",
291 (val2 & PPC7D_CPLD_MB_TYPE_ECC_ENABLE_MASK) ? "en" : 303 (val2 & PPC7D_CPLD_MB_TYPE_ECC_ENABLE_MASK) ? "en" :
@@ -1236,6 +1248,38 @@ static void __init ppc7d_setup_arch(void)
1236 printk(KERN_INFO "Radstone Technology PPC7D\n"); 1248 printk(KERN_INFO "Radstone Technology PPC7D\n");
1237 if (ppc_md.progress) 1249 if (ppc_md.progress)
1238 ppc_md.progress("ppc7d_setup_arch: exit", 0); 1250 ppc_md.progress("ppc7d_setup_arch: exit", 0);
1251
1252}
1253
1254/* Real Time Clock support.
1255 * PPC7D has a DS1337 accessed by I2C.
1256 */
1257static ulong ppc7d_get_rtc_time(void)
1258{
1259 struct rtc_time tm;
1260 int result;
1261
1262 spin_lock(&rtc_lock);
1263 result = ds1337_do_command(0, DS1337_GET_DATE, &tm);
1264 spin_unlock(&rtc_lock);
1265
1266 if (result == 0)
1267 result = mktime(tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
1268
1269 return result;
1270}
1271
1272static int ppc7d_set_rtc_time(unsigned long nowtime)
1273{
1274 struct rtc_time tm;
1275 int result;
1276
1277 spin_lock(&rtc_lock);
1278 to_tm(nowtime, &tm);
1279 result = ds1337_do_command(0, DS1337_SET_DATE, &tm);
1280 spin_unlock(&rtc_lock);
1281
1282 return result;
1239} 1283}
1240 1284
1241/* This kernel command line parameter can be used to have the target 1285/* This kernel command line parameter can be used to have the target
@@ -1293,6 +1337,10 @@ static void ppc7d_init2(void)
1293 data8 |= 0x07; 1337 data8 |= 0x07;
1294 outb(data8, PPC7D_CPLD_LEDS); 1338 outb(data8, PPC7D_CPLD_LEDS);
1295 1339
1340 /* Hook up RTC. We couldn't do this earlier because we need the I2C subsystem */
1341 ppc_md.set_rtc_time = ppc7d_set_rtc_time;
1342 ppc_md.get_rtc_time = ppc7d_get_rtc_time;
1343
1296 pr_debug("%s: exit\n", __FUNCTION__); 1344 pr_debug("%s: exit\n", __FUNCTION__);
1297} 1345}
1298 1346