Lines Matching +full:ipc +full:- +full:3

1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for the Intel P-Unit Mailbox IPC mechanism
7 * The heart of the P-Unit is the Foxton microcontroller and its firmware,
22 /* IPC Mailbox registers */
53 return readl(ipcdev->base[type][BASE_IFACE]); in ipc_read_status()
58 writel(cmd, ipcdev->base[type][BASE_IFACE]); in ipc_write_cmd()
63 return readl(ipcdev->base[type][BASE_DATA] + OFFSET_DATA_LOW); in ipc_read_data_low()
68 return readl(ipcdev->base[type][BASE_DATA] + OFFSET_DATA_HIGH); in ipc_read_data_high()
73 writel(data, ipcdev->base[type][BASE_DATA] + OFFSET_DATA_LOW); in ipc_write_data_low()
78 writel(data, ipcdev->base[type][BASE_DATA] + OFFSET_DATA_HIGH); in ipc_write_data_high()
107 if (ipcdev->irq) { in intel_punit_ipc_check_status()
108 if (!wait_for_completion_timeout(&ipcdev->cmd_complete, in intel_punit_ipc_check_status()
110 dev_err(ipcdev->dev, "IPC timed out\n"); in intel_punit_ipc_check_status()
111 return -ETIMEDOUT; in intel_punit_ipc_check_status()
114 while ((ipc_read_status(ipcdev, type) & CMD_RUN) && --loops) in intel_punit_ipc_check_status()
117 dev_err(ipcdev->dev, "IPC timed out\n"); in intel_punit_ipc_check_status()
118 return -ETIMEDOUT; in intel_punit_ipc_check_status()
125 dev_err(ipcdev->dev, "IPC failed: %s, IPC_STS=0x%x\n", in intel_punit_ipc_check_status()
127 return -EIO; in intel_punit_ipc_check_status()
134 * intel_punit_ipc_simple_command() - Simple IPC command
135 * @cmd: IPC command code.
139 * Send a IPC command to P-Unit when there is no data transaction
141 * Return: IPC error code or 0 on success.
150 mutex_lock(&ipcdev->lock); in intel_punit_ipc_simple_command()
152 reinit_completion(&ipcdev->cmd_complete); in intel_punit_ipc_simple_command()
160 mutex_unlock(&ipcdev->lock); in intel_punit_ipc_simple_command()
167 * intel_punit_ipc_command() - IPC command with data and pointers
168 * @cmd: IPC command code.
174 * Send a IPC command to P-Unit with data transaction
176 * Return: IPC error code or 0 on success.
185 mutex_lock(&ipcdev->lock); in intel_punit_ipc_command()
187 reinit_completion(&ipcdev->cmd_complete); in intel_punit_ipc_command()
211 mutex_unlock(&ipcdev->lock); in intel_punit_ipc_command()
220 complete(&ipcdev->cmd_complete); in intel_punit_ioc()
230 * - BIOS_IPC BASE_DATA in intel_punit_get_bars()
231 * - BIOS_IPC BASE_IFACE in intel_punit_get_bars()
236 punit_ipcdev->base[BIOS_IPC][BASE_DATA] = addr; in intel_punit_get_bars()
241 punit_ipcdev->base[BIOS_IPC][BASE_IFACE] = addr; in intel_punit_get_bars()
245 * - ISPDRIVER_IPC BASE_DATA in intel_punit_get_bars()
246 * - ISPDRIVER_IPC BASE_IFACE in intel_punit_get_bars()
247 * - GTDRIVER_IPC BASE_DATA in intel_punit_get_bars()
248 * - GTDRIVER_IPC BASE_IFACE in intel_punit_get_bars()
252 punit_ipcdev->base[ISPDRIVER_IPC][BASE_DATA] = addr; in intel_punit_get_bars()
254 addr = devm_platform_ioremap_resource(pdev, 3); in intel_punit_get_bars()
256 punit_ipcdev->base[ISPDRIVER_IPC][BASE_IFACE] = addr; in intel_punit_get_bars()
260 punit_ipcdev->base[GTDRIVER_IPC][BASE_DATA] = addr; in intel_punit_get_bars()
264 punit_ipcdev->base[GTDRIVER_IPC][BASE_IFACE] = addr; in intel_punit_get_bars()
273 punit_ipcdev = devm_kzalloc(&pdev->dev, in intel_punit_ipc_probe()
276 return -ENOMEM; in intel_punit_ipc_probe()
282 dev_warn(&pdev->dev, "Invalid IRQ, using polling mode\n"); in intel_punit_ipc_probe()
284 ret = devm_request_irq(&pdev->dev, irq, intel_punit_ioc, in intel_punit_ipc_probe()
288 dev_err(&pdev->dev, "Failed to request irq: %d\n", irq); in intel_punit_ipc_probe()
291 punit_ipcdev->irq = irq; in intel_punit_ipc_probe()
298 punit_ipcdev->dev = &pdev->dev; in intel_punit_ipc_probe()
299 mutex_init(&punit_ipcdev->lock); in intel_punit_ipc_probe()
300 init_completion(&punit_ipcdev->cmd_complete); in intel_punit_ipc_probe()
330 MODULE_DESCRIPTION("Intel P-Unit IPC driver");