Add support for keystone2 SoC and K2HK EVM
Subsystems (6)
v5 cover Add support for keystone2 SoC and K2HK EVM
This patch set add support for Keystone2 SoC and K2HK EVM.
Change history:
v5
- Rebased to v2014.04-rc3
- Replaced reg_rmw() with clrsetbits_le32()
- i2c Makefile update to add davinci_i2c sorted
- simplified spi_cs_is_valid() in davinci_spi driver
v4
- Added multibus support in i2c driver. Tested only on Keystone
- Added comments to fdt patch
v3
- Seperated network driver patches from the original series and and is now a different set as there are outstanding issues to be discussed and sorted out. Also the original series is ready for merge to upstream IMO.
- Review comments incorporated. Following are the major comments addressed
- Added KBUILD target for u-boot-spi.gph
- Added bootup and flashing instructions in README
- Cleaned up manually replacing #define <tab> with #define <space>
- Cleaned up k2hk_evm.h include file to remove unnecessary options
v2
- Review comments incorporated. Following are major comments addressed
- split network driver to navigator driver + ethernet driver
- replaced register base + offset implemenation with struct based register access implementation
- Added Readme for NAND no subpage write option
- re-use code for davinci i2c driver on keystone2 with updates
- clock-k2hk.c merged to clock.c
- currently keeping board specific getclk() command. See the thread for the rational.
- Added update to davinci spi driver to re-use on keystone
v1
- added separate patch for sorting tools/Makefile entries
- reworked gpimage patch to allow more re-use across omapimage/gpimage
- dropped patch related to ubifs file size
- added keystone SoC and K2HK EVM support
v0
- preparatory patch for keystone
Murali Karicheri (5):
tools: mkimage: add support for gpimage format
NAND: DaVinci: allow forced disable of subpage writes i2c, davinci: move i2c_defs.h to the drivers/i2c directory
spi: davinci: add support for multiple bus and chip select
k2hk-evm: add configuration for spi1 and spi2 support
Vitaly Andrianov (4):
fdt: call ft_board_setup_ex() at the end of image_setup_libfdt()
arm: add support for arch timer
i2c, davinci: convert driver to new mutlibus/mutliadapter framework
k2hk: add support for k2hk SOC and EVM
Makefile | 10 + README | 5 + arch/arm/cpu/arm926ejs/davinci/dm355.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm365.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm644x.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm646x.c | 2 +- arch/arm/cpu/armv7/keystone/Makefile | 17 + arch/arm/cpu/armv7/keystone/aemif.c | 71 ++++ arch/arm/cpu/armv7/keystone/clock.c | 318 ++++++++++++++++ arch/arm/cpu/armv7/keystone/cmd_clock.c | 124 ++++++ arch/arm/cpu/armv7/keystone/cmd_mon.c | 131 +++++++ arch/arm/cpu/armv7/keystone/ddr3.c | 69 ++++ arch/arm/cpu/armv7/keystone/init.c | 56 +++ arch/arm/cpu/armv7/keystone/msmc.c | 68 ++++ arch/arm/cpu/armv7/keystone/psc.c | 238 ++++++++++++ arch/arm/cpu/armv7/keystone/spl.c | 45 +++ arch/arm/include/asm/arch-davinci/i2c_defs.h | 71 +--- arch/arm/include/asm/arch-keystone/clock-k2hk.h | 109 ++++++ arch/arm/include/asm/arch-keystone/clock.h | 17 + arch/arm/include/asm/arch-keystone/clock_defs.h | 111 ++++++ arch/arm/include/asm/arch-keystone/emif_defs.h | 73 ++++ arch/arm/include/asm/arch-keystone/hardware-k2hk.h | 150 ++++++++ arch/arm/include/asm/arch-keystone/hardware.h | 175 +++++++++ arch/arm/include/asm/arch-keystone/i2c_defs.h | 17 + arch/arm/include/asm/arch-keystone/nand_defs.h | 23 ++ arch/arm/include/asm/arch-keystone/psc_defs.h | 90 +++++ arch/arm/include/asm/arch-keystone/spl.h | 12 + arch/arm/lib/Makefile | 1 + arch/arm/lib/arch_timer.c | 58 +++ board/ti/k2hk_evm/Makefile | 9 + board/ti/k2hk_evm/README | 122 ++++++ board/ti/k2hk_evm/board.c | 236 ++++++++++++ board/ti/k2hk_evm/ddr3.c | 269 +++++++++++++ boards.cfg | 1 + common/image-fdt.c | 5 + common/image.c | 1 + drivers/i2c/Makefile | 2 +- drivers/i2c/davinci_i2c.c | 402 ++++++++++++-------- drivers/i2c/davinci_i2c.h | 78 ++++ drivers/mtd/nand/davinci_nand.c | 3 + drivers/serial/ns16550.c | 8 + drivers/spi/davinci_spi.c | 49 ++- drivers/spi/davinci_spi.h | 33 ++ include/configs/cam_enc_4xx.h | 8 +- include/configs/da830evm.h | 8 +- include/configs/da850evm.h | 8 +- include/configs/davinci_dm355evm.h | 8 +- include/configs/davinci_dm355leopard.h | 8 +- include/configs/davinci_dm365evm.h | 8 +- include/configs/davinci_dm6467evm.h | 8 +- include/configs/davinci_dvevm.h | 8 +- include/configs/davinci_schmoogie.h | 8 +- include/configs/davinci_sffsdr.h | 8 +- include/configs/davinci_sonata.h | 8 +- include/configs/ea20.h | 7 +- include/configs/enbw_cmc.h | 8 +- include/configs/k2hk_evm.h | 221 +++++++++++ include/fdt_support.h | 7 + include/image.h | 1 + tools/Makefile | 2 + tools/gpheader.h | 40 ++ tools/gpimage-common.c | 80 ++++ tools/gpimage.c | 77 ++++ tools/imagetool.c | 2 + tools/imagetool.h | 1 + tools/omapimage.c | 104 +---- tools/omapimage.h | 5 - 67 files changed, 3541 insertions(+), 387 deletions(-) create mode 100644 arch/arm/cpu/armv7/keystone/Makefile create mode 100644 arch/arm/cpu/armv7/keystone/aemif.c create mode 100644 arch/arm/cpu/armv7/keystone/clock.c create mode 100644 arch/arm/cpu/armv7/keystone/cmd_clock.c create mode 100644 arch/arm/cpu/armv7/keystone/cmd_mon.c create mode 100644 arch/arm/cpu/armv7/keystone/ddr3.c create mode 100644 arch/arm/cpu/armv7/keystone/init.c create mode 100644 arch/arm/cpu/armv7/keystone/msmc.c create mode 100644 arch/arm/cpu/armv7/keystone/psc.c create mode 100644 arch/arm/cpu/armv7/keystone/spl.c create mode 100644 arch/arm/include/asm/arch-keystone/clock-k2hk.h create mode 100644 arch/arm/include/asm/arch-keystone/clock.h create mode 100644 arch/arm/include/asm/arch-keystone/clock_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/emif_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/hardware-k2hk.h create mode 100644 arch/arm/include/asm/arch-keystone/hardware.h create mode 100644 arch/arm/include/asm/arch-keystone/i2c_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/nand_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/psc_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/spl.h create mode 100644 arch/arm/lib/arch_timer.c create mode 100644 board/ti/k2hk_evm/Makefile create mode 100644 board/ti/k2hk_evm/README create mode 100644 board/ti/k2hk_evm/board.c create mode 100644 board/ti/k2hk_evm/ddr3.c create mode 100644 drivers/i2c/davinci_i2c.h create mode 100644 include/configs/k2hk_evm.h create mode 100644 tools/gpheader.h create mode 100644 tools/gpimage-common.c create mode 100644 tools/gpimage.c
Signature · 1 line
1.7.9.5
PATCH v5 1/9 fdt: call ft_board_setup_ex() at the end of image_setup_libfdt()
From: Vitaly Andrianov <[email protected]>
The keystone2 SOC requires to fix all 32 bit aliased addresses to their 36 physical format. This has to happen after all fdt nodes are added or modified.
--- common/image-fdt.c | 5 +++++ include/fdt_support.h | 7 +++++++ 2 files changed, 12 insertions(+)
common/image-fdt.c +5 -0
@@ -487,5 +487,10 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,if (!ft_verify_fdt (blob))return -1 ; +#ifdef CONFIG_SOC_K2HK +if (IMAGE_OF_BOARD_SETUP ) +ft_board_setup_ex (blob, gd->bd); +#endif +return 0 ; }
include/fdt_support.h +7 -0
@@ -63,6 +63,13 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose);#endif void ft_board_setup (void *blob,bd_t *bd); +/* +* The keystone2 SOC requires all 32 bit aliased addresses to be converted +* to their 36 physical format. This has to happen after all fdt nodes +* are added or modified by the image_setup_libfdt(). The ft_board_setup_ex() +* called at the end of the image_setup_libfdt() is to do that convertion. +*/ +void ft_board_setup_ex (void *blob,bd_t *bd);void ft_cpu_setup (void *blob,bd_t *bd);void ft_pci_setup (void *blob,bd_t *bd);
Signature · 1 line
1.7.9.5
PATCH v5 2/9 tools: mkimage: add support for gpimage format
In reply to Murali KaricheriThis patch add support for gpimage format as a preparatory patch for porting u-boot for keystone2 devices and is based on omapimage format. It re-uses gph header to store the size and loadaddr as done in omapimage.c
--- common/image.c | 1 + include/image.h | 1 + tools/Makefile | 2 + tools/gpheader.h | 40 +++++++++++++++++++ tools/gpimage-common.c | 80 +++++++++++++++++++++++++++++++++++++ tools/gpimage.c | 77 +++++++++++++++++++++++++++++++++++ tools/imagetool.c | 2 + tools/imagetool.h | 1 + tools/omapimage.c | 104 ++++++++---------------------------------------- tools/omapimage.h | 5 --- 10 files changed, 220 insertions(+), 93 deletions(-) create mode 100644 tools/gpheader.h create mode 100644 tools/gpimage-common.c create mode 100644 tools/gpimage.c
common/image.c +1 -0
@@ -125,6 +125,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_FILESYSTEM, "filesystem", "Filesystem Image", }, { IH_TYPE_FIRMWARE, "firmware", "Firmware", }, { IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", }, + { IH_TYPE_GPIMAGE, "gpimage", "TI Keystone SPL Image",}, { IH_TYPE_KERNEL, "kernel", "Kernel Image", }, { IH_TYPE_KERNEL_NOLOAD, "kernel_noload", "Kernel Image (no loading done)", }, { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",},
include/image.h +1 -0
@@ -215,6 +215,7 @@ struct lmb;#define IH_TYPE_KERNEL_NOLOAD 14/* OS Kernel Image, can run from any load address */ #define IH_TYPE_PBLIMAGE 15/* Freescale PBL Boot Image */ #define IH_TYPE_MXSIMAGE 16/* Freescale MXSBoot Image */ +#define IH_TYPE_GPIMAGE 17/* TI Keystone GPHeader Image */ /* * Compression Types
tools/Makefile +2 -0
@@ -73,6 +73,8 @@ dumpimage-mkimage-objs := aisimage.o \ crc32.o \ default_image.o \ fit_image.o \ + gpimage.o \ + gpimage-common.o \ image-fit.o \ image-host.o \ image.o \
tools/gpheader.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* (C) Copyright 2014 +* Texas Instruments Incorporated +* Refactored common functions in to gpimage-common.c. Include this common +* header file +* +* (C) Copyright 2010 +* Linaro LTD, www.linaro.org +* Author: John Rigby <[email protected]> +* Based on TI's signGP.c +* +* (C) Copyright 2009 +* Stefano Babic, DENX Software Engineering, sbabic at denx.de. +* +* (C) Copyright 2008 +* Marvell Semiconductor <www.marvell.com> +* Written-by: Prafulla Wadaskar <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _GPIMAGE_H_ +#define _GPIMAGE_H_ + +/* common headers for gpimage and omapimage formats */ +struct gp_header { +uint32_t size; +uint32_t load_addr; +}; +#define GPIMAGE_HDR_SIZE (sizeof(struct gp_header)) + +/* common functions across gpimage and omapimage handlers */ +int valid_gph_size (uint32_t size); +int valid_gph_load_addr (uint32_t load_addr); +int gph_verify_header (struct gp_header *gph,int be); +void gph_print_header (const struct gp_header *gph,int be); +void gph_set_header (struct gp_header *gph,uint32_t size,uint32_t load_addr, +int be); +int gpimage_check_params (struct image_tool_params *params); +#endif
tools/gpimage-common.c new file +80 -0
80 lines not on this page · raw message
tools/gpimage.c new file +77 -0
77 lines not on this page · raw message
tools/imagetool.c +2 -0
@@ -45,6 +45,8 @@ void register_image_tool(imagetool_register_t image_register)init_ubl_image_type ();/* Init Davinci AIS support */ init_ais_image_type (); +/* Init TI Keystone boot image generation/list support */ +init_gpimage_type (); }/*
tools/imagetool.h +1 -0
@@ -167,6 +167,7 @@ void init_mxs_image_type(void);void init_fit_image_type (void );void init_ubl_image_type (void );void init_omap_image_type (void ); +void init_gpimage_type (void );void pbl_load_uboot (int fd,struct image_tool_params *mparams);
tools/omapimage.c +16 -88
180 lines not on this page · raw message
tools/omapimage.h +0 -5
@@ -25,10 +25,5 @@ struct ch_settings { uint32_t flags; }; -struct gp_header { -uint32_t size; -uint32_t load_addr; -}; -#define KEY_CHSETTINGS 0xC0C0C0C1#endif /* _OMAPIMAGE_H_ */
Signature · 1 line
1.7.9.5
PATCH v5 3/9 arm: add support for arch timer
In reply to Murali KaricheriFrom: Vitaly Andrianov <[email protected]>
This patch add basic support for the architecture timer found on recent ARMv7 based SoCs.
--- arch/arm/lib/Makefile | 1 + arch/arm/lib/arch_timer.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 arch/arm/lib/arch_timer.c
arch/arm/lib/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o else obj-$(CONFIG_SPL_FRAMEWORK) += spl.o endif +obj-$(CONFIG_SYS_ARCH_TIMER) += arch_timer.o obj-y += sections.o ifdef CONFIG_ARM64
arch/arm/lib/arch_timer.c new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v5 3/9 arm: add support for arch timer
Hi Murali,
Quoted 11 lines · On Tue, 1 Apr 2014 14:44:23 -0400 Murali Karicheri <[email protected]> wrote:
From: Vitaly Andrianov <[email protected]>
This patch add basic support for the architecture timer found on recent ARMv7 based SoCs.
Signed-off-by Vitaly Andrianov <[email protected]>Signed-off-by Murali Karicheri <[email protected]>Acked-by Tom Rini <[email protected]>--- arch/arm/lib/Makefile | 1 + arch/arm/lib/arch_timer.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
I am not familiar with this timer, but your commit description implies it is specific to ARMv7.
If so, it looks like it should go to arch/arm/cpu/armv7/ . Is this right?
Best Regards
Masahiro Yamada
Andrianov
PATCH v5 3/9 arm: add support for arch timer
Hi Masahiro,
Quoted 29 lines
-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Masahiro Yamada
Sent: Wednesday, April 02, 2014 9:46 PM
To: Karicheri, Muralidharan
Cc: Rini, Tom; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v5 3/9] arm: add support for arch timerHi Murali,
Quoted 6 lines · On Tue, 1 Apr 2014 14:44:23 -0400 Murali Karicheri <[email protected]> wrote:
From: Vitaly Andrianov <[email protected]>
This patch add basic support for the architecture timer found on recent
ARMv7 based SoCs.Quoted 6 lines
Signed-off-by Vitaly Andrianov <[email protected]>Signed-off-by Murali Karicheri <[email protected]>Acked-by Tom Rini <[email protected]>--- arch/arm/lib/Makefile | 1 + arch/arm/lib/arch_timer.c | 58+++++++++++++++++++++++++++++++++++++++++++++
Quoted 5 lines
I am not familiar with this timer, but your commit description implies it is specific to ARMv7.
If so, it looks like it should go to
arch/arm/cpu/armv7/. Is this right?
This is for arch timer implemented in ARM Cortex-A15 which is ARMv7. I believe the same arch timer is in ARMv8. So, it is not specific to ARMv7 only. The commit description mentioned only ARMv7 because the driver was designed and tested on ARMv7.
Quoted 9 lines
Best Regards
Masahiro Yamada_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Best Regards,
Vitaly Andrianov
PATCH v5 3/9 arm: add support for arch timer
Quoted 44 lines
-----Original Messages-----
From: "Andrianov, Vitaly" <[email protected]>
Sent Time: 2014-04-03 19:22:34 (Thursday)
To: "Masahiro Yamada" <[email protected]>, "Karicheri, Muralidharan" <[email protected]>
Cc: "Rini, Tom" <[email protected]>, "u-boot at lists.denx.de" <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 3/9] arm: add support for arch timerHi Masahiro,
Quoted 32 lines
-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Masahiro Yamada
Sent: Wednesday, April 02, 2014 9:46 PM
To: Karicheri, Muralidharan
Cc: Rini, Tom; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v5 3/9] arm: add support for arch timerHi Murali,
Quoted 6 lines · On Tue, 1 Apr 2014 14:44:23 -0400 Murali Karicheri <[email protected]> wrote:
From: Vitaly Andrianov <[email protected]>
This patch add basic support for the architecture timer found on recent
ARMv7 based SoCs.Quoted 6 lines
Signed-off-by Vitaly Andrianov <[email protected]>Signed-off-by Murali Karicheri <[email protected]>Acked-by Tom Rini <[email protected]>--- arch/arm/lib/Makefile | 1 + arch/arm/lib/arch_timer.c | 58+++++++++++++++++++++++++++++++++++++++++++++
I am not familiar with this timer, but your commit description implies it is specific to ARMv7.
Quoted 8 lines
Quoted 2 lines
If so, it looks like it should go to
arch/arm/cpu/armv7/. Is this right?This is for arch timer implemented in ARM Cortex-A15 which is ARMv7. I believe the same arch timer is in ARMv8. So, it is not specific to ARMv7 only. The commit description mentioned only ARMv7 because the driver was designed and tested on ARMv7.
If we want to apply the arch_timer.c to armv8, the get_ticks() function should be modified due to mrrc instuction.
Furthermore, armv8 now make use of timer infrastructure of lib/time.c.
Only get_tbclk() and timer_read_counter() are architecture specific and declared in generic_timer.c. We'd better construct a common arch timer structure across arm platform.
Best regards,
David
PATCH v5 3/9 arm: add support for arch timer
Quoted 50 lines · FengHua
Quoted 43 lines
-----Original Messages-----
From: "Andrianov, Vitaly" <[email protected]>
Sent Time: 2014-04-03 19:22:34 (Thursday)
To: "Masahiro Yamada" <[email protected]>, "Karicheri, Muralidharan" <[email protected]>
Cc: "Rini, Tom" <[email protected]>, "u-boot at lists.denx.de" <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 3/9] arm: add support for arch timerHi Masahiro,
Quoted 32 lines
-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Masahiro Yamada
Sent: Wednesday, April 02, 2014 9:46 PM
To: Karicheri, Muralidharan
Cc: Rini, Tom; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v5 3/9] arm: add support for arch timerHi Murali,
Quoted 6 lines · On Tue, 1 Apr 2014 14:44:23 -0400 Murali Karicheri <[email protected]> wrote:
From: Vitaly Andrianov <[email protected]>
This patch add basic support for the architecture timer found on recent
ARMv7 based SoCs.Quoted 6 lines
Signed-off-by Vitaly Andrianov <[email protected]>Signed-off-by Murali Karicheri <[email protected]>Acked-by Tom Rini <[email protected]>--- arch/arm/lib/Makefile | 1 + arch/arm/lib/arch_timer.c | 58+++++++++++++++++++++++++++++++++++++++++++++
I am not familiar with this timer, but your commit description implies it is specific to ARMv7.
Quoted 7 lines
Quoted 2 lines
If so, it looks like it should go to
arch/arm/cpu/armv7/. Is this right?This is for arch timer implemented in ARM Cortex-A15 which is ARMv7. I believe the same arch timer is in ARMv8. So, it is not specific to ARMv7 only. The commit description mentioned only ARMv7 because the driver was designed and tested on ARMv7.
Quoted 13 lines
If we want to apply the
arch_timer.cto armv8, theget_ticks()function should be modified due to mrrc instuction.
Furthermore, armv8 now make use of timer infrastructure oflib/time.c.
Onlyget_tbclk()andtimer_read_counter()are architecture specific and declared ingeneric_timer.c. We'd better construct a common arch timer structure across arm platform.Best regards,
David
The v6 of the series just posted has moved the arch_timer.c to arch/arm/cpu/armv7 folder
as requested by you.
Regards,
Murali
PATCH v5 4/9 NAND: DaVinci: allow forced disable of subpage writes
In reply to Murali KaricheriThis patch introduces a configurable mechanism to disable subpage writes in the DaVinci NAND driver.
--- README | 5 +++++ drivers/mtd/nand/davinci_nand.c | 3 +++ 2 files changed, 8 insertions(+)
README +5 -0
@@ -4486,6 +4486,11 @@ Low Level (hardware related) configuration options: - CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC: Enables the RTC32K OSC on AM33xx based plattforms +- CONFIG_SYS_NAND_NO_SUBPAGE_WRITE + Option to disable subpage write in NAND driver + driver that uses this: + drivers/mtd/nand/davinci_nand.c + Freescale QE/FMAN Firmware Support: -----------------------------------
drivers/mtd/nand/davinci_nand.c +3 -0
@@ -609,6 +609,9 @@ void davinci_nand_init(struct nand_chip *nand)#ifdef CONFIG_SYS_NAND_USE_FLASH_BBT nand->bbt_options |=NAND_BBT_USE_FLASH ;#endif +#ifdef CONFIG_SYS_NAND_NO_SUBPAGE_WRITE + nand->options |=NAND_NO_SUBPAGE_WRITE ; +#endif #ifdef CONFIG_SYS_NAND_HW_ECC nand->ecc.mode =NAND_ECC_HW ; nand->ecc.size =512 ;
Signature · 1 line
1.7.9.5
PATCH v5 5/9 i2c, davinci: move i2c_defs.h to the drivers/i2c directory
In reply to Murali KaricheriThis patch moves the davinci i2c_defs.h file to drivers.i2c directory. It will allow to reuse the davinci_i2c driver for TI Keystone2 SOCs.
Not used "git mv" command to move the file because small part of it with definitions specific for Davinci SOCs has to remain in the arch/arm/include/asm/arch-davinci.
--- arch/arm/include/asm/arch-davinci/i2c_defs.h | 71 ++---------------------- drivers/i2c/davinci_i2c.c | 1 + drivers/i2c/davinci_i2c.h | 75 ++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 68 deletions(-) create mode 100644 drivers/i2c/davinci_i2c.h
arch/arm/include/asm/arch-davinci/i2c_defs.h +3 -68
@@ -1,16 +1,13 @@/* -* (C) Copyright 2004 +* (C) Copyright 2004-2014 * Texas Instruments, <www.ti.com> * * Some changes copyright (C) 2007 Sergey Kubushyn <[email protected]> * * SPDX-License-Identifier: GPL-2.0+ */ -#ifndef _DAVINCI_I2C_H_ -#define _DAVINCI_I2C_H_ - -#define I2C_WRITE 0 -#define I2C_READ 1 +#ifndef _I2C_DEFS_H_ +#define _I2C_DEFS_H_#ifndef CONFIG_SOC_DA8XX #define I2C_BASE 0x01c21000
@@ -18,66 +15,4 @@#define I2C_BASE 0x01c22000#endif -#define I2C_OA (I2C_BASE + 0x00) -#define I2C_IE (I2C_BASE + 0x04) -#define I2C_STAT (I2C_BASE + 0x08) -#define I2C_SCLL (I2C_BASE + 0x0c) -#define I2C_SCLH (I2C_BASE + 0x10) -#define I2C_CNT (I2C_BASE + 0x14) -#define I2C_DRR (I2C_BASE + 0x18) -#define I2C_SA (I2C_BASE + 0x1c) -#define I2C_DXR (I2C_BASE + 0x20) -#define I2C_CON (I2C_BASE + 0x24) -#define I2C_IV (I2C_BASE + 0x28) -#define I2C_PSC (I2C_BASE + 0x30) - -/* I2C masks */ - -/* I2C Interrupt Enable Register (I2C_IE): */ -#define I2C_IE_SCD_IE (1 << 5)/* Stop condition detect interrupt enable */ -#define I2C_IE_XRDY_IE (1 << 4)/* Transmit data ready interrupt enable */ -#define I2C_IE_RRDY_IE (1 << 3)/* Receive data ready interrupt enable */ -#define I2C_IE_ARDY_IE (1 << 2)/* Register access ready interrupt enable */ -#define I2C_IE_NACK_IE (1 << 1)/* No acknowledgment interrupt enable */ -#define I2C_IE_AL_IE (1 << 0)/* Arbitration lost interrupt enable */ - -/* I2C Status Register (I2C_STAT): */ - -#define I2C_STAT_BB (1 << 12)/* Bus busy */ -#define I2C_STAT_ROVR (1 << 11)/* Receive overrun */ -#define I2C_STAT_XUDF (1 << 10)/* Transmit underflow */ -#define I2C_STAT_AAS (1 << 9)/* Address as slave */ -#define I2C_STAT_SCD (1 << 5)/* Stop condition detect */ -#define I2C_STAT_XRDY (1 << 4)/* Transmit data ready */ -#define I2C_STAT_RRDY (1 << 3)/* Receive data ready */ -#define I2C_STAT_ARDY (1 << 2)/* Register access ready */ -#define I2C_STAT_NACK (1 << 1)/* No acknowledgment interrupt enable */ -#define I2C_STAT_AL (1 << 0)/* Arbitration lost interrupt enable */ - - -/* I2C Interrupt Code Register (I2C_INTCODE): */ - -#define I2C_INTCODE_MASK 7 -#define I2C_INTCODE_NONE 0 -#define I2C_INTCODE_AL 1/* Arbitration lost */ -#define I2C_INTCODE_NAK 2/* No acknowledgement/general call */ -#define I2C_INTCODE_ARDY 3/* Register access ready */ -#define I2C_INTCODE_RRDY 4/* Rcv data ready */ -#define I2C_INTCODE_XRDY 5/* Xmit data ready */ -#define I2C_INTCODE_SCD 6/* Stop condition detect */ - - -/* I2C Configuration Register (I2C_CON): */ - -#define I2C_CON_EN (1 << 5)/* I2C module enable */ -#define I2C_CON_STB (1 << 4)/* Start byte mode (master mode only) */ -#define I2C_CON_MST (1 << 10)/* Master/slave mode */ -#define I2C_CON_TRX (1 << 9)/* Transmitter/receiver mode (master mode only) */ -#define I2C_CON_XA (1 << 8)/* Expand address */ -#define I2C_CON_STP (1 << 11)/* Stop condition (master mode only) */ -#define I2C_CON_STT (1 << 13)/* Start condition (master mode only) */ -#define I2C_CON_FREE (1 << 14)/* Free run on emulation */ - -#define I2C_TIMEOUT 0xffff0000/* Timeout mask for poll_i2c_irq() */ -#endif
drivers/i2c/davinci_i2c.c +1 -0
@@ -12,6 +12,7 @@#include <i2c.h> #include <asm/arch/hardware.h> #include <asm/arch/i2c_defs.h> +#include "davinci_i2c.h" #define CHECK_NACK () \ do {\
drivers/i2c/davinci_i2c.h new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v5 6/9 i2c, davinci: convert driver to new mutlibus/mutliadapter framework
In reply to Murali KaricheriFrom: Vitaly Andrianov <[email protected]>
- add davinci driver to new multibus/multiadpater support
- adapted all config files, which uses this driver
--- arch/arm/cpu/arm926ejs/davinci/dm355.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm365.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm644x.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm646x.c | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/davinci_i2c.c | 401 ++++++++++++++++++------------- drivers/i2c/davinci_i2c.h | 27 ++- include/configs/cam_enc_4xx.h | 8 +- include/configs/da830evm.h | 8 +- include/configs/da850evm.h | 8 +- include/configs/davinci_dm355evm.h | 8 +- include/configs/davinci_dm355leopard.h | 8 +- include/configs/davinci_dm365evm.h | 8 +- include/configs/davinci_dm6467evm.h | 8 +- include/configs/davinci_dvevm.h | 8 +- include/configs/davinci_schmoogie.h | 8 +- include/configs/davinci_sffsdr.h | 8 +- include/configs/davinci_sonata.h | 8 +- include/configs/ea20.h | 7 +- include/configs/enbw_cmc.h | 8 +- 20 files changed, 306 insertions(+), 235 deletions(-)
arch/arm/cpu/arm926ejs/davinci/dm355.c +1 -1
@@ -19,7 +19,7 @@ void davinci_enable_uart0(void) } -#ifdef CONFIG_DRIVER_DAVINCI_I2C +#ifdef CONFIG_SYS_I2C_DAVINCI void davinci_enable_i2c (void ) {lpsc_on (DAVINCI_LPSC_I2C );
arch/arm/cpu/arm926ejs/davinci/dm365.c +1 -1
@@ -12,7 +12,7 @@ void davinci_enable_uart0(void)lpsc_on (DAVINCI_LPSC_UART0 ); } -#ifdef CONFIG_DRIVER_DAVINCI_I2C +#ifdef CONFIG_SYS_I2C_DAVINCI void davinci_enable_i2c (void ) {lpsc_on (DAVINCI_LPSC_I2C );
arch/arm/cpu/arm926ejs/davinci/dm644x.c +1 -1
@@ -47,7 +47,7 @@ void davinci_enable_emac(void) }#endif -#ifdef CONFIG_DRIVER_DAVINCI_I2C +#ifdef CONFIG_SYS_I2C_DAVINCI void davinci_enable_i2c (void ) {lpsc_on (DAVINCI_LPSC_I2C );
arch/arm/cpu/arm926ejs/davinci/dm646x.c +1 -1
@@ -18,7 +18,7 @@ void davinci_enable_emac(void) }#endif -#ifdef CONFIG_DRIVER_DAVINCI_I2C +#ifdef CONFIG_SYS_I2C_DAVINCI void davinci_enable_i2c (void ) {lpsc_on (DAVINCI_DM646X_LPSC_I2C );
drivers/i2c/Makefile +1 -1
@@ -6,7 +6,6 @@ # obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o -obj-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o obj-$(CONFIG_DW_I2C) += designware_i2c.o obj-$(CONFIG_I2C_MVTWSI) += mvtwsi.o obj-$(CONFIG_I2C_MV) += mv_i2c.o
@@ -16,6 +15,7 @@ obj-$(CONFIG_TSI108_I2C) += tsi108_i2c.o obj-$(CONFIG_U8500_I2C) += u8500_i2c.o obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o obj-$(CONFIG_SYS_I2C) += i2c_core.o +obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o
drivers/i2c/davinci_i2c.c +234 -167
548 lines not on this page · raw message
drivers/i2c/davinci_i2c.h +15 -12
@@ -12,18 +12,21 @@#define I2C_WRITE 0#define I2C_READ 1 -#define I2C_OA (I2C_BASE + 0x00) -#define I2C_IE (I2C_BASE + 0x04) -#define I2C_STAT (I2C_BASE + 0x08) -#define I2C_SCLL (I2C_BASE + 0x0c) -#define I2C_SCLH (I2C_BASE + 0x10) -#define I2C_CNT (I2C_BASE + 0x14) -#define I2C_DRR (I2C_BASE + 0x18) -#define I2C_SA (I2C_BASE + 0x1c) -#define I2C_DXR (I2C_BASE + 0x20) -#define I2C_CON (I2C_BASE + 0x24) -#define I2C_IV (I2C_BASE + 0x28) -#define I2C_PSC (I2C_BASE + 0x30) +struct i2c_regs { +u32 i2c_oa; +u32 i2c_ie; +u32 i2c_stat; +u32 i2c_scll; +u32 i2c_sclh; +u32 i2c_cnt; +u32 i2c_drr; +u32 i2c_sa; +u32 i2c_dxr; +u32 i2c_con; +u32 i2c_iv; +u32 res_2c; +u32 i2c_psc; +};/* I2C masks */
include/configs/cam_enc_4xx.h +4 -4
@@ -57,10 +57,10 @@#define CONFIG_RESET_PHY_R /* I2C */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 400000 -#define CONFIG_SYS_I2C_SLAVE 0x10/* SMBus host address */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 400000 +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 0x10/* SMBus host address */ /* NAND: socketed, two chipselects, normally 2 GBytes */ #define CONFIG_NAND_DAVINCI
include/configs/da830evm.h +4 -4
@@ -55,10 +55,10 @@/* * I2C Configuration */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 25000/* 100Kbps won't work, H/W bug */ -#define CONFIG_SYS_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 25000/* 100Kbps won't work, H/W bug */ +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ /* * I2C EEPROM definitions for catalyst 24W256 EEPROM chip
include/configs/da850evm.h +4 -4
@@ -166,10 +166,10 @@/* * I2C Configuration */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 25000 -#define CONFIG_SYS_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 25000 +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ #define CONFIG_SYS_I2C_EXPANDER_ADDR 0x20/*
include/configs/davinci_dm355evm.h +4 -4
@@ -41,10 +41,10 @@#define DM9000_DATA (CONFIG_DM9000_BASE + 2)/* I2C */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 400000 -#define CONFIG_SYS_I2C_SLAVE 0x10/* SMBus host address */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 400000 +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 0x10/* SMBus host address */ /* NAND: socketed, two chipselects, normally 2 GBytes */ #define CONFIG_NAND_DAVINCI
include/configs/davinci_dm355leopard.h +4 -4
@@ -40,10 +40,10 @@#define DM9000_DATA (CONFIG_DM9000_BASE + 16)/* I2C */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 400000 -#define CONFIG_SYS_I2C_SLAVE 0x10 +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 400000 +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 0x10/* NAND */ #define CONFIG_NAND_DAVINCI
include/configs/davinci_dm365evm.h +4 -4
@@ -49,10 +49,10 @@#define CONFIG_NET_RETRY_COUNT 10/* I2C */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 400000 -#define CONFIG_SYS_I2C_SLAVE 0x10/* SMBus host address */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 400000 +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 0x10/* SMBus host address */ /* NAND: socketed, two chipselects, normally 2 GBytes */ #define CONFIG_NAND_DAVINCI
include/configs/davinci_dm6467evm.h +4 -4
@@ -60,10 +60,10 @@ extern unsigned int davinci_arm_clk_get(void);#define CONFIG_BAUDRATE 115200/* I2C Configuration */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 80000 -#define CONFIG_SYS_I2C_SLAVE 10 +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000 +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Network & Ethernet Configuration */ #define CONFIG_DRIVER_TI_EMAC
include/configs/davinci_dvevm.h +4 -4
@@ -77,10 +77,10 @@/*===================*/ /* I2C Configuration */ /*===================*/ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 80000/* 100Kbps won't work, silicon bug */ -#define CONFIG_SYS_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000/* 100Kbps won't work, silicon bug */ +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ /*==================================*/ /* Network & Ethernet Configuration */ /*==================================*/
include/configs/davinci_schmoogie.h +4 -4
@@ -46,10 +46,10 @@/*===================*/ /* I2C Configuration */ /*===================*/ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 80000/* 100Kbps won't work, silicon bug */ -#define CONFIG_SYS_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000/* 100Kbps won't work, silicon bug */ +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ /*==================================*/ /* Network & Ethernet Configuration */ /*==================================*/
include/configs/davinci_sffsdr.h +4 -4
@@ -42,10 +42,10 @@#define CONFIG_CONS_INDEX 1/* use UART0 for console */ #define CONFIG_BAUDRATE 115200/* Default baud rate */ /* I2C Configuration */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 80000/* 100Kbps won't work, silicon bug */ -#define CONFIG_SYS_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000/* 100Kbps won't work, silicon bug */ +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ /* Network & Ethernet Configuration */ #define CONFIG_DRIVER_TI_EMAC #define CONFIG_MII
include/configs/davinci_sonata.h +4 -4
@@ -78,10 +78,10 @@/*===================*/ /* I2C Configuration */ /*===================*/ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 80000/* 100Kbps won't work, silicon bug */ -#define CONFIG_SYS_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000/* 100Kbps won't work, silicon bug */ +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ /*==================================*/ /* Network & Ethernet Configuration */ /*==================================*/
include/configs/ea20.h +4 -3
@@ -78,9 +78,10 @@/* * I2C Configuration */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 100000 +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 100000 +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ /* * Network & Ethernet Configuration
include/configs/enbw_cmc.h +4 -4
@@ -73,10 +73,10 @@/* * I2C Configuration */ -#define CONFIG_HARD_I2C -#define CONFIG_DRIVER_DAVINCI_I2C -#define CONFIG_SYS_I2C_SPEED 80000 -#define CONFIG_SYS_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DAVINCI +#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000 +#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10/* Bogus, master-only in U-Boot */ #define CONFIG_SYS_I2C_EXPANDER_ADDR 0x20#define CONFIG_CMD_I2C
Signature · 1 line
1.7.9.5
PATCH v5 6/9 i2c, davinci: convert driver to new mutlibus/mutliadapter framework
Hello Murali,
Am 01.04.2014 20:44, schrieb Murali Karicheri:
Quoted 21 lines
From: Vitaly Andrianov<[email protected]>
- add davinci driver to new multibus/multiadpater support
- adapted all config files, which uses this driverSigned-off-by Vitaly Andrianov<[email protected]>Signed-off-by Murali Karicheri<[email protected]>--- arch/arm/cpu/arm926ejs/davinci/dm355.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm365.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm644x.c | 2 +- arch/arm/cpu/arm926ejs/davinci/dm646x.c | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/davinci_i2c.c | 401 ++++++++++++++++++------------- drivers/i2c/davinci_i2c.h | 27 ++- include/configs/cam_enc_4xx.h | 8 +- include/configs/da830evm.h | 8 +- include/configs/da850evm.h | 8 +- include/configs/davinci_dm355evm.h | 8 +- include/configs/davinci_dm355leopard.h | 8 +- include/configs/davinci_dm365evm.h | 8 +-
Quoted 8 lines
include/configs/davinci_dm6467evm.h | 8 +- include/configs/davinci_dvevm.h | 8 +- include/configs/davinci_schmoogie.h | 8 +- include/configs/davinci_sffsdr.h | 8 +- include/configs/davinci_sonata.h | 8 +- include/configs/ea20.h | 7 +- include/configs/enbw_cmc.h | 8 +- 20 files changed, 306 insertions(+), 235 deletions(-)
Thanks!
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH v5 7/9 k2hk: add support for k2hk SOC and EVM
In reply to Murali KaricheriFrom: Vitaly Andrianov <[email protected]>
k2hk EVM is based on Texas Instruments Keystone2 Hawking/Kepler SoC. Keystone2 SoC has ARM v7 Cortex-A15 MPCore processor. Please refer the ti/k2hk_evm/README for details on the board, build and other information.
This patch add support for keystone architecture and k2hk evm.
--- Makefile | 10 + arch/arm/cpu/armv7/keystone/Makefile | 17 ++ arch/arm/cpu/armv7/keystone/aemif.c | 71 +++++ arch/arm/cpu/armv7/keystone/clock.c | 318 ++++++++++++++++++++ arch/arm/cpu/armv7/keystone/cmd_clock.c | 124 ++++++++ arch/arm/cpu/armv7/keystone/cmd_mon.c | 131 ++++++++ arch/arm/cpu/armv7/keystone/ddr3.c | 69 +++++ arch/arm/cpu/armv7/keystone/init.c | 56 ++++ arch/arm/cpu/armv7/keystone/msmc.c | 68 +++++ arch/arm/cpu/armv7/keystone/psc.c | 238 +++++++++++++++ arch/arm/cpu/armv7/keystone/spl.c | 45 +++ arch/arm/include/asm/arch-keystone/clock-k2hk.h | 109 +++++++ arch/arm/include/asm/arch-keystone/clock.h | 17 ++ arch/arm/include/asm/arch-keystone/clock_defs.h | 111 +++++++ arch/arm/include/asm/arch-keystone/emif_defs.h | 73 +++++ arch/arm/include/asm/arch-keystone/hardware-k2hk.h | 150 +++++++++ arch/arm/include/asm/arch-keystone/hardware.h | 175 +++++++++++ arch/arm/include/asm/arch-keystone/i2c_defs.h | 17 ++ arch/arm/include/asm/arch-keystone/nand_defs.h | 23 ++ arch/arm/include/asm/arch-keystone/psc_defs.h | 90 ++++++ arch/arm/include/asm/arch-keystone/spl.h | 12 + board/ti/k2hk_evm/Makefile | 9 + board/ti/k2hk_evm/README | 122 ++++++++ board/ti/k2hk_evm/board.c | 236 +++++++++++++++ board/ti/k2hk_evm/ddr3.c | 269 +++++++++++++++++ boards.cfg | 1 + drivers/serial/ns16550.c | 8 + include/configs/k2hk_evm.h | 212 +++++++++++++ 28 files changed, 2781 insertions(+) create mode 100644 arch/arm/cpu/armv7/keystone/Makefile create mode 100644 arch/arm/cpu/armv7/keystone/aemif.c create mode 100644 arch/arm/cpu/armv7/keystone/clock.c create mode 100644 arch/arm/cpu/armv7/keystone/cmd_clock.c create mode 100644 arch/arm/cpu/armv7/keystone/cmd_mon.c create mode 100644 arch/arm/cpu/armv7/keystone/ddr3.c create mode 100644 arch/arm/cpu/armv7/keystone/init.c create mode 100644 arch/arm/cpu/armv7/keystone/msmc.c create mode 100644 arch/arm/cpu/armv7/keystone/psc.c create mode 100644 arch/arm/cpu/armv7/keystone/spl.c create mode 100644 arch/arm/include/asm/arch-keystone/clock-k2hk.h create mode 100644 arch/arm/include/asm/arch-keystone/clock.h create mode 100644 arch/arm/include/asm/arch-keystone/clock_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/emif_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/hardware-k2hk.h create mode 100644 arch/arm/include/asm/arch-keystone/hardware.h create mode 100644 arch/arm/include/asm/arch-keystone/i2c_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/nand_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/psc_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/spl.h create mode 100644 board/ti/k2hk_evm/Makefile create mode 100644 board/ti/k2hk_evm/README create mode 100644 board/ti/k2hk_evm/board.c create mode 100644 board/ti/k2hk_evm/ddr3.c create mode 100644 include/configs/k2hk_evm.h
Makefile +10 -0
@@ -868,6 +868,16 @@ OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE $(call if_changed,pad_cat) +MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \ + -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL +spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE + $(call if_changed,mkimage) + +OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ + --gap-fill=0 +u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE + $(call if_changed,pad_cat) + ifneq ($(CONFIG_TEGRA),) OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE
arch/arm/cpu/armv7/keystone/Makefile new file +17 -0
@@ -0,0 +1,17 @@ +# +# (C) Copyright 2012-2014 +# Texas Instruments Incorporated, <www.ti.com> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += aemif.o +obj-y += init.o +obj-y += psc.o +obj-y += clock.o +obj-y += cmd_clock.o +obj-y += cmd_mon.o +obj-y += msmc.o +obj-$(CONFIG_SPL_BUILD) += spl.o +obj-y += ddr3.o +
arch/arm/cpu/armv7/keystone/aemif.c new file +71 -0
71 lines not on this page · raw message
arch/arm/cpu/armv7/keystone/clock.c new file +318 -0
318 lines not on this page · raw message
arch/arm/cpu/armv7/keystone/cmd_clock.c new file +124 -0
124 lines not on this page · raw message
arch/arm/cpu/armv7/keystone/cmd_mon.c new file +131 -0
131 lines not on this page · raw message
arch/arm/cpu/armv7/keystone/ddr3.c new file +69 -0
69 lines not on this page · raw message
arch/arm/cpu/armv7/keystone/init.c new file +56 -0
56 lines not on this page · raw message
arch/arm/cpu/armv7/keystone/msmc.c new file +68 -0
68 lines not on this page · raw message
arch/arm/cpu/armv7/keystone/psc.c new file +238 -0
238 lines not on this page · raw message
arch/arm/cpu/armv7/keystone/spl.c new file +45 -0
45 lines not on this page · raw message
arch/arm/include/asm/arch-keystone/clock-k2hk.h new file +109 -0
109 lines not on this page · raw message
arch/arm/include/asm/arch-keystone/clock.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* keystone2: common clock header file +* +* (C) Copyright 2012-2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ASM_ARCH_CLOCK_H +#define __ASM_ARCH_CLOCK_H + +#ifdef CONFIG_SOC_K2HK +#include <asm/arch/clock-k2hk.h> +#endif + +#endif
arch/arm/include/asm/arch-keystone/clock_defs.h new file +111 -0
111 lines not on this page · raw message
arch/arm/include/asm/arch-keystone/emif_defs.h new file +73 -0
73 lines not on this page · raw message
arch/arm/include/asm/arch-keystone/hardware-k2hk.h new file +150 -0
150 lines not on this page · raw message
arch/arm/include/asm/arch-keystone/hardware.h new file +175 -0
175 lines not on this page · raw message
arch/arm/include/asm/arch-keystone/i2c_defs.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* keystone: i2c driver definitions +* +* (C) Copyright 2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef _I2C_DEFS_H_ +#define _I2C_DEFS_H_ + +#define I2C0_BASE 0x02530000 +#define I2C1_BASE 0x02530400 +#define I2C2_BASE 0x02530800 +#define I2C_BASE I2C0_BASE + +#endif
arch/arm/include/asm/arch-keystone/nand_defs.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* nand driver definitions to re-use davinci nand driver on Keystone2 +* +* (C) Copyright 2012-2014 +* Texas Instruments Incorporated, <www.ti.com> +* (C) Copyright 2007 Sergey Kubushyn <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef _NAND_DEFS_H_ +#define _NAND_DEFS_H_ + +#include <asm/arch/hardware.h> +#include <linux/mtd/nand.h> + +#define MASK_CLE 0x4000 +#define MASK_ALE 0x2000 + +#define NAND_READ_START 0x00 +#define NAND_READ_END 0x30 +#define NAND_STATUS 0x70 + +#endif
arch/arm/include/asm/arch-keystone/psc_defs.h new file +90 -0
90 lines not on this page · raw message
arch/arm/include/asm/arch-keystone/spl.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* (C) Copyright 2012-2014 +* Texas Instruments, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef _ASM_ARCH_SPL_H_ +#define _ASM_SPL_H_ + +#define BOOT_DEVICE_SPI 2 + +#endif
board/ti/k2hk_evm/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# K2HK-EVM: board Makefile +# (C) Copyright 2012-2014 +# Texas Instruments Incorporated, <www.ti.com> +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += board.o +obj-y += ddr3.o
board/ti/k2hk_evm/README new file +122 -0
122 lines not on this page · raw message
board/ti/k2hk_evm/board.c new file +236 -0
236 lines not on this page · raw message
board/ti/k2hk_evm/ddr3.c new file +269 -0
269 lines not on this page · raw message
boards.cfg +1 -0
@@ -294,6 +294,7 @@ Active arm armv7 exynos samsung trats Active arm armv7 exynos samsung trats2 trats2 - Piotr Wilczek <[email protected]> Active arm armv7 exynos samsung universal_c210 s5pc210_universal - Przemyslaw Marczak <[email protected]> Active arm armv7 highbank - highbank highbank - Rob Herring <[email protected]> +Active arm armv7 keystone ti k2hk_evm k2hk_evm - Vitaly Andrianov <[email protected]> Active arm armv7 mx5 denx m53evk m53evk m53evk:IMX_CONFIG=board/denx/m53evk/imximage.cfg Marek Vasut <[email protected]> Active arm armv7 mx5 esg ima3-mx53 ima3-mx53 ima3-mx53:IMX_CONFIG=board/esg/ima3-mx53/imximage.cfg - Active arm armv7 mx5 freescale mx51evk mx51evk mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg Stefano Babic <[email protected]>
drivers/serial/ns16550.c +8 -0
@@ -30,6 +30,11 @@#define serial_in (y) readb(y)#endif +#if defined(CONFIG_K2HK_EVM ) +#define UART_REG_VAL_PWREMU_MGMT_UART_DISABLE 0 +#define UART_REG_VAL_PWREMU_MGMT_UART_ENABLE ((1 << 14) | (1 << 13) | (1 << 0)) +#endif +#ifndef CONFIG_SYS_NS16550_IER #define CONFIG_SYS_NS16550_IER 0x00#endif /* CONFIG_SYS_NS16550_IER */
@@ -77,6 +82,9 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)/* /16 is proper to hit 115200 with 48MHz */ serial_out (0 , &com_port->mdr1);#endif /* CONFIG_OMAP */ +#if defined(CONFIG_K2HK_EVM ) +serial_out (UART_REG_VAL_PWREMU_MGMT_UART_ENABLE , &com_port->regC); +#endif }#ifndef CONFIG_NS16550_MIN_FUNCTIONS
include/configs/k2hk_evm.h new file +212 -0
212 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v5 7/9 k2hk: add support for k2hk SOC and EVM
Quoted 352 lines · Murali Karicheri
From: Vitaly Andrianov<[email protected]>
k2hk EVM is based on Texas Instruments Keystone2 Hawking/Kepler SoC. Keystone2 SoC has ARM v7 Cortex-A15 MPCore processor. Please refer the ti/k2hk_evm/README for details on the board, build and other information.
This patch add support for keystone architecture and k2hk evm.
Signed-off-by Vitaly Andrianov<[email protected]>Signed-off-by Murali Karicheri<[email protected]>Signed-off-by WingMan Kwok<[email protected]>Signed-off-by Sandeep Nair<[email protected]>--- Makefile | 10 + arch/arm/cpu/armv7/keystone/Makefile | 17 ++ arch/arm/cpu/armv7/keystone/aemif.c | 71 +++++ arch/arm/cpu/armv7/keystone/clock.c | 318 ++++++++++++++++++++ arch/arm/cpu/armv7/keystone/cmd_clock.c | 124 ++++++++ arch/arm/cpu/armv7/keystone/cmd_mon.c | 131 ++++++++ arch/arm/cpu/armv7/keystone/ddr3.c | 69 +++++ arch/arm/cpu/armv7/keystone/init.c | 56 ++++ arch/arm/cpu/armv7/keystone/msmc.c | 68 +++++ arch/arm/cpu/armv7/keystone/psc.c | 238 +++++++++++++++ arch/arm/cpu/armv7/keystone/spl.c | 45 +++ arch/arm/include/asm/arch-keystone/clock-k2hk.h | 109 +++++++ arch/arm/include/asm/arch-keystone/clock.h | 17 ++ arch/arm/include/asm/arch-keystone/clock_defs.h | 111 +++++++ arch/arm/include/asm/arch-keystone/emif_defs.h | 73 +++++ arch/arm/include/asm/arch-keystone/hardware-k2hk.h | 150 +++++++++ arch/arm/include/asm/arch-keystone/hardware.h | 175 +++++++++++ arch/arm/include/asm/arch-keystone/i2c_defs.h | 17 ++ arch/arm/include/asm/arch-keystone/nand_defs.h | 23 ++ arch/arm/include/asm/arch-keystone/psc_defs.h | 90 ++++++ arch/arm/include/asm/arch-keystone/spl.h | 12 + board/ti/k2hk_evm/Makefile | 9 + board/ti/k2hk_evm/README | 122 ++++++++ board/ti/k2hk_evm/board.c | 236 +++++++++++++++ board/ti/k2hk_evm/ddr3.c | 269 +++++++++++++++++ boards.cfg | 1 + drivers/serial/ns16550.c | 8 + include/configs/k2hk_evm.h | 212 +++++++++++++ 28 files changed, 2781 insertions(+)create mode 100644
arch/arm/cpu/armv7/keystone/Makefilecreate mode 100644arch/arm/cpu/armv7/keystone/aemif.ccreate mode 100644arch/arm/cpu/armv7/keystone/clock.ccreate mode 100644arch/arm/cpu/armv7/keystone/cmd_clock.ccreate mode 100644arch/arm/cpu/armv7/keystone/cmd_mon.ccreate mode 100644arch/arm/cpu/armv7/keystone/ddr3.ccreate mode 100644arch/arm/cpu/armv7/keystone/init.ccreate mode 100644arch/arm/cpu/armv7/keystone/msmc.ccreate mode 100644arch/arm/cpu/armv7/keystone/psc.ccreate mode 100644arch/arm/cpu/armv7/keystone/spl.ccreate mode 100644arch/arm/include/asm/arch-keystone/clock-k2hk.hcreate mode 100644arch/arm/include/asm/arch-keystone/clock.hcreate mode 100644arch/arm/include/asm/arch-keystone/clock_defs.hcreate mode 100644arch/arm/include/asm/arch-keystone/emif_defs.hcreate mode 100644arch/arm/include/asm/arch-keystone/hardware-k2hk.hcreate mode 100644arch/arm/include/asm/arch-keystone/hardware.hcreate mode 100644arch/arm/include/asm/arch-keystone/i2c_defs.hcreate mode 100644arch/arm/include/asm/arch-keystone/nand_defs.hcreate mode 100644arch/arm/include/asm/arch-keystone/psc_defs.hcreate mode 100644arch/arm/include/asm/arch-keystone/spl.hcreate mode 100644 board/ti/k2hk_evm/Makefile
create mode 100644 board/ti/k2hk_evm/README
create mode 100644board/ti/k2hk_evm/board.c
create mode 100644board/ti/k2hk_evm/ddr3.c
create mode 100644include/configs/k2hk_evm.hMakefile +10
-0@@ -868,6 +868,16 @@ OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE $(call if_changed,pad_cat) +MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \ + -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL +spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE + $(call if_changed,mkimage) + +OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ + --gap-fill=0 +u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE + $(call if_changed,pad_cat) + ifneq ($(CONFIG_TEGRA),) OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCEarch/arm/cpu/armv7/keystone/Makefile new file +17
-0@@ -0,0 +1,17 @@ +# +# (C) Copyright 2012-2014 +# Texas Instruments Incorporated, <www.ti.com> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += aemif.o +obj-y += init.o +obj-y += psc.o +obj-y += clock.o +obj-y += cmd_clock.o +obj-y += cmd_mon.o +obj-y += msmc.o +obj-$(CONFIG_SPL_BUILD) += spl.o +obj-y += ddr3.o +arch/arm/cpu/armv7/keystone/aemif.c new file +71
-0@@ -0,0 +1,71 @@ +/* +* Keystone2: Asynchronous EMIF Configuration +* +* (C) Copyright 2012-2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/emif_defs.h> + +#define AEMIF_CFG_SELECT_STROBE (v) ((v) ? 1 << 31 : 0) +#define AEMIF_CFG_EXTEND_WAIT (v) ((v) ? 1 << 30 : 0) +#define AEMIF_CFG_WR_SETUP (v) (((v) & 0x0f) << 26) +#define AEMIF_CFG_WR_STROBE (v) (((v) & 0x3f) << 20) +#define AEMIF_CFG_WR_HOLD (v) (((v) & 0x07) << 17) +#define AEMIF_CFG_RD_SETUP (v) (((v) & 0x0f) << 13) +#define AEMIF_CFG_RD_STROBE (v) (((v) & 0x3f) << 7) +#define AEMIF_CFG_RD_HOLD (v) (((v) & 0x07) << 4) +#define AEMIF_CFG_TURN_AROUND (v) (((v) & 0x03) << 2) +#define AEMIF_CFG_WIDTH (v) (((v) & 0x03) << 0) + +#define set_config_field (reg, field, val) \ + do { \ + if (val != -1) { \ + reg &= ~AEMIF_CFG_##field(0xffffffff); \ + reg |= AEMIF_CFG_##field(val); \ + } \ + } while (0) + +void configure_async_emif (int cs,struct async_emif_config *cfg) +{ +unsigned long tmp; + +if (cfg->mode ==ASYNC_EMIF_MODE_NAND ) { + tmp =__raw_readl (&davinci_emif_regs->nandfcr); + tmp |= (1 << cs); +__raw_writel (tmp, &davinci_emif_regs->nandfcr); + + }else if (cfg->mode ==ASYNC_EMIF_MODE_ONENAND ) { + tmp =__raw_readl (&davinci_emif_regs->one_nand_cr); + tmp |= (1 << cs); +__raw_writel (tmp, &davinci_emif_regs->one_nand_cr); + } + + tmp =__raw_readl (&davinci_emif_regs->abncr[cs]); + +set_config_field (tmp,SELECT_STROBE , cfg->select_strobe); +set_config_field (tmp,EXTEND_WAIT , cfg->extend_wait); +set_config_field (tmp,WR_SETUP , cfg->wr_setup); +set_config_field (tmp,WR_STROBE , cfg->wr_strobe); +set_config_field (tmp,WR_HOLD , cfg->wr_hold); +set_config_field (tmp,RD_SETUP , cfg->rd_setup); +set_config_field (tmp,RD_STROBE , cfg->rd_strobe); +set_config_field (tmp,RD_HOLD , cfg->rd_hold); +set_config_field (tmp,TURN_AROUND , cfg->turn_around); +set_config_field (tmp,WIDTH , cfg->width); + +__raw_writel (tmp, &davinci_emif_regs->abncr[cs]); +} + +void init_async_emif (int num_cs,struct async_emif_config *config) +{ +int cs; + +for (cs =0 ; cs < num_cs; cs++) +configure_async_emif (cs, config + cs); +}arch/arm/cpu/armv7/keystone/clock.c new file +156
-0@@ -0,0 +1,318 @@ +/* +* Keystone2: pll initialization +* +* (C) Copyright 2012-2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm-generic/errno.h> +#include <asm/io.h> +#include <asm/processor.h> +#include <asm/arch/clock.h> +#include <asm/arch/clock_defs.h> + +static void wait_for_completion (const struct pll_init_data *data) +{ +int i; +for (i =0 ; i <100 ; i++) { +sdelay (450 ); +if ((pllctl_reg_read (data->pll, stat) &PLLSTAT_GO ) ==0 ) +break ; + } +} + +struct pll_regs { +u32 reg0, reg1; +}; + +static const struct pll_regs pll_regs[] = { + [CORE_PLL ] = {K2HK_MAINPLLCTL0 ,K2HK_MAINPLLCTL1 }, + [PASS_PLL ] = {K2HK_PASSPLLCTL0 ,K2HK_PASSPLLCTL1 }, + [TETRIS_PLL ] = {K2HK_ARMPLLCTL0 ,K2HK_ARMPLLCTL1 }, + [DDR3A_PLL ] = {K2HK_DDR3APLLCTL0 ,K2HK_DDR3APLLCTL1 }, + [DDR3B_PLL ] = {K2HK_DDR3BPLLCTL0 ,K2HK_DDR3BPLLCTL1 }, +}; + +/* Fout = Fref * NF(mult) / NR(prediv) / OD */ +static unsigned long pll_freq_get (int pll) +{ +unsigned long mult =1 , prediv =1 , output_div =2 ; +unsigned long ret; +u32 tmp, reg; + +if (pll ==CORE_PLL ) { + ret = external_clk[sys_clk]; +if (pllctl_reg_read (pll, ctl) &PLLCTL_PLLEN ) { +/* PLL mode */ + tmp =__raw_readl (K2HK_MAINPLLCTL0 ); + prediv = (tmp &PLL_DIV_MASK ) +1 ; + mult = (((tmp &PLLM_MULT_HI_SMASK ) >>6 ) | + (pllctl_reg_read (pll, mult) & +PLLM_MULT_LO_MASK )) +1 ; + output_div = ((pllctl_reg_read (pll, secctl) >> +PLL_CLKOD_SHIFT ) &PLL_CLKOD_MASK ) +1 ; + + ret = ret / prediv / output_div * mult; + } + }else { +switch (pll) { +case PASS_PLL : + ret = external_clk[pa_clk]; + reg =K2HK_PASSPLLCTL0 ; +break ; +case TETRIS_PLL : + ret = external_clk[tetris_clk]; + reg =K2HK_ARMPLLCTL0 ; +break ; +case DDR3A_PLL : + ret = external_clk[ddr3a_clk]; + reg =K2HK_DDR3APLLCTL0 ; +break ; +case DDR3B_PLL : + ret = external_clk[ddr3b_clk]; + reg =K2HK_DDR3BPLLCTL0 ; +break ; +default : +return 0 ; + } + + tmp =__raw_readl (reg); + +if (!(tmp &PLLCTL_BYPASS )) { +/* Bypass disabled */ + prediv = (tmp &PLL_DIV_MASK ) +1 ; + mult = ((tmp >>PLL_MULT_SHIFT ) &PLL_MULT_MASK ) +1 ; + output_div = ((tmp >>PLL_CLKOD_SHIFT ) & +PLL_CLKOD_MASK ) +1 ; + ret = ((ret / prediv) * mult) / output_div; + } + } + +return ret; +} + +unsigned long clk_get_rate (unsigned int clk) +{ +switch (clk) { +case core_pll_clk:return pll_freq_get (CORE_PLL ); +case pass_pll_clk:return pll_freq_get (PASS_PLL ); +case tetris_pll_clk:return pll_freq_get (TETRIS_PLL ); +case ddr3a_pll_clk:return pll_freq_get (DDR3A_PLL ); +case ddr3b_pll_clk:return pll_freq_get (DDR3B_PLL ); +case sys_clk0_1_clk: +case sys_clk0_clk:return pll_freq_get (CORE_PLL ) /pll0div_read (1 ); +case sys_clk1_clk:return pll_freq_get (CORE_PLL ) /pll0div_read (2 ); +case sys_clk2_clk:return pll_freq_get (CORE_PLL ) /pll0div_read (3 ); +case sys_clk3_clk:return pll_freq_get (CORE_PLL ) /pll0div_read (4 ); +case sys_clk0_2_clk:return clk_get_rate (sys_clk0_clk) /2 ; +case sys_clk0_3_clk:return clk_get_rate (sys_clk0_clk) /3 ; +case sys_clk0_4_clk:return clk_get_rate (sys_clk0_clk) /4 ; +case sys_clk0_6_clk:return clk_get_rate (sys_clk0_clk) /6 ; +case sys_clk0_8_clk:return clk_get_rate (sys_clk0_clk) /8 ; +case sys_clk0_12_clk:return clk_get_rate (sys_clk0_clk) /12 ; +case sys_clk0_24_clk:return clk_get_rate (sys_clk0_clk) /24 ; +case sys_clk1_3_clk:return clk_get_rate (sys_clk1_clk) /3 ; +case sys_clk1_4_clk:return clk_get_rate (sys_clk1_clk) /4 ; +case sys_clk1_6_clk:return clk_get_rate (sys_clk1_clk) /6 ; +case sys_clk1_12_clk:return clk_get_rate (sys_clk1_clk) /12 ; +default : +break ; + } +return 0 ; +} + +void init_pll (const struct pll_init_data *data) +{ +u32 tmp, tmp_ctl, pllm, plld, pllod, bwadj; + + pllm = data->pll_m -1 ; + plld = (data->pll_d -1 ) &PLL_DIV_MASK ; + pllod = (data->pll_od -1 ) &PLL_CLKOD_MASK ; + +if (data->pll ==MAIN_PLL ) { +/* The requered delay before main PLL configuration */ +sdelay (210000 ); + + tmp =pllctl_reg_read (data->pll, secctl); + +if (tmp & (PLLCTL_BYPASS )) { +setbits_le32 (pll_regs[data->pll].reg1, +BIT (MAIN_ENSAT_OFFSET )); + +pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLEN | +PLLCTL_PLLENSRC ); +sdelay (340 ); + +pllctl_reg_setbits (data->pll, secctl,PLLCTL_BYPASS ); +pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLPWRDN ); +sdelay (21000 ); + +pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLPWRDN ); + }else { +pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLEN | +PLLCTL_PLLENSRC );
arch/arm/cpu/armv7/keystone/clock.c line 166
Quoted 10 lines
arch/arm/cpu/armv7/keystone/clock.c new file +10
-0+sdelay (340 ); + } + +pllctl_reg_write (data->pll, mult, pllm &PLLM_MULT_LO_MASK ); + +clrsetbits_le32 (pll_regs[data->pll].reg0,PLLM_MULT_HI_SMASK , + (pllm <<6 )); + +/* Set the BWADJ (12 bit field) */ + tmp_ctl = pllm >>1 ;/* Divide the pllm by 2 */
Don't see any reason in comment: /* Divide the pllm by 2 */ If need to mark out it, may pllm/2 be better.
Quoted 337 lines
arch/arm/cpu/armv7/keystone/clock.c new file +152
-0+clrsetbits_le32 (pll_regs[data->pll].reg0,PLL_BWADJ_LO_SMASK , + (tmp_ctl <<PLL_BWADJ_LO_SHIFT )); +clrsetbits_le32 (pll_regs[data->pll].reg1,PLL_BWADJ_HI_MASK , + (tmp_ctl >>8 )); + +/* +* Set the pll divider (6 bit field) * +* PLLD[5:0] is located in MAINPLLCTL0 +*/ +clrsetbits_le32 (pll_regs[data->pll].reg0,PLL_DIV_MASK , plld); + +/* Set the OUTPUT DIVIDE (4 bit field) in SECCTL */ +pllctl_reg_rmw (data->pll, secctl,PLL_CLKOD_SMASK , + (pllod <<PLL_CLKOD_SHIFT )); +wait_for_completion (data); + +pllctl_reg_write (data->pll, div1,PLLM_RATIO_DIV1 ); +pllctl_reg_write (data->pll, div2,PLLM_RATIO_DIV2 ); +pllctl_reg_write (data->pll, div3,PLLM_RATIO_DIV3 ); +pllctl_reg_write (data->pll, div4,PLLM_RATIO_DIV4 ); +pllctl_reg_write (data->pll, div5,PLLM_RATIO_DIV5 ); + +pllctl_reg_setbits (data->pll, alnctl,0x1f ); + +/* +* Set GOSET bit in PLLCMD to initiate the GO operation +* to change the divide +*/ +pllctl_reg_setbits (data->pll, cmd,PLLSTAT_GO ); +sdelay (1500 );/* wait for the phase adj */ +wait_for_completion (data); + +/* Reset PLL */ +pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLRST ); +sdelay (21000 );/* Wait for a minimum of 7 us*/ +pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLRST ); +sdelay (105000 );/* Wait for PLL Lock time (min 50 us) */ + +pllctl_reg_clrbits (data->pll, secctl,PLLCTL_BYPASS ); + + tmp =pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLEN ); + + }else if (data->pll ==TETRIS_PLL ) { + bwadj = pllm >>1 ; +/* 1.5 Set PLLCTL0[BYPASS] =1 (enable bypass), */ +setbits_le32 (pll_regs[data->pll].reg0,PLLCTL_BYPASS ); +/* +* Set CHIPMISCCTL1[13] = 0 (enable glitchfree bypass) +* only applicable for Kepler +*/ +clrbits_le32 (K2HK_MISC_CTRL ,ARM_PLL_EN ); +/* 2 In PLLCTL1, write PLLRST = 1 (PLL is reset) */ +setbits_le32 (pll_regs[data->pll].reg1 , +PLL_PLLRST |PLLCTL_ENSAT ); + +/* +* 3 Program PLLM and PLLD in PLLCTL0 register +* 4 Program BWADJ[7:0] in PLLCTL0 and BWADJ[11:8] in +* PLLCTL1 register. BWADJ value must be set +* to ((PLLM + 1) >> 1) ? 1) +*/ + tmp = ((bwadj &PLL_BWADJ_LO_MASK ) <<PLL_BWADJ_LO_SHIFT ) | + (pllm <<6 ) | + (plld &PLL_DIV_MASK ) | + (pllod <<PLL_CLKOD_SHIFT ) |PLLCTL_BYPASS ; +__raw_writel (tmp, pll_regs[data->pll].reg0); + +/* Set BWADJ[11:8] bits */ + tmp =__raw_readl (pll_regs[data->pll].reg1); + tmp &= ~(PLL_BWADJ_HI_MASK ); + tmp |= ((bwadj>>8 ) &PLL_BWADJ_HI_MASK ); +__raw_writel (tmp, pll_regs[data->pll].reg1); +/* +* 5 Wait for at least 5 us based on the reference +* clock (PLL reset time) +*/ +sdelay (21000 );/* Wait for a minimum of 7 us*/ + +/* 6 In PLLCTL1, write PLLRST = 0 (PLL reset is released) */ +clrbits_le32 (pll_regs[data->pll].reg1,PLL_PLLRST ); +/* +* 7 Wait for at least 500 * REFCLK cycles * (PLLD + 1) +* (PLL lock time) +*/ +sdelay (105000 ); +/* 8 disable bypass */ +clrbits_le32 (pll_regs[data->pll].reg0,PLLCTL_BYPASS ); +/* +* 9 Set CHIPMISCCTL1[13] = 1 (disable glitchfree bypass) +* only applicable for Kepler +*/ +setbits_le32 (K2HK_MISC_CTRL ,ARM_PLL_EN ); + }else { +setbits_le32 (pll_regs[data->pll].reg1,PLLCTL_ENSAT ); +/* +* process keeps state of Bypass bit while programming +* all other DDR PLL settings +*/ + tmp =__raw_readl (pll_regs[data->pll].reg0); + tmp &=PLLCTL_BYPASS ;/* clear everything except Bypass */ + +/* +* Set the BWADJ[7:0], PLLD[5:0] and PLLM to PLLCTL0, +* bypass disabled +*/ + bwadj = pllm >>1 ; + tmp |= ((bwadj &PLL_BWADJ_LO_SHIFT ) <<PLL_BWADJ_LO_SHIFT ) | + (pllm <<PLL_MULT_SHIFT ) | + (plld &PLL_DIV_MASK ) | + (pllod <<PLL_CLKOD_SHIFT ); +__raw_writel (tmp, pll_regs[data->pll].reg0); + +/* Set BWADJ[11:8] bits */ + tmp =__raw_readl (pll_regs[data->pll].reg1); + tmp &= ~(PLL_BWADJ_HI_MASK ); + tmp |= ((bwadj >>8 ) &PLL_BWADJ_HI_MASK ); + +/* set PLL Select (bit 13) for PASS PLL */ +if (data->pll ==PASS_PLL ) + tmp |=PLLCTL_PAPLL ; + +__raw_writel (tmp, pll_regs[data->pll].reg1); + +/* Reset bit: bit 14 for both DDR3 & PASS PLL */ + tmp =PLL_PLLRST ; +/* Set RESET bit = 1 */ +setbits_le32 (pll_regs[data->pll].reg1, tmp); +/* Wait for a minimum of 7 us*/ +sdelay (21000 ); +/* Clear RESET bit */ +clrbits_le32 (pll_regs[data->pll].reg1, tmp); +sdelay (105000 ); + +/* clear BYPASS (Enable PLL Mode) */ +clrbits_le32 (pll_regs[data->pll].reg0,PLLCTL_BYPASS ); +sdelay (21000 );/* Wait for a minimum of 7 us*/ + } + +/* +* This is required to provide a delay between multiple +* consequent PPL configurations +*/ +sdelay (210000 ); +} + +void init_plls (int num_pll,struct pll_init_data *config) +{ +int i; + +for (i =0 ; i < num_pll; i++) +init_pll (&config[i]); +}arch/arm/cpu/armv7/keystone/cmd_clock.c new file +124
-0@@ -0,0 +1,124 @@ +/* +* keystone2: commands for clocks +* +* (C) Copyright 2012-2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <command.h> +#include <asm/arch/hardware.h> +#include <asm/arch/clock.h> +#include <asm/arch/psc_defs.h> + +struct pll_init_data cmd_pll_data = { + .pll =MAIN_PLL , + .pll_m =16 , + .pll_d =1 , + .pll_od =2 , +}; + +int do_pll_cmd (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +if (argc !=5 ) + goto pll_cmd_usage; + +if (strncmp (argv[1 ],"pa" ,2 ) ==0 ) + cmd_pll_data.pll =PASS_PLL ; +else if (strncmp (argv[1 ],"arm" ,3 ) ==0 ) + cmd_pll_data.pll =TETRIS_PLL ; +else if (strncmp (argv[1 ],"ddr3a" ,5 ) ==0 ) + cmd_pll_data.pll =DDR3A_PLL ; +else if (strncmp (argv[1 ],"ddr3b" ,5 ) ==0 ) + cmd_pll_data.pll =DDR3B_PLL ; +else + goto pll_cmd_usage; + + cmd_pll_data.pll_m =simple_strtoul (argv[2 ],NULL ,10 ); + cmd_pll_data.pll_d =simple_strtoul (argv[3 ],NULL ,10 ); + cmd_pll_data.pll_od =simple_strtoul (argv[4 ],NULL ,10 ); + +printf ("Trying to set pll %d; mult %d; div %d; OD %d\n" , + cmd_pll_data.pll, cmd_pll_data.pll_m, + cmd_pll_data.pll_d, cmd_pll_data.pll_od); +init_pll (&cmd_pll_data); + +return 0 ; + +pll_cmd_usage: +return cmd_usage (cmdtp); +} + +U_BOOT_CMD ( + pllset,5 ,0 , do_pll_cmd, +"set pll multiplier and pre divider" , +"<pa|arm|ddr3a|ddr3b> <mult> <div> <OD>\n" +); + +int do_getclk_cmd (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +unsigned int clk; +unsigned int freq; + +if (argc !=2 ) + goto getclk_cmd_usage; + + clk =simple_strtoul (argv[1 ],NULL ,10 ); + + freq =clk_get_rate (clk); +printf ("clock index [%d] - frequency %u\n" , clk, freq); +return 0 ; + +getclk_cmd_usage: +return cmd_usage (cmdtp); +} + +U_BOOT_CMD ( + getclk,2 ,0 , do_getclk_cmd, +"get clock rate" , +"<clk index>\n" +"See the 'enum clk_e' in the k2hk clock.h for clk indexes\n" +); + +int do_psc_cmd (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +int psc_module; +int res; + +if (argc !=3 ) + goto psc_cmd_usage; + + psc_module =simple_strtoul (argv[1 ],NULL ,10 ); +if (strcmp (argv[2 ],"en" ) ==0 ) { + res =psc_enable_module (psc_module); +printf ("psc_enable_module(%d) - %s\n" , psc_module, + (res) ?"ERROR" :"OK" ); +return 0 ; + } + +if (strcmp (argv[2 ],"di" ) ==0 ) { + res =psc_disable_module (psc_module); +printf ("psc_disable_module(%d) - %s\n" , psc_module, + (res) ?"ERROR" :"OK" ); +return 0 ; + } + +if (strcmp (argv[2 ],"domain" ) ==0 ) { + res =psc_disable_domain (psc_module); +printf ("psc_disable_domain(%d) - %s\n" , psc_module, + (res) ?"ERROR" :"OK" ); +return 0 ; + } + +psc_cmd_usage: +return cmd_usage (cmdtp); +} + +U_BOOT_CMD ( + psc,3 ,0 , do_psc_cmd, +"<enable/disable psc module os disable domain>" , +"<mod/domain index> <en|di|domain>\n" +"See the hardware.h for Power and Sleep Controller (PSC) Domains\n" +);arch/arm/cpu/armv7/keystone/cmd_mon.c new file +49
-0@@ -0,0 +1,131 @@ +/* +* K2HK: secure kernel command file +* +* (C) Copyright 2012-2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <command.h> +asm(".arch_extension sec\n\t" ); + +static int mon_install (u32 addr,u32 dpsc,u32 freq) +{ +int result; + + __asm__ __volatile__ ( +"stmfd r13!, {lr}\n" +"mov r0, %1\n" +"mov r1, %2\n" +"mov r2, %3\n" +"blx r0\n" +"ldmfd r13!, {lr}\n" + :"=&r" (result) + :"r" (addr),"r" (dpsc),"r" (freq) + :"cc" ,"r0" ,"r1" ,"r2" ,"memory" ); +return result; +} + +static int do_mon_install (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[]) +{ +u32 addr, dpsc_base =0x1E80000 , freq; +int rcode =0 ; + +if (argc <2 ) +return CMD_RET_USAGE ; + + freq =clk_get_rate (sys_clk0_6_clk); + + addr =simple_strtoul (argv[1 ],NULL ,16 ); + + rcode =mon_install (addr, dpsc_base, freq); +printf ("## installed monitor, freq [%d], status %d\n" , + freq, rcode); + +return 0 ; +}
arch/arm/cpu/armv7/keystone/cmd_mon.c line 59
Quoted 10 lines
arch/arm/cpu/armv7/keystone/cmd_mon.c new file +10
-0+ +U_BOOT_CMD (mon_install,2 ,0 , do_mon_install, +"Install boot kernel at 'addr'" , +"" +); + +static void core_spin (void ) +{ +while (1 ) + ;/* forever */ ;
/* forever */ - this comment is redundant
And why do you carry ';' ? Why just use while(1); instead
Quoted 32 lines
arch/arm/cpu/armv7/keystone/cmd_mon.c new file +32
-0+} + +int mon_power_on (int core_id,void *ep) +{ +int result; + + asmvolatile ( +"stmfd r13!, {lr}\n" +"mov r1, %1\n" +"mov r2, %2\n" +"mov r0, #0\n" +"smc #0\n" +"ldmfd r13!, {lr}\n" + :"=&r" (result) + :"r" (core_id),"r" (ep) + :"cc" ,"r0" ,"r1" ,"r2" ,"memory" ); +return result; +} + +int mon_power_off (int core_id) +{ +int result; + + asmvolatile ( +"stmfd r13!, {lr}\n" +"mov r1, %1\n" +"mov r0, #1\n" +"smc #1\n" +"ldmfd r13!, {lr}\n" + :"=&r" (result) + :"r" (core_id) + :"cc" ,"r0" ,"r1" ,"memory" );
arch/arm/cpu/armv7/keystone/cmd_mon.c line 101
Quoted 10 lines
arch/arm/cpu/armv7/keystone/cmd_mon.c new file +10
-0+return result; +} + +int do_mon_power (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[]) +{ +int rcode =0 , core_id, on; +void (*fn)(void ); + + fn = core_spin;
why do you need this pointer?
arch/arm/cpu/armv7/keystone/cmd_mon.c line 110
Quoted 9 lines
arch/arm/cpu/armv7/keystone/cmd_mon.c new file +9
-0+ +if (argc <3 ) +return CMD_RET_USAGE ; + + core_id =simple_strtoul (argv[1 ],NULL ,16 ); + on =simple_strtoul (argv[2 ],NULL ,16 ); + +if (on) + rcode =mon_power_on (core_id, fn);
Maybe there is no need to use fn pointer:
rcode = mon_power_on(core_id, core_spin);
Quoted 107 lines
arch/arm/cpu/armv7/keystone/cmd_mon.c new file +21
-0+else + rcode =mon_power_off (core_id); + +if (on) { +if (!rcode) +printf ("core %d powered on successfully\n" , core_id); +else +printf ("core %d power on failure\n" , core_id); + }else { +printf ("core %d powered off successfully\n" , core_id); + } + +return 0 ; +} + +U_BOOT_CMD (mon_power,3 ,0 , do_mon_power, +"Power On/Off secondary core" , +"mon_power <coreid> <oper>\n" +"- coreid (1-3) and oper (1 - ON, 0 - OFF)\n" +"" +);arch/arm/cpu/armv7/keystone/ddr3.c new file +69
-0@@ -0,0 +1,69 @@ +/* +* Keystone2: DDR3 initialization +* +* (C) Copyright 2012-2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <asm/arch/hardware.h> +#include <asm/io.h> + +void init_ddrphy (u32 base,struct ddr3_phy_config *phy_cfg) +{ +unsigned int tmp; + +while ((__raw_readl (base +KS2_DDRPHY_PGSR0_OFFSET ) + &0x00000001 ) !=0x00000001 ) + ; + +__raw_writel (phy_cfg->pllcr, base +KS2_DDRPHY_PLLCR_OFFSET ); + + tmp =__raw_readl (base +KS2_DDRPHY_PGCR1_OFFSET ); + tmp &= ~(phy_cfg->pgcr1_mask); + tmp |= phy_cfg->pgcr1_val; +__raw_writel (tmp, base +KS2_DDRPHY_PGCR1_OFFSET ); + +__raw_writel (phy_cfg->ptr0, base +KS2_DDRPHY_PTR0_OFFSET ); +__raw_writel (phy_cfg->ptr1, base +KS2_DDRPHY_PTR1_OFFSET ); +__raw_writel (phy_cfg->ptr3, base +KS2_DDRPHY_PTR3_OFFSET ); +__raw_writel (phy_cfg->ptr4, base +KS2_DDRPHY_PTR4_OFFSET ); + + tmp =__raw_readl (base +KS2_DDRPHY_DCR_OFFSET ); + tmp &= ~(phy_cfg->dcr_mask); + tmp |= phy_cfg->dcr_val; +__raw_writel (tmp, base +KS2_DDRPHY_DCR_OFFSET ); + +__raw_writel (phy_cfg->dtpr0, base +KS2_DDRPHY_DTPR0_OFFSET ); +__raw_writel (phy_cfg->dtpr1, base +KS2_DDRPHY_DTPR1_OFFSET ); +__raw_writel (phy_cfg->dtpr2, base +KS2_DDRPHY_DTPR2_OFFSET ); +__raw_writel (phy_cfg->mr0, base +KS2_DDRPHY_MR0_OFFSET ); +__raw_writel (phy_cfg->mr1, base +KS2_DDRPHY_MR1_OFFSET ); +__raw_writel (phy_cfg->mr2, base +KS2_DDRPHY_MR2_OFFSET ); +__raw_writel (phy_cfg->dtcr, base +KS2_DDRPHY_DTCR_OFFSET ); +__raw_writel (phy_cfg->pgcr2, base +KS2_DDRPHY_PGCR2_OFFSET ); + +__raw_writel (phy_cfg->zq0cr1, base +KS2_DDRPHY_ZQ0CR1_OFFSET ); +__raw_writel (phy_cfg->zq1cr1, base +KS2_DDRPHY_ZQ1CR1_OFFSET ); +__raw_writel (phy_cfg->zq2cr1, base +KS2_DDRPHY_ZQ2CR1_OFFSET ); + +__raw_writel (phy_cfg->pir_v1, base +KS2_DDRPHY_PIR_OFFSET ); +while ((__raw_readl (base +KS2_DDRPHY_PGSR0_OFFSET ) &0x1 ) !=0x1 ) + ; + +__raw_writel (phy_cfg->pir_v2, base +KS2_DDRPHY_PIR_OFFSET ); +while ((__raw_readl (base +KS2_DDRPHY_PGSR0_OFFSET ) &0x1 ) !=0x1 ) + ; +} + +void init_ddremif (u32 base,struct ddr3_emif_config *emif_cfg) +{ +__raw_writel (emif_cfg->sdcfg, base +KS2_DDR3_SDCFG_OFFSET ); +__raw_writel (emif_cfg->sdtim1, base +KS2_DDR3_SDTIM1_OFFSET ); +__raw_writel (emif_cfg->sdtim2, base +KS2_DDR3_SDTIM2_OFFSET ); +__raw_writel (emif_cfg->sdtim3, base +KS2_DDR3_SDTIM3_OFFSET ); +__raw_writel (emif_cfg->sdtim4, base +KS2_DDR3_SDTIM4_OFFSET ); +__raw_writel (emif_cfg->zqcfg, base +KS2_DDR3_ZQCFG_OFFSET ); +__raw_writel (emif_cfg->sdrfc, base +KS2_DDR3_SDRFC_OFFSET ); +}arch/arm/cpu/armv7/keystone/init.c new file +5
-0@@ -0,0 +1,56 @@ +/* +* Keystone2: Architecture initialization +* +* (C) Copyright 2012-2014 +* Texas Instruments Incorporated, <www.ti.com>
arch/arm/cpu/armv7/keystone/init.c line 15
Quoted 10 lines
arch/arm/cpu/armv7/keystone/init.c new file +10
-0+* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/hardware.h> + +void chip_configuration_unlock (void )
why not static inline?
Quoted 41 lines
arch/arm/cpu/armv7/keystone/init.c new file +41
-0+{ +__raw_writel (KEYSTONE_KICK0_MAGIC ,KEYSTONE_KICK0 ); +__raw_writel (KEYSTONE_KICK1_MAGIC ,KEYSTONE_KICK1 ); +} + +int arch_cpu_init (void ) +{ +chip_configuration_unlock (); +icache_enable (); + +#ifdef CONFIG_SOC_K2HK +share_all_segments (8 ); +share_all_segments (9 ); +share_all_segments (10 );/* QM PDSP */ +share_all_segments (11 );/* PCIE */ +#endif + +return 0 ; +} + +void reset_cpu (ulong addr) +{ +volatile u32 *rstctrl = (volatile u32 *)(KS2_RSTCTRL ); +u32 tmp; + + tmp = *rstctrl &KS2_RSTCTRL_MASK ; + *rstctrl = tmp |KS2_RSTCTRL_KEY ; + + *rstctrl &=KS2_RSTCTRL_SWRST ; + +for (;;) + ; +} + +void enable_caches (void ) +{ +#ifndef CONFIG_SYS_DCACHE_OFF +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +#endif +}
...
Signature · 2 lines
Regards, Ivan Khoronzhuk
PATCH v5 8/9 spi: davinci: add support for multiple bus and chip select
In reply to Murali KaricheriCurrently davinci spi driver supports only bus 0 cs 0. This patch allows driver to support bus 1 and bus 2 with configurable number of chip selects. Also defaults are selected in a way to avoid regression on other platforms that uses davinci spi driver and has only one spi bus.
--- drivers/spi/davinci_spi.c | 49 ++++++++++++++++++++++++++++++++++++++++++--- drivers/spi/davinci_spi.h | 33 ++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 3 deletions(-)
drivers/spi/davinci_spi.c +46 -3
@@ -32,7 +32,27 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,if (!ds)return NULL ; - ds->regs = (struct davinci_spi_regs *)CONFIG_SYS_SPI_BASE ; + ds->slave.bus = bus; + ds->slave.cs = cs; + +switch (bus) { +case SPI0_BUS : + ds->regs = (struct davinci_spi_regs *)SPI0_BASE ; +break ; +#ifdef CONFIG_SYS_SPI1 +case SPI1_BUS : + ds->regs = (struct davinci_spi_regs *)SPI0_BASE ; +break ; +#endif +#ifdef CONFIG_SYS_SPI2 +case SPI2_BUS : + ds->regs = (struct davinci_spi_regs *)SPI2_BASE ; +break ; +#endif +default :/* Invalid bus number */ +return NULL ; + } + ds->freq = max_hz;return &ds->slave;
@@ -59,7 +79,7 @@ int spi_claim_bus(struct spi_slave *slave)writel (SPIGCR1_MASTER_MASK |SPIGCR1_CLKMOD_MASK , &ds->regs->gcr1);/* CS, CLK, SIMO and SOMI are functional pins */ -writel ((SPIPC0_EN0FUN_MASK |SPIPC0_CLKFUN_MASK | +writel (((1 << slave->cs) |SPIPC0_CLKFUN_MASK |SPIPC0_DOFUN_MASK |SPIPC0_DIFUN_MASK ), &ds->regs->pc0);/* setup format */
@@ -264,7 +284,30 @@ out:int spi_cs_is_valid (unsigned int bus,unsigned int cs) { -return bus ==0 && cs ==0 ; +int ret =0 ; + +switch (bus) { +case SPI0_BUS : +if (cs <SPI0_NUM_CS ) + ret =1 ; +break ; +#ifdef CONFIG_SYS_SPI1 +case SPI1_BUS : +if (cs <SPI1_NUM_CS ) + ret =1 ; +break ; +#endif +#ifdef CONFIG_SYS_SPI2 +case SPI2_BUS : +if (cs <SPI2_NUM_CS ) + ret =1 ; +break ; +#endif +default : +/* Invalid bus number. Do nothing */ +break ; + } +return ret; }void spi_cs_activate (struct spi_slave *slave)
drivers/spi/davinci_spi.h +33 -0
@@ -74,6 +74,39 @@ struct davinci_spi_regs {/* SPIDEF */ #define SPIDEF_CSDEF0_MASK BIT(0) +#define SPI0_BUS 0 +#define SPI0_BASE CONFIG_SYS_SPI_BASE +/* +* Define default SPI0_NUM_CS as 1 for existing platforms that uses this +* driver. Platform can configure number of CS using CONFIG_SYS_SPI0_NUM_CS +* if more than one CS is supported and by defining CONFIG_SYS_SPI0. +*/ +#ifndef CONFIG_SYS_SPI0 +#define SPI0_NUM_CS 1 +#else +#define SPI0_NUM_CS CONFIG_SYS_SPI0_NUM_CS +#endif + +/* +* define CONFIG_SYS_SPI1 when platform has spi-1 device (bus #1) and +* CONFIG_SYS_SPI1_NUM_CS defines number of CS on this bus +*/ +#ifdef CONFIG_SYS_SPI1 +#define SPI1_BUS 1 +#define SPI1_NUM_CS CONFIG_SYS_SPI1_NUM_CS +#define SPI1_BASE CONFIG_SYS_SPI1_BASE +#endif + +/* +* define CONFIG_SYS_SPI2 when platform has spi-2 device (bus #2) and +* CONFIG_SYS_SPI2_NUM_CS defines number of CS on this bus +*/ +#ifdef CONFIG_SYS_SPI2 +#define SPI2_BUS 2 +#define SPI2_NUM_CS CONFIG_SYS_SPI2_NUM_CS +#define SPI2_BASE CONFIG_SYS_SPI2_BASE +#endif +struct davinci_spi_slave {struct spi_slave slave;struct davinci_spi_regs *regs;
Signature · 1 line
1.7.9.5
PATCH v5 9/9 k2hk-evm: add configuration for spi1 and spi2 support
In reply to Murali Karichericurrently only spi0 is enabled on k2hk evm. This configuration update is needed to enable spi1 and spi2.
--- include/configs/k2hk_evm.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/configs/k2hk_evm.h +9 -0
@@ -81,7 +81,16 @@#define CONFIG_SPI_FLASH #define CONFIG_SPI_FLASH_STMICRO #define CONFIG_DAVINCI_SPI +#define CONFIG_SYS_SPI0 #define CONFIG_SYS_SPI_BASE K2HK_SPI_BASE +#define CONFIG_SYS_SPI0_NUM_CS 4 +#define CONFIG_SYS_SPI1 +#define CONFIG_SYS_SPI1_BASE K2HK_SPI1_BASE +#define CONFIG_SYS_SPI1_NUM_CS 4 +#define CONFIG_SYS_SPI2 +#define CONFIG_SYS_SPI2_NUM_CS 4 +#define CONFIG_SYS_SPI2_BASE K2HK_SPI2_BASE +#define CONFIG_CMD_SPI #define CONFIG_SYS_SPI_CLK clk_get_rate(K2HK_LPSC_EMIF25_SPI)#define CONFIG_SF_DEFAULT_SPEED 30000000#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
Signature · 1 line
1.7.9.5