]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
4 months agotest: Update NAND test to avoid extra macros
Simon Glass [Thu, 22 Aug 2024 13:57:52 +0000 (07:57 -0600)]
test: Update NAND test to avoid extra macros

Write out the tests in full to allow the test to be found more easily
when there is a failure. We could use a single test function with a
for() loop but this would stop at the first failure, and some variations
might while other pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agommc: Drop the blank line before accesses
Simon Glass [Thu, 22 Aug 2024 13:57:51 +0000 (07:57 -0600)]
mmc: Drop the blank line before accesses

Several mmc subcommand print a blank line before starting and after
finishing. It isn't necessary to do both, so drop the first one.

It is questionable whether these command should produce any output at
all, but leave it for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agotest: Rename UTF_CONSOLE_REC to UTF_CONSOLE
Simon Glass [Thu, 22 Aug 2024 13:57:50 +0000 (07:57 -0600)]
test: Rename UTF_CONSOLE_REC to UTF_CONSOLE

The _REC suffix doesn't add much. Really what we want to know is whether
the test uses the console, so rename this flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
4 months agotest: Drop the blank line before test macros
Simon Glass [Thu, 22 Aug 2024 13:57:49 +0000 (07:57 -0600)]
test: Drop the blank line before test macros

Most tests don't have this. It helps to keep the test declaration
clearly associated with the function it relates to, rather than the next
one in the file. Remove the extra blank line and mention this in the
docs.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agotest: Rename unit-test flags
Simon Glass [Thu, 22 Aug 2024 13:57:48 +0000 (07:57 -0600)]
test: Rename unit-test flags

The UT_TESTF_ macros read as 'unit test test flags' which is not right.
Rename to UTF ('unit test flags').

This has the benefit of being shorter, which helps keep UNIT_TEST()
declarations on a single line.

Give the enum a name and reference it from the UNIT_TEST() macros while
we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agotest: Fail when an empty line is expected but not present
Simon Glass [Thu, 22 Aug 2024 13:57:47 +0000 (07:57 -0600)]
test: Fail when an empty line is expected but not present

The existing implementation of ut_assert_nextline_empty() cannot
distinguish between an empty line and no line at all. It can in fact be
called at the end of the recorded output and will happily return
success.

Adjust the logic so that this condition is detected. Show a failure
message in this case.

Fix the one test which falls foul of this fix.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 400175b0a7d ("test: Add a way to check each line of console...")
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
4 months agobuildman: Make test_process_limit handle time.monotonic()
Simon Glass [Thu, 22 Aug 2024 13:57:46 +0000 (07:57 -0600)]
buildman: Make test_process_limit handle time.monotonic()

Newer versions of filelock use time.monotonic() instead of time.time().
Update the test the handle this.

It would be better if filelock had support for writing unit tests which
use locking.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-samsung...
Tom Rini [Thu, 22 Aug 2024 14:15:04 +0000 (08:15 -0600)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-samsung into next

4 months agoMerge tag 'u-boot-dfu-next-20240820' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 20 Aug 2024 14:08:52 +0000 (08:08 -0600)]
Merge tag 'u-boot-dfu-next-20240820' of https://source.denx.de/u-boot/custodians/u-boot-dfu into next

u-boot-dfu-next-20240820

- Migrate Atmel usb gadget to DM_USB_GADGET
- More small cleanups/improvements on the atmel UDC driver
- Change udc uclass name from "usb" -> "usb_gadget"

4 months agousb: gadget: udc: Fix duplicate uclass name
Zixun LI [Fri, 2 Aug 2024 09:28:11 +0000 (11:28 +0200)]
usb: gadget: udc: Fix duplicate uclass name

Currently both USB host uclass and USB gadget uclass are using the same
name "usb" which break uclass functions like uclass_get_by_name().

Rename the uclass to "usb_gadget" to fix, also makes bind/unbind by class
index (or sequence) working.

This breaks the capacity of using "usb" as DT alias sequence numbering
which needs a fix afterwards.

Signed-off-by: Zixun LI <admin@hifiphile.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/all/20240802092820.917450-1-admin@hifiphile.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
4 months agoMerge tag 'v2024.10-rc3' into next
Tom Rini [Tue, 20 Aug 2024 00:24:58 +0000 (18:24 -0600)]
Merge tag 'v2024.10-rc3' into next

Prepare v2024.10-rc3

4 months agoPrepare v2024.10-rc3
Tom Rini [Mon, 19 Aug 2024 23:15:10 +0000 (17:15 -0600)]
Prepare v2024.10-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
4 months agoMerge patch series "clk: mediatek: mt7622: clk migration for OF_UPSTREAM"
Tom Rini [Mon, 19 Aug 2024 22:15:47 +0000 (16:15 -0600)]
Merge patch series "clk: mediatek: mt7622: clk migration for OF_UPSTREAM"

Christian Marangi <ansuelsmth@gmail.com> says:

These are all the required patches to migrate clk and correctly support
OF_UPSTREAM. This will align the clk index to upstream to support the same
clk implementation with downstream and upstream DTS.

4 months agoclk: mediatek: mt7622: add missing A1/2SYS clock ID
Christian Marangi [Sat, 3 Aug 2024 08:43:26 +0000 (10:43 +0200)]
clk: mediatek: mt7622: add missing A1/2SYS clock ID

Add missing A1/2SYS clock ID just as a reference for OF_UPSTREAM
support. These clocks are not defined and are not usable as current
clock topckgen OPs doesn't support gates.

These special node won't ever be used by uboot hence just add them for
reference.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
4 months agoclk: mediatek: mt7622: add missing clock PERIBUS_SEL clock
Christian Marangi [Sat, 3 Aug 2024 08:43:25 +0000 (10:43 +0200)]
clk: mediatek: mt7622: add missing clock PERIBUS_SEL clock

Add missing PERIBUS_SEL clock to match upstream linux clk ID order. Also
convert pericfg to mux + gate implementation as now we have also mux on
top of gates.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7622: add missing clock PERI_UART4_PD
Christian Marangi [Sat, 3 Aug 2024 08:43:24 +0000 (10:43 +0200)]
clk: mediatek: mt7622: add missing clock PERI_UART4_PD

Add missing clock PERI_UART4_PD for peri clock gates. This is needed to
match upstream linux clk ID in preparation for OF_UPSTREAM.
Also convert infracfg to mux + gate implementation as now we have mux on
top of gates.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7622: add missing clock MUX1_SEL
Christian Marangi [Sat, 3 Aug 2024 08:43:23 +0000 (10:43 +0200)]
clk: mediatek: mt7622: add missing clock MUX1_SEL

Add missing infra clock MUX1_SEL needed for CPU clock. This is needed to
match the upstream clk ID order in preparation for OF_UPSTREAM.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7622: add missing clock define for MAIN_CORE_EN
Christian Marangi [Sat, 3 Aug 2024 08:43:22 +0000 (10:43 +0200)]
clk: mediatek: mt7622: add missing clock define for MAIN_CORE_EN

Add missing clock for MAIN_CORE_EN. This is a special clock as it's a
gate for the APMIXED clocks required as a parent for CPU clocks.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7622: move INFRA_TRNG to the bottom
Christian Marangi [Sat, 3 Aug 2024 08:43:21 +0000 (10:43 +0200)]
clk: mediatek: mt7622: move INFRA_TRNG to the bottom

Move INFRA_TRNG clock to the bottom of the clk ID to match upstream
linux order. This is in preparation of OF_UPSTREAM.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7622: rename AUDIO_AWB3 to AUDIO_AWB2
Christian Marangi [Sat, 3 Aug 2024 08:43:20 +0000 (10:43 +0200)]
clk: mediatek: mt7622: rename AUDIO_AWB3 to AUDIO_AWB2

Rename AUDIO_AWB3 to AUDIO_AWB2 to match upstream linux naming in
preparation for OF_UPSTREAM support.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7622: fix broken peri_cgs clk with XTAL parents
Christian Marangi [Sat, 3 Aug 2024 08:43:19 +0000 (10:43 +0200)]
clk: mediatek: mt7622: fix broken peri_cgs clk with XTAL parents

Fix broken peri_cgs clock with XTAL parents as they have wrong
definition of the parent type.

Correctly fix them and use CLK_PARENT_XTAL for them.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoMerge patch series "clk: mediatek: mt7986: clk migration for OF_UPSTREAM"
Tom Rini [Mon, 19 Aug 2024 22:15:13 +0000 (16:15 -0600)]
Merge patch series "clk: mediatek: mt7986: clk migration for OF_UPSTREAM"

Christian Marangi <ansuelsmth@gmail.com> says:

These are all the required patches to migrate clk and correctly support
OF_UPSTREAM. This will align the clk index to upstream to support the same
clk implementation with downstream and upstream DTS.

4 months agoclk: mediatek: mt7986: rename CK to CLK
Christian Marangi [Sat, 3 Aug 2024 08:40:48 +0000 (10:40 +0200)]
clk: mediatek: mt7986: rename CK to CLK

Rename each entry from CK to CLK to match the include in upstream kernel
linux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
4 months agoclk: mediatek: mt7986: convert to unified infracfg gates + muxes
Christian Marangi [Sat, 3 Aug 2024 08:40:47 +0000 (10:40 +0200)]
clk: mediatek: mt7986: convert to unified infracfg gates + muxes

Convert to infracfg gates + muxes implementation now that it's
supported.

Drop infracfg-ao nodes and rename all infracfg-ao clocks to infracfg.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: replace infracfg ID with upstream linux
Christian Marangi [Sat, 3 Aug 2024 08:40:46 +0000 (10:40 +0200)]
clk: mediatek: mt7986: replace infracfg ID with upstream linux

Replace infracfg clk ID with upstream linux version.

The same format is used here with the factor first, then mux and then
gates.

To correctly reference the gates in clk_gate function, define the
gates_offs value in clk_tree now that they are at an offset from mux and
factor.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: move INFRA_TRNG_CK to the bottom of the list
Christian Marangi [Sat, 3 Aug 2024 08:40:45 +0000 (10:40 +0200)]
clk: mediatek: mt7986: move INFRA_TRNG_CK to the bottom of the list

Move INFRA_TRNG_CK to the bottom of the list to have a 1:1 match with
upstream linux clock ID.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: comment out CK_TOP_A_TUNER as not used
Christian Marangi [Sat, 3 Aug 2024 08:40:44 +0000 (10:40 +0200)]
clk: mediatek: mt7986: comment out CK_TOP_A_TUNER as not used

Comment out CK_TOP_A_TUNER as not used and not defined in upstream
kernel linux. This is to permit support of OF_UPSTREAM and have a 1:1
match with upstream linux clock ID.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: drop 1/1 spurious factor for topckgen
Christian Marangi [Sat, 3 Aug 2024 08:40:43 +0000 (10:40 +0200)]
clk: mediatek: mt7986: drop 1/1 spurious factor for topckgen

Now that we can have advanced parent handling for mux, we can drop
spurious topckgen 1/1 factor. This is in preparation to make the clk
ID match the ID in upstream include for mt7986.

Drop the factor entry from mt7986-clk.h and reference to them in
mt7981.dtsi. Muxes and gates are updated to reference the apmixed clk
following how it's done in upstream kernel linux. Add relevant clk type
flag in clk_tree for apmixed.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: reorder TOPCKGEN factor ID
Christian Marangi [Sat, 3 Aug 2024 08:40:42 +0000 (10:40 +0200)]
clk: mediatek: mt7986: reorder TOPCKGEN factor ID

Reorder TOPCKGEN factor ID to put TOP_FACTOR first and then PLL. This is
to match how it's done in upstream kernel linux and in preparation for
OF_UPSTREAM support.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: rename TOPCKGEN factor clock to upstream naming
Christian Marangi [Sat, 3 Aug 2024 08:40:41 +0000 (10:40 +0200)]
clk: mediatek: mt7986: rename TOPCKGEN factor clock to upstream naming

Rename TOPCKGEN factor clock to upstream neaming.
Upstream kernel linux reference the factor clock for apmixedpll with the
"pll" suffix. Align the naming to the upstream naming format in
preparation for OF_UPSTREAM support.

Also rename rtc clock to drop the CB_ as upstream doesn't have that.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: fix typo for infra_i2c0_ck
Christian Marangi [Sat, 3 Aug 2024 08:40:40 +0000 (10:40 +0200)]
clk: mediatek: mt7986: fix typo for infra_i2c0_ck

Fix a typo for infra_i2c0_ck where 0 was misspelled as O.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: add missing entry for IPCIE_PIPE_CK infra gate
Christian Marangi [Sat, 3 Aug 2024 08:40:39 +0000 (10:40 +0200)]
clk: mediatek: mt7986: add missing entry for IPCIE_PIPE_CK infra gate

Add missing entry for IPCIE_PIPE_CK infra gate clock. Renumber the clock
order to match the expected offset in the gate array.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: drop 1/1 infracfg spurious factor
Christian Marangi [Sat, 3 Aug 2024 08:40:38 +0000 (10:40 +0200)]
clk: mediatek: mt7986: drop 1/1 infracfg spurious factor

Now that we can have advanced parent handling for mux, we can drop
spurious infracfg 1/1 factor. This is in preparation to make the clk
ID match the ID in upstream include for mt7986.

Drop the factor entry from mt7986-clk.h and reference to them in
mt7981.dtsi. Muxes and gates are updated to reference the topckgen clk
following how it's done in upstream kernel linux. Add relevant clk type
flag in clk_tree for infracfg and topckgen.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: fix wrong parent for INFRA_ADC_26M_CK
Christian Marangi [Sat, 3 Aug 2024 08:40:37 +0000 (10:40 +0200)]
clk: mediatek: mt7986: fix wrong parent for INFRA_ADC_26M_CK

Fix wrong parent for INFRA_ADC_26M_CK as should be INFRA_ADC_FRC_CK
instead of INFRA_CK_F26M. This is to match implementation on upstream
kernel linux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: rename 66M_MCK to SYSAXI_D2
Christian Marangi [Sat, 3 Aug 2024 08:40:36 +0000 (10:40 +0200)]
clk: mediatek: mt7986: rename 66M_MCK to SYSAXI_D2

Upstream kernel linux clock include use SYSAXI_D2 instead of 66M_MCK.
Rename this clock to the upstream kernel in preparation for support of
OF_UPSTREAM.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: rename CB_CKSQ_40M to TOP_XTAL
Christian Marangi [Sat, 3 Aug 2024 08:40:35 +0000 (10:40 +0200)]
clk: mediatek: mt7986: rename CB_CKSQ_40M to TOP_XTAL

Upstream kernel linux clock include use TOP_XTAL instead of CB_CKSQ_40M.
Rename this clock to the upstream kernel in preparation for support of
OF_UPSTREAM.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7986: fix wrong shift for PCIe clocks
Christian Marangi [Sat, 3 Aug 2024 08:40:34 +0000 (10:40 +0200)]
clk: mediatek: mt7986: fix wrong shift for PCIe clocks

Fix wrong shift for PCIe clocks. This cause the PCIe port to malfunction
as the gate clocks weren't correctly enabled.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoMerge patch series "clk: mediatek: mt7988: clk migration for OF_UPSTREAM"
Tom Rini [Mon, 19 Aug 2024 22:14:29 +0000 (16:14 -0600)]
Merge patch series "clk: mediatek: mt7988: clk migration for OF_UPSTREAM"

Christian Marangi <ansuelsmth@gmail.com> says:

These are all the required patches to migrate clk and correctly support
OF_UPSTREAM. This will align the clk index to upstream to support the same
clk implementation with downstream and upstream DTS.

4 months agoclk: mediatek: mt7988: rename CK to CLK
Christian Marangi [Sat, 3 Aug 2024 08:33:02 +0000 (10:33 +0200)]
clk: mediatek: mt7988: rename CK to CLK

Rename each entry from CK to CLK to match the include in upstream kernel
linux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
4 months agoclk: mediatek: mt7988: convert to unified infracfg gates + muxes
Christian Marangi [Sat, 3 Aug 2024 08:33:01 +0000 (10:33 +0200)]
clk: mediatek: mt7988: convert to unified infracfg gates + muxes

Convert to infracfg gates + muxes implementation now that it's
supported.

Drop infracfg-ao nodes and rename all infracfg-ao clocks to infracfg.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: replace clock ID with upstream linux
Christian Marangi [Sat, 3 Aug 2024 08:33:00 +0000 (10:33 +0200)]
clk: mediatek: mt7988: replace clock ID with upstream linux

Replace infracfg clk ID with upstream linux version.

The same format is used here with the factor first, then mux and then
gates.

To correctly reference the gates in clk_gate function, define the
gates_offs value in clk_tree now that they are at an offset from mux and
factor.

Drop any comment that reference the clock ID as we now have a 1:1 match
with upstream kernel linux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: comment out infracfg clk not defined
Christian Marangi [Sat, 3 Aug 2024 08:32:59 +0000 (10:32 +0200)]
clk: mediatek: mt7988: comment out infracfg clk not defined

Comment out infracfg clk not defined in upstream kernel linux clock ID
include. These clock are not used and can be safely commented. Keep them
just to have a reference of their existence.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: drop 1/1 spurious factor for topckgen
Christian Marangi [Sat, 3 Aug 2024 08:32:58 +0000 (10:32 +0200)]
clk: mediatek: mt7988: drop 1/1 spurious factor for topckgen

Now that we can have advanced parent handling for mux, we can drop
spurious topckgen 1/1 factor. This is in preparation to make the clk
ID match the ID in upstream include for mt7988.

Drop the factor entry from mt7988-clk.h and reference to them in
mt7988.dtsi. Muxes and gates are updated to reference the apmixed clk
following how it's done in upstream kernel linux. Add relevant clk type
flag in clk_tree for apmixed and topckgen.

Also move TOP_XTAL to the fixed clock table following how it's done in
upstream linux kernel.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: reorder TOPCKGEN factor ID
Christian Marangi [Sat, 3 Aug 2024 08:32:57 +0000 (10:32 +0200)]
clk: mediatek: mt7988: reorder TOPCKGEN factor ID

Reorder TOPCKGEN factor ID to put TOP_FACTOR first and then PLL. This is
to match how it's done in upstream kernel linux and in preparation for
OF_UPSTREAM support.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: rename TOPCKGEN factor clock to upstream naming
Christian Marangi [Sat, 3 Aug 2024 08:32:56 +0000 (10:32 +0200)]
clk: mediatek: mt7988: rename TOPCKGEN factor clock to upstream naming

Rename TOPCKGEN factor clock to upstream neaming.
Upstream kernel linux reference the factor clock for apmixedpll with the
"pll" suffix. Align the naming to the upstream naming format in
preparation for OF_UPSTREAM support.

Also rename rtc clock to drop the CB_ as upstream doesn't have that.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: drop 1/1 infracfg spurious factor
Christian Marangi [Sat, 3 Aug 2024 08:32:55 +0000 (10:32 +0200)]
clk: mediatek: mt7988: drop 1/1 infracfg spurious factor

Now that we can have advanced parent handling for mux, we can drop
spurious infracfg 1/1 factor. This is in preparation to make the clk
ID match the ID in upstream include for mt7988.

Drop the factor entry from mt7988-clk.h and reference to them in
mt7988.dtsi. Muxes and gates are updated to reference the topckgen clk
following how it's done in upstream kernel linux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: fix wrong parent for INFRA_PCIE_PERI_26M_CK_P2
Christian Marangi [Sat, 3 Aug 2024 08:32:54 +0000 (10:32 +0200)]
clk: mediatek: mt7988: fix wrong parent for INFRA_PCIE_PERI_26M_CK_P2

Fix wrong parent for INFRA_PCIE_PERI_26M_CK_P2 as should be
INFRA_PCIE_PERI_26M_CK_P3 instead of INFRA_F26M_O0. This is to match
implementation on upstream kernel linux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: move INFRA_PCIE_PERI_26M_CK_Px clock at top
Christian Marangi [Sat, 3 Aug 2024 08:32:53 +0000 (10:32 +0200)]
clk: mediatek: mt7988: move INFRA_PCIE_PERI_26M_CK_Px clock at top

Move INFRA_PCIE_PERI_26M_CK_Px clock at top of the infracfg gates
in preparation for support of OF_UPSTREAM to have a 1:1 match with
upstream clock ID.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: rename TOP_CK_NPU_SEL_CM_TOPS_SEL to TOP_NPU_SEL
Christian Marangi [Sat, 3 Aug 2024 08:32:52 +0000 (10:32 +0200)]
clk: mediatek: mt7988: rename TOP_CK_NPU_SEL_CM_TOPS_SEL to TOP_NPU_SEL

Upstream kernel linux clock include use TOP_NPU_SEL instead of
TOP_CK_NPU_SEL_CM_TOPS_SEL.
Rename this clock to the upstream kernel in preparation for support of
OF_UPSTREAM.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: rename TOP_DA_SELM_XTAL_SEL to TOP_DA_SEL
Christian Marangi [Sat, 3 Aug 2024 08:32:51 +0000 (10:32 +0200)]
clk: mediatek: mt7988: rename TOP_DA_SELM_XTAL_SEL to TOP_DA_SEL

Upstream kernel linux clock include use TOP_DA_SEL instead of
TOP_DA_SELM_XTAL_SEL.
Rename this clock to the upstream kernel in preparation for support of
OF_UPSTREAM.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7988: rename CB_CKSQ_40M to TOP_XTAL
Christian Marangi [Sat, 3 Aug 2024 08:32:50 +0000 (10:32 +0200)]
clk: mediatek: mt7988: rename CB_CKSQ_40M to TOP_XTAL

Upstream kernel linux clock include use TOP_XTAL instead of CB_CKSQ_40M.
Rename this clock to the upstream kernel in preparation for support of
OF_UPSTREAM.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoMerge patch series "clk: mediatek: mt7981: clk migration for OF_UPSTREAM"
Tom Rini [Mon, 19 Aug 2024 22:13:51 +0000 (16:13 -0600)]
Merge patch series "clk: mediatek: mt7981: clk migration for OF_UPSTREAM"

Christian Marangi <ansuelsmth@gmail.com> says:

These are all the required patches to migrate clk and correctly support
OF_UPSTREAM. This will align the clk index to upstream to support the same
clk implementation with downstream and upstream DTS.

4 months agoclk: mediatek: mt7981: rename CK to CLK
Christian Marangi [Fri, 2 Aug 2024 13:53:15 +0000 (15:53 +0200)]
clk: mediatek: mt7981: rename CK to CLK

Rename each entry from CK to CLK to match the include in upstream kernel
linux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: convert to unified infracfg gates + muxes
Christian Marangi [Fri, 2 Aug 2024 13:53:14 +0000 (15:53 +0200)]
clk: mediatek: mt7981: convert to unified infracfg gates + muxes

Convert to infracfg gates + muxes implementation now that it's
supported.

