From patchwork Tue May 26 17:09:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagar Shrikant Kadam X-Patchwork-Id: 1298222 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=selector1 header.b=Svsr1feS; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49WgS91F9Tz9sRK for ; Wed, 27 May 2020 03:09:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F09E81865; Tue, 26 May 2020 19:09:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.b="Svsr1feS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 852A681865; Tue, 26 May 2020 19:09:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20618.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::618]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DB87681583 for ; Tue, 26 May 2020 19:09:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sagar.kadam@sifive.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nt7oXM/NyuKbubWrmrHgL4qA/wm5y8aA7UgbTIFi5h2NpfGN/YAWAAt76hyLHNW6Of+gxz8YEg5xz6yIEKnVYS+nGwUXVFto8ZQXNoElYUAgQZorBQ0zLAj8Up9+oRSdeaxaBRuz6ocf1DLiaG5jYD7Rxh9LMPYBNsoJTRobmzJZAjAQZhq5Gr8mKb2CxBmJWUW+93ZuwonRFWF47f850cMtgYacbLOQP4GG82bv6oh/IKgX6fWAwVlkU0VVEACkRaABc/M0V7VPtX7N0iEngZlBkpxmi5NJYA0fNZEVXWwvAeyonFbq81fbI9dSFATVAUnc0aFNRIbRJ5TWRBdWTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lBd+DfZPj87UlQuWzwL+wjI7DuttEFxbKGsMacUnGvE=; b=bWfUu8Gm/Mm0RdUuilIHYub0T6ScLX6DvvvoslZw7T0NU/knq8Ph2z3Un2bJQFKUtihIuGPcBKMRmpQ71ipP47gIxJ2wc2xlz868gg2frGZIdeN/ey5X458oD96Zs+a2sBu6xcDQLLv3OIfy9nW3GZ0eJg+ZK+aCSP3LYK+/tABEXXlnzVo3TxnjlfK8LucdTUkrrcsG38XbvoReeBBflAMtuUI8/zWMm2+MIaO56OXnLK/1SOpZRFPKFH9s/rpBqlpRJ2KjGj25/0d/ximXB6Y6YtXmlTbBseFJCrEBKrKO1sXaBGLFYM126kfoTBixhLPqi/jK1zdqxfVhapVGww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sifive.com; dmarc=pass action=none header.from=sifive.com; dkim=pass header.d=sifive.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lBd+DfZPj87UlQuWzwL+wjI7DuttEFxbKGsMacUnGvE=; b=Svsr1feSJRA/v5S4KiVRIMH1oXOdOiaOUSoA+IH7FKMifvXdxV0+aK93tWw0lobkEKR59vDAjY5HcOLYPAvjWGhk/r8CBXxooszlrQeWxwyPqFHIi/5lq/tqYcL6SQWsF/gvLgxE0Q9nEaZcZcR5TWrbF3VZrvIpFGW/YR5gz6g= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=sifive.com; Received: from BN8PR13MB2611.namprd13.prod.outlook.com (2603:10b6:408:81::17) by BN8PR13MB2897.namprd13.prod.outlook.com (2603:10b6:408:8a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.15; Tue, 26 May 2020 17:09:26 +0000 Received: from BN8PR13MB2611.namprd13.prod.outlook.com ([fe80::c1d9:f4ee:80ab:de83]) by BN8PR13MB2611.namprd13.prod.outlook.com ([fe80::c1d9:f4ee:80ab:de83%6]) with mapi id 15.20.3045.014; Tue, 26 May 2020 17:09:26 +0000 From: Sagar Shrikant Kadam To: u-boot@lists.denx.de, rick@andestech.com, lukma@denx.de Cc: jagan@amarulasolutions.com, bmeng.cn@gmail.com, pragnesh.patel@sifive.com, seanga2@gmail.com, Sagar Shrikant Kadam Subject: [PATCH v2 1/4] fu540: prci: add request and free clock handlers Date: Tue, 26 May 2020 10:09:08 -0700 Message-Id: <1590512951-1045-2-git-send-email-sagar.kadam@sifive.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1590512951-1045-1-git-send-email-sagar.kadam@sifive.com> References: <1590512951-1045-1-git-send-email-sagar.kadam@sifive.com> X-ClientProxiedBy: BYAPR01CA0054.prod.exchangelabs.com (2603:10b6:a03:94::31) To BN8PR13MB2611.namprd13.prod.outlook.com (2603:10b6:408:81::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from gamma07.internal.sifive.com (64.62.193.194) by BYAPR01CA0054.prod.exchangelabs.com (2603:10b6:a03:94::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3021.23 via Frontend Transport; Tue, 26 May 2020 17:09:25 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [64.62.193.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1480648e-1979-41a0-8a4c-08d801978b16 X-MS-TrafficTypeDiagnostic: BN8PR13MB2897: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:198; X-Forefront-PRVS: 041517DFAB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z5djYhbfYZaGkisfw+x7RxXc6ODnSyi9pFQU1Uoe5c4vk2JUbcQ1TZaCeheOwG2738TI76Ed+goxaq7IuAwHszk0KrB3TP9HO0pTnlL7gx9NhWUV33f8U06uUTMu2PgmkrUrxR9t730RlAJoeSH/eJmKfKzeu+NbfqkD/l5GXT0DIxfA7irRzYPywSCflfat+/QwEFpi3eQv/lz4E4EYq5iEbJjhkQcRht1RKLhIOv3VhdZ1coTavW6feiDcBS4gh00NjbcURg4xfecBEKLaeabQeE3FPjrdGo69SazzMjMr8rYwabrXXXoMoh6lVHUzc411P1Zm2xQSJpxvUGQCeg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR13MB2611.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(366004)(346002)(376002)(136003)(396003)(39840400004)(8936002)(8676002)(36756003)(2616005)(66556008)(6666004)(86362001)(66476007)(956004)(52116002)(26005)(186003)(7696005)(16526019)(66946007)(6486002)(107886003)(316002)(4326008)(2906002)(478600001)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WdnrjVLtOL+TQvrzviw3a+Gqicfd4HNjTP2u0bjo7oVOQbzmP7L3RPalYjIi8N/w6870njh6BqhzimhLxAl5esqiBtZUp+ojL0lxKotOW4MdfvSEsbyzKO6OPXE0mKUjMNufCtXsOQh6QiTqkcy7pWo/5cqRVf1wg57n5zGibjsl/zQtsihLhA12mn+wpoJKyAGKK2dNAPxRo/hbGgyG0cwvyAMga4EAlu7mG45O5BgIVeRm9akIy6sG1clgby93YuRpJPxkCVqJFeuenpVijj0z7I/EwLqQ6Adh1t5I3dHe+cZhGdavnhjoKvbalEanzFTqpzN1WdZsgjsV2LR6fkYfxkQrw0eFCLQqSsjcg6MoRTAKfr7jcKyZg/aXIXiX+x44lG2ocnIk/KQK/z24Mnj4Aso1tZbIs21JE36YchM44ufm0T+a3M5EFfptaVndcMg6bmxUl1zYXUH9xVMcPv/DJmHC6MzE5gXssezpqNk= X-OriginatorOrg: sifive.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1480648e-1979-41a0-8a4c-08d801978b16 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 May 2020 17:09:26.1363 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 22f88e9d-ae0d-4ed9-b984-cdc9be1529f1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2fpeFb2wbLm9Tb/qzqZrWP1IgMqMEdiWzGPpd1qqdWKBGd30/XmJJ/pGjQIO6+wrs7nfNvfsCxvMRxXmejwDnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR13MB2897 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Add clk_request handler to check if a valid clock is requested, Here clk_free handler is added for debug purpose which will display details of clock passed to clk_free. Signed-off-by: Sagar Shrikant Kadam Reviewed-by: Pragnesh Patel --- drivers/clk/sifive/fu540-prci.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c index 67e21b6..bf50ea2 100644 --- a/drivers/clk/sifive/fu540-prci.c +++ b/drivers/clk/sifive/fu540-prci.c @@ -581,6 +581,25 @@ static ulong sifive_fu540_prci_set_rate(struct clk *clk, ulong rate) return rate; } +static int sifive_fu540_prci_clk_request(struct clk *clk) +{ + debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev, + clk->id); + + if (clk->id >= ARRAY_SIZE(__prci_init_clocks)) + return -EINVAL; + + return 0; +} + +static int sifive_fu540_prci_clk_free(struct clk *clk) +{ + debug("%s(clk=%p) (dev=%p, id=%lu)\n", __func__, clk, clk->dev, + clk->id); + + return 0; +} + static int sifive_fu540_prci_probe(struct udevice *dev) { int i, err; @@ -612,6 +631,8 @@ static int sifive_fu540_prci_probe(struct udevice *dev) static struct clk_ops sifive_fu540_prci_ops = { .set_rate = sifive_fu540_prci_set_rate, .get_rate = sifive_fu540_prci_get_rate, + .request = sifive_fu540_prci_clk_request, + .rfree = sifive_fu540_prci_clk_free, }; static const struct udevice_id sifive_fu540_prci_ids[] = {