From a15b3f4f44ff76b7c8baec2a3deca38cf8b2a673 Mon Sep 17 00:00:00 2001 From: Manoharan Vijaya Raghavan Date: Mon, 29 Feb 2016 13:33:08 +0530 Subject: [PATCH] qca: ipq807x: Adding support for IPQ807x Added config, dts and initial board support code for ipq807x Change-Id: If624f806c65467900165781d9b32a6c060990418 Signed-off-by: Manoharan Vijaya Raghavan --- arch/arm/Kconfig | 8 + arch/arm/cpu/armv7/cache_v7.c | 1 + arch/arm/dts/Makefile | 3 + arch/arm/dts/ipq807x-hk01.dts | 24 +++ arch/arm/dts/ipq807x-hk01.dtsi | 24 +++ board/ipq807x/Kconfig | 12 ++ board/qca/ipq807x/Makefile | 3 + board/qca/ipq807x/ipq807x.c | 53 ++++++ board/qca/ipq807x/ipq807x.h | 20 +++ configs/ipq807x_defconfig | 300 +++++++++++++++++++++++++++++++++ drivers/serial/Makefile | 1 + include/configs/ipq807x.h | 109 ++++++++++++ 12 files changed, 558 insertions(+) create mode 100644 arch/arm/dts/ipq807x-hk01.dts create mode 100644 arch/arm/dts/ipq807x-hk01.dtsi create mode 100644 board/ipq807x/Kconfig create mode 100644 board/qca/ipq807x/Makefile create mode 100644 board/qca/ipq807x/ipq807x.c create mode 100644 board/qca/ipq807x/ipq807x.h create mode 100644 configs/ipq807x_defconfig create mode 100644 include/configs/ipq807x.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9bd6cf1d80..b0281cc575 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -421,6 +421,13 @@ config ARCH_EXYNOS select DM_GPIO select DM_KEYBOARD +config ARCH_IPQ807x + bool "QCA, IPQ807x" + select DM + select DM_SERIAL + select CPU_V7 + select SYS_GENERIC_BOARD + config ARCH_S5PC1XX bool "Samsung S5PC1XX" select CPU_V7 @@ -808,6 +815,7 @@ source "board/gumstix/pepper/Kconfig" source "board/h2200/Kconfig" source "board/hisilicon/hikey/Kconfig" source "board/imx31_phycore/Kconfig" +source "board/ipq807x/Kconfig" source "board/isee/igep0033/Kconfig" source "board/maxbcm/Kconfig" source "board/mpl/vcma9/Kconfig" diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c index a5aa4fa643..f3890f4ba6 100644 --- a/arch/arm/cpu/armv7/cache_v7.c +++ b/arch/arm/cpu/armv7/cache_v7.c @@ -197,6 +197,7 @@ static void v7_dcache_maint_range(u32 start, u32 stop, u32 range_op) { u32 line_len, ccsidr; + set_csselr(0, ARMV7_CSSELR_IND_DATA_UNIFIED); ccsidr = get_ccsidr(); line_len = ((ccsidr & CCSIDR_LINE_SIZE_MASK) >> CCSIDR_LINE_SIZE_OFFSET) + 2; diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 0bcd316375..88686efe88 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -19,6 +19,9 @@ dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \ exynos5420-peach-pit.dtb \ exynos5800-peach-pi.dtb \ exynos5422-odroidxu3.dtb + +dtb-$(CONFIG_ARCH_IPQ807x) += ipq807x-hk01.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += \ rk3288-firefly.dtb \ rk3288-jerry.dtb \ diff --git a/arch/arm/dts/ipq807x-hk01.dts b/arch/arm/dts/ipq807x-hk01.dts new file mode 100644 index 0000000000..518fbff0e2 --- /dev/null +++ b/arch/arm/dts/ipq807x-hk01.dts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +#include "ipq807x-hk01.dtsi" +/ { + model ="QCA, IPQ807x-HK01"; + compatible = "qca,ipq807x", "qca,ipq807x-hk01"; + + aliases { + console = "/serial@78b0000"; + }; +}; + diff --git a/arch/arm/dts/ipq807x-hk01.dtsi b/arch/arm/dts/ipq807x-hk01.dtsi new file mode 100644 index 0000000000..ba70dfaa45 --- /dev/null +++ b/arch/arm/dts/ipq807x-hk01.dtsi @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "skeleton.dtsi" + +/ { + + serial@78b0000 { + compatible = "qca,ipq-uartdm"; + reg = <0x78b0000 0x200>; + id = <2>; + }; +}; + diff --git a/board/ipq807x/Kconfig b/board/ipq807x/Kconfig new file mode 100644 index 0000000000..ed3fb34b36 --- /dev/null +++ b/board/ipq807x/Kconfig @@ -0,0 +1,12 @@ +config SYS_CPU + default "ipq807x" + +config SYS_BOARD + default "ipq807x" + +config SYS_VENDOR + default "qca" + +config SYS_CONFIG_NAME + default "ipq807x" + diff --git a/board/qca/ipq807x/Makefile b/board/qca/ipq807x/Makefile new file mode 100644 index 0000000000..d4cc6cc2d6 --- /dev/null +++ b/board/qca/ipq807x/Makefile @@ -0,0 +1,3 @@ + +obj-y := ipq807x.o + diff --git a/board/qca/ipq807x/ipq807x.c b/board/qca/ipq807x/ipq807x.c new file mode 100644 index 0000000000..51406e1a73 --- /dev/null +++ b/board/qca/ipq807x/ipq807x.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include + +#include "ipq807x.h" + +DECLARE_GLOBAL_DATA_PTR; + +void enable_caches(void) +{ + icache_enable(); +} + +void disable_caches(void) +{ + icache_disable(); +} + + +int board_init(void) +{ + return 0; +} + +int dram_init(void) +{ + gd->ram_size = CONFIG_SYS_SDRAM_SIZE; + return 0; +} + +unsigned long timer_read_counter(void) +{ + return 0; +} + +void reset_cpu(unsigned long a) +{ + while(1); +} diff --git a/board/qca/ipq807x/ipq807x.h b/board/qca/ipq807x/ipq807x.h new file mode 100644 index 0000000000..0c9c619359 --- /dev/null +++ b/board/qca/ipq807x/ipq807x.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _IPQ807X_H_ +#define _IPQ807X_H_ + +#include +#include + +#endif /* _IPQ807X_H_ */ diff --git a/configs/ipq807x_defconfig b/configs/ipq807x_defconfig new file mode 100644 index 0000000000..4352a7b3d1 --- /dev/null +++ b/configs/ipq807x_defconfig @@ -0,0 +1,300 @@ +CONFIG_ARM=y +CONFIG_HAS_VBAR=y +CONFIG_CPU_V7=y +CONFIG_ARCH_IPQ807x=y +CONFIG_SYS_MALLOC_F_LEN=0x400 +CONFIG_SYS_MALLOC_F=y +CONFIG_DM_SERIAL=y +CONFIG_DEFAULT_DEVICE_TREE="" +CONFIG_LOCALVERSION="" +CONFIG_LOCALVERSION_AUTO=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_EXPERT=y +CONFIG_SYS_MALLOC_CLEAR_ON_INIT=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +# CONFIG_FIT_SIGNATURE is not set +CONFIG_SYS_EXTRA_OPTIONS="" +CONFIG_SYS_PROMPT="IPQ807x# " + +# +# Commands +# + +# +# Info commands +# +CONFIG_CMD_BDI=y +CONFIG_CMD_CONSOLE=y + +# +# Boot commands +# +# CONFIG_CMD_BOOTD is not set +CONFIG_CMD_BOOTM=y +CONFIG_CMD_GO=y +# CONFIG_CMD_RUN is not set +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set + +# +# Environment commands +# +CONFIG_CMD_EXPORTENV=y +CONFIG_CMD_IMPORTENV=y +CONFIG_CMD_EDITENV=y +CONFIG_CMD_SAVEENV=y +CONFIG_CMD_ENV_EXISTS=y + +# +# Memory commands +# +CONFIG_CMD_MEMORY=y +CONFIG_CMD_CRC32=y +# CONFIG_LOOPW is not set +# CONFIG_CMD_MEMTEST is not set +# CONFIG_CMD_MX_CYCLIC is not set +# CONFIG_CMD_MEMINFO is not set + +# +# Device access commands +# +CONFIG_CMD_DM=y +# CONFIG_CMD_DEMO is not set +CONFIG_CMD_LOADB=y +CONFIG_CMD_LOADS=y +CONFIG_CMD_FLASH=y +# CONFIG_CMD_NAND is not set +# CONFIG_CMD_SF is not set +# CONFIG_CMD_SPI is not set +# CONFIG_CMD_I2C is not set +# CONFIG_CMD_USB is not set +CONFIG_CMD_FPGA=y + +# +# Shell scripting commands +# +CONFIG_CMD_ECHO=y +CONFIG_CMD_ITEST=y +CONFIG_CMD_SOURCE=y +CONFIG_CMD_SETEXPR=y + +# +# Network commands +# +CONFIG_CMD_NET=y +# CONFIG_CMD_TFTPPUT is not set +# CONFIG_CMD_TFTPSRV is not set +# CONFIG_CMD_RARP is not set +# CONFIG_CMD_DHCP is not set +CONFIG_CMD_NFS=y +# CONFIG_CMD_PING is not set +# CONFIG_CMD_CDP is not set +# CONFIG_CMD_SNTP is not set +# CONFIG_CMD_DNS is not set +# CONFIG_CMD_LINK_LOCAL is not set + +# +# Misc commands +# +# CONFIG_CMD_TIME is not set +CONFIG_CMD_MISC=y +# CONFIG_CMD_TIMER is not set + +# +# Boot timing +# +# CONFIG_BOOTSTAGE is not set +CONFIG_BOOTSTAGE_USER_COUNT=20 +CONFIG_BOOTSTAGE_STASH_ADDR=0 +CONFIG_BOOTSTAGE_STASH_SIZE=4096 + +# +# Power commands +# + +# +# Security commands +# +CONFIG_SUPPORT_OF_CONTROL=y + +# +# Device Tree Control +# +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y +# CONFIG_OF_EMBED is not set +CONFIG_NET=y +# CONFIG_NET_RANDOM_ETHADDR is not set +# CONFIG_NETCONSOLE is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_DM=y +CONFIG_DM_WARN=y +CONFIG_DM_DEVICE_REMOVE=y +CONFIG_DM_STDIO=y +CONFIG_DM_SEQ_ALIAS=y +# CONFIG_REGMAP is not set +# CONFIG_DEVRES is not set +CONFIG_SIMPLE_BUS=y +# CONFIG_CLK is not set +# CONFIG_CPU is not set + +# +# Hardware crypto devices +# +# CONFIG_FSL_CAAM is not set + +# +# Demo for driver model +# +# CONFIG_DM_DEMO is not set + +# +# DFU support +# +# CONFIG_DFU_TFTP is not set + +# +# GPIO Support +# +# CONFIG_LPC32XX_GPIO is not set +# CONFIG_VYBRID_GPIO is not set + +# +# I2C support +# +# CONFIG_DM_I2C_COMPAT is not set +# CONFIG_CROS_EC_KEYB is not set + +# +# LED Support +# +# CONFIG_LED is not set + +# +# Multifunction device drivers +# +# CONFIG_CROS_EC is not set +# CONFIG_FSL_SEC_MON is not set +# CONFIG_PCA9551_LED is not set +# CONFIG_RESET is not set + +# +# MMC Host controller Support +# +# CONFIG_DM_MMC is not set + +# +# NAND Device Support +# +# CONFIG_NAND_DENALI is not set +# CONFIG_NAND_VF610_NFC is not set +# CONFIG_NAND_PXA3XX is not set + +# +# Generic NAND options +# + +# +# SPI Flash Support +# +# CONFIG_SPI_FLASH is not set +# CONFIG_DM_ETH is not set +# CONFIG_PHYLIB is not set +# CONFIG_NETDEVICES is not set + +# +# PCI +# +# CONFIG_DM_PCI is not set + +# +# Pin controllers +# +# CONFIG_PINCTRL is not set + +# +# Power +# +# CONFIG_DM_PMIC is not set +# CONFIG_DM_REGULATOR is not set +# CONFIG_RAM is not set + +# +# Real Time Clock +# +# CONFIG_DM_RTC is not set + +# +# Serial drivers +# +CONFIG_REQUIRE_SERIAL_CONSOLE=y +# CONFIG_DEBUG_UART is not set + +# +# Sound support +# +# CONFIG_SOUND is not set + +# +# SPI Support +# +# CONFIG_FSL_ESPI is not set +# CONFIG_TI_QSPI is not set +# CONFIG_DM_THERMAL is not set + +# +# TPM support +# +# CONFIG_USB is not set + +# +# Graphics support +# +# CONFIG_VIDEO_VESA is not set +# CONFIG_VIDEO_LCD_ANX9804 is not set +# CONFIG_VIDEO_LCD_SSD2828 is not set +# CONFIG_DISPLAY_PORT is not set +# CONFIG_VIDEO_TEGRA124 is not set +# CONFIG_VIDEO_BRIDGE is not set +# CONFIG_PHYS_TO_BUS is not set + +# +# File systems +# + +# +# Library routines +# +# CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED is not set +CONFIG_HAVE_PRIVATE_LIBGCC=y +# CONFIG_USE_PRIVATE_LIBGCC is not set +CONFIG_SYS_HZ=1000 +# CONFIG_SYS_VSNPRINTF is not set +CONFIG_REGEX=y +# CONFIG_LIB_RAND is not set +# CONFIG_CMD_DHRYSTONE is not set +# CONFIG_RSA is not set +# CONFIG_TPM is not set + +# +# Hashing Support +# +# CONFIG_SHA1 is not set +# CONFIG_SHA256 is not set +# CONFIG_SHA_HW_ACCEL is not set + +# +# Compression Support +# +# CONFIG_LZ4 is not set +# CONFIG_ERRNO_STR is not set +# CONFIG_UNIT_TEST is not set diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index dd871478ea..7e6cc5cba0 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -5,6 +5,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_ARCH_IPQ807x_SERIAL) += qcom_uart.o ifdef CONFIG_DM_SERIAL obj-y += serial-uclass.o obj-$(CONFIG_PL01X_SERIAL) += serial_pl01x.o diff --git a/include/configs/ipq807x.h b/include/configs/ipq807x.h new file mode 100644 index 0000000000..65f5904faa --- /dev/null +++ b/include/configs/ipq807x.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _IPQCDP_H +#define _IPQCDP_H + +#ifndef DO_DEPS_ONLY +#include +#endif + +/* + * Disabled for actual chip. + * #define CONFIG_RUMI + */ + +#define CONFIG_SYS_NO_FLASH +#define CONFIG_SYS_CACHELINE_SIZE 64 + +#define CONFIG_IPQ807X_UART +#define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SKIP_LOWLEVEL_INIT + +#define CONFIG_SYS_BOOTM_LEN 0x1000000 + +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_SIZE_MAX (256 << 10) /* 256 KB */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE_MAX + (256 << 10)) + +#define CONFIG_ENV_IS_NOWHERE 1 +/* + * Size of malloc() pool + */ + +#define CONFIG_SYS_TIMER_RATE 32768 + +/* + * select serial console configuration + */ +#define CONFIG_CONS_INDEX 1 + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ + 115200} + +#define CONFIG_SYS_CBSIZE (512 * 2) /* Console I/O Buffer Size */ + +/* + + svc_sp --> -------------- + irq_sp --> | | + fiq_sp --> | | + bd --> | | + gd --> | | + pgt --> | | + malloc --> | | + text_base --> |------------| +*/ + +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE -\ + CONFIG_SYS_MALLOC_LEN - CONFIG_ENV_SIZE -\ + GENERATED_BD_INFO_SIZE) + +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) + +#define CONFIG_SYS_SDRAM_BASE 0x80000000 +#define CONFIG_SYS_TEXT_BASE 0x87300000 +#define CONFIG_SYS_SDRAM_SIZE 0x10000000 +#define CONFIG_MAX_RAM_BANK_SIZE CONFIG_SYS_SDRAM_SIZE +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + (64 << 20)) + +/* + * U-Boot Env Configs + */ +#define CONFIG_OF_LIBFDT 1 + +/* NSS firmware loaded using bootm */ +#define CONFIG_BOOTCOMMAND "bootm" +#define CONFIG_BOOTARGS "console=ttyMSM0,115200n8" + +#define CONFIG_BOOTDELAY 2 + + +#define CONFIG_CMD_BOOTZ + +/* L1 cache line size is 64 bytes, L2 cache line size is 128 bytes + * Cache flush and invalidation based on L1 cache, so the cache line + * size is configured to 64 */ +#define CONFIG_SYS_CACHELINE_SIZE 64 +/*#define CONFIG_SYS_DCACHE_OFF*/ + +/* Enabling this flag will report any L2 errors. + * By default we are disabling it */ +/*#define CONFIG_IPQ_REPORT_L2ERR*/ + +#endif /* _IPQCDP_H */ +