aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/prom.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/prom.c')
-rw-r--r--arch/sparc64/kernel/prom.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index e21cd6afa709..0917c24c4f08 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -793,7 +793,7 @@ static unsigned int schizo_irq_build(struct device_node *dp,
793 return virt_irq; 793 return virt_irq;
794} 794}
795 795
796static void schizo_irq_trans_init(struct device_node *dp) 796static void __schizo_irq_trans_init(struct device_node *dp, int is_tomatillo)
797{ 797{
798 struct linux_prom64_registers *regs; 798 struct linux_prom64_registers *regs;
799 struct schizo_irq_data *irq_data; 799 struct schizo_irq_data *irq_data;
@@ -807,11 +807,24 @@ static void schizo_irq_trans_init(struct device_node *dp)
807 dp->irq_trans->data = irq_data; 807 dp->irq_trans->data = irq_data;
808 808
809 irq_data->pbm_regs = regs[0].phys_addr; 809 irq_data->pbm_regs = regs[0].phys_addr;
810 irq_data->sync_reg = regs[3].phys_addr + 0x1a18UL; 810 if (is_tomatillo)
811 irq_data->sync_reg = regs[3].phys_addr + 0x1a18UL;
812 else
813 irq_data->sync_reg = 0UL;
811 irq_data->portid = of_getintprop_default(dp, "portid", 0); 814 irq_data->portid = of_getintprop_default(dp, "portid", 0);
812 irq_data->chip_version = of_getintprop_default(dp, "version#", 0); 815 irq_data->chip_version = of_getintprop_default(dp, "version#", 0);
813} 816}
814 817
818static void schizo_irq_trans_init(struct device_node *dp)
819{
820 __schizo_irq_trans_init(dp, 0);
821}
822
823static void tomatillo_irq_trans_init(struct device_node *dp)
824{
825 __schizo_irq_trans_init(dp, 1);
826}
827
815static unsigned int pci_sun4v_irq_build(struct device_node *dp, 828static unsigned int pci_sun4v_irq_build(struct device_node *dp,
816 unsigned int devino, 829 unsigned int devino,
817 void *_data) 830 void *_data)
@@ -1050,8 +1063,8 @@ static struct irq_trans pci_irq_trans_table[] = {
1050 { "pci108e,8001", schizo_irq_trans_init }, 1063 { "pci108e,8001", schizo_irq_trans_init },
1051 { "SUNW,schizo+", schizo_irq_trans_init }, 1064 { "SUNW,schizo+", schizo_irq_trans_init },
1052 { "pci108e,8002", schizo_irq_trans_init }, 1065 { "pci108e,8002", schizo_irq_trans_init },
1053 { "SUNW,tomatillo", schizo_irq_trans_init }, 1066 { "SUNW,tomatillo", tomatillo_irq_trans_init },
1054 { "pci108e,a801", schizo_irq_trans_init }, 1067 { "pci108e,a801", tomatillo_irq_trans_init },
1055 { "SUNW,sun4v-pci", pci_sun4v_irq_trans_init }, 1068 { "SUNW,sun4v-pci", pci_sun4v_irq_trans_init },
1056}; 1069};
1057#endif 1070#endif
@@ -1079,23 +1092,22 @@ static void sun4v_vdev_irq_trans_init(struct device_node *dp)
1079 1092
1080static void irq_trans_init(struct device_node *dp) 1093static void irq_trans_init(struct device_node *dp)
1081{ 1094{
1082 const char *model;
1083#ifdef CONFIG_PCI 1095#ifdef CONFIG_PCI
1096 const char *model;
1084 int i; 1097 int i;
1085#endif 1098#endif
1086 1099
1100#ifdef CONFIG_PCI
1087 model = of_get_property(dp, "model", NULL); 1101 model = of_get_property(dp, "model", NULL);
1088 if (!model) 1102 if (!model)
1089 model = of_get_property(dp, "compatible", NULL); 1103 model = of_get_property(dp, "compatible", NULL);
1090 if (!model) 1104 if (model) {
1091 return; 1105 for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) {
1092 1106 struct irq_trans *t = &pci_irq_trans_table[i];
1093#ifdef CONFIG_PCI
1094 for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) {
1095 struct irq_trans *t = &pci_irq_trans_table[i];
1096 1107
1097 if (!strcmp(model, t->name)) 1108 if (!strcmp(model, t->name))
1098 return t->init(dp); 1109 return t->init(dp);
1110 }
1099 } 1111 }
1100#endif 1112#endif
1101#ifdef CONFIG_SBUS 1113#ifdef CONFIG_SBUS
@@ -1103,8 +1115,9 @@ static void irq_trans_init(struct device_node *dp)
1103 !strcmp(dp->name, "sbi")) 1115 !strcmp(dp->name, "sbi"))
1104 return sbus_irq_trans_init(dp); 1116 return sbus_irq_trans_init(dp);
1105#endif 1117#endif
1106 if (!strcmp(dp->name, "central")) 1118 if (!strcmp(dp->name, "fhc") &&
1107 return central_irq_trans_init(dp->child); 1119 !strcmp(dp->parent->name, "central"))
1120 return central_irq_trans_init(dp);
1108 if (!strcmp(dp->name, "virtual-devices")) 1121 if (!strcmp(dp->name, "virtual-devices"))
1109 return sun4v_vdev_irq_trans_init(dp); 1122 return sun4v_vdev_irq_trans_init(dp);
1110} 1123}
@@ -1516,7 +1529,7 @@ static char * __init get_one_property(phandle node, const char *name)
1516 return buf; 1529 return buf;
1517} 1530}
1518 1531
1519static struct device_node * __init create_node(phandle node) 1532static struct device_node * __init create_node(phandle node, struct device_node *parent)
1520{ 1533{
1521 struct device_node *dp; 1534 struct device_node *dp;
1522 1535
@@ -1525,6 +1538,7 @@ static struct device_node * __init create_node(phandle node)
1525 1538
1526 dp = prom_early_alloc(sizeof(*dp)); 1539 dp = prom_early_alloc(sizeof(*dp));
1527 dp->unique_id = unique_id++; 1540 dp->unique_id = unique_id++;
1541 dp->parent = parent;
1528 1542
1529 kref_init(&dp->kref); 1543 kref_init(&dp->kref);
1530 1544
@@ -1543,12 +1557,11 @@ static struct device_node * __init build_tree(struct device_node *parent, phandl
1543{ 1557{
1544 struct device_node *dp; 1558 struct device_node *dp;
1545 1559
1546 dp = create_node(node); 1560 dp = create_node(node, parent);
1547 if (dp) { 1561 if (dp) {
1548 *(*nextp) = dp; 1562 *(*nextp) = dp;
1549 *nextp = &dp->allnext; 1563 *nextp = &dp->allnext;
1550 1564
1551 dp->parent = parent;
1552 dp->path_component_name = build_path_component(dp); 1565 dp->path_component_name = build_path_component(dp);
1553 dp->full_name = build_full_name(dp); 1566 dp->full_name = build_full_name(dp);
1554 1567
@@ -1564,7 +1577,7 @@ void __init prom_build_devicetree(void)
1564{ 1577{
1565 struct device_node **nextp; 1578 struct device_node **nextp;
1566 1579
1567 allnodes = create_node(prom_root_node); 1580 allnodes = create_node(prom_root_node, NULL);
1568 allnodes->path_component_name = ""; 1581 allnodes->path_component_name = "";
1569 allnodes->full_name = "/"; 1582 allnodes->full_name = "/";
1570 1583