platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ed W <lists@wildgooses.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Philip Prindeville <philipp@redfish-solutions.com>,
	platform-driver-x86@vger.kernel.org, "Enrico Weigelt,
	metux IT consult" <info@metux.net>
Cc: Andres Salomon <dilinger@queued.net>,
	Andreas Eberlein <foodeas@aeberlein.de>,
	Paul Spooren <paul@spooren.de>
Subject: Re: [PATCH v4 1/2] x86: Support APU5 & APU6 in PCEngines platform driver
Date: Fri, 20 Jan 2023 20:18:57 +0100	[thread overview]
Message-ID: <cb93fd68-5195-0d5e-cd40-5eba61df4c38@wildgooses.com> (raw)
In-Reply-To: <00b4cd69-14ce-ce1f-2bec-83ecbb928cbc@redhat.com>

On 19/01/2023 10:22, Hans de Goede wrote:

>>  /* Order in which the GPIO lines are defined in the register list */
>>  #define APU2_GPIO_LINE_LED1		0
>>  #define APU2_GPIO_LINE_LED2		1
>>  #define APU2_GPIO_LINE_LED3		2
>>  #define APU2_GPIO_LINE_MODESW		3
>> -#define APU2_GPIO_LINE_SIMSWAP		4
>> -#define APU2_GPIO_LINE_MPCIE2		5
>> -#define APU2_GPIO_LINE_MPCIE3		6
>> +#define APU2_GPIO_LINE_RESETM1		4
>> +#define APU2_GPIO_LINE_RESETM2		5
>> +#define APU2_GPIO_LINE_SIMSWAP		6
> I don't think this changing of GPIO ordering, or
> for that part the changing of the gpio_names from 
> "mpcie2_reset" to "modem1-reset" is a good idea.
>
> I'm not entirely sure how these GPIOs are supposed to be
> consumed / used by userspace. But since they are not used
> directly in this driver I assume userspace is supposed to
> use either the (deprecated) sysfs GPIO API or the new ioctl
> based GPIO API to toggle say "simswap" if it needs to.
>
> The old sysfs API exclusively uses pin-indexes inside a GPIO
> chip to select the pin, so by changing the pin order you
> have just broken the userspace API.
>
> And the new ioctl API can use either pin-indexes or GPIO-line-names,
> so by changing the names you have also just potentially broken
> that.
>
> Please keep the order as is and only use the new names for
> the newly added models (so for APU6 I believe).


Hi, I'm not sure what the "correct" thing to do is, but just to add some background to the situation:

There are an increasing number of APU boards, which are *very* similar, and also through time the
pin allocations have muddled around, plus most recently, the BIOS can configure many things and has
started to use naming conventions different to the historic kernel naming

So I don't have a board in front of me to be definitive, but something like the following happened:

- APU2 used something like mpcie sockets 1&2 for USB stuff and hence LTE cards, socket 3 was msata

- Then another version APU3, I think moved these to sockets 2&3

- Then another version APU4, moved the USB to sockets 2&3 and wired up a second SIM slot in most
versions, including a SIM line swapper chip. Now you start to wonder if you should have labelled
things PCIE1, PCIE2, PCIE3, etc, when really they mean modem 1 and modem 2, etc?

- Then came APU5, which has 3x USB sockets, plus 3x mpcie sockets. These are wired to different pcie
numbers, and so the naming modem1, modem2, modem3 starts to make a lot more sense.

- APU6, which is mentioned in the original patch, is really just the same as one of the other
boards, but with different ethernet sockets (SFP vs copper)


- There is also a rare feature, which is likely not known to most users, or even wired up correctly
on many boards. You have a reset/enable line to some of the mpcie slots. This again makes more sense
to label logically vs than per slot. It's really not clear that this feature is properly supported
or functioning on all boards (you can order special order boards wired in various ways). So changes
here are unlikely to be noticed by all but a handful of specialist users.


Overall, if one could start again, the unifying feature would be label slots logically, ie modem1,
modem2, wifi1, wifi2, rather than numbering them based on how they are wired on a specific board rev.

Additionally, users who didn't load the APU driver, likely had ACPI named devices and these all have
different (and to my eye, more logical names). So whatever we decide to do here will cause some
breakage and inconsistency...


Note that I submitted this previous patch "years ago", and I've somewhat given up on ever getting
the APU driver up to date.. I think in 2020, Enrico shot me down because he was working on some
grand unification for modem GPIO handling? (Enrico, please correct me on the details?) Hans, I think
if you search back to 2020 on "APU", you will see that you arbitrated in that thread? For whatever
reason, we seem to be stuck that there are competing voices blocking progress here. Every route
leads to some level of incompatibility. Personally I am a fairly large consumer of these devices,
but I really don't care what we decide, because we ship a custom software, where userspace will
match kernel, so we will update both in lockstep, whatever happens. Changes aren't a problem for me
personally.

My vote would be for a one-of breakage, to at least get everyone using the same
terms/names/whatever. I would suspect OpenWRT is probably the biggest voice here, so suggest we go
with whatever they suggest, and then at least we are all in sync for the future? If its a one off,
then suggest taking into account the ACPI naming as well?

Note, there is a very big risk that I missed the point... Please be gentle. Quite possibly there is
a solution to just reorder some definitions and we land where we want to be? Is it that simple?


Hopefully the above helps understanding the bigger picture?

All the best

Ed W


  parent reply	other threads:[~2023-01-20 19:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 23:11 [PATCH v4 1/2] x86: Support APU5 & APU6 in PCEngines platform driver Philip Prindeville
2023-01-19 10:22 ` Hans de Goede
2023-01-20  5:34   ` Philip Prindeville
2023-01-20  9:51     ` Hans de Goede
2023-01-20 19:18   ` Ed W [this message]
2023-02-02 11:14     ` Hans de Goede
2023-02-09  6:04       ` Philip Prindeville
2023-02-13 13:06         ` Hans de Goede
2023-02-13 14:05           ` Ed W
2023-02-13 14:25             ` Hans de Goede
     [not found]               ` <60af6134-3b0b-f8ec-1375-a9819a181911@metux.net>
2023-03-13 13:26                 ` Hans de Goede
2023-01-19 10:35 ` Hans de Goede

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=cb93fd68-5195-0d5e-cd40-5eba61df4c38@wildgooses.com \
    --to=lists@wildgooses.com \
    --cc=dilinger@queued.net \
    --cc=foodeas@aeberlein.de \
    --cc=hdegoede@redhat.com \
    --cc=info@metux.net \
    --cc=paul@spooren.de \
    --cc=philipp@redfish-solutions.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).