2020-03-09 08:24:31

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 0/6] Add basic support for Loongson 7A1000 bridge chip

The Loongson 7A1000 bridge chip has been released for several years
since the second half of 2017, but it is not supported by the Linux
mainline kernel while it only works well with the Loongson internal
kernel version. When I update the latest version of Linux mainline
kernel on the Loongson 3A3000 CPU and 7A1000 bridge chip system,
the boot process failed and I feel depressed.

The 7A1000 bridge chip is used a lot with 3A3000 or 3A4000 CPU in
the most Loongson desktop and sever products, it is important to
support Loongson 7A1000 bridge chip by the Linux mainline kernel.

This patch series adds the basic support for the Loongson 7A1000
bridge chip, when apply these patches based on linux-5.6-rc5, the
boot process is successful and we can login normally used with the
latest firmware and discrete graphics card, the next work to do is
power management and some other controller device drivers.

Additionally, when I git clone mips code [1], the speed is too slow
and clone always failed, so this patch series is based on the latest
linux-5.6-rc5 [2].

If you have any questions and suggestions, please let me know.

Thanks,

Tiezhu Yang

[1] git clone https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git
[2] git clone https://github.com/torvalds/linux.git

Tiezhu Yang (6):
PCI: Add Loongson vendor ID and 7A1000 device IDs
AHCI: Add support for Loongson 7A1000 SATA controller
MIPS: Loongson: Use firmware arguments to get board name
MIPS: Loongson: Add DMA support for 7A1000
MIPS: Loongson: Add PCI support for 7A1000
MIPS: Loongson: Add support for 7A1000 interrupt controller

arch/mips/include/asm/mach-loongson64/boot_param.h | 2 +
arch/mips/include/asm/mach-loongson64/ioaicu.h | 166 +++++++++++
arch/mips/include/asm/mach-loongson64/irq.h | 2 +
arch/mips/include/asm/mach-loongson64/pci.h | 1 +
arch/mips/loongson64/Makefile | 2 +-
arch/mips/loongson64/dma.c | 49 +++-
arch/mips/loongson64/env.c | 5 +
arch/mips/loongson64/init.c | 13 +
arch/mips/loongson64/ioaicu.c | 305 +++++++++++++++++++++
arch/mips/loongson64/irq.c | 20 +-
arch/mips/loongson64/pci.c | 12 +-
arch/mips/loongson64/smp.c | 11 +-
arch/mips/pci/Makefile | 2 +-
arch/mips/pci/ops-loongson3-ls7a.c | 132 +++++++++
drivers/ata/ahci.c | 8 +
include/linux/pci_ids.h | 18 ++
16 files changed, 733 insertions(+), 15 deletions(-)
create mode 100644 arch/mips/include/asm/mach-loongson64/ioaicu.h
create mode 100644 arch/mips/loongson64/ioaicu.c
create mode 100644 arch/mips/pci/ops-loongson3-ls7a.c

--
2.1.0


2020-03-09 08:24:34

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 3/6] MIPS: Loongson: Use firmware arguments to get board name

In order to distinguish various types of bridge chip such as AMD RS780E
or Loongson 7A1000, we can use firmware arguments to get board name.

Signed-off-by: Tiezhu Yang <[email protected]>
---
arch/mips/include/asm/mach-loongson64/boot_param.h | 1 +
arch/mips/loongson64/env.c | 5 +++++
2 files changed, 6 insertions(+)

diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
index 8c286be..225a563 100644
--- a/arch/mips/include/asm/mach-loongson64/boot_param.h
+++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
@@ -217,5 +217,6 @@ struct loongson_system_configuration {

extern struct efi_memory_map_loongson *loongson_memmap;
extern struct loongson_system_configuration loongson_sysconf;
+extern struct board_devices *eboard;

#endif
diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
index 0daeb7b..a244a8c 100644
--- a/arch/mips/loongson64/env.c
+++ b/arch/mips/loongson64/env.c
@@ -24,6 +24,9 @@ EXPORT_SYMBOL(cpu_clock_freq);
struct efi_memory_map_loongson *loongson_memmap;
struct loongson_system_configuration loongson_sysconf;

+struct board_devices *eboard;
+EXPORT_SYMBOL(eboard);
+
u64 loongson_chipcfg[MAX_PACKAGES] = {0xffffffffbfc00180};
u64 loongson_chiptemp[MAX_PACKAGES];
u64 loongson_freqctrl[MAX_PACKAGES];
@@ -51,6 +54,8 @@ void __init prom_init_env(void)
((u64)loongson_p + loongson_p->system_offset);
ecpu = (struct efi_cpuinfo_loongson *)
((u64)loongson_p + loongson_p->cpu_offset);
+ eboard = (struct board_devices *)
+ ((u64)loongson_p + loongson_p->boarddev_table_offset);
eirq_source = (struct irq_source_routing_table *)
((u64)loongson_p + loongson_p->irq_offset);
loongson_memmap = (struct efi_memory_map_loongson *)
--
2.1.0

2020-03-09 08:24:39

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 2/6] AHCI: Add support for Loongson 7A1000 SATA controller

Loongson 7A1000 SATA controller uses BAR0 as the base address register.

Signed-off-by: Tiezhu Yang <[email protected]>
---
drivers/ata/ahci.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 11ea1af..28a336e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -40,6 +40,7 @@
enum {
AHCI_PCI_BAR_STA2X11 = 0,
AHCI_PCI_BAR_CAVIUM = 0,
+ AHCI_PCI_BAR_LOONGSON = 0,
AHCI_PCI_BAR_ENMOTUS = 2,
AHCI_PCI_BAR_CAVIUM_GEN5 = 4,
AHCI_PCI_BAR_STANDARD = 5,
@@ -589,6 +590,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
/* Enmotus */
{ PCI_DEVICE(0x1c44, 0x8000), board_ahci },

+ /* Loongson */
+ { PCI_VDEVICE(LOONGSON, PCI_DEVICE_ID_LOONGSON_7A1000_SATA),
+ board_ahci },
+
/* Generic, PCI class code for AHCI */
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
@@ -1680,6 +1685,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
ahci_pci_bar = AHCI_PCI_BAR_CAVIUM;
if (pdev->device == 0xa084)
ahci_pci_bar = AHCI_PCI_BAR_CAVIUM_GEN5;
+ } else if (pdev->vendor == PCI_VENDOR_ID_LOONGSON) {
+ if (pdev->device == PCI_DEVICE_ID_LOONGSON_7A1000_SATA)
+ ahci_pci_bar = AHCI_PCI_BAR_LOONGSON;
}

/* acquire resources */
--
2.1.0

2020-03-09 08:25:33

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 1/6] PCI: Add Loongson vendor ID and 7A1000 device IDs

Add the Loongson vendor ID and 7A1000 device IDs to pci_ids.h
to be used by the controller driver in the future.

The Loongson IDs can be found at the following link:
https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/tree/pci.ids

Signed-off-by: Tiezhu Yang <[email protected]>
---
include/linux/pci_ids.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 352c0d7..0125ab4 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -3113,4 +3113,22 @@

#define PCI_VENDOR_ID_NCUBE 0x10ff

