Commit a6afa419 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull mailbox updates from Jassi Brar:

 - apple: implement poll and flush callbacks

 - qcom: fix clocks for IPQ6018 and IPQ8074 irq handler as not-a-thread

 - microchip: split reg-space into two

 - imx: RST channel fix

 - bcm: fix dma_map_sg error handling

 - misc: spelling fix in pcc driver

* tag 'mailbox-v6.1' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
  mailbox: qcom-ipcc: flag IRQ NO_THREAD
  mailbox: pcc: Fix spelling mistake "Plaform" -> "Platform"
  mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg
  mailbox: qcom-apcs-ipc: add IPQ8074 APSS clock support
  dt-bindings: mailbox: qcom: correct clocks for IPQ6018 and IPQ8074
  dt-bindings: mailbox: qcom: set correct #clock-cells
  mailbox: mpfs: account for mbox offsets while sending
  mailbox: mpfs: fix handling of the reg property
  dt-bindings: mailbox: fix the mpfs' reg property
  mailbox: imx: fix RST channel support
  mailbox: apple: Implement poll_data() operation
  mailbox: apple: Implement flush() operation
parents bdc753c7 b8ae88e1
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -14,9 +14,15 @@ properties:
    const: microchip,mpfs-mailbox

  reg:
    items:
      - description: mailbox data registers
    oneOf:
      - items:
          - description: mailbox control & data registers
          - description: mailbox interrupt registers
        deprecated: true
      - items:
          - description: mailbox control registers
          - description: mailbox interrupt registers
          - description: mailbox data registers

  interrupts:
    maxItems: 1
@@ -39,7 +45,8 @@ examples:
      #size-cells = <2>;
      mbox: mailbox@37020000 {
        compatible = "microchip,mpfs-mailbox";
        reg = <0x0 0x37020000 0x0 0x1000>, <0x0 0x2000318c 0x0 0x40>;
        reg = <0x0 0x37020000 0x0 0x58>, <0x0 0x2000318C 0x0 0x40>,
              <0x0 0x37020800 0x0 0x100>;
        interrupt-parent = <&L1>;
        interrupts = <96>;
        #mbox-cells = <1>;
+50 −13
Original line number Diff line number Diff line
@@ -45,23 +45,17 @@ properties:
  clocks:
    description: phandles to the parent clocks of the clock driver
    minItems: 2
    items:
      - description: primary pll parent of the clock driver
      - description: auxiliary parent
      - description: reference clock
    maxItems: 3

  '#mbox-cells':
    const: 1

  '#clock-cells':
    const: 0
    enum: [0, 1]

  clock-names:
    minItems: 2
    items:
      - const: pll
      - const: aux
      - const: ref
    maxItems: 3

required:
  - compatible
@@ -75,8 +69,6 @@ allOf:
      properties:
        compatible:
          enum:
            - qcom,ipq6018-apcs-apps-global
            - qcom,ipq8074-apcs-apps-global
            - qcom,msm8916-apcs-kpss-global
            - qcom,msm8994-apcs-kpss-global
            - qcom,msm8996-apcs-hmss-global
@@ -90,7 +82,13 @@ allOf:
    then:
      properties:
        clocks:
          maxItems: 2
          items:
            - description: primary pll parent of the clock driver
            - description: auxiliary parent
        clock-names:
          items:
            - const: pll
            - const: aux
  - if:
      properties:
        compatible:
@@ -99,7 +97,46 @@ allOf:
    then:
      properties:
        clocks:
          maxItems: 3
          items:
            - description: primary pll parent of the clock driver
            - description: auxiliary parent
            - description: reference clock
        clock-names:
          items:
            - const: pll
            - const: aux
            - const: ref
  - if:
      properties:
        compatible:
          enum:
            - qcom,ipq6018-apcs-apps-global
            - qcom,ipq8074-apcs-apps-global
    then:
      properties:
        clocks:
          items:
            - description: primary pll parent of the clock driver
            - description: XO clock
        clock-names:
          items:
            - const: pll
            - const: xo
  - if:
      properties:
        compatible:
          enum:
            - qcom,ipq6018-apcs-apps-global
            - qcom,ipq8074-apcs-apps-global
    then:
      properties:
        '#clock-cells':
          const: 1
    else:
      properties:
        '#clock-cells':
          const: 0

examples:

  # Example apcs with msm8996
+60 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
 */

#include <linux/apple-mailbox.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/gfp.h>
#include <linux/interrupt.h>
@@ -25,6 +26,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/types.h>

#define APPLE_ASC_MBOX_CONTROL_FULL  BIT(16)
@@ -100,6 +102,7 @@ struct apple_mbox {

	struct device *dev;
	struct mbox_controller controller;
	spinlock_t rx_lock;
};

static const struct of_device_id apple_mbox_of_match[];
@@ -112,6 +115,14 @@ static bool apple_mbox_hw_can_send(struct apple_mbox *apple_mbox)
	return !(mbox_ctrl & apple_mbox->hw->control_full);
}

static bool apple_mbox_hw_send_empty(struct apple_mbox *apple_mbox)
{
	u32 mbox_ctrl =
		readl_relaxed(apple_mbox->regs + apple_mbox->hw->a2i_control);

	return mbox_ctrl & apple_mbox->hw->control_empty;
}

static int apple_mbox_hw_send(struct apple_mbox *apple_mbox,
			      struct apple_mbox_msg *msg)
{
@@ -195,13 +206,15 @@ static irqreturn_t apple_mbox_send_empty_irq(int irq, void *data)
	return IRQ_HANDLED;
}

