Lines Matching refs:gdev
139 static u32 gisb_read(struct brcmstb_gisb_arb_device *gdev, int reg) in gisb_read() argument
141 int offset = gdev->gisb_offsets[reg]; in gisb_read()
151 if (gdev->big_endian) in gisb_read()
152 return ioread32be(gdev->base + offset); in gisb_read()
154 return ioread32(gdev->base + offset); in gisb_read()
157 static u64 gisb_read_address(struct brcmstb_gisb_arb_device *gdev) in gisb_read_address() argument
161 value = gisb_read(gdev, ARB_ERR_CAP_ADDR); in gisb_read_address()
162 value |= (u64)gisb_read(gdev, ARB_ERR_CAP_HI_ADDR) << 32; in gisb_read_address()
167 static u64 gisb_read_bp_address(struct brcmstb_gisb_arb_device *gdev) in gisb_read_bp_address() argument
171 value = gisb_read(gdev, ARB_BP_CAP_ADDR); in gisb_read_bp_address()
172 value |= (u64)gisb_read(gdev, ARB_BP_CAP_HI_ADDR) << 32; in gisb_read_bp_address()
177 static void gisb_write(struct brcmstb_gisb_arb_device *gdev, u32 val, int reg) in gisb_write() argument
179 int offset = gdev->gisb_offsets[reg]; in gisb_write()
184 if (gdev->big_endian) in gisb_write()
185 iowrite32be(val, gdev->base + offset); in gisb_write()
187 iowrite32(val, gdev->base + offset); in gisb_write()
194 struct brcmstb_gisb_arb_device *gdev = dev_get_drvdata(dev); in gisb_arb_get_timeout() local
197 mutex_lock(&gdev->lock); in gisb_arb_get_timeout()
198 timeout = gisb_read(gdev, ARB_TIMER); in gisb_arb_get_timeout()
199 mutex_unlock(&gdev->lock); in gisb_arb_get_timeout()
208 struct brcmstb_gisb_arb_device *gdev = dev_get_drvdata(dev); in gisb_arb_set_timeout() local
218 mutex_lock(&gdev->lock); in gisb_arb_set_timeout()
219 gisb_write(gdev, val, ARB_TIMER); in gisb_arb_set_timeout()
220 mutex_unlock(&gdev->lock); in gisb_arb_set_timeout()
226 brcmstb_gisb_master_to_str(struct brcmstb_gisb_arb_device *gdev, in brcmstb_gisb_master_to_str() argument
229 u32 mask = gdev->valid_mask & masters; in brcmstb_gisb_master_to_str()
234 return gdev->master_names[ffs(mask) - 1]; in brcmstb_gisb_master_to_str()
237 static int brcmstb_gisb_arb_decode_addr(struct brcmstb_gisb_arb_device *gdev, in brcmstb_gisb_arb_decode_addr() argument
246 cap_status = gisb_read(gdev, ARB_ERR_CAP_STATUS); in brcmstb_gisb_arb_decode_addr()
253 arb_addr = gisb_read_address(gdev); in brcmstb_gisb_arb_decode_addr()
254 master = gisb_read(gdev, ARB_ERR_CAP_MASTER); in brcmstb_gisb_arb_decode_addr()
256 m_name = brcmstb_gisb_master_to_str(gdev, master); in brcmstb_gisb_arb_decode_addr()
269 gisb_write(gdev, ARB_ERR_CAP_CLEAR, ARB_ERR_CAP_CLR); in brcmstb_gisb_arb_decode_addr()
278 struct brcmstb_gisb_arb_device *gdev; in brcmstb_bus_error_handler() local
281 list_for_each_entry(gdev, &brcmstb_gisb_arb_device_list, next) { in brcmstb_bus_error_handler()
282 cap_status = gisb_read(gdev, ARB_ERR_CAP_STATUS); in brcmstb_bus_error_handler()
290 ret |= brcmstb_gisb_arb_decode_addr(gdev, "bus error"); in brcmstb_bus_error_handler()
313 struct brcmstb_gisb_arb_device *gdev = dev_id; in brcmstb_gisb_bp_handler() local
320 bp_status = gisb_read(gdev, ARB_BP_CAP_STATUS); in brcmstb_gisb_bp_handler()
327 arb_addr = gisb_read_bp_address(gdev); in brcmstb_gisb_bp_handler()
328 master = gisb_read(gdev, ARB_BP_CAP_MASTER); in brcmstb_gisb_bp_handler()
330 m_name = brcmstb_gisb_master_to_str(gdev, master); in brcmstb_gisb_bp_handler()
341 gisb_write(gdev, ARB_ERR_CAP_CLEAR, ARB_ERR_CAP_CLR); in brcmstb_gisb_bp_handler()
363 struct brcmstb_gisb_arb_device *gdev; in dump_gisb_error() local
370 list_for_each_entry(gdev, &brcmstb_gisb_arb_device_list, next) in dump_gisb_error()
371 brcmstb_gisb_arb_decode_addr(gdev, reason); in dump_gisb_error()
401 struct brcmstb_gisb_arb_device *gdev; in brcmstb_gisb_arb_probe() local
413 gdev = devm_kzalloc(&pdev->dev, sizeof(*gdev), GFP_KERNEL); in brcmstb_gisb_arb_probe()
414 if (!gdev) in brcmstb_gisb_arb_probe()
417 mutex_init(&gdev->lock); in brcmstb_gisb_arb_probe()
418 INIT_LIST_HEAD(&gdev->next); in brcmstb_gisb_arb_probe()
420 gdev->base = devm_ioremap_resource(&pdev->dev, r); in brcmstb_gisb_arb_probe()
421 if (IS_ERR(gdev->base)) in brcmstb_gisb_arb_probe()
422 return PTR_ERR(gdev->base); in brcmstb_gisb_arb_probe()
429 gdev->gisb_offsets = of_id->data; in brcmstb_gisb_arb_probe()
430 gdev->big_endian = of_device_is_big_endian(dn); in brcmstb_gisb_arb_probe()
434 gdev); in brcmstb_gisb_arb_probe()
440 gdev); in brcmstb_gisb_arb_probe()
448 gdev); in brcmstb_gisb_arb_probe()
455 &gdev->valid_mask)) in brcmstb_gisb_arb_probe()
456 gdev->valid_mask = 0xffffffff; in brcmstb_gisb_arb_probe()
463 if (hweight_long(gdev->valid_mask) == num_masters) { in brcmstb_gisb_arb_probe()
464 first = ffs(gdev->valid_mask) - 1; in brcmstb_gisb_arb_probe()
465 last = fls(gdev->valid_mask) - 1; in brcmstb_gisb_arb_probe()
468 if (!(gdev->valid_mask & BIT(i))) in brcmstb_gisb_arb_probe()
473 &gdev->master_names[i]); in brcmstb_gisb_arb_probe()
482 platform_set_drvdata(pdev, gdev); in brcmstb_gisb_arb_probe()
484 list_add_tail(&gdev->next, &brcmstb_gisb_arb_device_list); in brcmstb_gisb_arb_probe()
505 struct brcmstb_gisb_arb_device *gdev = dev_get_drvdata(dev); in brcmstb_gisb_arb_suspend() local
507 gdev->saved_timeout = gisb_read(gdev, ARB_TIMER); in brcmstb_gisb_arb_suspend()
517 struct brcmstb_gisb_arb_device *gdev = dev_get_drvdata(dev); in brcmstb_gisb_arb_resume_noirq() local
519 gisb_write(gdev, gdev->saved_timeout, ARB_TIMER); in brcmstb_gisb_arb_resume_noirq()