Skip to contentSkip to conversation

x86: ivybridge: cougarcanyon2: Various enhancements

PATCH Superseded Bin Meng 2 participants 36 messages Jun 4, 2018 – Jun 12, 2018

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

cover x86: ivybridge: cougarcanyon2: Various enhancements

This adds some enhancements to the Intel Cougar Canyon 2 board.

This series is available at u-boot-x86/cc2-working for testing.

Bin Meng (13):
usb: xhci-pci: Fix compiler warning
x86: ivybridge: Imply USB_XHCI_HCD
x86: cougarcanyon2: Update dts for SPI lock down
x86: cougarcanyon2: Remove CONFIG_HAVE_INTEL_ME
x86: ivybridge: Enable 206ax cpu driver for FSP build
x86: ivybridge: Drop CONFIG_USBDEBUG
x86: chromebook_link: Remove dm-pre-reloc property in the cpu nodes
x86: cougarcanyon2: Enable CPU driver and SMP support
x86: irq: Remove chipset specific irq router drivers
x86: irq: Change LINK_V2N and LINK_N2V to inline functions
x86: irq: Introduce CONFIG_DISCRETE_PIRQ_ROUT
x86: ivybridge: Implement IvyBridge-specific IRQ converting logic
x86: cougarcanyon2: Add missing chipset interrupt information

 arch/x86/Kconfig                          |  9 ++++
 arch/x86/cpu/intel_common/mrc.c           |  5 ---
 arch/x86/cpu/irq.c                        | 28 ++++++------
 arch/x86/cpu/ivybridge/Kconfig            |  5 +++
 arch/x86/cpu/ivybridge/Makefile           |  2 +-
 arch/x86/cpu/ivybridge/model_206ax.c      | 15 -------
 arch/x86/cpu/quark/Makefile               |  2 +-
 arch/x86/cpu/quark/irq.c                  | 48 ---------------------
 arch/x86/cpu/quark/quark.c                | 26 +++++++++++
 arch/x86/cpu/queensbay/Makefile           |  2 +-
 arch/x86/cpu/queensbay/irq.c              | 64 ----------------------------
 arch/x86/cpu/queensbay/tnc.c              | 39 +++++++++++++++++
 arch/x86/dts/chromebook_link.dts          |  5 ---
 arch/x86/dts/cougarcanyon2.dts            | 71 +++++++++++++++++++++++++++++++
 arch/x86/dts/crownbay.dts                 |  2 +-
 arch/x86/dts/galileo.dts                  |  2 +-
 arch/x86/include/asm/arch-ivybridge/irq.h | 45 ++++++++++++++++++++
 arch/x86/include/asm/irq.h                | 31 ++++++++++----
 configs/cougarcanyon2_defconfig           |  6 +++
 doc/README.x86                            |  4 +-
 drivers/usb/host/xhci-pci.c               |  5 +--
 scripts/config_whitelist.txt              |  1 -
 22 files changed, 249 insertions(+), 168 deletions(-)
 delete mode 100644 arch/x86/cpu/quark/irq.c
 delete mode 100644 arch/x86/cpu/queensbay/irq.c
 create mode 100644 arch/x86/include/asm/arch-ivybridge/irq.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/13 usb: xhci-pci: Fix compiler warning

This fixes the following compiler warning:

"warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]"

---

 drivers/usb/host/xhci-pci.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-pci.c +2 -3
index e8fd6bf..b995aef 100644
@@ -23,9 +23,8 @@ static void xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr,
 	hcor = (struct xhci_hcor *)((uintptr_t) hccr +
 			HC_LENGTH(xhci_readl(&hccr->cr_capbase)));
 
-	debug("XHCI-PCI init hccr 0x%x and hcor 0x%x hc_length %d\n",
-	      (u32)hccr, (u32)hcor,
-	      (u32)HC_LENGTH(xhci_readl(&hccr->cr_capbase)));
+	debug("XHCI-PCI init hccr %p and hcor %p hc_length %d\n",
+	      hccr, hcor, (u32)HC_LENGTH(xhci_readl(&hccr->cr_capbase)));
 
 	*ret_hccr = hccr;
 	*ret_hcor = hcor;
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/13 usb: xhci-pci: Fix compiler warning

Quoted 10 lines · Bin Meng

This fixes the following compiler warning:

"warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]"

---

 drivers/usb/host/xhci-pci.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
author
#3 lore raw

PATCH 1/13 usb: xhci-pci: Fix compiler warning

Quoted 6 lines · Simon Glass
Quoted 5 lines · Bin Meng

This fixes the following compiler warning:

"warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]"

Quoted 7 lines
Quoted 5 lines

---

 drivers/usb/host/xhci-pci.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

applied to u-boot-x86, thanks!

author
#4 lore raw

PATCH 2/13 x86: ivybridge: Imply USB_XHCI_HCD

In reply to Bin Meng

The Panther Point chipset connected to Ivybridge has xHC integrated, imply it.

---

 arch/x86/cpu/ivybridge/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/x86/cpu/ivybridge/Kconfig +1 -0
index 82d5489..eec92df 100644
@@ -18,6 +18,7 @@ config NORTHBRIDGE_INTEL_IVYBRIDGE
 	imply SPI_FLASH
 	imply USB
 	imply USB_EHCI_HCD
+	imply USB_XHCI_HCD
 	imply VIDEO_VESA
 
 if NORTHBRIDGE_INTEL_IVYBRIDGE
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH 2/13 x86: ivybridge: Imply USB_XHCI_HCD

Quoted 4 lines · Simon Glass
Quoted 3 lines · Bin Meng

The Panther Point chipset connected to Ivybridge has xHC integrated, imply it.

Quoted 8 lines
Quoted 6 lines

