[{"id":1774398,"web_url":"http://patchwork.ozlabs.org/comment/1774398/","msgid":"<1506310811.30138.15.camel@aj.id.au>","list_archive_url":null,"date":"2017-09-25T03:40:11","subject":"Re: [PATCH v2 1/5] clk: Add clock driver for ASPEED BMC SoCs","submitter":{"id":68332,"url":"http://patchwork.ozlabs.org/api/people/68332/","name":"Andrew Jeffery","email":"andrew@aj.id.au"},"content":"On Thu, 2017-09-21 at 13:56 +0930, Joel Stanley wrote:\n> This adds the stub of a driver for the ASPEED SoCs. The clocks are\n> defined and the static registration is set up.\n> \n> Signed-off-by: Joel Stanley <joel@jms.id.au>\n> ---\n>  drivers/clk/Kconfig                      |  12 +++\n>  drivers/clk/Makefile                     |   1 +\n>  drivers/clk/clk-aspeed.c                 | 162 +++++++++++++++++++++++++++++++\n>  include/dt-bindings/clock/aspeed-clock.h |  43 ++++++++\n>  4 files changed, 218 insertions(+)\n>  create mode 100644 drivers/clk/clk-aspeed.c\n>  create mode 100644 include/dt-bindings/clock/aspeed-clock.h\n> \n> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig\n> index 1c4e1aa6767e..9abe063ef8d2 100644\n> --- a/drivers/clk/Kconfig\n> +++ b/drivers/clk/Kconfig\n> @@ -142,6 +142,18 @@ config COMMON_CLK_GEMINI\n>  \t  This driver supports the SoC clocks on the Cortina Systems Gemini\n>  \t  platform, also known as SL3516 or CS3516.\n>  \n> +config COMMON_CLK_ASPEED\n> +\tbool \"Clock driver for Aspeed BMC SoCs\"\n> +\tdepends on ARCH_ASPEED || COMPILE_TEST\n> +\tdefault ARCH_ASPEED\n> +\tselect MFD_SYSCON\n> +\tselect RESET_CONTROLLER\n> +\t---help---\n> +\t  This driver supports the SoC clocks on the Aspeed BMC platforms.\n>\n> +\t  The G4 and G5 series, including the ast2400 and ast2500, are supported\n> +\t  by this driver.\n> +\n>  config COMMON_CLK_S2MPS11\n>  \ttristate \"Clock driver for S2MPS1X/S5M8767 MFD\"\n>  \tdepends on MFD_SEC_CORE || COMPILE_TEST\n> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile\n> index c99f363826f0..575c68919d9b 100644\n> --- a/drivers/clk/Makefile\n> +++ b/drivers/clk/Makefile\n> @@ -26,6 +26,7 @@ obj-$(CONFIG_ARCH_CLPS711X)\t\t+= clk-clps711x.o\n>  obj-$(CONFIG_COMMON_CLK_CS2000_CP)\t+= clk-cs2000-cp.o\n>  obj-$(CONFIG_ARCH_EFM32)\t\t+= clk-efm32gg.o\n>  obj-$(CONFIG_COMMON_CLK_GEMINI)\t\t+= clk-gemini.o\n> +obj-$(CONFIG_COMMON_CLK_ASPEED)\t\t+= clk-aspeed.o\n>  obj-$(CONFIG_ARCH_HIGHBANK)\t\t+= clk-highbank.o\n>  obj-$(CONFIG_CLK_HSDK)\t\t\t+= clk-hsdk-pll.o\n>  obj-$(CONFIG_COMMON_CLK_MAX77686)\t+= clk-max77686.o\n> diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c\n> new file mode 100644\n> index 000000000000..824c54767009\n> --- /dev/null\n> +++ b/drivers/clk/clk-aspeed.c\n> @@ -0,0 +1,162 @@\n> +/*\n> + * Copyright 2017 IBM Corporation\n> + *\n> + * Joel Stanley <joel@jms.id.au>\n> + *\n> + * This program is free software; you can redistribute it and/or\n> + * modify it under the terms of the GNU General Public License\n> + * as published by the Free Software Foundation; either version\n> + * 2 of the License, or (at your option) any later version.\n> + */\n> +\n> +#define pr_fmt(fmt) \"clk-aspeed: \" fmt\n> +\n> +#include <linux/slab.h>\n> +#include <linux/of_address.h>\n> +#include <linux/clk-provider.h>\n> +#include <linux/regmap.h>\n> +#include <linux/spinlock.h>\n> +#include <linux/mfd/syscon.h>\n> +\n> +#include <dt-bindings/clock/aspeed-clock.h>\n> +\n> +#define ASPEED_RESET_CTRL\t0x04\n> +#define ASPEED_CLK_SELECTION\t0x08\n> +#define ASPEED_CLK_STOP_CTRL\t0x0c\n> +#define ASPEED_MPLL_PARAM\t0x20\n> +#define ASPEED_HPLL_PARAM\t0x24\n> +#define ASPEED_MISC_CTRL\t0x2c\n> +#define ASPEED_STRAP\t\t0x70\n> +\n> +/* Keeps track of all clocks */\n> +static struct clk_hw_onecell_data *aspeed_clk_data;\n> +\n> +static void __iomem *scu_base;\n> +\n> +/**\n> + * struct aspeed_gate_data - Aspeed gated clocks\n> + * @clock_idx: bit used to gate this clock in the clock register\n> + * @reset_idx: bit used to reset this IP in the reset register. -1 if no\n> + *             reset is required when enabling the clock\n> + * @name: the clock name\n> + * @parent_name: the name of the parent clock\n> + * @flags: standard clock framework flags\n> + */\n> +struct aspeed_gate_data {\n> +\tu8\t\tclock_idx;\n> +\ts8\t\treset_idx;\n> +\tconst char\t*name;\n> +\tconst char\t*parent_name;\n> +\tunsigned long\tflags;\n> +};\n> +\n> +/**\n> + * struct aspeed_clk_gate - Aspeed specific clk_gate structure\n> + * @hw:\t\thandle between common and hardware-specific interfaces\n> + * @reg:\tregister controlling gate\n> + * @clock_idx:\tbit used to gate this clock in the clock register\n> + * @reset_idx:\tbit used to reset this IP in the reset register. -1 if no\n> + *\t\treset is required when enabling the clock\n> + * @flags:\thardware-specific flags\n> + * @lock:\tregister lock\n> + *\n> + * Some of the clocks in the Aspeed SoC must be put in reset before enabling.\n> + * This modified version of clk_gate allows an optional reset bit to be\n> + * specified.\n> + */\n> +struct aspeed_clk_gate {\n> +\tstruct clk_hw\thw;\n> +\tstruct regmap\t*map;\n> +\tu8\t\tclock_idx;\n> +\ts8\t\treset_idx;\n> +\tu8\t\tflags;\n> +\tspinlock_t\t*lock;\n> +};\n\nIt feels like the two structures could be unified, but the result turns into a\nbit of a mess with a union of structs to limit the space impact, so perhaps we\nshouldn't go there?\n\n> +\n> +#define to_aspeed_clk_gate(_hw) container_of(_hw, struct aspeed_clk_gate, hw)\n> +\n> +/* TODO: ask Aspeed about the actual parent data */\n> +static const struct aspeed_gate_data aspeed_gates[] __initconst = {\n> +/*\t clk rst   name\t\t\tparent\t\tflags\t*/\n> +\t{  0, -1, \"eclk-gate\",\t\t\"eclk\",\t\t0 }, /* Video Engine */\n> +\t{  1,  7, \"gclk-gate\",\t\tNULL,\t\t0 }, /* 2D engine */\n> +\t{  2, -1, \"mclk-gate\",\t\t\"mpll\",\t\tCLK_IS_CRITICAL }, /* SDRAM */\n> +\t{  3,  6, \"vclk-gate\",\t\tNULL,\t\t0 }, /* Video Capture */\n> +\t{  4, 10, \"bclk-gate\",\t\t\"bclk\",\t\t0 }, /* PCIe/PCI */\n> +\t{  5, -1, \"dclk-gate\",\t\tNULL,\t\t0 }, /* DAC */\n> +\t{  6, -1, \"refclk-gate\",\t\"clkin\",\tCLK_IS_CRITICAL },\n> +\t{  7,  3, \"usb-port2-gate\",\tNULL,\t\t0 }, /* USB2.0 Host port 2 */\n> +\t{  8,  5, \"lclk-gate\",\t\tNULL,\t\t0 }, /* LPC */\n> +\t{  9, 15, \"usb-uhci-gate\",\tNULL,\t\t0 }, /* USB1.1 (requires port 2 enabled) */\n> +\t{ 10, 13, \"d1clk-gate\",\t\tNULL,\t\t0 }, /* GFX CRT */\n\nIs there a typo in the AST2400 datasheet? It claims bit 10 is \"D2CLK\".\n\n> +\t/* 11: reserved */\n> +\t/* 12: reserved */\n> +\t{ 13, 4,  \"yclk-gate\",\t\tNULL,\t\t0 }, /* HAC */\n> +\t{ 14, 14, \"usb-port1-gate\",\tNULL,\t\t0 }, /* USB2 hub/USB2 host port 1/USB1.1 dev */\n> +\t{ 15, -1, \"uart1clk-gate\",\t\"uart\",\t\t0 }, /* UART1 */\n> +\t{ 16, -1, \"uart2clk-gate\",\t\"uart\",\t\t0 }, /* UART2 */\n> +\t{ 17, -1, \"uart5clk-gate\",\t\"uart\",\t\t0 }, /* UART5 */\n> +\t/* 18: reserved */\n> +\t{ 19, -1, \"espiclk-gate\",\tNULL,\t\t0 }, /* eSPI */\n\n19 is reserved on the AST2400, and must be kept at '1'.\n\n> +\t{ 20, 11, \"mac1clk-gate\",\t\"clkin\",\t0 }, /* MAC1 */\n> +\t{ 21, 12, \"mac2clk-gate\",\t\"clkin\",\t0 }, /* MAC2 */\n> +\t/* 22: reserved */\n> +\t/* 23: reserved */\n> +\t{ 24, -1, \"rsaclk-gate\",\tNULL,\t\t0 }, /* RSA */\n> +\t{ 25, -1, \"uart3clk-gate\",\t\"uart\",\t\t0 }, /* UART3 */\n> +\t{ 26, -1, \"uart4clk-gate\",\t\"uart\",\t\t0 }, /* UART4 */\n> +\t{ 27, 16, \"sdclk-gate\",\t\tNULL,\t\t0 }, /* SDIO/SD */\n> +\t{ 28, -1, \"lhclk-gate\",\t\t\"lhclk\",\t0 }, /* LPC master/LPC+ */\n> +\t/* 29: reserved */\n> +\t/* 30: reserved */\n> +\t/* 31: reserved */\n\nInterestingly bits 29-30 are reserved in both the AST2400 and AST2500\ndatasheets, but are reserved-clear in the AST2400 datasheet and reserved-set in\nthe AST2500 datasheet. This may affect how we write register.\n\nSeparately, at one point I mistook the clk column for the index the entry\nshould appear at, which isn't the case. Do you think designated intializers\nmight help?\n\n> +};\n> +\n> +static void __init aspeed_cc_init(struct device_node *np)\n> +{\n> +\tstruct regmap *map;\n> +\tu32 val;\n> +\tint ret;\n> +\tint i;\n>\n> +\tscu_base = of_iomap(np, 0);\n> +\tif (IS_ERR(scu_base))\n> +\t\treturn;\n> +\n> +\taspeed_clk_data = kzalloc(sizeof(*aspeed_clk_data) +\n> +\t\t\tsizeof(*aspeed_clk_data->hws) * ASPEED_NUM_CLKS,\n> +\t\t\tGFP_KERNEL);\n> +\tif (!aspeed_clk_data)\n> +\t\treturn;\n> +\n> +\t/*\n> +\t * This way all clock fetched before the platform device probes,\n\nTypo: \"clocks\"\n\n> +\t * except those we assign here for early use, will be deferred.\n> +\t */\n> +\tfor (i = 0; i < ASPEED_NUM_CLKS; i++)\n> +\t\taspeed_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER);\n> +\n> +\tmap = syscon_node_to_regmap(np);\n> +\tif (IS_ERR(map)) {\n> +\t\tpr_err(\"no syscon regmap\\n\");\n> +\t\treturn;\n> +\t}\n> +\t/*\n> +\t * We check that the regmap works on this very first access,\n> +\t * but as this is an MMIO-backed regmap, subsequent regmap\n> +\t * access is not going to fail and we skip error checks from\n> +\t * this point.\n> +\t */\n> +\tret = regmap_read(map, ASPEED_STRAP, &val);\n> +\tif (ret) {\n> +\t\tpr_err(\"failed to read strapping register\\n\");\n> +\t\treturn;\n> +\t}\n> +\n> +\taspeed_clk_data->num = ASPEED_NUM_CLKS;\n> +\tret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, aspeed_clk_data);\n> +\tif (ret)\n> +\t\tpr_err(\"failed to add DT provider: %d\\n\", ret);\n> +};\n> +CLK_OF_DECLARE_DRIVER(aspeed_cc_g5, \"aspeed,ast2500-scu\", aspeed_cc_init);\n> +CLK_OF_DECLARE_DRIVER(aspeed_cc_g4, \"aspeed,ast2400-scu\", aspeed_cc_init);\n> diff --git a/include/dt-bindings/clock/aspeed-clock.h b/include/dt-bindings/clock/aspeed-clock.h\n> new file mode 100644\n> index 000000000000..afe06b77562d\n> --- /dev/null\n> +++ b/include/dt-bindings/clock/aspeed-clock.h\n> @@ -0,0 +1,43 @@\n> +#ifndef DT_BINDINGS_ASPEED_CLOCK_H\n> +#define DT_BINDINGS_ASPEED_CLOCK_H\n> +\n> +#define ASPEED_NUM_CLKS\t34\n\nThis is a bit of a nit pick: Do the constants below represent all the\nclocks in the SoC(s)? Maybe if not it's better to define\nASPEED_NUM_CLKS in terms of (n + ASPEED_CLK_GATES) at the bottom - that\nway when a clock or gate is added ASPEED_NUM_CLKS has better locality and\nbetter visual progression in context.\n\nAs a note, and as a clk noob but as someone with access to the Aspeed\ndatasheet, I was wondering whether the clocks and gates need to be represented\nin the same number space. However it seems to be so by how it's used with\nrespect to struct clk_hw_onecell_data.\n\n> +\n> +#define ASPEED_CLK_HPLL\t\t\t0\n> +#define ASPEED_CLK_AHB\t\t\t1\n> +#define ASPEED_CLK_APB\t\t\t2\n> +#define ASPEED_CLK_UART\t\t\t3\n> +#define ASPEED_CLK_SDIO\t\t\t4\n> +#define ASPEED_CLK_ECLK\t\t\t5\n> +#define ASPEED_CLK_ECLK_MUX\t\t6\n> +#define ASPEED_CLK_LHCLK\t\t7\n> +#define ASPEED_CLK_MAC\t\t\t8\n> +#define ASPEED_CLK_BCLK\t\t\t9\n> +#define ASPEED_CLK_MPLL\t\t\t10\n> +#define ASPEED_CLK_GATES\t\t11\n> +#define ASPEED_CLK_GATE_ECLK\t\t(0 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_GCLK\t\t(1 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_MCLK\t\t(2 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_VCLK\t\t(3 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_BCLK\t\t(4 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_DCLK\t\t(5 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_REFCLK\t\t(6 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_USBPORT2CLK\t(7 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_LCLK\t\t(8 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_USBUHCICLK\t(9 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_D1CLK\t\t(10 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_YCLK\t\t(11 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_USBPORT1CLK\t(12 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_UART1CLK\t(13 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_UART2CLK\t(14 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_UART5CLK\t(15 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_ESPICLK\t\t(16 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_MAC1CLK\t\t(17 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_MAC2CLK\t\t(18 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_RSACLK\t\t(19 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_UART3CLK\t(20 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_UART4CLK\t(21 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_SDCLKCLK\t(22 + ASPEED_CLK_GATES)\n> +#define ASPEED_CLK_GATE_LHCCLK\t\t(23 + ASPEED_CLK_GATES)\n\nLooks like there's an off-by-one error here: ASPEED_NUM_CLKS should be (23 +\nASPEED_CLK_GATES + 1) = 35.\n\nCheers,\n\nAndrew\n\n> +\n> +#endif","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"pFrPY0wS\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=aj.id.au header.i=@aj.id.au header.b=\"XGW6/JVh\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com\n\theader.b=\"e/F9qmc1\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y0qcY0fpLz9t1G\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 13:40:59 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dwKGM-0003Pp-AS; Mon, 25 Sep 2017 03:40:54 +0000","from out1-smtp.messagingengine.com ([66.111.4.25])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dwKGF-00035I-Qt for linux-arm-kernel@lists.infradead.org;\n\tMon, 25 Sep 2017 03:40:51 +0000","from compute4.internal (compute4.nyi.internal [10.202.2.44])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 4DB8220B04;\n\tSun, 24 Sep 2017 23:40:22 -0400 (EDT)","from frontend2 ([10.202.2.161])\n\tby compute4.internal (MEProxy); Sun, 24 Sep 2017 23:40:22 -0400","from keelia16 (unknown [203.0.153.9])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id 5170424155;\n\tSun, 24 Sep 2017 23:40:17 -0400 (EDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc:\n\tList-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:\n\tMime-Version:References:In-Reply-To:Date:To:From:Subject:Message-ID:Reply-To:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=P9xQvFml60sTC8vWsTPd6NlT0jCpmN3sBR3K5qUVyCc=;\n\tb=pFrPY0wSclVa+WHcp5B090j5h\n\tcLEc8HyHIVBvCld3V+bBjJ9RklwUQHUmK+LMm6IoM5I2LrDFNzZOZemjHI//4qgHxWDY08cvtjyQW\n\tTZyGoj3g1ftRNUYpCuVV/dFhUdGuASYt0dq7qQwGmz1kid3maECNs04v6see/Bw+vl7wGequ0Ms6R\n\tPDd55InTynOoiA+Ssk81Vrz4dW7jMmMCVJEKhQURYaN0tTebu5mcG9e3Au+oa0ja59K2UNV4u4n0f\n\tkWt56QcZO+kaMPlFkU533HuCXkXmoOWImNXghAP50xclAg+B+mrfRBsAzQCC1KSjO912Dsa/lEf9O\n\tunKDfj8Xw==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=cc\n\t:content-type:date:from:in-reply-to:message-id:mime-version\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc\n\t:x-sasl-enc; s=fm1; bh=4NlgH9jV9UoR76OYCELl8Jv5bgQ6tvT3g/tBx1rc9\n\tco=; b=XGW6/JVhzWpbUNHqgZIR8e8HKAnyXK0oe9T2lfDEGWhoG1wTATt8zf3R+\n\tD/IBuIUYa/RBWNprBV7Gd5vWTePSi4VEqpjTCg897o+O9xbvjXNL3+Plrqn9+bYK\n\tyUTQJElpgykvWFmFFnpKoanJwn76ItBl+yVzBMx6nxxNGehg/9JLK2cng2LrdXnf\n\tq2LyPoGvy2smUPUqXj9ZiIQHYE2aPUXGCTP8jBUPGB6DQ9kptDZEFH/odEyeAL+n\n\trs3URDGGWxoZSIz1Em0E7tQZ0U6c1CSeVFmSBeat9+kCEYuc/Lp5ev48RvrDJT6F\n\tZ+QtWu7fbrhPlqGOV6tSte4dKJshw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to:x-me-sender\n\t:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=4NlgH9jV9UoR76OYCE\n\tLl8Jv5bgQ6tvT3g/tBx1rc9co=; b=e/F9qmc1XOH3xnmZg3ryr5WgTNT0x+ZJz/\n\tjZO36/uIWO3GK1Ya/kEjAnXAbik9oYPFDXxnKdXrEmUQUsLJTYYLFgxZiVMgp43C\n\tITZ20yyat+nC8r206RQOy8RxX3e2/Yn7UJuLU2xk32fv61jdFVREvW4PvqNkm6yA\n\ttiwtcLsU2g0uF3yPeq1owpO4zP9LjEmcs/gTwLrVe6/nnF6qSB06mpVLOqe8IrIe\n\tH0AVpml3q4zMypt4lQSF6t5M9b6J/gdm/5vDXroF2mVGorottNNthWsiMHTfLkY9\n\tkqfEOJFJ0O67ivTUMwlwzes/XsrCZnsoN4V/rOmu2HZT8/v+Qb2A=="],"X-ME-Sender":"<xms:pnrIWQ6Qcj4nb4Sf4vQ-DeJsROANSbJ1vF-b1weXuw9_7tck_lzTAw>","X-Sasl-enc":"UcppMq+RBkSMiK9m98WI/VNTlQRfagpLP5z9js/CT1oE 1506310821","Message-ID":"<1506310811.30138.15.camel@aj.id.au>","Subject":"Re: [PATCH v2 1/5] clk: Add clock driver for ASPEED BMC SoCs","From":"Andrew Jeffery <andrew@aj.id.au>","To":"Joel Stanley <joel@jms.id.au>, Lee Jones <lee.jones@linaro.org>, Michael\n\tTurquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@codeaurora.org>","Date":"Mon, 25 Sep 2017 13:10:11 +0930","In-Reply-To":"<20170921042641.7326-2-joel@jms.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-2-joel@jms.id.au>","X-Mailer":"Evolution 3.22.6-1ubuntu1 ","Mime-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170924_204048_113684_BBE6D965 ","X-CRM114-Status":"GOOD (  28.98  )","X-Spam-Score":"-2.7 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow trust [66.111.4.25 listed in list.dnswl.org]\n\t-0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)\n\t[66.111.4.25 listed in wl.mailspike.net]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's\n\tdomain -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tlinux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,\n\tJeremy Kerr <jk@ozlabs.org>, Rick Altherr <raltherr@google.com>,\n\tlinux-arm-kernel@lists.infradead.org","Content-Type":"multipart/mixed;\n\tboundary=\"===============3333365236086604716==\"","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1774684,"web_url":"http://patchwork.ozlabs.org/comment/1774684/","msgid":"<1506340924.30138.26.camel@aj.id.au>","list_archive_url":null,"date":"2017-09-25T12:02:04","subject":"Re: [PATCH v2 2/5] clk: aspeed: Register core clocks","submitter":{"id":68332,"url":"http://patchwork.ozlabs.org/api/people/68332/","name":"Andrew Jeffery","email":"andrew@aj.id.au"},"content":"On Thu, 2017-09-21 at 13:56 +0930, Joel Stanley wrote:\n> This registers the core clocks; those which are required to calculate\n> the rate of the timer periperhal so the system can load a clocksource\n> driver.\n> \n> Signed-off-by: Joel Stanley <joel@jms.id.au>\n> ---\n>  drivers/clk/clk-aspeed.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++-\n>  1 file changed, 149 insertions(+), 3 deletions(-)\n> \n> diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c\n> index 824c54767009..e614c61b82d2 100644\n> --- a/drivers/clk/clk-aspeed.c\n> +++ b/drivers/clk/clk-aspeed.c\n> @@ -11,12 +11,12 @@\n>  \n>  #define pr_fmt(fmt) \"clk-aspeed: \" fmt\n>  \n> -#include <linux/slab.h>\n> -#include <linux/of_address.h>\n>  #include <linux/clk-provider.h>\n> +#include <linux/mfd/syscon.h>\n> +#include <linux/of_address.h>\n>  #include <linux/regmap.h>\n> +#include <linux/slab.h>\n>  #include <linux/spinlock.h>\n> -#include <linux/mfd/syscon.h>\n>  \n>  #include <dt-bindings/clock/aspeed-clock.h>\n>  \n> @@ -28,6 +28,9 @@\n>  #define ASPEED_MISC_CTRL\t0x2c\n>  #define ASPEED_STRAP\t\t0x70\n>  \n> +/* Globally visible clocks */\n> +static DEFINE_SPINLOCK(aspeed_clk_lock);\n> +\n>  /* Keeps track of all clocks */\n>  static struct clk_hw_onecell_data *aspeed_clk_data;\n>  \n> @@ -112,9 +115,137 @@ static const struct aspeed_gate_data aspeed_gates[] __initconst = {\n>  \t/* 31: reserved */\n>  };\n>  \n> +static const struct clk_div_table ast2400_div_table[] = {\n> +\t{ 0x0, 2 },\n> +\t{ 0x1, 4 },\n> +\t{ 0x2, 6 },\n> +\t{ 0x3, 8 },\n> +\t{ 0x4, 10 },\n> +\t{ 0x5, 12 },\n> +\t{ 0x6, 14 },\n> +\t{ 0x7, 16 },\n> +\t{ 0 }\n> +};\n> +\n> +static const struct clk_div_table ast2500_div_table[] = {\n> +\t{ 0x0, 4 },\n> +\t{ 0x1, 8 },\n> +\t{ 0x2, 12 },\n> +\t{ 0x3, 16 },\n> +\t{ 0x4, 20 },\n> +\t{ 0x5, 24 },\n> +\t{ 0x6, 28 },\n> +\t{ 0x7, 32 },\n> +\t{ 0 }\n> +};\n\nast2500_div_table is unused?\n\n> +\n> +static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n> +{\n> +\tunsigned int mult, div;\n> +\n> +\tif (val & BIT(20)) {\n> +\t\t/* Pass through mode */\n> +\t\tmult = div = 1;\n> +\t} else {\n> +\t\t/* F = clkin * [(M+1) / (N+1)] / (P + 1) */\n> +\t\tu32 p = (val >> 13) & 0x3f;\n> +\t\tu32 m = (val >> 5) & 0xff;\n> +\t\tu32 n = val & 0x1f;\n> +\n> +\t\tmult = (m + 1) / (n + 1);\n> +\t\tdiv = p + 1;\n> +\t}\n> +\n> +\treturn clk_hw_register_fixed_factor(NULL, name, \"clkin\", 0,\n> +\t\t\tmult, div);\n> +}\n> +\n> +static void __init aspeed_ast2400_cc(struct regmap *map)\n> +{\n> +\tstruct clk_hw *hw;\n> +\tu32 val, div, mult;\n> +\n> +\t/*\n> +\t * High-speed PLL clock derived from the crystal. This the CPU clock,\n> +\t * and we assume that it is enabled\n> +\t */\n> +\tregmap_read(map, ASPEED_HPLL_PARAM, &val);\n> +\tWARN(val & BIT(18), \"clock is strapped not configured\");\n\nI don't quite understand the intent of the warning - are we just trying to say\nthat the defaults have been assumed and they may not match reality? It's\nprobably not a great idea to not strap the board properly, but you could get\naway with it for a given configuration (Numerator = 20, H-PLL Output Divider\nset, H-PLL denominator = 1)\n\n> +\tif (val & BIT(17)) {\n> +\t\t/* Pass through mode */\n> +\t\tmult = div = 1;\n> +\t} else {\n> +\t\t/* F = 24Mhz * (2-OD) * [(N + 2) / (D + 1)] */\n> +\t\tu32 n = (val >> 5) & 0x3f;\n> +\t\tu32 od = (val >> 4) & 0x1;\n> +\t\tu32 d = val & 0xf;\n> +\n> +\t\tmult = (2 - od) * (n + 2);\n> +\t\tdiv = d + 1;\n> +\t}\n> +\thw = clk_hw_register_fixed_factor(NULL, \"hpll\", \"clkin\", 0, mult, div);\n> +\taspeed_clk_data->hws[ASPEED_CLK_HPLL] = hw;\n> +\n> +\t/*\n> +\t * Strap bits 11:10 define the CPU/AHB clock frequency ratio (aka HCLK)\n> +\t *   00: Select CPU:AHB = 1:1\n> +\t *   01: Select CPU:AHB = 2:1\n> +\t *   10: Select CPU:AHB = 4:1\n> +\t *   11: Select CPU:AHB = 3:1\n> +\t */\n> +\tregmap_read(map, ASPEED_STRAP, &val);\n> +\tval = (val >> 10) & 0x3;\n\nHow do the calculations below line up with the comment above? I can't see the\nconnection and I feel like I've missed something.\n\n> +\tdiv = val + 1;\n\nThis is only a valid mapping for 0b00 and 0b01?\n\n> +\tif (div == 2)\n> +\t\tdiv = 3;\n\nIf (div == 2) after adding 1, then the original value was 0b01, and so div\nshould remain 2?\n\n> +\telse if (div == 3)\n> +\t\tdiv = 2;\n\nIf (div == 3) after adding 1, then the original value was 0b10, and so div\nshould be 4?\n\n> +\thw = clk_hw_register_fixed_factor(NULL, \"ahb\", \"hpll\", 0, 1, div);\n> +\taspeed_clk_data->hws[ASPEED_CLK_AHB] = hw;\n> +\n> +\t/* APB clock clock selection register SCU08 (aka PCLK) */\n> +\thw = clk_hw_register_divider_table(NULL, \"apb\", \"hpll\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 23, 3, 0,\n> +\t\t\tast2400_div_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_APB] = hw;\n> +}\n> +\n> +static void __init aspeed_ast2500_cc(struct regmap *map)\n> +{\n> +\tstruct clk_hw *hw;\n> +\tu32 val, div;\n> +\n> +\t/*\n> +\t * High-speed PLL clock derived from the crystal. This the CPU clock,\n> +\t * and we assume that it is enabled\n> +\t */\n> +\tregmap_read(map, ASPEED_HPLL_PARAM, &val);\n> +\taspeed_clk_data->hws[ASPEED_CLK_HPLL] = aspeed_calc_pll(\"hpll\", val);\n\nWhy did you extract the aspeed_calc_pll() implementation for the ast2500 but\nnot the ast2400?\n\n> +\n> +\t/* Strap bits 11:9 define the AXI/AHB clock frequency ratio (aka HCLK)*/\n> +\tregmap_read(map, ASPEED_STRAP, &val);\n> +\tval = (val >> 9) & 0x7;\n> +\tWARN_ON(val == 0);\n\nMaybe WARN() would be better here to explain what's going wrong (zero is an\nundefined value)?\n\n> +\tdiv = 2 * (val + 1);\n> +\thw = clk_hw_register_fixed_factor(NULL, \"ahb\", \"hpll\", 0, 1, div);\n> +\taspeed_clk_data->hws[ASPEED_CLK_AHB] = hw;\n> +\n> +\t/* APB clock clock selection register SCU08 (aka PCLK) */\n> +\t/* TODO: this is wrong! */\n\nWhy is this wrong?\n\n> +\tregmap_read(map, ASPEED_CLK_SELECTION, &val);\n> +\tval = (val >> 23) & 0x7;\n> +\tdiv = 4 * (val + 1);\n> +\thw = clk_hw_register_fixed_factor(NULL, \"apb\", \"hpll\", 0, 1, div);\n> +\taspeed_clk_data->hws[ASPEED_CLK_APB] = hw;\n> +};\n> +\n> +\n>  static void __init aspeed_cc_init(struct device_node *np)\n>  {\n>  \tstruct regmap *map;\n> +\tunsigned long freq;\n> +\tstruct clk_hw *hw;\n>  \tu32 val;\n>  \tint ret;\n>  \tint i;\n> @@ -153,6 +284,21 @@ static void __init aspeed_cc_init(struct device_node *np)\n>  \t\treturn;\n>  \t}\n>  \n> +\t/* CLKIN is the crystal oscillator, 24 or 25MHz selected by strapping */\n> +\tif (val & BIT(23))\n> +\t\tfreq = 25000000;\n> +\telse\n> +\t\tfreq = 24000000;\n\nThis isn't true on the AST2400, where CLKIN could be 24 OR 48MHz when BIT(23) is\nclear. You need to test BIT(18) as well on the AST2400 to disambiguate.\n\n> +\thw = clk_hw_register_fixed_rate(NULL, \"clkin\", NULL, 0, freq);\n> +\tpr_debug(\"clkin @%lu MHz\\n\", freq / 1000000);\n> +\n> +\tif (of_device_is_compatible(np, \"aspeed,ast2400-scu\"))\n> +\t\taspeed_ast2400_cc(map);\n> +\telse if (of_device_is_compatible(np, \"aspeed,ast2500-scu\"))\n> +\t\taspeed_ast2500_cc(map);\n> +\telse\n> +\t\tpr_err(\"unknown platform, failed to add clocks\\n\");\n\nI'm not confident that \"borrowing\" the SCU compatible like this is entirely in\nthe spirit of its MFD nature, but maybe others can chime in.\n\nCheers,\n\nAndrew\n\n> +\n>  \taspeed_clk_data->num = ASPEED_NUM_CLKS;\n>  \tret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, aspeed_clk_data);\n>  \tif (ret)","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"kQ2D0fEe\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=aj.id.au header.i=@aj.id.au header.b=\"lrKvgkmt\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com\n\theader.b=\"UlzxdBxt\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y12lX021Xz9sRq\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 22:02:47 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dwS60-00006d-A5; Mon, 25 Sep 2017 12:02:44 +0000","from out1-smtp.messagingengine.com ([66.111.4.25])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dwS5u-0008TE-Tt for linux-arm-kernel@lists.infradead.org;\n\tMon, 25 Sep 2017 12:02:42 +0000","from compute4.internal (compute4.nyi.internal [10.202.2.44])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 9549C20F2C;\n\tMon, 25 Sep 2017 08:02:16 -0400 (EDT)","from frontend1 ([10.202.2.160])\n\tby compute4.internal (MEProxy); Mon, 25 Sep 2017 08:02:16 -0400","from keelia16 (124-169-182-122.dyn.iinet.net.au [124.169.182.122])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id B361A7E187;\n\tMon, 25 Sep 2017 08:02:11 -0400 (EDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc:\n\tList-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:\n\tMime-Version:References:In-Reply-To:Date:To:From:Subject:Message-ID:Reply-To:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=7ABkjQVyNMVi6hJqfiYS/gLXcJxfUVux6LLGQL5wIQI=;\n\tb=kQ2D0fEetxIBWIMLVRsY4Rbhc\n\tErhG4JzVcRNNcNw5NYznEwyD1CYiMo3q/f9/aR3G3Ks8h4mTH7KLfc9Emj+Hal1raeni69cr5NB4B\n\t/64b6p9Rr1yd4FQNgsuugDzI1udAhOG8+3Sjn+rVkUqUxbeyHLFrB/NH0jqzBuoVMrHF7VsMYMl5h\n\tjktmszUVoUXyMo0RDi+yWIKIRjQ/FlcYPQ/n3fU4MBmuUMhe0tXWUwuJNUg2EijIpjr6mFhi/UhYw\n\tynKtEJ1WkvllrSgj98gdvp9vP7mHnRUWxQllDur+mDb5mpWBrixfSU9+U/27hMpMk5xtS5Mh4v1M1\n\t0KuRFk+wg==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=cc\n\t:content-type:date:from:in-reply-to:message-id:mime-version\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc\n\t:x-sasl-enc; s=fm1; bh=I87EQjiV3TC7Ach8tEzYT9dtKkIYx1m8UPhWy3Itl\n\tN0=; b=lrKvgkmtpDJk1kf/iPdB0ib7JcSN3Z8c/6CtFk6xwLqfrOe0VgMOk0PXH\n\t1BiOXjeEWrxCltbTDU4RHDoJDWIMu3emqFR0ia+F604eLaADh//XJI7JBlwccNTh\n\tnBMtZ/ULfl4MW0Yh3lT7ry6i5VKNSe9CrR0ket23mWh7f5FPbF+5VBFF3iOkOJpD\n\twER5lH9tHhtLcZAsdzVtqYyvf+nhip9tbxwk5kXzkN+EeDjK7rTRrtEsT4tNRYcO\n\tfogO9HdxKHoWyoYHxZP//PywvjeOjJkeInXvgD4GkIz65SiT9FFQaim8uzybS8/3\n\tSl433+mKK+LqkJCB4S8YRdfjvlIqA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to:x-me-sender\n\t:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=I87EQjiV3TC7Ach8tE\n\tzYT9dtKkIYx1m8UPhWy3ItlN0=; b=UlzxdBxt332SzUaLer5I/CU9K0oDmnQtBc\n\tTkZs+9iChXEGo+JDwko16KMU4dXIrCp0lk/Um8YDNQn7WPdxQX50eBqQC1DYyL62\n\thPdz4O77kveEgkTC4RiqnrzsYrcqSWuJlYsgqIWNPAtg4Y5RfTj59NXffBAwh4Qv\n\tDCTZG+FOQHifQ/AUHoStW4exC2/+BfNuBKrsP1HtA02kuCoh2Wd3B5dpa+5wKsBx\n\txccalPaPMds7aGtVSRfbb/viWUNHqzv7jnYRhnQDmfuNXDnKUn0IQwdviwDSikDu\n\tFqBDrxgqhqqauSANCHAccHkqI7T2GIEsBVYOWRg2MNVFEV6esdNA=="],"X-ME-Sender":"<xms:SPDIWTGNthnohyktQEUucXpel0eEt13K-5lYW_DmKpY9Kk9nr2d7Ww>","X-Sasl-enc":"Jxk/xOoYXBxe8EorUYy466z2oLxrDqiy/W0+WPUl1PAZ 1506340935","Message-ID":"<1506340924.30138.26.camel@aj.id.au>","Subject":"Re: [PATCH v2 2/5] clk: aspeed: Register core clocks","From":"Andrew Jeffery <andrew@aj.id.au>","To":"Joel Stanley <joel@jms.id.au>, Lee Jones <lee.jones@linaro.org>, Michael\n\tTurquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@codeaurora.org>","Date":"Mon, 25 Sep 2017 21:32:04 +0930","In-Reply-To":"<20170921042641.7326-3-joel@jms.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-3-joel@jms.id.au>","X-Mailer":"Evolution 3.22.6-1ubuntu1 ","Mime-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170925_050239_124833_40C7600E ","X-CRM114-Status":"GOOD (  21.45  )","X-Spam-Score":"-2.7 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow trust [66.111.4.25 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)\n\t[66.111.4.25 listed in wl.mailspike.net]\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's\n\tdomain -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tlinux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,\n\tJeremy Kerr <jk@ozlabs.org>, Rick Altherr <raltherr@google.com>,\n\tlinux-arm-kernel@lists.infradead.org","Content-Type":"multipart/mixed;\n\tboundary=\"===============4091263242595719354==\"","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1774702,"web_url":"http://patchwork.ozlabs.org/comment/1774702/","msgid":"<1506343255.30138.29.camel@aj.id.au>","list_archive_url":null,"date":"2017-09-25T12:40:55","subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","submitter":{"id":68332,"url":"http://patchwork.ozlabs.org/api/people/68332/","name":"Andrew Jeffery","email":"andrew@aj.id.au"},"content":"On Thu, 2017-09-21 at 13:56 +0930, Joel Stanley wrote:\n> This registers a platform driver to set up all of the non-core clocks.\n> \n> The clocks that have configurable rates are now registered.\n> \n> Signed-off-by: Joel Stanley <joel@jms.id.au>\n> ---\n>  drivers/clk/clk-aspeed.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 129 insertions(+)\n> \n> diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c\n> index e614c61b82d2..19531798e040 100644\n> --- a/drivers/clk/clk-aspeed.c\n> +++ b/drivers/clk/clk-aspeed.c\n> @@ -14,6 +14,8 @@\n>  #include <linux/clk-provider.h>\n>  #include <linux/mfd/syscon.h>\n>  #include <linux/of_address.h>\n> +#include <linux/of_device.h>\n> +#include <linux/platform_device.h>\n>  #include <linux/regmap.h>\n>  #include <linux/slab.h>\n>  #include <linux/spinlock.h>\n> @@ -115,6 +117,20 @@ static const struct aspeed_gate_data aspeed_gates[] __initconst = {\n>  \t/* 31: reserved */\n>  };\n>  \n> +static const char * const eclk_parents[] = {\"d1pll\", \"hpll\", \"mpll\"};\n> +\n> +static const struct clk_div_table ast2500_mac_div_table[] = {\n> +\t{ 0x0, 4 }, /* Yep, really. Aspeed confirmed this is correct */\n> +\t{ 0x1, 4 },\n> +\t{ 0x2, 6 },\n> +\t{ 0x3, 8 },\n> +\t{ 0x4, 10 },\n> +\t{ 0x5, 12 },\n> +\t{ 0x6, 14 },\n> +\t{ 0x7, 16 },\n> +\t{ 0 }\n> +};\n> +\n>  static const struct clk_div_table ast2400_div_table[] = {\n>  \t{ 0x0, 2 },\n>  \t{ 0x1, 4 },\n> @@ -139,6 +155,21 @@ static const struct clk_div_table ast2500_div_table[] = {\n>  \t{ 0 }\n>  };\n>  \n> +struct aspeed_clk_soc_data {\n> +\tconst struct clk_div_table *div_table;\n> +\tconst struct clk_div_table *mac_div_table;\n> +};\n> +\n> +static const struct aspeed_clk_soc_data ast2500_data = {\n> +\t.div_table = ast2500_div_table,\n> +\t.mac_div_table = ast2500_mac_div_table,\n> +};\n> +\n> +static const struct aspeed_clk_soc_data ast2400_data = {\n> +\t.div_table = ast2400_div_table,\n> +\t.mac_div_table = ast2400_div_table,\n> +};\n> +\n>  static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n>  {\n>  \tunsigned int mult, div;\n> @@ -160,6 +191,104 @@ static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n>  \t\t\tmult, div);\n>  }\n>  \n> +static int __init aspeed_clk_probe(struct platform_device *pdev)\n> +{\n> +\tconst struct aspeed_clk_soc_data *soc_data;\n> +\tconst struct clk_div_table *mac_div_table;\n> +\tconst struct clk_div_table *div_table;\n> +\tstruct device *dev = &pdev->dev;\n> +\tstruct regmap *map;\n> +\tstruct clk_hw *hw;\n> +\tu32 val, rate;\n> +\n> +\tmap = syscon_node_to_regmap(dev->of_node);\n> +\tif (IS_ERR(map)) {\n> +\t\tdev_err(dev, \"no syscon regmap\\n\");\n> +\t\treturn PTR_ERR(map);\n> +\t}\n> +\n> +\t/* SoC generations share common layouts but have different divisors */\n> +\tsoc_data = of_device_get_match_data(&pdev->dev);\n> +\tdiv_table = soc_data->div_table;\n> +\tmac_div_table = soc_data->mac_div_table;\n> +\n> +\t/* UART clock div13 setting */\n> +\tregmap_read(map, ASPEED_MISC_CTRL, &val);\n> +\tif (val & BIT(12))\n> +\t\trate = 24000000 / 13;\n> +\telse\n> +\t\trate = 24000000;\n> +\t/* TODO: Find the parent data for the uart clock */\n> +\thw = clk_hw_register_fixed_rate(NULL, \"uart\", NULL, 0, rate);\n> +\taspeed_clk_data->hws[ASPEED_CLK_UART] = hw;\n> +\n> +\t/*\n> +\t * Memory controller (M-PLL) PLL. This clock is configured by the\n> +\t * bootloader, and is exposed to Linux as a read-only clock rate.\n> +\t */\n> +\tregmap_read(map, ASPEED_MPLL_PARAM, &val);\n> +\taspeed_clk_data->hws[ASPEED_CLK_MPLL] =\taspeed_calc_pll(\"mpll\", val);\n\nIIRC the calculation in aspeed_calc_pll() is appropriate for the AST2500, but\nnot the AST2400.\n\n> +\n> +\t/* SD/SDIO clock divider (TODO: There's a gate too) */\n> +\thw = clk_hw_register_divider_table(NULL, \"sdio\", \"hpll\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 12, 3, 0,\n> +\t\t\tdiv_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_SDIO] = hw;\n> +\n> +\t/* MAC AHB bus clock divider */\n> +\thw = clk_hw_register_divider_table(NULL, \"mac\", \"hpll\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 16, 3, 0,\n> +\t\t\tmac_div_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_MAC] = hw;\n> +\n> +\t/* LPC Host (LHCLK) clock divider */\n> +\thw = clk_hw_register_divider_table(NULL, \"lhclk\", \"hpll\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 20, 3, 0,\n> +\t\t\tdiv_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_LHCLK] = hw;\n> +\n> +\t/* Video Engine (ECLK) mux and clock divider */\n> +\thw = clk_hw_register_mux(NULL, \"eclk_mux\",\n> +\t\t\teclk_parents, ARRAY_SIZE(eclk_parents), 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 2, 2,\n> +\t\t\t0, &aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_ECLK_MUX] = hw;\n> +\thw = clk_hw_register_divider_table(NULL, \"eclk\", \"eclk_mux\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 20, 3, 0,\n\nOn the AST2500 it looks like this should start at bit 28 for 3 bits, not bit\n20. Separately, I'm not sure how to interpret the AST2400 datasheet here -\nmaybe it's similar but with different wording (\"clock slow down\" rather than\n\"divisor\"?).\n\n> +\t\t\tdiv_table,\n\nThis doesn't seem to be correct. There's the problem of 0b000 and 0b001 mapping\nthe same value of 2 for the AST2500, whose table then increments in steps of 1.\nThe AST2400 mapping on the otherhand is multiples of 2 starting at 2, with no\ninconsistency for 0b000 vs 0b001.\n\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_ECLK] = hw;\n> +\n> +\t/* P-Bus (BCLK) clock divider */\n> +\thw = clk_hw_register_divider_table(NULL, \"bclk\", \"hpll\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 0, 2, 0,\n\nBit 0 in SCU08 is a 1-bit field \"CPU/AHB clock dynamic slow down enable\". BCLK\nis actually in SCU*D*8, but (perhaps confusingly) documented immediately below\nSCU*0*8.\n\nCheers,\n\nAndrew\n\n> +\t\t\tdiv_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_BCLK] = hw;\n> +\n> +\treturn 0;\n> +};\n> +\n> +static const struct of_device_id aspeed_clk_dt_ids[] = {\n> +\t{ .compatible = \"aspeed,ast2400-scu\", .data = &ast2400_data },\n> +\t{ .compatible = \"aspeed,ast2500-scu\", .data = &ast2500_data },\n> +\t{ },\n> +};\n> +\n> +static struct platform_driver aspeed_clk_driver = {\n> +\t.probe  = aspeed_clk_probe,\n> +\t.driver = {\n> +\t\t.name = \"aspeed-clk\",\n> +\t\t.of_match_table = aspeed_clk_dt_ids,\n> +\t\t.suppress_bind_attrs = true,\n> +\t},\n> +};\n> +builtin_platform_driver(aspeed_clk_driver);\n> +\n> +\n>  static void __init aspeed_ast2400_cc(struct regmap *map)\n>  {\n>  \tstruct clk_hw *hw;","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"IUzfLrmr\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=aj.id.au header.i=@aj.id.au header.b=\"jWPnvE8n\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com\n\theader.b=\"T5ssdAi3\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y13cD6CB4z9tX3\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 22:41:32 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dwShU-0002NK-UE; Mon, 25 Sep 2017 12:41:28 +0000","from out1-smtp.messagingengine.com ([66.111.4.25])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dwShQ-0002Ix-Ij for linux-arm-kernel@lists.infradead.org;\n\tMon, 25 Sep 2017 12:41:27 +0000","from compute4.internal (compute4.nyi.internal [10.202.2.44])\n\tby mailout.nyi.internal (Postfix) with ESMTP id DFAA320B36;\n\tMon, 25 Sep 2017 08:41:03 -0400 (EDT)","from frontend1 ([10.202.2.160])\n\tby compute4.internal (MEProxy); Mon, 25 Sep 2017 08:41:03 -0400","from keelia16 (124-169-182-122.dyn.iinet.net.au [124.169.182.122])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id 6505B7F933;\n\tMon, 25 Sep 2017 08:40:59 -0400 (EDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc:\n\tList-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:\n\tMime-Version:References:In-Reply-To:Date:To:From:Subject:Message-ID:Reply-To:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=U4OqijpXSTWVYTOGzTBZm3n0i1Zt6aEA7su2b2DLInw=;\n\tb=IUzfLrmrUckzsYLk6HjTtaSrp\n\t4n91lg7QQXX/6YJTJnDCCwuBBET2H86dL/PCtjtl1wPk+GrTCFw2z5hYNDQ4lLuaSJ1IZ4Hulw8Hd\n\tBaS8y7xGa1nAs6pCN9SQDQlv71I4OS6UhfZjZx4XDHnIdqVlHc4C7GUStjL5qxV3qqwVUodbGAmJ3\n\tcHJCVNXBNT1rLTzmvFG1agTxhmTGikJgEXD5FzZUBIrtUq/Rt0b+Ds/U91Ct8GntQaekmIg7gxd+2\n\tCjhsgeBIxhJgdXDQ4DJDcJ8GZGSb0BX3jQ8NwUm2xSlbV8AGGWkw6CHfcBis6hyWQceGUpDuQ17Up\n\tlBJ5XL6dA==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=cc\n\t:content-type:date:from:in-reply-to:message-id:mime-version\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc\n\t:x-sasl-enc; s=fm1; bh=BxCPFdqm+pHn3A4DYrLJ0hbY6EGqHracWFS7TxO7f\n\tDQ=; b=jWPnvE8nYmeoqwe9b4WFjsolp27k+8MdQII8JPJSHC+0CZKZ3DQxS/s60\n\tPH+vjv4kraZpl3PqL14JGInsFLtZfuvapNhKgpIq5VrFONi1nFVs10NrSQLx84i8\n\tHEh4BRHwK6IgMYk7TNPMtK+trGEyQT/rwHPZ94e4JDKFky6UFOBERwr5V9IF/tsT\n\tYgp4/mIHVxSxHr0wOknqeAWhKONMWfmlMbedzxuJokiV6PMwIuw9shNxIExucwB8\n\tq2kKoj5QXpLDkRAkthoCYqYEa2O/j+yGUiGhx6/84Gxd1t0dTpcQq+gfEMNZm9Qn\n\tPZlVVBKBJRjt9l8qKPN4f0qxJLFLg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to:x-me-sender\n\t:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=BxCPFdqm+pHn3A4DYr\n\tLJ0hbY6EGqHracWFS7TxO7fDQ=; b=T5ssdAi317NhPS2x+8/GdpD665MWKgkMyl\n\tOcQSpEn5E7TxwJcYDsbWljBigG4n/66IWDcCZw4sprx2p1THhA2OA/hqeI37tAjk\n\tztlOGHrOAJlEjhM85ZPVYOS8vhETJAVRrNMxQ8m0AZnOabiIGKh8B0k5udk0izid\n\tw4uqalkVbHopKDO6a6dI2xlzjMZx5laC+ZOFeDp0qA2hapxOwER85R+rOUoB2zMV\n\tAKPH9rtjOUwX5hVH42iTCrFCWsG3Xutinu+4vFEBb7ccPt1Oi2EhkBTP4CoauQH5\n\tiMwOZCN+/jFWWSfMTmwXnlvNO/MGvdylQrvP+whthum/TEHtpxfA=="],"X-ME-Sender":"<xms:X_nIWVrg61DBFvh9Q9HP01HAEWa_tV57jHcna1OEgGj89gj-PkmCZw>","X-Sasl-enc":"BQ9MIu7k0GYi11UwubSogH7PrOywxAGrlWo7hcYZfNbw 1506343263","Message-ID":"<1506343255.30138.29.camel@aj.id.au>","Subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","From":"Andrew Jeffery <andrew@aj.id.au>","To":"Joel Stanley <joel@jms.id.au>, Lee Jones <lee.jones@linaro.org>, Michael\n\tTurquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@codeaurora.org>","Date":"Mon, 25 Sep 2017 22:10:55 +0930","In-Reply-To":"<20170921042641.7326-4-joel@jms.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-4-joel@jms.id.au>","X-Mailer":"Evolution 3.22.6-1ubuntu1 ","Mime-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170925_054124_775575_61380BD5 ","X-CRM114-Status":"GOOD (  18.32  )","X-Spam-Score":"-2.7 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow trust [66.111.4.25 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)\n\t[66.111.4.25 listed in wl.mailspike.net]\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's\n\tdomain -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tlinux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,\n\tJeremy Kerr <jk@ozlabs.org>, Rick Altherr <raltherr@google.com>,\n\tlinux-arm-kernel@lists.infradead.org","Content-Type":"multipart/mixed;\n\tboundary=\"===============4458574153244479193==\"","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1774712,"web_url":"http://patchwork.ozlabs.org/comment/1774712/","msgid":"<1506344081.30138.32.camel@aj.id.au>","list_archive_url":null,"date":"2017-09-25T12:54:41","subject":"Re: [PATCH v2 5/5] clk: aspeed: Add reset controller","submitter":{"id":68332,"url":"http://patchwork.ozlabs.org/api/people/68332/","name":"Andrew Jeffery","email":"andrew@aj.id.au"},"content":"On Thu, 2017-09-21 at 13:56 +0930, Joel Stanley wrote:\n> There are some resets that are not associated with gates. These are\n> represented by a reset controller.\n> \n> Signed-off-by: Joel Stanley <joel@jms.id.au>\n> ---\n>  drivers/clk/clk-aspeed.c                 | 82 +++++++++++++++++++++++++++++++-\n>  include/dt-bindings/clock/aspeed-clock.h |  9 ++++\n>  2 files changed, 90 insertions(+), 1 deletion(-)\n> \n> diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c\n> index dec9db4ec47b..db97c0f9f99e 100644\n> --- a/drivers/clk/clk-aspeed.c\n> +++ b/drivers/clk/clk-aspeed.c\n> @@ -17,6 +17,7 @@\n>  #include <linux/of_device.h>\n>  #include <linux/platform_device.h>\n>  #include <linux/regmap.h>\n> +#include <linux/reset-controller.h>\n>  #include <linux/slab.h>\n>  #include <linux/spinlock.h>\n>  \n> @@ -256,6 +257,68 @@ static const struct clk_ops aspeed_clk_gate_ops = {\n>  \t.is_enabled = aspeed_clk_is_enabled,\n>  };\n>  \n> +/**\n> + * struct aspeed_reset - Aspeed reset controller\n> + * @map: regmap to access the containing system controller\n> + * @rcdev: reset controller device\n> + */\n> +struct aspeed_reset {\n> +\tstruct regmap\t\t\t*map;\n> +\tstruct reset_controller_dev\trcdev;\n> +};\n> +\n> +#define to_aspeed_reset(p) container_of((p), struct aspeed_reset, rcdev)\n> +\n> +static const u8 aspeed_resets[] = {\n> +\t25, /* x-dma */\n> +\t24, /* mctp */\n> +\t23, /* adc */\n> +\t22, /* jtag-master */\n> +\t18, /* mic */\n> +\t 9, /* pwm */\n> +\t 8, /* pci-vga */\n> +\t 2, /* i2c */\n> +\t 1, /* ahb */\n\nBit of a nit, but given you define macros for the indices, maybe use designated\ninitialisers and drop the comments.\n\n> +};\n> +\n> +static int aspeed_reset_deassert(struct reset_controller_dev *rcdev,\n> +\t\t\t\t unsigned long id)\n> +{\n> +\tstruct aspeed_reset *ar = to_aspeed_reset(rcdev);\n> +\tu32 rst = BIT(aspeed_resets[id]);\n> +\n> +\treturn regmap_update_bits(ar->map, ASPEED_RESET_CTRL, rst, 0);\n> +}\n> +\n> +static int aspeed_reset_assert(struct reset_controller_dev *rcdev,\n> +\t\t\t       unsigned long id)\n> +{\n> +\tstruct aspeed_reset *ar = to_aspeed_reset(rcdev);\n> +\tu32 rst = BIT(aspeed_resets[id]);\n> +\n> +\treturn regmap_update_bits(ar->map, ASPEED_RESET_CTRL, rst, rst);\n> +}\n> +\n> +static int aspeed_reset_status(struct reset_controller_dev *rcdev,\n> +\t\t\t       unsigned long id)\n> +{\n> +\tstruct aspeed_reset *ar = to_aspeed_reset(rcdev);\n> +\tu32 val, rst = BIT(aspeed_resets[id]);\n> +\tint ret;\n> +\n> +\tret = regmap_read(ar->map, ASPEED_RESET_CTRL, &val);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\treturn !!(val & rst);\n> +}\n> +\n> +static const struct reset_control_ops aspeed_reset_ops = {\n> +\t.assert = aspeed_reset_assert,\n> +\t.deassert = aspeed_reset_deassert,\n> +\t.status = aspeed_reset_status,\n> +};\n> +\n>  static struct clk_hw *aspeed_clk_hw_register_gate(struct device *dev,\n>  \t\tconst char *name, const char *parent_name, unsigned long flags,\n>  \t\tstruct regmap *map, u8 clock_idx, u8 reset_idx,\n> @@ -299,10 +362,11 @@ static int __init aspeed_clk_probe(struct platform_device *pdev)\n>  \tconst struct clk_div_table *mac_div_table;\n>  \tconst struct clk_div_table *div_table;\n>  \tstruct device *dev = &pdev->dev;\n> +\tstruct aspeed_reset *ar;\n>  \tstruct regmap *map;\n>  \tstruct clk_hw *hw;\n>  \tu32 val, rate;\n> -\tint i;\n> +\tint i, ret;\n>  \n>  \tmap = syscon_node_to_regmap(dev->of_node);\n>  \tif (IS_ERR(map)) {\n> @@ -310,6 +374,22 @@ static int __init aspeed_clk_probe(struct platform_device *pdev)\n>  \t\treturn PTR_ERR(map);\n>  \t}\n>  \n> +\tar = devm_kzalloc(dev, sizeof(*ar), GFP_KERNEL);\n> +\tif (!ar)\n> +\t\treturn -ENOMEM;\n> +\n> +\tar->map = map;\n> +\tar->rcdev.owner = THIS_MODULE;\n> +\tar->rcdev.nr_resets = ARRAY_SIZE(aspeed_resets);\n> +\tar->rcdev.ops = &aspeed_reset_ops;\n> +\tar->rcdev.of_node = dev->of_node;\n> +\n> +\tret = devm_reset_controller_register(dev, &ar->rcdev);\n> +\tif (ret) {\n> +\t\tdev_err(dev, \"could not register reset controller\\n\");\n> +\t\treturn ret;\n> +\t}\n> +\n>  \t/* SoC generations share common layouts but have different divisors */\n>  \tsoc_data = of_device_get_match_data(&pdev->dev);\n>  \tdiv_table = soc_data->div_table;\n> diff --git a/include/dt-bindings/clock/aspeed-clock.h b/include/dt-bindings/clock/aspeed-clock.h\n> index afe06b77562d..a9d552b6bbd2 100644\n> --- a/include/dt-bindings/clock/aspeed-clock.h\n> +++ b/include/dt-bindings/clock/aspeed-clock.h\n> @@ -40,4 +40,13 @@\n>  #define ASPEED_CLK_GATE_SDCLKCLK\t(22 + ASPEED_CLK_GATES)\n>  #define ASPEED_CLK_GATE_LHCCLK\t\t(23 + ASPEED_CLK_GATES)\n>  \n> +#define ASPEED_RESET_XDMA\t\t0\n> +#define ASPEED_RESET_MCTP\t\t1\n> +#define ASPEED_RESET_JTAG_MASTER\t2\n> +#define ASPEED_RESET_MIC\t\t3\n> +#define ASPEED_RESET_PWM\t\t4\n> +#define ASPEED_RESET_PCIVGA\t\t5\n> +#define ASPEED_RESET_I2C\t\t6\n> +#define ASPEED_RESET_AHB\t\t7\n> +\n>  #endif","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"LKAJ55ig\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=aj.id.au header.i=@aj.id.au header.b=\"H1CxOjWE\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com\n\theader.b=\"EgN2DtrU\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y13wG6wBbz9tX8\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 22:55:23 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dwSut-0000LK-8k; Mon, 25 Sep 2017 12:55:19 +0000","from out1-smtp.messagingengine.com ([66.111.4.25])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dwSul-0007Wy-0w for linux-arm-kernel@lists.infradead.org;\n\tMon, 25 Sep 2017 12:55:17 +0000","from compute4.internal (compute4.nyi.internal [10.202.2.44])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 5CA3320BFF;\n\tMon, 25 Sep 2017 08:54:50 -0400 (EDT)","from frontend1 ([10.202.2.160])\n\tby compute4.internal (MEProxy); Mon, 25 Sep 2017 08:54:50 -0400","from keelia16 (124-169-182-122.dyn.iinet.net.au [124.169.182.122])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id C08E67E187;\n\tMon, 25 Sep 2017 08:54:45 -0400 (EDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc:\n\tList-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:\n\tMime-Version:References:In-Reply-To:Date:To:From:Subject:Message-ID:Reply-To:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=G199zFdPaNGK9vlb397QAH9lnDNenbZ80iBH7iMr4JI=;\n\tb=LKAJ55igQ9LGHeOo8tnSM0pwR\n\t+qMyfblZKLjxhgVUSajDVffB/TEl8QD8fPEl4CDD2wbHEs9fNbvJbE+qt7+LKjaDqQgq2nYhOPQIv\n\t4vUGfgrG2XCCZLakwzngNs/N8k0BeY0oJ5yby5XvhmfDV9oddFDX7tCIpZehjEF829EReE2tV6WcN\n\tD1vi/zOfbRyyTqK0/j5wVo0T0lf8rm8VWs7n72HC8cMfNYEFbK5AtxcWEYjU2fIUts//N2ey0SNKR\n\tQc3oKxB/Ho16XxCEfU4fuEiN4X5s/Yg6UmGEgoT3V1UzQCcGPbKCc8wCiEaQfANRpmiRJpqBuwosc\n\tYsy3Xg1Fw==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=cc\n\t:content-type:date:from:in-reply-to:message-id:mime-version\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc\n\t:x-sasl-enc; s=fm1; bh=ty7xz/2EcVwk7wfF7afGfeJYgQqNwp03zaqB6E3Rk\n\tCU=; b=H1CxOjWEcHFJIs95QMUev4ixXiohkHwgVVYDFHeVX8B3ZtlkoLTba8PEH\n\tS3Oli9FYiZm4HrUuWSiOMunbyvx1AyZ0z67xubCg74LxJUTPa1j2RKQYf1XqAGbC\n\tay7+EBLHT2OaJixAseQk6bPqqPsvmz/GWKvTT3fOOJuniywbWBR43OMZVEkThDYr\n\t4klmWVvIN65T2fNGLQEUpNI9usWo91XB5WzK5fsIynOwItZY7a5EsqukHlrfEKnl\n\t5FC5K3LvCayZsCsJ2l2ee14Nsme/zhhuRC8hltami8nqHOyuc2UJ7ohjvPRO+y1Q\n\tWNUn11Wo+nvJFKQjjPFeJajPXzW3g==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to:x-me-sender\n\t:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=ty7xz/2EcVwk7wfF7a\n\tfGfeJYgQqNwp03zaqB6E3RkCU=; b=EgN2DtrUcAGMZTnDwFpf3oDvsvXYIMaw0b\n\tH5sLEI3Kamd0cGHHm+43ILnNW8IPm1AKcXxgIvZrGZBNwfEPFuB1C03znc5agymQ\n\tGyWGGL4P9EXWGHtdbEmiWq/1XmWyERb9JHcc0bPgsjoipMrSm+Xy2KhxF+TICr0J\n\t+qZ1arPtOFz5gHD7AhhaYrvI/+fD+e3fvlT7gek9gPm6jLINIeK9g+szVYCWiurF\n\tOnJdUsnj/Adv5svfXJGGbuevlW+pm2s0lobV3Jc+mR+Vmx76tW2NjnYYqI646vuW\n\tIYBVR/2PP8/ViteBNIUXMo1iscQk3Jxfegtugx2qOYHXhtBSv1EQ=="],"X-ME-Sender":"<xms:mvzIWYAG_vW5Iw0Jfceniwnf5jSTqORDlwaVKLVJd5_8Ydx83Xq6kQ>","X-Sasl-enc":"xC8ran0TG/RCtaMYZVEV9qzKUurLqWYrYd37tXcwGORN 1506344089","Message-ID":"<1506344081.30138.32.camel@aj.id.au>","Subject":"Re: [PATCH v2 5/5] clk: aspeed: Add reset controller","From":"Andrew Jeffery <andrew@aj.id.au>","To":"Joel Stanley <joel@jms.id.au>, Lee Jones <lee.jones@linaro.org>, Michael\n\tTurquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@codeaurora.org>","Date":"Mon, 25 Sep 2017 22:24:41 +0930","In-Reply-To":"<20170921042641.7326-6-joel@jms.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-6-joel@jms.id.au>","X-Mailer":"Evolution 3.22.6-1ubuntu1 ","Mime-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170925_055511_218566_DA55A55A ","X-CRM114-Status":"GOOD (  14.88  )","X-Spam-Score":"-2.7 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow trust [66.111.4.25 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)\n\t[66.111.4.25 listed in wl.mailspike.net]\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's\n\tdomain -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tlinux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,\n\tJeremy Kerr <jk@ozlabs.org>, Rick Altherr <raltherr@google.com>,\n\tlinux-arm-kernel@lists.infradead.org","Content-Type":"multipart/mixed;\n\tboundary=\"===============8012155208382971731==\"","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1776046,"web_url":"http://patchwork.ozlabs.org/comment/1776046/","msgid":"<CACPK8XeQz=63PyEEC8947ppBa3UAJ0u5Na_oT6aHGk3OurKCJw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-27T06:11:15","subject":"Re: [PATCH v2 1/5] clk: Add clock driver for ASPEED BMC SoCs","submitter":{"id":48628,"url":"http://patchwork.ozlabs.org/api/people/48628/","name":"Joel Stanley","email":"joel@jms.id.au"},"content":"On Mon, Sep 25, 2017 at 1:40 PM, Andrew Jeffery <andrew@aj.id.au> wrote:\n\n>> +struct aspeed_clk_gate {\n>> +     struct clk_hw   hw;\n>> +     struct regmap   *map;\n>> +     u8              clock_idx;\n>> +     s8              reset_idx;\n>> +     u8              flags;\n>> +     spinlock_t      *lock;\n>> +};\n>\n> It feels like the two structures could be unified, but the result turns into a\n> bit of a mess with a union of structs to limit the space impact, so perhaps we\n> shouldn't go there?\n\nI agree; it's not going to make it any easier to read so lets leave it as is.\n\n>\n>> +\n>> +#define to_aspeed_clk_gate(_hw) container_of(_hw, struct aspeed_clk_gate, hw)\n>> +\n>> +/* TODO: ask Aspeed about the actual parent data */\n>> +static const struct aspeed_gate_data aspeed_gates[] __initconst = {\n>> +/*    clk rst   name                 parent          flags   */\n>> +     {  0, -1, \"eclk-gate\",          \"eclk\",         0 }, /* Video Engine */\n>> +     {  1,  7, \"gclk-gate\",          NULL,           0 }, /* 2D engine */\n>> +     {  2, -1, \"mclk-gate\",          \"mpll\",         CLK_IS_CRITICAL }, /* SDRAM */\n>> +     {  3,  6, \"vclk-gate\",          NULL,           0 }, /* Video Capture */\n>> +     {  4, 10, \"bclk-gate\",          \"bclk\",         0 }, /* PCIe/PCI */\n>> +     {  5, -1, \"dclk-gate\",          NULL,           0 }, /* DAC */\n>> +     {  6, -1, \"refclk-gate\",        \"clkin\",        CLK_IS_CRITICAL },\n>> +     {  7,  3, \"usb-port2-gate\",     NULL,           0 }, /* USB2.0 Host port 2 */\n>> +     {  8,  5, \"lclk-gate\",          NULL,           0 }, /* LPC */\n>> +     {  9, 15, \"usb-uhci-gate\",      NULL,           0 }, /* USB1.1 (requires port 2 enabled) */\n>> +     { 10, 13, \"d1clk-gate\",         NULL,           0 }, /* GFX CRT */\n>\n> Is there a typo in the AST2400 datasheet? It claims bit 10 is \"D2CLK\".\n\nThe ast2500 says d1clk, and the ast2400 says d2clk. Both call it the\nGFX CRT clock. Normally changes between the two are in a different\ncolour, but we don't have that here :(\n\nI'll ask Ryan if he knows what's going on.\n\n>\n>> +     /* 11: reserved */\n>> +     /* 12: reserved */\n>> +     { 13, 4,  \"yclk-gate\",          NULL,           0 }, /* HAC */\n>> +     { 14, 14, \"usb-port1-gate\",     NULL,           0 }, /* USB2 hub/USB2 host port 1/USB1.1 dev */\n>> +     { 15, -1, \"uart1clk-gate\",      \"uart\",         0 }, /* UART1 */\n>> +     { 16, -1, \"uart2clk-gate\",      \"uart\",         0 }, /* UART2 */\n>> +     { 17, -1, \"uart5clk-gate\",      \"uart\",         0 }, /* UART5 */\n>> +     /* 18: reserved */\n>> +     { 19, -1, \"espiclk-gate\",       NULL,           0 }, /* eSPI */\n>\n> 19 is reserved on the AST2400, and must be kept at '1'.\n\nYeah. This is another difference between the SoCs that isn't called\nout by the \"this has changed\" colouring of the datasheet.\n\nI'd suggest it's not worth adding the code to make the driver return\nan error when requesting this one. If anyone feels strongly about it\nwe could skip the registration of this one at probe time on the\nast2400.\n\n>\n>> +     { 20, 11, \"mac1clk-gate\",       \"clkin\",        0 }, /* MAC1 */\n>> +     { 21, 12, \"mac2clk-gate\",       \"clkin\",        0 }, /* MAC2 */\n>> +     /* 22: reserved */\n>> +     /* 23: reserved */\n>> +     { 24, -1, \"rsaclk-gate\",        NULL,           0 }, /* RSA */\n>> +     { 25, -1, \"uart3clk-gate\",      \"uart\",         0 }, /* UART3 */\n>> +     { 26, -1, \"uart4clk-gate\",      \"uart\",         0 }, /* UART4 */\n>> +     { 27, 16, \"sdclk-gate\",         NULL,           0 }, /* SDIO/SD */\n>> +     { 28, -1, \"lhclk-gate\",         \"lhclk\",        0 }, /* LPC master/LPC+ */\n>> +     /* 29: reserved */\n>> +     /* 30: reserved */\n>> +     /* 31: reserved */\n>\n> Interestingly bits 29-30 are reserved in both the AST2400 and AST2500\n> datasheets, but are reserved-clear in the AST2400 datasheet and reserved-set in\n> the AST2500 datasheet. This may affect how we write register.\n\nThe driver doesn't change the value, so I think we're safe.\n\n> Separately, at one point I mistook the clk column for the index the entry\n> should appear at, which isn't the case. Do you think designated intializers\n> might help?\n\nWill make the table a bit awkward, but it's a good suggestion. I'll\ngive it a go for v3.\n\n>> +     /*\n>> +      * This way all clock fetched before the platform device probes,\n>\n> Typo: \"clocks\"\n\nNice catch. It's a typo in the Gemini driver as well ;)\n\n>\n>> +      * except those we assign here for early use, will be deferred.\n>> +      */\n>> +     for (i = 0; i < ASPEED_NUM_CLKS; i++)\n>> +             aspeed_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER);\n\n>> +++ b/include/dt-bindings/clock/aspeed-clock.h\n>> @@ -0,0 +1,43 @@\n>> +#ifndef DT_BINDINGS_ASPEED_CLOCK_H\n>> +#define DT_BINDINGS_ASPEED_CLOCK_H\n>> +\n>> +#define ASPEED_NUM_CLKS      34\n>\n> This is a bit of a nit pick: Do the constants below represent all the\n> clocks in the SoC(s)? Maybe if not it's better to define\n> ASPEED_NUM_CLKS in terms of (n + ASPEED_CLK_GATES) at the bottom - that\n> way when a clock or gate is added ASPEED_NUM_CLKS has better locality and\n> better visual progression in context.\n\nOkay, I put it at the bottom.\n\n>> +#define ASPEED_CLK_GATE_LHCCLK               (23 + ASPEED_CLK_GATES)\n>\n> Looks like there's an off-by-one error here: ASPEED_NUM_CLKS should be (23 +\n> ASPEED_CLK_GATES + 1) = 35.\n\nThanks, fixed.","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"iszC+wbR\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"uTqZVnrU\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y26t42nnZz9sBW\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 16:12:12 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx5Zm-0001EH-5V; Wed, 27 Sep 2017 06:12:06 +0000","from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx5Zf-00014r-Qo for linux-arm-kernel@lists.infradead.org;\n\tWed, 27 Sep 2017 06:12:04 +0000","by mail-lf0-x234.google.com with SMTP id 80so6587065lfy.4\n\tfor <linux-arm-kernel@lists.infradead.org>;\n\tTue, 26 Sep 2017 23:11:37 -0700 (PDT)","by 10.25.103.82 with HTTP; Tue, 26 Sep 2017 23:11:15 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=/MoD8uXDtFFqhFMT+4XS9iWt3M9w90izEqmF8V6Wv0I=;\n\tb=iszC+wbRLaS/PQ\n\t5/9pMgU32prflARxLXBRc8GYvQMVNOrm3sf7y0vQQzIBL7CKOMT9clvg9+NSCk0HP3ytdPUtZCtxd\n\tfH/xmEjdhc17gSf4nvxtDDuaUgZQMZXON3YHcX7ZwACzAG/LokvaQkjUJ90rfG+HcQFgJkYwBQVrp\n\tdURjGpPDNzXb53KM3gLauFNCr9lv/jrkNzT1TIPaHDh7a8A+TDkyOWaca5L/nesWt6w59s9JvmEcc\n\t1qq3VLRN5R7L+Ne1qgQ38X6k06hiZ98liS8zCcwf0fmpqvHTEoCJO+JjrU8T4QDS95saQMWq0D9AJ\n\t6SkpxS/f6zdfo8mFkucw==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=icTHEQUu1lypSGhPmlPR6lFtzWRbkdtHnEpRsAPdS3U=;\n\tb=uTqZVnrUXuz+F6MWo2D+THfpM+HYNx59O7Ut3z1wyFEmTBgD5R8gOH2KHJMRPX9GXG\n\tWKSaIGUHbjZzeoHSD4jkUVGroxASmARZX2dnULcr2qiKFv6oRaxB0BUeytiUHo0pqrWA\n\tT2M+G67KiTy5auAXkSxN9QyoPmbNeFKejCyLhG/8ePjwo7nnxcsBlFQmTWqSZFgtW8EH\n\teGXp6HTOndM2xjTzJODZMdC0/QAb9YKfBmF73h1eKB0Zu2WLHY8GLfhA+QxNp073AnN0\n\tq3tMCCOVsGNdYQTDL0DhQfof7z8I+9PiXJBFCdrvFsVyOosfWi+FWbYr7fmqq30LDYq9\n\t4q1w=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=icTHEQUu1lypSGhPmlPR6lFtzWRbkdtHnEpRsAPdS3U=;\n\tb=LyK0UMuaHpR4n7/uMsnZQgMW6a1fqCFOie8C8LITD6dqU4l5+asZxL7dVxzlRgzaoG\n\tlLVmUKP0ihqwF6HJP8DxieohHOOQuovUSicnSql8sF3q2FTS6lW7sTkS3ISxsYLpoBWc\n\tOR+6QfMPYej75oUY+IhVcwxJqS89nzgYiK4FU/7eewQkSW/mUkrPElR8qSoDRnm/vpnj\n\thXqRS0rQ7/QMJAHwXE2Iwnmr6HaNhCvMc7Lv8tlf0uweJFoZ+IbmT0UHT0m7Ik/BzetD\n\tT99oH7rvAU93qRtgPDoHwaJYUJi+YXA4blWhwwPXXCvXhyc1n2Gcrkn+uRXJz65E/OFs\n\tpSuA==","X-Gm-Message-State":"AMCzsaViIU5sz8/BtR4/D0/TY7P0EqGRAPNDN5a3E7UBVDHVIZRk6Q8M\n\t7PdsVnay70GM6gNx2IlXCbr8F0SZ9sIyQZJZ2oQ=","X-Google-Smtp-Source":"AOwi7QCKZMlKDdWUuHm1TLAntaPON2LUQve+fsQZjbiPtl30OEXzHsnq/8gV1njRnddlaXqxzN3U0ulI8b8UpZRUIT0=","X-Received":"by 10.25.15.158 with SMTP id 30mr130184lfp.123.1506492695747;\n\tTue, 26 Sep 2017 23:11:35 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1506310811.30138.15.camel@aj.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-2-joel@jms.id.au>\n\t<1506310811.30138.15.camel@aj.id.au>","From":"Joel Stanley <joel@jms.id.au>","Date":"Wed, 27 Sep 2017 16:11:15 +1000","X-Google-Sender-Auth":"706Eo_-kPljD6vn9hlfyEVKqKZU","Message-ID":"<CACPK8XeQz=63PyEEC8947ppBa3UAJ0u5Na_oT6aHGk3OurKCJw@mail.gmail.com>","Subject":"Re: [PATCH v2 1/5] clk: Add clock driver for ASPEED BMC SoCs","To":"Andrew Jeffery <andrew@aj.id.au>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170926_231200_090088_63FD33BD ","X-CRM114-Status":"GOOD (  27.48  )","X-Spam-Score":"-2.4 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.4 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow\n\ttrust [2a00:1450:4010:c07:0:0:0:234 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (joel.stan[at]gmail.com)\n\t0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level\n\tmail domains are different\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and\n\tEnvelopeFrom freemail headers are different","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@codeaurora.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1776047,"web_url":"http://patchwork.ozlabs.org/comment/1776047/","msgid":"<CACPK8XcmwypP9HfjKKKYk55589Z0GGSa8mc=Uswzu6Dg01KwLA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-27T06:13:07","subject":"Re: [PATCH v2 2/5] clk: aspeed: Register core clocks","submitter":{"id":48628,"url":"http://patchwork.ozlabs.org/api/people/48628/","name":"Joel Stanley","email":"joel@jms.id.au"},"content":"On Mon, Sep 25, 2017 at 10:02 PM, Andrew Jeffery <andrew@aj.id.au> wrote:\n\n>> +static const struct clk_div_table ast2400_div_table[] = {\n>> +     { 0x0, 2 },\n>> +     { 0x1, 4 },\n>> +     { 0x2, 6 },\n>> +     { 0x3, 8 },\n>> +     { 0x4, 10 },\n>> +     { 0x5, 12 },\n>> +     { 0x6, 14 },\n>> +     { 0x7, 16 },\n>> +     { 0 }\n>> +};\n>> +\n>> +static const struct clk_div_table ast2500_div_table[] = {\n>> +     { 0x0, 4 },\n>> +     { 0x1, 8 },\n>> +     { 0x2, 12 },\n>> +     { 0x3, 16 },\n>> +     { 0x4, 20 },\n>> +     { 0x5, 24 },\n>> +     { 0x6, 28 },\n>> +     { 0x7, 32 },\n>> +     { 0 }\n>> +};\n>\n> ast2500_div_table is unused?\n\nIn this patch, yeah. It gets used in the next one. I defined it next\nto the ast2400_div_table so that it is clear why we need the separate\nones.\n\n>> +static void __init aspeed_ast2400_cc(struct regmap *map)\n>> +{\n>> +     struct clk_hw *hw;\n>> +     u32 val, div, mult;\n>> +\n>> +     /*\n>> +      * High-speed PLL clock derived from the crystal. This the CPU clock,\n>> +      * and we assume that it is enabled\n>> +      */\n>> +     regmap_read(map, ASPEED_HPLL_PARAM, &val);\n>> +     WARN(val & BIT(18), \"clock is strapped not configured\");\n>\n> I don't quite understand the intent of the warning - are we just trying to say\n> that the defaults have been assumed and they may not match reality? It's\n> probably not a great idea to not strap the board properly, but you could get\n> away with it for a given configuration (Numerator = 20, H-PLL Output Divider\n> set, H-PLL denominator = 1)\n\nThe vlaue of the PLL can be configured in two different ways; one is\nvia the strapping registers and the other is configured via the\nASPEED_HPLL_PARAM.\n\nI added this warning as the driver does not support reading the value\nof hpll from the strapping.\n\n>\n>> +     if (val & BIT(17)) {\n>> +             /* Pass through mode */\n>> +             mult = div = 1;\n>> +     } else {\n>> +             /* F = 24Mhz * (2-OD) * [(N + 2) / (D + 1)] */\n>> +             u32 n = (val >> 5) & 0x3f;\n>> +             u32 od = (val >> 4) & 0x1;\n>> +             u32 d = val & 0xf;\n>> +\n>> +             mult = (2 - od) * (n + 2);\n>> +             div = d + 1;\n>> +     }\n>> +     hw = clk_hw_register_fixed_factor(NULL, \"hpll\", \"clkin\", 0, mult, div);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_HPLL] = hw;\n>> +\n>> +     /*\n>> +      * Strap bits 11:10 define the CPU/AHB clock frequency ratio (aka HCLK)\n>> +      *   00: Select CPU:AHB = 1:1\n>> +      *   01: Select CPU:AHB = 2:1\n>> +      *   10: Select CPU:AHB = 4:1\n>> +      *   11: Select CPU:AHB = 3:1\n>> +      */\n>> +     regmap_read(map, ASPEED_STRAP, &val);\n>> +     val = (val >> 10) & 0x3;\n>\n> How do the calculations below line up with the comment above? I can't see the\n> connection and I feel like I've missed something.\n>\n\nThe code should read like this:\n\nif (div == 3)\n  div = 4;\nelse if (div == 3)\n  div = 4;\n\nFixed in v3.\n\n>\n>> +     hw = clk_hw_register_fixed_factor(NULL, \"ahb\", \"hpll\", 0, 1, div);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_AHB] = hw;\n>> +\n>> +     /* APB clock clock selection register SCU08 (aka PCLK) */\n>> +     hw = clk_hw_register_divider_table(NULL, \"apb\", \"hpll\", 0,\n>> +                     scu_base + ASPEED_CLK_SELECTION, 23, 3, 0,\n>> +                     ast2400_div_table,\n>> +                     &aspeed_clk_lock);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_APB] = hw;\n>> +}\n>> +\n>> +static void __init aspeed_ast2500_cc(struct regmap *map)\n>> +{\n>> +     struct clk_hw *hw;\n>> +     u32 val, div;\n>> +\n>> +     /*\n>> +      * High-speed PLL clock derived from the crystal. This the CPU clock,\n>> +      * and we assume that it is enabled\n>> +      */\n>> +     regmap_read(map, ASPEED_HPLL_PARAM, &val);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_HPLL] = aspeed_calc_pll(\"hpll\", val);\n>\n> Why did you extract the aspeed_calc_pll() implementation for the ast2500 but\n> not the ast2400?\n\nIt was used more than once for the ast2500, but only once for the\nast2400. That's changed it v3 so I broke it out again.\n\n>> +\n>> +     /* Strap bits 11:9 define the AXI/AHB clock frequency ratio (aka HCLK)*/\n>> +     regmap_read(map, ASPEED_STRAP, &val);\n>> +     val = (val >> 9) & 0x7;\n>> +     WARN_ON(val == 0);\n>\n> Maybe WARN() would be better here to explain what's going wrong (zero is an\n> undefined value)?\n\nDone.\n\n>\n>> +     div = 2 * (val + 1);\n>> +     hw = clk_hw_register_fixed_factor(NULL, \"ahb\", \"hpll\", 0, 1, div);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_AHB] = hw;\n>> +\n>> +     /* APB clock clock selection register SCU08 (aka PCLK) */\n>> +     /* TODO: this is wrong! */\n>\n> Why is this wrong?\n\nI think I must have been looking at the ast2400 data sheet and gotten\nconfused. It looks good to me. I removed the comment in v3.\n\n>\n>> +     regmap_read(map, ASPEED_CLK_SELECTION, &val);\n>> +     val = (val >> 23) & 0x7;\n>> +     div = 4 * (val + 1);\n>> +     hw = clk_hw_register_fixed_factor(NULL, \"apb\", \"hpll\", 0, 1, div);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_APB] = hw;\n>> +};\n>> +\n>> +\n>>  static void __init aspeed_cc_init(struct device_node *np)\n>>  {\n>>       struct regmap *map;\n>> +     unsigned long freq;\n>> +     struct clk_hw *hw;\n>>       u32 val;\n>>       int ret;\n>>       int i;\n>> @@ -153,6 +284,21 @@ static void __init aspeed_cc_init(struct device_node *np)\n>>               return;\n>>       }\n>>\n>> +     /* CLKIN is the crystal oscillator, 24 or 25MHz selected by strapping */\n>> +     if (val & BIT(23))\n>> +             freq = 25000000;\n>> +     else\n>> +             freq = 24000000;\n>\n> This isn't true on the AST2400, where CLKIN could be 24 OR 48MHz when BIT(23) is\n> clear. You need to test BIT(18) as well on the AST2400 to disambiguate.\n\nFixed. I moved the clkin calcs into the soc specific functions.\n\n>\n>> +     hw = clk_hw_register_fixed_rate(NULL, \"clkin\", NULL, 0, freq);\n>> +     pr_debug(\"clkin @%lu MHz\\n\", freq / 1000000);\n>> +\n>> +     if (of_device_is_compatible(np, \"aspeed,ast2400-scu\"))\n>> +             aspeed_ast2400_cc(map);\n>> +     else if (of_device_is_compatible(np, \"aspeed,ast2500-scu\"))\n>> +             aspeed_ast2500_cc(map);\n>> +     else\n>> +             pr_err(\"unknown platform, failed to add clocks\\n\");\n>\n> I'm not confident that \"borrowing\" the SCU compatible like this is entirely in\n> the spirit of its MFD nature, but maybe others can chime in.","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"Pgm46kZC\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"bqoWQRch\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y26w543L4z9sBW\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 16:13:57 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx5bV-0002Hf-CW; Wed, 27 Sep 2017 06:13:53 +0000","from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx5bR-0001tC-LT for linux-arm-kernel@lists.infradead.org;\n\tWed, 27 Sep 2017 06:13:51 +0000","by mail-lf0-x241.google.com with SMTP id h80so3772750lfe.1\n\tfor <linux-arm-kernel@lists.infradead.org>;\n\tTue, 26 Sep 2017 23:13:29 -0700 (PDT)","by 10.25.103.82 with HTTP; Tue, 26 Sep 2017 23:13:07 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=NcvM1uDbAv9jsEmU9Hln5BEPWauIaOpNrY7my0H8M5M=;\n\tb=Pgm46kZCGtPyjo\n\tVKheD/gR/VH9Sb/VGeKL2B29eUJB9buPUHgRfq8J1JxkIVi6vduvXRBSkdTpXAeD+4DrdkEDtJWYl\n\tMYnFjqTpmIMmZQmNzXz8VsAS3sjOuSkVy3DRaFCymKNFxgxgCmRx3ohsgDGYA8mv04vtAA0nvYEI6\n\tM6crOsuiVDUApWKRtbYbWdw1nzS0jCg5C5skvUrCzjjhVHRpkbuNQgbrqv0w+N5u08Vrs4af0qvJ2\n\tZt+6A8mBTb7R76auyds1k+WEhmFRyon1cGBu35ZqOPhPyz7EcL42u2mEj5hfiITmA6wgpOZISji7q\n\tjZVticyqGXNXSscOtpIw==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=nsfJ1WyiDpxChrMqg1RXY0bJTklViTJ0lFICb8w7e68=;\n\tb=bqoWQRchsud277Y3CRefdPy7OsHycx5YNCSdVUwodjC9durVnrihcnBBgyX7M2M5pj\n\tlCKUc05OOWXby3c26UTT36006zy0JkupQNlCTjT+2vU5C9CGR+KmuyqPorMD4dVwGDDV\n\tIACz4nGl7wHaQTazsO08a3CBoCvqlyyPRgxZAFH4JQ0i2R9KYt34ptNIv0Z7x68vRz2v\n\tr31hQU86ckrR1f3dQWnYykJ+3brZyM2Bc9PPAKFFgTFZvPoh8OKpNZjWg4qbJJ+WAC4B\n\tCmm2m6uaSTAjvxkOUL7nOiAdqWB1t+XAIjvv9c2H1HagTMPjJJNo/JEGI9wi0VK64MLF\n\ta1kA=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=nsfJ1WyiDpxChrMqg1RXY0bJTklViTJ0lFICb8w7e68=;\n\tb=CJrpZSZqqjjge75EHiDNBQwQkUvBQbb+hQQLDgazzdr6sqaLHbX+OsSq0o+fbquDH5\n\t2v8QLbCDCMxqWzF2RaRADjsR4hodNo8Fh5PXH9CugdZAa6Zb8IDSkyxraRbdUpXQImu4\n\tqileZ6eu9/JhU5QQr/WxUUdEwxq8bM4L5pAUVDuCwtcz6piIn9LiammSce7NR8o6k6O0\n\tupp/1oV2NVXJbAS72xCY1eXcAoHT9nUpRSiDT5zL8DH0o9HZo3AB1AetO/4NGvghDccV\n\tsL2IMaKiTEA5CEMg0/58BpMpBx1f9h5I9B3UfQjNXnoqwBTpi4sA5/stuvNTtdaXZDnD\n\tdleQ==","X-Gm-Message-State":"AMCzsaWEhbM1YPp1/Yfy15tVexVdpKcZAfOu6tPjFYTbo2u/kOJfHfVi\n\tLBGj0oKRT5YMMmmk/A0TUmeC18dysO5OebJ1XTU=","X-Google-Smtp-Source":"AOwi7QBBx2Al5auWDRbxU4/ZcS40GCfFE25ZxWvxDdQyKrTIjlkUVBI9gPTmCr2jNiB2fYP2qsVRY0lIql2tlnlfGKE=","X-Received":"by 10.25.100.18 with SMTP id y18mr128691lfb.257.1506492807528;\n\tTue, 26 Sep 2017 23:13:27 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1506340924.30138.26.camel@aj.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-3-joel@jms.id.au>\n\t<1506340924.30138.26.camel@aj.id.au>","From":"Joel Stanley <joel@jms.id.au>","Date":"Wed, 27 Sep 2017 16:13:07 +1000","X-Google-Sender-Auth":"glblfDvlXm2cJ08kVJqxmG_aKtQ","Message-ID":"<CACPK8XcmwypP9HfjKKKYk55589Z0GGSa8mc=Uswzu6Dg01KwLA@mail.gmail.com>","Subject":"Re: [PATCH v2 2/5] clk: aspeed: Register core clocks","To":"Andrew Jeffery <andrew@aj.id.au>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170926_231349_974284_E1B46CC5 ","X-CRM114-Status":"GOOD (  29.03  )","X-Spam-Score":"-1.7 (-)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-1.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (joel.stan[at]gmail.com)\n\t0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level\n\tmail domains are different\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and\n\tEnvelopeFrom freemail headers are different","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@codeaurora.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1776048,"web_url":"http://patchwork.ozlabs.org/comment/1776048/","msgid":"<CACPK8Xf6_hVgzakTYUrTND52fAeJrEi92Q+mdwOKjwACVLqN6Q@mail.gmail.com>","list_archive_url":null,"date":"2017-09-27T06:13:38","subject":"Re: [PATCH v2 5/5] clk: aspeed: Add reset controller","submitter":{"id":48628,"url":"http://patchwork.ozlabs.org/api/people/48628/","name":"Joel Stanley","email":"joel@jms.id.au"},"content":"On Mon, Sep 25, 2017 at 10:54 PM, Andrew Jeffery <andrew@aj.id.au> wrote:\n> On Thu, 2017-09-21 at 13:56 +0930, Joel Stanley wrote:\n>> +static const u8 aspeed_resets[] = {\n>> +     25, /* x-dma */\n>> +     24, /* mctp */\n>> +     23, /* adc */\n>> +     22, /* jtag-master */\n>> +     18, /* mic */\n>> +      9, /* pwm */\n>> +      8, /* pci-vga */\n>> +      2, /* i2c */\n>> +      1, /* ahb */\n>\n> Bit of a nit, but given you define macros for the indices, maybe use designated\n> initialisers and drop the comments.\n\nDone. And that way I'd notice that I missed the define for the ADC :)\n\nCheers,\n\nJoel","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"jTwP9tGu\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"pdsG1tY2\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y26x002dmz9s9Y\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 16:14:44 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx5cD-0002lu-9o; Wed, 27 Sep 2017 06:14:37 +0000","from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx5bx-0002OU-66 for linux-arm-kernel@lists.infradead.org;\n\tWed, 27 Sep 2017 06:14:23 +0000","by mail-lf0-x22d.google.com with SMTP id 23so2347751lfs.10\n\tfor <linux-arm-kernel@lists.infradead.org>;\n\tTue, 26 Sep 2017 23:14:00 -0700 (PDT)","by 10.25.103.82 with HTTP; Tue, 26 Sep 2017 23:13:38 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=5XRVPMRRcAVF+XEMh6GRPxPml/ph9UF/fJbT3B1x5Kk=;\n\tb=jTwP9tGuK/o/wz\n\t21QhnpNKUVpLzF7BRJ1uq1NEV8X0jEWDsZFJOgbuqZwobiu4VCIkpBusQVsDPLkzQUGHIDViiYCsQ\n\taVLmpq9skGRmvHuTs7EoxB1rDfQ5NzwjoSa2KigAUokna1f4SyBvDOFauNMmXt7auEE5V7YreiQqG\n\tREByhzNCR9mENmMT4aCj7X0XdUI+VbXdcB8xJ2cXgcLpuSmag7X1ndhdFuRQ7apm3QNRP3o9IBJd6\n\tc20iLZDR6LWG0GLG8kNJvWjiJl4UMv0TXYta4yUJmUKON2N+n3XPzQNTEymYXBFL4vw6mXKy5OmMw\n\tvr84kMvOpFUMMLGbVF0w==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=QqEwokxUOSZejqrRM1CrY1LRlcOtoLD5g+kyfzJr2VU=;\n\tb=pdsG1tY2zx2qEtVXoJnfgnTh/adQNk2v+KthDn1CcrlWzLAcfypYAclWRNriXfM/ew\n\t+0SuHpeU73TLDIJviatRmuL+enWubzthwlIBtPfiKoGL8D1p41+TIhjdnGbBYW9sRB0E\n\tt54jkJUMynCHXGiRfgZeFEVKkrL2nPFQCOteudhk7u975uqmy5Ut6kIxMRbU32/8gj5m\n\tpGWoPKk18SfcIQebpH65zcwi6xGjOG7e1ijpBfNjqHobtYR57JGbjDyZ+aSZGboPHBq3\n\t/eIX3vjhLpgtjSRfV8o4tzzEHY5KEQejiBXjSVkJW+xzYNlMqhdNETVx97x23IUTsHlW\n\tT9xw=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=QqEwokxUOSZejqrRM1CrY1LRlcOtoLD5g+kyfzJr2VU=;\n\tb=f5aEIrs1D4dNLrt6n5fq9s0FufD0XQR7KzCKcvH6vDH3YSE+UlI4w4MjOHuIWX3v2s\n\tvky4j6wi/f1kUdoLMpB2HCSrxMIThHKkSUlBuU5Tc6ve0DUiQJAFbMdodXxSJMEz1QdS\n\tawgb4isKNg6canijr4q2yAZgy4nq0EgYUj+KNjBrGlw7KjQBi/15dt1H8b38uwVX2oge\n\tZcguhn45KnAFcfvbp2oqubKLe4KdvGyScjC8IqpjjaXfjO0/ZUSDIAjb3IXPAaHd+YzK\n\tRVAQnoiXC8YN4TGUcyVkBIIdTlNuLkRkfwbbSyuBMBVtBLPHduQDt3+3+X6Axle0G3wU\n\tZ8bQ==","X-Gm-Message-State":"AMCzsaUwxiCRq1cwVVfqUoLXoztr8ceUjBz9IvfMEtoKojWHuhpX2JrI\n\tLnsw137WJBdwCkhls5Xa73Ynhkljf6vCQl1eQZ8=","X-Google-Smtp-Source":"AOwi7QCS2uxMVRu3Fe9Fh/gbrLbaUC4pIoSuHjHpDcIs07zWiI3BFGgpybolz68QOuEca7MBDv40Qvm1eGH3/dqrAkE=","X-Received":"by 10.25.143.27 with SMTP id r27mr130679lfd.85.1506492839116;\n\tTue, 26 Sep 2017 23:13:59 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1506344081.30138.32.camel@aj.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-6-joel@jms.id.au>\n\t<1506344081.30138.32.camel@aj.id.au>","From":"Joel Stanley <joel@jms.id.au>","Date":"Wed, 27 Sep 2017 16:13:38 +1000","X-Google-Sender-Auth":"UittVHzy3nxz2GyIy34gAhhB5Aw","Message-ID":"<CACPK8Xf6_hVgzakTYUrTND52fAeJrEi92Q+mdwOKjwACVLqN6Q@mail.gmail.com>","Subject":"Re: [PATCH v2 5/5] clk: aspeed: Add reset controller","To":"Andrew Jeffery <andrew@aj.id.au>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170926_231421_485014_0D190E1B ","X-CRM114-Status":"GOOD (  10.54  )","X-Spam-Score":"-2.4 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.4 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow\n\ttrust [2a00:1450:4010:c07:0:0:0:22d listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (joel.stan[at]gmail.com)\n\t0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level\n\tmail domains are different\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and\n\tEnvelopeFrom freemail headers are different","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@codeaurora.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1776051,"web_url":"http://patchwork.ozlabs.org/comment/1776051/","msgid":"<CACPK8Xd8RQ4s1xMsSuxHgQRiHS6vDtxVTAxu8Ba3J3it45MC5g@mail.gmail.com>","list_archive_url":null,"date":"2017-09-27T06:13:30","subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","submitter":{"id":48628,"url":"http://patchwork.ozlabs.org/api/people/48628/","name":"Joel Stanley","email":"joel@jms.id.au"},"content":"On Mon, Sep 25, 2017 at 10:40 PM, Andrew Jeffery <andrew@aj.id.au> wrote:\n> On Thu, 2017-09-21 at 13:56 +0930, Joel Stanley wrote:\n\n>> +     /*\n>> +      * Memory controller (M-PLL) PLL. This clock is configured by the\n>> +      * bootloader, and is exposed to Linux as a read-only clock rate.\n>> +      */\n>> +     regmap_read(map, ASPEED_MPLL_PARAM, &val);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_MPLL] = aspeed_calc_pll(\"mpll\", val);\n>\n> IIRC the calculation in aspeed_calc_pll() is appropriate for the AST2500, but\n> not the AST2400.\n\nAh ha. I knew there was a reason why I created an ast2400_calc_pll. I\nwill add it back in in the previous patch so we can use it here.\n\n>> +     /* Video Engine (ECLK) mux and clock divider */\n>> +     hw = clk_hw_register_mux(NULL, \"eclk_mux\",\n>> +                     eclk_parents, ARRAY_SIZE(eclk_parents), 0,\n>> +                     scu_base + ASPEED_CLK_SELECTION, 2, 2,\n>> +                     0, &aspeed_clk_lock);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_ECLK_MUX] = hw;\n>> +     hw = clk_hw_register_divider_table(NULL, \"eclk\", \"eclk_mux\", 0,\n>> +                     scu_base + ASPEED_CLK_SELECTION, 20, 3, 0,\n>\n> On the AST2500 it looks like this should start at bit 28 for 3 bits, not bit\n\nGood catch. Fixed in v3.\n\n> 20. Separately, I'm not sure how to interpret the AST2400 datasheet here -\n> maybe it's similar but with different wording (\"clock slow down\" rather than\n> \"divisor\"?).\n>\n>> +                     div_table,\n>\n> This doesn't seem to be correct. There's the problem of 0b000 and 0b001 mapping\n> the same value of 2 for the AST2500, whose table then increments in steps of 1.\n> The AST2400 mapping on the otherhand is multiples of 2 starting at 2, with no\n> inconsistency for 0b000 vs 0b001.\n\nYep, we do use a different table for ast2400 vs ast2500. See\nast2400_div_table vs ast2500_div_table.\n\n>\n>> +                     &aspeed_clk_lock);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_ECLK] = hw;\n>> +\n>> +     /* P-Bus (BCLK) clock divider */\n>> +     hw = clk_hw_register_divider_table(NULL, \"bclk\", \"hpll\", 0,\n>> +                     scu_base + ASPEED_CLK_SELECTION, 0, 2, 0,\n>\n> Bit 0 in SCU08 is a 1-bit field \"CPU/AHB clock dynamic slow down enable\". BCLK\n> is actually in SCU*D*8, but (perhaps confusingly) documented immediately below\n> SCU*0*8.\n\nGood catch. Fixed in v3.\n\nCheers,\n\nJoel","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"bWePY9dI\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"m5/fK6+f\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y271p5r4zz9sBW\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 16:18:54 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx5gC-0007nj-NC; Wed, 27 Sep 2017 06:18:44 +0000","from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx5bo-0002HL-Jk for linux-arm-kernel@lists.infradead.org;\n\tWed, 27 Sep 2017 06:14:14 +0000","by mail-lf0-x235.google.com with SMTP id b127so6587839lfe.9\n\tfor <linux-arm-kernel@lists.infradead.org>;\n\tTue, 26 Sep 2017 23:13:52 -0700 (PDT)","by 10.25.103.82 with HTTP; Tue, 26 Sep 2017 23:13:30 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=NVIvp/Srae0YEQfuuhAqeMeDum8M3nfX7TPG3FGs3rE=;\n\tb=bWePY9dI3plgYL\n\tzLzfVlZNgwjsdjMedVSerhlLRE1+POpZ7aF0p+bx3VU/a1tYrH3G/33xHONIUO4K4Aq/CG/Xqp0DY\n\tzvalCPbH5i3T5y2lTI/FoD/BABAJOo10JUw36Cdhajgm+OeRR0dK8GaLAOkSh1OMZkWAZnICxx++1\n\teT6sRCB2noNUs4+gyYUyVgO9jyhNmA0Sq/zGD4GLho1OjPdjtEtxW/UDxvfCVSdj+/8lqG/BaxZVd\n\thr+3Byrt406qBK5S4zUkv48IFj38eZZSaNv4D+0xpjD4hFcCFoZeSYe51Mb4v9QbQ4bsa1pyU53UW\n\taW9ZJ79HUNK55R2eNThQ==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=yZ+qmGs3O08lEHsPIdY4Nzco3Q3Jski26POUCumqAY4=;\n\tb=m5/fK6+fNv5Dj+/lR8N7ddY6dnFRJ5L0LIvKG7JcDVJnnIYBkDpwejGKqDIX+atH38\n\t1kfJc1fCyYeoeH04PulQb2LJo0IDmTSOW1yhNStDSNGewMFKSsmQFKNE2QEbuKRgHux6\n\tR+XkvHfcDOElQpOBRFuf/kXO6UJI511J0DZErzEk+YQ2tdEyIEOCPsAs+GI4XDm0Wj3G\n\tS3dzdBWGtlJs7udqe042iU5uua5U6ECDkwhCLBAL5J5/Xaon+GXWEl/iLv2nf9RCqEQb\n\tsNfiLp5RHelAFHevmWHJybOIZB/DFpPuOOfhggpna3yf3cNUwjaLAEDQiQBeV4kmEgGs\n\tHi2A=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=yZ+qmGs3O08lEHsPIdY4Nzco3Q3Jski26POUCumqAY4=;\n\tb=Ui4tfl0TXQJS3XZnuZgoXlLh2Ime2ijY1oG0fu6yqcAC52QuUnMZaZlpHIBAw8tDhU\n\taFGlWPuq6BkItxVB9n7nn5PcEbWroEugg65LNFXLW/oEwazLm7M5DDfDeWm0Dr0t1G81\n\tdKtH7y8mAcyCxMJWSZmE/ny5968rloJuDLhD/TI1bbjgEhHueXxQap3lutALvBr5LhSh\n\tJQxzATvac9OV2/1N46eV1z7xf/cYw9JYddIm03F/I26ew/zbojlyuUZcgQFqyFlF5Akc\n\tsC8p5jJ7tIn/UuJUeFNaKTDOkPirAGTiQyDwiUm3rdXCZnb4F7UpM6jebTfN7ssZfdL7\n\tatRA==","X-Gm-Message-State":"AMCzsaXrQSK7mRnNjcRDC9za5D1eEkxzP0odyHcDSUw7472uRh4UIFea\n\tdtj3GjIwsfAoBByO8PhZAc2HQT24CGaDbB6BhcM=","X-Google-Smtp-Source":"AOwi7QAzVutz/XhvDXojv2ITyazgUl0TSbWhKsx1BifEubqyzqm3os3hv7TbGoZFXmxMURCOT3IaTzZows+wXtsLcbM=","X-Received":"by 10.25.181.5 with SMTP id e5mr135859lff.42.1506492830605; Tue,\n\t26 Sep 2017 23:13:50 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1506343255.30138.29.camel@aj.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-4-joel@jms.id.au>\n\t<1506343255.30138.29.camel@aj.id.au>","From":"Joel Stanley <joel@jms.id.au>","Date":"Wed, 27 Sep 2017 16:13:30 +1000","X-Google-Sender-Auth":"PmDCdTvOZ1AXNdMnL_hpAC36Ejk","Message-ID":"<CACPK8Xd8RQ4s1xMsSuxHgQRiHS6vDtxVTAxu8Ba3J3it45MC5g@mail.gmail.com>","Subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","To":"Andrew Jeffery <andrew@aj.id.au>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170926_231412_899653_D44E5EDE ","X-CRM114-Status":"GOOD (  19.29  )","X-Spam-Score":"-2.4 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.4 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow\n\ttrust [2a00:1450:4010:c07:0:0:0:235 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (joel.stan[at]gmail.com)\n\t0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level\n\tmail domains are different\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and\n\tEnvelopeFrom freemail headers are different","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@codeaurora.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1776101,"web_url":"http://patchwork.ozlabs.org/comment/1776101/","msgid":"<1506497645.30138.37.camel@aj.id.au>","list_archive_url":null,"date":"2017-09-27T07:34:05","subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","submitter":{"id":68332,"url":"http://patchwork.ozlabs.org/api/people/68332/","name":"Andrew Jeffery","email":"andrew@aj.id.au"},"content":"On Wed, 2017-09-27 at 16:13 +1000, Joel Stanley wrote:\n> > > +                     div_table,\n> > \n> > This doesn't seem to be correct. There's the problem of 0b000 and 0b001 mapping\n> > the same value of 2 for the AST2500, whose table then increments in steps of 1.\n> > The AST2400 mapping on the otherhand is multiples of 2 starting at 2, with no\n> > inconsistency for 0b000 vs 0b001.\n> \n> Yep, we do use a different table for ast2400 vs ast2500. See\n> ast2400_div_table vs ast2500_div_table.\n\nYep, but for the AST2500 this is a different table again to what you've\nalready defined (for the AST2500). However, for the AST2400 the table\nlooks the same as the other AST2400 tables.\n\nCheers,\n\nAndrew","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"lInnPfCF\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=aj.id.au header.i=@aj.id.au header.b=\"boYOZ1iy\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com\n\theader.b=\"XFh9ZBun\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y291x3Yf9z9t4b\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 17:49:09 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx75a-00030D-6F; Wed, 27 Sep 2017 07:49:02 +0000","from out5-smtp.messagingengine.com ([66.111.4.29])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dx6rh-0007DW-5h for linux-arm-kernel@lists.infradead.org;\n\tWed, 27 Sep 2017 07:34:45 +0000","from compute4.internal (compute4.nyi.internal [10.202.2.44])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 33974213F2;\n\tWed, 27 Sep 2017 03:34:17 -0400 (EDT)","from frontend2 ([10.202.2.161])\n\tby compute4.internal (MEProxy); Wed, 27 Sep 2017 03:34:17 -0400","from keelia16 (unknown [203.0.153.9])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id A671024B26;\n\tWed, 27 Sep 2017 03:34:12 -0400 (EDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc:\n\tList-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:\n\tMime-Version:References:In-Reply-To:Date:To:From:Subject:Message-ID:Reply-To:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=BS4PSnM19wRb+mOsmrqKDjTHFh3o8Twwnk2qMbY+6+k=;\n\tb=lInnPfCFaMbXAEhy5TgRlvB4q\n\tocHSAyxdwlxC7qEKyMf6RjG6fddYKiyz4lQd1fwjcIGDMT0ngN+VmfYYqkLulB12uJefeLA/iarjC\n\tZByFVJ9ZdPxUHmSL8FGH0OMfYCrED/HyQAvbJrQakidnSfDzfSbwn314EgEq2zQBZqAqVH40sBWim\n\tfkh26tFW8l2XGyCz7/Sr6wUbXvfuUJfL6ERGm9KComy9+1f00DuvJwArntObDO6XoqVrErTk7Lb47\n\tr5bv3XQix1pcavz7zmvOax3sUAYp4UWBETlERj9+Y3sYJOuqemfXy+mGZ0wi47D+61GOTQ/Trc57I\n\tGeLu6rqjw==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=cc\n\t:content-type:date:from:in-reply-to:message-id:mime-version\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc\n\t:x-sasl-enc; s=fm1; bh=8hGE+khUN8NCMxHP6i+4rA+uPRO0vpjED+EFdfkzO\n\tIA=; b=boYOZ1iyLpR1a+Mnhy6f6NDj1rqZrZ1AwP6a16j0NSo0Eh+y0et6WaU/p\n\thnWPKqJIP8ymgiZrGm88ljmMOBZhiVKgg/eof35XYTKjlthDfPsvS9ehF3jX73BU\n\t9Q+VvekFxLasSmjs8/8bCZJ3G3nyvXUW0akbgD4UpJBN/LQPm1CgLhcx0kMizLgq\n\tsnabvDjSTTUNvunX0v7uEF10XynLYx+t6uhVPjaXxKa4bCXdUYjd+BH6i3q5zoOS\n\tdFbv0Xo1rua85oI/2CBeQHHbhQ1CjoETsYgDMc02smA2P1T8LrhZSHonfQYFB+pY\n\tDT8tR9BacDIGxR7FsxNlEE/Bh2smA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to:x-me-sender\n\t:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=8hGE+khUN8NCMxHP6i\n\t+4rA+uPRO0vpjED+EFdfkzOIA=; b=XFh9ZBunNFovr4FvKGSJMm1aT17tvVQElX\n\tkc53ALDM5ArNQT4To48LUBhimvMxAYAjiPsAM/X1kHsC2gsXFxI1ACVetXoT7oPm\n\tdyNL5MOtfte0zPZHwc6QAMdprJ/YVW9K8oV2BPZaptu1DWB7j9Ilfof6mqQ5Wr+Q\n\tGOgOIjknIfp25L5uoi2/vZI/GrBm+ohk5nX+/kNXUjb6h1ZlVe/QHjhCLgZQdEiS\n\tis3N73FrjjbZ7lLGdqlAf/pu5dkAqGNX2cI2tri32YyweDWh1Jr38vvxiGimIxJv\n\tHdB97XTPbErv+ljgeDe/PKdB52baVzg8WJuFGzo0rSxIxCX9MJpw=="],"X-ME-Sender":"<xms:eVTLWaZZ2sOjCr6hYRgovt-AEWPGafYdtKsY23WXJykr4qXo2gWiNQ>","X-Sasl-enc":"eI9ynhejBFK8yYf3uzucYUfcMkxu8fhnfRSGbrVuxCCx 1506497656","Message-ID":"<1506497645.30138.37.camel@aj.id.au>","Subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","From":"Andrew Jeffery <andrew@aj.id.au>","To":"Joel Stanley <joel@jms.id.au>","Date":"Wed, 27 Sep 2017 17:04:05 +0930","In-Reply-To":"<CACPK8Xd8RQ4s1xMsSuxHgQRiHS6vDtxVTAxu8Ba3J3it45MC5g@mail.gmail.com>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-4-joel@jms.id.au>\n\t<1506343255.30138.29.camel@aj.id.au>\n\t<CACPK8Xd8RQ4s1xMsSuxHgQRiHS6vDtxVTAxu8Ba3J3it45MC5g@mail.gmail.com>","X-Mailer":"Evolution 3.22.6-1ubuntu1 ","Mime-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170927_003442_205079_00D1650F ","X-CRM114-Status":"GOOD (  10.34  )","X-Spam-Score":"-2.7 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow trust [66.111.4.29 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@codeaurora.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"multipart/mixed;\n\tboundary=\"===============8925364692486899328==\"","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1776745,"web_url":"http://patchwork.ozlabs.org/comment/1776745/","msgid":"<CACPK8XeJE025GRT9kk9L1x1VsDGEmLG80G9LMM03vsvpHS+sYA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-28T04:29:22","subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","submitter":{"id":48628,"url":"http://patchwork.ozlabs.org/api/people/48628/","name":"Joel Stanley","email":"joel@jms.id.au"},"content":"On Wed, Sep 27, 2017 at 5:34 PM, Andrew Jeffery <andrew@aj.id.au> wrote:\n> On Wed, 2017-09-27 at 16:13 +1000, Joel Stanley wrote:\n>> > > +                     div_table,\n>> >\n>> > This doesn't seem to be correct. There's the problem of 0b000 and 0b001 mapping\n>> > the same value of 2 for the AST2500, whose table then increments in steps of 1.\n>> > The AST2400 mapping on the otherhand is multiples of 2 starting at 2, with no\n>> > inconsistency for 0b000 vs 0b001.\n>>\n>> Yep, we do use a different table for ast2400 vs ast2500. See\n>> ast2400_div_table vs ast2500_div_table.\n>\n> Yep, but for the AST2500 this is a different table again to what you've\n> already defined (for the AST2500). However, for the AST2400 the table\n> looks the same as the other AST2400 tables.\n\nYou're right. I didn't realise you were pointing out something strange\nabout eclk.\n\nI added another table for eclk, and the correct one is selected by the\nplatform data.\n\nI'll send out v4 today if no more reviews come in.","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"H/kCrQgN\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"luOyaWO4\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2hYz3fHJz9tXb\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 14:30:15 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dxQSg-0001jL-GR; Thu, 28 Sep 2017 04:30:10 +0000","from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dxQSc-0000Dg-Gr for linux-arm-kernel@lists.infradead.org;\n\tThu, 28 Sep 2017 04:30:08 +0000","by mail-wr0-x233.google.com with SMTP id g29so476810wrg.11\n\tfor <linux-arm-kernel@lists.infradead.org>;\n\tWed, 27 Sep 2017 21:29:44 -0700 (PDT)","by 10.25.103.82 with HTTP; Wed, 27 Sep 2017 21:29:22 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=XjPsKNSAhHtbY0Az1mBEJJQmem0b5LvabM5CuAoN7D0=;\n\tb=H/kCrQgN1GqhUZ\n\t5lbc8zRQRIMmcgTc7aimKLMclUT5u+Wa0MQaZ7ux/zDVV7t2xRLLjOpKEizmJYYtZZVH8Q4A0kgEY\n\tE/nk/+CC4Pm5gvIyX+gRUtb2WWuZDHnakidicH4UZu18ZlpF/jlU2YUSslw+27aDope4D9zQlck/N\n\tissT/ZLzqj3jUlF7kuXUf57Lkup4eAMuAggwsskx1UsOVHB0SIvZORHOrUScRtfRXac20NZPBdyAr\n\t5TnufdxKZZCcPxitd5XVVnUwqNRwNXJl88YHZNV+PVLywzszzhgg8rEFK7hXkkYIPCmWEm0bLckrw\n\tnLejDBnNMPKAAyCop27g==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=DbhXb7hxgXABoTr9MilrB1riw7k6a8gGFFMwyrtvgXw=;\n\tb=luOyaWO4rTlueJoovqX3XMWdeO3y3xRZld4KzFAN8I9rriW0XopVXBtxFsYQid7MgR\n\tQLhxJdX5GYDhjrpxKkrYRJvf9wqiCi/Sh9h0Y5zv5JXuK46VRRVisqwg1dxzkrAAGzIk\n\t4+0deXYEpbIVd4xX/ABZf6Nv1JylGwdC8zFr8uH7Oiv7aCS3QSsCrda1rK7oSEhw5zYL\n\t7SY5cDOV0apIcE8qtV6pIOu44lk2rxmaVjlyZW3LD3C1AnV59uLkZPL/SCn2ZJoHn1GD\n\tvPayR384qwU6BG49mGtwZgR/cBbNn1ipXLcc0e6jFe1lqKyNGtFOg6vpZaFjQyCCAVb6\n\t8eyw=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=DbhXb7hxgXABoTr9MilrB1riw7k6a8gGFFMwyrtvgXw=;\n\tb=hVqi6GiEHQL5F4N0lkDArkTJOZT+9ThfNR/RIppv8jfguMT/yc5qGxKNOxcnY7P53B\n\tSll9WV4jacOHy8Z8goJvgv1IcWQBYOtQOaPlelt0Dqm5ZkLSePJu4LP15cuZNYRKnfEe\n\t/8PgjTFM152Ea+Bi9YARhKfTGTmplhIO3w1HQ6zBVNJZLTag5/2WZf+LrfTqLLe7WM4C\n\tF6pGFjktOyiKO1kIamdODSN+Qat0ePePmApWpv8JVxpoTYbZ6kirkUBuR3CpGf3mVz8z\n\tpIgHKCaR+jMj/LI4d9jD8WYz5QAQHo1Cdz7pNlnohLRia5pPtbhcHkF9SsuYpUgQQlKy\n\tMHvw==","X-Gm-Message-State":"AMCzsaUlf6hA3ZyQx4jtpLJ/XrztpOBiS8FFqSC042OWuydRNk5gpMRg\n\tShmEc8XclrqBvFovFHxid87ssFNPNG6LmjLskSU=","X-Google-Smtp-Source":"AOwi7QBLiT7RW26THCzAbfmF8jpncyelT3NAmW7NvjNKX2Le5nfZJD5O6AJpByrjV9Ff1vyHlq3QIt+bC7oXoG4dswk=","X-Received":"by 10.25.78.153 with SMTP id u25mr1203608lfk.111.1506572982881; \n\tWed, 27 Sep 2017 21:29:42 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1506497645.30138.37.camel@aj.id.au>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-4-joel@jms.id.au>\n\t<1506343255.30138.29.camel@aj.id.au>\n\t<CACPK8Xd8RQ4s1xMsSuxHgQRiHS6vDtxVTAxu8Ba3J3it45MC5g@mail.gmail.com>\n\t<1506497645.30138.37.camel@aj.id.au>","From":"Joel Stanley <joel@jms.id.au>","Date":"Thu, 28 Sep 2017 14:29:22 +1000","X-Google-Sender-Auth":"5YVZSVpKTvjyb0o4ViDySH06rvc","Message-ID":"<CACPK8XeJE025GRT9kk9L1x1VsDGEmLG80G9LMM03vsvpHS+sYA@mail.gmail.com>","Subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","To":"Andrew Jeffery <andrew@aj.id.au>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170927_213006_732611_B15B78CD ","X-CRM114-Status":"GOOD (  16.15  )","X-Spam-Score":"-1.7 (-)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-1.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2a00:1450:400c:c0c:0:0:0:233 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (joel.stan[at]gmail.com)\n\t0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level\n\tmail domains are different\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and\n\tEnvelopeFrom freemail headers are different","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@codeaurora.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1778620,"web_url":"http://patchwork.ozlabs.org/comment/1778620/","msgid":"<20171002212435.GP457@codeaurora.org>","list_archive_url":null,"date":"2017-10-02T21:24:35","subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","submitter":{"id":6071,"url":"http://patchwork.ozlabs.org/api/people/6071/","name":"Stephen Boyd","email":"sboyd@codeaurora.org"},"content":"On 09/21, Joel Stanley wrote:\n> @@ -160,6 +191,104 @@ static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n>  \t\t\tmult, div);\n>  }\n>  \n> +static int __init aspeed_clk_probe(struct platform_device *pdev)\n\nDrop __init? Should be a section mismatch with __init here.\n\n> +{\n> +\tconst struct aspeed_clk_soc_data *soc_data;\n> +\tconst struct clk_div_table *mac_div_table;\n> +\tconst struct clk_div_table *div_table;\n> +\tstruct device *dev = &pdev->dev;\n> +\tstruct regmap *map;\n> +\tstruct clk_hw *hw;\n> +\tu32 val, rate;\n> +\n> +\tmap = syscon_node_to_regmap(dev->of_node);\n> +\tif (IS_ERR(map)) {\n> +\t\tdev_err(dev, \"no syscon regmap\\n\");\n> +\t\treturn PTR_ERR(map);\n> +\t}\n> +\n> +\t/* SoC generations share common layouts but have different divisors */\n> +\tsoc_data = of_device_get_match_data(&pdev->dev);\n\nCheck for soc_data being NULL.\n\n> +\tdiv_table = soc_data->div_table;\n> +\tmac_div_table = soc_data->mac_div_table;\n> +\n> +\t/* UART clock div13 setting */\n> +\tregmap_read(map, ASPEED_MISC_CTRL, &val);\n> +\tif (val & BIT(12))\n\nWhat does BIT(12) mean? #define or comment please.\n\n> +\t\trate = 24000000 / 13;\n> +\telse\n> +\t\trate = 24000000;\n> +\t/* TODO: Find the parent data for the uart clock */\n> +\thw = clk_hw_register_fixed_rate(NULL, \"uart\", NULL, 0, rate);\n> +\taspeed_clk_data->hws[ASPEED_CLK_UART] = hw;\n> +\n> +\t/*\n> +\t * Memory controller (M-PLL) PLL. This clock is configured by the\n> +\t * bootloader, and is exposed to Linux as a read-only clock rate.\n> +\t */\n> +\tregmap_read(map, ASPEED_MPLL_PARAM, &val);\n> +\taspeed_clk_data->hws[ASPEED_CLK_MPLL] =\taspeed_calc_pll(\"mpll\", val);\n> +\n> +\t/* SD/SDIO clock divider (TODO: There's a gate too) */\n> +\thw = clk_hw_register_divider_table(NULL, \"sdio\", \"hpll\", 0,\n\nPlease pass your dev pointer here from the platform device.\n\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 12, 3, 0,\n> +\t\t\tdiv_table,\n> +\t\t\t&aspeed_clk_lock);\n\nAnd check for errors? Perhaps use devm_clk_hw_regsiter() APIs and\nconstruct the dividers and muxes directly instead of using the\nbasic type registration APIs.\n\n> +\taspeed_clk_data->hws[ASPEED_CLK_SDIO] = hw;\n> +\n> +\t/* MAC AHB bus clock divider */\n> +\thw = clk_hw_register_divider_table(NULL, \"mac\", \"hpll\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 16, 3, 0,\n> +\t\t\tmac_div_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_MAC] = hw;\n> +\n> +\t/* LPC Host (LHCLK) clock divider */\n> +\thw = clk_hw_register_divider_table(NULL, \"lhclk\", \"hpll\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 20, 3, 0,\n> +\t\t\tdiv_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_LHCLK] = hw;\n> +\n> +\t/* Video Engine (ECLK) mux and clock divider */\n> +\thw = clk_hw_register_mux(NULL, \"eclk_mux\",\n> +\t\t\teclk_parents, ARRAY_SIZE(eclk_parents), 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 2, 2,\n> +\t\t\t0, &aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_ECLK_MUX] = hw;\n> +\thw = clk_hw_register_divider_table(NULL, \"eclk\", \"eclk_mux\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 20, 3, 0,\n> +\t\t\tdiv_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_ECLK] = hw;\n> +\n> +\t/* P-Bus (BCLK) clock divider */\n> +\thw = clk_hw_register_divider_table(NULL, \"bclk\", \"hpll\", 0,\n> +\t\t\tscu_base + ASPEED_CLK_SELECTION, 0, 2, 0,\n> +\t\t\tdiv_table,\n> +\t\t\t&aspeed_clk_lock);\n> +\taspeed_clk_data->hws[ASPEED_CLK_BCLK] = hw;\n> +\n> +\treturn 0;\n> +};\n> +\n> +static const struct of_device_id aspeed_clk_dt_ids[] = {\n> +\t{ .compatible = \"aspeed,ast2400-scu\", .data = &ast2400_data },\n> +\t{ .compatible = \"aspeed,ast2500-scu\", .data = &ast2500_data },\n> +\t{ },\n\n           ^\nNitpick, drop the comma\n\n> +};\n> +\n> +static struct platform_driver aspeed_clk_driver = {\n> +\t.probe  = aspeed_clk_probe,\n> +\t.driver = {\n> +\t\t.name = \"aspeed-clk\",\n> +\t\t.of_match_table = aspeed_clk_dt_ids,\n> +\t\t.suppress_bind_attrs = true,\n> +\t},\n> +};\n> +builtin_platform_driver(aspeed_clk_driver);\n> +\n> +\n\nKill a newline, save the internet.\n\n>  static void __init aspeed_ast2400_cc(struct regmap *map)\n>  {\n>  \tstruct clk_hw *hw;","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"Kr98zzcN\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=codeaurora.org header.i=@codeaurora.org\n\theader.b=\"Fq2VddLU\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n\theader.d=codeaurora.org header.i=@codeaurora.org header.b=\"Q0PntqSB\"; \n\tdkim-atps=neutral","pdx-caf-mail.web.codeaurora.org;\n\tdmarc=none (p=none dis=none) header.from=codeaurora.org","pdx-caf-mail.web.codeaurora.org;\n\tspf=none smtp.mailfrom=sboyd@codeaurora.org"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y5Zv45rc9z9t4X\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tTue,  3 Oct 2017 08:25:04 +1100 (AEDT)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dz8Cz-0008K6-JH; Mon, 02 Oct 2017 21:25:01 +0000","from smtp.codeaurora.org ([198.145.29.96])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dz8Cv-0008Gj-6Q for linux-arm-kernel@lists.infradead.org;\n\tMon, 02 Oct 2017 21:24:58 +0000","by smtp.codeaurora.org (Postfix, from userid 1000)\n\tid BCAFC6095F; Mon,  2 Oct 2017 21:24:36 +0000 (UTC)","from localhost (i-global254.qualcomm.com [199.106.103.254])\n\t(using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits))\n\t(No client certificate requested)\n\t(Authenticated sender: sboyd@smtp.codeaurora.org)\n\tby smtp.codeaurora.org (Postfix) with ESMTPSA id AAC23600D0;\n\tMon,  2 Oct 2017 21:24:35 +0000 (UTC)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:\n\tMessage-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=lDHRiyVq45LCm7TS4/fZdvH+cC5qCpDofPzO+7zFn24=;\n\tb=Kr98zzcNluEYu4\n\tkMPyQYjg6KH/FL8w7YS1ggxUqXf9Ztz41tSHdUhUatqTMbkIjBn61GouRcCldnCXeipspE2+3s70R\n\tm1G0KvRvEK+vmgTB34flaXkm5EeTaoGzs6pb0Z/6KgLA4W9dEOL0hTxEUwttkluBpSnYfOl3dkDs9\n\t6YGfGTAVkr520kDdSlIpnYN2AwhMSYzcLosegQC3G7R1hcgi890iDlVCTXnuSUSJhmgE9FY0SCeF2\n\t1xrHwaRmN+9Yn5uypkv71buR+aoNZLk5Ws+ikXzv/i06J+LxFs+wxgnZ6t6IU2tBHlXeaHy4PHRui\n\tzrrz0SkE77FUAI3t/zTg==;","v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1506979476;\n\tbh=MR9KkDsq4PEekl4T7y86XvF6U6lLv9YNlKVrud4z2vU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Fq2VddLUiNi/Yj1yoVTNfVmI+iY8FuR2ZAawmusyC45H//4eTwH7bsS6mwYHLZv0u\n\t0q7JEO6Z5eKfJ8Alhud4ft38jwFKrmBCmOew370hQJaWzqVKcwTzyiDMmH8ibBx7V4\n\tNvYYZpKmRi9wVcX0ov+rxZKx1t/HmCPfubCwvbcg=","v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1506979475;\n\tbh=MR9KkDsq4PEekl4T7y86XvF6U6lLv9YNlKVrud4z2vU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Q0PntqSBFvliPUDvL7gp6bpfNfcP4SMYL6wk6+LknqTmlMEJps1w3L+dfSolN2sFo\n\tuIP2Y9JzNSyfqO46z9CllwB/hod5XvlFch2/46VcUmlNVrtucAMVJSURjGi4XDda5u\n\tQewwyt/YYrG27Frfc8UvtytjHZo0O/MnY7krLBkU="],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tpdx-caf-mail.web.codeaurora.org","X-Spam-Level":"","X-Spam-Status":"No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00,\n\tDKIM_SIGNED,\n\tT_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0","DMARC-Filter":"OpenDMARC Filter v1.3.2 smtp.codeaurora.org AAC23600D0","Date":"Mon, 2 Oct 2017 14:24:35 -0700","From":"Stephen Boyd <sboyd@codeaurora.org>","To":"Joel Stanley <joel@jms.id.au>","Subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","Message-ID":"<20171002212435.GP457@codeaurora.org>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-4-joel@jms.id.au>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20170921042641.7326-4-joel@jms.id.au>","User-Agent":"Mutt/1.5.21 (2010-09-15)","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171002_142457_287644_B2482BF9 ","X-CRM114-Status":"GOOD (  16.68  )","X-Spam-Score":"-4.3 (----)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-4.3 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [198.145.29.96 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tAndrew Jeffery <andrew@aj.id.au>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tlinux-kernel@vger.kernel.org, \n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1778624,"web_url":"http://patchwork.ozlabs.org/comment/1778624/","msgid":"<20171002213742.GQ457@codeaurora.org>","list_archive_url":null,"date":"2017-10-02T21:37:42","subject":"Re: [PATCH v2 4/5] clk: aspeed: Register gated clocks","submitter":{"id":6071,"url":"http://patchwork.ozlabs.org/api/people/6071/","name":"Stephen Boyd","email":"sboyd@codeaurora.org"},"content":"On 09/21, Joel Stanley wrote:\n> The majority of the clocks in the system are gates paired with a reset\n> controller that holds the IP in reset.\n> \n> This borrows from clk_hw_register_gate, but registers two 'gates', one\n> to control the clock enable register and the other to control the reset\n> IP. This allows us to enforce the ordering:\n> \n>  1. Place IP in reset\n>  2. Enable clock\n>  3. Delay\n>  4. Release reset\n> \n> There are some gates that do not have an associated reset; these are\n> handled by using -1 as the index for the reset.\n\nHalf of these aren't clks, but reset bits? Perhaps you should\nregister power domains for these things and then have the power\ndomain assert the reset, enable the clock, delay, and then\nrelease the reset in the poweron callback. Then device drivers\ndon't have to be aware of the ordering, and you can keep\nenforcing the ordering in one place, but we don't have to make\nfake gates and shoehorn the sequence into the clk framework.\n\n> \n> Signed-off-by: Joel Stanley <joel@jms.id.au>\n> ---\n>  drivers/clk/clk-aspeed.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 128 insertions(+)\n> \n> diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c\n> index 19531798e040..dec9db4ec47b 100644\n> --- a/drivers/clk/clk-aspeed.c\n> +++ b/drivers/clk/clk-aspeed.c\n> @@ -191,6 +191,108 @@ static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n>  \t\t\tmult, div);\n>  }\n>  \n> +static int aspeed_clk_enable(struct clk_hw *hw)\n> +{\n> +\tstruct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw);\n> +\tunsigned long flags;\n> +\tu32 clk = BIT(gate->clock_idx);\n> +\tu32 rst = BIT(gate->reset_idx);\n> +\n> +\tspin_lock_irqsave(gate->lock, flags);\n> +\n> +\tif (gate->reset_idx >= 0) {\n> +\t\t/* Put IP in reset */\n> +\t\tregmap_update_bits(gate->map, ASPEED_RESET_CTRL, rst, rst);\n> +\n> +\t\t/* Delay 100us */\n> +\t\tudelay(100);\n> +\t}\n> +\n> +\t/* Enable clock */\n> +\tregmap_update_bits(gate->map, ASPEED_CLK_STOP_CTRL, clk, 0);\n> +\n> +\tif (gate->reset_idx >= 0) {\n> +\t\t/* Delay 10ms */\n> +\t\t/* TODO: can we sleep here? */\n> +\t\tmsleep(10);\n> +\n> +\t\t/* Take IP out of reset */\n> +\t\tregmap_update_bits(gate->map, ASPEED_RESET_CTRL, rst, 0);\n> +\t}\n> +\n> +\tspin_unlock_irqrestore(gate->lock, flags);\n> +\n> +\treturn 0;\n> +}\n> +\n> +static void aspeed_clk_disable(struct clk_hw *hw)\n> +{\n> +\tstruct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw);\n> +\tunsigned long flags;\n> +\tu32 clk = BIT(gate->clock_idx);\n> +\n> +\tspin_lock_irqsave(gate->lock, flags);\n> +\n> +\t/* Disable clock */\n\nDrop useless comment please.\n\n> +\tregmap_update_bits(gate->map, ASPEED_CLK_STOP_CTRL, clk, clk);\n> +\n> +\tspin_unlock_irqrestore(gate->lock, flags);\n> +}\n> +\n> +static int aspeed_clk_is_enabled(struct clk_hw *hw)\n> +{\n> +\tstruct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw);\n> +\tu32 clk = BIT(gate->clock_idx);\n> +\tu32 reg;\n> +\n> +\tregmap_read(gate->map, ASPEED_CLK_STOP_CTRL, &reg);\n> +\n> +\treturn (reg & clk) ? 0 : 1;\n> +}\n> +\n> +static const struct clk_ops aspeed_clk_gate_ops = {\n> +\t.enable = aspeed_clk_enable,\n> +\t.disable = aspeed_clk_disable,\n> +\t.is_enabled = aspeed_clk_is_enabled,\n> +};\n> +\n> +static struct clk_hw *aspeed_clk_hw_register_gate(struct device *dev,\n> +\t\tconst char *name, const char *parent_name, unsigned long flags,\n> +\t\tstruct regmap *map, u8 clock_idx, u8 reset_idx,\n> +\t\tu8 clk_gate_flags, spinlock_t *lock)\n> +{\n> +\tstruct aspeed_clk_gate *gate;\n> +\tstruct clk_init_data init;\n> +\tstruct clk_hw *hw;\n> +\tint ret;\n> +\n> +\tgate = kzalloc(sizeof(*gate), GFP_KERNEL);\n> +\tif (!gate)\n> +\t\treturn ERR_PTR(-ENOMEM);\n> +\n> +\tinit.name = name;\n> +\tinit.ops = &aspeed_clk_gate_ops;\n> +\tinit.flags = flags | CLK_IS_BASIC;\n\nPlease drop CLK_IS_BASIC.\n\n> +\tinit.parent_names = parent_name ? &parent_name : NULL;\n> +\tinit.num_parents = parent_name ? 1 : 0;\n> +\n> +\tgate->map = map;\n> +\tgate->clock_idx = clock_idx;\n> +\tgate->reset_idx = reset_idx;\n> +\tgate->flags = clk_gate_flags;\n> +\tgate->lock = lock;\n> +\tgate->hw.init = &init;\n> +\n> +\thw = &gate->hw;\n> +\tret = clk_hw_register(dev, hw);\n> +\tif (ret) {\n> +\t\tkfree(gate);\n> +\t\thw = ERR_PTR(ret);\n> +\t}\n> +\n> +\treturn hw;\n> +}\n> +\n>  static int __init aspeed_clk_probe(struct platform_device *pdev)\n>  {\n>  \tconst struct aspeed_clk_soc_data *soc_data;\n> @@ -200,6 +302,7 @@ static int __init aspeed_clk_probe(struct platform_device *pdev)\n>  \tstruct regmap *map;\n>  \tstruct clk_hw *hw;\n>  \tu32 val, rate;\n> +\tint i;\n>  \n>  \tmap = syscon_node_to_regmap(dev->of_node);\n>  \tif (IS_ERR(map)) {\n> @@ -269,6 +372,31 @@ static int __init aspeed_clk_probe(struct platform_device *pdev)\n>  \t\t\t&aspeed_clk_lock);\n>  \taspeed_clk_data->hws[ASPEED_CLK_BCLK] = hw;\n>  \n> +\t/* There are a number of clocks that not included in this driver as\n\nNeeds a /* before comment text starts. Also, TODO?\n\n> +\t * more information is required:\n> +\t *   D2-PLL\n> +\t *   D-PLL\n> +\t *   YCLK\n> +\t *   RGMII\n> +\t *   RMII\n> +\t *   UART[1..5] clock source mux\n> +\t */\n> +\n> +\tfor (i = 0; i < ARRAY_SIZE(aspeed_gates); i++) {\n> +\t\tconst struct aspeed_gate_data *gd;\n> +\n> +\t\tgd = &aspeed_gates[i];\n> +\t\taspeed_clk_data->hws[ASPEED_CLK_GATES + i] =\n> +\t\t\taspeed_clk_hw_register_gate(NULL, gd->name,\n\nPass device?\n\n> +\t\t\t\t\t     gd->parent_name,\n> +\t\t\t\t\t     gd->flags,\n> +\t\t\t\t\t     map,\n> +\t\t\t\t\t     gd->clock_idx,\n> +\t\t\t\t\t     gd->reset_idx,\n> +\t\t\t\t\t     CLK_GATE_SET_TO_DISABLE,\n> +\t\t\t\t\t     &aspeed_clk_lock);","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"RF/dlgv3\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=codeaurora.org header.i=@codeaurora.org\n\theader.b=\"fhN71IIP\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n\theader.d=codeaurora.org header.i=@codeaurora.org header.b=\"gYsw66Gf\"; \n\tdkim-atps=neutral","pdx-caf-mail.web.codeaurora.org;\n\tdmarc=none (p=none dis=none) header.from=codeaurora.org","pdx-caf-mail.web.codeaurora.org;\n\tspf=none smtp.mailfrom=sboyd@codeaurora.org"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y5bBJ09Qqz9t4X\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tTue,  3 Oct 2017 08:38:16 +1100 (AEDT)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dz8Pi-0006MJ-Gs; Mon, 02 Oct 2017 21:38:10 +0000","from smtp.codeaurora.org ([198.145.29.96])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dz8Pd-0006Ge-Ry for linux-arm-kernel@lists.infradead.org;\n\tMon, 02 Oct 2017 21:38:07 +0000","by smtp.codeaurora.org (Postfix, from userid 1000)\n\tid 357EB60AFB; Mon,  2 Oct 2017 21:37:45 +0000 (UTC)","from localhost (i-global254.qualcomm.com [199.106.103.254])\n\t(using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits))\n\t(No client certificate requested)\n\t(Authenticated sender: sboyd@smtp.codeaurora.org)\n\tby smtp.codeaurora.org (Postfix) with ESMTPSA id 58E7460227;\n\tMon,  2 Oct 2017 21:37:43 +0000 (UTC)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:\n\tMessage-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=VQ9j2KHwq4RKdJr3c/0+0exYF0JQymbAIrFD/9UatZQ=;\n\tb=RF/dlgv391+Apv\n\t+lTjjY8Sp8DnPas3MXlRVm+fx+2v0vM0AsuFazZPg2xviR9oKkbnhqoUh+mMh35hfF1bSHVZOTtol\n\t2lJQ2n3uHTu1lU+KAsnobEBZrv+8tyRcmz5pvLQ3Al69bBf3LVlVGPlf7/ViBRF34yphkLruij8Zo\n\tI0+Wd3wn3JAC0BxO4itmK16j6H0zJKfSRv8wcgtRgXdkJ7S6Yiib5+3SipIK7gOFL3J1F+Pzn7eQp\n\te2yBWwdhBPqTM8nITInpuRhkYffwu37HPDYVpOEo0dZFoiRcbI0iDg0YYGdbAUYQuAbrpF7D/MqKd\n\tQwnE6MfvsrpZLr2Yoc4w==;","v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1506980265;\n\tbh=EG96ZGUYSHoHODE5Yc1h3K6iyONYmpWzUHZT+46Ohyc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fhN71IIPijY1YHcMriaGG7oSV0xsN6w4WcYi4f1Xn6oiGloc7gsdiV9CukjLPKb4b\n\t5OGbIXy2HYple+7uj2AomtOpvCRxUX6fNxcDRrQQVoyzpm/HE5uq44QwFSyLX50Nj6\n\tIgAHofGhRSPprkyeqD+pk9R1uZeaCp4vnIIISoTU=","v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1506980263;\n\tbh=EG96ZGUYSHoHODE5Yc1h3K6iyONYmpWzUHZT+46Ohyc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=gYsw66GfxP/cuCUOWn2tO9qioA+mKVx7xW7IdmrBbXZoggiK8hGUw1bxxXJv3iQMG\n\tTV4Yi97Vmx3wELnaeI/tEk8D/+5N+1JyIz3owDbX/5AfYbk0dTTMZbETs5QjTB8UhZ\n\tQDNClG2GslPI5DEahIEnKwERfnzPVcjkrGhNPzCs="],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tpdx-caf-mail.web.codeaurora.org","X-Spam-Level":"","X-Spam-Status":"No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00,\n\tDKIM_SIGNED,\n\tT_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0","DMARC-Filter":"OpenDMARC Filter v1.3.2 smtp.codeaurora.org 58E7460227","Date":"Mon, 2 Oct 2017 14:37:42 -0700","From":"Stephen Boyd <sboyd@codeaurora.org>","To":"Joel Stanley <joel@jms.id.au>","Subject":"Re: [PATCH v2 4/5] clk: aspeed: Register gated clocks","Message-ID":"<20171002213742.GQ457@codeaurora.org>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-5-joel@jms.id.au>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20170921042641.7326-5-joel@jms.id.au>","User-Agent":"Mutt/1.5.21 (2010-09-15)","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171002_143805_986277_BDB4FB2A ","X-CRM114-Status":"GOOD (  24.50  )","X-Spam-Score":"-4.3 (----)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-4.3 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [198.145.29.96 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tAndrew Jeffery <andrew@aj.id.au>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tlinux-kernel@vger.kernel.org, \n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1778625,"web_url":"http://patchwork.ozlabs.org/comment/1778625/","msgid":"<20171002213958.GR457@codeaurora.org>","list_archive_url":null,"date":"2017-10-02T21:39:58","subject":"Re: [PATCH v2 2/5] clk: aspeed: Register core clocks","submitter":{"id":6071,"url":"http://patchwork.ozlabs.org/api/people/6071/","name":"Stephen Boyd","email":"sboyd@codeaurora.org"},"content":"On 09/21, Joel Stanley wrote:\n> @@ -112,9 +115,137 @@ static const struct aspeed_gate_data aspeed_gates[] __initconst = {\n>  \t/* 31: reserved */\n>  };\n>  \n> +static const struct clk_div_table ast2400_div_table[] = {\n> +\t{ 0x0, 2 },\n> +\t{ 0x1, 4 },\n> +\t{ 0x2, 6 },\n> +\t{ 0x3, 8 },\n> +\t{ 0x4, 10 },\n> +\t{ 0x5, 12 },\n> +\t{ 0x6, 14 },\n> +\t{ 0x7, 16 },\n> +\t{ 0 }\n> +};\n> +\n> +static const struct clk_div_table ast2500_div_table[] = {\n> +\t{ 0x0, 4 },\n> +\t{ 0x1, 8 },\n> +\t{ 0x2, 12 },\n> +\t{ 0x3, 16 },\n> +\t{ 0x4, 20 },\n> +\t{ 0x5, 24 },\n> +\t{ 0x6, 28 },\n> +\t{ 0x7, 32 },\n> +\t{ 0 }\n> +};\n> +\n> +static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n> +{\n> +\tunsigned int mult, div;\n> +\n> +\tif (val & BIT(20)) {\n\n#define for these BIT() things please. Or a comment, but #define\nis probably better. Just improves readability.","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"kV80GcAm\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=codeaurora.org header.i=@codeaurora.org\n\theader.b=\"iEi3UMZY\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n\theader.d=codeaurora.org header.i=@codeaurora.org header.b=\"iEi3UMZY\"; \n\tdkim-atps=neutral","pdx-caf-mail.web.codeaurora.org;\n\tdmarc=none (p=none dis=none) header.from=codeaurora.org","pdx-caf-mail.web.codeaurora.org;\n\tspf=none smtp.mailfrom=sboyd@codeaurora.org"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y5bF25BJFz9t4X\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tTue,  3 Oct 2017 08:40:38 +1100 (AEDT)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dz8Rr-0008I0-Dm; Mon, 02 Oct 2017 21:40:23 +0000","from smtp.codeaurora.org ([198.145.29.96])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dz8Rn-00073H-VV for linux-arm-kernel@lists.infradead.org;\n\tMon, 02 Oct 2017 21:40:21 +0000","by smtp.codeaurora.org (Postfix, from userid 1000)\n\tid 9D34D60715; Mon,  2 Oct 2017 21:39:59 +0000 (UTC)","from localhost (i-global254.qualcomm.com [199.106.103.254])\n\t(using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits))\n\t(No client certificate requested)\n\t(Authenticated sender: sboyd@smtp.codeaurora.org)\n\tby smtp.codeaurora.org (Postfix) with ESMTPSA id 3092360227;\n\tMon,  2 Oct 2017 21:39:59 +0000 (UTC)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:\n\tMessage-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=Ep4VPHsoRXdbfBmWD4Dkf+UqU4/ZbKEOMfs/loiBsxs=;\n\tb=kV80GcAmv65dG1\n\tfCLeQB+rCAkWy9oULxfeaz+mu7YcXpeOHcYd2g2uhjOacJ+ix7/V+OhelE39d0o7ByD+C/tNIWhoR\n\tw1VAc45bzQVxQebrXz6ckP/tar1wsqN8cNUAFAQR1GlY2L0tc4GlS+1AURpHwPMqEVnOxaHspftwi\n\tJB7bJWRxau9m9uFvW74oa/SiLZaqumC1VvrQSfuXwOrjAtuy/erO65poy9DoHcq8ZuluMi99DMpy+\n\teUU/pxJ4LXGeDKnwXgATpG2UmJYxd0pdrQqDwSmcdV5hifl87Qt2pxgBEUd+PsJJXD270pzNf889W\n\tvqgUJSd4SbZZebdAQF1g==;","v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1506980399;\n\tbh=q8NotybQD7KuCRlfbx7kYrUEpRsAfS/xiZ97TMHL/sQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=iEi3UMZYswwaUPZU3aemiY/bBeVc/RVFn7Sn+dHENx2CRix0+jFn5M52ggaLGXzUy\n\tgLB8wve6trc3rAh1OBlUMPGKZVuligDkw6SnFs1+9icMQZrb4if5wzUHhROG/jMJFW\n\t/Ga5D9Z2ycktbUWqG8y5YNHhCnwpWf88Pje7rDYw=","v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1506980399;\n\tbh=q8NotybQD7KuCRlfbx7kYrUEpRsAfS/xiZ97TMHL/sQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=iEi3UMZYswwaUPZU3aemiY/bBeVc/RVFn7Sn+dHENx2CRix0+jFn5M52ggaLGXzUy\n\tgLB8wve6trc3rAh1OBlUMPGKZVuligDkw6SnFs1+9icMQZrb4if5wzUHhROG/jMJFW\n\t/Ga5D9Z2ycktbUWqG8y5YNHhCnwpWf88Pje7rDYw="],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tpdx-caf-mail.web.codeaurora.org","X-Spam-Level":"","X-Spam-Status":"No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00,\n\tDKIM_SIGNED,\n\tT_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0","DMARC-Filter":"OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3092360227","Date":"Mon, 2 Oct 2017 14:39:58 -0700","From":"Stephen Boyd <sboyd@codeaurora.org>","To":"Joel Stanley <joel@jms.id.au>","Subject":"Re: [PATCH v2 2/5] clk: aspeed: Register core clocks","Message-ID":"<20171002213958.GR457@codeaurora.org>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-3-joel@jms.id.au>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20170921042641.7326-3-joel@jms.id.au>","User-Agent":"Mutt/1.5.21 (2010-09-15)","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171002_144020_044319_9C059FAE ","X-CRM114-Status":"GOOD (  11.90  )","X-Spam-Score":"-4.3 (----)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-4.3 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [198.145.29.96 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tAndrew Jeffery <andrew@aj.id.au>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tlinux-kernel@vger.kernel.org, \n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1778734,"web_url":"http://patchwork.ozlabs.org/comment/1778734/","msgid":"<CACPK8XdrqmBC8M+=NDUVhYKPafw-Qc8fRikV+xJ84FyzG6BfxQ@mail.gmail.com>","list_archive_url":null,"date":"2017-10-03T05:47:17","subject":"Re: [PATCH v2 4/5] clk: aspeed: Register gated clocks","submitter":{"id":48628,"url":"http://patchwork.ozlabs.org/api/people/48628/","name":"Joel Stanley","email":"joel@jms.id.au"},"content":"On Tue, Oct 3, 2017 at 7:07 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:\n> On 09/21, Joel Stanley wrote:\n>> The majority of the clocks in the system are gates paired with a reset\n>> controller that holds the IP in reset.\n>>\n>> This borrows from clk_hw_register_gate, but registers two 'gates', one\n>> to control the clock enable register and the other to control the reset\n>> IP. This allows us to enforce the ordering:\n>>\n>>  1. Place IP in reset\n>>  2. Enable clock\n>>  3. Delay\n>>  4. Release reset\n>>\n>> There are some gates that do not have an associated reset; these are\n>> handled by using -1 as the index for the reset.\n>\n> Half of these aren't clks, but reset bits? Perhaps you should\n> register power domains for these things and then have the power\n> domain assert the reset, enable the clock, delay, and then\n> release the reset in the poweron callback. Then device drivers\n> don't have to be aware of the ordering, and you can keep\n> enforcing the ordering in one place, but we don't have to make\n> fake gates and shoehorn the sequence into the clk framework.\n\nI had a look. We've got 24 gates being registered, and half are just\ngate+reset pairs, while the other half are both. Some of them have\nclocks with divisors upstream of the gate, so in those cases we do\ncare what the rate is. For the others they are simply bringing the IP\nonline.\n\nNote that we don't have drivers for all of the peripherals, so things\nmay change once those drivers are written.\n\nI hadn't looked into the power domain stuff - when I brought this up\non the list recently Philip suggested that this should be contained in\na clk driver, so that's the direction we went:\n\n http://www.spinics.net/lists/linux-clk/msg18733.html\n\nCheers,\n\nJoel","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"LM4vGGJj\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"R8a6ZCfE\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y5p3X4KZbz9t48\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tTue,  3 Oct 2017 16:48:08 +1100 (AEDT)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dzG3o-0000Np-JO; Tue, 03 Oct 2017 05:48:04 +0000","from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dzG3k-0008CE-V7 for linux-arm-kernel@lists.infradead.org;\n\tTue, 03 Oct 2017 05:48:03 +0000","by mail-lf0-x22f.google.com with SMTP id d10so6063938lfg.11\n\tfor <linux-arm-kernel@lists.infradead.org>;\n\tMon, 02 Oct 2017 22:47:39 -0700 (PDT)","by 10.25.24.70 with HTTP; Mon, 2 Oct 2017 22:47:17 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=90YpoEP7dubLXY8qnCn9/b5W5Sl5LOBWfD36FCrElEs=;\n\tb=LM4vGGJjrmW5nx\n\tB0irCYNV6IhfNDuBWZOzMAXtZzIzVcNyFi6nZFGehGt005N+ZG3948pbEcx92uZ+0kh2RvVBFPl+k\n\t/9KL+OCQ/tIfAFkFDhCFzFWTXy905C+fCmzqxxeJE+66fPuvHtIUhVaCGVWkRdBc9JDotug22hWm9\n\tCq08JVXcoxWoioEaG5hSJ1RB46w2FCoSgUFqaDoV3p6f7ARJoROebQSjYT1MieYbwmKAbDXNTBOor\n\t2sVtXlDqxLQ3W5J6PCfvDsin68MToQVFOndmq7DQF+aXLFLfciQ1E9YxLlAheVT7wbaoXUBQDqU6o\n\tNmNImQfwY9gwJJyznaYw==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=bQeSsRu4gUiHmq48lfBd1wDIFCd1+MnC8tUwBZxdvo4=;\n\tb=R8a6ZCfEwvnh35hQXpyJvS/Gv22A3NF2Zne/Da6YzMQlqqgv1bO5iXMG20SRYe7ycN\n\teVILyuhnq5vwLc4aS3J59gaTz/LAcx/GLsQ7LGBBW1zuFjfLQDx0Mr+PDQ/LUNlyaNYH\n\t4L5CPtGqTxqrKdL6h7L62eOr6/QQc66HpusZzEnt7NoP0hnP99g7prGj/sq3PCetAxiz\n\tIifEqZAFAD6P1lg8xNte4xid62jxpiO0kbY0DSIdj+46uMLxDWuLGs3GyYaPgbXGBMlc\n\tAuusRt6rZwiYKKPg08HodZy2i5IG4WiyTxrpe0yTZZkGxi2IorA9rdCNxfz9+jvfGEb5\n\t5PSQ=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=bQeSsRu4gUiHmq48lfBd1wDIFCd1+MnC8tUwBZxdvo4=;\n\tb=pMuyy1JbkDJKHphif4qZpuqik4HV9KNcXUpgTVQ0zFFtNF2cLkSEIPVPTfBrcRuIKb\n\tgfW9uri6tizRsxfynmKjUUNDg86l/Ohvw00vazPUp5WZ60X/w1eNFiRxbNa4RBLpg2Jk\n\tGyLmKGN5iyTa6FRoewqlhsYJVURmsaPyaB+ah0dmX+Zsnxa8ei/TKOlP4NKji/f7IrgJ\n\tIyENIkKAC+dVyMI/eOLKBJ/BN44Z9vxsUvqeiMEcVzOmyw5RtTj+uIoaZj9XHofEc/Xj\n\tuN8gSwQGiSi5UK26iv3SgYCvOUropzOGeIe00OODSOtisx/DuHZ1FyrWGAkkuzGNkQOM\n\tts8Q==","X-Gm-Message-State":"AMCzsaWX7v8aAwfxpNKzjjeVENIR2rjP6x8VrqLHdN+hjQbzfMOi22nj\n\t9Yu1hmdjE3yfQkQfeVBW6QHawlTfyCWTz9dtbs4=","X-Google-Smtp-Source":"AOwi7QAGFdE0oPWdM2oMFEeOVVNrPw9xPDAJYmrJzOaHB9g0Sy1/IUysUJ3t+TSAJQTsaZtKUOHTPF+WbsCjwudUKMw=","X-Received":"by 10.25.143.78 with SMTP id r75mr1558398lfd.85.1507009657765;\n\tMon, 02 Oct 2017 22:47:37 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20171002213742.GQ457@codeaurora.org>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-5-joel@jms.id.au>\n\t<20171002213742.GQ457@codeaurora.org>","From":"Joel Stanley <joel@jms.id.au>","Date":"Tue, 3 Oct 2017 15:17:17 +0930","X-Google-Sender-Auth":"6l-TW4Eo8qoNIr-WrVSMlKr1AFA","Message-ID":"<CACPK8XdrqmBC8M+=NDUVhYKPafw-Qc8fRikV+xJ84FyzG6BfxQ@mail.gmail.com>","Subject":"Re: [PATCH v2 4/5] clk: aspeed: Register gated clocks","To":"Stephen Boyd <sboyd@codeaurora.org>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171002_224801_222419_88C89E2E ","X-CRM114-Status":"GOOD (  16.22  )","X-Spam-Score":"-2.4 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.4 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow\n\ttrust [2a00:1450:4010:c07:0:0:0:22f listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (joel.stan[at]gmail.com)\n\t0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level\n\tmail domains are different\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and\n\tEnvelopeFrom freemail headers are different","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tAndrew Jeffery <andrew@aj.id.au>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1778735,"web_url":"http://patchwork.ozlabs.org/comment/1778735/","msgid":"<CACPK8XeHj2xdw6HgkWRDiJPjurip3wVbkOmY0mGW=dSTVWsYmg@mail.gmail.com>","list_archive_url":null,"date":"2017-10-03T05:48:00","subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","submitter":{"id":48628,"url":"http://patchwork.ozlabs.org/api/people/48628/","name":"Joel Stanley","email":"joel@jms.id.au"},"content":"On Tue, Oct 3, 2017 at 6:54 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:\n> On 09/21, Joel Stanley wrote:\n>> @@ -160,6 +191,104 @@ static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n>> +     /*\n>> +      * Memory controller (M-PLL) PLL. This clock is configured by the\n>> +      * bootloader, and is exposed to Linux as a read-only clock rate.\n>> +      */\n>> +     regmap_read(map, ASPEED_MPLL_PARAM, &val);\n>> +     aspeed_clk_data->hws[ASPEED_CLK_MPLL] = aspeed_calc_pll(\"mpll\", val);\n>> +\n>> +     /* SD/SDIO clock divider (TODO: There's a gate too) */\n>> +     hw = clk_hw_register_divider_table(NULL, \"sdio\", \"hpll\", 0,\n>\n> Please pass your dev pointer here from the platform device.\n>\n>> +                     scu_base + ASPEED_CLK_SELECTION, 12, 3, 0,\n>> +                     div_table,\n>> +                     &aspeed_clk_lock);\n>\n> And check for errors? Perhaps use devm_clk_hw_regsiter() APIs and\n> construct the dividers and muxes directly instead of using the\n> basic type registration APIs.\n\nDo you think that devm_ is overkill, given we will never unload this driver?\n\nCan you explain why you suggest to construct the structures directly\ninstead of using the APIs?\n\nI had a read of the basic type registration functions, and the\nrelevant failure paths are memory allocation failures. If we're out of\nmemory that early in boot then things have gone pretty bad.\n\nI can add checks for null and bail out; I don't think there's value in\nfreeing the allocated memory: if a system can't load it's clock driver\nthen it's super hosed.\n\nThanks for the review. I fixed all of the other things you mentioned.\n\nCheers,\n\nJoel","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"aaAdtIWy\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"qcih9EH1\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y5p4n02Hbz9t48\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tTue,  3 Oct 2017 16:49:13 +1100 (AEDT)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dzG4j-0000tg-7l; Tue, 03 Oct 2017 05:49:01 +0000","from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dzG4R-0000f8-E5 for linux-arm-kernel@lists.infradead.org;\n\tTue, 03 Oct 2017 05:48:59 +0000","by mail-lf0-x242.google.com with SMTP id m199so3069399lfe.5\n\tfor <linux-arm-kernel@lists.infradead.org>;\n\tMon, 02 Oct 2017 22:48:22 -0700 (PDT)","by 10.25.24.70 with HTTP; Mon, 2 Oct 2017 22:48:00 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=P0snrRRw64k4r/QZXCqUkSjyrx1zXNAGVw8tX9TsxOs=;\n\tb=aaAdtIWyW/Th5c\n\tCeqguiAwAatkCDPjft3NdJeSJEKGSA7ret/Cmnh4pV6M5Gjw2XkkOSd8GlEsppm3n840nXqpz8fya\n\tFSoi7Op6wxD/5d5VDhz00+Ehcy5I8mv/WXvaimhrka5vjM5ByFbOaaEsfXz7+HbtFj08YNF9iS/6O\n\tDjg8XG1424sy56LjfbaMOOJhaK6UXUsCEjLYFfDUswhggDLO++WSD/mJK25/MrwpUK3UXy2ShDQHA\n\tnh92Y7FLJs40d9jUrmGTzi4JNjC24G2r5cj5mKkeq/IPH8KlhCiGF0Y1pgTTm7vuay0BtCKWUkYFE\n\tEGXYsvHgDZ+x0n7QC6Aw==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=oaNh4qNSXBB06V/aY046Pl3+dE3/W8trC2dHDocB6KM=;\n\tb=qcih9EH1SWvkhQ7Cf0jGfjpKFwqa+DAN2N+kIHyHdrNTWHEXhP4JGyJis7plz4Texf\n\tr00n2jzu5nyr0BRRl6ykUh2l9RlldCOCJklF0p3rzqZrSM6YXviOE4c8BMNiFCf7ZXiJ\n\t9HVsRLBfVd58MNoZtUe/OyS2rMRShNMS9IJK4FpB18+enCF3x9CdQeNwprg54H5+jt4z\n\tV1RdIe4ujrU1uKPjvLf13KfmyFMH7x75wP6RzSb1hYTNe1B4/KSAdXr9TAp4UIDXwxSx\n\tpm07zA00gq5PbzmnHOrWBBWH2glXkWHWi3YNwcgnAyLSXbNyUTfHXQ/axR4JoZ1toi9U\n\tcUfg=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=oaNh4qNSXBB06V/aY046Pl3+dE3/W8trC2dHDocB6KM=;\n\tb=Nt6wznLfqyIK64+DvJkzeLuaCyi8IBS1mmBmVRe6jkq5VRarr/jJzV8oOoBpx8LDTS\n\tymjGGBZdot75I8xnLsp+IlM/AX/mcCB0qNJ6CZqh0+dQdN5RCoqLwYym5zAo2Pvt8Tue\n\tHnBut2qQ8ROvF21Z3JQJJaTnBRvKGAFtTRwHAxYv4h+BQw8q0/Orx0k3pJyVrgd9KN1J\n\tLj3VPYcfv7OOJr3hcoQORD2UHO71kqRa1c0LZ1pPisSbL0cQyx1W+/V1MuZD9F2HWxg+\n\tfXOlu4+nZ3+cQo4BsxtsZA49L2eQ4NcViOmoIYQ0YrnhCbnRT3g9han9IVyEwTcOhnHg\n\thy9w==","X-Gm-Message-State":"AHPjjUhF2iAY3BZrfjO9hJ4aCGjjkO89ybv5sNyfegqyrvJAjLMwwGMe\n\teorSCkIRmJdBI3oY3Hn5Qy0Zhdch/TjOuucy0Qo=","X-Google-Smtp-Source":"AOwi7QB6EWRglgWHbXseb3HnwypHOe8+BZtRPJjB2rTvxABynR4XbZ8Fxz+c87AjCjgcd25DQcLUPBZHg/uCuutoMxw=","X-Received":"by 10.46.93.75 with SMTP id r72mr9031803ljb.46.1507009701148;\n\tMon, 02 Oct 2017 22:48:21 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20171002212435.GP457@codeaurora.org>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-4-joel@jms.id.au>\n\t<20171002212435.GP457@codeaurora.org>","From":"Joel Stanley <joel@jms.id.au>","Date":"Tue, 3 Oct 2017 15:18:00 +0930","X-Google-Sender-Auth":"zejKAzW0eQFI2JZ04PZ6ZFItQ5o","Message-ID":"<CACPK8XeHj2xdw6HgkWRDiJPjurip3wVbkOmY0mGW=dSTVWsYmg@mail.gmail.com>","Subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","To":"Stephen Boyd <sboyd@codeaurora.org>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171002_224843_754186_F185A31A ","X-CRM114-Status":"GOOD (  16.47  )","X-Spam-Score":"-2.4 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.4 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow\n\ttrust [2a00:1450:4010:c07:0:0:0:242 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (joel.stan[at]gmail.com)\n\t0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level\n\tmail domains are different\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and\n\tEnvelopeFrom freemail headers are different","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tAndrew Jeffery <andrew@aj.id.au>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1780126,"web_url":"http://patchwork.ozlabs.org/comment/1780126/","msgid":"<20171004211820.GX457@codeaurora.org>","list_archive_url":null,"date":"2017-10-04T21:18:20","subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","submitter":{"id":6071,"url":"http://patchwork.ozlabs.org/api/people/6071/","name":"Stephen Boyd","email":"sboyd@codeaurora.org"},"content":"On 10/03, Joel Stanley wrote:\n> On Tue, Oct 3, 2017 at 6:54 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:\n> > On 09/21, Joel Stanley wrote:\n> >> @@ -160,6 +191,104 @@ static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n> >> +     /*\n> >> +      * Memory controller (M-PLL) PLL. This clock is configured by the\n> >> +      * bootloader, and is exposed to Linux as a read-only clock rate.\n> >> +      */\n> >> +     regmap_read(map, ASPEED_MPLL_PARAM, &val);\n> >> +     aspeed_clk_data->hws[ASPEED_CLK_MPLL] = aspeed_calc_pll(\"mpll\", val);\n> >> +\n> >> +     /* SD/SDIO clock divider (TODO: There's a gate too) */\n> >> +     hw = clk_hw_register_divider_table(NULL, \"sdio\", \"hpll\", 0,\n> >\n> > Please pass your dev pointer here from the platform device.\n> >\n> >> +                     scu_base + ASPEED_CLK_SELECTION, 12, 3, 0,\n> >> +                     div_table,\n> >> +                     &aspeed_clk_lock);\n> >\n> > And check for errors? Perhaps use devm_clk_hw_regsiter() APIs and\n> > construct the dividers and muxes directly instead of using the\n> > basic type registration APIs.\n> \n> Do you think that devm_ is overkill, given we will never unload this driver?\n\nIs probe defer going to happen? Even if unload can't happen,\nprobe defer is a concern unless that is also ruled out.\n\n> \n> Can you explain why you suggest to construct the structures directly\n> instead of using the APIs?\n\nThere aren't devm APIs for some of these basic clk type\nregistration functions.\n\n> \n> I had a read of the basic type registration functions, and the\n> relevant failure paths are memory allocation failures. If we're out of\n> memory that early in boot then things have gone pretty bad.\n> \n> I can add checks for null and bail out; I don't think there's value in\n> freeing the allocated memory: if a system can't load it's clock driver\n> then it's super hosed.\n\nIf we can't proceed without this driver because it's super hosed,\nthen perhaps we need to panic the system on errors here. Should\nbe simple enough to add some error checks and goto panic(\"Things\nare super hosed\").","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"bX5+vCDe\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=codeaurora.org header.i=@codeaurora.org\n\theader.b=\"Z9gPya4/\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n\theader.d=codeaurora.org header.i=@codeaurora.org header.b=\"Z9gPya4/\"; \n\tdkim-atps=neutral","pdx-caf-mail.web.codeaurora.org;\n\tdmarc=none (p=none dis=none) header.from=codeaurora.org","pdx-caf-mail.web.codeaurora.org;\n\tspf=none smtp.mailfrom=sboyd@codeaurora.org"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y6pg06GqBz9sRq\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 08:18:50 +1100 (AEDT)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dzr42-0003F5-2o; Wed, 04 Oct 2017 21:18:46 +0000","from smtp.codeaurora.org ([198.145.29.96])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dzr3y-0003BS-VD for linux-arm-kernel@lists.infradead.org;\n\tWed, 04 Oct 2017 21:18:44 +0000","by smtp.codeaurora.org (Postfix, from userid 1000)\n\tid E5C1A60A17; Wed,  4 Oct 2017 21:18:21 +0000 (UTC)","from localhost (i-global254.qualcomm.com [199.106.103.254])\n\t(using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits))\n\t(No client certificate requested)\n\t(Authenticated sender: sboyd@smtp.codeaurora.org)\n\tby smtp.codeaurora.org (Postfix) with ESMTPSA id D61066087C;\n\tWed,  4 Oct 2017 21:18:20 +0000 (UTC)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:\n\tMessage-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=u0tD6DWZ9LW2tzPkuBlH8jd1z6Iype3+k+CEauICxKM=;\n\tb=bX5+vCDePyraGc\n\tHyvZpGYjTYT4Mcs2EzP/JxC3pyJyYlUst8mm/MxiuPXYTET//8WpD8ZD71bwHLqHPGuYnR3akRcSh\n\t053C9wrDzALbiyGQ+NrfTJKYkJSYgjpTCbPNt/HiPIJELTKhJIymZA6xTfZhfdQGpOPIvC4B4kYZn\n\tfhzel0QvTI8NuMSQ9ctU84s/1GfhVrO8Hi76KgDG8YRCX0LzhcoMbix0iKMZtsa7X+v61Snz8omUg\n\t8ydClILCqjoi85ZYnWcYMnKXOUFNmw+m3Od5cLffHHRa9Iumbmi5cgWyboc0g0ElK7Sc5hdZhR6sV\n\t7S4b4gY7BHh18hMOuRCA==;","v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1507151901;\n\tbh=sX02GscLflv2TL0nTQf6Jjpkc3LDBzGjpl9CbPKYAHY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Z9gPya4/UEA6KNjL5F5Vgeii4Zdm9pii0pKmuDCAPW3cBRCYzlfA2wuyKNpWCMAN0\n\t+5Gpl3lvGv7P4lzDdZe/SxpN963G5vPvTLbatMUvebk36YbF5fqvShJcsysH5Cw0qs\n\tnp92WQHSJcxtIPXWO+c4SY8biHTn7bEEXi34dJRo=","v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1507151901;\n\tbh=sX02GscLflv2TL0nTQf6Jjpkc3LDBzGjpl9CbPKYAHY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Z9gPya4/UEA6KNjL5F5Vgeii4Zdm9pii0pKmuDCAPW3cBRCYzlfA2wuyKNpWCMAN0\n\t+5Gpl3lvGv7P4lzDdZe/SxpN963G5vPvTLbatMUvebk36YbF5fqvShJcsysH5Cw0qs\n\tnp92WQHSJcxtIPXWO+c4SY8biHTn7bEEXi34dJRo="],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tpdx-caf-mail.web.codeaurora.org","X-Spam-Level":"","X-Spam-Status":"No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00,\n\tDKIM_SIGNED,\n\tT_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0","DMARC-Filter":"OpenDMARC Filter v1.3.2 smtp.codeaurora.org D61066087C","Date":"Wed, 4 Oct 2017 14:18:20 -0700","From":"Stephen Boyd <sboyd@codeaurora.org>","To":"Joel Stanley <joel@jms.id.au>","Subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","Message-ID":"<20171004211820.GX457@codeaurora.org>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-4-joel@jms.id.au>\n\t<20171002212435.GP457@codeaurora.org>\n\t<CACPK8XeHj2xdw6HgkWRDiJPjurip3wVbkOmY0mGW=dSTVWsYmg@mail.gmail.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<CACPK8XeHj2xdw6HgkWRDiJPjurip3wVbkOmY0mGW=dSTVWsYmg@mail.gmail.com>","User-Agent":"Mutt/1.5.21 (2010-09-15)","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171004_141843_061568_2A6ED662 ","X-CRM114-Status":"GOOD (  20.80  )","X-Spam-Score":"-4.3 (----)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-4.3 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [198.145.29.96 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tAndrew Jeffery <andrew@aj.id.au>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}},{"id":1780301,"web_url":"http://patchwork.ozlabs.org/comment/1780301/","msgid":"<CACPK8XdzDatTXng-YR9qqYNqxzQPSaf87+2B==YEnC+ffGkPTw@mail.gmail.com>","list_archive_url":null,"date":"2017-10-05T06:22:50","subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","submitter":{"id":48628,"url":"http://patchwork.ozlabs.org/api/people/48628/","name":"Joel Stanley","email":"joel@jms.id.au"},"content":"On Thu, Oct 5, 2017 at 6:48 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:\n> On 10/03, Joel Stanley wrote:\n>> On Tue, Oct 3, 2017 at 6:54 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:\n>> > On 09/21, Joel Stanley wrote:\n>> >> @@ -160,6 +191,104 @@ static struct clk_hw *aspeed_calc_pll(const char *name, u32 val)\n>> >> +     /*\n>> >> +      * Memory controller (M-PLL) PLL. This clock is configured by the\n>> >> +      * bootloader, and is exposed to Linux as a read-only clock rate.\n>> >> +      */\n>> >> +     regmap_read(map, ASPEED_MPLL_PARAM, &val);\n>> >> +     aspeed_clk_data->hws[ASPEED_CLK_MPLL] = aspeed_calc_pll(\"mpll\", val);\n>> >> +\n>> >> +     /* SD/SDIO clock divider (TODO: There's a gate too) */\n>> >> +     hw = clk_hw_register_divider_table(NULL, \"sdio\", \"hpll\", 0,\n>> >\n>> > Please pass your dev pointer here from the platform device.\n>> >\n>> >> +                     scu_base + ASPEED_CLK_SELECTION, 12, 3, 0,\n>> >> +                     div_table,\n>> >> +                     &aspeed_clk_lock);\n>> >\n>> > And check for errors? Perhaps use devm_clk_hw_regsiter() APIs and\n>> > construct the dividers and muxes directly instead of using the\n>> > basic type registration APIs.\n>>\n>> Do you think that devm_ is overkill, given we will never unload this driver?\n>\n> Is probe defer going to happen? Even if unload can't happen,\n> probe defer is a concern unless that is also ruled out.\n\nAs I understand it, I will only get an EPROBE_DEFER if I'm requesting\nsomething from another driver?\n\nIf that's the case then we can rule that out.\n\n>>\n>> Can you explain why you suggest to construct the structures directly\n>> instead of using the APIs?\n>\n> There aren't devm APIs for some of these basic clk type\n> registration functions.\n>\n>>\n>> I had a read of the basic type registration functions, and the\n>> relevant failure paths are memory allocation failures. If we're out of\n>> memory that early in boot then things have gone pretty bad.\n>>\n>> I can add checks for null and bail out; I don't think there's value in\n>> freeing the allocated memory: if a system can't load it's clock driver\n>> then it's super hosed.\n>\n> If we can't proceed without this driver because it's super hosed,\n> then perhaps we need to panic the system on errors here. Should\n> be simple enough to add some error checks and goto panic(\"Things\n> are super hosed\").\n\nOkay. I added checks in v4. Does that look ok you you?\n\nCheers,\n\nJoel","headers":{"Return-Path":"<linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming-imx@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-imx@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.infradead.org\n\t(client-ip=65.50.211.133; helo=bombadil.infradead.org;\n\tenvelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"hlIxy1VC\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"cxpRfaor\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y72lg0R8Sz9t4X\n\tfor <incoming-imx@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 17:23:43 +1100 (AEDT)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dzzZL-0005va-1M; Thu, 05 Oct 2017 06:23:39 +0000","from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dzzZG-0005p9-TX for linux-arm-kernel@lists.infradead.org;\n\tThu, 05 Oct 2017 06:23:36 +0000","by mail-lf0-x242.google.com with SMTP id m7so76906lfe.5\n\tfor <linux-arm-kernel@lists.infradead.org>;\n\tWed, 04 Oct 2017 23:23:12 -0700 (PDT)","by 10.25.195.6 with HTTP; Wed, 4 Oct 2017 23:22:50 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:\n\tReferences:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=ui6kwmr/awp7mtmEFak5L0ASpwq0Dcr1vQ9RAwm19Mg=;\n\tb=hlIxy1VC4q/+HR\n\t2l+fZ1nZHFcFHkl0+K1JP1FLCc1BJcn5SNa8wV1iwWkzV2LjhCYgt89hu6mPr8um+kvwIQplVyxZ3\n\tqL+lxGArQYYYRmVY8zEDhxFu7SVqpbM+sT8htS/AJ9Gam7dq3/G8BzeEdktubRyI5lcTODL9K8jmO\n\t+qF0/Z0yuNv9DLpk0BfIQMtCbuPqd0jzDK2GhG8h5KrQrN6YxWsGc2lcKlQRj4opXLPIBz5L5U87w\n\tFMvSAf3KNVnw89np6bEFy5cfvfvrxlghgSSfehRJEElIcsvn1JO9BS1uButlrI26jjvWx//GFGoRN\n\tSpdg8ZE/Kz2ujNQ5N83Q==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=aSc9jzGcecvGYlfULPDJsXB/LpKhYv5K/1Bso0OVqI8=;\n\tb=cxpRfaorFdBmQ8cvZ/d0S2sXRkA7fhTwhHs2/SKecUgZauqcJwU2U4Cr0gIIdhu1Ui\n\t10WlWC1OsmMsMVzLlO5Z78AfgZ0+h6f4N+2K9Vwl43A+y/VW+8r/O2Bg29Fnn+T59RoE\n\tsJMB3Ce7braHR9p0UzBjYASijJnxmTBdEhAt1KG7Y+z+1ut44t7PqxHtX9BqT83wSqvc\n\ttCa6auwHVhLmqWVXXqcz6h/ptNAutXmxx6Qtd6Ke1YpLF/3wnL6S67avCWwH1l6S3HD6\n\tnja0iiA5booU6CBcT8TKS4F6TRfdl87k7ma3xU7iJPyUegH789ttARuIJX3iCak5ibfP\n\tuLzg=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=aSc9jzGcecvGYlfULPDJsXB/LpKhYv5K/1Bso0OVqI8=;\n\tb=i3WiK5lkl3bNUpFXmlyQrFs1gwEO+9FGOYOAUEW8ZsV2FETS9dkwAHt+M0tuCSkZjd\n\tFlQc+MrIFVwBxZD20MZH/jU1nD+L+pGBmNXMmDEEz0w/UH3vV2cdB3HnQ3UIANvD3t+0\n\tXQYvy+gIrf9CotwnNcNYVy0fGQ8i/a+Pg2C1wYOQ+KNaDF4Y+Aa7BxhtDB13DhtNBR1s\n\tff0vlpugvbjRORdOXAddo1Y+jjNqYGjuNKSVbXzN9w2jc7U+EOvCr1kSddKxKEYXLPjG\n\txtyhwdC08GJQrpprAqOSZ9AgXuefEPi9OXjahwU8bSjY39KvtkaDqKNBFFj5CtlS1zsI\n\t4Krw==","X-Gm-Message-State":"AHPjjUjaQAAUyRkWC7nHbZQIhlFuVLDFRBaFbjkJOsVcjDY325bXRc4z\n\tFWrG+Z8O9Jcwn4QOXHWL1qMtJDA961sdCcAr44w=","X-Google-Smtp-Source":"AOwi7QDWN/l7FQLyGKEXXfLP/1ej2wGgIbEibcCIF1LsUKWZDqXt9T8o84GYWjmQ6M2wve9YMz0ZIYkO4/ttN0ZDkqY=","X-Received":"by 10.46.93.75 with SMTP id r72mr12407531ljb.46.1507184590847;\n\tWed, 04 Oct 2017 23:23:10 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20171004211820.GX457@codeaurora.org>","References":"<20170921042641.7326-1-joel@jms.id.au>\n\t<20170921042641.7326-4-joel@jms.id.au>\n\t<20171002212435.GP457@codeaurora.org>\n\t<CACPK8XeHj2xdw6HgkWRDiJPjurip3wVbkOmY0mGW=dSTVWsYmg@mail.gmail.com>\n\t<20171004211820.GX457@codeaurora.org>","From":"Joel Stanley <joel@jms.id.au>","Date":"Thu, 5 Oct 2017 15:52:50 +0930","X-Google-Sender-Auth":"1iqqPlSBYeWulVNAbh1Su8ws9kM","Message-ID":"<CACPK8XdzDatTXng-YR9qqYNqxzQPSaf87+2B==YEnC+ffGkPTw@mail.gmail.com>","Subject":"Re: [PATCH v2 3/5] clk: aspeed: Add platform driver and register\n\tPLLs","To":"Stephen Boyd <sboyd@codeaurora.org>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171004_232335_152711_D85B749F ","X-CRM114-Status":"GOOD (  19.32  )","X-Spam-Score":"-2.4 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.4 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow\n\ttrust [2a00:1450:4010:c07:0:0:0:242 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (joel.stan[at]gmail.com)\n\t0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level\n\tmail domains are different\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and\n\tEnvelopeFrom freemail headers are different","X-BeenThere":"linux-arm-kernel@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-arm-kernel/>","List-Post":"<mailto:linux-arm-kernel@lists.infradead.org>","List-Help":"<mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,\n\t<mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>","Cc":"Ryan Chen <ryan_chen@aspeedtech.com>, Arnd Bergmann <arnd@arndb.de>,\n\tAndrew Jeffery <andrew@aj.id.au>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n\tRick Altherr <raltherr@google.com>, Jeremy Kerr <jk@ozlabs.org>,\n\tLee Jones <lee.jones@linaro.org>, linux-clk@vger.kernel.org,\n\tLinux ARM <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-arm-kernel\" <linux-arm-kernel-bounces@lists.infradead.org>","Errors-To":"linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org","List-Id":"linux-imx-kernel.lists.patchwork.ozlabs.org"}}]