From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Mon, 15 Jun 2015 17:21:33 +0200 Subject: [U-Boot] [PATCH] arm: mx6: tqma6: Add WRU-IV baseboard for the TQMa6 SoM In-Reply-To: <557ED332.10609@tqsc.de> References: <1434368891-19423-1-git-send-email-sr@denx.de> <557ED332.10609@tqsc.de> Message-ID: <557EED7D.5030504@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Markus, On 15.06.2015 15:29, Markus Niebel wrote: >> +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; >> + >> + bus = fec_get_miibus(base, -1); >> + if (!bus) { >> + puts("MII bus not found\n"); >> + return 0; >> + } >> + >> + /* scan phy */ >> + phydev = phy_find_by_mask(bus, (0xf << CONFIG_FEC_MXC_PHYADDR), >> + PHY_INTERFACE_MODE_RMII); >> + if (!phydev) { >> + free(bus); >> + puts("No phy found\n"); >> + return 0; >> + } >> + >> + ret = fec_probe(bis, -1, base, bus, phydev); >> + if (ret) { >> + puts("FEC MXC: probe failed\n"); >> + free(phydev); >> + free(bus); >> + } >> + >> + return 0; >> +} > This was implemented in the original starter kit code to implement > the phy specific setup in board_phy_config. Your phy should not need > this. Right, thanks. I'll change this in v2. >> + >> +/* GPIO */ >> +#define GPIO_PAD_CTRL ( \ >> + PAD_CTL_HYS | \ >> + PAD_CTL_PUS_100K_UP | \ >> + PAD_CTL_PUE | \ >> + PAD_CTL_SPEED_MED | \ >> + PAD_CTL_DSE_40ohm | \ >> + PAD_CTL_SRE_SLOW \ >> + ) >> + >> +#define GPIO_OD_PAD_CTRL ( \ >> + PAD_CTL_HYS | \ >> + PAD_CTL_PUS_100K_UP | \ >> + PAD_CTL_PUE | \ >> + PAD_CTL_ODE | \ >> + PAD_CTL_SPEED_MED | \ >> + PAD_CTL_DSE_40ohm | \ >> + PAD_CTL_SRE_SLOW \ >> + ) >> + >> +static iomux_v3_cfg_t const gpio_pads[] = { >> + /* USB_H_PWR */ >> + NEW_PAD_CTRL(MX6_PAD_GPIO_0__GPIO1_IO00, GPIO_PAD_CTRL), >> + /* USB_OTG_PWR */ >> + NEW_PAD_CTRL(MX6_PAD_EIM_D22__GPIO3_IO22, GPIO_PAD_CTRL), >> + /* ENET1_RST */ >> + NEW_PAD_CTRL(MX6_PAD_GPIO_8__GPIO1_IO08, GPIO_PAD_CTRL), > > This GPIO is already initialized in setup_iomuxc_enet. Thanks for spotting. Will fix. >> + /* PCIE_RST */ >> + NEW_PAD_CTRL(MX6_PAD_NANDF_CLE__GPIO6_IO07, GPIO_OD_PAD_CTRL), >> + /* UART1_PWRON */ >> + NEW_PAD_CTRL(MX6_PAD_DISP0_DAT14__GPIO5_IO08, GPIO_PAD_CTRL), >> + /* UART2_PWRON */ >> + NEW_PAD_CTRL(MX6_PAD_DISP0_DAT16__GPIO5_IO10, GPIO_PAD_CTRL), >> + /* UART3_PWRON */ >> + NEW_PAD_CTRL(MX6_PAD_DISP0_DAT18__GPIO5_IO12, GPIO_PAD_CTRL), >> +}; >> + >> +#define GPIO_USB_H_PWR IMX_GPIO_NR(1, 0) >> +#define GPIO_USB_OTG_PWR IMX_GPIO_NR(3, 22) >> +#define GPIO_ENET1_RST IMX_GPIO_NR(1, 8) >> +#define GPIO_PCIE_RST IMX_GPIO_NR(6, 7) >> +#define GPIO_UART1_PWRON IMX_GPIO_NR(5, 8) >> +#define GPIO_UART2_PWRON IMX_GPIO_NR(5, 10) >> +#define GPIO_UART3_PWRON IMX_GPIO_NR(5, 12) >> + >> +static void gpio_init(void) >> +{ >> + imx_iomux_v3_setup_multiple_pads(gpio_pads, ARRAY_SIZE(gpio_pads)); >> + >> + gpio_direction_output(GPIO_USB_H_PWR, 1); >> + gpio_direction_output(GPIO_USB_OTG_PWR, 1); >> + gpio_direction_output(GPIO_ENET1_RST, 1); >> + gpio_direction_output(GPIO_PCIE_RST, 1); >> + gpio_direction_output(GPIO_UART1_PWRON, 0); >> + gpio_direction_output(GPIO_UART2_PWRON, 0); >> + gpio_direction_output(GPIO_UART3_PWRON, 0); > > Some GPIO (USB) are requested later in USB specific code. I would prefer > requesting all used GPIO - then the transition to DM_GPIO would be prepared > already. Yes. I've missed this. I'll add the missing gpio_request() calls in v2. >> +} >> + >> +void tqma6_iomuxc_spi(void) >> +{ >> + /* No SPI on this baseboard */ >> +} >> + >> +int tqma6_bb_board_early_init_f(void) >> +{ >> + setup_iomuxc_uart4(); >> + >> + return 0; >> +} >> + >> +int tqma6_bb_board_init(void) >> +{ >> + setup_iomuxc_enet(); >> + >> + gpio_init(); >> + >> + /* Turn the UART-couplers on one-after-another */ >> + gpio_set_value(GPIO_UART1_PWRON, 1); >> + mdelay(10); >> + gpio_set_value(GPIO_UART2_PWRON, 1); >> + mdelay(10); >> + gpio_set_value(GPIO_UART3_PWRON, 1); >> + >> + return 0; >> +} >> + >> +int tqma6_bb_board_late_init(void) >> +{ >> + return 0; >> +} >> + >> +const char *tqma6_bb_get_boardname(void) >> +{ >> + return "WRU-IV"; >> +} >> + >> +static const struct boot_mode board_boot_modes[] = { >> + /* 4 bit bus width */ >> + {"sd2", MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)}, >> + /* 8 bit bus width */ >> + {"emmc", MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)}, >> + { NULL, 0 }, >> +}; >> + >> +int misc_init_r(void) >> +{ >> + add_board_boot_modes(board_boot_modes); >> + >> + return 0; >> +} >> + >> +#define WRU4_USB_H1_PWR IMX_GPIO_NR(1, 0) >> +#define WRU4_USB_OTG_PWR IMX_GPIO_NR(3, 22) >> + >> +int board_ehci_hcd_init(int port) >> +{ >> + int ret; >> + >> + ret = gpio_request(WRU4_USB_H1_PWR, "usb-h1-pwr"); >> + if (!ret) >> + gpio_direction_output(WRU4_USB_H1_PWR, 1); >> + >> + ret = gpio_request(WRU4_USB_OTG_PWR, "usb-OTG-pwr"); >> + if (!ret) >> + gpio_direction_output(WRU4_USB_OTG_PWR, 1); >> + >> + return 0; >> +} >> + >> +int board_ehci_power(int port, int on) >> +{ >> + if (port) >> + gpio_set_value(WRU4_USB_OTG_PWR, on); >> + else >> + gpio_set_value(WRU4_USB_H1_PWR, on); >> + >> + return 0; >> +} >> + >> +/* >> + * Device Tree Support >> + */ >> +#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) >> +void tqma6_bb_ft_board_setup(void *blob, bd_t *bd) >> +{ >> + /* TBD */ >> +} >> +#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ >> diff --git a/configs/tqma6s_wru4_mmc_defconfig b/configs/tqma6s_wru4_mmc_defconfig >> new file mode 100644 >> index 0000000..74bca0b >> --- /dev/null >> +++ b/configs/tqma6s_wru4_mmc_defconfig >> @@ -0,0 +1,10 @@ >> +CONFIG_ARM=y >> +CONFIG_TARGET_TQMA6=y >> +CONFIG_CMD_SETEXPR=y >> +CONFIG_CMD_NET=y >> +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/tqc/tqma6/tqma6s.cfg,MX6S,WRU4,TQMA6X_MMC_BOOT" >> +CONFIG_AUTOBOOT_KEYED=y >> +CONFIG_AUTOBOOT_PROMPT="Enter password in %d seconds to stop autoboot\n" >> +CONFIG_AUTOBOOT_ENCRYPTION=y >> +CONFIG_AUTOBOOT_STOP_STR_SHA256="36a9e7f1c95b82ffb99743e0c5c4ce95d83c9a430aac59f84ef3cbfab6145068" >> +CONFIG_PCA9551_LED=y > > Did you notice the patches for TQMa6 related config rework? > (arm: imx6: tqma6: Kconfig rework from 2015/06/04) Yes. But I totally forgot to take them into account for this baseboard support. I'll take another look into this patchset tomorrow. Thanks for the review, Stefan