diff mbox series

[v1,1/4] powerpc/52xx: Remove dead code, i.e. mpc52xx_get_xtal_freq()

Message ID 20220504134449.64473-1-andriy.shevchenko@linux.intel.com
State Superseded
Headers show
Series [v1,1/4] powerpc/52xx: Remove dead code, i.e. mpc52xx_get_xtal_freq() | expand

Commit Message

Andy Shevchenko May 4, 2022, 1:44 p.m. UTC
It seems mpc52xx_get_xtal_freq() is not used anywhere. Remove dead code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/powerpc/include/asm/mpc52xx.h           |  1 -
 arch/powerpc/platforms/52xx/mpc52xx_common.c | 37 --------------------
 2 files changed, 38 deletions(-)

Comments

Marc Kleine-Budde May 4, 2022, 2:08 p.m. UTC | #1
On 04.05.2022 16:44:47, Andy Shevchenko wrote:
> Switch mpc5xxx_get_bus_frequency() to use fwnode in order to help
> cleaning up other parts of the kernel from OF specific code.
> 
> No functional change intended.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/powerpc/include/asm/mpc5xxx.h            |  9 +++-
>  arch/powerpc/platforms/52xx/mpc52xx_gpt.c     |  2 +-
>  arch/powerpc/sysdev/mpc5xxx_clocks.c          | 41 ++++++++++---------
>  drivers/ata/pata_mpc52xx.c                    |  2 +-
>  drivers/i2c/busses/i2c-mpc.c                  |  7 ++--
>  drivers/net/can/mscan/mpc5xxx_can.c           |  2 +-
>  drivers/net/ethernet/freescale/fec_mpc52xx.c  |  2 +-
>  .../net/ethernet/freescale/fec_mpc52xx_phy.c  |  3 +-
>  .../net/ethernet/freescale/fs_enet/mii-fec.c  |  4 +-
>  drivers/spi/spi-mpc52xx.c                     |  2 +-
>  drivers/tty/serial/mpc52xx_uart.c             |  4 +-
>  11 files changed, 44 insertions(+), 34 deletions(-)

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for mscan/mpc5xxx_can

regards,
Marc
Wolfram Sang May 4, 2022, 8:11 p.m. UTC | #2
On Wed, May 04, 2022 at 04:44:47PM +0300, Andy Shevchenko wrote:
> Switch mpc5xxx_get_bus_frequency() to use fwnode in order to help
> cleaning up other parts of the kernel from OF specific code.
> 
> No functional change intended.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Wolfram Sang <wsa@kernel.org> # for the I2C part
Chris Packham May 4, 2022, 11:52 p.m. UTC | #3
On 5/05/22 01:44, Andy Shevchenko wrote:
> Switch mpc5xxx_get_bus_frequency() to use fwnode in order to help
> cleaning up other parts of the kernel from OF specific code.
>
> No functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   arch/powerpc/include/asm/mpc5xxx.h            |  9 +++-
>   arch/powerpc/platforms/52xx/mpc52xx_gpt.c     |  2 +-
>   arch/powerpc/sysdev/mpc5xxx_clocks.c          | 41 ++++++++++---------
>   drivers/ata/pata_mpc52xx.c                    |  2 +-
>   drivers/i2c/busses/i2c-mpc.c                  |  7 ++--
>   drivers/net/can/mscan/mpc5xxx_can.c           |  2 +-
>   drivers/net/ethernet/freescale/fec_mpc52xx.c  |  2 +-
>   .../net/ethernet/freescale/fec_mpc52xx_phy.c  |  3 +-
>   .../net/ethernet/freescale/fs_enet/mii-fec.c  |  4 +-
>   drivers/spi/spi-mpc52xx.c                     |  2 +-
>   drivers/tty/serial/mpc52xx_uart.c             |  4 +-
>   11 files changed, 44 insertions(+), 34 deletions(-)
<snip>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index 6c698c10d3cd..2030668ecde5 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -239,6 +239,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
>   static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
>   					  u32 *real_clk)
>   {
> +	struct fwnode_handle = of_fwnode_handle(node);

I think you mean

+       struct fwnode_handle *fwnode = of_fwnode_handle(node);

>   	const struct mpc_i2c_divider *div = NULL;
>   	unsigned int pvr = mfspr(SPRN_PVR);
>   	u32 divider;
> @@ -246,12 +247,12 @@ static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
>   
>   	if (clock == MPC_I2C_CLOCK_LEGACY) {
>   		/* see below - default fdr = 0x3f -> div = 2048 */
> -		*real_clk = mpc5xxx_get_bus_frequency(node) / 2048;
> +		*real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / 2048;
>   		return -EINVAL;
>   	}
>   
>   	/* Determine divider value */
> -	divider = mpc5xxx_get_bus_frequency(node) / clock;
> +	divider = mpc5xxx_fwnode_get_bus_frequency(fwnode) / clock;
>   
>   	/*
>   	 * We want to choose an FDR/DFSR that generates an I2C bus speed that
> @@ -266,7 +267,7 @@ static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
>   			break;
>   	}
>   
> -	*real_clk = mpc5xxx_get_bus_frequency(node) / div->divider;
> +	*real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / div->divider;
>   	return (int)div->fdr;
>   }
>
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
index ce1e0aabaa64..ddd80aae1e32 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -274,7 +274,6 @@  extern void mpc52xx_declare_of_platform_devices(void);
 extern int mpc5200_psc_ac97_gpio_reset(int psc_number);
 extern void mpc52xx_map_common_devices(void);
 extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
-extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);
 extern void __noreturn mpc52xx_restart(char *cmd);
 
 /* mpc52xx_gpt.c */
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 565e3a83dc9e..4a39e1cb2263 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -203,43 +203,6 @@  int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv)
 }
 EXPORT_SYMBOL(mpc52xx_set_psc_clkdiv);
 
-/**
- * mpc52xx_get_xtal_freq - Get SYS_XTAL_IN frequency for a device
- *
- * @node: device node
- *
- * Returns the frequency of the external oscillator clock connected
- * to the SYS_XTAL_IN pin, or 0 if it cannot be determined.
- */
-unsigned int mpc52xx_get_xtal_freq(struct device_node *node)
-{
-	u32 val;
-	unsigned int freq;
-
-	if (!mpc52xx_cdm)
-		return 0;
-
-	freq = mpc5xxx_get_bus_frequency(node);
-	if (!freq)
-		return 0;
-
-	if (in_8(&mpc52xx_cdm->ipb_clk_sel) & 0x1)
-		freq *= 2;
-
-	val  = in_be32(&mpc52xx_cdm->rstcfg);
-	if (val & (1 << 5))
-		freq *= 8;
-	else
-		freq *= 4;
-	if (val & (1 << 6))
-		freq /= 12;
-	else
-		freq /= 16;
-
-	return freq;
-}
-EXPORT_SYMBOL(mpc52xx_get_xtal_freq);
-
 /**
  * mpc52xx_restart: ppc_md->restart hook for mpc5200 using the watchdog timer
  */