All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 38/60] ARM: tegra: remove tegra_get_chip()
Date: Wed, 27 Apr 2016 10:13:09 -0600	[thread overview]
Message-ID: <5720E515.3020208@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ0u+C-CBQHMiZQJRZASpBpGgUnBOgh717HopHNYe+p-Vg@mail.gmail.com>

On 04/27/2016 08:50 AM, Simon Glass wrote:
> Hi Stephen,
>
> On 25 April 2016 at 13:25, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 04/23/2016 11:14 AM, Simon Glass wrote:
>>>
>>> Hi Stephen,
>>>
>>> On 19 April 2016 at 14:59, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>>>
>>>> From: Stephen Warren <swarren@nvidia.com>
>>>>
>>>> U-Boot is compiled for a single board, which in turn uses a specific SoC.
>>>> There's no need to make runtime decisions based on SoC ID. While there's
>>>> certainly an argument for making the code support different SoCs at
>>>> run-time, the Tegra code is so far from that possible ideal that the
>>>> existing runtime code is an anomaly. If this changes in the future, all
>>>> runtime decisions should likely be based on DT anyway.
>>>>
>>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>>> ---
>>>>    arch/arm/mach-tegra/ap.c               | 106
>>>> ++++++++++-----------------------
>>>>    arch/arm/mach-tegra/cache.c            |  20 +++----
>>>>    arch/arm/mach-tegra/cpu.c              |  16 ++---
>>>>    arch/arm/mach-tegra/cpu.h              |   6 --
>>>>    arch/arm/mach-tegra/tegra20/warmboot.c |  20 ++-----
>>>>    5 files changed, 51 insertions(+), 117 deletions(-)
>>>
>>>
>>> What exactly is missing to prevent multi-arch support?
>>
>> In a word: everything:-)
>>
>> Pretty much all decisions in core architecture code, core Tegra code,
>> drivers, and even board files are currently made at compile time. For
>> example, consider drivers where the register layouts are different between
>> different SoCs; not just new fields added, but existing fields moved to
>> different offsets. Right now, we handle this by changing the register struct
>> definition at compile time. To support multiple chips, we'd have to either
>> (a) link in n copies of the driver, one per register layout, or (b) rework
>> the driver to use #defines and runtime calculations for register offsets,
>> like the Linux kernel drivers do. Tegra USB is one example. The pinmux and
>> clock drivers have a significantly different sets of pins/clocks/resets/...
>> per SoC, and enums/tables describing those sets are currently configured at
>> compile time. Some PMIC constants (e.g. vdd_cpu voltage) are configured at
>> compile-time, and even differ per board.
>
> I wonder how far we would get by converting clock, pinctrl, reset to
> driver model drivers?

Well, I expect we'll find out soon. The next SoC has radically different 
clock/reset mechanisms, so we'll need to switch to standardized APIs for 
clock/reset on Tegra to isolate drivers from those differences, and I 
imagine that conversion would also involve conversion to DM since any 
standard APIs probably assume use of DM. I haven't investigated this in 
detail yet though.

>>> Shouldn't we head towards that rather than making it harder?
>>
>> I don't see any need for that, no.
>>
>> U-Boot is built for a specific board (or in some cases a set of extremely
>> closely related set of boards, such as the RPI A/B/A+/B+). There's no need
>> to determine almost anything at run-time since almost all information is
>> known at compile time, with exceptions such as standardized enumerable buses
>> such as USB, PCIe. If we support multiple HW in a single binary, it gets
>> bloated with code that simply isn't going to be used, since all the extra
>> code is either for a platform that the build won't be installed on (e.g.
>> clock/pinmux tables), or is overhead to add runtime detection of which block
>> of code to use, which simply isn't needed in the current model.
>
> It's not so much that. Presumably a build for a particular board would
> not include support for and SoC it doesn't have. But it is still
> useful to build the code. For example it would be nice to have an
> overall Tegra build that enables all SoCs to avoid building every
> board.
>
> So it is a serious question. I suspect the main impediment may be
> moving the clock and other core stuff to driver model.

Yes, everything is a bit too tightly coupled at the moment, and in many 
cases each SoC-specific implementation exposes the same global symbols 
which clients use. DM or similar conversions may well solve a lot of this.

>> In my opinion, firmware/bootloaders run on a single specific board, whereas
>> full-featured operating systems support multiple systems.
>
> Except when the boards are pretty similar. Also, doesn't barebox have
> only one build for Tegra?

I haven't looked at Barebox much. IIRC it only supports Tegra20 and not 
later SoCs which could simplify things. Besides, I'm not arguing that 
it's impossible to make a unified binary, simply that I don't see any 
need to do so, except perhaps your compile-coverage suggestion.

>> As an aside, I've wondered whether U-Boot should be split into multiple
>> parts; one HW-specific binary providing various drivers (e.g. via DM-related
>> APIs?) and the other containing just high-level user-interface code such as
>> the shell, high-level USB/... protocols, which would only call into those
>> APIs. Still, I don't think we're anywhere close to that, and I'm not aware
>> that it's a goal of the project at the moment.
>
> Well it gets built as one binary, but there's a pretty clear
> separation in the code, at least with driver model. What's the purpose
> of this?

