From 892ff8e972efc7d4f42750e4fdbb2c2fefb78229 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 2 Mar 2015 12:40:49 -0700 Subject: x86: Support machines with >4GB of RAM Some systems have more than 4GB of RAM. U-Boot can only place things below 4GB so any memory above that should not be used. Ignore any such memory so that the memory size will not exceed the maximum. This prevents gd->ram_size exceeding 4GB which causes problems for PCI devices which use DMA. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Lukasz Majewski --- arch/x86/cpu/coreboot/sdram.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c index e98a230..9c3ab81 100644 --- a/arch/x86/cpu/coreboot/sdram.c +++ b/arch/x86/cpu/coreboot/sdram.c @@ -90,7 +90,8 @@ int dram_init(void) struct memrange *memrange = &lib_sysinfo.memrange[i]; unsigned long long end = memrange->base + memrange->size; - if (memrange->type == CB_MEM_RAM && end > ram_size) + if (memrange->type == CB_MEM_RAM && end > ram_size && + memrange->base < (1ULL << 32)) ram_size = end; } gd->ram_size = ram_size; @@ -108,7 +109,8 @@ void dram_init_banksize(void) for (i = 0, j = 0; i < lib_sysinfo.n_memranges; i++) { struct memrange *memrange = &lib_sysinfo.memrange[i]; - if (memrange->type == CB_MEM_RAM) { + if (memrange->type == CB_MEM_RAM && + memrange->base < (1ULL << 32)) { gd->bd->bi_dram[j].start = memrange->base; gd->bd->bi_dram[j].size = memrange->size; j++; -- cgit v1.1 From 51e9dad29675384becb0d31b1aa7388dc77d34aa Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 2 Mar 2015 12:40:54 -0700 Subject: x86: Add support for panther (Asus Chromebox) Support running U-Boot as a coreboot payload. Tested peripherals include: - Video (HDMI and DisplayPort) - SATA disk - Gigabit Ethernet - SPI flash USB3 does not work. This may be a problem with the USB3 PCI driver or something in the USB3 stack and has not been investigated So far this is disabled. The SD card slot also does not work. For video, coreboot will need to run the OPROM to set this up. With this board, bare support (running without coreboot) is not available as yet. Signed-off-by: Simon Glass --- arch/x86/Kconfig | 16 ++++++++++ arch/x86/dts/Makefile | 1 + arch/x86/dts/chromebox_panther.dts | 64 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 arch/x86/dts/chromebox_panther.dts (limited to 'arch/x86') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index da27115..d171349 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -32,6 +32,20 @@ config TARGET_CHROMEBOOK_LINK and it provides a 2560x1700 high resolution touch-enabled LCD display. +config TARGET_CHROMEBOX_PANTHER + bool "Support Chromebox panther (not available)" + select n + help + Note: At present this must be used with Coreboot. See README.x86 + for instructions. + + This is the Asus Chromebox CN60 released in 2014. It uses an Intel + Haswell Celeron 2955U Dual Core CPU with 2GB of SDRAM. It has a + Lynx Point platform controller hub, PCIe WiFi and Bluetooth. It also + includes a USB SD reader, four USB3 ports, display port and HDMI + video output and a 16GB SATA solid state drive. There is no Chrome + OS EC on this model. + config TARGET_CROWNBAY bool "Support Intel Crown Bay CRB" help @@ -432,6 +446,8 @@ source "board/coreboot/coreboot/Kconfig" source "board/google/chromebook_link/Kconfig" +source "board/google/chromebox_panther/Kconfig" + source "board/intel/crownbay/Kconfig" source "board/intel/minnowmax/Kconfig" diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile index 7a66133..431bbd8 100644 --- a/arch/x86/dts/Makefile +++ b/arch/x86/dts/Makefile @@ -1,4 +1,5 @@ dtb-y += chromebook_link.dtb \ + chromebox_panther.dtb \ crownbay.dtb \ galileo.dtb \ minnowmax.dtb diff --git a/arch/x86/dts/chromebox_panther.dts b/arch/x86/dts/chromebox_panther.dts new file mode 100644 index 0000000..4eccefd --- /dev/null +++ b/arch/x86/dts/chromebox_panther.dts @@ -0,0 +1,64 @@ +/dts-v1/; + +/include/ "skeleton.dtsi" +/include/ "serial.dtsi" + +/ { + model = "Google Panther"; + compatible = "google,panther", "intel,haswell"; + + aliases { + spi0 = "/spi"; + }; + + config { + silent-console = <0>; + no-keyboard; + }; + + gpioa { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0 0x10>; + bank-name = "A"; + }; + + gpiob { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0x30 0x10>; + bank-name = "B"; + }; + + gpioc { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0x40 0x10>; + bank-name = "C"; + }; + + chosen { + stdout-path = "/serial"; + }; + + spi { + #address-cells = <1>; + #size-cells = <0>; + compatible = "intel,ich-spi"; + spi-flash@0 { + #size-cells = <1>; + #address-cells = <1>; + reg = <0>; + compatible = "winbond,w25q64", "spi-flash"; + memory-map = <0xff800000 0x00800000>; + rw-mrc-cache { + label = "rw-mrc-cache"; + /* Alignment: 4k (for updating) */ + reg = <0x003e0000 0x00010000>; + type = "wiped"; + wipe-value = [ff]; + }; + }; + }; + +}; -- cgit v1.1 From 31f57c28736d9a070fe56c55d57e9da406ee86ba Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 5 Mar 2015 12:25:15 -0700 Subject: x86: Add a x86_ prefix to the x86-specific PCI functions These functions currently use a generic name, but they are for x86 only. This may introduce confusion and prevents U-Boot from using these names more widely. In fact it should be possible to remove these at some point and use generic functions, but for now, rename them. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/baytrail/early_uart.c | 5 ++- arch/x86/cpu/ivybridge/bd82x6x.c | 32 +++++++------- arch/x86/cpu/ivybridge/cpu.c | 38 ++++++++-------- arch/x86/cpu/ivybridge/early_init.c | 58 +++++++++++++------------ arch/x86/cpu/ivybridge/early_me.c | 12 +++--- arch/x86/cpu/ivybridge/gma.c | 4 +- arch/x86/cpu/ivybridge/lpc.c | 74 ++++++++++++++++---------------- arch/x86/cpu/ivybridge/northbridge.c | 6 +-- arch/x86/cpu/ivybridge/pch.c | 4 +- arch/x86/cpu/ivybridge/pci.c | 4 +- arch/x86/cpu/ivybridge/report_platform.c | 4 +- arch/x86/cpu/ivybridge/sata.c | 61 +++++++++++++------------- arch/x86/cpu/ivybridge/sdram.c | 20 ++++----- arch/x86/cpu/ivybridge/usb_ehci.c | 4 +- arch/x86/cpu/ivybridge/usb_xhci.c | 8 ++-- arch/x86/cpu/pci.c | 12 +++--- arch/x86/cpu/quark/quark.c | 4 +- arch/x86/cpu/queensbay/tnc.c | 4 +- arch/x86/include/asm/pci.h | 12 +++--- arch/x86/lib/bios_interrupts.c | 12 +++--- 20 files changed, 191 insertions(+), 187 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/cpu/baytrail/early_uart.c b/arch/x86/cpu/baytrail/early_uart.c index 4199210..b64a3a9 100644 --- a/arch/x86/cpu/baytrail/early_uart.c +++ b/arch/x86/cpu/baytrail/early_uart.c @@ -50,7 +50,7 @@ static void score_select_func(int pad, int func) writel(reg, pconf0_addr); } -static void pci_write_config32(int dev, unsigned int where, u32 value) +static void x86_pci_write_config32(int dev, unsigned int where, u32 value) { unsigned long addr; @@ -62,7 +62,8 @@ static void pci_write_config32(int dev, unsigned int where, u32 value) int setup_early_uart(void) { /* Enable the legacy UART hardware. */ - pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC), UART_CONT, 1); + x86_pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC), UART_CONT, + 1); /* * Set up the pads to the UART function. This allows the signals to diff --git a/arch/x86/cpu/ivybridge/bd82x6x.c b/arch/x86/cpu/ivybridge/bd82x6x.c index 65a17d3..56b19e3 100644 --- a/arch/x86/cpu/ivybridge/bd82x6x.c +++ b/arch/x86/cpu/ivybridge/bd82x6x.c @@ -22,36 +22,36 @@ void bd82x6x_pci_init(pci_dev_t dev) debug("bd82x6x PCI init.\n"); /* Enable Bus Master */ - reg16 = pci_read_config16(dev, PCI_COMMAND); + reg16 = x86_pci_read_config16(dev, PCI_COMMAND); reg16 |= PCI_COMMAND_MASTER; - pci_write_config16(dev, PCI_COMMAND, reg16); + x86_pci_write_config16(dev, PCI_COMMAND, reg16); /* This device has no interrupt */ - pci_write_config8(dev, INTR, 0xff); + x86_pci_write_config8(dev, INTR, 0xff); /* disable parity error response and SERR */ - reg16 = pci_read_config16(dev, BCTRL); + reg16 = x86_pci_read_config16(dev, BCTRL); reg16 &= ~(1 << 0); reg16 &= ~(1 << 1); - pci_write_config16(dev, BCTRL, reg16); + x86_pci_write_config16(dev, BCTRL, reg16); /* Master Latency Count must be set to 0x04! */ - reg8 = pci_read_config8(dev, SMLT); + reg8 = x86_pci_read_config8(dev, SMLT); reg8 &= 0x07; reg8 |= (0x04 << 3); - pci_write_config8(dev, SMLT, reg8); + x86_pci_write_config8(dev, SMLT, reg8); /* Will this improve throughput of bus masters? */ - pci_write_config8(dev, PCI_MIN_GNT, 0x06); + x86_pci_write_config8(dev, PCI_MIN_GNT, 0x06); /* Clear errors in status registers */ - reg16 = pci_read_config16(dev, PSTS); + reg16 = x86_pci_read_config16(dev, PSTS); /* reg16 |= 0xf900; */ - pci_write_config16(dev, PSTS, reg16); + x86_pci_write_config16(dev, PSTS, reg16); - reg16 = pci_read_config16(dev, SECSTS); + reg16 = x86_pci_read_config16(dev, SECSTS); /* reg16 |= 0xf900; */ - pci_write_config16(dev, SECSTS, reg16); + x86_pci_write_config16(dev, SECSTS, reg16); } #define PCI_BRIDGE_UPDATE_COMMAND @@ -59,7 +59,7 @@ void bd82x6x_pci_dev_enable_resources(pci_dev_t dev) { uint16_t command; - command = pci_read_config16(dev, PCI_COMMAND); + command = x86_pci_read_config16(dev, PCI_COMMAND); command |= PCI_COMMAND_IO; #ifdef PCI_BRIDGE_UPDATE_COMMAND /* @@ -67,7 +67,7 @@ void bd82x6x_pci_dev_enable_resources(pci_dev_t dev) * ROM and APICs to become invisible. */ debug("%x cmd <- %02x\n", dev, command); - pci_write_config16(dev, PCI_COMMAND, command); + x86_pci_write_config16(dev, PCI_COMMAND, command); #else printf("%s cmd <- %02x (NOT WRITTEN!)\n", dev_path(dev), command); #endif @@ -77,11 +77,11 @@ void bd82x6x_pci_bus_enable_resources(pci_dev_t dev) { uint16_t ctrl; - ctrl = pci_read_config16(dev, PCI_BRIDGE_CONTROL); + ctrl = x86_pci_read_config16(dev, PCI_BRIDGE_CONTROL); ctrl |= PCI_COMMAND_IO; ctrl |= PCI_BRIDGE_CTL_VGA; debug("%x bridge ctrl <- %04x\n", dev, ctrl); - pci_write_config16(dev, PCI_BRIDGE_CONTROL, ctrl); + x86_pci_write_config16(dev, PCI_BRIDGE_CONTROL, ctrl); bd82x6x_pci_dev_enable_resources(dev); } diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index e925310..5fd3753 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -167,21 +167,21 @@ static int enable_smbus(void) dev = PCI_BDF(0x0, 0x1f, 0x3); /* Check to make sure we've got the right device. */ - value = pci_read_config16(dev, 0x0); + value = x86_pci_read_config16(dev, 0x0); if (value != 0x8086) { printf("SMBus controller not found\n"); return -ENOSYS; } /* Set SMBus I/O base. */ - pci_write_config32(dev, SMB_BASE, - SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO); + x86_pci_write_config32(dev, SMB_BASE, + SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO); /* Set SMBus enable. */ - pci_write_config8(dev, HOSTC, HST_EN); + x86_pci_write_config8(dev, HOSTC, HST_EN); /* Set SMBus I/O space enable. */ - pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO); + x86_pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO); /* Disable interrupt generation. */ outb(0, SMBUS_IO_BASE + SMBHSTCTL); @@ -214,25 +214,25 @@ static void enable_usb_bar(void) u32 cmd; /* USB Controller 1 */ - pci_write_config32(usb0, PCI_BASE_ADDRESS_0, - PCH_EHCI0_TEMP_BAR0); - cmd = pci_read_config32(usb0, PCI_COMMAND); + x86_pci_write_config32(usb0, PCI_BASE_ADDRESS_0, + PCH_EHCI0_TEMP_BAR0); + cmd = x86_pci_read_config32(usb0, PCI_COMMAND); cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - pci_write_config32(usb0, PCI_COMMAND, cmd); + x86_pci_write_config32(usb0, PCI_COMMAND, cmd); /* USB Controller 1 */ - pci_write_config32(usb1, PCI_BASE_ADDRESS_0, - PCH_EHCI1_TEMP_BAR0); - cmd = pci_read_config32(usb1, PCI_COMMAND); + x86_pci_write_config32(usb1, PCI_BASE_ADDRESS_0, + PCH_EHCI1_TEMP_BAR0); + cmd = x86_pci_read_config32(usb1, PCI_COMMAND); cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - pci_write_config32(usb1, PCI_COMMAND, cmd); + x86_pci_write_config32(usb1, PCI_COMMAND, cmd); /* USB3 Controller */ - pci_write_config32(usb3, PCI_BASE_ADDRESS_0, - PCH_XHCI_TEMP_BAR0); - cmd = pci_read_config32(usb3, PCI_COMMAND); + x86_pci_write_config32(usb3, PCI_BASE_ADDRESS_0, + PCH_XHCI_TEMP_BAR0); + cmd = x86_pci_read_config32(usb3, PCI_COMMAND); cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - pci_write_config32(usb3, PCI_COMMAND, cmd); + x86_pci_write_config32(usb3, PCI_COMMAND, cmd); } static int report_bist_failure(void) @@ -320,8 +320,8 @@ int print_cpuinfo(void) gd->arch.pei_boot_mode = boot_mode; /* TODO: Move this to the board or driver */ - pci_write_config32(PCH_LPC_DEV, GPIO_BASE, DEFAULT_GPIOBASE | 1); - pci_write_config32(PCH_LPC_DEV, GPIO_CNTL, 0x10); + x86_pci_write_config32(PCH_LPC_DEV, GPIO_BASE, DEFAULT_GPIOBASE | 1); + x86_pci_write_config32(PCH_LPC_DEV, GPIO_CNTL, 0x10); /* Print processor name */ name = cpu_get_name(processor_name); diff --git a/arch/x86/cpu/ivybridge/early_init.c b/arch/x86/cpu/ivybridge/early_init.c index eb8f613..9ca008e 100644 --- a/arch/x86/cpu/ivybridge/early_init.c +++ b/arch/x86/cpu/ivybridge/early_init.c @@ -17,10 +17,10 @@ static void sandybridge_setup_bars(pci_dev_t pch_dev, pci_dev_t lpc_dev) { /* Setting up Southbridge. In the northbridge code. */ debug("Setting up static southbridge registers\n"); - pci_write_config32(lpc_dev, PCH_RCBA_BASE, DEFAULT_RCBA | 1); + x86_pci_write_config32(lpc_dev, PCH_RCBA_BASE, DEFAULT_RCBA | 1); - pci_write_config32(lpc_dev, PMBASE, DEFAULT_PMBASE | 1); - pci_write_config8(lpc_dev, ACPI_CNTL, 0x80); /* Enable ACPI BAR */ + x86_pci_write_config32(lpc_dev, PMBASE, DEFAULT_PMBASE | 1); + x86_pci_write_config8(lpc_dev, ACPI_CNTL, 0x80); /* Enable ACPI BAR */ debug("Disabling watchdog reboot\n"); setbits_le32(RCB_REG(GCS), 1 >> 5); /* No reset */ @@ -28,25 +28,27 @@ static void sandybridge_setup_bars(pci_dev_t pch_dev, pci_dev_t lpc_dev) /* Set up all hardcoded northbridge BARs */ debug("Setting up static registers\n"); - pci_write_config32(pch_dev, EPBAR, DEFAULT_EPBAR | 1); - pci_write_config32(pch_dev, EPBAR + 4, (0LL + DEFAULT_EPBAR) >> 32); - pci_write_config32(pch_dev, MCHBAR, DEFAULT_MCHBAR | 1); - pci_write_config32(pch_dev, MCHBAR + 4, (0LL + DEFAULT_MCHBAR) >> 32); + x86_pci_write_config32(pch_dev, EPBAR, DEFAULT_EPBAR | 1); + x86_pci_write_config32(pch_dev, EPBAR + 4, (0LL + DEFAULT_EPBAR) >> 32); + x86_pci_write_config32(pch_dev, MCHBAR, DEFAULT_MCHBAR | 1); + x86_pci_write_config32(pch_dev, MCHBAR + 4, + (0LL + DEFAULT_MCHBAR) >> 32); /* 64MB - busses 0-63 */ - pci_write_config32(pch_dev, PCIEXBAR, DEFAULT_PCIEXBAR | 5); - pci_write_config32(pch_dev, PCIEXBAR + 4, - (0LL + DEFAULT_PCIEXBAR) >> 32); - pci_write_config32(pch_dev, DMIBAR, DEFAULT_DMIBAR | 1); - pci_write_config32(pch_dev, DMIBAR + 4, (0LL + DEFAULT_DMIBAR) >> 32); + x86_pci_write_config32(pch_dev, PCIEXBAR, DEFAULT_PCIEXBAR | 5); + x86_pci_write_config32(pch_dev, PCIEXBAR + 4, + (0LL + DEFAULT_PCIEXBAR) >> 32); + x86_pci_write_config32(pch_dev, DMIBAR, DEFAULT_DMIBAR | 1); + x86_pci_write_config32(pch_dev, DMIBAR + 4, + (0LL + DEFAULT_DMIBAR) >> 32); /* Set C0000-FFFFF to access RAM on both reads and writes */ - pci_write_config8(pch_dev, PAM0, 0x30); - pci_write_config8(pch_dev, PAM1, 0x33); - pci_write_config8(pch_dev, PAM2, 0x33); - pci_write_config8(pch_dev, PAM3, 0x33); - pci_write_config8(pch_dev, PAM4, 0x33); - pci_write_config8(pch_dev, PAM5, 0x33); - pci_write_config8(pch_dev, PAM6, 0x33); + x86_pci_write_config8(pch_dev, PAM0, 0x30); + x86_pci_write_config8(pch_dev, PAM1, 0x33); + x86_pci_write_config8(pch_dev, PAM2, 0x33); + x86_pci_write_config8(pch_dev, PAM3, 0x33); + x86_pci_write_config8(pch_dev, PAM4, 0x33); + x86_pci_write_config8(pch_dev, PAM5, 0x33); + x86_pci_write_config8(pch_dev, PAM6, 0x33); } static void sandybridge_setup_graphics(pci_dev_t pch_dev, pci_dev_t video_dev) @@ -55,7 +57,7 @@ static void sandybridge_setup_graphics(pci_dev_t pch_dev, pci_dev_t video_dev) u16 reg16; u8 reg8; - reg16 = pci_read_config16(video_dev, PCI_DEVICE_ID); + reg16 = x86_pci_read_config16(video_dev, PCI_DEVICE_ID); switch (reg16) { case 0x0102: /* GT1 Desktop */ case 0x0106: /* GT1 Mobile */ @@ -75,7 +77,7 @@ static void sandybridge_setup_graphics(pci_dev_t pch_dev, pci_dev_t video_dev) debug("Initialising Graphics\n"); /* Setup IGD memory by setting GGC[7:3] = 1 for 32MB */ - reg16 = pci_read_config16(pch_dev, GGC); + reg16 = x86_pci_read_config16(pch_dev, GGC); reg16 &= ~0x00f8; reg16 |= 1 << 3; /* Program GTT memory by setting GGC[9:8] = 2MB */ @@ -83,13 +85,13 @@ static void sandybridge_setup_graphics(pci_dev_t pch_dev, pci_dev_t video_dev) reg16 |= 2 << 8; /* Enable VGA decode */ reg16 &= ~0x0002; - pci_write_config16(pch_dev, GGC, reg16); + x86_pci_write_config16(pch_dev, GGC, reg16); /* Enable 256MB aperture */ - reg8 = pci_read_config8(video_dev, MSAC); + reg8 = x86_pci_read_config8(video_dev, MSAC); reg8 &= ~0x06; reg8 |= 0x02; - pci_write_config8(video_dev, MSAC, reg8); + x86_pci_write_config8(video_dev, MSAC, reg8); /* Erratum workarounds */ reg32 = readl(MCHBAR_REG(0x5f00)); @@ -124,22 +126,22 @@ void sandybridge_early_init(int chipset_type) u8 reg8; /* Device ID Override Enable should be done very early */ - capid0_a = pci_read_config32(pch_dev, 0xe4); + capid0_a = x86_pci_read_config32(pch_dev, 0xe4); if (capid0_a & (1 << 10)) { - reg8 = pci_read_config8(pch_dev, 0xf3); + reg8 = x86_pci_read_config8(pch_dev, 0xf3); reg8 &= ~7; /* Clear 2:0 */ if (chipset_type == SANDYBRIDGE_MOBILE) reg8 |= 1; /* Set bit 0 */ - pci_write_config8(pch_dev, 0xf3, reg8); + x86_pci_write_config8(pch_dev, 0xf3, reg8); } /* Setup all BARs required for early PCIe and raminit */ sandybridge_setup_bars(pch_dev, lpc_dev); /* Device Enable */ - pci_write_config32(pch_dev, DEVEN, DEVEN_HOST | DEVEN_IGD); + x86_pci_write_config32(pch_dev, DEVEN, DEVEN_HOST | DEVEN_IGD); sandybridge_setup_graphics(pch_dev, video_dev); } diff --git a/arch/x86/cpu/ivybridge/early_me.c b/arch/x86/cpu/ivybridge/early_me.c index b24dea1..356bbb4 100644 --- a/arch/x86/cpu/ivybridge/early_me.c +++ b/arch/x86/cpu/ivybridge/early_me.c @@ -29,7 +29,7 @@ static inline void pci_read_dword_ptr(void *ptr, int offset) { u32 dword; - dword = pci_read_config32(PCH_ME_DEV, offset); + dword = x86_pci_read_config32(PCH_ME_DEV, offset); memcpy(ptr, &dword, sizeof(dword)); } @@ -37,7 +37,7 @@ static inline void pci_write_dword_ptr(void *ptr, int offset) { u32 dword = 0; memcpy(&dword, ptr, sizeof(dword)); - pci_write_config32(PCH_ME_DEV, offset, dword); + x86_pci_write_config32(PCH_ME_DEV, offset, dword); } void intel_early_me_status(void) @@ -101,7 +101,7 @@ static inline void set_global_reset(int enable) { u32 etr3; - etr3 = pci_read_config32(PCH_LPC_DEV, ETR3); + etr3 = x86_pci_read_config32(PCH_LPC_DEV, ETR3); /* Clear CF9 Without Resume Well Reset Enable */ etr3 &= ~ETR3_CWORWRE; @@ -112,7 +112,7 @@ static inline void set_global_reset(int enable) else etr3 &= ~ETR3_CF9GR; - pci_write_config32(PCH_LPC_DEV, ETR3, etr3); + x86_pci_write_config32(PCH_LPC_DEV, ETR3, etr3); } int intel_early_me_init_done(u8 status) @@ -127,8 +127,8 @@ int intel_early_me_init_done(u8 status) }; /* MEBASE from MESEG_BASE[35:20] */ - mebase_l = pci_read_config32(PCH_DEV, PCI_CPU_MEBASE_L); - mebase_h = pci_read_config32(PCH_DEV, PCI_CPU_MEBASE_H); + mebase_l = x86_pci_read_config32(PCH_DEV, PCI_CPU_MEBASE_L); + mebase_h = x86_pci_read_config32(PCH_DEV, PCI_CPU_MEBASE_H); mebase_h &= 0xf; did.uma_base = (mebase_l >> 20) | (mebase_h << 12); diff --git a/arch/x86/cpu/ivybridge/gma.c b/arch/x86/cpu/ivybridge/gma.c index 821ea25..ea169b0 100644 --- a/arch/x86/cpu/ivybridge/gma.c +++ b/arch/x86/cpu/ivybridge/gma.c @@ -741,9 +741,9 @@ int gma_func0_init(pci_dev_t dev, struct pci_controller *hose, int ret; /* IGD needs to be Bus Master */ - reg32 = pci_read_config32(dev, PCI_COMMAND); + reg32 = x86_pci_read_config32(dev, PCI_COMMAND); reg32 |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO; - pci_write_config32(dev, PCI_COMMAND, reg32); + x86_pci_write_config32(dev, PCI_COMMAND, reg32); /* Use write-combining for the graphics memory, 256MB */ base = pci_read_bar32(hose, dev, 2); diff --git a/arch/x86/cpu/ivybridge/lpc.c b/arch/x86/cpu/ivybridge/lpc.c index 43fdd31..33b11a1 100644 --- a/arch/x86/cpu/ivybridge/lpc.c +++ b/arch/x86/cpu/ivybridge/lpc.c @@ -29,7 +29,7 @@ static int pch_enable_apic(pci_dev_t dev) int i; /* Enable ACPI I/O and power management. Set SCI IRQ to IRQ9 */ - pci_write_config8(dev, ACPI_CNTL, 0x80); + x86_pci_write_config8(dev, ACPI_CNTL, 0x80); writel(0, IO_APIC_INDEX); writel(1 << 25, IO_APIC_DATA); @@ -72,9 +72,9 @@ static void pch_enable_serial_irqs(pci_dev_t dev) /* Set packet length and toggle silent mode bit for one frame. */ value = (1 << 7) | (1 << 6) | ((21 - 17) << 2) | (0 << 0); #ifdef CONFIG_SERIRQ_CONTINUOUS_MODE - pci_write_config8(dev, SERIRQ_CNTL, value); + x86_pci_write_config8(dev, SERIRQ_CNTL, value); #else - pci_write_config8(dev, SERIRQ_CNTL, value | (1 << 6)); + x86_pci_write_config8(dev, SERIRQ_CNTL, value | (1 << 6)); #endif } @@ -86,15 +86,15 @@ static int pch_pirq_init(const void *blob, int node, pci_dev_t dev) sizeof(route))) return -EINVAL; ptr = route; - pci_write_config8(dev, PIRQA_ROUT, *ptr++); - pci_write_config8(dev, PIRQB_ROUT, *ptr++); - pci_write_config8(dev, PIRQC_ROUT, *ptr++); - pci_write_config8(dev, PIRQD_ROUT, *ptr++); + x86_pci_write_config8(dev, PIRQA_ROUT, *ptr++); + x86_pci_write_config8(dev, PIRQB_ROUT, *ptr++); + x86_pci_write_config8(dev, PIRQC_ROUT, *ptr++); + x86_pci_write_config8(dev, PIRQD_ROUT, *ptr++); - pci_write_config8(dev, PIRQE_ROUT, *ptr++); - pci_write_config8(dev, PIRQF_ROUT, *ptr++); - pci_write_config8(dev, PIRQG_ROUT, *ptr++); - pci_write_config8(dev, PIRQH_ROUT, *ptr++); + x86_pci_write_config8(dev, PIRQE_ROUT, *ptr++); + x86_pci_write_config8(dev, PIRQF_ROUT, *ptr++); + x86_pci_write_config8(dev, PIRQG_ROUT, *ptr++); + x86_pci_write_config8(dev, PIRQH_ROUT, *ptr++); /* * TODO(sjg@chromium.org): U-Boot does not set up the interrupts @@ -116,7 +116,7 @@ static int pch_gpi_routing(const void *blob, int node, pci_dev_t dev) for (reg = 0, gpi = 0; gpi < ARRAY_SIZE(route); gpi++) reg |= route[gpi] << (gpi * 2); - pci_write_config32(dev, 0xb8, reg); + x86_pci_write_config32(dev, 0xb8, reg); return 0; } @@ -141,7 +141,7 @@ static int pch_power_options(const void *blob, int node, pci_dev_t dev) */ pwr_on = MAINBOARD_POWER_ON; - reg16 = pci_read_config16(dev, GEN_PMCON_3); + reg16 = x86_pci_read_config16(dev, GEN_PMCON_3); reg16 &= 0xfffe; switch (pwr_on) { case MAINBOARD_POWER_OFF: @@ -168,7 +168,7 @@ static int pch_power_options(const void *blob, int node, pci_dev_t dev) reg16 |= (1 << 12); /* Disable SLP stretch after SUS well */ - pci_write_config16(dev, GEN_PMCON_3, reg16); + x86_pci_write_config16(dev, GEN_PMCON_3, reg16); debug("Set power %s after power failure.\n", state); /* Set up NMI on errors. */ @@ -192,21 +192,21 @@ static int pch_power_options(const void *blob, int node, pci_dev_t dev) outb(reg8, 0x70); /* Enable CPU_SLP# and Intel Speedstep, set SMI# rate down */ - reg16 = pci_read_config16(dev, GEN_PMCON_1); + reg16 = x86_pci_read_config16(dev, GEN_PMCON_1); reg16 &= ~(3 << 0); /* SMI# rate 1 minute */ reg16 &= ~(1 << 10); /* Disable BIOS_PCI_EXP_EN for native PME */ #if DEBUG_PERIODIC_SMIS /* Set DEBUG_PERIODIC_SMIS in pch.h to debug using periodic SMIs */ reg16 |= (3 << 0); /* Periodic SMI every 8s */ #endif - pci_write_config16(dev, GEN_PMCON_1, reg16); + x86_pci_write_config16(dev, GEN_PMCON_1, reg16); /* Set the board's GPI routing. */ ret = pch_gpi_routing(blob, node, dev); if (ret) return ret; - pmbase = pci_read_config16(dev, 0x40) & 0xfffe; + pmbase = x86_pci_read_config16(dev, 0x40) & 0xfffe; writel(pmbase + GPE0_EN, fdtdec_get_int(blob, node, "intel,gpe0-enable", 0)); @@ -231,11 +231,11 @@ static void pch_rtc_init(pci_dev_t dev) int rtc_failed; u8 reg8; - reg8 = pci_read_config8(dev, GEN_PMCON_3); + reg8 = x86_pci_read_config8(dev, GEN_PMCON_3); rtc_failed = reg8 & RTC_BATTERY_DEAD; if (rtc_failed) { reg8 &= ~RTC_BATTERY_DEAD; - pci_write_config8(dev, GEN_PMCON_3, reg8); + x86_pci_write_config8(dev, GEN_PMCON_3, reg8); } debug("rtc_failed = 0x%x\n", rtc_failed); @@ -258,7 +258,7 @@ static void pch_rtc_init(pci_dev_t dev) static void cpt_pm_init(pci_dev_t dev) { debug("CougarPoint PM init\n"); - pci_write_config8(dev, 0xa9, 0x47); + x86_pci_write_config8(dev, 0xa9, 0x47); setbits_le32(RCB_REG(0x2238), (1 << 6) | (1 << 0)); setbits_le32(RCB_REG(0x228c), 1 << 0); @@ -302,7 +302,7 @@ static void cpt_pm_init(pci_dev_t dev) static void ppt_pm_init(pci_dev_t dev) { debug("PantherPoint PM init\n"); - pci_write_config8(dev, 0xa9, 0x47); + x86_pci_write_config8(dev, 0xa9, 0x47); setbits_le32(RCB_REG(0x2238), 1 << 0); setbits_le32(RCB_REG(0x228c), 1 << 0); setbits_le16(RCB_REG(0x1100), (1 << 13) | (1 << 14)); @@ -356,9 +356,9 @@ static void enable_clock_gating(pci_dev_t dev) setbits_le32(RCB_REG(0x2234), 0xf); - reg16 = pci_read_config16(dev, GEN_PMCON_1); + reg16 = x86_pci_read_config16(dev, GEN_PMCON_1); reg16 |= (1 << 2) | (1 << 11); - pci_write_config16(dev, GEN_PMCON_1, reg16); + x86_pci_write_config16(dev, GEN_PMCON_1, reg16); pch_iobp_update(0xEB007F07, ~0UL, (1 << 31)); pch_iobp_update(0xEB004000, ~0UL, (1 << 7)); @@ -412,15 +412,15 @@ static void pch_lock_smm(pci_dev_t dev) #if TEST_SMM_FLASH_LOCKDOWN /* Now try this: */ debug("Locking BIOS to RO... "); - reg8 = pci_read_config8(dev, 0xdc); /* BIOS_CNTL */ + reg8 = x86_pci_read_config8(dev, 0xdc); /* BIOS_CNTL */ debug(" BLE: %s; BWE: %s\n", (reg8 & 2) ? "on" : "off", (reg8 & 1) ? "rw" : "ro"); reg8 &= ~(1 << 0); /* clear BIOSWE */ - pci_write_config8(dev, 0xdc, reg8); + x86_pci_write_config8(dev, 0xdc, reg8); reg8 |= (1 << 1); /* set BLE */ - pci_write_config8(dev, 0xdc, reg8); + x86_pci_write_config8(dev, 0xdc, reg8); debug("ok.\n"); - reg8 = pci_read_config8(dev, 0xdc); /* BIOS_CNTL */ + reg8 = x86_pci_read_config8(dev, 0xdc); /* BIOS_CNTL */ debug(" BLE: %s; BWE: %s\n", (reg8 & 2) ? "on" : "off", (reg8 & 1) ? "rw" : "ro"); @@ -428,9 +428,9 @@ static void pch_lock_smm(pci_dev_t dev) writeb(0, 0xfff00000); debug("Testing:\n"); reg8 |= (1 << 0); /* set BIOSWE */ - pci_write_config8(dev, 0xdc, reg8); + x86_pci_write_config8(dev, 0xdc, reg8); - reg8 = pci_read_config8(dev, 0xdc); /* BIOS_CNTL */ + reg8 = x86_pci_read_config8(dev, 0xdc); /* BIOS_CNTL */ debug(" BLE: %s; BWE: %s\n", (reg8 & 2) ? "on" : "off", (reg8 & 1) ? "rw" : "ro"); debug("Done.\n"); @@ -443,9 +443,9 @@ static void pch_disable_smm_only_flashing(pci_dev_t dev) u8 reg8; debug("Enabling BIOS updates outside of SMM... "); - reg8 = pci_read_config8(dev, 0xdc); /* BIOS_CNTL */ + reg8 = x86_pci_read_config8(dev, 0xdc); /* BIOS_CNTL */ reg8 &= ~(1 << 5); - pci_write_config8(dev, 0xdc, reg8); + x86_pci_write_config8(dev, 0xdc, reg8); } static void pch_fixups(pci_dev_t dev) @@ -453,9 +453,9 @@ static void pch_fixups(pci_dev_t dev) u8 gen_pmcon_2; /* Indicate DRAM init done for MRC S3 to know it can resume */ - gen_pmcon_2 = pci_read_config8(dev, GEN_PMCON_2); + gen_pmcon_2 = x86_pci_read_config8(dev, GEN_PMCON_2); gen_pmcon_2 |= (1 << 7); - pci_write_config8(dev, GEN_PMCON_2, gen_pmcon_2); + x86_pci_write_config8(dev, GEN_PMCON_2, gen_pmcon_2); /* Enable DMI ASPM in the PCH */ clrbits_le32(RCB_REG(0x2304), 1 << 10); @@ -478,10 +478,10 @@ int lpc_early_init(const void *blob, int node, pci_dev_t dev) return -EINVAL; /* Set COM1/COM2 decode range */ - pci_write_config16(dev, LPC_IO_DEC, 0x0010); + x86_pci_write_config16(dev, LPC_IO_DEC, 0x0010); /* Enable PS/2 Keyboard/Mouse, EC areas and COM1 */ - pci_write_config16(dev, LPC_EN, KBC_LPC_EN | MC_LPC_EN | + x86_pci_write_config16(dev, LPC_EN, KBC_LPC_EN | MC_LPC_EN | GAMEL_LPC_EN | COMA_LPC_EN); /* Write all registers but use 0 if we run out of data */ @@ -491,7 +491,7 @@ int lpc_early_init(const void *blob, int node, pci_dev_t dev) if (i < count) reg = ptr->base | PCI_COMMAND_IO | (ptr->size << 16); - pci_write_config32(dev, LPC_GENX_DEC(i), reg); + x86_pci_write_config32(dev, LPC_GENX_DEC(i), reg); } return 0; @@ -514,7 +514,7 @@ int lpc_init(struct pci_controller *hose, pci_dev_t dev) return -ENOENT; /* Set the value for PCI command register. */ - pci_write_config16(dev, PCI_COMMAND, 0x000f); + x86_pci_write_config16(dev, PCI_COMMAND, 0x000f); /* IO APIC initialization. */ pch_enable_apic(dev); diff --git a/arch/x86/cpu/ivybridge/northbridge.c b/arch/x86/cpu/ivybridge/northbridge.c index c50b5de..e95e60e 100644 --- a/arch/x86/cpu/ivybridge/northbridge.c +++ b/arch/x86/cpu/ivybridge/northbridge.c @@ -30,7 +30,7 @@ int bridge_silicon_revision(void) result = cpuid(1); stepping = result.eax & 0xf; dev = PCI_BDF(0, 0, 0); - bridge_id = pci_read_config16(dev, PCI_DEVICE_ID) & 0xf0; + bridge_id = x86_pci_read_config16(dev, PCI_DEVICE_ID) & 0xf0; bridge_revision_id = bridge_id | stepping; } @@ -55,7 +55,7 @@ static int get_pcie_bar(u32 *base, u32 *len) *base = 0; *len = 0; - pciexbar_reg = pci_read_config32(dev, PCIEXBAR); + pciexbar_reg = x86_pci_read_config32(dev, PCIEXBAR); if (!(pciexbar_reg & (1 << 0))) return 0; @@ -170,7 +170,7 @@ void northbridge_init(pci_dev_t dev) void northbridge_enable(pci_dev_t dev) { #if CONFIG_HAVE_ACPI_RESUME - switch (pci_read_config32(dev, SKPAD)) { + switch (x86_pci_read_config32(dev, SKPAD)) { case 0xcafebabe: debug("Normal boot.\n"); apci_set_slp_type(0); diff --git a/arch/x86/cpu/ivybridge/pch.c b/arch/x86/cpu/ivybridge/pch.c index fa04d48..bbab646 100644 --- a/arch/x86/cpu/ivybridge/pch.c +++ b/arch/x86/cpu/ivybridge/pch.c @@ -21,7 +21,7 @@ int pch_silicon_revision(void) dev = PCH_LPC_DEV; if (pch_revision_id < 0) - pch_revision_id = pci_read_config8(dev, PCI_REVISION_ID); + pch_revision_id = x86_pci_read_config8(dev, PCI_REVISION_ID); return pch_revision_id; } @@ -32,7 +32,7 @@ int pch_silicon_type(void) dev = PCH_LPC_DEV; if (pch_type < 0) - pch_type = pci_read_config8(dev, PCI_DEVICE_ID + 1); + pch_type = x86_pci_read_config8(dev, PCI_DEVICE_ID + 1); return pch_type; } diff --git a/arch/x86/cpu/ivybridge/pci.c b/arch/x86/cpu/ivybridge/pci.c index 452d1c3..7f62a86 100644 --- a/arch/x86/cpu/ivybridge/pci.c +++ b/arch/x86/cpu/ivybridge/pci.c @@ -70,9 +70,9 @@ int board_pci_pre_scan(struct pci_controller *hose) reg16 = 0xff; dev = PCH_DEV; - reg16 = pci_read_config16(dev, PCI_COMMAND); + reg16 = x86_pci_read_config16(dev, PCI_COMMAND); reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - pci_write_config16(dev, PCI_COMMAND, reg16); + x86_pci_write_config16(dev, PCI_COMMAND, reg16); /* * Clear non-reserved bits in status register. diff --git a/arch/x86/cpu/ivybridge/report_platform.c b/arch/x86/cpu/ivybridge/report_platform.c index 69e31b3..4493870 100644 --- a/arch/x86/cpu/ivybridge/report_platform.c +++ b/arch/x86/cpu/ivybridge/report_platform.c @@ -70,14 +70,14 @@ static void report_pch_info(void) u16 dev_id; uint8_t rev_id; - dev_id = pci_read_config16(PCH_LPC_DEV, 2); + dev_id = x86_pci_read_config16(PCH_LPC_DEV, 2); for (i = 0; i < ARRAY_SIZE(pch_table); i++) { if (pch_table[i].dev_id == dev_id) { pch_type = pch_table[i].dev_name; break; } } - rev_id = pci_read_config8(PCH_LPC_DEV, 8); + rev_id = x86_pci_read_config8(PCH_LPC_DEV, 8); debug("PCH type: %s, device id: %x, rev id %x\n", pch_type, dev_id, rev_id); } diff --git a/arch/x86/cpu/ivybridge/sata.c b/arch/x86/cpu/ivybridge/sata.c index bbcd47d..e7bf03c 100644 --- a/arch/x86/cpu/ivybridge/sata.c +++ b/arch/x86/cpu/ivybridge/sata.c @@ -14,14 +14,14 @@ static inline u32 sir_read(pci_dev_t dev, int idx) { - pci_write_config32(dev, SATA_SIRI, idx); - return pci_read_config32(dev, SATA_SIRD); + x86_pci_write_config32(dev, SATA_SIRI, idx); + return x86_pci_read_config32(dev, SATA_SIRD); } static inline void sir_write(pci_dev_t dev, int idx, u32 value) { - pci_write_config32(dev, SATA_SIRI, idx); - pci_write_config32(dev, SATA_SIRD, value); + x86_pci_write_config32(dev, SATA_SIRI, idx); + x86_pci_write_config32(dev, SATA_SIRD, value); } static void common_sata_init(pci_dev_t dev, unsigned int port_map) @@ -31,17 +31,17 @@ static void common_sata_init(pci_dev_t dev, unsigned int port_map) /* Set IDE I/O Configuration */ reg32 = SIG_MODE_PRI_NORMAL | FAST_PCB1 | FAST_PCB0 | PCB1 | PCB0; - pci_write_config32(dev, IDE_CONFIG, reg32); + x86_pci_write_config32(dev, IDE_CONFIG, reg32); /* Port enable */ - reg16 = pci_read_config16(dev, 0x92); + reg16 = x86_pci_read_config16(dev, 0x92); reg16 &= ~0x3f; reg16 |= port_map; - pci_write_config16(dev, 0x92, reg16); + x86_pci_write_config16(dev, 0x92, reg16); /* SATA Initialization register */ port_map &= 0xff; - pci_write_config32(dev, 0x94, ((port_map ^ 0x3f) << 24) | 0x183); + x86_pci_write_config32(dev, 0x94, ((port_map ^ 0x3f) << 24) | 0x183); } void bd82x6x_sata_init(pci_dev_t dev, const void *blob, int node) @@ -60,7 +60,7 @@ void bd82x6x_sata_init(pci_dev_t dev, const void *blob, int node) "sata_interface_speed_support", 0); /* Enable BARs */ - pci_write_config16(dev, PCI_COMMAND, 0x0007); + x86_pci_write_config16(dev, PCI_COMMAND, 0x0007); mode = fdt_getprop(blob, node, "intel,sata-mode", NULL); if (!mode || !strcmp(mode, "ahci")) { @@ -69,18 +69,18 @@ void bd82x6x_sata_init(pci_dev_t dev, const void *blob, int node) debug("SATA: Controller in AHCI mode\n"); /* Set Interrupt Line, Interrupt Pin is set by D31IP.PIP */ - pci_write_config8(dev, INTR_LN, 0x0a); + x86_pci_write_config8(dev, INTR_LN, 0x0a); /* Set timings */ - pci_write_config16(dev, IDE_TIM_PRI, IDE_DECODE_ENABLE | + x86_pci_write_config16(dev, IDE_TIM_PRI, IDE_DECODE_ENABLE | IDE_ISP_3_CLOCKS | IDE_RCT_1_CLOCKS | IDE_PPE0 | IDE_IE0 | IDE_TIME0); - pci_write_config16(dev, IDE_TIM_SEC, IDE_DECODE_ENABLE | + x86_pci_write_config16(dev, IDE_TIM_SEC, IDE_DECODE_ENABLE | IDE_ISP_5_CLOCKS | IDE_RCT_4_CLOCKS); /* Sync DMA */ - pci_write_config16(dev, IDE_SDMA_CNT, IDE_PSDE0); - pci_write_config16(dev, IDE_SDMA_TIM, 0x0001); + x86_pci_write_config16(dev, IDE_SDMA_CNT, IDE_PSDE0); + x86_pci_write_config16(dev, IDE_SDMA_TIM, 0x0001); common_sata_init(dev, 0x8000 | port_map); @@ -115,22 +115,22 @@ void bd82x6x_sata_init(pci_dev_t dev, const void *blob, int node) /* No AHCI: clear AHCI base */ pci_write_bar32(hose, dev, 5, 0x00000000); /* And without AHCI BAR no memory decoding */ - reg16 = pci_read_config16(dev, PCI_COMMAND); + reg16 = x86_pci_read_config16(dev, PCI_COMMAND); reg16 &= ~PCI_COMMAND_MEMORY; - pci_write_config16(dev, PCI_COMMAND, reg16); + x86_pci_write_config16(dev, PCI_COMMAND, reg16); - pci_write_config8(dev, 0x09, 0x80); + x86_pci_write_config8(dev, 0x09, 0x80); /* Set timings */ - pci_write_config16(dev, IDE_TIM_PRI, IDE_DECODE_ENABLE | + x86_pci_write_config16(dev, IDE_TIM_PRI, IDE_DECODE_ENABLE | IDE_ISP_5_CLOCKS | IDE_RCT_4_CLOCKS); - pci_write_config16(dev, IDE_TIM_SEC, IDE_DECODE_ENABLE | + x86_pci_write_config16(dev, IDE_TIM_SEC, IDE_DECODE_ENABLE | IDE_ISP_3_CLOCKS | IDE_RCT_1_CLOCKS | IDE_PPE0 | IDE_IE0 | IDE_TIME0); /* Sync DMA */ - pci_write_config16(dev, IDE_SDMA_CNT, IDE_SSDE0); - pci_write_config16(dev, IDE_SDMA_TIM, 0x0200); + x86_pci_write_config16(dev, IDE_SDMA_CNT, IDE_SSDE0); + x86_pci_write_config16(dev, IDE_SDMA_TIM, 0x0200); common_sata_init(dev, port_map); } else { @@ -140,31 +140,32 @@ void bd82x6x_sata_init(pci_dev_t dev, const void *blob, int node) pci_write_bar32(hose, dev, 5, 0x00000000); /* And without AHCI BAR no memory decoding */ - reg16 = pci_read_config16(dev, PCI_COMMAND); + reg16 = x86_pci_read_config16(dev, PCI_COMMAND); reg16 &= ~PCI_COMMAND_MEMORY; - pci_write_config16(dev, PCI_COMMAND, reg16); + x86_pci_write_config16(dev, PCI_COMMAND, reg16); /* * Native mode capable on both primary and secondary (0xa) * OR'ed with enabled (0x50) = 0xf */ - pci_write_config8(dev, 0x09, 0x8f); + x86_pci_write_config8(dev, 0x09, 0x8f); /* Set Interrupt Line */ /* Interrupt Pin is set by D31IP.PIP */ - pci_write_config8(dev, INTR_LN, 0xff); + x86_pci_write_config8(dev, INTR_LN, 0xff); /* Set timings */ - pci_write_config16(dev, IDE_TIM_PRI, IDE_DECODE_ENABLE | + x86_pci_write_config16(dev, IDE_TIM_PRI, IDE_DECODE_ENABLE | IDE_ISP_3_CLOCKS | IDE_RCT_1_CLOCKS | IDE_PPE0 | IDE_IE0 | IDE_TIME0); - pci_write_config16(dev, IDE_TIM_SEC, IDE_DECODE_ENABLE | + x86_pci_write_config16(dev, IDE_TIM_SEC, IDE_DECODE_ENABLE | IDE_SITRE | IDE_ISP_3_CLOCKS | IDE_RCT_1_CLOCKS | IDE_IE0 | IDE_TIME0); /* Sync DMA */ - pci_write_config16(dev, IDE_SDMA_CNT, IDE_SSDE0 | IDE_PSDE0); - pci_write_config16(dev, IDE_SDMA_TIM, 0x0201); + x86_pci_write_config16(dev, IDE_SDMA_CNT, + IDE_SSDE0 | IDE_PSDE0); + x86_pci_write_config16(dev, IDE_SDMA_TIM, 0x0201); common_sata_init(dev, port_map); } @@ -221,5 +222,5 @@ void bd82x6x_sata_enable(pci_dev_t dev, const void *blob, int node) port_map = fdtdec_get_int(blob, node, "intel,sata-port-map", 0); map |= (port_map ^ 0x3f) << 8; - pci_write_config16(dev, 0x90, map); + x86_pci_write_config16(dev, 0x90, map); } diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c index 766b385..672d069 100644 --- a/arch/x86/cpu/ivybridge/sdram.c +++ b/arch/x86/cpu/ivybridge/sdram.c @@ -444,7 +444,7 @@ int sdram_initialise(struct pei_data *pei_data) * Send ME init done for SandyBridge here. This is done inside the * SystemAgent binary on IvyBridge */ - done = pci_read_config32(PCH_DEV, PCI_DEVICE_ID); + done = x86_pci_read_config32(PCH_DEV, PCI_DEVICE_ID); done &= BASE_REV_MASK; if (BASE_REV_SNB == done) intel_early_me_init_done(ME_INIT_STATUS_SUCCESS); @@ -615,24 +615,24 @@ static int sdram_find(pci_dev_t dev) */ /* Top of Upper Usable DRAM, including remap */ - touud = pci_read_config32(dev, TOUUD+4); + touud = x86_pci_read_config32(dev, TOUUD+4); touud <<= 32; - touud |= pci_read_config32(dev, TOUUD); + touud |= x86_pci_read_config32(dev, TOUUD); /* Top of Lower Usable DRAM */ - tolud = pci_read_config32(dev, TOLUD); + tolud = x86_pci_read_config32(dev, TOLUD); /* Top of Memory - does not account for any UMA */ - tom = pci_read_config32(dev, 0xa4); + tom = x86_pci_read_config32(dev, 0xa4); tom <<= 32; - tom |= pci_read_config32(dev, 0xa0); + tom |= x86_pci_read_config32(dev, 0xa0); debug("TOUUD %llx TOLUD %08x TOM %llx\n", touud, tolud, tom); /* ME UMA needs excluding if total memory <4GB */ - me_base = pci_read_config32(dev, 0x74); + me_base = x86_pci_read_config32(dev, 0x74); me_base <<= 32; - me_base |= pci_read_config32(dev, 0x70); + me_base |= x86_pci_read_config32(dev, 0x70); debug("MEBASE %llx\n", me_base); @@ -650,7 +650,7 @@ static int sdram_find(pci_dev_t dev) } /* Graphics memory comes next */ - ggc = pci_read_config16(dev, GGC); + ggc = x86_pci_read_config16(dev, GGC); if (!(ggc & 2)) { debug("IGD decoded, subtracting "); @@ -670,7 +670,7 @@ static int sdram_find(pci_dev_t dev) } /* Calculate TSEG size from its base which must be below GTT */ - tseg_base = pci_read_config32(dev, 0xb8); + tseg_base = x86_pci_read_config32(dev, 0xb8); uma_size = (uma_memory_base - tseg_base) >> 10; tomk -= uma_size; uma_memory_base = tomk * 1024ULL; diff --git a/arch/x86/cpu/ivybridge/usb_ehci.c b/arch/x86/cpu/ivybridge/usb_ehci.c index 291c971..da11aee 100644 --- a/arch/x86/cpu/ivybridge/usb_ehci.c +++ b/arch/x86/cpu/ivybridge/usb_ehci.c @@ -20,10 +20,10 @@ void bd82x6x_usb_ehci_init(pci_dev_t dev) writel(reg32, RCB_REG(0x35b0)); debug("EHCI: Setting up controller.. "); - reg32 = pci_read_config32(dev, PCI_COMMAND); + reg32 = x86_pci_read_config32(dev, PCI_COMMAND); reg32 |= PCI_COMMAND_MASTER; /* reg32 |= PCI_COMMAND_SERR; */ - pci_write_config32(dev, PCI_COMMAND, reg32); + x86_pci_write_config32(dev, PCI_COMMAND, reg32); debug("done.\n"); } diff --git a/arch/x86/cpu/ivybridge/usb_xhci.c b/arch/x86/cpu/ivybridge/usb_xhci.c index 4a32a7e..f77b804 100644 --- a/arch/x86/cpu/ivybridge/usb_xhci.c +++ b/arch/x86/cpu/ivybridge/usb_xhci.c @@ -16,17 +16,17 @@ void bd82x6x_usb_xhci_init(pci_dev_t dev) debug("XHCI: Setting up controller.. "); /* lock overcurrent map */ - reg32 = pci_read_config32(dev, 0x44); + reg32 = x86_pci_read_config32(dev, 0x44); reg32 |= 1; - pci_write_config32(dev, 0x44, reg32); + x86_pci_write_config32(dev, 0x44, reg32); /* Enable clock gating */ - reg32 = pci_read_config32(dev, 0x40); + reg32 = x86_pci_read_config32(dev, 0x40); reg32 &= ~((1 << 20) | (1 << 21)); reg32 |= (1 << 19) | (1 << 18) | (1 << 17); reg32 |= (1 << 10) | (1 << 9) | (1 << 8); reg32 |= (1 << 31); /* lock */ - pci_write_config32(dev, 0x40, reg32); + x86_pci_write_config32(dev, 0x40, reg32); debug("done.\n"); } diff --git a/arch/x86/cpu/pci.c b/arch/x86/cpu/pci.c index ab1aaaa..c6c5267 100644 --- a/arch/x86/cpu/pci.c +++ b/arch/x86/cpu/pci.c @@ -70,7 +70,7 @@ static struct pci_controller *get_hose(void) return pci_bus_to_hose(0); } -unsigned int pci_read_config8(pci_dev_t dev, unsigned where) +unsigned int x86_pci_read_config8(pci_dev_t dev, unsigned where) { uint8_t value; @@ -79,7 +79,7 @@ unsigned int pci_read_config8(pci_dev_t dev, unsigned where) return value; } -unsigned int pci_read_config16(pci_dev_t dev, unsigned where) +unsigned int x86_pci_read_config16(pci_dev_t dev, unsigned where) { uint16_t value; @@ -88,7 +88,7 @@ unsigned int pci_read_config16(pci_dev_t dev, unsigned where) return value; } -unsigned int pci_read_config32(pci_dev_t dev, unsigned where) +unsigned int x86_pci_read_config32(pci_dev_t dev, unsigned where) { uint32_t value; @@ -97,17 +97,17 @@ unsigned int pci_read_config32(pci_dev_t dev, unsigned where) return value; } -void pci_write_config8(pci_dev_t dev, unsigned where, unsigned value) +void x86_pci_write_config8(pci_dev_t dev, unsigned where, unsigned value) { pci_hose_write_config_byte(get_hose(), dev, where, value); } -void pci_write_config16(pci_dev_t dev, unsigned where, unsigned value) +void x86_pci_write_config16(pci_dev_t dev, unsigned where, unsigned value) { pci_hose_write_config_word(get_hose(), dev, where, value); } -void pci_write_config32(pci_dev_t dev, unsigned where, unsigned value) +void x86_pci_write_config32(pci_dev_t dev, unsigned where, unsigned value) { pci_hose_write_config_dword(get_hose(), dev, where, value); } diff --git a/arch/x86/cpu/quark/quark.c b/arch/x86/cpu/quark/quark.c index 25edcf7..e4b19c2 100644 --- a/arch/x86/cpu/quark/quark.c +++ b/arch/x86/cpu/quark/quark.c @@ -30,9 +30,9 @@ static void unprotect_spi_flash(void) { u32 bc; - bc = pci_read_config32(QUARK_LEGACY_BRIDGE, 0xd8); + bc = x86_pci_read_config32(QUARK_LEGACY_BRIDGE, 0xd8); bc |= 0x1; /* unprotect the flash */ - pci_write_config32(QUARK_LEGACY_BRIDGE, 0xd8, bc); + x86_pci_write_config32(QUARK_LEGACY_BRIDGE, 0xd8, bc); } static void quark_setup_bars(void) diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c index 30ab725..b7236e7 100644 --- a/arch/x86/cpu/queensbay/tnc.c +++ b/arch/x86/cpu/queensbay/tnc.c @@ -16,9 +16,9 @@ static void unprotect_spi_flash(void) { u32 bc; - bc = pci_read_config32(PCH_LPC_DEV, 0xd8); + bc = x86_pci_read_config32(PCH_LPC_DEV, 0xd8); bc |= 0x1; /* unprotect the flash */ - pci_write_config32(PCH_LPC_DEV, 0xd8, bc); + x86_pci_write_config32(PCH_LPC_DEV, 0xd8, bc); } int arch_cpu_init(void) diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index a153dd1..b277b3d 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -48,13 +48,13 @@ int board_pci_post_scan(struct pci_controller *hose); * Simple PCI access routines - these work from either the early PCI hose * or the 'real' one, created after U-Boot has memory available */ -unsigned int pci_read_config8(pci_dev_t dev, unsigned where); -unsigned int pci_read_config16(pci_dev_t dev, unsigned where); -unsigned int pci_read_config32(pci_dev_t dev, unsigned where); +unsigned int x86_pci_read_config8(pci_dev_t dev, unsigned where); +unsigned int x86_pci_read_config16(pci_dev_t dev, unsigned where); +unsigned int x86_pci_read_config32(pci_dev_t dev, unsigned where); -void pci_write_config8(pci_dev_t dev, unsigned where, unsigned value); -void pci_write_config16(pci_dev_t dev, unsigned where, unsigned value); -void pci_write_config32(pci_dev_t dev, unsigned where, unsigned value); +void x86_pci_write_config8(pci_dev_t dev, unsigned where, unsigned value); +void x86_pci_write_config16(pci_dev_t dev, unsigned where, unsigned value); +void x86_pci_write_config32(pci_dev_t dev, unsigned where, unsigned value); #endif /* __ASSEMBLY__ */ diff --git a/arch/x86/lib/bios_interrupts.c b/arch/x86/lib/bios_interrupts.c index b0e2ecb..290990a 100644 --- a/arch/x86/lib/bios_interrupts.c +++ b/arch/x86/lib/bios_interrupts.c @@ -172,28 +172,28 @@ int int1a_handler(void) } switch (func) { case 0xb108: /* Read Config Byte */ - byte = pci_read_config8(dev, reg); + byte = x86_pci_read_config8(dev, reg); M.x86.R_ECX = byte; break; case 0xb109: /* Read Config Word */ - word = pci_read_config16(dev, reg); + word = x86_pci_read_config16(dev, reg); M.x86.R_ECX = word; break; case 0xb10a: /* Read Config Dword */ - dword = pci_read_config32(dev, reg); + dword = x86_pci_read_config32(dev, reg); M.x86.R_ECX = dword; break; case 0xb10b: /* Write Config Byte */ byte = M.x86.R_ECX; - pci_write_config8(dev, reg, byte); + x86_pci_write_config8(dev, reg, byte); break; case 0xb10c: /* Write Config Word */ word = M.x86.R_ECX; - pci_write_config16(dev, reg, word); + x86_pci_write_config16(dev, reg, word); break; case 0xb10d: /* Write Config Dword */ dword = M.x86.R_ECX; - pci_write_config32(dev, reg, dword); + x86_pci_write_config32(dev, reg, dword); break; } -- cgit v1.1 From 161d2e4e5b98310c4910a353e432dbabcb1bd630 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 5 Mar 2015 12:25:17 -0700 Subject: x86: Split up arch_cpu_init() At present we do more in this function than we should. Split out the post-driver-model part into a separate function. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/ivybridge/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/x86') diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index 5fd3753..e6ef481 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -116,6 +116,14 @@ static void set_spi_speed(void) int arch_cpu_init(void) { + post_code(POST_CPU_INIT); + timer_set_base(rdtsc()); + + return x86_cpu_init_f(); +} + +int arch_cpu_init_dm(void) +{ const void *blob = gd->fdt_blob; struct pci_controller *hose; int node; -- cgit v1.1 From a219daeafef4df1b219db68c80116d82113c82b2 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 5 Mar 2015 12:25:31 -0700 Subject: dm: x86: pci: Add a PCI driver for driver model Add a simple x86 PCI driver which uses standard functions provided by the architecture. Signed-off-by: Simon Glass --- arch/x86/cpu/pci.c | 40 ++++++++++++++++++++++++++++++++++++++++ arch/x86/include/asm/pci.h | 8 ++++++++ arch/x86/lib/Makefile | 2 ++ 3 files changed, 50 insertions(+) (limited to 'arch/x86') diff --git a/arch/x86/cpu/pci.c b/arch/x86/cpu/pci.c index c6c5267..e23b233 100644 --- a/arch/x86/cpu/pci.c +++ b/arch/x86/cpu/pci.c @@ -10,9 +10,11 @@ */ #include +#include #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -111,3 +113,41 @@ void x86_pci_write_config32(pci_dev_t dev, unsigned where, unsigned value) { pci_hose_write_config_dword(get_hose(), dev, where, value); } + +int pci_x86_read_config(struct udevice *bus, pci_dev_t bdf, uint offset, + ulong *valuep, enum pci_size_t size) +{ + outl(bdf | (offset & 0xfc) | PCI_CFG_EN, PCI_REG_ADDR); + switch (size) { + case PCI_SIZE_8: + *valuep = inb(PCI_REG_DATA + (offset & 3)); + break; + case PCI_SIZE_16: + *valuep = inw(PCI_REG_DATA + (offset & 2)); + break; + case PCI_SIZE_32: + *valuep = inl(PCI_REG_DATA); + break; + } + + return 0; +} + +int pci_x86_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, + ulong value, enum pci_size_t size) +{ + outl(bdf | (offset & 0xfc) | PCI_CFG_EN, PCI_REG_ADDR); + switch (size) { + case PCI_SIZE_8: + outb(value, PCI_REG_DATA + (offset & 3)); + break; + case PCI_SIZE_16: + outw(value, PCI_REG_DATA + (offset & 2)); + break; + case PCI_SIZE_32: + outl(value, PCI_REG_DATA); + break; + } + + return 0; +} diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index b277b3d..a1969ed 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -8,6 +8,8 @@ #ifndef _PCI_I386_H_ #define _PCI_I386_H_ +#include + /* bus mapping constants (used for PCI core initialization) */ #define PCI_REG_ADDR 0xcf8 #define PCI_REG_DATA 0xcfc @@ -56,6 +58,12 @@ void x86_pci_write_config8(pci_dev_t dev, unsigned where, unsigned value); void x86_pci_write_config16(pci_dev_t dev, unsigned where, unsigned value); void x86_pci_write_config32(pci_dev_t dev, unsigned where, unsigned value); +int pci_x86_read_config(struct udevice *bus, pci_dev_t bdf, uint offset, + ulong *valuep, enum pci_size_t size); + +int pci_x86_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, + ulong value, enum pci_size_t size); + #endif /* __ASSEMBLY__ */ #endif /* _PCI_I386_H_ */ diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index c17f7f0..67a34d8 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -17,7 +17,9 @@ obj-y += interrupts.o obj-y += cmd_mtrr.o obj-$(CONFIG_SYS_PCAT_INTERRUPTS) += pcat_interrupts.o obj-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o +ifndef CONFIG_DM_PCI obj-$(CONFIG_PCI) += pci_type1.o +endif obj-y += relocate.o obj-y += physmem.o obj-$(CONFIG_X86_RAMTEST) += ramtest.o -- cgit v1.1 From 801f4f1bbc5ae838cdd50df09895dc275726d23a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 5 Mar 2015 12:25:32 -0700 Subject: dm: x86: pci: Convert coreboot to use driver model for pci Move coreboot-x86 over to driver model for PCI. Signed-off-by: Simon Glass --- arch/x86/cpu/coreboot/pci.c | 63 ++++++++++------------------------------ arch/x86/dts/chromebook_link.dts | 7 +++++ 2 files changed, 23 insertions(+), 47 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/cpu/coreboot/pci.c b/arch/x86/cpu/coreboot/pci.c index c9983f1..fa415dd 100644 --- a/arch/x86/cpu/coreboot/pci.c +++ b/arch/x86/cpu/coreboot/pci.c @@ -10,58 +10,27 @@ */ #include +#include +#include #include +#include #include DECLARE_GLOBAL_DATA_PTR; -static void config_pci_bridge(struct pci_controller *hose, pci_dev_t dev, - struct pci_config_table *table) -{ - u8 secondary; - hose->read_byte(hose, dev, PCI_SECONDARY_BUS, &secondary); - hose->last_busno = max(hose->last_busno, (int)secondary); - pci_hose_scan_bus(hose, secondary); -} - -static struct pci_config_table pci_coreboot_config_table[] = { - /* vendor, device, class, bus, dev, func */ - { PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_PCI, - PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, &config_pci_bridge }, - {} +static const struct dm_pci_ops pci_x86_ops = { + .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config, }; -void board_pci_setup_hose(struct pci_controller *hose) -{ - hose->config_table = pci_coreboot_config_table; - hose->first_busno = 0; - hose->last_busno = 0; - - /* PCI memory space */ - pci_set_region(hose->regions + 0, - CONFIG_PCI_MEM_BUS, - CONFIG_PCI_MEM_PHYS, - CONFIG_PCI_MEM_SIZE, - PCI_REGION_MEM); - - /* PCI IO space */ - pci_set_region(hose->regions + 1, - CONFIG_PCI_IO_BUS, - CONFIG_PCI_IO_PHYS, - CONFIG_PCI_IO_SIZE, - PCI_REGION_IO); - - pci_set_region(hose->regions + 2, - CONFIG_PCI_PREF_BUS, - CONFIG_PCI_PREF_PHYS, - CONFIG_PCI_PREF_SIZE, - PCI_REGION_PREFETCH); - - pci_set_region(hose->regions + 3, - 0, - 0, - gd->ram_size, - PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); +static const struct udevice_id pci_x86_ids[] = { + { .compatible = "pci-x86" }, + { } +}; - hose->region_count = 4; -} +U_BOOT_DRIVER(pci_x86_drv) = { + .name = "pci_x86", + .id = UCLASS_PCI, + .of_match = pci_x86_ids, + .ops = &pci_x86_ops, +}; diff --git a/arch/x86/dts/chromebook_link.dts b/arch/x86/dts/chromebook_link.dts index 45ada61..cdbdb68 100644 --- a/arch/x86/dts/chromebook_link.dts +++ b/arch/x86/dts/chromebook_link.dts @@ -172,6 +172,13 @@ }; pci { + compatible = "intel,pci-ivybridge", "pci-x86"; + #address-cells = <3>; + #size-cells = <2>; + u-boot,dm-pre-reloc; + ranges = <0x02000000 0x0 0xe0000000 0xe0000000 0 0x10000000 + 0x42000000 0x0 0xd0000000 0xd0000000 0 0x10000000 + 0x01000000 0x0 0x1000 0x1000 0 0xefff>; sata { compatible = "intel,pantherpoint-ahci"; intel,sata-mode = "ahci"; -- cgit v1.1 From aad78d2732ee04326fb3523815795f76012aab99 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 5 Mar 2015 12:25:33 -0700 Subject: dm: x86: pci: Convert chromebook_link to use driver model for pci Move chromebook_link over to driver model for PCI. This involves: - adding a uclass for platform controller hub - removing most of the existing PCI driver - adjusting how CPU init works to use driver model instead - rename the lpc compatible string (it will be removed later) This does not really take advantage of driver model fully, but it does work. Furture work will improve the code structure to remove many of the explicit calls to init the board. Signed-off-by: Simon Glass --- arch/x86/cpu/ivybridge/bd82x6x.c | 24 +++++++- arch/x86/cpu/ivybridge/cpu.c | 16 +++--- arch/x86/cpu/ivybridge/lpc.c | 1 + arch/x86/cpu/ivybridge/pci.c | 81 ++++++++------------------- arch/x86/dts/chromebook_link.dts | 3 +- arch/x86/include/asm/arch-ivybridge/bd82x6x.h | 1 - 6 files changed, 59 insertions(+), 67 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/cpu/ivybridge/bd82x6x.c b/arch/x86/cpu/ivybridge/bd82x6x.c index 56b19e3..7b74282 100644 --- a/arch/x86/cpu/ivybridge/bd82x6x.c +++ b/arch/x86/cpu/ivybridge/bd82x6x.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -86,7 +87,7 @@ void bd82x6x_pci_bus_enable_resources(pci_dev_t dev) bd82x6x_pci_dev_enable_resources(dev); } -int bd82x6x_init_pci_devices(void) +static int bd82x6x_probe(struct udevice *dev) { const void *blob = gd->fdt_blob; struct pci_controller *hose; @@ -144,3 +145,24 @@ int bd82x6x_init(void) return 0; } + +static const struct udevice_id bd82x6x_ids[] = { + { .compatible = "intel,bd82x6x" }, + { } +}; + +U_BOOT_DRIVER(bd82x6x_drv) = { + .name = "bd82x6x", + .id = UCLASS_PCH, + .of_match = bd82x6x_ids, + .probe = bd82x6x_probe, +}; + +/* + * TODO(sjg@chromium.org): Move this to arch/x86/lib or similar when other + * boards also use a PCH + */ +UCLASS_DRIVER(pch) = { + .id = UCLASS_PCH, + .name = "pch", +}; diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index e6ef481..2639ec2 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -126,19 +127,20 @@ int arch_cpu_init_dm(void) { const void *blob = gd->fdt_blob; struct pci_controller *hose; + struct udevice *bus; int node; int ret; - post_code(POST_CPU_INIT); - timer_set_base(rdtsc()); - - ret = x86_cpu_init_f(); + post_code(0x70); + ret = uclass_get_device(UCLASS_PCI, 0, &bus); + post_code(0x71); if (ret) return ret; + post_code(0x72); + hose = dev_get_uclass_priv(bus); - ret = pci_early_init_hose(&hose); - if (ret) - return ret; + /* TODO(sjg@chromium.org): Get rid of gd->hose */ + gd->hose = hose; node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_LPC); if (node < 0) diff --git a/arch/x86/cpu/ivybridge/lpc.c b/arch/x86/cpu/ivybridge/lpc.c index 33b11a1..c20e180 100644 --- a/arch/x86/cpu/ivybridge/lpc.c +++ b/arch/x86/cpu/ivybridge/lpc.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/arch/x86/cpu/ivybridge/pci.c b/arch/x86/cpu/ivybridge/pci.c index 7f62a86..5e90f30 100644 --- a/arch/x86/cpu/ivybridge/pci.c +++ b/arch/x86/cpu/ivybridge/pci.c @@ -10,63 +10,24 @@ */ #include +#include #include #include +#include #include #include -static void config_pci_bridge(struct pci_controller *hose, pci_dev_t dev, - struct pci_config_table *table) -{ - u8 secondary; - - hose->read_byte(hose, dev, PCI_SECONDARY_BUS, &secondary); - if (secondary != 0) - pci_hose_scan_bus(hose, secondary); -} - -static struct pci_config_table pci_ivybridge_config_table[] = { - /* vendor, device, class, bus, dev, func */ - { PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_PCI, - PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, &config_pci_bridge }, - {} -}; - -void board_pci_setup_hose(struct pci_controller *hose) -{ - hose->config_table = pci_ivybridge_config_table; - hose->first_busno = 0; - hose->last_busno = 0; - - /* PCI memory space */ - pci_set_region(hose->regions + 0, - CONFIG_PCI_MEM_BUS, - CONFIG_PCI_MEM_PHYS, - CONFIG_PCI_MEM_SIZE, - PCI_REGION_MEM); - - /* PCI IO space */ - pci_set_region(hose->regions + 1, - CONFIG_PCI_IO_BUS, - CONFIG_PCI_IO_PHYS, - CONFIG_PCI_IO_SIZE, - PCI_REGION_IO); - - pci_set_region(hose->regions + 2, - CONFIG_PCI_PREF_BUS, - CONFIG_PCI_PREF_PHYS, - CONFIG_PCI_PREF_SIZE, - PCI_REGION_PREFETCH); - - hose->region_count = 3; -} - -int board_pci_pre_scan(struct pci_controller *hose) +static int pci_ivybridge_probe(struct udevice *bus) { + struct pci_controller *hose = dev_get_uclass_priv(bus); pci_dev_t dev; u16 reg16; + if (!(gd->flags & GD_FLG_RELOC)) + return 0; + post_code(0x50); bd82x6x_init(); + post_code(0x51); reg16 = 0xff; dev = PCH_DEV; @@ -82,19 +43,25 @@ int board_pci_pre_scan(struct pci_controller *hose) pci_hose_write_config_byte(hose, dev, PCI_CACHE_LINE_SIZE, 0x08); pci_write_bar32(hose, dev, 0, 0xf0000000); + post_code(0x52); return 0; } -int board_pci_post_scan(struct pci_controller *hose) -{ - int ret; +static const struct dm_pci_ops pci_ivybridge_ops = { + .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config, +}; - ret = bd82x6x_init_pci_devices(); - if (ret) { - printf("bd82x6x_init_pci_devices() failed: %d\n", ret); - return ret; - } +static const struct udevice_id pci_ivybridge_ids[] = { + { .compatible = "intel,pci-ivybridge" }, + { } +}; - return 0; -} +U_BOOT_DRIVER(pci_ivybridge_drv) = { + .name = "pci_ivybridge", + .id = UCLASS_PCI, + .of_match = pci_ivybridge_ids, + .ops = &pci_ivybridge_ops, + .probe = pci_ivybridge_probe, +}; diff --git a/arch/x86/dts/chromebook_link.dts b/arch/x86/dts/chromebook_link.dts index cdbdb68..0a845f2 100644 --- a/arch/x86/dts/chromebook_link.dts +++ b/arch/x86/dts/chromebook_link.dts @@ -200,7 +200,8 @@ }; lpc { - compatible = "intel,lpc"; + reg = <0x0000f800 0 0 0 0>; + compatible = "intel,bd82x6x"; #address-cells = <1>; #size-cells = <1>; gen-dec = <0x800 0xfc 0x900 0xfc>; diff --git a/arch/x86/include/asm/arch-ivybridge/bd82x6x.h b/arch/x86/include/asm/arch-ivybridge/bd82x6x.h index e1d9a9b..5ae32f7 100644 --- a/arch/x86/include/asm/arch-ivybridge/bd82x6x.h +++ b/arch/x86/include/asm/arch-ivybridge/bd82x6x.h @@ -12,7 +12,6 @@ void bd82x6x_sata_enable(pci_dev_t dev, const void *blob, int node); void bd82x6x_pci_init(pci_dev_t dev); void bd82x6x_usb_ehci_init(pci_dev_t dev); void bd82x6x_usb_xhci_init(pci_dev_t dev); -int bd82x6x_init_pci_devices(void); int gma_func0_init(pci_dev_t dev, struct pci_controller *hose, const void *blob, int node); int bd82x6x_init(void); -- cgit v1.1 From ba4575626eddef71b5a8dc26dc4b267918b9438c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 26 Mar 2015 09:29:26 -0600 Subject: dm: x86: spi: Convert ICH SPI driver to driver model Convert this driver over to use driver model. Since all x86 platforms use it, move x86 to use driver model for SPI and SPI flash. Adjust all dependent code and remove the old x86 spi_init() function. Note that this does not make full use of the new PCI uclass as yet. We still scan the bus looking for the device. It should move to finding its details in the device tree. Signed-off-by: Simon Glass --- arch/x86/Kconfig | 9 +++++++++ arch/x86/cpu/ivybridge/mrccache.c | 7 ++++--- arch/x86/cpu/ivybridge/sdram.c | 17 ++++++++++------- arch/x86/include/asm/arch-ivybridge/mrccache.h | 4 ++-- arch/x86/lib/init_helpers.c | 8 -------- 5 files changed, 25 insertions(+), 20 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d171349..b67a899 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -90,6 +90,15 @@ config DM_GPIO config DM_SERIAL default y +config DM_SERIAL + default y + +config DM_SPI + default y + +config DM_SPI_FLASH + default y + config SYS_MALLOC_F_LEN default 0x800 diff --git a/arch/x86/cpu/ivybridge/mrccache.c b/arch/x86/cpu/ivybridge/mrccache.c index 0f1a64b..9205494 100644 --- a/arch/x86/cpu/ivybridge/mrccache.c +++ b/arch/x86/cpu/ivybridge/mrccache.c @@ -105,7 +105,7 @@ static struct mrc_data_container *find_next_mrc_cache(struct fmap_entry *entry, return cache; } -int mrccache_update(struct spi_flash *sf, struct fmap_entry *entry, +int mrccache_update(struct udevice *sf, struct fmap_entry *entry, struct mrc_data_container *cur) { struct mrc_data_container *cache; @@ -135,7 +135,7 @@ int mrccache_update(struct spi_flash *sf, struct fmap_entry *entry, debug("Erasing the MRC cache region of %x bytes at %x\n", entry->length, entry->offset); - ret = spi_flash_erase(sf, entry->offset, entry->length); + ret = spi_flash_erase_dm(sf, entry->offset, entry->length); if (ret) { debug("Failed to erase flash region\n"); return ret; @@ -146,7 +146,8 @@ int mrccache_update(struct spi_flash *sf, struct fmap_entry *entry, /* Write the data out */ offset = (ulong)cache - base_addr + entry->offset; debug("Write MRC cache update to flash at %lx\n", offset); - ret = spi_flash_write(sf, offset, cur->data_size + sizeof(*cur), cur); + ret = spi_flash_write_dm(sf, offset, cur->data_size + sizeof(*cur), + cur); if (ret) { debug("Failed to write to SPI flash\n"); return ret; diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c index 672d069..9a6da37 100644 --- a/arch/x86/cpu/ivybridge/sdram.c +++ b/arch/x86/cpu/ivybridge/sdram.c @@ -89,11 +89,12 @@ void dram_init_banksize(void) } } -static int get_mrc_entry(struct spi_flash **sfp, struct fmap_entry *entry) +static int get_mrc_entry(struct udevice **devp, struct fmap_entry *entry) { const void *blob = gd->fdt_blob; int node, spi_node, mrc_node; int upto; + int ret; /* Find the flash chip within the SPI controller node */ upto = 0; @@ -112,10 +113,13 @@ static int get_mrc_entry(struct spi_flash **sfp, struct fmap_entry *entry) if (fdtdec_read_fmap_entry(blob, mrc_node, "rm-mrc-cache", entry)) return -EINVAL; - if (sfp) { - *sfp = spi_flash_probe_fdt(blob, node, spi_node); - if (!*sfp) - return -EBADF; + if (devp) { + debug("getting sf\n"); + ret = uclass_get_device_by_of_offset(UCLASS_SPI_FLASH, node, + devp); + debug("ret = %d\n", ret); + if (ret) + return ret; } return 0; @@ -246,7 +250,7 @@ static int sdram_save_mrc_data(void) { struct mrc_data_container *data; struct fmap_entry entry; - struct spi_flash *sf; + struct udevice *sf; int ret; if (!gd->arch.mrc_output_len) @@ -266,7 +270,6 @@ static int sdram_save_mrc_data(void) free(data); err_data: - spi_flash_free(sf); err_entry: if (ret) debug("%s: Failed: %d\n", __func__, ret); diff --git a/arch/x86/include/asm/arch-ivybridge/mrccache.h b/arch/x86/include/asm/arch-ivybridge/mrccache.h index 968b2ef..1d50ebb 100644 --- a/arch/x86/include/asm/arch-ivybridge/mrccache.h +++ b/arch/x86/include/asm/arch-ivybridge/mrccache.h @@ -20,7 +20,7 @@ __packed struct mrc_data_container { }; struct fmap_entry; -struct spi_flash; +struct udevice; /** * mrccache_find_current() - find the latest MRC cache record @@ -45,7 +45,7 @@ struct mrc_data_container *mrccache_find_current(struct fmap_entry *entry); * @return 0 if updated, -EEXIST if the record is the same as the latest * record, other error if SPI write failed */ -int mrccache_update(struct spi_flash *sf, struct fmap_entry *entry, +int mrccache_update(struct udevice *sf, struct fmap_entry *entry, struct mrc_data_container *cur); #endif diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 5097ca2..4fd47fc 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -89,11 +89,3 @@ int init_bd_struct_r(void) return 0; } - -int init_func_spi(void) -{ - puts("SPI: "); - spi_init(); - puts("ready\n"); - return 0; -} -- cgit v1.1 From 452f5487536e9d5bf9bb7e515368f6deac7d61f5 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 26 Mar 2015 09:29:27 -0600 Subject: dm: x86: Add a uclass for a Platform Controller Hub Add a simple uclass for this chip which is often found in x86 systems where the CPU is a separate device. The device can have children, so make it scan the device tree for these. Signed-off-by: Simon Glass --- arch/x86/cpu/ivybridge/bd82x6x.c | 9 --------- arch/x86/lib/Makefile | 1 + arch/x86/lib/pch-uclass.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 arch/x86/lib/pch-uclass.c (limited to 'arch/x86') diff --git a/arch/x86/cpu/ivybridge/bd82x6x.c b/arch/x86/cpu/ivybridge/bd82x6x.c index 7b74282..ca8cccf 100644 --- a/arch/x86/cpu/ivybridge/bd82x6x.c +++ b/arch/x86/cpu/ivybridge/bd82x6x.c @@ -157,12 +157,3 @@ U_BOOT_DRIVER(bd82x6x_drv) = { .of_match = bd82x6x_ids, .probe = bd82x6x_probe, }; - -/* - * TODO(sjg@chromium.org): Move this to arch/x86/lib or similar when other - * boards also use a PCH - */ -UCLASS_DRIVER(pch) = { - .id = UCLASS_PCH, - .name = "pch", -}; diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 67a34d8..fe022f6 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o ifndef CONFIG_DM_PCI obj-$(CONFIG_PCI) += pci_type1.o endif +obj-y += pch-uclass.o obj-y += relocate.o obj-y += physmem.o obj-$(CONFIG_X86_RAMTEST) += ramtest.o diff --git a/arch/x86/lib/pch-uclass.c b/arch/x86/lib/pch-uclass.c new file mode 100644 index 0000000..d1082e1 --- /dev/null +++ b/arch/x86/lib/pch-uclass.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2015 Google, Inc + * Written by Simon Glass + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include + +static int pch_uclass_post_bind(struct udevice *bus) +{ + /* + * Scan the device tree for devices + * + * Before relocation, only bind devices marked for pre-relocation + * use. + */ + return dm_scan_fdt_node(bus, gd->fdt_blob, bus->of_offset, + gd->flags & GD_FLG_RELOC ? false : true); +} + +UCLASS_DRIVER(pch) = { + .id = UCLASS_PCH, + .name = "pch", + .post_bind = pch_uclass_post_bind, +}; -- cgit v1.1 From a274e9cac55de3c8ca4e877912a260fb646df38d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 26 Mar 2015 09:29:28 -0600 Subject: dm: x86: Add a uclass for an Low Pin Count (LPC) device On x86 systems this device is commonly used to provide legacy port access. It is sort-of a replacement for the old ISA bus. Add a uclass for this, and allow it to have child devices. Signed-off-by: Simon Glass --- arch/x86/lib/Makefile | 1 + arch/x86/lib/lpc-uclass.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 arch/x86/lib/lpc-uclass.c (limited to 'arch/x86') diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index fe022f6..6c571dd 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_HAVE_FSP) += cmd_hob.o obj-y += gcc.o obj-y += init_helpers.o obj-y += interrupts.o +obj-y += lpc-uclass.o obj-y += cmd_mtrr.o obj-$(CONFIG_SYS_PCAT_INTERRUPTS) += pcat_interrupts.o obj-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o diff --git a/arch/x86/lib/lpc-uclass.c b/arch/x86/lib/lpc-uclass.c new file mode 100644 index 0000000..6aeb4d4 --- /dev/null +++ b/arch/x86/lib/lpc-uclass.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2015 Google, Inc + * Written by Simon Glass + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include + +static int lpc_uclass_post_bind(struct udevice *bus) +{ + /* + * Scan the device tree for devices + * + * Before relocation, only bind devices marked for pre-relocation + * use. + */ + return dm_scan_fdt_node(bus, gd->fdt_blob, bus->of_offset, + gd->flags & GD_FLG_RELOC ? false : true); +} + +UCLASS_DRIVER(lpc) = { + .id = UCLASS_LPC, + .name = "lpc", + .post_bind = lpc_uclass_post_bind, +}; -- cgit v1.1 From 90b16d1491facd55909bdeca1326766dd5d0b925 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 26 Mar 2015 09:29:29 -0600 Subject: x86: chromebook_link: dts: Add PCH and LPC devices The PCH (Platform Controller Hub) is on the PCI bus, so show it as such. The LPC (Low Pin Count) and SPI bus are inside the PCH, so put these in the right place also. Rename the compatible strings to be more descriptive since this board is the only user. Once we are using driver model fully on x86, these will be dropped. Signed-off-by: Simon Glass --- arch/x86/cpu/ivybridge/cpu.c | 2 +- arch/x86/cpu/ivybridge/lpc.c | 13 +++++++- arch/x86/dts/chromebook_link.dts | 70 ++++++++++++++++++++++------------------ 3 files changed, 52 insertions(+), 33 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index 2639ec2..37f3731 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -142,7 +142,7 @@ int arch_cpu_init_dm(void) /* TODO(sjg@chromium.org): Get rid of gd->hose */ gd->hose = hose; - node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_LPC); + node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_PCH); if (node < 0) return -ENOENT; ret = lpc_early_init(gd->fdt_blob, node, PCH_LPC_DEV); diff --git a/arch/x86/cpu/ivybridge/lpc.c b/arch/x86/cpu/ivybridge/lpc.c index c20e180..bc1a0f0 100644 --- a/arch/x86/cpu/ivybridge/lpc.c +++ b/arch/x86/cpu/ivybridge/lpc.c @@ -510,7 +510,7 @@ int lpc_init(struct pci_controller *hose, pci_dev_t dev) pci_write_bar32(hose, dev, 3, 0x800); pci_write_bar32(hose, dev, 4, 0x900); - node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_LPC); + node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_PCH); if (node < 0) return -ENOENT; @@ -568,3 +568,14 @@ void lpc_enable(pci_dev_t dev) writew(0x0010, RCB_REG(DISPBDF)); setbits_le32(RCB_REG(FD2), PCH_ENABLE_DBDF); } + +static const struct udevice_id bd82x6x_lpc_ids[] = { + { .compatible = "intel,bd82x6x-lpc" }, + { } +}; + +U_BOOT_DRIVER(bd82x6x_lpc_drv) = { + .name = "lpc", + .id = UCLASS_LPC, + .of_match = bd82x6x_lpc_ids, +}; diff --git a/arch/x86/dts/chromebook_link.dts b/arch/x86/dts/chromebook_link.dts index 0a845f2..b450c3c 100644 --- a/arch/x86/dts/chromebook_link.dts +++ b/arch/x86/dts/chromebook_link.dts @@ -8,7 +8,7 @@ compatible = "google,link", "intel,celeron-ivybridge"; aliases { - spi0 = "/spi"; + spi0 = "/pci/pch/spi"; }; config { @@ -151,26 +151,6 @@ }; }; - spi { - #address-cells = <1>; - #size-cells = <0>; - compatible = "intel,ich-spi"; - spi-flash@0 { - #size-cells = <1>; - #address-cells = <1>; - reg = <0>; - compatible = "winbond,w25q64", "spi-flash"; - memory-map = <0xff800000 0x00800000>; - rw-mrc-cache { - label = "rw-mrc-cache"; - /* Alignment: 4k (for updating) */ - reg = <0x003e0000 0x00010000>; - type = "wiped"; - wipe-value = [ff]; - }; - }; - }; - pci { compatible = "intel,pci-ivybridge", "pci-x86"; #address-cells = <3>; @@ -199,9 +179,10 @@ intel,pch-backlight = <0x04000000>; }; - lpc { + pch { reg = <0x0000f800 0 0 0 0>; compatible = "intel,bd82x6x"; + u-boot,dm-pre-reloc; #address-cells = <1>; #size-cells = <1>; gen-dec = <0x800 0xfc 0x900 0xfc>; @@ -212,17 +193,44 @@ 1 0 0 0 0 0 0 0>; /* Enable EC SMI source */ intel,alt-gp-smi-enable = <0x0100>; + spi { + #address-cells = <1>; + #size-cells = <0>; + compatible = "intel,ich-spi"; + spi-flash@0 { + #size-cells = <1>; + #address-cells = <1>; + reg = <0>; + compatible = "winbond,w25q64", + "spi-flash"; + memory-map = <0xff800000 0x00800000>; + rw-mrc-cache { + label = "rw-mrc-cache"; + reg = <0x003e0000 0x00010000>; + type = "wiped"; + wipe-value = [ff]; + }; + }; + }; - cros-ec@200 { - compatible = "google,cros-ec"; - reg = <0x204 1 0x200 1 0x880 0x80>; - - /* Describes the flash memory within the EC */ + lpc { + compatible = "intel,bd82x6x-lpc"; #address-cells = <1>; - #size-cells = <1>; - flash@8000000 { - reg = <0x08000000 0x20000>; - erase-value = <0xff>; + #size-cells = <0>; + cros-ec@200 { + compatible = "google,cros-ec"; + reg = <0x204 1 0x200 1 0x880 0x80>; + + /* + * Describes the flash memory within + * the EC + */ + #address-cells = <1>; + #size-cells = <1>; + flash@8000000 { + reg = <0x08000000 0x20000>; + erase-value = <0xff>; + }; }; }; }; -- cgit v1.1 From 58d423b88e5bc1b6e43aa04a05feccd0e737c061 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 31 Mar 2015 12:47:53 +0900 Subject: dm: select CONFIG_DM* options As mentioned in the previous commit, adding default values in each Kconfig causes problems because it does not co-exist with the "depends on" syntax. (Please note this is not a bug of Kconfig.) We should not do so unless we have a special reason. Actually, for CONFIG_DM*, we have no good reason to do so. Generally, CONFIG_DM is not a user-configurable option. Once we convert a driver into Driver Model, the board only works with Driver Model, i.e. CONFIG_DM must be always enabled for that board. So, using "select DM" is more suitable rather than allowing users to modify it. Another good thing is, Kconfig warns unmet dependencies for "select" syntax, so we easily notice bugs. Actually, CONFIG_DM and other related options have been added without consistency: some into arch/*/Kconfig, some into board/*/Kconfig, and some into configs/*_defconfig. This commit prefers "select" and cleans up the following issues. [1] Never use "CONFIG_DM=n" in defconfig files It is really rare to add "CONFIG_FOO=n" to disable CONFIG options. It is more common to use "# CONFIG_FOO is not set". But here, we do not even have to do it. Less than half of OMAP3 boards have been converted to Driver Model. Adding the default values to arch/arm/cpu/armv7/omap3/Kconfig is weird. Instead, add "select DM" only to appropriate boards, which eventually eliminates "CONFIG_DM=n", etc. [2] Delete redundant CONFIGs Sandbox sets CONFIG_DM in arch/sandbox/Kconfig and defines it again in configs/sandbox_defconfig. Likewise, OMAP3 sets CONFIG_DM arch/arm/cpu/armv7/omap3/Kconfig and defines it also in omap3_beagle_defconfig and devkit8000_defconfig. Signed-off-by: Masahiro Yamada --- arch/x86/Kconfig | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index b67a899..6cff14a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -81,18 +81,6 @@ config TARGET_GALILEO endchoice -config DM - default y - -config DM_GPIO - default y - -config DM_SERIAL - default y - -config DM_SERIAL - default y - config DM_SPI default y -- cgit v1.1 From ee2b24340fd1d63a27ac4ed6ac828ade1469dbe7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 2 Mar 2015 17:04:37 -0700 Subject: Kconfig: Move CONFIG_BOOTSTAGE to Kconfig Move CONFIG_BOOT_STAGE and its associated options to Kconfig. Adjust existing users and code. Signed-off-by: Simon Glass --- arch/x86/Kconfig | 9 +++++++++ arch/x86/cpu/cpu.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'arch/x86') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 6cff14a..b44f709 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -465,4 +465,13 @@ config PCIE_ECAM_BASE assigned to PCI devices - i.e. the memory and prefetch regions, as passed to pci_set_region(). +config BOOTSTAGE + default y + +config BOOTSTAGE_REPORT + default y + +config CMD_BOOTSTAGE + default y + endmenu diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index ed7905c..a9ca50b 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -163,7 +163,7 @@ void setup_gdt(gd_t *id, u64 *gdt_addr) int __weak x86_cleanup_before_linux(void) { #ifdef CONFIG_BOOTSTAGE_STASH - bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH, + bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR, CONFIG_BOOTSTAGE_STASH_SIZE); #endif -- cgit v1.1 From 8156345dfec385d3fd394acb7ef9f78aca35f003 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Mar 2015 13:19:02 -0700 Subject: sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig Move this over to Kconfig and tidy up. Signed-off-by: Simon Glass --- arch/x86/Kconfig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch/x86') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index b44f709..3f1401a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -7,6 +7,9 @@ config SYS_ARCH config USE_PRIVATE_LIBGCC default y +config SYS_VSNPRINTF + default y + choice prompt "Target select" -- cgit v1.1