All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
Date: Tue, 24 Jan 2023 05:25:08 +0800	[thread overview]
Message-ID: <202301240503.znwPtr2z-lkp@intel.com> (raw)
In-Reply-To: <e825b50a843ffe40e33f34e4d858c07c1b2ff259.1674499048.git.geert+renesas@glider.be>

Hi Geert,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.2-rc5 next-20230123]
[cannot apply to mkl-can-next/testing]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geert-Uytterhoeven/dt-bindings-can-renesas-rcar-canfd-R-Car-V3U-is-R-Car-Gen4/20230124-030354
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/e825b50a843ffe40e33f34e4d858c07c1b2ff259.1674499048.git.geert%2Brenesas%40glider.be
patch subject: [PATCH 12/12] can: rcar_canfd: Add transceiver support
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230124/202301240503.znwPtr2z-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.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/d2ab7bc9940c2cb09888ee0f253ca39cadccbc60
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Geert-Uytterhoeven/dt-bindings-can-renesas-rcar-canfd-R-Car-V3U-is-R-Car-Gen4/20230124-030354
        git checkout d2ab7bc9940c2cb09888ee0f253ca39cadccbc60
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/net/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/net/can/rcar/rcar_canfd.c: In function 'rcar_canfd_probe':
   drivers/net/can/rcar/rcar_canfd.c:1876:43: error: implicit declaration of function 'devm_of_phy_optional_get'; did you mean 'devm_phy_optional_get'? [-Werror=implicit-function-declaration]
    1876 |                         transceivers[i] = devm_of_phy_optional_get(dev,
         |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
         |                                           devm_phy_optional_get
>> drivers/net/can/rcar/rcar_canfd.c:1876:41: warning: assignment to 'struct phy *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    1876 |                         transceivers[i] = devm_of_phy_optional_get(dev,
         |                                         ^
   cc1: some warnings being treated as errors


vim +1876 drivers/net/can/rcar/rcar_canfd.c

  1849	
  1850	static int rcar_canfd_probe(struct platform_device *pdev)
  1851	{
  1852		struct phy *transceivers[RCANFD_NUM_CHANNELS] = { 0, };
  1853		const struct rcar_canfd_hw_info *info;
  1854		struct device *dev = &pdev->dev;
  1855		void __iomem *addr;
  1856		u32 sts, ch, fcan_freq;
  1857		struct rcar_canfd_global *gpriv;
  1858		struct device_node *of_child;
  1859		unsigned long channels_mask = 0;
  1860		int err, ch_irq, g_irq;
  1861		int g_err_irq, g_recc_irq;
  1862		bool fdmode = true;			/* CAN FD only mode - default */
  1863		char name[9] = "channelX";
  1864		int i;
  1865	
  1866		info = of_device_get_match_data(dev);
  1867	
  1868		if (of_property_read_bool(dev->of_node, "renesas,no-can-fd"))
  1869			fdmode = false;			/* Classical CAN only mode */
  1870	
  1871		for (i = 0; i < info->max_channels; ++i) {
  1872			name[7] = '0' + i;
  1873			of_child = of_get_child_by_name(dev->of_node, name);
  1874			if (of_child && of_device_is_available(of_child)) {
  1875				channels_mask |= BIT(i);
> 1876				transceivers[i] = devm_of_phy_optional_get(dev,
  1877								of_child, NULL);
  1878			}
  1879			of_node_put(of_child);
  1880			if (IS_ERR(transceivers[i]))
  1881				return PTR_ERR(transceivers[i]);
  1882		}
  1883	
  1884		if (info->shared_global_irqs) {
  1885			ch_irq = platform_get_irq_byname_optional(pdev, "ch_int");
  1886			if (ch_irq < 0) {
  1887				/* For backward compatibility get irq by index */
  1888				ch_irq = platform_get_irq(pdev, 0);
  1889				if (ch_irq < 0)
  1890					return ch_irq;
  1891			}
  1892	
  1893			g_irq = platform_get_irq_byname_optional(pdev, "g_int");
  1894			if (g_irq < 0) {
  1895				/* For backward compatibility get irq by index */
  1896				g_irq = platform_get_irq(pdev, 1);
  1897				if (g_irq < 0)
  1898					return g_irq;
  1899			}
  1900		} else {
  1901			g_err_irq = platform_get_irq_byname(pdev, "g_err");
  1902			if (g_err_irq < 0)
  1903				return g_err_irq;
  1904	
  1905			g_recc_irq = platform_get_irq_byname(pdev, "g_recc");
  1906			if (g_recc_irq < 0)
  1907				return g_recc_irq;
  1908		}
  1909	
  1910		/* Global controller context */
  1911		gpriv = devm_kzalloc(dev, sizeof(*gpriv), GFP_KERNEL);
  1912		if (!gpriv)
  1913			return -ENOMEM;
  1914	
  1915		gpriv->pdev = pdev;
  1916		gpriv->channels_mask = channels_mask;
  1917		gpriv->fdmode = fdmode;
  1918		gpriv->info = info;
  1919	
  1920		gpriv->rstc1 = devm_reset_control_get_optional_exclusive(dev, "rstp_n");
  1921		if (IS_ERR(gpriv->rstc1))
  1922			return dev_err_probe(dev, PTR_ERR(gpriv->rstc1),
  1923					     "failed to get rstp_n\n");
  1924	
  1925		gpriv->rstc2 = devm_reset_control_get_optional_exclusive(dev, "rstc_n");
  1926		if (IS_ERR(gpriv->rstc2))
  1927			return dev_err_probe(dev, PTR_ERR(gpriv->rstc2),
  1928					     "failed to get rstc_n\n");
  1929	
  1930		/* Peripheral clock */
  1931		gpriv->clkp = devm_clk_get(dev, "fck");
  1932		if (IS_ERR(gpriv->clkp))
  1933			return dev_err_probe(dev, PTR_ERR(gpriv->clkp),
  1934					     "cannot get peripheral clock\n");
  1935	
  1936		/* fCAN clock: Pick External clock. If not available fallback to
  1937		 * CANFD clock
  1938		 */
  1939		gpriv->can_clk = devm_clk_get(dev, "can_clk");
  1940		if (IS_ERR(gpriv->can_clk) || (clk_get_rate(gpriv->can_clk) == 0)) {
  1941			gpriv->can_clk = devm_clk_get(dev, "canfd");
  1942			if (IS_ERR(gpriv->can_clk))
  1943				return dev_err_probe(dev, PTR_ERR(gpriv->can_clk),
  1944						     "cannot get canfd clock\n");
  1945	
  1946			gpriv->fcan = RCANFD_CANFDCLK;
  1947	
  1948		} else {
  1949			gpriv->fcan = RCANFD_EXTCLK;
  1950		}
  1951		fcan_freq = clk_get_rate(gpriv->can_clk);
  1952	
  1953		if (gpriv->fcan == RCANFD_CANFDCLK)
  1954			/* CANFD clock is further divided by (1/2) within the IP */
  1955			fcan_freq /= info->postdiv;
  1956	
  1957		addr = devm_platform_ioremap_resource(pdev, 0);
  1958		if (IS_ERR(addr)) {
  1959			err = PTR_ERR(addr);
  1960			goto fail_dev;
  1961		}
  1962		gpriv->base = addr;
  1963	
  1964		/* Request IRQ that's common for both channels */
  1965		if (info->shared_global_irqs) {
  1966			err = devm_request_irq(dev, ch_irq,
  1967					       rcar_canfd_channel_interrupt, 0,
  1968					       "canfd.ch_int", gpriv);
  1969			if (err) {
  1970				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1971					ch_irq, err);
  1972				goto fail_dev;
  1973			}
  1974	
  1975			err = devm_request_irq(dev, g_irq, rcar_canfd_global_interrupt,
  1976					       0, "canfd.g_int", gpriv);
  1977			if (err) {
  1978				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1979					g_irq, err);
  1980				goto fail_dev;
  1981			}
  1982		} else {
  1983			err = devm_request_irq(dev, g_recc_irq,
  1984					       rcar_canfd_global_receive_fifo_interrupt, 0,
  1985					       "canfd.g_recc", gpriv);
  1986	
  1987			if (err) {
  1988				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1989					g_recc_irq, err);
  1990				goto fail_dev;
  1991			}
  1992	
  1993			err = devm_request_irq(dev, g_err_irq,
  1994					       rcar_canfd_global_err_interrupt, 0,
  1995					       "canfd.g_err", gpriv);
  1996			if (err) {
  1997				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1998					g_err_irq, err);
  1999				goto fail_dev;
  2000			}
  2001		}
  2002	
  2003		err = reset_control_reset(gpriv->rstc1);
  2004		if (err)
  2005			goto fail_dev;
  2006		err = reset_control_reset(gpriv->rstc2);
  2007		if (err) {
  2008			reset_control_assert(gpriv->rstc1);
  2009			goto fail_dev;
  2010		}
  2011	
  2012		/* Enable peripheral clock for register access */
  2013		err = clk_prepare_enable(gpriv->clkp);
  2014		if (err) {
  2015			dev_err(dev, "failed to enable peripheral clock, error %d\n",
  2016				err);
  2017			goto fail_reset;
  2018		}
  2019	
  2020		err = rcar_canfd_reset_controller(gpriv);
  2021		if (err) {
  2022			dev_err(dev, "reset controller failed\n");
  2023			goto fail_clk;
  2024		}
  2025	
  2026		/* Controller in Global reset & Channel reset mode */
  2027		rcar_canfd_configure_controller(gpriv);
  2028	
  2029		/* Configure per channel attributes */
  2030		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels) {
  2031			/* Configure Channel's Rx fifo */
  2032			rcar_canfd_configure_rx(gpriv, ch);
  2033	
  2034			/* Configure Channel's Tx (Common) fifo */
  2035			rcar_canfd_configure_tx(gpriv, ch);
  2036	
  2037			/* Configure receive rules */
  2038			rcar_canfd_configure_afl_rules(gpriv, ch);
  2039		}
  2040	
  2041		/* Configure common interrupts */
  2042		rcar_canfd_enable_global_interrupts(gpriv);
  2043	
  2044		/* Start Global operation mode */
  2045		rcar_canfd_update_bit(gpriv->base, RCANFD_GCTR, RCANFD_GCTR_GMDC_MASK,
  2046				      RCANFD_GCTR_GMDC_GOPM);
  2047	
  2048		/* Verify mode change */
  2049		err = readl_poll_timeout((gpriv->base + RCANFD_GSTS), sts,
  2050					 !(sts & RCANFD_GSTS_GNOPM), 2, 500000);
  2051		if (err) {
  2052			dev_err(dev, "global operational mode failed\n");
  2053			goto fail_mode;
  2054		}
  2055	
  2056		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels) {
  2057			err = rcar_canfd_channel_probe(gpriv, ch, fcan_freq,
  2058						       transceivers[ch]);
  2059			if (err)
  2060				goto fail_channel;
  2061		}
  2062	
  2063		platform_set_drvdata(pdev, gpriv);
  2064		dev_info(dev, "global operational state (clk %d, fdmode %d)\n",
  2065			 gpriv->fcan, gpriv->fdmode);
  2066		return 0;
  2067	
  2068	fail_channel:
  2069		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels)
  2070			rcar_canfd_channel_remove(gpriv, ch);
  2071	fail_mode:
  2072		rcar_canfd_disable_global_interrupts(gpriv);
  2073	fail_clk:
  2074		clk_disable_unprepare(gpriv->clkp);
  2075	fail_reset:
  2076		reset_control_assert(gpriv->rstc1);
  2077		reset_control_assert(gpriv->rstc2);
  2078	fail_dev:
  2079		return err;
  2080	}
  2081	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

  reply	other threads:[~2023-01-23 21:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Geert Uytterhoeven
2023-01-31 17:17   ` Rob Herring
2023-01-23 18:56 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Geert Uytterhoeven
2023-01-31 17:18   ` Rob Herring
2023-01-23 18:56 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Geert Uytterhoeven
2023-01-31 17:18   ` Rob Herring
2023-01-23 18:56 ` [PATCH 04/12] can: rcar_canfd: Fix R-Car V3U CAN mode selection Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 05/12] can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 06/12] can: rcar_canfd: Abstract out DCFG address differences Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 07/12] can: rcar_canfd: Add support for R-Car Gen4 Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 08/12] can: rcar_canfd: Fix R-Car Gen4 DCFG.DSJW field width Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 09/12] can: rcar_canfd: Fix R-Car Gen4 CFCC.CFTML " Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 10/12] can: rcar_canfd: Sort included header files Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 11/12] can: rcar_canfd: Add helper variable dev Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 12/12] can: rcar_canfd: Add transceiver support Geert Uytterhoeven
2023-01-23 21:25   ` kernel test robot [this message]
2023-01-24 18:41   ` Geert Uytterhoeven
2023-02-02 14:40     ` Marc Kleine-Budde
2023-02-02 14:53       ` Geert Uytterhoeven
2023-02-02 15:06         ` Marc Kleine-Budde
2023-02-03 10:24           ` Geert Uytterhoeven
2023-02-07 19:20             ` Marc Kleine-Budde
2023-01-25  6:34   ` kernel test robot
2023-01-23 19:28 ` [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Wolfram Sang
2023-01-23 19:37   ` Geert Uytterhoeven
2023-01-24 11:02 ` Simon Horman
2023-01-25 19:15 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Rob Herring
2023-01-25 19:15 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Rob Herring
2023-01-25 19:16 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Rob Herring

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=202301240503.znwPtr2z-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=geert+renesas@glider.be \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.