Drop infracfg-ao nodes and rename all infracfg-ao clocks to infracfg.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: fix support for pwm3 clock
Christian Marangi [Fri, 2 Aug 2024 13:53:13 +0000 (15:53 +0200)]
clk: mediatek: mt7981: fix support for pwm3 clock

Add and fix support for pwm3 clock. In the pwm DTSI node we were
actually using PWM2 clock for PWM3. Now that we have correct ID also add
the missing entry of gate and mux to support PWM3 clock.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: replace infracfg ID with upstream linux
Christian Marangi [Fri, 2 Aug 2024 13:53:12 +0000 (15:53 +0200)]
clk: mediatek: mt7981: replace infracfg ID with upstream linux

Replace infracfg clk ID with upstream linux version.

Add some missing clk for PWM3 and for PCIe. The same format is used here
with the factor first, then mux and then gates.

To correctly reference the gates in clk_gate function, define the
gates_offs value in clk_tree now that they are at an offset from mux and
factor.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: drop 1/1 spurious factor
Christian Marangi [Fri, 2 Aug 2024 13:53:11 +0000 (15:53 +0200)]
clk: mediatek: mt7981: drop 1/1 spurious factor

Now that we can have advanced parent handling for mux, we can drop
spurious infracfg 1/1 factor. This is in preparation to make the clk
ID match the ID in upstream include for mt7981.

Drop the factor entry from mt7981-clk.h and reference to them in
mt7981.dtsi. Muxes and gates are updated to reference the topckgen clk
following how it's done in upstream kernel linux. Add relevant clk type
flag in clk_tree for infracfg and topckgen.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: implement sgmii0/1 clock
Christian Marangi [Fri, 2 Aug 2024 13:53:10 +0000 (15:53 +0200)]
clk: mediatek: mt7981: implement sgmii0/1 clock

Implement missing sgmii0/1 clock and update the compatible the DTS to
match upstream kernel linux and in preparation for OF_UPSTREAM support
since the ethernet node define these additional clocks.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: fix wrong parent list for INFRA_PWM1_SEL mux
Christian Marangi [Fri, 2 Aug 2024 13:53:09 +0000 (15:53 +0200)]
clk: mediatek: mt7981: fix wrong parent list for INFRA_PWM1_SEL mux

Fix wrong parent list for INFRA_PWM1_SEL mux. The list is incorrect and
the parents are just 2. This also match the upstream linux
implementation.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: fix wrong parent for TOP_FAUD clock
Christian Marangi [Fri, 2 Aug 2024 13:53:08 +0000 (15:53 +0200)]
clk: mediatek: mt7981: fix wrong parent for TOP_FAUD clock

Fix wrong parent for TOP_FAUD clock. Upstream linux sets the parent for
TOP_FAUD to TOP_AUD_SEL instead of CB_CKSQ_40M.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: swap wrong clock-names for spi nodes
Christian Marangi [Fri, 2 Aug 2024 13:53:07 +0000 (15:53 +0200)]
clk: mediatek: mt7981: swap wrong clock-names for spi nodes

Swap wrong clock-names for spi nodes as they were wrong and the spi-clk
was referencing the sel-clk and the sel-clk was referencing the spi-clk.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: add missing clock for spi1 node
Christian Marangi [Fri, 2 Aug 2024 13:53:06 +0000 (15:53 +0200)]
clk: mediatek: mt7981: add missing clock for spi1 node

Add missing clock for spi1 node. Clocks taken from upstream clock
definition and clock mux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: fix wrong clock definition for spi2
Christian Marangi [Fri, 2 Aug 2024 13:53:05 +0000 (15:53 +0200)]
clk: mediatek: mt7981: fix wrong clock definition for spi2

Fix wrong clock definition for spi2 node as they reference spi0 clock
instead of spi2.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: fix wrong mux width for pwm2 and pwm1 clock
Christian Marangi [Fri, 2 Aug 2024 13:53:04 +0000 (15:53 +0200)]
clk: mediatek: mt7981: fix wrong mux width for pwm2 and pwm1 clock

Fix wrong mux width for pwm2 and pwm1. Upstream have width 1 but U-Boot
have width set to 2. Change the value to follow upstream implementation.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: fix typo for infra_i2c0_ck
Christian Marangi [Fri, 2 Aug 2024 13:53:03 +0000 (15:53 +0200)]
clk: mediatek: mt7981: fix typo for infra_i2c0_ck

Fix a typo for infra_i2c0_ck where 0 was misspelled as O.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7981: add missing clock for infra_ipcie_pipe
Christian Marangi [Fri, 2 Aug 2024 13:53:02 +0000 (15:53 +0200)]
clk: mediatek: mt7981: add missing clock for infra_ipcie_pipe

Add missing clock for infra_ipcie_pipe to make PCIe correctly work. This
clock is a parent of the fixed clock from topckgen cb_cksq_40m.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoMerge patch series "clk: mediatek: mt7623: clk migration for OF_UPSTREAM"
Tom Rini [Mon, 19 Aug 2024 22:13:01 +0000 (16:13 -0600)]
Merge patch series "clk: mediatek: mt7623: clk migration for OF_UPSTREAM"

Christian Marangi <ansuelsmth@gmail.com> says:

These are all the required patches to migrate clk and correctly support
OF_UPSTREAM. This will align the clk index to upstream to support the same
clk implementation with downstream and upstream DTS.

4 months agoclk: mediatek: mt7623: remap peri clock ID and add MUX
Christian Marangi [Fri, 2 Aug 2024 13:45:05 +0000 (15:45 +0200)]
clk: mediatek: mt7623: remap peri clock ID and add MUX

Upstream kernel linux makes use of peri clock MUX to setup UART.

Add definition for these and add remap table as in the upstream clock ID
order gates are before MUX but we require MUX first and then clocks in
our downstream driver.

