Merge tag 'arm-multiplatform-5.19-1' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 May 2022 17:43:09 +0000 (10:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 May 2022 17:43:09 +0000 (10:43 -0700)
Pull ARMv4T/v5 multiplatform support from Arnd Bergmann:
 "This series has been 12 years in the making, it mostly finishes the
  work that was started with the founding of Linaro to clean up platform
  support in the kernel.

  The largest change here is a cleanup of the omap1 platform, which is
  the final ARM machine type to get converted to the common-clk
  subsystem. All the omap1 specific drivers are now made independent of
  the mach/*.h headers to allow the platform to be part of a generic
  ARMv4/v5 multiplatform kernel.

  The last bit that enables this support is still missing here while we
  wait for some last dependencies to make it into the mainline kernel
  through other subsystems.

  The s3c24xx, ixp4xx, iop32x, ep93xx and dove platforms were all almost
  at the point of allowing multiplatform kernels, this work gets
  completed here along with a few additional cleanup. At the same time,
  the s3c24xx and s3c64xx are now deprecated and expected to get removed
  in the future.

  The PXA and OMAP1 bits are in a separate branch because of
  dependencies. Once both branches are merged, only the three Intel
  StrongARM platforms (RiscPC, Footbridge/NetWinder and StrongARM1100)
  need separate kernels, and there are no plans to include these"

* tag 'arm-multiplatform-5.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (61 commits)
  ARM: ixp4xx: Consolidate Kconfig fixing issue
  ARM: versatile: Add missing of_node_put in dcscb_init
  ARM: config: Refresh IXP4xx config after multiplatform
  ARM: omap1: add back omap_set_dma_priority() stub
  ARM: omap: fix missing declaration warnings
  ARM: omap: fix address space warnings from sparse
  ARM: spear: remove include/mach/ subdirectory
  ARM: davinci: remove include/mach/ subdirectory
  ARM: omap2: remove include/mach/ subdirectory
  integrator: remove empty ap_init_early()
  ARM: s3c: fix include path
  MAINTAINERS: omap1: Add Janusz as an additional maintainer
  ARM: omap1: htc_herald: fix typos in comments
  ARM: OMAP1: fix typos in comments
  ARM: OMAP1: clock: Remove noop code
  ARM: OMAP1: clock: Remove unused code
  ARM: OMAP1: clock: Fix UART rate reporting algorithm
  ARM: OMAP1: clock: Fix early UART rate issues
  ARM: OMAP1: Prepare for conversion of OMAP1 clocks to CCF
  ARM: omap1: fix build with no SoC selected
  ...

18 files changed:
1  2 
MAINTAINERS
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/configs/mini2440_defconfig
arch/arm/configs/s3c2410_defconfig
arch/arm/mach-at91/Kconfig
arch/arm/mach-davinci/board-da850-evm.c
arch/arm/mach-exynos/Kconfig
arch/arm/mach-nomadik/Kconfig
arch/arm/mach-omap2/omap4-common.c
arch/arm/mach-s3c/Kconfig.s3c24xx
arch/arm/mach-s3c/pm-s3c64xx.c
arch/arm/mach-s3c/s3c24xx.c
arch/arm/mach-sunxi/Kconfig
arch/arm/mach-versatile/spc.c
drivers/spi/Kconfig
drivers/video/fbdev/omap/lcdc.c
drivers/video/fbdev/omap/sossi.c

diff --cc MAINTAINERS
Simple merge
Simple merge
Simple merge
index c7741289f213eb499bd2302dbc8230448ac65659,0a2e97de3cf34ee50fca0fb07799caf6842a94e4..3ef48e79b41019753e0af36aa2ca70b94dd58323
@@@ -4,8 -4,11 +4,10 @@@ CONFIG_POSIX_MQUEUE=
  CONFIG_RELAY=y
  CONFIG_BLK_DEV_INITRD=y
  # CONFIG_COMPAT_BRK is not set
+ CONFIG_ARCH_MULTI_V4T=y
+ # CONFIG_ARCH_MULTI_V7 is not set
  CONFIG_ARCH_S3C24XX=y
  CONFIG_S3C_ADC=y
 -CONFIG_S3C24XX_PWM=y
  # CONFIG_CPU_S3C2410 is not set
  CONFIG_CPU_S3C2440=y
  CONFIG_MACH_MINI2440=y
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index abdb99fe1e972c44adb427000c9ad2860e9d72fd,93cf70c0749badb210b082099679fefbb7c1026e..e015f2497111a42133ddd4e7ddd172eda06d90ba
@@@ -1,10 -1,13 +1,10 @@@
  # SPDX-License-Identifier: GPL-2.0-only
  menuconfig ARCH_SUNXI
        bool "Allwinner SoCs"
-       depends on ARCH_MULTI_V5 || ARCH_MULTI_V7
+       depends on (CPU_LITTLE_ENDIAN && ARCH_MULTI_V5) || ARCH_MULTI_V7
        select ARCH_HAS_RESET_CONTROLLER
        select CLKSRC_MMIO
 -      select GENERIC_IRQ_CHIP
        select GPIOLIB
 -      select IRQ_DOMAIN_HIERARCHY
 -      select IRQ_FASTEOI_HIERARCHY_HANDLERS
        select PINCTRL
        select PM_OPP
        select SUN4I_TIMER
@@@ -41,10 -40,8 +41,9 @@@ config MACH_SUN7
        default ARCH_SUNXI
        select ARM_GIC
        select ARM_PSCI
-       select ARCH_SUPPORTS_BIG_ENDIAN
        select HAVE_ARM_ARCH_TIMER
        select SUN5I_HSTIMER
 +      select SUNXI_NMI_INTC
  
  config MACH_SUN8I
        bool "Allwinner sun8i Family SoCs support"
index 0000000000000000000000000000000000000000,1da11bdb1dfbd6f1ce906b83ba2d84ecd396f316..6e6985e756afb7eeda5f0b0b0f5cce94fa3c197b
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,598 +1,598 @@@
 - * ve_spc_global_wakeup_irq()
+ /*
+  * Versatile Express Serial Power Controller (SPC) support
+  *
+  * Copyright (C) 2013 ARM Ltd.
+  *
+  * Authors: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
+  *          Achin Gupta           <achin.gupta@arm.com>
+  *          Lorenzo Pieralisi     <lorenzo.pieralisi@arm.com>
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License version 2 as
+  * published by the Free Software Foundation.
+  *
+  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+  * kind, whether express or implied; without even the implied warranty
+  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  */
+ #include <linux/clk-provider.h>
+ #include <linux/clkdev.h>
+ #include <linux/cpu.h>
+ #include <linux/delay.h>
+ #include <linux/err.h>
+ #include <linux/interrupt.h>
+ #include <linux/io.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_opp.h>
+ #include <linux/slab.h>
+ #include <linux/semaphore.h>
+ #include <asm/cacheflush.h>
+ #include "spc.h"
+ #define SPCLOG "vexpress-spc: "
+ #define PERF_LVL_A15          0x00
+ #define PERF_REQ_A15          0x04
+ #define PERF_LVL_A7           0x08
+ #define PERF_REQ_A7           0x0c
+ #define COMMS                 0x10
+ #define COMMS_REQ             0x14
+ #define PWC_STATUS            0x18
+ #define PWC_FLAG              0x1c
+ /* SPC wake-up IRQs status and mask */
+ #define WAKE_INT_MASK         0x24
+ #define WAKE_INT_RAW          0x28
+ #define WAKE_INT_STAT         0x2c
+ /* SPC power down registers */
+ #define A15_PWRDN_EN          0x30
+ #define A7_PWRDN_EN           0x34
+ /* SPC per-CPU mailboxes */
+ #define A15_BX_ADDR0          0x68
+ #define A7_BX_ADDR0           0x78
+ /* SPC CPU/cluster reset statue */
+ #define STANDBYWFI_STAT               0x3c
+ #define STANDBYWFI_STAT_A15_CPU_MASK(cpu)     (1 << (cpu))
+ #define STANDBYWFI_STAT_A7_CPU_MASK(cpu)      (1 << (3 + (cpu)))
+ /* SPC system config interface registers */
+ #define SYSCFG_WDATA          0x70
+ #define SYSCFG_RDATA          0x74
+ /* A15/A7 OPP virtual register base */
+ #define A15_PERFVAL_BASE      0xC10
+ #define A7_PERFVAL_BASE               0xC30
+ /* Config interface control bits */
+ #define SYSCFG_START          BIT(31)
+ #define SYSCFG_SCC            (6 << 20)
+ #define SYSCFG_STAT           (14 << 20)
+ /* wake-up interrupt masks */
+ #define GBL_WAKEUP_INT_MSK    (0x3 << 10)
+ /* TC2 static dual-cluster configuration */
+ #define MAX_CLUSTERS          2
+ /*
+  * Even though the SPC takes max 3-5 ms to complete any OPP/COMMS
+  * operation, the operation could start just before jiffie is about
+  * to be incremented. So setting timeout value of 20ms = 2jiffies@100Hz
+  */
+ #define TIMEOUT_US    20000
+ #define MAX_OPPS      8
+ #define CA15_DVFS     0
+ #define CA7_DVFS      1
+ #define SPC_SYS_CFG   2
+ #define STAT_COMPLETE(type)   ((1 << 0) << (type << 2))
+ #define STAT_ERR(type)                ((1 << 1) << (type << 2))
+ #define RESPONSE_MASK(type)   (STAT_COMPLETE(type) | STAT_ERR(type))
+ struct ve_spc_opp {
+       unsigned long freq;
+       unsigned long u_volt;
+ };
+ struct ve_spc_drvdata {
+       void __iomem *baseaddr;
+       /*
+        * A15s cluster identifier
+        * It corresponds to A15 processors MPIDR[15:8] bitfield
+        */
+       u32 a15_clusid;
+       uint32_t cur_rsp_mask;
+       uint32_t cur_rsp_stat;
+       struct semaphore sem;
+       struct completion done;
+       struct ve_spc_opp *opps[MAX_CLUSTERS];
+       int num_opps[MAX_CLUSTERS];
+ };
+ static struct ve_spc_drvdata *info;
+ static inline bool cluster_is_a15(u32 cluster)
+ {
+       return cluster == info->a15_clusid;
+ }
+ /**
 - *
 - * @set: if true, global wake-up IRQs are set, if false they are cleared
++ * ve_spc_global_wakeup_irq() - sets/clears global wakeup IRQs
++ *
++ * @set: if true, global wake-up IRQs are set, if false they are cleared
+  *
+  * Function to set/clear global wakeup IRQs. Not protected by locking since
+  * it might be used in code paths where normal cacheable locks are not
+  * working. Locking must be provided by the caller to ensure atomicity.
 - * ve_spc_cpu_wakeup_irq()
 - *
 - * Function to set/clear per-CPU wake-up IRQs. Not protected by locking since
 - * it might be used in code paths where normal cacheable locks are not
 - * working. Locking must be provided by the caller to ensure atomicity.
+  */
+ void ve_spc_global_wakeup_irq(bool set)
+ {
+       u32 reg;
+       reg = readl_relaxed(info->baseaddr + WAKE_INT_MASK);
+       if (set)
+               reg |= GBL_WAKEUP_INT_MSK;
+       else
+               reg &= ~GBL_WAKEUP_INT_MSK;
+       writel_relaxed(reg, info->baseaddr + WAKE_INT_MASK);
+ }
+ /**
 - * ve_spc_powerdown()
++ * ve_spc_cpu_wakeup_irq() - sets/clears per-CPU wake-up IRQs
+  *
+  * @cluster: mpidr[15:8] bitfield describing cluster affinity level
+  * @cpu: mpidr[7:0] bitfield describing cpu affinity level
+  * @set: if true, wake-up IRQs are set, if false they are cleared
++ *
++ * Function to set/clear per-CPU wake-up IRQs. Not protected by locking since
++ * it might be used in code paths where normal cacheable locks are not
++ * working. Locking must be provided by the caller to ensure atomicity.
+  */
+ void ve_spc_cpu_wakeup_irq(u32 cluster, u32 cpu, bool set)
+ {
+       u32 mask, reg;
+       if (cluster >= MAX_CLUSTERS)
+               return;
+       mask = BIT(cpu);
+       if (!cluster_is_a15(cluster))
+               mask <<= 4;
+       reg = readl_relaxed(info->baseaddr + WAKE_INT_MASK);
+       if (set)
+               reg |= mask;
+       else
+               reg &= ~mask;
+       writel_relaxed(reg, info->baseaddr + WAKE_INT_MASK);
+ }
+ /**
+  * ve_spc_set_resume_addr() - set the jump address used for warm boot
+  *
+  * @cluster: mpidr[15:8] bitfield describing cluster affinity level
+  * @cpu: mpidr[7:0] bitfield describing cpu affinity level
+  * @addr: physical resume address
+  */
+ void ve_spc_set_resume_addr(u32 cluster, u32 cpu, u32 addr)
+ {
+       void __iomem *baseaddr;
+       if (cluster >= MAX_CLUSTERS)
+               return;
+       if (cluster_is_a15(cluster))
+               baseaddr = info->baseaddr + A15_BX_ADDR0 + (cpu << 2);
+       else
+               baseaddr = info->baseaddr + A7_BX_ADDR0 + (cpu << 2);
+       writel_relaxed(addr, baseaddr);
+ }
+ /**
 - *
 - * @cluster: mpidr[15:8] bitfield describing cluster affinity level
 - * @enable: if true enables powerdown, if false disables it
++ * ve_spc_powerdown() - enables/disables cluster powerdown
++ *
++ * @cluster: mpidr[15:8] bitfield describing cluster affinity level
++ * @enable: if true enables powerdown, if false disables it
+  *
+  * Function to enable/disable cluster powerdown. Not protected by locking
+  * since it might be used in code paths where normal cacheable locks are not
+  * working. Locking must be provided by the caller to ensure atomicity.
 - * ve_spc_cpu_in_wfi(u32 cpu, u32 cluster)
+  */
+ void ve_spc_powerdown(u32 cluster, bool enable)
+ {
+       u32 pwdrn_reg;
+       if (cluster >= MAX_CLUSTERS)
+               return;
+       pwdrn_reg = cluster_is_a15(cluster) ? A15_PWRDN_EN : A7_PWRDN_EN;
+       writel_relaxed(enable, info->baseaddr + pwdrn_reg);
+ }
+ static u32 standbywfi_cpu_mask(u32 cpu, u32 cluster)
+ {
+       return cluster_is_a15(cluster) ?
+                 STANDBYWFI_STAT_A15_CPU_MASK(cpu)
+               : STANDBYWFI_STAT_A7_CPU_MASK(cpu);
+ }
+ /**
 -              if (init_opp_table[cluster])
++ * ve_spc_cpu_in_wfi() - Checks if the specified CPU is in WFI or not
+  *
+  * @cpu: mpidr[7:0] bitfield describing CPU affinity level within cluster
+  * @cluster: mpidr[15:8] bitfield describing cluster affinity level
+  *
+  * @return: non-zero if and only if the specified CPU is in WFI
+  *
+  * Take care when interpreting the result of this function: a CPU might
+  * be in WFI temporarily due to idle, and is not necessarily safely
+  * parked.
+  */
+ int ve_spc_cpu_in_wfi(u32 cpu, u32 cluster)
+ {
+       int ret;
+       u32 mask = standbywfi_cpu_mask(cpu, cluster);
+       if (cluster >= MAX_CLUSTERS)
+               return 1;
+       ret = readl_relaxed(info->baseaddr + STANDBYWFI_STAT);
+       pr_debug("%s: PCFGREG[0x%X] = 0x%08X, mask = 0x%X\n",
+                __func__, STANDBYWFI_STAT, ret, mask);
+       return ret & mask;
+ }
+ static int ve_spc_get_performance(int cluster, u32 *freq)
+ {
+       struct ve_spc_opp *opps = info->opps[cluster];
+       u32 perf_cfg_reg = 0;
+       u32 perf;
+       perf_cfg_reg = cluster_is_a15(cluster) ? PERF_LVL_A15 : PERF_LVL_A7;
+       perf = readl_relaxed(info->baseaddr + perf_cfg_reg);
+       if (perf >= info->num_opps[cluster])
+               return -EINVAL;
+       opps += perf;
+       *freq = opps->freq;
+       return 0;
+ }
+ /* find closest match to given frequency in OPP table */
+ static int ve_spc_round_performance(int cluster, u32 freq)
+ {
+       int idx, max_opp = info->num_opps[cluster];
+       struct ve_spc_opp *opps = info->opps[cluster];
+       u32 fmin = 0, fmax = ~0, ftmp;
+       freq /= 1000; /* OPP entries in kHz */
+       for (idx = 0; idx < max_opp; idx++, opps++) {
+               ftmp = opps->freq;
+               if (ftmp >= freq) {
+                       if (ftmp <= fmax)
+                               fmax = ftmp;
+               } else {
+                       if (ftmp >= fmin)
+                               fmin = ftmp;
+               }
+       }
+       if (fmax != ~0)
+               return fmax * 1000;
+       else
+               return fmin * 1000;
+ }
+ static int ve_spc_find_performance_index(int cluster, u32 freq)
+ {
+       int idx, max_opp = info->num_opps[cluster];
+       struct ve_spc_opp *opps = info->opps[cluster];
+       for (idx = 0; idx < max_opp; idx++, opps++)
+               if (opps->freq == freq)
+                       break;
+       return (idx == max_opp) ? -EINVAL : idx;
+ }
+ static int ve_spc_waitforcompletion(int req_type)
+ {
+       int ret = wait_for_completion_interruptible_timeout(
+                       &info->done, usecs_to_jiffies(TIMEOUT_US));
+       if (ret == 0)
+               ret = -ETIMEDOUT;
+       else if (ret > 0)
+               ret = info->cur_rsp_stat & STAT_COMPLETE(req_type) ? 0 : -EIO;
+       return ret;
+ }
+ static int ve_spc_set_performance(int cluster, u32 freq)
+ {
+       u32 perf_cfg_reg;
+       int ret, perf, req_type;
+       if (cluster_is_a15(cluster)) {
+               req_type = CA15_DVFS;
+               perf_cfg_reg = PERF_LVL_A15;
+       } else {
+               req_type = CA7_DVFS;
+               perf_cfg_reg = PERF_LVL_A7;
+       }
+       perf = ve_spc_find_performance_index(cluster, freq);
+       if (perf < 0)
+               return perf;
+       if (down_timeout(&info->sem, usecs_to_jiffies(TIMEOUT_US)))
+               return -ETIME;
+       init_completion(&info->done);
+       info->cur_rsp_mask = RESPONSE_MASK(req_type);
+       writel(perf, info->baseaddr + perf_cfg_reg);
+       ret = ve_spc_waitforcompletion(req_type);
+       info->cur_rsp_mask = 0;
+       up(&info->sem);
+       return ret;
+ }
+ static int ve_spc_read_sys_cfg(int func, int offset, uint32_t *data)
+ {
+       int ret;
+       if (down_timeout(&info->sem, usecs_to_jiffies(TIMEOUT_US)))
+               return -ETIME;
+       init_completion(&info->done);
+       info->cur_rsp_mask = RESPONSE_MASK(SPC_SYS_CFG);
+       /* Set the control value */
+       writel(SYSCFG_START | func | offset >> 2, info->baseaddr + COMMS);
+       ret = ve_spc_waitforcompletion(SPC_SYS_CFG);
+       if (ret == 0)
+               *data = readl(info->baseaddr + SYSCFG_RDATA);
+       info->cur_rsp_mask = 0;
+       up(&info->sem);
+       return ret;
+ }
+ static irqreturn_t ve_spc_irq_handler(int irq, void *data)
+ {
+       struct ve_spc_drvdata *drv_data = data;
+       uint32_t status = readl_relaxed(drv_data->baseaddr + PWC_STATUS);
+       if (info->cur_rsp_mask & status) {
+               info->cur_rsp_stat = status;
+               complete(&drv_data->done);
+       }
+       return IRQ_HANDLED;
+ }
+ /*
+  *  +--------------------------+
+  *  | 31      20 | 19        0 |
+  *  +--------------------------+
+  *  |   m_volt   |  freq(kHz)  |
+  *  +--------------------------+
+  */
+ #define MULT_FACTOR   20
+ #define VOLT_SHIFT    20
+ #define FREQ_MASK     (0xFFFFF)
+ static int ve_spc_populate_opps(uint32_t cluster)
+ {
+       uint32_t data = 0, off, ret, idx;
+       struct ve_spc_opp *opps;
+       opps = kcalloc(MAX_OPPS, sizeof(*opps), GFP_KERNEL);
+       if (!opps)
+               return -ENOMEM;
+       info->opps[cluster] = opps;
+       off = cluster_is_a15(cluster) ? A15_PERFVAL_BASE : A7_PERFVAL_BASE;
+       for (idx = 0; idx < MAX_OPPS; idx++, off += 4, opps++) {
+               ret = ve_spc_read_sys_cfg(SYSCFG_SCC, off, &data);
+               if (!ret) {
+                       opps->freq = (data & FREQ_MASK) * MULT_FACTOR;
+                       opps->u_volt = (data >> VOLT_SHIFT) * 1000;
+               } else {
+                       break;
+               }
+       }
+       info->num_opps[cluster] = idx;
+       return ret;
+ }
+ static int ve_init_opp_table(struct device *cpu_dev)
+ {
+       int cluster;
+       int idx, ret = 0, max_opp;
+       struct ve_spc_opp *opps;
+       cluster = topology_physical_package_id(cpu_dev->id);
+       cluster = cluster < 0 ? 0 : cluster;
+       max_opp = info->num_opps[cluster];
+       opps = info->opps[cluster];
+       for (idx = 0; idx < max_opp; idx++, opps++) {
+               ret = dev_pm_opp_add(cpu_dev, opps->freq * 1000, opps->u_volt);
+               if (ret) {
+                       dev_warn(cpu_dev, "failed to add opp %lu %lu\n",
+                                opps->freq, opps->u_volt);
+                       return ret;
+               }
+       }
+       return ret;
+ }
+ int __init ve_spc_init(void __iomem *baseaddr, u32 a15_clusid, int irq)
+ {
+       int ret;
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
+       if (!info)
+               return -ENOMEM;
+       info->baseaddr = baseaddr;
+       info->a15_clusid = a15_clusid;
+       if (irq <= 0) {
+               pr_err(SPCLOG "Invalid IRQ %d\n", irq);
+               kfree(info);
+               return -EINVAL;
+       }
+       init_completion(&info->done);
+       readl_relaxed(info->baseaddr + PWC_STATUS);
+       ret = request_irq(irq, ve_spc_irq_handler, IRQF_TRIGGER_HIGH
+                               | IRQF_ONESHOT, "vexpress-spc", info);
+       if (ret) {
+               pr_err(SPCLOG "IRQ %d request failed\n", irq);
+               kfree(info);
+               return -ENODEV;
+       }
+       sema_init(&info->sem, 1);
+       /*
+        * Multi-cluster systems may need this data when non-coherent, during
+        * cluster power-up/power-down. Make sure driver info reaches main
+        * memory.
+        */
+       sync_cache_w(info);
+       sync_cache_w(&info);
+       return 0;
+ }
+ struct clk_spc {
+       struct clk_hw hw;
+       int cluster;
+ };
+ #define to_clk_spc(spc) container_of(spc, struct clk_spc, hw)
+ static unsigned long spc_recalc_rate(struct clk_hw *hw,
+               unsigned long parent_rate)
+ {
+       struct clk_spc *spc = to_clk_spc(hw);
+       u32 freq;
+       if (ve_spc_get_performance(spc->cluster, &freq))
+               return -EIO;
+       return freq * 1000;
+ }
+ static long spc_round_rate(struct clk_hw *hw, unsigned long drate,
+               unsigned long *parent_rate)
+ {
+       struct clk_spc *spc = to_clk_spc(hw);
+       return ve_spc_round_performance(spc->cluster, drate);
+ }
+ static int spc_set_rate(struct clk_hw *hw, unsigned long rate,
+               unsigned long parent_rate)
+ {
+       struct clk_spc *spc = to_clk_spc(hw);
+       return ve_spc_set_performance(spc->cluster, rate / 1000);
+ }
+ static struct clk_ops clk_spc_ops = {
+       .recalc_rate = spc_recalc_rate,
+       .round_rate = spc_round_rate,
+       .set_rate = spc_set_rate,
+ };
+ static struct clk *ve_spc_clk_register(struct device *cpu_dev)
+ {
+       struct clk_init_data init;
+       struct clk_spc *spc;
+       spc = kzalloc(sizeof(*spc), GFP_KERNEL);
+       if (!spc)
+               return ERR_PTR(-ENOMEM);
+       spc->hw.init = &init;
+       spc->cluster = topology_physical_package_id(cpu_dev->id);
+       spc->cluster = spc->cluster < 0 ? 0 : spc->cluster;
+       init.name = dev_name(cpu_dev);
+       init.ops = &clk_spc_ops;
+       init.flags = CLK_GET_RATE_NOCACHE;
+       init.num_parents = 0;
+       return devm_clk_register(cpu_dev, &spc->hw);
+ }
+ static int __init ve_spc_clk_init(void)
+ {
+       int cpu, cluster;
+       struct clk *clk;
+       bool init_opp_table[MAX_CLUSTERS] = { false };
+       if (!info)
+               return 0; /* Continue only if SPC is initialised */
+       if (ve_spc_populate_opps(0) || ve_spc_populate_opps(1)) {
+               pr_err("failed to build OPP table\n");
+               return -ENODEV;
+       }
+       for_each_possible_cpu(cpu) {
+               struct device *cpu_dev = get_cpu_device(cpu);
+               if (!cpu_dev) {
+                       pr_warn("failed to get cpu%d device\n", cpu);
+                       continue;
+               }
+               clk = ve_spc_clk_register(cpu_dev);
+               if (IS_ERR(clk)) {
+                       pr_warn("failed to register cpu%d clock\n", cpu);
+                       continue;
+               }
+               if (clk_register_clkdev(clk, NULL, dev_name(cpu_dev))) {
+                       pr_warn("failed to register cpu%d clock lookup\n", cpu);
+                       continue;
+               }
+               cluster = topology_physical_package_id(cpu_dev->id);
++              if (cluster < 0 || init_opp_table[cluster])
+                       continue;
+               if (ve_init_opp_table(cpu_dev))
+                       pr_warn("failed to initialise cpu%d opp table\n", cpu);
+               else if (dev_pm_opp_set_sharing_cpus(cpu_dev,
+                        topology_core_cpumask(cpu_dev->id)))
+                       pr_warn("failed to mark OPPs shared for cpu%d\n", cpu);
+               else
+                       init_opp_table[cluster] = true;
+       }
+       platform_device_register_simple("vexpress-spc-cpufreq", -1, NULL, 0);
+       return 0;
+ }
+ device_initcall(ve_spc_clk_init);
Simple merge
index 97d20dc0d1d0276ea704ad27e2454a38250ae085,4c9091bd936d1687510eaaa3c3f1b28ebafb3f3d..e7ce783e5215f7288b653a87d68d0aa76a00035c
@@@ -711,9 -713,9 +713,9 @@@ static int omap_lcdc_init(struct omapfb
                dev_err(fbdev->dev, "failed to adjust LCD rate\n");
                goto fail1;
        }
 -      clk_enable(lcdc.lcd_ck);
 +      clk_prepare_enable(lcdc.lcd_ck);
  
-       r = request_irq(OMAP_LCDC_IRQ, lcdc_irq_handler, 0, MODULE_NAME, fbdev);
+       r = request_irq(fbdev->int_irq, lcdc_irq_handler, 0, MODULE_NAME, fbdev);
        if (r) {
                dev_err(fbdev->dev, "unable to get IRQ\n");
                goto fail2;
@@@ -744,9 -746,9 +746,9 @@@ fail5
  fail4:
        omap_free_lcd_dma();
  fail3:
-       free_irq(OMAP_LCDC_IRQ, lcdc.fbdev);
+       free_irq(fbdev->int_irq, lcdc.fbdev);
  fail2:
 -      clk_disable(lcdc.lcd_ck);
 +      clk_disable_unprepare(lcdc.lcd_ck);
  fail1:
        clk_put(lcdc.lcd_ck);
  fail0:
@@@ -759,8 -761,8 +761,8 @@@ static void omap_lcdc_cleanup(void
                free_palette_ram();
        free_fbmem();
        omap_free_lcd_dma();
-       free_irq(OMAP_LCDC_IRQ, lcdc.fbdev);
+       free_irq(lcdc.fbdev->int_irq, lcdc.fbdev);
 -      clk_disable(lcdc.lcd_ck);
 +      clk_disable_unprepare(lcdc.lcd_ck);
        clk_put(lcdc.lcd_ck);
  }
  
Simple merge