mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
Merge branch 'pci/host/mt7621'
- Declare mt7621_pci_ops static (Sergio Paracuellos) - Give pcibios_root_bridge_prepare() access to host bridge windows (Sergio Paracuellos) - Move MIPS I/O coherency unit setup from driver to pcibios_root_bridge_prepare() (Sergio Paracuellos) - Add missing MODULE_LICENSE() (Sergio Paracuellos) - Allow COMPILE_TEST for all arches (Sergio Paracuellos) * pci/host/mt7621: PCI: mt7621: Allow COMPILE_TEST for all arches PCI: mt7621: Add missing MODULE_LICENSE() PCI: mt7621: Move MIPS setup to pcibios_root_bridge_prepare() PCI: Let pcibios_root_bridge_prepare() access bridge->windows PCI: mt7621: Declare mt7621_pci_ops static
This commit is contained in:
commit
fc10f9d667
@ -10,6 +10,8 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sys_soc.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
#include <asm/bootinfo.h>
|
||||
#include <asm/mipsregs.h>
|
||||
@ -22,6 +24,35 @@
|
||||
|
||||
static void *detect_magic __initdata = detect_memory_region;
|
||||
|
||||
int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
|
||||
{
|
||||
struct resource_entry *entry;
|
||||
resource_size_t mask;
|
||||
|
||||
entry = resource_list_first_type(&bridge->windows, IORESOURCE_MEM);
|
||||
if (!entry) {
|
||||
pr_err("Cannot get memory resource\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (mips_cps_numiocu(0)) {
|
||||
/*
|
||||
* Hardware doesn't accept mask values with 1s after
|
||||
* 0s (e.g. 0xffef), so warn if that's happen
|
||||
*/
|
||||
mask = ~(entry->res->end - entry->res->start) & CM_GCR_REGn_MASK_ADDRMASK;
|
||||
WARN_ON(mask && BIT(ffz(~mask)) - 1 != ~mask);
|
||||
|
||||
write_gcr_reg1_base(entry->res->start);
|
||||
write_gcr_reg1_mask(mask | CM_GCR_REGn_MASK_CMTGT_IOCU0);
|
||||
pr_info("PCI coherence region base: 0x%08llx, mask/settings: 0x%08llx\n",
|
||||
(unsigned long long)read_gcr_reg1_base(),
|
||||
(unsigned long long)read_gcr_reg1_mask());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
phys_addr_t mips_cpc_default_phys_base(void)
|
||||
{
|
||||
panic("Cannot detect cpc address");
|
||||
|
@ -333,7 +333,7 @@ config PCIE_APPLE
|
||||
|
||||
config PCIE_MT7621
|
||||
tristate "MediaTek MT7621 PCIe Controller"
|
||||
depends on (RALINK && SOC_MT7621) || (MIPS && COMPILE_TEST)
|
||||
depends on SOC_MT7621 || COMPILE_TEST
|
||||
select PHY_MT7621_PCI
|
||||
default SOC_MT7621
|
||||
help
|
||||
|
@ -148,7 +148,7 @@ static void __iomem *mt7621_pcie_map_bus(struct pci_bus *bus,
|
||||
return pcie->base + RALINK_PCI_CONFIG_DATA + (where & 3);
|
||||
}
|
||||
|
||||
struct pci_ops mt7621_pci_ops = {
|
||||
static struct pci_ops mt7621_pci_ops = {
|
||||
.map_bus = mt7621_pcie_map_bus,
|
||||
.read = pci_generic_config_read,
|
||||
.write = pci_generic_config_write,
|
||||
@ -208,37 +208,6 @@ static inline void mt7621_control_deassert(struct mt7621_pcie_port *port)
|
||||
reset_control_assert(port->pcie_rst);
|
||||
}
|
||||
|
||||
static int setup_cm_memory_region(struct pci_host_bridge *host)
|
||||
{
|
||||
struct mt7621_pcie *pcie = pci_host_bridge_priv(host);
|
||||
struct device *dev = pcie->dev;
|
||||
struct resource_entry *entry;
|
||||
resource_size_t mask;
|
||||
|
||||
entry = resource_list_first_type(&host->windows, IORESOURCE_MEM);
|
||||
if (!entry) {
|
||||
dev_err(dev, "cannot get memory resource\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (mips_cps_numiocu(0)) {
|
||||
/*
|
||||
* FIXME: hardware doesn't accept mask values with 1s after
|
||||
* 0s (e.g. 0xffef), so it would be great to warn if that's
|
||||
* about to happen
|
||||
*/
|
||||
mask = ~(entry->res->end - entry->res->start);
|
||||
|
||||
write_gcr_reg1_base(entry->res->start);
|
||||
write_gcr_reg1_mask(mask | CM_GCR_REGn_MASK_CMTGT_IOCU0);
|
||||
dev_info(dev, "PCI coherence region base: 0x%08llx, mask/settings: 0x%08llx\n",
|
||||
(unsigned long long)read_gcr_reg1_base(),
|
||||
(unsigned long long)read_gcr_reg1_mask());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
|
||||
struct device_node *node,
|
||||
int slot)
|
||||
@ -557,12 +526,6 @@ static int mt7621_pci_probe(struct platform_device *pdev)
|
||||
goto remove_resets;
|
||||
}
|
||||
|
||||
err = setup_cm_memory_region(bridge);
|
||||
if (err) {
|
||||
dev_err(dev, "error setting up iocu mem regions\n");
|
||||
goto remove_resets;
|
||||
}
|
||||
|
||||
return mt7621_pcie_register_host(bridge);
|
||||
|
||||
remove_resets:
|
||||
@ -598,3 +561,5 @@ static struct platform_driver mt7621_pci_driver = {
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(mt7621_pci_driver);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
@ -898,8 +898,6 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
|
||||
|
||||
bridge->bus = bus;
|
||||
|
||||
/* Temporarily move resources off the list */
|
||||
list_splice_init(&bridge->windows, &resources);
|
||||
bus->sysdata = bridge->sysdata;
|
||||
bus->ops = bridge->ops;
|
||||
bus->number = bus->busn_res.start = bridge->busnr;
|
||||
@ -925,6 +923,8 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
|
||||
if (err)
|
||||
goto free;
|
||||
|
||||
/* Temporarily move resources off the list */
|
||||
list_splice_init(&bridge->windows, &resources);
|
||||
err = device_add(&bridge->dev);
|
||||
if (err) {
|
||||
put_device(&bridge->dev);
|
||||
|
Loading…
Reference in New Issue
Block a user