2024年11月20日 星期三

MV32, PCIE, wwan0at0

環境: ubuntu22.04 + kernel 6.9.12
模組: Telit MV32(應該是R1.0, AP046)

預設只有/dev/wwan0mbim0,沒有/dev/wwan0at0能下AT指令,但FN990就有...

修改 drivers/bus/mhi/host/pci_generic.c
...
...
...
static const struct mhi_channel_config mhi_telit_mv32_channels[] = {
	MHI_CHANNEL_CONFIG_UL(0, "LOOPBACK", 64, 0),
	MHI_CHANNEL_CONFIG_DL(1, "LOOPBACK", 64, 0),
	/* MBIM Control Channel */
	MHI_CHANNEL_CONFIG_UL(12, "MBIM", 64, 0),
	MHI_CHANNEL_CONFIG_DL(13, "MBIM", 64, 0),
	MHI_CHANNEL_CONFIG_UL(32, "DUN", 64, 0),
	MHI_CHANNEL_CONFIG_DL(33, "DUN", 64, 0),
	MHI_CHANNEL_CONFIG_UL(92, "DUN2", 64, 1),
	MHI_CHANNEL_CONFIG_DL(93, "DUN2", 64, 1),
	/* MBIM Data Channel */
	MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0_MBIM", 512, 2),
	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
	
};

static struct mhi_event_config mhi_telit_mv32_events[] = {
	MHI_EVENT_CONFIG_CTRL(0, 256),
	MHI_EVENT_CONFIG_DATA(1, 256),
	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
	MHI_EVENT_CONFIG_HW_DATA(3, 1024, 101),
};

static const struct mhi_controller_config modem_telit_mv32_config = {
	.max_channels = 128,
	.timeout_ms = 20000,
	.num_channels = ARRAY_SIZE(mhi_telit_mv32_channels),
	.ch_cfg = mhi_telit_mv32_channels,
	.num_events = ARRAY_SIZE(mhi_telit_mv32_events),
	.event_cfg = mhi_telit_mv32_events,
};

static const struct mhi_pci_dev_info mhi_telit_mv32_info = {
	.name = "cinterion-telit-mv32",
	.config = &modem_telit_mv32_config,
	.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
	.dma_data_width = 32,
	.mru_default = 32768,
};
...
...
...
{ PCI_DEVICE(PCI_VENDOR_ID_THALES, 0x00ba),
		.driver_data = (kernel_ulong_t) &mhi_telit_mv32_info },
{ PCI_DEVICE(PCI_VENDOR_ID_THALES, 0x00bb),
		.driver_data = (kernel_ulong_t) &mhi_telit_mv32_info },

WWAN_PORT_AT
...
...
...
static const struct mhi_device_id mhi_wwan_ctrl_match_table[] = {
	{ .chan = "DUN", .driver_data = WWAN_PORT_AT },
	{ .chan = "DUN2", .driver_data = WWAN_PORT_AT },
	{ .chan = "MBIM", .driver_data = WWAN_PORT_MBIM },
	{ .chan = "QMI", .driver_data = WWAN_PORT_QMI },
	{ .chan = "DIAG", .driver_data = WWAN_PORT_QCDM },
	{ .chan = "FIREHOSE", .driver_data = WWAN_PORT_FIREHOSE },
	{},
};
MODULE_DEVICE_TABLE(mhi, mhi_wwan_ctrl_match_table);
...
...
...

沒有留言:

張貼留言