From c722553e8a4566177f9203b0ffef6d79a668471a Mon Sep 17 00:00:00 2001 From: Klaus Goger Date: Fri, 10 Jul 2015 08:28:42 +0200 Subject: sun6i: pangolin: hack to configure phy skew should be done via devicetree but this require to enhance the micrel driver quite a bit so let's do this hack instead which breaks every other sun6i device other then pangolin Signed-off-by: Klaus Goger --- arch/arm/dts/sun6i-a31-pangolin.dts | 4 ++-- board/sunxi/board.c | 21 +++++++++++++++++++++ configs/Pangolin_defconfig | 5 +++-- include/configs/sunxi-common.h | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/arch/arm/dts/sun6i-a31-pangolin.dts b/arch/arm/dts/sun6i-a31-pangolin.dts index 1d649b78dc..21d497e67d 100644 --- a/arch/arm/dts/sun6i-a31-pangolin.dts +++ b/arch/arm/dts/sun6i-a31-pangolin.dts @@ -96,8 +96,8 @@ snps,reset-delays-us = <0 10000 30000>; status = "okay"; - phy1: ethernet-phy@1 { - reg = <1>; + phy1: ethernet-phy@4 { + reg = <4>; }; }; diff --git a/board/sunxi/board.c b/board/sunxi/board.c index ed60e74808..4c050174fa 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -33,6 +33,7 @@ #include #include #include +#include #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */ @@ -93,12 +94,20 @@ int board_init(void) asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"(24000000)); } + gpio_request(SUNXI_GPA(7), "PHY Reset"); + sunxi_gpio_set_cfgpin(SUNXI_GPA(7), SUNXI_GPIO_OUTPUT); + + gpio_direction_output(SUNXI_GPA(7), 0); + mdelay(10); + gpio_direction_output(SUNXI_GPA(7), 1); + ret = axp_gpio_init(); if (ret) return ret; /* Uses dm gpio code so do this here and not in i2c_init_board() */ return soft_i2c_board_init(); + } int dram_init(void) @@ -500,6 +509,18 @@ void get_board_serial(struct tag_serialnr *serialnr) } #endif +int last_stage_init(void) +{ + static const char miiname[] = "ethernet@01c30000"; + /* enables TXC and RXC skew on the Micrel PHY */ + miiphy_write(miiname,0x4,0xd,0x2); + miiphy_write(miiname,0x4,0xe,0x8); + miiphy_write(miiname,0x4,0xd,0x4002); + miiphy_write(miiname,0x4,0xe,0x3de); + return 0; +} + + #ifdef CONFIG_MISC_INIT_R int misc_init_r(void) { diff --git a/configs/Pangolin_defconfig b/configs/Pangolin_defconfig index 8fac4a40a0..a455faf77b 100644 --- a/configs/Pangolin_defconfig +++ b/configs/Pangolin_defconfig @@ -1,5 +1,5 @@ CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI" +CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC,RGMII" CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-pangolin" CONFIG_VIDEO_VGA_VIA_LCD=y CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN="PH25" @@ -22,7 +22,6 @@ CONFIG_CONS_INDEX=3 # Vbus gpio for usb1 CONFIG_USB1_VBUS_PIN="" # No Vbus gpio for usb2 -CONFIG_NET=y CONFIG_USB2_VBUS_PIN="" CONFIG_USB=y CONFIG_DM_USB=y @@ -31,3 +30,5 @@ CONFIG_USB_KEYBOARD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_SMSC95XX=y # CONFIG_CMD_IMLS is not set +CONFIG_DM_ETH=y +CONFIG_ETH_DESIGNWARE=y diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index bda4059fe5..e7a32b2f68 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -352,6 +352,7 @@ extern int soft_i2c_gpio_scl; #endif #define CONFIG_MISC_INIT_R +#define CONFIG_LAST_STAGE_INIT #define CONFIG_SYS_CONSOLE_IS_IN_ENV #ifndef CONFIG_SPL_BUILD -- cgit v1.2.3