From patchwork Wed Apr 29 20:58:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 212189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAF12C83007 for ; Wed, 29 Apr 2020 20:58:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A95682076B for ; Wed, 29 Apr 2020 20:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588193913; bh=O49K09ayBJX/x/K22YUJzwtINfEfyV8aTgZgCQTyGT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KIphc0pzydyu4kncikhip9YQD2YJ3U5mFWQ9xeD4UqHZ+YYtE7yZMUZCP37J+4oS3 ojBVBduCcca4QSYzx+c9PqHP++WSeH5rrDOJ/8LAgA/jm72ZYzqepSo7mouuXR4uBs NFn3ZwEKbltacu1uPvmDRb6wnM51xPbvEM9ZJ5SI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727079AbgD2U6d (ORCPT ); Wed, 29 Apr 2020 16:58:33 -0400 Received: from mail-oo1-f68.google.com ([209.85.161.68]:38924 "EHLO mail-oo1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726950AbgD2U6d (ORCPT ); Wed, 29 Apr 2020 16:58:33 -0400 Received: by mail-oo1-f68.google.com with SMTP id c83so760679oob.6; Wed, 29 Apr 2020 13:58:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5GEo8L05GfOsrETFUSYjrPBx8MpWGlvpLKnzBBG4Zk0=; b=NHT1hSFzTf2Xbv2L98Ig2TnilEqkKmvBe79VQFkb9+nONNfTK8Je6tgB9DSLDoM/hO v0QkkGUGNbF5QWGOflRFd4dTUB9bRdklUTsSZx3EevCLfeNcMwRugqR7jha6qga044sY eWQhQK8a9BbsGwX/vfBOweMrrju1iy0oOVjKUT6cvAFtXcy3sLajo5HP6zkOetFsaaKc jgoXOyE8UbTolmUuJXFbbXS9HBVoGXOZZrxsXoxJIEsJM+RvbbbRSG+SxSn541EAEcRQ 1PmkiV1RYy2zMm3HA6mERm3HuPQcFmIvoonBentMBpIw2gUSrQI+JP5x9RyAtL+LSZrK dWZQ== X-Gm-Message-State: AGi0PuYhRnAjrcX0qgSvWgy8MBcRewcGDP8Tm/934e157Y0XOFOxfhct O2tbylkEqtk/z3J3AVK8ow== X-Google-Smtp-Source: APiQypKiIIo1iL3b/WKj8zsWqGEh+qK+DtjFWH1bOfzxAP684pSi5OWlTJPWn1gRh6hDHj5NzKd/5w== X-Received: by 2002:a4a:621d:: with SMTP id x29mr11304095ooc.92.1588193911048; Wed, 29 Apr 2020 13:58:31 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z13sm653162oth.10.2020.04.29.13.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:58:30 -0700 (PDT) From: Rob Herring To: Linus Walleij , Liviu Dudau , Lorenzo Pieralisi , Sudeep Holla Cc: Kevin Brodsky , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , Lee Jones , Sebastian Reichel , Stephen Boyd , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 02/16] arm64: vexpress: Don't select CONFIG_POWER_RESET_VEXPRESS Date: Wed, 29 Apr 2020 15:58:11 -0500 Message-Id: <20200429205825.10604-3-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429205825.10604-1-robh@kernel.org> References: <20200429205825.10604-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The VExpress power-off/reset driver is not needed on 64-bit platforms as PSCI power-off and reset can be used instead. Stop selecting it so it can be disabled and not always built-in. CONFIG_VEXPRESS_CONFIG can also be dropped as it was a dependency for CONFIG_POWER_RESET_VEXPRESS. Cc: Catalin Marinas Cc: Will Deacon Cc: Lorenzo Pieralisi Cc: Linus Walleij Acked-by: Arnd Bergmann Acked-by: Liviu Dudau Reviewed-by: Sudeep Holla Signed-off-by: Rob Herring --- v2: - squash dropping CONFIG_VEXPRESS_CONFIG select into this patch --- arch/arm64/Kconfig.platforms | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 55d70cfe0f9e..5c38dc56b808 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -278,8 +278,6 @@ config ARCH_VEXPRESS select GPIOLIB select PM select PM_GENERIC_DOMAINS - select POWER_RESET_VEXPRESS - select VEXPRESS_CONFIG help This enables support for the ARMv8 software model (Versatile Express). From patchwork Wed Apr 29 20:58:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 212187 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D85A6C8300A for ; Wed, 29 Apr 2020 20:58:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B72A720B1F for ; Wed, 29 Apr 2020 20:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588193917; bh=bZWmwNZRThJSNoN/9I2DxiXbKB7TM5mrJ11tx2SjYi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sKNtbGKXdfrV3JLpvb8lsKRjRB0T20XALp0dC8y0k5a3OSzFGUAjz+2AL2DfJTtXZ ZJw2E5wAMdC1vj2zzDyelm133vQftIsz7dOy+QR/wFN4ePMgVcbJ1OVmpBazbV03QN Jp6+fM5YAF7fI2a+Ewp+tN0HZ4mlWbsp7zVZElE4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727094AbgD2U6h (ORCPT ); Wed, 29 Apr 2020 16:58:37 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:35421 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727070AbgD2U6g (ORCPT ); Wed, 29 Apr 2020 16:58:36 -0400 Received: by mail-ot1-f65.google.com with SMTP id e26so3006313otr.2; Wed, 29 Apr 2020 13:58:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ycrzTsN2UDt80PFGBLFquCxPRdusJ6s2yOMWOscpSM4=; b=EtjarPHuadfV1NbMBXYMoHbqWbIbcn3Swqbi+WnC26ajPHYcaYWVICl9zXEQ8a947J Sq2+0Dyfj7EbIQ+GfdAFTmPUUitqKoyPyb35bPvQwqfuP5XedtIQdYE9ICzX3KRDA9n5 tmjlRdy4YQz5xZ99uWjdQ69wF8oyfJ2zM3o58qWSPEDG5kmiIqdy5slx5kg+P6ImPGOS 1zJsHto9imFmJpKe7KpCRnKfREkOGYx7jaVPcZC7lzG59eGVFqun2NxmOrgKb5keX2vD jQ1U03k/6K4xF0w+5yCS9tEfDcSAQwQfbTgETcWFrZ8KWUp49CRPU8pRlkPzbLqyOEcZ LmcQ== X-Gm-Message-State: AGi0PuY3ZLi408o8TD4VtcqLpa2NRvZC4hOJBewj2bIiDktAu2u5ISl1 oaK7B8fJCe4RkOznzSoonQ== X-Google-Smtp-Source: APiQypL4VnrXGZPah4Civ+Lm3BOCjh2M68S53+iKXITJryVzyn0lRjk1cF+ARDOewyDNk8HX1VAE3Q== X-Received: by 2002:a05:6830:22dc:: with SMTP id q28mr26756333otc.221.1588193914163; Wed, 29 Apr 2020 13:58:34 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z13sm653162oth.10.2020.04.29.13.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:58:33 -0700 (PDT) From: Rob Herring To: Linus Walleij , Liviu Dudau , Lorenzo Pieralisi , Sudeep Holla Cc: Kevin Brodsky , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , Lee Jones , Sebastian Reichel , Stephen Boyd , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 04/16] clk: versatile: Rework kconfig structure Date: Wed, 29 Apr 2020 15:58:13 -0500 Message-Id: <20200429205825.10604-5-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429205825.10604-1-robh@kernel.org> References: <20200429205825.10604-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org CONFIG_COMMON_CLK_VERSATILE doesn't really do anything other than hiding Arm Ltd reference platform clock drivers. It is both selected by the platforms that need it and has a 'depends on' for those platforms. Let's drop the selects and convert CONFIG_COMMON_CLK_VERSATILE into a menuconfig entry. With this make CONFIG_ICST visible. Move the 'select REGMAP_MMIO' to the drivers that require it (SP810 did not). This also has the side effect of enabling CONFIG_ICST for COMPILE_TEST as it was not visible before. Cc: Catalin Marinas Cc: Will Deacon Cc: Liviu Dudau Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: Linus Walleij Cc: Stephen Boyd Signed-off-by: Rob Herring --- v2: - Correct erroneous COMPILE_TEST added and then removed later in the series. - Bring back COMMON_CLK_VERSATILE making it a menuconfig and separate it from CONFIG_ICST --- arch/arm/mach-integrator/Kconfig | 1 - arch/arm/mach-realview/Kconfig | 1 - arch/arm/mach-versatile/Kconfig | 1 - arch/arm/mach-vexpress/Kconfig | 1 - arch/arm64/Kconfig.platforms | 1 - drivers/clk/Makefile | 2 +- drivers/clk/versatile/Kconfig | 22 ++++++++++++---------- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig index 982eabc36163..d59ba15a6b69 100644 --- a/arch/arm/mach-integrator/Kconfig +++ b/arch/arm/mach-integrator/Kconfig @@ -3,7 +3,6 @@ menuconfig ARCH_INTEGRATOR bool "ARM Ltd. Integrator family" depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6 select ARM_AMBA - select COMMON_CLK_VERSATILE select HAVE_TCM select ICST select MFD_SYSCON diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig index 44ebbf9ec673..002404fafc14 100644 --- a/arch/arm/mach-realview/Kconfig +++ b/arch/arm/mach-realview/Kconfig @@ -6,7 +6,6 @@ menuconfig ARCH_REALVIEW select ARM_GIC select ARM_TIMER_SP804 select CLK_SP810 - select COMMON_CLK_VERSATILE select GPIO_PL061 if GPIOLIB select HAVE_ARM_SCU if SMP select HAVE_ARM_TWD if SMP diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig index f5c275434d6c..d88e7725bf99 100644 --- a/arch/arm/mach-versatile/Kconfig +++ b/arch/arm/mach-versatile/Kconfig @@ -6,7 +6,6 @@ config ARCH_VERSATILE select ARM_TIMER_SP804 select ARM_VIC select CLKSRC_VERSATILE - select COMMON_CLK_VERSATILE select CPU_ARM926T select ICST select MFD_SYSCON diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig index 18951cd20d9d..2d1fdec4c230 100644 --- a/arch/arm/mach-vexpress/Kconfig +++ b/arch/arm/mach-vexpress/Kconfig @@ -7,7 +7,6 @@ menuconfig ARCH_VEXPRESS select ARM_GIC select ARM_GLOBAL_TIMER select ARM_TIMER_SP804 - select COMMON_CLK_VERSATILE select GPIOLIB select HAVE_ARM_SCU if SMP select HAVE_ARM_TWD if SMP diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 5c38dc56b808..25cbb556d863 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -274,7 +274,6 @@ config ARCH_UNIPHIER config ARCH_VEXPRESS bool "ARMv8 software model (Versatile Express)" - select COMMON_CLK_VERSATILE select GPIOLIB select PM select PM_GENERIC_DOMAINS diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index f4169cc2fd31..fb30c16e1596 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -114,7 +114,7 @@ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-y += ti/ obj-$(CONFIG_CLK_UNIPHIER) += uniphier/ obj-$(CONFIG_ARCH_U8500) += ux500/ -obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/ +obj-y += versatile/ ifeq ($(CONFIG_COMMON_CLK), y) obj-$(CONFIG_X86) += x86/ endif diff --git a/drivers/clk/versatile/Kconfig b/drivers/clk/versatile/Kconfig index c2618f1477a2..df0d50bb846c 100644 --- a/drivers/clk/versatile/Kconfig +++ b/drivers/clk/versatile/Kconfig @@ -1,22 +1,22 @@ # SPDX-License-Identifier: GPL-2.0-only -config ICST - bool -config COMMON_CLK_VERSATILE - bool "Clock driver for ARM Reference designs" - depends on ARCH_INTEGRATOR || ARCH_REALVIEW || \ - ARCH_VERSATILE || ARCH_VEXPRESS || ARM64 || \ - COMPILE_TEST +menuconfig COMMON_CLK_VERSATILE + bool "Clock driver for ARM Reference designs" if COMPILE_TEST + default y if ARCH_INTEGRATOR || ARCH_REALVIEW || \ + ARCH_VERSATILE || ARCH_VEXPRESS + +if COMMON_CLK_VERSATILE + +config ICST + bool "Clock driver for ARM Reference designs ICST" select REGMAP_MMIO ---help--- Supports clocking on ARM Reference designs: - Integrator/AP and Integrator/CP - RealView PB1176, EB, PB11MP and PBX - - Versatile Express config CLK_SP810 bool "Clock driver for ARM SP810 System Controller" - depends on COMMON_CLK_VERSATILE default y if ARCH_VEXPRESS ---help--- Supports clock muxing (REFCLK/TIMCLK to TIMERCLKEN0-3) capabilities @@ -24,10 +24,12 @@ config CLK_SP810 config CLK_VEXPRESS_OSC bool "Clock driver for Versatile Express OSC clock generators" - depends on COMMON_CLK_VERSATILE depends on VEXPRESS_CONFIG + select REGMAP_MMIO default y if ARCH_VEXPRESS ---help--- Simple regmap-based driver driving clock generators on Versatile Express platforms hidden behind its configuration infrastructure, commonly known as OSCs. + +endif From patchwork Wed Apr 29 20:58:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 212188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A9D3C83000 for ; Wed, 29 Apr 2020 20:58:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40E5F2137B for ; Wed, 29 Apr 2020 20:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588193917; bh=BBLb010f5BMdHODMYRRNpYHUv9lak/XrXyS43JDVe0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vLCeFqYYbqjat10s7PCDcb0nrGwNnrSHbqNMMAkhblAgGlEzjkdMlfZhUWC3x9Amx zBPkAcATMh37GHPvjcyt98hL/j4FjQLuQDeACrPyUk1jGgULvUfJ4L3zAEGmxYBEkO IO5Pw17ZHdM/KHzUL3PsUMxrkqJ0F9qgLsfNjcuI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727090AbgD2U6g (ORCPT ); Wed, 29 Apr 2020 16:58:36 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:44180 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727086AbgD2U6g (ORCPT ); Wed, 29 Apr 2020 16:58:36 -0400 Received: by mail-oi1-f196.google.com with SMTP id a2so3117058oia.11; Wed, 29 Apr 2020 13:58:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D2qb/OvsZeuot/6uM8EwDvWFdbtAPyr2Mv3N5hc2RTw=; b=FaoTTTw5EODe7EUKBRKA8aNCWFKYBWzmnZD/VUjJH++D9OHtFL2Z4jROIpvmxmb2Z2 3SJUs2XkpCCHSEJsebvIDX7BnLJ0g2mlYVu+1mMbE6nra7lmRZSyWNfOoPTFBlhrMgy/ lLnDr8Bmx9S37poglqQ7ei1Ppd4y58qK7hCKT7Vmjj7fAppCK8CwaoAVwAct640Z5qru 0zv+DI0eQ6juwbWrocm4YObOfcBvshNWwTDNge2+J/03BqF1UicRNciu9alaPdQqBx0w 80rnnfNA6VXbau7keDmdiy1EqBD6nJMHy6M5lBk7TvFp9uPrgI2XSGZ3wZhL0qo9bsR5 JVOg== X-Gm-Message-State: AGi0PuZI6qQDsKlnG1c1WVime2D7yzsIoev0J69n0RW6ovuV/xKKIBtW igWD6Au2XbZgnSueVVr8yQ== X-Google-Smtp-Source: APiQypInPg4wr8U7ru0AiPOb2rYYQ+qLy6mnlNZK1mQLdkr/zxHbjhm53Jiw7qfUFFZqUi5e6teEPA== X-Received: by 2002:aca:b382:: with SMTP id c124mr140690oif.64.1588193915509; Wed, 29 Apr 2020 13:58:35 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z13sm653162oth.10.2020.04.29.13.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:58:34 -0700 (PDT) From: Rob Herring To: Linus Walleij , Liviu Dudau , Lorenzo Pieralisi , Sudeep Holla Cc: Kevin Brodsky , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , Lee Jones , Sebastian Reichel , Stephen Boyd , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 05/16] clk: versatile: Only enable SP810 on 32-bit by default Date: Wed, 29 Apr 2020 15:58:14 -0500 Message-Id: <20200429205825.10604-6-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429205825.10604-1-robh@kernel.org> References: <20200429205825.10604-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org While 64-bit Arm reference platforms have SP810 for clocks for SP804 timers, they are not needed since the arch timers are used instead. Cc: Catalin Marinas Cc: Will Deacon Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: Linus Walleij Cc: Stephen Boyd Cc: linux-clk@vger.kernel.org Acked-by: Arnd Bergmann Acked-by: Liviu Dudau Signed-off-by: Rob Herring --- drivers/clk/versatile/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/versatile/Kconfig b/drivers/clk/versatile/Kconfig index df0d50bb846c..a47dd6c86d2e 100644 --- a/drivers/clk/versatile/Kconfig +++ b/drivers/clk/versatile/Kconfig @@ -17,7 +17,7 @@ config ICST config CLK_SP810 bool "Clock driver for ARM SP810 System Controller" - default y if ARCH_VEXPRESS + default y if (ARCH_VEXPRESS && ARM) ---help--- Supports clock muxing (REFCLK/TIMCLK to TIMERCLKEN0-3) capabilities of the ARM SP810 System Controller cell. From patchwork Wed Apr 29 20:58:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 212186 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A35EC83000 for ; Wed, 29 Apr 2020 20:58:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 779DF2076B for ; Wed, 29 Apr 2020 20:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588193920; bh=RHwqmk34hRt22w/ldSGV0u0E1CO7bTs78pTQyWBA6FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xsOSTT9vZTa6f0PQYEpFINTdpwRyfYI5424shHXyzqT1AyQePuFziBc5l03FD3GXK L3J+qf2anIx3oJM70od2Q83a6nWfEy+V3dRCvq1uFKuf6YuZVayjQTriqsyU1NwiFk JQnpZQeQb6URymrWG4LxoXHDYmGsg3d9SYRxYRQ0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727102AbgD2U6k (ORCPT ); Wed, 29 Apr 2020 16:58:40 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:41114 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727070AbgD2U6j (ORCPT ); Wed, 29 Apr 2020 16:58:39 -0400 Received: by mail-oi1-f193.google.com with SMTP id 19so3121315oiy.8; Wed, 29 Apr 2020 13:58:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qg2zxc590nC56Olu/LMLIdebNTiQLSp6hgsD/Wgzqhc=; b=jGCOmzGqVtaMZ+AgL4r4UTSJEoMJEHCOHSLCsqRpCIlbrddNLAfMmSTlVbtKqqcHLl GCPzv1dycCZAezM/Yqcu3PQUCHxxoC7r+C0Qg1Ly53zy84WQgZw4d1d646LzZ4KTaJOu FX3j4TKg8VOUWbeXy8lpTHwSYyvdQ57a1wkw78KZBXJUAUt2dKcciNrlHbknh+3vweUa inANULWtepxULwIi7IyQiXzfjcbLqu81L5KYo+PN7K1HuL3T85icvvO5dw2QVJLpNpYz UjVrPoouOm25XLTdR9FD4ybALUOKaDoUoL0iUzzb1QYgqZOgH7DbKA5u5WV3OXqd8+/2 WLfQ== X-Gm-Message-State: AGi0PuajgC+iTW02vZ3Nju4nTeOyT21YIiYbGLhNxPDgh12DMgOIdhuQ ToJ8UMCu+OH9cLKsPj7q0w== X-Google-Smtp-Source: APiQypLrWJY7pYSRXhfCSOB9FxS2TVlt5Ok67NnxttN2E8ckgZPz2Ph897iAX8kOYgBQBWEzEAcFZw== X-Received: by 2002:a54:4619:: with SMTP id p25mr128029oip.122.1588193918475; Wed, 29 Apr 2020 13:58:38 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z13sm653162oth.10.2020.04.29.13.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:58:37 -0700 (PDT) From: Rob Herring To: Linus Walleij , Liviu Dudau , Lorenzo Pieralisi , Sudeep Holla Cc: Kevin Brodsky , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , Lee Jones , Sebastian Reichel , Stephen Boyd , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, Michael Turquette Subject: [PATCH v2 07/16] clk: vexpress-osc: Support building as a module Date: Wed, 29 Apr 2020 15:58:16 -0500 Message-Id: <20200429205825.10604-8-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429205825.10604-1-robh@kernel.org> References: <20200429205825.10604-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Enable building the vexpress-osc clock driver as a module. Cc: Linus Walleij Cc: Liviu Dudau Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: Michael Turquette Cc: Stephen Boyd Cc: linux-clk@vger.kernel.org Signed-off-by: Rob Herring --- drivers/clk/versatile/clk-vexpress-osc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/clk/versatile/clk-vexpress-osc.c b/drivers/clk/versatile/clk-vexpress-osc.c index 5bb1d5a714d0..b2b32fa2d7c3 100644 --- a/drivers/clk/versatile/clk-vexpress-osc.c +++ b/drivers/clk/versatile/clk-vexpress-osc.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -108,6 +109,7 @@ static const struct of_device_id vexpress_osc_of_match[] = { { .compatible = "arm,vexpress-osc", }, {} }; +MODULE_DEVICE_TABLE(of, vexpress_osc_of_match); static struct platform_driver vexpress_osc_driver = { .driver = { @@ -116,9 +118,5 @@ static struct platform_driver vexpress_osc_driver = { }, .probe = vexpress_osc_probe, }; - -static int __init vexpress_osc_init(void) -{ - return platform_driver_register(&vexpress_osc_driver); -} -core_initcall(vexpress_osc_init); +module_platform_driver(vexpress_osc_driver); +MODULE_LICENSE("GPL v2"); From patchwork Wed Apr 29 20:58:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 212185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7997C8300B for ; Wed, 29 Apr 2020 20:58:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 861DA20B1F for ; Wed, 29 Apr 2020 20:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588193924; bh=T4lULlfdis3pO59cxx1iFLivWv+x8cqFPKw6Yx0n+E0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=awLwcvk8j/6o5Fxts4mQi8qjhZDXjk8Iv3uJ9Vf1EdUvGW5iYR3D2NrYTRyxe8ptH EABqiEnDJi2M2po2m9YN8Wh6s0NUxHXH26cZ3HAlJfSIkndZqzJhxZKiB+JA49e1ea DMk2wYRIZkv5D1GR3wcxLUkJ6weaCISxepM9QYPo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbgD2U6o (ORCPT ); Wed, 29 Apr 2020 16:58:44 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:44195 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727070AbgD2U6n (ORCPT ); Wed, 29 Apr 2020 16:58:43 -0400 Received: by mail-oi1-f195.google.com with SMTP id a2so3117386oia.11; Wed, 29 Apr 2020 13:58:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mCsNkb20GktgvT3EVSg7e0Ed7fNCWMt0hSKRdrZhvDs=; b=sMDRWWbDbki96lLdasxcFtsMdVea8AQZ6bdNo6DLYMSvfBhgJwR9Ne3CZPL1rZqwjH m5m5dx6jGHF/nrzAawvTBr7Lsk5eRk4gmvK/ge9UjGFvbDKnce+BFfelDOpJLaKsijti hT1nwm2w38U38tmWJpA1hqwVaEtdezMysyWaFQlGe7Z3ziIi3fn1d1bDd9OlUDDgJnIL KlkQMrQHjKEK4gid9YSL9KycehfKpztHzlknWF3Zg3B3ynXKMz3gQodbP4arYs162b2A ujsU8hcsWbhC7AxCtHZIYGu+vo+7Ua4uwkrIvnemA6obDZ1MSYxpeCmy6G34ROz3bBwI VIEA== X-Gm-Message-State: AGi0PubN2YC+6OMu6e1Am6ANblwirBvDz9MKfDAvWI/1C9pAmgL9VOwR GiRUkztM0H+HzbMZ05x89Q== X-Google-Smtp-Source: APiQypIMdJYtJ48k8tsFDlemNM2E4VC1cOVOCiiaXWDZFhkxrRyppPOhxj91cmywM1r4IIPVqeGw1w== X-Received: by 2002:aca:2807:: with SMTP id 7mr123603oix.15.1588193922725; Wed, 29 Apr 2020 13:58:42 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z13sm653162oth.10.2020.04.29.13.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:58:42 -0700 (PDT) From: Rob Herring To: Linus Walleij , Liviu Dudau , Lorenzo Pieralisi , Sudeep Holla Cc: Kevin Brodsky , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , Lee Jones , Sebastian Reichel , Stephen Boyd , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 10/16] mfd: vexpress-sysreg: Use devres API variants Date: Wed, 29 Apr 2020 15:58:19 -0500 Message-Id: <20200429205825.10604-11-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429205825.10604-1-robh@kernel.org> References: <20200429205825.10604-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use the managed devm_gpiochip_add_data() and devm_mfd_add_devices() instead of their unmanaged counterparts. With this, no .remove() hook is needed for driver unbind. Cc: Liviu Dudau Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: Linus Walleij Cc: Lee Jones Acked-by: Arnd Bergmann Acked-by: Liviu Dudau Signed-off-by: Rob Herring --- drivers/mfd/vexpress-sysreg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c index 90a4eda2ba2b..9fb37fa689e0 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c @@ -140,9 +140,9 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) bgpio_init(mmc_gpio_chip, &pdev->dev, 0x4, base + SYS_MCI, NULL, NULL, NULL, NULL, 0); mmc_gpio_chip->ngpio = 2; - gpiochip_add_data(mmc_gpio_chip, NULL); + devm_gpiochip_add_data(&pdev->dev, mmc_gpio_chip, NULL); - return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, + return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, vexpress_sysreg_cells, ARRAY_SIZE(vexpress_sysreg_cells), mem, 0, NULL); } From patchwork Wed Apr 29 20:58:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 212184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A34B1C83007 for ; Wed, 29 Apr 2020 20:58:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 754D720BED for ; Wed, 29 Apr 2020 20:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588193928; bh=QeDSqUDnXW3GXi7KCeACyeM5pcMJaZDTy1RYGWXmlc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rpeI13QNXwlH2y3U0B5HzS9UtpOmDnrd35Jl4At115NIwhMxbWlxnKXsjC+Vam3iR hAlAsaO7nYKpaCWEdb96SrIB5ObHE/XW3dT76bUca1nlauS4JfjJC2qvR+eZ4puAeg eYLvz7rk16wBCseEl+dyTLg3tI/UTLGGSUg8Ur9w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727070AbgD2U6r (ORCPT ); Wed, 29 Apr 2020 16:58:47 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:36125 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbgD2U6r (ORCPT ); Wed, 29 Apr 2020 16:58:47 -0400 Received: by mail-ot1-f67.google.com with SMTP id b13so2992120oti.3; Wed, 29 Apr 2020 13:58:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+USzHRYmJEzVRKFDOu0LkwxTP/bvZhq9sONXfjk1RSU=; b=FQFYPDR9aKSl14k6xJrdgQG3JXKiSr/Wc3cf4z4KrTSPYyLuvHkbho0CxIE6521IyZ sReuw6cpEklc6Lp5VQKF6lVdy8Esw+wgJ9iEYhx/zMwxuMZuOKMuUE8sgSagBknvvpR0 TQmrlm+DMJOxdqRb6fw9ELIuB/WlKtg/kizgs5ESfrfxoqZCMCt0/OPPzzMpn+nhBe9j OCCafpwAJyw4BNsOfZcDSTTK1MxTMLCwJ/RcY0pNz5zRNyDXvR71GmPO0tBiEttghulr l8yx8Zf4yj4GsTfQr1A2ThaRIcXVcSprMEzpyGE52yoqYxBlX1P6/ClobLZhaO1OazT1 0AXQ== X-Gm-Message-State: AGi0PuYNxruBfMdPiBIMTiDvM9zgbbCKnVLCcfbfqpSOZh8DMSN9v0Tt OzvOkH/y+LPMaeBNnqznMw== X-Google-Smtp-Source: APiQypK0Wl97YaJ+3gmf3RG0azGmqbkDqn9cb7GfcYJGkadk3/1GnuCxNSkLpU0KU+MPLRR6UWLwCA== X-Received: by 2002:a9d:6ac6:: with SMTP id m6mr4943974otq.215.1588193925511; Wed, 29 Apr 2020 13:58:45 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z13sm653162oth.10.2020.04.29.13.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:58:44 -0700 (PDT) From: Rob Herring To: Linus Walleij , Liviu Dudau , Lorenzo Pieralisi , Sudeep Holla Cc: Kevin Brodsky , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , Lee Jones , Sebastian Reichel , Stephen Boyd , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 12/16] bus: vexpress-config: Merge vexpress-syscfg into vexpress-config Date: Wed, 29 Apr 2020 15:58:21 -0500 Message-Id: <20200429205825.10604-13-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429205825.10604-1-robh@kernel.org> References: <20200429205825.10604-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The only thing that vexpress-syscfg does is provide a regmap to vexpress-config bus child devices. There's little reason to have 2 components for this. The current structure with initcall ordering requirements makes turning these components into modules more difficult. So let's start to simplify things and merge vexpress-syscfg into vexpress-config. There's no functional change in this commit and it's still separate components until subsequent commits. Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: Linus Walleij Cc: Arnd Bergmann Acked-by: Greg Kroah-Hartman Acked-by: Liviu Dudau Signed-off-by: Rob Herring --- arch/arm/mach-vexpress/Kconfig | 1 - drivers/bus/vexpress-config.c | 283 +++++++++++++++++++++++++++++++-- drivers/misc/Kconfig | 9 -- drivers/misc/Makefile | 1 - drivers/misc/vexpress-syscfg.c | 280 -------------------------------- include/linux/vexpress.h | 17 -- 6 files changed, 274 insertions(+), 317 deletions(-) delete mode 100644 drivers/misc/vexpress-syscfg.c diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig index 2d1fdec4c230..065e12991663 100644 --- a/arch/arm/mach-vexpress/Kconfig +++ b/arch/arm/mach-vexpress/Kconfig @@ -20,7 +20,6 @@ menuconfig ARCH_VEXPRESS select REGULATOR if MMC_ARMMMCI select REGULATOR_FIXED_VOLTAGE if REGULATOR select VEXPRESS_CONFIG - select VEXPRESS_SYSCFG help This option enables support for systems using Cortex processor based ARM core and logic (FPGA) tiles on the Versatile Express motherboard, diff --git a/drivers/bus/vexpress-config.c b/drivers/bus/vexpress-config.c index ff70575b2db6..43f5beac9811 100644 --- a/drivers/bus/vexpress-config.c +++ b/drivers/bus/vexpress-config.c @@ -6,10 +6,48 @@ #include #include +#include #include +#include #include +#include +#include #include +#define SYS_CFGDATA 0x0 + +#define SYS_CFGCTRL 0x4 +#define SYS_CFGCTRL_START (1 << 31) +#define SYS_CFGCTRL_WRITE (1 << 30) +#define SYS_CFGCTRL_DCC(n) (((n) & 0xf) << 26) +#define SYS_CFGCTRL_FUNC(n) (((n) & 0x3f) << 20) +#define SYS_CFGCTRL_SITE(n) (((n) & 0x3) << 16) +#define SYS_CFGCTRL_POSITION(n) (((n) & 0xf) << 12) +#define SYS_CFGCTRL_DEVICE(n) (((n) & 0xfff) << 0) + +#define SYS_CFGSTAT 0x8 +#define SYS_CFGSTAT_ERR (1 << 1) +#define SYS_CFGSTAT_COMPLETE (1 << 0) + + +struct vexpress_syscfg { + struct device *dev; + void __iomem *base; + struct list_head funcs; +}; + +struct vexpress_syscfg_func { + struct list_head list; + struct vexpress_syscfg *syscfg; + struct regmap *regmap; + int num_templates; + u32 template[]; /* Keep it last! */ +}; + +struct vexpress_config_bridge_ops { + struct regmap * (*regmap_init)(struct device *dev, void *context); + void (*regmap_exit)(struct regmap *regmap, void *context); +}; struct vexpress_config_bridge { struct vexpress_config_bridge_ops *ops; @@ -27,17 +65,12 @@ void vexpress_config_set_master(u32 site) vexpress_config_site_master = site; } -u32 vexpress_config_get_master(void) -{ - return vexpress_config_site_master; -} - -void vexpress_config_lock(void *arg) +static void vexpress_config_lock(void *arg) { mutex_lock(&vexpress_config_mutex); } -void vexpress_config_unlock(void *arg) +static void vexpress_config_unlock(void *arg) { mutex_unlock(&vexpress_config_mutex); } @@ -59,7 +92,7 @@ static void vexpress_config_find_prop(struct device_node *node, } } -int vexpress_config_get_topo(struct device_node *node, u32 *site, +static int vexpress_config_get_topo(struct device_node *node, u32 *site, u32 *position, u32 *dcc) { vexpress_config_find_prop(node, "arm,vexpress,site", site); @@ -113,7 +146,7 @@ struct regmap *devm_regmap_init_vexpress_config(struct device *dev) } EXPORT_SYMBOL_GPL(devm_regmap_init_vexpress_config); -struct device *vexpress_config_bridge_register(struct device *parent, +static struct device *vexpress_config_bridge_register(struct device *parent, struct vexpress_config_bridge_ops *ops, void *context) { struct device *dev; @@ -201,3 +234,235 @@ static int __init vexpress_config_init(void) } postcore_initcall(vexpress_config_init); +static int vexpress_syscfg_exec(struct vexpress_syscfg_func *func, + int index, bool write, u32 *data) +{ + struct vexpress_syscfg *syscfg = func->syscfg; + u32 command, status; + int tries; + long timeout; + + if (WARN_ON(index >= func->num_templates)) + return -EINVAL; + + command = readl(syscfg->base + SYS_CFGCTRL); + if (WARN_ON(command & SYS_CFGCTRL_START)) + return -EBUSY; + + command = func->template[index]; + command |= SYS_CFGCTRL_START; + command |= write ? SYS_CFGCTRL_WRITE : 0; + + /* Use a canary for reads */ + if (!write) + *data = 0xdeadbeef; + + dev_dbg(syscfg->dev, "func %p, command %x, data %x\n", + func, command, *data); + writel(*data, syscfg->base + SYS_CFGDATA); + writel(0, syscfg->base + SYS_CFGSTAT); + writel(command, syscfg->base + SYS_CFGCTRL); + mb(); + + /* The operation can take ages... Go to sleep, 100us initially */ + tries = 100; + timeout = 100; + do { + if (!irqs_disabled()) { + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(usecs_to_jiffies(timeout)); + if (signal_pending(current)) + return -EINTR; + } else { + udelay(timeout); + } + + status = readl(syscfg->base + SYS_CFGSTAT); + if (status & SYS_CFGSTAT_ERR) + return -EFAULT; + + if (timeout > 20) + timeout -= 20; + } while (--tries && !(status & SYS_CFGSTAT_COMPLETE)); + if (WARN_ON_ONCE(!tries)) + return -ETIMEDOUT; + + if (!write) { + *data = readl(syscfg->base + SYS_CFGDATA); + dev_dbg(syscfg->dev, "func %p, read data %x\n", func, *data); + } + + return 0; +} + +static int vexpress_syscfg_read(void *context, unsigned int index, + unsigned int *val) +{ + struct vexpress_syscfg_func *func = context; + + return vexpress_syscfg_exec(func, index, false, val); +} + +static int vexpress_syscfg_write(void *context, unsigned int index, + unsigned int val) +{ + struct vexpress_syscfg_func *func = context; + + return vexpress_syscfg_exec(func, index, true, &val); +} + +static struct regmap_config vexpress_syscfg_regmap_config = { + .lock = vexpress_config_lock, + .unlock = vexpress_config_unlock, + .reg_bits = 32, + .val_bits = 32, + .reg_read = vexpress_syscfg_read, + .reg_write = vexpress_syscfg_write, + .reg_format_endian = REGMAP_ENDIAN_LITTLE, + .val_format_endian = REGMAP_ENDIAN_LITTLE, +}; + + +static struct regmap *vexpress_syscfg_regmap_init(struct device *dev, + void *context) +{ + int err; + struct vexpress_syscfg *syscfg = context; + struct vexpress_syscfg_func *func; + struct property *prop; + const __be32 *val = NULL; + __be32 energy_quirk[4]; + int num; + u32 site, position, dcc; + int i; + + err = vexpress_config_get_topo(dev->of_node, &site, + &position, &dcc); + if (err) + return ERR_PTR(err); + + prop = of_find_property(dev->of_node, + "arm,vexpress-sysreg,func", NULL); + if (!prop) + return ERR_PTR(-EINVAL); + + num = prop->length / sizeof(u32) / 2; + val = prop->value; + + /* + * "arm,vexpress-energy" function used to be described + * by its first device only, now it requires both + */ + if (num == 1 && of_device_is_compatible(dev->of_node, + "arm,vexpress-energy")) { + num = 2; + energy_quirk[0] = *val; + energy_quirk[2] = *val++; + energy_quirk[1] = *val; + energy_quirk[3] = cpu_to_be32(be32_to_cpup(val) + 1); + val = energy_quirk; + } + + func = kzalloc(struct_size(func, template, num), GFP_KERNEL); + if (!func) + return ERR_PTR(-ENOMEM); + + func->syscfg = syscfg; + func->num_templates = num; + + for (i = 0; i < num; i++) { + u32 function, device; + + function = be32_to_cpup(val++); + device = be32_to_cpup(val++); + + dev_dbg(dev, "func %p: %u/%u/%u/%u/%u\n", + func, site, position, dcc, + function, device); + + func->template[i] = SYS_CFGCTRL_DCC(dcc); + func->template[i] |= SYS_CFGCTRL_SITE(site); + func->template[i] |= SYS_CFGCTRL_POSITION(position); + func->template[i] |= SYS_CFGCTRL_FUNC(function); + func->template[i] |= SYS_CFGCTRL_DEVICE(device); + } + + vexpress_syscfg_regmap_config.max_register = num - 1; + + func->regmap = regmap_init(dev, NULL, func, + &vexpress_syscfg_regmap_config); + + if (IS_ERR(func->regmap)) { + void *err = func->regmap; + + kfree(func); + return err; + } + + list_add(&func->list, &syscfg->funcs); + + return func->regmap; +} + +static void vexpress_syscfg_regmap_exit(struct regmap *regmap, void *context) +{ + struct vexpress_syscfg *syscfg = context; + struct vexpress_syscfg_func *func, *tmp; + + regmap_exit(regmap); + + list_for_each_entry_safe(func, tmp, &syscfg->funcs, list) { + if (func->regmap == regmap) { + list_del(&syscfg->funcs); + kfree(func); + break; + } + } +} + +static struct vexpress_config_bridge_ops vexpress_syscfg_bridge_ops = { + .regmap_init = vexpress_syscfg_regmap_init, + .regmap_exit = vexpress_syscfg_regmap_exit, +}; + + +static int vexpress_syscfg_probe(struct platform_device *pdev) +{ + struct vexpress_syscfg *syscfg; + struct resource *res; + struct device *bridge; + + syscfg = devm_kzalloc(&pdev->dev, sizeof(*syscfg), GFP_KERNEL); + if (!syscfg) + return -ENOMEM; + syscfg->dev = &pdev->dev; + INIT_LIST_HEAD(&syscfg->funcs); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + syscfg->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(syscfg->base)) + return PTR_ERR(syscfg->base); + + /* Must use dev.parent (MFD), as that's where DT phandle points at... */ + bridge = vexpress_config_bridge_register(pdev->dev.parent, + &vexpress_syscfg_bridge_ops, syscfg); + + return PTR_ERR_OR_ZERO(bridge); +} + +static const struct platform_device_id vexpress_syscfg_id_table[] = { + { "vexpress-syscfg", }, + {}, +}; + +static struct platform_driver vexpress_syscfg_driver = { + .driver.name = "vexpress-syscfg", + .id_table = vexpress_syscfg_id_table, + .probe = vexpress_syscfg_probe, +}; + +static int __init vexpress_syscfg_init(void) +{ + return platform_driver_register(&vexpress_syscfg_driver); +} +core_initcall(vexpress_syscfg_init); diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 99e151475d8f..edd5dd5ebfdc 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -423,15 +423,6 @@ config SRAM config SRAM_EXEC bool -config VEXPRESS_SYSCFG - bool "Versatile Express System Configuration driver" - depends on VEXPRESS_CONFIG - default y - help - ARM Ltd. Versatile Express uses specialised platform configuration - bus. System Configuration interface is one of the possible means - of generating transactions on this bus. - config PCI_ENDPOINT_TEST depends on PCI select CRC32 diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 9abf2923d831..c7bd01ac6291 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -49,7 +49,6 @@ obj-$(CONFIG_SRAM_EXEC) += sram-exec.o obj-y += mic/ obj-$(CONFIG_GENWQE) += genwqe/ obj-$(CONFIG_ECHO) += echo/ -obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o obj-$(CONFIG_CXL_BASE) += cxl/ obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o obj-$(CONFIG_OCXL) += ocxl/ diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c deleted file mode 100644 index a431787c0898..000000000000 --- a/drivers/misc/vexpress-syscfg.c +++ /dev/null @@ -1,280 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * - * Copyright (C) 2014 ARM Limited - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define SYS_CFGDATA 0x0 - -#define SYS_CFGCTRL 0x4 -#define SYS_CFGCTRL_START (1 << 31) -#define SYS_CFGCTRL_WRITE (1 << 30) -#define SYS_CFGCTRL_DCC(n) (((n) & 0xf) << 26) -#define SYS_CFGCTRL_FUNC(n) (((n) & 0x3f) << 20) -#define SYS_CFGCTRL_SITE(n) (((n) & 0x3) << 16) -#define SYS_CFGCTRL_POSITION(n) (((n) & 0xf) << 12) -#define SYS_CFGCTRL_DEVICE(n) (((n) & 0xfff) << 0) - -#define SYS_CFGSTAT 0x8 -#define SYS_CFGSTAT_ERR (1 << 1) -#define SYS_CFGSTAT_COMPLETE (1 << 0) - - -struct vexpress_syscfg { - struct device *dev; - void __iomem *base; - struct list_head funcs; -}; - -struct vexpress_syscfg_func { - struct list_head list; - struct vexpress_syscfg *syscfg; - struct regmap *regmap; - int num_templates; - u32 template[]; /* Keep it last! */ -}; - - -static int vexpress_syscfg_exec(struct vexpress_syscfg_func *func, - int index, bool write, u32 *data) -{ - struct vexpress_syscfg *syscfg = func->syscfg; - u32 command, status; - int tries; - long timeout; - - if (WARN_ON(index >= func->num_templates)) - return -EINVAL; - - command = readl(syscfg->base + SYS_CFGCTRL); - if (WARN_ON(command & SYS_CFGCTRL_START)) - return -EBUSY; - - command = func->template[index]; - command |= SYS_CFGCTRL_START; - command |= write ? SYS_CFGCTRL_WRITE : 0; - - /* Use a canary for reads */ - if (!write) - *data = 0xdeadbeef; - - dev_dbg(syscfg->dev, "func %p, command %x, data %x\n", - func, command, *data); - writel(*data, syscfg->base + SYS_CFGDATA); - writel(0, syscfg->base + SYS_CFGSTAT); - writel(command, syscfg->base + SYS_CFGCTRL); - mb(); - - /* The operation can take ages... Go to sleep, 100us initially */ - tries = 100; - timeout = 100; - do { - if (!irqs_disabled()) { - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(usecs_to_jiffies(timeout)); - if (signal_pending(current)) - return -EINTR; - } else { - udelay(timeout); - } - - status = readl(syscfg->base + SYS_CFGSTAT); - if (status & SYS_CFGSTAT_ERR) - return -EFAULT; - - if (timeout > 20) - timeout -= 20; - } while (--tries && !(status & SYS_CFGSTAT_COMPLETE)); - if (WARN_ON_ONCE(!tries)) - return -ETIMEDOUT; - - if (!write) { - *data = readl(syscfg->base + SYS_CFGDATA); - dev_dbg(syscfg->dev, "func %p, read data %x\n", func, *data); - } - - return 0; -} - -static int vexpress_syscfg_read(void *context, unsigned int index, - unsigned int *val) -{ - struct vexpress_syscfg_func *func = context; - - return vexpress_syscfg_exec(func, index, false, val); -} - -static int vexpress_syscfg_write(void *context, unsigned int index, - unsigned int val) -{ - struct vexpress_syscfg_func *func = context; - - return vexpress_syscfg_exec(func, index, true, &val); -} - -static struct regmap_config vexpress_syscfg_regmap_config = { - .lock = vexpress_config_lock, - .unlock = vexpress_config_unlock, - .reg_bits = 32, - .val_bits = 32, - .reg_read = vexpress_syscfg_read, - .reg_write = vexpress_syscfg_write, - .reg_format_endian = REGMAP_ENDIAN_LITTLE, - .val_format_endian = REGMAP_ENDIAN_LITTLE, -}; - - -static struct regmap *vexpress_syscfg_regmap_init(struct device *dev, - void *context) -{ - int err; - struct vexpress_syscfg *syscfg = context; - struct vexpress_syscfg_func *func; - struct property *prop; - const __be32 *val = NULL; - __be32 energy_quirk[4]; - int num; - u32 site, position, dcc; - int i; - - err = vexpress_config_get_topo(dev->of_node, &site, - &position, &dcc); - if (err) - return ERR_PTR(err); - - prop = of_find_property(dev->of_node, - "arm,vexpress-sysreg,func", NULL); - if (!prop) - return ERR_PTR(-EINVAL); - - num = prop->length / sizeof(u32) / 2; - val = prop->value; - - /* - * "arm,vexpress-energy" function used to be described - * by its first device only, now it requires both - */ - if (num == 1 && of_device_is_compatible(dev->of_node, - "arm,vexpress-energy")) { - num = 2; - energy_quirk[0] = *val; - energy_quirk[2] = *val++; - energy_quirk[1] = *val; - energy_quirk[3] = cpu_to_be32(be32_to_cpup(val) + 1); - val = energy_quirk; - } - - func = kzalloc(struct_size(func, template, num), GFP_KERNEL); - if (!func) - return ERR_PTR(-ENOMEM); - - func->syscfg = syscfg; - func->num_templates = num; - - for (i = 0; i < num; i++) { - u32 function, device; - - function = be32_to_cpup(val++); - device = be32_to_cpup(val++); - - dev_dbg(dev, "func %p: %u/%u/%u/%u/%u\n", - func, site, position, dcc, - function, device); - - func->template[i] = SYS_CFGCTRL_DCC(dcc); - func->template[i] |= SYS_CFGCTRL_SITE(site); - func->template[i] |= SYS_CFGCTRL_POSITION(position); - func->template[i] |= SYS_CFGCTRL_FUNC(function); - func->template[i] |= SYS_CFGCTRL_DEVICE(device); - } - - vexpress_syscfg_regmap_config.max_register = num - 1; - - func->regmap = regmap_init(dev, NULL, func, - &vexpress_syscfg_regmap_config); - - if (IS_ERR(func->regmap)) { - void *err = func->regmap; - - kfree(func); - return err; - } - - list_add(&func->list, &syscfg->funcs); - - return func->regmap; -} - -static void vexpress_syscfg_regmap_exit(struct regmap *regmap, void *context) -{ - struct vexpress_syscfg *syscfg = context; - struct vexpress_syscfg_func *func, *tmp; - - regmap_exit(regmap); - - list_for_each_entry_safe(func, tmp, &syscfg->funcs, list) { - if (func->regmap == regmap) { - list_del(&syscfg->funcs); - kfree(func); - break; - } - } -} - -static struct vexpress_config_bridge_ops vexpress_syscfg_bridge_ops = { - .regmap_init = vexpress_syscfg_regmap_init, - .regmap_exit = vexpress_syscfg_regmap_exit, -}; - - -static int vexpress_syscfg_probe(struct platform_device *pdev) -{ - struct vexpress_syscfg *syscfg; - struct resource *res; - struct device *bridge; - - syscfg = devm_kzalloc(&pdev->dev, sizeof(*syscfg), GFP_KERNEL); - if (!syscfg) - return -ENOMEM; - syscfg->dev = &pdev->dev; - INIT_LIST_HEAD(&syscfg->funcs); - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - syscfg->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(syscfg->base)) - return PTR_ERR(syscfg->base); - - /* Must use dev.parent (MFD), as that's where DT phandle points at... */ - bridge = vexpress_config_bridge_register(pdev->dev.parent, - &vexpress_syscfg_bridge_ops, syscfg); - - return PTR_ERR_OR_ZERO(bridge); -} - -static const struct platform_device_id vexpress_syscfg_id_table[] = { - { "vexpress-syscfg", }, - {}, -}; - -static struct platform_driver vexpress_syscfg_driver = { - .driver.name = "vexpress-syscfg", - .id_table = vexpress_syscfg_id_table, - .probe = vexpress_syscfg_probe, -}; - -static int __init vexpress_syscfg_init(void) -{ - return platform_driver_register(&vexpress_syscfg_driver); -} -core_initcall(vexpress_syscfg_init); diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h index 2ec7992b054c..65096c792d57 100644 --- a/include/linux/vexpress.h +++ b/include/linux/vexpress.h @@ -18,23 +18,6 @@ /* Config infrastructure */ void vexpress_config_set_master(u32 site); -u32 vexpress_config_get_master(void); - -void vexpress_config_lock(void *arg); -void vexpress_config_unlock(void *arg); - -int vexpress_config_get_topo(struct device_node *node, u32 *site, - u32 *position, u32 *dcc); - -/* Config bridge API */ - -struct vexpress_config_bridge_ops { - struct regmap * (*regmap_init)(struct device *dev, void *context); - void (*regmap_exit)(struct regmap *regmap, void *context); -}; - -struct device *vexpress_config_bridge_register(struct device *parent, - struct vexpress_config_bridge_ops *ops, void *context); /* Config regmap API */ From patchwork Wed Apr 29 20:58:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 212183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBC08C8300C for ; Wed, 29 Apr 2020 20:58:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AAF1A20BED for ; Wed, 29 Apr 2020 20:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588193930; bh=uUrdVo9043HmvbcKzvLhdSoNCjBCAIsRpxzGcUTOBSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qZNhqpt2uktQF8LajLdlRZ1pPQsOO4O7ebnU5q8lCj0it6sg5RKLplqtYfsTXTEkm 0tH0ua2pDE7nLWcXqdPQrvYIf8mv0Me6qAs31SL1nNdyOjdS+0i7yGal68gKHo568n SFTIG3odr/FXlE0LIlyjPacJECZKahuUy03dotEY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727771AbgD2U6u (ORCPT ); Wed, 29 Apr 2020 16:58:50 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:38937 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbgD2U6t (ORCPT ); Wed, 29 Apr 2020 16:58:49 -0400 Received: by mail-oi1-f194.google.com with SMTP id m10so3130965oie.6; Wed, 29 Apr 2020 13:58:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=myrenzSPyW59XpfF+gIY1TxdoxeVOHKfaEK33JnlZTA=; b=jfLWwBOAOJfrGQDrLkC24LXLhz6oOO3jCqVuGnW/ixZ6enwc9DSBkIIVb6U5idzP3f DSUkdDzRsAtU7In+4th6OHG/Fxi/PngZbb7sOqEiPfrckCKC7gKR9HZ1rWuxSwDHe/IY j7QT9EHkPGe0F++o+0v0aLwqOWR0K8qgzeKL7Vu2qn21MaHIrr4Wcp3T6D9l1oCueUil U9XBuunMZ4aFRpY8GFXlVwbMSEtKoPgry8BfAvxt0RdD11MkwLW9e4zj9wYgdo4n7khB K7vpGPL0JeQ4lOND9Hxx7bIy7JbKaSDitFrOCDBTCWGy9+DNkjiun2OuF8R+4J7KmcPs fELA== X-Gm-Message-State: AGi0PuZWpJ1awCB4nsZqfG5iiWGcow0K6zZX4nZuiewi+8Uo8wvMqjSy W6xkEM8OR6hw9BHrFuCbmw== X-Google-Smtp-Source: APiQypId0MDw7AeVQVQkoHCYMF2A7Fv08/wl1ScqTYpGJciki03GgiqVioMmxhSmH8L/Spi9eOa0sg== X-Received: by 2002:a54:4e86:: with SMTP id c6mr127195oiy.178.1588193926891; Wed, 29 Apr 2020 13:58:46 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z13sm653162oth.10.2020.04.29.13.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:58:46 -0700 (PDT) From: Rob Herring To: Linus Walleij , Liviu Dudau , Lorenzo Pieralisi , Sudeep Holla Cc: Kevin Brodsky , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , Lee Jones , Sebastian Reichel , Stephen Boyd , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 13/16] bus: vexpress-config: simplify config bus probing Date: Wed, 29 Apr 2020 15:58:22 -0500 Message-Id: <20200429205825.10604-14-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429205825.10604-1-robh@kernel.org> References: <20200429205825.10604-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The vexpress-config initialization is dependent on the vexpress-syscfg driver probing. As vexpress-config was not a driver, deferred probe could not be used and instead initcall ordering was relied upon. This is fragile and doesn't work for modules. Let's move the config bus init into the vexpress-syscfg probe. This eliminates the initcall ordering requirement and the need to create a struct device and the "vexpress-config" class. Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: Linus Walleij Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Acked-by: Liviu Dudau Signed-off-by: Rob Herring --- drivers/bus/vexpress-config.c | 118 ++++++---------------------------- 1 file changed, 21 insertions(+), 97 deletions(-) diff --git a/drivers/bus/vexpress-config.c b/drivers/bus/vexpress-config.c index 43f5beac9811..43deb4df140b 100644 --- a/drivers/bus/vexpress-config.c +++ b/drivers/bus/vexpress-config.c @@ -56,7 +56,6 @@ struct vexpress_config_bridge { static DEFINE_MUTEX(vexpress_config_mutex); -static struct class *vexpress_config_class; static u32 vexpress_config_site_master = VEXPRESS_SITE_MASTER; @@ -121,9 +120,6 @@ struct regmap *devm_regmap_init_vexpress_config(struct device *dev) struct regmap *regmap; struct regmap **res; - if (WARN_ON(dev->parent->class != vexpress_config_class)) - return ERR_PTR(-ENODEV); - bridge = dev_get_drvdata(dev->parent); if (WARN_ON(!bridge)) return ERR_PTR(-EINVAL); @@ -146,94 +142,6 @@ struct regmap *devm_regmap_init_vexpress_config(struct device *dev) } EXPORT_SYMBOL_GPL(devm_regmap_init_vexpress_config); -static struct device *vexpress_config_bridge_register(struct device *parent, - struct vexpress_config_bridge_ops *ops, void *context) -{ - struct device *dev; - struct vexpress_config_bridge *bridge; - - if (!vexpress_config_class) { - vexpress_config_class = class_create(THIS_MODULE, - "vexpress-config"); - if (IS_ERR(vexpress_config_class)) - return (void *)vexpress_config_class; - } - - dev = device_create(vexpress_config_class, parent, 0, - NULL, "%s.bridge", dev_name(parent)); - - if (IS_ERR(dev)) - return dev; - - bridge = devm_kmalloc(dev, sizeof(*bridge), GFP_KERNEL); - if (!bridge) { - put_device(dev); - device_unregister(dev); - return ERR_PTR(-ENOMEM); - } - bridge->ops = ops; - bridge->context = context; - - dev_set_drvdata(dev, bridge); - - dev_dbg(parent, "Registered bridge '%s', parent node %p\n", - dev_name(dev), parent->of_node); - - return dev; -} - - -static int vexpress_config_node_match(struct device *dev, const void *data) -{ - const struct device_node *node = data; - - dev_dbg(dev, "Parent node %p, looking for %p\n", - dev->parent->of_node, node); - - return dev->parent->of_node == node; -} - -static int vexpress_config_populate(struct device_node *node) -{ - struct device_node *bridge; - struct device *parent; - int ret; - - bridge = of_parse_phandle(node, "arm,vexpress,config-bridge", 0); - if (!bridge) - return -EINVAL; - - parent = class_find_device(vexpress_config_class, NULL, bridge, - vexpress_config_node_match); - of_node_put(bridge); - if (WARN_ON(!parent)) - return -ENODEV; - - ret = of_platform_populate(node, NULL, NULL, parent); - - put_device(parent); - - return ret; -} - -static int __init vexpress_config_init(void) -{ - int err = 0; - struct device_node *node; - - /* Need the config devices early, before the "normal" devices... */ - for_each_compatible_node(node, NULL, "arm,vexpress,config-bus") { - err = vexpress_config_populate(node); - if (err) { - of_node_put(node); - break; - } - } - - return err; -} -postcore_initcall(vexpress_config_init); - static int vexpress_syscfg_exec(struct vexpress_syscfg_func *func, int index, bool write, u32 *data) { @@ -430,7 +338,8 @@ static int vexpress_syscfg_probe(struct platform_device *pdev) { struct vexpress_syscfg *syscfg; struct resource *res; - struct device *bridge; + struct vexpress_config_bridge *bridge; + struct device_node *node; syscfg = devm_kzalloc(&pdev->dev, sizeof(*syscfg), GFP_KERNEL); if (!syscfg) @@ -443,11 +352,26 @@ static int vexpress_syscfg_probe(struct platform_device *pdev) if (IS_ERR(syscfg->base)) return PTR_ERR(syscfg->base); - /* Must use dev.parent (MFD), as that's where DT phandle points at... */ - bridge = vexpress_config_bridge_register(pdev->dev.parent, - &vexpress_syscfg_bridge_ops, syscfg); + bridge = devm_kmalloc(&pdev->dev, sizeof(*bridge), GFP_KERNEL); + if (!bridge) + return -ENOMEM; + + bridge->ops = &vexpress_syscfg_bridge_ops; + bridge->context = syscfg; + + dev_set_drvdata(&pdev->dev, bridge); - return PTR_ERR_OR_ZERO(bridge); + for_each_compatible_node(node, NULL, "arm,vexpress,config-bus") { + struct device_node *bridge_np; + + bridge_np = of_parse_phandle(node, "arm,vexpress,config-bridge", 0); + if (bridge_np != pdev->dev.parent->of_node) + continue; + + of_platform_populate(node, NULL, NULL, &pdev->dev); + } + + return 0; } static const struct platform_device_id vexpress_syscfg_id_table[] = { From patchwork Wed Apr 29 20:58:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 212182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28CCAC8300E for ; Wed, 29 Apr 2020 20:58:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2F6620B1F for ; Wed, 29 Apr 2020 20:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588193934; bh=y1dLk5BzaF5Bzu4/3KDawirl/1MYfyiqdJM/yx4rKEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mVyTHD8mp6YpPGsga694zlA6EzXrXiGIAQSn4f9QL+KaBQpygw09Py9GcKeH4V4ay TZ4WETZuDN8FYObpzb9/IrZsvycVtz2/+8EdyKXr5XrDLOAwhppR4rffBD7AabADRJ xMVx+OJzBOP6RFe51Q73CJiwjGs1XrhfqCjvIx2o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726871AbgD2U6x (ORCPT ); Wed, 29 Apr 2020 16:58:53 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:46051 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbgD2U6x (ORCPT ); Wed, 29 Apr 2020 16:58:53 -0400 Received: by mail-ot1-f67.google.com with SMTP id e20so2955664otk.12; Wed, 29 Apr 2020 13:58:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cAdoTZHLltMFOVfGrqWdl37EO5vwkDwGDKM22JQICTM=; b=F5OknAKY58cpbfpDvtNn4umOrWJRShRr7mbLLU5eV+GlJBD57GOsa2fGJCscyrqN+/ pEuWL8Jh2GoS/OWoS8FoaVElo7DICPokO1djBNeQJDco4oE646j0hZHXjKlGncjvdwqX JfpZqVORlruuEggH7osFHZ3JQpAhRgCzwiopvWd5mIRdog6ZwDz42rWuCcTUvEZML8ox GIfCZivZlWgufCX/MsqOvmzs2S5UmgvBaCUgVpau00LUWShNY2PgJlNbz6LTHbi1ulV8 1RyA4MVEFxNg6Srf0KEZoNvd/nK4pG5+umjE9Z3hYJBxT4VyJyhpFyW3pTwTm0js8v6M iz0A== X-Gm-Message-State: AGi0PubM77fnbWaYYB3Lg3Vb+tJsKkOjCYHNXDDDiLs0LQTEvVWwXSFc i6CLW+bMYlI8ttxTntVLIA== X-Google-Smtp-Source: APiQypLaRwS1DB9c2Fr/UQVYYitfrqYIOoI7sUirq8Ad0qUr/66dbbAtO3c5FnIEbYo/svvyYQtMXA== X-Received: by 2002:a05:6830:3112:: with SMTP id b18mr26344468ots.97.1588193931043; Wed, 29 Apr 2020 13:58:51 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z13sm653162oth.10.2020.04.29.13.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:58:50 -0700 (PDT) From: Rob Herring To: Linus Walleij , Liviu Dudau , Lorenzo Pieralisi , Sudeep Holla Cc: Kevin Brodsky , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , Lee Jones , Sebastian Reichel , Stephen Boyd , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 16/16] ARM: vexpress: Don't select VEXPRESS_CONFIG Date: Wed, 29 Apr 2020 15:58:25 -0500 Message-Id: <20200429205825.10604-17-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429205825.10604-1-robh@kernel.org> References: <20200429205825.10604-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org CONFIG_VEXPRESS_CONFIG has 'default y if ARCH_VEXPRESS', so selecting is unnecessary. Selecting it also prevents setting CONFIG_VEXPRESS_CONFIG to a module. Cc: Sudeep Holla Cc: Lorenzo Pieralisi Cc: Linus Walleij Acked-by: Liviu Dudau Signed-off-by: Rob Herring --- arch/arm/mach-vexpress/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig index 065e12991663..8391a5b3cd78 100644 --- a/arch/arm/mach-vexpress/Kconfig +++ b/arch/arm/mach-vexpress/Kconfig @@ -19,7 +19,6 @@ menuconfig ARCH_VEXPRESS select POWER_SUPPLY select REGULATOR if MMC_ARMMMCI select REGULATOR_FIXED_VOLTAGE if REGULATOR - select VEXPRESS_CONFIG help This option enables support for systems using Cortex processor based ARM core and logic (FPGA) tiles on the Versatile Express motherboard,