All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] mips: Add basic MediaTek MT7620/88 support
Date: Sun, 12 Aug 2018 00:52:23 +0200	[thread overview]
Message-ID: <41424b87-58c9-e6f9-5616-125bc5704620@gmail.com> (raw)
In-Reply-To: <df9b8655-3447-d43f-52e0-617b54620732@denx.de>



On 09.08.2018 16:22, Stefan Roese wrote:

>>>>> diff --git a/arch/mips/mach-mt7620/cpu.c b/arch/mips/mach-mt7620/cpu.c
>>>>> new file mode 100644
>>>>> index 0000000000..0b22956499
>>>>> --- /dev/null
>>>>> +++ b/arch/mips/mach-mt7620/cpu.c
>>>>> @@ -0,0 +1,66 @@
>>>>> +// SPDX-License-Identifier: GPL-2.0+
>>>>> +/*
>>>>> + * Copyright (C) 2018 Stefan Roese <sr@denx.de>
>>>>> + */
>>>>> +
>>>>> +#include <common.h>
>>>>> +#include <dm.h>
>>>>> +#include <ram.h>
>>>>> +#include <asm/io.h>
>>>>> +#include <linux/io.h>
>>>>> +#include <linux/sizes.h>
>>>>> +#include "mt76xx.h"
>>>>> +
>>>>> +#define STR_LEN                        6
>>>>> +
>>>>> +#ifdef CONFIG_BOOT_ROM
>>>>> +int mach_cpu_init(void)
>>>>> +{
>>>>> +       void (*ptr)(void);
>>>>> +
>>>>> +       /*
>>>>> +        * DDR calibration routine needs to be called very early. This
>>>>> +        * function also configures the clock to run at full speed.
>>>>> +        */
>>>>> +       ptr = (void *)CKSEG0ADDR(ddr_calibrate);
>>>>> +       (*ptr)();
>>>>
>>>> what is the purpose of forcing the function symbol to KSEG0?
>>>
>>> Its copied from the original MediaTek code. I just tested it without
>>> forcing the execution into KSEG0 and the DDR calibration is extremely
>>> slow then, taking a few minutes to complete.
>>>
>>> I have to admit that I am not 100% sure, if the caches are configured
>>> 100% correctly / optimally for this SoC. Perhaps you (or someone else)
>>> has some improvements here.
>>
>> I guess the BootROM does some XiP magic with the SPI flash controller
>> and runs in the uncached KSEG1 segment.
>> That would explain why the pre-relocation code runs so slowly. But
>> this shift from KSEG1 to KSEG0 could be done
>> generically in start.S after the cache initialization is complete. I
>> will have a look at it.
> 
> That would be great. Please let me know if you need some help with
> testing etc.
> 

could you try branch mips_optimize_cache_init from
git://git.denx.de/u-boot-mips.git. You have to change your text base
from 0xbc000000 to 0x9c000000 to execute all code prior relocation from
the cached KSEG0 segment. The code should now run fast without that
function pointer magic.

For now the patch series is only tested in Qemu and needs some more
cleanup. I'll try to do some testing on real hardware in the next days.

-- 
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180812/bba228e3/attachment.sig>

  reply	other threads:[~2018-08-11 22:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 15:11 [U-Boot] [PATCH 1/4] mips: Add basic MediaTek MT7620/88 support Stefan Roese
2018-08-06 15:11 ` [U-Boot] [PATCH 2/4] mips: Add arch/mips/include/asm/atomic.h Stefan Roese
2018-08-07 14:51   ` Daniel Schwierzeck
2018-08-09  9:27     ` Stefan Roese
2018-08-09 10:20       ` Daniel Schwierzeck
2018-08-06 15:11 ` [U-Boot] [PATCH 3/4] mips: Add LinkIt Smart 7688 support Stefan Roese
2018-08-06 15:11 ` [U-Boot] [PATCH 4/4] mips: Add Gardena Smart-Gateway board support Stefan Roese
2018-08-07 15:44 ` [U-Boot] [PATCH 1/4] mips: Add basic MediaTek MT7620/88 support Daniel Schwierzeck
2018-08-09 10:46   ` Stefan Roese
2018-08-09 13:28     ` Daniel Schwierzeck
2018-08-09 14:22       ` Stefan Roese
2018-08-11 22:52         ` Daniel Schwierzeck [this message]
2018-08-15  6:22           ` Stefan Roese

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=41424b87-58c9-e6f9-5616-125bc5704620@gmail.com \
    --to=daniel.schwierzeck@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.