---

 arch/x86/cpu/ivybridge/Kconfig | 1 +
 1 file changed, 1 insertion(+)

applied to u-boot-x86, thanks!

author
#7 lore raw

PATCH 3/13 x86: cougarcanyon2: Update dts for SPI lock down

In reply to Bin Meng

It turns out that like Braswell, Intel FSP for IvyBridge requires SPI controller settings to be locked down, as the U-Boot ICH SPI driver fails with the following message on Cougar Canyon 2 board:

"ICH SPI: Opcode 9f not found"

Update the SPI node property to indicate this fact.

---

 arch/x86/dts/cougarcanyon2.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/dts/cougarcanyon2.dts +2 -0
index ea836ee..8c71e98 100644
@@ -70,6 +70,8 @@
 				#address-cells = <1>;
 				#size-cells = <0>;
 				compatible = "intel,ich9-spi";
+				intel,spi-lock-down;
+
 				spi-flash at 0 {
 					reg = <0>;
 					compatible = "winbond,w25q64bv", "spi-flash";
Signature · 1 line
2.7.4
#8 lore raw

PATCH 3/13 x86: cougarcanyon2: Update dts for SPI lock down

Quoted 6 lines · Bin Meng

It turns out that like Braswell, Intel FSP for IvyBridge requires SPI controller settings to be locked down, as the U-Boot ICH SPI driver fails with the following message on Cougar Canyon 2 board:

"ICH SPI: Opcode 9f not found"

Quoted 7 lines

Update the SPI node property to indicate this fact.

---

 arch/x86/dts/cougarcanyon2.dts | 2 ++
 1 file changed, 2 insertions(+)
author
#9 lore raw

PATCH 3/13 x86: cougarcanyon2: Update dts for SPI lock down

Quoted 9 lines · Simon Glass
Quoted 8 lines · Bin Meng

It turns out that like Braswell, Intel FSP for IvyBridge requires SPI controller settings to be locked down, as the U-Boot ICH SPI driver fails with the following message on Cougar Canyon 2 board:

"ICH SPI: Opcode 9f not found"

Update the SPI node property to indicate this fact.

Quoted 7 lines
Quoted 5 lines

---

 arch/x86/dts/cougarcanyon2.dts | 2 ++
 1 file changed, 2 insertions(+)

applied to u-boot-x86, thanks!

author
#10 lore raw

PATCH 4/13 x86: cougarcanyon2: Remove CONFIG_HAVE_INTEL_ME

In reply to Bin Meng

As README.x86 already mentions, there are two SPI flashes mounted on Intel Cougar Canyon 2 board, called SPI-0 and SPI-1 respectively. SPI-0 stores the flash descriptor and the ME firmware. SPI-1 stores the actual BIOS image which is U-Boot. Building a single image with both ME firmware and U-Boot does not make sense.

This also describes the exact flash location where the u-boot.rom should be programmed in the documentation.

---

 configs/cougarcanyon2_defconfig | 1 +
 doc/README.x86                  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
configs/cougarcanyon2_defconfig +1 -0
index 6c79b77..04ad232 100644
@@ -3,6 +3,7 @@ CONFIG_SYS_TEXT_BASE=0xFFE00000
 CONFIG_VENDOR_INTEL=y
 CONFIG_DEFAULT_DEVICE_TREE="cougarcanyon2"
 CONFIG_TARGET_COUGARCANYON2=y
+# CONFIG_HAVE_INTEL_ME is not set
 # CONFIG_ENABLE_MRC_CACHE is not set
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
doc/README.x86 +3 -1
index 04f0220..78664c3 100644
@@ -256,7 +256,9 @@ the board manual. The SPI-0 flash should have flash descriptor plus ME firmware
 and SPI-1 flash is used to store U-Boot. For convenience, the complete 8MB SPI-0
 flash image is included in the FSP package (named Rom00_8M_MB_PPT.bin). Program
 this image to the SPI-0 flash according to the board manual just once and we are
-all set. For programming U-Boot we just need to program SPI-1 flash.
+all set. For programming U-Boot we just need to program SPI-1 flash. Since the
+default u-boot.rom image for this board is set to 2MB, it should be programmed
+to the last 2MB of the 8MB chip, address range [600000, 7FFFFF].
 
 ---
 
Signature · 1 line
2.7.4
#11 lore raw

PATCH 4/13 x86: cougarcanyon2: Remove CONFIG_HAVE_INTEL_ME

Quoted 9 lines · Bin Meng

As README.x86 already mentions, there are two SPI flashes mounted on Intel Cougar Canyon 2 board, called SPI-0 and SPI-1 respectively. SPI-0 stores the flash descriptor and the ME firmware. SPI-1 stores the actual BIOS image which is U-Boot. Building a single image with both ME firmware and U-Boot does not make sense.

This also describes the exact flash location where the u-boot.rom should be programmed in the documentation.

Quoted 6 lines

---

 configs/cougarcanyon2_defconfig | 1 +
 doc/README.x86                  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
author
#12 lore raw

PATCH 4/13 x86: cougarcanyon2: Remove CONFIG_HAVE_INTEL_ME

Quoted 10 lines · Simon Glass
Quoted 9 lines · Bin Meng

As README.x86 already mentions, there are two SPI flashes mounted on Intel Cougar Canyon 2 board, called SPI-0 and SPI-1 respectively. SPI-0 stores the flash descriptor and the ME firmware. SPI-1 stores the actual BIOS image which is U-Boot. Building a single image with both ME firmware and U-Boot does not make sense.

This also describes the exact flash location where the u-boot.rom should be programmed in the documentation.

Quoted 8 lines
Quoted 6 lines

---

 configs/cougarcanyon2_defconfig | 1 +
 doc/README.x86                  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

applied to u-boot-x86, thanks!

author
#13 lore raw

PATCH 5/13 x86: ivybridge: Enable 206ax cpu driver for FSP build

In reply to Bin Meng

At present this 206ax cpu driver is only built when FSP is not used. This updates the Makefile to enable the build for both cases.

---

 arch/x86/cpu/ivybridge/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/ivybridge/Makefile +1 -1
index 27cfb26..716134e 100644
@@ -8,7 +8,6 @@ else
 obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += cpu.o
 obj-y += early_me.o
 obj-y += lpc.o
-obj-y += model_206ax.o
 obj-y += northbridge.o
 ifndef CONFIG_SPL_BUILD
 obj-y += sata.o
@@ -18,4 +17,5 @@ ifndef CONFIG_$(SPL_)X86_32BIT_INIT
 obj-y += sdram_nop.o
 endif
 endif
+obj-y += model_206ax.o
 obj-y += bd82x6x.o
Signature · 1 line
2.7.4
#14 lore raw

PATCH 5/13 x86: ivybridge: Enable 206ax cpu driver for FSP build

Quoted 8 lines · Bin Meng

At present this 206ax cpu driver is only built when FSP is not used. This updates the Makefile to enable the build for both cases.

---

 arch/x86/cpu/ivybridge/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
author
#15 lore raw

PATCH 5/13 x86: ivybridge: Enable 206ax cpu driver for FSP build

Quoted 11 lines · Simon Glass
Quoted 8 lines · Bin Meng

At present this 206ax cpu driver is only built when FSP is not used. This updates the Makefile to enable the build for both cases.

---

 arch/x86/cpu/ivybridge/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

applied to u-boot-x86, thanks!

author
#16 lore raw

PATCH 6/13 x86: ivybridge: Drop CONFIG_USBDEBUG

In reply to Bin Meng

This is not used anywhere. Clean this up.

---

 arch/x86/cpu/intel_common/mrc.c      |  5 -----
 arch/x86/cpu/ivybridge/model_206ax.c | 15 ---------------
 scripts/config_whitelist.txt         |  1 -
 3 files changed, 21 deletions(-)
arch/x86/cpu/intel_common/mrc.c +0 -5
index a5697a6..b35102a 100644
@@ -242,11 +242,6 @@ static int sdram_initialise(struct udevice *dev, struct udevice *me_dev,
 	      version >> 24 , (version >> 16) & 0xff,
 	      (version >> 8) & 0xff, version & 0xff);
 
-#if CONFIG_USBDEBUG
-	/* mrc.bin reconfigures USB, so reinit it to have debug */
-	early_usbdebug_init();
-#endif
-
 	return 0;
 }
 
