* [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls
@ 2012-06-12 16:37 Vikram Narayanan
2012-06-12 16:58 ` Fabio Estevam
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Vikram Narayanan @ 2012-06-12 16:37 UTC (permalink / raw)
To: u-boot
Changes from v1:
Used appropriate gpio_* lib calls.
---
Instead of manipulating gpio registers directly, use the calls
from the gpio library.
Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: John Rigby <jcrigby@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
---
board/karo/tx25/tx25.c | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 2a29943..ff2de38 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -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_direction_output(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);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls
2012-06-12 16:37 [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls Vikram Narayanan
@ 2012-06-12 16:58 ` Fabio Estevam
2012-06-13 7:52 ` Stefano Babic
2012-06-15 18:26 ` [U-Boot] [PATCH v3] " Vikram Narayanan
2 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2012-06-12 16:58 UTC (permalink / raw)
To: u-boot
On Tue, Jun 12, 2012 at 1:37 PM, Vikram Narayanan <vikram186@gmail.com> wrote:
> Changes from v1:
> Used appropriate gpio_* lib calls.
This should go below the --- line
>
> ---
> Instead of manipulating gpio registers directly, use the calls
> from the gpio library.
,and this should go above the --- line
Otherwise, patch looks good. I don't have a tx25 board to test it.
Hopefully John can give it a try.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls
2012-06-12 16:37 [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls Vikram Narayanan
2012-06-12 16:58 ` Fabio Estevam
@ 2012-06-13 7:52 ` Stefano Babic
2012-06-13 16:34 ` Vikram Narayanan
2012-06-15 18:26 ` [U-Boot] [PATCH v3] " Vikram Narayanan
2 siblings, 1 reply; 6+ messages in thread
From: Stefano Babic @ 2012-06-13 7:52 UTC (permalink / raw)
To: u-boot
On 12/06/2012 18:37, Vikram Narayanan wrote:
> Changes from v1:
> Used appropriate gpio_* lib calls.
>
> ---
> Instead of manipulating gpio registers directly, use the calls
> from the gpio library.
Changelog must go after the "---" line and commit message before. They
are swapped. Apart of that..
>
> Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: John Rigby <jcrigby@gmail.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
> board/karo/tx25/tx25.c | 25 +++++++++----------------
> 1 files changed, 9 insertions(+), 16 deletions(-)
>
> diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
> index 2a29943..ff2de38 100644
> --- a/board/karo/tx25/tx25.c
> +++ b/board/karo/tx25/tx25.c
> @@ -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_direction_output(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);
>
Acked-by: Stefano Babic <sbabic@denx.de>
Best regards,
Stefano Babic
--
=====================================================================
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
=====================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls
2012-06-13 7:52 ` Stefano Babic
@ 2012-06-13 16:34 ` Vikram Narayanan
0 siblings, 0 replies; 6+ messages in thread
From: Vikram Narayanan @ 2012-06-13 16:34 UTC (permalink / raw)
To: u-boot
On 6/13/2012 1:22 PM, Stefano Babic wrote:
> On 12/06/2012 18:37, Vikram Narayanan wrote:
>> Changes from v1:
>> Used appropriate gpio_* lib calls.
>>
>> ---
>> Instead of manipulating gpio registers directly, use the calls
>> from the gpio library.
>
> Changelog must go after the "---" line and commit message before. They
> are swapped. Apart of that..
Sorry for the mix up of commit message and the change log.
Will send a v3 for this.
BTW, did someone test this on tx25?
@John: Any comments from your side?
Thanks,
Vikram
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v3] tx25: Use generic gpio_* calls
2012-06-12 16:37 [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls Vikram Narayanan
2012-06-12 16:58 ` Fabio Estevam
2012-06-13 7:52 ` Stefano Babic
@ 2012-06-15 18:26 ` Vikram Narayanan
2012-06-15 18:35 ` Fabio Estevam
2 siblings, 1 reply; 6+ messages in thread
From: Vikram Narayanan @ 2012-06-15 18:26 UTC (permalink / raw)
To: u-boot
Instead of manipulating gpio registers directly, use the calls
from the gpio library.
Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Cc: John Rigby <jcrigby@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
---
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(-)
diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 2a29943..ff2de38 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -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_direction_output(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);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v3] tx25: Use generic gpio_* calls
2012-06-15 18:26 ` [U-Boot] [PATCH v3] " Vikram Narayanan
@ 2012-06-15 18:35 ` Fabio Estevam
0 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2012-06-15 18:35 UTC (permalink / raw)
To: u-boot
On Fri, Jun 15, 2012 at 3:26 PM, Vikram Narayanan <vikram186@gmail.com> wrote:
> ? ? ? ?/* turn on PHY power leaving reset asserted */
> - ? ? ? val = readl(&gpio4->gpio_dr) | 1 << 9;
> - ? ? ? writel(val, &gpio4->gpio_dr);
> + ? ? ? gpio_direction_output(GPIO_FEC_ENABLE_B, 1);
Please use gpio_set_value instead.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-06-15 18:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-12 16:37 [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls Vikram Narayanan
2012-06-12 16:58 ` Fabio Estevam
2012-06-13 7:52 ` Stefano Babic
2012-06-13 16:34 ` Vikram Narayanan
2012-06-15 18:26 ` [U-Boot] [PATCH v3] " Vikram Narayanan
2012-06-15 18:35 ` Fabio Estevam
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.