public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 10/14] imx: clock: Introduce set_fec_clock() to configure ETH clock (imx6)
Date: Wed, 2 Jan 2019 10:00:18 +0100	[thread overview]
Message-ID: <20190102100007.47918c0f@jawa> (raw)
In-Reply-To: <9570acbe-f6c7-d900-fc05-a0337d42f2bb@denx.de>

Hi Marek,

> On 1/2/19 12:37 AM, Lukasz Majewski wrote:
> > This patch provides a generic way to setup ENET (ETH) clocks for
> > imx6(q) based boards. Previously this was performed per board in the
> > board_eth_init() function.
> > 
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > ---
> > 
> >  arch/arm/include/asm/arch-mx6/clock.h |  1 +
> >  arch/arm/mach-imx/mx6/clock.c         | 17 +++++++++++++++++
> >  2 files changed, 18 insertions(+)
> > 
> > diff --git a/arch/arm/include/asm/arch-mx6/clock.h
> > b/arch/arm/include/asm/arch-mx6/clock.h index
> > a9481a5fea..9a217349f5 100644 ---
> > a/arch/arm/include/asm/arch-mx6/clock.h +++
> > b/arch/arm/include/asm/arch-mx6/clock.h @@ -72,6 +72,7 @@ int
> > enable_i2c_clk(unsigned char enable, unsigned i2c_num); int
> > enable_spi_clk(unsigned char enable, unsigned spi_num); void
> > enable_ipu_clock(void); int enable_fec_anatop_clock(int fec_id,
> > enum enet_freq freq); +int set_fec_clock(int fec_id, enum enet_freq
> > freq); void enable_enet_clk(unsigned char enable);
> >  int enable_lcdif_clock(u32 base_addr, bool enable);
> >  void enable_qspi_clk(int qspi_num);
> > diff --git a/arch/arm/mach-imx/mx6/clock.c
> > b/arch/arm/mach-imx/mx6/clock.c index 366a4e3c6b..8a4fb23090 100644
> > --- a/arch/arm/mach-imx/mx6/clock.c
> > +++ b/arch/arm/mach-imx/mx6/clock.c
> > @@ -902,6 +902,17 @@ void enable_qspi_clk(int qspi_num)
> >  #endif
> >  
> >  #ifdef CONFIG_FEC_MXC
> > +static void select_fec_clock_source(int fec_id)  
> 
> How is the fec_id() used in here ?

I guess that you refer to "int fec_id."

> Shouldn't this be part of
> enable_fec_anatop_clock() ?

The enable_fec_anatop_clock() function is used on several board files
- for example:
http://git.denx.de/?p=u-boot.git;a=blob;f=board/dhelectronics/dh_imx6/dh_imx6.c;h=f9ac5c10e1dc954b64605a1c4f84a6c819d183a7;hb=HEAD#l154

And changing it could break some boards.

The select_fec_clock_source() shall be used to replace several:
	clrsetbits_le32(&iomuxc_regs->gpr[1], 0x1 << 21, 0x1 << 21);

clauses for imx6 variants.

Moreover, I'd pass 'fec_id' parameter anyway - it may be needed by other
imx6 variants.

