Skip to contentSkip to conversation

x86: Add initial support for apollolake

PATCH Superseded Simon Glass 6 participants 235 messages Dec 7, 2019 – Feb 17, 2020 Page 2 of 2

Subsystems (22)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#183 lore raw

PATCH v6 81/102 x86: Add a generic Intel GPIO driver

In reply to Simon Glass

Add a GPIO driver which uses the pinctrl driver to access the pad information. This driver relies on the GPIO nodes being subnodes to the pinctrl device.

---

Changes in v6:
- Fix 'hone' typo
- Remove the * in the first line of the binding file
- Use 'north' as the node name instead of 'n'
- Use a generic compatible string intel,gpio

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 .../gpio/intel,apl-gpio.txt                   |  55 ++++++
 drivers/gpio/Kconfig                          |   9 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/intel_gpio.c                     | 161 ++++++++++++++++++
 4 files changed, 226 insertions(+)
 create mode 100644 doc/device-tree-bindings/gpio/intel,apl-gpio.txt
 create mode 100644 drivers/gpio/intel_gpio.c
doc/device-tree-bindings/gpio/intel,apl-gpio.txt new file +55 -0
new file mode 100644
index 0000000000..e27a40b437
@@ -0,0 +1,55 @@
+Intel Apollo Lake GPIO controller
+
+The Apollo Lake (APL) GPIO controller is used to control GPIO functions of
+the pins.
+
+Required properties:
+- compatible: "intel,apl-gpio"
+- #gpio-cells: Should be 2. The syntax of the gpio specifier used by client
+  nodes should be the following with values derived from the SoC user manual.
+     <[phandle of the gpio controller node]
+      [pin number within the gpio controller]
+      [flags]>
+
+  Values for gpio specifier:
+  - Pin number: is a GPIO pin number between 0 and 244
+  - Flags: GPIO_ACTIVE_HIGH or GPIO_ACTIVE_LOW
+
+- gpio-controller: Specifies that the node is a gpio controller.
+
+Example:
+
+...
+{
+	p2sb: p2sb at d,0 {
+		reg = <0x02006810 0 0 0 0>;
+		compatible = "intel,apl-p2sb";
+		early-regs = <IOMAP_P2SB_BAR 0x100000>;
+
+		north {
+			compatible = "intel,apl-pinctrl";
+			intel,p2sb-port-id = <PID_GPIO_N>;
+			gpio_n: gpio-n {
+				compatible = "intel,gpio";
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+		};
+	};
+
+	i2c_2: i2c2 at 16,2 {
+		compatible = "intel,apl-i2c", "snps,designware-i2c-pci";
+		reg = <0x0200b210 0 0 0 0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clock-frequency = <400000>;
+		tpm at 50 {
+			reg = <0x50>;
+			compatible = "google,cr50";
+			u-boot,i2c-offset-len = <0>;
+			ready-gpio = <&gpio_n GPIO_28 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+};
+...
drivers/gpio/Kconfig +9 -0
index 447cf04578..1de6f5225e 100644
@@ -104,6 +104,15 @@ config INTEL_BROADWELL_GPIO
 	  driver from the common Intel ICH6 driver. It supports a total of
 	  95 GPIOs which can be configured from the device tree.
 
+config INTEL_GPIO
+	bool "Intel generic GPIO driver"
+	depends on DM_GPIO
+	help
+	  Say yes here to select Intel generic GPIO driver. This controller
+	  supports recent chips (e.g. Apollo Lake). It permits basic GPIO
+	  control including setting pins to input/output. It makes use of its
+	  parent pinctrl driver to actually effect changes.
+
 config INTEL_ICH6_GPIO
 	bool "Intel ICH6 compatible legacy GPIO driver"
 	depends on DM_GPIO
drivers/gpio/Makefile +1 -0
index 3612e66786..449046b64c 100644
@@ -17,6 +17,7 @@ endif
 obj-$(CONFIG_AT91_GPIO)	+= at91_gpio.o
 obj-$(CONFIG_ATMEL_PIO4)	+= atmel_pio4.o
 obj-$(CONFIG_BCM6345_GPIO)	+= bcm6345_gpio.o
+obj-$(CONFIG_INTEL_GPIO)	+= intel_gpio.o
 obj-$(CONFIG_INTEL_ICH6_GPIO)	+= intel_ich6_gpio.o
 obj-$(CONFIG_INTEL_BROADWELL_GPIO)	+= intel_broadwell_gpio.o
 obj-$(CONFIG_KIRKWOOD_GPIO)	+= kw_gpio.o
drivers/gpio/intel_gpio.c new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#184 lore raw

PATCH v6 81/102 x86: Add a generic Intel GPIO driver

Quoted 19 lines · Simon Glass

Add a GPIO driver which uses the pinctrl driver to access the pad information. This driver relies on the GPIO nodes being subnodes to the pinctrl device.

---

Changes in v6:
- Fix 'hone' typo
- Remove the * in the first line of the binding file
- Use 'north' as the node name instead of 'n'
- Use a generic compatible string intel,gpio

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 8 lines
 .../gpio/intel,apl-gpio.txt                   |  55 ++++++
 drivers/gpio/Kconfig                          |   9 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/intel_gpio.c                     | 161 ++++++++++++++++++
 4 files changed, 226 insertions(+)
 create mode 100644 doc/device-tree-bindings/gpio/intel,apl-gpio.txt
 create mode 100644 drivers/gpio/intel_gpio.c
#185 lore raw

PATCH v6 81/102 x86: Add a generic Intel GPIO driver

Quoted 30 lines · Bin Meng
Quoted 19 lines · Simon Glass

Add a GPIO driver which uses the pinctrl driver to access the pad information. This driver relies on the GPIO nodes being subnodes to the pinctrl device.

---

Changes in v6:
- Fix 'hone' typo
- Remove the * in the first line of the binding file
- Use 'north' as the node name instead of 'n'
- Use a generic compatible string intel,gpio

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 8 lines
 .../gpio/intel,apl-gpio.txt                   |  55 ++++++
 drivers/gpio/Kconfig                          |   9 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/intel_gpio.c                     | 161 ++++++++++++++++++
 4 files changed, 226 insertions(+)
 create mode 100644 doc/device-tree-bindings/gpio/intel,apl-gpio.txt
 create mode 100644 drivers/gpio/intel_gpio.c
Quoted 1 line

applied to u-boot-x86/next, thanks!

#186 lore raw

PATCH v6 81/102 x86: Add a generic Intel GPIO driver

In reply to Simon Glass

Hi Simon, Bin,

drivers/gpio/intel_gpio.c line 42

Quoted 7 lines
drivers/gpio/intel_gpio.c new file +7 -0
+static int intel_gpio_direction_output(struct udevice *dev, uint offset,
+				       int value)
+{
+	struct udevice *pinctrl = dev_get_parent(dev);
+	uint config_offset = intel_pinctrl_get_config_reg_addr(pinctrl, offset);
+
+	pcr_clrsetbits32(dev, config_offset,

I think we should pass 'pinctrl' instead of 'dev' here.
As far as I understand the code the function pcr_clrsetbits32 expects a pinctrl device with a p2sb parent.

drivers/gpio/intel_gpio.c line 44

Quoted 2 lines
drivers/gpio/intel_gpio.c new file +2 -0
+			 PAD_CFG0_MODE_MASK | PAD_CFG0_RX_STATE |
+				  PAD_CFG0_TX_DISABLE,

We also need to clear the bit PAD_CFG0_TX_STATE here. Otherwise if a gpio is set to high once it can never be set to low again.

drivers/gpio/intel_gpio.c line 49

Quoted 5 lines
drivers/gpio/intel_gpio.c new file +5 -0
+			 PAD_CFG0_MODE_GPIO | PAD_CFG0_RX_DISABLE |
+				  (value ? PAD_CFG0_TX_STATE : 0));
+
+	return 0;
+}

regards, Wolfgang

#187 lore raw

PATCH v6 81/102 x86: Add a generic Intel GPIO driver

Hi Wolfgang,

Quoted 15 lines · Wolfgang Wallner

Hi Simon, Bin,

drivers/gpio/intel_gpio.c line 42

Quoted 7 lines
drivers/gpio/intel_gpio.c new file +7 -0
+static int intel_gpio_direction_output(struct udevice *dev, uint offset,
+                                    int value)
+{
+     struct udevice *pinctrl = dev_get_parent(dev);
+     uint config_offset = intel_pinctrl_get_config_reg_addr(pinctrl, offset);
+
+     pcr_clrsetbits32(dev, config_offset,

I think we should pass 'pinctrl' instead of 'dev' here.
As far as I understand the code the function pcr_clrsetbits32 expects a pinctrl device with a p2sb parent.

Quoted 9 lines

drivers/gpio/intel_gpio.c line 44

Quoted 2 lines
drivers/gpio/intel_gpio.c new file +2 -0
+                      PAD_CFG0_MODE_MASK | PAD_CFG0_RX_STATE |
+                               PAD_CFG0_TX_DISABLE,

We also need to clear the bit PAD_CFG0_TX_STATE here. Otherwise if a gpio is set to high once it can never be set to low again.

Quoted 3 lines
drivers/gpio/intel_gpio.c new file +3 -0
+                      PAD_CFG0_MODE_GPIO | PAD_CFG0_RX_DISABLE |
+                               (value ? PAD_CFG0_TX_STATE : 0));
+

I see you have sent patches for these, thank you,

Regards,
Simon

#188 lore raw

PATCH v6 82/102 x86: Move qemu CPU fixup function into its own file

In reply to Simon Glass

This function is specific to qemu so it seems best to keep it separate from the generic code.

Move it out to a new file and update the condition to use if() instead of
#ifdef

---

Changes in v6:
- Add back '#ifdef' line to commit message
- Drop incorrect mention of coreboot in qfw_cpu.c

Changes in v5:
- Add a new patch to move qemu CPU fixup function into its own file

Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/x86/cpu/Makefile  |  1 +
 arch/x86/cpu/mp_init.c | 73 +++---------------------------------------
 arch/x86/cpu/qfw_cpu.c | 73 ++++++++++++++++++++++++++++++++++++++++++
 include/qfw.h          |  8 +++++
 4 files changed, 87 insertions(+), 68 deletions(-)
 create mode 100644 arch/x86/cpu/qfw_cpu.c
arch/x86/cpu/Makefile +1 -0
index b6a010ea32..0e90a38dc5 100644
@@ -54,6 +54,7 @@ obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/
 obj-$(CONFIG_INTEL_TANGIER) += tangier/
 obj-$(CONFIG_APIC) += lapic.o ioapic.o
 obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += irq.o
+obj-$(CONFIG_QFW) += qfw_cpu.o
 ifndef CONFIG_$(SPL_)X86_64
 obj-$(CONFIG_SMP) += mp_init.o
 endif
arch/x86/cpu/mp_init.c +5 -68

85 lines not on this page · raw message

arch/x86/cpu/qfw_cpu.c new file +73 -0

73 lines not on this page · raw message

include/qfw.h +8 -0
index 2f1a20416f..cea8e11d44 100644
@@ -172,4 +172,12 @@ bool qemu_fwcfg_file_iter_end(struct fw_cfg_file_iter *iter);
 bool qemu_fwcfg_present(void);
 bool qemu_fwcfg_dma_present(void);
 
+/**
+ * qemu_cpu_fixup() - Fix up the CPUs for QEMU
+ *
+ * @return 0 if OK, -ENODEV if no CPUs, -ENOMEM if out of memory, other -ve on
+ *	on other error
+ */
+int qemu_cpu_fixup(void);
+
 #endif
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#189 lore raw

PATCH v6 82/102 x86: Move qemu CPU fixup function into its own file

Quoted 21 lines · Simon Glass

This function is specific to qemu so it seems best to keep it separate from the generic code.

Move it out to a new file and update the condition to use if() instead of
#ifdef

---

Changes in v6:
- Add back '#ifdef' line to commit message
- Drop incorrect mention of coreboot in qfw_cpu.c

Changes in v5:
- Add a new patch to move qemu CPU fixup function into its own file

Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 7 lines
 arch/x86/cpu/Makefile  |  1 +
 arch/x86/cpu/mp_init.c | 73 +++---------------------------------------
 arch/x86/cpu/qfw_cpu.c | 73 ++++++++++++++++++++++++++++++++++++++++++
 include/qfw.h          |  8 +++++
 4 files changed, 87 insertions(+), 68 deletions(-)
 create mode 100644 arch/x86/cpu/qfw_cpu.c
#190 lore raw

PATCH v6 82/102 x86: Move qemu CPU fixup function into its own file

Quoted 31 lines · Bin Meng
Quoted 21 lines · Simon Glass

This function is specific to qemu so it seems best to keep it separate from the generic code.

Move it out to a new file and update the condition to use if() instead of
#ifdef

---

Changes in v6:
- Add back '#ifdef' line to commit message
- Drop incorrect mention of coreboot in qfw_cpu.c

Changes in v5:
- Add a new patch to move qemu CPU fixup function into its own file

Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 7 lines
 arch/x86/cpu/Makefile  |  1 +
 arch/x86/cpu/mp_init.c | 73 +++---------------------------------------
 arch/x86/cpu/qfw_cpu.c | 73 ++++++++++++++++++++++++++++++++++++++++++
 include/qfw.h          |  8 +++++
 4 files changed, 87 insertions(+), 68 deletions(-)
 create mode 100644 arch/x86/cpu/qfw_cpu.c
Quoted 1 line

applied to u-boot-x86/next, thanks!

#191 lore raw

PATCH v6 83/102 x86: apl: Add basic IO addresses

In reply to Simon Glass

Add some fixed IO and mmap addresses for use in the device tree and with some early-init code.

---

Changes in v6: None
Changes in v5:
- Add ACPI base address and size

Changes in v4:
- Drop TCO_BASE_ADDRESS
- Tidy up header guards

Changes in v3: None
Changes in v2: None

 arch/x86/include/asm/arch-apollolake/iomap.h | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 arch/x86/include/asm/arch-apollolake/iomap.h
arch/x86/include/asm/arch-apollolake/iomap.h new file +29 -0
new file mode 100644
index 0000000000..4ce1017055
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2017 Intel Corporation.
+ * Take from coreboot project file of the same name
+ */
+
+#ifndef _ASM_ARCH_IOMAP_H
+#define _ASM_ARCH_IOMAP_H
+
+#define R_ACPI_PM1_TMR			0x8
+
+/* Put p2sb at 0xd0000000 in TPL */
+#define IOMAP_P2SB_BAR		0xd0000000
+
+#define IOMAP_SPI_BASE		0xfe010000
+
+#define IOMAP_ACPI_BASE		0x400
+#define IOMAP_ACPI_SIZE		0x100
+
+/*
+ * Use UART2. To use UART1 you need to set '2' to '1', change device tree serial
+ * node name and 'reg' property, and update CONFIG_DEBUG_UART_BASE.
+ */
+#define PCH_DEV_UART		PCI_BDF(0, 0x18, 2)
+
+#define PCH_DEV_LPC		PCI_BDF(0, 0x1f, 0)
+#define PCH_DEV_SPI		PCI_BDF(0, 0x0d, 2)
+
+#endif
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#192 lore raw

PATCH v6 83/102 x86: apl: Add basic IO addresses

Quoted 17 lines · Simon Glass

Add some fixed IO and mmap addresses for use in the device tree and with some early-init code.

---

Changes in v6: None
Changes in v5:
- Add ACPI base address and size

Changes in v4:
- Drop TCO_BASE_ADDRESS
- Tidy up header guards

Quoted 7 lines

Changes in v3: None
Changes in v2: None

 arch/x86/include/asm/arch-apollolake/iomap.h | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 arch/x86/include/asm/arch-apollolake/iomap.h

applied to u-boot-x86/next, thanks!

#193 lore raw

PATCH v6 84/102 x86: apl: Add PMC driver

In reply to Simon Glass

Add a driver for the Apollo Lake SoC. It supports the basic operations and can use device tree or of-platdata.

---

Changes in v6:
- Use one space after #defines in pm.h

Changes in v5: None
Changes in v4:
- Fix Makefile copyright message
- Fix incorrect mask check in pmc_gpe_init()
- Switch over to use pinctrl for pad init/config
- Tidy up header guards
- Use pci_ofplat_get_devfn()
- apollolake -> Apollo Lake

Changes in v3:
- Use pci_get_devfn()

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile          |   5 +
 arch/x86/cpu/apollolake/pmc.c             | 216 ++++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/pm.h |  19 ++
 drivers/power/acpi_pmc/acpi-pmc-uclass.c  |  56 ++++++
 4 files changed, 296 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/Makefile
 create mode 100644 arch/x86/cpu/apollolake/pmc.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/pm.h
arch/x86/cpu/apollolake/Makefile new file +5 -0
new file mode 100644
index 0000000000..5e136b6515
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2019 Google LLC
+
+obj-y += pmc.o
arch/x86/cpu/apollolake/pmc.c new file +216 -0

216 lines not on this page · raw message

arch/x86/include/asm/arch-apollolake/pm.h new file +19 -0
new file mode 100644
index 0000000000..6718290c4f
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2015-2016 Intel Corp.
+ * (Written by Lance Zhao <[email protected]> for Intel Corp.)
+ */
+
+#ifndef _ASM_ARCH_PM_H
+#define _ASM_ARCH_PM_H
+
+#define PMC_GPE_SW_31_0	0
+#define PMC_GPE_SW_63_32	1
+#define PMC_GPE_NW_31_0	3
+#define PMC_GPE_NW_63_32	4
+#define PMC_GPE_NW_95_64	5
+#define PMC_GPE_N_31_0		6
+#define PMC_GPE_N_63_32	7
+#define PMC_GPE_W_31_0		9
+
+#endif
drivers/power/acpi_pmc/acpi-pmc-uclass.c +56 -0

68 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#194 lore raw

PATCH v6 84/102 x86: apl: Add PMC driver

Quoted 24 lines · Simon Glass

Add a driver for the Apollo Lake SoC. It supports the basic operations and can use device tree or of-platdata.

---

Changes in v6:
- Use one space after #defines in pm.h

Changes in v5: None
Changes in v4:
- Fix Makefile copyright message
- Fix incorrect mask check in pmc_gpe_init()
- Switch over to use pinctrl for pad init/config
- Tidy up header guards
- Use pci_ofplat_get_devfn()
- apollolake -> Apollo Lake

Changes in v3:
- Use pci_get_devfn()

Changes in v2: None

Quoted 9 lines
 arch/x86/cpu/apollolake/Makefile          |   5 +
 arch/x86/cpu/apollolake/pmc.c             | 216 ++++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/pm.h |  19 ++
 drivers/power/acpi_pmc/acpi-pmc-uclass.c  |  56 ++++++
 4 files changed, 296 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/Makefile
 create mode 100644 arch/x86/cpu/apollolake/pmc.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/pm.h
#195 lore raw

PATCH v6 84/102 x86: apl: Add PMC driver

Quoted 36 lines · Bin Meng
Quoted 24 lines · Simon Glass

Add a driver for the Apollo Lake SoC. It supports the basic operations and can use device tree or of-platdata.

---

Changes in v6:
- Use one space after #defines in pm.h

Changes in v5: None
Changes in v4:
- Fix Makefile copyright message
- Fix incorrect mask check in pmc_gpe_init()
- Switch over to use pinctrl for pad init/config
- Tidy up header guards
- Use pci_ofplat_get_devfn()
- apollolake -> Apollo Lake

Changes in v3:
- Use pci_get_devfn()

Changes in v2: None

Quoted 9 lines
 arch/x86/cpu/apollolake/Makefile          |   5 +
 arch/x86/cpu/apollolake/pmc.c             | 216 ++++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/pm.h |  19 ++
 drivers/power/acpi_pmc/acpi-pmc-uclass.c  |  56 ++++++
 4 files changed, 296 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/Makefile
 create mode 100644 arch/x86/cpu/apollolake/pmc.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/pm.h
Quoted 1 line

applied to u-boot-x86/next, thanks!

#196 lore raw

PATCH v6 85/102 x86: apl: Add UART driver

In reply to Simon Glass

Add a driver for the Apollo Lake UART. It uses the standard ns16550 device but also sets up the input clock with LPSS and supports configuration via of-platdata.

---

Changes in v6:
- Drop code to handle !CONFIG_OF_TRANSLATE case
- Update comment to reference board_debug_uart_init() (its in a later patch)

Changes in v5: None
Changes in v4:
- Add an extra comment to apl_uart_init()
- Tidy up header guards
- apollolake -> Apollo Lake

Changes in v3:
- Use the LPSS code from a separate file

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile            |   1 +
 arch/x86/cpu/apollolake/uart.c              | 133 ++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/uart.h |  20 +++
 3 files changed, 154 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/uart.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/uart.h
arch/x86/cpu/apollolake/Makefile +1 -0
index 5e136b6515..fdda748ea3 100644
@@ -3,3 +3,4 @@
 # Copyright 2019 Google LLC
 
 obj-y += pmc.o
+obj-y += uart.o
arch/x86/cpu/apollolake/uart.c new file +133 -0

133 lines not on this page · raw message

arch/x86/include/asm/arch-apollolake/uart.h new file +20 -0
new file mode 100644
index 0000000000..d4fffe6525
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2019 Google LLC
+ */
+
+#ifndef _ASM_ARCH_UART_H
+#define _ASM_ARCH_UART_H
+
+/**
+ * apl_uart_init() - Set up the APL UART device and clock
+ *
+ * This enables the PCI device, sets up the MMIO region and turns on the clock
+ * using LPSS.
+ *
+ * The UART won't actually work unless the GPIO settings are correct and the
+ * signals actually exit the SoC. See board_debug_uart_init() for that.
+ */
+int apl_uart_init(pci_dev_t bdf, ulong base);
+
+#endif
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#197 lore raw

PATCH v6 85/102 x86: apl: Add UART driver

Quoted 21 lines · Simon Glass

Add a driver for the Apollo Lake UART. It uses the standard ns16550 device but also sets up the input clock with LPSS and supports configuration via of-platdata.

---

Changes in v6:
- Drop code to handle !CONFIG_OF_TRANSLATE case
- Update comment to reference board_debug_uart_init() (its in a later patch)

Changes in v5: None
Changes in v4:
- Add an extra comment to apl_uart_init()
- Tidy up header guards
- apollolake -> Apollo Lake

Changes in v3:
- Use the LPSS code from a separate file

Quoted 9 lines

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile            |   1 +
 arch/x86/cpu/apollolake/uart.c              | 133 ++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/uart.h |  20 +++
 3 files changed, 154 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/uart.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/uart.h
#198 lore raw

PATCH v6 85/102 x86: apl: Add UART driver

Quoted 33 lines · Bin Meng
Quoted 21 lines · Simon Glass

Add a driver for the Apollo Lake UART. It uses the standard ns16550 device but also sets up the input clock with LPSS and supports configuration via of-platdata.

---

Changes in v6:
- Drop code to handle !CONFIG_OF_TRANSLATE case
- Update comment to reference board_debug_uart_init() (its in a later patch)

Changes in v5: None
Changes in v4:
- Add an extra comment to apl_uart_init()
- Tidy up header guards
- apollolake -> Apollo Lake

Changes in v3:
- Use the LPSS code from a separate file

Quoted 9 lines

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile            |   1 +
 arch/x86/cpu/apollolake/uart.c              | 133 ++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/uart.h |  20 +++
 3 files changed, 154 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/uart.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/uart.h
Quoted 1 line

applied to u-boot-x86/next, thanks!

#199 lore raw

PATCH v6 86/102 x86: apl: Add pinctrl driver

In reply to Simon Glass

Add a driver for the Apollo Lake pinctrl. This mostly makes use of the common Intel pinctrl support.

---

Changes in v6: None
Changes in v5: None
Changes in v4:
- Allow pinctrl nodes to have subnodes (i.e. GPIO nodes)
- Drop GPIO_NUM_PAD_CFG_REGS
- Switch over to use pinctrl for pad init/config
- Tidy up the header file a little
- apollolake -> Apollo Lake

Changes in v3:
- Add various minor tidy-ups
- Fix mixed case in GPIO defines
- Rework how pads configuration is defined in TPL and SPL
- Use the IRQ uclass instead of ITSS

Changes in v2: None

 arch/x86/include/asm/arch-apollolake/gpio.h | 490 ++++++++++++++++++++
 drivers/pinctrl/intel/Kconfig               |   8 +
 drivers/pinctrl/intel/Makefile              |   1 +
 drivers/pinctrl/intel/pinctrl_apl.c         | 192 ++++++++
 4 files changed, 691 insertions(+)
 create mode 100644 arch/x86/include/asm/arch-apollolake/gpio.h
 create mode 100644 drivers/pinctrl/intel/pinctrl_apl.c
arch/x86/include/asm/arch-apollolake/gpio.h new file +490 -0
new file mode 100644
index 0000000000..f33025d7c5
@@ -0,0 +1,490 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Definitions for the GPIO subsystem on Apollolake
+ *
+ * Copyright (C) 2015 - 2017 Intel Corp.
+ * (Written by Alexandru Gagniuc <[email protected]> for Intel Corp.)
+ *
+ * Placed in a separate file since some of these definitions can be used from
+ * assembly code
+ *
+ * Taken from gpio_apl.h in coreboot
+ */
+
+#ifndef _ASM_ARCH_GPIO_H_
+#define _ASM_ARCH_GPIO_H_
+
+/* Port ids */
+#if IS_ENABLED(CONFIG_SOC_INTEL_GLK)
+#define PID_GPIO_AUDIO	0xC9
+#define PID_GPIO_SCC	0xC8
+#else
+#define PID_GPIO_SW	0xC0
+#define PID_GPIO_S	0xC2
+#define PID_GPIO_W	0xC7
+#endif
+#define PID_GPIO_NW	0xC4
+#define PID_GPIO_N	0xC5
+#define PID_ITSS	0xD0
+#define PID_RTC		0xD1
+
+/*
+ * Miscellaneous Configuration register(MISCCFG). These are community-specific
+ * registers and are meant to house miscellaneous configuration fields per
+ * community. There are 8 GPIO groups: GPP_0 -> GPP_8 (Group 3 is absent)
+ */
+#define GPIO_MISCCFG		0x10 /* Miscellaneous Configuration offset */
+#define  GPIO_GPE_SW_31_0	0 /* SOUTHWEST GPIO#  0 ~ 31 belong to GROUP0 */
+#define  GPIO_GPE_SW_63_32	1 /* SOUTHWEST GPIO# 32 ~ 42 belong to GROUP1 */
+#define  GPIO_GPE_W_31_0	2 /* WEST      GPIO#  0 ~ 25 belong to GROUP2 */
+#define  GPIO_GPE_NW_31_0	4 /* NORTHWEST GPIO#  0 ~ 17 belong to GROUP4 */
+#define  GPIO_GPE_NW_63_32	5 /* NORTHWEST GPIO# 32 ~ 63 belong to GROUP5 */
+#define  GPIO_GPE_NW_95_64	6 /* NORTHWEST GPIO# 64 ~ 76 belong to GROUP6 */
+#define  GPIO_GPE_N_31_0	7 /* NORTH     GPIO#  0 ~ 31 belong to GROUP7 */
+#define  GPIO_GPE_N_63_32	8 /* NORTH     GPIO# 32 ~ 61 belong to GROUP8 */
+
+#define GPIO_MAX_NUM_PER_GROUP	32
+
+/*
+ * Host Software Pad Ownership Register.
+ * The pins in the community are divided into 3 groups:
+ * GPIO 0 ~ 31, GPIO 32 ~ 63, GPIO 64 ~ 95
+ */
+#define HOSTSW_OWN_REG_0		0x80
+
+#define PAD_CFG_BASE			0x500
+
+#define GPI_INT_STS_0			0x100
+#define GPI_INT_EN_0			0x110
+
+#define GPI_SMI_STS_0			0x140
+#define GPI_SMI_EN_0			0x150
+
+#define NUM_N_PADS			(PAD_N(SVID0_CLK) + 1)
+#define NUM_NW_PADS			(PAD_NW(GPIO_123) + 1)
+#define NUM_W_PADS			(PAD_W(SUSPWRDNACK) + 1)
+#define NUM_SW_PADS			(PAD_SW(LPC_FRAMEB) + 1)
+
+#define NUM_N_GPI_REGS	\
+	(ALIGN(NUM_N_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP)
+
+#define NUM_NW_GPI_REGS	\
+	(ALIGN(NUM_NW_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP)
+
+#define NUM_W_GPI_REGS	\
+	(ALIGN(NUM_W_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP)
+
+#define NUM_SW_GPI_REGS	\
+	(ALIGN(NUM_SW_PADS, GPIO_MAX_NUM_PER_GROUP) / GPIO_MAX_NUM_PER_GROUP)
+
+/*
+ * Total number of GPI status registers across all GPIO communities in the SOC
+ */
+#define NUM_GPI_STATUS_REGS		(NUM_N_GPI_REGS + NUM_NW_GPI_REGS \
+					+ NUM_W_GPI_REGS + NUM_SW_GPI_REGS)
+
+/* North community pads */
+#define GPIO_0				0
+#define GPIO_1				1
+#define GPIO_2				2
+#define GPIO_3				3
+#define GPIO_4				4
+#define GPIO_5				5
+#define GPIO_6				6
+#define GPIO_7				7
+#define GPIO_8				8
+#define GPIO_9				9
+#define GPIO_10				10
+#define GPIO_11				11
+#define GPIO_12				12
+#define GPIO_13				13
+#define GPIO_14				14
+#define GPIO_15				15
+#define GPIO_16				16
+#define GPIO_17				17
+#define GPIO_18				18
+#define GPIO_19				19
+#define GPIO_20				20
+#define GPIO_21				21
+#define GPIO_22				22
+#define GPIO_23				23
+#define GPIO_24				24
+#define GPIO_25				25
+#define GPIO_26				26
+#define GPIO_27				27
+#define GPIO_28				28
+#define GPIO_29				29
+#define GPIO_30				30
+#define GPIO_31				31
+#define GPIO_32				32
+#define GPIO_33				33
+#define GPIO_34				34
+#define GPIO_35				35
+#define GPIO_36				36
+#define GPIO_37				37
+#define GPIO_38				38
+#define GPIO_39				39
+#define GPIO_40				40
+#define GPIO_41				41
+#define GPIO_42				42
+#define GPIO_43				43
+#define GPIO_44				44
+#define GPIO_45				45
+#define GPIO_46				46
+#define GPIO_47				47
+#define GPIO_48				48
+#define GPIO_49				49
+#define GPIO_62				50
+#define GPIO_63				51
+#define GPIO_64				52
+#define GPIO_65				53
+#define GPIO_66				54
+#define GPIO_67				55
+#define GPIO_68				56
+#define GPIO_69				57
+#define GPIO_70				58
+#define GPIO_71				59
+#define GPIO_72				60
+#define GPIO_73				61
+#define JTAG_TCK			62
+#define JTAG_TRST_B			63
+#define JTAG_TMS			64
+#define JTAG_TDI			65
+#define JTAG_CX_PMODE			66
+#define JTAG_CX_PREQ_B			67
+#define JTAGX				68
+#define JTAG_CX_PRDY_B			69
+#define JTAG_TDO			70
+#define CNV_BRI_DT			71
+#define CNV_BRI_RSP			72
+#define CNV_RGI_DT			73
+#define CNV_RGI_RSP			74
+#define SVID0_ALERT_B			75
+#define SVID0_DATA			76
+#define SVID0_CLK			77
+
+/* Northwest community pads */
+#define GPIO_187			78
+#define GPIO_188			79
+#define GPIO_189			80
+#define GPIO_190			81
+#define GPIO_191			82
+#define GPIO_192			83
+#define GPIO_193			84
+#define GPIO_194			85
+#define GPIO_195			86
+#define GPIO_196			87
+#define GPIO_197			88
+#define GPIO_198			89
+#define GPIO_199			90
+#define GPIO_200			91
+#define GPIO_201			92
+#define GPIO_202			93
+#define GPIO_203			94
+#define GPIO_204			95
+#define PMC_SPI_FS0			96
+#define PMC_SPI_FS1			97
+#define PMC_SPI_FS2			98
+#define PMC_SPI_RXD			99
+#define PMC_SPI_TXD			100
+#define PMC_SPI_CLK			101
+#define PMIC_PWRGOOD			102
+#define PMIC_RESET_B			103
+#define GPIO_213			104
+#define GPIO_214			105
+#define GPIO_215			106
+#define PMIC_THERMTRIP_B		107
+#define PMIC_STDBY			108
+#define PROCHOT_B			109
+#define PMIC_I2C_SCL			110
+#define PMIC_I2C_SDA			111
+#define GPIO_74				112
+#define GPIO_75				113
+#define GPIO_76				114
+#define GPIO_77				115
+#define GPIO_78				116
+#define GPIO_79				117
+#define GPIO_80				118
+#define GPIO_81				119
+#define GPIO_82				120
+#define GPIO_83				121
+#define GPIO_84				122
+#define GPIO_85				123
+#define GPIO_86				124
+#define GPIO_87				125
+#define GPIO_88				126
+#define GPIO_89				127
+#define GPIO_90				128
+#define GPIO_91				129
+#define GPIO_92				130
+#define GPIO_97				131
+#define GPIO_98				132
+#define GPIO_99				133
+#define GPIO_100			134
+#define GPIO_101			135
+#define GPIO_102			136
+#define GPIO_103			137
+#define FST_SPI_CLK_FB			138
+#define GPIO_104			139
+#define GPIO_105			140
+#define GPIO_106			141
+#define GPIO_109			142
+#define GPIO_110			143
+#define GPIO_111			144
+#define GPIO_112			145
+#define GPIO_113			146
+#define GPIO_116			147
+#define GPIO_117			148
+#define GPIO_118			149
+#define GPIO_119			150
+#define GPIO_120			151
+#define GPIO_121			152
+#define GPIO_122			153
+#define GPIO_123			154
+
+/* West community pads */
+#define GPIO_124			155
+#define GPIO_125			156
+#define GPIO_126			157
+#define GPIO_127			158
+#define GPIO_128			159
+#define GPIO_129			160
+#define GPIO_130			161
+#define GPIO_131			162
+#define GPIO_132			163
+#define GPIO_133			164
+#define GPIO_134			165
+#define GPIO_135			166
+#define GPIO_136			167
+#define GPIO_137			168
+#define GPIO_138			169
+#define GPIO_139			170
+#define GPIO_146			171
+#define GPIO_147			172
+#define GPIO_148			173
+#define GPIO_149			174
+#define GPIO_150			175
+#define GPIO_151			176
+#define GPIO_152			177
+#define GPIO_153			178
+#define GPIO_154			179
+#define GPIO_155			180
+#define GPIO_209			181
+#define GPIO_210			182
+#define GPIO_211			183
+#define GPIO_212			184
+#define OSC_CLK_OUT_0			185
+#define OSC_CLK_OUT_1			186
+#define OSC_CLK_OUT_2			187
+#define OSC_CLK_OUT_3			188
+#define OSC_CLK_OUT_4			189
+#define PMU_AC_PRESENT			190
+#define PMU_BATLOW_B			191
+#define PMU_PLTRST_B			192
+#define PMU_PWRBTN_B			193
+#define PMU_RESETBUTTON_B		194
+#define PMU_SLP_S0_B			195
+#define PMU_SLP_S3_B			196
+#define PMU_SLP_S4_B			197
+#define PMU_SUSCLK			198
+#define PMU_WAKE_B			199
+#define SUS_STAT_B			200
+#define SUSPWRDNACK			201
+
+/* Southwest community pads */
+#define GPIO_205			202
+#define GPIO_206			203
+#define GPIO_207			204
+#define GPIO_208			205
+#define GPIO_156			206
+#define GPIO_157			207
+#define GPIO_158			208
+#define GPIO_159			209
+#define GPIO_160			210
+#define GPIO_161			211
+#define GPIO_162			212
+#define GPIO_163			213
+#define GPIO_164			214
+#define GPIO_165			215
+#define GPIO_166			216
+#define GPIO_167			217
+#define GPIO_168			218
+#define GPIO_169			219
+#define GPIO_170			220
+#define GPIO_171			221
+#define GPIO_172			222
+#define GPIO_179			223
+#define GPIO_173			224
+#define GPIO_174			225
+#define GPIO_175			226
+#define GPIO_176			227
+#define GPIO_177			228
+#define GPIO_178			229
+#define GPIO_186			230
+#define GPIO_182			231
+#define GPIO_183			232
+#define SMB_ALERTB			233
+#define SMB_CLK				234
+#define SMB_DATA			235
+#define LPC_ILB_SERIRQ			236
+#define LPC_CLKOUT0			237
+#define LPC_CLKOUT1			238
+#define LPC_AD0				239
+#define LPC_AD1				240
+#define LPC_AD2				241
+#define LPC_AD3				242
+#define LPC_CLKRUNB			243
+#define LPC_FRAMEB			244
+
+/* PERST_0 not defined */
+#define GPIO_PRT0_UDEF			0xFF
+
+#define TOTAL_PADS			245
+#define N_OFFSET			GPIO_0
+#define NW_OFFSET			GPIO_187
+#define W_OFFSET			GPIO_124
+#define SW_OFFSET			GPIO_205
+
+/* Macros for translating a global pad offset to a local offset */
+#define PAD_N(pad)			(pad - N_OFFSET)
+#define PAD_NW(pad)			(pad - NW_OFFSET)
+#define PAD_W(pad)			(pad - W_OFFSET)
+#define PAD_SW(pad)			(pad - SW_OFFSET)
+
+/* Linux names of the GPIO devices */
+#define GPIO_COMM_N_NAME		"INT3452:00"
+#define GPIO_COMM_NW_NAME		"INT3452:01"
+#define GPIO_COMM_W_NAME		"INT3452:02"
+#define GPIO_COMM_SW_NAME		"INT3452:03"
+
+/* Following is used in gpio asl */
+#define GPIO_COMM_NAME			"INT3452"
+#define GPIO_COMM_0_DESC	\
+	"General Purpose Input/Output (GPIO) Controller - North"
+#define GPIO_COMM_1_DESC	\
+	"General Purpose Input/Output (GPIO) Controller - Northwest"
+#define GPIO_COMM_2_DESC	\
+	"General Purpose Input/Output (GPIO) Controller - West"
+#define GPIO_COMM_3_DESC	\
+	"General Purpose Input/Output (GPIO) Controller - Southwest"
+
+#define GPIO_COMM0_PID			PID_GPIO_N
+#define GPIO_COMM1_PID			PID_GPIO_NW
+#define GPIO_COMM2_PID			PID_GPIO_W
+#define GPIO_COMM3_PID			PID_GPIO_SW
+
+/*
+ * IOxAPIC IRQs for the GPIOs, overlap is expected as we encourage to use
+ * shared IRQ instead of direct IRQ, in case of overlapping, we can easily
+ * program one of the overlap to shared IRQ to avoid the conflict.
+ */
+
+/* NorthWest community pads */
+#define PMIC_I2C_SDA_IRQ		0x32
+#define GPIO_74_IRQ			0x33
+#define GPIO_75_IRQ			0x34
+#define GPIO_76_IRQ			0x35
+#define GPIO_77_IRQ			0x36
+#define GPIO_78_IRQ			0x37
+#define GPIO_79_IRQ			0x38
+#define GPIO_80_IRQ			0x39
+#define GPIO_81_IRQ			0x3A
+#define GPIO_82_IRQ			0x3B
+#define GPIO_83_IRQ			0x3C
+#define GPIO_84_IRQ			0x3D
+#define GPIO_85_IRQ			0x3E
+#define GPIO_86_IRQ			0x3F
+#define GPIO_87_IRQ			0x40
+#define GPIO_88_IRQ			0x41
+#define GPIO_89_IRQ			0x42
+#define GPIO_90_IRQ			0x43
+#define GPIO_91_IRQ			0x44
+#define GPIO_97_IRQ			0x49
+#define GPIO_98_IRQ			0x4A
+#define GPIO_99_IRQ			0x4B
+#define GPIO_100_IRQ			0x4C
+#define GPIO_101_IRQ			0x4D
+#define GPIO_102_IRQ			0x4E
+#define GPIO_103_IRQ			0x4F
+#define GPIO_104_IRQ			0x50
+#define GPIO_105_IRQ			0x51
+#define GPIO_106_IRQ			0x52
+#define GPIO_109_IRQ			0x54
+#define GPIO_110_IRQ			0x55
+#define GPIO_111_IRQ			0x56
+#define GPIO_112_IRQ			0x57
+#define GPIO_113_IRQ			0x58
+#define GPIO_116_IRQ			0x5B
+#define GPIO_117_IRQ			0x5C
+#define GPIO_118_IRQ			0x5D
+#define GPIO_119_IRQ			0x5E
+#define GPIO_120_IRQ			0x5F
+#define GPIO_121_IRQ			0x60
+#define GPIO_122_IRQ			0x61
+#define GPIO_123_IRQ			0x62
+
+/* North community pads */
+#define GPIO_0_IRQ			0x63
+#define GPIO_1_IRQ			0x64
+#define GPIO_2_IRQ			0x65
+#define GPIO_3_IRQ			0x66
+#define GPIO_4_IRQ			0x67
+#define GPIO_5_IRQ			0x68
+#define GPIO_6_IRQ			0x69
+#define GPIO_7_IRQ			0x6A
+#define GPIO_8_IRQ			0x6B
+#define GPIO_9_IRQ			0x6C
+#define GPIO_10_IRQ			0x6D
+#define GPIO_11_IRQ			0x6E
+#define GPIO_12_IRQ			0x6F
+#define GPIO_13_IRQ			0x70
+#define GPIO_14_IRQ			0x71
+#define GPIO_15_IRQ			0x72
+#define GPIO_16_IRQ			0x73
+#define GPIO_17_IRQ			0x74
+#define GPIO_18_IRQ			0x75
+#define GPIO_19_IRQ			0x76
+#define GPIO_20_IRQ			0x77
+#define GPIO_21_IRQ			0x32
+#define GPIO_22_IRQ			0x33
+#define GPIO_23_IRQ			0x34
+#define GPIO_24_IRQ			0x35
+#define GPIO_25_IRQ			0x36
+#define GPIO_26_IRQ			0x37
+#define GPIO_27_IRQ			0x38
+#define GPIO_28_IRQ			num_reset_vals0x39
+#define GPIO_29_IRQ			0x3A
+#define GPIO_30_IRQ			0x3B
+#define GPIO_31_IRQ			0x3C
+#define GPIO_32_IRQ			0x3D
+#define GPIO_33_IRQ			0x3E
+#define GPIO_34_IRQ			0x3F
+#define GPIO_35_IRQ			0x40
+#define GPIO_36_IRQ			0x41
+#define GPIO_37_IRQ			0x42
+#define GPIO_38_IRQ			0x43
+#define GPIO_39_IRQ			0x44
+#define GPIO_40_IRQ			0x45
+#define GPIO_41_IRQ			0x46
+#define GPIO_42_IRQ			0x47
+#define GPIO_43_IRQ			0x48
+#define GPIO_44_IRQ			0x49
+#define GPIO_45_IRQ			0x4A
+#define GPIO_46_IRQ			0x4B
+#define GPIO_47_IRQ			0x4C
+#define GPIO_48_IRQ			0x4D
+#define GPIO_49_IRQ			0x4E
+#define GPIO_62_IRQ			0x5B
+#define GPIO_63_IRQ			0x5C
+#define GPIO_64_IRQ			0x5D
+#define GPIO_65_IRQ			0x5E
+#define GPIO_66_IRQ			0x5F
+#define GPIO_67_IRQ			0x60
+#define GPIO_68_IRQ			0x61
+#define GPIO_69_IRQ			0x62
+#define GPIO_70_IRQ			0x63
+#define GPIO_71_IRQ			0x64
+#define GPIO_72_IRQ			0x65
+#define GPIO_73_IRQ			0x66
+
+#endif /* _ASM_ARCH_GPIO_H_ */
drivers/pinctrl/intel/Kconfig +8 -0
index c01c6244d9..974be13d97 100644
@@ -13,4 +13,12 @@ config INTEL_PINCTRL_PADCFG_PADTOL
 config INTEL_PINCTRL_IOSTANDBY
 	def_bool y
 
+config PINCTRL_INTEL_APL
+	bool "Support Intel Apollo Lake (APL)"
+	help
+	  Add support for Intel Apollo Lake pin-control and pin-mux settings.
+	  These are mostly read from the device tree, with the early-pads
+	  property in the host bridge and the pads property in the fsp-s
+	  subnode of the host bridge.
+
 endif
drivers/pinctrl/intel/Makefile +1 -0
index bc1aad2c06..3aed8e9663 100644
@@ -3,3 +3,4 @@
 # Copyright 2019 Google LLC
 
 obj-y += pinctrl.o
+obj-$(CONFIG_PINCTRL_INTEL_APL) += pinctrl_apl.o
drivers/pinctrl/intel/pinctrl_apl.c new file +192 -0

192 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#200 lore raw

PATCH v6 86/102 x86: apl: Add pinctrl driver

Hi Simon,

Quoted 8 lines · Simon Glass

Add a driver for the Apollo Lake pinctrl. This mostly makes use of the common Intel pinctrl support.

---

Changes in v6: None

It looks the comment in v5 was not addressed. See
https://lists.denx.de/pipermail/u-boot/2019-December/392375.html

Quoted 16 lines

Changes in v5: None
Changes in v4:
- Allow pinctrl nodes to have subnodes (i.e. GPIO nodes)
- Drop GPIO_NUM_PAD_CFG_REGS
- Switch over to use pinctrl for pad init/config
- Tidy up the header file a little
- apollolake -> Apollo Lake

Changes in v3:
- Add various minor tidy-ups
- Fix mixed case in GPIO defines
- Rework how pads configuration is defined in TPL and SPL
- Use the IRQ uclass instead of ITSS

Changes in v2: None

Quoted 8 lines
 arch/x86/include/asm/arch-apollolake/gpio.h | 490 ++++++++++++++++++++
 drivers/pinctrl/intel/Kconfig               |   8 +
 drivers/pinctrl/intel/Makefile              |   1 +
 drivers/pinctrl/intel/pinctrl_apl.c         | 192 ++++++++
 4 files changed, 691 insertions(+)
 create mode 100644 arch/x86/include/asm/arch-apollolake/gpio.h
 create mode 100644 drivers/pinctrl/intel/pinctrl_apl.c

Regards,
Bin

#201 lore raw

PATCH v6 87/102 i2c: designware: Add Apollo Lake support

In reply to Simon Glass

For Apollo Lake we need to take the I2C bus controller out of reset before using this. Add this functionality to the driver.

---

Changes in v6:
- Add .driver_data in the designware_pci_supported array
- Add a comment about VANILLA
- Move lpss_reset_release() to this commit

Changes in v5:
- Drop unrelated change metioned by Heiko

Changes in v4:
- apollolake -> Apollo Lake

Changes in v3:
- Add a weak function to avoid errors on other platforms

Changes in v2: None

 drivers/i2c/designware_i2c_pci.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/i2c/designware_i2c_pci.c +25 -0
index bb1f809af3..a3586371dc 100644
@@ -8,8 +8,14 @@
 #include <common.h>
 #include <dm.h>
 #include <spl.h>
+#include <asm/lpss.h>
 #include "designware_i2c.h"
 
+enum {
+	VANILLA		= 0,	/* standard I2C with no tweaks */
+	INTEL_APL,		/* Apollo Lake I2C */
+};
+
 /* BayTrail HCNT/LCNT/SDA hold time */
 static struct dw_scl_sda_cfg byt_config = {
 	.ss_hcnt = 0x200,
@@ -19,6 +25,9 @@ static struct dw_scl_sda_cfg byt_config = {
 	.sda_hold = 0x6,
 };
 
+/* Have a weak function for now - possibly should be a new uclass */
+__weak void lpss_reset_release(void *regs);
+
 static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev)
 {
 	struct dw_i2c *priv = dev_get_priv(dev);
@@ -59,6 +68,15 @@ static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev)
 
 static int designware_i2c_pci_probe(struct udevice *dev)
 {
+	struct dw_i2c *priv = dev_get_priv(dev);
+
+	if (dev_get_driver_data(dev) == INTEL_APL) {
+		/* Ensure controller is in D0 state */
+		lpss_set_power_state(dev, STATE_D0);
+
+		lpss_reset_release(priv->regs);
+	}
+
 	return designware_i2c_probe(dev);
 }
 
@@ -88,6 +106,7 @@ static int designware_i2c_pci_bind(struct udevice *dev)
 
 static const struct udevice_id designware_i2c_pci_ids[] = {
 	{ .compatible = "snps,designware-i2c-pci" },
+	{ .compatible = "intel,apl-i2c", INTEL_APL },
 	{ }
 };
 
@@ -113,6 +132,12 @@ static struct pci_device_id designware_pci_supported[] = {
 	{ PCI_VDEVICE(INTEL, 0x0f45) },
 	{ PCI_VDEVICE(INTEL, 0x0f46) },
 	{ PCI_VDEVICE(INTEL, 0x0f47) },
+	{ PCI_VDEVICE(INTEL, 0x5aac), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5aae), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5ab0), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5ab2), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5ab4), .driver_data = INTEL_APL },
+	{ PCI_VDEVICE(INTEL, 0x5ab6), .driver_data = INTEL_APL },
 	{},
 };
 
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#202 lore raw

PATCH v6 88/102 x86: apl: Add systemagent driver

In reply to Simon Glass

This driver handles communication with the systemagent which needs to be told when U-Boot has completed its init.

---

Changes in v6: None
Changes in v5: None
Changes in v4:
- Add a comment for enable_bios_reset_cpl()
- Tidy up header guards
- use GENMASK() for VTBAR_MASK

Changes in v3: None
Changes in v2: None

 arch/x86/cpu/apollolake/Makefile              |  2 +
 arch/x86/cpu/apollolake/systemagent.c         | 19 ++++++++++
 .../include/asm/arch-apollolake/systemagent.h | 37 +++++++++++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/systemagent.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/systemagent.h
arch/x86/cpu/apollolake/Makefile +2 -0
index fdda748ea3..3a8c2f66a3 100644
@@ -2,5 +2,7 @@
 #
 # Copyright 2019 Google LLC
 
+obj-$(CONFIG_SPL_BUILD) += systemagent.o
+
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/systemagent.c new file +19 -0
new file mode 100644
index 0000000000..3a41b329c3
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2017 Intel Corporation.
+ * Take from coreboot project file of the same name
+ */
+
+#include <common.h>
+#include <asm/intel_regs.h>
+#include <asm/io.h>
+#include <asm/arch/systemagent.h>
+
+void enable_bios_reset_cpl(void)
+{
+	/*
+	 * Set bits 0+1 of BIOS_RESET_CPL to indicate to the CPU
+	 * that BIOS has initialised memory and power management
+	 */
+	setbits_8(MCHBAR_REG(BIOS_RESET_CPL), 3);
+}
arch/x86/include/asm/arch-apollolake/systemagent.h new file +37 -0
new file mode 100644
index 0000000000..206d8903fa
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2017 Intel Corporation.
+ * Take from coreboot project file of the same name
+ */
+
+#ifndef _ASM_ARCH_SYSTEMAGENT_H
+#define _ASM_ARCH_SYSTEMAGENT_H
+
+/* Device 0:0.0 PCI configuration space */
+#define MCHBAR		0x48
+
+/* RAPL Package Power Limit register under MCHBAR */
+#define PUNIT_THERMAL_DEVICE_IRQ		0x700C
+#define PUINT_THERMAL_DEVICE_IRQ_VEC_NUMBER	0x18
+#define PUINT_THERMAL_DEVICE_IRQ_LOCK		0x80000000
+#define BIOS_RESET_CPL		0x7078
+#define   PCODE_INIT_DONE	BIT(8)
+#define MCHBAR_RAPL_PPL		0x70A8
+#define CORE_DISABLE_MASK	0x7168
+#define CAPID0_A		0xE4
+#define   VTD_DISABLE		BIT(23)
+#define DEFVTBAR		0x6c80
+#define GFXVTBAR		0x6c88
+#define   VTBAR_ENABLED		0x01
+#define VTBAR_MASK		GENMASK_ULL(39, 12)
+#define VTBAR_SIZE		0x1000
+
+/**
+ * enable_bios_reset_cpl() - Tell the system agent that memory/power are ready
+ *
+ * This should be called when U-Boot has set up the memory and power
+ * management.
+ */
+void enable_bios_reset_cpl(void);
+
+#endif
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#203 lore raw

PATCH v6 88/102 x86: apl: Add systemagent driver

Hi Simon,

Quoted 50 lines · Simon Glass

This driver handles communication with the systemagent which needs to be told when U-Boot has completed its init.

---

Changes in v6: None
Changes in v5: None
Changes in v4:
- Add a comment for enable_bios_reset_cpl()
- Tidy up header guards
- use GENMASK() for VTBAR_MASK

Changes in v3: None
Changes in v2: None

 arch/x86/cpu/apollolake/Makefile              |  2 +
 arch/x86/cpu/apollolake/systemagent.c         | 19 ++++++++++
 .../include/asm/arch-apollolake/systemagent.h | 37 +++++++++++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/systemagent.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/systemagent.h
arch/x86/cpu/apollolake/Makefile +2 -0
index fdda748ea3..3a8c2f66a3 100644
@@ -2,5 +2,7 @@
 #
 # Copyright 2019 Google LLC
 
+obj-$(CONFIG_SPL_BUILD) += systemagent.o
+
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/systemagent.c new file +7 -0
new file mode 100644
index 0000000000..3a41b329c3
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2017 Intel Corporation.
+ * Take from coreboot project file of the same name
+ */
+
+#include <common.h>

arch/x86/cpu/apollolake/systemagent.c line 17

Quoted 10 lines
arch/x86/cpu/apollolake/systemagent.c new file +10 -0
+#include <asm/intel_regs.h>
+#include <asm/io.h>
+#include <asm/arch/systemagent.h>
+
+void enable_bios_reset_cpl(void)
+{
+       /*
+        * Set bits 0+1 of BIOS_RESET_CPL to indicate to the CPU
+        * that BIOS has initialised memory and power management
+        */

Could you put more comments here, like what you mentioned in the v5 comments:

"The FSP-S does not do it. If we leave this as zero then I believe the power-aware interrupts don't work in Linux, and cpu 0 always gets the interrupt."

arch/x86/cpu/apollolake/systemagent.c line 19

Quoted 2 lines
arch/x86/cpu/apollolake/systemagent.c new file +2 -0
+       setbits_8(MCHBAR_REG(BIOS_RESET_CPL), 3);
+}

[snip]

Regards,
Bin

#204 lore raw

PATCH v6 89/102 x86: apl: Add hostbridge driver

In reply to Simon Glass

This driver models the hostbridge as a northbridge. It simply sets up the graphics BAR. It supports of-platdata.

---

Changes in v6:
- Fix comments for struct apl_hostbridge_platdata

Changes in v5: None
Changes in v4:
- Avoid needing to know internals of pinctrl in this driver
- Move code to pinctrl driver
- Switch over to use pinctrl for pad init/config

Changes in v3:
- Move pad programming into the hostbridge to reduce TPL device-tree size
- Use pci_get_devfn()

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile     |   1 +
 arch/x86/cpu/apollolake/hostbridge.c | 179 +++++++++++++++++++++++++++
 2 files changed, 180 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/hostbridge.c
arch/x86/cpu/apollolake/Makefile +1 -0
index 3a8c2f66a3..4d3c08f84e 100644
@@ -4,5 +4,6 @@
 
 obj-$(CONFIG_SPL_BUILD) += systemagent.o
 
+obj-y += hostbridge.o
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/hostbridge.c new file +179 -0

179 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#205 lore raw

PATCH v6 89/102 x86: apl: Add hostbridge driver

Quoted 20 lines · Simon Glass

This driver models the hostbridge as a northbridge. It simply sets up the graphics BAR. It supports of-platdata.

---

Changes in v6:
- Fix comments for struct apl_hostbridge_platdata

Changes in v5: None
Changes in v4:
- Avoid needing to know internals of pinctrl in this driver
- Move code to pinctrl driver
- Switch over to use pinctrl for pad init/config

Changes in v3:
- Move pad programming into the hostbridge to reduce TPL device-tree size
- Use pci_get_devfn()

Quoted 7 lines

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile     |   1 +
 arch/x86/cpu/apollolake/hostbridge.c | 179 +++++++++++++++++++++++++++
 2 files changed, 180 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/hostbridge.c
#206 lore raw

PATCH v6 90/102 x86: apl: Add ITSS driver

In reply to Simon Glass

This driver models some sort of interrupt thingy but there are so many abreviations that I cannot find out what it stands for. Possibly something to do with interrupts.

---

Changes in v6: None
Changes in v5: None
Changes in v4:
- Tidy up header guards

Changes in v3:
- Add snapshot/restore for IRQs
- Use the IRQ uclass instead of ITSS

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile            |   1 +
 arch/x86/cpu/apollolake/itss.c              | 214 ++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/itss.h |  43 ++++
 3 files changed, 258 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/itss.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/itss.h
arch/x86/cpu/apollolake/Makefile +1 -0
index 4d3c08f84e..2d78368150 100644
@@ -5,5 +5,6 @@
 obj-$(CONFIG_SPL_BUILD) += systemagent.o
 
 obj-y += hostbridge.o
+obj-y += itss.o
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/itss.c new file +214 -0

214 lines not on this page · raw message

arch/x86/include/asm/arch-apollolake/itss.h new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#207 lore raw

PATCH v6 91/102 x86: apl: Add LPC driver

In reply to Simon Glass

This driver the LPC and provides a few functions to set up LPC features. These should probably use ioctls() or perhaps, better, have specific uclass methods.

---

Changes in v6:
- Drop init of ComB since it is not used
- Drop lpc_configure_pads() and probe() function, add a comment about pads

Changes in v5: None
Changes in v4:
- Add comments for exported functions
- Tidy up header guards
- Use 'Apollo Lake'
- Use BIT() macro a bit more
- Use tabs instead of spaces

Changes in v3:
- Drop unused code in lpc_configure_pads()
- Fix value of LPC_BC_LE

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile           |   1 +
 arch/x86/cpu/apollolake/lpc.c              | 122 +++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/lpc.h |  82 ++++++++++++++
 3 files changed, 205 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/lpc.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/lpc.h
arch/x86/cpu/apollolake/Makefile +1 -0
index 2d78368150..31045a03c1 100644
@@ -6,5 +6,6 @@ obj-$(CONFIG_SPL_BUILD) += systemagent.o
 
 obj-y += hostbridge.o
 obj-y += itss.o
+obj-y += lpc.o
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/lpc.c new file +122 -0

122 lines not on this page · raw message

arch/x86/include/asm/arch-apollolake/lpc.h new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#208 lore raw

PATCH v6 91/102 x86: apl: Add LPC driver

Quoted 24 lines · Simon Glass

This driver the LPC and provides a few functions to set up LPC features. These should probably use ioctls() or perhaps, better, have specific uclass methods.

---

Changes in v6:
- Drop init of ComB since it is not used
- Drop lpc_configure_pads() and probe() function, add a comment about pads

Changes in v5: None
Changes in v4:
- Add comments for exported functions
- Tidy up header guards
- Use 'Apollo Lake'
- Use BIT() macro a bit more
- Use tabs instead of spaces

Changes in v3:
- Drop unused code in lpc_configure_pads()
- Fix value of LPC_BC_LE

Quoted 9 lines

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile           |   1 +
 arch/x86/cpu/apollolake/lpc.c              | 122 +++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/lpc.h |  82 ++++++++++++++
 3 files changed, 205 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/lpc.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/lpc.h
#209 lore raw

PATCH v6 92/102 x86: apl: Add PCH driver

In reply to Simon Glass

Add a driver for the Apollo Lake Platform Controller Hub. It does not have any functionality and is just a placeholder for now.

---

Changes in v6: None
Changes in v5: None
Changes in v4:
- Tidy up header guards
- Update SPI flash protection only in SPL
- apollolake -> Apollo Lake

Changes in v3: None
Changes in v2:
- Drop probe() function
- Implement set_spi_protect()

 arch/x86/cpu/apollolake/Makefile           |  1 +
 arch/x86/cpu/apollolake/pch.c              | 36 ++++++++++++++++++++++
 arch/x86/include/asm/arch-apollolake/pch.h |  9 ++++++
 3 files changed, 46 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/pch.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/pch.h
arch/x86/cpu/apollolake/Makefile +1 -0
index 31045a03c1..36eefcbad7 100644
@@ -7,5 +7,6 @@ obj-$(CONFIG_SPL_BUILD) += systemagent.o
 obj-y += hostbridge.o
 obj-y += itss.o
 obj-y += lpc.o
+obj-y += pch.o
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/pch.c new file +36 -0
new file mode 100644
index 0000000000..1a5a985221
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Google LLC
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <pch.h>
+#include <spl.h>
+#include <asm/lpc_common.h>
+
+#define BIOS_CTRL	0xdc
+
+static int apl_set_spi_protect(struct udevice *dev, bool protect)
+{
+	if (spl_phase() == PHASE_SPL)
+		return lpc_set_spi_protect(dev, BIOS_CTRL, protect);
+
+	return 0;
+}
+
+static const struct pch_ops apl_pch_ops = {
+	.set_spi_protect = apl_set_spi_protect,
+};
+
+static const struct udevice_id apl_pch_ids[] = {
+	{ .compatible = "intel,apl-pch" },
+	{ }
+};
+
+U_BOOT_DRIVER(apl_pch) = {
+	.name		= "apl_pch",
+	.id		= UCLASS_PCH,
+	.of_match	= apl_pch_ids,
+	.ops		= &apl_pch_ops,
+};
arch/x86/include/asm/arch-apollolake/pch.h new file +9 -0
new file mode 100644
index 0000000000..bf3e1670d2
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2019 Google LLC
+ */
+
+#ifndef _ASM_ARCH_PCH_H
+#define _ASM_ARCH_PCH_H
+
+#endif /* _ASM_ARCH_PCH_H */
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#210 lore raw

PATCH v6 93/102 x86: apl: Add PUNIT driver

In reply to Simon Glass

Add a driver for the Apollo Lake P-unit (power unit). It is modelled as a syscon driver since it only needs to be probed.

---

Changes in v6:
- Drop Glacier Lake code
- Drop platform data and pre-PCI code, since DM PCI is available in SPL

Changes in v5: None
Changes in v4:
- Name this P-Unit instead of power unit, in the commit message
- apollolake -> Apollo Lake

Changes in v3:
- Use pci_get_devfn()

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |  3 +
 arch/x86/cpu/apollolake/punit.c  | 94 ++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/punit.c
arch/x86/cpu/apollolake/Makefile +3 -0
index 36eefcbad7..875d454157 100644
@@ -3,6 +3,9 @@
 # Copyright 2019 Google LLC
 
 obj-$(CONFIG_SPL_BUILD) += systemagent.o
+ifndef CONFIG_TPL_BUILD
+obj-y += punit.o
+endif
 
 obj-y += hostbridge.o
 obj-y += itss.o
arch/x86/cpu/apollolake/punit.c new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#211 lore raw

PATCH v6 93/102 x86: apl: Add PUNIT driver

Quoted 19 lines · Simon Glass

Add a driver for the Apollo Lake P-unit (power unit). It is modelled as a syscon driver since it only needs to be probed.

---

Changes in v6:
- Drop Glacier Lake code
- Drop platform data and pre-PCI code, since DM PCI is available in SPL

Changes in v5: None
Changes in v4:
- Name this P-Unit instead of power unit, in the commit message
- apollolake -> Apollo Lake

Changes in v3:
- Use pci_get_devfn()

Quoted 7 lines

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |  3 +
 arch/x86/cpu/apollolake/punit.c  | 94 ++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/punit.c
#212 lore raw

PATCH v6 94/102 spl: Add methods to find the position/size of next phase

In reply to Simon Glass

Binman supports writing the position and size of U-Boot proper and SPL into the previous phase of U-Boot. This allows the next phase to be easily located and loaded.

Add functions to return these useful values, along with symbols to allow TPL to load SPL.

---

Changes in v6:
- Add new patch with methods to find the position/size of next SPL phase

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 common/spl/spl.c | 20 ++++++++++++++++++++
 include/spl.h    | 21 ++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
common/spl/spl.c +20 -0
index d51dbe9942..c1fce62b91 100644
@@ -42,6 +42,12 @@ u32 *boot_params_ptr = NULL;
 
 /* See spl.h for information about this */
 binman_sym_declare(ulong, u_boot_any, image_pos);
+binman_sym_declare(ulong, u_boot_any, size);
+
+#ifdef CONFIG_TPL
+binman_sym_declare(ulong, spl, image_pos);
+binman_sym_declare(ulong, spl, size);
+#endif
 
 /* Define board data structure */
 static bd_t bdata __attribute__ ((section(".data")));
@@ -120,6 +126,20 @@ void spl_fixup_fdt(void)
 #endif
 }
 
+ulong spl_get_image_pos(void)
+{
+	return spl_phase() == PHASE_TPL ?
+		binman_sym(ulong, spl, image_pos) :
+		binman_sym(ulong, u_boot_any, image_pos);
+}
+
+ulong spl_get_image_size(void)
+{
+	return spl_phase() == PHASE_TPL ?
+		binman_sym(ulong, spl, size) :
+		binman_sym(ulong, u_boot_any, size);
+}
+
 /*
  * Weak default function for board specific cleanup/preparation before
  * Linux boot. Some boards/platforms might not need it, so just provide
include/spl.h +20 -1
index 08ffddac29..02aa1ff85d 100644
@@ -169,10 +169,29 @@ struct spl_load_info {
  * We need to know the position of U-Boot in memory so we can jump to it. We
  * allow any U-Boot binary to be used (u-boot.bin, u-boot-nodtb.bin,
  * u-boot.img), hence the '_any'. These is no checking here that the correct
- * image is found. For * example if u-boot.img is used we don't check that
+ * image is found. For example if u-boot.img is used we don't check that
  * spl_parse_image_header() can parse a valid header.
+ *
+ * Similarly for SPL, so that TPL can jump to SPL.
  */
 binman_sym_extern(ulong, u_boot_any, image_pos);
+binman_sym_extern(ulong, u_boot_any, size);
+binman_sym_extern(ulong, spl, image_pos);
+binman_sym_extern(ulong, spl, size);
+
+/**
+ * spl_get_image_pos() - get the image position of the next phase
+ *
+ * This returns the image position to use to load the next phase of U-Boot
+ */
+ulong spl_get_image_pos(void);
+
+/**
+ * spl_get_image_size() - get the size of the next phase
+ *
+ * This returns the size to use to load the next phase of U-Boot
+ */
+ulong spl_get_image_size(void);
 
 /**
  * spl_load_simple_fit_skip_processing() - Hook to allow skipping the FIT
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#213 lore raw

PATCH v6 94/102 spl: Add methods to find the position/size of next phase

Quoted 14 lines · Simon Glass

Binman supports writing the position and size of U-Boot proper and SPL into the previous phase of U-Boot. This allows the next phase to be easily located and loaded.

Add functions to return these useful values, along with symbols to allow TPL to load SPL.

---

Changes in v6:
- Add new patch with methods to find the position/size of next SPL phase

Quoted 9 lines

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 common/spl/spl.c | 20 ++++++++++++++++++++
 include/spl.h    | 21 ++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)
#214 lore raw

PATCH v6 95/102 x86: apl: Add SPL loaders

In reply to Simon Glass

Add loaders for SPL and TPL so that the next stage can be loaded from memory-mapped SPI or, failing that, the Fast SPI driver.

---

Changes in v6:
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option
- Move image pos/size access functions and symbols to generic SPL code

Changes in v5:
- Add L2 cache flush functoin
- Drop SAFETY_MARGIN

Changes in v4: None
Changes in v3:
- Add a driver for APL SPI for TPL (using of-platdata)
- Support TPL without CONFIG_TPL_SPI_SUPPORT
- Support bootstage timing

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |   2 +
 arch/x86/cpu/apollolake/spl.c    | 178 +++++++++++++++++++++++++++++++
 2 files changed, 180 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/spl.c
arch/x86/cpu/apollolake/Makefile +2 -0
index 875d454157..1fde400d77 100644
@@ -2,7 +2,9 @@
 #
 # Copyright 2019 Google LLC
 
+obj-$(CONFIG_SPL_BUILD) += spl.o
 obj-$(CONFIG_SPL_BUILD) += systemagent.o
+
 ifndef CONFIG_TPL_BUILD
 obj-y += punit.o
 endif
arch/x86/cpu/apollolake/spl.c new file +178 -0

178 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#215 lore raw

PATCH v6 95/102 x86: apl: Add SPL loaders

Quoted 22 lines · Simon Glass

Add loaders for SPL and TPL so that the next stage can be loaded from memory-mapped SPI or, failing that, the Fast SPI driver.

---

Changes in v6:
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option
- Move image pos/size access functions and symbols to generic SPL code

Changes in v5:
- Add L2 cache flush functoin
- Drop SAFETY_MARGIN

Changes in v4: None
Changes in v3:
- Add a driver for APL SPI for TPL (using of-platdata)
- Support TPL without CONFIG_TPL_SPI_SUPPORT
- Support bootstage timing

Quoted 7 lines

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |   2 +
 arch/x86/cpu/apollolake/spl.c    | 178 +++++++++++++++++++++++++++++++
 2 files changed, 180 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/spl.c
#216 lore raw

PATCH v6 96/102 x86: apl: Add a CPU driver

In reply to Simon Glass

Add a bare-bones CPU driver so that CPUs can be probed.

---

Changes in v6:
- Drop unnecessary priv struct and probe method
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option

Changes in v5:
- Add L2 cache flush function
- Drop SAFETY_MARGIN

Changes in v4:
- Change apollolake to apl
- Tidy up header guards

Changes in v3:
- Add two more defines for the CPU driver
- Expand comments for BOOT_FROM_FAST_SPI_FLASH

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile           |  2 ++
 arch/x86/cpu/apollolake/cpu.c              | 41 ++++++++++++++++++++++
 arch/x86/cpu/apollolake/cpu_common.c       | 17 +++++++++
 arch/x86/include/asm/arch-apollolake/cpu.h | 20 +++++++++++
 arch/x86/include/asm/msr-index.h           |  1 +
 5 files changed, 81 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/cpu.c
 create mode 100644 arch/x86/cpu/apollolake/cpu_common.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/cpu.h
arch/x86/cpu/apollolake/Makefile +2 -0
index 1fde400d77..37e42092ec 100644
@@ -4,8 +4,10 @@
 
 obj-$(CONFIG_SPL_BUILD) += spl.o
 obj-$(CONFIG_SPL_BUILD) += systemagent.o
+obj-y += cpu_common.o
 
 ifndef CONFIG_TPL_BUILD
+obj-y += cpu.o
 obj-y += punit.o
 endif
 
arch/x86/cpu/apollolake/cpu.c new file +41 -0

41 lines not on this page · raw message

arch/x86/cpu/apollolake/cpu_common.c new file +17 -0
new file mode 100644
index 0000000000..ba6bda37bc
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Google LLC
+ */
+
+#include <common.h>
+#include <asm/cpu_common.h>
+#include <asm/msr.h>
+
+void cpu_flush_l1d_to_l2(void)
+{
+	struct msr_t msr;
+
+	msr = msr_read(MSR_POWER_MISC);
+	msr.lo |= FLUSH_DL1_L2;
+	msr_write(MSR_POWER_MISC, msr);
+}
arch/x86/include/asm/arch-apollolake/cpu.h new file +20 -0
new file mode 100644
index 0000000000..5e906c5e7d
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2019 Google LLC
+ */
+
+#ifndef _ASM_ARCH_CPU_H
+#define _ASM_ARCH_CPU_H
+
+/* Common Timer Copy (CTC) frequency - 19.2MHz */
+#define CTC_FREQ		19200000
+
+#define MAX_PCIE_PORTS		6
+#define CLKREQ_DISABLED		0xf
+
+#ifndef __ASSEMBLY__
+/* Flush L1D to L2 */
+void cpu_flush_l1d_to_l2(void);
+#endif
+
+#endif /* _ASM_ARCH_CPU_H */
arch/x86/include/asm/msr-index.h +1 -0
index 79a9369de1..246c14f815 100644
@@ -70,6 +70,7 @@
 #define MSR_IA32_BBL_CR_CTL		0x00000119
 #define MSR_IA32_BBL_CR_CTL3		0x0000011e
 #define MSR_POWER_MISC			0x00000120
+#define  FLUSH_DL1_L2			(1 << 8)
 #define ENABLE_ULFM_AUTOCM_MASK		(1 << 2)
 #define ENABLE_INDP_AUTOCM_MASK		(1 << 3)
 
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#217 lore raw

PATCH v6 96/102 x86: apl: Add a CPU driver

Quoted 24 lines · Simon Glass

Add a bare-bones CPU driver so that CPUs can be probed.

---

Changes in v6:
- Drop unnecessary priv struct and probe method
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option

Changes in v5:
- Add L2 cache flush function
- Drop SAFETY_MARGIN

Changes in v4:
- Change apollolake to apl
- Tidy up header guards

Changes in v3:
- Add two more defines for the CPU driver
- Expand comments for BOOT_FROM_FAST_SPI_FLASH

Changes in v2: None

Quoted 10 lines
 arch/x86/cpu/apollolake/Makefile           |  2 ++
 arch/x86/cpu/apollolake/cpu.c              | 41 ++++++++++++++++++++++
 arch/x86/cpu/apollolake/cpu_common.c       | 17 +++++++++
 arch/x86/include/asm/arch-apollolake/cpu.h | 20 +++++++++++
 arch/x86/include/asm/msr-index.h           |  1 +
 5 files changed, 81 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/cpu.c
 create mode 100644 arch/x86/cpu/apollolake/cpu_common.c
 create mode 100644 arch/x86/include/asm/arch-apollolake/cpu.h
#218 lore raw

PATCH v6 97/102 x86: apl: Add SPL/TPL init

In reply to Simon Glass

Add code to init the system both in TPL and SPL. Each phase has its own procedure.

---

Changes in v6:
- Change comment to apl_hostbridge_early_init_pinctrl, not apl_gpio_early_init
- Change commented-out enable_rtc_upper_bank() call to a TODO
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option
- Rename init_for_uart() to board_debug_uart_init()
- Use SZ_4G instead of open-coded shift

Changes in v5: None
Changes in v4:
- Switch over to use pinctrl for pad init/config

Changes in v3:
- Adjust fast_spi_cache_bios_region() to avoid using SPI driver
- Drop calls to x86_cpu_init_f(), x86_cpu_reinit_f()
- Fix build error when debug UART is disabled
- Init the p2sb before the northbridge since the latter so it can use GPIOs
- Move location of fast_spi.h header file
- Shorten log_msg_ret() calls since the function name is always printed
- Support TPL without CONFIG_TPL_SPI_SUPPORT (reduces code size)

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile  |   1 +
 arch/x86/cpu/apollolake/cpu_spl.c | 271 ++++++++++++++++++++++++++++++
 2 files changed, 272 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/cpu_spl.c
arch/x86/cpu/apollolake/Makefile +1 -0
index 37e42092ec..edde122f75 100644
@@ -2,6 +2,7 @@
 #
 # Copyright 2019 Google LLC
 
+obj-$(CONFIG_SPL_BUILD) += cpu_spl.o
 obj-$(CONFIG_SPL_BUILD) += spl.o
 obj-$(CONFIG_SPL_BUILD) += systemagent.o
 obj-y += cpu_common.o
arch/x86/cpu/apollolake/cpu_spl.c new file +271 -0

271 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#219 lore raw

PATCH v6 97/102 x86: apl: Add SPL/TPL init

Quoted 27 lines · Simon Glass

Add code to init the system both in TPL and SPL. Each phase has its own procedure.

---

Changes in v6:
- Change comment to apl_hostbridge_early_init_pinctrl, not apl_gpio_early_init
- Change commented-out enable_rtc_upper_bank() call to a TODO
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option
- Rename init_for_uart() to board_debug_uart_init()
- Use SZ_4G instead of open-coded shift

Changes in v5: None
Changes in v4:
- Switch over to use pinctrl for pad init/config

Changes in v3:
- Adjust fast_spi_cache_bios_region() to avoid using SPI driver
- Drop calls to x86_cpu_init_f(), x86_cpu_reinit_f()
- Fix build error when debug UART is disabled
- Init the p2sb before the northbridge since the latter so it can use GPIOs
- Move location of fast_spi.h header file
- Shorten log_msg_ret() calls since the function name is always printed
- Support TPL without CONFIG_TPL_SPI_SUPPORT (reduces code size)

Quoted 7 lines

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile  |   1 +
 arch/x86/cpu/apollolake/cpu_spl.c | 271 ++++++++++++++++++++++++++++++
 2 files changed, 272 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/cpu_spl.c
#220 lore raw

PATCH v6 98/102 x86: apl: Add P2SB driver

In reply to Simon Glass

Adds a driver for the Apollo Lake Primary-to-sideband bus. This supports various child devices. It supposed both device tree and of-platdata.

---

Changes in v6: None
Changes in v5: None
Changes in v4:
- Detect zero mmio address
- Use BIT() macro bit more
- apollolake -> Apollo Lake

Changes in v3:
- Use pci_get_devfn()

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |   1 +
 arch/x86/cpu/apollolake/p2sb.c   | 167 +++++++++++++++++++++++++++++++
 2 files changed, 168 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/p2sb.c
arch/x86/cpu/apollolake/Makefile +1 -0
index edde122f75..dc6df15dab 100644
@@ -15,6 +15,7 @@ endif
 obj-y += hostbridge.o
 obj-y += itss.o
 obj-y += lpc.o
+obj-y += p2sb.o
 obj-y += pch.o
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/p2sb.c new file +167 -0

167 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#221 lore raw

PATCH v6 98/102 x86: apl: Add P2SB driver

Hi Simon,

Quoted 81 lines · Simon Glass

Adds a driver for the Apollo Lake Primary-to-sideband bus. This supports various child devices. It supposed both device tree and of-platdata.

---

Changes in v6: None
Changes in v5: None
Changes in v4:
- Detect zero mmio address
- Use BIT() macro bit more
- apollolake -> Apollo Lake

Changes in v3:
- Use pci_get_devfn()

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |   1 +
 arch/x86/cpu/apollolake/p2sb.c   | 167 +++++++++++++++++++++++++++++++
 2 files changed, 168 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/p2sb.c
arch/x86/cpu/apollolake/Makefile +1 -0
index edde122f75..dc6df15dab 100644
@@ -15,6 +15,7 @@ endif
 obj-y += hostbridge.o
 obj-y += itss.o
 obj-y += lpc.o
+obj-y += p2sb.o
 obj-y += pch.o
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/p2sb.c new file +39 -0
new file mode 100644
index 0000000000..0a5deaf4a0
@@ -0,0 +1,167 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Primary-to-Sideband Bridge
+ *
+ * Copyright 2019 Google LLC
+ */
+
+#define LOG_CATEGORY UCLASS_P2SB
+
+#include <common.h>
+#include <dm.h>
+#include <dt-structs.h>
+#include <p2sb.h>
+#include <spl.h>
+#include <asm/pci.h>
+
+struct p2sb_platdata {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+       struct dtd_intel_apl_p2sb dtplat;
+#endif
+       ulong mmio_base;
+       pci_dev_t bdf;
+};
+
+/* PCI config space registers */
+#define HPTC_OFFSET            0x60
+#define HPTC_ADDR_ENABLE_BIT   BIT(7)
+
+/* High Performance Event Timer Configuration */
+#define P2SB_HPTC                              0x60
+#define P2SB_HPTC_ADDRESS_ENABLE               BIT(7)
+
+/*
+ * ADDRESS_SELECT            ENCODING_RANGE
+ *      0                 0xfed0 0000 - 0xfed0 03ff
+ *      1                 0xfed0 1000 - 0xfed0 13ff
+ *      2                 0xfed0 2000 - 0xfed0 23ff
+ *      3                 0xfed0 3000 - 0xfed0 33ff
+ */

arch/x86/cpu/apollolake/p2sb.c line 49

Quoted 10 lines
arch/x86/cpu/apollolake/p2sb.c new file +10 -0
+#define P2SB_HPTC_ADDRESS_SELECT_0             (0 << 0)
+#define P2SB_HPTC_ADDRESS_SELECT_1             (1 << 0)
+#define P2SB_HPTC_ADDRESS_SELECT_2             (2 << 0)
+#define P2SB_HPTC_ADDRESS_SELECT_3             (3 << 0)
+
+/*
+ * apl_p2sb_early_init() - Enable decoding for HPET range
+ *
+ * This is needed for FspMemoryInit to store and retrieve a global data
+ * pointer

Looks my comment in the v5 series was not addressed.
See https://lists.denx.de/pipermail/u-boot/2019-December/392392.html

Quoted 109 lines
arch/x86/cpu/apollolake/p2sb.c new file +109 -0
+ *
+ * @dev: P2SB device
+ * @return 0 if OK, -ve on error
+ */
+static int apl_p2sb_early_init(struct udevice *dev)
+{
+       struct p2sb_platdata *plat = dev_get_platdata(dev);
+       pci_dev_t pdev = plat->bdf;
+
+       /*
+        * Enable decoding for HPET memory address range.
+        * HPTC_OFFSET(0x60) bit 7, when set the P2SB will decode
+        * the High Performance Timer memory address range
+        * selected by bits 1:0
+        */
+       pci_x86_write_config(pdev, HPTC_OFFSET, HPTC_ADDR_ENABLE_BIT,
+                            PCI_SIZE_8);
+
+       /* Enable PCR Base address in PCH */
+       pci_x86_write_config(pdev, PCI_BASE_ADDRESS_0, plat->mmio_base,
+                            PCI_SIZE_32);
+       pci_x86_write_config(pdev, PCI_BASE_ADDRESS_1, 0, PCI_SIZE_32);
+
+       /* Enable P2SB MSE */
+       pci_x86_write_config(pdev, PCI_COMMAND, PCI_COMMAND_MASTER |
+                            PCI_COMMAND_MEMORY, PCI_SIZE_8);
+
+       return 0;
+}
+
+static int apl_p2sb_spl_init(struct udevice *dev)
+{
+       /* Enable decoding for HPET. Needed for FSP global pointer storage */
+       dm_pci_write_config(dev, P2SB_HPTC, P2SB_HPTC_ADDRESS_SELECT_0 |
+                           P2SB_HPTC_ADDRESS_ENABLE, PCI_SIZE_8);
+
+       return 0;
+}
+
+int apl_p2sb_ofdata_to_platdata(struct udevice *dev)
+{
+       struct p2sb_uc_priv *upriv = dev_get_uclass_priv(dev);
+       struct p2sb_platdata *plat = dev_get_platdata(dev);
+
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+       int ret;
+
+       if (spl_phase() == PHASE_TPL) {
+               u32 base[2];
+
+               /* TPL sets up the initial BAR */
+               ret = dev_read_u32_array(dev, "early-regs", base,
+                                        ARRAY_SIZE(base));
+               if (ret)
+                       return log_msg_ret("Missing/short early-regs", ret);
+               plat->mmio_base = base[0];
+               plat->bdf = pci_get_devfn(dev);
+               if (plat->bdf < 0)
+                       return log_msg_ret("Cannot get p2sb PCI address",
+                                          plat->bdf);
+       } else {
+               plat->mmio_base = dev_read_addr_pci(dev);
+               /* Don't set BDF since it should not be used */
+               if (!plat->mmio_base || plat->mmio_base == FDT_ADDR_T_NONE)
+                       return -EINVAL;
+       }
+#else
+       plat->mmio_base = plat->dtplat.early_regs[0];
+       plat->bdf = pci_ofplat_get_devfn(plat->dtplat.reg[0]);
+#endif
+       upriv->mmio_base = plat->mmio_base;
+       debug("p2sb: mmio_base=%x\n", (uint)plat->mmio_base);
+
+       return 0;
+}
+
+static int apl_p2sb_probe(struct udevice *dev)
+{
+       if (spl_phase() == PHASE_TPL)
+               return apl_p2sb_early_init(dev);
+       else if (spl_phase() == PHASE_SPL)
+               return apl_p2sb_spl_init(dev);
+
+       return 0;
+}
+
+static int p2sb_child_post_bind(struct udevice *dev)
+{
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+       struct p2sb_child_platdata *pplat = dev_get_parent_platdata(dev);
+       int ret;
+       u32 pid;
+
+       ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid);
+       if (ret)
+               return ret;
+       pplat->pid = pid;
+#endif
+
+       return 0;
+}
+
+static const struct udevice_id apl_p2sb_ids[] = {
+       { .compatible = "intel,apl-p2sb" },
+       { }
+};
+
+U_BOOT_DRIVER(apl_p2sb_drv) = {
+       .name           = "intel_apl_p2sb",

arch/x86/cpu/apollolake/p2sb.c

Quoted 10 lines
arch/x86/cpu/apollolake/p2sb.c new file +9 -1
+       .id             = UCLASS_P2SB,
+       .of_match       = apl_p2sb_ids,
+       .probe          = apl_p2sb_probe,
+       .ofdata_to_platdata = apl_p2sb_ofdata_to_platdata,
+       .platdata_auto_alloc_size = sizeof(struct p2sb_platdata),
+       .per_child_platdata_auto_alloc_size =
+               sizeof(struct p2sb_child_platdata),
+       .child_post_bind = p2sb_child_post_bind,
+};
--

Regards,
Bin

#222 lore raw

PATCH v6 98/102 x86: apl: Add P2SB driver

Hi Bin,

Quoted 90 lines · Bin Meng

Hi Simon,

Quoted 86 lines · Simon Glass

Adds a driver for the Apollo Lake Primary-to-sideband bus. This supports various child devices. It supposed both device tree and of-platdata.

---

Changes in v6: None
Changes in v5: None
Changes in v4:
- Detect zero mmio address
- Use BIT() macro bit more
- apollolake -> Apollo Lake

Changes in v3:
- Use pci_get_devfn()

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |   1 +
 arch/x86/cpu/apollolake/p2sb.c   | 167 +++++++++++++++++++++++++++++++
 2 files changed, 168 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/p2sb.c
arch/x86/cpu/apollolake/Makefile +1 -0
index edde122f75..dc6df15dab 100644
@@ -15,6 +15,7 @@ endif
 obj-y += hostbridge.o
 obj-y += itss.o
 obj-y += lpc.o
+obj-y += p2sb.o
 obj-y += pch.o
 obj-y += pmc.o
 obj-y += uart.o
arch/x86/cpu/apollolake/p2sb.c new file +44 -0
new file mode 100644
index 0000000000..0a5deaf4a0
@@ -0,0 +1,167 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Primary-to-Sideband Bridge
+ *
+ * Copyright 2019 Google LLC
+ */
+
+#define LOG_CATEGORY UCLASS_P2SB
+
+#include <common.h>
+#include <dm.h>
+#include <dt-structs.h>
+#include <p2sb.h>
+#include <spl.h>
+#include <asm/pci.h>
+
+struct p2sb_platdata {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+       struct dtd_intel_apl_p2sb dtplat;
+#endif
+       ulong mmio_base;
+       pci_dev_t bdf;
+};
+
+/* PCI config space registers */
+#define HPTC_OFFSET            0x60
+#define HPTC_ADDR_ENABLE_BIT   BIT(7)
+
+/* High Performance Event Timer Configuration */
+#define P2SB_HPTC                              0x60
+#define P2SB_HPTC_ADDRESS_ENABLE               BIT(7)
+
+/*
+ * ADDRESS_SELECT            ENCODING_RANGE
+ *      0                 0xfed0 0000 - 0xfed0 03ff
+ *      1                 0xfed0 1000 - 0xfed0 13ff
+ *      2                 0xfed0 2000 - 0xfed0 23ff
+ *      3                 0xfed0 3000 - 0xfed0 33ff
+ */
+#define P2SB_HPTC_ADDRESS_SELECT_0             (0 << 0)
+#define P2SB_HPTC_ADDRESS_SELECT_1             (1 << 0)
+#define P2SB_HPTC_ADDRESS_SELECT_2             (2 << 0)
+#define P2SB_HPTC_ADDRESS_SELECT_3             (3 << 0)
+
Quoted 8 lines

arch/x86/cpu/apollolake/p2sb.c line 49

Quoted 5 lines
arch/x86/cpu/apollolake/p2sb.c new file +5 -0
+/*
+ * apl_p2sb_early_init() - Enable decoding for HPET range
+ *
+ * This is needed for FspMemoryInit to store and retrieve a global data
+ * pointer

Looks my comment in the v5 series was not addressed.
See https://lists.denx.de/pipermail/u-boot/2019-December/392392.html

OK. I am not really sure what the FSP is doing here, but it apparently does need HPET set up.

I'll update the comment to just say it is needed by FSP-M.

Regards,
Simon

#223 lore raw

PATCH v6 99/102 x86: apl: Add Kconfig and Makefile

In reply to Simon Glass

Add basic plumbing to allow Apollo Lake support to be used.

---

Changes in v6:
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option

Changes in v5:
- Enable SMP

Changes in v4:
- Enable HAVE_X86_FIT
- Enable INTEL_GPIO
- Switch over to use pinctrl for pad init/config
- Use existing VBT Kconfig option
- apollolake -> Apollo Lake

Changes in v3:
- Add MMC, video, USB configs
- Add an APL_SPI_FLASH_BOOT option to enable non-mmap boot
- Fix the incorrect value of CPU_ADDR_BITS

Changes in v2: None

 arch/x86/Kconfig                |  1 +
 arch/x86/cpu/Makefile           |  1 +
 arch/x86/cpu/apollolake/Kconfig | 96 +++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/Kconfig
arch/x86/Kconfig +1 -0
index 1d08cb24fb..89b93e5de2 100644
@@ -106,6 +106,7 @@ source "board/google/Kconfig"
 source "board/intel/Kconfig"
 
 # platform-specific options below
+source "arch/x86/cpu/apollolake/Kconfig"
 source "arch/x86/cpu/baytrail/Kconfig"
 source "arch/x86/cpu/braswell/Kconfig"
 source "arch/x86/cpu/broadwell/Kconfig"
arch/x86/cpu/Makefile +1 -0
index 0e90a38dc5..5b40838e60 100644
@@ -41,6 +41,7 @@ extra-y += call32.o
 endif
 
 obj-y += intel_common/
+obj-$(CONFIG_INTEL_APOLLOLAKE) += apollolake/
 obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/
 obj-$(CONFIG_INTEL_BRASWELL) += braswell/
 obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
arch/x86/cpu/apollolake/Kconfig new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#224 lore raw

PATCH v6 99/102 x86: apl: Add Kconfig and Makefile

Quoted 24 lines · Simon Glass

Add basic plumbing to allow Apollo Lake support to be used.

---

Changes in v6:
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option

Changes in v5:
- Enable SMP

Changes in v4:
- Enable HAVE_X86_FIT
- Enable INTEL_GPIO
- Switch over to use pinctrl for pad init/config
- Use existing VBT Kconfig option
- apollolake -> Apollo Lake

Changes in v3:
- Add MMC, video, USB configs
- Add an APL_SPI_FLASH_BOOT option to enable non-mmap boot
- Fix the incorrect value of CPU_ADDR_BITS

Quoted 8 lines

Changes in v2: None

 arch/x86/Kconfig                |  1 +
 arch/x86/cpu/Makefile           |  1 +
 arch/x86/cpu/apollolake/Kconfig | 96 +++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/Kconfig
#225 lore raw

PATCH v6 100/102 x86: apl: Add FSP structures

In reply to Simon Glass

These are mostly specific to a particular SoC. Add the definitions for Apollo Lake.

---

Changes in v6:
- Fix FSP-M and FSP-S in comments

Changes in v5: None
Changes in v4:
- apollolake -> Apollo Lake

Changes in v3:
- Add VBT signature
- Add structures for FSP-S also
- Drop struct fsp_usp_header as it is now in the API file

Changes in v2: None

 .../asm/arch-apollolake/fsp/fsp_configs.h     |  14 +
 .../asm/arch-apollolake/fsp/fsp_m_upd.h       | 123 ++++++++
 .../asm/arch-apollolake/fsp/fsp_s_upd.h       | 292 ++++++++++++++++++
 .../include/asm/arch-apollolake/fsp/fsp_vpd.h |  11 +
 4 files changed, 440 insertions(+)
 create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_configs.h
 create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_m_upd.h
 create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_s_upd.h
 create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_vpd.h
arch/x86/include/asm/arch-apollolake/fsp/fsp_configs.h new file +14 -0
new file mode 100644
index 0000000000..9185d94b2b
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: Intel */
+/*
+ * Copyright 2019 Google LLC
+ */
+
+#ifndef __FSP_CONFIGS_H__
+#define __FSP_CONFIGS_H__
+
+#define FSPT_UPD_SIGNATURE	0x545F4450554C5041	/* 'APLUPD_T' */
+#define FSPM_UPD_SIGNATURE	0x4D5F4450554C5041	/* 'APLUPD_M' */
+#define FSPS_UPD_SIGNATURE	0x535F4450554C5041	/* 'APLUPD_S' */
+#define VBT_SIGNATURE		0x54425624
+
+#endif
arch/x86/include/asm/arch-apollolake/fsp/fsp_m_upd.h new file +123 -0

123 lines not on this page · raw message

arch/x86/include/asm/arch-apollolake/fsp/fsp_s_upd.h new file +292 -0

292 lines not on this page · raw message

arch/x86/include/asm/arch-apollolake/fsp/fsp_vpd.h new file +11 -0
new file mode 100644
index 0000000000..b14f28b236
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: Intel */
+/*
+ * Copyright 2019 Google LLC
+ */
+
+#ifndef __FSP_VPD_H
+#define __FSP_VPD_H
+
+/* Nothing to declare here for FSP2 */
+
+#endif
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#226 lore raw

PATCH v6 100/102 x86: apl: Add FSP structures

Quoted 21 lines · Simon Glass

These are mostly specific to a particular SoC. Add the definitions for Apollo Lake.

---

Changes in v6:
- Fix FSP-M and FSP-S in comments

Changes in v5: None
Changes in v4:
- apollolake -> Apollo Lake

Changes in v3:
- Add VBT signature
- Add structures for FSP-S also
- Drop struct fsp_usp_header as it is now in the API file

Changes in v2: None

Quoted 10 lines
 .../asm/arch-apollolake/fsp/fsp_configs.h     |  14 +
 .../asm/arch-apollolake/fsp/fsp_m_upd.h       | 123 ++++++++
 .../asm/arch-apollolake/fsp/fsp_s_upd.h       | 292 ++++++++++++++++++
 .../include/asm/arch-apollolake/fsp/fsp_vpd.h |  11 +
 4 files changed, 440 insertions(+)
 create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_configs.h
 create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_m_upd.h
 create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_s_upd.h
 create mode 100644 arch/x86/include/asm/arch-apollolake/fsp/fsp_vpd.h
