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 <akilan@codeaurora.org>
This commit is contained in:
Akila N 2016-08-12 14:29:31 +05:30
parent c47af78ae2
commit e7aaad5e69
9 changed files with 18 additions and 149 deletions

View file

@ -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/

View file

@ -1,3 +0,0 @@
config ARCH_IPQ40xx
bool "QCA IPQ40xx SPECIFIC IPs"

View file

@ -1,3 +0,0 @@
ccflags-y += -I$(srctree)/board/qca/ipq40xx/
obj-y += gpio.o

View file

@ -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 <asm/arch-qcom-common/iomap.h>
#include <asm/arch-qcom-common/gpio.h>
#include <asm/io.h>
/*******************************************************
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);
}

View file

@ -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*/

View file

@ -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*/

View file

@ -15,11 +15,11 @@
#define ___QCA_COMMON_H_
#include <asm/u-boot.h>
#ifdef CONFIG_IPQ807x_I2C
#ifdef CONFIG_IPQ807x
#include <asm/arch-ipq807x/clk.h>
#endif
#ifdef CONFIG_IPQ40XX_I2C
#ifdef CONFIG_IPQ40xx
#include <asm/arch-ipq40xx/clk.h>
#endif

View file

@ -18,7 +18,6 @@
#include <environment.h>
#include <configs/ipq40xx.h>
#include "ipq40xx.h"
#include "ipq40xx_board_param.h"
#include <nand.h>
#include <part.h>
#include <asm/arch-qcom-common/smem.h>
@ -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);

View file

@ -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