[SPARC64] auxio: Convert to pure of_device driver.

Signed-off-by: David S. Miller <davem@davemloft.net>

authored by David S. Miller and committed by David S. Miller 36a59bd8 50312ce9

+24 -49
+24 -49
arch/sparc64/kernel/auxio.c
··· 111 111 } 112 112 } 113 113 114 - static void __devinit auxio_report_dev(struct device_node *dp) 115 - { 116 - printk(KERN_INFO "AUXIO: Found device at %s\n", 117 - dp->full_name); 118 - } 119 - 120 114 static struct of_device_id auxio_match[] = { 121 115 { 122 116 .name = "auxio", ··· 120 126 121 127 MODULE_DEVICE_TABLE(of, auxio_match); 122 128 123 - #ifdef CONFIG_SBUS 124 - static int __devinit auxio_sbus_probe(struct of_device *dev, const struct of_device_id *match) 129 + static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match) 125 130 { 126 - struct sbus_dev *sdev = to_sbus_device(&dev->dev); 131 + struct device_node *dp = dev->node; 132 + unsigned long size; 127 133 128 - auxio_devtype = AUXIO_TYPE_SBUS; 129 - auxio_register = sbus_ioremap(&sdev->resource[0], 0, 130 - sdev->reg_addrs[0].reg_size, 131 - "auxiliaryIO"); 134 + if (!strcmp(dp->parent->name, "ebus")) { 135 + auxio_devtype = AUXIO_TYPE_EBUS; 136 + size = sizeof(u32); 137 + } else if (!strcmp(dp->parent->name, "sbus")) { 138 + auxio_devtype = AUXIO_TYPE_SBUS; 139 + size = 1; 140 + } else { 141 + printk("auxio: Unknown parent bus type [%s]\n", 142 + dp->parent->name); 143 + return -ENODEV; 144 + } 145 + auxio_register = of_ioremap(&dev->resource[0], 0, size, "auxio"); 132 146 if (!auxio_register) 133 147 return -ENODEV; 134 148 135 - auxio_report_dev(dev->node); 136 - return 0; 137 - } 149 + printk(KERN_INFO "AUXIO: Found device at %s\n", 150 + dp->full_name); 138 151 139 - static struct of_platform_driver auxio_sbus_driver = { 140 - .name = "auxio", 141 - .match_table = auxio_match, 142 - .probe = auxio_sbus_probe, 143 - }; 144 - #endif 145 - 146 - #ifdef CONFIG_PCI 147 - static int __devinit auxio_ebus_probe(struct of_device *dev, const struct of_device_id *match) 148 - { 149 - struct linux_ebus_device *edev = to_ebus_device(&dev->dev); 150 - 151 - auxio_devtype = AUXIO_TYPE_EBUS; 152 - auxio_register = ioremap(edev->resource[0].start, sizeof(u32)); 153 - if (!auxio_register) 154 - return -ENODEV; 155 - 156 - auxio_report_dev(dev->node); 157 - 158 - auxio_set_led(AUXIO_LED_ON); 152 + if (auxio_devtype == AUXIO_TYPE_EBUS) 153 + auxio_set_led(AUXIO_LED_ON); 159 154 160 155 return 0; 161 156 } 162 157 163 - static struct of_platform_driver auxio_ebus_driver = { 158 + static struct of_platform_driver auxio_driver = { 164 159 .name = "auxio", 165 160 .match_table = auxio_match, 166 - .probe = auxio_ebus_probe, 161 + .probe = auxio_probe, 167 162 }; 168 - #endif 169 163 170 - static int __init auxio_probe(void) 164 + static int __init auxio_init(void) 171 165 { 172 - #ifdef CONFIG_SBUS 173 - of_register_driver(&auxio_sbus_driver, &sbus_bus_type); 174 - #endif 175 - #ifdef CONFIG_PCI 176 - of_register_driver(&auxio_ebus_driver, &ebus_bus_type); 177 - #endif 178 - 179 - return 0; 166 + return of_register_driver(&auxio_driver, &of_bus_type); 180 167 } 181 168 182 169 /* Must be after subsys_initcall() so that busses are probed. Must 183 170 * be before device_initcall() because things like the floppy driver 184 171 * need to use the AUXIO register. 185 172 */ 186 - fs_initcall(auxio_probe); 173 + fs_initcall(auxio_init);