#227 lore raw

PATCH v6 101/102 x86: apl: Add FSP support

In reply to Simon Glass

The memory and silicon init parts of the FSP need support code to work. Add this for Apollo Lake.

---

Changes in v6:
- Drop mention of devicetree for VTD feature
- Drop mention of ramstage
- Fix various coding style problems
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option
- Use 'No SPI' instead of 'SPI2' as a debug message

Changes in v5:
- Allocate the FSP-S data instead of using the stack
- Rename APOLLOLAKE_USB2_PORT_MAX

Changes in v4:
- Adjust the comment for struct dw_i2c_speed_config
- Rename arch_fsp_s_preinit() to arch_fsps_preinit()
- Switch over to use pinctrl for pad init/config
- Tidy up mixed case in FSP code
- apollolake -> Apollo Lake

Changes in v3:
- Add bootstage timing for reading vbt
- Add fspm_done() hook to handle FSP-S wierdness (it breaks SPI flash)
- Don't allow BOOT_FROM_FAST_SPI_FLASH with FSP-S
- Set boot_loader_tolum_size to 0
- Use the IRQ uclass instead of ITSS

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |   6 +
 arch/x86/cpu/apollolake/fsp_m.c  | 210 ++++++++++
 arch/x86/cpu/apollolake/fsp_s.c  | 661 +++++++++++++++++++++++++++++++
 3 files changed, 877 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/fsp_m.c
 create mode 100644 arch/x86/cpu/apollolake/fsp_s.c
