Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5416e553 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: use msm_11ad for platform operations"

parents af9a270f f1c9a148
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -14,10 +14,12 @@ wil6210-y += ioctl.o
wil6210-y += fw.o
wil6210-$(CONFIG_WIL6210_TRACING) += trace.o
wil6210-y += wil_platform.o
wil6210-$(CONFIG_WIL6210_PLATFORM_MSM) += wil_platform_msm.o
wil6210-y += ethtool.o

# for tracing framework to find trace.h
CFLAGS_trace.o := -I$(src)

subdir-ccflags-y += -D__CHECK_ENDIAN__

MSM_11AD_PATH = drivers/platform/msm/msm_11ad
CFLAGS_wil_platform.o := -I$(MSM_11AD_PATH)
+1 −2
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ static void wil_dev_setup(struct net_device *dev)
	dev->tx_queue_len = WIL_TX_Q_LEN_DEFAULT;
}

void *wil_if_alloc(struct device *dev, void __iomem *csr)
void *wil_if_alloc(struct device *dev)
{
	struct net_device *ndev;
	struct wireless_dev *wdev;
@@ -142,7 +142,6 @@ void *wil_if_alloc(struct device *dev, void __iomem *csr)
	}

	wil = wdev_to_wil(wdev);
	wil->csr = csr;
	wil->wdev = wdev;

	wil_dbg_misc(wil, "%s()\n", __func__);
+64 −35
Original line number Diff line number Diff line
@@ -169,7 +169,6 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
	struct wil6210_priv *wil;
	struct device *dev = &pdev->dev;
	void __iomem *csr;
	int rc;

	/* check HW */
@@ -184,9 +183,28 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
		return -ENODEV;
	}

	wil = wil_if_alloc(dev);
	if (IS_ERR(wil)) {
		rc = (int)PTR_ERR(wil);
		dev_err(dev, "wil_if_alloc failed: %d\n", rc);
		return rc;
	}
	wil->pdev = pdev;
	pci_set_drvdata(pdev, wil);
	/* rollback to if_free */

	wil->platform_handle =
			wil_platform_init(&pdev->dev, &wil->platform_ops);
	if (!wil->platform_handle) {
		rc = -ENODEV;
		wil_err(wil, "wil_platform_init failed\n");
		goto if_free;
	}
	/* rollback to err_plat */

	rc = pci_enable_device(pdev);
	if (rc) {
		dev_err(&pdev->dev,
		wil_err(wil,
			"pci_enable_device failed, retry with MSI only\n");
		/* Work around for platforms that can't allocate IRQ:
		 * retry with MSI only
@@ -194,47 +212,37 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
		pdev->msi_enabled = 1;
		rc = pci_enable_device(pdev);
	}
	if (rc)
		return -ENODEV;
	if (rc) {
		wil_err(wil,
			"pci_enable_device failed, even with MSI only\n");
		goto err_plat;
	}
	/* rollback to err_disable_pdev */

	rc = pci_request_region(pdev, 0, WIL_NAME);
	if (rc) {
		dev_err(&pdev->dev, "pci_request_region failed\n");
		wil_err(wil, "pci_request_region failed\n");
		goto err_disable_pdev;
	}
	/* rollback to err_release_reg */

	csr = pci_ioremap_bar(pdev, 0);
	if (!csr) {
		dev_err(&pdev->dev, "pci_ioremap_bar failed\n");
	wil->csr = pci_ioremap_bar(pdev, 0);
	if (!wil->csr) {
		wil_err(wil, "pci_ioremap_bar failed\n");
		rc = -ENODEV;
		goto err_release_reg;
	}
	/* rollback to err_iounmap */
	dev_info(&pdev->dev, "CSR at %pR -> 0x%p\n", &pdev->resource[0], csr);
	wil_info(wil, "CSR at %pR -> 0x%p\n", &pdev->resource[0], wil->csr);

	wil = wil_if_alloc(dev, csr);
	if (IS_ERR(wil)) {
		rc = (int)PTR_ERR(wil);
		dev_err(dev, "wil_if_alloc failed: %d\n", rc);
		goto err_iounmap;
	}
	/* rollback to if_free */

	pci_set_drvdata(pdev, wil);
	wil->pdev = pdev;
	wil_set_capabilities(wil);
	wil6210_clear_irq(wil);

	wil->platform_handle =
			wil_platform_init(&pdev->dev, &wil->platform_ops);

	/* FW should raise IRQ when ready */
	rc = wil_if_pcie_enable(wil);
	if (rc) {
		wil_err(wil, "Enable device failed\n");
		goto if_free;
		goto err_iounmap;
	}
	/* rollback to bus_disable */

@@ -253,16 +261,17 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)

bus_disable:
	wil_if_pcie_disable(wil);
 if_free:
	if (wil->platform_ops.uninit)
		wil->platform_ops.uninit(wil->platform_handle);
	wil_if_free(wil);
err_iounmap:
	pci_iounmap(pdev, csr);
	pci_iounmap(pdev, wil->csr);
err_release_reg:
	pci_release_region(pdev, 0);
err_disable_pdev:
	pci_disable_device(pdev);
err_plat:
	if (wil->platform_ops.uninit)
		wil->platform_ops.uninit(wil->platform_handle);
if_free:
	wil_if_free(wil);

	return rc;
}
@@ -277,12 +286,12 @@ static void wil_pcie_remove(struct pci_dev *pdev)
	wil6210_debugfs_remove(wil);
	wil_if_remove(wil);
	wil_if_pcie_disable(wil);
	if (wil->platform_ops.uninit)
		wil->platform_ops.uninit(wil->platform_handle);
	wil_if_free(wil);
	pci_iounmap(pdev, csr);
	pci_release_region(pdev, 0);
	pci_disable_device(pdev);
	if (wil->platform_ops.uninit)
		wil->platform_ops.uninit(wil->platform_handle);
	wil_if_free(wil);
}

static const struct pci_device_id wil6210_pcie_ids[] = {
@@ -299,7 +308,27 @@ static struct pci_driver wil6210_driver = {
	.name		= WIL_NAME,
};

module_pci_driver(wil6210_driver);
static int __init wil6210_driver_init(void)
{
	int rc;

	rc = wil_platform_modinit();
	if (rc)
		return rc;

	rc = pci_register_driver(&wil6210_driver);
	if (rc)
		wil_platform_modexit();
	return rc;
}
module_init(wil6210_driver_init);

static void __exit wil6210_driver_exit(void)
{
	pci_unregister_driver(&wil6210_driver);
	wil_platform_modexit();
}
module_exit(wil6210_driver_exit);

MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Qualcomm Atheros <wil6210@qca.qualcomm.com>");
+1 −1
Original line number Diff line number Diff line
@@ -660,7 +660,7 @@ void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src,
void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src,
			size_t count);

void *wil_if_alloc(struct device *dev, void __iomem *csr);
void *wil_if_alloc(struct device *dev);
void wil_if_free(struct wil6210_priv *wil);
int wil_if_add(struct wil6210_priv *wil);
void wil_if_remove(struct wil6210_priv *wil);
+12 −11
Original line number Diff line number Diff line
@@ -16,10 +16,17 @@

#include "linux/device.h"
#include "wil_platform.h"
#include "msm_11ad.h"

#ifdef CONFIG_WIL6210_PLATFORM_MSM
#include "wil_platform_msm.h"
#endif
int __init wil_platform_modinit(void)
{
	return msm_11ad_modinit();
}

void wil_platform_modexit(void)
{
	msm_11ad_modexit();
}

/**
 * wil_platform_init() - wil6210 platform module init
@@ -30,20 +37,14 @@
 */
void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops)
{
	void *handle = NULL;
	void *handle;

	if (!ops) {
		dev_err(dev, "Invalid parameter. Cannot init platform module\n");
		return NULL;
	}

#ifdef CONFIG_WIL6210_PLATFORM_MSM
	handle = wil_platform_msm_init(dev, ops);
	if (handle)
		return handle;
#endif

	/* other platform specific init functions should be called here */
	handle = msm_11ad_dev_init(dev, ops);

	return handle;
}
Loading