arch/x86/cpu/ivybridge/model_206ax.c +0 -15
index c5441aa..33e5c62 100644
@@ -393,10 +393,6 @@ static void configure_mca(void)
 		msr_write(IA32_MC0_STATUS + (i * 4), msr);
 }
 
-#if CONFIG_USBDEBUG
-static unsigned ehci_debug_addr;
-#endif
-
 static int model_206ax_init(struct udevice *dev)
 {
 	int ret;
@@ -404,17 +400,6 @@ static int model_206ax_init(struct udevice *dev)
 	/* Clear out pending MCEs */
 	configure_mca();
 
-#if CONFIG_USBDEBUG
-	/* Is this caution really needed? */
-	if (!ehci_debug_addr)
-		ehci_debug_addr = get_ehci_debug();
-	set_ehci_debug(0);
-#endif
-
-#if CONFIG_USBDEBUG
-	set_ehci_debug(ehci_debug_addr);
-#endif
-
 	/* Enable the local cpu apics */
 	enable_lapic_tpr();
 
scripts/config_whitelist.txt +0 -1
index 705ed89..580304a 100644
@@ -4596,7 +4596,6 @@ CONFIG_USART1
 CONFIG_USART_BASE
 CONFIG_USART_ID
 CONFIG_USBBOOTCOMMAND
-CONFIG_USBDEBUG
 CONFIG_USBD_CONFIGURATION_STR
 CONFIG_USBD_CTRL_INTERFACE_STR
 CONFIG_USBD_DATA_INTERFACE_STR
Signature · 1 line
2.7.4
#17 lore raw

PATCH 6/13 x86: ivybridge: Drop CONFIG_USBDEBUG

Quoted 9 lines · Bin Meng

This is not used anywhere. Clean this up.

---

 arch/x86/cpu/intel_common/mrc.c      |  5 -----
 arch/x86/cpu/ivybridge/model_206ax.c | 15 ---------------
 scripts/config_whitelist.txt         |  1 -
 3 files changed, 21 deletions(-)
author
#18 lore raw

PATCH 6/13 x86: ivybridge: Drop CONFIG_USBDEBUG

Quoted 6 lines · Simon Glass
Quoted 5 lines · Bin Meng

This is not used anywhere. Clean this up.

---

Quoted 6 lines
Quoted 4 lines
 arch/x86/cpu/intel_common/mrc.c      |  5 -----
 arch/x86/cpu/ivybridge/model_206ax.c | 15 ---------------
 scripts/config_whitelist.txt         |  1 -
 3 files changed, 21 deletions(-)

applied to u-boot-x86, thanks!

author
#19 lore raw

PATCH 7/13 x86: chromebook_link: Remove dm-pre-reloc property in the cpu nodes

In reply to Bin Meng

The 206ax cpu driver does not require pre-relocation flag to work.

---

 arch/x86/dts/chromebook_link.dts | 5 -----
 1 file changed, 5 deletions(-)
arch/x86/dts/chromebook_link.dts +0 -5
index fab919a..26b9f85 100644
@@ -26,14 +26,12 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		u-boot,dm-pre-reloc;
 
 		cpu at 0 {
 			device_type = "cpu";
 			compatible = "intel,core-gen3";
 			reg = <0>;
 			intel,apic-id = <0>;
-			u-boot,dm-pre-reloc;
 		};
 
 		cpu at 1 {
@@ -41,7 +39,6 @@
 			compatible = "intel,core-gen3";
 			reg = <1>;
 			intel,apic-id = <1>;
-			u-boot,dm-pre-reloc;
 		};
 
 		cpu at 2 {
@@ -49,7 +46,6 @@
 			compatible = "intel,core-gen3";
 			reg = <2>;
 			intel,apic-id = <2>;
-			u-boot,dm-pre-reloc;
 		};
 
 		cpu at 3 {
@@ -57,7 +53,6 @@
 			compatible = "intel,core-gen3";
 			reg = <3>;
 			intel,apic-id = <3>;
-			u-boot,dm-pre-reloc;
 		};
 
 	};
