All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard Hsu(許育彰)" <Richard_Hsu@asmedia.com.tw>
To: "Bjorn Helgaas" <helgaas@kernel.org>,
	"Richard Hsu" <saraon640529@gmail.com>,
	"Richard Hsu(許育彰)" <Richard_Hsu@asmedia.com.tw>
Cc: "Yd Tseng(曾裕達)" <Yd_Tseng@asmedia.com.tw>,
	"Jesse1 Chang(張國器)" <Jesse1_Chang@asmedia.com.tw>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"bgolaszewski@baylibre.com" <bgolaszewski@baylibre.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"Lee Jones" <lee.jones@linaro.org>
Subject: RE: [PATCH] gpio:asm28xx-18xx: new driver
Date: Mon, 8 Jun 2020 08:57:24 +0000	[thread overview]
Message-ID: <64b6e37f10a048189b2661f328e3f13c@asmedia.com.tw> (raw)
In-Reply-To: <20200605171244.GA1140813@bjorn-Precision-5520>

Hi Bjorn Helgaas,
    Thank for your detailed explanation and benefited me a lot.
  I am sorry for your confusion. As you mentioned, i have a single PCIe switch port
and also implements some GPIOs.

>Your driver looks for PCI_VENDOR_ID_ASMEDIA devices: [1b21:2824], [1b21:2812], [1b21:2806], [1b21:1824], etc).
>But I haven't found a second driver that needs to claim these devices. 
   these devices are PCIe switch port and use "pcieport" as main driver.

Hi Bartosz Golaszewski and linus Walleij,
   Thanks for your help. I almost know the problem of this driver. Sorry! This is my mistake to use driver's framework incorrectly. 

BR,
   Richard 

-----Original Message-----
From: Bjorn Helgaas <helgaas@kernel.org> 
Sent: Saturday, June 6, 2020 1:13 AM
To: Richard Hsu <saraon640529@gmail.com>
Cc: Richard Hsu(許育彰) <Richard_Hsu@asmedia.com.tw>; Yd Tseng(曾裕達) <Yd_Tseng@asmedia.com.tw>; Jesse1 Chang(張國器) <Jesse1_Chang@asmedia.com.tw>; linus.walleij@linaro.org; bgolaszewski@baylibre.com; bhelgaas@google.com; linux-gpio@vger.kernel.org; linux-pci@vger.kernel.org; Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH] gpio:asm28xx-18xx: new driver

[+cc Lee in case he can shed light on the MFD question below]

On Mon, Jun 01, 2020 at 03:36:04PM +0800, Richard Hsu wrote:
> Hi Bjorn Helgaas,
>  1. What are the other functions and where is the other driver?
>  >PCI bus and GPIO can be considered as two functions independently.
>  And the driver is located at drivers/gpio/gpio-amd8111.c

I'm obviously missing the point here; sorry for being slow.

drivers/gpio/gpio-amd8111.c uses for_each_pci_dev() to look for PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS [1022:746b] devices.
drivers/i2c/busses/i2c-amd756.c claims that same device using the normal PCI probe mechanism.

In this case both i2c-amd756 and gpio-amd8111 want to use the same device, so there's at least a reason why gpio-amd8111 uses the non-standard mechanism.

Your driver looks for PCI_VENDOR_ID_ASMEDIA devices: [1b21:2824], [1b21:2812], [1b21:2806], [1b21:1824], etc).  But I haven't found a second driver that needs to claim these devices.

I can't tell what any of these devices are (other than that they seem to have some GPIO).  You might want to add them to the Linux PCI database at https://pci-ids.ucw.cz/read/PC/1b21 .  If you do, then "lspci" will show the correct names for them.

You mention below that these devices are PCIe bridges.  If that's the case, they would be claimed by the "pcieport" driver in the PCI core (drivers/pci/pcie/portdrv_pci.c).  If you collect the output of "sudo lspci -vvxxxx", it would tell us whether the pcieport driver will claim it.

If it does, then we have a problem because the PCIe port services (AER, PME, DPC, etc) currently require pcieport.  If you want the AER, PME, etc functionality in addition to GPIO, then we have to figure out how to coordinate things.

>  2.We end up with multiple drivers controlling the device without any 
> coordination between them?
>  >Yes,because two functions are independently in the device,and the 
> main driver for PCI bus function is more important.We wish they can't 
> be affected and coordinated between two drivers as much as possible.If 
> main driver is affected,it is more serious.
>  In our case,we have gpio registers on pci configuration space of 
> asm28xx pci-e bridge(with main pci bus driver).If we want to use it by 
> another driver that use gpio subsystem /sys/class/ gpio/(sysfs 
> interface).I find the driver(gpio-amd8111.c) that meet our 
> request.Sorry! i am not best friend with git,and reply mail in the 
> same way.
> 
> 
> Hi Bartosz Golaszewski,
>  Thank you.And i have studied PCI MFD device in drivers/mfd.

I'm not familiar with drivers/mfd.  It looks like it might be useful for cases where a single PCI function implements multiple sorts of functionality.

But if the problem is that you have a single function that is a PCIe switch port and also implements some GPIOs, I doubt drivers/mfd will help.  In that case, both the existing pcieport driver and your new gpio-asm28xx-18xx driver would need to operate the same function, and we'd have to make some significant changes to both of them to fit into the MFD framework.

Long-term, I think it would be good to move the pcieport things directly into the PCI core instead of being a separate driver.  We've tripped over this problem before with things like performance counters in PCIe ports.

> Maybe,it is not what i am looking for.This type of device include core 
> and miscellaneous function drivers.And function drivers export 
> resources(io/mem/dma) to sysfs.Fist,we can't implement another pci bus 
> driver as core driver,and secondly, it don't use gpio subsystem with 
> /sys/class/gpio/(sysfs interface).
>  So,you will review this driver and upstream to mainline kernel?
==================================================================================================================
This email and any attachments to it contain confidential information and are intended solely for the use of the individual to whom it 
is addressed.If you are not the intended recipient or receive it accidentally, please immediately notify the sender by e-mail and delete 
the message and any attachments from your computer system, and destroy all hard copies. If any, please be advised that any unauthorized 
disclosure, copying, distribution or any action taken or omitted in reliance on this, is illegal and prohibited. Furthermore, any views 
or opinions expressed are solely those of the author and do not represent those of ASMedia Technology Inc. Thank you for your cooperation.
==================================================================================================================

  reply	other threads:[~2020-06-08  9:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01  7:36 [PATCH] gpio:asm28xx-18xx: new driver Richard Hsu
2020-06-01 15:36 ` kbuild test robot
2020-06-01 15:36   ` kbuild test robot
2020-06-05 17:12 ` Bjorn Helgaas
2020-06-08  8:57   ` Richard Hsu(許育彰) [this message]
2020-06-04  7:32 Richard Hsu
2020-06-04 11:54 ` Bartosz Golaszewski
2020-06-04 11:54   ` Bartosz Golaszewski
2020-06-04 17:55   ` Bjorn Helgaas
2020-06-04 17:55     ` Bjorn Helgaas
2020-06-05  7:55     ` Bartosz Golaszewski
2020-06-05 10:02       ` Richard Hsu(許育彰)
2020-06-05 10:13         ` Bartosz Golaszewski
2020-06-05 10:13           ` Bartosz Golaszewski

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=64b6e37f10a048189b2661f328e3f13c@asmedia.com.tw \
    --to=richard_hsu@asmedia.com.tw \
    --cc=Jesse1_Chang@asmedia.com.tw \
    --cc=Yd_Tseng@asmedia.com.tw \
    --cc=bgolaszewski@baylibre.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=saraon640529@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.