From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Zhi Li <lizhi01@loongson.cn>,
peppe.cavallaro@st.com, alexandre.torgue@st.com,
joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org,
mcoquelin.stm32@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
lixuefeng@loongson.cn, chenhc@lemote.com, yangtiezhu@loongson.cn,
Hongbin Li <lihongbin@loongson.cn>
Subject: Re: [PATCH] stmmac: pci: Add support for LS7A bridge chip
Date: Sat, 11 Jul 2020 09:45:23 +0800 [thread overview]
Message-ID: <bafaf026-9ec4-8cbd-8872-2109676dcdf5@flygoat.com> (raw)
In-Reply-To: <51aeec81-400f-c63b-3a22-e5384ff848f8@flygoat.com>
在 2020/7/11 9:35, Jiaxun Yang 写道:
>
>
> 在 2020/7/10 16:51, Zhi Li 写道:
>> Add gmac platform data to support LS7A bridge chip.
>>
>> Co-developed-by: Hongbin Li <lihongbin@loongson.cn>
>> Signed-off-by: Hongbin Li <lihongbin@loongson.cn>
>> Signed-off-by: Zhi Li <lizhi01@loongson.cn>
>> ---
>> drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 22
>> ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
>> index 272cb47..dab2a40 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
>> @@ -138,6 +138,24 @@ static const struct stmmac_pci_info
>> snps_gmac5_pci_info = {
>> .setup = snps_gmac5_default_data,
>> };
>> +static int loongson_default_data(struct pci_dev *pdev, struct
>> plat_stmmacenent_data *plat)
>> +{
>> + common_default_data(plat);
>> +
>> + plat->bus_id = pci_dev_id(pdev);
>> + plat->phy_addr = 0;
>> + plat->interface = PHY_INTERFACE_MODE_GMII;
>> +
>> + plat->dma_cfg->pbl = 32;
>> + plat->dma_cfg->pblx8 = true;
>> +
>> + return 0;
>> +}
>> +
>> +static struct stmmac_pci_info loongson_pci_info = {
>> + .setup = loongson_default_data;
>> +};
>> +
>> /**
>> * stmmac_pci_probe
>> *
>> @@ -204,6 +222,8 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
>> res.addr = pcim_iomap_table(pdev)[i];
>> res.wol_irq = pdev->irq;
>> res.irq = pdev->irq;
>> + if (pdev->vendor == PCI_VENDOR_ID_LOONGSON)
>> + res.lpi_irq = pdev->irq + 1;
>
> This can never work.
> We're allocating IRQs by irq_domain, not ID.
> Please describe IRQ in DeviceTree, and *DO NOT* sne dout untested patch.
Oops, ^ send out
FYI: Here is my solution of GMAC[1] [2], I was too busy to upstream it.
We're using totally different structure than Loongson's out of tree Kernel,
especially in IRQ management.
Please don't simply copy 'n paste code from your company's internal kernel.
Please try to understand how upstream kernel is working and test your
patches
with upstrem kernel.
[1]:
https://github.com/FlyGoat/linux/commit/9d6584c186a8007f14dc8bb2524e48a2fd7d689a
[2]:
https://github.com/FlyGoat/linux/commit/558a256acfeb022e132113e7952a9df3df375302
>
> Thanks.
>
>> return stmmac_dvr_probe(&pdev->dev, plat, &res);
>> }
>> @@ -273,11 +293,13 @@ static SIMPLE_DEV_PM_OPS(stmmac_pm_ops,
>> stmmac_pci_suspend, stmmac_pci_resume);
>> #define PCI_DEVICE_ID_STMMAC_STMMAC 0x1108
>> #define PCI_DEVICE_ID_SYNOPSYS_GMAC5_ID 0x7102
>> +#define PCI_DEVICE_ID_LOONGSON_GMAC 0x7a03
>> static const struct pci_device_id stmmac_id_table[] = {
>> { PCI_DEVICE_DATA(STMMAC, STMMAC, &stmmac_pci_info) },
>> { PCI_DEVICE_DATA(STMICRO, MAC, &stmmac_pci_info) },
>> { PCI_DEVICE_DATA(SYNOPSYS, GMAC5_ID, &snps_gmac5_pci_info) },
>> + { PCI_DEVICE_DATA(LOONGSON, GMAC, &loongson_pci_info) },
>> {}
>> };
> - Jiaxun
next prev parent reply other threads:[~2020-07-11 1:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-10 8:51 Zhi Li
2020-07-10 15:50 ` Jakub Kicinski
2020-07-11 1:35 ` Jiaxun Yang
2020-07-11 1:45 ` Jiaxun Yang [this message]
[not found] <1606125828-15742-1-git-send-email-lizhi01@loongson.cn>
2020-11-23 10:31 ` Jiaxun Yang
2020-11-25 7:07 ` Zhi Li
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=bafaf026-9ec4-8cbd-8872-2109676dcdf5@flygoat.com \
--to=jiaxun.yang@flygoat.com \
--cc=alexandre.torgue@st.com \
--cc=chenhc@lemote.com \
--cc=davem@davemloft.net \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=lihongbin@loongson.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--cc=lizhi01@loongson.cn \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=yangtiezhu@loongson.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®