tx25: Use generic gpio_* calls
PATCH v4 1/1 tx25: Use generic gpio_* calls
Instead of manipulating gpio registers directly, use the calls from the gpio library.
---
Changes from v3:
Use gpio_set_value instead of gpio_direction_output (Ahh. Missed it again!!. Very bad)
Changes from v2:
Swap the place of the change log and commit message.
Changes from v1:
Used appropriate gpio_* lib calls.
board/karo/tx25/tx25.c | 25 +++++++++---------------- 1 files changed, 9 insertions(+), 16 deletions(-)
board/karo/tx25/tx25.c +9 -16
@@ -34,14 +34,13 @@DECLARE_GLOBAL_DATA_PTR ;#ifdef CONFIG_FEC_MXC +#define GPIO_FEC_RESET_B MXC_GPIO_PORT_TO_NUM(4, 7) +#define GPIO_FEC_ENABLE_B MXC_GPIO_PORT_TO_NUM(4, 9)void tx25_fec_init (void ) {struct iomuxc_mux_ctl *muxctl;struct iomuxc_pad_ctl *padctl; -u32 val;u32 gpio_mux_mode =MX25_PIN_MUX_MODE (5 ); -struct gpio_regs *gpio4 = (struct gpio_regs *)IMX_GPIO4_BASE ; -struct gpio_regs *gpio3 = (struct gpio_regs *)IMX_GPIO3_BASE ;u32 saved_rdata0_mode, saved_rdata1_mode, saved_rx_dv_mode;debug ("tx25_fec_init\n" );
@@ -66,18 +65,15 @@ void tx25_fec_init(void)writel (0x0 , &padctl->pad_d11);/* drop PHY power and assert reset (low) */ - val =readl (&gpio4->gpio_dr) & ~((1 <<7 ) | (1 <<9 )); -writel (val, &gpio4->gpio_dr); - val =readl (&gpio4->gpio_dir) | (1 <<7 ) | (1 <<9 ); -writel (val, &gpio4->gpio_dir); +gpio_direction_output (GPIO_FEC_RESET_B ,0 ); +gpio_direction_output (GPIO_FEC_ENABLE_B ,0 );mdelay (5 );debug ("resetting phy\n" );/* turn on PHY power leaving reset asserted */ - val =readl (&gpio4->gpio_dr) |1 <<9 ; -writel (val, &gpio4->gpio_dr); +gpio_set_value (GPIO_FEC_ENABLE_B ,1 );mdelay (10 );
@@ -107,19 +103,16 @@ void tx25_fec_init(void)/* * set each to 1 and make each an output */ - val =readl (&gpio3->gpio_dr) | (1 <<10 ) | (1 <<11 ) | (1 <<12 ); -writel (val, &gpio3->gpio_dr); - val =readl (&gpio3->gpio_dir) | (1 <<10 ) | (1 <<11 ) | (1 <<12 ); -writel (val, &gpio3->gpio_dir); +gpio_direction_output (MXC_GPIO_PORT_TO_NUM (3 ,10 ),1 ); +gpio_direction_output (MXC_GPIO_PORT_TO_NUM (3 ,11 ),1 ); +gpio_direction_output (MXC_GPIO_PORT_TO_NUM (3 ,12 ),1 );mdelay (22 );/* this value came from RedBoot */ /* * deassert PHY reset */ - val =readl (&gpio4->gpio_dr) |1 <<7 ; -writel (val, &gpio4->gpio_dr); -writel (val, &gpio4->gpio_dr); +gpio_set_value (GPIO_FEC_RESET_B ,1 );mdelay (5 );
Signature · 1 line
1.7.4.1
PATCH v4 1/1 tx25: Use generic gpio_* calls
Quoted 7 lines · Vikram Narayanan
Instead of manipulating gpio registers directly, use the calls from the gpio library.
Signed-off-by Vikram Narayanan <[email protected]>Acked-by Stefano Babic <[email protected]>Cc John Rigby <[email protected]>Cc Fabio Estevam <[email protected]>
PATCH v4 1/1 tx25: Use generic gpio_* calls
In reply to Vikram NarayananQuoted 78 lines · Vikram Narayanan
Instead of manipulating gpio registers directly, use the calls from the gpio library.
Signed-off-by Vikram Narayanan <[email protected]>Acked-by Stefano Babic <[email protected]>Cc John Rigby <[email protected]>Cc Fabio Estevam <[email protected]>---
Changes from v3:
Usegpio_set_valueinstead ofgpio_direction_output(Ahh. Missed it again!!. Very bad)Changes from v2:
Swap the place of the change log and commit message.Changes from v1:
Used appropriate gpio_* lib calls.board/karo/tx25/tx25.c | 25 +++++++++---------------- 1 files changed, 9 insertions(+), 16 deletions(-)board/karo/tx25/tx25.c +8
-13@@ -34,14 +34,13 @@DECLARE_GLOBAL_DATA_PTR ;#ifdef CONFIG_FEC_MXC +#define GPIO_FEC_RESET_B MXC_GPIO_PORT_TO_NUM(4, 7) +#define GPIO_FEC_ENABLE_B MXC_GPIO_PORT_TO_NUM(4, 9)void tx25_fec_init (void ) {struct iomuxc_mux_ctl *muxctl;struct iomuxc_pad_ctl *padctl; -u32 val;u32 gpio_mux_mode =MX25_PIN_MUX_MODE (5 ); -struct gpio_regs *gpio4 = (struct gpio_regs *)IMX_GPIO4_BASE ; -struct gpio_regs *gpio3 = (struct gpio_regs *)IMX_GPIO3_BASE ;u32 saved_rdata0_mode, saved_rdata1_mode, saved_rx_dv_mode;debug ("tx25_fec_init\n" );@@ -66,18 +65,15 @@ void tx25_fec_init(void)writel (0x0 , &padctl->pad_d11);/* drop PHY power and assert reset (low) */ - val =readl (&gpio4->gpio_dr) & ~((1 <<7 ) | (1 <<9 )); -writel (val, &gpio4->gpio_dr); - val =readl (&gpio4->gpio_dir) | (1 <<7 ) | (1 <<9 ); -writel (val, &gpio4->gpio_dir); +gpio_direction_output (GPIO_FEC_RESET_B ,0 ); +gpio_direction_output (GPIO_FEC_ENABLE_B ,0 );mdelay (5 );debug ("resetting phy\n" );/* turn on PHY power leaving reset asserted */ - val =readl (&gpio4->gpio_dr) |1 <<9 ; -writel (val, &gpio4->gpio_dr); +gpio_set_value (GPIO_FEC_ENABLE_B ,1 );mdelay (10 );@@ -107,19 +103,16 @@ void tx25_fec_init(void)/* * set each to 1 and make each an output */ - val =readl (&gpio3->gpio_dr) | (1 <<10 ) | (1 <<11 ) | (1 <<12 ); -writel (val, &gpio3->gpio_dr); - val =readl (&gpio3->gpio_dir) | (1 <<10 ) | (1 <<11 ) | (1 <<12 ); -writel (val, &gpio3->gpio_dir); +gpio_direction_output (MXC_GPIO_PORT_TO_NUM (3 ,10 ),1 ); +gpio_direction_output (MXC_GPIO_PORT_TO_NUM (3 ,11 ),1 ); +gpio_direction_output (MXC_GPIO_PORT_TO_NUM (3 ,12 ),1 );mdelay (22 );/* this value came from RedBoot */
board/karo/tx25/tx25.c void tx25_fec_init(void) · line 118
Quoted 10 lines
board/karo/tx25/tx25.c +1
-3/* * deassert PHY reset */ - val =readl (&gpio4->gpio_dr) |1 <<7 ; -writel (val, &gpio4->gpio_dr); -writel (val, &gpio4->gpio_dr); +gpio_set_value (GPIO_FEC_RESET_B ,1 );mdelay (5 );
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 =====================================================================
Anatolij Gustschin
AppliedPATCH v4 1/1 tx25: Use generic gpio_* calls
In reply to Vikram NarayananHi,
Quoted 12 lines · On Sat, 16 Jun 2012 22:46:17 +0530 Vikram Narayanan <[email protected]> wrote:
Instead of manipulating gpio registers directly, use the calls from the gpio library.
Signed-off-by Vikram Narayanan <[email protected]>Acked-by Stefano Babic <[email protected]>Cc John Rigby <[email protected]>Cc Fabio Estevam <[email protected]>---
Changes from v3:
Usegpio_set_valueinstead ofgpio_direction_output(Ahh. Missed it again!!. Very bad)
Quoted 8 lines
Changes from v2:
Swap the place of the change log and commit message.Changes from v1:
Used appropriate gpio_* lib calls.board/karo/tx25/tx25.c | 25 +++++++++---------------- 1 files changed, 9 insertions(+), 16 deletions(-)
applied to my staging branch, thanks!
Anatolij