All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neil@brown.name>
To: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Cc: gregkh@linuxfoundation.org, driverdev-devel@linuxdriverproject.org
Subject: Re: [PATCH v4 00/15] staging: mt7621-pci: avoid custom pci config read and writes
Date: Thu, 26 Jul 2018 14:50:55 +1000	[thread overview]
Message-ID: <87a7qeob0w.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20180725074756.GA28389@foobar>


[-- Attachment #1.1: Type: text/plain, Size: 3797 bytes --]

On Wed, Jul 25 2018, Sergio Paracuellos wrote:

> On Wed, Jul 25, 2018 at 08:21:35AM +1000, NeilBrown wrote:
>> On Mon, Jul 16 2018, Sergio Paracuellos wrote:
>> 
>> > This patch series include an attempt to avoid the use of custom
>> > read and writes in driver code and use PCI subsystem common ones.
>> >
>> > In order to do this 'map_bus' callback is implemented and also
>> > data structures for driver are included. The regs base address
>> > is being readed from device tree and the driver gets clean a lot
>> > of code.
>> >
>> > Changes in v4:
>> >     - Rebased onto staging-next.
>> >
>> > Changes in v3:
>> >     - Include new patches to delete all RALINK_BASE definition
>> >       dependant code and be able to avoid use of pci_legacy code.
>> >     - use devm_of_pci_get_host_bridge_resources,
>> >       devm_request_pci_bus_resources and pci_scan_root_bus_bridge
>> >       and pci_bus_add_devices
>> >
>> > Changes in v2:
>> >     - squash PATCH 1 and PATCH 2 of previous series in only PATCH 1
>> >     - Change name for host structure.
>> >     - Create a new port structure (platform has 3 pcie controllers)
>> >     - Replace the use of pci_generic_config_[read|write]32 in favour
>> >       of pci_generic_config_[read|write] and change map_bus implemen-
>> >       tation for hopefully the right one.
>> >
>> > Best regards,
>> 
>> Thanks for these.
>> I added
>> diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
>> index 1f9cb0e3c79a..50779b3379db 100644
>> --- a/arch/mips/ralink/Kconfig
>> +++ b/arch/mips/ralink/Kconfig
>> @@ -51,6 +51,7 @@ choice
>>                 select COMMON_CLK
>>                 select CLKSRC_MIPS_GIC
>>                 select HW_HAS_PCI
>> +               select PCI_DRIVERS_GENERIC
>>  endchoice
>>  
>>  choice
>> 
>> so that I could build and test it - maybe there is somewhere else that
>> "select" can go while this is still in staging..
>> 
>> The system boots and can see the three pcie-attached SATA controllers:
>> 
>> # lspci
>> 00:00.0 PCI bridge: Device 0e8d:0801 (rev 01)
>> 00:01.0 PCI bridge: Device 0e8d:0801 (rev 01)
>> 00:02.0 PCI bridge: Device 0e8d:0801 (rev 01)
>> 01:00.0 IDE interface: ASMedia Technology Inc. ASM1061 SATA IDE Controller (rev 02)
>> 02:00.0 IDE interface: ASMedia Technology Inc. ASM1061 SATA IDE Controller (rev 02)
>> 03:00.0 IDE interface: ASMedia Technology Inc. ASM1061 SATA IDE Controller (rev 02)
>> 
>> but it cannot see the drive that is plugged into one of these.
>> Below is the first 10 seconds of dmesg.
>> I suspect the relevant bit is
>> 
>> [    8.680000] ahci: probe of 0000:01:00.0 failed with error -22
>> [    8.700000] ahci: probe of 0000:02:00.0 failed with error -22
>> [    8.710000] ahci: probe of 0000:03:00.0 failed with error -22
>> 
>> I haven't dug deeper yet.
>
> Hi Neil,
>
> Can you please make a test for me? Can you comment lines about pinctrl in the pcie 
> node of the device tree? I am not sure we have to use the reset pin there but just
> use the reset_control in a proper way. These two:
>
> pinctrl-names = "default";
> pinctrl-0 = <&pcie_pins>;
>
> Does this change make the plugged drives to work?

Thanks for the suggestion.  No, this does change anything.
I had a go at sprinking printks to see what exactly was failing.
It is pcim_iomap_regions().
"mask" is 0x20, is t wants to map region 5.
However region 5 has size zero - hence -EINVAL.

In the dmesg there is:

>> [    2.530000] pci 0000:01:00.0: BAR 5: no space for [mem size 0x00000200]
>> [    2.540000] pci 0000:01:00.0: BAR 5: failed to assign [mem size 0x00000200]

I think this is where resource 5 is not getting set up properly.
That is as far as I got today.

Thanks,
NeilBrown

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  reply	other threads:[~2018-07-26  4:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 15:53 [PATCH v4 00/15] staging: mt7621-pci: avoid custom pci config read and writes Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 01/15] staging: mt7621-pci: use generic kernel pci subsystem read and write Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 02/15] staging: mt7621-pci: remove dead code derived to not use custom reads and writes Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 03/15] staging: mt7621-pci: add pcie_write and pcie_read helpers Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 04/15] staging: mt7621-pci: use pcie_[read|write] in [write|read]_config Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 05/15] staging: mt7621-pci: simplify read_config function Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 06/15] staging: mt7621-pci: simplify write_config function Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 07/15] staging: mt7621-pci: remove unused macros Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 08/15] staging: mt7621-pci: avoid register duplication per controller using pcie_[read|write] Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 09/15] staging: mt7621-pci: remove unused includes Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 10/15] staging: mt7621-pci: use pcie_[read|write] in RALINK_PCI_PCICFG_ADDR and RALINK_PCI_PCIMSK_ADDR Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 11/15] staging: mt7621-pci: remove RALINK_PCI_BASE from remaining definitions Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 12/15] staging: mt7621-pci: use BIT macro in preprocessor definitions Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 13/15] staging: mt7621-pci: rename RALINK_PCI_CONFIG_DATA_VIRTUAL_REG definition Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 14/15] staging: mt7621-pci: remove duplicated include Sergio Paracuellos
2018-07-16 15:53 ` [PATCH v4 15/15] staging: mt7621-pci: remove remaining pci_legacy dependant code Sergio Paracuellos
2018-07-24 22:21 ` [PATCH v4 00/15] staging: mt7621-pci: avoid custom pci config read and writes NeilBrown
2018-07-25  6:14   ` Sergio Paracuellos
2018-07-25  7:47   ` Sergio Paracuellos
2018-07-26  4:50     ` NeilBrown [this message]
2018-07-26  5:59       ` Sergio Paracuellos
2018-07-26  6:45         ` NeilBrown
2018-07-26  7:34           ` Sergio Paracuellos
2018-07-26  8:23           ` Sergio Paracuellos
2018-07-26 10:02             ` NeilBrown
2018-07-26 11:24               ` Sergio Paracuellos
2018-07-26 13:11                 ` Sergio Paracuellos

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=87a7qeob0w.fsf@notabene.neil.brown.name \
    --to=neil@brown.name \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=sergio.paracuellos@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.