<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Joel,<br>
</div>
<div><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Can you please apply this below patch to kernel 5.0.<br>
<br>
Regards<br>
-Vijay<br>
<br>
On 3/18/19, 12:46 PM, "openbmc on behalf of Vijay Khemka" <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org on behalf of vijaykhemka@fb.com> wrote:<br>
<br>
    Hi Joel,<br>
    Can you please apply this patch as " Documentation/devicetree/bindings/mfd/aspeed-lpc.txt" has already been applied<br>
<br>
    Regards<br>
    -Vijay<br>
<br>
    On 3/5/19, 4:15 PM, "Linux-aspeed on behalf of Vijay Khemka" <linux-aspeed-bounces+vijaykhemka=fb.com@lists.ozlabs.org on behalf of vijaykhemka@fb.com> wrote:<br>
<br>
        Joel,<br>
        Did this patch apply upstream. Somehow I can't find this patch in linux or linux-next or our obmc dev4.19.<br>
<br>
        Regards<br>
        -Vijay<br>
<br>
        On 1/17/19, 10:53 AM, "Linux-aspeed on behalf of Vijay Khemka" <linux-aspeed-bounces+vijaykhemka=fb.com@lists.ozlabs.org on behalf of vijaykhemka@fb.com> wrote:<br>
<br>
<br>
<br>
            On 1/16/19, 10:17 PM, "Joel Stanley" <joel@jms.id.au> wrote:<br>
<br>
                On Thu, 17 Jan 2019 at 09:02, Vijay Khemka <vijaykhemka@fb.com> wrote:<br>
                ><br>
                > Makiing memory-region and flash as optional parameter in device<br>
                > tree if user needs to use these parameter through ioctl then<br>
                > need to define in devicetree.<br>
                ><br>
                > Signed-off-by: Vijay Khemka <vijaykhemka@fb.com><br>
<br>
                Thanks! This looks okay to me. I tested it on one of our systems which<br>
                uses both flash and reserved memory and it was fine.<br>
<br>
                Reviewed-by: Joel Stanley <joel@jms.id.au><br>
<br>
                Can you also send a patch to update the bindings at<br>
                Documentation/devicetree/bindings/mfd/aspeed-lpc.txt ? I think the<br>
                only change you need to make is to move the memory region and flash<br>
                properties to optional (instead of required).<br>
<br>
            Sure I will do this.<br>
<br>
                Cheers,<br>
<br>
                Joel<br>
<br>
                > ---<br>
                >  drivers/misc/aspeed-lpc-ctrl.c | 58 +++++++++++++++++++++-------------<br>
                >  1 file changed, 36 insertions(+), 22 deletions(-)<br>
                ><br>
                > diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c<br>
                > index a024f8042259..332210e06e98 100644<br>
                > --- a/drivers/misc/aspeed-lpc-ctrl.c<br>
                > +++ b/drivers/misc/aspeed-lpc-ctrl.c<br>
                > @@ -68,6 +68,7 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd,<br>
                >                 unsigned long param)<br>
                >  {<br>
                >         struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file);<br>
                > +       struct device *dev = file->private_data;<br>
                >         void __user *p = (void __user *)param;<br>
                >         struct aspeed_lpc_ctrl_mapping map;<br>
                >         u32 addr;<br>
                > @@ -90,6 +91,12 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd,<br>
                >                 if (map.window_id != 0)<br>
                >                         return -EINVAL;<br>
                ><br>
                > +               /* If memory-region is not described in device tree */<br>
                > +               if (!lpc_ctrl->mem_size) {<br>
                > +                       dev_err(dev, "Didn't find reserved memory\n");<br>
                > +                       return -EINVAL;<br>
                > +               }<br>
                > +<br>
                >                 map.size = lpc_ctrl->mem_size;<br>
                ><br>
                >                 return copy_to_user(p, &map, sizeof(map)) ? -EFAULT : 0;<br>
                > @@ -126,9 +133,18 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd,<br>
                >                         return -EINVAL;<br>
                ><br>
                >                 if (map.window_type == ASPEED_LPC_CTRL_WINDOW_FLASH) {<br>
                > +                       if (!lpc_ctrl->pnor_size) {<br>
                > +                               dev_err(dev, "Didn't find host pnor flash\n");<br>
                > +                               return -EINVAL;<br>
                > +                       }<br>
                >                         addr = lpc_ctrl->pnor_base;<br>
                >                         size = lpc_ctrl->pnor_size;<br>
                >                 } else if (map.window_type == ASPEED_LPC_CTRL_WINDOW_MEMORY) {<br>
                > +                       /* If memory-region is not described in device tree */<br>
                > +                       if (!lpc_ctrl->mem_size) {<br>
                > +                               dev_err(dev, "Didn't find reserved memory\n");<br>
                > +                               return -EINVAL;<br>
                > +                       }<br>
                >                         addr = lpc_ctrl->mem_base;<br>
                >                         size = lpc_ctrl->mem_size;<br>
                >                 } else {<br>
                > @@ -196,17 +212,17 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)<br>
                >         if (!lpc_ctrl)<br>
                >                 return -ENOMEM;<br>
                ><br>
                > +       /* If flash is described in device tree then store */<br>
                >         node = of_parse_phandle(dev->of_node, "flash", 0);<br>
                >         if (!node) {<br>
                > -               dev_err(dev, "Didn't find host pnor flash node\n");<br>
                > -               return -ENODEV;<br>
                > -       }<br>
                > -<br>
                > -       rc = of_address_to_resource(node, 1, &resm);<br>
                > -       of_node_put(node);<br>
                > -       if (rc) {<br>
                > -               dev_err(dev, "Couldn't address to resource for flash\n");<br>
                > -               return rc;<br>
                > +               dev_dbg(dev, "Didn't find host pnor flash node\n");<br>
                > +       } else {<br>
                > +               rc = of_address_to_resource(node, 1, &resm);<br>
                > +               of_node_put(node);<br>
                > +               if (rc) {<br>
                > +                       dev_err(dev, "Couldn't address to resource for flash\n");<br>
                > +                       return rc;<br>
                > +               }<br>
                >         }<br>
                ><br>
                >         lpc_ctrl->pnor_size = resource_size(&resm);<br>
                > @@ -214,22 +230,22 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)<br>
                ><br>
                >         dev_set_drvdata(&pdev->dev, lpc_ctrl);<br>
                ><br>
                > +       /* If memory-region is described in device tree then store */<br>
                >         node = of_parse_phandle(dev->of_node, "memory-region", 0);<br>
                >         if (!node) {<br>
                > -               dev_err(dev, "Didn't find reserved memory\n");<br>
                > -               return -EINVAL;<br>
                > -       }<br>
                > +               dev_dbg(dev, "Didn't find reserved memory\n");<br>
                > +       } else {<br>
                > +               rc = of_address_to_resource(node, 0, &resm);<br>
                > +               of_node_put(node);<br>
                > +               if (rc) {<br>
                > +                       dev_err(dev, "Couldn't address to resource for reserved memory\n");<br>
                > +                       return -ENOMEM;<br>
                > +               }<br>
                ><br>
                > -       rc = of_address_to_resource(node, 0, &resm);<br>
                > -       of_node_put(node);<br>
                > -       if (rc) {<br>
                > -               dev_err(dev, "Couldn't address to resource for reserved memory\n");<br>
                > -               return -ENOMEM;<br>
                > +               lpc_ctrl->mem_size = resource_size(&resm);<br>
                > +               lpc_ctrl->mem_base = resm.start;<br>
                >         }<br>
                ><br>
                > -       lpc_ctrl->mem_size = resource_size(&resm);<br>
                > -       lpc_ctrl->mem_base = resm.start;<br>
                > -<br>
                >         lpc_ctrl->regmap = syscon_node_to_regmap(<br>
                >                         pdev->dev.parent->of_node);<br>
                >         if (IS_ERR(lpc_ctrl->regmap)) {<br>
                > @@ -258,8 +274,6 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)<br>
                >                 goto err;<br>
                >         }<br>
                ><br>
                > -       dev_info(dev, "Loaded at %pr\n", &resm);<br>
                > -<br>
                >         return 0;<br>
                ><br>
                >  err:<br>
                > --<br>
                > 2.17.1<br>
                ><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</span></font></div>
</body>
</html>