Convert the peri clk tree to MUX + GATE implementation.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
4 months agoclk: mediatek: mt7623: remap apmixedsys clock ID
Christian Marangi [Fri, 2 Aug 2024 13:45:04 +0000 (15:45 +0200)]
clk: mediatek: mt7623: remap apmixedsys clock ID

Define remap table also for apmixedsys clock ID. The clock ID starts
from 1 instead of 0 in upstream kernel linux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7623: define id_offs_map and import clk ID from upstream
Christian Marangi [Fri, 2 Aug 2024 13:45:03 +0000 (15:45 +0200)]
clk: mediatek: mt7623: define id_offs_map and import clk ID from upstream

Define id_offs_map and use clk ID form upstream linux kernel to have a
1:1 match for the TOPCKGEN clock and permit usage of OF_UPSTREAM with
upstream dtsi.

For all the gate clock, the clk ID starts from 1 instead of zero. Define
an additional clock tree for them and set the .gates_offs to 1 to
account for this.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7623: split clk tree to dedicated topckgen and apmixed
Christian Marangi [Fri, 2 Aug 2024 13:45:02 +0000 (15:45 +0200)]
clk: mediatek: mt7623: split clk tree to dedicated topckgen and apmixed

Split clk tree to dedicated topckgen and apmixed in preparation for
remap table.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: mt7623: fix broken peri_cgs clk with XTAL parents
Christian Marangi [Fri, 2 Aug 2024 13:45:01 +0000 (15:45 +0200)]
clk: mediatek: mt7623: fix broken peri_cgs clk with XTAL parents

Fix broken peri_cgs and infra_cgs clock with XTAL parents as they have
wrong definition of the parent type.

Correctly fix them and use CLK_PARENT_XTAL for them.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agodoc: samsung: Mention enabled eMMC in E850-96 board doc
Sam Protsenko [Thu, 8 Aug 2024 03:14:44 +0000 (22:14 -0500)]
doc: samsung: Mention enabled eMMC in E850-96 board doc

eMMC is enabled on E850-96 board now. Mention that in the board
documentation.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agoconfigs: e850-96: Enable MMC
Sam Protsenko [Thu, 8 Aug 2024 03:14:43 +0000 (22:14 -0500)]
configs: e850-96: Enable MMC

Enable MMC subsystem and DW MMC driver support to make eMMC functional.
Also enable a couple of related commands so the user can make use of
eMMC from U-Boot shell.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agoarm: dts: exynos: Remove outdated DW MMC properties in all Exynos dts
Sam Protsenko [Thu, 8 Aug 2024 03:14:42 +0000 (22:14 -0500)]
arm: dts: exynos: Remove outdated DW MMC properties in all Exynos dts

Upstream properties were added to device trees to follow current Linux
kernel. DW MMC driver was updated accordingly. Safely remove outdated
MMC properties. Details on removed properties are as follows:

