All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wills Wang <wills.wang@live.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v7 1/7] mips: add base support for QCA/Atheros ath79 SOCs
Date: Sat, 23 Jan 2016 13:25:52 +0800	[thread overview]
Message-ID: <BLU437-SMTP1027B495EBC75F6C3B7A97EFFC50@phx.gbl> (raw)
In-Reply-To: <201601230406.47375.marex@denx.de>



On Saturday, January 23, 2016 11:06 AM, Marek Vasut wrote:
> On Saturday, January 23, 2016 at 02:31:31 AM, Wills Wang wrote:
>> On Friday, January 22, 2016 10:44 PM, Marek Vasut wrote:
>>> On Friday, January 22, 2016 at 10:02:18 AM, Wills Wang wrote:
>>>> On Sunday, January 17, 2016 03:19 AM, Marek Vasut wrote:
>>>>> On Saturday, January 16, 2016 at 07:13:47 PM, Wills Wang wrote:
>>>>>
>>>>> Commit message is missing.
>>>>>
>>>>>> Signed-off-by: Wills Wang <wills.wang@live.com>
>>>>>> ---
>>>>>>
>>>>>> Changes in v7:
>>>>>> - Use setbits_32
>>>>>> - Fix include path for SoC specific headers
>>>>>>
>>>>>> Changes in v6:
>>>>>> - Move ar933x as separate patch
>>>>>> - Add get_bootstrap in reset.c
>>>>>> - Use map_physmem instead of KSEG1ADDR
>>>>>> - Add arch_cpu_init for detect SOC type for early
>>>>> [...]
>>>>>
>>>>>> diff --git a/arch/mips/mach-ath79/Kconfig
>>>>>> b/arch/mips/mach-ath79/Kconfig new file mode 100644
>>>>>> index 0000000..df84876
>>>>>> --- /dev/null
>>>>>> +++ b/arch/mips/mach-ath79/Kconfig
>>>>>> @@ -0,0 +1,10 @@
>>>>>> +menu "QCA/Athroes 7xxx/9xxx platforms"
>>>>>> +	depends on ARCH_ATH79
>>>>>> +
>>>>>> +config SYS_VENDOR
>>>>>> +	default "ath79"
>>>>> Vendor should be atheros I believe.
>>>> Now atheros was merged into qualcomm, ap121 and ap143, one belongs
>>>> to atheros and the other to qualcomm.
>>> So write qualcomm/atheros ? What's the problem ?
>> SYS_VENDOR is used to specify the folder
> directory, this is not windows.
>
>> name under board, i will change it into atheros-qualcomm or qca.
> qca then.
>
>>>>>> +config SYS_SOC
>>>>>> +	default "ath79"
>>>>>> +
>>>>>> +endmenu
>>>>>> diff --git a/arch/mips/mach-ath79/Makefile
>>>>>> b/arch/mips/mach-ath79/Makefile new file mode 100644
>>>>>> index 0000000..6203cf0
>>>>>> --- /dev/null
>>>>>> +++ b/arch/mips/mach-ath79/Makefile
>>>>>> @@ -0,0 +1,7 @@
>>>>>> +#
>>>>>> +# SPDX-License-Identifier:	GPL-2.0+
>>>>>> +#
>>>>>> +
>>>>>> +obj-y += reset.o
>>>>>> +obj-y += cpu.o
>>>>>> +obj-y += dram.o
>>>>>> diff --git a/arch/mips/mach-ath79/cpu.c b/arch/mips/mach-ath79/cpu.c
>>>>>> new file mode 100644
>>>>>> index 0000000..d8910a0
>>>>>> --- /dev/null
>>>>>> +++ b/arch/mips/mach-ath79/cpu.c
>>>>>> @@ -0,0 +1,203 @@
>>>>>> +/*
>>>>>> + * Copyright (C) 2015-2016 Wills Wang <wills.wang@live.com>
>>>>>> + *
>>>>>> + * SPDX-License-Identifier: GPL-2.0+
>>>>>> + */
>>>>>> +
>>>>>> +#include <common.h>
>>>>>> +#include <asm/io.h>
>>>>>> +#include <asm/addrspace.h>
>>>>>> +#include <asm/types.h>
>>>>>> +#include <mach/ath79.h>
>>>>>> +#include <mach/ar71xx_regs.h>
>>>>>> +
>>>>>> +struct ath79_soc_desc {
>>>>>> +	enum ath79_soc_type soc;
>>>>>> +	const char *chip;
>>>>>> +};
>>>>>> +
>>>>>> +static struct ath79_soc_desc desc[] = {
>>>>>> +	{ATH79_SOC_AR7130,      "7130"},
>>>>>> +	{ATH79_SOC_AR7141,      "7141"},
>>>>>> +	{ATH79_SOC_AR7161,      "7161"},
>>>>> Just curious, were 7161 chips ever tested ?
>>>> These id rules are verified by kernel and openwrt project,
>>>> Of course, we can also remove support for these chips that faded out the
>>>> market.
>>> That's not answering my question, I am asking if the code was tested on
>>> those chips at all or not.
>> Not test.
> OK, which SoCs were tested ?
I have ar9331 and qca9531 board and tested on it.
>>>>>> +	{ATH79_SOC_AR7240,      "7240"},
>>>>>> +	{ATH79_SOC_AR7242,      "7242"},
>>>>>> +	{ATH79_SOC_AR9130,      "9130"},
>>>>>> +	{ATH79_SOC_AR9132,      "9132"},
>>>>>> +	{ATH79_SOC_AR9330,      "9330"},
>>>>>> +	{ATH79_SOC_AR9331,      "9331"},
>>>>>> +	{ATH79_SOC_AR9341,      "9341"},
>>>>>> +	{ATH79_SOC_AR9342,      "9342"},
>>>>>> +	{ATH79_SOC_AR9344,      "9344"},
>>>>>> +	{ATH79_SOC_QCA9533,     "9533"},
>>>>>> +	{ATH79_SOC_QCA9556,     "9556"},
>>>>>> +	{ATH79_SOC_QCA9558,     "9558"},
>>>>>> +	{ATH79_SOC_TP9343,      "9343"},
>>>>>> +	{ATH79_SOC_QCA9561,     "9561"},
>>>>>> +};
>>>>>> +
>>>>>> +int arch_cpu_init(void)
>>>>>> +{
>>>>>> +	void __iomem *base;
>>>>>> +	enum ath79_soc_type soc = ATH79_SOC_UNKNOWN;
>>>>>> +	u32 id, major, minor;
>>>>>> +	u32 rev = 0;
>>>>>> +	u32 ver = 1;
>>>>>> +
>>>>>> +	base = map_physmem(AR71XX_RESET_BASE, AR71XX_RESET_SIZE,
>>>>>> +			   MAP_NOCACHE);
>>>>>> +
>>>>>> +	id = readl(base + AR71XX_RESET_REG_REV_ID);
>>>>>> +	major = id & REV_ID_MAJOR_MASK;
>>>>>> +
>>>>>> +	switch (major) {
>>>>>> +	case REV_ID_MAJOR_AR71XX:
>>>>>> +		minor = id & AR71XX_REV_ID_MINOR_MASK;
>>>>>> +		rev = id >> AR71XX_REV_ID_REVISION_SHIFT;
>>>>>> +		rev &= AR71XX_REV_ID_REVISION_MASK;
>>>>>> +		switch (minor) {
>>>>>> +		case AR71XX_REV_ID_MINOR_AR7130:
>>>>>> +			soc = ATH79_SOC_AR7130;
>>>>>> +			break;
>>>>>> +
>>>>>> +		case AR71XX_REV_ID_MINOR_AR7141:
>>>>>> +			soc = ATH79_SOC_AR7141;
>>>>>> +			break;
>>>>>> +
>>>>>> +		case AR71XX_REV_ID_MINOR_AR7161:
>>>>>> +			soc = ATH79_SOC_AR7161;
>>>>>> +			break;
>>>>>> +		}
>>>>>> +		break;
>>>>> This could easily be a lookup-table instead of such big switch
>>>>> statement.
>>>> This has already been explained in v4, i have tried to use lookup-table,
>>>> but the code is not more beautiful than now, the bit filed of id is not
>>>> regular.
>>>>
>>>> The shift bits of minor and revision is different for same chips, same
>>>> chips
>>>> should ignore the minor bits,  the lookup table must store these shift
>>>> information and which was ignored in common, so the table will become
>>>> more complex if this code want to be compatible with many other SOCs.
>>> I don't see a problem with storing offset and mask in the table.
>>>
>>>> If people want to add other QCA's SoC, need spend a great deal of time
>>>> to debug this code.
>>> Why? They'd just add the necessary entry into the table.
>> The bit filed of id register is not regular, they need modify this lookup
>> table sometimes.
> Major seems pretty regular to me, minor might be different.
>
>>>>>> +	case REV_ID_MAJOR_AR7240:
>>>>>> +		soc = ATH79_SOC_AR7240;
>>>>>> +		rev = id & AR71XX_REV_ID_REVISION_MASK;
>>>>>> +		break;
>>>>> [...]
>>>>>
>>>>>> diff --git a/arch/mips/mach-ath79/include/mach/ar71xx_regs.h
>>>>>> b/arch/mips/mach-ath79/include/mach/ar71xx_regs.h new file mode 100644
>>>>>> index 0000000..5e80eaf
>>>>>> --- /dev/null
>>>>>> +++ b/arch/mips/mach-ath79/include/mach/ar71xx_regs.h
>>>>>> @@ -0,0 +1,1187 @@
>>>>>> +/*
>>>>>> + * Atheros AR71XX/AR724X/AR913X SoC register definitions
>>>>>> + *
>>>>>> + * Copyright (C) 2015-2016 Wills Wang <wills.wang@live.com>
>>>>>> + * Copyright (C) 2010-2011 Jaiganesh Narayanan
>>>>>> <jnarayanan@atheros.com> + * Copyright (C) 2008-2010 Gabor Juhos
>>>>>> <juhosg@openwrt.org>
>>>>>> + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
>>>>>> + *
>>>>>> + * SPDX-License-Identifier:     GPL-2.0+
>>>>>> + */
>>>>>> +
>>>>>> +#ifndef __ASM_MACH_AR71XX_REGS_H
>>>>>> +#define __ASM_MACH_AR71XX_REGS_H
>>>>>> +
>>>>>> +#ifndef __ASSEMBLY__
>>>>>> +#include <linux/bitops.h>
>>>>>> +#else
>>>>>> +#ifndef BIT
>>>>>> +#define BIT(nr)                 (1 << (nr))
>>>>> Linux defines the macro as (1ul << (nr))
>>>> This header is also used by assembler,  the assembler don't recognize
>>>> label 1ul.
>>> In that case, this should be fixed in bitops.h and brought up in the
>>> kernel mailing list. Otherwise, we will develop unnecessary boilerplate
>>> code soon.
>>>
>>>>>> +#endif
>>>>>> +#endif
>>>>> [...]

-- 
Best Regards
Wills

  reply	other threads:[~2016-01-23  5:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1452968033-4460-1-git-send-email-wills.wang@live.com>
2016-01-16 18:13 ` [U-Boot] [PATCH v7 1/7] mips: add base support for QCA/Atheros ath79 SOCs Wills Wang
2016-01-16 19:19   ` Marek Vasut
2016-01-22  9:02     ` Wills Wang
2016-01-22 14:44       ` Marek Vasut
2016-01-23  1:31         ` Wills Wang
2016-01-23  3:06           ` Marek Vasut
2016-01-23  5:25             ` Wills Wang [this message]
2016-02-01 19:19   ` Marek Vasut
2016-01-16 18:13 ` [U-Boot] [PATCH v7 2/7] mips: ath79: add support for AR933x SOCs Wills Wang
2016-01-16 19:31   ` Marek Vasut
2016-01-22  9:10     ` Wills Wang
2016-01-22 14:46       ` Marek Vasut
2016-01-16 18:13 ` [U-Boot] [PATCH v7 3/7] mips: ath79: add support for QCA953x SOCs Wills Wang
2016-01-16 19:33   ` Marek Vasut
2016-01-22  9:17     ` Wills Wang
2016-01-22 14:49       ` Marek Vasut
2016-01-16 18:13 ` [U-Boot] [PATCH v7 4/7] mips: ath79: add serial driver for ar933x SOC Wills Wang
2016-01-16 19:17   ` Daniel Schwierzeck
2016-01-18  3:58   ` Simon Glass
2016-01-16 18:13 ` [U-Boot] [PATCH v7 5/7] mips: ath79: add spi driver Wills Wang
2016-01-16 19:37   ` Daniel Schwierzeck
2016-01-22  9:24     ` Wills Wang
2016-01-27  1:33   ` Marek Vasut
2016-02-02 15:38     ` Wills Wang
2016-02-02 16:07       ` Marek Vasut
2016-01-16 18:13 ` [U-Boot] [PATCH v7 6/7] mips: ath79: add AP121 reference board Wills Wang
2016-01-16 19:50   ` Daniel Schwierzeck
2016-01-22  9:36     ` Wills Wang
2016-01-16 18:13 ` [U-Boot] [PATCH v7 7/7] mips: ath79: add AP143 " Wills Wang
2016-01-16 19:53   ` Daniel Schwierzeck

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=BLU437-SMTP1027B495EBC75F6C3B7A97EFFC50@phx.gbl \
    --to=wills.wang@live.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.