[{"id":1776566,"web_url":"http://patchwork.ozlabs.org/comment/1776566/","msgid":"<20170927193616.32gxszmk4cjjoqmo@rob-hp-laptop>","list_archive_url":null,"date":"2017-09-27T19:36:16","subject":"Re: [RFC v2 0/2] Add support for Meson MX \"SDIO\" MMC controller","submitter":{"id":62529,"url":"http://patchwork.ozlabs.org/api/people/62529/","name":"Rob Herring (Arm)","email":"robh@kernel.org"},"content":"On Sun, Sep 24, 2017 at 09:05:26PM +0200, Martin Blumenstingl wrote:\n> This is the successor to Carlo Caione's \"Add support for Amlogic Meson\n> MMC driver\" series (v5) from [0].\n> This new driver is for the \"SDIO\" controller found in Amlogic Meson6,\n> Meson8 and Meson8b SoCs and supports an internal mux to allow connecting\n> three cards to it.\n> \n> \n> changes since RFC v1 at [1]:\n> - added COMMON_CLK dependency as reported by the kbuild test robot\n> - use of_platform_device_{create,destroy} instead of open-coding it's\n>   logic\n> - moved struct device (which was an array) from meson_mx_mmc_host to\n>   the corresponding meson_mx_mmc_slot\n> - use struct mmc_command's busy_timeout instead of hard-coding the\n>   timeout values in meson_mx_mmc_start_cmd()\n> - don't use arrays with only one element for the clock parents in\n>   meson_mx_mmc_register_clks()\n> - removed the wrapper functions meson_mx_mmc_readl() meson_mx_mmc_writel()\n> - allow setting the MMC clock to 0 for UHS speed mode (the actual\n>   hardware clock cannot be gated as far as I know, so instead the\n>   lowest supported rate is chosen)\n> - remove unused #include <linux/init.h>\n> - add MMC_CAP_ERASE\n> - removed multiple slot support after discussing this with Ulf\n>   (this is a feature that needs to be part of the MMC core before drivers\n>   can use it)\n> - removed SDIO interrupt support (as I currently don't have a way to\n>   test it)\n> - merge meson_mx_mmc_apply_ios into meson_mx_mmc_set_ios (as that's\n>   the only place where it's needed after removing multiple slot support)\n> - updated the commit message of the driver patch to indicate the\n>   difference between the meson-mx-sdio.c and meson-gx.c (and the \"still\n>   missing SDHC\") driver\n> - NOTE: I did not add Rob's ACK on the dt-bindings patch because I\n>   introduced the \"mmc-slot\" compatible for the child nodes as suggested\n>   by Ulf (and I want confirmation from the DT maintainers that I did this\n>   correctly)\n\nDidn't slot support get removed as no h/w really uses that feature?\n\nRob\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y2Sjx6HXSz9t6C\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 05:36:21 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750917AbdI0TgU (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tWed, 27 Sep 2017 15:36:20 -0400","from mail-pg0-f52.google.com ([74.125.83.52]:48311 \"EHLO\n\tmail-pg0-f52.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750739AbdI0TgT (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Wed, 27 Sep 2017 15:36:19 -0400","by mail-pg0-f52.google.com with SMTP id v23so8327414pgc.5;\n\tWed, 27 Sep 2017 12:36:19 -0700 (PDT)","from localhost ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id\n\te2sm17598227pfc.176.2017.09.27.12.36.17\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 27 Sep 2017 12:36:17 -0700 (PDT)"],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to:user-agent;\n\tbh=OIohogJCan4BVRKfgFsOntxXM4RZGKWo8NeAKow5GLk=;\n\tb=sZs5PyVv9R1MfEcnhZroxbhCQ4rM0LzOSCBAIPnLsA5zEtsfbnxl9mVCosboQ82lqw\n\t5C/Uvlji2roQzpjCQpjYReUcONVYgDQpOKTr+xA/E/Jklv3sOhnRvHYEbqocjI/Zt7nW\n\tfB2poOTznq6zOWEtXihpH03n7zbf2sn4l8b9qWDj0Kzi2YS28nZnW/fLp0iBaOvZ5HnC\n\tkE4d3d+mb7sFEzUT0mDqBC0gmR0X8NdHmNGKaac/+2UJqBeKjur7iaVS+fILc6gm4SP/\n\tWL7G8rdVQiEEx0MorXgXTkOvGGln1d0HjkF9uQmSgOqYW3iRHTP8nlenBN94BdqCwmbr\n\tdIUQ==","X-Gm-Message-State":"AHPjjUgxp7dgIOB+svrC+tUSDHBrRrxMD4fHZvTw8u/aeKjjHvm+oXER\n\trxQ/R2UFDozQSoQCnNDyig==","X-Google-Smtp-Source":"AOwi7QDGN0mCzPK5trLU7nFyyYLIKeWrVaFsQBp6pYDMqQccevL59Oz2bAqu9uVEs6hcBWU2SKCbHg==","X-Received":"by 10.98.147.4 with SMTP id b4mr2209259pfe.347.1506540978647;\n\tWed, 27 Sep 2017 12:36:18 -0700 (PDT)","Date":"Wed, 27 Sep 2017 14:36:16 -0500","From":"Rob Herring <robh@kernel.org>","To":"Martin Blumenstingl <martin.blumenstingl@googlemail.com>","Cc":"ulf.hansson@linaro.org, mark.rutland@arm.com, carlo@caione.org,\n\tkhilman@baylibre.com, linux-mmc@vger.kernel.org,\n\tdevicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tlinux-amlogic@lists.infradead.org","Subject":"Re: [RFC v2 0/2] Add support for Meson MX \"SDIO\" MMC controller","Message-ID":"<20170927193616.32gxszmk4cjjoqmo@rob-hp-laptop>","References":"<20170924190528.21841-1-martin.blumenstingl@googlemail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170924190528.21841-1-martin.blumenstingl@googlemail.com>","User-Agent":"NeoMutt/20170113 (1.7.2)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1778196,"web_url":"http://patchwork.ozlabs.org/comment/1778196/","msgid":"<CAPDyKFqj1CkhHO4SvUySEV4OnKcTeHRu6YAfBPSN4hvkQpHKfA@mail.gmail.com>","list_archive_url":null,"date":"2017-10-02T08:08:09","subject":"Re: [RFC v2 2/2] mmc: meson-mx-sdio: Add a driver for the Amlogic\n\tMeson8 and Meson8b SoCs","submitter":{"id":21036,"url":"http://patchwork.ozlabs.org/api/people/21036/","name":"Ulf Hansson","email":"ulf.hansson@linaro.org"},"content":"[...]\n\n> +#define MESON_MX_SDIO_MAX_SLOTS                                        3\n> +\n> +struct meson_mx_mmc_slot {\n> +       struct device                   *dev;\n> +       struct mmc_host                 *mmc;\n> +       struct meson_mx_mmc_host        *host;\n> +\n> +       struct mmc_request              *mrq;\n> +       struct mmc_command              *cmd;\n> +       int                             error;\n> +\n> +       unsigned int                    id;\n> +};\n\nIf I recall correctly, we agreed on postponing the multiple slot\nsupport for now as to start simple.\nTherefore, can you please remove all that code, and instead only use\nthe struct meson_mx_mmc_host for the data needed.\n\nJust to be clear, I am fine having using the mmc slot bindings, as we\nagreed. However as only one slot is supported in this stage, we don't\nneed a separate struct for that.\n\n> +\n> +struct meson_mx_mmc_host {\n> +       struct device                   *dev;\n> +\n> +       struct clk                      *parent_clk;\n> +       struct clk                      *core_clk;\n> +       struct clk_divider              cfg_div;\n> +       struct clk                      *cfg_div_clk;\n> +       struct clk_fixed_factor         fixed_factor;\n> +       struct clk                      *fixed_factor_clk;\n> +\n> +       void __iomem                    *base;\n> +       int                             irq;\n> +       spinlock_t                      irq_lock;\n> +\n> +       struct timer_list               cmd_timeout;\n> +\n> +       struct meson_mx_mmc_slot        *slot;\n> +};\n> +\n\n[...]\n\n> +static int meson_mx_mmc_slot_probe(struct device *slot_dev,\n> +                                  struct meson_mx_mmc_host *host)\n> +{\n> +       struct meson_mx_mmc_slot *slot;\n> +       struct mmc_host *mmc;\n> +       unsigned int id;\n> +       int ret;\n> +\n> +       if (of_property_read_u32(slot_dev->of_node, \"reg\", &id)) {\n> +               dev_err(slot_dev, \"missing 'reg' property\\n\");\n> +               return -EINVAL;\n> +       }\n> +\n> +       if (id >= MESON_MX_SDIO_MAX_SLOTS) {\n> +               dev_err(slot_dev, \"invalid 'reg' property value %d\\n\", id);\n> +               return -EINVAL;\n> +       }\n> +\n> +       mmc = mmc_alloc_host(sizeof(*slot), slot_dev);\n> +       if (!mmc)\n> +               return -ENOMEM;\n> +\n> +       slot = mmc_priv(mmc);\n> +       slot->dev = slot_dev;\n> +       slot->mmc = mmc;\n> +       slot->id = id;\n> +       slot->host = host;\n> +\n> +       host->slot = slot;\n> +\n> +       /* Get regulators and the supported OCR mask */\n> +       ret = mmc_regulator_get_supply(mmc);\n> +       if (ret == -EPROBE_DEFER)\n> +               goto error_free_host;\n> +\n> +       mmc->max_req_size = MESON_MX_SDIO_BOUNCE_REQ_SIZE;\n> +       mmc->max_seg_size = mmc->max_req_size;\n> +       mmc->max_blk_count =\n> +               FIELD_GET(MESON_MX_SDIO_SEND_REPEAT_PACKAGE_TIMES_MASK,\n> +                         0xffffffff);\n> +       mmc->max_blk_size = FIELD_GET(MESON_MX_SDIO_EXT_DATA_RW_NUMBER_MASK,\n> +                                     0xffffffff);\n> +       mmc->max_blk_size -= (4 * MESON_MX_SDIO_RESPONSE_CRC16_BITS);\n> +       mmc->max_blk_size /= BITS_PER_BYTE;\n> +\n> +       /* Get the min and max supported clock rates */\n> +       mmc->f_min = clk_round_rate(host->cfg_div_clk, 1);\n> +       mmc->f_max = clk_round_rate(host->cfg_div_clk,\n> +                                   clk_get_rate(host->parent_clk));\n> +\n> +       mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23;\n> +       mmc->ops = &meson_mx_mmc_ops;\n> +\n> +       ret = mmc_of_parse(mmc);\n> +       if (ret)\n> +               goto error_free_host;\n> +\n> +       ret = mmc_add_host(mmc);\n> +       if (ret)\n> +               goto error_free_host;\n> +\n> +       return 0;\n> +\n> +error_free_host:\n> +       mmc_free_host(mmc);\n> +       return ret;\n> +}\n> +\n> +static int meson_mx_mmc_probe_slots(struct meson_mx_mmc_host *host)\n> +{\n> +       struct device_node *slot_node;\n> +       struct platform_device *slot_pdev;\n> +       int ret;\n> +\n> +       for_each_child_of_node(host->dev->of_node, slot_node) {\n> +               if (!of_device_is_compatible(slot_node, \"mmc-slot\"))\n> +                       continue;\n> +\n> +               /*\n> +                * TODO: the MMC core framework currently does not support\n> +                * controllers with multiple slots properly.\n> +                */\n> +               if (host->slot) {\n> +                       dev_warn(host->dev,\n> +                                \"skipping slot other than the first\\n\");\n> +                       continue;\n> +               }\n> +\n> +               slot_pdev = of_platform_device_create(slot_node, NULL,\n> +                                                     host->dev);\n> +               if (!slot_pdev)\n> +                       continue;\n> +\n> +               ret = meson_mx_mmc_slot_probe(&slot_pdev->dev, host);\n> +               if (ret) {\n> +                       of_platform_device_destroy(&slot_pdev->dev, NULL);\n> +                       return ret;\n> +               }\n> +       }\n> +\n> +       return 0;\n> +}\n\nFor the above two functions, please simplify the code by limiting them\nto deal with only one valid mmc-slot.\n\n[...]\n\nBesides the comments on the multiple slot support, this looks good to me.\n\nKind regards\nUffe\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"GYLkDQMO\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y5FCd4jXXz9t48\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tMon,  2 Oct 2017 19:08:13 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750983AbdJBIIL (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tMon, 2 Oct 2017 04:08:11 -0400","from mail-it0-f47.google.com ([209.85.214.47]:52883 \"EHLO\n\tmail-it0-f47.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750923AbdJBIIK (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Mon, 2 Oct 2017 04:08:10 -0400","by mail-it0-f47.google.com with SMTP id c195so6416457itb.1\n\tfor <devicetree@vger.kernel.org>;\n\tMon, 02 Oct 2017 01:08:10 -0700 (PDT)","by 10.2.65.137 with HTTP; Mon, 2 Oct 2017 01:08:09 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=73JuqEshfID44QQIDPlsx6Qc41wPPPFo810SkPX6whY=;\n\tb=GYLkDQMO9ABaMURaDVgESj5+2Edqo9YG0kJ2u7SLc5L1UjbQcIZ/xIkR28DzGk3O90\n\tiX5wQ0Ou4hTgkHyI6Al2UxTS0KPZjeVDKgLmKX66NMlQmUs5tn/ObrAG6G9Hi0DWOsmF\n\tOG5WLJ4dkcTwHYAWetcWiq/tXhEQvTVQowbRs=","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:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=73JuqEshfID44QQIDPlsx6Qc41wPPPFo810SkPX6whY=;\n\tb=cEU9jzQppCVzVHShjE0x8dKsgtmvmKl/CniG/gB/0Q516PnXwSHL3a2qek2Xj8T/h3\n\t/qX/a+QmGPcdy4zHAt/taDvxAcjmtJgFiIIN2GXR4hp6CMlK/7sDO8AUDjy73+ccZ3eP\n\tE6PLGkEo/MCGVxhTyHl1wZxTfrDq+6bdWjYCG9kKldrrHiOng58PoI2bu+ZXx8ap0ieH\n\tUr3DTMV4QLhJ5mDKjQUJonxZbFySVGTVCam+XQfySYjt53Q9q2Fw4p0PyrcLkhMdMakm\n\tOcHIdzxqm+BUdayUeYeh3HoUUzCZobaT5zd3r6gO55ZWXj9a/axCm5SMi7hLrDgaWwIY\n\tKDvg==","X-Gm-Message-State":"AHPjjUhRBmqCAgQ+HqDWz7I6T9rg3DnUiVfRbRP3N7JCi3LGXQkVN30k\n\te+nMBmhOSlE/dFvpkk4WhfT9zcf+28OHbBZLY6NoGQ==","X-Google-Smtp-Source":"AOwi7QAzuHdgAHmigoYS8v9KuyABjmCWOW3LR02h/rrzRxB5ldB90sClnAxdDgSzUXrXSKnuq/cK80v4iIOETTWRS7o=","X-Received":"by 10.36.26.87 with SMTP id 84mr18436344iti.38.1506931689600;\n\tMon, 02 Oct 2017 01:08:09 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170924190528.21841-3-martin.blumenstingl@googlemail.com>","References":"<20170924190528.21841-1-martin.blumenstingl@googlemail.com>\n\t<20170924190528.21841-3-martin.blumenstingl@googlemail.com>","From":"Ulf Hansson <ulf.hansson@linaro.org>","Date":"Mon, 2 Oct 2017 10:08:09 +0200","Message-ID":"<CAPDyKFqj1CkhHO4SvUySEV4OnKcTeHRu6YAfBPSN4hvkQpHKfA@mail.gmail.com>","Subject":"Re: [RFC v2 2/2] mmc: meson-mx-sdio: Add a driver for the Amlogic\n\tMeson8 and Meson8b SoCs","To":"Martin Blumenstingl <martin.blumenstingl@googlemail.com>","Cc":"Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,\n\tCarlo Caione <carlo@caione.org>, Kevin Hilman <khilman@baylibre.com>, \n\t\"linux-mmc@vger.kernel.org\" <linux-mmc@vger.kernel.org>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-arm-kernel@lists.infradead.org\" \n\t<linux-arm-kernel@lists.infradead.org>,\n\t\"open list:ARM/Amlogic Meson...\" <linux-amlogic@lists.infradead.org>, \n\tCarlo Caione <carlo@endlessm.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1778517,"web_url":"http://patchwork.ozlabs.org/comment/1778517/","msgid":"<CAFBinCCW5r=DFLyBgSrQzDkqHr6uN7Opvi6Tdmb8k+ikw+qnPA@mail.gmail.com>","list_archive_url":null,"date":"2017-10-02T18:45:39","subject":"Re: [RFC v2 2/2] mmc: meson-mx-sdio: Add a driver for the Amlogic\n\tMeson8 and Meson8b SoCs","submitter":{"id":66366,"url":"http://patchwork.ozlabs.org/api/people/66366/","name":"Martin Blumenstingl","email":"martin.blumenstingl@googlemail.com"},"content":"Hi Ulf,\n\nOn Mon, Oct 2, 2017 at 10:08 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:\n> [...]\n>\n>> +#define MESON_MX_SDIO_MAX_SLOTS                                        3\n>> +\n>> +struct meson_mx_mmc_slot {\n>> +       struct device                   *dev;\n>> +       struct mmc_host                 *mmc;\n>> +       struct meson_mx_mmc_host        *host;\n>> +\n>> +       struct mmc_request              *mrq;\n>> +       struct mmc_command              *cmd;\n>> +       int                             error;\n>> +\n>> +       unsigned int                    id;\n>> +};\n>\n> If I recall correctly, we agreed on postponing the multiple slot\n> support for now as to start simple.\nyes, indeed\n\n> Therefore, can you please remove all that code, and instead only use\n> the struct meson_mx_mmc_host for the data needed.\nI initially wanted to keep these structs separated to make it easier\nto spot which part of the logic might have to be changed to support\nmultiple slots\nlooking back at it: currently meson_mx_mmc_slot only contains very\ngeneric stuff, so it'll (hopefully) be easy to spot the relevant parts\nanyways\nI'll remove it, which will even fix a warning found by the \"kbuild\ntest robot\" (where I didn't initialize but use the \"slot\" variable in\nmeson_mx_mmc_timeout)\n\n> Just to be clear, I am fine having using the mmc slot bindings, as we\n> agreed. However as only one slot is supported in this stage, we don't\n> need a separate struct for that.\nACK\n\n>> +\n>> +struct meson_mx_mmc_host {\n>> +       struct device                   *dev;\n>> +\n>> +       struct clk                      *parent_clk;\n>> +       struct clk                      *core_clk;\n>> +       struct clk_divider              cfg_div;\n>> +       struct clk                      *cfg_div_clk;\n>> +       struct clk_fixed_factor         fixed_factor;\n>> +       struct clk                      *fixed_factor_clk;\n>> +\n>> +       void __iomem                    *base;\n>> +       int                             irq;\n>> +       spinlock_t                      irq_lock;\n>> +\n>> +       struct timer_list               cmd_timeout;\n>> +\n>> +       struct meson_mx_mmc_slot        *slot;\n>> +};\n>> +\n>\n> [...]\n>\n>> +static int meson_mx_mmc_slot_probe(struct device *slot_dev,\n>> +                                  struct meson_mx_mmc_host *host)\n>> +{\n>> +       struct meson_mx_mmc_slot *slot;\n>> +       struct mmc_host *mmc;\n>> +       unsigned int id;\n>> +       int ret;\n>> +\n>> +       if (of_property_read_u32(slot_dev->of_node, \"reg\", &id)) {\n>> +               dev_err(slot_dev, \"missing 'reg' property\\n\");\n>> +               return -EINVAL;\n>> +       }\n>> +\n>> +       if (id >= MESON_MX_SDIO_MAX_SLOTS) {\n>> +               dev_err(slot_dev, \"invalid 'reg' property value %d\\n\", id);\n>> +               return -EINVAL;\n>> +       }\n>> +\n>> +       mmc = mmc_alloc_host(sizeof(*slot), slot_dev);\n>> +       if (!mmc)\n>> +               return -ENOMEM;\n>> +\n>> +       slot = mmc_priv(mmc);\n>> +       slot->dev = slot_dev;\n>> +       slot->mmc = mmc;\n>> +       slot->id = id;\n>> +       slot->host = host;\n>> +\n>> +       host->slot = slot;\n>> +\n>> +       /* Get regulators and the supported OCR mask */\n>> +       ret = mmc_regulator_get_supply(mmc);\n>> +       if (ret == -EPROBE_DEFER)\n>> +               goto error_free_host;\n>> +\n>> +       mmc->max_req_size = MESON_MX_SDIO_BOUNCE_REQ_SIZE;\n>> +       mmc->max_seg_size = mmc->max_req_size;\n>> +       mmc->max_blk_count =\n>> +               FIELD_GET(MESON_MX_SDIO_SEND_REPEAT_PACKAGE_TIMES_MASK,\n>> +                         0xffffffff);\n>> +       mmc->max_blk_size = FIELD_GET(MESON_MX_SDIO_EXT_DATA_RW_NUMBER_MASK,\n>> +                                     0xffffffff);\n>> +       mmc->max_blk_size -= (4 * MESON_MX_SDIO_RESPONSE_CRC16_BITS);\n>> +       mmc->max_blk_size /= BITS_PER_BYTE;\n>> +\n>> +       /* Get the min and max supported clock rates */\n>> +       mmc->f_min = clk_round_rate(host->cfg_div_clk, 1);\n>> +       mmc->f_max = clk_round_rate(host->cfg_div_clk,\n>> +                                   clk_get_rate(host->parent_clk));\n>> +\n>> +       mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23;\n>> +       mmc->ops = &meson_mx_mmc_ops;\n>> +\n>> +       ret = mmc_of_parse(mmc);\n>> +       if (ret)\n>> +               goto error_free_host;\n>> +\n>> +       ret = mmc_add_host(mmc);\n>> +       if (ret)\n>> +               goto error_free_host;\n>> +\n>> +       return 0;\n>> +\n>> +error_free_host:\n>> +       mmc_free_host(mmc);\n>> +       return ret;\n>> +}\n>> +\n>> +static int meson_mx_mmc_probe_slots(struct meson_mx_mmc_host *host)\n>> +{\n>> +       struct device_node *slot_node;\n>> +       struct platform_device *slot_pdev;\n>> +       int ret;\n>> +\n>> +       for_each_child_of_node(host->dev->of_node, slot_node) {\n>> +               if (!of_device_is_compatible(slot_node, \"mmc-slot\"))\n>> +                       continue;\n>> +\n>> +               /*\n>> +                * TODO: the MMC core framework currently does not support\n>> +                * controllers with multiple slots properly.\n>> +                */\n>> +               if (host->slot) {\n>> +                       dev_warn(host->dev,\n>> +                                \"skipping slot other than the first\\n\");\n>> +                       continue;\n>> +               }\n>> +\n>> +               slot_pdev = of_platform_device_create(slot_node, NULL,\n>> +                                                     host->dev);\n>> +               if (!slot_pdev)\n>> +                       continue;\n>> +\n>> +               ret = meson_mx_mmc_slot_probe(&slot_pdev->dev, host);\n>> +               if (ret) {\n>> +                       of_platform_device_destroy(&slot_pdev->dev, NULL);\n>> +                       return ret;\n>> +               }\n>> +       }\n>> +\n>> +       return 0;\n>> +}\n>\n> For the above two functions, please simplify the code by limiting them\n> to deal with only one valid mmc-slot.\nOK, I'll do that - however I'll leave that TODO comment in the code so\npeople know that this is on purpose\n\n> [...]\n>\n> Besides the comments on the multiple slot support, this looks good to me.\nawesome, thanks for reviewing!\nI'll send an updated version as soon as I have time\n\n\nRegards,\nMartin\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=googlemail.com header.i=@googlemail.com\n\theader.b=\"OE+O+Hb5\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y5WMb5rBpz9t64\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue,  3 Oct 2017 05:46:03 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751945AbdJBSqC (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tMon, 2 Oct 2017 14:46:02 -0400","from mail-io0-f196.google.com ([209.85.223.196]:35031 \"EHLO\n\tmail-io0-f196.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751354AbdJBSqB (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Mon, 2 Oct 2017 14:46:01 -0400","by mail-io0-f196.google.com with SMTP id d16so3571688ioj.2;\n\tMon, 02 Oct 2017 11:46:00 -0700 (PDT)","by 10.2.51.84 with HTTP; Mon, 2 Oct 2017 11:45:39 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlemail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=Dzg2oeh5UARctE5AE5skqMaXDPiYwOsZxR6AFdDzfH8=;\n\tb=OE+O+Hb5KwSL85KdN5oTEKRtpS3vCpYbrmoLv1/jRCFuDKYvwp5ye/bErgxxdo8JYR\n\ttWI7tJdQ1FXNhzdsahOKAlIdZj2dOCh1qtlvMid+8LMmJpWEzDQTelxvpTXsDQ+n09C9\n\t+/8jczM4JlYICv31SSxH7zL/ZfSwGfqaO2FRvSsJwScuYXW0qbetBiDTXeT4Ohtw1TuP\n\t03iKztvHbUMb3VzIMqwq6mxfnYe9BW0bzoWWTmgqKHIwdWw4jtZKCXB7r3G27xHmO1en\n\tca/8J8g+vJ9NXRqizwvogJKAPEP+ZhQGBM1+xdKuY2NC4bVVvYMpZ7YHga0nc8n4MDda\n\t9OcQ==","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:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=Dzg2oeh5UARctE5AE5skqMaXDPiYwOsZxR6AFdDzfH8=;\n\tb=YYG7XuDrmWUjAtWGX77F5eXflSyXdqDrjtaCvK0aM+KgBSDtiAQrTHYr47gZjyXCYy\n\tiph98g89F1CO+R59VXVVNb2cw/4UTK2M8E53Pd9Tznn0ycGsaHsaDV9gFDtgl4z3dl9r\n\tObIoj0OMYsCQNC4sl0f8Jsd2Oh5JKKEYyO20kZVszjMNy3C0K024u8E40/qUvejulg0A\n\tSvdriUIYBik4cZDScZTHyzpv7MFORzGvKu8xSfhI03V3yk2R3TMEowoPks8cJxXmSfoa\n\t05EvmdgxtjUaMyOzWXItBm5OXSFx0bBc+13wO20DZUh0yu4vn+QaZ+oZzanwoU3QnCRb\n\twAEQ==","X-Gm-Message-State":"AMCzsaV0akqZtBMFfJgt+PgEWc9eWnYzPfbSISv57dOvGa9hOkhO7c2J\n\tNhAHUf+E25kknCh5EPHRWHFuGG2Cn5CVOSJ45UI=","X-Google-Smtp-Source":"AOwi7QBIT9uP6T/e0uoKx2NLpleK+OFaTygEcwLFyZjqMUU0uvVQjjDhWIEhbihzVYDb3fYKY8s7D9XA/LxEHyogxI8=","X-Received":"by 10.107.81.1 with SMTP id f1mr25418277iob.17.1506969959975;\n\tMon, 02 Oct 2017 11:45:59 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAPDyKFqj1CkhHO4SvUySEV4OnKcTeHRu6YAfBPSN4hvkQpHKfA@mail.gmail.com>","References":"<20170924190528.21841-1-martin.blumenstingl@googlemail.com>\n\t<20170924190528.21841-3-martin.blumenstingl@googlemail.com>\n\t<CAPDyKFqj1CkhHO4SvUySEV4OnKcTeHRu6YAfBPSN4hvkQpHKfA@mail.gmail.com>","From":"Martin Blumenstingl <martin.blumenstingl@googlemail.com>","Date":"Mon, 2 Oct 2017 20:45:39 +0200","Message-ID":"<CAFBinCCW5r=DFLyBgSrQzDkqHr6uN7Opvi6Tdmb8k+ikw+qnPA@mail.gmail.com>","Subject":"Re: [RFC v2 2/2] mmc: meson-mx-sdio: Add a driver for the Amlogic\n\tMeson8 and Meson8b SoCs","To":"Ulf Hansson <ulf.hansson@linaro.org>","Cc":"Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,\n\tCarlo Caione <carlo@caione.org>, Kevin Hilman <khilman@baylibre.com>, \n\t\"linux-mmc@vger.kernel.org\" <linux-mmc@vger.kernel.org>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-arm-kernel@lists.infradead.org\" \n\t<linux-arm-kernel@lists.infradead.org>,\n\t\"open list:ARM/Amlogic Meson...\" <linux-amlogic@lists.infradead.org>, \n\tCarlo Caione <carlo@endlessm.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1778845,"web_url":"http://patchwork.ozlabs.org/comment/1778845/","msgid":"<CAFBinCDrEmj27ewWQ4+rNXtFSWR3dUoF5H2qZmn2=bpP6OXSZw@mail.gmail.com>","list_archive_url":null,"date":"2017-10-03T11:19:08","subject":"Re: [RFC v2 0/2] Add support for Meson MX \"SDIO\" MMC controller","submitter":{"id":66366,"url":"http://patchwork.ozlabs.org/api/people/66366/","name":"Martin Blumenstingl","email":"martin.blumenstingl@googlemail.com"},"content":"Hi Rob,\n\nOn Wed, Sep 27, 2017 at 9:36 PM, Rob Herring <robh@kernel.org> wrote:\n> On Sun, Sep 24, 2017 at 09:05:26PM +0200, Martin Blumenstingl wrote:\n>> This is the successor to Carlo Caione's \"Add support for Amlogic Meson\n>> MMC driver\" series (v5) from [0].\n>> This new driver is for the \"SDIO\" controller found in Amlogic Meson6,\n>> Meson8 and Meson8b SoCs and supports an internal mux to allow connecting\n>> three cards to it.\n>>\n>>\n>> changes since RFC v1 at [1]:\n>> - added COMMON_CLK dependency as reported by the kbuild test robot\n>> - use of_platform_device_{create,destroy} instead of open-coding it's\n>>   logic\n>> - moved struct device (which was an array) from meson_mx_mmc_host to\n>>   the corresponding meson_mx_mmc_slot\n>> - use struct mmc_command's busy_timeout instead of hard-coding the\n>>   timeout values in meson_mx_mmc_start_cmd()\n>> - don't use arrays with only one element for the clock parents in\n>>   meson_mx_mmc_register_clks()\n>> - removed the wrapper functions meson_mx_mmc_readl() meson_mx_mmc_writel()\n>> - allow setting the MMC clock to 0 for UHS speed mode (the actual\n>>   hardware clock cannot be gated as far as I know, so instead the\n>>   lowest supported rate is chosen)\n>> - remove unused #include <linux/init.h>\n>> - add MMC_CAP_ERASE\n>> - removed multiple slot support after discussing this with Ulf\n>>   (this is a feature that needs to be part of the MMC core before drivers\n>>   can use it)\n>> - removed SDIO interrupt support (as I currently don't have a way to\n>>   test it)\n>> - merge meson_mx_mmc_apply_ios into meson_mx_mmc_set_ios (as that's\n>>   the only place where it's needed after removing multiple slot support)\n>> - updated the commit message of the driver patch to indicate the\n>>   difference between the meson-mx-sdio.c and meson-gx.c (and the \"still\n>>   missing SDHC\") driver\n>> - NOTE: I did not add Rob's ACK on the dt-bindings patch because I\n>>   introduced the \"mmc-slot\" compatible for the child nodes as suggested\n>>   by Ulf (and I want confirmation from the DT maintainers that I did this\n>>   correctly)\n>\n> Didn't slot support get removed as no h/w really uses that feature?\nI have at least one boards which uses it: Endless Mini (EC-100)\nthe SoC itself has two MMC controllers, but that board has:\n- an eMMC module (connected to a yet unsupported MMC controller)\n- an internal SD card (connected to the SDIO controller from this patch)\n- a RTL8723BS wifi SDIO card (also connected to the SDIO controller\nfrom this patch)\n\nso it's pretty rare - but such hardware exists.\n\n\nRegards,\nMartin\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=googlemail.com header.i=@googlemail.com\n\theader.b=\"X9zaT6jK\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y5xPw0XX7z9s83\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue,  3 Oct 2017 22:19:32 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750841AbdJCLTa (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 3 Oct 2017 07:19:30 -0400","from mail-io0-f193.google.com ([209.85.223.193]:34942 \"EHLO\n\tmail-io0-f193.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750720AbdJCLT3 (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 3 Oct 2017 07:19:29 -0400","by mail-io0-f193.google.com with SMTP id d16so4641487ioj.2;\n\tTue, 03 Oct 2017 04:19:29 -0700 (PDT)","by 10.2.51.84 with HTTP; Tue, 3 Oct 2017 04:19:08 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlemail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=e47n7zePQdO2zgF07lPQFWmGqTDUISUuYBfvFkFRygY=;\n\tb=X9zaT6jK8UJQwSvOj4cAqvYTV/c1esnfn8KhDeBs7A126MaPXVcVgIayDGrGJrR5js\n\t/mVcCu3zHj2oFI+VD5GibroiisCBaLFw1F+rF1bkVdKzQEszZk5DYQOZ7LE/lmji1fuz\n\tJvhfbScE/nlf/cdQFH3/mfB+cbL+SHxWHfHZlB9MSXbykk009IJUH3fFS96k2AUlywkD\n\tjCpwhbOqEBesB2v5Z3m/sw5UeKQ9vPWIb8eFA5KitbNt4lLaE1rx0hi4P8sKK3BoND8n\n\tATazSkGqXu9Ed3kO9hBpB9LrHRVHhYJ91kwmrUmsdaTXJZBJ5VRxA75hRMYz9d2R2mku\n\teT3g==","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:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=e47n7zePQdO2zgF07lPQFWmGqTDUISUuYBfvFkFRygY=;\n\tb=ZjNUFpRtyBe5tah9JznWF+9wSjDEQh0rELXRC+7Gl3kl3t1MNmN3fz0n86B/7RRIb/\n\togPqFVBJ1+3Pv+gidczQWUQ/zDCNFKZGgyGXIVbFuc+iKqfjsOndC8i+DkCPDy96Kc52\n\tIpHOwoFBWfA6pQ7saQbnQ2F3SWK4JQw9LtT58BInhuZs/2/mmu6UYN7XULP+Atc3Tw1X\n\teOWHzxdz1SWxofYo36j1Uu5rO3rbRff6er2/THfn/MS23RT94X/4X2eQzXdPcApr9GaK\n\tsmuEOAB7a4rPtYoJpP3cyB/mMRywx5ygxtmamW0yCHRp0zl0vRDyexalJktDnMzML0/n\n\t3GJg==","X-Gm-Message-State":"AMCzsaXH5UbjnfI7hAHJlk0hFXkiOrI0o0Vl20MWbopIhnfsgh9vRRR+\n\taxQXPnVbhaNB5EbN4PjY6UWwSB2BSZwbIBzwOS8=","X-Google-Smtp-Source":"AOwi7QA8QOGdYxq2KO3cdYD4L4SAddTLNnrd59AxreuAXluosPc0ohzi9YzPwns+s/sIbpwpBUj9BX/GsS/Ki7B0Wq8=","X-Received":"by 10.107.7.161 with SMTP id g33mr26912836ioi.169.1507029568681; \n\tTue, 03 Oct 2017 04:19:28 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170927193616.32gxszmk4cjjoqmo@rob-hp-laptop>","References":"<20170924190528.21841-1-martin.blumenstingl@googlemail.com>\n\t<20170927193616.32gxszmk4cjjoqmo@rob-hp-laptop>","From":"Martin Blumenstingl <martin.blumenstingl@googlemail.com>","Date":"Tue, 3 Oct 2017 13:19:08 +0200","Message-ID":"<CAFBinCDrEmj27ewWQ4+rNXtFSWR3dUoF5H2qZmn2=bpP6OXSZw@mail.gmail.com>","Subject":"Re: [RFC v2 0/2] Add support for Meson MX \"SDIO\" MMC controller","To":"Rob Herring <robh@kernel.org>","Cc":"ulf.hansson@linaro.org, mark.rutland@arm.com, carlo@caione.org,\n\tkhilman@baylibre.com, linux-mmc@vger.kernel.org,\n\tdevicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tlinux-amlogic@lists.infradead.org","Content-Type":"text/plain; charset=\"UTF-8\"","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}}]