Ignore:
Timestamp:
Apr 14, 2017, 9:41:36 PM (6 weeks ago)
Author:
brainslayer
Message:

kernel update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-4.9/drivers/pci/host/pci-thunder-pem.c

    r31574 r31859  
    285285}
    286286
    287 static int thunder_pem_init(struct pci_config_window *cfg)
    288 {
    289         struct device *dev = cfg->parent;
     287static int thunder_pem_init(struct device *dev, struct pci_config_window *cfg,
     288                            struct resource *res_pem)
     289{
     290        struct thunder_pem_pci *pem_pci;
    290291        resource_size_t bar4_start;
    291         struct resource *res_pem;
    292         struct thunder_pem_pci *pem_pci;
    293         struct platform_device *pdev;
    294 
    295         /* Only OF support for now */
    296         if (!dev->of_node)
    297                 return -EINVAL;
    298292
    299293        pem_pci = devm_kzalloc(dev, sizeof(*pem_pci), GFP_KERNEL);
     
    301295                return -ENOMEM;
    302296
    303         pdev = to_platform_device(dev);
     297        pem_pci->pem_reg_base = devm_ioremap(dev, res_pem->start, 0x10000);
     298        if (!pem_pci->pem_reg_base)
     299                return -ENOMEM;
     300
     301        /*
     302         * The MSI-X BAR for the PEM and AER interrupts is located at
     303         * a fixed offset from the PEM register base.  Generate a
     304         * fragment of the synthesized Enhanced Allocation capability
     305         * structure here for the BAR.
     306         */
     307        bar4_start = res_pem->start + 0xf00000;
     308        pem_pci->ea_entry[0] = (u32)bar4_start | 2;
     309        pem_pci->ea_entry[1] = (u32)(res_pem->end - bar4_start) & ~3u;
     310        pem_pci->ea_entry[2] = (u32)(bar4_start >> 32);
     311
     312        cfg->priv = pem_pci;
     313        return 0;
     314}
     315
     316static int thunder_pem_platform_init(struct pci_config_window *cfg)
     317{
     318        struct device *dev = cfg->parent;
     319        struct platform_device *pdev = to_platform_device(dev);
     320        struct resource *res_pem;
     321
     322        if (!dev->of_node)
     323                return -EINVAL;
    304324
    305325        /*
     
    314334        }
    315335
    316         pem_pci->pem_reg_base = devm_ioremap(dev, res_pem->start, 0x10000);
    317         if (!pem_pci->pem_reg_base)
    318                 return -ENOMEM;
    319 
    320         /*
    321          * The MSI-X BAR for the PEM and AER interrupts is located at
    322          * a fixed offset from the PEM register base.  Generate a
    323          * fragment of the synthesized Enhanced Allocation capability
    324          * structure here for the BAR.
    325          */
    326         bar4_start = res_pem->start + 0xf00000;
    327         pem_pci->ea_entry[0] = (u32)bar4_start | 2;
    328         pem_pci->ea_entry[1] = (u32)(res_pem->end - bar4_start) & ~3u;
    329         pem_pci->ea_entry[2] = (u32)(bar4_start >> 32);
    330 
    331         cfg->priv = pem_pci;
    332         return 0;
     336        return thunder_pem_init(dev, cfg, res_pem);
    333337}
    334338
    335339static struct pci_ecam_ops pci_thunder_pem_ops = {
    336340        .bus_shift      = 24,
    337         .init           = thunder_pem_init,
     341        .init           = thunder_pem_platform_init,
    338342        .pci_ops        = {
    339343                .map_bus        = pci_ecam_map_bus,
Note: See TracChangeset for help on using the changeset viewer.