* [PATCH 0/5] PCI Devices for Loongson PCH
@ 2019-10-30 13:53 Jiaxun Yang
2019-10-30 13:53 ` [PATCH 1/5] PCI: pci_ids: Add Loongson IDs Jiaxun Yang
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Jiaxun Yang @ 2019-10-30 13:53 UTC (permalink / raw)
To: linux-mips
Cc: davem, robh+dt, mark.rutland, axboe, peppe.cavallaro,
alexandre.torgue, joabreu, bhelgaas, netdev, devicetree,
linux-ide, linux-pci, Jiaxun Yang
Hi,
This series is adding quirks & configs for Loongson PCH Devices.
Jiaxun Yang (5):
PCI: pci_ids: Add Loongson IDs
net: stmmac: Split devicetree parse
net: stmmac: pci: Add Loongson GMAC
dt-bindings: net: document loongson.pci-gmac
libata/ahci: Apply non-standard BAR fix for Loongson
.../net/wireless/loongson,pci-gmac.yaml | 71 +++++++++++++++++++
drivers/ata/ahci.c | 7 ++
.../net/ethernet/stmicro/stmmac/stmmac_pci.c | 52 +++++++++++++-
.../ethernet/stmicro/stmmac/stmmac_platform.c | 63 +++++++++++-----
.../ethernet/stmicro/stmmac/stmmac_platform.h | 3 +
include/linux/pci_ids.h | 4 ++
6 files changed, 181 insertions(+), 19 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml
--
2.23.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 1/5] PCI: pci_ids: Add Loongson IDs 2019-10-30 13:53 [PATCH 0/5] PCI Devices for Loongson PCH Jiaxun Yang @ 2019-10-30 13:53 ` Jiaxun Yang 2019-10-30 20:40 ` Bjorn Helgaas 2019-10-30 13:53 ` [PATCH 2/5] net: stmmac: Split devicetree parse Jiaxun Yang ` (3 subsequent siblings) 4 siblings, 1 reply; 15+ messages in thread From: Jiaxun Yang @ 2019-10-30 13:53 UTC (permalink / raw) To: linux-mips Cc: davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci, Jiaxun Yang Add Loongson device IDs that will be used by drivers later. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- include/linux/pci_ids.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 21a572469a4e..75f3336116eb 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -148,6 +148,10 @@ /* Vendors and devices. Sort key: vendor first, device next. */ +#define PCI_VENDOR_ID_LOONGSON 0x0014 +#define PCI_DEVICE_ID_LOONGSON_GMAC 0x7a03 +#define PCI_DEVICE_ID_LOONGSON_AHCI 0x7a08 + #define PCI_VENDOR_ID_TTTECH 0x0357 #define PCI_DEVICE_ID_TTTECH_MC322 0x000a -- 2.23.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/5] PCI: pci_ids: Add Loongson IDs 2019-10-30 13:53 ` [PATCH 1/5] PCI: pci_ids: Add Loongson IDs Jiaxun Yang @ 2019-10-30 20:40 ` Bjorn Helgaas 0 siblings, 0 replies; 15+ messages in thread From: Bjorn Helgaas @ 2019-10-30 20:40 UTC (permalink / raw) To: Jiaxun Yang Cc: linux-mips, davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, netdev, devicetree, linux-ide, linux-pci Please pay attention to the "git log --oneline include/linux/pci_ids.h" output and make yours match, e.g., PCI: Add Loongson Vendor and Device IDs On Wed, Oct 30, 2019 at 09:53:43PM +0800, Jiaxun Yang wrote: > Add Loongson device IDs that will be used by drivers later. > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> With that change, Acked-by: Bjorn Helgaas <bhelgaas@google.com> > --- > include/linux/pci_ids.h | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h > index 21a572469a4e..75f3336116eb 100644 > --- a/include/linux/pci_ids.h > +++ b/include/linux/pci_ids.h > @@ -148,6 +148,10 @@ > > /* Vendors and devices. Sort key: vendor first, device next. */ > > +#define PCI_VENDOR_ID_LOONGSON 0x0014 > +#define PCI_DEVICE_ID_LOONGSON_GMAC 0x7a03 > +#define PCI_DEVICE_ID_LOONGSON_AHCI 0x7a08 > + > #define PCI_VENDOR_ID_TTTECH 0x0357 > #define PCI_DEVICE_ID_TTTECH_MC322 0x000a > > -- > 2.23.0 > ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/5] net: stmmac: Split devicetree parse 2019-10-30 13:53 [PATCH 0/5] PCI Devices for Loongson PCH Jiaxun Yang 2019-10-30 13:53 ` [PATCH 1/5] PCI: pci_ids: Add Loongson IDs Jiaxun Yang @ 2019-10-30 13:53 ` Jiaxun Yang 2019-11-01 12:18 ` Andrew Murray ` (2 more replies) 2019-10-30 13:53 ` [PATCH 3/5] net: stmmac: pci: Add Loongson GMAC Jiaxun Yang ` (2 subsequent siblings) 4 siblings, 3 replies; 15+ messages in thread From: Jiaxun Yang @ 2019-10-30 13:53 UTC (permalink / raw) To: linux-mips Cc: davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci, Jiaxun Yang PCI based devices can share devicetree info parse with platform device based devices after split dt parse frpm dt probe. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 63 ++++++++++++++----- .../ethernet/stmicro/stmmac/stmmac_platform.h | 3 + 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 170c3a052b14..7e29bc76b7c3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -385,25 +385,19 @@ static int stmmac_of_get_mac_mode(struct device_node *np) } /** - * stmmac_probe_config_dt - parse device-tree driver parameters - * @pdev: platform_device structure - * @mac: MAC address to use + * stmmac_parse_config_dt - parse device-tree driver parameters + * @np: device_mode structure + * @plat: plat_stmmacenet_data structure * Description: * this function is to read the driver parameters from device-tree and * set some private fields that will be used by the main at runtime. */ -struct plat_stmmacenet_data * -stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) +int stmmac_parse_config_dt(struct device_node *np, + struct plat_stmmacenet_data *plat) { - struct device_node *np = pdev->dev.of_node; - struct plat_stmmacenet_data *plat; struct stmmac_dma_cfg *dma_cfg; int rc; - plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); - if (!plat) - return ERR_PTR(-ENOMEM); - *mac = of_get_mac_address(np); if (IS_ERR(*mac)) { if (PTR_ERR(*mac) == -EPROBE_DEFER) @@ -414,7 +408,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->phy_interface = of_get_phy_mode(np); if (plat->phy_interface < 0) - return ERR_PTR(plat->phy_interface); + return plat->phy_interface; plat->interface = stmmac_of_get_mac_mode(np); if (plat->interface < 0) @@ -453,7 +447,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* To Configure PHY by using all device-tree supported properties */ rc = stmmac_dt_phy(plat, np, &pdev->dev); if (rc) - return ERR_PTR(rc); + return rc; of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); @@ -531,7 +525,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) GFP_KERNEL); if (!dma_cfg) { stmmac_remove_config_dt(pdev, plat); - return ERR_PTR(-ENOMEM); + return -ENOMEM; } plat->dma_cfg = dma_cfg; @@ -560,7 +554,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) rc = stmmac_mtl_setup(pdev, plat); if (rc) { stmmac_remove_config_dt(pdev, plat); - return ERR_PTR(rc); + return rc; } /* clock setup */ @@ -604,14 +598,43 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->stmmac_rst = NULL; } - return plat; + return 0; error_hw_init: clk_disable_unprepare(plat->pclk); error_pclk_get: clk_disable_unprepare(plat->stmmac_clk); - return ERR_PTR(-EPROBE_DEFER); + return -EPROBE_DEFER; +} + +/** + * stmmac_probe_config_dt - probe and setup stmmac platform data by devicetree + * @pdev: platform_device structure + * @mac: MAC address to use + * Description: + * this function is to set up plat_stmmacenet_data private structure + * for platform drivers. + */ +struct plat_stmmacenet_data * +stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) +{ + struct device_node *np = pdev->dev.of_node; + struct plat_stmmacenet_data *plat; + int rc; + + plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); + if (!plat) + return ERR_PTR(-ENOMEM); + + rc = stmmac_parse_config_dt(np, plat); + + if (rc) { + free(plat); + return ERR_PTR(rc); + } + + return plat; } /** @@ -628,6 +651,11 @@ void stmmac_remove_config_dt(struct platform_device *pdev, of_node_put(plat->mdio_node); } #else +int stmmac_parse_config_dt(struct device_node *np, + struct plat_stmmacenet_data *plat) +{ + return -EINVAL; +} struct plat_stmmacenet_data * stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) { @@ -639,6 +667,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev, { } #endif /* CONFIG_OF */ +EXPORT_SYMBOL_GPL(stmmac_parse_config_dt); EXPORT_SYMBOL_GPL(stmmac_probe_config_dt); EXPORT_SYMBOL_GPL(stmmac_remove_config_dt); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index 3a4663b7b460..0e4aec1f502a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -11,6 +11,9 @@ #include "stmmac.h" +int stmmac_parse_config_dt(struct device_node *np, + struct plat_stmmacenet_data *plat); + struct plat_stmmacenet_data * stmmac_probe_config_dt(struct platform_device *pdev, const char **mac); void stmmac_remove_config_dt(struct platform_device *pdev, -- 2.23.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] net: stmmac: Split devicetree parse 2019-10-30 13:53 ` [PATCH 2/5] net: stmmac: Split devicetree parse Jiaxun Yang @ 2019-11-01 12:18 ` Andrew Murray 2019-11-01 22:43 ` kbuild test robot 2019-11-01 22:45 ` kbuild test robot 2 siblings, 0 replies; 15+ messages in thread From: Andrew Murray @ 2019-11-01 12:18 UTC (permalink / raw) To: Jiaxun Yang Cc: linux-mips, davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci On Wed, Oct 30, 2019 at 09:53:44PM +0800, Jiaxun Yang wrote: > PCI based devices can share devicetree info parse with platform > device based devices after split dt parse frpm dt probe. s/frpm/from/ > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- > .../ethernet/stmicro/stmmac/stmmac_platform.c | 63 ++++++++++++++----- > .../ethernet/stmicro/stmmac/stmmac_platform.h | 3 + > 2 files changed, 49 insertions(+), 17 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > index 170c3a052b14..7e29bc76b7c3 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > @@ -385,25 +385,19 @@ static int stmmac_of_get_mac_mode(struct device_node *np) > } > > /** > - * stmmac_probe_config_dt - parse device-tree driver parameters > - * @pdev: platform_device structure > - * @mac: MAC address to use > + * stmmac_parse_config_dt - parse device-tree driver parameters > + * @np: device_mode structure > + * @plat: plat_stmmacenet_data structure > * Description: > * this function is to read the driver parameters from device-tree and > * set some private fields that will be used by the main at runtime. > */ > -struct plat_stmmacenet_data * > -stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > +int stmmac_parse_config_dt(struct device_node *np, > + struct plat_stmmacenet_data *plat) > { > - struct device_node *np = pdev->dev.of_node; > - struct plat_stmmacenet_data *plat; > struct stmmac_dma_cfg *dma_cfg; > int rc; > > - plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); > - if (!plat) > - return ERR_PTR(-ENOMEM); > - > *mac = of_get_mac_address(np); > if (IS_ERR(*mac)) { > if (PTR_ERR(*mac) == -EPROBE_DEFER) > @@ -414,7 +408,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > > plat->phy_interface = of_get_phy_mode(np); > if (plat->phy_interface < 0) > - return ERR_PTR(plat->phy_interface); > + return plat->phy_interface; > > plat->interface = stmmac_of_get_mac_mode(np); > if (plat->interface < 0) > @@ -453,7 +447,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > /* To Configure PHY by using all device-tree supported properties */ > rc = stmmac_dt_phy(plat, np, &pdev->dev); > if (rc) > - return ERR_PTR(rc); > + return rc; > > of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); > > @@ -531,7 +525,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > GFP_KERNEL); > if (!dma_cfg) { > stmmac_remove_config_dt(pdev, plat); > - return ERR_PTR(-ENOMEM); > + return -ENOMEM; > } > plat->dma_cfg = dma_cfg; > > @@ -560,7 +554,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > rc = stmmac_mtl_setup(pdev, plat); > if (rc) { > stmmac_remove_config_dt(pdev, plat); > - return ERR_PTR(rc); > + return rc; > } > > /* clock setup */ > @@ -604,14 +598,43 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > plat->stmmac_rst = NULL; > } > > - return plat; > + return 0; > > error_hw_init: > clk_disable_unprepare(plat->pclk); > error_pclk_get: > clk_disable_unprepare(plat->stmmac_clk); > > - return ERR_PTR(-EPROBE_DEFER); > + return -EPROBE_DEFER; > +} > + > +/** > + * stmmac_probe_config_dt - probe and setup stmmac platform data by devicetree > + * @pdev: platform_device structure > + * @mac: MAC address to use > + * Description: > + * this function is to set up plat_stmmacenet_data private structure > + * for platform drivers. > + */ > +struct plat_stmmacenet_data * > +stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > +{ > + struct device_node *np = pdev->dev.of_node; > + struct plat_stmmacenet_data *plat; > + int rc; > + > + plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); > + if (!plat) > + return ERR_PTR(-ENOMEM); > + > + rc = stmmac_parse_config_dt(np, plat); > + > + if (rc) { > + free(plat); Given the devm_kzalloc - is the free really needed here? Thanks, Andrew Murray > + return ERR_PTR(rc); > + } > + > + return plat; > } > > /** > @@ -628,6 +651,11 @@ void stmmac_remove_config_dt(struct platform_device *pdev, > of_node_put(plat->mdio_node); > } > #else > +int stmmac_parse_config_dt(struct device_node *np, > + struct plat_stmmacenet_data *plat) > +{ > + return -EINVAL; > +} > struct plat_stmmacenet_data * > stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) > { > @@ -639,6 +667,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev, > { > } > #endif /* CONFIG_OF */ > +EXPORT_SYMBOL_GPL(stmmac_parse_config_dt); > EXPORT_SYMBOL_GPL(stmmac_probe_config_dt); > EXPORT_SYMBOL_GPL(stmmac_remove_config_dt); > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h > index 3a4663b7b460..0e4aec1f502a 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h > @@ -11,6 +11,9 @@ > > #include "stmmac.h" > > +int stmmac_parse_config_dt(struct device_node *np, > + struct plat_stmmacenet_data *plat); > + > struct plat_stmmacenet_data * > stmmac_probe_config_dt(struct platform_device *pdev, const char **mac); > void stmmac_remove_config_dt(struct platform_device *pdev, > -- > 2.23.0 > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] net: stmmac: Split devicetree parse 2019-10-30 13:53 ` [PATCH 2/5] net: stmmac: Split devicetree parse Jiaxun Yang 2019-11-01 12:18 ` Andrew Murray @ 2019-11-01 22:43 ` kbuild test robot 2019-11-01 22:45 ` kbuild test robot 2 siblings, 0 replies; 15+ messages in thread From: kbuild test robot @ 2019-11-01 22:43 UTC (permalink / raw) To: Jiaxun Yang Cc: kbuild-all, linux-mips, davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci, Jiaxun Yang [-- Attachment #1: Type: text/plain, Size: 3514 bytes --] Hi Jiaxun, I love your patch! Yet something to improve: [auto build test ERROR on net-next/master] [also build test ERROR on v5.4-rc5 next-20191031] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Jiaxun-Yang/PCI-Devices-for-Loongson-PCH/20191102-045600 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 52340b82cf1a9c8d466b6e36a0881bc44174b969 config: mips-allmodconfig (attached as .config) compiler: mips-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=mips If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/net//ethernet/stmicro/stmmac/stmmac_platform.c: In function 'stmmac_parse_config_dt': drivers/net//ethernet/stmicro/stmmac/stmmac_platform.c:401:3: error: 'mac' undeclared (first use in this function); did you mean 'max'? *mac = of_get_mac_address(np); ^~~ max drivers/net//ethernet/stmicro/stmmac/stmmac_platform.c:401:3: note: each undeclared identifier is reported only once for each function it appears in In file included from include/linux/platform_device.h:13:0, from drivers/net//ethernet/stmicro/stmmac/stmmac_platform.c:11: drivers/net//ethernet/stmicro/stmmac/stmmac_platform.c:445:13: error: 'pdev' undeclared (first use in this function); did you mean 'cdev'? dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); ^ include/linux/device.h:1743:12: note: in definition of macro 'dev_warn' _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~ drivers/net//ethernet/stmicro/stmmac/stmmac_platform.c: In function 'stmmac_probe_config_dt': >> drivers/net//ethernet/stmicro/stmmac/stmmac_platform.c:633:3: error: implicit declaration of function 'free'; did you mean 'kfree'? [-Werror=implicit-function-declaration] free(plat); ^~~~ kfree cc1: some warnings being treated as errors vim +633 drivers/net//ethernet/stmicro/stmmac/stmmac_platform.c 610 611 /** 612 * stmmac_probe_config_dt - probe and setup stmmac platform data by devicetree 613 * @pdev: platform_device structure 614 * @mac: MAC address to use 615 * Description: 616 * this function is to set up plat_stmmacenet_data private structure 617 * for platform drivers. 618 */ 619 struct plat_stmmacenet_data * 620 stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) 621 { 622 struct device_node *np = pdev->dev.of_node; 623 struct plat_stmmacenet_data *plat; 624 int rc; 625 626 plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); 627 if (!plat) 628 return ERR_PTR(-ENOMEM); 629 630 rc = stmmac_parse_config_dt(np, plat); 631 632 if (rc) { > 633 free(plat); 634 return ERR_PTR(rc); 635 } 636 637 return plat; 638 } 639 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 62104 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] net: stmmac: Split devicetree parse 2019-10-30 13:53 ` [PATCH 2/5] net: stmmac: Split devicetree parse Jiaxun Yang 2019-11-01 12:18 ` Andrew Murray 2019-11-01 22:43 ` kbuild test robot @ 2019-11-01 22:45 ` kbuild test robot 2 siblings, 0 replies; 15+ messages in thread From: kbuild test robot @ 2019-11-01 22:45 UTC (permalink / raw) To: Jiaxun Yang Cc: kbuild-all, linux-mips, davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci, Jiaxun Yang [-- Attachment #1: Type: text/plain, Size: 21686 bytes --] Hi Jiaxun, I love your patch! Yet something to improve: [auto build test ERROR on net-next/master] [cannot apply to v5.4-rc5 next-20191031] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Jiaxun-Yang/PCI-Devices-for-Loongson-PCH/20191102-045600 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 52340b82cf1a9c8d466b6e36a0881bc44174b969 config: sparc64-allmodconfig (attached as .config) compiler: sparc64-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=sparc64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All error/warnings (new ones prefixed by >>): drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c: In function 'stmmac_parse_config_dt': >> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:401:3: error: 'mac' undeclared (first use in this function); did you mean 'max'? *mac = of_get_mac_address(np); ^~~ max drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:401:3: note: each undeclared identifier is reported only once for each function it appears in In file included from include/linux/platform_device.h:13:0, from drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:11: >> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:445:13: error: 'pdev' undeclared (first use in this function); did you mean 'cdev'? dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); ^ include/linux/device.h:1743:12: note: in definition of macro 'dev_warn' _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c: In function 'stmmac_probe_config_dt': >> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:633:3: error: implicit declaration of function 'free' [-Werror=implicit-function-declaration] free(plat); ^~~~ >> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:633:3: warning: incompatible implicit declaration of built-in function 'free' drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:633:3: note: include '<stdlib.h>' or provide a declaration of 'free' cc1: some warnings being treated as errors vim +401 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c 0060c8783330ab Alexandru Ardelean 2019-09-06 386 732fdf0e5253e9 Giuseppe CAVALLARO 2014-11-18 387 /** af5ab092fba22b Jiaxun Yang 2019-10-30 388 * stmmac_parse_config_dt - parse device-tree driver parameters af5ab092fba22b Jiaxun Yang 2019-10-30 389 * @np: device_mode structure af5ab092fba22b Jiaxun Yang 2019-10-30 390 * @plat: plat_stmmacenet_data structure 732fdf0e5253e9 Giuseppe CAVALLARO 2014-11-18 391 * Description: 732fdf0e5253e9 Giuseppe CAVALLARO 2014-11-18 392 * this function is to read the driver parameters from device-tree and 732fdf0e5253e9 Giuseppe CAVALLARO 2014-11-18 393 * set some private fields that will be used by the main at runtime. 732fdf0e5253e9 Giuseppe CAVALLARO 2014-11-18 394 */ af5ab092fba22b Jiaxun Yang 2019-10-30 395 int stmmac_parse_config_dt(struct device_node *np, af5ab092fba22b Jiaxun Yang 2019-10-30 396 struct plat_stmmacenet_data *plat) 6a228452d11eaf Stefan Roese 2012-03-13 397 { 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 398 struct stmmac_dma_cfg *dma_cfg; 2ee2132ffb83e3 Niklas Cassel 2018-02-19 399 int rc; 6a228452d11eaf Stefan Roese 2012-03-13 400 6a228452d11eaf Stefan Roese 2012-03-13 @401 *mac = of_get_mac_address(np); 195b2919ccd7ff Martin Blumenstingl 2019-07-27 402 if (IS_ERR(*mac)) { 195b2919ccd7ff Martin Blumenstingl 2019-07-27 403 if (PTR_ERR(*mac) == -EPROBE_DEFER) 195b2919ccd7ff Martin Blumenstingl 2019-07-27 404 return ERR_CAST(*mac); 195b2919ccd7ff Martin Blumenstingl 2019-07-27 405 195b2919ccd7ff Martin Blumenstingl 2019-07-27 406 *mac = NULL; 195b2919ccd7ff Martin Blumenstingl 2019-07-27 407 } 195b2919ccd7ff Martin Blumenstingl 2019-07-27 408 0060c8783330ab Alexandru Ardelean 2019-09-06 409 plat->phy_interface = of_get_phy_mode(np); 0060c8783330ab Alexandru Ardelean 2019-09-06 410 if (plat->phy_interface < 0) af5ab092fba22b Jiaxun Yang 2019-10-30 411 return plat->phy_interface; 0060c8783330ab Alexandru Ardelean 2019-09-06 412 0060c8783330ab Alexandru Ardelean 2019-09-06 413 plat->interface = stmmac_of_get_mac_mode(np); 0060c8783330ab Alexandru Ardelean 2019-09-06 414 if (plat->interface < 0) 0060c8783330ab Alexandru Ardelean 2019-09-06 415 plat->interface = plat->phy_interface; 4838a54050284d Jose Abreu 2019-06-14 416 4838a54050284d Jose Abreu 2019-06-14 417 /* Some wrapper drivers still rely on phy_node. Let's save it while 4838a54050284d Jose Abreu 2019-06-14 418 * they are not converted to phylink. */ 4838a54050284d Jose Abreu 2019-06-14 419 plat->phy_node = of_parse_phandle(np, "phy-handle", 0); 4838a54050284d Jose Abreu 2019-06-14 420 4838a54050284d Jose Abreu 2019-06-14 421 /* PHYLINK automatically parses the phy-handle property */ 4838a54050284d Jose Abreu 2019-06-14 422 plat->phylink_node = np; 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 423 9cbadf094d9d47 Srinivas Kandagatla 2014-01-16 424 /* Get max speed of operation from device tree */ 9cbadf094d9d47 Srinivas Kandagatla 2014-01-16 425 if (of_property_read_u32(np, "max-speed", &plat->max_speed)) 9cbadf094d9d47 Srinivas Kandagatla 2014-01-16 426 plat->max_speed = -1; 9cbadf094d9d47 Srinivas Kandagatla 2014-01-16 427 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 428 plat->bus_id = of_alias_get_id(np, "ethernet"); 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 429 if (plat->bus_id < 0) 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 430 plat->bus_id = 0; 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 431 436f7ecdcc08f7 Chen-Yu Tsai 2014-01-17 432 /* Default to phy auto-detection */ 436f7ecdcc08f7 Chen-Yu Tsai 2014-01-17 433 plat->phy_addr = -1; 436f7ecdcc08f7 Chen-Yu Tsai 2014-01-17 434 5e7f7fc538d894 Biao Huang 2019-05-24 435 /* Default to get clk_csr from stmmac_clk_crs_set(), 5e7f7fc538d894 Biao Huang 2019-05-24 436 * or get clk_csr from device tree. 5e7f7fc538d894 Biao Huang 2019-05-24 437 */ 5e7f7fc538d894 Biao Huang 2019-05-24 438 plat->clk_csr = -1; 81311c03ab4dca Christophe Roullier 2019-03-05 439 of_property_read_u32(np, "clk_csr", &plat->clk_csr); 81311c03ab4dca Christophe Roullier 2019-03-05 440 436f7ecdcc08f7 Chen-Yu Tsai 2014-01-17 441 /* "snps,phy-addr" is not a standard property. Mark it as deprecated 436f7ecdcc08f7 Chen-Yu Tsai 2014-01-17 442 * and warn of its use. Remove this when phy node support is added. 436f7ecdcc08f7 Chen-Yu Tsai 2014-01-17 443 */ 436f7ecdcc08f7 Chen-Yu Tsai 2014-01-17 444 if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) 436f7ecdcc08f7 Chen-Yu Tsai 2014-01-17 @445 dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 446 a7657f128c279a Giuseppe CAVALLARO 2016-04-01 447 /* To Configure PHY by using all device-tree supported properties */ ce339abc9a40af Niklas Cassel 2018-02-19 448 rc = stmmac_dt_phy(plat, np, &pdev->dev); ce339abc9a40af Niklas Cassel 2018-02-19 449 if (rc) af5ab092fba22b Jiaxun Yang 2019-10-30 450 return rc; 6a228452d11eaf Stefan Roese 2012-03-13 451 e7877f52fd4a8d Vince Bridgers 2015-04-15 452 of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); e7877f52fd4a8d Vince Bridgers 2015-04-15 453 e7877f52fd4a8d Vince Bridgers 2015-04-15 454 of_property_read_u32(np, "rx-fifo-depth", &plat->rx_fifo_size); e7877f52fd4a8d Vince Bridgers 2015-04-15 455 8c2a7a5d2c6ec6 Giuseppe CAVALLARO 2014-10-14 456 plat->force_sf_dma_mode = 8c2a7a5d2c6ec6 Giuseppe CAVALLARO 2014-10-14 457 of_property_read_bool(np, "snps,force_sf_dma_mode"); 6aedb8c06df732 Chen-Yu Tsai 2014-01-17 458 b4b7b772e8b018 jpinto 2017-01-09 459 plat->en_tx_lpi_clockgating = b4b7b772e8b018 jpinto 2017-01-09 460 of_property_read_bool(np, "snps,en-tx-lpi-clockgating"); b4b7b772e8b018 jpinto 2017-01-09 461 2618abb73c8953 Vince Bridgers 2014-01-20 462 /* Set the maxmtu to a default of JUMBO_LEN in case the 2618abb73c8953 Vince Bridgers 2014-01-20 463 * parameter is not present in the device tree. 2618abb73c8953 Vince Bridgers 2014-01-20 464 */ 2618abb73c8953 Vince Bridgers 2014-01-20 465 plat->maxmtu = JUMBO_LEN; 2618abb73c8953 Vince Bridgers 2014-01-20 466 4ed2d8fca7979a Joachim Eastwood 2015-07-17 467 /* Set default value for multicast hash bins */ 4ed2d8fca7979a Joachim Eastwood 2015-07-17 468 plat->multicast_filter_bins = HASH_TABLE_SIZE; 4ed2d8fca7979a Joachim Eastwood 2015-07-17 469 4ed2d8fca7979a Joachim Eastwood 2015-07-17 470 /* Set default value for unicast filter entries */ 4ed2d8fca7979a Joachim Eastwood 2015-07-17 471 plat->unicast_filter_entries = 1; 4ed2d8fca7979a Joachim Eastwood 2015-07-17 472 6a228452d11eaf Stefan Roese 2012-03-13 473 /* 6a228452d11eaf Stefan Roese 2012-03-13 474 * Currently only the properties needed on SPEAr600 6a228452d11eaf Stefan Roese 2012-03-13 475 * are provided. All other properties should be added 6a228452d11eaf Stefan Roese 2012-03-13 476 * once needed on other platforms. 6a228452d11eaf Stefan Roese 2012-03-13 477 */ 84c9f8c41df9f6 Dinh Nguyen 2012-07-18 478 if (of_device_is_compatible(np, "st,spear600-gmac") || f9a09687a87887 Alexandre TORGUE 2016-08-29 479 of_device_is_compatible(np, "snps,dwmac-3.50a") || 84c9f8c41df9f6 Dinh Nguyen 2012-07-18 480 of_device_is_compatible(np, "snps,dwmac-3.70a") || 84c9f8c41df9f6 Dinh Nguyen 2012-07-18 481 of_device_is_compatible(np, "snps,dwmac")) { 2618abb73c8953 Vince Bridgers 2014-01-20 482 /* Note that the max-frame-size parameter as defined in the 2618abb73c8953 Vince Bridgers 2014-01-20 483 * ePAPR v1.1 spec is defined as max-frame-size, it's 2618abb73c8953 Vince Bridgers 2014-01-20 484 * actually used as the IEEE definition of MAC Client 2618abb73c8953 Vince Bridgers 2014-01-20 485 * data, or MTU. The ePAPR specification is confusing as 2618abb73c8953 Vince Bridgers 2014-01-20 486 * the definition is max-frame-size, but usage examples 2618abb73c8953 Vince Bridgers 2014-01-20 487 * are clearly MTUs 2618abb73c8953 Vince Bridgers 2014-01-20 488 */ 2618abb73c8953 Vince Bridgers 2014-01-20 489 of_property_read_u32(np, "max-frame-size", &plat->maxmtu); 3b57de958e2aa3 Vince Bridgers 2014-07-31 490 of_property_read_u32(np, "snps,multicast-filter-bins", 3b57de958e2aa3 Vince Bridgers 2014-07-31 491 &plat->multicast_filter_bins); 3b57de958e2aa3 Vince Bridgers 2014-07-31 492 of_property_read_u32(np, "snps,perfect-filter-entries", 3b57de958e2aa3 Vince Bridgers 2014-07-31 493 &plat->unicast_filter_entries); 3b57de958e2aa3 Vince Bridgers 2014-07-31 494 plat->unicast_filter_entries = dwmac1000_validate_ucast_entries( c3a502deaf1f0d Andy Shevchenko 2019-09-05 495 &pdev->dev, plat->unicast_filter_entries); 3b57de958e2aa3 Vince Bridgers 2014-07-31 496 plat->multicast_filter_bins = dwmac1000_validate_mcast_bins( c3a502deaf1f0d Andy Shevchenko 2019-09-05 497 &pdev->dev, plat->multicast_filter_bins); 6a228452d11eaf Stefan Roese 2012-03-13 498 plat->has_gmac = 1; 6a228452d11eaf Stefan Roese 2012-03-13 499 plat->pmt = 1; 6a228452d11eaf Stefan Roese 2012-03-13 500 } 6a228452d11eaf Stefan Roese 2012-03-13 501 ee2ae1ed46251d Alexandre TORGUE 2016-04-01 502 if (of_device_is_compatible(np, "snps,dwmac-4.00") || 026e57585ff159 Christophe Roullier 2018-05-25 503 of_device_is_compatible(np, "snps,dwmac-4.10a") || 026e57585ff159 Christophe Roullier 2018-05-25 504 of_device_is_compatible(np, "snps,dwmac-4.20a")) { ee2ae1ed46251d Alexandre TORGUE 2016-04-01 505 plat->has_gmac4 = 1; 7cc99fd29b9829 Niklas Cassel 2016-12-07 506 plat->has_gmac = 0; ee2ae1ed46251d Alexandre TORGUE 2016-04-01 507 plat->pmt = 1; ee2ae1ed46251d Alexandre TORGUE 2016-04-01 508 plat->tso_en = of_property_read_bool(np, "snps,tso"); ee2ae1ed46251d Alexandre TORGUE 2016-04-01 509 } ee2ae1ed46251d Alexandre TORGUE 2016-04-01 510 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 511 if (of_device_is_compatible(np, "snps,dwmac-3.610") || 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 512 of_device_is_compatible(np, "snps,dwmac-3.710")) { 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 513 plat->enh_desc = 1; 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 514 plat->bugged_jumbo = 1; 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 515 plat->force_sf_dma_mode = 1; 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 516 } 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 517 a3f142478a5aa1 Jose Abreu 2018-08-08 518 if (of_device_is_compatible(np, "snps,dwxgmac")) { a3f142478a5aa1 Jose Abreu 2018-08-08 519 plat->has_xgmac = 1; a3f142478a5aa1 Jose Abreu 2018-08-08 520 plat->pmt = 1; a3f142478a5aa1 Jose Abreu 2018-08-08 521 plat->tso_en = of_property_read_bool(np, "snps,tso"); a3f142478a5aa1 Jose Abreu 2018-08-08 522 } a3f142478a5aa1 Jose Abreu 2018-08-08 523 64c3b252e9fc82 Byungho An 2013-08-24 524 dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), 64c3b252e9fc82 Byungho An 2013-08-24 525 GFP_KERNEL); 277323814e4956 Mathieu Olivari 2015-05-27 526 if (!dma_cfg) { d2ed0a7755fe14 Johan Hovold 2016-11-30 527 stmmac_remove_config_dt(pdev, plat); af5ab092fba22b Jiaxun Yang 2019-10-30 528 return -ENOMEM; 277323814e4956 Mathieu Olivari 2015-05-27 529 } 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 530 plat->dma_cfg = dma_cfg; a332e2fa56343c Niklas Cassel 2016-12-07 531 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 532 of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl); a332e2fa56343c Niklas Cassel 2016-12-07 533 if (!dma_cfg->pbl) a332e2fa56343c Niklas Cassel 2016-12-07 534 dma_cfg->pbl = DEFAULT_DMA_PBL; 89caaa2d80b7bf Niklas Cassel 2016-12-07 535 of_property_read_u32(np, "snps,txpbl", &dma_cfg->txpbl); 89caaa2d80b7bf Niklas Cassel 2016-12-07 536 of_property_read_u32(np, "snps,rxpbl", &dma_cfg->rxpbl); 4022d039a31595 Niklas Cassel 2016-12-07 537 dma_cfg->pblx8 = !of_property_read_bool(np, "snps,no-pbl-x8"); a332e2fa56343c Niklas Cassel 2016-12-07 538 afea03656add70 Giuseppe Cavallaro 2016-02-29 539 dma_cfg->aal = of_property_read_bool(np, "snps,aal"); a332e2fa56343c Niklas Cassel 2016-12-07 540 dma_cfg->fixed_burst = of_property_read_bool(np, "snps,fixed-burst"); a332e2fa56343c Niklas Cassel 2016-12-07 541 dma_cfg->mixed_burst = of_property_read_bool(np, "snps,mixed-burst"); a332e2fa56343c Niklas Cassel 2016-12-07 542 e2a240c7d3bceb Sonic Zhang 2013-08-28 543 plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode"); e2a240c7d3bceb Sonic Zhang 2013-08-28 544 if (plat->force_thresh_dma_mode) { e2a240c7d3bceb Sonic Zhang 2013-08-28 545 plat->force_sf_dma_mode = 0; c3a502deaf1f0d Andy Shevchenko 2019-09-05 546 dev_warn(&pdev->dev, c3a502deaf1f0d Andy Shevchenko 2019-09-05 547 "force_sf_dma_mode is ignored if force_thresh_dma_mode is set.\n"); 356f9e74ffaafd Olof Johansson 2013-09-05 548 } 25c83b5c2e8256 Srinivas Kandagatla 2013-07-04 549 02e57b9d7c8ce9 Giuseppe CAVALLARO 2016-06-24 550 of_property_read_u32(np, "snps,ps-speed", &plat->mac_port_sel_speed); 02e57b9d7c8ce9 Giuseppe CAVALLARO 2016-06-24 551 afea03656add70 Giuseppe Cavallaro 2016-02-29 552 plat->axi = stmmac_axi_setup(pdev); afea03656add70 Giuseppe Cavallaro 2016-02-29 553 2ee2132ffb83e3 Niklas Cassel 2018-02-19 554 rc = stmmac_mtl_setup(pdev, plat); 2ee2132ffb83e3 Niklas Cassel 2018-02-19 555 if (rc) { 2ee2132ffb83e3 Niklas Cassel 2018-02-19 556 stmmac_remove_config_dt(pdev, plat); af5ab092fba22b Jiaxun Yang 2019-10-30 557 return rc; 2ee2132ffb83e3 Niklas Cassel 2018-02-19 558 } d976a525c37127 Joao Pinto 2017-03-10 559 f573c0b9c4e026 jpinto 2017-01-09 560 /* clock setup */ ddfbee9e3204a0 Thierry Reding 2019-07-26 561 if (!of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) { f573c0b9c4e026 jpinto 2017-01-09 562 plat->stmmac_clk = devm_clk_get(&pdev->dev, f573c0b9c4e026 jpinto 2017-01-09 563 STMMAC_RESOURCE_NAME); f573c0b9c4e026 jpinto 2017-01-09 564 if (IS_ERR(plat->stmmac_clk)) { f573c0b9c4e026 jpinto 2017-01-09 565 dev_warn(&pdev->dev, "Cannot get CSR clock\n"); f573c0b9c4e026 jpinto 2017-01-09 566 plat->stmmac_clk = NULL; f573c0b9c4e026 jpinto 2017-01-09 567 } f573c0b9c4e026 jpinto 2017-01-09 568 clk_prepare_enable(plat->stmmac_clk); ddfbee9e3204a0 Thierry Reding 2019-07-26 569 } f573c0b9c4e026 jpinto 2017-01-09 570 f573c0b9c4e026 jpinto 2017-01-09 571 plat->pclk = devm_clk_get(&pdev->dev, "pclk"); f573c0b9c4e026 jpinto 2017-01-09 572 if (IS_ERR(plat->pclk)) { f573c0b9c4e026 jpinto 2017-01-09 573 if (PTR_ERR(plat->pclk) == -EPROBE_DEFER) f573c0b9c4e026 jpinto 2017-01-09 574 goto error_pclk_get; f573c0b9c4e026 jpinto 2017-01-09 575 f573c0b9c4e026 jpinto 2017-01-09 576 plat->pclk = NULL; f573c0b9c4e026 jpinto 2017-01-09 577 } f573c0b9c4e026 jpinto 2017-01-09 578 clk_prepare_enable(plat->pclk); f573c0b9c4e026 jpinto 2017-01-09 579 f573c0b9c4e026 jpinto 2017-01-09 580 /* Fall-back to main clock in case of no PTP ref is passed */ 9fbb9dd8eee459 Thierry Reding 2017-03-10 581 plat->clk_ptp_ref = devm_clk_get(&pdev->dev, "ptp_ref"); f573c0b9c4e026 jpinto 2017-01-09 582 if (IS_ERR(plat->clk_ptp_ref)) { f573c0b9c4e026 jpinto 2017-01-09 583 plat->clk_ptp_rate = clk_get_rate(plat->stmmac_clk); f573c0b9c4e026 jpinto 2017-01-09 584 plat->clk_ptp_ref = NULL; f573c0b9c4e026 jpinto 2017-01-09 585 dev_warn(&pdev->dev, "PTP uses main clock\n"); f573c0b9c4e026 jpinto 2017-01-09 586 } else { f573c0b9c4e026 jpinto 2017-01-09 587 plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref); fd3984e6e78a56 Heiner Kallweit 2017-02-02 588 dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate); f573c0b9c4e026 jpinto 2017-01-09 589 } f573c0b9c4e026 jpinto 2017-01-09 590 f573c0b9c4e026 jpinto 2017-01-09 591 plat->stmmac_rst = devm_reset_control_get(&pdev->dev, f573c0b9c4e026 jpinto 2017-01-09 592 STMMAC_RESOURCE_NAME); f573c0b9c4e026 jpinto 2017-01-09 593 if (IS_ERR(plat->stmmac_rst)) { f573c0b9c4e026 jpinto 2017-01-09 594 if (PTR_ERR(plat->stmmac_rst) == -EPROBE_DEFER) f573c0b9c4e026 jpinto 2017-01-09 595 goto error_hw_init; f573c0b9c4e026 jpinto 2017-01-09 596 f573c0b9c4e026 jpinto 2017-01-09 597 dev_info(&pdev->dev, "no reset control found\n"); f573c0b9c4e026 jpinto 2017-01-09 598 plat->stmmac_rst = NULL; f573c0b9c4e026 jpinto 2017-01-09 599 } f573c0b9c4e026 jpinto 2017-01-09 600 af5ab092fba22b Jiaxun Yang 2019-10-30 601 return 0; f573c0b9c4e026 jpinto 2017-01-09 602 f573c0b9c4e026 jpinto 2017-01-09 603 error_hw_init: f573c0b9c4e026 jpinto 2017-01-09 604 clk_disable_unprepare(plat->pclk); f573c0b9c4e026 jpinto 2017-01-09 605 error_pclk_get: f573c0b9c4e026 jpinto 2017-01-09 606 clk_disable_unprepare(plat->stmmac_clk); f573c0b9c4e026 jpinto 2017-01-09 607 af5ab092fba22b Jiaxun Yang 2019-10-30 608 return -EPROBE_DEFER; af5ab092fba22b Jiaxun Yang 2019-10-30 609 } af5ab092fba22b Jiaxun Yang 2019-10-30 610 :::::: The code at line 401 was first introduced by commit :::::: 6a228452d11eaf1f1577261540ec0903a2af7f61 stmmac: Add device-tree support :::::: TO: Stefan Roese <sr@denx.de> :::::: CC: David S. Miller <davem@davemloft.net> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 59108 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/5] net: stmmac: pci: Add Loongson GMAC 2019-10-30 13:53 [PATCH 0/5] PCI Devices for Loongson PCH Jiaxun Yang 2019-10-30 13:53 ` [PATCH 1/5] PCI: pci_ids: Add Loongson IDs Jiaxun Yang 2019-10-30 13:53 ` [PATCH 2/5] net: stmmac: Split devicetree parse Jiaxun Yang @ 2019-10-30 13:53 ` Jiaxun Yang 2019-10-30 20:36 ` Bjorn Helgaas 2019-10-30 13:53 ` [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac Jiaxun Yang 2019-10-30 13:53 ` [PATCH 5/5] libata/ahci: Apply non-standard BAR fix for Loongson Jiaxun Yang 4 siblings, 1 reply; 15+ messages in thread From: Jiaxun Yang @ 2019-10-30 13:53 UTC (permalink / raw) To: linux-mips Cc: davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci, Jiaxun Yang This device will be setup by parsing DeviceTree node of pci device. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 52 ++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 292045f4581f..640a2a5b8d41 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -12,8 +12,11 @@ #include <linux/clk-provider.h> #include <linux/pci.h> #include <linux/dmi.h> +#include <linux/of.h> +#include <linux/of_irq.h> #include "stmmac.h" +#include "stmmac_platform.h" /* * This struct is used to associate PCI Function of MAC controller on a board, @@ -33,6 +36,7 @@ struct stmmac_pci_dmi_data { struct stmmac_pci_info { int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat); + bool of_irq; }; static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, @@ -444,6 +448,30 @@ static const struct stmmac_pci_info snps_gmac5_pci_info = { .setup = snps_gmac5_default_data, }; +static int loongson_pci_of_setup(struct pci_dev *pdev, + struct plat_stmmacenet_data *plat) +{ + struct device_node *np; + np = pci_device_to_OF_node(pdev); + + if(!np) { + dev_err(&pdev->dev, "Unable to get OF node\n"); + return -ENODEV; + } + + if(!of_device_is_compatible(np, "loongson,pci-gmac")) { + dev_err(&pdev->dev, "Device compatible mismatch\n"); + return -ENODEV; + } + + return stmmac_parse_config_dt(np, plat); +} + +static const struct stmmac_pci_info loongson_of_pci_info = { + .setup = loongson_pci_of_setup, + .of_irq = true, +}; + /** * stmmac_pci_probe * @@ -508,8 +536,27 @@ static int stmmac_pci_probe(struct pci_dev *pdev, memset(&res, 0, sizeof(res)); res.addr = pcim_iomap_table(pdev)[i]; - res.wol_irq = pdev->irq; - res.irq = pdev->irq; + + if(info->of_irq) { + struct device_node *np; + np = pci_device_to_OF_node(pdev); + + res.irq = of_irq_get_byname(np, "macirq"); + if (res.irq < 0) + return res.irq; + res.wol_irq = of_irq_get_byname(np, "eth_wake_irq"); + if (res.wol_irq < 0) { + if (res.wol_irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + res.wol_irq = res.irq; + } + res.lpi_irq = of_irq_get_byname(np, "eth_lpi"); + if (res.lpi_irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + } else { + res.wol_irq = pdev->irq; + res.irq = pdev->irq; + } return stmmac_dvr_probe(&pdev->dev, plat, &res); } @@ -602,6 +649,7 @@ static const struct pci_device_id stmmac_id_table[] = { STMMAC_DEVICE(INTEL, STMMAC_EHL_SGMII1G_ID, ehl_sgmii1g_pci_info), STMMAC_DEVICE(INTEL, STMMAC_TGL_SGMII1G_ID, tgl_sgmii1g_pci_info), STMMAC_DEVICE(SYNOPSYS, STMMAC_GMAC5_ID, snps_gmac5_pci_info), + STMMAC_DEVICE(LOONGSON, PCI_DEVICE_ID_LOONGSON_GMAC, loongson_of_pci_info), {} }; -- 2.23.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 3/5] net: stmmac: pci: Add Loongson GMAC 2019-10-30 13:53 ` [PATCH 3/5] net: stmmac: pci: Add Loongson GMAC Jiaxun Yang @ 2019-10-30 20:36 ` Bjorn Helgaas 0 siblings, 0 replies; 15+ messages in thread From: Bjorn Helgaas @ 2019-10-30 20:36 UTC (permalink / raw) To: Jiaxun Yang Cc: linux-mips, davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, netdev, devicetree, linux-ide, linux-pci On Wed, Oct 30, 2019 at 09:53:45PM +0800, Jiaxun Yang wrote: > This device will be setup by parsing DeviceTree node > of pci device. > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > +static int loongson_pci_of_setup(struct pci_dev *pdev, > + struct plat_stmmacenet_data *plat) > +{ > + struct device_node *np; > + np = pci_device_to_OF_node(pdev); > + > + if(!np) { Please pay attention to the existing coding style in the file and follow it. In this and other cases below, add a space in "if (". > + if(!of_device_is_compatible(np, "loongson,pci-gmac")) { > + return stmmac_parse_config_dt(np, plat); Remove the double space here. > + if(info->of_irq) { > + STMMAC_DEVICE(LOONGSON, PCI_DEVICE_ID_LOONGSON_GMAC, loongson_of_pci_info), And here. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac 2019-10-30 13:53 [PATCH 0/5] PCI Devices for Loongson PCH Jiaxun Yang ` (2 preceding siblings ...) 2019-10-30 13:53 ` [PATCH 3/5] net: stmmac: pci: Add Loongson GMAC Jiaxun Yang @ 2019-10-30 13:53 ` Jiaxun Yang 2019-10-31 8:35 ` Simon Horman 2019-10-30 13:53 ` [PATCH 5/5] libata/ahci: Apply non-standard BAR fix for Loongson Jiaxun Yang 4 siblings, 1 reply; 15+ messages in thread From: Jiaxun Yang @ 2019-10-30 13:53 UTC (permalink / raw) To: linux-mips Cc: davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci, Jiaxun Yang This binding will provide extra information for PCI enabled device. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- .../net/wireless/loongson,pci-gmac.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml new file mode 100644 index 000000000000..5f764bd46735 --- /dev/null +++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Loongson PCI GMAC Device Tree Bindings + +allOf: + - $ref: "snps,dwmac.yaml#" + +maintainers: + - Jiaxun Yang <jiaxun.yang@flygoat.com> + +properties: + compatible: + const: loongson,pci-gmac + + reg: + maxItems: 1 + + interrupts: + minItems: 1 + maxItems: 3 + items: + - description: Combined signal for various interrupt events + - description: The interrupt to manage the remote wake-up packet detection + - description: The interrupt that occurs when Rx exits the LPI state + + interrupt-names: + minItems: 1 + maxItems: 3 + items: + - const: macirq + - const: eth_wake_irq + - const: eth_lpi + + clocks: + items: + - description: GMAC main clock + + clock-names: + items: + - const: stmmaceth + +required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + - clock-names + - phy-mode + +examples: + - | + gmac: ethernet@ { + compatible = "loongson,pci-irq"; + reg = <0x00001800 0 0 0 0>; + interrupts = <12>, <13>; + interrupt-names = "macirq", "eth_lpi"; + clocks = <&clk_pch_gmac>; + clock-names = "stmmaceth"; + phy-mode = "rgmii"; + }; + +# FIXME: We should set it, but it would report all the generic +# properties as additional properties. +# additionalProperties: false + +... -- 2.23.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac 2019-10-30 13:53 ` [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac Jiaxun Yang @ 2019-10-31 8:35 ` Simon Horman 2019-10-31 10:57 ` Jiaxun Yang 0 siblings, 1 reply; 15+ messages in thread From: Simon Horman @ 2019-10-31 8:35 UTC (permalink / raw) To: Jiaxun Yang Cc: linux-mips, davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci Hi Jiaxun, thanks for your patch. On Wed, Oct 30, 2019 at 09:53:46PM +0800, Jiaxun Yang wrote: > This binding will provide extra information for PCI enabled > device. > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Please verify the bindings using dtbs_check as described in Documentation/devicetree/writing-schema.rst > --- > .../net/wireless/loongson,pci-gmac.yaml | 71 +++++++++++++++++++ > 1 file changed, 71 insertions(+) > create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml > > diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml > new file mode 100644 > index 000000000000..5f764bd46735 > --- /dev/null > +++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml > @@ -0,0 +1,71 @@ > +# SPDX-License-Identifier: GPL-2.0 > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml# The id does not match the filename of the schema. i.e. the above should be: $id: http://devicetree.org/schemas/net/wireless/loongson,pci-gmac.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Loongson PCI GMAC Device Tree Bindings > + > +allOf: > + - $ref: "snps,dwmac.yaml#" snps,dwmac.yaml# is in the parent directory relative to loongson,pci-gmac.yaml. So I think the above needs to be: $ref: "../snps,dwmac.yaml#" > + > +maintainers: > + - Jiaxun Yang <jiaxun.yang@flygoat.com> > + > +properties: > + compatible: > + const: loongson,pci-gmac > + > + reg: > + maxItems: 1 > + > + interrupts: > + minItems: 1 > + maxItems: 3 > + items: > + - description: Combined signal for various interrupt events > + - description: The interrupt to manage the remote wake-up packet detection > + - description: The interrupt that occurs when Rx exits the LPI state > + > + interrupt-names: > + minItems: 1 > + maxItems: 3 > + items: > + - const: macirq > + - const: eth_wake_irq > + - const: eth_lpi > + > + clocks: > + items: > + - description: GMAC main clock > + > + clock-names: > + items: > + - const: stmmaceth > + > +required: > + - compatible > + - reg > + - interrupts > + - interrupt-names > + - clocks > + - clock-names > + - phy-mode > + > +examples: > + - | > + gmac: ethernet@ { I would have expected a bus address here, f.e.: gmac: ethernet@0x00001800 > + compatible = "loongson,pci-irq"; > + reg = <0x00001800 0 0 0 0>; I think there is one to many cell in the above, perhaps it should be. reg = <0x00001800 0 0 0>; Also, I would expect the registers to be wider than 0, i.e. no registers. ` > + interrupts = <12>, <13>; > + interrupt-names = "macirq", "eth_lpi"; > + clocks = <&clk_pch_gmac>; > + clock-names = "stmmaceth"; > + phy-mode = "rgmii"; > + }; > + > +# FIXME: We should set it, but it would report all the generic > +# properties as additional properties. > +# additionalProperties: false > + > +... > -- > 2.23.0 > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac 2019-10-31 8:35 ` Simon Horman @ 2019-10-31 10:57 ` Jiaxun Yang 2019-10-31 20:42 ` Simon Horman 0 siblings, 1 reply; 15+ messages in thread From: Jiaxun Yang @ 2019-10-31 10:57 UTC (permalink / raw) To: Simon Horman Cc: linux-mips, davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci 在 2019/10/31 下午4:35, Simon Horman 写道: > Hi Jiaxun, > > thanks for your patch. > > On Wed, Oct 30, 2019 at 09:53:46PM +0800, Jiaxun Yang wrote: >> This binding will provide extra information for PCI enabled >> device. >> >> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > Please verify the bindings using dtbs_check as described in > Documentation/devicetree/writing-schema.rst > >> --- >> .../net/wireless/loongson,pci-gmac.yaml | 71 +++++++++++++++++++ >> 1 file changed, 71 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml >> >> diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml >> new file mode 100644 >> index 000000000000..5f764bd46735 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml >> @@ -0,0 +1,71 @@ >> +# SPDX-License-Identifier: GPL-2.0 >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml# > The id does not match the filename of the schema. > > i.e. the above should be: > > $id: http://devicetree.org/schemas/net/wireless/loongson,pci-gmac.yaml# > >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: Loongson PCI GMAC Device Tree Bindings >> + >> +allOf: >> + - $ref: "snps,dwmac.yaml#" > snps,dwmac.yaml# is in the parent directory relative to loongson,pci-gmac.yaml. > So I think the above needs to be: > > $ref: "../snps,dwmac.yaml#" > >> + >> +maintainers: >> + - Jiaxun Yang <jiaxun.yang@flygoat.com> >> + >> +properties: >> + compatible: >> + const: loongson,pci-gmac >> + >> + reg: >> + maxItems: 1 >> + >> + interrupts: >> + minItems: 1 >> + maxItems: 3 >> + items: >> + - description: Combined signal for various interrupt events >> + - description: The interrupt to manage the remote wake-up packet detection >> + - description: The interrupt that occurs when Rx exits the LPI state >> + >> + interrupt-names: >> + minItems: 1 >> + maxItems: 3 >> + items: >> + - const: macirq >> + - const: eth_wake_irq >> + - const: eth_lpi >> + >> + clocks: >> + items: >> + - description: GMAC main clock >> + >> + clock-names: >> + items: >> + - const: stmmaceth >> + >> +required: >> + - compatible >> + - reg >> + - interrupts >> + - interrupt-names >> + - clocks >> + - clock-names >> + - phy-mode >> + >> +examples: >> + - | >> + gmac: ethernet@ { > I would have expected a bus address here, f.e.: > > gmac: ethernet@0x00001800 > >> + compatible = "loongson,pci-irq"; >> + reg = <0x00001800 0 0 0 0>; > I think there is one to many cell in the above, perhaps it should be. > > reg = <0x00001800 0 0 0>; > > Also, I would expect the registers to be wider than 0, i.e. no registers. Hi Simon, Thanks for your suggestions above, will fix in v1. Here, the reg domain is a standard 5-cell representing a PCI device, See: Documentation/devicetree/bindings/pci/pci.txt and IEEE Std 1275-1994,<https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/pci/pci.txt> Should I add some description? Jiaxun ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac 2019-10-31 10:57 ` Jiaxun Yang @ 2019-10-31 20:42 ` Simon Horman 0 siblings, 0 replies; 15+ messages in thread From: Simon Horman @ 2019-10-31 20:42 UTC (permalink / raw) To: Jiaxun Yang Cc: linux-mips, davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci On Thu, Oct 31, 2019 at 06:57:16PM +0800, Jiaxun Yang wrote: > > 在 2019/10/31 下午4:35, Simon Horman 写道: > > Hi Jiaxun, > > > > thanks for your patch. > > > > On Wed, Oct 30, 2019 at 09:53:46PM +0800, Jiaxun Yang wrote: > > > This binding will provide extra information for PCI enabled > > > device. > > > > > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > > Please verify the bindings using dtbs_check as described in > > Documentation/devicetree/writing-schema.rst > > > > > --- > > > .../net/wireless/loongson,pci-gmac.yaml | 71 +++++++++++++++++++ > > > 1 file changed, 71 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml > > > > > > diff --git a/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml > > > new file mode 100644 > > > index 000000000000..5f764bd46735 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/net/wireless/loongson,pci-gmac.yaml > > > @@ -0,0 +1,71 @@ > > > +# SPDX-License-Identifier: GPL-2.0 > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml# > > The id does not match the filename of the schema. > > > > i.e. the above should be: > > > > $id: http://devicetree.org/schemas/net/wireless/loongson,pci-gmac.yaml# > > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: Loongson PCI GMAC Device Tree Bindings > > > + > > > +allOf: > > > + - $ref: "snps,dwmac.yaml#" > > snps,dwmac.yaml# is in the parent directory relative to loongson,pci-gmac.yaml. > > So I think the above needs to be: > > > > $ref: "../snps,dwmac.yaml#" > > > > > + > > > +maintainers: > > > + - Jiaxun Yang <jiaxun.yang@flygoat.com> > > > + > > > +properties: > > > + compatible: > > > + const: loongson,pci-gmac > > > + > > > + reg: > > > + maxItems: 1 > > > + > > > + interrupts: > > > + minItems: 1 > > > + maxItems: 3 > > > + items: > > > + - description: Combined signal for various interrupt events > > > + - description: The interrupt to manage the remote wake-up packet detection > > > + - description: The interrupt that occurs when Rx exits the LPI state > > > + > > > + interrupt-names: > > > + minItems: 1 > > > + maxItems: 3 > > > + items: > > > + - const: macirq > > > + - const: eth_wake_irq > > > + - const: eth_lpi > > > + > > > + clocks: > > > + items: > > > + - description: GMAC main clock > > > + > > > + clock-names: > > > + items: > > > + - const: stmmaceth > > > + > > > +required: > > > + - compatible > > > + - reg > > > + - interrupts > > > + - interrupt-names > > > + - clocks > > > + - clock-names > > > + - phy-mode > > > + > > > +examples: > > > + - | > > > + gmac: ethernet@ { > > I would have expected a bus address here, f.e.: > > > > gmac: ethernet@0x00001800 > > > > > + compatible = "loongson,pci-irq"; > > > + reg = <0x00001800 0 0 0 0>; > > I think there is one to many cell in the above, perhaps it should be. > > > > reg = <0x00001800 0 0 0>; > > > > Also, I would expect the registers to be wider than 0, i.e. no registers. > > Hi Simon, > > Thanks for your suggestions above, will fix in v1. > > Here, the reg domain is a standard 5-cell representing a PCI device, > > See: Documentation/devicetree/bindings/pci/pci.txt and IEEE Std 1275-1994,<https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/pci/pci.txt> > > Should I add some description? Thanks, sorry for missing that. As that is the case I think you need something like the following as an example that compiles. examples: - | pcie@0 { reg = <0 0 0 0>; #size-cells = <2>; #address-cells = <3>; ranges = <0 0 0 0 0 0>; device_type = "pci"; gmac: ethernet@1800 { compatible = "loongson,pci-irq"; reg = <0x00001800 0 0 0 0>; interrupts = <12>, <13>; interrupt-names = "macirq", "eth_lpi"; clocks = <&clk_pch_gmac>; clock-names = "stmmaceth"; phy-mode = "rgmii"; }; }; ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5/5] libata/ahci: Apply non-standard BAR fix for Loongson 2019-10-30 13:53 [PATCH 0/5] PCI Devices for Loongson PCH Jiaxun Yang ` (3 preceding siblings ...) 2019-10-30 13:53 ` [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac Jiaxun Yang @ 2019-10-30 13:53 ` Jiaxun Yang 2019-10-31 10:39 ` John Garry 4 siblings, 1 reply; 15+ messages in thread From: Jiaxun Yang @ 2019-10-30 13:53 UTC (permalink / raw) To: linux-mips Cc: davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci, Jiaxun Yang Loongson is using BAR0 as AHCI registers BAR. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- drivers/ata/ahci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index dd92faf197d5..db3d7b94ad53 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -42,6 +42,7 @@ enum { AHCI_PCI_BAR_CAVIUM = 0, AHCI_PCI_BAR_ENMOTUS = 2, AHCI_PCI_BAR_CAVIUM_GEN5 = 4, + AHCI_PCI_BAR_LOONGSON = 0, AHCI_PCI_BAR_STANDARD = 5, }; @@ -575,6 +576,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { /* Enmotus */ { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, + /* Loongson */ + { PCI_VDEVICE(LOONGSON, 0x7a08), board_ahci }, + /* Generic, PCI class code for AHCI */ { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, @@ -1663,6 +1667,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ahci_pci_bar = AHCI_PCI_BAR_CAVIUM; if (pdev->device == 0xa084) ahci_pci_bar = AHCI_PCI_BAR_CAVIUM_GEN5; + } else if (pdev->vendor == PCI_VENDOR_ID_LOONGSON) { + if (pdev->device == PCI_DEVICE_ID_LOONGSON_AHCI) + ahci_pci_bar = AHCI_PCI_BAR_LOONGSON; } /* acquire resources */ -- 2.23.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 5/5] libata/ahci: Apply non-standard BAR fix for Loongson 2019-10-30 13:53 ` [PATCH 5/5] libata/ahci: Apply non-standard BAR fix for Loongson Jiaxun Yang @ 2019-10-31 10:39 ` John Garry 0 siblings, 0 replies; 15+ messages in thread From: John Garry @ 2019-10-31 10:39 UTC (permalink / raw) To: Jiaxun Yang, linux-mips Cc: davem, robh+dt, mark.rutland, axboe, peppe.cavallaro, alexandre.torgue, joabreu, bhelgaas, netdev, devicetree, linux-ide, linux-pci On 30/10/2019 13:53, Jiaxun Yang wrote: > Loongson is using BAR0 as AHCI registers BAR. > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- > drivers/ata/ahci.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c > index dd92faf197d5..db3d7b94ad53 100644 > --- a/drivers/ata/ahci.c > +++ b/drivers/ata/ahci.c > @@ -42,6 +42,7 @@ enum { > AHCI_PCI_BAR_CAVIUM = 0, > AHCI_PCI_BAR_ENMOTUS = 2, > AHCI_PCI_BAR_CAVIUM_GEN5 = 4, > + AHCI_PCI_BAR_LOONGSON = 0, nit: these seem to be ordered by ascending BAR index > AHCI_PCI_BAR_STANDARD = 5, > }; > > @@ -575,6 +576,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { > /* Enmotus */ > { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, > > + /* Loongson */ > + { PCI_VDEVICE(LOONGSON, 0x7a08), board_ahci }, > + > /* Generic, PCI class code for AHCI */ > { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, > PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, > @@ -1663,6 +1667,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) > ahci_pci_bar = AHCI_PCI_BAR_CAVIUM; > if (pdev->device == 0xa084) > ahci_pci_bar = AHCI_PCI_BAR_CAVIUM_GEN5; > + } else if (pdev->vendor == PCI_VENDOR_ID_LOONGSON) { > + if (pdev->device == PCI_DEVICE_ID_LOONGSON_AHCI) > + ahci_pci_bar = AHCI_PCI_BAR_LOONGSON; > } > > /* acquire resources */ > ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-11-01 22:46 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-10-30 13:53 [PATCH 0/5] PCI Devices for Loongson PCH Jiaxun Yang 2019-10-30 13:53 ` [PATCH 1/5] PCI: pci_ids: Add Loongson IDs Jiaxun Yang 2019-10-30 20:40 ` Bjorn Helgaas 2019-10-30 13:53 ` [PATCH 2/5] net: stmmac: Split devicetree parse Jiaxun Yang 2019-11-01 12:18 ` Andrew Murray 2019-11-01 22:43 ` kbuild test robot 2019-11-01 22:45 ` kbuild test robot 2019-10-30 13:53 ` [PATCH 3/5] net: stmmac: pci: Add Loongson GMAC Jiaxun Yang 2019-10-30 20:36 ` Bjorn Helgaas 2019-10-30 13:53 ` [PATCH 4/5] dt-bindings: net: document loongson.pci-gmac Jiaxun Yang 2019-10-31 8:35 ` Simon Horman 2019-10-31 10:57 ` Jiaxun Yang 2019-10-31 20:42 ` Simon Horman 2019-10-30 13:53 ` [PATCH 5/5] libata/ahci: Apply non-standard BAR fix for Loongson Jiaxun Yang 2019-10-31 10:39 ` John Garry
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).