arch/x86/cpu/apollolake/Makefile +6 -0
index dc6df15dab..1760df54d8 100644
@@ -10,6 +10,12 @@ obj-y += cpu_common.o
 ifndef CONFIG_TPL_BUILD
 obj-y += cpu.o
 obj-y += punit.o
+ifdef CONFIG_SPL_BUILD
+obj-y += fsp_m.o
+endif
+endif
+ifndef CONFIG_SPL_BUILD
+obj-y += fsp_s.o
 endif
 
 obj-y += hostbridge.o
arch/x86/cpu/apollolake/fsp_m.c new file +210 -0

210 lines not on this page · raw message

arch/x86/cpu/apollolake/fsp_s.c new file +661 -0

661 lines not on this page · raw message

Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#228 lore raw

PATCH v6 101/102 x86: apl: Add FSP support

Quoted 32 lines · Simon Glass

The memory and silicon init parts of the FSP need support code to work. Add this for Apollo Lake.

---

Changes in v6:
- Drop mention of devicetree for VTD feature
- Drop mention of ramstage
- Fix various coding style problems
- Make BOOT_FROM_FAST_SPI_FLASH a Kconfig option
- Use 'No SPI' instead of 'SPI2' as a debug message

Changes in v5:
- Allocate the FSP-S data instead of using the stack
- Rename APOLLOLAKE_USB2_PORT_MAX

Changes in v4:
- Adjust the comment for struct dw_i2c_speed_config
- Rename arch_fsp_s_preinit() to arch_fsps_preinit()
- Switch over to use pinctrl for pad init/config
- Tidy up mixed case in FSP code
- apollolake -> Apollo Lake

Changes in v3:
- Add bootstage timing for reading vbt
- Add fspm_done() hook to handle FSP-S wierdness (it breaks SPI flash)
- Don't allow BOOT_FROM_FAST_SPI_FLASH with FSP-S
- Set boot_loader_tolum_size to 0
- Use the IRQ uclass instead of ITSS

Quoted 9 lines

Changes in v2: None

 arch/x86/cpu/apollolake/Makefile |   6 +
 arch/x86/cpu/apollolake/fsp_m.c  | 210 ++++++++++
 arch/x86/cpu/apollolake/fsp_s.c  | 661 +++++++++++++++++++++++++++++++
 3 files changed, 877 insertions(+)
 create mode 100644 arch/x86/cpu/apollolake/fsp_m.c
 create mode 100644 arch/x86/cpu/apollolake/fsp_s.c
#229 lore raw

PATCH v6 102/102 x86: Add chromebook_coral

In reply to Simon Glass

Add support for coral which is a range of Apollo Lake-based Chromebook released in 2017. This also includes reef released in 2016, since it is based on the same SoC.

---

Changes in v6:
- Add a comment about the need for board_run_command()
- Use generic gpio compatible string

Changes in v5:
- Add gpio-controller to GPIO nodes
- Comment out GPIOs in the fsp_s node since we don't use them yet
- Correct CPU ACPI IDs
- Use a define for ACPI base address

Changes in v4:
- Add u-boot,skip-auto-config-until-reloc property to PCI
- Drop duplicate commit 'Create a new sandbox_pci_read_bar() function'
- New GPIO driver binding
- Set up LPC pads early
- Switch over to use pinctrl for pad init/config
- Update documentation with more detailed memory map
- Use hyphen for device-tree properties
- apollolake -> Apollo Lake

Changes in v3:
- Ad FSP-S support
- Add CONFIG_TPL_X86_ASSUME_CPUID to reduce code size
- Add Chrome OS EC support
- Add a proper SPI node and make the SPI flash node a child
- Add bootstage support
- Add more documentation
- Add spi alias in device tree
- Disable the bootcommand since it does nothing useful on coral
- Don't enable SPI flash in TPL by default
- Drop CONFIG_SPL_NET_SUPPORT
- Drop patch '86: timer: Reduce timer code size in TPL on Intel CPUs'
- Drop patch 'dm: core: Don't include ofnode functions with of-platdata'
- Drop patch 'spi: sandbox: Add a test driver for sandbox SPI flash'
- Drop patch 'spl: Allow SPL/TPL to use of-platdata without libfdt'
- Drop patch 'x86: apollolake: Add definitions for the Intel Fast SPI interface'
- Drop patch 'x86: timer: Set up the timer in timer_early_get_count()'
- Enable video and USB3
- Reduce amount of early-pad data in TPL
- Tidy up the pad settings in the device tree
- Use a zero-based tsc timer

Changes in v2: None

 arch/x86/dts/Makefile                     |   1 +
 arch/x86/dts/chromebook_coral.dts         | 831 ++++++++++++++++++++++
 board/google/Kconfig                      |  15 +
 board/google/chromebook_coral/Kconfig     |  43 ++
 board/google/chromebook_coral/MAINTAINERS |   6 +
 board/google/chromebook_coral/Makefile    |   5 +
 board/google/chromebook_coral/coral.c     |  19 +
 configs/chromebook_coral_defconfig        | 102 +++
 doc/board/google/chromebook_coral.rst     | 241 +++++++
 include/configs/chromebook_coral.h        |  32 +
 10 files changed, 1295 insertions(+)
 create mode 100644 arch/x86/dts/chromebook_coral.dts
 create mode 100644 board/google/chromebook_coral/Kconfig
 create mode 100644 board/google/chromebook_coral/MAINTAINERS
 create mode 100644 board/google/chromebook_coral/Makefile
 create mode 100644 board/google/chromebook_coral/coral.c
 create mode 100644 configs/chromebook_coral_defconfig
 create mode 100644 doc/board/google/chromebook_coral.rst
 create mode 100644 include/configs/chromebook_coral.h
arch/x86/dts/Makefile +1 -0
index d4bdf62be6..be209aaaf8 100644
@@ -2,6 +2,7 @@
 
 dtb-y += bayleybay.dtb \
 	cherryhill.dtb \
+	chromebook_coral.dtb \
 	chromebook_link.dtb \
 	chromebox_panther.dtb \
 	chromebook_samus.dtb \
arch/x86/dts/chromebook_coral.dts new file +831 -0

831 lines not on this page · raw message

board/google/Kconfig +15 -0
index 679a0f1023..22c4be392f 100644
@@ -8,6 +8,20 @@ choice
 	prompt "Mainboard model"
 	optional
 