* samsung,removable: replaced by non-removable
* samsung,bus-width: replaced by bus-width
* samsung,timing:
  - replaced by samsung,dw-mshc-ciu-div and samsung,dw-mshc-sdr-timing
    in dw_mmc nodes
  - removed from sdhci nodes (it's neither described in bindings, nor
    it's used in s5p_sdhci.c driver)
* fifoth_val: replaced by fifo-depth
* bus_hz: replaced by clock-frequency
* div: the fixed CIU clock divider value was moved to the chip data in
  exynos_dw_mmc.c driver

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Improve coding style
Sam Protsenko [Thu, 8 Aug 2024 03:14:41 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Improve coding style

Fix most of checkpatch warnings and other obvious style issues.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Use dev->name as driver's displayed name
Sam Protsenko [Thu, 8 Aug 2024 03:14:40 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Use dev->name as driver's displayed name

Reduce U-Boot footprint by reusing dev->name as a driver's displayed
name. This changes boot device name (and "mmc info" output) from "EXYNOS
DWMMC" to something like "mmc@12100000".

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Don't call dwmci_setup_cfg() after add_dwmci()
Sam Protsenko [Thu, 8 Aug 2024 03:14:39 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Don't call dwmci_setup_cfg() after add_dwmci()

add_dwmci() is already calling dwmci_setup_cfg() internally, there is no
needed to call dwmci_setup_cfg() again in case when add_dwmci() is used
(for non-DM cases). Fix it by calling dwmci_setup_cfg() only in DM
cases, when add_dwmci() wasn't called. Also, this assignment:

    host->mmc = &plat->mmc;

is wrong in non-DM case when add_dwmci() was called, as it's creating
mmc object internally. Fix that by pulling that assignment into DM case,
when add_dwmci() isn't called.

While at it, add also this missing assignment:

    host->mmc->dev = dev;

Fixes: 3537ee879e04 ("mmc: exynos_dw_mmc: support the Driver mode for Exynos")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Pull all init code into probe function
Sam Protsenko [Thu, 8 Aug 2024 03:14:38 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Pull all init code into probe function

There is no logical sense to split the initialization code between
multiple functions. Pull both do_dwmci_init() and
exynos_dwmci_core_init() into exynos_dwmmc_probe() to make the code more
simple and obvious.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Add support for ARM64 Exynos chips
Sam Protsenko [Thu, 8 Aug 2024 03:14:37 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Add support for ARM64 Exynos chips

Add the compatible entry and corresponding chip data for Exynos7
compatible chips, which covers modern ARM64 based Exynos chips. They
have some differences w.r.t. old ARM32 Exynos chips:
  - CLKSEL register offset is different
  - 64-bit IDMAC descriptor and 64-bit IDMAC registers are used
    (implemented in dw_mmc core driver)

In terms of the driver implementation, the CIU clock is obtained via CCF
framework (as opposed to ad-hoc clock driver implementation for ARM32
chips).

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Set requested freq in get_mmc_clk() callback
Sam Protsenko [Thu, 8 Aug 2024 03:14:36 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Set requested freq in get_mmc_clk() callback

By now exynos_dw_mmc driver was relying on the correct CIU clock
frequency being set on driver init. But dw_mmc core is actually trying
to change CIU clock rate dynamically, on init and in set_ios() callback,
which it's requesting via host->get_mmc_clk() callback (the name is
misleading: although it's called "get_mmc_clk()", it can actually
request both get and set operations). Implement setting the requested
rate for CIU clock in Exynos driver to achieve the correct dw_mmc core
driver operation at all times. DDR mode requires the clock to be twice
as fast (when 8 bit bus is used), so handle this too, to make DDR
function properly.

This change makes the eMMC throughput on E850-96 board twice as fast.
That's because "clock-frequency" is set to 800 MHz in E850-96 device
tree, but for DDR52 mode it should be 416 MHz (and TRM states it should
be 400 MHz for DDR50/8bit mode). The dw_mmc core is requesting 52 MHz
bus_hz for DDR52 mode, and DDR+8bit mode means it should be x2 fast, so:

    f_ciu = 2 * ciu_div * f_bus = 2 * 4 * 52e6 = 416 MHz,

where f_ciu   - freq of clock fed to DW MMC block from CMU (SDCLKIN), Hz
      f_bus   - freq of clock fed to the card (CCLKIN), Hz
      ciu_div - value of internal divider (in DW MMC block).

Another way to work that around would be overriding the
"clock-frequency" property in corresponding dts. But setting the clock
frequency dynamically as it's done here looks much neater.

This implementation follows what's done in Linux kernel dw_mmc-exynos
driver in .set_ios() callback for MMC_TIMING_MMC_DDR52 case.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Read and use DDR timing when available
Sam Protsenko [Thu, 8 Aug 2024 03:14:35 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Read and use DDR timing when available

DDR timing values should be defined in "samsung,dw-mshc-ddr-timing" dts
property, and used when DDR MMC mode is selected. Read that value from
dts and use it. If it's not available, use SDR timing values instead.
This change is following upstream Linux kernel implementation.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Move quirks from struct dwmci_host to chip data
Sam Protsenko [Thu, 8 Aug 2024 03:14:34 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Move quirks from struct dwmci_host to chip data

host->quirks field is only used internally in exynos_dw_mmc.c driver.
To avoid cluttering the scope of struct dwmci_host, move quirks field
into Exynos driver's chip data, where it can be statically defined.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Read common clock-frequency property
Sam Protsenko [Thu, 8 Aug 2024 03:14:33 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Read common clock-frequency property

Instead of using non-standard "bus_hz" dts property, read common
"clock-frequency" property used in upstream Linux kernel. It's safe to
do so, as "clock-frequency" property was already added to corresponding
nodes in all affected Exynos device tree files.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Read common bus-width property
Sam Protsenko [Thu, 8 Aug 2024 03:14:32 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Read common bus-width property

Instead of using non-standard "samsung,bus-width" dts property, read
common "bus-width" property used in upstream Linux kernel. It's safe to
do so, as "bus-width" property was already added to corresponding nodes
in all affected Exynos device tree files.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Refactor fixed CIU clock divider
Sam Protsenko [Thu, 8 Aug 2024 03:14:31 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Refactor fixed CIU clock divider

Some chips like Exynos4412 have fixed internal CIU clock divider.
Instead of reading it from non-standard "div" dts property, store its
value in the driver internally, in static chip data associated with
corresponding compatible. This makes it possible to avoid using
host->div for storing it, so the latter can be removed safely. Also
create a helper function called exynos_dwmmc_get_ciu_div() for getting
the current div value: in case the fixed div is provided in the chip
data it will be used, otherwise the current div value is being read from
CLKSEL register.

The insights for this change were taken from dw_mmc-exynos.c driver in
Linux kernel.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Abstract CLKSEL register
Sam Protsenko [Thu, 8 Aug 2024 03:14:30 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Abstract CLKSEL register

CLKSEL register offset may vary between different Exynos chips, e.g. on
ARM64 vs ARM32 chips. Provide a way to specify its offset value for each
compatible instead of hard-coding its value in read/write calls.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Read upstream SDR timing properties
Sam Protsenko [Thu, 8 Aug 2024 03:14:29 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Read upstream SDR timing properties

The obsolete "samsung,timing" dts property is now split into
"samsung,dw-mshc-ciu-div" (for holding the internal DW MMC divider
value) and "samsung,dw-mshc-sdr-timing" (for actual timing values) in
upstream Linux kernel. Rework the driver to make use of new properties
instead of the old one. All affected dts files were already updated
accordingly.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Convert to use livetree API
Sam Protsenko [Thu, 8 Aug 2024 03:14:28 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Convert to use livetree API

Update the driver to use livetree API instead of FDT one.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Use .of_to_plat for device tree parsing
Sam Protsenko [Thu, 8 Aug 2024 03:14:27 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Use .of_to_plat for device tree parsing

exynos_dwmci_get_config() is called from the probe function and used to
read data from device tree. Make use of .of_to_plat driver callback
instead, and convert exynos_dwmci_get_config() to match its signature.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Obtain and use CIU clock via CCF API
Sam Protsenko [Thu, 8 Aug 2024 03:14:26 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Obtain and use CIU clock via CCF API

New Exynos chips should implement clock drivers using CCF framework. In
that case corresponding CCF functions can be used to get/set the clock
rates. Moreover, already existing get_mmc_clk() and set_mmc_clk() calls
are only implemented for CONFIG_CPU_V7A (i.e. ARM32 chips). In case of
ARM64 chips that config option is not defined, so build will crash on
linking stage, with errors like these:

    ld: drivers/mmc/exynos_dw_mmc.o:
      in function `exynos_dwmci_get_sclk':
      undefined reference to `get_mmc_clk'
    ld: drivers/mmc/exynos_dw_mmc.o:
      in function `exynos_dwmci_set_sclk':
      undefined reference to `set_mmc_clk'

Fix that issue by using CCF clocks API on ARM64 platforms for getting
and setting the source clock (sclk = SDCLKIN = CIU) rate. To implement
this, first extract the existing ARM32 clock control code into helper
functions with more generic signatures to abstract getting/setting the
sclk rate. Then add CCF clock support to those functions for ARM64
platforms.

Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Don't call pinmux functions on ARM64 chips
Sam Protsenko [Thu, 8 Aug 2024 03:14:25 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Don't call pinmux functions on ARM64 chips

Pinmux configuration on ARM64 platforms must be performed during startup
in pinctrl driver using info from device tree. exynos_pinmux_config()
and pinmux_decode_periph_id() are only available on ARM32 platforms, so
don't call those functions on ARM64 platforms. Instead of the latter
function, use "non-removable" property from device tree to derive the
dev_index value.

This fixes next linking errors on ARM64 platforms:

    ld: drivers/mmc/exynos_dw_mmc.o:
      in function `exynos_dwmci_get_config':
      undefined reference to `pinmux_decode_periph_id'
    ld: drivers/mmc/exynos_dw_mmc.o:
      in function `do_dwmci_init':
      undefined reference to `exynos_pinmux_config'

Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Fix getting private data in exynos_dwmci_board_init()
Sam Protsenko [Thu, 8 Aug 2024 03:14:24 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Fix getting private data in exynos_dwmci_board_init()

In case of CONFIG_DM_MMC, host->priv actually holds (struct udevice *),
and not (struct dwmci_exynos_priv_data *). This makes *priv pointer
invalid and may lead to Synchronous Abort during its dereference later
in exynos_dwmci_board_init(). Fix it by extracting
exynos_dwmmc_get_priv() helper from exynos_dwmci_clksel() and using it
for getting the private data in exynos_dwmci_board_init()

Fixes: 3537ee879e04 ("mmc: exynos_dw_mmc: support the Driver mode for Exynos")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: exynos_dw_mmc: Fix obtaining the base address of controller
Sam Protsenko [Thu, 8 Aug 2024 03:14:23 +0000 (22:14 -0500)]
mmc: exynos_dw_mmc: Fix obtaining the base address of controller

Getting the base address with outdated fdtdec_get_addr() API and further
casting it to (void *) leads to next build warning on ARM64 platforms:

    In function 'exynos_dwmci_get_config':
        warning: cast to pointer from integer of different size
        [-Wint-to-pointer-cast]
            host->ioaddr = (void *)base;

Use livetree API instead (dev_read_addr_ptr()), which handles this
correctly.

Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agoarm: exynos: Add header guard for dwmmc.h
Sam Protsenko [Thu, 8 Aug 2024 03:14:22 +0000 (22:14 -0500)]
arm: exynos: Add header guard for dwmmc.h

Add missing header guard to prevent possible build errors.

Fixes: 77b55e8cfcee ("ARM: exynos: move SoC sources to mach-exynos")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agodt-bindings: exynos: Update bindings doc for DW MMC controller
Sam Protsenko [Thu, 8 Aug 2024 03:14:21 +0000 (22:14 -0500)]
dt-bindings: exynos: Update bindings doc for DW MMC controller

Update the bindings doc for Exynos DW MMC block to follow the upstream
example and reflect the latest changes made in corresponding Linux
kernel bindings.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agoarm: dts: exynos: Add upstream DW MMC properties to all Exynos dts
Sam Protsenko [Thu, 8 Aug 2024 03:14:20 +0000 (22:14 -0500)]
arm: dts: exynos: Add upstream DW MMC properties to all Exynos dts

Some device tree properties for DW MMC block were updated in Linux
kernel. Let's follow its example and rework corresponding properties in
all Exynos device trees. Don't remove outdated properties yet, it'll be
done later once DW MMC driver is updated accordingly to read the updated
properties instead of outdated ones.

Next properties are added:

* samsung,dw-mshc-ciu-div and samsung,dw-mshc-sdr-timing:

  They were derived from outdated samsung,timing property.

* fifo-depth (generic replacement for fifoth_val):

  FIFO depth was calculated from fifoth_val (using expressions from
  FIFOTH register description in TRM):

      fifo-depth = ((fifoth_val >> 16) + 1) * 2

* bus-width: generic replacement for samsung,bus-width
* clock-frequency: generic replacement for bus_hz
* non-removable: generic replacement for samsung,removable = <0>

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Improve coding style
Sam Protsenko [Thu, 8 Aug 2024 03:14:19 +0000 (22:14 -0500)]
mmc: dw_mmc: Improve coding style

Fix most of checkpatch warnings and other obvious style issues.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Fix kernel-doc comments in dwmmc.h
Sam Protsenko [Thu, 8 Aug 2024 03:14:18 +0000 (22:14 -0500)]
mmc: dw_mmc: Fix kernel-doc comments in dwmmc.h

Rework kernel-doc comments in dwmmc.h header so it's actually possible
to generate a proper documentation from it usin scripts/kernel-doc
script, with no errors.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
4 months agommc: dw_mmc: Replace fifoth_val property with fifo-depth
Sam Protsenko [Thu, 8 Aug 2024 03:14:17 +0000 (22:14 -0500)]
mmc: dw_mmc: Replace fifoth_val property with fifo-depth

Replace fifoth_val property with its fifo-depth counterpart in all DW
MMC drivers. fifo-depth is a common property used in upstream Linux
kernel. The FIFOTH register value will be calculated using fifo-depth
value in DW MMC core (dw_mmc.c). This change reduces code duplication in
platform drivers, and pulls common FIFOTH register value calculation
into core dw_mmc driver where it belongs.

No functional change.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>