> 
> > +{
> > +	struct iomuxc *iomuxc_regs = (struct iomuxc
> > *)IOMUXC_BASE_ADDR; +
> > +	if (is_mx6dq()) {
> > +		/* set gpr1[21] to select anatop clock */
> > +		setbits_le32(&iomuxc_regs->gpr[1],
> > +			     IOMUXC_GPR1_ENET_CLK_SEL_MASK);
> > +	}
> > +}
> > +
> >  int enable_fec_anatop_clock(int fec_id, enum enet_freq freq)
> >  {
> >  	u32 reg = 0;
> > @@ -976,6 +987,12 @@ int enable_fec_anatop_clock(int fec_id, enum
> > enet_freq freq) #endif
> >  	return 0;
> >  }
> > +
> > +int set_fec_clock(int fec_id, enum enet_freq freq)
> > +{
> > +	select_fec_clock_source(fec_id);
> > +	return enable_fec_anatop_clock(fec_id, freq);
> > +}
> >  #endif
> >  
> >  static u32 get_usdhc_clk(u32 port)
> >   
> 
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190102/c52c5dc6/attachment.sig>

  reply	other threads:[~2019-01-02  9:00 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01 23:37 [U-Boot] [PATCH v1 00/14] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski
2019-01-01 23:37 ` [U-Boot] [PATCH v1 01/14] tpc70: config: Add script commands to update u-boot and OE's wic Lukasz Majewski
2019-01-02  1:07   ` Marek Vasut
2019-01-02  9:50     ` Lukasz Majewski
2019-01-02 14:09       ` Marek Vasut
2019-01-01 23:37 ` [U-Boot] [PATCH v1 02/14] tpc70: config: Update TPC70 config to support eMMC's boot0 SPL update Lukasz Majewski
2019-01-02  1:08   ` Marek Vasut
2019-01-02  9:47     ` Lukasz Majewski
2019-01-02 14:09       ` Marek Vasut
2019-01-01 23:37 ` [U-Boot] [PATCH v1 03/14] tpc70: Provide board_boot_order() function to distinct between eMMC and SD boot Lukasz Majewski
2019-01-05  1:57   ` Simon Glass
2019-01-01 23:37 ` [U-Boot] [PATCH v1 04/14] DTS: imx: Remove not needed '#address-cells' and '#size-cells' properties Lukasz Majewski
2019-01-02  1:09   ` Marek Vasut
2019-01-02  9:43     ` Lukasz Majewski
2019-01-02 14:10       ` Marek Vasut
2019-01-02 14:34         ` Lukasz Majewski
2019-01-01 23:37 ` [U-Boot] [PATCH v1 05/14] board: cosmetic: Use define to set ENET clock selection mask on TPC70 Lukasz Majewski
2019-01-02  1:09   ` Marek Vasut
2019-01-02 10:06     ` Lukasz Majewski
2019-01-02 14:12       ` Marek Vasut
2019-01-02 14:37         ` Lukasz Majewski
2019-01-01 23:37 ` [U-Boot] [PATCH v1 06/14] DM: tpc70: led: Enable LED default state Lukasz Majewski
2019-01-01 23:37 ` [U-Boot] [PATCH v1 07/14] pinctrl: imx: Replace static soc info definitions with run time allocations Lukasz Majewski
2019-01-02  1:13   ` Marek Vasut
2019-01-02  8:26     ` Lukasz Majewski
2019-01-02 14:14       ` Marek Vasut
2019-01-03  7:22         ` Lukasz Majewski
2019-01-01 23:37 ` [U-Boot] [PATCH v1 08/14] DTS: imx: Add "u-boot, dm-pre-reloc" property to relevant imx6qdl nodes Lukasz Majewski
2019-01-02  1:13   ` Marek Vasut
2019-01-02  9:23     ` Lukasz Majewski
2019-01-01 23:37 ` [U-Boot] [PATCH v1 09/14] imx: serial: dm: Enable DM_FLAG_PRE_RELOC in the IMX uart driver Lukasz Majewski
2019-01-02  1:14   ` Marek Vasut
2019-01-02  8:42     ` Lukasz Majewski
2019-01-02 14:15       ` Marek Vasut
2019-01-01 23:37 ` [U-Boot] [PATCH v1 10/14] imx: clock: Introduce set_fec_clock() to configure ETH clock (imx6) Lukasz Majewski
2019-01-02  1:16   ` Marek Vasut
2019-01-02  9:00     ` Lukasz Majewski [this message]
2019-01-02 14:18       ` Marek Vasut
2019-01-01 23:37 ` [U-Boot] [PATCH v1 11/14] DM: net: imx: Provide weak function to initialize fec clocks Lukasz Majewski
2019-01-02  1:17   ` Marek Vasut
2019-01-02  8:47     ` Lukasz Majewski
2019-01-01 23:37 ` [U-Boot] [PATCH v1 12/14] imx: mmc: Use 'fsl, usdhc-index' property to provide esdhc controller number Lukasz Majewski
2019-01-02  1:18   ` Marek Vasut
2019-01-02 10:31     ` Lukasz Majewski
2019-01-02 14:17       ` Marek Vasut
2019-01-01 23:37 ` [U-Boot] [PATCH v1 13/14] DTS: imx: tpc70: Add TPC70 board (imx6q based) device tree description Lukasz Majewski
2019-01-02  1:19   ` Marek Vasut
2019-01-02  8:49     ` Lukasz Majewski
2019-01-02 14:17       ` Marek Vasut
2019-01-01 23:37 ` [U-Boot] [PATCH v1 14/14] imx: tpc70: Convert TPC70 (imx6q based) board to use DM/DTS in SPL and u-boot Lukasz Majewski
2019-01-05  1:57   ` Simon Glass

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=20190102100007.47918c0f@jawa \
    --to=lukma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox