* Re: [DTSpec PATCH] Document additional "phy-connection-type" values
From: Grant Likely @ 2016-09-23 10:34 UTC (permalink / raw)
To: sean.wang-NuS5LvNUpcJWk0Htik3J/w
Cc: Florian Fainelli, devicetree-spec-u79uwXL29TY76Z2rM5mHXA,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1474613260-15457-1-git-send-email-sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
On Fri, Sep 23, 2016 at 7:47 AM, <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> From: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
>
> Add the following values to the "phy-connection-type" property:
>
> * Turbo Reduced Gigabit Media Independent Interface ``trgmii``
>
> Suggested-by: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Applied, thanks.
g.
> ---
> source/device-bindings.rst | 39 ++++++++++++++++++++-------------------
> 1 file changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/source/device-bindings.rst b/source/device-bindings.rst
> index 7020267..9de6f3c 100644
> --- a/source/device-bindings.rst
> +++ b/source/device-bindings.rst
> @@ -332,25 +332,26 @@ the network device class.
> .. tabularcolumns:: | l J |
> .. table:: Defined values for the ``phy-connection-type`` Property
>
> - =============================================== ============
> - Connection type Value
> - =============================================== ============
> - Media Independent Interface ``mii``
> - Reduced Media Independent Interface ``rmii``
> - Gigabit Media Independent Interface ``gmii``
> - Reduced Gigabit Media Independent ``rgmii``
> - rgmii with internal delay ``rgmii-id``
> - rgmii with internal delay on TX only ``rgmii-txid``
> - rgmii with internal delay on RX only ``rgmii-rxid``
> - Ten Bit Interface ``tbi``
> - Reduced Ten Bit Interface ``rtbi``
> - Serial Media Independent Interface ``smii``
> - Serial Gigabit Media Independent Interface ``sgmii``
> - Reverse Media Independent Interface ``rev-mii``
> - 10 Gigabits Media Independent Interface ``xgmii``
> - Multimedia over Coaxial ``moca``
> - Quad Serial Gigabit Media Independent Interface ``qsgmii``
> - =============================================== ============
> + ================================================= ============
> + Connection type Value
> + ================================================= ============
> + Media Independent Interface ``mii``
> + Reduced Media Independent Interface ``rmii``
> + Gigabit Media Independent Interface ``gmii``
> + Reduced Gigabit Media Independent ``rgmii``
> + rgmii with internal delay ``rgmii-id``
> + rgmii with internal delay on TX only ``rgmii-txid``
> + rgmii with internal delay on RX only ``rgmii-rxid``
> + Ten Bit Interface ``tbi``
> + Reduced Ten Bit Interface ``rtbi``
> + Serial Media Independent Interface ``smii``
> + Serial Gigabit Media Independent Interface ``sgmii``
> + Reverse Media Independent Interface ``rev-mii``
> + 10 Gigabits Media Independent Interface ``xgmii``
> + Multimedia over Coaxial ``moca``
> + Quad Serial Gigabit Media Independent Interface ``qsgmii``
> + Turbo Reduced Gigabit Media Independent Interface ``trgmii``
> + ================================================= ============
>
> ``phy-handle`` Property
> ^^^^^^^^^^^^^^^^^^^^^^^
> --
> 1.7.9.5
>
^ permalink raw reply
* Re: [PATCH net-next v2 0/3] add support for RGMII on GMAC0 through TRGMII hardware module
From: Sergei Shtylyov @ 2016-09-23 10:23 UTC (permalink / raw)
To: David Miller
Cc: sean.wang, john, nbd, netdev, linux-kernel, linux-mediatek,
andrew, f.fainelli, keyhaede, objelf
In-Reply-To: <20160922.201303.415060758995900781.davem@davemloft.net>
Hello.
On 9/23/2016 3:13 AM, David Miller wrote:
>> Despite my comments? Sigh...
>
> Sorry, I thought he had addressed your feedback in v2.
IIRC, I had only commented to v2, not v1.
> I'll wait longer next time.
Thank you. :-)
MBR, Sergei
^ permalink raw reply
* Re: [PATCH net-next v2 1/3] net: ethernet: mediatek: add extension of phy-mode for TRGMII
From: Sergei Shtylyov @ 2016-09-23 10:19 UTC (permalink / raw)
To: Sean Wang
Cc: john, davem, nbd, netdev, linux-kernel, linux-mediatek, keyhaede,
objelf
In-Reply-To: <1474601571-9647-1-git-send-email-sean.wang@mediatek.com>
Hello.
On 9/23/2016 6:32 AM, Sean Wang wrote:
>>> From: Sean Wang <sean.wang@mediatek.com>
>>>
>>> adds PHY-mode "trgmii" as an extension for the operation mode of the
>>> PHY interface for PHY_INTERFACE_MODE_TRGMII.
>
> .. deleted
What? Why?
>>> switch (of_get_phy_mode(np)) {
>>> + case PHY_INTERFACE_MODE_TRGMII:
>>> + mac->trgmii = true;
>>> case PHY_INTERFACE_MODE_RGMII_TXID:
>>> case PHY_INTERFACE_MODE_RGMII_RXID:
>>> case PHY_INTERFACE_MODE_RGMII_ID:
>>> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>>> b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>>> index 7c5e534..e3b9525 100644
>>> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>>> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>>> @@ -529,6 +529,8 @@ struct mtk_eth {
>>> * @hw: Backpointer to our main datastruture
>>> * @hw_stats: Packet statistics counter
>>> * @phy_dev: The attached PHY if available
>>> + * @trgmii Indicate if the MAC uses TRGMII connected to internal
>>> + switch
>>> */
>>> struct mtk_mac {
>>> int id;
>>> @@ -539,6 +541,7 @@ struct mtk_mac {
>>> struct phy_device *phy_dev;
>>> __be32 hwlro_ip[MTK_MAX_LRO_IP_CNT];
>>> int hwlro_ip_cnt;
>>> + bool trgmii;
>>
>> I don't see where this is used.
>
> I set trgmii as below
> switch (of_get_phy_mode(np)) {
> case PHY_INTERFACE_MODE_TRGMII:
> mac->trgmii = true;
> case PHY_INTERFACE_MODE_RGMII_TXID:
You only set it in this patch but don't check it, so this is essentially a
NOP. It only gets checked in another patch...
>> [...]
>>> diff --git a/include/linux/phy.h b/include/linux/phy.h index
>>> 2d24b28..e25f183 100644
>>> --- a/include/linux/phy.h
>>> +++ b/include/linux/phy.h
>>> @@ -80,6 +80,7 @@ typedef enum {
>>> PHY_INTERFACE_MODE_XGMII,
>>> PHY_INTERFACE_MODE_MOCA,
>>> PHY_INTERFACE_MODE_QSGMII,
>>> + PHY_INTERFACE_MODE_TRGMII,
>>> PHY_INTERFACE_MODE_MAX,
>>> } phy_interface_t;
>>>
>>> @@ -123,6 +124,8 @@ static inline const char *phy_modes(phy_interface_t interface)
>>> return "moca";
>>> case PHY_INTERFACE_MODE_QSGMII:
>>> return "qsgmii";
>>> + case PHY_INTERFACE_MODE_TRGMII:
>>> + return "trgmii";
>>> default:
>>> return "unknown";
>>> }
>>
>> I think this should be done in a separate phylib patch.
>
> this patch is applied, so I am so little confused how to do this.
Right, it's too late now.
MBR, Sergei
^ permalink raw reply
* Re: [PATCH v14 2/4] CMDQ: Mediatek CMDQ driver
From: Horng-Shyang Liao @ 2016-09-23 9:28 UTC (permalink / raw)
To: Jassi Brar
Cc: Rob Herring, Matthias Brugger, Daniel Kurtz, Sascha Hauer,
Devicetree List, Linux Kernel Mailing List,
linux-arm-kernel@lists.infradead.org, linux-mediatek,
srv_heupstream, Sascha Hauer, Philipp Zabel, Nicolas Boichat,
CK HU, cawa cheng, Bibby Hsieh, YT Shen, Daoyuan Huang, Damon Chu,
Jo
In-Reply-To: <CABb+yY1U8WeSWTaeiPJDO1WCBm2AH2QGAiyBextga-KFHwspig@mail.gmail.com>
Hi Jassi,
Please see my inline reply.
On Thu, 2016-09-22 at 13:47 +0530, Jassi Brar wrote:
> On Mon, Sep 5, 2016 at 7:14 AM, HS Liao <hs.liao@mediatek.com> wrote:
[...]
> > +struct cmdq_base *cmdq_register_device(struct device *dev)
> > +{
> > + struct cmdq_base *cmdq_base;
> > + struct resource res;
> > + int subsys;
> > + u32 base;
> > +
> > + if (of_address_to_resource(dev->of_node, 0, &res))
> > + return NULL;
> > + base = (u32)res.start;
> > +
> > + subsys = cmdq_subsys_base_to_id(base >> 16);
> > + if (subsys < 0)
> > + return NULL;
> > +
> > + cmdq_base = devm_kmalloc(dev, sizeof(*cmdq_base), GFP_KERNEL);
> > + if (!cmdq_base)
> > + return NULL;
> > + cmdq_base->subsys = subsys;
> > + cmdq_base->base = base;
> > +
> > + return cmdq_base;
> > +}
> > +EXPORT_SYMBOL(cmdq_register_device);
> > +
> > +struct cmdq_client *cmdq_mbox_create(struct device *dev, int index)
> > +{
> > + struct cmdq_client *client;
> > +
> > + client = kzalloc(sizeof(*client), GFP_KERNEL);
> > + client->client.dev = dev;
> > + client->client.tx_block = false;
> > + client->chan = mbox_request_channel(&client->client, index);
> > + return client;
> > +}
> > +EXPORT_SYMBOL(cmdq_mbox_create);
> > +
> > +int cmdq_task_create(struct device *dev, struct cmdq_task **task_ptr)
> > +{
> > + struct cmdq_task *task;
> > + int err;
> > +
> > + task = kzalloc(sizeof(*task), GFP_KERNEL);
> > + if (!task)
> > + return -ENOMEM;
> > + task->cmdq = dev_get_drvdata(dev);
> > + err = cmdq_task_realloc_cmd_buffer(task, PAGE_SIZE);
> > + if (err < 0) {
> > + kfree(task);
> > + return err;
> > + }
> > + *task_ptr = task;
> > + return 0;
> > +}
> > +EXPORT_SYMBOL(cmdq_task_create);
> > +
> > +static int cmdq_task_append_command(struct cmdq_task *task, enum cmdq_code code,
> > + u32 arg_a, u32 arg_b)
> > +{
> > + u64 *cmd_ptr;
> > + int err;
> > +
> > + if (WARN_ON(task->finalized))
> > + return -EBUSY;
> > + if (unlikely(task->cmd_buf_size + CMDQ_INST_SIZE > task->buf_size)) {
> > + err = cmdq_task_realloc_cmd_buffer(task, task->buf_size * 2);
> > + if (err < 0)
> > + return err;
> > + }
> > + cmd_ptr = task->va_base + task->cmd_buf_size;
> > + (*cmd_ptr) = (u64)((code << CMDQ_OP_CODE_SHIFT) | arg_a) << 32 | arg_b;
> > + task->cmd_buf_size += CMDQ_INST_SIZE;
> > + return 0;
> > +}
> > +
> > +int cmdq_task_write(struct cmdq_task *task, u32 value, struct cmdq_base *base,
> > + u32 offset)
> > +{
> > + u32 arg_a = ((base->base + offset) & CMDQ_ARG_A_WRITE_MASK) |
> > + (base->subsys << CMDQ_SUBSYS_SHIFT);
> > + return cmdq_task_append_command(task, CMDQ_CODE_WRITE, arg_a, value);
> > +}
> > +EXPORT_SYMBOL(cmdq_task_write);
> > +
> > +int cmdq_task_write_mask(struct cmdq_task *task, u32 value,
> > + struct cmdq_base *base, u32 offset, u32 mask)
> > +{
> > + u32 offset_mask = offset;
> > + int err;
> > +
> > + if (mask != 0xffffffff) {
> > + err = cmdq_task_append_command(task, CMDQ_CODE_MASK, 0, ~mask);
> > + if (err < 0)
> > + return err;
> > + offset_mask |= CMDQ_WRITE_ENABLE_MASK;
> > + }
> > + return cmdq_task_write(task, value, base, offset_mask);
> > +}
> > +EXPORT_SYMBOL(cmdq_task_write_mask);
> > +
> > +static const u32 cmdq_event_value[CMDQ_MAX_EVENT] = {
> > + /* Display start of frame(SOF) events */
> > + [CMDQ_EVENT_DISP_OVL0_SOF] = 11,
> > + [CMDQ_EVENT_DISP_OVL1_SOF] = 12,
> > + [CMDQ_EVENT_DISP_RDMA0_SOF] = 13,
> > + [CMDQ_EVENT_DISP_RDMA1_SOF] = 14,
> > + [CMDQ_EVENT_DISP_RDMA2_SOF] = 15,
> > + [CMDQ_EVENT_DISP_WDMA0_SOF] = 16,
> > + [CMDQ_EVENT_DISP_WDMA1_SOF] = 17,
> > + /* Display end of frame(EOF) events */
> > + [CMDQ_EVENT_DISP_OVL0_EOF] = 39,
> > + [CMDQ_EVENT_DISP_OVL1_EOF] = 40,
> > + [CMDQ_EVENT_DISP_RDMA0_EOF] = 41,
> > + [CMDQ_EVENT_DISP_RDMA1_EOF] = 42,
> > + [CMDQ_EVENT_DISP_RDMA2_EOF] = 43,
> > + [CMDQ_EVENT_DISP_WDMA0_EOF] = 44,
> > + [CMDQ_EVENT_DISP_WDMA1_EOF] = 45,
> > + /* Mutex end of frame(EOF) events */
> > + [CMDQ_EVENT_MUTEX0_STREAM_EOF] = 53,
> > + [CMDQ_EVENT_MUTEX1_STREAM_EOF] = 54,
> > + [CMDQ_EVENT_MUTEX2_STREAM_EOF] = 55,
> > + [CMDQ_EVENT_MUTEX3_STREAM_EOF] = 56,
> > + [CMDQ_EVENT_MUTEX4_STREAM_EOF] = 57,
> > + /* Display underrun events */
> > + [CMDQ_EVENT_DISP_RDMA0_UNDERRUN] = 63,
> > + [CMDQ_EVENT_DISP_RDMA1_UNDERRUN] = 64,
> > + [CMDQ_EVENT_DISP_RDMA2_UNDERRUN] = 65,
> > +};
> > +
> > +int cmdq_task_wfe(struct cmdq_task *task, enum cmdq_event event)
> > +{
> > + u32 arg_b;
> > +
> > + if (event >= CMDQ_MAX_EVENT || event < 0)
> > + return -EINVAL;
> > +
> > + /*
> > + * WFE arg_b
> > + * bit 0-11: wait value
> > + * bit 15: 1 - wait, 0 - no wait
> > + * bit 16-27: update value
> > + * bit 31: 1 - update, 0 - no update
> > + */
> > + arg_b = CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE;
> > + return cmdq_task_append_command(task, CMDQ_CODE_WFE,
> > + cmdq_event_value[event], arg_b);
> > +}
> > +EXPORT_SYMBOL(cmdq_task_wfe);
> > +
> > +int cmdq_task_clear_event(struct cmdq_task *task, enum cmdq_event event)
> > +{
> > + if (event >= CMDQ_MAX_EVENT || event < 0)
> > + return -EINVAL;
> > +
> > + return cmdq_task_append_command(task, CMDQ_CODE_WFE,
> > + cmdq_event_value[event], CMDQ_WFE_UPDATE);
> > +}
> > +EXPORT_SYMBOL(cmdq_task_clear_event);
> > +
> > +static int cmdq_task_finalize(struct cmdq_task *task)
> > +{
> > + int err;
> > +
> > + if (task->finalized)
> > + return 0;
> > +
> > + /* insert EOC and generate IRQ for each command iteration */
> > + err = cmdq_task_append_command(task, CMDQ_CODE_EOC, 0, CMDQ_EOC_IRQ_EN);
> > + if (err < 0)
> > + return err;
> > +
> > + /* JUMP to end */
> > + err = cmdq_task_append_command(task, CMDQ_CODE_JUMP, 0, CMDQ_JUMP_PASS);
> > + if (err < 0)
> > + return err;
> > +
> > + task->finalized = true;
> > + return 0;
> > +}
> > +
> > +int cmdq_task_flush_async(struct cmdq_client *client, struct cmdq_task *task,
> > + cmdq_async_flush_cb cb, void *data)
> > +{
> > + struct cmdq *cmdq = task->cmdq;
> > + int err;
> > +
> > + mutex_lock(&cmdq->task_mutex);
> > + if (cmdq->suspended) {
> > + dev_err(cmdq->mbox.dev, "%s is called after suspended\n",
> > + __func__);
> > + mutex_unlock(&cmdq->task_mutex);
> > + return -EPERM;
> > + }
> > +
> > + err = cmdq_task_finalize(task);
> > + if (err < 0) {
> > + mutex_unlock(&cmdq->task_mutex);
> > + return err;
> > + }
> > +
> > + INIT_LIST_HEAD(&task->list_entry);
> > + task->cb.cb = cb;
> > + task->cb.data = data;
> > + task->pa_base = dma_map_single(cmdq->mbox.dev, task->va_base,
> > + task->cmd_buf_size, DMA_TO_DEVICE);
> > +
> > + mbox_send_message(client->chan, task);
> > + /* We can send next task immediately, so just call txdone. */
> > + mbox_client_txdone(client->chan, 0);
> > + mutex_unlock(&cmdq->task_mutex);
> > + return 0;
> > +}
> > +EXPORT_SYMBOL(cmdq_task_flush_async);
> > +
> > +struct cmdq_flush_completion {
> > + struct completion cmplt;
> > + bool err;
> > +};
> > +
> > +static void cmdq_task_flush_cb(struct cmdq_cb_data data)
> > +{
> > + struct cmdq_flush_completion *cmplt = data.data;
> > +
> > + cmplt->err = data.err;
> > + complete(&cmplt->cmplt);
> > +}
> > +
> > +int cmdq_task_flush(struct cmdq_client *client, struct cmdq_task *task)
> > +{
> > + struct cmdq_flush_completion cmplt;
> > + int err;
> > +
> > + init_completion(&cmplt.cmplt);
> > + err = cmdq_task_flush_async(client, task, cmdq_task_flush_cb, &cmplt);
> > + if (err < 0)
> > + return err;
> > + wait_for_completion(&cmplt.cmplt);
> > + return cmplt.err ? -EFAULT : 0;
> > +}
> > +EXPORT_SYMBOL(cmdq_task_flush);
> > +
> > +void cmdq_mbox_free(struct cmdq_client *client)
> > +{
> > + mbox_free_channel(client->chan);
> > + kfree(client);
> > +}
> > +EXPORT_SYMBOL(cmdq_mbox_free);
> > +
> All these exported functions implement the protocol, so should not be
> a part of this controller driver. That should go into
> drivers/soc/mediatek/
>
> The controller driver (mtk-cmdq.c) should implement mainly the
> mbox_chan_ops and mbox.of_xlate.
>
I can do that, but I would like to confirm with Matthias in advance.
[...]
> > + cmdq->irq = irq_of_parse_and_map(node, 0);
> >
> why not, cmdq->irq = platform_get_irq(pdev, 0);
Will do
[...]
> > +static struct platform_driver cmdq_drv = {
> > + .probe = cmdq_probe,
> > + .remove = cmdq_remove,
> > + .driver = {
> > + .name = "mtk_cmdq",
> > + .owner = THIS_MODULE,
> >
> please remove the unnecessary .owner field.
Will do
> > + .pm = &cmdq_pm_ops,
> > + .of_match_table = cmdq_of_ids,
> > + }
> > +};
> > +
> > +builtin_platform_driver(cmdq_drv);
> > diff --git a/include/linux/mailbox/mtk-cmdq.h b/include/linux/mailbox/mtk-cmdq.h
> > new file mode 100644
> > index 0000000..c3c924d
> > --- /dev/null
> > +++ b/include/linux/mailbox/mtk-cmdq.h
> >
> The api implemented is Mediateck proprietary, so I think it should be
> include/linux/soc/mediatek/cmdq.h
>
>
> > @@ -0,0 +1,180 @@
> > +/*
> > + * Copyright (c) 2015 MediaTek Inc.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + * GNU General Public License for more details.
> > + */
> > +
> > +#ifndef __MTK_CMDQ_H__
> > +#define __MTK_CMDQ_H__
> > +
> > +#include <linux/mailbox_client.h>
> > +#include <linux/mailbox_controller.h>
> >
> Clients should not need to include mailbox_controller.h
This is because client needs to know controller's dev.
Please see my CMDQ v13.
http://www.spinics.net/lists/kernel/msg2327867.html
I add mailbox_controller.h for client to get controller's dev,
so I can remove a node reference in device tree.
Should I revert the modification of CMDQ v13?
> > +#include <linux/platform_device.h>
> > +#include <linux/types.h>
> > +
> > +/* display events in command queue(CMDQ) */
> > +enum cmdq_event {
> > + /* Display start of frame(SOF) events */
> > + CMDQ_EVENT_DISP_OVL0_SOF,
> >
> you may want to explicitly initialise the first element.
Will do
> > + CMDQ_EVENT_DISP_OVL1_SOF,
> > + CMDQ_EVENT_DISP_RDMA0_SOF,
> > + CMDQ_EVENT_DISP_RDMA1_SOF,
> > + CMDQ_EVENT_DISP_RDMA2_SOF,
> > + CMDQ_EVENT_DISP_WDMA0_SOF,
> > + CMDQ_EVENT_DISP_WDMA1_SOF,
> > + /* Display end of frame(EOF) events */
> > + CMDQ_EVENT_DISP_OVL0_EOF,
> > + CMDQ_EVENT_DISP_OVL1_EOF,
> > + CMDQ_EVENT_DISP_RDMA0_EOF,
> > + CMDQ_EVENT_DISP_RDMA1_EOF,
> > + CMDQ_EVENT_DISP_RDMA2_EOF,
> > + CMDQ_EVENT_DISP_WDMA0_EOF,
> > + CMDQ_EVENT_DISP_WDMA1_EOF,
> > + /* Mutex end of frame(EOF) events */
> > + CMDQ_EVENT_MUTEX0_STREAM_EOF,
> > + CMDQ_EVENT_MUTEX1_STREAM_EOF,
> > + CMDQ_EVENT_MUTEX2_STREAM_EOF,
> > + CMDQ_EVENT_MUTEX3_STREAM_EOF,
> > + CMDQ_EVENT_MUTEX4_STREAM_EOF,
> > + /* Display underrun events */
> > + CMDQ_EVENT_DISP_RDMA0_UNDERRUN,
> > + CMDQ_EVENT_DISP_RDMA1_UNDERRUN,
> > + CMDQ_EVENT_DISP_RDMA2_UNDERRUN,
> > + /* Keep this at the end */
> > + CMDQ_MAX_EVENT,
> > +};
> > +
Thanks,
HS
Hi Matthias,
Do you agree with Jassi's comments about moving parts of code back to
soc/mediatek/ ?
If I do it, the part in soc/mediatek/ will be similar to a library.
Could you tell me a good way to handle this situation?
Thanks,
HS
^ permalink raw reply
* Re: [PATCH v14 4/4] CMDQ: save more energy in idle
From: Horng-Shyang Liao @ 2016-09-23 9:28 UTC (permalink / raw)
To: Jassi Brar
Cc: Rob Herring, Matthias Brugger, Daniel Kurtz, Sascha Hauer,
Devicetree List, Linux Kernel Mailing List,
linux-arm-kernel@lists.infradead.org, linux-mediatek,
srv_heupstream, Sascha Hauer, Philipp Zabel, Nicolas Boichat,
CK HU, cawa cheng, Bibby Hsieh, YT Shen, Daoyuan Huang, Damon Chu,
Jo
In-Reply-To: <CABb+yY1YqyReK5bii6n5a_rJ6fgpPi=aC3sfKJdomvM5+NG9FA@mail.gmail.com>
On Thu, 2016-09-22 at 13:22 +0530, Jassi Brar wrote:
> On Mon, Sep 5, 2016 at 7:14 AM, HS Liao <hs.liao@mediatek.com> wrote:
> > Use clk_disable_unprepare instead of clk_disable to save more energy
> > when CMDQ is idle.
> >
> > Signed-off-by: HS Liao <hs.liao@mediatek.com>
> > ---
> > drivers/mailbox/mtk-cmdq.c | 54 +++++++++++++++++++++++++++++++++++++++-------
>
> The driver is introduced by second patch of the set, so it makes sense
> to merge this patch into patch 2/4.
Hi Jassi,
Could you take a look at previous discussion between Matthias and me?
http://lkml.iu.edu/hypermail/linux/kernel/1606.2/05239.html
His basic idea is to simplify first working version.
Therefore, I move some code to this patch.
Thanks,
HS
^ permalink raw reply
* [DTSpec PATCH] Document additional "phy-connection-type" values
From: sean.wang-NuS5LvNUpcJWk0Htik3J/w @ 2016-09-23 6:47 UTC (permalink / raw)
To: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w
Cc: devicetree-spec-u79uwXL29TY76Z2rM5mHXA,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sean Wang
From: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Add the following values to the "phy-connection-type" property:
* Turbo Reduced Gigabit Media Independent Interface ``trgmii``
Suggested-by: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
source/device-bindings.rst | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/source/device-bindings.rst b/source/device-bindings.rst
index 7020267..9de6f3c 100644
--- a/source/device-bindings.rst
+++ b/source/device-bindings.rst
@@ -332,25 +332,26 @@ the network device class.
.. tabularcolumns:: | l J |
.. table:: Defined values for the ``phy-connection-type`` Property
- =============================================== ============
- Connection type Value
- =============================================== ============
- Media Independent Interface ``mii``
- Reduced Media Independent Interface ``rmii``
- Gigabit Media Independent Interface ``gmii``
- Reduced Gigabit Media Independent ``rgmii``
- rgmii with internal delay ``rgmii-id``
- rgmii with internal delay on TX only ``rgmii-txid``
- rgmii with internal delay on RX only ``rgmii-rxid``
- Ten Bit Interface ``tbi``
- Reduced Ten Bit Interface ``rtbi``
- Serial Media Independent Interface ``smii``
- Serial Gigabit Media Independent Interface ``sgmii``
- Reverse Media Independent Interface ``rev-mii``
- 10 Gigabits Media Independent Interface ``xgmii``
- Multimedia over Coaxial ``moca``
- Quad Serial Gigabit Media Independent Interface ``qsgmii``
- =============================================== ============
+ ================================================= ============
+ Connection type Value
+ ================================================= ============
+ Media Independent Interface ``mii``
+ Reduced Media Independent Interface ``rmii``
+ Gigabit Media Independent Interface ``gmii``
+ Reduced Gigabit Media Independent ``rgmii``
+ rgmii with internal delay ``rgmii-id``
+ rgmii with internal delay on TX only ``rgmii-txid``
+ rgmii with internal delay on RX only ``rgmii-rxid``
+ Ten Bit Interface ``tbi``
+ Reduced Ten Bit Interface ``rtbi``
+ Serial Media Independent Interface ``smii``
+ Serial Gigabit Media Independent Interface ``sgmii``
+ Reverse Media Independent Interface ``rev-mii``
+ 10 Gigabits Media Independent Interface ``xgmii``
+ Multimedia over Coaxial ``moca``
+ Quad Serial Gigabit Media Independent Interface ``qsgmii``
+ Turbo Reduced Gigabit Media Independent Interface ``trgmii``
+ ================================================= ============
``phy-handle`` Property
^^^^^^^^^^^^^^^^^^^^^^^
--
1.7.9.5
^ permalink raw reply related
* [PATCH net-next] Documentation: devicetree: fix typo in MediaTek ethernet device-tree binding
From: sean.wang @ 2016-09-23 6:09 UTC (permalink / raw)
To: davem, sergei.shtylyov
Cc: nbd, netdev, linux-kernel, devicetree, linux-mediatek, john,
keyhaede, objelf, Sean Wang
From: Sean Wang <sean.wang@mediatek.com>
fix typo in
Documentation/devicetree/bindings/net/mediatek-net.txt
Cc: devicetree@vger.kernel.org
Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
Documentation/devicetree/bindings/net/mediatek-net.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/net/mediatek-net.txt b/Documentation/devicetree/bindings/net/mediatek-net.txt
index 7111278..f095257 100644
--- a/Documentation/devicetree/bindings/net/mediatek-net.txt
+++ b/Documentation/devicetree/bindings/net/mediatek-net.txt
@@ -34,7 +34,7 @@ Required properties:
- phy-handle: see ethernet.txt file in the same directory and
the phy-mode "trgmii" required being provided when reg
is equal to 0 and the MAC uses fixed-link to connect
- with inernal switch such as MT7530.
+ with internal switch such as MT7530.
Example:
--
1.9.1
^ permalink raw reply related
* [PATCH net-next v2] Documentation: devicetree: revise ethernet device-tree binding about TRGMII
From: sean.wang @ 2016-09-23 6:04 UTC (permalink / raw)
To: davem, sergei.shtylyov
Cc: nbd, netdev, linux-kernel, devicetree, linux-mediatek, john,
keyhaede, objelf, Sean Wang
From: Sean Wang <sean.wang@mediatek.com>
add phy-mode "trgmii" to
Documentation/devicetree/bindings/net/ethernet.txt
Cc: devicetree@vger.kernel.org
Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
Documentation/devicetree/bindings/net/ethernet.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt
index 5d88f37..e1d7681 100644
--- a/Documentation/devicetree/bindings/net/ethernet.txt
+++ b/Documentation/devicetree/bindings/net/ethernet.txt
@@ -11,8 +11,8 @@ The following properties are common to the Ethernet controllers:
the maximum frame size (there's contradiction in ePAPR).
- phy-mode: string, operation mode of the PHY interface; supported values are
"mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id",
- "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii"; this is now a de-facto
- standard property;
+ "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii", "trgmii"; this is now a
+ de-facto standard property;
- phy-connection-type: the same as "phy-mode" property but described in ePAPR;
- phy-handle: phandle, specifies a reference to a node representing a PHY
device; this property is described in ePAPR and so preferred;
--
1.9.1
^ permalink raw reply related
* Re: [PATCH net-next v2 1/3] net: ethernet: mediatek: add extension of phy-mode for TRGMII
From: Sean Wang @ 2016-09-23 3:32 UTC (permalink / raw)
To: sergei.shtylyov
Cc: john, davem, nbd, netdev, linux-kernel, linux-mediatek, keyhaede,
objelf
In-Reply-To: <9e375cf6-8283-b6fb-f21f-5d013c3172fa@cogentembedded.com>
Date: Thu, 22 Sep 2016 14:30:53 +0300, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
>>Hello.
>
>On 9/22/2016 5:33 AM, sean.wang@mediatek.com wrote:
>
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> adds PHY-mode "trgmii" as an extension for the operation mode of the
>> PHY interface for PHY_INTERFACE_MODE_TRGMII.
.. deleted
>> switch (of_get_phy_mode(np)) {
>> + case PHY_INTERFACE_MODE_TRGMII:
>> + mac->trgmii = true;
>> case PHY_INTERFACE_MODE_RGMII_TXID:
>> case PHY_INTERFACE_MODE_RGMII_RXID:
>> case PHY_INTERFACE_MODE_RGMII_ID:
>> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>> b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>> index 7c5e534..e3b9525 100644
>> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>> @@ -529,6 +529,8 @@ struct mtk_eth {
>> * @hw: Backpointer to our main datastruture
>> * @hw_stats: Packet statistics counter
>> * @phy_dev: The attached PHY if available
>> + * @trgmii Indicate if the MAC uses TRGMII connected to internal
>> + switch
>> */
>> struct mtk_mac {
>> int id;
>> @@ -539,6 +541,7 @@ struct mtk_mac {
>> struct phy_device *phy_dev;
>> __be32 hwlro_ip[MTK_MAX_LRO_IP_CNT];
>> int hwlro_ip_cnt;
>> + bool trgmii;
>
> I don't see where this is used.
I set trgmii as below
switch (of_get_phy_mode(np)) {
case PHY_INTERFACE_MODE_TRGMII:
mac->trgmii = true;
case PHY_INTERFACE_MODE_RGMII_TXID:
>[...]
>> diff --git a/include/linux/phy.h b/include/linux/phy.h index
>> 2d24b28..e25f183 100644
>> --- a/include/linux/phy.h
>> +++ b/include/linux/phy.h
>> @@ -80,6 +80,7 @@ typedef enum {
>> PHY_INTERFACE_MODE_XGMII,
>> PHY_INTERFACE_MODE_MOCA,
>> PHY_INTERFACE_MODE_QSGMII,
>> + PHY_INTERFACE_MODE_TRGMII,
>> PHY_INTERFACE_MODE_MAX,
>> } phy_interface_t;
>>
>> @@ -123,6 +124,8 @@ static inline const char *phy_modes(phy_interface_t interface)
>> return "moca";
>> case PHY_INTERFACE_MODE_QSGMII:
>> return "qsgmii";
>> + case PHY_INTERFACE_MODE_TRGMII:
>> + return "trgmii";
>> default:
>> return "unknown";
>> }
>
> I think this should be done in a separate phylib patch.
this patch is applied, so I am so little confused how to do this.
next time I will note placing modification for generic layer
into separate patch.
>
>MBR, Sergei
>
^ permalink raw reply
* Re: [PATCH net-next] Documentation: devicetree: revise ethernet device-tree binding about TRGMII
From: Sean Wang @ 2016-09-23 2:52 UTC (permalink / raw)
To: sergei.shtylyov
Cc: john, davem, nbd, netdev, linux-kernel, linux-mediatek, keyhaede,
objelf
In-Reply-To: <0582f22e-6e6f-1564-fcdd-1bcfc3562cf3@cogentembedded.com>
Date: Thu, 22 Sep 2016 19:48:47 +0300, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
>On 09/22/2016 07:16 PM, sean.wang@mediatek.com wrote:
>
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> fix typo in mediatek-net.txt and add phy-mode "trgmii" to ethernet.txt
>
> These changes are unrelated to each other, so there should be 2 separate
>patches. And have the patches I reviewed been merged already, why are you
>sending an incremental patch?
>
okay, I will make them into distinct patchs.
I saw they had been applied so I created an incremental
patch based on codebase after applied.
>> Cc: devicetree@vger.kernel.org
>> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>[...]
>
>MBR, Sergei
>
>
^ permalink raw reply
* Re: [PATCH net-next v2 0/3] add support for RGMII on GMAC0 through TRGMII hardware module
From: David Miller @ 2016-09-23 0:13 UTC (permalink / raw)
To: sergei.shtylyov
Cc: sean.wang, john, nbd, netdev, linux-kernel, linux-mediatek,
andrew, f.fainelli, keyhaede, objelf
In-Reply-To: <b2157c96-0b5c-5b7a-31c2-9eb4df71c73d@cogentembedded.com>
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Thu, 22 Sep 2016 20:08:47 +0300
> Despite my comments? Sigh...
Sorry, I thought he had addressed your feedback in v2.
I'll wait longer next time.
^ permalink raw reply
* Re: [PATCH net-next v2 0/3] add support for RGMII on GMAC0 through TRGMII hardware module
From: Sergei Shtylyov @ 2016-09-22 17:08 UTC (permalink / raw)
To: David Miller, sean.wang
Cc: john, nbd, netdev, linux-kernel, linux-mediatek, andrew,
f.fainelli, keyhaede, objelf
In-Reply-To: <20160922.082247.198689057396545219.davem@davemloft.net>
Hello.
On 09/22/2016 03:22 PM, David Miller wrote:
>> By default, GMAC0 is connected to built-in switch called
>> MT7530 through the proprietary interface called Turbo RGMII
>> (TRGMII). TRGMII also supports well for RGMII as generic external
>> PHY uses but requires some slight changes to the setup of TRGMII
>> and doesn't have well support on current driver.
>>
>> So this patchset
>> 1) provides the slight changes of the setup for RGMII can work
>> through TRGMII
>> 2) adds additional setting "trgmii" as PHY_INTERFACE_MODE_TRGMII
>> about phy-mode on device tree to make GMAC0 distinguish which
>> mode it runs
>> 3) changes dynamically source clock, TX/RX delay and interface
>> mode on TRGMII for adapting various link
>>
>> Changes since v1:
>> - fixed the style of comment which doesn't have a space at
>> the beginning and end of comment lines
>> - add support for phy-mode "trgmii" as PHY_INTERFACE_MODE_TRGMII
>> into linux/phy.h
>> - enhance the Documentation about device tree binding for trgmii
>> which is applicable only for GMAC0 which uses fixed-link
>
> Series applied.
Despite my comments? Sigh...
MBR, Sergei
^ permalink raw reply
* Re: [PATCH net-next] Documentation: devicetree: revise ethernet device-tree binding about TRGMII
From: Sergei Shtylyov @ 2016-09-22 16:48 UTC (permalink / raw)
To: sean.wang, davem, john
Cc: nbd, netdev, linux-kernel, linux-mediatek, devicetree, keyhaede,
objelf
In-Reply-To: <1474560996-20863-1-git-send-email-sean.wang@mediatek.com>
On 09/22/2016 07:16 PM, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> fix typo in mediatek-net.txt and add phy-mode "trgmii" to ethernet.txt
These changes are unrelated to each other, so there should be 2 separate
patches. And have the patches I reviewed been merged already, why are you
sending an incremental patch?
> Cc: devicetree@vger.kernel.org
> Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
[...]
MBR, Sergei
^ permalink raw reply
* [PATCH net-next] Documentation: devicetree: revise ethernet device-tree binding about TRGMII
From: sean.wang @ 2016-09-22 16:16 UTC (permalink / raw)
To: davem, sergei.shtylyov, john
Cc: nbd, netdev, linux-kernel, linux-mediatek, devicetree, keyhaede,
objelf, Sean Wang
From: Sean Wang <sean.wang@mediatek.com>
fix typo in mediatek-net.txt and add phy-mode "trgmii" to ethernet.txt
Cc: devicetree@vger.kernel.org
Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
Documentation/devicetree/bindings/net/ethernet.txt | 4 ++--
Documentation/devicetree/bindings/net/mediatek-net.txt | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt
index 5d88f37..e1d7681 100644
--- a/Documentation/devicetree/bindings/net/ethernet.txt
+++ b/Documentation/devicetree/bindings/net/ethernet.txt
@@ -11,8 +11,8 @@ The following properties are common to the Ethernet controllers:
the maximum frame size (there's contradiction in ePAPR).
- phy-mode: string, operation mode of the PHY interface; supported values are
"mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id",
- "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii"; this is now a de-facto
- standard property;
+ "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii", "trgmii"; this is now a
+ de-facto standard property;
- phy-connection-type: the same as "phy-mode" property but described in ePAPR;
- phy-handle: phandle, specifies a reference to a node representing a PHY
device; this property is described in ePAPR and so preferred;
diff --git a/Documentation/devicetree/bindings/net/mediatek-net.txt b/Documentation/devicetree/bindings/net/mediatek-net.txt
index bae848e..da05f8b 100644
--- a/Documentation/devicetree/bindings/net/mediatek-net.txt
+++ b/Documentation/devicetree/bindings/net/mediatek-net.txt
@@ -34,7 +34,7 @@ Required properties:
- phy-handle: see ethernet.txt file in the same directory and
the phy-mode "trgmii" required being provided when reg
is equal to 0 and the MAC uses fixed-link to connect
- with inernal switch such as MT7530.
+ with internal switch such as MT7530.
Example:
--
1.9.1
^ permalink raw reply related
* Re: [PATCH net-next v2 3/3] net: ethernet: mediatek: add the dts property to set if TRGMII supported on GMAC0
From: Sean Wang @ 2016-09-22 15:21 UTC (permalink / raw)
To: sergei.shtylyov
Cc: john, davem, nbd, netdev, linux-kernel, linux-mediatek, keyhaede
In-Reply-To: <b04e14ff-15db-9cc8-9490-204da8c5837d@cogentembedded.com>
Date: Thu, 22 Sep 2016 14:28:36 +0300, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
>Hello.
>
>On 9/22/2016 5:33 AM, sean.wang@mediatek.com wrote:
>
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> Add the dts property for the capability if TRGMII supported on GAMC0
>>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>> ---
>> Documentation/devicetree/bindings/net/mediatek-net.txt | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/mediatek-net.txt b/Documentation/devicetree/bindings/net/mediatek-net.txt
>> index 6103e55..7111278 100644
>> --- a/Documentation/devicetree/bindings/net/mediatek-net.txt
>> +++ b/Documentation/devicetree/bindings/net/mediatek-net.txt
>> @@ -31,7 +31,10 @@ Optional properties:
>> Required properties:
>> - compatible: Should be "mediatek,eth-mac"
>> - reg: The number of the MAC
>> -- phy-handle: see ethernet.txt file in the same directory.
>> +- phy-handle: see ethernet.txt file in the same directory and
>> + the phy-mode "trgmii" required being provided when reg
>
> Since you've modified the generic parser of the "phy-mode" to add your
>"trgmii", you also need to update ethernet.txt...
>
>> + is equal to 0 and the MAC uses fixed-link to connect
>> + with inernal switch such as MT7530.
>
> Internal.
>
thank you for taking time and effort to review this
I will fix it up
^ permalink raw reply
* Re: [PATCH net-next] net: ethernet: mediatek: get out of potential invalid pointer access
From: David Miller @ 2016-09-22 12:23 UTC (permalink / raw)
To: sean.wang
Cc: john, nbd, netdev, linux-kernel, linux-mediatek, keyhaede, objelf
In-Reply-To: <1474533856-22753-1-git-send-email-sean.wang@mediatek.com>
From: <sean.wang@mediatek.com>
Date: Thu, 22 Sep 2016 16:44:16 +0800
> From: Sean Wang <sean.wang@mediatek.com>
>
> Potential dangerous invalid pointer might be accessed if
> the error happens when couple phy_device to net_device so
> cleanup the error path.
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: ethernet: mediatek: use [get|set]_link_ksettings
From: David Miller @ 2016-09-22 12:23 UTC (permalink / raw)
To: sean.wang
Cc: john, nbd, netdev, linux-kernel, linux-mediatek, keyhaede, objelf
In-Reply-To: <1474533723-22629-1-git-send-email-sean.wang@mediatek.com>
From: <sean.wang@mediatek.com>
Date: Thu, 22 Sep 2016 16:42:03 +0800
> From: Sean Wang <sean.wang@mediatek.com>
>
> 1) use new api [get|set]_link_ksettings instead
> of [get|set]_settings old ones.
>
> 2) dev->phydev is sure being ready before calling
> these callbacks, so removing all the sanity check
> if it is existing.
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: ethernet: mediatek: remove superfluous local variable for phy address
From: David Miller @ 2016-09-22 12:23 UTC (permalink / raw)
To: sean.wang
Cc: john, nbd, netdev, linux-kernel, linux-mediatek, keyhaede, objelf
In-Reply-To: <1474533375-22423-1-git-send-email-sean.wang@mediatek.com>
From: <sean.wang@mediatek.com>
Date: Thu, 22 Sep 2016 16:36:15 +0800
> From: Sean Wang <sean.wang@mediatek.com>
>
> remove the unused variable for parsing PHY address
> and the related logic for sanity test which would
> be all already handled done when of_mdiobus_register
> was called
>
> Reported-by: Nelson Chang <nelson.chang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: ethernet: mediatek: use phydev from struct net_device
From: David Miller @ 2016-09-22 12:23 UTC (permalink / raw)
To: sean.wang
Cc: john, nbd, netdev, linux-kernel, linux-mediatek, keyhaede, objelf
In-Reply-To: <1474533215-22273-1-git-send-email-sean.wang@mediatek.com>
From: <sean.wang@mediatek.com>
Date: Thu, 22 Sep 2016 16:33:35 +0800
> From: Sean Wang <sean.wang@mediatek.com>
>
> reuse phydev already in struct net_device instead of creating
> another new one in private structure.
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next v2 0/3] add support for RGMII on GMAC0 through TRGMII hardware module
From: David Miller @ 2016-09-22 12:22 UTC (permalink / raw)
To: sean.wang
Cc: john, nbd, netdev, linux-kernel, linux-mediatek, andrew,
f.fainelli, keyhaede, objelf
In-Reply-To: <1474511636-11644-1-git-send-email-sean.wang@mediatek.com>
From: <sean.wang@mediatek.com>
Date: Thu, 22 Sep 2016 10:33:53 +0800
> By default, GMAC0 is connected to built-in switch called
> MT7530 through the proprietary interface called Turbo RGMII
> (TRGMII). TRGMII also supports well for RGMII as generic external
> PHY uses but requires some slight changes to the setup of TRGMII
> and doesn't have well support on current driver.
>
> So this patchset
> 1) provides the slight changes of the setup for RGMII can work
> through TRGMII
> 2) adds additional setting "trgmii" as PHY_INTERFACE_MODE_TRGMII
> about phy-mode on device tree to make GMAC0 distinguish which
> mode it runs
> 3) changes dynamically source clock, TX/RX delay and interface
> mode on TRGMII for adapting various link
>
> Changes since v1:
> - fixed the style of comment which doesn't have a space at
> the beginning and end of comment lines
> - add support for phy-mode "trgmii" as PHY_INTERFACE_MODE_TRGMII
> into linux/phy.h
> - enhance the Documentation about device tree binding for trgmii
> which is applicable only for GMAC0 which uses fixed-link
Series applied.
^ permalink raw reply
* Re: [PATCH net-next v2 1/3] net: ethernet: mediatek: add extension of phy-mode for TRGMII
From: Sergei Shtylyov @ 2016-09-22 11:30 UTC (permalink / raw)
To: sean.wang, john, davem
Cc: nbd, netdev, linux-kernel, linux-mediatek, andrew, f.fainelli,
keyhaede, objelf
In-Reply-To: <1474511636-11644-2-git-send-email-sean.wang@mediatek.com>
Hello.
On 9/22/2016 5:33 AM, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> adds PHY-mode "trgmii" as an extension for the operation
> mode of the PHY interface for PHY_INTERFACE_MODE_TRGMII.
> and adds a variable trgmii inside mtk_mac as the indication
> to make the difference between the MAC connected to internal
> switch or connected to external PHY by the given configuration
> on the board and then to perform the corresponding setup on
> TRGMII hardware module.
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> ---
> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 ++
> drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 +++
> include/linux/phy.h | 3 +++
> 3 files changed, 8 insertions(+)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index ca6b501..827f4bd 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -244,6 +244,8 @@ static int mtk_phy_connect(struct mtk_mac *mac)
> return -ENODEV;
>
> switch (of_get_phy_mode(np)) {
> + case PHY_INTERFACE_MODE_TRGMII:
> + mac->trgmii = true;
> case PHY_INTERFACE_MODE_RGMII_TXID:
> case PHY_INTERFACE_MODE_RGMII_RXID:
> case PHY_INTERFACE_MODE_RGMII_ID:
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> index 7c5e534..e3b9525 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> @@ -529,6 +529,8 @@ struct mtk_eth {
> * @hw: Backpointer to our main datastruture
> * @hw_stats: Packet statistics counter
> * @phy_dev: The attached PHY if available
> + * @trgmii Indicate if the MAC uses TRGMII connected to internal
> + switch
> */
> struct mtk_mac {
> int id;
> @@ -539,6 +541,7 @@ struct mtk_mac {
> struct phy_device *phy_dev;
> __be32 hwlro_ip[MTK_MAX_LRO_IP_CNT];
> int hwlro_ip_cnt;
> + bool trgmii;
I don't see where this is used.
[...]
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 2d24b28..e25f183 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -80,6 +80,7 @@ typedef enum {
> PHY_INTERFACE_MODE_XGMII,
> PHY_INTERFACE_MODE_MOCA,
> PHY_INTERFACE_MODE_QSGMII,
> + PHY_INTERFACE_MODE_TRGMII,
> PHY_INTERFACE_MODE_MAX,
> } phy_interface_t;
>
> @@ -123,6 +124,8 @@ static inline const char *phy_modes(phy_interface_t interface)
> return "moca";
> case PHY_INTERFACE_MODE_QSGMII:
> return "qsgmii";
> + case PHY_INTERFACE_MODE_TRGMII:
> + return "trgmii";
> default:
> return "unknown";
> }
I think this should be done in a separate phylib patch.
MBR, Sergei
^ permalink raw reply
* Re: [PATCH net-next v2 3/3] net: ethernet: mediatek: add the dts property to set if TRGMII supported on GMAC0
From: Sergei Shtylyov @ 2016-09-22 11:28 UTC (permalink / raw)
To: sean.wang, john, davem
Cc: nbd, netdev, linux-kernel, linux-mediatek, andrew, f.fainelli,
keyhaede, objelf
In-Reply-To: <1474511636-11644-4-git-send-email-sean.wang@mediatek.com>
Hello.
On 9/22/2016 5:33 AM, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> Add the dts property for the capability if TRGMII supported on GAMC0
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> Documentation/devicetree/bindings/net/mediatek-net.txt | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/net/mediatek-net.txt b/Documentation/devicetree/bindings/net/mediatek-net.txt
> index 6103e55..7111278 100644
> --- a/Documentation/devicetree/bindings/net/mediatek-net.txt
> +++ b/Documentation/devicetree/bindings/net/mediatek-net.txt
> @@ -31,7 +31,10 @@ Optional properties:
> Required properties:
> - compatible: Should be "mediatek,eth-mac"
> - reg: The number of the MAC
> -- phy-handle: see ethernet.txt file in the same directory.
> +- phy-handle: see ethernet.txt file in the same directory and
> + the phy-mode "trgmii" required being provided when reg
Since you've modified the generic parser of the "phy-mode" to add your
"trgmii", you also need to update ethernet.txt...
> + is equal to 0 and the MAC uses fixed-link to connect
> + with inernal switch such as MT7530.
Internal.
[...]
MBR, Sergei
^ permalink raw reply
* [PATCH net-next] net: ethernet: mediatek: get out of potential invalid pointer access
From: sean.wang @ 2016-09-22 8:44 UTC (permalink / raw)
To: john, davem
Cc: nbd, netdev, linux-kernel, linux-mediatek, keyhaede, objelf,
Sean Wang
From: Sean Wang <sean.wang@mediatek.com>
Potential dangerous invalid pointer might be accessed if
the error happens when couple phy_device to net_device so
cleanup the error path.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index a65801a..3d7e0cb 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -296,7 +296,9 @@ static int mtk_phy_connect(struct net_device *dev)
regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
/* couple phydev to net_device */
- mtk_phy_connect_node(eth, mac, np);
+ if (mtk_phy_connect_node(eth, mac, np))
+ goto err_phy;
+
dev->phydev->autoneg = AUTONEG_ENABLE;
dev->phydev->speed = 0;
dev->phydev->duplex = 0;
@@ -317,7 +319,7 @@ static int mtk_phy_connect(struct net_device *dev)
err_phy:
of_node_put(np);
- dev_err(eth->dev, "invalid phy_mode\n");
+ dev_err(eth->dev, "%s: invalid phy\n", __func__);
return -EINVAL;
}
--
1.9.1
^ permalink raw reply related
* [PATCH net-next] net: ethernet: mediatek: use [get|set]_link_ksettings
From: sean.wang @ 2016-09-22 8:42 UTC (permalink / raw)
To: john, davem
Cc: nbd, netdev, linux-kernel, linux-mediatek, keyhaede, objelf,
Sean Wang
From: Sean Wang <sean.wang@mediatek.com>
1) use new api [get|set]_link_ksettings instead
of [get|set]_settings old ones.
2) dev->phydev is sure being ready before calling
these callbacks, so removing all the sanity check
if it is existing.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 33 +++++++++++------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 1918c39..a65801a 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2034,35 +2034,26 @@ static int mtk_cleanup(struct mtk_eth *eth)
return 0;
}
-static int mtk_get_settings(struct net_device *dev,
- struct ethtool_cmd *cmd)
+int mtk_get_link_ksettings(struct net_device *ndev,
+ struct ethtool_link_ksettings *cmd)
{
- struct mtk_mac *mac = netdev_priv(dev);
- int err;
+ struct mtk_mac *mac = netdev_priv(ndev);
if (unlikely(test_bit(MTK_RESETTING, &mac->hw->state)))
return -EBUSY;
- err = phy_read_status(dev->phydev);
- if (err)
- return -ENODEV;
-
- return phy_ethtool_gset(dev->phydev, cmd);
+ return phy_ethtool_ksettings_get(ndev->phydev, cmd);
}
-static int mtk_set_settings(struct net_device *dev,
- struct ethtool_cmd *cmd)
+int mtk_set_link_ksettings(struct net_device *ndev,
+ const struct ethtool_link_ksettings *cmd)
{
- struct mtk_mac *mac = netdev_priv(dev);
+ struct mtk_mac *mac = netdev_priv(ndev);
- if (cmd->phy_address != dev->phydev->mdio.addr) {
- dev->phydev = mdiobus_get_phy(mac->hw->mii_bus,
- cmd->phy_address);
- if (!dev->phydev)
- return -ENODEV;
- }
+ if (unlikely(test_bit(MTK_RESETTING, &mac->hw->state)))
+ return -EBUSY;
- return phy_ethtool_sset(dev->phydev, cmd);
+ return phy_ethtool_ksettings_set(ndev->phydev, cmd);
}
static void mtk_get_drvinfo(struct net_device *dev,
@@ -2225,8 +2216,8 @@ static int mtk_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
}
static const struct ethtool_ops mtk_ethtool_ops = {
- .get_settings = mtk_get_settings,
- .set_settings = mtk_set_settings,
+ .get_link_ksettings = mtk_get_link_ksettings,
+ .set_link_ksettings = mtk_set_link_ksettings,
.get_drvinfo = mtk_get_drvinfo,
.get_msglevel = mtk_get_msglevel,
.set_msglevel = mtk_set_msglevel,
--
1.9.1
^ permalink raw reply related
* [PATCH net-next] net: ethernet: mediatek: remove superfluous local variable for phy address
From: sean.wang @ 2016-09-22 8:36 UTC (permalink / raw)
To: john, davem
Cc: nbd, netdev, linux-kernel, linux-mediatek, keyhaede, objelf,
Sean Wang
From: Sean Wang <sean.wang@mediatek.com>
remove the unused variable for parsing PHY address
and the related logic for sanity test which would
be all already handled done when of_mdiobus_register
was called
Reported-by: Nelson Chang <nelson.chang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 6b7acf4..1918c39 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -226,17 +226,9 @@ static void mtk_phy_link_adjust(struct net_device *dev)
static int mtk_phy_connect_node(struct mtk_eth *eth, struct mtk_mac *mac,
struct device_node *phy_node)
{
- const __be32 *_addr = NULL;
struct phy_device *phydev;
- int phy_mode, addr;
+ int phy_mode;
- _addr = of_get_property(phy_node, "reg", NULL);
-
- if (!_addr || (be32_to_cpu(*_addr) >= 0x20)) {
- pr_err("%s: invalid phy address\n", phy_node->name);
- return -EINVAL;
- }
- addr = be32_to_cpu(*_addr);
phy_mode = of_get_phy_mode(phy_node);
if (phy_mode < 0) {
dev_err(eth->dev, "incorrect phy-mode %d\n", phy_mode);
--
1.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox