Commit 87dae9e7 authored by M Chetan Kumar's avatar M Chetan Kumar Committed by David S. Miller
Browse files

net: wwan: t7xx: Enable devlink based fw flashing and coredump collection



This patch brings-in support for t7xx wwan device firmware flashing &
coredump collection using devlink.

Driver Registers with Devlink framework.
Implements devlink ops flash_update callback that programs modem firmware.
Creates region & snapshot required for device coredump log collection.
On early detection of wwan device in fastboot mode driver sets up CLDMA0 HW
tx/rx queues for raw data transfer then registers with devlink framework.
Upon receiving firmware image & partition details driver sends fastboot
commands for flashing the firmware.

In this flow the fastboot command & response gets exchanged between driver
and device. Once firmware flashing is success completion status is reported
to user space application.

Below is the devlink command usage for firmware flashing

$devlink dev flash pci/$BDF file ABC.img component ABC

Note: ABC.img is the firmware to be programmed to "ABC" partition.

In case of coredump collection when wwan device encounters an exception
it reboots & stays in fastboot mode for coredump collection by host driver.
On detecting exception state driver collects the core dump, creates the
devlink region & reports an event to user space application for dump
collection. The user space application invokes devlink region read command
for dump collection.

Below are the devlink commands used for coredump collection.

devlink region new pci/$BDF/mr_dump
devlink region read pci/$BDF/mr_dump snapshot $ID address $ADD length $LEN
devlink region del pci/$BDF/mr_dump snapshot $ID

Signed-off-by: default avatarM Chetan Kumar <m.chetan.kumar@linux.intel.com>
Signed-off-by: default avatarDevegowda Chandrashekar <chandrashekar.devegowda@intel.com>
Signed-off-by: default avatarMishra Soumya Prakash <soumya.prakash.mishra@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 140424d9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ config IOSM
config MTK_T7XX
	tristate "MediaTek PCIe 5G WWAN modem T7xx device"
	depends on PCI
	select NET_DEVLINK
	help
	  Enables MediaTek PCIe based 5G WWAN modem (T7xx series) device.
	  Adapts WWAN framework and provides network interface like wwan0
+3 −1
Original line number Diff line number Diff line
@@ -18,4 +18,6 @@ mtk_t7xx-y:= t7xx_pci.o \
		t7xx_hif_dpmaif_rx.o  \
		t7xx_dpmaif.o \
		t7xx_netdev.o \
		t7xx_pci_rescan.o
		t7xx_pci_rescan.o \
		t7xx_uevent.o \
		t7xx_port_devlink.o
+12 −2
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include "t7xx_pci.h"
#include "t7xx_pci_rescan.h"
#include "t7xx_pcie_mac.h"
#include "t7xx_port_devlink.h"
#include "t7xx_reg.h"
#include "t7xx_state_monitor.h"

@@ -704,16 +705,20 @@ static int t7xx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
	t7xx_pci_infracfg_ao_calc(t7xx_dev);
	t7xx_mhccif_init(t7xx_dev);

	ret = t7xx_md_init(t7xx_dev);
	ret = t7xx_devlink_register(t7xx_dev);
	if (ret)
		return ret;

	ret = t7xx_md_init(t7xx_dev);
	if (ret)
		goto err_devlink_unregister;

	t7xx_pcie_mac_interrupts_dis(t7xx_dev);

	ret = t7xx_interrupt_init(t7xx_dev);
	if (ret) {
		t7xx_md_exit(t7xx_dev);
		return ret;
		goto err_devlink_unregister;
	}

	t7xx_rescan_done();
@@ -723,6 +728,10 @@ static int t7xx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
		pci_ignore_hotplug(pdev);

	return 0;

err_devlink_unregister:
	t7xx_devlink_unregister(t7xx_dev);
	return ret;
}

static void t7xx_pci_remove(struct pci_dev *pdev)
@@ -732,6 +741,7 @@ static void t7xx_pci_remove(struct pci_dev *pdev)

	t7xx_dev = pci_get_drvdata(pdev);
	t7xx_md_exit(t7xx_dev);
	t7xx_devlink_unregister(t7xx_dev);

	for (i = 0; i < EXT_INT_NUM; i++) {
		if (!t7xx_dev->intr_handler[i])
+2 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ typedef irqreturn_t (*t7xx_intr_callback)(int irq, void *param);
 * @md_pm_lock: protects PCIe sleep lock
 * @sleep_disable_count: PCIe L1.2 lock counter
 * @sleep_lock_acquire: indicates that sleep has been disabled
 * @dl: devlink struct
 */
struct t7xx_pci_dev {
	t7xx_intr_callback	intr_handler[EXT_INT_NUM];
@@ -79,6 +80,7 @@ struct t7xx_pci_dev {
	spinlock_t		md_pm_lock;		/* Protects PCI resource lock */
	unsigned int		sleep_disable_count;
	struct completion	sleep_lock_acquire;
	struct t7xx_devlink	*dl;
};

enum t7xx_pm_id {
+1 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ struct t7xx_port {
	int				rx_length_th;
	bool				chan_enable;
	struct task_struct		*thread;
	struct t7xx_devlink	*dl;
};

int t7xx_get_port_mtu(struct t7xx_port *port);
Loading