+#define PCI_VENDOR_ID_LOONGSON 0x0014
+#define PCI_DEVICE_ID_LOONGSON_7A1000_HT 0x7a00
+#define PCI_DEVICE_ID_LOONGSON_7A1000_APB 0x7a02
+#define PCI_DEVICE_ID_LOONGSON_7A1000_GMAC 0x7a03
+#define PCI_DEVICE_ID_LOONGSON_7A1000_OTG 0x7a04
+#define PCI_DEVICE_ID_LOONGSON_7A1000_DC 0x7a06
+#define PCI_DEVICE_ID_LOONGSON_7A1000_HDA 0x7a07
+#define PCI_DEVICE_ID_LOONGSON_7A1000_SATA 0x7a08
+#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X1 0x7a09
+#define PCI_DEVICE_ID_LOONGSON_7A1000_SPI 0x7a0b
+#define PCI_DEVICE_ID_LOONGSON_7A1000_LPC 0x7a0c
+#define PCI_DEVICE_ID_LOONGSON_7A1000_DMA 0x7a0f
+#define PCI_DEVICE_ID_LOONGSON_7A1000_EHCI 0x7a14
+#define PCI_DEVICE_ID_LOONGSON_7A1000_GPU 0x7a15
+#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X4 0x7a19
+#define PCI_DEVICE_ID_LOONGSON_7A1000_OHCI 0x7a24
+#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X8 0x7a29
+
#endif /* _LINUX_PCI_IDS_H */
--
2.1.0

2020-03-09 08:39:18

by Jiaxun Yang

[permalink] [raw]
Subject: 回复:[PATCH 3/6] MIPS: Loongson: Use firmware arguments to get board name



---- 在 星期一, 2020-03-09 16:23:23 Tiezhu Yang <[email protected]> 撰写 ----
> In order to distinguish various types of bridge chip such as AMD RS780E
> or Loongson 7A1000, we can use firmware arguments to get board name.
>
Hi Tiezhu,

Thanks for your contribution.
Your series is sightly conflict with my "modernize" series. But that's fine,
if your code can meet mainline requirement, I'm going to adjust my works.

See my comments bellow.

