powerpc/52xx: Remove dead code, i.e. mpc52xx_get_xtal_freq()
Subsystems (11)
PATCH 1/4 powerpc/52xx: Remove dead code, i.e. mpc52xx_get_xtal_freq()
It seems mpc52xx_get_xtal_freq() is not used anywhere. Remove dead code.
--- arch/powerpc/include/asm/mpc52xx.h | 1 - arch/powerpc/platforms/52xx/mpc52xx_common.c | 37 -------------------- 2 files changed, 38 deletions(-)
arch/powerpc/include/asm/mpc52xx.h +0 -1
@@ -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 */
arch/powerpc/platforms/52xx/mpc52xx_common.c +0 -37
@@ -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 */
Signature · 1 line
2.35.1
PATCH 4/4 powerpc/52xx: Convert to use fwnode API
We may convert the GPT driver to use fwnode API for the sake of consistency of the used APIs inside the driver.
--- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 47 +++++++++++------------ 1 file changed, 22 insertions(+), 25 deletions(-)
arch/powerpc/platforms/52xx/mpc52xx_gpt.c +22 -25
@@ -53,10 +53,9 @@#include <linux/interrupt.h> #include <linux/io.h> #include <linux/list.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> #include <linux/mutex.h> -#include <linux/of.h> -#include <linux/of_platform.h> -#include <linux/of_gpio.h> #include <linux/kernel.h> #include <linux/property.h> #include <linux/slab.h>
@@ -64,7 +63,7 @@#include <linux/watchdog.h> #include <linux/miscdevice.h> #include <linux/uaccess.h> -#include <linux/module.h> +#include <asm/div64.h> #include <asm/mpc52xx.h>
@@ -235,18 +234,17 @@ static const struct irq_domain_ops mpc52xx_gpt_irq_ops = { .xlate = mpc52xx_gpt_irq_xlate, }; -static void -mpc52xx_gpt_irq_setup (struct mpc52xx_gpt_priv *gpt,struct device_node *node) +static void mpc52xx_gpt_irq_setup (struct mpc52xx_gpt_priv *gpt) {int cascade_virq;unsigned long flags;u32 mode; - cascade_virq =irq_of_parse_and_map (node,0 ); -if (!cascade_virq) + cascade_virq =platform_get_irq (to_platform_device (gpt->dev),0 ); +if (cascade_virq <0 )return ; - gpt->irqhost =irq_domain_add_linear (node,1 , &mpc52xx_gpt_irq_ops, gpt); + gpt->irqhost =irq_domain_create_linear (dev_fwnode (gpt->dev),1 , &mpc52xx_gpt_irq_ops, gpt);if (!gpt->irqhost) {dev_err (gpt->dev,"irq_domain_add_linear() failed\n" );return ;
@@ -670,8 +668,7 @@ static int mpc52xx_gpt_wdt_init(void)return err; } -static int mpc52xx_gpt_wdt_setup (struct mpc52xx_gpt_priv *gpt, -const u32 *period) +static int mpc52xx_gpt_wdt_setup (struct mpc52xx_gpt_priv *gpt,const u32 period) {u64 real_timeout;
@@ -679,14 +676,14 @@ static int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt, mpc52xx_gpt_wdt = gpt;/* configure the wdt if the device tree contained a timeout */ -if (!period || *period ==0 ) +if (period ==0 )return 0 ; - real_timeout = (u64) *period *1000000000ULL ; + real_timeout = (u64 )period *1000000000ULL ;if (mpc52xx_gpt_do_start (gpt, real_timeout,0 ,1 ))dev_warn (gpt->dev,"starting as wdt failed\n" );else -dev_info (gpt->dev,"watchdog set to %us timeout\n" , *period); +dev_info (gpt->dev,"watchdog set to %us timeout\n" , period);return 0 ; }
@@ -697,8 +694,7 @@ static int mpc52xx_gpt_wdt_init(void)return 0 ; } -static inline int mpc52xx_gpt_wdt_setup (struct mpc52xx_gpt_priv *gpt, -const u32 *period) +static inline int mpc52xx_gpt_wdt_setup (struct mpc52xx_gpt_priv *gpt,const u32 period) {return 0 ; }
@@ -726,25 +722,26 @@ static int mpc52xx_gpt_probe(struct platform_device *ofdev)dev_set_drvdata (&ofdev->dev, gpt);mpc52xx_gpt_gpio_setup (gpt); -mpc52xx_gpt_irq_setup (gpt, ofdev->dev.of_node); +mpc52xx_gpt_irq_setup (gpt);mutex_lock (&mpc52xx_gpt_list_mutex);list_add (&gpt->list, &mpc52xx_gpt_list);mutex_unlock (&mpc52xx_gpt_list_mutex);/* check if this device could be a watchdog */ -if (of_get_property (ofdev->dev.of_node,"fsl,has-wdt" ,NULL ) || -of_get_property (ofdev->dev.of_node,"has-wdt" ,NULL )) { -const u32 *on_boot_wdt; +if (device_property_present (gpt->dev,"fsl,has-wdt" ) || +device_property_present (gpt->dev,"has-wdt" )) { +u32 on_boot_wdt =0 ; +int ret; gpt->wdt_mode = MPC52xx_GPT_CAN_WDT; - on_boot_wdt =of_get_property (ofdev->dev.of_node, -"fsl,wdt-on-boot" ,NULL ); -if (on_boot_wdt) { + ret =device_property_read_u32 (gpt->dev,"fsl,wdt-on-boot" , &on_boot_wdt); +if (ret) { +dev_info (gpt->dev,"can function as watchdog\n" ); + }else {dev_info (gpt->dev,"used as watchdog\n" ); gpt->wdt_mode |= MPC52xx_GPT_IS_WDT; - }else -dev_info (gpt->dev,"can function as watchdog\n" ); + }mpc52xx_gpt_wdt_setup (gpt, on_boot_wdt); }
Signature · 1 line
2.35.1
PATCH 2/4 powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoSwitch 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.
--- 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(-)
arch/powerpc/include/asm/mpc5xxx.h +8 -1
@@ -11,7 +11,14 @@#ifndef __ASM_POWERPC_MPC5xxx_H__#define __ASM_POWERPC_MPC5xxx_H__ -extern unsigned long mpc5xxx_get_bus_frequency (struct device_node *node); +#include <linux/property.h> + +unsigned long mpc5xxx_fwnode_get_bus_frequency (struct fwnode_handle *fwnode); + +static inline unsigned long mpc5xxx_get_bus_frequency (struct device *dev) +{ +return mpc5xxx_fwnode_get_bus_frequency (dev_fwnode (dev)); +}#endif /* __ASM_POWERPC_MPC5xxx_H__ */
arch/powerpc/platforms/52xx/mpc52xx_gpt.c +1 -1
@@ -720,7 +720,7 @@ static int mpc52xx_gpt_probe(struct platform_device *ofdev)raw_spin_lock_init (&gpt->lock); gpt->dev = &ofdev->dev; - gpt->ipb_freq =mpc5xxx_get_bus_frequency (ofdev->dev.of_node); + gpt->ipb_freq =mpc5xxx_get_bus_frequency (&ofdev->dev); gpt->regs =of_iomap (ofdev->dev.of_node,0 );if (!gpt->regs)return -ENOMEM ;
arch/powerpc/sysdev/mpc5xxx_clocks.c +22 -19
53 lines not on this page · raw message
drivers/ata/pata_mpc52xx.c +1 -1
@@ -683,7 +683,7 @@ static int mpc52xx_ata_probe(struct platform_device *op)struct bcom_task *dmatsk;/* Get ipb frequency */ - ipb_freq =mpc5xxx_get_bus_frequency (op->dev.of_node); + ipb_freq =mpc5xxx_get_bus_frequency (&op->dev);if (!ipb_freq) {dev_err (&op->dev,"could not determine IPB bus frequency\n" );return -ENODEV ;
drivers/i2c/busses/i2c-mpc.c +4 -3
@@ -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);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; }
drivers/net/can/mscan/mpc5xxx_can.c +1 -1
@@ -63,7 +63,7 @@ static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,else *mscan_clksrc =MSCAN_CLKSRC_XTAL ; - freq =mpc5xxx_get_bus_frequency (ofdev->dev.of_node); + freq =mpc5xxx_get_bus_frequency (&ofdev->dev);if (!freq)return 0 ;
drivers/net/ethernet/freescale/fec_mpc52xx.c +1 -1
@@ -922,7 +922,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)/* Start with safe defaults for link connection */ priv->speed =100 ; priv->duplex =DUPLEX_HALF ; - priv->mdio_speed = ((mpc5xxx_get_bus_frequency (np) >>20 ) /5 ) <<1 ; + priv->mdio_speed = ((mpc5xxx_get_bus_frequency (&op->dev) >>20 ) /5 ) <<1 ;/* The current speed preconfigures the speed of the MII link */ prop =of_get_property (np,"current-speed" , &prop_size);
drivers/net/ethernet/freescale/fec_mpc52xx_phy.c +1 -2
@@ -99,8 +99,7 @@ static int mpc52xx_fec_mdio_probe(struct platform_device *of)dev_set_drvdata (dev, bus);/* set MII speed */ -out_be32 (&priv->regs->mii_speed, - ((mpc5xxx_get_bus_frequency (of->dev.of_node) >>20 ) /5 ) <<1 ); +out_be32 (&priv->regs->mii_speed, ((mpc5xxx_get_bus_frequency (dev) >>20 ) /5 ) <<1 ); err =of_mdiobus_register (bus, np);if (err)
drivers/net/ethernet/freescale/fs_enet/mii-fec.c +2 -2
@@ -102,7 +102,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev)struct resource res;struct mii_bus *new_bus;struct fec_info *fec; -int (*get_bus_freq)(struct device_node *); +int (*get_bus_freq)(struct device *);int ret = -ENOMEM , clock, speed; match =of_match_device (fs_enet_mdio_fec_match, &ofdev->dev);
@@ -136,7 +136,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) }if (get_bus_freq) { - clock =get_bus_freq (ofdev->dev.of_node); + clock =get_bus_freq (&ofdev->dev);if (!clock) {/* Use maximum divider if clock is unknown */ dev_warn (&ofdev->dev,"could not determine IPS clock\n" );
drivers/spi/spi-mpc52xx.c +1 -1
@@ -437,7 +437,7 @@ static int mpc52xx_spi_probe(struct platform_device *op) ms->irq0 =irq_of_parse_and_map (op->dev.of_node,0 ); ms->irq1 =irq_of_parse_and_map (op->dev.of_node,1 ); ms->state = mpc52xx_spi_fsmstate_idle; - ms->ipb_freq =mpc5xxx_get_bus_frequency (op->dev.of_node); + ms->ipb_freq =mpc5xxx_get_bus_frequency (&op->dev); ms->gpio_cs_count =of_gpio_count (op->dev.of_node);if (ms->gpio_cs_count >0 ) { master->num_chipselect = ms->gpio_cs_count;
drivers/tty/serial/mpc52xx_uart.c +2 -2
@@ -1630,7 +1630,7 @@ mpc52xx_console_setup(struct console *co, char *options)return ret; } - uartclk =mpc5xxx_get_bus_frequency (np); + uartclk =mpc5xxx_fwnode_get_bus_frequency (of_fwnode_handle (np));if (uartclk ==0 ) {pr_debug ("Could not find uart clock frequency!\n" );return -EINVAL ;
@@ -1747,7 +1747,7 @@ static int mpc52xx_uart_of_probe(struct platform_device *op)/* set the uart clock to the input clock of the psc, the different * prescalers are taken into account in the set_baudrate() methods * of the respective chip */ - uartclk =mpc5xxx_get_bus_frequency (op->dev.of_node); + uartclk =mpc5xxx_get_bus_frequency (&op->dev);if (uartclk ==0 ) {dev_dbg (&op->dev,"Could not find uart clock frequency!\n" );return -EINVAL ;
Signature · 1 line
2.35.1
PATCH 3/4 powerpc/52xx: Get rid of of_node assignment
In reply to Andy ShevchenkoLet GPIO library assign of_node from the parent device. This allows to move GPIO library and drivers to use fwnode APIs instead of being stuck with OF-only interfaces.
--- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
arch/powerpc/platforms/52xx/mpc52xx_gpt.c +8 -10
@@ -58,6 +58,7 @@#include <linux/of_platform.h> #include <linux/of_gpio.h> #include <linux/kernel.h> +#include <linux/property.h> #include <linux/slab.h> #include <linux/fs.h> #include <linux/watchdog.h>
@@ -314,17 +315,15 @@ mpc52xx_gpt_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)return 0 ; } -static void -mpc52xx_gpt_gpio_setup (struct mpc52xx_gpt_priv *gpt,struct device_node *node) +static void mpc52xx_gpt_gpio_setup (struct mpc52xx_gpt_priv *gpt) {int rc; -/* Only setup GPIO if the device tree claims the GPT is -* a GPIO controller */ -if (!of_find_property (node,"gpio-controller" ,NULL )) +/* Only setup GPIO if the device claims the GPT is a GPIO controller */ +if (!device_property_present (gpt->dev,"gpio-controller" ))return ; - gpt->gc.label =kasprintf (GFP_KERNEL ,"%pOF" , node); + gpt->gc.label =kasprintf (GFP_KERNEL ,"%pfw" ,dev_fwnode (gpt->dev));if (!gpt->gc.label) {dev_err (gpt->dev,"out of memory\n" );return ;
@@ -336,7 +335,7 @@ mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node) gpt->gc.get = mpc52xx_gpt_gpio_get; gpt->gc.set = mpc52xx_gpt_gpio_set; gpt->gc.base =-1 ; - gpt->gc.of_node = node; + gpt->gc.parent = gpt->dev;/* Setup external pin in GPIO mode */ clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK,
@@ -349,8 +348,7 @@ mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node) dev_dbg(gpt->dev, "%s() complete.\n", __func__); }#else /* defined(CONFIG_GPIOLIB) */ -static void -mpc52xx_gpt_gpio_setup (struct mpc52xx_gpt_priv *p,struct device_node *np) { } +static void mpc52xx_gpt_gpio_setup (struct mpc52xx_gpt_priv *gpt) { }#endif /* defined(CONFIG_GPIOLIB) */ /***********************************************************************
@@ -727,7 +725,7 @@ static int mpc52xx_gpt_probe(struct platform_device *ofdev)dev_set_drvdata (&ofdev->dev, gpt); -mpc52xx_gpt_gpio_setup (gpt, ofdev->dev.of_node); +mpc52xx_gpt_gpio_setup (gpt);mpc52xx_gpt_irq_setup (gpt, ofdev->dev.of_node);mutex_lock (&mpc52xx_gpt_list_mutex);
Signature · 1 line
2.35.1
Re: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoQuoted 6 lines · Andy Shevchenko
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 <[email protected]>
Quoted 13 lines
--- 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(-)
regards,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoQuoted 6 lines · Andy Shevchenko
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 <[email protected]>
For the pata bits,
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoQuoted 2 lines · Andy Shevchenko
Switch
mpc5xxx_get_bus_frequency()to use fwnode in order to help cleaning up other parts of the kernel from OF specific code.
Wow, MPC5200, that was a long time ago for me...
Quoted 1 line
It seems
mpc52xx_get_xtal_freq()is not used anywhere. Remove dead code.
Looks like it.
Re: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoQuoted 6 lines · Andy Shevchenko
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 <[email protected]>
Re: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoOn 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.
--- 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(-)
kernel test robot
build botRe: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoI love your patch! Perhaps something to improve:
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on wsa/i2c/for-next mkl-can-next/testing broonie-spi/for-next tty/tty-testing linus/master v5.18-rc5 next-20220504] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/powerpc-52xx-Remove-dead-code-i-e-mpc52xx_get_xtal_freq/20220504-215701 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-pcm030_defconfig (https://download.01.org/0day-ci/archive/20220505/[email protected]/config) compiler: powerpc-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/7bff10cee4f441153a56de337715dd4f40c55521
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/powerpc-52xx-Remove-dead-code-i-e-mpc52xx_get_xtal_freq/20220504-215701 git checkout 7bff10cee4f441153a56de337715dd4f40c55521
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/i2c/busses/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/i2c/busses/i2c-mpc.c: In function 'mpc_i2c_get_fdr_52xx':
drivers/i2c/busses/i2c-mpc.c:242:30: error: expected identifier or '(' before '=' token
242 | struct fwnode_handle = of_fwnode_handle(node);
| ^
In file included from include/linux/of_address.h:6,
from drivers/i2c/busses/i2c-mpc.c:14:
include/linux/of.h:176:10: error: expected statement before ')' token
176 | })
| ^
drivers/i2c/busses/i2c-mpc.c:242:32: note: in expansion of macro 'of_fwnode_handle'
242 | struct fwnode_handle = of_fwnode_handle(node);
| ^~~~~~~~~~~~~~~~
>> drivers/i2c/busses/i2c-mpc.c:243:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
243 | const struct mpc_i2c_divider *div = NULL;
| ^~~~~
drivers/i2c/busses/i2c-mpc.c:250:62: error: 'fwnode' undeclared (first use in this function); did you mean 'node'?
250 | *real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / 2048;
| ^~~~~~
| node drivers/i2c/busses/i2c-mpc.c:250:62: note: each undeclared identifier is reported only once for each function it appears in
vim +243 drivers/i2c/busses/i2c-mpc.c
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 238
0b255e927d47b55 Bill Pemberton 2012-11-27 239 static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
38a99bd7730efdd Arseny Solokha 2018-01-10 240 u32 *real_clk)
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 241 {
7bff10cee4f4411 Andy Shevchenko 2022-05-04 242 struct fwnode_handle = of_fwnode_handle(node);
1904b03430ade1c Wolfgang Grandegger 2009-04-09 @243 const struct mpc_i2c_divider *div = NULL;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 244 unsigned int pvr = mfspr(SPRN_PVR);
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 245 u32 divider;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 246 int i;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 247
0c2daaafcdec726 Albrecht Dreß 2010-02-17 248 if (clock == MPC_I2C_CLOCK_LEGACY) {
0c2daaafcdec726 Albrecht Dreß 2010-02-17 249 /* see below - default fdr = 0x3f -> div = 2048 */
7bff10cee4f4411 Andy Shevchenko 2022-05-04 250 *real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / 2048;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 251 return -EINVAL;
0c2daaafcdec726 Albrecht Dreß 2010-02-17 252 }
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 253
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 254 /* Determine divider value */
7bff10cee4f4411 Andy Shevchenko 2022-05-04 255 divider = mpc5xxx_fwnode_get_bus_frequency(fwnode) / clock;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 256
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 257 /*
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 258 * We want to choose an FDR/DFSR that generates an I2C bus speed that
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 259 * is equal to or lower than the requested speed.
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 260 */
1904b03430ade1c Wolfgang Grandegger 2009-04-09 261 for (i = 0; i < ARRAY_SIZE(mpc_i2c_dividers_52xx); i++) {
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 262 div = &mpc_i2c_dividers_52xx[i];
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 263 /* Old MPC5200 rev A CPUs do not support the high bits */
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 264 if (div->fdr & 0xc0 && pvr == 0x80822011)
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 265 continue;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 266 if (div->divider >= divider)
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 267 break;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 268 }
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 269
7bff10cee4f4411 Andy Shevchenko 2022-05-04 270 *real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / div->divider;0c2daaafcdec726 Albrecht Dreß 2010-02-17 271 return (int)div->fdr;f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 272 } f2bd5efe7238149 Wolfgang Grandegger 2009-04-07 273
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
Chris Packham
maintainerRe: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoQuoted 19 lines · Andy Shevchenko
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 <[email protected]>--- 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>
drivers/i2c/busses/i2c-mpc.c static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { · line 242
Quoted 9 lines
drivers/i2c/busses/i2c-mpc.c +1
-0@@ -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);
Quoted 27 lines
drivers/i2c/busses/i2c-mpc.c +3
-3const 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; }
kernel test robot
build botRe: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on powerpc/next]
[also build test ERROR on wsa/i2c/for-next mkl-can-next/testing broonie-spi/for-next tty/tty-testing linus/master v5.18-rc5 next-20220504] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/powerpc-52xx-Remove-dead-code-i-e-mpc52xx_get_xtal_freq/20220504-215701 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-pcm030_defconfig (https://download.01.org/0day-ci/archive/20220505/[email protected]/config) compiler: powerpc-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/7bff10cee4f441153a56de337715dd4f40c55521
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/powerpc-52xx-Remove-dead-code-i-e-mpc52xx_get_xtal_freq/20220504-215701 git checkout 7bff10cee4f441153a56de337715dd4f40c55521
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/i2c/busses/i2c-mpc.c: In function 'mpc_i2c_get_fdr_52xx':
>> drivers/i2c/busses/i2c-mpc.c:242:30: error: expected identifier or '(' before '=' token
242 | struct fwnode_handle = of_fwnode_handle(node);
| ^
In file included from include/linux/of_address.h:6,
from drivers/i2c/busses/i2c-mpc.c:14:
>> include/linux/of.h:176:10: error: expected statement before ')' token
176 | })
| ^
drivers/i2c/busses/i2c-mpc.c:242:32: note: in expansion of macro 'of_fwnode_handle'
242 | struct fwnode_handle = of_fwnode_handle(node);
| ^~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-mpc.c:243:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
243 | const struct mpc_i2c_divider *div = NULL;
| ^~~~~
>> drivers/i2c/busses/i2c-mpc.c:250:62: error: 'fwnode' undeclared (first use in this function); did you mean 'node'?
250 | *real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / 2048;
| ^~~~~~
| node drivers/i2c/busses/i2c-mpc.c:250:62: note: each undeclared identifier is reported only once for each function it appears in
vim +242 drivers/i2c/busses/i2c-mpc.c
238
239 static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
240 u32 *real_clk)
241 {
> 242 struct fwnode_handle = of_fwnode_handle(node);
243 const struct mpc_i2c_divider *div = NULL;
244 unsigned int pvr = mfspr(SPRN_PVR);
245 u32 divider;
246 int i;
247
248 if (clock == MPC_I2C_CLOCK_LEGACY) {
249 /* see below - default fdr = 0x3f -> div = 2048 */
> 250 *real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / 2048; 251 return -EINVAL;
252 }
253
254 /* Determine divider value */
255 divider = mpc5xxx_fwnode_get_bus_frequency(fwnode) / clock;
256
257 /*
258 * We want to choose an FDR/DFSR that generates an I2C bus speed that
259 * is equal to or lower than the requested speed.
260 */
261 for (i = 0; i < ARRAY_SIZE(mpc_i2c_dividers_52xx); i++) {
262 div = &mpc_i2c_dividers_52xx[i];
263 /* Old MPC5200 rev A CPUs do not support the high bits */
264 if (div->fdr & 0xc0 && pvr == 0x80822011)
265 continue;
266 if (div->divider >= divider)
267 break;
268 }
269
270 *real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / div->divider;
271 return (int)div->fdr;
272 }
273
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp