mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
9ad9a52cce
This adds basic support for hardware implementing the MIPI I3C HCI specification. This driver is currently limited by the capabilities of the I3C subsystem, meaning things like scheduled commands, auto-commands and NCM mode are not yet supported. This supports version 1.0 of the MIPI I3C HCI spec, as well as the imminent release of version 1.1. Support for draft version 2.0 of the spec is also largely included with the caveat that future adjustments to this code are likely as the spec is still a work in progress. This is also lightly tested as actual hardware is still very scarce, even for HCI v1.0. Hence the EXPERIMENTAL tag. Further contributions to this driver are expected once vendor implementations and new I3C devices become available. Signed-off-by: Nicolas Pitre <npitre@baylibre.com> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://lore.kernel.org/linux-i3c/20201111220510.3622216-3-nico@fluxnic.net
37 lines
837 B
C
37 lines
837 B
C
// SPDX-License-Identifier: BSD-3-Clause
|
|
/*
|
|
* Copyright (c) 2020, MIPI Alliance, Inc.
|
|
*
|
|
* Author: Nicolas Pitre <npitre@baylibre.com>
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/bitfield.h>
|
|
#include <linux/i3c/master.h>
|
|
#include <linux/io.h>
|
|
|
|
#include "hci.h"
|
|
#include "dct.h"
|
|
|
|
/*
|
|
* Device Characteristic Table
|
|
*/
|
|
|
|
void i3c_hci_dct_get_val(struct i3c_hci *hci, unsigned int dct_idx,
|
|
u64 *pid, unsigned int *dcr, unsigned int *bcr)
|
|
{
|
|
void __iomem *reg = hci->DCT_regs + dct_idx * 4 * 4;
|
|
u32 dct_entry_data[4];
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
dct_entry_data[i] = readl(reg);
|
|
reg += 4;
|
|
}
|
|
|
|
*pid = ((u64)dct_entry_data[0]) << (47 - 32 + 1) |
|
|
FIELD_GET(W1_MASK(47, 32), dct_entry_data[1]);
|
|
*dcr = FIELD_GET(W2_MASK(71, 64), dct_entry_data[2]);
|
|
*bcr = FIELD_GET(W2_MASK(79, 72), dct_entry_data[2]);
|
|
}
|