It would allow the HW-agnostic portion to be compiled once (or once for 
a CPU ISA) and re-used with any of the HW-/board-specific "driver" 
blobs. It'd get use to "single binary" for the generic stuff, but 
without requiring the for HW-specific code. Perhaps the generic portion 
could even run on top of other driver stacks if they implemented the API 
it needed! However, this does ignore potential feature differences in 
the common binary, e.g. someone might want dfu/ums commands, but someone 
else might not need them and hence consider them bloat. Still, those 
configurations would be differentiated by feature more than HW, so it 
might still be useful.

  reply	other threads:[~2016-04-27 16:13 UTC|newest]

Thread overview: 177+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 20:58 [U-Boot] [PATCH 00/60] ARM: tegra: cleanup part 1 Stephen Warren
2016-04-19 20:58 ` [U-Boot] [PATCH 01/60] ARM: tegra: remove unused definitions in headers Stephen Warren
2016-04-20 19:25   ` Simon Glass
2016-04-24 10:20   ` Wolfgang Denk
2016-04-25 19:34     ` Stephen Warren
2016-04-25 21:46       ` Wolfgang Denk
2016-04-25 22:00         ` Stephen Warren
2016-04-25 21:54       ` Simon Glass
2016-04-25 22:02         ` Stephen Warren
2016-04-25 22:15           ` Simon Glass
2016-04-25 22:16           ` Tom Rini
2016-04-19 20:58 ` [U-Boot] [PATCH 02/60] mmc: tegra: move pad init into MMC driver Stephen Warren
2016-04-20 19:25   ` Simon Glass
2016-04-24 10:20   ` Wolfgang Denk
2016-04-25 19:42     ` Stephen Warren
2016-04-25 21:52       ` Wolfgang Denk
2016-04-25 22:37         ` Tom Rini
2016-04-25 22:43           ` Stephen Warren
2016-04-25 23:05             ` Tom Rini
2016-04-25 23:11               ` Stephen Warren
2016-04-25 23:26                 ` Tom Rini
2016-04-25 23:34                   ` Stephen Warren
2016-04-26  0:14                     ` Tom Rini
2016-04-26 16:21                       ` Stephen Warren
2016-04-26 18:15                         ` Tom Rini
2016-04-26 18:09                     ` Wolfgang Denk
2016-04-19 20:58 ` [U-Boot] [PATCH 03/60] mmc: tegra: move header file to driver directory Stephen Warren
2016-04-20 19:25   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 04/60] mmc: tegra: move public header to arch/arm/mach-tegra/include Stephen Warren
2016-04-20 19:25   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 05/60] pwm: tegra: move header file to driver directory Stephen Warren
2016-04-20 19:25   ` Simon Glass
2016-04-24 10:20   ` Wolfgang Denk
2016-04-25 19:47     ` Stephen Warren
2016-04-19 20:58 ` [U-Boot] [PATCH 06/60] i2c: " Stephen Warren
2016-04-20  4:48   ` Heiko Schocher
2016-04-20 19:25   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 07/60] usb: " Stephen Warren
2016-04-20 19:25   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 08/60] video: " Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 09/60] ARM: tegra: correct 64-bit DT unit addresses Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 10/60] ARM: tegra: sort DT /aliases entries Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 11/60] ARM: tegra: add DT alias for GPIO controller Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 12/60] gpio: tegra: remove duplicate define Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 13/60] ARM: tegra: sort some board file include directives Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-24 10:20   ` Wolfgang Denk
2016-04-25 19:54     ` Stephen Warren
2016-04-25 21:59       ` Wolfgang Denk
2016-04-25 23:22         ` Tom Rini
2016-04-26 16:18           ` Stephen Warren
2016-04-26 18:13             ` Wolfgang Denk
2016-04-26 18:20               ` Wolfgang Denk
2016-04-26 18:15             ` Tom Rini
2016-04-26 20:44               ` Stephen Warren
2016-04-26 23:29                 ` Tom Rini
2016-04-26 16:23           ` Stephen Warren
2016-04-26 18:15             ` Tom Rini
2016-04-19 20:58 ` [U-Boot] [PATCH 14/60] ARM: tegra: use DT bindings for GPIO naming Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 15/60] gpio: tegra: header file split Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-20 22:01     ` Stephen Warren
2016-04-21 14:11       ` Simon Glass
2016-04-21 16:40         ` Stephen Warren
2016-04-21 16:51           ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 16/60] ARM: tegra: migrate TEGRA_GPIO to Kconfig Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 17/60] ARM: tegra: move apb_misc.h Stephen Warren
2016-04-20 19:26   ` Simon Glass
2016-04-20 21:56     ` Stephen Warren
2016-04-21 20:59       ` Simon Glass
2016-04-21 21:14         ` Stephen Warren
2016-04-19 20:58 ` [U-Boot] [PATCH 18/60] ARM: tegra: move fuse.h Stephen Warren
2016-04-22 18:30   ` Simon Glass
2016-04-19 20:58 ` [U-Boot] [PATCH 19/60] ARM: tegra: move gpu.h Stephen Warren
2016-04-22 18:30   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 20/60] ARM: tegra: move pmc.h Stephen Warren
2016-04-22 18:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 21/60] ARM: tegra: move scu.h Stephen Warren
2016-04-22 18:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 22/60] ARM: tegra: move warmboot.h Stephen Warren
2016-04-22 18:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 23/60] ARM: tegra: move xusb-padctl.h to <mach/> Stephen Warren
2016-04-22 18:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 24/60] ARM: tegra: unify+move {board, sys_proto}.h " Stephen Warren
2016-04-22 18:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 25/60] ARM: tegra: use consistently named include guards Stephen Warren
2016-04-22 18:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 26/60] ARM: tegra: delete unused headers Stephen Warren
2016-04-22 18:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 27/60] ARM: tegra: move emc.h Stephen Warren
2016-04-22 18:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 28/60] ARM: tegra: move sdram_param.h Stephen Warren
2016-04-22 18:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 29/60] ARM: tegra: move sysctr.h Stephen Warren
2016-04-22 18:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 30/60] ARM: tegra: remove pmu.h Stephen Warren
2016-04-22 18:32   ` Simon Glass
2016-04-22 20:42     ` Stephen Warren
2016-04-19 20:59 ` [U-Boot] [PATCH 31/60] ARM: tegra: move powergate.h to <mach/> Stephen Warren
2016-04-22 18:33   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 32/60] ARM: tegra: add SoC-specific include directory Stephen Warren
2016-04-22 18:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 33/60] ARM: tegra: fix bug in Tegra20 flow.h Stephen Warren
2016-04-22 18:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 34/60] ARM: tegra: move flow.h Stephen Warren
2016-04-22 18:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 35/60] nyan-big: remove direct MC register access Stephen Warren
2016-04-22 18:33   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 36/60] ARM: tegra: move mc.h Stephen Warren
2016-04-22 18:33   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 37/60] ARM: tegra: move SDIOCFG_DRV* to pinmux.h Stephen Warren
2016-04-23 17:14   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 38/60] ARM: tegra: remove tegra_get_chip() Stephen Warren
2016-04-23 17:14   ` Simon Glass
2016-04-25 19:25     ` Stephen Warren
2016-04-27 14:50       ` Simon Glass
2016-04-27 16:13         ` Stephen Warren [this message]
2016-04-29 14:02           ` Simon Glass
2016-04-29 16:27             ` Stephen Warren
2016-04-29 16:53               ` Simon Glass
2016-04-29 17:42                 ` Simon Glass
2016-04-29 19:21                   ` Stephen Warren
2016-05-01 19:16                     ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 39/60] ARM: tegra: remove get_num_cpus() Stephen Warren
2016-04-19 20:59 ` [U-Boot] [PATCH 40/60] ARM: tegra: remove gp_padctrl.h Stephen Warren
2016-05-07 22:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 41/60] ARM: tegra: remove tegra_get_sku_info() Stephen Warren
2016-05-07 22:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 42/60] ARM: tegra: move EMC code to tegra20/ directory Stephen Warren
2016-05-07 22:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 43/60] ARM: tegra: move PLLX configuration into SoC directories Stephen Warren
2016-05-07 22:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 44/60] ARM: tegra: remove tegra_get_chip_sku() Stephen Warren
2016-05-07 22:31   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 45/60] ARM: tegra: move custom pinmux.h to <mach/> Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 46/60] ARM: tegra: add pinmux APIs to replace funcmux Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 47/60] ARM: tegra: provide API for SPL code to init UART Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 48/60] ARM: tegra: lay groundwork for board hook cleanup Stephen Warren
2016-04-19 20:59 ` [U-Boot] [PATCH 49/60] ARM: tegra: convert boards to new hooks Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 50/60] ARM: tegra: remove unused includes Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 51/60] ARM: tegra: move SPL-specific GPIO device to spl.c Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 52/60] ARM: tegra: convert pin_mux_*() to new hooks Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 53/60] tegra: keyboard: move pinmux setup to board files Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 54/60] video: tegra: " Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 55/60] i2c: " Stephen Warren
2016-04-27 15:12   ` Simon Glass
2016-04-27 16:24     ` Stephen Warren
2016-04-27 16:58       ` Simon Glass
2016-04-27 17:16         ` Stephen Warren
2016-04-29 14:02           ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 56/60] ARM: tegra: remove funcmux API Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 57/60] ARM: tegra: don't access Boot Info Table from board code Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 58/60] ARM: tegra: clean up board include statements Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 59/60] ARM: tegra: unify+move tegra.h to mach-tegra/ Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-04-19 20:59 ` [U-Boot] [PATCH 60/60] ARM: tegra: move clock headers Stephen Warren
2016-05-07 22:32   ` Simon Glass
2016-05-07 22:32 ` [U-Boot] [PATCH 00/60] ARM: tegra: cleanup part 1 Simon Glass

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=5720E515.3020208@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /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.