]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge tag 'arm-soc-pmdomain' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantos...
authorOlof Johansson <olof@lixom.net>
Wed, 19 Apr 2017 12:58:02 +0000 (05:58 -0700)
committerOlof Johansson <olof@lixom.net>
Wed, 19 Apr 2017 12:58:02 +0000 (05:58 -0700)
ARM SOC PM domain support for 4.12

Dave Gerlach (5):
      PM / Domains: Add generic data pointer to genpd data struct
      PM / Domains: Do not check if simple providers have phandle cells
      dt-bindings: Add TI SCI PM Domains
      soc: ti: Add ti_sci_pm_domains driver
      ARM: keystone: Drop PM domain support for k2g

* tag 'arm-soc-pmdomain' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone:
  ARM: keystone: Drop PM domain support for k2g
  soc: ti: Add ti_sci_pm_domains driver
  dt-bindings: Add TI SCI PM Domains
  PM / Domains: Do not check if simple providers have phandle cells
  PM / Domains: Add generic data pointer to genpd data struct

Signed-off-by: Olof Johansson <olof@lixom.net>
24 files changed:
Documentation/devicetree/bindings/reset/fsl,imx7-src.txt [new file with mode: 0644]
MAINTAINERS
drivers/ata/Kconfig
drivers/ata/Makefile
drivers/ata/pata_bk3710.c [new file with mode: 0644]
drivers/firmware/arm_scpi.c
drivers/firmware/meson/meson_sm.c
drivers/nvmem/meson-efuse.c
drivers/reset/Kconfig
drivers/reset/Makefile
drivers/reset/reset-a10sr.c [new file with mode: 0644]
drivers/reset/reset-ath79.c
drivers/reset/reset-imx7.c [new file with mode: 0644]
drivers/reset/reset-meson.c
drivers/reset/reset-oxnas.c
drivers/reset/reset-pistachio.c
drivers/reset/reset-socfpga.c
drivers/reset/reset-sunxi.c
drivers/reset/reset-uniphier.c
drivers/soc/bcm/brcmstb/common.c
drivers/soc/renesas/renesas-soc.c
include/dt-bindings/reset/altr,rst-mgr-a10sr.h [new file with mode: 0644]
include/dt-bindings/reset/imx7-reset.h [new file with mode: 0644]
include/linux/firmware/meson/meson_sm.h

diff --git a/Documentation/devicetree/bindings/reset/fsl,imx7-src.txt b/Documentation/devicetree/bindings/reset/fsl,imx7-src.txt
new file mode 100644 (file)
index 0000000..5e1afc3
--- /dev/null
@@ -0,0 +1,47 @@
+Freescale i.MX7 System Reset Controller
+======================================
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "fsl,imx7-src", "syscon"
+- reg: should be register base and length as documented in the
+  datasheet
+- interrupts: Should contain SRC interrupt
+- #reset-cells: 1, see below
+
+example:
+
+src: reset-controller@30390000 {
+     compatible = "fsl,imx7d-src", "syscon";
+     reg = <0x30390000 0x2000>;
+     interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
+     #reset-cells = <1>;
+};
+
+
+Specifying reset lines connected to IP modules
+==============================================
+
+The system reset controller can be used to reset various set of
+peripherals. Device nodes that need access to reset lines should
+specify them as a reset phandle in their corresponding node as
+specified in reset.txt.
+
+Example:
+
+       pcie: pcie@33800000 {
+
+               ...
+
+               resets = <&src IMX7_RESET_PCIEPHY>,
+                        <&src IMX7_RESET_PCIE_CTRL_APPS_EN>;
+               reset-names = "pciephy", "apps";
+
+               ...
+        };
+
+
+For list of all valid reset indicies see
+<dt-bindings/reset/imx7-reset.h>
index e4ceac9f604911775a6b23215898df28df5dfb31..eaede8c3363183ccad81415fd7b883b7f18a5939 100644 (file)
@@ -653,7 +653,9 @@ M:  Thor Thayer <thor.thayer@linux.intel.com>
 S:     Maintained
 F:     drivers/gpio/gpio-altera-a10sr.c
 F:     drivers/mfd/altera-a10sr.c
+F:     drivers/reset/reset-a10sr.c
 F:     include/linux/mfd/altera-a10sr.h
+F:     include/dt-bindings/reset/altr,rst-mgr-a10sr.h
 
 ALTERA TRIPLE SPEED ETHERNET DRIVER
 M:     Vince Bridgers <vbridger@opensource.altera.com>
index 70b57d2229d6657c57c054fa9272484bdc397ca1..38fa4acc9b26ed25265487c5e16e851ea7d41809 100644 (file)
@@ -510,6 +510,15 @@ config PATA_BF54X
 
          If unsure, say N.
 
+config PATA_BK3710
+       tristate "Palmchip BK3710 PATA support"
+       depends on ARCH_DAVINCI
+       help
+         This option enables support for the integrated IDE controller on
+         the TI DaVinci SoC.
+
+         If unsure, say N.
+
 config PATA_CMD64X
        tristate "CMD64x PATA support"
        depends on PCI
index 89a0a1915d36081e4c6ee9dc6ad4b4dfd055b5c9..9438db855d57ba31e4ab22aeb9c73d660814c880 100644 (file)
@@ -50,6 +50,7 @@ obj-$(CONFIG_PATA_ARTOP)      += pata_artop.o
 obj-$(CONFIG_PATA_ATIIXP)      += pata_atiixp.o
 obj-$(CONFIG_PATA_ATP867X)     += pata_atp867x.o
 obj-$(CONFIG_PATA_BF54X)       += pata_bf54x.o
+obj-$(CONFIG_PATA_BK3710)      += pata_bk3710.o
 obj-$(CONFIG_PATA_CMD64X)      += pata_cmd64x.o
 obj-$(CONFIG_PATA_CS5520)      += pata_cs5520.o
 obj-$(CONFIG_PATA_CS5530)      += pata_cs5530.o
diff --git a/drivers/ata/pata_bk3710.c b/drivers/ata/pata_bk3710.c
new file mode 100644 (file)
index 0000000..6c3bd5f
--- /dev/null
@@ -0,0 +1,382 @@
+/*
+ * Palmchip BK3710 PATA controller driver
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * Based on palm_bk3710.c:
+ *
+ * Copyright (C) 2006 Texas Instruments.
+ * Copyright (C) 2007 MontaVista Software, Inc., <source@mvista.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/ata.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/kernel.h>
+#include <linux/libata.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+
+#define DRV_NAME "pata_bk3710"
+
+#define BK3710_TF_OFFSET       0x1F0
+#define BK3710_CTL_OFFSET      0x3F6
+
+#define BK3710_BMISP           0x02
+#define BK3710_IDETIMP         0x40
+#define BK3710_UDMACTL         0x48
+#define BK3710_MISCCTL         0x50
+#define BK3710_REGSTB          0x54
+#define BK3710_REGRCVR         0x58
+#define BK3710_DATSTB          0x5C
+#define BK3710_DATRCVR         0x60
+#define BK3710_DMASTB          0x64
+#define BK3710_DMARCVR         0x68
+#define BK3710_UDMASTB         0x6C
+#define BK3710_UDMATRP         0x70
+#define BK3710_UDMAENV         0x74
+#define BK3710_IORDYTMP                0x78
+
+static struct scsi_host_template pata_bk3710_sht = {
+       ATA_BMDMA_SHT(DRV_NAME),
+};
+
+static unsigned int ideclk_period; /* in nanoseconds */
+
+struct pata_bk3710_udmatiming {
+       unsigned int rptime;    /* tRP -- Ready to pause time (nsec) */
+       unsigned int cycletime; /* tCYCTYP2/2 -- avg Cycle Time (nsec) */
+                               /* tENV is always a minimum of 20 nsec */
+};
+
+static const struct pata_bk3710_udmatiming pata_bk3710_udmatimings[6] = {
+       { 160, 240 / 2 },       /* UDMA Mode 0 */
+       { 125, 160 / 2 },       /* UDMA Mode 1 */
+       { 100, 120 / 2 },       /* UDMA Mode 2 */
+       { 100,  90 / 2 },       /* UDMA Mode 3 */
+       { 100,  60 / 2 },       /* UDMA Mode 4 */
+       {  85,  40 / 2 },       /* UDMA Mode 5 */
+};
+
+static void pata_bk3710_setudmamode(void __iomem *base, unsigned int dev,
+                                   unsigned int mode)
+{
+       u32 val32;
+       u16 val16;
+       u8 tenv, trp, t0;
+
+       /* DMA Data Setup */
+       t0 = DIV_ROUND_UP(pata_bk3710_udmatimings[mode].cycletime,
+                         ideclk_period) - 1;
+       tenv = DIV_ROUND_UP(20, ideclk_period) - 1;
+       trp = DIV_ROUND_UP(pata_bk3710_udmatimings[mode].rptime,
+                          ideclk_period) - 1;
+
+       /* udmastb Ultra DMA Access Strobe Width */
+       val32 = ioread32(base + BK3710_UDMASTB) & (0xFF << (dev ? 0 : 8));
+       val32 |= t0 << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_UDMASTB);
+
+       /* udmatrp Ultra DMA Ready to Pause Time */
+       val32 = ioread32(base + BK3710_UDMATRP) & (0xFF << (dev ? 0 : 8));
+       val32 |= trp << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_UDMATRP);
+
+       /* udmaenv Ultra DMA envelop Time */
+       val32 = ioread32(base + BK3710_UDMAENV) & (0xFF << (dev ? 0 : 8));
+       val32 |= tenv << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_UDMAENV);
+
+       /* Enable UDMA for Device */
+       val16 = ioread16(base + BK3710_UDMACTL) | (1 << dev);
+       iowrite16(val16, base + BK3710_UDMACTL);
+}
+
+static void pata_bk3710_setmwdmamode(void __iomem *base, unsigned int dev,
+                                    unsigned short min_cycle,
+                                    unsigned int mode)
+{
+       const struct ata_timing *t;
+       int cycletime;
+       u32 val32;
+       u16 val16;
+       u8 td, tkw, t0;
+
+       t = ata_timing_find_mode(mode);
+       cycletime = max_t(int, t->cycle, min_cycle);
+
+       /* DMA Data Setup */
+       t0 = DIV_ROUND_UP(cycletime, ideclk_period);
+       td = DIV_ROUND_UP(t->active, ideclk_period);
+       tkw = t0 - td - 1;
+       td--;
+
+       val32 = ioread32(base + BK3710_DMASTB) & (0xFF << (dev ? 0 : 8));
+       val32 |= td << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_DMASTB);
+
+       val32 = ioread32(base + BK3710_DMARCVR) & (0xFF << (dev ? 0 : 8));
+       val32 |= tkw << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_DMARCVR);
+
+       /* Disable UDMA for Device */
+       val16 = ioread16(base + BK3710_UDMACTL) & ~(1 << dev);
+       iowrite16(val16, base + BK3710_UDMACTL);
+}
+
+static void pata_bk3710_set_dmamode(struct ata_port *ap,
+                                   struct ata_device *adev)
+{
+       void __iomem *base = (void __iomem *)ap->ioaddr.bmdma_addr;
+       int is_slave = adev->devno;
+       const u8 xferspeed = adev->dma_mode;
+
+       if (xferspeed >= XFER_UDMA_0)
+               pata_bk3710_setudmamode(base, is_slave,
+                                       xferspeed - XFER_UDMA_0);
+       else
+               pata_bk3710_setmwdmamode(base, is_slave,
+                                        adev->id[ATA_ID_EIDE_DMA_MIN],
+                                        xferspeed);
+}
+
+static void pata_bk3710_setpiomode(void __iomem *base, struct ata_device *pair,
+                                  unsigned int dev, unsigned int cycletime,
+                                  unsigned int mode)
+{
+       const struct ata_timing *t;
+       u32 val32;
+       u8 t2, t2i, t0;
+
+       t = ata_timing_find_mode(XFER_PIO_0 + mode);
+
+       /* PIO Data Setup */
+       t0 = DIV_ROUND_UP(cycletime, ideclk_period);
+       t2 = DIV_ROUND_UP(t->active, ideclk_period);
+
+       t2i = t0 - t2 - 1;
+       t2--;
+
+       val32 = ioread32(base + BK3710_DATSTB) & (0xFF << (dev ? 0 : 8));
+       val32 |= t2 << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_DATSTB);
+
+       val32 = ioread32(base + BK3710_DATRCVR) & (0xFF << (dev ? 0 : 8));
+       val32 |= t2i << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_DATRCVR);
+
+       /* FIXME: this is broken also in the old driver */
+       if (pair) {
+               u8 mode2 = pair->pio_mode - XFER_PIO_0;
+
+               if (mode2 < mode)
+                       mode = mode2;
+       }
+
+       /* TASKFILE Setup */
+       t0 = DIV_ROUND_UP(t->cyc8b, ideclk_period);
+       t2 = DIV_ROUND_UP(t->act8b, ideclk_period);
+
+       t2i = t0 - t2 - 1;
+       t2--;
+
+       val32 = ioread32(base + BK3710_REGSTB) & (0xFF << (dev ? 0 : 8));
+       val32 |= t2 << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_REGSTB);
+
+       val32 = ioread32(base + BK3710_REGRCVR) & (0xFF << (dev ? 0 : 8));
+       val32 |= t2i << (dev ? 8 : 0);
+       iowrite32(val32, base + BK3710_REGRCVR);
+}
+
+static void pata_bk3710_set_piomode(struct ata_port *ap,
+                                   struct ata_device *adev)
+{
+       void __iomem *base = (void __iomem *)ap->ioaddr.bmdma_addr;
+       struct ata_device *pair = ata_dev_pair(adev);
+       const struct ata_timing *t = ata_timing_find_mode(adev->pio_mode);
+       const u16 *id = adev->id;
+       unsigned int cycle_time = 0;
+       int is_slave = adev->devno;
+       const u8 pio = adev->pio_mode - XFER_PIO_0;
+
+       if (id[ATA_ID_FIELD_VALID] & 2) {
+               if (ata_id_has_iordy(id))
+                       cycle_time = id[ATA_ID_EIDE_PIO_IORDY];
+               else
+                       cycle_time = id[ATA_ID_EIDE_PIO];
+
+               /* conservative "downgrade" for all pre-ATA2 drives */
+               if (pio < 3 && cycle_time < t->cycle)
+                       cycle_time = 0; /* use standard timing */
+       }
+
+       if (!cycle_time)
+               cycle_time = t->cycle;
+
+       pata_bk3710_setpiomode(base, pair, is_slave, cycle_time, pio);
+}
+
+static void pata_bk3710_chipinit(void __iomem *base)
+{
+       /*
+        * REVISIT:  the ATA reset signal needs to be managed through a
+        * GPIO, which means it should come from platform_data.  Until
+        * we get and use such information, we have to trust that things
+        * have been reset before we get here.
+        */
+
+       /*
+        * Program the IDETIMP Register Value based on the following assumptions
+        *
+        * (ATA_IDETIMP_IDEEN           , ENABLE ) |
+        * (ATA_IDETIMP_PREPOST1        , DISABLE) |
+        * (ATA_IDETIMP_PREPOST0        , DISABLE) |
+        *
+        * DM6446 silicon rev 2.1 and earlier have no observed net benefit
+        * from enabling prefetch/postwrite.
+        */
+       iowrite16(BIT(15), base + BK3710_IDETIMP);
+
+       /*
+        * UDMACTL Ultra-ATA DMA Control
+        * (ATA_UDMACTL_UDMAP1  , 0 ) |
+        * (ATA_UDMACTL_UDMAP0  , 0 )
+        *
+        */
+       iowrite16(0, base + BK3710_UDMACTL);
+
+       /*
+        * MISCCTL Miscellaneous Conrol Register
+        * (ATA_MISCCTL_HWNHLD1P        , 1 cycle)
+        * (ATA_MISCCTL_HWNHLD0P        , 1 cycle)
+        * (ATA_MISCCTL_TIMORIDE        , 1)
+        */
+       iowrite32(0x001, base + BK3710_MISCCTL);
+
+       /*
+        * IORDYTMP IORDY Timer for Primary Register
+        * (ATA_IORDYTMP_IORDYTMP       , DISABLE)
+        */
+       iowrite32(0, base + BK3710_IORDYTMP);
+
+       /*
+        * Configure BMISP Register
+        * (ATA_BMISP_DMAEN1    , DISABLE )     |
+        * (ATA_BMISP_DMAEN0    , DISABLE )     |
+        * (ATA_BMISP_IORDYINT  , CLEAR)        |
+        * (ATA_BMISP_INTRSTAT  , CLEAR)        |
+        * (ATA_BMISP_DMAERROR  , CLEAR)
+        */
+       iowrite16(0xE, base + BK3710_BMISP);
+
+       pata_bk3710_setpiomode(base, NULL, 0, 600, 0);
+       pata_bk3710_setpiomode(base, NULL, 1, 600, 0);
+}
+
+static struct ata_port_operations pata_bk3710_ports_ops = {
+       .inherits               = &ata_bmdma_port_ops,
+       .cable_detect           = ata_cable_80wire,
+
+       .set_piomode            = pata_bk3710_set_piomode,
+       .set_dmamode            = pata_bk3710_set_dmamode,
+};
+
+static int __init pata_bk3710_probe(struct platform_device *pdev)
+{
+       struct clk *clk;
+       struct resource *mem;
+       struct ata_host *host;
+       struct ata_port *ap;
+       void __iomem *base;
+       unsigned long rate;
+       int irq;
+
+       clk = devm_clk_get(&pdev->dev, NULL);
+       if (IS_ERR(clk))
+               return -ENODEV;
+
+       clk_enable(clk);
+       rate = clk_get_rate(clk);
+       if (!rate)
+               return -EINVAL;
+
+       /* NOTE:  round *down* to meet minimum timings; we count in clocks */
+       ideclk_period = 1000000000UL / rate;
+
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+               pr_err(DRV_NAME ": failed to get IRQ resource\n");
+               return irq;
+       }
+
+       base = devm_ioremap_resource(&pdev->dev, mem);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       /* configure the Palmchip controller */
+       pata_bk3710_chipinit(base);
+
+       /* allocate host */
+       host = ata_host_alloc(&pdev->dev, 1);
+       if (!host)
+               return -ENOMEM;
+       ap = host->ports[0];
+
+       ap->ops = &pata_bk3710_ports_ops;
+       ap->pio_mask = ATA_PIO4;
+       ap->mwdma_mask = ATA_MWDMA2;
+       ap->udma_mask = rate < 100000000 ? ATA_UDMA4 : ATA_UDMA5;
+       ap->flags |= ATA_FLAG_SLAVE_POSS;
+
+       ap->ioaddr.data_addr            = base + BK3710_TF_OFFSET;
+       ap->ioaddr.error_addr           = base + BK3710_TF_OFFSET + 1;
+       ap->ioaddr.feature_addr         = base + BK3710_TF_OFFSET + 1;
+       ap->ioaddr.nsect_addr           = base + BK3710_TF_OFFSET + 2;
+       ap->ioaddr.lbal_addr            = base + BK3710_TF_OFFSET + 3;
+       ap->ioaddr.lbam_addr            = base + BK3710_TF_OFFSET + 4;
+       ap->ioaddr.lbah_addr            = base + BK3710_TF_OFFSET + 5;
+       ap->ioaddr.device_addr          = base + BK3710_TF_OFFSET + 6;
+       ap->ioaddr.status_addr          = base + BK3710_TF_OFFSET + 7;
+       ap->ioaddr.command_addr         = base + BK3710_TF_OFFSET + 7;
+
+       ap->ioaddr.altstatus_addr       = base + BK3710_CTL_OFFSET;
+       ap->ioaddr.ctl_addr             = base + BK3710_CTL_OFFSET;
+
+       ap->ioaddr.bmdma_addr           = base;
+
+       ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx",
+                     (unsigned long)base + BK3710_TF_OFFSET,
+                     (unsigned long)base + BK3710_CTL_OFFSET);
+
+       /* activate */
+       return ata_host_activate(host, irq, ata_sff_interrupt, 0,
+                                &pata_bk3710_sht);
+}
+
+/* work with hotplug and coldplug */
+MODULE_ALIAS("platform:palm_bk3710");
+
+static struct platform_driver pata_bk3710_driver = {
+       .driver = {
+               .name = "palm_bk3710",
+       },
+};
+
+static int __init pata_bk3710_init(void)
+{
+       return platform_driver_probe(&pata_bk3710_driver, pata_bk3710_probe);
+}
+
+module_init(pata_bk3710_init);
+MODULE_LICENSE("GPL");
index 9ad0b1934be9a31173ede1ed6c1c3705cc0c1e05..f6cfc31d34c71578623258bbe7443e4023b8a485 100644 (file)
@@ -538,7 +538,7 @@ static int scpi_send_message(u8 idx, void *tx_buf, unsigned int tx_len,
        msg->tx_len = tx_len;
        msg->rx_buf = rx_buf;
        msg->rx_len = rx_len;
-       init_completion(&msg->done);
+       reinit_completion(&msg->done);
 
        ret = mbox_send_message(scpi_chan->chan, msg);
        if (ret < 0 || !rx_buf)
@@ -872,8 +872,11 @@ static int scpi_alloc_xfer_list(struct device *dev, struct scpi_chan *ch)
                return -ENOMEM;
 
        ch->xfers = xfers;
-       for (i = 0; i < MAX_SCPI_XFERS; i++, xfers++)
+       for (i = 0; i < MAX_SCPI_XFERS; i++, xfers++) {
+               init_completion(&xfers->done);
                list_add_tail(&xfers->node, &ch->xfers_list);
+       }
+
        return 0;
 }
 
index b0d254930ed35cd86efa782d631582bcabda22b4..ff204421117b8bd9c836a41e6f439f592f21c565 100644 (file)
@@ -127,6 +127,7 @@ EXPORT_SYMBOL(meson_sm_call);
  * meson_sm_call_read - retrieve data from secure-monitor
  *
  * @buffer:    Buffer to store the retrieved data
+ * @bsize:     Size of the buffer
  * @cmd_index: Index of the SMC32 function ID
  * @arg0:      SMC32 Argument 0
  * @arg1:      SMC32 Argument 1
@@ -135,11 +136,14 @@ EXPORT_SYMBOL(meson_sm_call);
  * @arg4:      SMC32 Argument 4
  *
  * Return:     size of read data on success, a negative value on error
+ *             When 0 is returned there is no guarantee about the amount of
+ *             data read and bsize bytes are copied in buffer.
  */
-int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0,
-                      u32 arg1, u32 arg2, u32 arg3, u32 arg4)
+int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index,
+                      u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
 {
        u32 size;
+       int ret;
 
        if (!fw.chip)
                return -ENOENT;
@@ -147,16 +151,24 @@ int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0,
        if (!fw.chip->cmd_shmem_out_base)
                return -EINVAL;
 
+       if (bsize > fw.chip->shmem_size)
+               return -EINVAL;
+
        if (meson_sm_call(cmd_index, &size, arg0, arg1, arg2, arg3, arg4) < 0)
                return -EINVAL;
 
-       if (!size || size > fw.chip->shmem_size)
+       if (size > bsize)
                return -EINVAL;
 
+       ret = size;
+
+       if (!size)
+               size = bsize;
+
        if (buffer)
                memcpy(buffer, fw.sm_shmem_out_base, size);
 
-       return size;
+       return ret;
 }
 EXPORT_SYMBOL(meson_sm_call_read);
 