Signature · 1 line
2.7.4
author
#21 lore raw

PATCH 7/13 x86: chromebook_link: Remove dm-pre-reloc property in the cpu nodes

Quoted 11 lines · Simon Glass
Quoted 8 lines · Bin Meng

The 206ax cpu driver does not require pre-relocation flag to work.

---

 arch/x86/dts/chromebook_link.dts | 5 -----
 1 file changed, 5 deletions(-)

applied to u-boot-x86, thanks!

author
#22 lore raw

PATCH 8/13 x86: cougarcanyon2: Enable CPU driver and SMP support

In reply to Bin Meng

This enables the 206ax cpu driver on Intel Cougar Canyon 2 board, so that SMP can be supported too.

---

 arch/x86/dts/cougarcanyon2.dts  | 33 +++++++++++++++++++++++++++++++++
 configs/cougarcanyon2_defconfig |  3 +++
 2 files changed, 36 insertions(+)
arch/x86/dts/cougarcanyon2.dts +33 -0
index 8c71e98..946ba06 100644
@@ -27,6 +27,39 @@
 		stdout-path = "/serial";
 	};
 
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "intel,core-gen3";
+			reg = <0>;
+			intel,apic-id = <0>;
+		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "intel,core-gen3";
+			reg = <1>;
+			intel,apic-id = <1>;
+		};
+
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "intel,core-gen3";
+			reg = <2>;
+			intel,apic-id = <2>;
+		};
+
+		cpu at 3 {
+			device_type = "cpu";
+			compatible = "intel,core-gen3";
+			reg = <3>;
+			intel,apic-id = <3>;
+		};
+	};
+
 	microcode {
 		update at 0 {
 #include "microcode/m12306a2_00000008.dtsi"
configs/cougarcanyon2_defconfig +3 -0
index 04ad232..98d9aa0 100644
@@ -5,12 +5,14 @@ CONFIG_DEFAULT_DEVICE_TREE="cougarcanyon2"
 CONFIG_TARGET_COUGARCANYON2=y
 # CONFIG_HAVE_INTEL_ME is not set
 # CONFIG_ENABLE_MRC_CACHE is not set
+CONFIG_SMP=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
+CONFIG_CMD_CPU=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_PART=y
@@ -32,6 +34,7 @@ CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
+CONFIG_CPU=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_USB_STORAGE=y
Signature · 1 line
2.7.4
#23 lore raw

PATCH 8/13 x86: cougarcanyon2: Enable CPU driver and SMP support

Quoted 10 lines · Bin Meng

This enables the 206ax cpu driver on Intel Cougar Canyon 2 board, so that SMP can be supported too.

---

 arch/x86/dts/cougarcanyon2.dts  | 33 +++++++++++++++++++++++++++++++++
 configs/cougarcanyon2_defconfig |  3 +++
 2 files changed, 36 insertions(+)
author
#24 lore raw

PATCH 8/13 x86: cougarcanyon2: Enable CPU driver and SMP support

Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng

This enables the 206ax cpu driver on Intel Cougar Canyon 2 board, so that SMP can be supported too.

---

Quoted 6 lines
Quoted 4 lines
 arch/x86/dts/cougarcanyon2.dts  | 33 +++++++++++++++++++++++++++++++++
 configs/cougarcanyon2_defconfig |  3 +++
 2 files changed, 36 insertions(+)

applied to u-boot-x86, thanks!

author
#25 lore raw

PATCH 9/13 x86: irq: Remove chipset specific irq router drivers

In reply to Bin Meng

At present there are 3 irq router drivers. One is the common one and the other two are chipset specific for queensbay and quark. However these are really the same drivers as the core logic is the same. The two chipset specific drivers configure some registers that are outside the irq router block which should really be part of the chipset initialization.

Now we remove these specific drivers and make all x86 boards use the common one.

---

 arch/x86/cpu/irq.c              |  7 +----
 arch/x86/cpu/quark/Makefile     |  2 +-
 arch/x86/cpu/quark/irq.c        | 48 -------------------------------
 arch/x86/cpu/quark/quark.c      | 26 +++++++++++++++++
 arch/x86/cpu/queensbay/Makefile |  2 +-
 arch/x86/cpu/queensbay/irq.c    | 64 -----------------------------------------
 arch/x86/cpu/queensbay/tnc.c    | 39 +++++++++++++++++++++++++
 arch/x86/dts/crownbay.dts       |  2 +-
 arch/x86/dts/galileo.dts        |  2 +-
 arch/x86/include/asm/irq.h      |  7 -----
 10 files changed, 70 insertions(+), 129 deletions(-)
 delete mode 100644 arch/x86/cpu/quark/irq.c
 delete mode 100644 arch/x86/cpu/queensbay/irq.c
arch/x86/cpu/irq.c +1 -6
index 305cd3d..a1d6a84 100644
@@ -237,7 +237,7 @@ static void irq_enable_sci(struct udevice *dev)
 	}
 }
 
