From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] mx6: soc: Add ENET2 support
Date: Tue, 10 Feb 2015 11:22:17 +0100 [thread overview]
Message-ID: <54D9DBD9.70009@denx.de> (raw)
In-Reply-To: <1421052378-29913-2-git-send-email-B37916@freescale.com>
Hi,
On 12/01/2015 09:46, Ye.Li wrote:
> The mx6sx has two ENET controllers, some board like mx6sxsabreauto
> uses the ENET2 for ethernet. So add ENET2 support to soc level,
> including: ENET2 clock enable and MAC address fuse for ENET2.
>
> Signed-off-by: Ye.Li <B37916@freescale.com>
> ---
> arch/arm/cpu/armv7/mx6/clock.c | 9 ++++++++-
> arch/arm/cpu/armv7/mx6/soc.c | 25 ++++++++++++++++++++++++-
> arch/arm/include/asm/arch-mx6/crm_regs.h | 7 +++++++
> 3 files changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
> index 055f44e..fd57f22 100644
> --- a/arch/arm/cpu/armv7/mx6/clock.c
> +++ b/arch/arm/cpu/armv7/mx6/clock.c
> @@ -498,7 +498,11 @@ int enable_fec_anatop_clock(enum enet_freq freq)
>
> reg = readl(&anatop->pll_enet);
> reg &= ~BM_ANADIG_PLL_ENET_DIV_SELECT;
> - reg |= freq;
> + reg |= BF_ANADIG_PLL_ENET_DIV_SELECT(freq);
> +#ifdef CONFIG_MX6SX
> + reg &= ~BM_ANADIG_PLL_ENET2_DIV_SELECT;
> + reg |= BF_ANADIG_PLL_ENET2_DIV_SELECT(freq);
> +#endif
>
> if ((reg & BM_ANADIG_PLL_ENET_POWERDOWN) ||
> (!(reg & BM_ANADIG_PLL_ENET_LOCK))) {
> @@ -514,6 +518,9 @@ int enable_fec_anatop_clock(enum enet_freq freq)
>
> /* Enable FEC clock */
> reg |= BM_ANADIG_PLL_ENET_ENABLE;
> +#ifdef CONFIG_MX6SX
> + reg |= BM_ANADIG_PLL_ENET2_ENABLE;
> +#endif
> reg &= ~BM_ANADIG_PLL_ENET_BYPASS;
> writel(reg, &anatop->pll_enet);
>
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index 5f5f497..4994eab 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -337,6 +337,29 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
> struct fuse_bank4_regs *fuse =
> (struct fuse_bank4_regs *)bank->fuse_regs;
>
> +#ifdef CONFIG_MX6SX
> + if (0 == dev_id) {
> + u32 value = readl(&fuse->mac_addr_high);
> + mac[0] = (value >> 8);
> + mac[1] = value ;
> +
> + value = readl(&fuse->mac_addr_low);
> + mac[2] = value >> 24 ;
^---
Checkpatch complains about extra spaces.
> + mac[3] = value >> 16 ;
> + mac[4] = value >> 8 ;
> + mac[5] = value ;
> + } else {
> + u32 value = readl(&fuse->mac_addr2);
> + mac[0] = value >> 24 ;
> + mac[1] = value >> 16 ;
> + mac[2] = value >> 8 ;
> + mac[3] = value ;
> +
> + value = readl(&fuse->mac_addr_high);
> + mac[4] = value >> 24 ;
> + mac[5] = value >> 16 ;
Is it desired that the layout is different between the two mac addresses
? As far as I know, MAC_ADDR in fuses is reserved to customers, and it
makes sense they have the same layout.
Is there some reason (that I do not know, obviously) to have them
different ?
> + }
> +#else
> u32 value = readl(&fuse->mac_addr_high);
> mac[0] = (value >> 8);
> mac[1] = value ;
> @@ -346,7 +369,7 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
> mac[3] = value >> 16 ;
> mac[4] = value >> 8 ;
> mac[5] = value ;
> -
> +#endif
> }
> #endif
>
> diff --git a/arch/arm/include/asm/arch-mx6/crm_regs.h b/arch/arm/include/asm/arch-mx6/crm_regs.h
> index 39f3c07..eec03cf 100644
> --- a/arch/arm/include/asm/arch-mx6/crm_regs.h
> +++ b/arch/arm/include/asm/arch-mx6/crm_regs.h
> @@ -1012,6 +1012,13 @@ struct mxc_ccm_reg {
> #define BM_ANADIG_PLL_ENET_DIV_SELECT 0x00000003
> #define BF_ANADIG_PLL_ENET_DIV_SELECT(v) \
> (((v) << 0) & BM_ANADIG_PLL_ENET_DIV_SELECT)
> +#ifdef CONFIG_MX6SX
> +#define BM_ANADIG_PLL_ENET2_ENABLE 0x00100000
> +
> +#define BM_ANADIG_PLL_ENET2_DIV_SELECT 0x0000000C
> +#define BF_ANADIG_PLL_ENET2_DIV_SELECT(v) \
> + (((v) << 2) & BM_ANADIG_PLL_ENET2_DIV_SELECT)
> +#endif
>
> #define BM_ANADIG_PFD_480_PFD3_CLKGATE 0x80000000
> #define BM_ANADIG_PFD_480_PFD3_STABLE 0x40000000
>
Best regards,
Stefano Babic
--
=====================================================================
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
=====================================================================
next prev parent reply other threads:[~2015-02-10 10:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 8:46 [U-Boot] [PATCH 1/4] mx6sx: pins: Enable SION for I2C3 iomux setting Ye.Li
2015-01-12 8:46 ` [U-Boot] [PATCH 2/4] mx6: soc: Add ENET2 support Ye.Li
2015-02-10 10:22 ` Stefano Babic [this message]
2015-02-11 2:42 ` Li Ye-B37916
2015-02-11 12:46 ` Stefano Babic
2015-01-12 8:46 ` [U-Boot] [PATCH 3/4] mx6: clock: Modify GPMI clock to support mx6sx Ye.Li
2015-02-10 10:26 ` Stefano Babic
2015-02-11 3:14 ` Li Ye-B37916
2015-02-11 12:48 ` Stefano Babic
2015-01-12 8:46 ` [U-Boot] [PATCH 4/4] imx: mx6sxsabreauto: Add support for mx6sx SABREAUTO board Ye.Li
2015-02-10 10:51 ` Stefano Babic
2015-02-11 9:43 ` Li Ye-B37916
2015-02-11 13:21 ` Peng Fan
2015-01-12 10:37 ` [U-Boot] [PATCH 1/4] mx6sx: pins: Enable SION for I2C3 iomux setting Nikolay Dimitrov
2015-01-29 17:54 ` Stefano Babic
2015-02-09 13:27 ` Li Ye-B37916
2015-02-10 10:18 ` Stefano Babic
2015-02-15 15:11 ` Nikolay Dimitrov
2015-02-15 16:23 ` Stefano Babic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54D9DBD9.70009@denx.de \
--to=sbabic@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.