MIPS: Add support for JZ4730 and Skytone Alpha 400
Subsystems (12)
cover MIPS: Add support for JZ4730 and Skytone Alpha 400
Hi,
chained to his message are patches that implement support for the Ingenic JZ4730 MIPS SoC and a laptop that's based around it.
Please consider this RFC-quality: there are some known issues that need to be resolved before some of the patches could be applied (indicated in some of the patches themselves) and there are also certainly issues unknown to me that would be obvious to others given I haven't really submitted code to U-Boot apart from some very trifial stuff. I'll be very thankful for any feeback.
The hardware support added by this patch set is essentially equivalent to vendor U-Boot that's shipped with the machine: boot off NAND works, MMC, UART and Ethernet are supported. LCD, GPIO matrix keyboard and OHCI USB don't work at this point. CONFIG_DISTRO_DEFAULT makes it convenient to run custom kernels in place of the vendor's one, but the compatibility with the vendor kernels is retained.
The first three patches are not actually JZ4730 specific, but they are dependend on by the JZ4730 work:
[PATCH RFC 01/20] config: Remove CONFIG_SYS_ID_EEPROM [PATCH RFC 02/20] mtd: Allow building nand_spl_simple w/o SPL_NAND_ECC [PATCH RFC 03/20] cmd/mac: Don't build unless CONFIG_CMD_MAC is enabled
The rest of the patches implement JZ4730 hardware support:
[PATCH RFC 04/20] mips: Don't access CP0_EBASE on JZ47XX [PATCH RFC 05/20] ns16550: Turn on the UME bit if on ARCH_JZ47XX [PATCH RFC 06/20] clk: Add driver for Ingenic JZ4730 CGU [PATCH RFC 07/20] timer-uclass: Tolerate failure to get clock rate in [PATCH RFC 08/20] timer: Add Ingenic JZ4730 timer driver [PATCH RFC 09/20] mmc: Default to JZ47XX_MMC=y on ARCH_JZ47XX [PATCH RFC 10/20] mmc/jz_mmc: Add a JZ4740 compatible string [PATCH RFC 11/20] mmc/jz_mmc: Support wp-gpio/cd-gpio
[PATCH RFC 12/20] pinctrl: Add Ingenic JZ4730 pin control and GPIO driver [PATCH RFC 13/20] nand: Use correct prototype of board_nand_init() with [PATCH RFC 14/20] nand/raw: Add Ingenic JZ4730 NAND flash driver [PATCH RFC 15/20] watchdog: Add Ingenic JZ4730 watchdog timer driver [PATCH RFC 16/20] net: Add Ingenic JZ4730 Ethernet driver [PATCH RFC 17/20] mips: dts: Add Ingenic JZ4730
[PATCH RFC 18/20] mips/mach-jz47xx: Add Ingenic JZ4730 support [PATCH RFC 19/20] mips: dts: Add Skytone Alpha 400
[PATCH RFC 20/20] board: Add Skytone Alpha 400
In case someone finds git more convenient to work with than e-mail, here you go:
git pull git://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/u-boot.git lr/alpha400
Thank you
Lubo
RFC PATCH 1/20 config: Remove CONFIG_SYS_ID_EEPROM
It seems to be a vestige of a somewhat messed up attempt to rename CFG_ID_EEPROM -- the name that actually got used is CONFIG_ID_EEPROM. Remove it.
--- include/configs/MPC8541CDS.h | 1 - include/configs/MPC8548CDS.h | 1 - include/configs/MPC8555CDS.h | 1 - scripts/config_whitelist.txt | 1 - 4 files changed, 4 deletions(-)
include/configs/MPC8541CDS.h +0 -1
@@ -241,7 +241,6 @@ extern unsigned long get_clock_freq(void);/* EEPROM */ #define CONFIG_ID_EEPROM #define CONFIG_SYS_I2C_EEPROM_CCID -#define CONFIG_SYS_ID_EEPROM #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
include/configs/MPC8548CDS.h +0 -1
@@ -312,7 +312,6 @@ extern unsigned long get_clock_freq(void);/* EEPROM */ #define CONFIG_ID_EEPROM #define CONFIG_SYS_I2C_EEPROM_CCID -#define CONFIG_SYS_ID_EEPROM #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
include/configs/MPC8555CDS.h +0 -1
@@ -239,7 +239,6 @@ extern unsigned long get_clock_freq(void);/* EEPROM */ #define CONFIG_ID_EEPROM #define CONFIG_SYS_I2C_EEPROM_CCID -#define CONFIG_SYS_ID_EEPROM #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
scripts/config_whitelist.txt +0 -1
@@ -2789,7 +2789,6 @@ CONFIG_SYS_ICACHE_INV CONFIG_SYS_ICS8N3QV01_I2C CONFIG_SYS_IDE_MAXBUS CONFIG_SYS_IDE_MAXDEVICE -CONFIG_SYS_ID_EEPROM CONFIG_SYS_IFC_ADDR CONFIG_SYS_IFC_CCR CONFIG_SYS_INIT_DBCR
Signature · 1 line
2.28.0
RFC PATCH 2/20 mtd: Allow building nand_spl_simple w/o SPL_NAND_ECC
In reply to Lubomir RintelThe Skytone Alpha 400 boards don't use ECC.
It's probably and oversignt and certainly a bad idea, nevertheless enforcing ECC on existing boards would break boot. Sigh.
--- drivers/mtd/nand/raw/nand_spl_simple.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/nand_spl_simple.c +15 -3
@@ -9,14 +9,16 @@#include <asm/io.h> #include <linux/mtd/nand_ecc.h> -static int nand_ecc_pos[] =CONFIG_SYS_NAND_ECCPOS ;static struct mtd_info *mtd;static struct nand_chip nand_chip; +#if IS_ENABLED (CONFIG_SPL_NAND_ECC ) +static int nand_ecc_pos[] =CONFIG_SYS_NAND_ECCPOS ; +#define ECCSTEPS (CONFIG_SYS_NAND_PAGE_SIZE / \ CONFIG_SYS_NAND_ECCSIZE)#define ECCTOTAL (ECCSTEPS * CONFIG_SYS_NAND_ECCBYTES) - +#endif #if (CONFIG_SYS_NAND_PAGE_SIZE <=512 )/*
@@ -166,7 +168,7 @@ static int nand_read_page(int block, int page, uchar *dst) return 0; } -#else +#elif IS_ENABLED(CONFIG_SPL_NAND_ECC)static int nand_read_page (int block,int page,void *dst) {struct nand_chip *this =mtd_to_nand (mtd);
@@ -206,6 +208,16 @@ static int nand_read_page(int block, int page, void *dst) return 0; } +#else +static int nand_read_page (int block,int page,void *dst) +{ +struct nand_chip *this =mtd_to_nand (mtd); + +nand_command (block, page,0 ,NAND_CMD_READ0 ); + this->read_buf (mtd, dst,CONFIG_SYS_NAND_PAGE_SIZE ); + +return 0 ; +}#endif /* nand_init() - initialize data to make nand usable by SPL */
Signature · 1 line
2.28.0
RFC PATCH 3/20 cmd/mac: Don't build unless CONFIG_CMD_MAC is enabled
In reply to Lubomir RintelThis allows us to enable CONFIG_ID_EEPROM to add a hook to read ethaddr off a ROM without having to implement do_mac().
--- arch/arm/Kconfig | 19 +++++++++++++++++++ arch/powerpc/cpu/mpc85xx/Kconfig | 17 +++++++++++++++++ cmd/Kconfig | 3 +++ cmd/Makefile | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-)
arch/arm/Kconfig +19 -0
@@ -1245,6 +1245,7 @@ config TARGET_LS1088AQDS select BOARD_LATE_INIT select SUPPORT_SPL select FSL_DDR_INTERACTIVE if !SD_BOOT + select CMD_MAC help Support for NXP LS1088AQDS platform. The LS1088A Development System (QDS) is a high-performance
@@ -1263,6 +1264,7 @@ config TARGET_LS2080AQDS imply SCSI_AHCI select FSL_DDR_BIST select FSL_DDR_INTERACTIVE if !SPL + select CMD_MAC help Support for Freescale LS2080AQDS platform. The LS2080A Development System (QDS) is a high-performance
@@ -1279,6 +1281,7 @@ config TARGET_LS2080ARDB select SUPPORT_SPL select FSL_DDR_BIST select FSL_DDR_INTERACTIVE if !SPL + select CMD_MAC imply SCSI imply SCSI_AHCI help
@@ -1294,6 +1297,7 @@ config TARGET_LS2081ARDB select ARMV8_MULTIENTRY select BOARD_LATE_INIT select SUPPORT_SPL + select CMD_MAC help Support for Freescale LS2081ARDB platform. The LS2081A Reference design board (RDB) is a high-performance
@@ -1307,6 +1311,7 @@ config TARGET_LX2160ARDB select ARMV8_MULTIENTRY select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for NXP LX2160ARDB platform. The lx2160ardb (LX2160A Reference design board (RDB)
@@ -1320,6 +1325,7 @@ config TARGET_LX2160AQDS select ARMV8_MULTIENTRY select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for NXP LX2160AQDS platform. The lx2160aqds (LX2160A QorIQ Development System (QDS)
@@ -1373,6 +1379,7 @@ config TARGET_LS1012AQDS select ARM64 select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for Freescale LS1012AQDS platform. The LS1012A Development System (QDS) is a high-performance
@@ -1438,6 +1445,7 @@ config TARGET_LS1028AQDS select ARMV8_MULTIENTRY select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for Freescale LS1028AQDS platform The LS1028A Development System (QDS) is a high-performance
@@ -1451,6 +1459,7 @@ config TARGET_LS1028ARDB select ARMV8_MULTIENTRY select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for Freescale LS1028ARDB platform The LS1028A Development System (RDB) is a high-performance
@@ -1466,6 +1475,7 @@ config TARGET_LS1088ARDB select BOARD_LATE_INIT select SUPPORT_SPL select FSL_DDR_INTERACTIVE if !SD_BOOT + select CMD_MAC help Support for NXP LS1088ARDB platform. The LS1088A Reference design board (RDB) is a high-performance
@@ -1487,6 +1497,7 @@ config TARGET_LS1021AQDS select FSL_DDR_INTERACTIVE select DM_SPI_FLASH if FSL_DSPI || FSL_QSPI select SPI_FLASH_DATAFLASH if FSL_DSPI || FSL_QSPI + select CMD_MAC imply SCSI config TARGET_LS1021ATWR
@@ -1501,6 +1512,7 @@ config TARGET_LS1021ATWR select LS1_DEEP_SLEEP select SUPPORT_SPL select DM_SPI_FLASH if FSL_DSPI || FSL_QSPI + select CMD_MAC imply SCSI config TARGET_LS1021ATSN
@@ -1514,6 +1526,7 @@ config TARGET_LS1021ATSN select CPU_V7_HAS_VIRT select LS1_DEEP_SLEEP select SUPPORT_SPL + select CMD_MAC imply SCSI config TARGET_LS1021AIOT
@@ -1526,6 +1539,7 @@ config TARGET_LS1021AIOT select CPU_V7_HAS_VIRT select SUPPORT_SPL select DM_SPI_FLASH if FSL_DSPI || FSL_QSPI + select CMD_MAC imply SCSI help Support for Freescale LS1021AIOT platform.
@@ -1545,6 +1559,7 @@ config TARGET_LS1043AQDS select FSL_DDR_INTERACTIVE if !SPL select FSL_DSPI if !SPL_NO_DSPI select DM_SPI_FLASH if FSL_DSPI + select CMD_MAC imply SCSI imply SCSI_AHCI help
@@ -1561,6 +1576,7 @@ config TARGET_LS1043ARDB select SUPPORT_SPL select FSL_DSPI if !SPL_NO_DSPI select DM_SPI_FLASH if FSL_DSPI + select CMD_MAC help Support for Freescale LS1043ARDB platform.
@@ -1577,6 +1593,7 @@ config TARGET_LS1046AQDS select FSL_DDR_BIST if !SPL select FSL_DDR_INTERACTIVE if !SPL select FSL_DDR_INTERACTIVE if !SPL + select CMD_MAC imply SCSI help Support for Freescale LS1046AQDS platform.
@@ -1597,6 +1614,7 @@ config TARGET_LS1046ARDB select SUPPORT_SPL select FSL_DDR_BIST select FSL_DDR_INTERACTIVE if !SPL + select CMD_MAC imply SCSI help Support for Freescale LS1046ARDB platform.
@@ -1613,6 +1631,7 @@ config TARGET_LS1046AFRWY select BOARD_EARLY_INIT_F select BOARD_LATE_INIT select DM_SPI_FLASH if DM_SPI + select CMD_MAC imply SCSI help Support for Freescale LS1046AFRWY platform.
arch/powerpc/cpu/mpc85xx/Kconfig +17 -0
@@ -29,6 +29,7 @@ config TARGET_P3041DS select PHYS_64BIT select ARCH_P3041 select BOARD_LATE_INIT if CHAIN_OF_TRUST + select CMD_MAC imply CMD_SATA imply PANIC_HANG
@@ -37,6 +38,7 @@ config TARGET_P4080DS select PHYS_64BIT select ARCH_P4080 select BOARD_LATE_INIT if CHAIN_OF_TRUST + select CMD_MAC imply CMD_SATA imply PANIC_HANG
@@ -45,12 +47,14 @@ config TARGET_P5040DS select PHYS_64BIT select ARCH_P5040 select BOARD_LATE_INIT if CHAIN_OF_TRUST + select CMD_MAC imply CMD_SATA imply PANIC_HANG config TARGET_MPC8541CDS bool "Support MPC8541CDS" select ARCH_MPC8541 + select CMD_MAC config TARGET_MPC8544DS bool "Support MPC8544DS"
@@ -60,10 +64,12 @@ config TARGET_MPC8544DS config TARGET_MPC8548CDS bool "Support MPC8548CDS" select ARCH_MPC8548 + select CMD_MAC config TARGET_MPC8555CDS bool "Support MPC8555CDS" select ARCH_MPC8555 + select CMD_MAC config TARGET_MPC8568MDS bool "Support MPC8568MDS"
@@ -72,12 +78,14 @@ config TARGET_MPC8568MDS config TARGET_MPC8569MDS bool "Support MPC8569MDS" select ARCH_MPC8569 + select CMD_MAC config TARGET_MPC8572DS bool "Support MPC8572DS" select ARCH_MPC8572 # Use DDR3 controller with DDR2 DIMMs on this board select SYS_FSL_DDRC_GEN3 + select CMD_MAC imply SCSI imply PANIC_HANG
@@ -97,6 +105,7 @@ config TARGET_P1010RDB_PB select BOARD_LATE_INIT if CHAIN_OF_TRUST select SUPPORT_SPL select SUPPORT_TPL + select CMD_MAC imply CMD_EEPROM imply CMD_SATA imply PANIC_HANG
@@ -133,6 +142,7 @@ config TARGET_P2041RDB select ARCH_P2041 select BOARD_LATE_INIT if CHAIN_OF_TRUST select PHYS_64BIT + select CMD_MAC imply CMD_SATA imply FSL_SATA
@@ -148,6 +158,7 @@ config TARGET_T1023RDB select SUPPORT_SPL select PHYS_64BIT select FSL_DDR_INTERACTIVE + select CMD_MAC imply CMD_EEPROM imply PANIC_HANG
@@ -158,6 +169,7 @@ config TARGET_T1024RDB select SUPPORT_SPL select PHYS_64BIT select FSL_DDR_INTERACTIVE + select CMD_MAC imply CMD_EEPROM imply PANIC_HANG
@@ -213,6 +225,7 @@ config TARGET_T2080QDS select PHYS_64BIT select FSL_DDR_FIRST_SLOT_QUAD_CAPABLE select FSL_DDR_INTERACTIVE + select CMD_MAC imply CMD_SATA config TARGET_T2080RDB
@@ -221,6 +234,7 @@ config TARGET_T2080RDB select BOARD_LATE_INIT if CHAIN_OF_TRUST select SUPPORT_SPL select PHYS_64BIT + select CMD_MAC imply CMD_SATA imply PANIC_HANG
@@ -231,6 +245,7 @@ config TARGET_T2081QDS select PHYS_64BIT select FSL_DDR_FIRST_SLOT_QUAD_CAPABLE select FSL_DDR_INTERACTIVE + select CMD_MAC config TARGET_T4160RDB bool "Support T4160RDB"
@@ -280,12 +295,14 @@ config TARGET_CYRUS_P5020 bool "Support Varisys Cyrus P5020" select ARCH_P5020 select PHYS_64BIT + select CMD_MAC imply PANIC_HANG config TARGET_CYRUS_P5040 bool "Support Varisys Cyrus P5040" select ARCH_P5040 select PHYS_64BIT + select CMD_MAC imply PANIC_HANG endchoice
cmd/Kconfig +3 -0
@@ -1696,6 +1696,9 @@ config CMD_LED with led on/off/togle/blink. Any LED drivers can be controlled with this command, e.g. led_gpio. +config CMD_MAC + bool + config CMD_DATE bool "date" default y if DM_RTC
cmd/Makefile +1 -1
@@ -88,7 +88,7 @@ obj-$(CONFIG_CMD_LICENSE) += license.o obj-y += load.o obj-$(CONFIG_CMD_LOG) += log.o obj-$(CONFIG_CMD_LSBLK) += lsblk.o -obj-$(CONFIG_ID_EEPROM) += mac.o +obj-$(CONFIG_CMD_MAC) += mac.o obj-$(CONFIG_CMD_MD5SUM) += md5sum.o obj-$(CONFIG_CMD_MEMORY) += mem.o obj-$(CONFIG_CMD_IO) += io.o
Signature · 1 line
2.28.0
RFC PATCH 3/20 cmd/mac: Don't build unless CONFIG_CMD_MAC is enabled
Am Dienstag, den 17.11.2020, 22:00 +0100 schrieb Lubomir Rintel:
Quoted 7 lines
This allows us to enable
CONFIG_ID_EEPROMto add a hook to read ethaddr off a ROM without having to implementdo_mac().Signed-off-by Lubomir Rintel <[email protected]>--- arch/arm/Kconfig | 19 +++++++++++++++++++ arch/powerpc/cpu/mpc85xx/Kconfig | 17 +++++++++++++++++
you should also cc Tom Rini and Priyanka Jain <[email protected]>
arch/arm/Kconfig config TARGET_LS1088AQDS · line 1248
Quoted 13 lines
cmd/Kconfig | 3 +++ cmd/Makefile | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-)arch/arm/Kconfig +1
-0@@ -1245,6 +1245,7 @@ config TARGET_LS1088AQDS select BOARD_LATE_INIT select SUPPORT_SPL select FSL_DDR_INTERACTIVE if !SD_BOOT + select CMD_MAC
commands should be selected with "imply CMD_XXX" so the user can deselect them when needed. This also means that CMD_MAC should be visible to the user:
config CMD_MAC
bool "mac"
Quoted 308 lines
arch/arm/Kconfig +18
-0help Support for NXP LS1088AQDS platform. The LS1088A Development System (QDS) is a high-performance@@ -1263,6 +1264,7 @@ config TARGET_LS2080AQDS imply SCSI_AHCI select FSL_DDR_BIST select FSL_DDR_INTERACTIVE if !SPL + select CMD_MAC help Support for Freescale LS2080AQDS platform. The LS2080A Development System (QDS) is a high-performance@@ -1279,6 +1281,7 @@ config TARGET_LS2080ARDB select SUPPORT_SPL select FSL_DDR_BIST select FSL_DDR_INTERACTIVE if !SPL + select CMD_MAC imply SCSI imply SCSI_AHCI help@@ -1294,6 +1297,7 @@ config TARGET_LS2081ARDB select ARMV8_MULTIENTRY select BOARD_LATE_INIT select SUPPORT_SPL + select CMD_MAC help Support for Freescale LS2081ARDB platform. The LS2081A Reference design board (RDB) is a high-performance@@ -1307,6 +1311,7 @@ config TARGET_LX2160ARDB select ARMV8_MULTIENTRY select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for NXP LX2160ARDB platform. The lx2160ardb (LX2160A Reference design board (RDB)@@ -1320,6 +1325,7 @@ config TARGET_LX2160AQDS select ARMV8_MULTIENTRY select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for NXP LX2160AQDS platform. The lx2160aqds (LX2160A QorIQ Development System (QDS)@@ -1373,6 +1379,7 @@ config TARGET_LS1012AQDS select ARM64 select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for Freescale LS1012AQDS platform. The LS1012A Development System (QDS) is a high-performance@@ -1438,6 +1445,7 @@ config TARGET_LS1028AQDS select ARMV8_MULTIENTRY select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for Freescale LS1028AQDS platform The LS1028A Development System (QDS) is a high-performance@@ -1451,6 +1459,7 @@ config TARGET_LS1028ARDB select ARMV8_MULTIENTRY select ARCH_SUPPORT_TFABOOT select BOARD_LATE_INIT + select CMD_MAC help Support for Freescale LS1028ARDB platform The LS1028A Development System (RDB) is a high-performance@@ -1466,6 +1475,7 @@ config TARGET_LS1088ARDB select BOARD_LATE_INIT select SUPPORT_SPL select FSL_DDR_INTERACTIVE if !SD_BOOT + select CMD_MAC help Support for NXP LS1088ARDB platform. The LS1088A Reference design board (RDB) is a high-performance@@ -1487,6 +1497,7 @@ config TARGET_LS1021AQDS select FSL_DDR_INTERACTIVE select DM_SPI_FLASH if FSL_DSPI || FSL_QSPI select SPI_FLASH_DATAFLASH if FSL_DSPI || FSL_QSPI + select CMD_MAC imply SCSI config TARGET_LS1021ATWR@@ -1501,6 +1512,7 @@ config TARGET_LS1021ATWR select LS1_DEEP_SLEEP select SUPPORT_SPL select DM_SPI_FLASH if FSL_DSPI || FSL_QSPI + select CMD_MAC imply SCSI config TARGET_LS1021ATSN@@ -1514,6 +1526,7 @@ config TARGET_LS1021ATSN select CPU_V7_HAS_VIRT select LS1_DEEP_SLEEP select SUPPORT_SPL + select CMD_MAC imply SCSI config TARGET_LS1021AIOT@@ -1526,6 +1539,7 @@ config TARGET_LS1021AIOT select CPU_V7_HAS_VIRT select SUPPORT_SPL select DM_SPI_FLASH if FSL_DSPI || FSL_QSPI + select CMD_MAC imply SCSI help Support for Freescale LS1021AIOT platform.@@ -1545,6 +1559,7 @@ config TARGET_LS1043AQDS select FSL_DDR_INTERACTIVE if !SPL select FSL_DSPI if !SPL_NO_DSPI select DM_SPI_FLASH if FSL_DSPI + select CMD_MAC imply SCSI imply SCSI_AHCI help@@ -1561,6 +1576,7 @@ config TARGET_LS1043ARDB select SUPPORT_SPL select FSL_DSPI if !SPL_NO_DSPI select DM_SPI_FLASH if FSL_DSPI + select CMD_MAC help Support for Freescale LS1043ARDB platform.@@ -1577,6 +1593,7 @@ config TARGET_LS1046AQDS select FSL_DDR_BIST if !SPL select FSL_DDR_INTERACTIVE if !SPL select FSL_DDR_INTERACTIVE if !SPL + select CMD_MAC imply SCSI help Support for Freescale LS1046AQDS platform.@@ -1597,6 +1614,7 @@ config TARGET_LS1046ARDB select SUPPORT_SPL select FSL_DDR_BIST select FSL_DDR_INTERACTIVE if !SPL + select CMD_MAC imply SCSI help Support for Freescale LS1046ARDB platform.@@ -1613,6 +1631,7 @@ config TARGET_LS1046AFRWY select BOARD_EARLY_INIT_F select BOARD_LATE_INIT select DM_SPI_FLASH if DM_SPI + select CMD_MAC imply SCSI help Support for Freescale LS1046AFRWY platform.arch/powerpc/cpu/mpc85xx/Kconfig +17
-0@@ -29,6 +29,7 @@ config TARGET_P3041DS select PHYS_64BIT select ARCH_P3041 select BOARD_LATE_INIT if CHAIN_OF_TRUST + select CMD_MAC imply CMD_SATA imply PANIC_HANG@@ -37,6 +38,7 @@ config TARGET_P4080DS select PHYS_64BIT select ARCH_P4080 select BOARD_LATE_INIT if CHAIN_OF_TRUST + select CMD_MAC imply CMD_SATA imply PANIC_HANG@@ -45,12 +47,14 @@ config TARGET_P5040DS select PHYS_64BIT select ARCH_P5040 select BOARD_LATE_INIT if CHAIN_OF_TRUST + select CMD_MAC imply CMD_SATA imply PANIC_HANG config TARGET_MPC8541CDS bool "Support MPC8541CDS" select ARCH_MPC8541 + select CMD_MAC config TARGET_MPC8544DS bool "Support MPC8544DS"@@ -60,10 +64,12 @@ config TARGET_MPC8544DS config TARGET_MPC8548CDS bool "Support MPC8548CDS" select ARCH_MPC8548 + select CMD_MAC config TARGET_MPC8555CDS bool "Support MPC8555CDS" select ARCH_MPC8555 + select CMD_MAC config TARGET_MPC8568MDS bool "Support MPC8568MDS"@@ -72,12 +78,14 @@ config TARGET_MPC8568MDS config TARGET_MPC8569MDS bool "Support MPC8569MDS" select ARCH_MPC8569 + select CMD_MAC config TARGET_MPC8572DS bool "Support MPC8572DS" select ARCH_MPC8572 # Use DDR3 controller with DDR2 DIMMs on this board select SYS_FSL_DDRC_GEN3 + select CMD_MAC imply SCSI imply PANIC_HANG@@ -97,6 +105,7 @@ config TARGET_P1010RDB_PB select BOARD_LATE_INIT if CHAIN_OF_TRUST select SUPPORT_SPL select SUPPORT_TPL + select CMD_MAC imply CMD_EEPROM imply CMD_SATA imply PANIC_HANG@@ -133,6 +142,7 @@ config TARGET_P2041RDB select ARCH_P2041 select BOARD_LATE_INIT if CHAIN_OF_TRUST select PHYS_64BIT + select CMD_MAC imply CMD_SATA imply FSL_SATA@@ -148,6 +158,7 @@ config TARGET_T1023RDB select SUPPORT_SPL select PHYS_64BIT select FSL_DDR_INTERACTIVE + select CMD_MAC imply CMD_EEPROM imply PANIC_HANG@@ -158,6 +169,7 @@ config TARGET_T1024RDB select SUPPORT_SPL select PHYS_64BIT select FSL_DDR_INTERACTIVE + select CMD_MAC imply CMD_EEPROM imply PANIC_HANG@@ -213,6 +225,7 @@ config TARGET_T2080QDS select PHYS_64BIT select FSL_DDR_FIRST_SLOT_QUAD_CAPABLE select FSL_DDR_INTERACTIVE + select CMD_MAC imply CMD_SATA config TARGET_T2080RDB@@ -221,6 +234,7 @@ config TARGET_T2080RDB select BOARD_LATE_INIT if CHAIN_OF_TRUST select SUPPORT_SPL select PHYS_64BIT + select CMD_MAC imply CMD_SATA imply PANIC_HANG@@ -231,6 +245,7 @@ config TARGET_T2081QDS select PHYS_64BIT select FSL_DDR_FIRST_SLOT_QUAD_CAPABLE select FSL_DDR_INTERACTIVE + select CMD_MAC config TARGET_T4160RDB bool "Support T4160RDB"@@ -280,12 +295,14 @@ config TARGET_CYRUS_P5020 bool "Support Varisys Cyrus P5020" select ARCH_P5020 select PHYS_64BIT + select CMD_MAC imply PANIC_HANG config TARGET_CYRUS_P5040 bool "Support Varisys Cyrus P5040" select ARCH_P5040 select PHYS_64BIT + select CMD_MAC imply PANIC_HANG endchoicecmd/Kconfig +3
-0@@ -1696,6 +1696,9 @@ config CMD_LED with led on/off/togle/blink. Any LED drivers can be controlled with this command, e.g. led_gpio. +config CMD_MAC + bool + config CMD_DATE bool "date" default y if DM_RTCcmd/Makefile +1
-1@@ -88,7 +88,7 @@ obj-$(CONFIG_CMD_LICENSE) += license.o obj-y += load.o obj-$(CONFIG_CMD_LOG) += log.o obj-$(CONFIG_CMD_LSBLK) += lsblk.o -obj-$(CONFIG_ID_EEPROM) += mac.o +obj-$(CONFIG_CMD_MAC) += mac.o obj-$(CONFIG_CMD_MD5SUM) += md5sum.o obj-$(CONFIG_CMD_MEMORY) += mem.o obj-$(CONFIG_CMD_IO) += io.o
Signature · 1 line
- Daniel
RFC PATCH 4/20 mips: Don't access CP0_EBASE on JZ47XX
In reply to Lubomir RintelOn JZ4730 (and I guess all Ingenic/XBurst cores), the CP0 register 15 doesn't support a selector 1 or, for that matter, any selector and always behaves as if the selector is zero.
We don't need it anyways, these SoCs have just a single processor core.
--- arch/mips/cpu/start.S | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/cpu/start.S +2 -0
@@ -136,6 +136,8 @@ reset: #ifdef CONFIG_ARCH_BMIPS 1: mfc0 t0, CP0_DIAGNOSTIC, 3 and t0, t0, (1 << 31) +#elif CONFIG_ARCH_JZ47XX +1: and t0, t0, zero #else 1: mfc0 t0, CP0_EBASE and t0, t0, MIPS_EBASE_CPUNUM
Signature · 1 line
2.28.0
RFC PATCH 5/20 ns16550: Turn on the UME bit if on ARCH_JZ47XX
In reply to Lubomir RintelThe jz47xx serial port is essentially a ns16550 with an extra bit that needs to be turned on. The driver already takes care of it, but not in the early debug config path.
--- drivers/serial/ns16550.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/serial/ns16550.c +6 -1
@@ -326,6 +326,7 @@ static inline void _debug_uart_init(void) {struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE ;int baud_divisor; +int fcr =UART_FCR_DEFVAL ;/* * We copy the code from above because it is already horribly messy.
@@ -335,9 +336,13 @@ static inline void _debug_uart_init(void)*/ baud_divisor =ns16550_calc_divisor (com_port,CONFIG_DEBUG_UART_CLOCK ,CONFIG_BAUDRATE ); + +if (IS_ENABLED (CONFIG_ARCH_JZ47XX )) + fcr |=UART_FCR_UME ; +serial_dout (&com_port->ier,CONFIG_SYS_NS16550_IER );serial_dout (&com_port->mcr,UART_MCRVAL ); -serial_dout (&com_port->fcr,UART_FCR_DEFVAL ); +serial_dout (&com_port->fcr, fcr);serial_dout (&com_port->lcr,UART_LCR_BKSE |UART_LCRVAL );serial_dout (&com_port->dll, baud_divisor &0xff );
Signature · 1 line
2.28.0
RFC PATCH 5/20 ns16550: Turn on the UME bit if on ARCH_JZ47XX
Am Dienstag, den 17.11.2020, 22:00 +0100 schrieb Lubomir Rintel:
Quoted 22 lines
The jz47xx serial port is essentially a ns16550 with an extra bit that needs to be turned on. The driver already takes care of it, but not in the early debug config path.
Signed-off-by Lubomir Rintel <[email protected]>--- drivers/serial/ns16550.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/serial/ns16550.c +1
-0@@ -326,6 +326,7 @@ static inline void _debug_uart_init(void) {struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE ;int baud_divisor; +int fcr =UART_FCR_DEFVAL ;/* * We copy the code from above because it is already horribly messy.
drivers/serial/ns16550.c static inline void _debug_uart_init(void) · line 341
Quoted 6 lines
drivers/serial/ns16550.c +3
-0@@ -335,9 +336,13 @@ static inline void _debug_uart_init(void)*/ baud_divisor =ns16550_calc_divisor (com_port,CONFIG_DEBUG_UART_CLOCK ,CONFIG_BAUDRATE ); + +if (IS_ENABLED (CONFIG_ARCH_JZ47XX )) + fcr |=UART_FCR_UME ;
do you use that driver without CONFIG_OF_CONTROL?
There is already code for UME bit on JS4780 when you use the compatible "ingenic,jz4780-uart":
plat->fcr = UART_FCR_DEFVAL; if (port_type == PORT_JZ4780) plat->fcr |= UART_FCR_UME;
Quoted 8 lines
drivers/serial/ns16550.c +2
-1+serial_dout (&com_port->ier,CONFIG_SYS_NS16550_IER );serial_dout (&com_port->mcr,UART_MCRVAL ); -serial_dout (&com_port->fcr,UART_FCR_DEFVAL ); +serial_dout (&com_port->fcr, fcr);serial_dout (&com_port->lcr,UART_LCR_BKSE |UART_LCRVAL );serial_dout (&com_port->dll, baud_divisor &0xff );
Signature · 1 line
- Daniel
RFC PATCH 5/20 ns16550: Turn on the UME bit if on ARCH_JZ47XX
Quoted 20 lines · Daniel Schwierzeck
Am Dienstag, den 17.11.2020, 22:00 +0100 schrieb Lubomir Rintel:
Quoted 19 lines
The jz47xx serial port is essentially a ns16550 with an extra bit that needs to be turned on. The driver already takes care of it, but not in the early debug config path.
Signed-off-by Lubomir Rintel <[email protected]>--- drivers/serial/ns16550.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/serial/ns16550.c +1
-0@@ -326,6 +326,7 @@ static inline void _debug_uart_init(void) {struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE ;int baud_divisor; +int fcr =UART_FCR_DEFVAL ;
Quoted 11 lines
drivers/serial/ns16550.c static inline void _debug_uart_init(void) · line 341
Quoted 9 lines
drivers/serial/ns16550.c +3
-0/* * We copy the code from above because it is already horribly messy. @@ -335,9 +336,13 @@ static inline void _debug_uart_init(void)*/ baud_divisor =ns16550_calc_divisor (com_port,CONFIG_DEBUG_UART_CLOCK ,CONFIG_BAUDRATE ); + +if (IS_ENABLED (CONFIG_ARCH_JZ47XX )) + fcr |=UART_FCR_UME ;do you use that driver without
CONFIG_OF_CONTROL?
Yes. This is indeed for the debug uart output only. I needed in SPL which is too constrained for OF_CONTROL to fit on my board, but I think it could be used to get debug output very early even if OF_CONTROL is enabled.
I actually tried to indicate that in the patch description, perhaps I could reword that somehow to make it clearer.
Thank you
Lubo
Quoted 18 lines
There is already code for UME bit on JS4780 when you use the compatible "ingenic,jz4780-uart":
plat->fcr = UART_FCR_DEFVAL; if (port_type == PORT_JZ4780) plat->fcr |= UART_FCR_UME;Quoted 8 lines
drivers/serial/ns16550.c +2
-1+serial_dout (&com_port->ier,CONFIG_SYS_NS16550_IER );serial_dout (&com_port->mcr,UART_MCRVAL ); -serial_dout (&com_port->fcr,UART_FCR_DEFVAL ); +serial_dout (&com_port->fcr, fcr);serial_dout (&com_port->lcr,UART_LCR_BKSE |UART_LCRVAL );serial_dout (&com_port->dll, baud_divisor &0xff );Signature · 1 line
- Daniel
RFC PATCH 6/20 clk: Add driver for Ingenic JZ4730 CGU
In reply to Lubomir RintelA rather minimal driver for that reads back configured clock rates for hardware we support.
--- drivers/clk/Kconfig | 8 +++ drivers/clk/Makefile | 1 + drivers/clk/clk-jz4730.c | 121 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 drivers/clk/clk-jz4730.c
drivers/clk/Kconfig +8 -0
@@ -113,6 +113,14 @@ config CLK_HSDK Enable this to support the cgu clocks on Synopsys ARC HSDK and Synopsys ARC HSDK-4xD boards +config CLK_JZ4730 + bool "Enable clock driver for Ingenic JZ4730 cgu" + depends on CLK && SOC_JZ4730 + default y + help + This clock driver adds support for clock generators present on + Ingenic JZ4730 SoC. + config CLK_VERSAL bool "Enable clock driver support for Versal" depends on ARCH_VERSAL
drivers/clk/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_CLK_BOSTON) += clk_boston.o obj-$(CONFIG_CLK_EXYNOS) += exynos/ obj-$(CONFIG_$(SPL_TPL_)CLK_INTEL) += intel/ obj-$(CONFIG_CLK_HSDK) += clk-hsdk-cgu.o +obj-$(CONFIG_CLK_JZ4730) += clk-jz4730.o obj-$(CONFIG_CLK_K210) += kendryte/ obj-$(CONFIG_CLK_MPC83XX) += mpc83xx_clk.o obj-$(CONFIG_CLK_OCTEON) += clk_octeon.o
drivers/clk/clk-jz4730.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 7/20 timer-uclass: Tolerate failure to get clock rate in pre_probe
In reply to Lubomir RintelPre-probe merely guesses that the first clock is the right one -- a different one might actually be picked by probe(). In case it does not, post_probe() already has a check that will fail.
--- drivers/timer/timer-uclass.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/timer/timer-uclass.c +5 -3
@@ -61,9 +61,11 @@ static int timer_pre_probe(struct udevice *dev)if (!err) { ret =clk_get_rate (&timer_clk);if (IS_ERR_VALUE (ret)) -return ret; - uc_priv->clock_rate = ret; - }else { + err = ret; +else + uc_priv->clock_rate = ret; + } +if (err) { uc_priv->clock_rate =dev_read_u32_default (dev,"clock-frequency" ,0 ); }
Signature · 1 line
2.28.0
RFC PATCH 8/20 timer: Add Ingenic JZ4730 timer driver
In reply to Lubomir RintelThis adds support for a timer block on JZ4730 SoC.
--- drivers/timer/Kconfig | 8 ++++ drivers/timer/Makefile | 1 + drivers/timer/jz4730_timer.c | 83 ++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 drivers/timer/jz4730_timer.c
drivers/timer/Kconfig +8 -0
@@ -110,6 +110,14 @@ config DESIGNWARE_APB_TIMER Enables support for the Designware APB Timer driver. This timer is present on Altera SoCFPGA SoCs. +config JZ4730_TIMER + bool "Ingenic JZ4730 timer support" + depends on TIMER + default y if SOC_JZ4730 + help + Select this to enable support for the timer found on + devices based on the Ingenic JZ4730 SoC. + config MPC83XX_TIMER bool "MPC83xx timer support" depends on TIMER
drivers/timer/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_ATCPIT100_TIMER) += atcpit100_timer.o obj-$(CONFIG_ATMEL_PIT_TIMER) += atmel_pit_timer.o obj-$(CONFIG_CADENCE_TTC_TIMER) += cadence-ttc.o obj-$(CONFIG_DESIGNWARE_APB_TIMER) += dw-apb-timer.o +obj-$(CONFIG_JZ4730_TIMER) += jz4730_timer.o obj-$(CONFIG_MPC83XX_TIMER) += mpc83xx_timer.o obj-$(CONFIG_NOMADIK_MTU_TIMER) += nomadik-mtu-timer.o obj-$(CONFIG_OMAP_TIMER) += omap-timer.o
drivers/timer/jz4730_timer.c new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 9/20 mmc: Default to JZ47XX_MMC=y on ARCH_JZ47XX
In reply to Lubomir RintelIt's basically certain we want this MMC driver if we have MMC support turned on JZ47XX. A sane default here will keep the defconfig cleaner.
--- drivers/mmc/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/Kconfig +1 -0
@@ -407,6 +407,7 @@ config MMC_BCM2835 config JZ47XX_MMC bool "Ingenic JZ47xx SD/MMC Host Controller support" depends on ARCH_JZ47XX + default y help This selects support for the SD Card Controller on Ingenic JZ47xx SoCs.
Signature · 1 line
2.28.0
RFC PATCH 10/20 mmc/jz_mmc: Add a JZ4740 compatible string
In reply to Lubomir RintelThe driver doesn't use the jz4780's extra DMA channels and handles jz4740 just fine.
--- drivers/mmc/jz_mmc.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/jz_mmc.c +1 -0
@@ -490,6 +490,7 @@ static int jz_mmc_probe(struct udevice *dev) }static const struct udevice_id jz_mmc_ids[] = { + { .compatible ="ingenic,jz4740-mmc" }, { .compatible ="ingenic,jz4780-mmc" }, { } };
Signature · 1 line
2.28.0
RFC PATCH 10/20 mmc/jz_mmc: Add a JZ4740 compatible string
Hi Lubomir,
Quoted 13 lines · Lubomir Rintel
The driver doesn't use the jz4780's extra DMA channels and handles jz4740 just fine.
Signed-off-by Lubomir Rintel <[email protected]>--- drivers/mmc/jz_mmc.c | 1 + 1 file changed, 1 insertion(+)drivers/mmc/jz_mmc.c +0
-0
drivers/mmc/jz_mmc.c static int jz_mmc_probe(struct udevice *dev) · line 493
Quoted 4 lines
drivers/mmc/jz_mmc.c +1
-0@@ -490,6 +490,7 @@ static int jz_mmc_probe(struct udevice *dev) }static const struct udevice_id jz_mmc_ids[] = { + { .compatible ="ingenic,jz4740-mmc" },
Normally, you don't need to add another compatible if there's nothing in the implementation to distinguish them.
However, I'm guessing here you want to add the compatible so you can support kernel compatibles such as ingenic,jz4740-mmc?
Regards,
Ezequiel
Quoted 3 lines
drivers/mmc/jz_mmc.c +0
-0{ .compatible = "ingenic,jz4780-mmc" }, { } };
RFC PATCH 11/20 mmc/jz_mmc: Support wp-gpio/cd-gpio
In reply to Lubomir RintelThis adds support for using GPIO lines for detecting Write-Protect and Card-Detect status.
This way the driver can fail fast if there's no card inserted.
--- drivers/mmc/jz_mmc.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/mmc/jz_mmc.c +35 -0
@@ -9,6 +9,7 @@#include <common.h> #include <malloc.h> #include <mmc.h> +#include <asm/gpio.h> #include <asm/io.h> #include <asm/unaligned.h> #include <errno.h>
@@ -130,6 +131,11 @@ struct jz_mmc_priv {#define JZ_MMC_BUS_WIDTH_4 0x2#define JZ_MMC_BUS_WIDTH_8 0x3#define JZ_MMC_SENT_INIT BIT(2) + +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc gpio_wp; +struct gpio_desc gpio_cd; +#endif };static int jz_mmc_clock_rate (void )
@@ -438,9 +444,33 @@ static int jz_mmc_dm_set_ios(struct udevice *dev)return jz_mmc_set_ios (mmc, priv); }; +#if CONFIG_IS_ENABLED (DM_GPIO ) +static int jz_mmc_dm_get_cd (struct udevice *dev) +{ +struct jz_mmc_priv *priv =dev_get_priv (dev); + +if (priv->gpio_cd.dev) +return dm_gpio_get_value (&priv->gpio_cd); +return -ENOSYS ; +} + +static int jz_mmc_dm_get_wp (struct udevice *dev) +{ +struct jz_mmc_priv *priv =dev_get_priv (dev); + +if (priv->gpio_wp.dev) +dm_gpio_get_value (&priv->gpio_wp); +return -ENOSYS ; +} +#endif +static const struct dm_mmc_ops jz_msc_ops = { .send_cmd = jz_mmc_dm_send_cmd, .set_ios = jz_mmc_dm_set_ios, +#if CONFIG_IS_ENABLED(DM_GPIO) + .get_cd = jz_mmc_dm_get_cd, + .get_wp = jz_mmc_dm_get_wp, +#endif };static int jz_mmc_ofdata_to_platdata (struct udevice *dev)
@@ -484,6 +514,11 @@ static int jz_mmc_probe(struct udevice *dev)struct jz_mmc_priv *priv =dev_get_priv (dev);struct jz_mmc_plat *plat =dev_get_platdata (dev); +#if CONFIG_IS_ENABLED (DM_GPIO ) +gpio_request_by_name (dev,"wp-gpios" ,0 , &priv->gpio_wp,GPIOD_IS_IN ); +gpio_request_by_name (dev,"cd-gpios" ,0 , &priv->gpio_cd,GPIOD_IS_IN ); +#endif + plat->mmc.priv = priv; upriv->mmc = &plat->mmc;return jz_mmc_core_init (&plat->mmc);
Signature · 1 line
2.28.0
RFC PATCH 12/20 pinctrl: Add Ingenic JZ4730 pin control and GPIO driver
In reply to Lubomir RintelThis is a fairly minimal driver for the pin controller on JZ4730 SoC.
--- drivers/pinctrl/Kconfig | 8 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-jz4730.c | 346 +++++++++++++++++++++++++++++++ 3 files changed, 355 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-jz4730.c
drivers/pinctrl/Kconfig +8 -0
@@ -177,6 +177,14 @@ config PINCTRL_AT91PIO4 This option is to enable the AT91 pinctrl driver for AT91 PIO4 controller which is available on SAMA5D2 SoC. +config PINCTRL_JZ4730 + bool "Ingenic JZ4730 pinctrl driver" + depends on DM && SOC_JZ4730 + default y + help + This option is to enable the driver for pinctrl and GPIO + controller which is available on Ingenic JZ4730 SoC. + config PINCTRL_INTEL bool "Standard Intel pin-control and pin-mux driver" help
drivers/pinctrl/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_$(SPL_)PINCTRL_GENERIC) += pinctrl-generic.o obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o obj-$(CONFIG_PINCTRL_AT91PIO4) += pinctrl-at91-pio4.o +obj-$(CONFIG_PINCTRL_JZ4730) += pinctrl-jz4730.o obj-y += nxp/ obj-$(CONFIG_$(SPL_)PINCTRL_ROCKCHIP) += rockchip/ obj-$(CONFIG_ARCH_ASPEED) += aspeed/
drivers/pinctrl/pinctrl-jz4730.c new file +346 -0
346 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 12/20 pinctrl: Add Ingenic JZ4730 pin control and GPIO driver
Am Dienstag, den 17.11.2020, 22:00 +0100 schrieb Lubomir Rintel:
Quoted 47 lines
This is a fairly minimal driver for the pin controller on JZ4730 SoC.
Signed-off-by Lubomir Rintel <[email protected]>--- drivers/pinctrl/Kconfig | 8 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-jz4730.c | 346 +++++++++++++++++++++++++++++++ 3 files changed, 355 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-jz4730.cdrivers/pinctrl/Kconfig +8
-0@@ -177,6 +177,14 @@ config PINCTRL_AT91PIO4 This option is to enable the AT91 pinctrl driver for AT91 PIO4 controller which is available on SAMA5D2 SoC. +config PINCTRL_JZ4730 + bool "Ingenic JZ4730 pinctrl driver" + depends on DM && SOC_JZ4730 + default y + help + This option is to enable the driver for pinctrl and GPIO + controller which is available on Ingenic JZ4730 SoC. + config PINCTRL_INTEL bool "Standard Intel pin-control and pin-mux driver" helpdrivers/pinctrl/Makefile +1
-0@@ -5,6 +5,7 @@ obj-$(CONFIG_$(SPL_)PINCTRL_GENERIC) += pinctrl-generic.o obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o obj-$(CONFIG_PINCTRL_AT91PIO4) += pinctrl-at91-pio4.o +obj-$(CONFIG_PINCTRL_JZ4730) += pinctrl-jz4730.o obj-y += nxp/ obj-$(CONFIG_$(SPL_)PINCTRL_ROCKCHIP) += rockchip/ obj-$(CONFIG_ARCH_ASPEED) += aspeed/drivers/pinctrl/pinctrl-jz4730.c new file +0
-0
drivers/pinctrl/pinctrl-jz4730.c line 8
Quoted 8 lines
drivers/pinctrl/pinctrl-jz4730.c new file +8
-0@@ -0,0 +1,346 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* JZ4730 Pin control and GPIO driver. +* +* Copyright (C) 2020 Lubomir Rintel <[email protected]> +*/ + +#include <common.h>
don't use common.h in new code and just include the required header files
Quoted 96 lines
drivers/pinctrl/pinctrl-jz4730.c new file +96
-0+#include <dm.h> +#include <dm/device-internal.h> +#include <dm/pinctrl.h> +#include <asm/gpio.h> +#include <asm/io.h> + +#define PINCTRL_DR (n) (0x00 + (n) * 0x30) +#define PINCTRL_DIR (n) (0x04 + (n) * 0x30) +#define PINCTRL_ODR (n) (0x08 + (n) * 0x30) +#define PINCTRL_PUR (n) (0x0c + (n) * 0x30) +#define PINCTRL_ALR (n) (0x10 + (n) * 0x30) +#define PINCTRL_AUR (n) (0x14 + (n) * 0x30) +#define PINCTRL_IDLR (n) (0x18 + (n) * 0x30) +#define PINCTRL_IDUR (n) (0x1c + (n) * 0x30) +#define PINCTRL_IER (n) (0x20 + (n) * 0x30) +#define PINCTRL_IMR (n) (0x24 + (n) * 0x30) +#define PINCTRL_FR (n) (0x28 + (n) * 0x30) + +struct jz4730_pinctrl_priv { +void __iomem *base; +}; + +struct jz4730_gpio_priv { +unsigned int bank; +}; + +static int jz4730_gpio_get_value (struct udevice *dev,unsigned int offset) +{ +struct jz4730_gpio_priv *priv =dev_get_priv (dev); +struct jz4730_pinctrl_priv *pc_priv =dev_get_priv (dev->parent); + +return !!(readl (pc_priv->base +PINCTRL_DR (priv->bank)) &BIT (offset)); +} + +static int jz4730_gpio_set_value (struct udevice *dev,unsigned int offset,int value) +{ +struct jz4730_gpio_priv *priv =dev_get_priv (dev); +struct jz4730_pinctrl_priv *pc_priv =dev_get_priv (dev->parent); +u32 gpdr =readl (pc_priv->base +PINCTRL_DR (priv->bank)); + +if (value) + gpdr |=BIT (offset); +else + gpdr &= ~BIT (offset); +writel (gpdr, pc_priv->base +PINCTRL_DR (priv->bank)); + +return 0 ; +} + +static int jz4730_gpio_get_direction (struct udevice *dev,unsigned int offset) +{ +struct jz4730_gpio_priv *priv =dev_get_priv (dev); +struct jz4730_pinctrl_priv *pc_priv =dev_get_priv (dev->parent); + +if (offset <16 ) { +if (readl (pc_priv->base +PINCTRL_ALR (priv->bank)) & (3 << (offset *2 ))) +return GPIOF_FUNC ; + }else { +if (readl (pc_priv->base +PINCTRL_AUR (priv->bank)) & (3 << ((offset -16 ) *2 ))) +return GPIOF_FUNC ; + } +if (readl (pc_priv->base +PINCTRL_DIR (priv->bank)) &BIT (offset)) +return GPIOF_OUTPUT ; + +return GPIOF_INPUT ; +} + +static int jz4730_gpio_direction_input (struct udevice *dev,unsigned int offset) +{ +struct jz4730_gpio_priv *priv =dev_get_priv (dev); +struct jz4730_pinctrl_priv *pc_priv =dev_get_priv (dev->parent); + +clrbits_32 (pc_priv->base +PINCTRL_IER (priv->bank),BIT (offset)); +clrbits_32 (pc_priv->base +PINCTRL_DIR (priv->bank),BIT (offset)); +if (offset <16 ) +clrbits_32 (pc_priv->base +PINCTRL_ALR (priv->bank), (3 << (offset <<1 ))); +else +clrbits_32 (pc_priv->base +PINCTRL_AUR (priv->bank), (3 << ((offset -16 ) <<1 ))); + +return 0 ; +} + +static int jz4730_gpio_direction_output (struct udevice *dev,unsigned int offset,int value) +{ +struct jz4730_gpio_priv *priv =dev_get_priv (dev); +struct jz4730_pinctrl_priv *pc_priv =dev_get_priv (dev->parent); + +jz4730_gpio_set_value (dev, offset, value); + +clrbits_32 (pc_priv->base +PINCTRL_IER (priv->bank),BIT (offset)); +setbits_32 (pc_priv->base +PINCTRL_DIR (priv->bank),BIT (offset)); +if (offset <16 ) +clrbits_32 (pc_priv->base +PINCTRL_ALR (priv->bank), (3 << (offset <<1 ))); +else +clrbits_32 (pc_priv->base +PINCTRL_AUR (priv->bank), (3 << ((offset -16 ) <<1 ))); +
drivers/pinctrl/pinctrl-jz4730.c line 114
Quoted 10 lines
drivers/pinctrl/pinctrl-jz4730.c new file +10
-0+return 0 ; +} + +static int jz4730_gpio_probe (struct udevice *dev) +{ +struct jz4730_gpio_priv *priv =dev_get_priv (dev); +struct gpio_dev_priv *uc_priv =dev_get_uclass_priv (dev); +int ret; + + ret =ofnode_read_u32 (dev_ofnode (dev),"reg" , &priv->bank);
you shoud prefer dev_read_u32() respectively the API in include/dm/read.h
Quoted 200 lines
drivers/pinctrl/pinctrl-jz4730.c new file +200
-0+if (ret) +return ret; + + uc_priv->bank_name =strdup (dev->name); + uc_priv->gpio_count =32 ; +return 0 ; +} + +static const struct dm_gpio_ops jz4730_gpio_ops = { + .set_value = jz4730_gpio_set_value, + .get_value = jz4730_gpio_get_value, + .get_function = jz4730_gpio_get_direction, + .direction_input = jz4730_gpio_direction_input, + .direction_output = jz4730_gpio_direction_output, +}; + +static struct driver jz4730_gpio_driver = { + .name ="jz4730-gpio" , + .id =UCLASS_GPIO , + .probe = jz4730_gpio_probe, + .priv_auto_alloc_size =sizeof (struct jz4730_gpio_priv ), + .ops = &jz4730_gpio_ops, +}; + +static const char *const pin_names[] = { +"PA0" ,"PA1" ,"PA2" ,"PA3" ,"PA4" ,"PA5" ,"PA6" ,"PA7" , +"PA8" ,"PA9" ,"PA10" ,"PA11" ,"PA12" ,"PA13" ,"PA14" ,"PA15" , +"PA16" ,"PA17" ,"PA18" ,"PA19" ,"PA20" ,"PA21" ,"PA22" ,"PA23" , +"PA24" ,"PA25" ,"PA26" ,"PA27" ,"PA28" ,"PA29" ,"PA30" ,"PA31" , +"PB0" ,"PB1" ,"PB2" ,"PB3" ,"PB4" ,"PB5" ,"PB6" ,"PB7" , +"PB8" ,"PB9" ,"PB10" ,"PB11" ,"PB12" ,"PB13" ,"PB14" ,"PB15" , +"PB16" ,"PB17" ,"PB18" ,"PB19" ,"PB20" ,"PB21" ,"PB22" ,"PB23" , +"PB24" ,"PB25" ,"PB26" ,"PB27" ,"PB28" ,"PB29" ,"PB30" ,"PB31" , +"PC0" ,"PC1" ,"PC2" ,"PC3" ,"PC4" ,"PC5" ,"PC6" ,"PC7" , +"PC8" ,"PC9" ,"PC10" ,"PC11" ,"PC12" ,"PC13" ,"PC14" ,"PC15" , +"PC16" ,"PC17" ,"PC18" ,"PC19" ,"PC20" ,"PC21" ,"PC22" ,"PC23" , +"PC24" ,"PC25" ,"PC26" ,"PC27" ,"PC28" ,"PC29" ,"PC30" ,"PC31" , +"PD0" ,"PD1" ,"PD2" ,"PD3" ,"PD4" ,"PD5" ,"PD6" ,"PD7" , +"PD8" ,"PD9" ,"PD10" ,"PD11" ,"PD12" ,"PD13" ,"PD14" ,"PD15" , +"PD16" ,"PD17" ,"PD18" ,"PD19" ,"PD20" ,"PD21" ,"PD22" ,"PD23" , +"PD24" ,"PD25" ,"PD26" ,"PD27" ,"PD28" ,"PD29" ,"PD30" ,"PD31" , +}; + +static int jz4730_pinctrl_get_pins_count (struct udevice *dev) +{ +return ARRAY_SIZE (pin_names); +} + +static const char *jz4730_pinctrl_get_pin_name (struct udevice *dev, +unsigned int selector) +{ +return pin_names[selector]; +} + +static const struct { +const char *name; +struct {u32 gpalr, gpaur; } mask[4 ]; +} groups[] = { + {"lcd-16bit" , { {0 , }, {0x00000000 ,0x00c0ffff }, {0 , }, {0 ,0 , } } }, + {"lcd-16bit-tft" , { {0 , }, {0x00000000 ,0xff000000 }, {0 , }, {0 ,0 , } } }, + {"lcd-8bit" , { {0 , }, {0xffff0000 ,0x003f0000 }, {0 , }, {0 ,0 , } } }, + {"lcd-no-pins" , { {0 , }, {0 , }, {0 , }, {0 ,0 , } } }, + {"mac" , { {0 , }, {0 , }, {0 , }, {0 ,0x03ffffff , } } }, + {"mmc-1bit" , { {0 , }, {0x0000f030 ,0 }, {0 , }, {0 ,0 , } } }, + {"mmc-4bit" , { {0 , }, {0x00000fc0 ,0 }, {0 , }, {0 ,0 , } } }, + {"nand-cs1" , { {0 , }, {0 , }, {0 ,0x000000c0 }, {0 ,0 , } } }, + {"nand-cs2" , { {0 , }, {0 , }, {0 ,0x00000300 }, {0 ,0 , } } }, + {"nand-cs3" , { {0 , }, {0 , }, {0 ,0x00000c00 }, {0 ,0 , } } }, + {"nand-cs4" , { {0 , }, {0 , }, {0 ,0x00003000 }, {0 ,0 , } } }, + {"nand-cs5" , { {0 , }, {0 , }, {0 ,0x0000c000 }, {0 ,0 , } } }, + {"pwm0" , { {0 , }, {0 , }, {0 ,0x30000000 }, {0 ,0 , } } }, + {"pwm1" , { {0 , }, {0 , }, {0 ,0xc0000000 }, {0 ,0 , } } }, + {"uart0-data" , { {0 , }, {0 , }, {0 , }, {0 ,0xf0000000 } } }, +}; + +static int jz4730_pinctrl_get_groups_count (struct udevice *dev) +{ +return ARRAY_SIZE (groups); +} + +static const char *jz4730_pinctrl_get_group_name (struct udevice *dev, +unsigned int group_selector) +{ +return groups[group_selector].name; +} + +static const struct { +const char *name; +struct {u32 gpalr, gpaur; } val[4 ]; +} funcs[] = { + {"lcd" , { {0 , }, {0x55550000 ,0x556a5555 }, {0 , }, {0 ,0 , } } }, + {"mac" , { {0 , }, {0 , }, {0 , }, {0 ,0x01555555 , } } }, + {"mmc" , { {0 , }, {0x00005550 ,0 }, {0 , }, {0 ,0 , } } }, + {"nand" , { {0 , }, {0 , }, {0 ,0x000055c0 }, {0 ,0 , } } }, + {"pwm0" , { {0 , }, {0 , }, {0 ,0x10000000 }, {0 ,0 , } } }, + {"pwm1" , { {0 , }, {0 , }, {0 ,0x40000000 }, {0 ,0 , } } }, + {"sleep" , { {0 , }, {0 , }, {0 ,0 }, {0 ,0 , } } }, + {"uart0" , { {0 , }, {0 , }, {0 , }, {0 ,0x50000000 } } }, +}; + +static int jz4730_pinctrl_get_funcs_count (struct udevice *dev) +{ +return ARRAY_SIZE (funcs); +} + +static const char *jz4730_pinctrl_get_func_name (struct udevice *dev, +unsigned int func_selector) +{ +return funcs[func_selector].name; +} + +static inline void update_bits (void __iomem *reg,u32 mask,u32 val) +{ +if (mask) +writel ((readl (reg) & ~mask) | val, reg); +} + +static int jz4730_pinctrl_set (struct udevice *dev, +unsigned int selector, +unsigned int func_selector) +{ +struct jz4730_pinctrl_priv *priv =dev_get_priv (dev); +int bank = selector /32 ; +int pin = selector %32 ; + +if (pin <16 ) { +update_bits (priv->base +PINCTRL_ALR (bank), + funcs[func_selector].val[bank].gpalr, +3 << (pin *2 )); + }else { +update_bits (priv->base +PINCTRL_AUR (bank), + funcs[func_selector].val[bank].gpaur, +3 << ((pin -16 ) *2 )); + } + +return 0 ; +} + +static int jz4730_pinctrl_group_set (struct udevice *dev, +unsigned int group_selector, +unsigned int func_selector) +{ +struct jz4730_pinctrl_priv *priv =dev_get_priv (dev); +int bank; + +for (bank =0 ; bank <ARRAY_SIZE (groups[0 ].mask); bank++) { +update_bits (priv->base +PINCTRL_ALR (bank), + groups[group_selector].mask[bank].gpalr, + funcs[func_selector].val[bank].gpalr); +update_bits (priv->base +PINCTRL_AUR (bank), + groups[group_selector].mask[bank].gpaur, + funcs[func_selector].val[bank].gpaur); + } + +return 0 ; +} + +const int jz4730_pinctrl_get_pin_muxing (struct udevice *dev, +unsigned int selector, +char *buf,int size) +{ +struct jz4730_pinctrl_priv *priv =dev_get_priv (dev); +int bank = selector /32 ; +int pin = selector %32 ; + +snprintf (buf, size,"%3d D%d DI%d OD%d PU%d A%d ID%d IE%d IM%d F%d" , + selector, + (readl (priv->base +PINCTRL_DR (bank)) >> pin) &1 , + (readl (priv->base +PINCTRL_DIR (bank)) >> pin) &1 , + (readl (priv->base +PINCTRL_ODR (bank)) >> pin) &1 , + (readl (priv->base +PINCTRL_PUR (bank)) >> pin) &1 , + pin <16 + ? (readl (priv->base +PINCTRL_ALR (bank)) >> pin *2 ) &3 + : (readl (priv->base +PINCTRL_AUR (bank)) >> (pin -16 ) *2 ) &3 , + pin <16 + ? (readl (priv->base +PINCTRL_IDLR (bank)) >> pin *2 ) &3 + : (readl (priv->base +PINCTRL_IDUR (bank)) >> (pin -16 ) *2 ) &3 , + (readl (priv->base +PINCTRL_IER (bank)) >> pin) &1 , + (readl (priv->base +PINCTRL_IMR (bank)) >> pin) &1 , + (readl (priv->base +PINCTRL_FR (bank)) >> pin) &1 ); + +return 0 ; +} + +const struct pinctrl_ops jz4730_pinctrl_ops = { + .get_pins_count = jz4730_pinctrl_get_pins_count, + .get_pin_name = jz4730_pinctrl_get_pin_name, + .get_groups_count = jz4730_pinctrl_get_groups_count, + .get_group_name = jz4730_pinctrl_get_group_name, + .get_functions_count = jz4730_pinctrl_get_funcs_count, + .get_function_name = jz4730_pinctrl_get_func_name, + .pinmux_set = jz4730_pinctrl_set, + .pinmux_group_set = jz4730_pinctrl_group_set, + .set_state = pinctrl_generic_set_state, + .get_pin_muxing = jz4730_pinctrl_get_pin_muxing, +}; + +int jz4730_pinctrl_probe (struct udevice *dev) +{ +struct jz4730_pinctrl_priv *priv =dev_get_priv (dev);
drivers/pinctrl/pinctrl-jz4730.c line 324
Quoted 10 lines
drivers/pinctrl/pinctrl-jz4730.c new file +10
-0+ofnode node; + + priv->base =dev_remap_addr (dev); +if (!priv->base) +return -EINVAL ; + +dev_for_each_subnode (node, dev) { +struct udevice *cdev; + +if (!ofnode_read_bool (node,"gpio-controller" ))
you should prefer dev_read_bool()
Quoted 22 lines
drivers/pinctrl/pinctrl-jz4730.c new file +22
-0+continue ; + +device_bind_ofnode (dev, &jz4730_gpio_driver,ofnode_get_name (node), + priv, node, &cdev); + } + +return 0 ; +} + +static const struct udevice_id jz4730_pinctrl_of_match[] = { + { .compatible ="ingenic,jz4730-pinctrl" , }, + { } +}; + +U_BOOT_DRIVER (jz4730_pinctrl) = { + .name ="jz4730-pinctrl" , + .id =UCLASS_PINCTRL , + .of_match =of_match_ptr (jz4730_pinctrl_of_match), + .probe = jz4730_pinctrl_probe, + .priv_auto_alloc_size =sizeof (struct jz4730_pinctrl_priv ), + .ops = &jz4730_pinctrl_ops, +};
Signature · 1 line
- Daniel
RFC PATCH 13/20 nand: Use correct prototype of board_nand_init() with SPL_NAND_SIMPLE
In reply to Lubomir Rintelnand_spl_simple.c machinery allways passes a nand_chip argument to board_nand_init() even if the main u-boot proper uses the SYS_NAND_SELF_INIT version.
--- include/nand.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/nand.h +1 -1
@@ -35,7 +35,7 @@ unsigned long nand_size(void);int nand_mtd_to_devnum (struct mtd_info *mtd); -#ifdef CONFIG_SYS_NAND_SELF_INIT +#if defined(CONFIG_SYS_NAND_SELF_INIT ) && !CONFIG_IS_ENABLED (NAND_SIMPLE )void board_nand_init (void );int nand_register (int devnum,struct mtd_info *mtd);#else
Signature · 1 line
2.28.0
RFC PATCH 14/20 nand/raw: Add Ingenic JZ4730 NAND flash driver
In reply to Lubomir RintelThis adds driver for the NAND flash driver for JZ4730 SoC.
Can also be used in the NAND SPL that is too constrained (needs to fit in 4K) to be DT-driven.
--- drivers/mtd/nand/raw/Kconfig | 10 ++ drivers/mtd/nand/raw/Makefile | 1 + drivers/mtd/nand/raw/jz4730_nand.c | 212 +++++++++++++++++++++++++++++ 3 files changed, 223 insertions(+) create mode 100644 drivers/mtd/nand/raw/jz4730_nand.c
drivers/mtd/nand/raw/Kconfig +10 -0
@@ -121,6 +121,16 @@ config NAND_DENALI_DT Enable the driver for NAND flash on platforms using a Denali NAND controller as a DT device. +config NAND_JZ4730 + bool "Support JZ4730 NAND controller" + select SYS_NAND_SELF_INIT + depends on DM_MTD && SOC_JZ4730 + imply CMD_NAND + default y + help + Enable this driver for NAND flash controllers available in + Ingenic JZ4730 SoCs. + config NAND_LPC32XX_SLC bool "Support LPC32XX_SLC controller" help
drivers/mtd/nand/raw/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o obj-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o obj-$(CONFIG_NAND_FSMC) += fsmc_nand.o +obj-$(CONFIG_NAND_JZ4730) += jz4730_nand.o obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o
drivers/mtd/nand/raw/jz4730_nand.c new file +212 -0
212 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 15/20 watchdog: Add Ingenic JZ4730 watchdog timer driver
In reply to Lubomir RintelThis adds support for the watchdog timer on JZ4730 SoC.
Once started, the hardware can't be told to stop counting. It is especially inconvenient given the stock kernel on Skytone Alpha 400 (a JZ4730-based laptop) won't poke the watchdog.
We nevertheless want to keep the driver around in order to be able to reset the processor. For now, the driver uses a timeout of 0 to mean it shouldn't set a timout, which should be good enough for the Alpha 400 boards. There's probaby a nicer solution.
--- drivers/watchdog/Kconfig | 8 ++++ drivers/watchdog/Makefile | 1 + drivers/watchdog/jz4730_wdt.c | 86 +++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/watchdog/jz4730_wdt.c
drivers/watchdog/Kconfig +8 -0
@@ -118,6 +118,14 @@ config WDT_CORTINA This driver support all CPU ISAs supported by Cortina Access CAxxxx SoCs. +config WDT_JZ4730 + bool "Ingenic JZ4730 watchdog timer support" + depends on WDT && SOC_JZ4730 + default y + help + Select this to enable watchdog timer, which can be found on + Ingenic JZ4730 chips. + config WDT_MPC8xx bool "MPC8xx watchdog timer support" depends on WDT && MPC8xx
drivers/watchdog/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_WDT_BCM6345) += bcm6345_wdt.o obj-$(CONFIG_WDT_CORTINA) += cortina_wdt.o obj-$(CONFIG_WDT_ORION) += orion_wdt.o obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o +obj-$(CONFIG_WDT_JZ4730) += jz4730_wdt.o obj-$(CONFIG_WDT_MPC8xx) += mpc8xx_wdt.o obj-$(CONFIG_WDT_MT7621) += mt7621_wdt.o obj-$(CONFIG_WDT_MTK) += mtk_wdt.o
drivers/watchdog/jz4730_wdt.c new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 16/20 net: Add Ingenic JZ4730 Ethernet driver
In reply to Lubomir RintelThis adds support for Ethernet MAC block on Ingenic JZ4730 SoC.
Based on old Ingenic GPL code dump, but significantly cleaned up and reworked (e.g. to plug into the MAC framework).
--- drivers/net/Kconfig | 11 + drivers/net/Makefile | 1 + drivers/net/jz4730_eth.c | 447 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 459 insertions(+) create mode 100644 drivers/net/jz4730_eth.c
drivers/net/Kconfig +11 -0
@@ -342,6 +342,17 @@ config FSLDMAFEC This driver supports the network interface units in the ColdFire family. + +config JZ4730_ETH + bool "Ingenic JZ4730 Ethernet Support" + depends on DM_ETH && SOC_JZ4730 + select PHYLIB + select MII + default y + help + This driver supports the network interface units in the + Ingenic JZ4730 SoC. + config KS8851_MLL bool "Microchip KS8851-MLL controller driver" help
drivers/net/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_FTGMAC100) += ftgmac100.o obj-$(CONFIG_FTMAC110) += ftmac110.o obj-$(CONFIG_FTMAC100) += ftmac100.o obj-$(CONFIG_GMAC_ROCKCHIP) += gmac_rockchip.o +obj-$(CONFIG_JZ4730_ETH) += jz4730_eth.o obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o obj-$(CONFIG_LAN91C96) += lan91c96.o obj-$(CONFIG_LPC32XX_ETH) += lpc32xx_eth.o
drivers/net/jz4730_eth.c new file +447 -0
447 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 17/20 mips: dts: Add Ingenic JZ4730
In reply to Lubomir RintelThis generally comes from a mipsbook400 Letux git repository [1], not mainline. It seems to be the work of Paul Boddie and H. Nikolaus Schaller.
[1] https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/dt-mipsbook400
Some more things need to be addressed here:
1.) Linux upstream review of the bindings.
The tree is generally very nice and complete and bindings look good, but an upstream review could still cut off some rough edges. In particular I think the gpio/pinctrl bindings don't seem to describe the hardware in a very useful way (GPIO split into multiple nodes for ports slaves to the pinctrl node).
2.) Missing copyright/license notices.
Probably an oversignt.
3.) I've made some changes that I need to split out into separate patches
for upstream and document.
--- arch/mips/dts/jz4730.dtsi | 340 +++++++++++++++++++++++++ include/dt-bindings/clock/jz4730-cgu.h | 47 ++++ 2 files changed, 387 insertions(+) create mode 100644 arch/mips/dts/jz4730.dtsi create mode 100644 include/dt-bindings/clock/jz4730-cgu.h
arch/mips/dts/jz4730.dtsi new file +340 -0
@@ -0,0 +1,340 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <dt-bindings/clock/jz4730-cgu.h> + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ingenic,jz4730"; + + cpuintc: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + intc: interrupt-controller at 10001000 { + compatible = "ingenic,jz4730-intc"; + reg = <0x10001000 0x14>; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&cpuintc>; + interrupts = <2>; + }; + + ext: ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + }; + + rtc: rtc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + msc16m: msc16m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <16000000>; + }; + + msc24m: msc24m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + }; + + usb48m: usb48m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <48000000>; + }; + + cgu: jz4730-cgu at 10000000 { + compatible = "ingenic,jz4730-cgu"; + reg = <0x10000000 0x100>; + + clocks = <&ext>, <&rtc>, <&msc16m>, <&msc24m>, <&usb48m>; + clock-names = "ext", "rtc", "msc16m", "msc24m", "usb48m"; + + #clock-cells = <1>; + }; + + tcu: timer at 10002000 { + compatible = "ingenic,jz4730-tcu"; + reg = <0x10002000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x10002000 0x1000>; + + #clock-cells = <1>; + + clocks = <&cgu JZ4730_CLK_RTC>, + <&cgu JZ4730_CLK_EXT>, + <&cgu JZ4730_CLK_PCLK>, + <&cgu JZ4730_CLK_TCU>; + clock-names = "rtc", "ext", "pclk", "tcu"; + + interrupt-controller; + #interrupt-cells = <1>; + + interrupt-parent = <&intc>; + interrupts = <24 23 22>; + }; + + watchdog: watchdog at 10004000 { + compatible = "ingenic,jz4730-watchdog"; + reg = <0x10004000 0x100>; + + clocks = <&cgu JZ4730_CLK_WDT>; + clock_names = "wdt"; + }; + + pwm: pwm at 10050000 { + compatible = "ingenic,jz4730-pwm"; + reg = <0x10050000 0x2000>; + + #pwm-cells = <2>; + + clocks = <&ext>; + clock-names = "ext"; + }; + + rtc_dev: rtc at 10003000 { + compatible = "ingenic,jz4740-rtc"; + reg = <0x10003000 0x10>; + + interrupt-parent = <&intc>; + interrupts = <15>; + + clocks = <&cgu JZ4730_CLK_RTC>; + clock-names = "rtc"; + }; + + pinctrl: pin-controller at 10010000 { + compatible = "ingenic,jz4730-pinctrl"; + reg = <0x10010000 0x400>; + + #address-cells = <1>; + #size-cells = <0>; + + gpa: gpio at 0 { + compatible = "ingenic,jz4730-gpio"; + reg = <0>; + + gpio-controller; + gpio-ranges = <&pinctrl 0 0 32>; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <28>; + }; + + gpb: gpio at 1 { + compatible = "ingenic,jz4730-gpio"; + reg = <1>; + + gpio-controller; + gpio-ranges = <&pinctrl 0 32 32>; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <27>; + }; + + gpc: gpio at 2 { + compatible = "ingenic,jz4730-gpio"; + reg = <2>; + + gpio-controller; + gpio-ranges = <&pinctrl 0 64 32>; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <26>; + }; + + gpd: gpio at 3 { + compatible = "ingenic,jz4730-gpio"; + reg = <3>; + + gpio-controller; + gpio-ranges = <&pinctrl 0 96 32>; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&intc>; + interrupts = <25>; + }; + }; + + i2s: i2s { + compatible = "ingenic,jt4730-dai"; + + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c: i2c at 10042000 { + compatible = "ingenic,jz4730-i2c"; + reg = <0x10042000 0x10>; + + #address-cells = <1>; + #size-cells = <0>; + + interrupt-parent = <&intc>; + interrupts = <1>; + + clocks = <&cgu JZ4730_CLK_PLL>; + clock-names = "i2c"; + + clock-frequency = <100000>; + }; + + mmc: mmc at 10021000 { + compatible = "ingenic,jz4740-mmc"; + reg = <0x10021000 0x100>; + + interrupt-parent = <&intc>; + interrupts = <14>; + + clocks = <&cgu JZ4730_CLK_MMC>; + clock-names = "mmc"; + }; + + uart0: serial at 10030000 { + compatible = "ingenic,jz4740-uart", "ingenic,jz4780-uart"; + reg = <0x10030000 0x100>; + + reg-shift = <2>; + fifo-size = <16>; + tx-threshold = <8>; + + interrupt-parent = <&intc>; + interrupts = <9>; + + clocks = <&ext>, <&cgu JZ4730_CLK_UART0>; + clock-names = "baud", "module"; + }; + + uart1: serial at 10031000 { + compatible = "ingenic,jz4740-uart", "ingenic,jz4780-uart"; + reg = <0x10031000 0x100>; + + reg-shift = <2>; + fifo-size = <16>; + tx-threshold = <8>; + + interrupt-parent = <&intc>; + interrupts = <8>; + + clocks = <&ext>, <&cgu JZ4730_CLK_UART1>; + clock-names = "baud", "module"; + }; + + uart2: serial at 10032000 { + compatible = "ingenic,jz4740-uart", "ingenic,jz4780-uart"; + reg = <0x10032000 0x100>; + + reg-shift = <2>; + fifo-size = <16>; + tx-threshold = <8>; + + interrupt-parent = <&intc>; + interrupts = <7>; + + clocks = <&ext>, <&cgu JZ4730_CLK_UART2>; + clock-names = "baud", "module"; + }; + + uart3: serial at 10033000 { + compatible = "ingenic,jz4740-uart", "ingenic,jz4780-uart"; + reg = <0x10033000 0x100>; + + reg-shift = <2>; + fifo-size = <16>; + tx-threshold = <8>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + clocks = <&ext>, <&cgu JZ4730_CLK_UART3>; + clock-names = "baud", "module"; + }; + + dma: dma at 10020000 { + compatible = "ingenic,jz4730-dma"; + reg = <0x10020000 0x100>; + + interrupt-parent = <&intc>; + interrupts = <21>; + + clocks = <&cgu JZ4730_CLK_DMA>; + clock-names = "dma"; + + #dma-cells = <1>; + dma-channels = <6>; + }; + + emc: memory-controller at 13010000 { + #address-cells = <0>; + #size-cells = <0>; + compatible = "ingenic,jz4730-emc", "simple-mfd"; + reg = <0x13010000 0xf000>; + + nand: nand-controller { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ingenic,jz4730-nand"; + }; + }; + + uhc: uhc at 13030000 { + compatible = "ingenic,jz4740-ohci", "generic-ohci"; + reg = <0x13030000 0x1000>; + + clocks = <&cgu JZ4730_CLK_UHC>; + assigned-clocks = <&cgu JZ4730_CLK_UHC>; + assigned-clock-rates = <48000000>; + + interrupt-parent = <&intc>; + interrupts = <13>; + + status = "disabled"; + }; + + ethernet: ethernet at 13100000 { + compatible = "ingenic,jz4730-ethernet"; + reg = <0x13100000 0x1000>; + + mdio: mdio { + #address-cells = <1>; + #size-cells = <0>; + }; + }; + + lcd: lcd at 10050000 { + compatible = "ingenic,jz4740-lcd"; + reg = <0x10050000 0x100>; + + interrupt-parent = <&intc>; + interrupts = <30>; + + clocks = <&cgu JZ4730_CLK_LCD>, <&cgu JZ4730_CLK_LCD_PCLK>; + clock-names = "lcd", "lcd_pclk"; + }; +};
include/dt-bindings/clock/jz4730-cgu.h new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 18/20 mips/mach-jz47xx: Add Ingenic JZ4730 support
In reply to Lubomir RintelThis adds support for the Ingenic JZ4730 SoC. There's not much more than the build machinery and SPL stage because the main stage is entirely DT driven.
The SPL is fairly unsophisticated since it has to fit into 4096 bytes. The serial support didn't fit, and the pinmux and PLL init duplicates some functionality of full drivers for space reasons. A regular NAND flash driver is used though.
--- arch/mips/mach-jz47xx/Kconfig | 39 +++ arch/mips/mach-jz47xx/Makefile | 2 + arch/mips/mach-jz47xx/jz4730/Kconfig | 87 ++++++ arch/mips/mach-jz47xx/jz4730/Makefile | 3 + arch/mips/mach-jz47xx/jz4730/lowlevel_init.S | 37 +++ arch/mips/mach-jz47xx/jz4730/spl.c | 293 +++++++++++++++++++ 6 files changed, 461 insertions(+) create mode 100644 arch/mips/mach-jz47xx/jz4730/Kconfig create mode 100644 arch/mips/mach-jz47xx/jz4730/Makefile create mode 100644 arch/mips/mach-jz47xx/jz4730/lowlevel_init.S create mode 100644 arch/mips/mach-jz47xx/jz4730/spl.c
arch/mips/mach-jz47xx/Kconfig +39 -0
@@ -4,6 +4,41 @@ menu "Ingenic JZ47xx platforms" config SYS_SOC default "jz47xx" +config SPL_TEXT_BASE + default 0x80000000 if ARCH_JZ47XX + +config SYS_TEXT_BASE + default 0x80100000 if ARCH_JZ47XX + +config SOC_JZ4730 + bool + select MIPS_INIT_STACK_IN_SRAM + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_LITTLE_ENDIAN + select SYS_RELOC_GD_ENV_ADDR + select SPL_INIT_STACK_WITHOUT_MALLOC_F if SPL + select SPL_LIBCOMMON_SUPPORT if SPL + select SPL_LIBGENERIC_SUPPORT if SPL + select SPL_LOADER_SUPPORT if SPL + imply CLK + imply CMD_DM + imply DM_GPIO + imply DM_MMC + imply DM_MTD + imply DM_SERIAL + imply FIT + imply MMC + imply MTD + imply MTD_RAW_NAND + imply PINCTRL + imply SPL + imply SYS_NS16550 + imply SYSRESET + imply SYSRESET_WATCHDOG + imply TIMER + help + Support for Ingenic JZ4730 family SoCs. + config SOC_JZ4780 bool select SUPPORTS_LITTLE_ENDIAN
@@ -21,6 +56,10 @@ config TARGET_JZ4780_CI20 endchoice +source "arch/mips/mach-jz47xx/jz4730/Kconfig" + +source "board/skytone/alpha400/Kconfig" + source "board/imgtec/ci20/Kconfig" endmenu
arch/mips/mach-jz47xx/Makefile +2 -0
@@ -2,4 +2,6 @@ extra-$(CONFIG_SPL_BUILD) := start.o +obj-$(CONFIG_SOC_JZ4730) += jz4730/ + obj-$(CONFIG_SOC_JZ4780) += jz4780/
arch/mips/mach-jz47xx/jz4730/Kconfig new file +87 -0
87 lines not on this page · raw message
arch/mips/mach-jz47xx/jz4730/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-y += lowlevel_init.o + +obj-$(CONFIG_SPL_BUILD) += spl.o
arch/mips/mach-jz47xx/jz4730/lowlevel_init.S new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2020 Lubomir Rintel <[email protected]> + * + * Derived from work that's Copyright (c) 2003 + * Wolfgang Denk <[email protected]> + */ + +#include <config.h> +#include <asm/regdef.h> +#include <asm/mipsregs.h> +#include <asm/asm.h> + +LEAF(lowlevel_init) + + /* Invalidate BTB */ + mfc0 t0, CP0_CONFIG, 7 + nop + ori t0, 2 + mtc0 t0, CP0_CONFIG, 7 + nop + + /* + * CU0=UM=EXL=IE=0, BEV=ERL=1, IP2~7=1 + */ + li t0, 0x0040FC04 + mtc0 t0, CP0_STATUS + + /* CAUSE register */ + /* IV=1, use the specical interrupt vector (0x200) */ + li t1, 0x00800000 + mtc0 t1, CP0_CAUSE + + jr ra + nop + + END(lowlevel_init)
arch/mips/mach-jz47xx/jz4730/spl.c new file +293 -0
293 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 19/20 mips: dts: Add Skytone Alpha 400
In reply to Lubomir RintelThis generally comes from a mipsbook400 Letux git repository [1], not mainline. It seems to be the work of Paul Boddie and H. Nikolaus Schaller.
[1] https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/dt-mipsbook400
Some more things need to be addressed here:
1.) Linux upstream review of the bindings.
The tree is generally very nice and complete and bindings look good, but an upstream review could still cut off some rough edges. In particular I think the gpio/pinctrl bindings don't seem to describe the hardware in a very useful way (GPIO split into multiple nodes for ports slaves to the pinctrl node).
2.) Missing copyright/license notices.
Probably an oversignt.
3.) I've made some changes that I need to split out into separate patches
for upstream and document.
--- arch/mips/dts/Makefile | 1 + arch/mips/dts/alpha400.dts | 542 +++++++++++++++++++++++++++++++++++++ 2 files changed, 543 insertions(+) create mode 100644 arch/mips/dts/alpha400.dts
arch/mips/dts/Makefile +1 -0
@@ -25,6 +25,7 @@ dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f at st1704.dtb dtb-$(CONFIG_BOARD_SFR_NB4_SER) += sfr,nb4-ser.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb dtb-$(CONFIG_BOARD_VOCORE2) += vocore_vocore2.dtb +dtb-$(CONFIG_TARGET_JZ4730_ALPHA400) += alpha400.dtb dtb-$(CONFIG_TARGET_JZ4780_CI20) += ci20.dtb dtb-$(CONFIG_SOC_LUTON) += luton_pcb090.dtb luton_pcb091.dtb dtb-$(CONFIG_SOC_OCELOT) += ocelot_pcb120.dtb ocelot_pcb123.dtb
arch/mips/dts/alpha400.dts new file +542 -0
542 lines not on this page · raw message
Signature · 1 line
2.28.0
RFC PATCH 20/20 board: Add Skytone Alpha 400
In reply to Lubomir RintelThis is a MIPS subnotebook built around Ingenic JZ4730 SoC. It is known by many names, including CPC400 and Letux 400, but the OEM seems to be Skytone and use the "Alpha 400" designator.
--- arch/mips/mach-jz47xx/Kconfig | 23 ++++++++ board/skytone/alpha400/Kconfig | 60 +++++++++++++++++++ board/skytone/alpha400/Makefile | 3 + board/skytone/alpha400/alpha400.c | 43 ++++++++++++++ configs/alpha400_nand_defconfig | 11 ++++ include/configs/alpha400.h | 98 +++++++++++++++++++++++++++++++ 6 files changed, 238 insertions(+) create mode 100644 board/skytone/alpha400/Kconfig create mode 100644 board/skytone/alpha400/Makefile create mode 100644 board/skytone/alpha400/alpha400.c create mode 100644 configs/alpha400_nand_defconfig create mode 100644 include/configs/alpha400.h
arch/mips/mach-jz47xx/Kconfig +23 -0
@@ -50,6 +50,29 @@ config SOC_JZ4780 choice prompt "Board select" +config TARGET_JZ4730_ALPHA400 + bool "Skytone Alpha 400 Mini Notebook" + select SOC_JZ4730 + select CMD_MMC if DISTRO_DEFAULTS + select SPL_NAND_BASE if SPL + select SPL_NAND_DRIVERS if SPL + select SPL_NAND_SIMPLE if SPL + select SPL_NAND_SUPPORT if SPL + select SYS_NAND_U_BOOT_LOCATIONS + imply DISTRO_DEFAULTS + imply DM_ETH + imply DM_ETH_PHY + imply DM_GPIO + imply DM_MMC + imply DM_MTD + imply DM_REGULATOR + imply DM_REGULATOR_FIXED + imply NET_RANDOM_ETHADDR + help + Support for a MIPS subnotebook built around Ingenic JZ4730 SoC. + It is known by many names, including CPC400 and Letux 400, but + the OEM seems to be Skytone and use the "Alpha 400" designator. + config TARGET_JZ4780_CI20 bool "Creator CI20 Reference Board" select SOC_JZ4780
board/skytone/alpha400/Kconfig new file +60 -0
60 lines not on this page · raw message
board/skytone/alpha400/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y := alpha400.o
board/skytone/alpha400/alpha400.c new file +43 -0
43 lines not on this page · raw message
configs/alpha400_nand_defconfig new file +11 -0
@@ -0,0 +1,11 @@ +CONFIG_MIPS=y +CONFIG_ARCH_JZ47XX=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_JFFS2=y +CONFIG_MTDIDS_DEFAULT="nand0=jz4730-nand.0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=jz4730-nand.0:1m(bootloader),3m(kernel),1m(mac),5m(mini),1014m(yaffs2),-(extend)" +# CONFIG_SPL_DOS_PARTITION is not set +# CONFIG_EFI_PARTITION is not set +# CONFIG_MMC_HW_PARTITIONING is not set +CONFIG_NS16550_DYNAMIC=y +CONFIG_WATCHDOG_TIMEOUT_MSECS=0
include/configs/alpha400.h new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
2.28.0