-int irq_router_common_init(struct udevice *dev)
+int irq_router_probe(struct udevice *dev)
 {
 	int ret;
 
@@ -256,11 +256,6 @@ int irq_router_common_init(struct udevice *dev)
 	return 0;
 }
 
-int irq_router_probe(struct udevice *dev)
-{
-	return irq_router_common_init(dev);
-}
-
 ulong write_pirq_routing_table(ulong addr)
 {
 	if (!gd->arch.pirq_routing_table)
arch/x86/cpu/quark/Makefile +1 -1
index 476e37c..7039f8b 100644
@@ -2,6 +2,6 @@
 #
 # Copyright (C) 2015, Bin Meng <[email protected]>
 
-obj-y += car.o dram.o irq.o msg_port.o quark.o
+obj-y += car.o dram.o msg_port.o quark.o
 obj-y += mrc.o mrc_util.o hte.o smc.o
 obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi.o
arch/x86/cpu/quark/irq.c deleted +0 -48

48 lines not on this page · raw message

arch/x86/cpu/quark/quark.c +26 -0
index 46141c4..4fd6864 100644
@@ -7,6 +7,7 @@
 #include <mmc.h>
 #include <asm/io.h>
 #include <asm/ioapic.h>
+#include <asm/irq.h>
 #include <asm/mrccache.h>
 #include <asm/mtrr.h>
 #include <asm/pci.h>
@@ -313,12 +314,37 @@ static void quark_usb_init(void)
 	writel((0xf << 16) | 0xf, bar + USBD_EP_INT_STS);
 }
 
+static void quark_irq_init(void)
+{
+	struct quark_rcba *rcba;
+	u32 base;
+
+	qrk_pci_read_config_dword(QUARK_LEGACY_BRIDGE, LB_RCBA, &base);
+	base &= ~MEM_BAR_EN;
+	rcba = (struct quark_rcba *)base;
+
+	/*
+	 * Route Quark PCI device interrupt pin to PIRQ
+	 *
+	 * Route device#23's INTA/B/C/D to PIRQA/B/C/D
+	 * Route device#20,21's INTA/B/C/D to PIRQE/F/G/H
+	 */
+	writew(PIRQC, &rcba->rmu_ir);
+	writew(PIRQA | (PIRQB << 4) | (PIRQC << 8) | (PIRQD << 12),
+	       &rcba->d23_ir);
+	writew(PIRQD, &rcba->core_ir);
+	writew(PIRQE | (PIRQF << 4) | (PIRQG << 8) | (PIRQH << 12),
+	       &rcba->d20d21_ir);
+}
+
 int arch_early_init_r(void)
 {
 	quark_pcie_init();
 
 	quark_usb_init();
 
+	quark_irq_init();
+
 	return 0;
 }
 
arch/x86/cpu/queensbay/Makefile +1 -1
index b535b2a..ac29613 100644
@@ -2,5 +2,5 @@
 #
 # Copyright (C) 2014, Bin Meng <[email protected]>
 
-obj-y += fsp_configs.o irq.o
+obj-y += fsp_configs.o
 obj-y += tnc.o
arch/x86/cpu/queensbay/irq.c deleted +0 -64

64 lines not on this page · raw message

arch/x86/cpu/queensbay/tnc.c +39 -0
index 439c14d..76556fc 100644
@@ -98,6 +98,43 @@ int arch_cpu_init(void)
 	return x86_cpu_init_f();
 }
 
+static void tnc_irq_init(void)
+{
+	struct tnc_rcba *rcba;
+	u32 base;
+
+	pci_read_config32(TNC_LPC, LPC_RCBA, &base);
+	base &= ~MEM_BAR_EN;
+	rcba = (struct tnc_rcba *)base;
+
+	/* Make sure all internal PCI devices are using INTA */
+	writel(INTA, &rcba->d02ip);
+	writel(INTA, &rcba->d03ip);
+	writel(INTA, &rcba->d27ip);
+	writel(INTA, &rcba->d31ip);
+	writel(INTA, &rcba->d23ip);
+	writel(INTA, &rcba->d24ip);
+	writel(INTA, &rcba->d25ip);
+	writel(INTA, &rcba->d26ip);
+
+	/*
+	 * Route TunnelCreek PCI device interrupt pin to PIRQ
+	 *
+	 * Since PCIe downstream ports received INTx are routed to PIRQ
+	 * A/B/C/D directly and not configurable, we have to route PCIe
+	 * root ports' INTx to PIRQ A/B/C/D as well. For other devices
+	 * on TunneCreek, route them to PIRQ E/F/G/H.
+	 */
+	writew(PIRQE, &rcba->d02ir);
+	writew(PIRQF, &rcba->d03ir);
+	writew(PIRQG, &rcba->d27ir);
+	writew(PIRQH, &rcba->d31ir);
+	writew(PIRQA, &rcba->d23ir);
+	writew(PIRQB, &rcba->d24ir);
+	writew(PIRQC, &rcba->d25ir);
+	writew(PIRQD, &rcba->d26ir);
+}
+
 int arch_early_init_r(void)
 {
 	int ret = 0;
@@ -106,5 +143,7 @@ int arch_early_init_r(void)
 	ret = disable_igd();
 #endif
 
+	tnc_irq_init();
+
 	return ret;
 }
