[U-Boot] [PATCH v1 2/2] sun8i: enable support for the Micrel KSZ9031 with SUN8I_EMAC

Philipp Tomsich philipp.tomsich at theobroma-systems.com
Fri Feb 17 17:47:55 UTC 2017


Enable support for the MICREL KSZ9031 GbE PHY in sunxi-common.h	when
using the SUN8I_EMAC driver (e.g. on the A64).

X-AffectedPlatforms: A64-uQ7
Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
---
 include/configs/sunxi-common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index e20ea6a..374ae09 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -285,327 +285,329 @@ extern int soft_i2c_gpio_sda;
 extern int soft_i2c_gpio_scl;
 #endif
 #define CONFIG_VIDEO_LCD_I2C_BUS	0 /* The lcd panel soft i2c is bus 0 */
 #define CONFIG_SYS_SPD_BUS_NUM		1 /* And the axp209 i2c bus is bus 1 */
 #else
 #define CONFIG_SYS_SPD_BUS_NUM		0 /* The axp209 i2c bus is bus 0 */
 #define CONFIG_VIDEO_LCD_I2C_BUS	-1 /* NA, but necessary to compile */
 #endif
 
 /* PMU */
 #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || \
     defined CONFIG_AXP221_POWER || defined CONFIG_AXP818_POWER || \
     defined CONFIG_SY8106A_POWER
 #endif
 
 #ifndef CONFIG_CONS_INDEX
 #define CONFIG_CONS_INDEX              1       /* UART0 */
 #endif
 
 #ifdef CONFIG_REQUIRE_SERIAL_CONSOLE
 #if CONFIG_CONS_INDEX == 1
 #ifdef CONFIG_MACH_SUN9I
 #define OF_STDOUT_PATH		"/soc/serial at 07000000:115200"
 #else
 #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28000:115200"
 #endif
 #elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I)
 #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28400:115200"
 #elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN6I)
 #define OF_STDOUT_PATH          "/soc at 01c00000/serial at 01c28800:115200"
 #elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN8I)
 #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01c28800:115200"
 #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
 #define OF_STDOUT_PATH		"/soc at 01c00000/serial at 01f02800:115200"
 #else
 #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h.
 #endif
 #endif /* ifdef CONFIG_REQUIRE_SERIAL_CONSOLE */
 
 /* GPIO */
 #define CONFIG_SUNXI_GPIO
 
 #ifdef CONFIG_VIDEO
 /*
  * The amount of RAM to keep free at the top of RAM when relocating u-boot,
  * to use as framebuffer. This must be a multiple of 4096.
  */
 #define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20)
 
 /* Do we want to initialize a simple FB? */
 #define CONFIG_VIDEO_DT_SIMPLEFB
 
 /* Fallback to old sunxi_video if the driver model video driver is disabled */
 #ifndef CONFIG_VIDEO_SUNXI_DM
 #define CONFIG_VIDEO_SUNXI
 #endif
 
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_VIDEO_BMP_LOGO
 
 #define CONFIG_CMD_BMP
 #define CONFIG_SPLASH_SCREEN_ALIGN
 
 #define CONFIG_VIDEO_STD_TIMINGS
 #define CONFIG_I2C_EDID
 #define VIDEO_LINE_LEN (pGD->plnSizeX)
 
 /* allow both serial and cfb console. */
 /* stop x86 thinking in cfbconsole from trying to init a pc keyboard */
 
 #endif /* CONFIG_VIDEO */
 
 /* Ethernet support */
 #ifdef CONFIG_SUNXI_EMAC
 #define CONFIG_PHY_ADDR		1
 #define CONFIG_MII			/* MII PHY management		*/
 #define CONFIG_PHYLIB
 #endif
 
 #ifdef CONFIG_SUNXI_GMAC
 #define CONFIG_PHY_GIGE			/* GMAC can use gigabit PHY	*/
 /* Cherry-pick from A80: #define CONFIG_PHY_ADDR		1 */
 #define CONFIG_MII			/* MII PHY management		*/
 #define CONFIG_PHY_REALTEK
 #define CONFIG_PHY_MICREL
 #define CONFIG_PHY_MICREL_KSZ9031
 #endif
 
 #ifdef CONFIG_SUN8I_EMAC
 #define CONFIG_PHY_GIGE			/* GMAC can use gigabit PHY	*/
