ipq5018: Tiny U-boot: Remove nor from MTD

This code changes remove initializing nor as sudo NAND in mtd
framework and add sf command support to read from ART partition

Signed-off-by: Vandhiadevan Karunamoorthy <vkarunam@codeaurora.org>
Change-Id: I39a27a72d9ab966f95d58adb4274660e147df67c
This commit is contained in:
Vandhiadevan Karunamoorthy 2020-04-28 16:15:57 +05:30
parent dc75984fcc
commit f5f074b49e
5 changed files with 37 additions and 1 deletions

View file

@ -36,5 +36,10 @@ config QPIC_SERIAL
config IPQ_TINY
bool "Enable Tiny support for ipq5018"
endif
config IPQ_MTD_NOR
bool "Register nor in MTD framework for ipq5018"
config IPQ_TINY_SPI_NOR
bool "This config helps to update spi-nor related updated in ipq5018"
endif

View file

@ -19,6 +19,10 @@
#include <asm/arch-qca-common/smem.h>
#include <asm/arch-qca-common/qca_common.h>
#include <sdhci.h>
#ifdef CONFIG_IPQ_TINY_SPI_NOR
#include <spi.h>
#include <spi_flash.h>
#endif
#ifdef CONFIG_QCA_MMC
#ifndef CONFIG_SDHCI_SUPPORT
@ -46,6 +50,10 @@ int get_eth_mac_address(uchar *enetaddr, uint no_of_macs)
struct mmc *mmc;
char mmc_blks[512];
#endif
#ifdef CONFIG_IPQ_TINY_SPI_NOR
struct spi_flash *flash = NULL;
#endif
if (sfi->flash_type != SMEM_BOOT_MMC_FLASH) {
if (qca_smem_flash_info.flash_type == SMEM_BOOT_SPI_FLASH)
flash_type = CONFIG_SPI_FLASH_INFO_IDX;
@ -70,8 +78,23 @@ int get_eth_mac_address(uchar *enetaddr, uint no_of_macs)
art_offset =
((loff_t) qca_smem_flash_info.flash_block_size * start_blocks);
#ifdef CONFIG_IPQ_TINY_SPI_NOR
flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS,
CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE);
if (flash == NULL){
printf("No SPI flash device found\n");
ret = -1;
} else {
ret = spi_flash_read(flash, art_offset, length, enetaddr);
}
/*
* Avoid unused warning
*/
(void)flash_type;
#else
ret = nand_read(&nand_info[flash_type],
art_offset, &length, enetaddr);
#endif
if (ret < 0)
printf("ART partition read failed..\n");
#ifdef CONFIG_QCA_MMC

View file

@ -42,7 +42,9 @@ DECLARE_GLOBAL_DATA_PTR;
struct sdhci_host mmc_host;
#endif
#ifdef CONFIG_IPQ_MTD_NOR
extern int ipq_spi_init(u16);
#endif
const char *rsvd_node = "/reserved-memory";
const char *del_node[] = {"uboot",
@ -528,7 +530,9 @@ void board_nand_init(void)
gpio_node = fdt_path_offset(gd->fdt_blob, "/spi/spi_gpio");
if (gpio_node >= 0) {
qca_gpio_init(gpio_node);
#ifdef CONFIG_IPQ_MTD_NOR
ipq_spi_init(CONFIG_IPQ_SPI_NOR_INFO_IDX);
#endif
}
#endif
}

View file

@ -223,6 +223,8 @@ CONFIG_QPIC_SERIAL=y
# CONFIG_DM_ETH is not set
# CONFIG_PHYLIB is not set
# CONFIG_NETDEVICES is not set
CONFIG_IPQ_MTD_NOR=y
# CONFIG_IPQ_TINY_SPI_NOR is not set
#
# PCI

View file

@ -223,6 +223,8 @@ CONFIG_SIMPLE_BUS=y
# CONFIG_DM_ETH is not set
# CONFIG_PHYLIB is not set
# CONFIG_NETDEVICES is not set
# CONFIG_IPQ_MTD_NOR is not set
CONFIG_IPQ_TINY_SPI_NOR=y
#
# PCI