arch/x86/dts/crownbay.dts +1 -1
index 4fe076a..d8faa9d 100644
@@ -151,7 +151,7 @@
 			#size-cells = <1>;
 
 			irq-router {
-				compatible = "intel,queensbay-irq-router";
+				compatible = "intel,irq-router";
 				intel,pirq-config = "pci";
 				intel,actl-addr = <0x58>;
 				intel,pirq-link = <0x60 8>;
arch/x86/dts/galileo.dts +1 -1
index d86fdc0..3454abd 100644
@@ -97,7 +97,7 @@
 			#size-cells = <1>;
 
 			irq-router {
-				compatible = "intel,quark-irq-router";
+				compatible = "intel,irq-router";
 				intel,pirq-config = "pci";
 				intel,actl-addr = <0x58>;
 				intel,pirq-link = <0x60 8>;
arch/x86/include/asm/irq.h +0 -7
index 169b281..ad95bb4 100644
@@ -58,11 +58,4 @@ struct pirq_routing {
 
 #define PIRQ_BITMAP		0xdef8
 
-/**
- * irq_router_common_init() - Perform common x86 interrupt init
- *
- * This creates the PIRQ routing table and routes the IRQs
- */
-int irq_router_common_init(struct udevice *dev);
-
 #endif /* _ARCH_IRQ_H_ */
Signature · 1 line
2.7.4
#26 lore raw

PATCH 9/13 x86: irq: Remove chipset specific irq router drivers

Quoted 13 lines · Bin Meng

At present there are 3 irq router drivers. One is the common one and the other two are chipset specific for queensbay and quark. However these are really the same drivers as the core logic is the same. The two chipset specific drivers configure some registers that are outside the irq router block which should really be part of the chipset initialization.

Now we remove these specific drivers and make all x86 boards use the common one.

---

Quoted 13 lines
 arch/x86/cpu/irq.c              |  7 +----
 arch/x86/cpu/quark/Makefile     |  2 +-
 arch/x86/cpu/quark/irq.c        | 48 -------------------------------
 arch/x86/cpu/quark/quark.c      | 26 +++++++++++++++++
 arch/x86/cpu/queensbay/Makefile |  2 +-
 arch/x86/cpu/queensbay/irq.c    | 64 -----------------------------------------
 arch/x86/cpu/queensbay/tnc.c    | 39 +++++++++++++++++++++++++
 arch/x86/dts/crownbay.dts       |  2 +-
 arch/x86/dts/galileo.dts        |  2 +-
 arch/x86/include/asm/irq.h      |  7 -----
 10 files changed, 70 insertions(+), 129 deletions(-)
 delete mode 100644 arch/x86/cpu/quark/irq.c
 delete mode 100644 arch/x86/cpu/queensbay/irq.c
author
#27 lore raw

PATCH 9/13 x86: irq: Remove chipset specific irq router drivers

Quoted 29 lines · Simon Glass
Quoted 13 lines · Bin Meng

At present there are 3 irq router drivers. One is the common one and the other two are chipset specific for queensbay and quark. However these are really the same drivers as the core logic is the same. The two chipset specific drivers configure some registers that are outside the irq router block which should really be part of the chipset initialization.

Now we remove these specific drivers and make all x86 boards use the common one.

---

Quoted 13 lines
 arch/x86/cpu/irq.c              |  7 +----
 arch/x86/cpu/quark/Makefile     |  2 +-
 arch/x86/cpu/quark/irq.c        | 48 -------------------------------
 arch/x86/cpu/quark/quark.c      | 26 +++++++++++++++++
 arch/x86/cpu/queensbay/Makefile |  2 +-
 arch/x86/cpu/queensbay/irq.c    | 64 -----------------------------------------
 arch/x86/cpu/queensbay/tnc.c    | 39 +++++++++++++++++++++++++
 arch/x86/dts/crownbay.dts       |  2 +-
 arch/x86/dts/galileo.dts        |  2 +-
 arch/x86/include/asm/irq.h      |  7 -----
 10 files changed, 70 insertions(+), 129 deletions(-)
 delete mode 100644 arch/x86/cpu/quark/irq.c
 delete mode 100644 arch/x86/cpu/queensbay/irq.c
Quoted 1 line

applied to u-boot-x86, thanks!

author
#28 lore raw

PATCH 10/13 x86: irq: Change LINK_V2N and LINK_N2V to inline functions

In reply to Bin Meng

LINK_V2N and LINK_N2V are currently defines, so they cannot handle complex logics. Change to inline functions for future extension.

---

 arch/x86/cpu/irq.c         | 18 +++++++++++-------
 arch/x86/include/asm/irq.h | 26 +++++++++++++++++++++++---
 2 files changed, 34 insertions(+), 10 deletions(-)
arch/x86/cpu/irq.c +11 -7
index a1d6a84..ec556d3 100644
@@ -23,9 +23,11 @@ bool pirq_check_irq_routed(struct udevice *dev, int link, u8 irq)
 	int base = priv->link_base;
 
 	if (priv->config == PIRQ_VIA_PCI)
-		dm_pci_read_config8(dev->parent, LINK_N2V(link, base), &pirq);
+		dm_pci_read_config8(dev->parent,
+				    pirq_linkno_to_reg(link, base), &pirq);
 	else
-		pirq = readb((uintptr_t)priv->ibase + LINK_N2V(link, base));
+		pirq = readb((uintptr_t)priv->ibase +
+			     pirq_linkno_to_reg(link, base));
 
 	pirq &= 0xf;
 
@@ -40,7 +42,7 @@ int pirq_translate_link(struct udevice *dev, int link)
 {
 	struct irq_router *priv = dev_get_priv(dev);
 
-	return LINK_V2N(link, priv->link_base);
+	return pirq_reg_to_linkno(link, priv->link_base);
 }
 
 void pirq_assign_irq(struct udevice *dev, int link, u8 irq)
@@ -53,9 +55,11 @@ void pirq_assign_irq(struct udevice *dev, int link, u8 irq)
 		return;
 
 	if (priv->config == PIRQ_VIA_PCI)
-		dm_pci_write_config8(dev->parent, LINK_N2V(link, base), irq);
+		dm_pci_write_config8(dev->parent,
+				     pirq_linkno_to_reg(link, base), irq);
 	else
-		writeb(irq, (uintptr_t)priv->ibase + LINK_N2V(link, base));
+		writeb(irq, (uintptr_t)priv->ibase +
+		       pirq_linkno_to_reg(link, base));
 }
 
 static struct irq_info *check_dup_entry(struct irq_info *slot_base,
@@ -78,7 +82,7 @@ static inline void fill_irq_info(struct irq_router *priv, struct irq_info *slot,
 {
 	slot->bus = bus;
 	slot->devfn = (device << 3) | 0;
-	slot->irq[pin - 1].link = LINK_N2V(pirq, priv->link_base);
+	slot->irq[pin - 1].link = pirq_linkno_to_reg(pirq, priv->link_base);
 	slot->irq[pin - 1].bitmap = priv->irq_mask;
 }
 
@@ -199,7 +203,7 @@ static int create_pirq_routing_table(struct udevice *dev)
 				 * routing information in the device tree.
 				 */
 				if (slot->irq[pr.pin - 1].link !=
-					LINK_N2V(pr.pirq, priv->link_base))
+				    pirq_linkno_to_reg(pr.pirq, priv->link_base))
 					debug("WARNING: Inconsistent PIRQ routing information\n");
 				continue;
 			}
arch/x86/include/asm/irq.h +23 -3
index ad95bb4..bfa58cf 100644
@@ -52,9 +52,29 @@ struct pirq_routing {
 	int pirq;
 };
 
-/* PIRQ link number and value conversion */
-#define LINK_V2N(link, base)	(link - base)
-#define LINK_N2V(link, base)	(link + base)
+/**
+ * pirq_reg_to_linkno() - Convert a PIRQ routing register offset to link number
+ *
+ * @reg:	PIRQ routing register offset from the base address
+ * @base:	PIRQ routing register block base address
+ * @return:	PIRQ link number (0 for PIRQA, 1 for PIRQB, etc)
+ */
+static inline int pirq_reg_to_linkno(int reg, int base)
+{
+	return reg - base;
+}
+
+/**
+ * pirq_linkno_to_reg() - Convert a PIRQ link number to routing register offset
+ *
+ * @linkno:	PIRQ link number (0 for PIRQA, 1 for PIRQB, etc)
+ * @base:	PIRQ routing register block base address
+ * @return:	PIRQ routing register offset from the base address
+ */
+static inline int pirq_linkno_to_reg(int linkno, int base)
+{
+	return linkno + base;
+}
 
 #define PIRQ_BITMAP		0xdef8
 
Signature · 1 line
2.7.4
#29 lore raw

PATCH 10/13 x86: irq: Change LINK_V2N and LINK_N2V to inline functions

Quoted 10 lines · Bin Meng

LINK_V2N and LINK_N2V are currently defines, so they cannot handle complex logics. Change to inline functions for future extension.

---

 arch/x86/cpu/irq.c         | 18 +++++++++++-------
 arch/x86/include/asm/irq.h | 26 +++++++++++++++++++++++---
 2 files changed, 34 insertions(+), 10 deletions(-)
author
#30 lore raw

PATCH 10/13 x86: irq: Change LINK_V2N and LINK_N2V to inline functions

Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng

LINK_V2N and LINK_N2V are currently defines, so they cannot handle complex logics. Change to inline functions for future extension.

---

Quoted 6 lines
Quoted 4 lines
 arch/x86/cpu/irq.c         | 18 +++++++++++-------
 arch/x86/include/asm/irq.h | 26 +++++++++++++++++++++++---
 2 files changed, 34 insertions(+), 10 deletions(-)

applied to u-boot-x86, thanks!

author
#31 lore raw

PATCH 11/13 x86: irq: Introduce CONFIG_DISCRETE_PIRQ_ROUT

In reply to Bin Meng

Currently both pirq_reg_to_linkno() and pirq_linkno_to_reg() assume consecutive PIRQ routing control registers. But this is not always the case on some platforms. Introduce a Kconfig option for this and adjust the irq router driver to be able to use platform-specific converting logic.

---

 arch/x86/Kconfig           | 9 +++++++++
 arch/x86/cpu/irq.c         | 3 +++
 arch/x86/include/asm/irq.h | 2 ++
 3 files changed, 14 insertions(+)
arch/x86/Kconfig +9 -0
index 5c23b2c..c145799 100644
@@ -686,6 +686,15 @@ config STACK_SIZE
 	  Estimated U-Boot's runtime stack size that needs to be reserved
 	  during an ACPI S3 resume.
 
+config DISCRETE_PIRQ_ROUT
+	bool
+	help
+	  This variable indicates that the chipset's PIRQ routing control
+	  registers are not consecutive. If this is the case, the platform
+	  codes must provide two inline functions for the IRQ router driver
+	  to convert PIRQ routing control register offset to link number.
+	  See pirq_reg_to_linkno() and pirq_linkno_to_reg().
+
 config MAX_PIRQ_LINKS
 	int
 	default 8
arch/x86/cpu/irq.c +3 -0
index ec556d3..e33be61 100644
@@ -13,6 +13,9 @@
 #include <asm/pci.h>
 #include <asm/pirq_routing.h>
 #include <asm/tables.h>
+#ifdef CONFIG_DISCRETE_PIRQ_ROUT
+#include <asm/arch/irq.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
arch/x86/include/asm/irq.h +2 -0
index bfa58cf..468a29f 100644
@@ -52,6 +52,7 @@ struct pirq_routing {
 	int pirq;
 };
 
+#ifndef CONFIG_DISCRETE_PIRQ_ROUT
 /**
  * pirq_reg_to_linkno() - Convert a PIRQ routing register offset to link number
  *
@@ -75,6 +76,7 @@ static inline int pirq_linkno_to_reg(int linkno, int base)
 {
 	return linkno + base;
 }
+#endif
 
 #define PIRQ_BITMAP		0xdef8
 
Signature · 1 line
2.7.4
#32 lore raw

PATCH 11/13 x86: irq: Introduce CONFIG_DISCRETE_PIRQ_ROUT

Hi Bin,

Quoted 6 lines · Bin Meng

Currently both pirq_reg_to_linkno() and pirq_linkno_to_reg() assume consecutive PIRQ routing control registers. But this is not always the case on some platforms. Introduce a Kconfig option for this and adjust the irq router driver to be able to use platform-specific converting logic.

Quoted 7 lines

---

 arch/x86/Kconfig           | 9 +++++++++
 arch/x86/cpu/irq.c         | 3 +++
 arch/x86/include/asm/irq.h | 2 ++
 3 files changed, 14 insertions(+)

Wouldn't it make sense to put the mapping in the device tree?

Regards,
Simon

author
#33 lore raw

PATCH 12/13 x86: ivybridge: Implement IvyBridge-specific IRQ converting logic

In reply to Bin Meng

This adds pirq_reg_to_linkno() and pirq_linkno_to_reg() for IvyBridge.

---

 arch/x86/cpu/ivybridge/Kconfig            |  4 +++
 arch/x86/include/asm/arch-ivybridge/irq.h | 45 +++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 arch/x86/include/asm/arch-ivybridge/irq.h
arch/x86/cpu/ivybridge/Kconfig +4 -0
index eec92df..e31c33c 100644
@@ -58,6 +58,10 @@ config ENABLE_VMX
 	  will be unable to support virtualisation, or it will run very
 	  slowly.
 
+config DISCRETE_PIRQ_ROUT
+	bool
+	default y
+
 config FSP_ADDR
 	hex
 	default 0xfff80000
arch/x86/include/asm/arch-ivybridge/irq.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#34 lore raw

PATCH 13/13 x86: cougarcanyon2: Add missing chipset interrupt information

In reply to Bin Meng

Add Panther Point chipset interrupt pin/PIRQ information, and enable the generation of PIRQ routing table and MP table.

---

 arch/x86/dts/cougarcanyon2.dts  | 36 ++++++++++++++++++++++++++++++++++++
 configs/cougarcanyon2_defconfig |  2 ++
 2 files changed, 38 insertions(+)
arch/x86/dts/cougarcanyon2.dts +36 -0
index 946ba06..65c8ffd 100644
@@ -5,6 +5,8 @@
 
 /dts-v1/;
 
+#include <dt-bindings/interrupt-router/intel-irq.h>
+
 /include/ "skeleton.dtsi"
 /include/ "serial.dtsi"
 /include/ "keyboard.dtsi"
@@ -99,6 +101,40 @@
 			#address-cells = <1>;
 			#size-cells = <1>;
 
+			irq-router {
+				compatible = "intel,irq-router";
+				intel,pirq-config = "pci";
+				intel,actl-8bit;
+				intel,actl-addr = <0x44>;
+				intel,pirq-link = <0x60 8>;
+				intel,pirq-mask = <0xcee0>;
+				intel,pirq-routing = <
+					/* Panther Point PCI devices */
+					PCI_BDF(0, 2, 0) INTA PIRQA
+					PCI_BDF(0, 20, 0) INTA PIRQA
+					PCI_BDF(0, 22, 0) INTA PIRQA
+					PCI_BDF(0, 22, 1) INTB PIRQB
+					PCI_BDF(0, 22, 2) INTC PIRQC
+					PCI_BDF(0, 22, 3) INTD PIRQD
+					PCI_BDF(0, 25, 0) INTA PIRQA
+					PCI_BDF(0, 26, 0) INTA PIRQA
+					PCI_BDF(0, 27, 0) INTB PIRQA
+					PCI_BDF(0, 28, 0) INTA PIRQA
+					PCI_BDF(0, 28, 1) INTB PIRQB
+					PCI_BDF(0, 28, 2) INTC PIRQC
+					PCI_BDF(0, 28, 3) INTD PIRQD
+					PCI_BDF(0, 28, 4) INTA PIRQA
+					PCI_BDF(0, 28, 5) INTB PIRQB
+					PCI_BDF(0, 28, 6) INTC PIRQC
+					PCI_BDF(0, 28, 7) INTD PIRQD
+					PCI_BDF(0, 29, 0) INTA PIRQA
+					PCI_BDF(0, 31, 2) INTB PIRQB
+					PCI_BDF(0, 31, 3) INTC PIRQC
+					PCI_BDF(0, 31, 5) INTB PIRQB
+					PCI_BDF(0, 31, 6) INTC PIRQC
+				>;
+			};
+
 			spi0: spi {
 				#address-cells = <1>;
 				#size-cells = <0>;
configs/cougarcanyon2_defconfig +2 -0
index 98d9aa0..eeee252 100644
@@ -6,6 +6,8 @@ CONFIG_TARGET_COUGARCANYON2=y
 # CONFIG_HAVE_INTEL_ME is not set
 # CONFIG_ENABLE_MRC_CACHE is not set
 CONFIG_SMP=y
+CONFIG_GENERATE_PIRQ_TABLE=y
+CONFIG_GENERATE_MP_TABLE=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
Signature · 1 line
2.7.4
#35 lore raw

PATCH 13/13 x86: cougarcanyon2: Add missing chipset interrupt information

Quoted 10 lines · Bin Meng

Add Panther Point chipset interrupt pin/PIRQ information, and enable the generation of PIRQ routing table and MP table.

---

 arch/x86/dts/cougarcanyon2.dts  | 36 ++++++++++++++++++++++++++++++++++++
 configs/cougarcanyon2_defconfig |  2 ++
 2 files changed, 38 insertions(+)