forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/pci/controller/pcie-rockchip-ep.c
....@@ -22,6 +22,7 @@
2222 /**
2323 * struct rockchip_pcie_ep - private data for PCIe endpoint controller driver
2424 * @rockchip: Rockchip PCIe controller
25
+ * @epc: PCI EPC device
2526 * @max_regions: maximum number of regions supported by hardware
2627 * @ob_region_map: bitmask of mapped outbound regions
2728 * @ob_addr: base addresses in the AXI bus where the outbound regions start
....@@ -263,8 +264,7 @@
263264 struct rockchip_pcie *pcie = &ep->rockchip;
264265 u32 r;
265266
266
- r = find_first_zero_bit(&ep->ob_region_map,
267
- sizeof(ep->ob_region_map) * BITS_PER_LONG);
267
+ r = find_first_zero_bit(&ep->ob_region_map, BITS_PER_LONG);
268268 /*
269269 * Region 0 is reserved for configuration space and shouldn't
270270 * be used elsewhere per TRM, so leave it out.
....@@ -499,10 +499,19 @@
499499
500500 rockchip_pcie_write(rockchip, cfg, PCIE_CORE_PHY_FUNC_CFG);
501501
502
- list_for_each_entry(epf, &epc->pci_epf, list)
503
- pci_epf_linkup(epf);
504
-
505502 return 0;
503
+}
504
+
505
+static const struct pci_epc_features rockchip_pcie_epc_features = {
506
+ .linkup_notifier = false,
507
+ .msi_capable = true,
508
+ .msix_capable = false,
509
+};
510
+
511
+static const struct pci_epc_features*
512
+rockchip_pcie_ep_get_features(struct pci_epc *epc, u8 func_no)
513
+{
514
+ return &rockchip_pcie_epc_features;
506515 }
507516
508517 static const struct pci_epc_ops rockchip_pcie_epc_ops = {
....@@ -515,6 +524,7 @@
515524 .get_msi = rockchip_pcie_ep_get_msi,
516525 .raise_irq = rockchip_pcie_ep_raise_irq,
517526 .start = rockchip_pcie_ep_start,
527
+ .get_features = rockchip_pcie_ep_get_features,
518528 };
519529
520530 static int rockchip_pcie_parse_ep_dt(struct rockchip_pcie *rockchip,
....@@ -605,7 +615,7 @@
605615 rockchip_pcie_write(rockchip, BIT(0), PCIE_CORE_PHY_FUNC_CFG);
606616
607617 err = pci_epc_mem_init(epc, rockchip->mem_res->start,
608
- resource_size(rockchip->mem_res));
618
+ resource_size(rockchip->mem_res), PAGE_SIZE);
609619 if (err < 0) {
610620 dev_err(dev, "failed to initialize the memory space\n");
611621 goto err_uninit_port;