Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ include $(BOARD_DIR)/Makefile.mk
SRC += $(foreach src, $(board-y), $(BOARD_DIR)/$(src))
SRC += $(foreach src, $(keyboard-y), $(KEYBOARD_DIR)/$(src))

# The board will define the embedded controller
# Include the embedded controller's source
EC_DIR=src/ec/$(EC)
INCLUDE += $(EC_DIR)/Makefile.mk
CFLAGS+=-I$(EC_DIR)/include
include $(EC_DIR)/Makefile.mk
SRC += $(foreach src, $(ec-y), $(EC_DIR)/$(src))

# The EC will define the architecture
# The board will define the SoC
include src/soc/Makefile.mk

# The SoC will define the architecture
# Include the architecture's source
ARCH_DIR=src/arch/$(ARCH)
INCLUDE += $(ARCH_DIR)/Makefile.mk
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ uint16_t battery_charger_input_current = CHARGER_INPUT_CURRENT;
#define BATTERY_END_DEFAULT 100

// Flash address to save charging thresholds to
static const uint32_t BAT_CFG_ADDR = CONFIG_EC_FLASH_SIZE - (2 * 1024);
static const uint32_t BAT_CFG_ADDR = CONFIG_SOC_FLASH_SIZE - (2 * 1024);
static const uint16_t BAT_CFG_MAGIC = 0x4254;