+#define CONFIG_PHY_MICREL
+#define CONFIG_PHY_MICREL_KSZ9031       /* used on A64-uQ7              */
 #endif
 
 #ifdef CONFIG_USB_EHCI_HCD
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_USB_OHCI_SUNXI
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 1
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 1
 #endif
 
 #ifdef CONFIG_USB_MUSB_SUNXI
 #define CONFIG_USB_MUSB_PIO_ONLY
 #endif
 
 #ifdef CONFIG_USB_MUSB_GADGET
 #define CONFIG_USB_FUNCTION_MASS_STORAGE
 #endif
 
 #ifdef CONFIG_USB_FUNCTION_FASTBOOT
 #define CONFIG_FASTBOOT_BUF_SIZE	0x8000000
 #define CONFIG_SYS_BOOTM_LEN            0x1000000
 
 #define CONFIG_SUNXI_FASTBOOT_GPIO      "PM7"
 
 #ifdef CONFIG_SUNXI_FASTBOOT_GPIO
 #  define CONFIG_BOARD_LATE_INIT
 #endif
 
 #ifdef CONFIG_MMC
 #define CONFIG_FASTBOOT_FLASH_MMC_DEV	 1
 #define CONFIG_EFI_PARTITION_ENTRIES_OFF 1024000
 #define CONFIG_RANDOM_UUID
 #endif
 #endif
 
 #ifdef CONFIG_USB_FUNCTION_MASS_STORAGE
 #endif
 
 #ifdef CONFIG_USB_KEYBOARD
 #define CONFIG_PREBOOT
 #define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
 #endif
 
 #if !defined CONFIG_ENV_IS_IN_MMC && \
     !defined CONFIG_ENV_IS_IN_NAND && \
     !defined CONFIG_ENV_IS_IN_FAT && \
     !defined CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_IS_NOWHERE
 #endif
 
 #define CONFIG_MISC_INIT_R
 
 #ifndef CONFIG_SPL_BUILD
 #include <config_distro_defaults.h>
 
 #ifdef CONFIG_ARM64
 /*
  * Boards seem to come with at least 512MB of DRAM.
  * The kernel should go at 512K, which is the default text offset (that will
  * be adjusted at runtime if needed).
  * There is no compression for arm64 kernels (yet), so leave some space
  * for really big kernels, say 256MB for now.
  * Scripts, PXE and DTBs should go afterwards, leaving the rest for the initrd.
  * Align the initrd to a 2MB page.
  */
 #define KERNEL_ADDR_R	__stringify(SDRAM_OFFSET(0080000))
 #define FDT_ADDR_R	__stringify(SDRAM_OFFSET(FA00000))
 #define SCRIPT_ADDR_R	__stringify(SDRAM_OFFSET(FC00000))
 #define PXEFILE_ADDR_R	__stringify(SDRAM_OFFSET(FD00000))
 #define RAMDISK_ADDR_R	__stringify(SDRAM_OFFSET(FE00000))
 
 #else
 /*
  * 160M RAM (256M minimum minus 64MB heap + 32MB for u-boot, stack, fb, etc.
  * 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
  * 1M script, 1M pxe and the ramdisk at the end.
  */
 
 #define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(2000000))
 #define FDT_ADDR_R     __stringify(SDRAM_OFFSET(3000000))
 #define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(3100000))
 #define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(3200000))
 #define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(3300000))
 #endif
 
 #define MEM_LAYOUT_ENV_SETTINGS \
 	"bootm_size=0xa000000\0" \
 	"kernel_addr_r=" KERNEL_ADDR_R "\0" \
 	"fdt_addr_r=" FDT_ADDR_R "\0" \
 	"scriptaddr=" SCRIPT_ADDR_R "\0" \
 	"pxefile_addr_r=" PXEFILE_ADDR_R "\0" \
 	"ramdisk_addr_r=" RAMDISK_ADDR_R "\0"
 
 #define DFU_ALT_INFO_RAM \
 	"dfu_alt_info_ram=" \
 	"kernel ram " KERNEL_ADDR_R " 0x1000000;" \
 	"fdt ram " FDT_ADDR_R " 0x100000;" \
 	"ramdisk ram " RAMDISK_ADDR_R " 0x4000000\0"
 
 #ifdef CONFIG_MMC
 #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
 #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
 #define BOOT_TARGET_DEVICES_MMC_EXTRA(func) func(MMC, mmc, 1)
 #else
 #define BOOT_TARGET_DEVICES_MMC_EXTRA(func)
 #endif
 #else
 #define BOOT_TARGET_DEVICES_MMC(func)
 #define BOOT_TARGET_DEVICES_MMC_EXTRA(func)
 #endif
 
 #ifdef CONFIG_AHCI
 #define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
 #else
 #define BOOT_TARGET_DEVICES_SCSI(func)
 #endif
 
 #ifdef CONFIG_USB_STORAGE
 #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
 #else
 #define BOOT_TARGET_DEVICES_USB(func)
 #endif
 
 #ifdef CONFIG_USB_FUNCTION_FASTBOOT
 #define BOOT_TARGET_DEVICES_FASTBOOT(func) func(FASTBOOT, fastboot, 0)
 #else
 #define BOOT_TARGET_DEVICES_FASTBOOT(func)
 #endif
 
 /* FEL boot support, auto-execute boot.scr if a script address was provided */
 #define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \
 	"bootcmd_fel=" \
 		"if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then " \
 			"echo '(FEL boot)'; " \
 			"source ${fel_scriptaddr}; " \
 		"fi\0"
 #define BOOTENV_DEV_NAME_FEL(devtypeu, devtypel, instance) \
 	"fel "
 
 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
         "bootcmd_fastboot=" \
 	       "fastboot musb\0"
 
 #define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
         "fastboot "
 
 #define BOOT_TARGET_DEVICES(func) \
 	func(FEL, fel, na) \
 	BOOT_TARGET_DEVICES_MMC_EXTRA(func) \
 	BOOT_TARGET_DEVICES_MMC(func) \
 	BOOT_TARGET_DEVICES_SCSI(func) \
 	BOOT_TARGET_DEVICES_USB(func) \
 	BOOT_TARGET_DEVICES_FASTBOOT(func) \
 	func(PXE, pxe, na) \
 	func(DHCP, dhcp, na)
 
 #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
 #define BOOTCMD_SUNXI_COMPAT \
 	"bootcmd_sunxi_compat=" \
 		"setenv root /dev/mmcblk0p3 rootwait; " \
 		"if ext2load mmc 0 0x44000000 uEnv.txt; then " \
 			"echo Loaded environment from uEnv.txt; " \
 			"env import -t 0x44000000 ${filesize}; " \
 		"fi; " \
 		"setenv bootargs console=${console} root=${root} ${extraargs}; " \
 		"ext2load mmc 0 0x43000000 script.bin && " \
 		"ext2load mmc 0 0x48000000 uImage && " \
 		"bootm 0x48000000\0"
 #else
 #define BOOTCMD_SUNXI_COMPAT
 #endif
 
 #include <config_distro_bootcmd.h>
 
 #ifdef CONFIG_USB_KEYBOARD
 #define CONSOLE_STDIN_SETTINGS \
 	"preboot=usb start\0" \
 	"stdin=serial,usbkbd\0"
 #else
 #define CONSOLE_STDIN_SETTINGS \
 	"stdin=serial\0"
 #endif
 
 #ifdef CONFIG_VIDEO
 #define CONSOLE_STDOUT_SETTINGS \
 	"stdout=serial,vga\0" \
 	"stderr=serial,vga\0"
 #else
 #define CONSOLE_STDOUT_SETTINGS \
 	"stdout=serial\0" \
 	"stderr=serial\0"
 #endif
 
 #define CONSOLE_ENV_SETTINGS \
 	CONSOLE_STDIN_SETTINGS \
 	CONSOLE_STDOUT_SETTINGS
 
 /* The space below the paritions-entries is reserved by the EFI
  * partition table (i.e. 'first_usable_lba' points to the first
  * LBA beyond the table.  We thus don't need to have any 'magic'
  * partitions for the bootloader or any other reserved areas.
  */
 #define CONFIG_EFI_PARTITION_ENTRIES_OFF 1024000
 #define PARTS_DEFAULT \
   "uuid_disk=${uuid_gpt_disk};" \
   "name=resource,size=16M;" \
   "name=boot,size=16M;" \
   "name=system,size=500M,uuid=69dad710-2ce4-4e3c-b16c-21a1d49abed3;" \
   "name=cache,size=256M;" \
   "name=databk,size=128M;" \
   "name=data,size=-,uuid=933ac7e1-2eb4-4f13-b844-0e14e2aef915;"
 
 #if (CONFIG_CONS_INDEX == 1)
 #define CONSOLE_DEFAULT "console=ttyS0,115200\0"
 #elif (CONFIG_CONS_INDEX == 3)
 #define CONSOLE_DEFAULT "console=ttyS2,115200\0"
 #else
 #error "CONFIG_CONS_INDEX to CONFIG_DEFAULT_CONSOLE_ENV missing."
 #endif
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	CONSOLE_ENV_SETTINGS \
 	MEM_LAYOUT_ENV_SETTINGS \
 	DFU_ALT_INFO_RAM \
 	"partitions=" PARTS_DEFAULT "\0" \
 	"partitions_linux=" \
         "uuid_disk=${uuid_gpt_disk};" \
 	"name=rootfs,size=-,uuid=69dad710-2ce4-4e3c-b16c-21a1d49abed3\0" \
 	"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
 	CONSOLE_DEFAULT \
 	BOOTCMD_SUNXI_COMPAT \
 	BOOTENV
 
 #else /* ifndef CONFIG_SPL_BUILD */
 #define CONFIG_EXTRA_ENV_SETTINGS
 #endif
 
 #endif /* _SUNXI_COMMON_CONFIG_H */
-- 
1.9.1



More information about the U-Boot mailing list