patch-2.2.17 linux/arch/ppc/kernel/pmac_setup.c
Next file: linux/arch/ppc/kernel/pmac_support.c
Previous file: linux/arch/ppc/kernel/pmac_pic.c
Back to the patch index
Back to the overall index
- Lines: 244
- Date:
Mon Sep 4 18:39:16 2000
- Orig file:
v2.2.16/arch/ppc/kernel/pmac_setup.c
- Orig date:
Mon Sep 4 18:37:47 2000
diff -u --recursive --new-file v2.2.16/arch/ppc/kernel/pmac_setup.c linux/arch/ppc/kernel/pmac_setup.c
@@ -58,12 +58,13 @@
#include <asm/ide.h>
#include <asm/machdep.h>
-#include "time.h"
+#include <asm/time.h>
#include "local_irq.h"
#include "pmac_pic.h"
#undef SHOW_GATWICK_IRQS
+void pmac_time_init(void);
unsigned long pmac_get_rtc_time(void);
int pmac_set_rtc_time(unsigned long nowtime);
void pmac_read_rtc_time(void);
@@ -87,6 +88,7 @@
extern char pckbd_unexpected_up(unsigned char keycode);
extern void pckbd_leds(unsigned char leds);
extern void pckbd_init_hw(void);
+extern void pmac_nvram_update(void);
unsigned char drive_info;
@@ -95,11 +97,14 @@
extern char saved_command_line[];
+extern int pmac_newworld;
+
#define DEFAULT_ROOT_DEVICE 0x0801 /* sda1 - slightly silly choice */
extern void zs_kgdb_hook(int tty_num);
static void ohare_init(void);
static void init_p2pbridge(void);
+static void init_uninorth(void);
__pmac
int
@@ -187,6 +192,10 @@
len += sprintf(buffer+len, "l2cr override\t: 0x%x\n", *l2cr);
}
}
+
+ /* Indicate newworld/oldworld */
+ len += sprintf(buffer+len, "pmac-generation\t: %s\n",
+ pmac_newworld ? "NewWorld" : "OldWorld");
return len;
}
@@ -246,8 +255,10 @@
if (fp != 0) {
switch (_get_PVR() >> 16) {
case 4: /* 604 */
+ case 8: /* G3 */
case 9: /* 604e */
case 10: /* mach V (604ev5) */
+ case 12: /* G4 */
case 20: /* 620 */
loops_per_sec = *fp;
break;
@@ -266,9 +277,10 @@
*memory_start_p = pmac_find_bridges(*memory_start_p, *memory_end_p);
init_p2pbridge();
-
+ init_uninorth();
+
/* Checks "l2cr-value" property in the registry */
- if ( (_get_PVR() >> 16) == 8) {
+ if ( (_get_PVR() >> 16) == 8 || (_get_PVR() >> 16) == 12 ) {
struct device_node *np = find_devices("cpus");
if (np == 0)
np = find_type_devices("cpu");
@@ -288,7 +300,6 @@
printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
? "enabled" : "disabled");
-
feature_init();
#ifdef CONFIG_KGDB
@@ -298,6 +309,8 @@
find_via_cuda();
find_via_pmu();
+ pmac_nvram_init();
+
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
@@ -355,6 +368,38 @@
}
}
+__initfunc(static void init_uninorth(void))
+{
+ /*
+ * Turns OFF the gmac clock. The gmac driver will turn
+ * it back ON when the interface is enabled. This save
+ * power on portables.
+ *
+ * Note: We could also try to turn OFF the PHY. Since this
+ * has to be done by both the gmac driver and this code,
+ * I'll probably end-up moving some of this out of the
+ * modular gmac driver into a non-modular stub containing
+ * some basic PHY management and power management stuffs
+ */
+ struct device_node* uni_n = find_devices("uni-n");
+ struct device_node* gmac = find_devices("ethernet");
+ unsigned long* addr;
+
+ if (!uni_n || uni_n->n_addrs < 1)
+ return;
+ addr = ioremap(uni_n->addrs[0].address, 0x300);
+
+ while(gmac) {
+ if (device_is_compatible(gmac, "gmac"))
+ break;
+ gmac = gmac->next;
+ }
+ if (gmac) {
+ *(addr + 8) &= ~0x00000002UL;
+ eieio();
+ }
+}
+
extern char *bootpath;
extern char *bootdevice;
void *boot_host;
@@ -366,7 +411,6 @@
pmac_init2(void))
{
adb_init();
- pmac_nvram_init();
media_bay_init();
}
@@ -402,14 +446,13 @@
#endif
#ifdef CONFIG_BLK_DEV_IDE_PMAC
-extern int pmac_ide_count;
-extern struct device_node *pmac_ide_node[];
-static int ide_majors[] = { 3, 22, 33, 34, 56, 57 };
+
+extern kdev_t pmac_find_ide_boot(char *bootdevice, int n);
__initfunc(kdev_t find_ide_boot(void))
{
char *p;
- int i, n;
+ int n;
if (bootdevice == NULL)
return 0;
@@ -418,18 +461,7 @@
return 0;
n = p - bootdevice;
- /*
- * Look through the list of IDE interfaces for this one.
- */
- for (i = 0; i < pmac_ide_count; ++i) {
- char *name = pmac_ide_node[i]->full_name;
- if (memcmp(name, bootdevice, n) == 0 && name[n] == 0) {
- /* XXX should cope with the 2nd drive as well... */
- return MKDEV(ide_majors[i], 0);
- }
- }
-
- return 0;
+ return pmac_find_ide_boot(bootdevice, n);
}
#endif /* CONFIG_BLK_DEV_IDE_PMAC */
@@ -468,7 +500,7 @@
if (boot_dev == 0 || dev == boot_dev) {
ROOT_DEV = MKDEV(MAJOR(dev), MINOR(dev) + part);
boot_dev = NODEV;
- printk(" (root)");
+ printk(" (root on %d)", part);
}
}
@@ -477,6 +509,8 @@
{
struct adb_request req;
+ pmac_nvram_update();
+
switch (adb_hardware) {
case ADB_VIACUDA:
cuda_request(&req, NULL, 2, CUDA_PACKET,
@@ -497,6 +531,8 @@
{
struct adb_request req;
+ pmac_nvram_update();
+
switch (adb_hardware) {
case ADB_VIACUDA:
cuda_request(&req, NULL, 2, CUDA_PACKET,
@@ -515,7 +551,6 @@
void
pmac_halt(void)
{
- pmac_power_off();
}
@@ -541,11 +576,15 @@
return 0;
}
+#if defined(CONFIG_BLK_DEV_IDE_PMAC)
+extern ide_ioreg_t pmac_ide_get_base(int index);
+#endif
+
ide_ioreg_t
pmac_ide_default_io_base(int index)
{
#if defined(CONFIG_BLK_DEV_IDE_PMAC)
- return pmac_ide_regbase[index];
+ return pmac_ide_get_base(index);
#else
return 0;
#endif
@@ -611,7 +650,7 @@
ppc_md.power_off = pmac_power_off;
ppc_md.halt = pmac_halt;
- ppc_md.time_init = NULL;
+ ppc_md.time_init = pmac_time_init;
ppc_md.set_rtc_time = pmac_set_rtc_time;
ppc_md.get_rtc_time = pmac_get_rtc_time;
ppc_md.calibrate_decr = pmac_calibrate_decr;
@@ -625,6 +664,7 @@
ppc_md.kbd_init_hw = mackbd_init_hw;
#ifdef CONFIG_MAGIC_SYSRQ
ppc_md.kbd_sysrq_xlate = mackbd_sysrq_xlate;
+ ppc_md.SYSRQ_KEY = 0x69;
#endif
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)