struct battery_config {
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/dgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <board/gpio.h>
#include <common/debug.h>
#include <common/macro.h>
#include <ec/i2c.h>
#include <soc/i2c.h>

int16_t dgpu_temp = 0;

Expand Down
6 changes: 3 additions & 3 deletions src/app/main/espi.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <arch/delay.h>
#include <common/debug.h>
#include <common/macro.h>
#include <ec/ecpm.h>
#include <ec/gctrl.h>
#include <ec/gpio.h>
#include <soc/ecpm.h>
#include <soc/gctrl.h>
#include <soc/gpio.h>

#include <8051.h>
#include <stdint.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <app/power.h>
#include <common/debug.h>
#include <common/macro.h>
#include <ec/pwm.h>
#include <soc/pwm.h>

#if CONFIG_PLATFORM_INTEL
#include <app/peci.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/flash/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void flash_write_enable(void);
void flash_entry(uint32_t addr, uint8_t *data, uint32_t length,
uint8_t command) __reentrant __critical {
// Only allow access from 64 KiB to the end of flash.
if ((addr < 0x10000) || (length > 0x10000) || ((addr + length) > CONFIG_EC_FLASH_SIZE))
if ((addr < 0x10000) || (length > 0x10000) || ((addr + length) > CONFIG_SOC_FLASH_SIZE))
return;

if (command == FLASH_COMMAND_READ) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/flash/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (C) 2020 Evan Lojewski

#include <app/flash.h>
#include <ec/scratch.h>
#include <soc/scratch.h>
#include "include/flash/entry.h"
#include <stdint.h>
#include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/ecpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef _APP_ECPM_H
#define _APP_ECPM_H

#include <ec/ecpm.h>
#include <soc/ecpm.h>

void ecpm_init(void);

Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/espi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <stdbool.h>

#include <ec/espi.h>
#include <soc/espi.h>

extern bool espi_host_reset;

Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/gctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef _APP_GCTRL_H
#define _APP_GCTRL_H

#include <ec/gctrl.h>
#include <soc/gctrl.h>

void gctrl_init(void);

Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/kbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <stdbool.h>

#include <ec/kbc.h>
#include <soc/kbc.h>

extern uint8_t kbc_leds;

Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/kbscan.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <stdbool.h>

#include <board/keymap.h>
#include <ec/kbscan.h>
#include <soc/kbscan.h>

// EC config reset key combo: Fn+Esc
extern bool kbscan_fn_held;
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/peci.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef _APP_PECI_H
#define _APP_PECI_H

#include <ec/peci.h>
#include <soc/peci.h>
#include <stdbool.h>

extern bool peci_on;
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/pmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef _APP_PMC_H
#define _APP_PMC_H

#include <ec/pmc.h>
#include <soc/pmc.h>

void pmc_init(void);
bool pmc_sci(struct Pmc *const pmc, uint8_t sci);
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/ps2.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef _APP_PS2_H
#define _APP_PS2_H

#include <ec/ps2.h>
#include <soc/ps2.h>

void ps2_init(void);

Expand Down
2 changes: 1 addition & 1 deletion src/app/main/include/app/smbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef _APP_SMBUS_H
#define _APP_SMBUS_H

#include <ec/smbus.h>
#include <soc/smbus.h>

void smbus_init(void);
int16_t smbus_read(uint8_t address, uint8_t command, uint16_t *const data);
Expand Down
4 changes: 2 additions & 2 deletions src/app/main/kbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <board/keymap.h>
#include <common/debug.h>
#include <common/macro.h>
#include <ec/espi.h>
#include <ec/ps2.h>
#include <soc/espi.h>
#include <soc/ps2.h>

void kbc_init(void) {
// Disable interrupts
Expand Down
6 changes: 3 additions & 3 deletions src/app/main/kbled/bonw14.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <app/kbled.h>
#include <common/debug.h>
#include <ec/i2c.h>
#include <ec/pwm.h>
#include <ec/smbus.h>
#include <soc/i2c.h>
#include <soc/pwm.h>
#include <soc/smbus.h>

void kbled_init(void) {
kbled_kind = KBLED_RGB;
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/kbled/rgb_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <arch/delay.h>
#include <board/gpio.h>
#include <common/macro.h>
#include <ec/i2c.h>
#include <soc/i2c.h>

#define kbled_i2c_get(A, D, L) i2c_get(&KBLED_I2C, 0x68, A, D, L)
#define kbled_i2c_set(A, D, L) i2c_set(&KBLED_I2C, 0x68, A, D, L)
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/kbled/rgb_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <app/kbled.h>
#include <board/gpio.h>
#include <ec/pwm.h>
#include <soc/pwm.h>

void kbled_init(void) {
if (!gpio_get(&RGBKB_DET_N)) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/kbled/white_dac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <app/kbled.h>
#include <common/macro.h>
#include <ec/dac.h>
#include <soc/dac.h>

#if !defined(KBLED_DAC)
#error "KBLED_DAC must be defined"
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bool keymap_fnlock = false;
uint16_t __xdata DYNAMIC_KEYMAP[KM_LAY][KM_OUT][KM_IN];

// Config is in the last sector of flash
const uint32_t CONFIG_ADDR = CONFIG_EC_FLASH_SIZE - 1024;
const uint32_t CONFIG_ADDR = CONFIG_SOC_FLASH_SIZE - 1024;
// Signature is the size of the keymap
const uint16_t CONFIG_SIGNATURE = sizeof(DYNAMIC_KEYMAP);

Expand Down
4 changes: 2 additions & 2 deletions src/app/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <common/debug.h>
#include <common/macro.h>
#include <common/version.h>
#include <ec/ec.h>
#include <soc/soc.h>

#if CONFIG_PLATFORM_INTEL
#include <app/peci.h>
Expand Down Expand Up @@ -58,7 +58,7 @@ uint8_t main_cycle = 0;
void init(void) {
// Must happen first
arch_init();
ec_init();
soc_init();
gctrl_init();
gpio_init();

Expand Down
2 changes: 1 addition & 1 deletion src/app/main/parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <arch/delay.h>
#include <arch/time.h>
#include <common/macro.h>
#include <ec/kbscan.h>
#include <soc/kbscan.h>

#include <stdbool.h>

Expand Down
4 changes: 2 additions & 2 deletions src/app/main/peci.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <board/gpio.h>
#include <common/debug.h>
#include <common/macro.h>
#include <ec/gpio.h>
#include <ec/pwm.h>
#include <soc/gpio.h>
#include <soc/pwm.h>

bool peci_on = false;
int16_t peci_temp = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <board/gpio.h>
#include <common/macro.h>
#include <common/debug.h>
#include <ec/espi.h>
#include <soc/espi.h>

void pmc_init(void) {
*(PMC_1.control) = 0x41;
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/pnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <app/pnp.h>
#include <common/macro.h>
#include <common/debug.h>
#include <ec/espi.h>
#include <soc/espi.h>
#include <stdint.h>

volatile uint8_t __xdata __at(0x1200) IHIOA;
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/power/intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <common/debug.h>

#if CONFIG_BUS_ESPI
#include <ec/espi.h>
#include <app/espi.h>
#include <soc/espi.h>
#endif

#if CONFIG_SECURITY
Expand Down
4 changes: 2 additions & 2 deletions src/app/main/pwm.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <app/pwm.h>
#include <ec/pwm.h>
#include <common/macro.h>
#include <soc/pwm.h>

void pwm_init(void) {
// Set T0CHSEL to TACH0A and T1CHSEL to TACH1A
Expand Down Expand Up @@ -30,7 +30,7 @@ void pwm_init(void) {
FAN2_PWM = 0;
#endif

#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
#if CONFIG_SOC_ITE_IT5570E || CONFIG_SOC_ITE_IT5571E
// Reload counters when they reach 0 instead of immediately
PWMLCCR = 0xFF;
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/app/main/scratch.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <app/fan.h>
#include <app/smfi.h>
#include <common/macro.h>
#include <ec/pwm.h>
#include <ec/scratch.h>
#include <soc/pwm.h>
#include <soc/scratch.h>

#include <8051.h>
#include <stdint.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/smbus.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <app/smbus.h>
#include <ec/i2c.h>
#include <soc/i2c.h>

void smbus_init(void) {
// 9.2 MHz * 4.7 us = 43.24
Expand Down
4 changes: 2 additions & 2 deletions src/app/main/smfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#include <common/command.h>
#include <common/macro.h>
#include <common/version.h>
#include <ec/etwd.h>
#include <ec/pwm.h>
#include <soc/etwd.h>
#include <soc/pwm.h>

#include <stdint.h>
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#endif

#ifdef I2C_DEBUGGER
#include <ec/i2c.h>
#include <soc/i2c.h>
#endif

#ifdef PARALLEL_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/usbpd/tps65987.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <app/power.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/i2c.h>
#include <soc/i2c.h>

#define USBPD_ADDRESS 0x20

Expand Down
2 changes: 1 addition & 1 deletion src/arch/8051/toolchain.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sim: $(BUILD)/ec.rom
$(BUILD)/ec.rom: $(BUILD)/ec.ihx
@echo " OBJCOPY $(subst $(BUILD)/,,$@)"
mkdir -p $(@D)
objcopy -I ihex -O binary --gap-fill=0xFF --pad-to=$(CONFIG_EC_FLASH_SIZE) $< $@
objcopy -I ihex -O binary --gap-fill=0xFF --pad-to=$(CONFIG_SOC_FLASH_SIZE) $< $@

# Link object files into Intel Hex file
$(BUILD)/ec.ihx: $(OBJ)
Expand Down
5 changes: 2 additions & 3 deletions src/board/system76/addw1/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
board-y += board.c
board-y += gpio.c

EC = ite
CONFIG_EC_ITE_IT8587E = y
CONFIG_EC_FLASH_SIZE_128K = y
CONFIG_SOC_ITE_IT8587E = y
CONFIG_SOC_FLASH_SIZE_128K = y

# Intel-based host
CONFIG_PLATFORM_INTEL = y
Expand Down
2 changes: 1 addition & 1 deletion src/board/system76/addw1/include/board/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef _BOARD_GPIO_H
#define _BOARD_GPIO_H

#include <ec/gpio.h>
#include <soc/gpio.h>

void gpio_init(void);

Expand Down
5 changes: 2 additions & 3 deletions src/board/system76/addw2/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
board-y += board.c
board-y += gpio.c

EC = ite
CONFIG_EC_ITE_IT5570E = y
CONFIG_EC_FLASH_SIZE_128K = y
CONFIG_SOC_ITE_IT5570E = y
CONFIG_SOC_FLASH_SIZE_128K = y

# Intel-based host
CONFIG_PLATFORM_INTEL = y
Expand Down
Loading