Unverified Commit af1d1823 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4736 PCIe and miniIO OLK-5.10 branch partial code round OLK-6.6 branch

Merge Pull Request from: @lujunhuaHW 
 
The PCIe and miniIO modules have been incorporated into the code of the OLK-5.10 branch and need to be transferred to the OLK-6.6 branch. Each patch has its own issues and details, which are not described here.

Self-verification & related issues:
https://gitee.com/openeuler/kernel/issues/I94G7Y
https://gitee.com/openeuler/kernel/issues/I94FKX
https://gitee.com/openeuler/kernel/issues/I94FKM
https://gitee.com/openeuler/kernel/issues/I94G7Y
https://gitee.com/openeuler/kernel/issues/I944FB
 
 
Link:https://gitee.com/openeuler/kernel/pulls/4736

 

Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 74df1e70 e7c27893
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ static void hisi_gpio_get_pdata(struct device *dev,
		hisi_gpio->irq = platform_get_irq(pdev, idx);

		dev_info(dev,
			 "get hisi_gpio[%d] with %d lines\n", idx,
			 "get hisi_gpio[%d] with %u lines\n", idx,
			 hisi_gpio->line_num);

		idx++;
+17 −11
Original line number Diff line number Diff line
@@ -183,6 +183,10 @@ static void hisi_ptt_wait_dma_reset_done(struct hisi_ptt *hisi_ptt)
static void hisi_ptt_trace_end(struct hisi_ptt *hisi_ptt)
{
	writel(0, hisi_ptt->iobase + HISI_PTT_TRACE_CTRL);

	/* Mask the interrupt on the end */
	writel(HISI_PTT_TRACE_INT_MASK_ALL, hisi_ptt->iobase + HISI_PTT_TRACE_INT_MASK);

	hisi_ptt->trace_ctrl.started = false;
}

@@ -270,15 +274,14 @@ static int hisi_ptt_update_aux(struct hisi_ptt *hisi_ptt, int index, bool stop)
	buf->pos += size;

	/*
	 * Just commit the traced data if we're going to stop. Otherwise if the
	 * resident AUX buffer cannot contain the data of next trace buffer,
	 * apply a new one.
	 * Always commit the data to the AUX buffer in time to make sure
	 * userspace got enough time to consume the data.
	 *
	 * If we're not going to stop, apply a new one and check whether
	 * there's enough room for the next trace.
	 */
	if (stop) {
		perf_aux_output_end(handle, buf->pos);
	} else if (buf->length - buf->pos < HISI_PTT_TRACE_BUF_SIZE) {
		perf_aux_output_end(handle, buf->pos);

	perf_aux_output_end(handle, size);
	if (!stop) {
		buf = perf_aux_output_begin(handle, event);
		if (!buf)
			return -EINVAL;
@@ -342,9 +345,9 @@ static int hisi_ptt_register_irq(struct hisi_ptt *hisi_ptt)
		return ret;

	hisi_ptt->trace_irq = pci_irq_vector(pdev, HISI_PTT_TRACE_DMA_IRQ);
	ret = devm_request_threaded_irq(&pdev->dev, hisi_ptt->trace_irq,
					NULL, hisi_ptt_isr, 0,
					DRV_NAME, hisi_ptt);
	ret = devm_request_irq(&pdev->dev, hisi_ptt->trace_irq, hisi_ptt_isr,
				IRQF_NOBALANCING | IRQF_NO_THREAD, DRV_NAME,
				hisi_ptt);
	if (ret) {
		pci_err(pdev, "failed to request irq %d, ret = %d\n",
			hisi_ptt->trace_irq, ret);
@@ -1003,6 +1006,9 @@ static int hisi_ptt_pmu_event_init(struct perf_event *event)
		return -EOPNOTSUPP;
	}

	if (event->attach_state & PERF_ATTACH_TASK)
		return -EOPNOTSUPP;

	ret = hisi_ptt_trace_valid_filter(hisi_ptt, event->attr.config);
	if (ret < 0)
		return ret;
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@
#define HISI_PTT_TRACE_INT_STAT		0x0890
#define   HISI_PTT_TRACE_INT_STAT_MASK	GENMASK(3, 0)
#define HISI_PTT_TRACE_INT_MASK		0x0894
#define   HISI_PTT_TRACE_INT_MASK_ALL	GENMASK(3, 0)
#define HISI_PTT_TUNING_INT_STAT	0x0898
#define   HISI_PTT_TUNING_INT_STAT_MASK	BIT(0)
#define HISI_PTT_TRACE_WR_STS		0x08a0
+81 −0
Original line number Diff line number Diff line
@@ -5,10 +5,12 @@
 * Copyright (c) 2021 HiSilicon Technologies Co., Ltd.
 */

#include <linux/acpi.h>
#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/io.h>
@@ -109,6 +111,9 @@ struct hisi_i2c_controller {
	struct i2c_timings t;
	u32 clk_rate_khz;
	u32 spk_len;

	/* Bus recovery method */
	struct i2c_bus_recovery_info rinfo;
};

static void hisi_i2c_enable_int(struct hisi_i2c_controller *ctlr, u32 mask)
@@ -455,6 +460,80 @@ static void hisi_i2c_configure_bus(struct hisi_i2c_controller *ctlr)
	writel(reg, ctlr->iobase + HISI_I2C_FIFO_CTRL);
}

#ifdef CONFIG_ACPI
#define HISI_I2C_PIN_MUX_METHOD	"PMUX"

/**
 * i2c_dw_acpi_pin_mux_change - Change the I2C controller's pin mux through ACPI
 * @dev: device owns the SCL/SDA pin
 * @to_gpio: true to switch to GPIO, false to switch to SCL/SDA
 *
 * The function invokes the specific ACPI method "PMUX" for changing the
 * pin mux of I2C controller between SCL/SDA and GPIO in order to help on
 * the generic GPIO recovery process.
 */
static void i2c_hisi_pin_mux_change(struct device *dev, bool to_gpio)
{
	acpi_handle handle = ACPI_HANDLE(dev);
	struct acpi_object_list arg_list;
	unsigned long long data;
	union acpi_object arg;

	arg.type = ACPI_TYPE_INTEGER;
	arg.integer.value = to_gpio;
	arg_list.count = 1;
	arg_list.pointer = &arg;

	acpi_evaluate_integer(handle, HISI_I2C_PIN_MUX_METHOD, &arg_list, &data);
}

static void i2c_hisi_prepare_recovery(struct i2c_adapter *adap)
{
	struct hisi_i2c_controller *ctlr = i2c_get_adapdata(adap);

	i2c_hisi_pin_mux_change(ctlr->dev, true);
}

static void i2c_hisi_unprepare_recovery(struct i2c_adapter *adap)
{
	struct hisi_i2c_controller *ctlr = i2c_get_adapdata(adap);

	i2c_hisi_pin_mux_change(ctlr->dev, false);
}

static void hisi_i2c_init_recovery_info(struct hisi_i2c_controller *ctlr)
{
	struct i2c_bus_recovery_info *rinfo = &ctlr->rinfo;
	struct acpi_device *adev = ACPI_COMPANION(ctlr->dev);
	struct gpio_desc *gpio;

	if (acpi_disabled)
		return;

	if (!adev || !acpi_has_method(adev->handle, HISI_I2C_PIN_MUX_METHOD))
		return;

	gpio = devm_gpiod_get_optional(ctlr->dev, "scl", GPIOD_OUT_HIGH);
	if (IS_ERR_OR_NULL(gpio))
		return;

	rinfo->scl_gpiod = gpio;

	gpio = devm_gpiod_get_optional(ctlr->dev, "sda", GPIOD_IN);
	if (IS_ERR(gpio))
		return;

	rinfo->sda_gpiod = gpio;
	rinfo->recover_bus = i2c_generic_scl_recovery;
	rinfo->prepare_recovery =  i2c_hisi_prepare_recovery;
	rinfo->unprepare_recovery = i2c_hisi_unprepare_recovery;

	ctlr->adapter.bus_recovery_info = rinfo;
}
#else
static inline void hisi_i2c_init_recovery_info(struct hisi_i2c_controller *ctlr) { }
#endif /* CONFIG_ACPI */

static int hisi_i2c_probe(struct platform_device *pdev)
{
	struct hisi_i2c_controller *ctlr;
@@ -505,6 +584,8 @@ static int hisi_i2c_probe(struct platform_device *pdev)
	adapter->dev.parent = dev;
	i2c_set_adapdata(adapter, ctlr);

	hisi_i2c_init_recovery_info(ctlr);

	ret = devm_i2c_add_adapter(dev, adapter);
	if (ret)
		return ret;
+5 −0
Original line number Diff line number Diff line
@@ -377,6 +377,11 @@ static const struct spi_controller_mem_ops hisi_sfc_v3xx_mem_ops = {
static irqreturn_t hisi_sfc_v3xx_isr(int irq, void *data)
{
	struct hisi_sfc_v3xx_host *host = data;
	u32 reg;

	reg = readl(host->regbase + HISI_SFC_V3XX_INT_STAT);
	if (!reg)
		return IRQ_NONE;

	hisi_sfc_v3xx_disable_int(host);

Loading