Commit 43418032 authored by Martin Blumenstingl's avatar Martin Blumenstingl
Browse files

ARM: dts: meson: add the AO ARC remote processor - WiP

parent da56261a
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -211,6 +211,14 @@
			#size-cells = <1>;
			ranges = <0x0 0xc8100000 0x100000>;

			ao_arc_rproc: remoteproc@1c {
				compatible= "amlogic,meson-mx-ao-arc-rproc";
				reg = <0x1c 0x8>, <0x38 0x8>;
				reg-names = "remap", "cpu";
				amlogic,sram = <&ahb_sram>;
				amlogic,secbus2 = <&secbus2>;
			};

			ir_receiver: ir-receiver@480 {
				compatible= "amlogic,meson6-ir";
				reg = <0x480 0x20>;
@@ -306,6 +314,11 @@
				#address-cells = <1>;
				#size-cells = <1>;
			};

			secbus2: bus@4000 {
				compatible = "amlogic,meson-mx-secbus2";
				reg = <0x4000 0x2000>;
			};
		};
	};

+4 −0
Original line number Diff line number Diff line
@@ -55,6 +55,10 @@
	};
}; /* end of / */

&ao_arc_rproc {
	status = "disabled";
};

&efuse {
	status = "disabled";
};
+5 −0
Original line number Diff line number Diff line
@@ -545,6 +545,11 @@
	resets = <&reset RESET_AIU>;
};

&ao_arc_rproc {
	resets = <&reset RESET_MEDIA_CPU>;
	reset-names = "arc625";
};

&cbus {
	reset: reset-controller@4404 {
		compatible = "amlogic,meson8b-reset";
+5 −0
Original line number Diff line number Diff line
@@ -504,6 +504,11 @@
	resets = <&reset RESET_AIU>;
};

&ao_arc_rproc {
	resets = <&reset RESET_MEDIA_CPU>;
	reset-names = "arc625";
};

&cbus {
	reset: reset-controller@4404 {
		compatible = "amlogic,meson8b-reset";
+26 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_platform.h>
@@ -24,16 +25,39 @@ static void* __iomem meson_mx_ao_arc_mbox_iomem(struct mbox_chan *chan)
	return (void* __iomem)chan->con_priv;
}

static bool meson_mx_ao_arc_mbox_rts(struct mbox_chan *chan)
{
	return readl_relaxed(meson_mx_ao_arc_mbox_iomem(chan)) == 0;
}

static int meson_mx_ao_arc_mbox_send_data(struct mbox_chan *chan, void *data)
{

	u32 *arg = data;

	if (!meson_mx_ao_arc_mbox_rts(chan))
		return -EBUSY;

	writel_relaxed(*arg, meson_mx_ao_arc_mbox_iomem(chan));

	return 0;
}

static int meson_mx_ao_arc_mbox_flush(struct mbox_chan *chan,
				      unsigned long timeout)
{
	timeout = jiffies + msecs_to_jiffies(timeout);

	while (time_before(jiffies, timeout)) {
		if (meson_mx_ao_arc_mbox_rts(chan))
			return 0;

		udelay(5);
	}

	return -ETIMEDOUT;
}

static int meson_mx_ao_arc_mbox_startup(struct mbox_chan *chan)
{
	u32 data = 0;
@@ -43,12 +67,12 @@ static int meson_mx_ao_arc_mbox_startup(struct mbox_chan *chan)

static bool meson_mx_ao_arc_mbox_last_tx_done(struct mbox_chan *chan)
{

	return readl_relaxed(meson_mx_ao_arc_mbox_iomem(chan)) == 0;
	return meson_mx_ao_arc_mbox_rts(chan);
}

static const struct mbox_chan_ops meson_mx_ao_arc_mbox_ops = {
	.send_data	= meson_mx_ao_arc_mbox_send_data,
	.flush		= meson_mx_ao_arc_mbox_flush,
	.startup	= meson_mx_ao_arc_mbox_startup,
	.last_tx_done	= meson_mx_ao_arc_mbox_last_tx_done,
};