aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-09-10 06:15:56 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-11 02:11:57 -0400
commit1c03a55cdf309d0939e881b313abbe7e9a67d95e (patch)
treed965f7cbe122dec580656d609521716b3fdd71e7 /arch/sparc64
parenta21cff3e5e39c087b5a4c5efb20f1744475c556e (diff)
sparc64: Create and use psycho_pbm_init_common().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/pci_psycho.c32
-rw-r--r--arch/sparc64/kernel/pci_sabre.c19
-rw-r--r--arch/sparc64/kernel/psycho_common.c22
-rw-r--r--arch/sparc64/kernel/psycho_common.h4
4 files changed, 31 insertions, 46 deletions
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 4681e3d8b5fb..2de51fb34ee7 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -895,35 +895,8 @@ static void psycho_pbm_strbuf_init(struct pci_pbm_info *pbm,
895static void __init psycho_pbm_init(struct pci_pbm_info *pbm, 895static void __init psycho_pbm_init(struct pci_pbm_info *pbm,
896 struct of_device *op, int is_pbm_a) 896 struct of_device *op, int is_pbm_a)
897{ 897{
898 struct device_node *dp = op->node; 898 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO);
899
900 pbm->next = pci_pbm_root;
901 pci_pbm_root = pbm;
902
903 pbm->numa_node = -1;
904
905 pbm->pci_ops = &sun4u_pci_ops;
906 pbm->config_space_reg_bits = 8;
907
908 pbm->index = pci_num_pbms++;
909
910 pbm->chip_type = PBM_CHIP_TYPE_PSYCHO;
911 pbm->chip_version = of_getintprop_default(dp, "version#", 0);
912 pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
913
914 pbm->op = op;
915 pbm->name = dp->full_name;
916
917 printk(KERN_INFO "%s: PSYCHO PCI Bus Module ver[%x:%x]\n",
918 pbm->name,
919 pbm->chip_version, pbm->chip_revision);
920
921 pci_determine_mem_io_space(pbm);
922
923 pci_get_pbm_props(pbm);
924
925 psycho_pbm_strbuf_init(pbm, is_pbm_a); 899 psycho_pbm_strbuf_init(pbm, is_pbm_a);
926
927 psycho_scan_bus(pbm, &op->dev); 900 psycho_scan_bus(pbm, &op->dev);
928} 901}
929 902
@@ -1009,6 +982,9 @@ static int __devinit psycho_probe(struct of_device *op,
1009 982
1010 psycho_pbm_init(pbm, op, is_pbm_a); 983 psycho_pbm_init(pbm, op, is_pbm_a);
1011 984
985 pbm->next = pci_pbm_root;
986 pci_pbm_root = pbm;
987
1012 if (pbm->sibling) 988 if (pbm->sibling)
1013 pbm->sibling->sibling = pbm; 989 pbm->sibling->sibling = pbm;
1014 990
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index a3a276de75ab..ae11d67388e1 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -678,24 +678,7 @@ static void __init sabre_scan_bus(struct pci_pbm_info *pbm,
678static void __init sabre_pbm_init(struct pci_pbm_info *pbm, 678static void __init sabre_pbm_init(struct pci_pbm_info *pbm,
679 struct of_device *op) 679 struct of_device *op)
680{ 680{
681 struct device_node *dp = op->node; 681 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE);
682
683 pbm->name = dp->full_name;
684 printk("%s: SABRE PCI Bus Module\n", pbm->name);
685
686 pbm->numa_node = -1;
687
688 pbm->pci_ops = &sun4u_pci_ops;
689 pbm->config_space_reg_bits = 8;
690
691 pbm->index = pci_num_pbms++;
692
693 pbm->chip_type = PBM_CHIP_TYPE_SABRE;
694 pbm->op = op;
695 pci_get_pbm_props(pbm);
696
697 pci_determine_mem_io_space(pbm);
698
699 sabre_scan_bus(pbm, &op->dev); 682 sabre_scan_bus(pbm, &op->dev);
700} 683}
701 684
diff --git a/arch/sparc64/kernel/psycho_common.c b/arch/sparc64/kernel/psycho_common.c
index 07acc13637b3..1b4d462513df 100644
--- a/arch/sparc64/kernel/psycho_common.c
+++ b/arch/sparc64/kernel/psycho_common.c
@@ -91,3 +91,25 @@ int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
91 return 0; 91 return 0;
92 92
93} 93}
94
95void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op,
96 const char *chip_name, int chip_type)
97{
98 struct device_node *dp = op->node;
99
100 pbm->name = dp->full_name;
101 pbm->numa_node = -1;
102 pbm->chip_type = chip_type;
103 pbm->chip_version = of_getintprop_default(dp, "version#", 0);
104 pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
105 pbm->op = op;
106 pbm->pci_ops = &sun4u_pci_ops;
107 pbm->config_space_reg_bits = 8;
108 pbm->index = pci_num_pbms++;
109 pci_get_pbm_props(pbm);
110 pci_determine_mem_io_space(pbm);
111
112 printk(KERN_INFO "%s: %s PCI Bus Module ver[%x:%x]\n",
113 pbm->name, chip_name,
114 pbm->chip_version, pbm->chip_revision);
115}
diff --git a/arch/sparc64/kernel/psycho_common.h b/arch/sparc64/kernel/psycho_common.h
index bffaff57d5e0..adfbadb6986e 100644
--- a/arch/sparc64/kernel/psycho_common.h
+++ b/arch/sparc64/kernel/psycho_common.h
@@ -5,4 +5,8 @@ extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
5 u32 dvma_offset, u32 dma_mask, 5 u32 dvma_offset, u32 dma_mask,
6 unsigned long write_complete_offset); 6 unsigned long write_complete_offset);
7 7
8extern void psycho_pbm_init_common(struct pci_pbm_info *pbm,
9 struct of_device *op,
10 const char *chip_name, int chip_type);
11
8#endif /* _PSYCHO_COMMON_H */ 12#endif /* _PSYCHO_COMMON_H */