public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb•de>
To: linuxppc-dev@ozlabs•org
Cc: linuxppc-dev@ozlabs•org, paulus@samba•org
Subject: Re: [PATCH v3 3/9] add Freescale SerDes PHY support
Date: Fri, 12 Oct 2007 16:33:48 +0200	[thread overview]
Message-ID: <200710121633.49263.arnd@arndb.de> (raw)
In-Reply-To: <1192195728-24189-4-git-send-email-leoli@freescale.com>

On Friday 12 October 2007, Li Yang wrote:
> The SerDes(serializer/deserializer) PHY block is a new SoC block used
> in Freescale chips to support multiple serial interfaces, such as PCI
> Express, SGMII, SATA.

Some of my comments here are similar to those for the ata driver,
so I won't be as verbose here

> +static int __init setup_serdes(struct device_node *np)
> +{
> +	void __iomem *regs;
> +	const void *prot;
> +	const unsigned int *freq;
> +	struct resource res;
> +	u32 rfcks;
> +
> +	of_address_to_resource(np, 0, &res);
> +	regs = ioremap(res.start, res.end - res.start + 1);

of_iomap?

Also, shouldn't there be a matching iounmap?

> +static int __init fsl_serdes_init(void) {
> +	struct device_node *np;
> +
> +	for (np = NULL; (np = of_find_compatible_node(np, NULL, "fsl,serdes")) != NULL;)
> +		setup_serdes(np);
> +
> +	return 0;
> +}
> +
> +arch_initcall(fsl_serdes_init);

I suppose the reason why you can't use an of_platform_device here is that
the serdes node is a child of the actual device that is using the serdes
interface, right?

Could you perhaps call fsl_serdes_init from all the drivers that can have
a serdes attachment, and pass the parent device into the setup function? 

> diff --git a/arch/powerpc/sysdev/fsl_serdes.h b/arch/powerpc/sysdev/fsl_serdes.h
> new file mode 100644
> index 0000000..d4e5570
> --- /dev/null
> +++ b/arch/powerpc/sysdev/fsl_serdes.h
> @@ -0,0 +1,36 @@
> +/*
> + * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation;  either version 2 of the License, or (at your
> + * option) any later version.
> + */
> +
> +/* SerDes registers */
> +#define FSL_SRDSCR0_OFFS		0x0
> +#define FSL_SRDSCR0_DPP_1V2		0x00008800
> +#define FSL_SRDSCR1_OFFS		0x4
> +#define FSL_SRDSCR1_PLLBW		0x00000040
> +#define FSL_SRDSCR2_OFFS		0x8
> +#define FSL_SRDSCR2_VDD_1V2		0x00800000
> +#define FSL_SRDSCR2_SEIC_MASK		0x00001c1c
> +#define FSL_SRDSCR2_SEIC_SATA		0x00001414
> +#define FSL_SRDSCR2_SEIC_PEX		0x00001010
> +#define FSL_SRDSCR2_SEIC_SGMII		0x00000101
> +#define FSL_SRDSCR3_OFFS		0xc
> +#define FSL_SRDSCR3_KFR_SATA		0x10100000
> +#define FSL_SRDSCR3_KPH_SATA		0x04040000
> +#define FSL_SRDSCR3_SDFM_SATA_PEX	0x01010000
> +#define FSL_SRDSCR3_SDTXL_SATA		0x00000505
> +#define FSL_SRDSCR4_OFFS		0x10
> +#define FSL_SRDSCR4_PROT_SATA		0x00000808
> +#define FSL_SRDSCR4_PROT_PEX		0x00000101
> +#define FSL_SRDSCR4_PROT_SGMII		0x00000505
> +#define FSL_SRDSCR4_PLANE_X2		0x01000000
> +#define FSL_SRDSCR4_RFCKS_100		0x00000000
> +#define FSL_SRDSCR4_RFCKS_125		0x10000000
> +#define FSL_SRDSCR4_RFCKS_150		0x30000000
> +#define FSL_SRDSRSTCTL_OFFS		0x20
> +#define FSL_SRDSRSTCTL_RST		0x80000000
> +#define FSL_SRDSRSTCTL_SATA_RESET	0xf

These can all be moved to the source file so you can kill the
entire header.

	Arnd <><

  parent reply	other threads:[~2007-10-12 14:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-12 13:28 [PATCH v3 0/9] Add MPC837x generic support and MPC837xE MDS support Li Yang
2007-10-12 13:28 ` [PATCH v3 1/9] add e300c4 entry to cputable Li Yang
2007-10-12 13:28   ` [PATCH v3 2/9] ipic: add new interrupts introduced by new chip Li Yang
2007-10-12 13:28     ` [PATCH v3 3/9] add Freescale SerDes PHY support Li Yang
2007-10-12 13:28       ` [PATCH v3 4/9] add platform support for MPC837x MDS board Li Yang
2007-10-12 13:28         ` [PATCH v3 5/9] add documentation for SATA nodes Li Yang
2007-10-12 13:28           ` [PATCH v3 6/9] add documentation for SerDes nodes Li Yang
2007-10-12 13:28             ` [PATCH v3 7/9] ipic: clean up unsupported ack operations Li Yang
2007-10-12 13:28               ` [PATCH v3 8/9] add MPC837x MDS default kernel configuration Li Yang
2007-10-12 13:28                 ` [PATCH v3 9/9] add MPC837x MDS board default device tree Li Yang
2007-10-15  0:37                   ` David Gibson
2007-10-17 13:59                     ` Kumar Gala
2007-10-18 13:46                       ` Li Yang-r58472
2007-10-19 13:04                         ` Kumar Gala
2007-10-12 14:38           ` [PATCH v3 5/9] add documentation for SATA nodes Arnd Bergmann
2007-10-17 13:47         ` [PATCH v3 4/9] add platform support for MPC837x MDS board Kumar Gala
2007-10-18  3:51           ` Li Yang-r58472
2007-10-12 14:33       ` Arnd Bergmann [this message]
2007-10-15 12:30         ` [PATCH v3 3/9] add Freescale SerDes PHY support Li Yang-r58472
2007-10-15 14:10           ` Arnd Bergmann
2007-10-14  5:59       ` Stephen Rothwell
2007-10-17 14:13       ` Kumar Gala
2007-10-18  2:46         ` Li Yang-r58472
2007-10-17 13:45     ` [PATCH v3 2/9] ipic: add new interrupts introduced by new chip Kumar Gala
2007-10-18  4:09       ` Li Yang-r58472

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=200710121633.49263.arnd@arndb.de \
    --to=arnd@arndb$(echo .)de \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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