central.c (19fdb9eefb21b72edbc365b838502780c392bad6) central.c (4018294b53d1dae026880e45f174c1cc63b5d435)
1/* central.c: Central FHC driver for Sunfire/Starfire/Wildfire.
2 *
3 * Copyright (C) 1997, 1999, 2008 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/kernel.h>
7#include <linux/types.h>
8#include <linux/slab.h>

--- 135 unchanged lines hidden (view full) ---

144static struct of_device_id __initdata clock_board_match[] = {
145 {
146 .name = "clock-board",
147 },
148 {},
149};
150
151static struct of_platform_driver clock_board_driver = {
1/* central.c: Central FHC driver for Sunfire/Starfire/Wildfire.
2 *
3 * Copyright (C) 1997, 1999, 2008 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/kernel.h>
7#include <linux/types.h>
8#include <linux/slab.h>

--- 135 unchanged lines hidden (view full) ---

144static struct of_device_id __initdata clock_board_match[] = {
145 {
146 .name = "clock-board",
147 },
148 {},
149};
150
151static struct of_platform_driver clock_board_driver = {
152 .match_table = clock_board_match,
153 .probe = clock_board_probe,
152 .probe = clock_board_probe,
154 .driver = {
155 .name = "clock_board",
153 .driver = {
154 .name = "clock_board",
155 .owner = THIS_MODULE,
156 .of_match_table = clock_board_match,
156 },
157};
158
159static int __devinit fhc_probe(struct of_device *op,
160 const struct of_device_id *match)
161{
162 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
163 int err = -ENOMEM;
164 u32 reg;
165
166 if (!p) {
167 printk(KERN_ERR "fhc: Cannot allocate struct fhc\n");
168 goto out;
169 }
170
157 },
158};
159
160static int __devinit fhc_probe(struct of_device *op,
161 const struct of_device_id *match)
162{
163 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
164 int err = -ENOMEM;
165 u32 reg;
166
167 if (!p) {
168 printk(KERN_ERR "fhc: Cannot allocate struct fhc\n");
169 goto out;
170 }
171
171 if (!strcmp(op->node->parent->name, "central"))
172 if (!strcmp(op->dev.of_node->parent->name, "central"))
172 p->central = true;
173
174 p->pregs = of_ioremap(&op->resource[0], 0,
175 resource_size(&op->resource[0]),
176 "fhc_pregs");
177 if (!p->pregs) {
178 printk(KERN_ERR "fhc: Cannot map pregs\n");
179 goto out_free;
180 }
181
182 if (p->central) {
183 reg = upa_readl(p->pregs + FHC_PREGS_BSR);
184 p->board_num = ((reg >> 16) & 1) | ((reg >> 12) & 0x0e);
185 } else {
173 p->central = true;
174
175 p->pregs = of_ioremap(&op->resource[0], 0,
176 resource_size(&op->resource[0]),
177 "fhc_pregs");
178 if (!p->pregs) {
179 printk(KERN_ERR "fhc: Cannot map pregs\n");
180 goto out_free;
181 }
182
183 if (p->central) {
184 reg = upa_readl(p->pregs + FHC_PREGS_BSR);
185 p->board_num = ((reg >> 16) & 1) | ((reg >> 12) & 0x0e);
186 } else {
186 p->board_num = of_getintprop_default(op->node, "board#", -1);
187 p->board_num = of_getintprop_default(op->dev.of_node, "board#", -1);
187 if (p->board_num == -1) {
188 printk(KERN_ERR "fhc: No board# property\n");
189 goto out_unmap_pregs;
190 }
191 if (upa_readl(p->pregs + FHC_PREGS_JCTRL) & FHC_JTAG_CTRL_MENAB)
192 p->jtag_master = true;
193 }
194

--- 54 unchanged lines hidden (view full) ---

249static struct of_device_id __initdata fhc_match[] = {
250 {
251 .name = "fhc",
252 },
253 {},
254};
255
256static struct of_platform_driver fhc_driver = {
188 if (p->board_num == -1) {
189 printk(KERN_ERR "fhc: No board# property\n");
190 goto out_unmap_pregs;
191 }
192 if (upa_readl(p->pregs + FHC_PREGS_JCTRL) & FHC_JTAG_CTRL_MENAB)
193 p->jtag_master = true;
194 }
195

--- 54 unchanged lines hidden (view full) ---

250static struct of_device_id __initdata fhc_match[] = {
251 {
252 .name = "fhc",
253 },
254 {},
255};
256
257static struct of_platform_driver fhc_driver = {
257 .match_table = fhc_match,
258 .probe = fhc_probe,
258 .probe = fhc_probe,
259 .driver = {
260 .name = "fhc",
259 .driver = {
260 .name = "fhc",
261 .owner = THIS_MODULE,
262 .of_match_table = fhc_match,
261 },
262};
263
264static int __init sunfire_init(void)
265{
266 (void) of_register_driver(&fhc_driver, &of_platform_bus_type);
267 (void) of_register_driver(&clock_board_driver, &of_platform_bus_type);
268 return 0;
269}
270
271subsys_initcall(sunfire_init);
263 },
264};
265
266static int __init sunfire_init(void)
267{
268 (void) of_register_driver(&fhc_driver, &of_platform_bus_type);
269 (void) of_register_driver(&clock_board_driver, &of_platform_bus_type);
270 return 0;
271}
272
273subsys_initcall(sunfire_init);