From e7aaad5e69bd8a0ce4e36f2ef04c0ed0d046f108 Mon Sep 17 00:00:00 2001 From: Akila N Date: Fri, 12 Aug 2016 14:29:31 +0530 Subject: [PATCH] ipq40xx: Eliminate use of gboard_param This change eliminates the use of gboard_param variable. Subsequent changes will make use of dts. Change-Id: Ic79a72c4fa1b86e864b55306a32c110bcfbc9184 Signed-off-by: Akila N --- arch/arm/cpu/armv7/Makefile | 1 - arch/arm/cpu/armv7/qca/ipq40xx/Kconfig | 3 - arch/arm/cpu/armv7/qca/ipq40xx/Makefile | 3 - arch/arm/cpu/armv7/qca/ipq40xx/gpio.c | 88 ------------------- arch/arm/include/asm/arch-ipq40xx/clk.h | 6 +- arch/arm/include/asm/arch-ipq807x/clk.h | 6 +- .../include/asm/arch-qcom-common/qca_common.h | 4 +- board/qca/ipq40xx/ipq40xx.c | 55 +++--------- board/qca/ipq40xx/ipq40xx.h | 1 - 9 files changed, 18 insertions(+), 149 deletions(-) delete mode 100644 arch/arm/cpu/armv7/qca/ipq40xx/Kconfig delete mode 100644 arch/arm/cpu/armv7/qca/ipq40xx/Makefile delete mode 100644 arch/arm/cpu/armv7/qca/ipq40xx/gpio.c diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile index 57538dadf8..ab75abfec9 100644 --- a/arch/arm/cpu/armv7/Makefile +++ b/arch/arm/cpu/armv7/Makefile @@ -49,7 +49,6 @@ obj-$(CONFIG_OMAP34XX) += omap3/ obj-$(CONFIG_OMAP44XX) += omap4/ obj-$(CONFIG_OMAP54XX) += omap5/ obj-$(CONFIG_QCA_COMMON) += qca/common/ -obj-$(CONFIG_ARCH_IPQ40xx) += qca/ipq40xx/ obj-$(CONFIG_ARCH_IPQ806x) += qca/ipq806x/ obj-$(CONFIG_RMOBILE) += rmobile/ obj-$(if $(filter stv0991,$(SOC)),y) += stv0991/ diff --git a/arch/arm/cpu/armv7/qca/ipq40xx/Kconfig b/arch/arm/cpu/armv7/qca/ipq40xx/Kconfig deleted file mode 100644 index 54c893aa98..0000000000 --- a/arch/arm/cpu/armv7/qca/ipq40xx/Kconfig +++ /dev/null @@ -1,3 +0,0 @@ -config ARCH_IPQ40xx - bool "QCA IPQ40xx SPECIFIC IPs" - diff --git a/arch/arm/cpu/armv7/qca/ipq40xx/Makefile b/arch/arm/cpu/armv7/qca/ipq40xx/Makefile deleted file mode 100644 index 555d61fb72..0000000000 --- a/arch/arm/cpu/armv7/qca/ipq40xx/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ccflags-y += -I$(srctree)/board/qca/ipq40xx/ - -obj-y += gpio.o diff --git a/arch/arm/cpu/armv7/qca/ipq40xx/gpio.c b/arch/arm/cpu/armv7/qca/ipq40xx/gpio.c deleted file mode 100644 index 3732ec7be1..0000000000 --- a/arch/arm/cpu/armv7/qca/ipq40xx/gpio.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * - * Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - *     * Redistributions of source code must retain the above copyright - *       notice, this list of conditions and the following disclaimer. - *     * Redistributions in binary form must reproduce the above - *       copyright notice, this list of conditions and the following - *       disclaimer in the documentation and/or other materials provided - *       with the distribution. - *     * Neither the name of The Linux Foundation nor the names of its - *       contributors may be used to endorse or promote products derived - *       from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include - -/******************************************************* -Function description: configure GPIO functinality -Arguments : -unsigned int gpio - Gpio number -unsigned int func - Functionality number -unsigned int dir - direction 0- i/p, 1- o/p -unsigned int pull - pull up/down, no pull range(0-3) -unsigned int drvstr - range (0 - 7)-> (2- 16)MA steps of 2 -unsigned int oe - 0 - Disable, 1- Enable. - -Return : None -*******************************************************/ - - -void gpio_tlmm_config(unsigned int gpio, unsigned int func, - unsigned int out, unsigned int pull, - unsigned int drvstr, unsigned int oe, - unsigned int gpio_vm, unsigned int gpio_od_en, - unsigned int gpio_pu_res) -{ - unsigned int val = 0; - val |= pull; - val |= func << 2; - val |= drvstr << 6; - val |= oe << 9; - val |= gpio_vm << 11; - val |= gpio_od_en << 12; - val |= gpio_pu_res << 13; - - unsigned int *addr = (unsigned int *)GPIO_CONFIG_ADDR(gpio); - writel(val, addr); - - /* Output value is only relevant if GPIO has been configured for fixed - * output setting - i.e. func == 0 */ - if (func == 0) { - addr = (unsigned int *)GPIO_IN_OUT_ADDR(gpio); - val = readl(addr); - val |= out << 1; - writel(val, addr); - } - - return; -} - -void gpio_set_value(unsigned int gpio, unsigned int out) -{ - unsigned int *addr = (unsigned int *)GPIO_IN_OUT_ADDR(gpio); - unsigned int val = 0; - - val = readl(addr); - val &= ~(0x2); - val |= out << 1; - writel(val, addr); -} diff --git a/arch/arm/include/asm/arch-ipq40xx/clk.h b/arch/arm/include/asm/arch-ipq40xx/clk.h index 20e90e7cb4..c0bd23ce27 100644 --- a/arch/arm/include/asm/arch-ipq40xx/clk.h +++ b/arch/arm/include/asm/arch-ipq40xx/clk.h @@ -11,8 +11,8 @@ * GNU General Public License for more details. */ -#ifndef QCA_CLK_H -#define QCA_CLK_H +#ifndef IPQ40XX_CLK_H +#define IPQ40XX_CLK_H #define MMC_IDENTIFY_MODE 0 #define MMC_DATA_TRANSFER_MODE 1 @@ -96,4 +96,4 @@ void i2c0_configure_mux(void); int pcie_clock_enable(int clk_addr); void pcie_clock_disable(int clk_addr); -#endif /*QCA_CLK_H*/ +#endif /*IPQ40XX_CLK_H*/ diff --git a/arch/arm/include/asm/arch-ipq807x/clk.h b/arch/arm/include/asm/arch-ipq807x/clk.h index 0c4ebfac94..e430e84157 100644 --- a/arch/arm/include/asm/arch-ipq807x/clk.h +++ b/arch/arm/include/asm/arch-ipq807x/clk.h @@ -11,12 +11,12 @@ * GNU General Public License for more details. */ -#ifndef QCA_CLK_H -#define QCA_CLK_H +#ifndef IPQ807X_CLK_H +#define IPQ807X_CLK_H /* I2C clocks configuration */ #ifdef CONFIG_IPQ807x_I2C void i2c_clock_config(void); #endif -#endif /*QCA_CLK_H*/ +#endif /*IPQ807X_CLK_H*/ diff --git a/arch/arm/include/asm/arch-qcom-common/qca_common.h b/arch/arm/include/asm/arch-qcom-common/qca_common.h index 1897c8d67c..78ef1704bb 100644 --- a/arch/arm/include/asm/arch-qcom-common/qca_common.h +++ b/arch/arm/include/asm/arch-qcom-common/qca_common.h @@ -15,11 +15,11 @@ #define ___QCA_COMMON_H_ #include -#ifdef CONFIG_IPQ807x_I2C +#ifdef CONFIG_IPQ807x #include #endif -#ifdef CONFIG_IPQ40XX_I2C +#ifdef CONFIG_IPQ40xx #include #endif diff --git a/board/qca/ipq40xx/ipq40xx.c b/board/qca/ipq40xx/ipq40xx.c index b9828f7982..7ee92f03d9 100644 --- a/board/qca/ipq40xx/ipq40xx.c +++ b/board/qca/ipq40xx/ipq40xx.c @@ -18,7 +18,6 @@ #include #include #include "ipq40xx.h" -#include "ipq40xx_board_param.h" #include #include #include @@ -74,7 +73,6 @@ extern char *mmc_env_name_spec; * Moral of the story: Global variables that are written before * relocate_code() gets executed cannot be in '.bss' */ -board_ipq40xx_params_t *gboard_param = (board_ipq40xx_params_t *)0xbadb0ad; #define DLOAD_DISABLE 0x1 #define RESERVE_ADDRESS_START 0x87B00000 /*TZAPPS, SMEM and TZ Regions */ @@ -86,25 +84,16 @@ board_ipq40xx_params_t *gboard_param = (board_ipq40xx_params_t *)0xbadb0ad; #define SCM_CMD_TZ_FORCE_DLOAD_ID 0x10 #define BOOT_VERSION 0 #define TZ_VERSION 1 -/******************************************************* - Function description: Board specific initialization. - I/P : None - O/P : integer, 0 - no error. -********************************************************/ - -static board_ipq40xx_params_t *get_board_param(unsigned int machid) +/* To get board params from Device Tree (to be implemented) */ +static unsigned int is_spi_nand_available (void) { - unsigned int index; + return 0; /* hard coded since no device tree entry */ +} - printf("machid: %x\n", machid); - for (index = 0; index < NUM_IPQ40XX_BOARDS; index++) { - if (machid == board_params[index].machid) - return &board_params[index]; - } - BUG_ON(index == NUM_IPQ40XX_BOARDS); - printf("cdp: Invalid machine id 0x%x\n", machid); - for (;;); +static unsigned int is_nor_nand_available (void) +{ + return 0; } int env_init(void) @@ -161,7 +150,6 @@ int board_init(void) gd->bd->bi_boot_params = QCA_BOOT_PARAMS_ADDR; gd->bd->bi_arch_number = smem_get_board_platform_type(); - gboard_param = get_board_param(gd->bd->bi_arch_number); ret = smem_get_boot_flash(&sfi->flash_type, &sfi->flash_index, @@ -292,8 +280,6 @@ int board_late_init(void) void qca_serial_init(struct ipq_serial_platdata *plat) { - qca_configure_gpio(gboard_param->console_uart_cfg->dbg_uart_gpio, - NO_OF_DBG_UART_GPIOS); writel(1, GCC_BLSP1_UART1_APPS_CBCR); } /* @@ -304,8 +290,6 @@ void qca_serial_init(struct ipq_serial_platdata *plat) */ int board_early_init_f(void) { - /*Retrieve the machid of the board from smem*/ - gboard_param = get_board_param(smem_get_board_platform_type()); return 0; } @@ -348,9 +332,6 @@ int dram_init(void) gd->ram_size += rtable.parts[i].size; } } - gboard_param->ddr_size = gd->ram_size; - } else { - gd->ram_size = gboard_param->ddr_size; } return 0; } @@ -392,13 +373,6 @@ void board_nand_init(void) config.nand_base = nand_base; config.ee = QPIC_NAND_EE; config.max_desc_len = QPIC_NAND_MAX_DESC_LEN; - - gpio = gboard_param->nand_gpio; - if (gpio) { - qca_configure_gpio(gpio, - gboard_param->nand_gpio_count); - } - qpic_nand_init(&config); } @@ -412,9 +386,6 @@ void qca_configure_gpio(gpio_func_data_t *gpio, uint count) int i; for (i = 0; i < count; i++) { - gpio_tlmm_config(gpio->gpio, gpio->func, gpio->out, - gpio->pull, gpio->drvstr, gpio->oe, - gpio->gpio_vm, gpio->gpio_od_en, gpio->gpio_pu_res); gpio++; } } @@ -586,7 +557,7 @@ void ipq_fdt_fixup_mtdparts(void *blob, struct flash_node_info *ni) int ft_board_setup(void *blob, bd_t *bd) { u64 memory_start = CONFIG_SYS_SDRAM_BASE; - u64 memory_size = gboard_param->ddr_size; + u64 memory_size = gd->ram_size; char *mtdparts = NULL; char parts_str[4096]; qca_smem_flash_info_t *sfi = &qca_smem_flash_info; @@ -609,12 +580,12 @@ int ft_board_setup(void *blob, bd_t *bd) /* Patch NOR block size and density for * generic probe case */ ipq_fdt_fixup_spi_nor_params(blob); - if (gboard_param->spi_nand_available && + if (is_spi_nand_available() && get_which_flash_param("rootfs") == 0) { sprintf(parts_str, "mtdparts=nand1:0x%x@0(rootfs);spi0.0", IPQ_NAND_ROOTFS_SIZE); - } else if (gboard_param->nor_nand_available && + } else if (is_nor_nand_available() && get_which_flash_param("rootfs") == 0) { sprintf(parts_str, "mtdparts=nand0:0x%x@0(rootfs);spi0.0", @@ -682,12 +653,6 @@ int board_mmc_init(bd_t *bis) int ret; qca_smem_flash_info_t *sfi = &qca_smem_flash_info; - if (!gboard_param->mmc_gpio_count) - return 0; - - qca_configure_gpio(gboard_param->mmc_gpio, - gboard_param->mmc_gpio_count); - mmc_host.base = MSM_SDC1_BASE; mmc_host.clk_mode = MMC_IDENTIFY_MODE; emmc_clock_config(mmc_host.clk_mode); diff --git a/board/qca/ipq40xx/ipq40xx.h b/board/qca/ipq40xx/ipq40xx.h index a262c16c53..fe953a138a 100644 --- a/board/qca/ipq40xx/ipq40xx.h +++ b/board/qca/ipq40xx/ipq40xx.h @@ -136,7 +136,6 @@ typedef enum { SMEM_MAX_SIZE = SMEM_PARTITION_TABLE_OFFSET + 1, } smem_mem_type_t; -extern board_ipq40xx_params_t *gboard_param; unsigned int get_board_index(unsigned int machid); void qca_configure_gpio(gpio_func_data_t *gpio, uint count); #endif