From patchwork Fri Sep 4 06:57:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "bhupesh.sharma@freescale.com" X-Patchwork-Id: 7120161 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 85DABBEEC1 for ; Fri, 4 Sep 2015 07:01:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7663E2089E for ; Fri, 4 Sep 2015 07:01:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 586FE20859 for ; Fri, 4 Sep 2015 07:01:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXkyh-0002Tg-N1; Fri, 04 Sep 2015 07:00:03 +0000 Received: from mail-by2on0136.outbound.protection.outlook.com ([207.46.100.136] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXkyG-0001x9-0J for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2015 06:59:37 +0000 Received: from CO2PR03CA0017.namprd03.prod.outlook.com (10.141.194.144) by BY1PR03MB1481.namprd03.prod.outlook.com (10.162.210.14) with Microsoft SMTP Server (TLS) id 15.1.262.15; Fri, 4 Sep 2015 06:59:13 +0000 Received: from BY2FFO11FD038.protection.gbl (2a01:111:f400:7c0c::110) by CO2PR03CA0017.outlook.office365.com (2a01:111:e400:1414::16) with Microsoft SMTP Server (TLS) id 15.1.268.10 via Frontend Transport; Fri, 4 Sep 2015 06:59:13 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD038.mail.protection.outlook.com (10.1.14.223) with Microsoft SMTP Server (TLS) id 15.1.262.18 via Frontend Transport; Fri, 4 Sep 2015 06:59:13 +0000 Received: from localhost.localdomain ([10.214.249.74]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t846w36H028644; Thu, 3 Sep 2015 23:59:09 -0700 From: Bhupesh Sharma To: , , , , Subject: [PATCH v2 06/10] clk: qoriq: Add ls2080a support. Date: Fri, 4 Sep 2015 12:27:48 +0530 Message-ID: <1441349872-4560-7-git-send-email-bhupesh.sharma@freescale.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1441349872-4560-1-git-send-email-bhupesh.sharma@freescale.com> References: <1441349872-4560-1-git-send-email-bhupesh.sharma@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD038; 1:noPa6ZolIMHuGXIHppxkd7CuNxcvr7HnEjcQJsj+3Bsn0Et8nHWkYAASsCCrmKQl6jAdFlKAPYcxY7y++KIQ8scaZ3yYk2MgRIa55+Bb2iR2vgMzfd0D5eWy4Q06Wp2aSIZAQvmvfTl0I/4igEDxoHlQ+ZX2OZzaFMOpxC4wcYfj1+YegSSvjHy9yg9RhwESkw55HZw9RrQOhhk+1Gj1sEMkqSaUkhrj6pO91ZDIN0H+Q/ipGcntPJfRJ8toQDl6pkfDCtk4hhKDkqIGsOenbTIwppNhFJjIgmgS66kwAUZEFADq4IkZC828RCWcnAFJ4JW9ErN1m2NBCMGvYFC1t274FehQUQ6G2WfJMGk4V+S/NlOJ4ZsHNTYmPSL6UAShM+AABwtomo+4sk+VxmyleQ== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1109001)(339900001)(189002)(199003)(85426001)(5003940100001)(46102003)(19580405001)(49486002)(48376002)(5001960100002)(2201001)(87936001)(50466002)(97736004)(6806004)(19580395003)(50986999)(50226001)(76176999)(104016003)(86362001)(62966003)(68736005)(92566002)(4001540100001)(81156007)(47776003)(33646002)(5007970100001)(5001770100001)(106466001)(64706001)(77096005)(2950100001)(107886002)(229853001)(5001860100001)(5001830100001)(77156002)(36756003)(189998001)(105606002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR03MB1481; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1481; 2:d4ayCBlPyvGYVZwZ3WVGWEMoInJ7B09VZoqtjcOMqUzwUuwAK5l/SOE+GL2LZcUqjoG8lpzqlXBY7h5tHTend05TnFDJ6eAFbA9JHnwIbql40ItdW1vhi5lCLy8UeHo7HXIkCt4tNDiCKrpv9NQJSBE20gjuBdEgQFY75MsS690=; 3:HPEb1jujTna3zYSSqKD1WCwrpUI5ImDHDUu5ceB2Omoic/FS5SV8cBijlOEUypBUsoUaeu9ljqM3g9kL/LHKCm89lWqi7rBrN4SEy2RZuJaopYcvYrDS2pvZdzvXHZmTZ9Lnwt5omey3uqhgg9q4QrtdVTOGT7idyEjBoEjidHMumwlDpwJj9P/dPzd7/fZFAeBBcmRDCju68ZOXqsHqnuF2rDyMFI6FdnWLFwvzL00=; 25:8PJRW1XHc7rAR1InUodny3sSg8kiQjPTdYZH2V25s8bzV900XvqMywOcdki3TfEHsHEkih9TXSOEIDTj3J1m91BrP4l8vZ3aRwXaCfS6oCjsMCgLA2nh0oPdbpcaCu4v9FjRazPBM3XeYiC5E7p6MasQbpbXzOAPUDKp/U0vHxJh7Hfq5RoChRCwc0+QJtLcaiA332fLY8CI/A8cWkcApGV9HpZcJ5fP9hDlyOHVNPnkUPh7bCeFh7VwJKfGo2xB74HAaCeONFUzCjuzEWeg4Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1481; X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1481; 20:2B8TwAjfHcOcgnjWWYxADJEdV0wrTr3+MXwVif0VE6RQoLwOcJJ9bHYTPHLTqyGxQtRT2VnF3KOop3L/xO93zTNrQ+3+DosoIjfuSW0Lhd1Iri+LnnloVz0uoiNgsRddm8q+VpoYbkyT8bN0rAkqp65WmmZjQPQGZZWpOdx42vUrgXxFmS7vhBk4VsAgM4Q7nqxMf9A5K/OBrytRdvtMCZA6hIb6wMG6399NCgpBBIGdths5FEOzAYronpC0o80m9jsJDnjcsGjQQlQyzlIE4J6mq7ppulM1N5oD7aoWMIznjp8qPOYWSlRbUKdGWgMIHsaWseBOwIyn2m6mxARuOvaoF4Rkhq0YyQiV8LGn/gk=; 4:fYr35+kVmS28kIw+RLKZlVTTc0zdJOrMdT6DCT6JAqVrS6nY73q7HdTlXbM5olQ5XzxL5DoZFCRX9J3ddxM0mQVA0ovNrwQmZhJnpnn8kX4DjZR7Uz3lAl7VIDJtHCSP3UOxkFTKtEIxpodfFsdO8GN+R20q4gqI59xH4Na/fa10A+2DAI1qn3jaZCNY2iAc2qbfxjeLLLji26iflEsoXFRyzVxZiUu34c49UOUvscFj25oumjWH+aK4vWFL7pGepC/26BioNo570C2hgf1S7pqe7QAQa8snsdA/OfVUFrCMJwb0UIVws2CpTm3G7vNV X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(8121501046)(5005006)(3002001); SRVR:BY1PR03MB1481; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1481; X-Forefront-PRVS: 06891E23FB X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR03MB1481; 23:U6WQmDbauLyfKpLqYwWc4k2dCMK4zxGUytwGinWha?= =?us-ascii?Q?sEbe7ZmHm314Mk3lMyreTjeeTFQsBF6ftgKVn3yxDBczWvp9WVVs+xGA0ohJ?= =?us-ascii?Q?TFcYg1sYqX5XQvVBjGROIH0zllye680Quj92YEj0wGrogqeK7fy6w9HUiZR8?= =?us-ascii?Q?ld8RA+PnE3uE3s2FRgJpIz9Hv7oTgNj3AKcf7QEwPSSHzZZpmpmYW10EQ0LW?= =?us-ascii?Q?bFk3ga/g7YKSNB65WkXkReEl8NEEnfn1LjhrTPhX+C50bKBQaNaJ+lqrLIar?= =?us-ascii?Q?jxYnDzQQcpancMKMvUL2NDSO3ZIuv10mogbW/CbD1xhL81rxfypW0MZCwRxh?= =?us-ascii?Q?liPcNc9zWSR/Ce6JguDVRHtLIzUoQBre0g2ajDKSRjCTIg2ZnZe6utC59wVP?= =?us-ascii?Q?xU3bgcR1VOD8sRMZVGhcdh3ElzZlj9TfVyef+a0DyotczWDnxfLuLgKaebjs?= =?us-ascii?Q?lGcqBr5Un1qwu6jaG1et/EjVAXwH+1gR/NXDDZgQAN05uanWHBqRCyS2JZQA?= =?us-ascii?Q?WE+JwvtlBM4W5Gg9yhi/MGXFXVwHg8fYCEiQt1Nm1F8N71TgKno6ZO+MMvWj?= =?us-ascii?Q?vQjgrGCm6Lh0KvsRU7gZKQZlb0gwyd89dOe9WdVgvo+SavDSFBh4lsZ0DP0/?= =?us-ascii?Q?ig2oBw8LT2VFsCz6NrfPjvS6CFeyXN42UlwLs+C9zBybcepW/AJ2BC/VzET6?= =?us-ascii?Q?Mz3tuK7KgPnmnBvajBZtgXmo2ua+rxuBvH+dSaaJwzwqY2maHAURGcTBDnat?= =?us-ascii?Q?Ojo+JbvkASQtJjL3JOHjwkC1bwMl54NLMQapBeTEVbUPECpVUYMXksM1uSIS?= =?us-ascii?Q?syor7QZ69WXx1EZR0abRzeWIjvKDoBEfAsj9faAZjPivJGJGqIXu+b6ztJRp?= =?us-ascii?Q?cezOh7mMTktMd9gx8ABMGHRFlp1qdd/fhIZ+3KoCrxIeRrh1uRD5Uw0u66fu?= =?us-ascii?Q?Vu6+sFit5AbpMwn94YfNzHqKv5iVJcnxk+jngh4pSaSxjSZjOF0Gl6NJzAC2?= =?us-ascii?Q?oGD23JhGbicUriJR/Rd3tVdH2Ed2PWi95ZAYH8YBtakMka8mKqQJjx7VuxuK?= =?us-ascii?Q?nIAvj9rH05aXZOPKE+bnUH5Q7xywOaYQIe8ELrLdq/5KK3KVfEqQgRoo8J6U?= =?us-ascii?Q?GamhWvmupwnH5RCu2RMdy3G2opxmGLahpvBu9cwjcGEHaWwKNsOgOzlQq+ER?= =?us-ascii?Q?NaeemsWnTzj6jhoAUclYzwXKdMt7KzE/y9MHhTIrZQ+Wbvr72pxBxp5xysex?= =?us-ascii?Q?TTF2BFg16vPQES92W4=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1481; 5:1W2u/ECjq8cMYuIemnM1yB87o2L3f6zr5/P7re4cHS4dt2s7nldweTk6dB+hLuYQmYIA4h3zlcFkGVi4QTp+0wapMUNnjmQ2IYY3vsN2tWPbV6CoCjtLFsCtKBw4DJcSRBxT1Ylw8IZ//ReZvKtdtA==; 24:s4SsSUVGY4wqRKM1YrD+ck1A5CFE55HKYsGZf2L+Y9oIVp5og0CEUJLRibFI9XitGVeUMLQIx5w3irFA3FqMAH6MT6T/7hhqUYNzdmtJtLA=; 20:XzesR4DOEj/TyWIwdDcfmrZolAF9xl+mIqCTzcoszjqpgbolw2/44W0ce0Ryu50GJFsbv8fJ7fEsSj19au98nQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2015 06:59:13.3270 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1481 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150903_235936_173062_64D31C78 X-CRM114-Status: GOOD ( 24.67 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bhupesh.sharma@freescale.com, Catalin.Marinas@arm.com, will.deacon@arm.com, Scott Wood , olof@lixom.net, bhupesh.linux@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Scott Wood LS2080A is the first implementation of the chassis 3 clockgen, which has a different register layout than previous chips. It is also little endian, unlike previous chips. Signed-off-by: Scott Wood --- drivers/clk/Kconfig | 2 +- drivers/clk/clk-qoriq.c | 78 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 42f7120..9f1970c 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -121,7 +121,7 @@ config COMMON_CLK_AXI_CLKGEN config CLK_QORIQ bool "Clock driver for Freescale QorIQ platforms" - depends on (PPC_E500MC || ARM) && OF + depends on (PPC_E500MC || ARM || ARM64) && OF ---help--- This adds the clock driver support for Freescale QorIQ platforms using common clock framework. diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index d9e4402..bae82ac 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -68,7 +68,10 @@ struct clockgen; * If not set, cmux freq must be >= platform pll/2 */ #define CG_CMUX_GE_PLAT 1 + #define CG_PLL_8BIT 2 /* PLLCnGSR[CFG] is 8 bits, not 6 */ +#define CG_VER3 4 /* version 3 cg: reg layout different */ +#define CG_LITTLE_ENDIAN 8 struct clockgen_chipinfo { const char *compat, *guts_compat; @@ -94,6 +97,26 @@ struct clockgen { static struct clockgen clockgen; +static void cg_out(struct clockgen *cg, u32 val, u32 __iomem *reg) +{ + if (cg->info.flags & CG_LITTLE_ENDIAN) + iowrite32(val, reg); + else + iowrite32be(val, reg); +} + +static u32 cg_in(struct clockgen *cg, u32 __iomem *reg) +{ + u32 val; + + if (cg->info.flags & CG_LITTLE_ENDIAN) + val = ioread32(reg); + else + val = ioread32be(reg); + + return val; +} + static const struct clockgen_muxinfo p2041_cmux_grp1 = { { [0] = { CLKSEL_VALID, CGA_PLL1, PLL_DIV1 }, @@ -429,6 +452,17 @@ static const struct clockgen_chipinfo chipinfo[] = { .pll_mask = 0x03, }, { + .compat = "fsl,ls2080a-clockgen", + .cmux_groups = { + &clockgen2_cmux_cga12, &clockgen2_cmux_cgb + }, + .cmux_to_group = { + 0, 0, 1, 1, -1 + }, + .pll_mask = 0x37, + .flags = CG_VER3 | CG_LITTLE_ENDIAN, + }, + { .compat = "fsl,p2041-clockgen", .guts_compat = "fsl,qoriq-device-config-1.0", .init_periph = p2041_init_periph, @@ -575,7 +609,7 @@ static int mux_set_parent(struct clk_hw *hw, u8 idx) return -EINVAL; clksel = hwc->parent_to_clksel[idx]; - iowrite32be((clksel << CLKSEL_SHIFT) & CLKSEL_MASK, hwc->reg); + cg_out(hwc->cg, (clksel << CLKSEL_SHIFT) & CLKSEL_MASK, hwc->reg); return 0; } @@ -586,7 +620,7 @@ static u8 mux_get_parent(struct clk_hw *hw) u32 clksel; s8 ret; - clksel = (ioread32be(hwc->reg) & CLKSEL_MASK) >> CLKSEL_SHIFT; + clksel = (cg_in(hwc->cg, hwc->reg) & CLKSEL_MASK) >> CLKSEL_SHIFT; ret = hwc->clksel_to_parent[clksel]; if (ret < 0) { @@ -694,6 +728,7 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx) if (!hwc) return NULL; + hwc->cg = cg; hwc->reg = cg->regs + 0x20 * idx; hwc->info = cg->info.cmux_groups[cg->info.cmux_to_group[idx]]; @@ -704,7 +739,7 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx) * default clksel) may be inappropriately excluded on certain * chips. */ - clksel = (ioread32be(hwc->reg) & CLKSEL_MASK) >> CLKSEL_SHIFT; + clksel = (cg_in(cg, hwc->reg) & CLKSEL_MASK) >> CLKSEL_SHIFT; div = get_pll_div(cg, hwc, clksel); if (!div) return NULL; @@ -873,13 +908,36 @@ static void __init create_one_pll(struct clockgen *cg, int idx) if (!(cg->info.pll_mask & (1 << idx))) return; - if (idx == PLATFORM_PLL) - reg = cg->regs + 0xc00; - else - reg = cg->regs + 0x800 + 0x20 * (idx - 1); + if (cg->info.flags & CG_VER3) { + switch (idx) { + case PLATFORM_PLL: + reg = cg->regs + 0x60080; + break; + case CGA_PLL1: + reg = cg->regs + 0x80; + break; + case CGA_PLL2: + reg = cg->regs + 0xa0; + break; + case CGB_PLL1: + reg = cg->regs + 0x10080; + break; + case CGB_PLL2: + reg = cg->regs + 0x100a0; + break; + default: + WARN_ONCE(1, "index %d\n", idx); + return; + } + } else { + if (idx == PLATFORM_PLL) + reg = cg->regs + 0xc00; + else + reg = cg->regs + 0x800 + 0x20 * (idx - 1); + } /* Get the multiple of PLL */ - mult = ioread32be(reg); + mult = cg_in(cg, reg); /* Check if this PLL is disabled */ if (mult & PLL_KILL) { @@ -887,7 +945,8 @@ static void __init create_one_pll(struct clockgen *cg, int idx) return; } - if ((cg->info.flags & CG_PLL_8BIT) && idx != PLATFORM_PLL) + if ((cg->info.flags & CG_VER3) || + ((cg->info.flags & CG_PLL_8BIT) && idx != PLATFORM_PLL)) mult = (mult & GENMASK(8, 1)) >> 1; else mult = (mult & GENMASK(6, 1)) >> 1; @@ -1168,6 +1227,7 @@ err: CLK_OF_DECLARE(qoriq_clockgen_1, "fsl,qoriq-clockgen-1.0", clockgen_init); CLK_OF_DECLARE(qoriq_clockgen_2, "fsl,qoriq-clockgen-2.0", clockgen_init); CLK_OF_DECLARE(qoriq_clockgen_ls1021a, "fsl,ls1021a-clockgen", clockgen_init); +CLK_OF_DECLARE(qoriq_clockgen_ls2080a, "fsl,ls2080a-clockgen", clockgen_init); /* Legacy nodes */ CLK_OF_DECLARE(qoriq_sysclk_1, "fsl,qoriq-sysclk-1.0", sysclk_init);