Message ID | 20170513135753.8478-17-marek.vasut+renesas@gmail.com |
---|---|
State | Accepted |
Commit | 90e53f8b455e762c04cb154a381c8f1513af847f |
Delegated to: | Nobuhiro Iwamatsu |
Headers | show |
Applied to rmobile branch, thanks! 2017-05-13 22:57 GMT+09:00 Marek Vasut <marek.vasut@gmail.com>: > Add support for the AVB ethernet on the Salvator-X board. > > Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> > Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> > Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> > --- > board/renesas/salvator-x/salvator-x.c | 46 +++++++++++++++++++++++++++++++++++ > configs/salvator-x_defconfig | 7 ++++++ > include/configs/salvator-x.h | 6 +++++ > 3 files changed, 59 insertions(+) > > diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c > index 1ee5cf1051..38ff99a17c 100644 > --- a/board/renesas/salvator-x/salvator-x.c > +++ b/board/renesas/salvator-x/salvator-x.c > @@ -49,6 +49,7 @@ void s_init(void) > #define TMU0_MSTP125 BIT(25) /* secure */ > #define TMU1_MSTP124 BIT(24) /* non-secure */ > #define SCIF2_MSTP310 BIT(10) /* SCIF2 */ > +#define ETHERAVB_MSTP812 BIT(12) > #define SD0_MSTP314 BIT(14) > #define SD1_MSTP313 BIT(13) > #define SD2_MSTP312 BIT(12) /* either MMC0 */ > @@ -65,6 +66,8 @@ int board_early_init_f(void) > mstp_clrbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125 | TMU1_MSTP124); > /* SCIF2 */ > mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SCIF2_MSTP310); > + /* EHTERAVB */ > + mstp_clrbits_le32(MSTPSR8, SMSTPCR8, ETHERAVB_MSTP812); > /* eMMC */ > mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SD1_MSTP313 | SD2_MSTP312); > /* SDHI0, 3 */ > @@ -99,9 +102,52 @@ int board_init(void) > > mstp_clrbits_le32(MSTPSR1, SMSTPCR1, GSX_MSTP112); > > +#ifdef CONFIG_RAVB > + /* EtherAVB Enable */ > + /* GPSR2 */ > + gpio_request(GPIO_GFN_AVB_AVTP_CAPTURE_A, NULL); > + gpio_request(GPIO_GFN_AVB_AVTP_MATCH_A, NULL); > + gpio_request(GPIO_GFN_AVB_LINK, NULL); > + gpio_request(GPIO_GFN_AVB_PHY_INT, NULL); > + gpio_request(GPIO_GFN_AVB_MAGIC, NULL); > + gpio_request(GPIO_GFN_AVB_MDC, NULL); > + > + /* IPSR0 */ > + gpio_request(GPIO_IFN_AVB_MDC, NULL); > + gpio_request(GPIO_IFN_AVB_MAGIC, NULL); > + gpio_request(GPIO_IFN_AVB_PHY_INT, NULL); > + gpio_request(GPIO_IFN_AVB_LINK, NULL); > + gpio_request(GPIO_IFN_AVB_AVTP_MATCH_A, NULL); > + gpio_request(GPIO_IFN_AVB_AVTP_CAPTURE_A, NULL); > + /* IPSR1 */ > + gpio_request(GPIO_FN_AVB_AVTP_PPS, NULL); > + /* IPSR2 */ > + gpio_request(GPIO_FN_AVB_AVTP_MATCH_B, NULL); > + /* IPSR3 */ > + gpio_request(GPIO_FN_AVB_AVTP_CAPTURE_B, NULL); > + > + /* AVB_PHY_RST */ > + gpio_request(GPIO_GP_2_10, NULL); > + gpio_direction_output(GPIO_GP_2_10, 0); > + mdelay(20); > + gpio_set_value(GPIO_GP_2_10, 1); > + udelay(1); > +#endif > + > return 0; > } > > +static struct eth_pdata salvator_x_ravb_platdata = { > + .iobase = 0xE6800000, > + .phy_interface = 0, > + .max_speed = 1000, > +}; > + > +U_BOOT_DEVICE(salvator_x_ravb) = { > + .name = "ravb", > + .platdata = &salvator_x_ravb_platdata, > +}; > + > #ifdef CONFIG_SH_SDHI > int board_mmc_init(bd_t *bis) > { > diff --git a/configs/salvator-x_defconfig b/configs/salvator-x_defconfig > index 1478b6ae3b..3738fe4536 100644 > --- a/configs/salvator-x_defconfig > +++ b/configs/salvator-x_defconfig > @@ -12,7 +12,14 @@ CONFIG_SH_SDHI=y > # CONFIG_CMD_IMLS is not set > CONFIG_CMD_EDITENV=y > CONFIG_CMD_SAVEENV=y > +CONFIG_CMD_NET=y > +CONFIG_CMD_NFS=y > +CONFIG_CMD_MII=y > +CONFIG_CMD_PING=y > +CONFIG_CMD_DHCP=y > CONFIG_DOS_PARTITION=y > CONFIG_MMC=y > CONFIG_GENERIC_MMC=y > CONFIG_OF_LIBFDT=y > +CONFIG_DM_ETH=y > +CONFIG_RENESAS_RAVB=y > diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h > index 91307eb353..b5a98d6db2 100644 > --- a/include/configs/salvator-x.h > +++ b/include/configs/salvator-x.h > @@ -25,6 +25,12 @@ > /* [A] Hyper Flash */ > /* use to RPC(SPI Multi I/O Bus Controller) */ > > +/* Ethernet RAVB */ > +#define CONFIG_NET_MULTI > +#define CONFIG_PHY_MICREL > +#define CONFIG_BITBANGMII > +#define CONFIG_BITBANGMII_MULTI > + > /* Board Clock */ > /* XTAL_CLK : 33.33MHz */ > #define RCAR_XTAL_CLK 33333333u > -- > 2.11.0 >
diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index 1ee5cf1051..38ff99a17c 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -49,6 +49,7 @@ void s_init(void) #define TMU0_MSTP125 BIT(25) /* secure */ #define TMU1_MSTP124 BIT(24) /* non-secure */ #define SCIF2_MSTP310 BIT(10) /* SCIF2 */ +#define ETHERAVB_MSTP812 BIT(12) #define SD0_MSTP314 BIT(14) #define SD1_MSTP313 BIT(13) #define SD2_MSTP312 BIT(12) /* either MMC0 */ @@ -65,6 +66,8 @@ int board_early_init_f(void) mstp_clrbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125 | TMU1_MSTP124); /* SCIF2 */ mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SCIF2_MSTP310); + /* EHTERAVB */ + mstp_clrbits_le32(MSTPSR8, SMSTPCR8, ETHERAVB_MSTP812); /* eMMC */ mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SD1_MSTP313 | SD2_MSTP312); /* SDHI0, 3 */ @@ -99,9 +102,52 @@ int board_init(void) mstp_clrbits_le32(MSTPSR1, SMSTPCR1, GSX_MSTP112); +#ifdef CONFIG_RAVB + /* EtherAVB Enable */ + /* GPSR2 */ + gpio_request(GPIO_GFN_AVB_AVTP_CAPTURE_A, NULL); + gpio_request(GPIO_GFN_AVB_AVTP_MATCH_A, NULL); + gpio_request(GPIO_GFN_AVB_LINK, NULL); + gpio_request(GPIO_GFN_AVB_PHY_INT, NULL); + gpio_request(GPIO_GFN_AVB_MAGIC, NULL); + gpio_request(GPIO_GFN_AVB_MDC, NULL); + + /* IPSR0 */ + gpio_request(GPIO_IFN_AVB_MDC, NULL); + gpio_request(GPIO_IFN_AVB_MAGIC, NULL); + gpio_request(GPIO_IFN_AVB_PHY_INT, NULL); + gpio_request(GPIO_IFN_AVB_LINK, NULL); + gpio_request(GPIO_IFN_AVB_AVTP_MATCH_A, NULL); + gpio_request(GPIO_IFN_AVB_AVTP_CAPTURE_A, NULL); + /* IPSR1 */ + gpio_request(GPIO_FN_AVB_AVTP_PPS, NULL); + /* IPSR2 */ + gpio_request(GPIO_FN_AVB_AVTP_MATCH_B, NULL); + /* IPSR3 */ + gpio_request(GPIO_FN_AVB_AVTP_CAPTURE_B, NULL); + + /* AVB_PHY_RST */ + gpio_request(GPIO_GP_2_10, NULL); + gpio_direction_output(GPIO_GP_2_10, 0); + mdelay(20); + gpio_set_value(GPIO_GP_2_10, 1); + udelay(1); +#endif + return 0; } +static struct eth_pdata salvator_x_ravb_platdata = { + .iobase = 0xE6800000, + .phy_interface = 0, + .max_speed = 1000, +}; + +U_BOOT_DEVICE(salvator_x_ravb) = { + .name = "ravb", + .platdata = &salvator_x_ravb_platdata, +}; + #ifdef CONFIG_SH_SDHI int board_mmc_init(bd_t *bis) { diff --git a/configs/salvator-x_defconfig b/configs/salvator-x_defconfig index 1478b6ae3b..3738fe4536 100644 --- a/configs/salvator-x_defconfig +++ b/configs/salvator-x_defconfig @@ -12,7 +12,14 @@ CONFIG_SH_SDHI=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_EDITENV=y CONFIG_CMD_SAVEENV=y +CONFIG_CMD_NET=y +CONFIG_CMD_NFS=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_DHCP=y CONFIG_DOS_PARTITION=y CONFIG_MMC=y CONFIG_GENERIC_MMC=y CONFIG_OF_LIBFDT=y +CONFIG_DM_ETH=y +CONFIG_RENESAS_RAVB=y diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h index 91307eb353..b5a98d6db2 100644 --- a/include/configs/salvator-x.h +++ b/include/configs/salvator-x.h @@ -25,6 +25,12 @@ /* [A] Hyper Flash */ /* use to RPC(SPI Multi I/O Bus Controller) */ +/* Ethernet RAVB */ +#define CONFIG_NET_MULTI +#define CONFIG_PHY_MICREL +#define CONFIG_BITBANGMII +#define CONFIG_BITBANGMII_MULTI + /* Board Clock */ /* XTAL_CLK : 33.33MHz */ #define RCAR_XTAL_CLK 33333333u
Add support for the AVB ethernet on the Salvator-X board. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> --- board/renesas/salvator-x/salvator-x.c | 46 +++++++++++++++++++++++++++++++++++ configs/salvator-x_defconfig | 7 ++++++ include/configs/salvator-x.h | 6 +++++ 3 files changed, 59 insertions(+)