• Home
  • Raw
  • Download

Lines Matching full:v3

3  * Support for V3 Semiconductor PCI Local Bus to PCI Bridge
254 * The V3 PCI interface chip in Integrator provides several windows from
267 * There are three V3 windows, each described by a pair of V3 registers.
294 * The V3 chip translates an address by checking its range within
298 * LB_BASE1/LB_MAP1, the V3 will use the translation from
318 struct v3_pci *v3 = bus->sysdata; in v3_map_bus() local
370 writel(v3_addr_to_lb_base(v3->non_pre_mem) | in v3_map_bus()
372 v3->base + V3_LB_BASE0); in v3_map_bus()
378 writel(v3_addr_to_lb_base(v3->config_mem) | in v3_map_bus()
380 v3->base + V3_LB_BASE1); in v3_map_bus()
381 writew(mapaddress, v3->base + V3_LB_MAP1); in v3_map_bus()
383 return v3->config_base + address + offset; in v3_map_bus()
386 static void v3_unmap_bus(struct v3_pci *v3) in v3_unmap_bus() argument
391 writel(v3_addr_to_lb_base(v3->pre_mem) | in v3_unmap_bus()
394 v3->base + V3_LB_BASE1); in v3_unmap_bus()
395 writew(v3_addr_to_lb_map(v3->pre_bus_addr) | in v3_unmap_bus()
397 v3->base + V3_LB_MAP1); in v3_unmap_bus()
402 writel(v3_addr_to_lb_base(v3->non_pre_mem) | in v3_unmap_bus()
404 v3->base + V3_LB_BASE0); in v3_unmap_bus()
410 struct v3_pci *v3 = bus->sysdata; in v3_pci_read_config() local
417 v3_unmap_bus(v3); in v3_pci_read_config()
424 struct v3_pci *v3 = bus->sysdata; in v3_pci_write_config() local
431 v3_unmap_bus(v3); in v3_pci_write_config()
443 struct v3_pci *v3 = data; in v3_irq() local
444 struct device *dev = v3->dev; in v3_irq()
447 status = readw(v3->base + V3_PCI_STAT); in v3_irq()
456 writew(status, v3->base + V3_PCI_STAT); in v3_irq()
458 status = readb(v3->base + V3_LB_ISTAT); in v3_irq()
476 writeb(0, v3->base + V3_LB_ISTAT); in v3_irq()
477 if (v3->map) in v3_irq()
478 regmap_write(v3->map, INTEGRATOR_SC_PCI_OFFSET, in v3_irq()
485 static int v3_integrator_init(struct v3_pci *v3) in v3_integrator_init() argument
489 v3->map = in v3_integrator_init()
491 if (IS_ERR(v3->map)) { in v3_integrator_init()
492 dev_err(v3->dev, "no syscon\n"); in v3_integrator_init()
496 regmap_read(v3->map, INTEGRATOR_SC_PCI_OFFSET, &val); in v3_integrator_init()
498 regmap_write(v3->map, INTEGRATOR_SC_PCI_OFFSET, in v3_integrator_init()
507 writel(0x6200, v3->base + V3_LB_IO_BASE); in v3_integrator_init()
511 writeb(0xaa, v3->base + V3_MAIL_DATA); in v3_integrator_init()
512 writeb(0x55, v3->base + V3_MAIL_DATA + 4); in v3_integrator_init()
513 } while (readb(v3->base + V3_MAIL_DATA) != 0xaa && in v3_integrator_init()
514 readb(v3->base + V3_MAIL_DATA) != 0x55); in v3_integrator_init()
517 dev_info(v3->dev, "initialized PCI V3 Integrator/AP integration\n"); in v3_integrator_init()
522 static int v3_pci_setup_resource(struct v3_pci *v3, in v3_pci_setup_resource() argument
527 struct device *dev = v3->dev; in v3_pci_setup_resource()
535 io->name = "V3 PCI I/O"; in v3_pci_setup_resource()
536 v3->io_mem = io_base; in v3_pci_setup_resource()
537 v3->io_bus_addr = io->start - win->offset; in v3_pci_setup_resource()
539 io, &v3->io_bus_addr); in v3_pci_setup_resource()
548 writel(v3_addr_to_lb_base2(v3->io_mem) | in v3_pci_setup_resource()
550 v3->base + V3_LB_BASE2); in v3_pci_setup_resource()
551 writew(v3_addr_to_lb_map2(v3->io_bus_addr), in v3_pci_setup_resource()
552 v3->base + V3_LB_MAP2); in v3_pci_setup_resource()
557 mem->name = "V3 PCI PRE-MEM"; in v3_pci_setup_resource()
558 v3->pre_mem = mem->start; in v3_pci_setup_resource()
559 v3->pre_bus_addr = mem->start - win->offset; in v3_pci_setup_resource()
561 mem, &v3->pre_bus_addr); in v3_pci_setup_resource()
566 if (v3->non_pre_mem && in v3_pci_setup_resource()
567 (mem->start != v3->non_pre_mem + SZ_256M)) { in v3_pci_setup_resource()
573 writel(v3_addr_to_lb_base(v3->pre_mem) | in v3_pci_setup_resource()
577 v3->base + V3_LB_BASE1); in v3_pci_setup_resource()
578 writew(v3_addr_to_lb_map(v3->pre_bus_addr) | in v3_pci_setup_resource()
580 v3->base + V3_LB_MAP1); in v3_pci_setup_resource()
582 mem->name = "V3 PCI NON-PRE-MEM"; in v3_pci_setup_resource()
583 v3->non_pre_mem = mem->start; in v3_pci_setup_resource()
584 v3->non_pre_bus_addr = mem->start - win->offset; in v3_pci_setup_resource()
586 mem, &v3->non_pre_bus_addr); in v3_pci_setup_resource()
593 writel(v3_addr_to_lb_base(v3->non_pre_mem) | in v3_pci_setup_resource()
596 v3->base + V3_LB_BASE0); in v3_pci_setup_resource()
597 writew(v3_addr_to_lb_map(v3->non_pre_bus_addr) | in v3_pci_setup_resource()
599 v3->base + V3_LB_MAP0); in v3_pci_setup_resource()
615 static int v3_get_dma_range_config(struct v3_pci *v3, in v3_get_dma_range_config() argument
619 struct device *dev = v3->dev; in v3_get_dma_range_config()
675 dev_err(v3->dev, "illegal dma memory chunk size\n"); in v3_get_dma_range_config()
692 static int v3_pci_parse_map_dma_ranges(struct v3_pci *v3, in v3_pci_parse_map_dma_ranges() argument
697 struct device *dev = v3->dev; in v3_pci_parse_map_dma_ranges()
712 ret = v3_get_dma_range_config(v3, &range, &pci_base, &pci_map); in v3_pci_parse_map_dma_ranges()
717 writel(pci_base, v3->base + V3_PCI_BASE0); in v3_pci_parse_map_dma_ranges()
718 writel(pci_map, v3->base + V3_PCI_MAP0); in v3_pci_parse_map_dma_ranges()
720 writel(pci_base, v3->base + V3_PCI_BASE1); in v3_pci_parse_map_dma_ranges()
721 writel(pci_map, v3->base + V3_PCI_MAP1); in v3_pci_parse_map_dma_ranges()
738 struct v3_pci *v3; in v3_pci_probe() local
746 host = devm_pci_alloc_host_bridge(dev, sizeof(*v3)); in v3_pci_probe()
756 v3 = pci_host_bridge_priv(host); in v3_pci_probe()
757 host->sysdata = v3; in v3_pci_probe()
758 v3->dev = dev; in v3_pci_probe()
773 v3->base = devm_ioremap_resource(dev, regs); in v3_pci_probe()
774 if (IS_ERR(v3->base)) in v3_pci_probe()
775 return PTR_ERR(v3->base); in v3_pci_probe()
778 * of the V3 controller itself, verify that this is the same in v3_pci_probe()
781 if (readl(v3->base + V3_LB_IO_BASE) != (regs->start >> 16)) in v3_pci_probe()
783 readl(v3->base + V3_LB_IO_BASE), regs); in v3_pci_probe()
791 v3->config_mem = regs->start; in v3_pci_probe()
792 v3->config_base = devm_ioremap_resource(dev, regs); in v3_pci_probe()
793 if (IS_ERR(v3->config_base)) in v3_pci_probe()
794 return PTR_ERR(v3->config_base); in v3_pci_probe()
812 "PCIv3 error", v3); in v3_pci_probe()
821 * Unlock V3 registers, but only if they were previously locked. in v3_pci_probe()
823 if (readw(v3->base + V3_SYSTEM) & V3_SYSTEM_M_LOCK) in v3_pci_probe()
824 writew(V3_SYSTEM_UNLOCK, v3->base + V3_SYSTEM); in v3_pci_probe()
827 val = readw(v3->base + V3_PCI_CMD); in v3_pci_probe()
829 writew(val, v3->base + V3_PCI_CMD); in v3_pci_probe()
832 val = readw(v3->base + V3_SYSTEM); in v3_pci_probe()
834 writew(val, v3->base + V3_SYSTEM); in v3_pci_probe()
837 val = readw(v3->base + V3_PCI_CFG); in v3_pci_probe()
839 writew(val, v3->base + V3_PCI_CFG); in v3_pci_probe()
842 val = readw(v3->base + V3_LB_CFG); in v3_pci_probe()
847 writew(val, v3->base + V3_LB_CFG); in v3_pci_probe()
850 val = readw(v3->base + V3_PCI_CMD); in v3_pci_probe()
852 writew(val, v3->base + V3_PCI_CMD); in v3_pci_probe()
856 ret = v3_pci_setup_resource(v3, io_base, host, win); in v3_pci_probe()
862 ret = v3_pci_parse_map_dma_ranges(v3, np); in v3_pci_probe()
871 writel(0x00000000, v3->base + V3_PCI_IO_BASE); in v3_pci_probe()
879 writew(val, v3->base + V3_PCI_CFG); in v3_pci_probe()
882 * Set the V3 FIFO such that writes have higher priority than in v3_pci_probe()
890 v3->base + V3_FIFO_PRIORITY); in v3_pci_probe()
897 writeb(0, v3->base + V3_LB_ISTAT); in v3_pci_probe()
898 val = readw(v3->base + V3_LB_CFG); in v3_pci_probe()
900 writew(val, v3->base + V3_LB_CFG); in v3_pci_probe()
902 v3->base + V3_LB_IMASK); in v3_pci_probe()
906 ret = v3_integrator_init(v3); in v3_pci_probe()
912 val = readw(v3->base + V3_PCI_CMD); in v3_pci_probe()
914 writew(val, v3->base + V3_PCI_CMD); in v3_pci_probe()
917 writeb(0, v3->base + V3_LB_ISTAT); in v3_pci_probe()
920 v3->base + V3_LB_IMASK); in v3_pci_probe()
923 val = readw(v3->base + V3_SYSTEM); in v3_pci_probe()
925 writew(val, v3->base + V3_SYSTEM); in v3_pci_probe()
930 val = readw(v3->base + V3_SYSTEM); in v3_pci_probe()
932 writew(val, v3->base + V3_SYSTEM); in v3_pci_probe()
940 v3->bus = host->bus; in v3_pci_probe()
942 pci_bus_assign_resources(v3->bus); in v3_pci_probe()
943 pci_bus_add_devices(v3->bus); in v3_pci_probe()
950 .compatible = "v3,v360epc-pci",
957 .name = "pci-v3-semi",