index f207c3b1048200d6a37586de7acaf5071a9bf2c0..70bfc9839bb2fede6ec424f23d933805ba3f4812 100644 (file)
@@ -27,7 +27,7 @@ static int meson_efuse_read(void *context, unsigned int offset,
        u8 *buf = val;
        int ret;
 
-       ret = meson_sm_call_read(buf, SM_EFUSE_READ, offset,
+       ret = meson_sm_call_read(buf, bytes, SM_EFUSE_READ, offset,
                                 bytes, 0, 0, 0);
        if (ret < 0)
                return ret;
index f4cdfe94b9ec0b4124b3f9680b23c283d546f867..d21c07ccc94e501ff44206c151a8bc5c48db513e 100644 (file)
@@ -14,6 +14,13 @@ menuconfig RESET_CONTROLLER
 
 if RESET_CONTROLLER
 
+config RESET_A10SR
+       tristate "Altera Arria10 System Resource Reset"
+       depends on MFD_ALTERA_A10SR
+       help
+         This option enables support for the external reset functions for
+         peripheral PHYs on the Altera Arria10 System Resource Chip.
+
 config RESET_ATH79
        bool "AR71xx Reset Driver" if COMPILE_TEST
        default ATH79
@@ -27,6 +34,13 @@ config RESET_BERLIN
        help
          This enables the reset controller driver for Marvell Berlin SoCs.
 
+config RESET_IMX7
+       bool "i.MX7 Reset Driver" if COMPILE_TEST
+       default SOC_IMX7D
+       select MFD_SYSCON
+       help
+         This enables the reset controller driver for i.MX7 SoCs.
+
 config RESET_LPC18XX
        bool "LPC18xx/43xx Reset Driver" if COMPILE_TEST
        default ARCH_LPC18XX
index 2cd3f6c45165a8f4a3a1e5c31c92e7f2fa69a8f8..02a74db94339750d4bb57b2450f24d29caed4128 100644 (file)
@@ -2,8 +2,10 @@ obj-y += core.o
 obj-y += hisilicon/
 obj-$(CONFIG_ARCH_STI) += sti/
 obj-$(CONFIG_ARCH_TEGRA) += tegra/
+obj-$(CONFIG_RESET_A10SR) += reset-a10sr.o
 obj-$(CONFIG_RESET_ATH79) += reset-ath79.o
 obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o
+obj-$(CONFIG_RESET_IMX7) += reset-imx7.o
 obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
 obj-$(CONFIG_RESET_MESON) += reset-meson.o
 obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
@@ -15,3 +17,4 @@ obj-$(CONFIG_TI_SYSCON_RESET) += reset-ti-syscon.o
 obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
 obj-$(CONFIG_RESET_ZX2967) += reset-zx2967.o
 obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o
+
diff --git a/drivers/reset/reset-a10sr.c b/drivers/reset/reset-a10sr.c
new file mode 100644 (file)
index 0000000..37496bd
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ *  Copyright Intel Corporation (C) 2017. All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Reset driver for Altera Arria10 MAX5 System Resource Chip
+ *
+ * Adapted from reset-socfpga.c
+ */
+
+#include <linux/err.h>
+#include <linux/mfd/altera-a10sr.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/reset/altr,rst-mgr-a10sr.h>
+
+struct a10sr_reset {
+       struct reset_controller_dev     rcdev;
+       struct regmap *regmap;
+};
+
+static inline struct a10sr_reset *to_a10sr_rst(struct reset_controller_dev *rc)
+{
+       return container_of(rc, struct a10sr_reset, rcdev);
+}
+
+static inline int a10sr_reset_shift(unsigned long id)
+{
+       switch (id) {
+       case A10SR_RESET_ENET_HPS:
+               return 1;
+       case A10SR_RESET_PCIE:
+       case A10SR_RESET_FILE:
+       case A10SR_RESET_BQSPI:
+       case A10SR_RESET_USB:
+               return id + 11;
+       default:
+               return -EINVAL;
+       }
+}
+
+static int a10sr_reset_update(struct reset_controller_dev *rcdev,
+                             unsigned long id, bool assert)
+{
+       struct a10sr_reset *a10r = to_a10sr_rst(rcdev);
+       int offset = a10sr_reset_shift(id);
+       u8 mask = ALTR_A10SR_REG_BIT_MASK(offset);
+       int index = ALTR_A10SR_HPS_RST_REG + ALTR_A10SR_REG_OFFSET(offset);
+
+       return regmap_update_bits(a10r->regmap, index, mask, assert ? 0 : mask);
+}
+
+static int a10sr_reset_assert(struct reset_controller_dev *rcdev,
+                             unsigned long id)
+{
+       return a10sr_reset_update(rcdev, id, true);
+}
+
+static int a10sr_reset_deassert(struct reset_controller_dev *rcdev,
+                               unsigned long id)
+{
+       return a10sr_reset_update(rcdev, id, false);
+}
+
+static int a10sr_reset_status(struct reset_controller_dev *rcdev,
+                             unsigned long id)
+{
+       int ret;
+       struct a10sr_reset *a10r = to_a10sr_rst(rcdev);
+       int offset = a10sr_reset_shift(id);
+       u8 mask = ALTR_A10SR_REG_BIT_MASK(offset);
+       int index = ALTR_A10SR_HPS_RST_REG + ALTR_A10SR_REG_OFFSET(offset);
+       unsigned int value;
+
+       ret = regmap_read(a10r->regmap, index, &value);
+       if (ret < 0)
+               return ret;
+
+       return !!(value & mask);
+}
+
+static const struct reset_control_ops a10sr_reset_ops = {
+       .assert         = a10sr_reset_assert,
+       .deassert       = a10sr_reset_deassert,
+       .status         = a10sr_reset_status,
+};
+
+static int a10sr_reset_probe(struct platform_device *pdev)
+{
+       struct altr_a10sr *a10sr = dev_get_drvdata(pdev->dev.parent);
+       struct a10sr_reset *a10r;
+
+       a10r = devm_kzalloc(&pdev->dev, sizeof(struct a10sr_reset),
+                           GFP_KERNEL);
+       if (!a10r)
+               return -ENOMEM;
+
+       a10r->rcdev.owner = THIS_MODULE;
+       a10r->rcdev.nr_resets = A10SR_RESET_NUM;
+       a10r->rcdev.ops = &a10sr_reset_ops;
+       a10r->rcdev.of_node = pdev->dev.of_node;
+       a10r->regmap = a10sr->regmap;
+
+       platform_set_drvdata(pdev, a10r);
+
+       return devm_reset_controller_register(&pdev->dev, &a10r->rcdev);
+}
+
+static const struct of_device_id a10sr_reset_of_match[] = {
+       { .compatible = "altr,a10sr-reset" },
+       { },
+};
+MODULE_DEVICE_TABLE(of, a10sr_reset_of_match);
+
+static struct platform_driver a10sr_reset_driver = {
+       .probe  = a10sr_reset_probe,
+       .driver = {
+               .name           = "altr_a10sr_reset",
+       },
+};
+module_platform_driver(a10sr_reset_driver);
+
+MODULE_AUTHOR("Thor Thayer <thor.thayer@linux.intel.com>");
+MODULE_DESCRIPTION("Altera Arria10 System Resource Reset Controller Driver");
+MODULE_LICENSE("GPL v2");
index 6b97631f548932158e7e84b29fdc5cc63f5e2049..2674880e5492be7be62b7053abe776961ba013ef 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * AR71xx Reset Controller Driver
+ * Author: Alban Bedel
+ *
  * Copyright (C) 2015 Alban Bedel <albeu@free.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -13,7 +16,7 @@
  */
 
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
 #include <linux/reboot.h>
@@ -127,31 +130,17 @@ static int ath79_reset_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int ath79_reset_remove(struct platform_device *pdev)
-{
-       struct ath79_reset *ath79_reset = platform_get_drvdata(pdev);
-
-       unregister_restart_handler(&ath79_reset->restart_nb);
-
-       return 0;
-}
-
 static const struct of_device_id ath79_reset_dt_ids[] = {
        { .compatible = "qca,ar7100-reset", },
        { },
 };
-MODULE_DEVICE_TABLE(of, ath79_reset_dt_ids);
 
 static struct platform_driver ath79_reset_driver = {
        .probe  = ath79_reset_probe,
-       .remove = ath79_reset_remove,
        .driver = {
-               .name           = "ath79-reset",
-               .of_match_table = ath79_reset_dt_ids,
+               .name                   = "ath79-reset",
+               .of_match_table         = ath79_reset_dt_ids,
+               .suppress_bind_attrs    = true,
        },
 };
-module_platform_driver(ath79_reset_driver);
-
-MODULE_AUTHOR("Alban Bedel <albeu@free.fr>");
-MODULE_DESCRIPTION("AR71xx Reset Controller Driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(ath79_reset_driver);
diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c
new file mode 100644 (file)
index 0000000..4db177b
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2017, Impinj, Inc.
+ *
+ * i.MX7 System Reset Controller (SRC) driver
+ *
+ * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/mfd/syscon.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/regmap.h>
+#include <dt-bindings/reset/imx7-reset.h>
+
+struct imx7_src {
+       struct reset_controller_dev rcdev;
+       struct regmap *regmap;
+};
+
+enum imx7_src_registers {
+       SRC_A7RCR0              = 0x0004,
+       SRC_M4RCR               = 0x000c,
+       SRC_ERCR                = 0x0014,
+       SRC_HSICPHY_RCR         = 0x001c,
+       SRC_USBOPHY1_RCR        = 0x0020,
+       SRC_USBOPHY2_RCR        = 0x0024,
+       SRC_MIPIPHY_RCR         = 0x0028,
+       SRC_PCIEPHY_RCR         = 0x002c,
+       SRC_DDRC_RCR            = 0x1000,
+};
+
+struct imx7_src_signal {
+       unsigned int offset, bit;
+};
+
+static const struct imx7_src_signal imx7_src_signals[IMX7_RESET_NUM] = {
+       [IMX7_RESET_A7_CORE_POR_RESET0] = { SRC_A7RCR0, BIT(0) },
+       [IMX7_RESET_A7_CORE_POR_RESET1] = { SRC_A7RCR0, BIT(1) },
+       [IMX7_RESET_A7_CORE_RESET0]     = { SRC_A7RCR0, BIT(4) },
+       [IMX7_RESET_A7_CORE_RESET1]     = { SRC_A7RCR0, BIT(5) },
+       [IMX7_RESET_A7_DBG_RESET0]      = { SRC_A7RCR0, BIT(8) },
+       [IMX7_RESET_A7_DBG_RESET1]      = { SRC_A7RCR0, BIT(9) },
+       [IMX7_RESET_A7_ETM_RESET0]      = { SRC_A7RCR0, BIT(12) },
+       [IMX7_RESET_A7_ETM_RESET1]      = { SRC_A7RCR0, BIT(13) },
+       [IMX7_RESET_A7_SOC_DBG_RESET]   = { SRC_A7RCR0, BIT(20) },
+       [IMX7_RESET_A7_L2RESET]         = { SRC_A7RCR0, BIT(21) },
+       [IMX7_RESET_SW_M4C_RST]         = { SRC_M4RCR, BIT(1) },
+       [IMX7_RESET_SW_M4P_RST]         = { SRC_M4RCR, BIT(2) },
+       [IMX7_RESET_EIM_RST]            = { SRC_ERCR, BIT(0) },
+       [IMX7_RESET_HSICPHY_PORT_RST]   = { SRC_HSICPHY_RCR, BIT(1) },
+       [IMX7_RESET_USBPHY1_POR]        = { SRC_USBOPHY1_RCR, BIT(0) },
+       [IMX7_RESET_USBPHY1_PORT_RST]   = { SRC_USBOPHY1_RCR, BIT(1) },
+       [IMX7_RESET_USBPHY2_POR]        = { SRC_USBOPHY2_RCR, BIT(0) },
+       [IMX7_RESET_USBPHY2_PORT_RST]   = { SRC_USBOPHY2_RCR, BIT(1) },
+       [IMX7_RESET_MIPI_PHY_MRST]      = { SRC_MIPIPHY_RCR, BIT(1) },
+       [IMX7_RESET_MIPI_PHY_SRST]      = { SRC_MIPIPHY_RCR, BIT(2) },
+       [IMX7_RESET_PCIEPHY]            = { SRC_PCIEPHY_RCR, BIT(2) | BIT(1) },
+       [IMX7_RESET_PCIEPHY_PERST]      = { SRC_PCIEPHY_RCR, BIT(3) },
+       [IMX7_RESET_PCIE_CTRL_APPS_EN]  = { SRC_PCIEPHY_RCR, BIT(6) },
+       [IMX7_RESET_DDRC_PRST]          = { SRC_DDRC_RCR, BIT(0) },
+       [IMX7_RESET_DDRC_CORE_RST]      = { SRC_DDRC_RCR, BIT(1) },
+};
+
+static struct imx7_src *to_imx7_src(struct reset_controller_dev *rcdev)
+{
+       return container_of(rcdev, struct imx7_src, rcdev);
+}
+
+static int imx7_reset_set(struct reset_controller_dev *rcdev,
+                         unsigned long id, bool assert)
+{
+       struct imx7_src *imx7src = to_imx7_src(rcdev);
+       const struct imx7_src_signal *signal = &imx7_src_signals[id];
+       unsigned int value = 0;
+
+       switch (id) {
+       case IMX7_RESET_PCIEPHY:
+               /*
+                * wait for more than 10us to release phy g_rst and
+                * btnrst
+                */
+               if (!assert)
+                       udelay(10);
+               break;
+
+       case IMX7_RESET_PCIE_CTRL_APPS_EN:
+               value = (assert) ? 0 : signal->bit;
+               break;
+       }
+
+       return regmap_update_bits(imx7src->regmap,
+                                 signal->offset, signal->bit, value);
+}
+
+static int imx7_reset_assert(struct reset_controller_dev *rcdev,
+                            unsigned long id)
+{
+       return imx7_reset_set(rcdev, id, true);
+}
+
+static int imx7_reset_deassert(struct reset_controller_dev *rcdev,
+                              unsigned long id)
+{
+       return imx7_reset_set(rcdev, id, false);
+}
+
+static const struct reset_control_ops imx7_reset_ops = {
+       .assert         = imx7_reset_assert,
+       .deassert       = imx7_reset_deassert,
+};
+
+static int imx7_reset_probe(struct platform_device *pdev)
+{
+       struct imx7_src *imx7src;
+       struct device *dev = &pdev->dev;
+       struct regmap_config config = { .name = "src" };
+
+       imx7src = devm_kzalloc(dev, sizeof(*imx7src), GFP_KERNEL);
+       if (!imx7src)
+               return -ENOMEM;
+
+       imx7src->regmap = syscon_node_to_regmap(dev->of_node);
+       if (IS_ERR(imx7src->regmap)) {
+               dev_err(dev, "Unable to get imx7-src regmap");
+               return PTR_ERR(imx7src->regmap);
+       }
+       regmap_attach_dev(dev, imx7src->regmap, &config);
+
+       imx7src->rcdev.owner     = THIS_MODULE;
+       imx7src->rcdev.nr_resets = IMX7_RESET_NUM;
+       imx7src->rcdev.ops       = &imx7_reset_ops;
+       imx7src->rcdev.of_node   = dev->of_node;
+
+       return devm_reset_controller_register(dev, &imx7src->rcdev);
+}
+
+static const struct of_device_id imx7_reset_dt_ids[] = {
+       { .compatible = "fsl,imx7d-src", },
+       { /* sentinel */ },
+};
+
+static struct platform_driver imx7_reset_driver = {
+       .probe  = imx7_reset_probe,
+       .driver = {
+               .name           = KBUILD_MODNAME,
+               .of_match_table = imx7_reset_dt_ids,
+       },
+};
+builtin_platform_driver(imx7_reset_driver);
index c32f11a30c5f3f732e2e80d11e88a394cf0fe425..a8b915eb8b581e4e9086d5cb0d2df11ff800b814 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * Amlogic Meson Reset Controller driver
+ *
  * This file is provided under a dual BSD/GPLv2 license.  When using or
  * redistributing this file, you may do so under either license.
  *
@@ -53,7 +55,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include <linux/err.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
@@ -95,7 +97,6 @@ static const struct of_device_id meson_reset_dt_ids[] = {
         { .compatible = "amlogic,meson-gxbb-reset", },
         { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, meson_reset_dt_ids);
 
 static int meson_reset_probe(struct platform_device *pdev)
 {
@@ -128,9 +129,4 @@ static struct platform_driver meson_reset_driver = {
                .of_match_table = meson_reset_dt_ids,
        },
 };
-
-module_platform_driver(meson_reset_driver);
-
-MODULE_AUTHOR("Neil Armstrong <narmstrong@baylibre.com>");
-MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver");
-MODULE_LICENSE("Dual BSD/GPL");
+builtin_platform_driver(meson_reset_driver);
index 0d9036dea010d1274e4a79b536368adad543f0a0..cf5b9742b86ecf4ebc8aa8f53fd5ffb3f607d6b1 100644 (file)
@@ -18,7 +18,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/err.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
@@ -83,7 +83,6 @@ static const struct of_device_id oxnas_reset_dt_ids[] = {
         { .compatible = "oxsemi,ox820-reset", },
         { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, oxnas_reset_dt_ids);
 
 static int oxnas_reset_probe(struct platform_device *pdev)
 {
@@ -123,5 +122,4 @@ static struct platform_driver oxnas_reset_driver = {
                .of_match_table = oxnas_reset_dt_ids,
        },
 };
-
-module_platform_driver(oxnas_reset_driver);
+builtin_platform_driver(oxnas_reset_driver);
index bbc4c06dd33b7542b1b1478e46201e9024237682..11d651b44e814ba922e1f7151c6214666cf7c057 100644 (file)
@@ -10,7 +10,7 @@
  * version 2, as published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
@@ -128,7 +128,6 @@ static const struct of_device_id pistachio_reset_dt_ids[] = {
         { .compatible = "img,pistachio-reset", },
         { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, pistachio_reset_dt_ids);
 
 static struct platform_driver pistachio_reset_driver = {
        .probe  = pistachio_reset_probe,
@@ -137,8 +136,4 @@ static struct platform_driver pistachio_reset_driver = {
                .of_match_table = pistachio_reset_dt_ids,
        },
 };
-module_platform_driver(pistachio_reset_driver);
-
-MODULE_AUTHOR("Damien Horsley <Damien.Horsley@imgtec.com>");
-MODULE_DESCRIPTION("Pistacho Reset Controller Driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(pistachio_reset_driver);
index 43e4a9f39b9b8f9be75a52695c9adec73a981667..07224c019892006248a98fe58343d2a0f6c4fe36 100644 (file)
@@ -25,7 +25,8 @@
 #include <linux/spinlock.h>
 #include <linux/types.h>
 
-#define NR_BANKS               4
+#define BANK_INCREMENT         4
+#define NR_BANKS               8
 
 struct socfpga_reset_data {
        spinlock_t                      lock;
@@ -46,8 +47,8 @@ static int socfpga_reset_assert(struct reset_controller_dev *rcdev,
 
        spin_lock_irqsave(&data->lock, flags);
 
-       reg = readl(data->membase + (bank * NR_BANKS));
-       writel(reg | BIT(offset), data->membase + (bank * NR_BANKS));
+       reg = readl(data->membase + (bank * BANK_INCREMENT));
+       writel(reg | BIT(offset), data->membase + (bank * BANK_INCREMENT));
        spin_unlock_irqrestore(&data->lock, flags);
 
        return 0;
@@ -67,8 +68,8 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
 
        spin_lock_irqsave(&data->lock, flags);
 
-       reg = readl(data->membase + (bank * NR_BANKS));
-       writel(reg & ~BIT(offset), data->membase + (bank * NR_BANKS));
+       reg = readl(data->membase + (bank * BANK_INCREMENT));
+       writel(reg & ~BIT(offset), data->membase + (bank * BANK_INCREMENT));
 
        spin_unlock_irqrestore(&data->lock, flags);
 
@@ -84,7 +85,7 @@ static int socfpga_reset_status(struct reset_controller_dev *rcdev,
        int offset = id % BITS_PER_LONG;
        u32 reg;
 
-       reg = readl(data->membase + (bank * NR_BANKS));
+       reg = readl(data->membase + (bank * BANK_INCREMENT));
 
        return !(reg & BIT(offset));
 }
index b44f6b5f87b6389a7f983ff794c746a77fbe9b7a..cd585cd2f04dd1b2677fa8c2cf5ac95200792b70 100644 (file)
@@ -34,15 +34,16 @@ static int sunxi_reset_assert(struct reset_controller_dev *rcdev,
        struct sunxi_reset_data *data = container_of(rcdev,
                                                     struct sunxi_reset_data,
                                                     rcdev);
-       int bank = id / BITS_PER_LONG;
-       int offset = id % BITS_PER_LONG;
+       int reg_width = sizeof(u32);
+       int bank = id / (reg_width * BITS_PER_BYTE);
+       int offset = id % (reg_width * BITS_PER_BYTE);
        unsigned long flags;
        u32 reg;
 
        spin_lock_irqsave(&data->lock, flags);
 
-       reg = readl(data->membase + (bank * 4));
-       writel(reg & ~BIT(offset), data->membase + (bank * 4));
+       reg = readl(data->membase + (bank * reg_width));
+       writel(reg & ~BIT(offset), data->membase + (bank * reg_width));
 
        spin_unlock_irqrestore(&data->lock, flags);
 
@@ -55,15 +56,16 @@ static int sunxi_reset_deassert(struct reset_controller_dev *rcdev,
        struct sunxi_reset_data *data = container_of(rcdev,
                                                     struct sunxi_reset_data,
                                                     rcdev);
-       int bank = id / BITS_PER_LONG;
-       int offset = id % BITS_PER_LONG;
+       int reg_width = sizeof(u32);
+       int bank = id / (reg_width * BITS_PER_BYTE);
+       int offset = id % (reg_width * BITS_PER_BYTE);
        unsigned long flags;
        u32 reg;
 
        spin_lock_irqsave(&data->lock, flags);
 
-       reg = readl(data->membase + (bank * 4));
-       writel(reg | BIT(offset), data->membase + (bank * 4));
+       reg = readl(data->membase + (bank * reg_width));
+       writel(reg | BIT(offset), data->membase + (bank * reg_width));
 
        spin_unlock_irqrestore(&data->lock, flags);
 
index 9c11be3d3450f804d1ae90470a3950ac79c5bef0..c4ba89832796b767debc204d41513dc563c96c81 100644 (file)
@@ -50,6 +50,15 @@ struct uniphier_reset_data {
        }
 
 /* System reset data */
+#define UNIPHIER_SLD3_SYS_RESET_NAND(id)               \
+       UNIPHIER_RESETX((id), 0x2004, 2)
+
+#define UNIPHIER_LD11_SYS_RESET_NAND(id)               \
+       UNIPHIER_RESETX((id), 0x200c, 0)
+
+#define UNIPHIER_LD11_SYS_RESET_EMMC(id)               \
+       UNIPHIER_RESETX((id), 0x200c, 2)
+
 #define UNIPHIER_SLD3_SYS_RESET_STDMAC(id)             \
        UNIPHIER_RESETX((id), 0x2000, 10)
 
@@ -65,12 +74,14 @@ struct uniphier_reset_data {
 #define UNIPHIER_PRO4_SYS_RESET_USB3(id, ch)           \
        UNIPHIER_RESETX((id), 0x2000 + 0x4 * (ch), 17)
 
-const struct uniphier_reset_data uniphier_sld3_sys_reset_data[] = {
+static const struct uniphier_reset_data uniphier_sld3_sys_reset_data[] = {
+       UNIPHIER_SLD3_SYS_RESET_NAND(2),
        UNIPHIER_SLD3_SYS_RESET_STDMAC(8),      /* Ether, HSC, MIO */
        UNIPHIER_RESET_END,
 };
 
-const struct uniphier_reset_data uniphier_pro4_sys_reset_data[] = {
+static const struct uniphier_reset_data uniphier_pro4_sys_reset_data[] = {
+       UNIPHIER_SLD3_SYS_RESET_NAND(2),
        UNIPHIER_SLD3_SYS_RESET_STDMAC(8),      /* HSC, MIO, RLE */
        UNIPHIER_PRO4_SYS_RESET_GIO(12),        /* Ether, SATA, USB3 */
        UNIPHIER_PRO4_SYS_RESET_USB3(14, 0),
@@ -78,7 +89,8 @@ const struct uniphier_reset_data uniphier_pro4_sys_reset_data[] = {
        UNIPHIER_RESET_END,
 };
 
-const struct uniphier_reset_data uniphier_pro5_sys_reset_data[] = {
+static const struct uniphier_reset_data uniphier_pro5_sys_reset_data[] = {
+       UNIPHIER_SLD3_SYS_RESET_NAND(2),
        UNIPHIER_SLD3_SYS_RESET_STDMAC(8),      /* HSC */
        UNIPHIER_PRO4_SYS_RESET_GIO(12),        /* PCIe, USB3 */
        UNIPHIER_PRO4_SYS_RESET_USB3(14, 0),
@@ -86,7 +98,8 @@ const struct uniphier_reset_data uniphier_pro5_sys_reset_data[] = {
        UNIPHIER_RESET_END,
 };
 
-const struct uniphier_reset_data uniphier_pxs2_sys_reset_data[] = {
+static const struct uniphier_reset_data uniphier_pxs2_sys_reset_data[] = {
+       UNIPHIER_SLD3_SYS_RESET_NAND(2),
        UNIPHIER_SLD3_SYS_RESET_STDMAC(8),      /* HSC, RLE */
        UNIPHIER_PRO4_SYS_RESET_USB3(14, 0),
        UNIPHIER_PRO4_SYS_RESET_USB3(15, 1),
@@ -100,12 +113,16 @@ const struct uniphier_reset_data uniphier_pxs2_sys_reset_data[] = {
        UNIPHIER_RESET_END,
 };
 
-const struct uniphier_reset_data uniphier_ld11_sys_reset_data[] = {
+static const struct uniphier_reset_data uniphier_ld11_sys_reset_data[] = {
+       UNIPHIER_LD11_SYS_RESET_NAND(2),
+       UNIPHIER_LD11_SYS_RESET_EMMC(4),
        UNIPHIER_LD11_SYS_RESET_STDMAC(8),      /* HSC, MIO */
        UNIPHIER_RESET_END,
 };
 
-const struct uniphier_reset_data uniphier_ld20_sys_reset_data[] = {
+static const struct uniphier_reset_data uniphier_ld20_sys_reset_data[] = {
+       UNIPHIER_LD11_SYS_RESET_NAND(2),
+       UNIPHIER_LD11_SYS_RESET_EMMC(4),
        UNIPHIER_LD11_SYS_RESET_STDMAC(8),      /* HSC */
        UNIPHIER_LD20_SYS_RESET_GIO(12),        /* PCIe, USB3 */
        UNIPHIER_RESETX(16, 0x200c, 12),        /* USB30-PHY0 */
@@ -134,7 +151,7 @@ const struct uniphier_reset_data uniphier_ld20_sys_reset_data[] = {
 #define UNIPHIER_MIO_RESET_DMAC(id)                    \
        UNIPHIER_RESETX((id), 0x110, 17)
 
-const struct uniphier_reset_data uniphier_sld3_mio_reset_data[] = {
+static const struct uniphier_reset_data uniphier_sld3_mio_reset_data[] = {
        UNIPHIER_MIO_RESET_SD(0, 0),
        UNIPHIER_MIO_RESET_SD(1, 1),
        UNIPHIER_MIO_RESET_SD(2, 2),
@@ -154,7 +171,7 @@ const struct uniphier_reset_data uniphier_sld3_mio_reset_data[] = {
        UNIPHIER_RESET_END,
 };
 
-const struct uniphier_reset_data uniphier_pro5_sd_reset_data[] = {
+static const struct uniphier_reset_data uniphier_pro5_sd_reset_data[] = {
        UNIPHIER_MIO_RESET_SD(0, 0),
        UNIPHIER_MIO_RESET_SD(1, 1),
        UNIPHIER_MIO_RESET_EMMC_HW_RESET(6, 1),
@@ -171,7 +188,7 @@ const struct uniphier_reset_data uniphier_pro5_sd_reset_data[] = {
 #define UNIPHIER_PERI_RESET_FI2C(id, ch)               \
        UNIPHIER_RESETX((id), 0x114, 24 + (ch))
 
-const struct uniphier_reset_data uniphier_ld4_peri_reset_data[] = {
+static const struct uniphier_reset_data uniphier_ld4_peri_reset_data[] = {
        UNIPHIER_PERI_RESET_UART(0, 0),
        UNIPHIER_PERI_RESET_UART(1, 1),
        UNIPHIER_PERI_RESET_UART(2, 2),
@@ -184,7 +201,7 @@ const struct uniphier_reset_data uniphier_ld4_peri_reset_data[] = {
        UNIPHIER_RESET_END,
 };
 
-const struct uniphier_reset_data uniphier_pro4_peri_reset_data[] = {
+static const struct uniphier_reset_data uniphier_pro4_peri_reset_data[] = {
        UNIPHIER_PERI_RESET_UART(0, 0),
        UNIPHIER_PERI_RESET_UART(1, 1),
        UNIPHIER_PERI_RESET_UART(2, 2),
index 94e7335553f437f43d614a50e2bf2381c1fae330..b6195fdf0d0033c7ec24afb9cff100cd5dcf0978 100644 (file)
@@ -41,6 +41,15 @@ bool soc_is_brcmstb(void)
 }
 
 static const struct of_device_id sun_top_ctrl_match[] = {
+       { .compatible = "brcm,bcm7125-sun-top-ctrl", },
+       { .compatible = "brcm,bcm7346-sun-top-ctrl", },
+       { .compatible = "brcm,bcm7358-sun-top-ctrl", },
+       { .compatible = "brcm,bcm7360-sun-top-ctrl", },
+       { .compatible = "brcm,bcm7362-sun-top-ctrl", },
+       { .compatible = "brcm,bcm7420-sun-top-ctrl", },
+       { .compatible = "brcm,bcm7425-sun-top-ctrl", },
+       { .compatible = "brcm,bcm7429-sun-top-ctrl", },
+       { .compatible = "brcm,bcm7425-sun-top-ctrl", },
        { .compatible = "brcm,brcmstb-sun-top-ctrl", },
        { }
 };
index 330960312296f603075fbcd0296f2693df8889aa..b894cf64225b31ac89693b5b04f0301be3aaf10f 100644 (file)
@@ -80,11 +80,21 @@ static const struct renesas_soc soc_rmobile_a1 __initconst __maybe_unused = {
        .id     = 0x40,
 };
 
+static const struct renesas_soc soc_rz_g1h __initconst __maybe_unused = {
+       .family = &fam_rzg,
+       .id     = 0x45,
+};
+
 static const struct renesas_soc soc_rz_g1m __initconst __maybe_unused = {
        .family = &fam_rzg,
        .id     = 0x47,
 };
 
+static const struct renesas_soc soc_rz_g1n __initconst __maybe_unused = {
+       .family = &fam_rzg,
+       .id     = 0x4b,
+};
+
 static const struct renesas_soc soc_rz_g1e __initconst __maybe_unused = {
        .family = &fam_rzg,
        .id     = 0x4c,
@@ -150,9 +160,15 @@ static const struct of_device_id renesas_socs[] __initconst = {
 #ifdef CONFIG_ARCH_R8A7740
        { .compatible = "renesas,r8a7740",      .data = &soc_rmobile_a1 },
 #endif
+#ifdef CONFIG_ARCH_R8A7742
+       { .compatible = "renesas,r8a7742",      .data = &soc_rz_g1h },
+#endif
 #ifdef CONFIG_ARCH_R8A7743
        { .compatible = "renesas,r8a7743",      .data = &soc_rz_g1m },
 #endif
+#ifdef CONFIG_ARCH_R8A7744
+       { .compatible = "renesas,r8a7744",      .data = &soc_rz_g1n },
+#endif
 #ifdef CONFIG_ARCH_R8A7745
        { .compatible = "renesas,r8a7745",      .data = &soc_rz_g1e },
 #endif
diff --git a/include/dt-bindings/reset/altr,rst-mgr-a10sr.h b/include/dt-bindings/reset/altr,rst-mgr-a10sr.h
new file mode 100644 (file)
index 0000000..9855925
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ *  Copyright Intel Corporation (C) 2017. All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Reset binding definitions for Altera Arria10 MAX5 System Resource Chip
+ *
+ * Adapted from altr,rst-mgr-a10.h
+ */
+
+#ifndef _DT_BINDINGS_RESET_ALTR_RST_MGR_A10SR_H
+#define _DT_BINDINGS_RESET_ALTR_RST_MGR_A10SR_H
+
+/* Peripheral PHY resets */
+#define A10SR_RESET_ENET_HPS   0
+#define A10SR_RESET_PCIE       1
+#define A10SR_RESET_FILE       2
+#define A10SR_RESET_BQSPI      3
+#define A10SR_RESET_USB                4
+
+#define A10SR_RESET_NUM                5
+
+#endif
diff --git a/include/dt-bindings/reset/imx7-reset.h b/include/dt-bindings/reset/imx7-reset.h
new file mode 100644 (file)
index 0000000..6394817
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017 Impinj, Inc.
+ *
+ * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DT_BINDING_RESET_IMX7_H
+#define DT_BINDING_RESET_IMX7_H
+
+#define IMX7_RESET_A7_CORE_POR_RESET0  0
+#define IMX7_RESET_A7_CORE_POR_RESET1  1
+#define IMX7_RESET_A7_CORE_RESET0      2
+#define IMX7_RESET_A7_CORE_RESET1      3
+#define IMX7_RESET_A7_DBG_RESET0       4
+#define IMX7_RESET_A7_DBG_RESET1       5
+#define IMX7_RESET_A7_ETM_RESET0       6
+#define IMX7_RESET_A7_ETM_RESET1       7
+#define IMX7_RESET_A7_SOC_DBG_RESET    8
+#define IMX7_RESET_A7_L2RESET          9
+#define IMX7_RESET_SW_M4C_RST          10
+#define IMX7_RESET_SW_M4P_RST          11
+#define IMX7_RESET_EIM_RST             12
+#define IMX7_RESET_HSICPHY_PORT_RST    13
+#define IMX7_RESET_USBPHY1_POR         14
+#define IMX7_RESET_USBPHY1_PORT_RST    15
+#define IMX7_RESET_USBPHY2_POR         16
+#define IMX7_RESET_USBPHY2_PORT_RST    17
+#define IMX7_RESET_MIPI_PHY_MRST       18
+#define IMX7_RESET_MIPI_PHY_SRST       19
+
+/*
+ * IMX7_RESET_PCIEPHY is a logical reset line combining PCIEPHY_BTN
+ * and PCIEPHY_G_RST
+ */
+#define IMX7_RESET_PCIEPHY             20
+#define IMX7_RESET_PCIEPHY_PERST       21
+
+/*
+ * IMX7_RESET_PCIE_CTRL_APPS_EN is not strictly a reset line, but it
+ * can be used to inhibit PCIe LTTSM, so, in a way, it can be thoguht
+ * of as one
+ */
+#define IMX7_RESET_PCIE_CTRL_APPS_EN   22
+#define IMX7_RESET_DDRC_PRST           23
+#define IMX7_RESET_DDRC_CORE_RST       24
+
+#define IMX7_RESET_NUM                 25
+
+#endif
+
index 8e953c6f394ae58ef5902c2ae4fd44fd5f3c1173..37a5eaea69dde299a18855ffc99b1227513b25da 100644 (file)
@@ -25,7 +25,7 @@ int meson_sm_call(unsigned int cmd_index, u32 *ret, u32 arg0, u32 arg1,
                  u32 arg2, u32 arg3, u32 arg4);
 int meson_sm_call_write(void *buffer, unsigned int b_size, unsigned int cmd_index,
                        u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
-int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0, u32 arg1,
-                      u32 arg2, u32 arg3, u32 arg4);
+int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index,
+                      u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
 
 #endif /* _MESON_SM_FW_H_ */