User:Knuxify/Draft:Qualcomm/Adding a new SoC to mainline Linux: Difference between revisions
No edit summary |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
{{Work-in-progress page|note=Currently in the middle of finding this out in real time :)}} | {{Work-in-progress page|note=Currently in the middle of finding this out in real time :)}} | ||
This guide will cover the process of adding support for a recent (~2020 or newer | This guide will cover the process of adding support for a recent (~2020 or newer) Qualcomm SoC into mainline Linux. <!--For the U-Boot guide, see TODO.--> | ||
This guide was tested with the SM7435. Some details might be different for other SoCs. If you have any hints, please contribute! | This guide was tested with the SM7435. Some details might be different for other SoCs. If you have any hints, please contribute! | ||
| Line 48: | Line 48: | ||
todo | todo | ||
== | == Clock controllers == | ||
'''A note about licences and copying code:''' a good chunk of drivers can be copied from downstream with minimal modifications. In those cases, keep the original copyright at the top of the file (Copyright (c) 20xx, Qualcomm Innovation Center, Inc. etc), and add yourself below. (This seems to be how it was done for milos as well.) | {{note|'''A note about licences and copying code:''' a good chunk of drivers can be copied from downstream with minimal modifications. In those cases, keep the original copyright at the top of the file ''(Copyright (c) 20xx, Qualcomm Innovation Center, Inc. etc)'', and add yourself below. (This seems to be how it was done for milos as well.)}} | ||
On recent Qualcomm SoCs, the downstream kernel uses the mainline Qualcomm clock driver with ''some'' vendor-specific quirks. This means that the clock drivers and their relevant headers can pretty much be copied verbatim from downstream, though quite a few modifications are needed. | On recent Qualcomm SoCs, the downstream kernel uses the mainline Qualcomm clock driver with ''some'' vendor-specific quirks. This means that the clock drivers and their relevant headers can pretty much be copied verbatim from downstream, though quite a few modifications are needed. | ||
| Line 83: | Line 81: | ||
Copy your downstream driver to <code>driver/clk/qcom/CODENAME-gcc.c</code>; also copy the dt-bindings from <code>include/dt-bindings/clock/qcom,gcc-CODENAME.h</code> to <code>include/dt-bindings/clock/qcom,CODENAME-gcc.h</code> in mainline. | Copy your downstream driver to <code>driver/clk/qcom/CODENAME-gcc.c</code>; also copy the dt-bindings from <code>include/dt-bindings/clock/qcom,gcc-CODENAME.h</code> to <code>include/dt-bindings/clock/qcom,CODENAME-gcc.h</code> in mainline. | ||
=== Simple changes === | |||
* <code><linux/platform_device.h></code> needs to be added to includes | * <code><linux/platform_device.h></code> needs to be added to includes | ||
| Line 89: | Line 87: | ||
* <code>CLK_DONT_HOLD_STATE</code> in clock flags is downstream-specific, it has no equivalent in mainline. | * <code>CLK_DONT_HOLD_STATE</code> in clock flags is downstream-specific, it has no equivalent in mainline. | ||
=== Clock VDDs/regulators === | |||
Remove anything related to "clock VDDs/regulators": | Remove anything related to "clock VDDs/regulators": | ||
| Line 100: | Line 98: | ||
These have no mainline equivalent. | These have no mainline equivalent. | ||
=== Clock parent data === | |||
Downstream and mainline differ in two significant ways when it comes to how clock parents are defined: | Downstream and mainline differ in two significant ways when it comes to how clock parents are defined: | ||
| Line 107: | Line 105: | ||
* Downstream puts the parent data directly in the clock struct; mainline puts it in separate structs. | * Downstream puts the parent data directly in the clock struct; mainline puts it in separate structs. | ||
=== Probe === | |||
The way probing is done is different in mainline. | The way probing is done is different in mainline. | ||
| Line 134: | Line 132: | ||
For the rest of the probe steps, see how other drivers do it. | For the rest of the probe steps, see how other drivers do it. | ||
== Interconnect driver == | |||
{{todo|figure out what the interconnect actually does.}} | |||
Similar to clocks, interconnects are nearly the same as in downstream, but need some changes. | Similar to clocks, interconnects are nearly the same as in downstream, but need some changes. | ||
| Line 150: | Line 148: | ||
''See https://lore.kernel.org/all/[email protected]/ for an example. Ignore the part where they add <code>alloc_dyn_id</code>, that was removed in another commit as dynamic IDs are now the only option.'' | ''See https://lore.kernel.org/all/[email protected]/ for an example. Ignore the part where they add <code>alloc_dyn_id</code>, that was removed in another commit as dynamic IDs are now the only option.'' | ||
== TLMM/pinctrl == | |||
Driver is in drivers/pinctrl/qcom. | Driver is in drivers/pinctrl/qcom. | ||