power: pmic: Add Voltage configuration macro
PATCH 1/3 power: pmic: Add Voltage configuration macro
Add pfuze3000 voltage configuration macro for SW1AB, SW3 and VLDO1/2 according to tables 53, 57 and 62 on PF3000 datasheet.
---
Note: This patch series depends on my last series submission.
include/power/pfuze3000_pmic.h | 5 +++++ 1 file changed, 5 insertions(+)
include/power/pfuze3000_pmic.h +5 -0
@@ -75,4 +75,9 @@ enum {int power_pfuze3000_init (unsigned char bus); +/* Voltage Configuration */ +#define PFUZE3000_SW1AB_SETP (x) ((x - 7000) / 250) +#define PFUZE3000_SW3_SETP (x) ((x - 9000) / 500) +#define PFUZE3000_VLDO_SETP (x) ((x - 8000) / 500) +#endif
Signature · 1 line
2.7.4
PATCH 2/3 udoo_neo: Add PFUZE300 PMIC support
UDOO Neo boards has a PFUZE300 connected to I2C1 bus.
Tested on a UDOO Neo Full with "pmic PFUZE3000 dump" command.
--- board/udoo/neo/neo.c | 143 +++++++++++++++++++++++++++++++++++++++++++++ include/configs/udoo_neo.h | 13 +++++ 2 files changed, 156 insertions(+)
board/udoo/neo/neo.c +143 -0
@@ -19,10 +19,14 @@#include <fsl_esdhc.h> #include <asm/arch/crm_regs.h> #include <asm/io.h> +#include <asm/imx-common/mxc_i2c.h> #include <asm/arch/sys_proto.h> #include <spl.h> #include <linux/sizes.h> #include <common.h> +#include <i2c.h> +#include <power/pmic.h> +#include <power/pfuze3000_pmic.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -41,6 +45,11 @@ enum { PAD_CTL_PUS_22K_UP | PAD_CTL_SPEED_LOW | \ PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS) +#define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ + PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ + PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ + PAD_CTL_ODE) +#define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_40ohm)
@@ -56,6 +65,136 @@ int dram_init(void)return 0 ; } +#ifdef CONFIG_SYS_I2C_MXC +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) +/* I2C1 for PMIC */ +static struct i2c_pads_info i2c_pad_info1 = { + .scl = { + .i2c_mode =MX6_PAD_GPIO1_IO00__I2C1_SCL |PC , + .gpio_mode =MX6_PAD_GPIO1_IO00__GPIO1_IO_0 |PC , + .gp =IMX_GPIO_NR (1 ,0 ), + }, + .sda = { + .i2c_mode =MX6_PAD_GPIO1_IO01__I2C1_SDA |PC , + .gpio_mode =MX6_PAD_GPIO1_IO01__GPIO1_IO_1 |PC , + .gp =IMX_GPIO_NR (1 ,1 ), + }, +}; +#endif + +#ifdef CONFIG_POWER +int power_init_board (void ) +{ +struct pmic *p; +int ret; +unsigned int reg, rev_id; + + ret =power_pfuze3000_init (PFUZE3000_I2C_BUS ); +if (ret) +return ret; + + p =pmic_get ("PFUZE3000" ); + ret =pmic_probe (p); +if (ret) +return ret; + +pmic_reg_read (p,PFUZE3000_DEVICEID , ®); +pmic_reg_read (p,PFUZE3000_REVID , &rev_id); +printf ("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n" , reg, rev_id); + +/* disable Low Power Mode during standby mode */ +pmic_reg_read (p,PFUZE3000_LDOGCTL , ®); + reg |=0x1 ; + ret =pmic_reg_write (p,PFUZE3000_LDOGCTL , reg); +if (ret) +return ret; + + ret =pmic_reg_write (p,PFUZE3000_SW1AMODE ,0xc ); +if (ret) +return ret; + + ret =pmic_reg_write (p,PFUZE3000_SW1BMODE ,0xc ); +if (ret) +return ret; + + ret =pmic_reg_write (p,PFUZE3000_SW2MODE ,0xc ); +if (ret) +return ret; + + ret =pmic_reg_write (p,PFUZE3000_SW3MODE ,0xc ); +if (ret) +return ret; + +/* set SW1A standby voltage 0.975V */ +pmic_reg_read (p,PFUZE3000_SW1ASTBY , ®); + reg &= ~0x3f ; + reg |=PFUZE3000_SW1AB_SETP (9750 ); + ret =pmic_reg_write (p,PFUZE3000_SW1ASTBY , reg); +if (ret) +return ret; + +/* set SW1B standby voltage 0.975V */ +pmic_reg_read (p,PFUZE3000_SW1BSTBY , ®); + reg &= ~0x3f ; + reg |=PFUZE3000_SW1AB_SETP (9750 ); + ret =pmic_reg_write (p,PFUZE3000_SW1BSTBY , reg); +if (ret) +return ret; + +/* set SW1A/VDD_ARM_IN step ramp up time from 16us to 4us/25mV */ +pmic_reg_read (p,PFUZE3000_SW1ACONF , ®); + reg &= ~0xc0 ; + reg |=0x40 ; + ret =pmic_reg_write (p,PFUZE3000_SW1ACONF , reg); +if (ret) +return ret; + +/* set SW1B/VDD_SOC_IN step ramp up time from 16us to 4us/25mV */ +pmic_reg_read (p,PFUZE3000_SW1BCONF , ®); + reg &= ~0xc0 ; + reg |=0x40 ; + ret =pmic_reg_write (p,PFUZE3000_SW1BCONF , reg); +if (ret) +return ret; + +/* set VDD_ARM_IN to 1.350V */ +pmic_reg_read (p,PFUZE3000_SW1AVOLT , ®); + reg &= ~0x3f ; + reg |=PFUZE3000_SW1AB_SETP (13500 ); + ret =pmic_reg_write (p,PFUZE3000_SW1AVOLT , reg); +if (ret) +return ret; + +/* set VDD_SOC_IN to 1.350V */ +pmic_reg_read (p,PFUZE3000_SW1BVOLT , ®); + reg &= ~0x3f ; + reg |=PFUZE3000_SW1AB_SETP (13500 ); + ret =pmic_reg_write (p,PFUZE3000_SW1BVOLT , reg); +if (ret) +return ret; + +/* set DDR_1_5V to 1.350V */ +pmic_reg_read (p,PFUZE3000_SW3VOLT , ®); + reg &= ~0x0f ; + reg |=PFUZE3000_SW3_SETP (13500 ); + ret =pmic_reg_write (p,PFUZE3000_SW3VOLT , reg); +if (ret) +return ret; + +/* set VGEN2_1V5 to 1.5V */ +pmic_reg_read (p,PFUZE3000_VLDO2CTL , ®); + reg &= ~0x0f ; + reg |=PFUZE3000_VLDO_SETP (15000 ); +/* enable */ + reg |=0x10 ; + ret =pmic_reg_write (p,PFUZE3000_VLDO2CTL , reg); +if (ret) +return ret; + +return 0 ; +} +#endif +static iomux_v3_cfg_t const uart1_pads[] = {MX6_PAD_GPIO1_IO04__UART1_TX |MUX_PAD_CTRL (UART_PAD_CTRL ),MX6_PAD_GPIO1_IO05__UART1_RX |MUX_PAD_CTRL (UART_PAD_CTRL ),
@@ -115,6 +254,10 @@ int board_init(void)/* Active high for ncp692 */ gpio_direction_output (IMX_GPIO_NR (4 ,16 ) ,1 ); +#ifdef CONFIG_SYS_I2C_MXC +setup_i2c (0 ,CONFIG_SYS_I2C_SPEED ,0x7f , &i2c_pad_info1); +#endif +return 0 ; }
include/configs/udoo_neo.h +13 -0
@@ -90,4 +90,17 @@#define CONFIG_IMX_THERMAL +/* I2C configs */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_I2C_MXC_I2C1 +#define CONFIG_SYS_I2C_SPEED 100000 + +/* PMIC */ +#define CONFIG_POWER +#define CONFIG_POWER_I2C +#define CONFIG_POWER_PFUZE3000 +#define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08 +#define PFUZE3000_I2C_BUS 0 +#endif /* __CONFIG_H */
Signature · 1 line
2.7.4
PATCH 3/3 udoo_neo: Add Ethernet support
In reply to Breno LimaUDOO Neo boards has one FEC port connected to KSZ8091, add support for it.
Tested on a UDOO Neo Full with "dhcp zImage" command.
--- board/udoo/neo/neo.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++ configs/udoo_neo_defconfig | 2 +- include/configs/udoo_neo.h | 17 ++++++++- 3 files changed, 112 insertions(+), 2 deletions(-)
board/udoo/neo/neo.c +95 -0
@@ -10,6 +10,7 @@*/ #include <asm/arch/clock.h> +#include <asm/arch/crm_regs.h> #include <asm/arch/imx-regs.h> #include <asm/arch/iomux.h> #include <asm/arch/mx6-pins.h>
@@ -25,8 +26,11 @@#include <linux/sizes.h> #include <common.h> #include <i2c.h> +#include <miiphy.h> +#include <netdev.h> #include <power/pmic.h> #include <power/pfuze3000_pmic.h> +#include <malloc.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -50,6 +54,16 @@ enum { PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ PAD_CTL_ODE) +#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \ + PAD_CTL_SPEED_MED | \ + PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST) + +#define ENET_CLK_PAD_CTRL (PAD_CTL_SPEED_MED | \ + PAD_CTL_DSE_120ohm | PAD_CTL_SRE_FAST) + +#define ENET_RX_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ + PAD_CTL_SPEED_MED | PAD_CTL_SRE_FAST) +#define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_40ohm)
@@ -213,6 +227,27 @@ static iomux_v3_cfg_t const usdhc2_pads[] = { MX6_PAD_SD1_CMD__GPIO6_IO_1 | MUX_PAD_CTRL(NO_PAD_CTRL), }; +static iomux_v3_cfg_t const fec1_pads[] = { +MX6_PAD_ENET1_MDC__ENET1_MDC |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_ENET1_MDIO__ENET1_MDIO |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII1_RX_CTL__ENET1_RX_EN |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_RGMII1_RD0__ENET1_RX_DATA_0 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_RGMII1_RD1__ENET1_RX_DATA_1 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_RGMII1_TX_CTL__ENET1_TX_EN |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII1_RXC__ENET1_RX_ER |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_RGMII1_TD0__ENET1_TX_DATA_0 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII1_TD1__ENET1_TX_DATA_1 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_ENET2_TX_CLK__GPIO2_IO_9 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_ENET1_CRS__GPIO2_IO_1 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +}; + +static iomux_v3_cfg_t const phy_control_pads[] = { +/* 25MHz Ethernet PHY Clock */ +MX6_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M | +MUX_PAD_CTRL (ENET_CLK_PAD_CTRL ), +}; +static iomux_v3_cfg_t const board_recognition_pads[] = {/*Connected to R184*/ MX6_PAD_NAND_READY_B__GPIO4_IO_13 |BOARD_DETECT_PAD_CFG ,
@@ -233,6 +268,66 @@ static void setup_iomux_uart(void)imx_iomux_v3_setup_multiple_pads (uart1_pads,ARRAY_SIZE (uart1_pads)); } +static int setup_fec (int fec_id) +{ +struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR ; +int reg; + +imx_iomux_v3_setup_multiple_pads (phy_control_pads, +ARRAY_SIZE (phy_control_pads)); + +/* Reset PHY */ +gpio_direction_output (IMX_GPIO_NR (2 ,1 ) ,0 ); +udelay (10000 ); +gpio_set_value (IMX_GPIO_NR (2 ,1 ),1 ); +udelay (100 ); + + reg =readl (&anatop->pll_enet); + reg |=BM_ANADIG_PLL_ENET_REF_25M_ENABLE ; +writel (reg, &anatop->pll_enet); + +return enable_fec_anatop_clock (fec_id,ENET_25MHZ ); +} + +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; + +imx_iomux_v3_setup_multiple_pads (fec1_pads,ARRAY_SIZE (fec1_pads)); + +setup_fec (CONFIG_FEC_ENET_DEV ); + + bus =fec_get_miibus (base,CONFIG_FEC_ENET_DEV ); +if (!bus) +return -EINVAL ; + + phydev =phy_find_by_mask (bus, (0x1 <<CONFIG_FEC_MXC_PHYADDR ), +PHY_INTERFACE_MODE_RMII ); +if (!phydev) { +free (bus); +return -EINVAL ; + } + + ret =fec_probe (bis,CONFIG_FEC_ENET_DEV , base, bus, phydev); +if (ret) { +free (bus); +free (phydev); +return ret; + } +return 0 ; +} + +int board_phy_config (struct phy_device *phydev) +{ +if (phydev->drv->config) + phydev->drv->config (phydev); + +return 0 ; +} +int board_init (void ) {/* Address of boot parameters */
configs/udoo_neo_defconfig +1 -1
@@ -19,7 +19,7 @@ CONFIG_CMD_BOOTZ=y CONFIG_CMD_MMC=y CONFIG_CMD_GPIO=y # CONFIG_CMD_SETEXPR is not set -# CONFIG_CMD_DHCP=y +CONFIG_CMD_DHCP=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_EXT2=y
include/configs/udoo_neo.h +16 -1
@@ -58,7 +58,8 @@ BOOTENV#define BOOT_TARGET_DEVICES (func) \ - func(MMC, mmc, 0) + func(MMC, mmc, 0) \ + func(DHCP, dhcp, na)#define CONFIG_BOOTCOMMAND \ "run findfdt; " \
@@ -103,4 +104,18 @@#define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08#define PFUZE3000_I2C_BUS 0 +/* Network */ +#define CONFIG_FEC_MXC +#define CONFIG_MII + +#define CONFIG_FEC_ENET_DEV 0 +#define IMX_FEC_BASE ENET_BASE_ADDR +#define CONFIG_FEC_MXC_PHYADDR 0x0 + +#define CONFIG_FEC_XCV_TYPE RMII +#define CONFIG_ETHPRIME "FEC0" + +#define CONFIG_PHYLIB +#define CONFIG_PHY_MICREL +#endif /* __CONFIG_H */
Signature · 1 line
2.7.4
PATCH 1/3 power: pmic: Add Voltage configuration macro
In reply to Breno LimaQuoted 15 lines · Breno Lima
Add pfuze3000 voltage configuration macro for SW1AB, SW3 and VLDO1/2 according to tables 53, 57 and 62 on PF3000 datasheet.
Signed-off-by Breno Lima <[email protected]>---
Note: This patch series depends on my last series submission.include/power/pfuze3000_pmic.h | 5 +++++ 1 file changed, 5 insertions(+)include/power/pfuze3000_pmic.h +0
-0
include/power/pfuze3000_pmic.h enum { · line 83
Quoted 9 lines
include/power/pfuze3000_pmic.h +5
-0@@ -75,4 +75,9 @@ enum {int power_pfuze3000_init (unsigned char bus); +/* Voltage Configuration */ +#define PFUZE3000_SW1AB_SETP (x) ((x - 7000) / 250) +#define PFUZE3000_SW3_SETP (x) ((x - 9000) / 500) +#define PFUZE3000_VLDO_SETP (x) ((x - 8000) / 500) +#endif
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 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 2/3 udoo_neo: Add PFUZE300 PMIC support
In reply to Breno LimaQuoted 202 lines · Breno Lima
UDOO Neo boards has a PFUZE300 connected to I2C1 bus.
Tested on a UDOO Neo Full with "pmic PFUZE3000 dump" command.
Signed-off-by Breno Lima <[email protected]>--- board/udoo/neo/neo.c | 143 +++++++++++++++++++++++++++++++++++++++++++++ include/configs/udoo_neo.h | 13 +++++ 2 files changed, 156 insertions(+)board/udoo/neo/neo.c +143
-0@@ -19,10 +19,14 @@#include <fsl_esdhc.h> #include <asm/arch/crm_regs.h> #include <asm/io.h> +#include <asm/imx-common/mxc_i2c.h> #include <asm/arch/sys_proto.h> #include <spl.h> #include <linux/sizes.h> #include <common.h> +#include <i2c.h> +#include <power/pmic.h> +#include <power/pfuze3000_pmic.h> DECLARE_GLOBAL_DATA_PTR ;@@ -41,6 +45,11 @@ enum { PAD_CTL_PUS_22K_UP | PAD_CTL_SPEED_LOW | \ PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS) +#define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ + PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ + PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ + PAD_CTL_ODE) +#define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_40ohm)@@ -56,6 +65,136 @@ int dram_init(void)return 0 ; } +#ifdef CONFIG_SYS_I2C_MXC +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) +/* I2C1 for PMIC */ +static struct i2c_pads_info i2c_pad_info1 = { + .scl = { + .i2c_mode =MX6_PAD_GPIO1_IO00__I2C1_SCL |PC , + .gpio_mode =MX6_PAD_GPIO1_IO00__GPIO1_IO_0 |PC , + .gp =IMX_GPIO_NR (1 ,0 ), + }, + .sda = { + .i2c_mode =MX6_PAD_GPIO1_IO01__I2C1_SDA |PC , + .gpio_mode =MX6_PAD_GPIO1_IO01__GPIO1_IO_1 |PC , + .gp =IMX_GPIO_NR (1 ,1 ), + }, +}; +#endif + +#ifdef CONFIG_POWER +int power_init_board (void ) +{ +struct pmic *p; +int ret; +unsigned int reg, rev_id; + + ret =power_pfuze3000_init (PFUZE3000_I2C_BUS ); +if (ret) +return ret; + + p =pmic_get ("PFUZE3000" ); + ret =pmic_probe (p); +if (ret) +return ret; + +pmic_reg_read (p,PFUZE3000_DEVICEID , ®); +pmic_reg_read (p,PFUZE3000_REVID , &rev_id); +printf ("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n" , reg, rev_id); + +/* disable Low Power Mode during standby mode */ +pmic_reg_read (p,PFUZE3000_LDOGCTL , ®); + reg |=0x1 ; + ret =pmic_reg_write (p,PFUZE3000_LDOGCTL , reg); +if (ret) +return ret; + + ret =pmic_reg_write (p,PFUZE3000_SW1AMODE ,0xc ); +if (ret) +return ret; + + ret =pmic_reg_write (p,PFUZE3000_SW1BMODE ,0xc ); +if (ret) +return ret; + + ret =pmic_reg_write (p,PFUZE3000_SW2MODE ,0xc ); +if (ret) +return ret; + + ret =pmic_reg_write (p,PFUZE3000_SW3MODE ,0xc ); +if (ret) +return ret; + +/* set SW1A standby voltage 0.975V */ +pmic_reg_read (p,PFUZE3000_SW1ASTBY , ®); + reg &= ~0x3f ; + reg |=PFUZE3000_SW1AB_SETP (9750 ); + ret =pmic_reg_write (p,PFUZE3000_SW1ASTBY , reg); +if (ret) +return ret; + +/* set SW1B standby voltage 0.975V */ +pmic_reg_read (p,PFUZE3000_SW1BSTBY , ®); + reg &= ~0x3f ; + reg |=PFUZE3000_SW1AB_SETP (9750 ); + ret =pmic_reg_write (p,PFUZE3000_SW1BSTBY , reg); +if (ret) +return ret; + +/* set SW1A/VDD_ARM_IN step ramp up time from 16us to 4us/25mV */ +pmic_reg_read (p,PFUZE3000_SW1ACONF , ®); + reg &= ~0xc0 ; + reg |=0x40 ; + ret =pmic_reg_write (p,PFUZE3000_SW1ACONF , reg); +if (ret) +return ret; + +/* set SW1B/VDD_SOC_IN step ramp up time from 16us to 4us/25mV */ +pmic_reg_read (p,PFUZE3000_SW1BCONF , ®); + reg &= ~0xc0 ; + reg |=0x40 ; + ret =pmic_reg_write (p,PFUZE3000_SW1BCONF , reg); +if (ret) +return ret; + +/* set VDD_ARM_IN to 1.350V */ +pmic_reg_read (p,PFUZE3000_SW1AVOLT , ®); + reg &= ~0x3f ; + reg |=PFUZE3000_SW1AB_SETP (13500 ); + ret =pmic_reg_write (p,PFUZE3000_SW1AVOLT , reg); +if (ret) +return ret; + +/* set VDD_SOC_IN to 1.350V */ +pmic_reg_read (p,PFUZE3000_SW1BVOLT , ®); + reg &= ~0x3f ; + reg |=PFUZE3000_SW1AB_SETP (13500 ); + ret =pmic_reg_write (p,PFUZE3000_SW1BVOLT , reg); +if (ret) +return ret; + +/* set DDR_1_5V to 1.350V */ +pmic_reg_read (p,PFUZE3000_SW3VOLT , ®); + reg &= ~0x0f ; + reg |=PFUZE3000_SW3_SETP (13500 ); + ret =pmic_reg_write (p,PFUZE3000_SW3VOLT , reg); +if (ret) +return ret; + +/* set VGEN2_1V5 to 1.5V */ +pmic_reg_read (p,PFUZE3000_VLDO2CTL , ®); + reg &= ~0x0f ; + reg |=PFUZE3000_VLDO_SETP (15000 ); +/* enable */ + reg |=0x10 ; + ret =pmic_reg_write (p,PFUZE3000_VLDO2CTL , reg); +if (ret) +return ret; + +return 0 ; +} +#endif +static iomux_v3_cfg_t const uart1_pads[] = {MX6_PAD_GPIO1_IO04__UART1_TX |MUX_PAD_CTRL (UART_PAD_CTRL ),MX6_PAD_GPIO1_IO05__UART1_RX |MUX_PAD_CTRL (UART_PAD_CTRL ),@@ -115,6 +254,10 @@ int board_init(void)/* Active high for ncp692 */ gpio_direction_output (IMX_GPIO_NR (4 ,16 ) ,1 ); +#ifdef CONFIG_SYS_I2C_MXC +setup_i2c (0 ,CONFIG_SYS_I2C_SPEED ,0x7f , &i2c_pad_info1); +#endif +return 0 ; }include/configs/udoo_neo.h +4
-0@@ -90,4 +90,17 @@#define CONFIG_IMX_THERMAL +/* I2C configs */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_I2C_MXC_I2C1
include/configs/udoo_neo.h line 106
Quoted 10 lines
include/configs/udoo_neo.h +9
-0+#define CONFIG_SYS_I2C_SPEED 100000 + +/* PMIC */ +#define CONFIG_POWER +#define CONFIG_POWER_I2C +#define CONFIG_POWER_PFUZE3000 +#define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08 +#define PFUZE3000_I2C_BUS 0 +#endif /* __CONFIG_H */
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 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 3/3 udoo_neo: Add Ethernet support
In reply to Breno LimaQuoted 184 lines · Breno Lima
UDOO Neo boards has one FEC port connected to KSZ8091, add support for it.
Tested on a UDOO Neo Full with "dhcp zImage" command.
Signed-off-by Breno Lima <[email protected]>--- board/udoo/neo/neo.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++ configs/udoo_neo_defconfig | 2 +- include/configs/udoo_neo.h | 17 ++++++++- 3 files changed, 112 insertions(+), 2 deletions(-)board/udoo/neo/neo.c +95
-0@@ -10,6 +10,7 @@*/ #include <asm/arch/clock.h> +#include <asm/arch/crm_regs.h> #include <asm/arch/imx-regs.h> #include <asm/arch/iomux.h> #include <asm/arch/mx6-pins.h> @@ -25,8 +26,11 @@#include <linux/sizes.h> #include <common.h> #include <i2c.h> +#include <miiphy.h> +#include <netdev.h> #include <power/pmic.h> #include <power/pfuze3000_pmic.h> +#include <malloc.h> DECLARE_GLOBAL_DATA_PTR ;@@ -50,6 +54,16 @@ enum { PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ PAD_CTL_ODE) +#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \ + PAD_CTL_SPEED_MED | \ + PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST) + +#define ENET_CLK_PAD_CTRL (PAD_CTL_SPEED_MED | \ + PAD_CTL_DSE_120ohm | PAD_CTL_SRE_FAST) + +#define ENET_RX_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ + PAD_CTL_SPEED_MED | PAD_CTL_SRE_FAST) +#define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_40ohm)@@ -213,6 +227,27 @@ static iomux_v3_cfg_t const usdhc2_pads[] = { MX6_PAD_SD1_CMD__GPIO6_IO_1 | MUX_PAD_CTRL(NO_PAD_CTRL), }; +static iomux_v3_cfg_t const fec1_pads[] = { +MX6_PAD_ENET1_MDC__ENET1_MDC |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_ENET1_MDIO__ENET1_MDIO |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII1_RX_CTL__ENET1_RX_EN |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_RGMII1_RD0__ENET1_RX_DATA_0 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_RGMII1_RD1__ENET1_RX_DATA_1 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_RGMII1_TX_CTL__ENET1_TX_EN |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII1_RXC__ENET1_RX_ER |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_RGMII1_TD0__ENET1_TX_DATA_0 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_RGMII1_TD1__ENET1_TX_DATA_1 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +MX6_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_ENET2_TX_CLK__GPIO2_IO_9 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), +MX6_PAD_ENET1_CRS__GPIO2_IO_1 |MUX_PAD_CTRL (ENET_PAD_CTRL ), +}; + +static iomux_v3_cfg_t const phy_control_pads[] = { +/* 25MHz Ethernet PHY Clock */ +MX6_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M | +MUX_PAD_CTRL (ENET_CLK_PAD_CTRL ), +}; +static iomux_v3_cfg_t const board_recognition_pads[] = {/*Connected to R184*/ MX6_PAD_NAND_READY_B__GPIO4_IO_13 |BOARD_DETECT_PAD_CFG ,@@ -233,6 +268,66 @@ static void setup_iomux_uart(void)imx_iomux_v3_setup_multiple_pads (uart1_pads,ARRAY_SIZE (uart1_pads)); } +static int setup_fec (int fec_id) +{ +struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR ; +int reg; + +imx_iomux_v3_setup_multiple_pads (phy_control_pads, +ARRAY_SIZE (phy_control_pads)); + +/* Reset PHY */ +gpio_direction_output (IMX_GPIO_NR (2 ,1 ) ,0 ); +udelay (10000 ); +gpio_set_value (IMX_GPIO_NR (2 ,1 ),1 ); +udelay (100 ); + + reg =readl (&anatop->pll_enet); + reg |=BM_ANADIG_PLL_ENET_REF_25M_ENABLE ; +writel (reg, &anatop->pll_enet); + +return enable_fec_anatop_clock (fec_id,ENET_25MHZ ); +} + +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; + +imx_iomux_v3_setup_multiple_pads (fec1_pads,ARRAY_SIZE (fec1_pads)); + +setup_fec (CONFIG_FEC_ENET_DEV ); + + bus =fec_get_miibus (base,CONFIG_FEC_ENET_DEV ); +if (!bus) +return -EINVAL ; + + phydev =phy_find_by_mask (bus, (0x1 <<CONFIG_FEC_MXC_PHYADDR ), +PHY_INTERFACE_MODE_RMII ); +if (!phydev) { +free (bus); +return -EINVAL ; + } + + ret =fec_probe (bis,CONFIG_FEC_ENET_DEV , base, bus, phydev); +if (ret) { +free (bus); +free (phydev); +return ret; + } +return 0 ; +} + +int board_phy_config (struct phy_device *phydev) +{ +if (phydev->drv->config) + phydev->drv->config (phydev); + +return 0 ; +} +int board_init (void ) {/* Address of boot parameters */ configs/udoo_neo_defconfig +1
-1@@ -19,7 +19,7 @@ CONFIG_CMD_BOOTZ=y CONFIG_CMD_MMC=y CONFIG_CMD_GPIO=y # CONFIG_CMD_SETEXPR is not set -# CONFIG_CMD_DHCP=y +CONFIG_CMD_DHCP=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_EXT2=yinclude/configs/udoo_neo.h +7
-1@@ -58,7 +58,8 @@ BOOTENV#define BOOT_TARGET_DEVICES (func) \ - func(MMC, mmc, 0) + func(MMC, mmc, 0) \ + func(DHCP, dhcp, na)#define CONFIG_BOOTCOMMAND \ "run findfdt; " \@@ -103,4 +104,18 @@#define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08#define PFUZE3000_I2C_BUS 0 +/* Network */ +#define CONFIG_FEC_MXC +#define CONFIG_MII + +#define CONFIG_FEC_ENET_DEV 0
include/configs/udoo_neo.h line 121
Quoted 10 lines
include/configs/udoo_neo.h +9
-0+#define IMX_FEC_BASE ENET_BASE_ADDR +#define CONFIG_FEC_MXC_PHYADDR 0x0 + +#define CONFIG_FEC_XCV_TYPE RMII +#define CONFIG_ETHPRIME "FEC0" + +#define CONFIG_PHYLIB +#define CONFIG_PHY_MICREL +#endif /* __CONFIG_H */
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 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 =====================================================================