diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2013-08-13 08:25:22 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2013-09-30 10:58:39 -0400 |
commit | e5615c30c1c921dda957638ddf9c9437fcb7bb36 (patch) | |
tree | db12b441d88b09fc6e2ea4fa475dc53fcff318b8 | |
parent | bf09b6ae588f7567bcf31d9eff313d4d9fdc664e (diff) |
PCI: mvebu: remove subsys_initcall
This removes the subsys_initcall from the driver and converts it to
a normal platform_driver. Also, drvdata is set and a remove functions
is added to disable the clock and free resources. As pci driver removal
currently is not supported, set .suppress_bind_attrs to permit unbinding.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r-- | drivers/pci/host/pci-mvebu.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 87aaed591c80..af23038a52ac 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -165,7 +165,7 @@ static void mvebu_pcie_set_local_dev_nr(struct mvebu_pcie_port *port, int nr) | |||
165 | * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks | 165 | * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks |
166 | * WIN[0-3] -> DRAM bank[0-3] | 166 | * WIN[0-3] -> DRAM bank[0-3] |
167 | */ | 167 | */ |
168 | static void __init mvebu_pcie_setup_wins(struct mvebu_pcie_port *port) | 168 | static void mvebu_pcie_setup_wins(struct mvebu_pcie_port *port) |
169 | { | 169 | { |
170 | const struct mbus_dram_target_info *dram; | 170 | const struct mbus_dram_target_info *dram; |
171 | u32 size; | 171 | u32 size; |
@@ -217,7 +217,7 @@ static void __init mvebu_pcie_setup_wins(struct mvebu_pcie_port *port) | |||
217 | port->base + PCIE_BAR_CTRL_OFF(1)); | 217 | port->base + PCIE_BAR_CTRL_OFF(1)); |
218 | } | 218 | } |
219 | 219 | ||
220 | static void __init mvebu_pcie_setup_hw(struct mvebu_pcie_port *port) | 220 | static void mvebu_pcie_setup_hw(struct mvebu_pcie_port *port) |
221 | { | 221 | { |
222 | u16 cmd; | 222 | u16 cmd; |
223 | u32 mask; | 223 | u32 mask; |
@@ -628,7 +628,7 @@ static struct pci_ops mvebu_pcie_ops = { | |||
628 | .write = mvebu_pcie_wr_conf, | 628 | .write = mvebu_pcie_wr_conf, |
629 | }; | 629 | }; |
630 | 630 | ||
631 | static int __init mvebu_pcie_setup(int nr, struct pci_sys_data *sys) | 631 | static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys) |
632 | { | 632 | { |
633 | struct mvebu_pcie *pcie = sys_to_pcie(sys); | 633 | struct mvebu_pcie *pcie = sys_to_pcie(sys); |
634 | int i; | 634 | int i; |
@@ -647,7 +647,7 @@ static int __init mvebu_pcie_setup(int nr, struct pci_sys_data *sys) | |||
647 | return 1; | 647 | return 1; |
648 | } | 648 | } |
649 | 649 | ||
650 | static int __init mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 650 | static int mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
651 | { | 651 | { |
652 | struct of_irq oirq; | 652 | struct of_irq oirq; |
653 | int ret; | 653 | int ret; |
@@ -704,7 +704,7 @@ resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev, | |||
704 | return start; | 704 | return start; |
705 | } | 705 | } |
706 | 706 | ||
707 | static void __init mvebu_pcie_enable(struct mvebu_pcie *pcie) | 707 | static void mvebu_pcie_enable(struct mvebu_pcie *pcie) |
708 | { | 708 | { |
709 | struct hw_pci hw; | 709 | struct hw_pci hw; |
710 | 710 | ||
@@ -727,10 +727,8 @@ static void __init mvebu_pcie_enable(struct mvebu_pcie *pcie) | |||
727 | * <...> property for one that matches the given port/lane. Once | 727 | * <...> property for one that matches the given port/lane. Once |
728 | * found, maps it. | 728 | * found, maps it. |
729 | */ | 729 | */ |
730 | static void __iomem * __init | 730 | static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev, |
731 | mvebu_pcie_map_registers(struct platform_device *pdev, | 731 | struct device_node *np, struct mvebu_pcie_port *port) |
732 | struct device_node *np, | ||
733 | struct mvebu_pcie_port *port) | ||
734 | { | 732 | { |
735 | struct resource regs; | 733 | struct resource regs; |
736 | int ret = 0; | 734 | int ret = 0; |
@@ -786,7 +784,7 @@ static int mvebu_get_tgt_attr(struct device_node *np, int devfn, | |||
786 | return -ENOENT; | 784 | return -ENOENT; |
787 | } | 785 | } |
788 | 786 | ||
789 | static void __init mvebu_pcie_msi_enable(struct mvebu_pcie *pcie) | 787 | static void mvebu_pcie_msi_enable(struct mvebu_pcie *pcie) |
790 | { | 788 | { |
791 | struct device_node *msi_node; | 789 | struct device_node *msi_node; |
792 | 790 | ||
@@ -801,7 +799,7 @@ static void __init mvebu_pcie_msi_enable(struct mvebu_pcie *pcie) | |||
801 | pcie->msi->dev = &pcie->pdev->dev; | 799 | pcie->msi->dev = &pcie->pdev->dev; |
802 | } | 800 | } |
803 | 801 | ||
804 | static int __init mvebu_pcie_probe(struct platform_device *pdev) | 802 | static int mvebu_pcie_probe(struct platform_device *pdev) |
805 | { | 803 | { |
806 | struct mvebu_pcie *pcie; | 804 | struct mvebu_pcie *pcie; |
807 | struct device_node *np = pdev->dev.of_node; | 805 | struct device_node *np = pdev->dev.of_node; |
@@ -814,6 +812,7 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev) | |||
814 | return -ENOMEM; | 812 | return -ENOMEM; |
815 | 813 | ||
816 | pcie->pdev = pdev; | 814 | pcie->pdev = pdev; |
815 | platform_set_drvdata(pdev, pcie); | ||
817 | 816 | ||
818 | /* Get the PCIe memory and I/O aperture */ | 817 | /* Get the PCIe memory and I/O aperture */ |
819 | mvebu_mbus_get_pcie_mem_aperture(&pcie->mem); | 818 | mvebu_mbus_get_pcie_mem_aperture(&pcie->mem); |
@@ -957,16 +956,12 @@ static struct platform_driver mvebu_pcie_driver = { | |||
957 | .name = "mvebu-pcie", | 956 | .name = "mvebu-pcie", |
958 | .of_match_table = | 957 | .of_match_table = |
959 | of_match_ptr(mvebu_pcie_of_match_table), | 958 | of_match_ptr(mvebu_pcie_of_match_table), |
959 | /* driver unloading/unbinding currently not supported */ | ||
960 | .suppress_bind_attrs = true, | ||
960 | }, | 961 | }, |
962 | .probe = mvebu_pcie_probe, | ||
961 | }; | 963 | }; |
962 | 964 | module_platform_driver(mvebu_pcie_driver); | |
963 | static int __init mvebu_pcie_init(void) | ||
964 | { | ||
965 | return platform_driver_probe(&mvebu_pcie_driver, | ||
966 | mvebu_pcie_probe); | ||
967 | } | ||
968 | |||
969 | subsys_initcall(mvebu_pcie_init); | ||
970 | 965 | ||
971 | MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); | 966 | MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); |
972 | MODULE_DESCRIPTION("Marvell EBU PCIe driver"); | 967 | MODULE_DESCRIPTION("Marvell EBU PCIe driver"); |