static irqreturn_t apple_mbox_recv_irq(int irq, void *data)
static int apple_mbox_poll(struct apple_mbox *apple_mbox)
{
	struct apple_mbox *apple_mbox = data;
	struct apple_mbox_msg msg;
	int ret = 0;

	while (apple_mbox_hw_recv(apple_mbox, &msg) == 0)
	while (apple_mbox_hw_recv(apple_mbox, &msg) == 0) {
		mbox_chan_received_data(&apple_mbox->chan, (void *)&msg);
		ret++;
	}

	/*
	 * The interrupt will keep firing even if there are no more messages
@@ -216,9 +229,50 @@ static irqreturn_t apple_mbox_recv_irq(int irq, void *data)
			       apple_mbox->regs + apple_mbox->hw->irq_ack);
	}

	return ret;
}

static irqreturn_t apple_mbox_recv_irq(int irq, void *data)
{
	struct apple_mbox *apple_mbox = data;

	spin_lock(&apple_mbox->rx_lock);
	apple_mbox_poll(apple_mbox);
	spin_unlock(&apple_mbox->rx_lock);

	return IRQ_HANDLED;
}

static bool apple_mbox_chan_peek_data(struct mbox_chan *chan)
{
	struct apple_mbox *apple_mbox = chan->con_priv;
	unsigned long flags;
	int ret;

	spin_lock_irqsave(&apple_mbox->rx_lock, flags);
	ret = apple_mbox_poll(apple_mbox);
	spin_unlock_irqrestore(&apple_mbox->rx_lock, flags);

	return ret > 0;
}

static int apple_mbox_chan_flush(struct mbox_chan *chan, unsigned long timeout)
{
	struct apple_mbox *apple_mbox = chan->con_priv;
	unsigned long deadline = jiffies + msecs_to_jiffies(timeout);

	while (time_before(jiffies, deadline)) {
		if (apple_mbox_hw_send_empty(apple_mbox)) {
			mbox_chan_txdone(&apple_mbox->chan, 0);
			return 0;
		}

		udelay(1);
	}

	return -ETIME;
}

static int apple_mbox_chan_startup(struct mbox_chan *chan)
{
	struct apple_mbox *apple_mbox = chan->con_priv;
@@ -250,6 +304,8 @@ static void apple_mbox_chan_shutdown(struct mbox_chan *chan)

static const struct mbox_chan_ops apple_mbox_ops = {
	.send_data = apple_mbox_chan_send_data,
	.peek_data = apple_mbox_chan_peek_data,
	.flush = apple_mbox_chan_flush,
	.startup = apple_mbox_chan_startup,
	.shutdown = apple_mbox_chan_shutdown,
};
@@ -304,6 +360,7 @@ static int apple_mbox_probe(struct platform_device *pdev)
	mbox->controller.txdone_irq = true;
	mbox->controller.of_xlate = apple_mbox_of_xlate;
	mbox->chan.con_priv = mbox;
	spin_lock_init(&mbox->rx_lock);

	irqname = devm_kasprintf(dev, GFP_KERNEL, "%s-recv", dev_name(dev));
	if (!irqname)
+4 −4
Original line number Diff line number Diff line
@@ -622,15 +622,15 @@ static int flexrm_spu_dma_map(struct device *dev, struct brcm_message *msg)

	rc = dma_map_sg(dev, msg->spu.src, sg_nents(msg->spu.src),
			DMA_TO_DEVICE);
	if (rc < 0)
		return rc;
	if (!rc)
		return -EIO;

	rc = dma_map_sg(dev, msg->spu.dst, sg_nents(msg->spu.dst),
			DMA_FROM_DEVICE);
	if (rc < 0) {
	if (!rc) {
		dma_unmap_sg(dev, msg->spu.src, sg_nents(msg->spu.src),
			     DMA_TO_DEVICE);
		return rc;
		return -EIO;
	}

	return 0;
+5 −5
Original line number Diff line number Diff line
@@ -904,7 +904,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = {
	.xTR	= 0x20,
	.xRR	= 0x40,
	.xSR	= {0x60, 0x60, 0x60, 0x60},
	.xCR	= {0x64, 0x64, 0x64, 0x64},
	.xCR	= {0x64, 0x64, 0x64, 0x64, 0x64},
};

static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = {
@@ -927,7 +927,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp_s4 = {
	.xTR	= 0x200,
	.xRR	= 0x280,
	.xSR	= {0xC, 0x118, 0x124, 0x12C},
	.xCR	= {0x110, 0x114, 0x120, 0x128},
	.xCR	= {0x8, 0x110, 0x114, 0x120, 0x128},
};

static const struct imx_mu_dcfg imx_mu_cfg_imx93_s4 = {
@@ -938,7 +938,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx93_s4 = {
	.xTR	= 0x200,
	.xRR	= 0x280,
	.xSR	= {0xC, 0x118, 0x124, 0x12C},
	.xCR	= {0x110, 0x114, 0x120, 0x128},
	.xCR	= {0x8, 0x110, 0x114, 0x120, 0x128},
};

static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = {
@@ -949,7 +949,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = {
	.xTR	= 0x0,
	.xRR	= 0x10,
	.xSR	= {0x20, 0x20, 0x20, 0x20},
	.xCR	= {0x24, 0x24, 0x24, 0x24},
	.xCR	= {0x24, 0x24, 0x24, 0x24, 0x24},
};

static const struct imx_mu_dcfg imx_mu_cfg_imx8_seco = {
@@ -960,7 +960,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8_seco = {
	.xTR	= 0x0,
	.xRR	= 0x10,
	.xSR	= {0x20, 0x20, 0x20, 0x20},
	.xCR	= {0x24, 0x24, 0x24, 0x24},
	.xCR	= {0x24, 0x24, 0x24, 0x24, 0x24},
};

static const struct of_device_id imx_mu_dt_ids[] = {
Loading