udoo: Move and optimize platform register setting.
Subsystems (2)
v2 cover udoo: Move and optimize platform register setting.
Previous uDoo configuration adopts register settings for DDR3, clock, muxing, etc. taken from Nitrogen6x. uDoo schematics is rather different from that board, and it needs customized setting for most of the registers.
All this changes can be considered atomical since it is part of initial support of the board.
Patch changes uDoo configuration files path to a specific one, and adopt optimized value for every configured register.
---
Changes in v2:
- Cosmetic changes.
board/udoo/1066mhz_4x256mx16.cfg | 55 ++++++++++++++++++++++++ board/udoo/clocks.cfg | 32 ++++++++++++++ board/udoo/ddr-setup.cfg | 87 ++++++++++++++++++++++++++++++++++++++ board/udoo/udoo.cfg | 29 +++++++++++++ boards.cfg | 2 +- 5 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 board/udoo/1066mhz_4x256mx16.cfg create mode 100644 board/udoo/clocks.cfg create mode 100644 board/udoo/ddr-setup.cfg create mode 100644 board/udoo/udoo.cfg
board/udoo/1066mhz_4x256mx16.cfg new file +55 -0
@@ -0,0 +1,55 @@ +/* + * Copyright (C) 2013 Boundary Devices + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +DATA 4, MX6_MMDC_P0_MDPDC, 0x00020036 +DATA 4, MX6_MMDC_P0_MDOTC, 0x09444040 + +DATA 4, MX6_MMDC_P0_MDCFG0, 0x54597955 +DATA 4, MX6_MMDC_P0_MDCFG1, 0xFF328F64 +DATA 4, MX6_MMDC_P0_MDCFG2, 0x01FF00DB + +DATA 4, MX6_MMDC_P0_MDMISC, 0x00001740 +DATA 4, MX6_MMDC_P0_MDSCR, 0x00008000 +DATA 4, MX6_MMDC_P0_MDRWD, 0x000026D2 + +DATA 4, MX6_MMDC_P0_MDOR, 0x00591023 +DATA 4, MX6_MMDC_P0_MDASP, 0x00000027 +DATA 4, MX6_MMDC_P0_MDCTL, 0x831A0000 + +DATA 4, MX6_MMDC_P0_MDSCR, 0x04088032 +DATA 4, MX6_MMDC_P0_MDSCR, 0x00008033 + +DATA 4, MX6_MMDC_P0_MDSCR, 0x00048031 +DATA 4, MX6_MMDC_P0_MDSCR, 0x09408030 +DATA 4, MX6_MMDC_P0_MDSCR, 0x04008040 +DATA 4, MX6_MMDC_P0_MPZQHWCTRL, 0xA1380003 +DATA 4, MX6_MMDC_P1_MPZQHWCTRL, 0xA1380003 +DATA 4, MX6_MMDC_P0_MDREF, 0x00005800 +DATA 4, MX6_MMDC_P0_MPODTCTRL, 0x00011117 +DATA 4, MX6_MMDC_P1_MPODTCTRL, 0x00011117 + +DATA 4, MX6_MMDC_P0_MPDGCTRL0, 0x43510360 +DATA 4, MX6_MMDC_P0_MPDGCTRL1, 0x0342033F +DATA 4, MX6_MMDC_P1_MPDGCTRL0, 0x033F033F +DATA 4, MX6_MMDC_P1_MPDGCTRL1, 0x03290266 + +DATA 4, MX6_MMDC_P0_MPRDDLCTL, 0x4B3E4141 +DATA 4, MX6_MMDC_P1_MPRDDLCTL, 0x47413B4A +DATA 4, MX6_MMDC_P0_MPWRDLCTL, 0x42404843 +DATA 4, MX6_MMDC_P1_MPWRDLCTL, 0x4C3F4C45 + +DATA 4, MX6_MMDC_P0_MPWLDECTRL0, 0x00350035 +DATA 4, MX6_MMDC_P0_MPWLDECTRL1, 0x001F001F +DATA 4, MX6_MMDC_P1_MPWLDECTRL0, 0x00010001 +DATA 4, MX6_MMDC_P1_MPWLDECTRL1, 0x00010001 + +DATA 4, MX6_MMDC_P0_MPMUR0, 0x00000800 +DATA 4, MX6_MMDC_P1_MPMUR0, 0x00000800 + +DATA 4, MX6_MMDC_P0_MDPDC, 0x00025576 +DATA 4, MX6_MMDC_P0_MAPSR, 0x00011006 +DATA 4, MX6_MMDC_P0_MDSCR, 0x00000000 +
board/udoo/clocks.cfg new file +32 -0
@@ -0,0 +1,32 @@ +/* + * Copyright (C) 2013 Boundary Devices + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Device Configuration Data (DCD) + * + * Each entry must have the format: + * Addr-type Address Value + * + * where: + * Addr-type register length (1,2 or 4 bytes) + * Address absolute address of the register + * value value to be stored in the register + */ + +/* set the default clock gate to save power */ +DATA 4, CCM_CCGR0, 0x00C03F3F +DATA 4, CCM_CCGR1, 0x0030FC03 +DATA 4, CCM_CCGR2, 0x0FFFC000 +DATA 4, CCM_CCGR3, 0x3FF00000 +DATA 4, CCM_CCGR4, 0x00FFF300 +DATA 4, CCM_CCGR5, 0x0F0000C3 +DATA 4, CCM_CCGR6, 0x000003FF + +/* enable AXI cache for VDOA/VPU/IPU */ +DATA 4, MX6_IOMUXC_GPR4, 0xF00000FF + +/* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */ +DATA 4, MX6_IOMUXC_GPR6, 0x007F007F +DATA 4, MX6_IOMUXC_GPR7, 0x007F007F +
board/udoo/ddr-setup.cfg new file +87 -0
87 lines not on this page · raw message
board/udoo/udoo.cfg new file +29 -0
@@ -0,0 +1,29 @@ +/* + * Copyright (C) 2013 Boundary Devices + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Refer doc/README.imximage for more details about how-to configure + * and create imximage boot image + * + * The syntax is taken as close as possible with the kwbimage + */ + +/* image version */ +IMAGE_VERSION 2 + +/* + * Boot Device : one of + * spi, sd (the board has no nand neither onenand) + */ +BOOT_FROM sd + +#define __ASSEMBLY__ +#include <config.h> +#include "asm/arch/mx6-ddr.h" +#include "asm/arch/iomux.h" +#include "asm/arch/crm_regs.h" + +#include "ddr-setup.cfg" +#include "1066mhz_4x256mx16.cfg" +#include "clocks.cfg"
boards.cfg +1 -1
@@ -288,7 +288,7 @@ Active arm armv7 mx5 freescale mx53smd Active arm armv7 mx5 genesi mx51_efikamx mx51_efikamx mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg - Active arm armv7 mx5 genesi mx51_efikamx mx51_efikasb mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_sb.cfg - Active arm armv7 mx5 ttcontrol vision2 vision2 vision2:IMX_CONFIG=board/ttcontrol/vision2/imximage_hynix.cfg Stefano Babic <[email protected]> -Active arm armv7 mx6 - udoo udoo_quad udoo:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q.cfg,MX6Q,DDR_MB=1024 Fabio Estevam <[email protected]> +Active arm armv7 mx6 - udoo udoo_quad udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6Q,DDR_MB=1024 Fabio Estevam <[email protected]> Active arm armv7 mx6 - wandboard wandboard_dl wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024 Fabio Estevam <[email protected]> Active arm armv7 mx6 - wandboard wandboard_quad wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q2g.cfg,MX6Q,DDR_MB=2048 Fabio Estevam <[email protected]> Active arm armv7 mx6 - wandboard wandboard_solo wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s.cfg,MX6S,DDR_MB=512 Fabio Estevam <[email protected]>
Signature · 1 line
1.7.10.4
PATCH v2 1/4 udoo: Add ethernet support (FEC + Micrel KSZ9031).
Add Ethernet and networking support on uDoo board (FEC +phy Micrel KSZ9031). Ethernet speed is currently limited to 10/100Mbps.
---
Changes in v2:
- Improve description and comment.
- uDoo does not works well with Gigabit switches, as workaround speed will be limited to 10/100Mbps.
- use defines instead of hard coded values for KSZ9031 register address.
board/udoo/udoo.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++ include/configs/udoo.h | 16 ++++++ include/micrel.h | 5 ++ 3 files changed, 161 insertions(+)
board/udoo/udoo.c +140 -0
@@ -9,6 +9,7 @@#include <asm/arch/clock.h> #include <asm/arch/imx-regs.h> #include <asm/arch/iomux.h> +#include <malloc.h> #include <asm/arch/mx6-pins.h> #include <asm/errno.h> #include <asm/gpio.h>
@@ -18,6 +19,9 @@#include <asm/arch/crm_regs.h> #include <asm/io.h> #include <asm/arch/sys_proto.h> +#include <micrel.h> +#include <miiphy.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -25,6 +29,9 @@ DECLARE_GLOBAL_DATA_PTR; PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ PAD_CTL_SRE_FAST | PAD_CTL_HYS) +#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ + PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS) +#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \ PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \ PAD_CTL_SRE_FAST | PAD_CTL_HYS)
@@ -58,6 +65,99 @@ static iomux_v3_cfg_t const wdog_pads[] = { MX6_PAD_EIM_D19__GPIO_3_19, }; +int mx6_rgmii_rework (struct phy_device *phydev) +{ +/* +* Bug: Apparently uDoo does not works with Gigabit switches... +* Limiting speed to 10/100Mbps, and setting master mode, seems to +* be the only way to have a successfull PHY auto negotiation. +* How to fix: Understand why Linux kernel do not have this issue. +*/ +phy_write (phydev,MDIO_DEVAD_NONE ,MII_CTRL1000 ,0x1c00 ); + +/* control data pad skew - devaddr = 0x02, register = 0x04 */ +ksz9031_phy_extended_write (phydev,0x02 , +MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW , +MII_KSZ9031_MOD_DATA_NO_POST_INC ,0x0000 ); +/* rx data pad skew - devaddr = 0x02, register = 0x05 */ +ksz9031_phy_extended_write (phydev,0x02 , +MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW , +MII_KSZ9031_MOD_DATA_NO_POST_INC ,0x0000 ); +/* tx data pad skew - devaddr = 0x02, register = 0x05 */ +ksz9031_phy_extended_write (phydev,0x02 , +MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW , +MII_KSZ9031_MOD_DATA_NO_POST_INC ,0x0000 ); +/* gtx and rx clock pad skew - devaddr = 0x02, register = 0x08 */ +ksz9031_phy_extended_write (phydev,0x02 , +MII_KSZ9031_EXT_RGMII_CLOCK_SKEW , +MII_KSZ9031_MOD_DATA_NO_POST_INC ,0x03FF ); +return 0 ; +} + +static iomux_v3_cfg_t const enet_pads1[] = { +MX6_PAD_ENET_MDIO__ENET_MDIO |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_ENET_MDC__ENET_MDC |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_TXC__ENET_RGMII_TXC |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_TD0__ENET_RGMII_TD0 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_TD1__ENET_RGMII_TD1 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_TD2__ENET_RGMII_TD2 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_TD3__ENET_RGMII_TD3 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_ENET_REF_CLK__ENET_TX_CLK |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_RXC__ENET_RGMII_RXC |MUX_PAD_CTRL (ENET_PAD_CTRL ), +/* RGMII reset */ +MX6_PAD_EIM_D23__GPIO_3_23 |MUX_PAD_CTRL (NO_PAD_CTRL ), +/* Ethernet power supply */ +MX6_PAD_EIM_EB3__GPIO_2_31 |MUX_PAD_CTRL (NO_PAD_CTRL ), +/* pin 32 - 1 - (MODE0) all */ +MX6_PAD_RGMII_RD0__GPIO_6_25 |MUX_PAD_CTRL (NO_PAD_CTRL ), +/* pin 31 - 1 - (MODE1) all */ +MX6_PAD_RGMII_RD1__GPIO_6_27 |MUX_PAD_CTRL (NO_PAD_CTRL ), +/* pin 28 - 1 - (MODE2) all */ +MX6_PAD_RGMII_RD2__GPIO_6_28 |MUX_PAD_CTRL (NO_PAD_CTRL ), +/* pin 27 - 1 - (MODE3) all */ +MX6_PAD_RGMII_RD3__GPIO_6_29 |MUX_PAD_CTRL (NO_PAD_CTRL ), +/* pin 33 - 1 - (CLK125_EN) 125Mhz clockout enabled */ +MX6_PAD_RGMII_RX_CTL__GPIO_6_24 |MUX_PAD_CTRL (NO_PAD_CTRL ), +}; + +static iomux_v3_cfg_t const enet_pads2[] = { +MX6_PAD_RGMII_RD0__ENET_RGMII_RD0 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_RD1__ENET_RGMII_RD1 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_RD2__ENET_RGMII_RD2 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_RD3__ENET_RGMII_RD3 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL |MUX_PAD_CTRL (ENET_PAD_CTRL ), +}; + +static void setup_iomux_enet (void ) +{ +imx_iomux_v3_setup_multiple_pads (enet_pads1,ARRAY_SIZE (enet_pads1)); +udelay (20 ); +gpio_direction_output (IMX_GPIO_NR (2 ,31 ),1 );/* Power supply on */ + +gpio_direction_output (IMX_GPIO_NR (3 ,23 ),0 );/* assert PHY rst */ + +gpio_direction_output (IMX_GPIO_NR (6 ,24 ),1 ); +gpio_direction_output (IMX_GPIO_NR (6 ,25 ),1 ); +gpio_direction_output (IMX_GPIO_NR (6 ,27 ),1 ); +gpio_direction_output (IMX_GPIO_NR (6 ,28 ),1 ); +gpio_direction_output (IMX_GPIO_NR (6 ,29 ),1 ); +udelay (1000 ); + +gpio_set_value (IMX_GPIO_NR (3 ,23 ),1 );/* deassert PHY rst */ + +/* Need 100ms delay to exit from reset. */ +udelay (1000 *100 ); + +gpio_free (IMX_GPIO_NR (6 ,24 )); +gpio_free (IMX_GPIO_NR (6 ,25 )); +gpio_free (IMX_GPIO_NR (6 ,27 )); +gpio_free (IMX_GPIO_NR (6 ,28 )); +gpio_free (IMX_GPIO_NR (6 ,29 )); + +imx_iomux_v3_setup_multiple_pads (enet_pads2,ARRAY_SIZE (enet_pads2)); +} +static void setup_iomux_uart (void ) {imx_iomux_v3_setup_multiple_pads (uart2_pads,ARRAY_SIZE (uart2_pads));
@@ -77,6 +177,37 @@ int board_mmc_getcd(struct mmc *mmc)return 1 ;/* Always present */ } +int board_eth_init (bd_t *bis) +{ +uint32_t base =IMX_FEC_BASE ; +struct mii_dev *bus =NULL ; +struct phy_device *phydev =NULL ; +int ret; + +setup_iomux_enet (); + +#ifdef CONFIG_FEC_MXC + bus =fec_get_miibus (base,-1 ); +if (!bus) +return 0 ; +/* scan phy 4,5,6,7 */ + phydev =phy_find_by_mask (bus, (0xf <<4 ),PHY_INTERFACE_MODE_RGMII ); + +if (!phydev) { +free (bus); +return 0 ; + } +printf ("using phy@%d\n" , phydev->addr); + ret =fec_probe (bis,-1 , base, bus, phydev); +if (ret) { +printf ("FEC MXC: %s:failed\n" , __func__); +free (phydev); +free (bus); + } +#endif +return 0 ; +} +int board_mmc_init (bd_t *bis) {imx_iomux_v3_setup_multiple_pads (usdhc3_pads,ARRAY_SIZE (usdhc3_pads));
@@ -94,6 +225,15 @@ int board_early_init_f(void)return 0 ; } +int board_phy_config (struct phy_device *phydev) +{ +mx6_rgmii_rework (phydev); +if (phydev->drv->config) + phydev->drv->config (phydev); + +return 0 ; +} +int board_init (void ) {/* address of boot parameters */
include/configs/udoo.h +16 -0
@@ -34,6 +34,22 @@#define CONFIG_MXC_UART #define CONFIG_MXC_UART_BASE UART2_BASE +/* Network support */ + +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_MII +#define CONFIG_CMD_NET +#define CONFIG_FEC_MXC +#define CONFIG_MII +#define IMX_FEC_BASE ENET_BASE_ADDR +#define CONFIG_FEC_XCV_TYPE RGMII +#define CONFIG_ETHPRIME "FEC" +#define CONFIG_FEC_MXC_PHYADDR 6 +#define CONFIG_PHYLIB +#define CONFIG_PHY_MICREL +#define CONFIG_PHY_MICREL_KSZ9031 +/* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE #define CONFIG_CONS_INDEX 1
include/micrel.h +5 -0
@@ -15,6 +15,11 @@#define MII_KSZ9031_MOD_DATA_POST_INC_RW 0x8000#define MII_KSZ9031_MOD_DATA_POST_INC_W 0xC000 +#define MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW 0x4 +#define MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW 0x5 +#define MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW 0x6 +#define MII_KSZ9031_EXT_RGMII_CLOCK_SKEW 0x8 +struct phy_device ;int ksz9021_phy_extended_write (struct phy_device *phydev,int regnum,u16 val);int ksz9021_phy_extended_read (struct phy_device *phydev,int regnum);
Signature · 1 line
1.7.10.4
PATCH v2 1/4 udoo: Add ethernet support (FEC + Micrel KSZ9031).
Hi Giuseppe,
Quoted 8 lines · Giuseppe Pagano
Add Ethernet and networking support on uDoo board (FEC +phy Micrel KSZ9031). Ethernet speed is currently limited to 10/100Mbps.
Signed-off-by Giuseppe Pagano <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Stefano Babic <[email protected]>CC Fabio Estevam <[email protected]>---
IMHO the patch is ok. If there are not any further comments, I mark your patchset for merging.
board/udoo/udoo.c static iomux_v3_cfg_t const wdog_pads[] = { · line 93
Quoted 3 lines
board/udoo/udoo.c +3
-0+ksz9031_phy_extended_write (phydev,0x02 , +MII_KSZ9031_EXT_RGMII_CLOCK_SKEW , +MII_KSZ9031_MOD_DATA_NO_POST_INC ,0x03FF );
I had also some issues with KSZ9031 and i.MX6. Gigabit starts working only after setting the clock skew. I see you set the register again with the default value (0x3FF). Because it is the reset value, it is not required to set it again, but more important : have you make a trying enabling Gb and adjusting only this extended register ? Rather the KSZ9031's manual is not clear and does not say a lot about it,
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 1/4 udoo: Add ethernet support (FEC + Micrel KSZ9031).
Hi Stefano,
Quoted 6 lines · Stefano Babic
Hi Giuseppe,
Quoted 3 lines · Giuseppe Pagano
Add Ethernet and networking support on uDoo board (FEC +phy Micrel KSZ9031). Ethernet speed is currently limited to 10/100Mbps.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Giuseppe Pagano <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Stefano Babic <[email protected]>CC Fabio Estevam <[email protected]>---
IMHO the patch is ok. If there are not any further comments, I mark your patchset for merging.
good!
Quoted 11 lines
board/udoo/udoo.c static iomux_v3_cfg_t const wdog_pads[] = { · line 93
Quoted 4 lines
board/udoo/udoo.c +3
-0+ksz9031_phy_extended_write (phydev,0x02 , +MII_KSZ9031_EXT_RGMII_CLOCK_SKEW , +MII_KSZ9031_MOD_DATA_NO_POST_INC ,0x03FF );I had also some issues with KSZ9031 and i.MX6. Gigabit starts working only after setting the clock skew. I see you set the register again with the default value (
0x3FF). Because it is the reset value, it is not required to set it again, but more important : have you make a trying enabling Gb and adjusting only this extended register ? Rather the KSZ9031's manual is not clear and does not say a lot about it,
I have september 2012 revision of KSZ9031's manual, and I think it is complete enough about skew parameter (preliminary version was not). Default value for GTX_CLK and RX_CLK swek register is 0x001ef (0 ns delay for both). I use maximum positive delay (value 0x03ff) as safe value, but it doesn't work on every board. I also tested halfway value and negative delay, but again this value doesn't works on every board I tested.
Linux kernel, with the same skew configuration for data and clock, works well with Gigabit ! I've marked as to do to understand why Gigabit works under Linux, and not with u-boot.
Quoted 4 lines
Best regards,
Stefano Babic
Best regards
Giuseppe Pagano
PATCH v2 1/4 udoo: Add ethernet support (FEC + Micrel KSZ9031).
Quoted 11 lines · Giuseppe Pagano
Quoted 6 lines
board/udoo/udoo.c static iomux_v3_cfg_t const wdog_pads[] = { · line 93
Quoted 5 lines
board/udoo/udoo.c +3
-0+ksz9031_phy_extended_write (phydev,0x02 , +MII_KSZ9031_EXT_RGMII_CLOCK_SKEW , +MII_KSZ9031_MOD_DATA_NO_POST_INC ,0x03FF );I have september 2012 revision of KSZ9031's manual, and I think it is complete enough about skew parameter (preliminary version was not). Default value for
GTX_CLKandRX_CLKswek register is0x001ef(0 ns delay for both). I use maximum positive delay (value0x03ff) as safe value, but it doesn't work on every board.
To be more clear (for people who do not have KSZ9031 manual). GTX and RX skew delay have 5 bit resolution, so MII_KSZ9031_EXT_RGMII_CLOCK_SKEW register have this default value bit:
reserved GTX skew RX skew
0000_00----01_111-----0_1111 (0x01EF -> 0ns delay) 0000_00----00_000-----0_0000 (0x0000 -> -0.96ns delay both) 0000_00----11_111-----1_1111 (0x03FF -> +0.96ns delay both) 0000_00----11_111-----0_1111 (0x03EF -> +0.96ns delay only for GTX)
etc.
Quoted 3 lines
Best regards
Giuseppe Pagano
Fabio Estevam
reviewerPATCH v2 1/4 udoo: Add ethernet support (FEC + Micrel KSZ9031).
In reply to Stefano BabicHi Stefano
Quoted 6 lines · Stefano Babic
Hi Giuseppe,
Quoted 3 lines · Giuseppe Pagano
Add Ethernet and networking support on uDoo board (FEC +phy Micrel KSZ9031). Ethernet speed is currently limited to 10/100Mbps.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Giuseppe Pagano <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Stefano Babic <[email protected]>CC Fabio Estevam <[email protected]>---
IMHO the patch is ok. If there are not any further comments, I mark your patchset for merging.
Excellent, patch series looks good for me.
Thanks,
Fabio Estevam
Fabio Estevam
reviewerPATCH v2 1/4 udoo: Add ethernet support (FEC + Micrel KSZ9031).
In reply to Stefano BabicHi Stefano,
Quoted 6 lines · Stefano Babic
Hi Giuseppe,
Quoted 3 lines · Giuseppe Pagano
Add Ethernet and networking support on uDoo board (FEC +phy Micrel KSZ9031). Ethernet speed is currently limited to 10/100Mbps.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Giuseppe Pagano <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Stefano Babic <[email protected]>CC Fabio Estevam <[email protected]>---
IMHO the patch is ok. If there are not any further comments, I mark your patchset for merging.
Please apply this series when you have a chance.
I would like to send some other patches to udoo board that depends on this series.
Regards,
Fabio Estevam
PATCH v2 1/4 udoo: Add ethernet support (FEC + Micrel KSZ9031).
In reply to Giuseppe PaganoHi Giuseppe,
Quoted 8 lines · Giuseppe Pagano
Add Ethernet and networking support on uDoo board (FEC +phy Micrel KSZ9031). Ethernet speed is currently limited to 10/100Mbps.
Signed-off-by Giuseppe Pagano <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Stefano Babic <[email protected]>CC Fabio Estevam <[email protected]>---
I slightly change the patch to fix names of pins according to last patches to consolidate names between i.MX6 flavour.
Applied to u-boot-imx, thanks.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 1/4 udoo: Add ethernet support (FEC + Micrel KSZ9031).
Hi Stefano,
Quoted 10 lines · Stefano Babic
Hi Giuseppe,
Quoted 4 lines · Giuseppe Pagano
Add Ethernet and networking support on uDoo board (FEC +phy Micrel KSZ9031). Ethernet speed is currently limited to 10/100Mbps.
---
I slightly change the patch to fix names of pins according to last patches to consolidate names between i.MX6 flavour.
It's ok.
Quoted 1 line
Applied to u-boot-imx, thanks.
Thanks.
Quoted 2 lines
Best regards,
Stefano Babic
best regards
Giuseppe
PATCH v2 2/4 nitrogen6x: Move setup_sata to common part
In reply to Giuseppe PaganoMove setup_sata function definition from platform file nitrogen6x.c to arch/arm/imx-common/sata.c to avoid code duplication.
---
Changes in v2:
- Split previous patch between nitrogen6x udoo code changes.
arch/arm/imx-common/Makefile | 1 + arch/arm/imx-common/sata.c | 33 ++++++++++++++++++++++++++++++++ arch/arm/include/asm/imx-common/sata.h | 17 ++++++++++++++++ board/boundary/nitrogen6x/nitrogen6x.c | 27 +------------------------- 4 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 arch/arm/imx-common/sata.c create mode 100644 arch/arm/include/asm/imx-common/sata.h
arch/arm/imx-common/Makefile +1 -0
@@ -17,6 +17,7 @@ endif ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) COBJS-y += timer.o cpu.o speed.o COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o +COBJS-$(CONFIG_CMD_SATA) += sata.o endif ifeq ($(SOC),$(filter $(SOC),mx6 mxs)) COBJS-y += misc.o
arch/arm/imx-common/sata.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Copyright 2011 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <asm/imx-common/iomux-v3.h> +#include <asm/arch/iomux.h> +#include <asm/io.h> + +int setup_sata (void ) +{ +struct iomuxc_base_regs *const iomuxc_regs + = (struct iomuxc_base_regs *)IOMUXC_BASE_ADDR ; + +int ret =enable_sata_clock (); +if (ret) +return ret; + +clrsetbits_le32 (&iomuxc_regs->gpr[13 ], +IOMUXC_GPR13_SATA_MASK , +IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB + |IOMUXC_GPR13_SATA_PHY_7_SATA2M + |IOMUXC_GPR13_SATA_SPEED_3G + |(3 <<IOMUXC_GPR13_SATA_PHY_6_SHIFT ) + |IOMUXC_GPR13_SATA_SATA_PHY_5_SS_DISABLED + |IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16 + |IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB + |IOMUXC_GPR13_SATA_PHY_2_TX_1P104V + |IOMUXC_GPR13_SATA_PHY_1_SLOW ); + +return 0 ; +}
arch/arm/include/asm/imx-common/sata.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Copyright 2011 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __IMX_SATA_H_ +#define __IMX_SATA_H_ + +/* +* SATA setup for i.mx6 quad based platform +*/ + +int setup_sata (void ); + +#endif +
board/boundary/nitrogen6x/nitrogen6x.c +1 -26
@@ -17,6 +17,7 @@#include <asm/gpio.h> #include <asm/imx-common/iomux-v3.h> #include <asm/imx-common/mxc_i2c.h> +#include <asm/imx-common/sata.h> #include <asm/imx-common/boot_mode.h> #include <mmc.h> #include <fsl_esdhc.h>
@@ -378,32 +379,6 @@ static void setup_buttons(void) ARRAY_SIZE(button_pads)); } -#ifdef CONFIG_CMD_SATA - -int setup_sata (void ) -{ -struct iomuxc_base_regs *const iomuxc_regs - = (struct iomuxc_base_regs *)IOMUXC_BASE_ADDR ; -int ret =enable_sata_clock (); -if (ret) -return ret; - -clrsetbits_le32 (&iomuxc_regs->gpr[13 ], -IOMUXC_GPR13_SATA_MASK , -IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB - |IOMUXC_GPR13_SATA_PHY_7_SATA2M - |IOMUXC_GPR13_SATA_SPEED_3G - |(3 <<IOMUXC_GPR13_SATA_PHY_6_SHIFT ) - |IOMUXC_GPR13_SATA_SATA_PHY_5_SS_DISABLED - |IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16 - |IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB - |IOMUXC_GPR13_SATA_PHY_2_TX_1P104V - |IOMUXC_GPR13_SATA_PHY_1_SLOW ); - -return 0 ; -} -#endif -#if defined(CONFIG_VIDEO_IPUV3 ) static iomux_v3_cfg_t const backlight_pads[] = {
Signature · 1 line
1.7.10.4
PATCH v2 2/4 nitrogen6x: Move setup_sata to common part
Hi Giuseppe,
Quoted 25 lines · Giuseppe Pagano
Move
setup_satafunction definition from platform filenitrogen6x.ctoarch/arm/imx-common/sata.cto avoid code duplication.Signed-off-by Giuseppe Pagano <[email protected]>CC Stefano Babic <[email protected]>CC Fabio Estevam <[email protected]>CC Eric Nelson <[email protected]>---
Changes in v2:
- Split previous patch between nitrogen6x udoo code changes.arch/arm/imx-common/Makefile | 1 + arch/arm/imx-common/sata.c | 33 ++++++++++++++++++++++++++++++++ arch/arm/include/asm/imx-common/sata.h | 17 ++++++++++++++++ board/boundary/nitrogen6x/nitrogen6x.c | 27 +------------------------- 4 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 arch/arm/imx-common/sata.c create mode 100644 arch/arm/include/asm/imx-common/sata.harch/arm/imx-common/Makefile +0
-0
arch/arm/imx-common/Makefile endif · line 20
Quoted 4 lines
arch/arm/imx-common/Makefile +1
-0@@ -17,6 +17,7 @@ endif ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) COBJS-y += timer.o cpu.o speed.o COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o +COBJS-$(CONFIG_CMD_SATA) += sata.o
By testing this breaks mx5 boards:
Boards with errors: 3 ( m53evk ima3-mx53 mx53loco )
The reason is that mx5 does not have and does not need a setup_sata, and the code in sata.c (all registers definitions) are mx6 specific.
I suggest the file is compiled only for iMX6 (now it is for both mx5 and mx6) as result of filter.
Can you send a V3 of the two sata patches ? You do not need to resend the whole patchset.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 3/4 udoo: Add SATA support on uDoo Board.
In reply to Giuseppe PaganoAdd SATA support on uDoo Board.
---
Changes in v2:
- Split previous patch between nitrogen6x udoo code changes.
board/udoo/udoo.c | 4 ++++ include/configs/udoo.h | 12 ++++++++++++ 2 files changed, 16 insertions(+)
board/udoo/udoo.c +4 -0
@@ -14,6 +14,7 @@#include <asm/errno.h> #include <asm/gpio.h> #include <asm/imx-common/iomux-v3.h> +#include <asm/imx-common/sata.h> #include <mmc.h> #include <fsl_esdhc.h> #include <asm/arch/crm_regs.h>
@@ -239,6 +240,9 @@ int board_init(void)/* address of boot parameters */ gd->bd->bi_boot_params =PHYS_SDRAM +0x100 ; +#ifdef CONFIG_CMD_SATA +setup_sata (); +#endif return 0 ; }
include/configs/udoo.h +12 -0
@@ -34,6 +34,18 @@#define CONFIG_MXC_UART #define CONFIG_MXC_UART_BASE UART2_BASE +/* SATA Configs */ + +#define CONFIG_CMD_SATA +#ifdef CONFIG_CMD_SATA +#define CONFIG_DWC_AHSATA +#define CONFIG_SYS_SATA_MAX_DEVICE 1 +#define CONFIG_DWC_AHSATA_PORT_ID 0 +#define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR +#define CONFIG_LBA48 +#define CONFIG_LIBATA +#endif +/* Network support */ #define CONFIG_CMD_PING
Signature · 1 line
1.7.10.4
PATCH v2 4/4 udoo: Fix watchdog during kernel boot.
In reply to Giuseppe PaganouDoo uses APX823-31W5 watchdog chip. Timeout is about 1.2 seconds. To disabled watchdog during kernel boot, WDI pin of that chip needs to be in "high impedance" state. I.mx6 gpio configuration does not contemplate tristate, so pin is set as input in high impedance.
---
Changes in v2:
- None
board/udoo/udoo.c | 1 + 1 file changed, 1 insertion(+)
board/udoo/udoo.c +1 -0
@@ -169,6 +169,7 @@ static void setup_iomux_wdog(void)imx_iomux_v3_setup_multiple_pads (wdog_pads,ARRAY_SIZE (wdog_pads));gpio_direction_output (WDT_TRG ,0 );gpio_direction_output (WDT_EN ,1 ); +gpio_direction_input (WDT_TRG ); }static struct fsl_esdhc_cfg usdhc_cfg = {USDHC3_BASE_ADDR };
Signature · 1 line
1.7.10.4
PATCH v2 4/4 udoo: Fix watchdog during kernel boot.
Quoted 11 lines · Giuseppe Pagano
uDoo uses APX823-31W5 watchdog chip. Timeout is about 1.2 seconds. To disabled watchdog during kernel boot, WDI pin of that chip needs to be in "high impedance" state. I.mx6 gpio configuration does not contemplate tristate, so pin is set as input in high impedance.
Signed-off-by Giuseppe Pagano <[email protected]>Reviewed-by Fabio Estevam <[email protected]>CC Stefano Babic <[email protected]>CC Fabio Estevam <[email protected]>---
Applied to u-boot-imx, thanks.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
v2 cover udoo: Move and optimize platform register setting.
In reply to Giuseppe PaganoQuoted 6 lines · Giuseppe Pagano
Previous uDoo configuration adopts register settings for DDR3, clock, muxing, etc. taken from Nitrogen6x. uDoo schematics is rather different from that board, and it needs customized setting for most of the registers.
All this changes can be considered atomical since it is part of initial support of the board.
Quoted 8 lines
Patch changes uDoo configuration files path to a specific one, and adopt optimized value for every configured register.
Signed-off-by Giuseppe Pagano <[email protected]>Tested-by Fabio Estevam <[email protected]>CC Stefano Babic <[email protected]>CC Fabio Estevam <[email protected]>---
Applied to u-boot-imx, thanks.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================