+config TARGET_CHROMEBOOK_CORAL
+	bool "Chromebook coral"
+	help
+	  This is a range of Intel-based laptops released in 2018. They use an
+	  Intel Apollo Lake SoC. The design supports WiFi, 4GB to 16GB of
+	  LPDDR4 1600MHz SDRAM, PCIe WiFi and Bluetooth, eMMC (typically 32GB),
+	  up two cameras (front-facing 720p and another 5MP option), USB SD
+	  reader, microphone and speakers. It also includes two USB 3 Type A and
+	  two Type C ports. The latter are used as power input and can also
+	  charge external devices as well as a 4K external display. There is a
+	  Chrome OS EC connected on LPC, a Cr50 secure chip from Google and
+	  various display options. OEMs products include Acer Chromebook 11
+	  (e.g. C732, CB11, CP311) and Lenovo Chromebook (100e, 300e, 500e).
+
 config TARGET_CHROMEBOOK_LINK
 	bool "Chromebook link"
 	help
@@ -62,6 +76,7 @@ config TARGET_CHROMEBOOK_SAMUS_TPL
 
 endchoice
 
+source "board/google/chromebook_coral/Kconfig"
 source "board/google/chromebook_link/Kconfig"
 source "board/google/chromebox_panther/Kconfig"
 source "board/google/chromebook_samus/Kconfig"
board/google/chromebook_coral/Kconfig new file +43 -0

43 lines not on this page · raw message

board/google/chromebook_coral/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..904227e2e2
@@ -0,0 +1,6 @@
+CHROMEBOOK_CORAL_BOARD
+M:	Simon Glass <[email protected]>
+S:	Maintained
+F:	board/google/chromebook_coral/
+F:	include/configs/chromebook_coral.h
+F:	configs/chromebook_coral_defconfig
board/google/chromebook_coral/Makefile new file +5 -0
new file mode 100644
index 0000000000..6a27ce3da1
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2019 Google LLC
+
+obj-y	+= coral.o
board/google/chromebook_coral/coral.c new file +19 -0
new file mode 100644
index 0000000000..4e34710b97
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 Google LLC
+ */
+
+#include <common.h>
+
+int arch_misc_init(void)
+{
+	return 0;
+}
+
+/* This function is needed if CONFIG_CMDLINE is not enabled */
+int board_run_command(const char *cmdline)
+{
+	printf("No command line\n");
+
+	return 0;
+}
configs/chromebook_coral_defconfig new file +102 -0

102 lines not on this page · raw message

doc/board/google/chromebook_coral.rst new file +241 -0

241 lines not on this page · raw message

include/configs/chromebook_coral.h new file +32 -0
new file mode 100644
index 0000000000..a63c3c9eea
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 Google LLC
+ */
+
+/*
+ * board/config.h - configuration options, board-specific
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_BOOTCOMMAND	\
+	"fatload mmc 1:c 1000000 syslinux/vmlinuz.A; zboot 1000000"
+
+#include <configs/x86-common.h>
+#include <configs/x86-chromebook.h>
+
+#undef CONFIG_STD_DEVICES_SETTINGS
+#define CONFIG_STD_DEVICES_SETTINGS     "stdin=usbkbd,i8042-kbd,serial\0" \
+					"stdout=vidconsole,serial\0" \
+					"stderr=vidconsole,serial\0"
+
+#define CONFIG_ENV_SECT_SIZE		0x1000
+#define CONFIG_ENV_OFFSET		0x003f8000
+
+#define CONFIG_TPL_TEXT_BASE		0xffff8000
+
+#define CONFIG_SYS_NS16550_MEM32
+#undef CONFIG_SYS_NS16550_PORT_MAPPED
+
+#endif	/* __CONFIG_H */
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
#230 lore raw

PATCH v6 102/102 x86: Add chromebook_coral

Hi Simon,

Quoted 52 lines · Simon Glass

Add support for coral which is a range of Apollo Lake-based Chromebook released in 2017. This also includes reef released in 2016, since it is based on the same SoC.

---

Changes in v6:
- Add a comment about the need for board_run_command()
- Use generic gpio compatible string

Changes in v5:
- Add gpio-controller to GPIO nodes
- Comment out GPIOs in the fsp_s node since we don't use them yet
- Correct CPU ACPI IDs
- Use a define for ACPI base address

Changes in v4:
- Add u-boot,skip-auto-config-until-reloc property to PCI
- Drop duplicate commit 'Create a new sandbox_pci_read_bar() function'
- New GPIO driver binding
- Set up LPC pads early
- Switch over to use pinctrl for pad init/config
- Update documentation with more detailed memory map
- Use hyphen for device-tree properties
- apollolake -> Apollo Lake

Changes in v3:
- Ad FSP-S support
- Add CONFIG_TPL_X86_ASSUME_CPUID to reduce code size
- Add Chrome OS EC support
- Add a proper SPI node and make the SPI flash node a child
- Add bootstage support
- Add more documentation
- Add spi alias in device tree
- Disable the bootcommand since it does nothing useful on coral
- Don't enable SPI flash in TPL by default
- Drop CONFIG_SPL_NET_SUPPORT
- Drop patch '86: timer: Reduce timer code size in TPL on Intel CPUs'
- Drop patch 'dm: core: Don't include ofnode functions with of-platdata'
- Drop patch 'spi: sandbox: Add a test driver for sandbox SPI flash'
- Drop patch 'spl: Allow SPL/TPL to use of-platdata without libfdt'
- Drop patch 'x86: apollolake: Add definitions for the Intel Fast SPI interface'
- Drop patch 'x86: timer: Set up the timer in timer_early_get_count()'
- Enable video and USB3
- Reduce amount of early-pad data in TPL
- Tidy up the pad settings in the device tree
- Use a zero-based tsc timer

Changes in v2: None

Quoted 9 lines
 arch/x86/dts/Makefile                     |   1 +
 arch/x86/dts/chromebook_coral.dts         | 831 ++++++++++++++++++++++
 board/google/Kconfig                      |  15 +
 board/google/chromebook_coral/Kconfig     |  43 ++
 board/google/chromebook_coral/MAINTAINERS |   6 +
 board/google/chromebook_coral/Makefile    |   5 +
 board/google/chromebook_coral/coral.c     |  19 +
 configs/chromebook_coral_defconfig        | 102 +++
 doc/board/google/chromebook_coral.rst     | 241 +++++++

This file needs to be added in doc/board/google/index.rst

Quoted 11 lines
 include/configs/chromebook_coral.h        |  32 +
 10 files changed, 1295 insertions(+)
 create mode 100644 arch/x86/dts/chromebook_coral.dts
 create mode 100644 board/google/chromebook_coral/Kconfig
 create mode 100644 board/google/chromebook_coral/MAINTAINERS
 create mode 100644 board/google/chromebook_coral/Makefile
 create mode 100644 board/google/chromebook_coral/coral.c
 create mode 100644 configs/chromebook_coral_defconfig
 create mode 100644 doc/board/google/chromebook_coral.rst
 create mode 100644 include/configs/chromebook_coral.h

Other than that,

Regards,
Bin

#231 lore raw

v6 cover x86: Add initial support for apollolake

In reply to Simon Glass

Hi Simon,

Quoted 9 lines · Simon Glass

Apollo Lake is an Intel SoC generation aimed at relatively low-end embedded systems. It was released in 2016 but has become more popular recently with some embedded boards using it.

This series adds support for Apollo Lake. As an example it adds an implementation of chromebook_coral (a large range of Chromebooks released in 2017).

Quoted 8 lines

The series provides enough support to boot to a prompt. with LCD display, storage, USB, EC and keyboard.

Since this is the first time U-Boot has used FSP2 there is quite a bit of refactoring needed.

This series is available at u-boot-dm/coral-working

I applied the first 85 patches in the v6 series to u-boot-x86/next, except the following 2 patches:

[v6,015/102] Revert "RFC: sandbox: net: Suppress the MAC-address warnings [v6,014/102] RFC: sandbox: net: Suppress the MAC-address warnings

I believe this needs to be handled by Joe?

The patches unfortunately break am335x_evm.

Azure logs:

       arm:  +   am335x_evm

+arm-linux-gnueabi-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region .sram'
+arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 8 bytes +make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2

GitLab logs:

       arm:  +   am335x_evm

+arm-linux-gnueabi-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region .sram'
+arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 76 bytes +make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2

Would you please take a look, and propose a fix so that I can squash into the one that breaks this board?
https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/37696

@Tom, not sure why Azure and GitLab reported different size overflowed? (8 vs 76). Is this caused by build directory path?

Regards,
Bin

#232 lore raw

v6 cover x86: Add initial support for apollolake

Quoted 49 lines · Bin Meng

Hi Simon,

Quoted 9 lines · Simon Glass

Apollo Lake is an Intel SoC generation aimed at relatively low-end embedded systems. It was released in 2016 but has become more popular recently with some embedded boards using it.

This series adds support for Apollo Lake. As an example it adds an implementation of chromebook_coral (a large range of Chromebooks released in 2017).

Quoted 8 lines

The series provides enough support to boot to a prompt. with LCD display, storage, USB, EC and keyboard.

Since this is the first time U-Boot has used FSP2 there is quite a bit of refactoring needed.

This series is available at u-boot-dm/coral-working

I applied the first 85 patches in the v6 series to u-boot-x86/next, except the following 2 patches:

[v6,015/102] Revert "RFC: sandbox: net: Suppress the MAC-address warnings [v6,014/102] RFC: sandbox: net: Suppress the MAC-address warnings

I believe this needs to be handled by Joe?

The patches unfortunately break am335x_evm.

Azure logs:

       arm:  +   am335x_evm

+arm-linux-gnueabi-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region .sram'

(quoted diff) +4 -0
+arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 8 bytes
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2

GitLab logs:

       arm:  +   am335x_evm

+arm-linux-gnueabi-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region .sram'

(quoted diff) +4 -0
+arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 76 bytes
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2
Quoted 6 lines

Would you please take a look, and propose a fix so that I can squash into the one that breaks this board?
https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/37696

@Tom, not sure why Azure and GitLab reported different size overflowed? (8 vs 76). Is this caused by build directory path?

Seems likely to be a path size overflow, yeah.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191208/10d24c53/attachment.sig>
#233 lore raw

v6 cover x86: Add initial support for apollolake

Hi,

Quoted 51 lines · Tom Rini
Quoted 49 lines · Bin Meng

Hi Simon,

Quoted 9 lines · Simon Glass

Apollo Lake is an Intel SoC generation aimed at relatively low-end embedded systems. It was released in 2016 but has become more popular recently with some embedded boards using it.

This series adds support for Apollo Lake. As an example it adds an implementation of chromebook_coral (a large range of Chromebooks released in 2017).

Quoted 8 lines

The series provides enough support to boot to a prompt. with LCD display, storage, USB, EC and keyboard.

Since this is the first time U-Boot has used FSP2 there is quite a bit of refactoring needed.

This series is available at u-boot-dm/coral-working

I applied the first 85 patches in the v6 series to u-boot-x86/next, except the following 2 patches:

[v6,015/102] Revert "RFC: sandbox: net: Suppress the MAC-address warnings [v6,014/102] RFC: sandbox: net: Suppress the MAC-address warnings

I believe this needs to be handled by Joe?

The patches unfortunately break am335x_evm.

Azure logs:

       arm:  +   am335x_evm

+arm-linux-gnueabi-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region .sram'

(quoted diff) +4 -0
+arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 8 bytes
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2

GitLab logs:

       arm:  +   am335x_evm

+arm-linux-gnueabi-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region .sram'

(quoted diff) +4 -0
+arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 76 bytes
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2
Quoted 8 lines
Quoted 6 lines

Would you please take a look, and propose a fix so that I can squash into the one that breaks this board?
https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/37696

@Tom, not sure why Azure and GitLab reported different size overflowed? (8 vs 76). Is this caused by build directory path?

Seems likely to be a path size overflow, yeah.

The use of BUG(), WARN_ON() and friends brings in __FILE__. I'll send a patch to help with that.

At least with gcc 7.3 it builds OK for me.

There are about 13KB of strings in SPL for this board.

I hate to say it, but it seems that the gcc rodata bug has returned. For example, it brings in the compat_name[] when building SPL, even though that is not actually used. I vaguely recall that this only happens when partial linking is used, but I cannot easily change U-Boot to use archives these days.

Regards,
SImon

#234 lore raw

v6 cover x86: Add initial support for apollolake

Quoted 68 lines · Simon Glass

Hi,

Quoted 51 lines · Tom Rini
Quoted 49 lines · Bin Meng

Hi Simon,

Quoted 9 lines · Simon Glass

Apollo Lake is an Intel SoC generation aimed at relatively low-end embedded systems. It was released in 2016 but has become more popular recently with some embedded boards using it.

This series adds support for Apollo Lake. As an example it adds an implementation of chromebook_coral (a large range of Chromebooks released in 2017).

Quoted 8 lines

The series provides enough support to boot to a prompt. with LCD display, storage, USB, EC and keyboard.

Since this is the first time U-Boot has used FSP2 there is quite a bit of refactoring needed.

This series is available at u-boot-dm/coral-working

I applied the first 85 patches in the v6 series to u-boot-x86/next, except the following 2 patches:

[v6,015/102] Revert "RFC: sandbox: net: Suppress the MAC-address warnings [v6,014/102] RFC: sandbox: net: Suppress the MAC-address warnings

I believe this needs to be handled by Joe?

The patches unfortunately break am335x_evm.

Azure logs:

       arm:  +   am335x_evm

+arm-linux-gnueabi-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region .sram'

(quoted diff) +4 -0
+arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 8 bytes
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2

GitLab logs:

       arm:  +   am335x_evm

+arm-linux-gnueabi-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region .sram'

(quoted diff) +4 -0
+arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 76 bytes
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2
Quoted 8 lines
Quoted 6 lines

Would you please take a look, and propose a fix so that I can squash into the one that breaks this board?
https://gitlab.denx.de/u-boot/custodians/u-boot-x86/-/jobs/37696

@Tom, not sure why Azure and GitLab reported different size overflowed? (8 vs 76). Is this caused by build directory path?

Seems likely to be a path size overflow, yeah.

The use of BUG(), WARN_ON() and friends brings in __FILE__. I'll send a patch to help with that.

At least with gcc 7.3 it builds OK for me.

Quoted 7 lines

There are about 13KB of strings in SPL for this board.

I hate to say it, but it seems that the gcc rodata bug has returned. For example, it brings in the compat_name[] when building SPL, even though that is not actually used. I vaguely recall that this only happens when partial linking is used, but I cannot easily change U-Boot to use archives these days.

We should probably look at getting the patch I sent the other day to drop NFS from SPL when we have networking (like that board does) in as soon as feasible.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191208/54b4f138/attachment.sig>