Lines Matching refs:p
37 static int clock_board_calc_nslots(struct clock_board *p) in clock_board_calc_nslots() argument
39 u8 reg = upa_readb(p->clock_regs + CLOCK_STAT1) & 0xc0; in clock_board_calc_nslots()
50 if (p->clock_ver_reg) in clock_board_calc_nslots()
51 reg = upa_readb(p->clock_ver_reg); in clock_board_calc_nslots()
66 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL); in clock_board_probe() local
69 if (!p) { in clock_board_probe()
74 p->clock_freq_regs = of_ioremap(&op->resource[0], 0, in clock_board_probe()
77 if (!p->clock_freq_regs) { in clock_board_probe()
82 p->clock_regs = of_ioremap(&op->resource[1], 0, in clock_board_probe()
85 if (!p->clock_regs) { in clock_board_probe()
91 p->clock_ver_reg = of_ioremap(&op->resource[2], 0, in clock_board_probe()
94 if (!p->clock_ver_reg) { in clock_board_probe()
100 p->num_slots = clock_board_calc_nslots(p); in clock_board_probe()
102 p->leds_resource.start = (unsigned long) in clock_board_probe()
103 (p->clock_regs + CLOCK_CTRL); in clock_board_probe()
104 p->leds_resource.end = p->leds_resource.start; in clock_board_probe()
105 p->leds_resource.name = "leds"; in clock_board_probe()
107 p->leds_pdev.name = "sunfire-clockboard-leds"; in clock_board_probe()
108 p->leds_pdev.id = -1; in clock_board_probe()
109 p->leds_pdev.resource = &p->leds_resource; in clock_board_probe()
110 p->leds_pdev.num_resources = 1; in clock_board_probe()
111 p->leds_pdev.dev.parent = &op->dev; in clock_board_probe()
113 err = platform_device_register(&p->leds_pdev); in clock_board_probe()
121 p->num_slots); in clock_board_probe()
128 if (p->clock_ver_reg) in clock_board_probe()
129 of_iounmap(&op->resource[2], p->clock_ver_reg, in clock_board_probe()
133 of_iounmap(&op->resource[1], p->clock_regs, in clock_board_probe()
137 of_iounmap(&op->resource[0], p->clock_freq_regs, in clock_board_probe()
141 kfree(p); in clock_board_probe()
162 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL); in fhc_probe() local
166 if (!p) { in fhc_probe()
172 p->central = true; in fhc_probe()
174 p->pregs = of_ioremap(&op->resource[0], 0, in fhc_probe()
177 if (!p->pregs) { in fhc_probe()
182 if (p->central) { in fhc_probe()
183 reg = upa_readl(p->pregs + FHC_PREGS_BSR); in fhc_probe()
184 p->board_num = ((reg >> 16) & 1) | ((reg >> 12) & 0x0e); in fhc_probe()
186 p->board_num = of_getintprop_default(op->dev.of_node, "board#", -1); in fhc_probe()
187 if (p->board_num == -1) { in fhc_probe()
191 if (upa_readl(p->pregs + FHC_PREGS_JCTRL) & FHC_JTAG_CTRL_MENAB) in fhc_probe()
192 p->jtag_master = true; in fhc_probe()
195 if (!p->central) { in fhc_probe()
196 p->leds_resource.start = (unsigned long) in fhc_probe()
197 (p->pregs + FHC_PREGS_CTRL); in fhc_probe()
198 p->leds_resource.end = p->leds_resource.start; in fhc_probe()
199 p->leds_resource.name = "leds"; in fhc_probe()
201 p->leds_pdev.name = "sunfire-fhc-leds"; in fhc_probe()
202 p->leds_pdev.id = p->board_num; in fhc_probe()
203 p->leds_pdev.resource = &p->leds_resource; in fhc_probe()
204 p->leds_pdev.num_resources = 1; in fhc_probe()
205 p->leds_pdev.dev.parent = &op->dev; in fhc_probe()
207 err = platform_device_register(&p->leds_pdev); in fhc_probe()
214 reg = upa_readl(p->pregs + FHC_PREGS_CTRL); in fhc_probe()
216 if (!p->central) in fhc_probe()
223 upa_writel(reg, p->pregs + FHC_PREGS_CTRL); in fhc_probe()
224 upa_readl(p->pregs + FHC_PREGS_CTRL); in fhc_probe()
226 reg = upa_readl(p->pregs + FHC_PREGS_ID); in fhc_probe()
228 p->board_num, in fhc_probe()
232 (p->jtag_master ? in fhc_probe()
234 (p->central ? "(Central)" : ""))); in fhc_probe()
242 of_iounmap(&op->resource[0], p->pregs, resource_size(&op->resource[0])); in fhc_probe()
245 kfree(p); in fhc_probe()