public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/4] mips: add base support for atheros ath79 based SOCs
Date: Sat, 26 Dec 2015 07:02:32 +0100	[thread overview]
Message-ID: <201512260702.32790.marex@denx.de> (raw)
In-Reply-To: <BLU437-SMTP653034A84485A5BC0EB112FFF80@phx.gbl>

On Friday, December 25, 2015 at 12:38:39 PM, Wills Wang wrote:
> On 12/24/2015 11:12 PM, Marek Vasut wrote:
> > On Thursday, December 24, 2015 at 02:51:06 PM, Wills Wang wrote:
> > 
> > [...]
> > 
> >>>> +LEAF(lowlevel_init)
> >>>> +   /* These three WLAN_RESET will avoid original issue */
> >>>> +    li      t3, 0x03
> >>>> +1:
> >>>> +    li      t0, KSEG1ADDR(AR71XX_RESET_BASE)
> >>>> +    lw      t1, AR933X_RESET_REG_RESET_MODULE(t0)
> >>>> +    ori     t1, t1, 0x0800
> >>>> +    sw      t1, AR933X_RESET_REG_RESET_MODULE(t0)
> >>>> +    nop
> >>>> +    lw      t1, AR933X_RESET_REG_RESET_MODULE(t0)
> >>>> +    li      t2, 0xfffff7ff
> >>>> +    and     t1, t1, t2
> >>>> +    sw      t1, AR933X_RESET_REG_RESET_MODULE(t0)
> >>>> +    nop
> >>>> +    addi    t3, t3, -1
> >>>> +    bnez    t3, 1b
> >>>> +     nop
> >>> 
> >>> This should be also easy to rewrite into C , right ?
> >> 
> >> C runtime environment is not available.
> >> C stack is not ready before DDR has initialized.
> > 
> > Just point the stack into a locked cacheline or some onchip RAM and there
> > you have a C runtime. That should be pretty easy :)
> 
> How to lock cacheline?

You'd have to check the MIPS core manual, I don't know the details, sorry.

> My guess is that cache memory may be use to map SPI flash at 0x9f000000
> by ROM code.

The SPI flash is an IP block which just maps the SPI NOR into the address space,
it doesn't use the CPU cache at all.

Maybe you don't even need to lock cachelines though, the AR9331 should have some 
internal SRAM, so just use that for stack. Do you have a proper datasheet for 
the Atheros MIPS chips ? I have some 320 pages datasheet for AR9331.

> > [...]
> > 
> >>>> +phys_size_t initdram(int board_type)
> >>>> +{
> >>>> +	uint8_t *addr, *p;
> >>>> +	int i;
> >>>> +
> >>>> +	ddr_tap_init();
> >>>> +	addr = (uint8_t *)KSEG1;
> >>>> +	*addr = 0x77;
> >>>> +	for (i = 0, p = addr; p < (uint8_t *)KSEG2; i++) {
> >>>> +		p += 0x1000000;
> >>>> +		*p = i;
> >>>> +		if (*addr != 0x77)
> >>>> +			break;
> >>>> +	}
> >>> 
> >>> What is this and how does it work ?
> >> 
> >> Physical memory was mapped circularly for this chip.
> > 
> > Can you please expand on that ? I am not as deep in this chip as you are,
> > so please explain it to me in a bit more detail.

Well ... ?

> >>>> +	return (phys_size_t)(p - addr);
> >>>> +}
> > 
> > [...]
> > 
> >>>> +	if (reg) {
> >>>> +		val = RST_READ(reg);
> >>>> +		val |= AR71XX_RESET_FULL_CHIP;
> >>>> +		RST_WRITE(reg, val);
> >>> 
> >>> setbits_le32() please.
> >> 
> >> Macro setbits_le32() is not available for MIPS architecture.
> > 
> > You can always add them :)
> > 
> >> Other, I don't think there is better in being so explicit and using
> >> little-endian.
> > 
> > I believe your register accesses should have correct endianness exactly
> > beause mips can be both endian.
> 
> What is the advantage of using setbits_le32()?

You don't have these constant repeating patterns of:

var = read()
var |= BIT
write(var)

It makes things a bit less confusing.

Best regards,
Marek Vasut

  reply	other threads:[~2015-12-26  6:02 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1450956123-17606-1-git-send-email-wills.wang@live.com>
2015-12-24 11:22 ` [U-Boot] [PATCH v3 1/4] mips: add base support for atheros ath79 based SOCs Wills Wang
2015-12-24 11:52   ` Marek Vasut
2015-12-24 13:51     ` Wills Wang
2015-12-24 15:12       ` Marek Vasut
2015-12-25 11:38         ` Wills Wang
2015-12-26  6:02           ` Marek Vasut [this message]
2015-12-26 15:48             ` Wills Wang
2015-12-26 17:35               ` Marek Vasut
2015-12-26 18:17                 ` Marek Vasut
2015-12-26 18:29                   ` Wills Wang
2015-12-26 18:37                     ` Marek Vasut
2015-12-27  7:33                       ` Wills Wang
2015-12-27  7:38                         ` Marek Vasut
2015-12-27  8:07                           ` Wills Wang
2015-12-27 10:09                             ` Marek Vasut
2015-12-27 10:18                               ` Wills Wang
2015-12-27 11:04                                 ` Marek Vasut
2015-12-27 11:37                                   ` Wills Wang
2015-12-27 12:27                                     ` Marek Vasut
2015-12-28 11:17                                       ` Wills Wang
2015-12-28 13:47                                         ` Marek Vasut
2015-12-28 15:36                                           ` Wills Wang
2015-12-28 15:48                                           ` Wills Wang
2015-12-28 15:52                                             ` Marek Vasut
2015-12-28 17:08                                               ` Daniel Schwierzeck
2015-12-28 17:33                                                 ` Marek Vasut
2015-12-27 11:37                                   ` Daniel Schwierzeck
2015-12-27 12:25                                     ` Marek Vasut
2015-12-27 13:17                                     ` Wills Wang
2015-12-24 11:22 ` [U-Boot] [PATCH v3 2/4] mips: ath79: add serial driver for ar933x SOC Wills Wang
2015-12-25  2:39   ` Thomas Chou
2015-12-25  6:05     ` Wills Wang
2015-12-25  6:48       ` Thomas Chou
2015-12-25  2:49   ` Thomas Chou
2016-01-06  0:25   ` Simon Glass
2016-01-06  2:58     ` Wills Wang
2015-12-24 11:22 ` [U-Boot] [PATCH v3 3/4] mips: ath79: add spi driver Wills Wang
2015-12-24 11:55   ` Marek Vasut
2015-12-24 11:22 ` [U-Boot] [PATCH v3 4/4] mips: ath79: add AP121 reference board Wills Wang

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=201512260702.32790.marex@denx.de \
    --to=marex@denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox