mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Cc: artlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	linux-fbdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: simple-framebuffer enquire
Date: Tue, 26 Jun 2018 16:47:07 +0200	[thread overview]
Message-ID: <7b996681-3a94-1f93-10c0-5369fe843cbc@redhat.com> (raw)
In-Reply-To: <CAOf5uwnVoXw1MA=n3vphMhtto=fc+NVf11idLF8nwC6JCvf4+A@mail.gmail.com>

Hi,

On 26-06-18 16:42, Michael Nazzareno Trimarchi wrote:
> Hi Hans
> 
> On Tue, Jun 26, 2018 at 3:38 PM, Michael Nazzareno Trimarchi
> <michael@amarulasolutions.com> wrote:
>> Hi
>>
>> On Tue, Jun 26, 2018 at 3:36 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>>> Hi,
>>>
>>>
>>> On 26-06-18 15:29, Michael Nazzareno Trimarchi wrote:
>>>>
>>>> Hi
>>>>
>>>> to be more specific
>>>>
>>>> On Tue, Jun 26, 2018 at 3:06 PM, Michael Nazzareno Trimarchi
>>>> <michael@amarulasolutions.com> wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> On Tue., 26 Jun. 2018, 12:01 pm Hans de Goede, <hdegoede@redhat.com>
>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On 25-06-18 15:29, Michael Nazzareno Trimarchi wrote:
>>>>>>>
>>>>>>> Hi Hans
>>>>>>>
>>>>>>> In order to let it even registered the simplefb I have added this
>>>>>>> change. According on what I understand
>>>>>>> from the code seems that this is the way to acquire memory with the
>>>>>>> correct attribute
>>>>>>>
>>>>>>> diff --git a/drivers/video/fbdev/simplefb.c
>>>>>>> b/drivers/video/fbdev/simplefb.c
>>>>>>> index a3c44ec..7e61ce3 100644
>>>>>>> --- a/drivers/video/fbdev/simplefb.c
>>>>>>> +++ b/drivers/video/fbdev/simplefb.c
>>>>>>> @@ -466,8 +466,8 @@ static int simplefb_probe(struct platform_device
>>>>>>> *pdev)
>>>>>>>
>>>>>>>            info->fbops = &simplefb_ops;
>>>>>>>            info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE;
>>>>>>> -       info->screen_base = ioremap_wc(info->fix.smem_start,
>>>>>>> -                                      info->fix.smem_len);
>>>>>>> +       info->screen_base = arch_memremap_wb(info->fix.smem_start,
>>>>>>> +                                            info->fix.smem_len);
>>>>>>
>>>>>>
>>>>>> I'm not sure why you need this?  wb certainly is not optimal
>>>>>> for a framebuffer, the existing wc mapping is really what you
>>>>>> want.
>>>>>>
>>>>>
>>>>> Well in this way raise a WARN and get a nice NULL on memory remap on
>>>>> imx6ull
>>>>> SoC
>>>>>
>>>>
>>>> [    0.397484] WARNING: CPU: 0 PID: 1 at arch/arm/mm/ioremap.c:303
>>>> __arm_ioremap_pfn_caller+0x80/0x1cc
>>>
>>>
>>>
>>> This is causes by a mismatch in memory attributes, which means the
>>> memory is already mapped by the kernel as regular RAM and may
>>> already be used for other purposes by the kernel!
>>>
>>> Memory used by a simplefb framebuffer must be reserved by the
>>> bootloader, so that it does not get used by the kernel as regular
>>> RAM. See e.g.:
>>>
>>> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/video/sunxi/sunxi_display.c
>>>
>>> Near the end of the file where the framebuffer RAM gets excluded from
>>> the memory-range reported to the kernel as usable RAM. Note this relies
>>> on the u-boot sunxi video code putting the framebuffer at the end of the
>>> RAM.
> 
> +       aliases {
> +               display0 = &lcdif;
> +       };
> +
> +       reserved-memory {
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +               ranges;
> +
> +               display_reserved: framebuffer@86fd6080 {
> +                       reg = <0x86fd6080 (480 * 272 *4)>;
> +               };
> +
> 
> This should do the trick but I have still the same problem on memory
> type. Any idea?

For starters your start address and size are not page-size
(multiple of 4k aligned), you need to fix that.

After that double check in the memory map reported by the
kernel during boot that your reservation actually works.

Regards,

Hans



> 
> 
> +               linux,cma {
> +                       compatible = "shared-dma-pool";
> +                       reusable;
> +                       size = <0x1000000>;
> +                       linux,cma-default;
> +               };
> +       };
> +
> +       chosen {
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +               ranges;
> +
> +               stdout-path = &uart1;
> +               framebuffer0: framebuffer@86fd6080 {
> +                       compatible = "simple-framebuffer";
> +                       reg = <0x86fd6080 (480 * 272 * 4)>;
> 
> Here I try to use the same. I will create in uboot a dynamic way to
> track down. I think that
> we can even add to the simple buffer a way to get hand of reserved
> region automatically
> 
> Michael
> 
> +                       width = <480>;
> +                       height = <272>;
> +                       stride = <(480 * 4)>;
> +                       format = "a8r8g8b8";
> +                       clocks = <&clks IMX6UL_CLK_LCDIF_PIX>,
> +                                <&clks IMX6UL_CLK_LCDIF_APB>,
> +                                <&clks IMX6UL_CLK_DUMMY>,
> +                                <&clks IMX6UL_CLK_GPIO3>,
> +                                <&clks IMX6UL_CLK_GPIO4>;
> +                       nshut-supply = <&reg_lcd_nshut>;
> +                       nreset-supply = <&reg_lcd_nreset>;
> +                       display = <&lcdif>;
> +                       status = "okay";
> +               };
> 
> 
> 
>>>
>>
>> Thank you very much for this lesson ;). I will try to document better
>> after my tour ;)
>>
>> Michael
>>
>>> Regards,
>>>
>>> Hans
>>
>>
>>
>> --
>> | Michael Nazzareno Trimarchi                     Amarula Solutions BV |
>> | COO  -  Founder                                      Cruquiuskade 47 |
>> | +31(0)851119172                                 Amsterdam 1018 AM NL |
>> |                  [`as] http://www.amarulasolutions.com               |
> 
> 
> 

  reply	other threads:[~2018-06-26 14:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 13:29 Michael Nazzareno Trimarchi
2018-06-26 10:01 ` Hans de Goede
     [not found]   ` <CAOf5uwk2cf_+27nk9i9MQmbfJ8LCfPYopkcX__9M64jMYmhu1A@mail.gmail.com>
2018-06-26 13:29     ` Michael Nazzareno Trimarchi
2018-06-26 13:36       ` Hans de Goede
2018-06-26 13:38         ` Michael Nazzareno Trimarchi
2018-06-26 14:42           ` Michael Nazzareno Trimarchi
2018-06-26 14:47             ` Hans de Goede [this message]
2018-06-26 16:35               ` Michael Nazzareno Trimarchi
2018-06-26 18:44                 ` Hans de Goede
2018-06-26 18:59                   ` Julia Cartwright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b996681-3a94-1f93-10c0-5369fe843cbc@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@amarulasolutions.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®