> Signed-off-by: Tiezhu Yang <[email protected]>
> ---
> arch/mips/include/asm/mach-loongson64/boot_param.h | 1 +
> arch/mips/loongson64/env.c | 5 +++++
> 2 files changed, 6 insertions(+)
>
> diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
> index 8c286be..225a563 100644
> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> @@ -217,5 +217,6 @@ struct loongson_system_configuration {
>
> extern struct efi_memory_map_loongson *loongson_memmap;
> extern struct loongson_system_configuration loongson_sysconf;
> +extern struct board_devices *eboard;
>
> #endif
> diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
> index 0daeb7b..a244a8c 100644
> --- a/arch/mips/loongson64/env.c
> +++ b/arch/mips/loongson64/env.c
> @@ -24,6 +24,9 @@ EXPORT_SYMBOL(cpu_clock_freq);
> struct efi_memory_map_loongson *loongson_memmap;
> struct loongson_system_configuration loongson_sysconf;
>
> +struct board_devices *eboard;
> +EXPORT_SYMBOL(eboard);

Can we make it as a part of struct loongson_sysconf and export that struct?
Memory of struct eboard is not managed by kernel, we shouldn't export such symbol.

Also I noticed that you're checking PCH type repeatly in other subsystems. Can you just
determine the PCH type here?

> +
> u64 loongson_chipcfg[MAX_PACKAGES] = {0xffffffffbfc00180};
> u64 loongson_chiptemp[MAX_PACKAGES];
> u64 loongson_freqctrl[MAX_PACKAGES];
> @@ -51,6 +54,8 @@ void __init prom_init_env(void)
> ((u64)loongson_p + loongson_p->system_offset);
> ecpu = (struct efi_cpuinfo_loongson *)
> ((u64)loongson_p + loongson_p->cpu_offset);
> + eboard = (struct board_devices *)
> + ((u64)loongson_p + loongson_p->boarddev_table_offset);
> eirq_source = (struct irq_source_routing_table *)
> ((u64)loongson_p + loongson_p->irq_offset);
> loongson_memmap = (struct efi_memory_map_loongson *)
> --
> 2.1.0
>
>

2020-03-09 08:52:24

by Jiaxun Yang

[permalink] [raw]
Subject: 回复:[PATCH 1/6] PCI: Add Loongson vendor ID and 7A1000 device IDs


---- 在 星期一, 2020-03-09 16:23:21 Tiezhu Yang <[email protected]> 撰写 ----
> Add the Loongson vendor ID and 7A1000 device IDs to pci_ids.h
> to be used by the controller driver in the future.
>
> The Loongson IDs can be found at the following link:
> https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/tree/pci.ids
>
> Signed-off-by: Tiezhu Yang <[email protected]>
> ---
> include/linux/pci_ids.h | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index 352c0d7..0125ab4 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -3113,4 +3113,22 @@
>
> #define PCI_VENDOR_ID_NCUBE 0x10ff
>
> +#define PCI_VENDOR_ID_LOONGSON 0x0014
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_HT 0x7a00
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_APB 0x7a02
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_GMAC 0x7a03
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_OTG 0x7a04
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_DC 0x7a06
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_HDA 0x7a07
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_SATA 0x7a08
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X1 0x7a09
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_SPI 0x7a0b
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_LPC 0x7a0c
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_DMA 0x7a0f
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_EHCI 0x7a14
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_GPU 0x7a15
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X4 0x7a19
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_OHCI 0x7a24
> +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X8 0x7a29

Devices IDs are unlikely to be reused by mutiple subsystems, so probably we don't need
to add them here?

> +
> #endif /* _LINUX_PCI_IDS_H */
> --
> 2.1.0
>
>

2020-03-10 02:33:16

by Tiezhu Yang

[permalink] [raw]
Subject: Re: 回复:[PATCH 1/6] PCI: Add Loongson vend or ID and 7A1000 device IDs

On 03/09/2020 04:50 PM, Jiaxun Yang wrote:
> ---- 在 星期一, 2020-03-09 16:23:21 Tiezhu Yang <[email protected]> 撰写 ----
> > Add the Loongson vendor ID and 7A1000 device IDs to pci_ids.h
> > to be used by the controller driver in the future.
> >
> > The Loongson IDs can be found at the following link:
> > https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/tree/pci.ids
> >
> > Signed-off-by: Tiezhu Yang <[email protected]>
> > ---
> > include/linux/pci_ids.h | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> > index 352c0d7..0125ab4 100644
> > --- a/include/linux/pci_ids.h
> > +++ b/include/linux/pci_ids.h
> > @@ -3113,4 +3113,22 @@
> >
> > #define PCI_VENDOR_ID_NCUBE 0x10ff
> >
> > +#define PCI_VENDOR_ID_LOONGSON 0x0014
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_HT 0x7a00
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_APB 0x7a02
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_GMAC 0x7a03
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_OTG 0x7a04
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_DC 0x7a06
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_HDA 0x7a07
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_SATA 0x7a08
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X1 0x7a09
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_SPI 0x7a0b
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_LPC 0x7a0c
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_DMA 0x7a0f
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_EHCI 0x7a14
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_GPU 0x7a15
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X4 0x7a19
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_OHCI 0x7a24
> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X8 0x7a29
>
> Devices IDs are unlikely to be reused by mutiple subsystems, so probably we don't need
> to add them here?

Hi Jiaxun,

I think it is better to define the device IDs in pci_ids.h,
otherwise it seems a little disorganized.

Thanks,

Tiezhu Yang

>
>> +
> > #endif /* _LINUX_PCI_IDS_H */
> > --
> > 2.1.0
> >
> >

2020-03-10 02:39:45

by Jiaxun Yang

[permalink] [raw]
Subject: Re: 回复:[PATCH 1/6] PCI: Add Loongs on vendor ID and 7A1000 device IDs



于 2020年3月10日 GMT+08:00 上午10:31:56, Tiezhu Yang <[email protected]> 写到:
>On 03/09/2020 04:50 PM, Jiaxun Yang wrote:
>> ---- 在 星期一, 2020-03-09 16:23:21 Tiezhu Yang
><[email protected]> 撰写 ----
>> > Add the Loongson vendor ID and 7A1000 device IDs to pci_ids.h
>> > to be used by the controller driver in the future.
>> >
>> > The Loongson IDs can be found at the following link:
>> >
>https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/tree/pci.ids
>> >
>> > Signed-off-by: Tiezhu Yang <[email protected]>
>> > ---
>> > include/linux/pci_ids.h | 18 ++++++++++++++++++
>> > 1 file changed, 18 insertions(+)
>> >
>> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
>> > index 352c0d7..0125ab4 100644
>> > --- a/include/linux/pci_ids.h
>> > +++ b/include/linux/pci_ids.h
>> > @@ -3113,4 +3113,22 @@
>> >
>> > #define PCI_VENDOR_ID_NCUBE 0x10ff
>> >
>> > +#define PCI_VENDOR_ID_LOONGSON 0x0014
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_HT 0x7a00
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_APB 0x7a02
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_GMAC 0x7a03
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_OTG 0x7a04
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_DC 0x7a06
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_HDA 0x7a07
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_SATA 0x7a08
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X1 0x7a09
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_SPI 0x7a0b
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_LPC 0x7a0c
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_DMA 0x7a0f
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_EHCI 0x7a14
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_GPU 0x7a15
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X4 0x7a19
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_OHCI 0x7a24
>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X8 0x7a29
>>
>> Devices IDs are unlikely to be reused by mutiple subsystems, so
>probably we don't need
>> to add them here?
>
>Hi Jiaxun,
>
>I think it is better to define the device IDs in pci_ids.h,
>otherwise it seems a little disorganized.

Please read the comment at the start of this file.
New entries should be added only if they're shared by multiple drivers.

That's the rule.

And probably you can split these two patches into a new series
as they're likely to be accepted.

Thanks.

>
>Thanks,
>
>Tiezhu Yang
>
>>
>>> +
>> > #endif /* _LINUX_PCI_IDS_H */
>> > --
>> > 2.1.0
>> >
>> >

--
Jiaxun Yang

2020-03-10 02:40:36

by Tiezhu Yang

[permalink] [raw]
Subject: Re: 回复:[PATCH 3/6] MIPS: Loongson: Use fi rmware arguments to get board name

On 03/09/2020 04:36 PM, Jiaxun Yang wrote:
>
> ---- 在 星期一, 2020-03-09 16:23:23 Tiezhu Yang <[email protected]> 撰写 ----
> > In order to distinguish various types of bridge chip such as AMD RS780E
> > or Loongson 7A1000, we can use firmware arguments to get board name.
> >
> Hi Tiezhu,
>
> Thanks for your contribution.
> Your series is sightly conflict with my "modernize" series. But that's fine,
> if your code can meet mainline requirement, I'm going to adjust my works.

Hi Jiaxun,

Thanks very much for your kindly reply.

>
> See my comments bellow.
>
> > Signed-off-by: Tiezhu Yang <[email protected]>
> > ---
> > arch/mips/include/asm/mach-loongson64/boot_param.h | 1 +
> > arch/mips/loongson64/env.c | 5 +++++
> > 2 files changed, 6 insertions(+)
> >
> > diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
> > index 8c286be..225a563 100644
> > --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> > +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> > @@ -217,5 +217,6 @@ struct loongson_system_configuration {
> >
> > extern struct efi_memory_map_loongson *loongson_memmap;
> > extern struct loongson_system_configuration loongson_sysconf;
> > +extern struct board_devices *eboard;
> >
> > #endif
> > diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
> > index 0daeb7b..a244a8c 100644
> > --- a/arch/mips/loongson64/env.c
> > +++ b/arch/mips/loongson64/env.c
> > @@ -24,6 +24,9 @@ EXPORT_SYMBOL(cpu_clock_freq);
> > struct efi_memory_map_loongson *loongson_memmap;
> > struct loongson_system_configuration loongson_sysconf;
> >
> > +struct board_devices *eboard;
> > +EXPORT_SYMBOL(eboard);
>
> Can we make it as a part of struct loongson_sysconf and export that struct?
> Memory of struct eboard is not managed by kernel, we shouldn't export such symbol.

OK, I will do it.

>
> Also I noticed that you're checking PCH type repeatly in other subsystems. Can you just
> determine the PCH type here?

Yes, of course.

Thanks,

Tiezhu Yang

>
> > +
> > u64 loongson_chipcfg[MAX_PACKAGES] = {0xffffffffbfc00180};
> > u64 loongson_chiptemp[MAX_PACKAGES];
> > u64 loongson_freqctrl[MAX_PACKAGES];
> > @@ -51,6 +54,8 @@ void __init prom_init_env(void)
> > ((u64)loongson_p + loongson_p->system_offset);
> > ecpu = (struct efi_cpuinfo_loongson *)
> > ((u64)loongson_p + loongson_p->cpu_offset);
> > + eboard = (struct board_devices *)
> > + ((u64)loongson_p + loongson_p->boarddev_table_offset);
> > eirq_source = (struct irq_source_routing_table *)
> > ((u64)loongson_p + loongson_p->irq_offset);
> > loongson_memmap = (struct efi_memory_map_loongson *)
> > --
> > 2.1.0
> >
> >

2020-03-10 09:29:22

by Tiezhu Yang

[permalink] [raw]
Subject: Re: 回复:[PATCH 1/6] PCI: Add Loongson vend or ID and 7A1000 device IDs

On 03/10/2020 10:37 AM, Jiaxun Yang wrote:
>
> 于 2020年3月10日 GMT+08:00 上午10:31:56, Tiezhu Yang <[email protected]> 写到:
>> On 03/09/2020 04:50 PM, Jiaxun Yang wrote:
>>> ---- 在 星期一, 2020-03-09 16:23:21 Tiezhu Yang
>> <[email protected]> 撰写 ----
>>> > Add the Loongson vendor ID and 7A1000 device IDs to pci_ids.h
>>> > to be used by the controller driver in the future.
>>> >
>>> > The Loongson IDs can be found at the following link:
>>> >
>> https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/tree/pci.ids
>>> >
>>> > Signed-off-by: Tiezhu Yang <[email protected]>
>>> > ---
>>> > include/linux/pci_ids.h | 18 ++++++++++++++++++
>>> > 1 file changed, 18 insertions(+)
>>> >
>>> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
>>> > index 352c0d7..0125ab4 100644
>>> > --- a/include/linux/pci_ids.h
>>> > +++ b/include/linux/pci_ids.h
>>> > @@ -3113,4 +3113,22 @@
>>> >
>>> > #define PCI_VENDOR_ID_NCUBE 0x10ff
>>> >
>>> > +#define PCI_VENDOR_ID_LOONGSON 0x0014
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_HT 0x7a00
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_APB 0x7a02
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_GMAC 0x7a03
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_OTG 0x7a04
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_DC 0x7a06
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_HDA 0x7a07
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_SATA 0x7a08
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X1 0x7a09
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_SPI 0x7a0b
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_LPC 0x7a0c
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_DMA 0x7a0f
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_EHCI 0x7a14
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_GPU 0x7a15
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X4 0x7a19
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_OHCI 0x7a24
>>> > +#define PCI_DEVICE_ID_LOONGSON_7A1000_PCIE_X8 0x7a29
>>>
>>> Devices IDs are unlikely to be reused by mutiple subsystems, so
>> probably we don't need
>>> to add them here?
>> Hi Jiaxun,
>>
>> I think it is better to define the device IDs in pci_ids.h,
>> otherwise it seems a little disorganized.
> Please read the comment at the start of this file.
> New entries should be added only if they're shared by multiple drivers.
>
> That's the rule.
>
> And probably you can split these two patches into a new series
> as they're likely to be accepted.

OK, that makes sense.

Let me split the two patches 1/6 and 2/6 into a new series,
the first patch only adds the Loongson vendor ID to pci_ids.h.

Thanks,

Tiezhu Yang

>
> Thanks.
>
>> Thanks,
>>
>> Tiezhu Yang
>>
>>>
>>>> +
>>> > #endif /* _LINUX_PCI_IDS_H */
>>> > --
>>> > 2.1.0
>>> >
>>> >