Re: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode

Chris Packham
2022-05-05T00:02:36Z

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;
> }
>