Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca956ae0 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "spmi: pmic_arb: add interrupt support to virtio spmi"

parents 0b76d977 b9f2c2a8
Loading
Loading
Loading
Loading
+6 −15
Original line number Diff line number Diff line
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.

 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -253,25 +253,16 @@
		status = "ok";
	};

	spmi_bus: qcom,spmi {
		compatible = "qcom,viospmi-pmic-arb";
		interrupt-names = "periph_irq";
		interrupts = <GIC_SPI 481 IRQ_TYPE_NONE>;
		qcom,ee = <0>;
		qcom,channel = <0>;
		#address-cells = <2>;
		#size-cells = <0>;
		interrupt-controller;
		#interrupt-cells = <4>;
		cell-index = <0>;
	};

	viospmi: virtio-spmi@1c800000 {
	spmi_bus: virtio-spmi@1c800000 {
		compatible = "virtio,mmio";
		#address-cells = <1>;
		#size-cells = <1>;
		reg = <0x1c800000 0x1100>;
		interrupt-names = "periph_irq";
		interrupts = <GIC_SPI 45 IRQ_TYPE_NONE>;
		interrupt-controller;
		#interrupt-cells = <4>;
		cell-index = <0>;
		status = "okay";
	};

+207 −343

File changed.

Preview size limit exceeded, changes collapsed.

+6 −15
Original line number Diff line number Diff line
/* Copyright (c) 2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -29,12 +29,13 @@ struct virtio_spmi_config {
} __packed;

struct payload_cmd {
	__virtio32 cmd;
	__virtio32 data[2];
};

struct payload_irq {
	__virtio32 ppid;
	__virtio32 val;
	__virtio16 ppid;
	__virtio32 regval;
};

union payload_data {
@@ -44,19 +45,15 @@ union payload_data {

struct virtio_spmi_msg {
	__virtio32 type;
	__virtio32 len;
	__virtio32 res;
	union {
		__virtio32 cmd;
		__virtio32 cnt;
	} u;
	union payload_data payload[];
	union payload_data payload;
};

/* Virtio SPMI message type */
enum vio_spmi_msg_type {
	VIO_SPMI_BUS_WRITE = 0,
	VIO_SPMI_BUS_READ = 1,
	VIO_SPMI_BUS_CMDMAX  = 1,
	VIO_ACC_ENABLE_WR = 2,
	VIO_ACC_ENABLE_RD = 3,
	VIO_IRQ_CLEAR = 4,
@@ -68,10 +65,4 @@ enum vio_spmi_msg_res {
	VIO_SPMI_DONE = 0,
	VIO_SPMI_ERR = 1,
};

/* payload fix size and one payload_data size */
#define MSG_FIX_SZ (sizeof(struct virtio_spmi_msg))
#define PER_PLD_SZ (sizeof(union payload_data))
#define MSG_SZ(x)  (MSG_FIX_SZ + ((PER_PLD_SZ) * (x)))

#endif /* _LINUX_VIRTIO_SPMI_H */