drivers/pci: Fix for debug builds without CONFIG_PCI_ENUM_ONLY
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/11 drivers/pci: Fix for debug builds without CONFIG_PCI_ENUM_ONLY
The debug printing references bar_res, which exists only if CONFIG_PCI_ENUM_ONLY is not defined. Therefore move it into the ifdef'd area.
--- drivers/pci/pci_auto_old.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci_auto_old.c +1 -1
@@ -98,11 +98,11 @@ void pciauto_setup_device(struct pci_controller *hose, bar_res = prefetch; else bar_res = mem; -#endif debug ("PCI Autoconfig: BAR %d, %s, size=0x%llx, " , bar_nr, bar_res == prefetch ?"Prf" :"Mem" , (unsigned long long )bar_size); +#endif }#ifndef CONFIG_PCI_ENUM_ONLY
Signature · 1 line
2.5.3
PATCH 2/11 drivers/spi/kirkwood_spi: Fix debugging with CONFIG_DM_SPI
In reply to a message not in the archiveThe debug printing tries to reference slave->bus and slave->cs which don't exist when CONFIG_DM_SPI is defined.
--- drivers/spi/kirkwood_spi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/kirkwood_spi.c +2 -0
@@ -161,8 +161,10 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,unsigned int tmpdout, tmpdin;int tm, isread =0 ; +#ifndef CONFIG_DM_SPI debug ("spi_xfer: slave %u:%u dout %p din %p bitlen %u\n" , slave->bus, slave->cs, dout, din, bitlen); +#endif if (flags &SPI_XFER_BEGIN )spi_cs_activate (slave);
Signature · 1 line
2.5.3
PATCH 3/11 mvebu: Fix for non-DM ehci-marvell support
In reply to a message not in the archiveThis mimics the relevant code in mach-kirkwood headers. The *_winctrl_calcsize functions are identical, as well as the MVCPU_WIN_* macros. Implementing shared headers/code between mvebu and kirkwood is left for someone with a better knowledge of how u-boot is organized internally.
--- arch/arm/mach-mvebu/cpu.c | 21 +++++++++++++++++++++ arch/arm/mach-mvebu/include/mach/cpu.h | 3 +++ arch/arm/mach-mvebu/include/mach/soc.h | 9 ++++++++- 3 files changed, 32 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/cpu.c +21 -0
@@ -46,6 +46,27 @@ void reset_cpu(unsigned long ignored) ; } +/* +* Window Size +* Used with the Base register to set the address window size and location. +* Must be programmed from LSB to MSB as sequence of ones followed by +* sequence of zeros. The number of ones specifies the size of the window in +* 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte). +* NOTE: A value of 0x0 specifies 64-KByte size. +*/ +unsigned int mvebu_winctrl_calcsize (unsigned int sizeval) +{ +int i; +unsigned int j =0 ; +u32 val = sizeval >>1 ; + +for (i =0 ; val >=0x10000 ; i++) { + j |= (1 << i); + val = val >>1 ; + } +return 0x0000ffff & j; +} +int mvebu_soc_family (void ) {u16 devid = (readl (MVEBU_REG_PCIE_DEVID ) >>16 ) &0xffff ;
arch/arm/mach-mvebu/include/mach/cpu.h +3 -0
@@ -13,6 +13,9 @@#ifndef __ASSEMBLY__ +#define MVEBU_CPU_WIN_CTRL_DATA (size, target, attr, en) (en | (target << 4) \ + | (attr << 8) | (mvebu_winctrl_calcsize(size) << 16)) +#define MVEBU_REG_PCIE_DEVID (MVEBU_REG_PCIE_BASE + 0x00)#define MVEBU_REG_PCIE_REVID (MVEBU_REG_PCIE_BASE + 0x08)
arch/arm/mach-mvebu/include/mach/soc.h +8 -1
@@ -96,8 +96,15 @@#define SDRAM_MAX_CS 4#define SDRAM_ADDR_MASK 0xFF000000 +/* MVEBU USB Host controller */ +#define MVUSB0_BASE MVEBU_AXP_USB_BASE +#define MVUSB0_CPU_ATTR_DRAM_CS0 CPU_ATTR_DRAM_CS0 +#define MVUSB0_CPU_ATTR_DRAM_CS1 CPU_ATTR_DRAM_CS1 +#define MVUSB0_CPU_ATTR_DRAM_CS2 CPU_ATTR_DRAM_CS2 +#define MVUSB0_CPU_ATTR_DRAM_CS3 CPU_ATTR_DRAM_CS3 +/* MVEBU CPU memory windows */ -#define MVCPU_WIN_CTRL_DATA CPU_WIN_CTRL_DATA +#define MVCPU_WIN_CTRL_DATA MVEBU_CPU_WIN_CTRL_DATA#define MVCPU_WIN_ENABLE CPU_WIN_ENABLE#define MVCPU_WIN_DISABLE CPU_WIN_DISABLE
Signature · 1 line
2.5.3
PATCH 4/11 README: Review the u-boot porting guide list
In reply to a message not in the archive* There is no boards.cfg anymore, so drop (1).
* Creating flash.c and u-boot.lds seems not mandatory as well.
* Adjusting the enumerators for the above implicitly fixed for double items numbered (3).
--- README | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
README +4 -7
@@ -5153,14 +5153,11 @@ If the system board that you have is not listed, then you will need to port U-Boot to your hardware platform. To do this, follow these steps: -1. Add a new configuration option for your board to the toplevel - "boards.cfg" file, using the existing entries as examples. - Follow the instructions there to keep the boards in order. -2. Create a new directory to hold your board specific code. Add any +1. Create a new directory to hold your board specific code. Add any files you need. In your board directory, you will need at least - the "Makefile", a "<board>.c", "flash.c" and "u-boot.lds". -3. Create a new configuration file "include/configs/<board>.h" for - your board + the "Makefile" and a "<board>.c". +2. Create a new configuration file "include/configs/<board>.h" for + your board. 3. If you're porting U-Boot to a new CPU, then also create a new directory to hold your CPU specific code. Add any files you need. 4. Run "make <board>_defconfig" with your new name.
Signature · 1 line
2.5.3
PATCH 5/11 axp: Fix debugging support in DDR3 write leveling
In reply to a message not in the archiveIf MV_DEBUG_WL is defined, DEBUG_WL_S and DEBUG_WL_D macros are missing. In addition to that, get rid of debug output printing non-existent counter variable.
--- drivers/ddr/marvell/axp/ddr3_write_leveling.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ddr/marvell/axp/ddr3_write_leveling.c +2 -2
@@ -22,6 +22,8 @@ DEBUG_WL_FULL_S(s); DEBUG_WL_FULL_D(d, l); DEBUG_WL_FULL_S("\n")#ifdef MV_DEBUG_WL +#define DEBUG_WL_S (s) puts(s) +#define DEBUG_WL_D (d, l) printf("%x", d)#define DEBUG_RL_S (s) \ debug_cond(ddr3_get_log_level() >= MV_LOG_LEVEL_2, "%s", s)#define DEBUG_RL_D (d, l) \
@@ -1229,8 +1231,6 @@ static int ddr3_write_leveling_single_cs(u32 cs, u32 freq, int ratio_2to1,DEBUG_WL_FULL_D ((u32 ) phase,1 );DEBUG_WL_FULL_S (", Delay = " );DEBUG_WL_FULL_D ((u32 ) delay,1 ); -DEBUG_WL_FULL_S (", Counter = " ); -DEBUG_WL_FULL_D ((u32 ) i,1 );DEBUG_WL_FULL_S ("\n" );/* Drive DQS high for one cycle - All data PUPs */
Signature · 1 line
2.5.3
PATCH 6/11 drivers/pci/pci_mvebu: Fix for boards with X4 lanes
In reply to a message not in the archiveArmada XP has support for X4 lanes, boards specify this in their serdes_cfg. During PEX init in high_speed_env_lib.c, the configuration is stored in GEN_PURP_RES_2_REG.
When enumerating PEX, subsequent interfaces of an X4 lane must be skipped. Otherwise the enumeration hangs up the board.
The way this is implemented here is not exactly beautiful, but it mimics how Marvell's BSP does it. Alternatively we could get the information using board_serdes_cfg_get(), but that won't lead to clean code, either. Especially since the ugly includes will have to be done anyway.
--- drivers/pci/pci_mvebu.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/pci/pci_mvebu.c +21 -0
@@ -18,6 +18,11 @@#include <asm/arch/soc.h> #include <linux/mbus.h> +#if defined(CONFIG_ARMADA_XP ) +#include "../ddr/marvell/axp/ddr3_init.h" +#include "../../arch/arm/mach-mvebu/serdes/axp/board_env_spec.h" +#endif +DECLARE_GLOBAL_DATA_PTR ;/* PCIe unit register offsets */
@@ -155,6 +160,16 @@ static void mvebu_get_port_lane(struct mvebu_pcie *pcie, int pex_idx, }#endif +#if defined(CONFIG_ARMADA_XP ) +static int mvebu_pex_unit_is_x4 (int pex_idx) +{ +int pex_unit = pex_idx <9 ? pex_idx >>2 :3 ; +u32 mask = (0x0f << (pex_unit *8 )); + +return (reg_read (GEN_PURP_RES_2_REG ) & mask) == mask; +} +#endif +static inline bool mvebu_pcie_link_up (struct mvebu_pcie *pcie) {u32 val;
@@ -419,5 +434,11 @@ void pci_init_board(void)writel (0 , pcie->base +PCIE_BAR_HI_OFF (0 )); bus = hose->last_busno +1 ; + +#if defined(CONFIG_ARMADA_XP ) +/* need to skip more for X4 links, otherwise scan will hang */ +if (mvebu_pex_unit_is_x4 (i)) + i +=3 ; +#endif } }
Signature · 1 line
2.5.3
PATCH 7/11 mvebu: Fix shortcoming of Marvell BSP board detection
In reply to a message not in the archive--- arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c +2 -1
@@ -70,8 +70,9 @@ static u32 board_id_get(void)/* * Return 0 here for custom board as this should not be used * for custom boards. +* -- Spoke Marvell and forgot that DB_88F78XX0_BP_ID == 0. */ -return 0 ; +return INVALID_BOARD_ID ;#endif }
Signature · 1 line
2.5.3
PATCH 8/11 drivers/ddr/marvell: Default DRAM_ECC to 0
In reply to a message not in the archiveNot all boards implementing an Armada XP chip are equipped with ECC RAM. Defining DRAM_ECC to 1 enables ECC without a chance to turn it off in board configs, which breaks DDR training for them.
--- drivers/ddr/marvell/axp/ddr3_axp_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/marvell/axp/ddr3_axp_config.h +1 -1
@@ -44,7 +44,7 @@* DDR3_TRAINING_DEBUG - Debug prints of internal code */ #define DDR_TARGET_FABRIC 5 -#define DRAM_ECC 1 +#define DRAM_ECC 0#ifdef MV_DDR_32BIT #define BUS_WIDTH 32
Signature · 1 line
2.5.3
PATCH 9/11 mvebu: Add rudimental MV78320 support
In reply to a message not in the archive--- arch/arm/mach-mvebu/cpu.c | 5 ++++- arch/arm/mach-mvebu/include/mach/soc.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/cpu.c +4 -1
@@ -71,7 +71,7 @@ int mvebu_soc_family(void) {u16 devid = (readl (MVEBU_REG_PCIE_DEVID ) >>16 ) &0xffff ; -if (devid ==SOC_MV78460_ID ) +if (devid ==SOC_MV78460_ID || devid ==SOC_MV78230_ID )return MVEBU_SOC_AXP ; if (devid == SOC_88F6810_ID || devid == SOC_88F6820_ID ||
@@ -90,6 +90,9 @@ int print_cpuinfo(void)puts ("SoC: " );switch (devid) { +case SOC_MV78230_ID : +puts ("MV78230-" ); +break ;case SOC_MV78460_ID :puts ("MV78460-" );break ;
arch/arm/mach-mvebu/include/mach/soc.h +1 -0
@@ -11,6 +11,7 @@#ifndef _MVEBU_SOC_H#define _MVEBU_SOC_H +#define SOC_MV78230_ID 0x7823#define SOC_MV78460_ID 0x7846#define SOC_88F6810_ID 0x6810#define SOC_88F6820_ID 0x6820
Signature · 1 line
2.5.3
PATCH 10/11 mvebu: Support Synology DS414
In reply to a message not in the archiveThis adds support for the MV78230 based DS414 NAS by Synology. The relevant bits have been extracted from the 'synogpl-5004-armadaxp' package Synology kindly published, garnished with a fair amount of trial-and-error.
Sadly, support is far from perfect. The major parts I have failed in are SATA and XHCI support. Details about these and some other things follow:
SATA Support
------------
There is a Marvell 88SX7042 controller attached to PCIe which is supported by Linux's sata_mv driver but sadly not U-Boot's mvsata_ide. I'm not sure if extending the latter to support PCI devices is worth the effort at all. Porting sata_mv from Linux exceeded my brain's capacities. :(
XHCI Support
------------
There is an EtronTech EJ168A XHCI controller attached to PCIe which drives the two rear USB3 ports. After a bit of playing around I managed to get it recognized by xhci-pci, but never was able to access any devices attached to it. Enabling it in ds414 board config shows that it does not respond to commands for whatever reason. The (somewhat) bright side to it is that it is not even supported in Synology's customized U-Boot, but that also means nowhere to steal the relevant bits from.
EHCI Support
------------
This seems functional after issuing 'usb start'. At least it detects USB storage devices, and IIRC reading from them was OK. OTOH Linux fails to register the controller if 'usb start' wasn't given before in U-Boot.
According to Synology sources, this board seems to support USB device (gadget?) mode. Though I didn't play around with it.
PCIe Support
------------
This is fine, but trying to gate the clocks of unused lanes will hang PCI enum. In addition to that, pci_mvebu seems not to support DM_PCI.
DDR3 Training
-------------
Marvell/Synology uses eight PUPs instead of four. Does not look like this is meant to be customized in mainline U-Boot at all. OTOH I have no idea what a "PUP" actually is.
PEX Init
--------
Synology uses different values than mainline U-Boot with this patch:pex_max_unit_get returns 2, pex_max_if_get returns 7 and max_serdes_lines is set to 7. Not changing this seems to not have an impact, although I'm not entirely sure it does not cause issues I am not aware of.
--- arch/arm/Kconfig | 1 + arch/arm/dts/Makefile | 2 + arch/arm/dts/armada-xp-synology-ds414.dts | 330 +++++++++++++++++++++ arch/arm/mach-mvebu/Kconfig | 3 + arch/arm/mach-mvebu/serdes/axp/board_env_spec.h | 5 +- .../arm/mach-mvebu/serdes/axp/high_speed_env_lib.c | 8 +- board/Synology/ds414/Kconfig | 12 + board/Synology/ds414/Makefile | 1 + board/Synology/ds414/ds414.c | 173 +++++++++++ board/Synology/ds414/kwbimage.cfg | 12 + configs/ds414_defconfig | 12 + include/configs/ds414.h | 153 ++++++++++ 12 files changed, 709 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/armada-xp-synology-ds414.dts create mode 100644 board/Synology/ds414/Kconfig create mode 100644 board/Synology/ds414/Makefile create mode 100644 board/Synology/ds414/ds414.c create mode 100644 board/Synology/ds414/kwbimage.cfg create mode 100644 configs/ds414_defconfig create mode 100644 include/configs/ds414.h
arch/arm/Kconfig +1 -0
@@ -807,6 +807,7 @@ source "board/hisilicon/hikey/Kconfig" source "board/imx31_phycore/Kconfig" source "board/isee/igep0033/Kconfig" source "board/maxbcm/Kconfig" +source "board/Synology/ds414/Kconfig" source "board/mpl/vcma9/Kconfig" source "board/olimex/mx23_olinuxino/Kconfig" source "board/phytec/pcm051/Kconfig"
arch/arm/dts/Makefile +2 -0
@@ -51,6 +51,8 @@ dtb-$(CONFIG_ARCH_MVEBU) += \ armada-388-gp.dtb \ armada-xp-gp.dtb +dtb-$(CONFIG_TARGET_DS414) += armada-xp-synology-ds414.dtb + dtb-$(CONFIG_ARCH_UNIPHIER) += \ uniphier-ph1-ld4-ref.dtb \ uniphier-ph1-ld6b-ref.dtb \
arch/arm/dts/armada-xp-synology-ds414.dts new file +330 -0
330 lines not on this page · raw message
arch/arm/mach-mvebu/Kconfig +3 -0
@@ -13,6 +13,9 @@ config TARGET_DB_MV784MP_GP config TARGET_MAXBCM bool "Support maxbcm" +config TARGET_DS414 + bool "Support Synology DS414" + endchoice config SYS_SOC
arch/arm/mach-mvebu/serdes/axp/board_env_spec.h +3 -2
@@ -43,8 +43,9 @@#define RD_78460_SERVER_REV2_ID (DB_78X60_PCAC_REV2_ID + 1)#define DB_784MP_GP_ID (RD_78460_SERVER_REV2_ID + 1)#define RD_78460_CUSTOMER_ID (DB_784MP_GP_ID + 1) -#define MV_MAX_BOARD_ID (RD_78460_CUSTOMER_ID + 1) -#define INVALID_BAORD_ID 0xFFFFFFFF +#define SYNOLOGY_DS414_ID (RD_78460_CUSTOMER_ID + 1) +#define MV_MAX_BOARD_ID (SYNOLOGY_DS414_ID + 1) +#define INVALID_BOARD_ID 0xFFFFFFFF/* Sample at Reset */ #define MPP_SAMPLE_AT_RESET (id) (0x18230 + (id * 4))
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c +7 -1
@@ -66,6 +66,8 @@ static u32 board_id_get(void)return DB_784MP_GP_ID ;#elif defined(CONFIG_RD_78460_CUSTOMER )return RD_78460_CUSTOMER_ID ; +#elif defined(CONFIG_SYNOLOGY_DS414 ) +return SYNOLOGY_DS414_ID ;#else /* * Return 0 here for custom board as this should not be used
@@ -191,8 +193,11 @@ __weak MV_BIN_SERDES_CFG *board_serdes_cfg_get(u8 pex_mode)u16 ctrl_model_get (void ) { -/* Right now only MV78460 supported */ +#if defined(CONFIG_SYNOLOGY_DS414 ) +return MV_78230_DEV_ID ; +#else return MV_78460_DEV_ID ; +#endif }u32 get_line_cfg (u32 line_num,MV_BIN_SERDES_CFG *info)
@@ -241,6 +246,7 @@ int serdes_phy_config(void)case RD_78460_SERVER_ID :case RD_78460_SERVER_REV2_ID :case DB_78X60_PCAC_ID : +case SYNOLOGY_DS414_ID : satr11 = (0x1 <<1 ) |1 ;break ;case FPGA_88F78XX0_ID :
board/Synology/ds414/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if TARGET_DS414 + +config SYS_BOARD + default "ds414" + +config SYS_VENDOR + default "Synology" + +config SYS_CONFIG_NAME + default "ds414" + +endif
board/Synology/ds414/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y := ds414.o
board/Synology/ds414/ds414.c new file +173 -0
173 lines not on this page · raw message
board/Synology/ds414/kwbimage.cfg new file +12 -0
@@ -0,0 +1,12 @@ +# +# Copyright (C) 2014 Stefan Roese <[email protected]> +# + +# Armada XP uses version 1 image format +VERSION 1 + +# Boot Media configurations +BOOT_FROM spi + +# Binary Header (bin_hdr) with DDR3 training code +BINARY spl/u-boot-spl.bin 0000005b 00000068
configs/ds414_defconfig new file +12 -0
@@ -0,0 +1,12 @@ +CONFIG_ARM=y +CONFIG_ARCH_MVEBU=y +CONFIG_TARGET_DS414=y +CONFIG_DEFAULT_DEVICE_TREE="armada-xp-synology-ds414" +CONFIG_SPL=y +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_SETEXPR is not set +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SYS_NS16550=y
include/configs/ds414.h new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
2.5.3
PATCH 11/11 common: Implement Synology specific command set
In reply to a message not in the archiveSynology keeps per item configuration in a dedicated 'partition' in SPI flash, namely the one named 'vendor' in DTS file. It contains the two NICs MAC addresses as well as the item's serial number. I didn't find a way to have this information extracted automatically, therefore implemented 'syno populate_env' command which extracts the three values and puts them into environment. To make things permanent though, one has to 'saveenv'.
Another command is 'syno clk_gate', which allows to change the clock gating which is done in DS414 board file.
--- common/Makefile | 1 + common/cmd_syno.c | 225 ++++++++++++++++++++++++++++++++++++++++++++++++ include/configs/ds414.h | 1 + 3 files changed, 227 insertions(+) create mode 100644 common/cmd_syno.c
common/Makefile +1 -0
@@ -217,6 +217,7 @@ obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o obj-$(CONFIG_CMD_DFU) += cmd_dfu.o obj-$(CONFIG_CMD_GPT) += cmd_gpt.o obj-$(CONFIG_CMD_ETHSW) += cmd_ethsw.o +obj-$(CONFIG_CMD_SYNO) += cmd_syno.o # Power obj-$(CONFIG_CMD_PMIC) += cmd_pmic.o
common/cmd_syno.c new file +225 -0
225 lines not on this page · raw message
include/configs/ds414.h +1 -0
@@ -37,6 +37,7 @@#define CONFIG_CMD_PING #define CONFIG_CMD_SF #define CONFIG_CMD_SPI +#define CONFIG_CMD_SYNO #define CONFIG_CMD_TFTPPUT #define CONFIG_CMD_TIME #define CONFIG_CMD_USB
Signature · 1 line
2.5.3