Lines Matching +full:startup +full:- +full:sensor
1 // SPDX-License-Identifier: GPL-2.0
29 #define CP500_RECONFIG_REG 0x11 /* upper 8-bits of STARTUP register */
47 #define CP500_IS_CP035(dev) ((dev)->pci_dev->device == PCI_DEVICE_ID_KEBA_CP035)
48 #define CP500_IS_CP505(dev) ((dev)->pci_dev->device == PCI_DEVICE_ID_KEBA_CP505)
49 #define CP500_IS_CP520(dev) ((dev)->pci_dev->device == PCI_DEVICE_ID_KEBA_CP520)
57 struct cp500_dev_info startup; member
63 .startup = { 0x0000, SZ_4K },
69 .startup = { 0x0000, SZ_4K },
75 .startup = { 0x0000, SZ_4K },
101 { /* temperature sensor */
149 n += scnprintf(buf + n, max_len - n, "_FPGA_%d.%02d", in cp500_get_fpga_version()
150 cp500->version.major, cp500->version.minor); in cp500_get_fpga_version()
153 if (cp500->version.build & CP500_BUILD_TEST) in cp500_get_fpga_version()
154 n += scnprintf(buf + n, max_len - n, "Test%d", in cp500_get_fpga_version()
155 cp500->version.build & ~CP500_BUILD_TEST); in cp500_get_fpga_version()
157 n += scnprintf(buf + n, max_len - n, "\n"); in cp500_get_fpga_version()
181 if (ioread8(cp500->system_startup_addr + CP500_RECONFIG_REG) & in keep_cfg_show()
195 return -EINVAL; in keep_cfg_store()
206 iowrite8(0, cp500->system_startup_addr + CP500_RECONFIG_REG); in keep_cfg_store()
209 cp500->system_startup_addr + CP500_RECONFIG_REG); in keep_cfg_store()
234 cp500->i2c = kzalloc(sizeof(*cp500->i2c), GFP_KERNEL); in cp500_register_i2c()
235 if (!cp500->i2c) in cp500_register_i2c()
236 return -ENOMEM; in cp500_register_i2c()
238 cp500->i2c->auxdev.name = "i2c"; in cp500_register_i2c()
239 cp500->i2c->auxdev.id = 0; in cp500_register_i2c()
240 cp500->i2c->auxdev.dev.release = cp500_i2c_release; in cp500_register_i2c()
241 cp500->i2c->auxdev.dev.parent = &cp500->pci_dev->dev; in cp500_register_i2c()
242 cp500->i2c->io = (struct resource) { in cp500_register_i2c()
244 .start = (resource_size_t) cp500->sys_hwbase + in cp500_register_i2c()
245 cp500->devs->i2c.offset, in cp500_register_i2c()
246 .end = (resource_size_t) cp500->sys_hwbase + in cp500_register_i2c()
247 cp500->devs->i2c.offset + in cp500_register_i2c()
248 cp500->devs->i2c.size - 1, in cp500_register_i2c()
251 cp500->i2c->info_size = ARRAY_SIZE(cp500_i2c_info); in cp500_register_i2c()
252 cp500->i2c->info = cp500_i2c_info; in cp500_register_i2c()
254 retval = auxiliary_device_init(&cp500->i2c->auxdev); in cp500_register_i2c()
256 kfree(cp500->i2c); in cp500_register_i2c()
257 cp500->i2c = NULL; in cp500_register_i2c()
261 retval = __auxiliary_device_add(&cp500->i2c->auxdev, "keba"); in cp500_register_i2c()
263 auxiliary_device_uninit(&cp500->i2c->auxdev); in cp500_register_i2c()
264 cp500->i2c = NULL; in cp500_register_i2c()
274 struct device *dev = &cp500->pci_dev->dev; in cp500_register_auxiliary_devs()
289 if (cp500->i2c) { in cp500_unregister_auxiliary_devs()
290 cp500_unregister_dev(&cp500->i2c->auxdev); in cp500_unregister_auxiliary_devs()
291 cp500->i2c = NULL; in cp500_unregister_auxiliary_devs()
298 u32 axi_address = ioread32(cp500->system_startup_addr + CP500_AXI_REG); in cp500_axi_handler()
304 dev_err(&cp500->pci_dev->dev, "AXI response error at 0x%08x\n", in cp500_axi_handler()
312 int axi_irq = -1; in cp500_enable()
315 if (cp500->msix_num > CP500_NUM_MSIX_NO_AXI) { in cp500_enable()
316 axi_irq = pci_irq_vector(cp500->pci_dev, CP500_AXI_MSIX); in cp500_enable()
320 dev_err(&cp500->pci_dev->dev, in cp500_enable()
333 if (cp500->msix_num > CP500_NUM_MSIX_NO_AXI) { in cp500_disable()
334 axi_irq = pci_irq_vector(cp500->pci_dev, CP500_AXI_MSIX); in cp500_disable()
341 struct device *dev = &pci_dev->dev; in cp500_probe()
342 struct resource startup; in cp500_probe() local
350 return -ENOMEM; in cp500_probe()
351 cp500->pci_dev = pci_dev; in cp500_probe()
352 cp500->sys_hwbase = pci_resource_start(pci_dev, CP500_SYS_BAR); in cp500_probe()
353 cp500->ecm_hwbase = pci_resource_start(pci_dev, CP500_ECM_BAR); in cp500_probe()
354 if (!cp500->sys_hwbase || !cp500->ecm_hwbase) in cp500_probe()
355 return -ENODEV; in cp500_probe()
358 cp500->devs = &cp035_devices; in cp500_probe()
360 cp500->devs = &cp505_devices; in cp500_probe()
362 cp500->devs = &cp520_devices; in cp500_probe()
364 return -ENODEV; in cp500_probe()
371 startup = *pci_resource_n(pci_dev, CP500_SYS_BAR); in cp500_probe()
372 startup.end = startup.start + cp500->devs->startup.size - 1; in cp500_probe()
373 cp500->system_startup_addr = devm_ioremap_resource(&pci_dev->dev, in cp500_probe()
374 &startup); in cp500_probe()
375 if (IS_ERR(cp500->system_startup_addr)) { in cp500_probe()
376 ret = PTR_ERR(cp500->system_startup_addr); in cp500_probe()
380 cp500->msix_num = pci_alloc_irq_vectors(pci_dev, CP500_NUM_MSIX_NO_MMI, in cp500_probe()
382 if (cp500->msix_num < CP500_NUM_MSIX_NO_MMI) { in cp500_probe()
383 dev_err(&pci_dev->dev, in cp500_probe()
384 "Hardware does not support enough MSI-X interrupts\n"); in cp500_probe()
385 ret = -ENODEV; in cp500_probe()
389 cp500_vers = ioread32(cp500->system_startup_addr + CP500_VERSION_REG); in cp500_probe()
390 cp500->version.major = (cp500_vers & 0xff); in cp500_probe()
391 cp500->version.minor = (cp500_vers >> 8) & 0xff; in cp500_probe()
392 cp500->version.build = (cp500_vers >> 16) & 0xffff; in cp500_probe()
395 dev_info(&pci_dev->dev, "FPGA version %s", buf); in cp500_probe()