Received: by 10.213.65.68 with SMTP id h4csp3880249imn; Tue, 10 Apr 2018 06:09:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/XQiNmH79NQPNuo21jkR0pPKXjr91RqyqD9LX1lqmJ/1hzaeOvH+xSTl3n88wFu7caxNJk X-Received: by 2002:a17:902:a985:: with SMTP id bh5-v6mr414160plb.0.1523365762533; Tue, 10 Apr 2018 06:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523365762; cv=none; d=google.com; s=arc-20160816; b=mZITzIQKX+I1TS9yjtnSj4pJTzfAV0bHE3mUvzmIuo5uI6Hm5LAZFPxX7WxLqoF09O FLPTPHv4HRmbl4zhTK2REyysDRsc1aN0TtjoLwzrMe/52PHT9FSMLLt+Fmb9m8rvQUMq 2PVgvfYiZ5ywT4hv43K6Cnyx7QNGjHz4CsjUfhZiqiH/WVAbiIAquZAWk++0WfZawX1L LAO2S67wwBq+2l6dIuqFGHRqamb9c+KMWZaz5op+aLUAvEbq9r+mlCEFDlnPulcyh8VN AHVHqBmg3caOOyM1DdKf8bjjNhfNbgQWKbC6EmClOGvPMmWqyLKtQd+jSAm1lZOzPt8w gdsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=uB/EoJtFb+d5jrx0cc9Z1z9G+b2YUwj0Dcw/Gq95bF0=; b=xJdDl2+0i5Mj8R7+z3wQa3h3ewRD3Ljp8DIXW5EHRXvdw77DfCc4ZvIuciiBmsf9Cj d3kVAgJIt3b4U05ixZm5aqNr1wx4d6BeknxyNXYe3/GLzTzQECOMRWlBjGnuzcGiyHTP TKErCIL4VTpi1Fiv+LmpWr92DPxaWFJtF8wlpiZw5hmwvjwYo/7emkodBDA4I0JigwV+ n1k87LkA6FkMOfn5DwzzH/klmEyg6ktp0AdMApQ6u0w70yUxzzaC7qepgMF/xXF3Np+h 1CehuMiu4e88UgNoIJY4bnXZO55K/wLkrTjWPN1XRPIai0NSamqyEvoD9mRTFzvu7T/o jvPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7-v6si2823308plk.380.2018.04.10.06.08.45; Tue, 10 Apr 2018 06:09:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753781AbeDJNFK (ORCPT + 99 others); Tue, 10 Apr 2018 09:05:10 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:45480 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753540AbeDJNFH (ORCPT ); Tue, 10 Apr 2018 09:05:07 -0400 Received: from ayla.of.borg ([84.194.111.163]) by baptiste.telenet-ops.be with bizsmtp id Yd551x0393XaVaC01d55E4; Tue, 10 Apr 2018 15:05:06 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1f5sxN-00059m-Lp; Tue, 10 Apr 2018 15:05:05 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1f5sxN-0004Ne-KH; Tue, 10 Apr 2018 15:05:05 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd , Biju Das Cc: linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] clk: renesas: rcar-gen2: Centralize quirks handling Date: Tue, 10 Apr 2018 15:04:58 +0200 Message-Id: <1523365498-16789-1-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce centralized quirks handling like on R-Car Gen3, and convert the RZ/G1C SD clock table handling over to it. This makes it easier to add more quirks later, if/when needed. Signed-off-by: Geert Uytterhoeven --- To be queued in clk-renesas-for-v4.18. drivers/clk/renesas/rcar-gen2-cpg.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/clk/renesas/rcar-gen2-cpg.c b/drivers/clk/renesas/rcar-gen2-cpg.c index 0c49f59d5074b1c4..daf88bc2cdae177b 100644 --- a/drivers/clk/renesas/rcar-gen2-cpg.c +++ b/drivers/clk/renesas/rcar-gen2-cpg.c @@ -261,9 +261,15 @@ static const struct clk_div_table cpg_sd01_div_table[] = { static const struct rcar_gen2_cpg_pll_config *cpg_pll_config __initdata; static unsigned int cpg_pll0_div __initdata; static u32 cpg_mode __initdata; +static u32 cpg_quirks __initdata; -static const struct soc_device_attribute soc_r8a77470[] = { - { .soc_id = "r8a77470" }, +#define SD_SKIP_FIRST BIT(0) /* Skip first clock in SD table */ + +static const struct soc_device_attribute cpg_quirks_match[] __initconst = { + { + .soc_id = "r8a77470", + .data = (void *)SD_SKIP_FIRST, + }, { /* sentinel */ } }; @@ -333,7 +339,7 @@ struct clk * __init rcar_gen2_cpg_clk_register(struct device *dev, case CLK_TYPE_GEN2_SD0: table = cpg_sd01_div_table; - if (soc_device_match(soc_r8a77470)) + if (cpg_quirks & SD_SKIP_FIRST) table++; shift = 4; @@ -341,7 +347,7 @@ struct clk * __init rcar_gen2_cpg_clk_register(struct device *dev, case CLK_TYPE_GEN2_SD1: table = cpg_sd01_div_table; - if (soc_device_match(soc_r8a77470)) + if (cpg_quirks & SD_SKIP_FIRST) table++; shift = 0; @@ -372,9 +378,15 @@ struct clk * __init rcar_gen2_cpg_clk_register(struct device *dev, int __init rcar_gen2_cpg_init(const struct rcar_gen2_cpg_pll_config *config, unsigned int pll0_div, u32 mode) { + const struct soc_device_attribute *attr; + cpg_pll_config = config; cpg_pll0_div = pll0_div; cpg_mode = mode; + attr = soc_device_match(cpg_quirks_match); + if (attr) + cpg_quirks = (uintptr_t)attr->data; + pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks); spin_lock_init(&cpg_lock); -- 2.7.4