Skip to contentSkip to conversation

Add support for sam9x7 SoC and SAM9X75 Curiosity board

PATCH Superseded Manikandan Muralidharan 5 participants 20 messages Feb 27, 2025 – Mar 4, 2025

Subsystems (5)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add support for sam9x7 SoC and SAM9X75 Curiosity board

This patch series adds support for the new SoC family - sam9x7.
- sam9x7 SoC is added
- Clock driver for sam9x7 is added
- Target board SAM9X75 Curiosity is added with its differences in DT and MMC config

----

changes in v2:

- 1/8 - add additional PMC clock definition to support the sam9x7 upstream DT
- 6/8 - Remove support for SoC DT and board DTS as they are already available in dts/upstream
- add the differences in DT files between upstream Linux DT and U-Boot DT to at91-sam9x75_curiosity-u-boot.dtsi
- 7/8 - Add OF_UPSTREAM support for sam9x75 curiosity board
- 8/8 - update the DEFAULT_DEVICE_TREE config to <vendor/name>

----

Manikandan Muralidharan (4):
dt-bindings: clk: define additional PMC clocks
ARM: dts: at91: sam9x75_curiosity: add tweaks for sam9x75 curiosity
board
board: sam9x75_curiosity: Add support for sam9x75 curiosity
configs: sam9x75_curiosity: Add initial mmc default config

Varshini Rajendran (4):
clk: at91: sam9x60-pll: add support for core clock frequency inputs
clk: at91: sam9x60-pll: add support for HW PLL freq dividers
clk: at91: sam9x7: add pmc driver for sam9x7 SoC family
ARM: at91: Add sam9x7 soc

 .../dts/at91-sam9x75_curiosity-u-boot.dtsi    |  107 ++
 arch/arm/mach-at91/Kconfig                    |   12 +
 arch/arm/mach-at91/arm926ejs/Makefile         |    1 +
 arch/arm/mach-at91/arm926ejs/sam9x7_devices.c |   49 +
 arch/arm/mach-at91/include/mach/hardware.h    |    2 +
 arch/arm/mach-at91/include/mach/sam9x7.h      |  172 +++
 board/atmel/sam9x75_curiosity/Kconfig         |   15 +
 board/atmel/sam9x75_curiosity/MAINTAINERS     |    7 +
 board/atmel/sam9x75_curiosity/Makefile        |    7 +
 .../sam9x75_curiosity/sam9x75_curiosity.c     |   66 +
 configs/sam9x75_curiosity_mmc_defconfig       |   73 ++
 drivers/clk/at91/Makefile                     |    1 +
 drivers/clk/at91/clk-sam9x60-pll.c            |   55 +-
 drivers/clk/at91/pmc.h                        |    2 +
 drivers/clk/at91/sam9x60.c                    |    7 +
 drivers/clk/at91/sam9x7.c                     | 1094 +++++++++++++++++
 drivers/clk/at91/sama7g5.c                    |    6 +
 include/configs/sam9x75_curiosity.h           |   23 +
 include/dt-bindings/clk/at91.h                |    3 +
 include/dt-bindings/clock/at91.h              |    2 +
 20 files changed, 1694 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/dts/at91-sam9x75_curiosity-u-boot.dtsi
 create mode 100644 arch/arm/mach-at91/arm926ejs/sam9x7_devices.c
 create mode 100644 arch/arm/mach-at91/include/mach/sam9x7.h
 create mode 100644 board/atmel/sam9x75_curiosity/Kconfig
 create mode 100644 board/atmel/sam9x75_curiosity/MAINTAINERS
 create mode 100644 board/atmel/sam9x75_curiosity/Makefile
 create mode 100644 board/atmel/sam9x75_curiosity/sam9x75_curiosity.c
 create mode 100644 configs/sam9x75_curiosity_mmc_defconfig
 create mode 100644 drivers/clk/at91/sam9x7.c
 create mode 100644 include/configs/sam9x75_curiosity.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/8 dt-bindings: clk: define additional PMC clocks

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

---
 include/dt-bindings/clk/at91.h   | 3 +++
 include/dt-bindings/clock/at91.h | 2 ++
 2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +3 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
 #define USB_UTMI2		1
 #define USB_UTMI3		2
 
+#define PMC_MCK			1
+#define PMC_UTMI		2
+
 #endif
include/dt-bindings/clock/at91.h +2 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
  * Licensed under GPLv2 or later.
  */
 
+#include <dt-bindings/clk/at91.h>
+
 #ifndef _DT_BINDINGS_CLK_AT91_H
 #define _DT_BINDINGS_CLK_AT91_H
 
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Quoted 4 lines · Manikandan Muralidharan

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

-Sumit

Quoted 35 lines
---
 include/dt-bindings/clk/at91.h   | 3 +++
 include/dt-bindings/clock/at91.h | 2 ++
 2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +3 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
 #define USB_UTMI2              1
 #define USB_UTMI3              2
 
+#define PMC_MCK                        1
+#define PMC_UTMI               2
+
 #endif
include/dt-bindings/clock/at91.h +2 -1
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
  * Licensed under GPLv2 or later.
  */
 
+#include <dt-bindings/clk/at91.h>
+
 #ifndef _DT_BINDINGS_CLK_AT91_H
 #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

#3 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Hi Sumit,

Quoted 5 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 1 line · Manikandan Muralidharan
Quoted 7 lines
Quoted 3 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

Other SoC DTs where OF_UPSTREAM migration is not added yet, depends on the local DT bindings header, dropping this will lead to issues with compilation.
We can drop this altogether when we sync the u-boot clock framework with Linux.

Quoted 38 lines

-Sumit

Quoted 35 lines
---
  include/dt-bindings/clk/at91.h   | 3 +++
  include/dt-bindings/clock/at91.h | 2 ++
  2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +3 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
  #define USB_UTMI2              1
  #define USB_UTMI3              2
 
+#define PMC_MCK                        1
+#define PMC_UTMI               2
+
  #endif
include/dt-bindings/clock/at91.h +2 -1
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
   * Licensed under GPLv2 or later.
   */
 
+#include <dt-bindings/clk/at91.h>
+
  #ifndef _DT_BINDINGS_CLK_AT91_H
  #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

Signature · 2 lines
Thanks and Regards,
Manikandan M.
#4 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Quoted 38 lines · On 2/27/25 12:37, [email protected] wrote:

Hi Sumit,

Quoted 5 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 1 line · Manikandan Muralidharan
Quoted 7 lines
Quoted 3 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

Other SoC DTs where OF_UPSTREAM migration is not added yet, depends on the local DT bindings header, dropping this will lead to issues with compilation.
We can drop this altogether when we sync the u-boot clock framework with Linux.

Quoted 18 lines

-Sumit

Quoted 15 lines
---
  include/dt-bindings/clk/at91.h   | 3 +++
  include/dt-bindings/clock/at91.h | 2 ++
  2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
  #define USB_UTMI2              1
  #define USB_UTMI3              2
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clk/at91.h line 28

Quoted 2 lines
include/dt-bindings/clk/at91.h +2 -0
+#define PMC_MCK                        1
+#define PMC_UTMI               2

Where in the patch series do you need these defines ?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
include/dt-bindings/clk/at91.h +1 -0
+
  #endif
include/dt-bindings/clock/at91.h +0 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
   * Licensed under GPLv2 or later.
   */
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clock/at91.h line 10

Quoted 2 lines
include/dt-bindings/clock/at91.h +2 -0
+#include <dt-bindings/clk/at91.h>
+

I find this odd to include one at91.h in another at91.h

Let's consider to remove one of these files in the future, and have just one that is identical with the bindings one from Linux

Meanwhile, let's see where do you need the PMC_*

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
include/dt-bindings/clock/at91.h +0 -1
  #ifndef _DT_BINDINGS_CLK_AT91_H
  #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

#5 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Hi Eugen,

Quoted 61 lines · Eugen Hristev

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 38 lines · On 2/27/25 12:37, [email protected] wrote:

Hi Sumit,

Quoted 5 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 1 line · Manikandan Muralidharan
Quoted 7 lines
Quoted 3 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

Other SoC DTs where OF_UPSTREAM migration is not added yet, depends on the local DT bindings header, dropping this will lead to issues with compilation.
We can drop this altogether when we sync the u-boot clock framework with Linux.

Quoted 18 lines

-Sumit

Quoted 15 lines
---
   include/dt-bindings/clk/at91.h   | 3 +++
   include/dt-bindings/clock/at91.h | 2 ++
   2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
   #define USB_UTMI2              1
   #define USB_UTMI3              2
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clk/at91.h line 28

Quoted 2 lines
include/dt-bindings/clk/at91.h +2 -0
+#define PMC_MCK                        1
+#define PMC_UTMI               2

Where in the patch series do you need these defines ?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
include/dt-bindings/clk/at91.h +1 -0
+
   #endif
include/dt-bindings/clock/at91.h +0 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
    * Licensed under GPLv2 or later.
    */
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clock/at91.h line 10

Quoted 2 lines
include/dt-bindings/clock/at91.h +2 -0
+#include <dt-bindings/clk/at91.h>
+

I find this odd to include one at91.h in another at91.h

Quoted 4 lines

Let's consider to remove one of these files in the future, and have just one that is identical with the bindings one from Linux

Meanwhile, let's see where do you need the PMC_*

The PMC_MCK and PMC_UTMI are defined in the dts/upstream sam9x7 SoC DT. since during compilation the clock/at91.h from u-boot is used and to resolve the syntax issues I had to declare them in clk/at91.h and include the header in clock/at91.h

if we drop the clock/at91.h from u-boot, the sam9x75 will pass using the includes from upstream Linux but will break other SoC that has not migrated to OF_UPSTREAM yet.

Or we can align u-boot's clock/at91.h with Linux and drop clk/at91.h, replace it with clock/at91.h in drivers and DT.
Please let me know if that works.

Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
include/dt-bindings/clock/at91.h +0 -1
   #ifndef _DT_BINDINGS_CLK_AT91_H
   #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

Signature · 2 lines
Thanks and Regards,
Manikandan M.
#6 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Quoted 74 lines · On Fri, 28 Feb 2025 at 15:20, <[email protected]> wrote:

Hi Eugen,

Quoted 61 lines · Eugen Hristev

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 38 lines · On 2/27/25 12:37, [email protected] wrote:

Hi Sumit,

Quoted 5 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 1 line · Manikandan Muralidharan
Quoted 7 lines
Quoted 3 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

Other SoC DTs where OF_UPSTREAM migration is not added yet, depends on the local DT bindings header, dropping this will lead to issues with compilation.
We can drop this altogether when we sync the u-boot clock framework with Linux.

Quoted 18 lines

-Sumit

Quoted 15 lines
---
   include/dt-bindings/clk/at91.h   | 3 +++
   include/dt-bindings/clock/at91.h | 2 ++
   2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
   #define USB_UTMI2              1
   #define USB_UTMI3              2
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clk/at91.h line 28

Quoted 2 lines
include/dt-bindings/clk/at91.h +2 -0
+#define PMC_MCK                        1
+#define PMC_UTMI               2

Where in the patch series do you need these defines ?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
include/dt-bindings/clk/at91.h +1 -0
+
   #endif
include/dt-bindings/clock/at91.h +0 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
    * Licensed under GPLv2 or later.
    */
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clock/at91.h line 10

Quoted 2 lines
include/dt-bindings/clock/at91.h +2 -0
+#include <dt-bindings/clk/at91.h>
+

I find this odd to include one at91.h in another at91.h

Quoted 4 lines

Let's consider to remove one of these files in the future, and have just one that is identical with the bindings one from Linux

Meanwhile, let's see where do you need the PMC_*

The PMC_MCK and PMC_UTMI are defined in the dts/upstream sam9x7 SoC DT. since during compilation the clock/at91.h from u-boot is used and to resolve the syntax issues I had to declare them in clk/at91.h and include the header in clock/at91.h

Quoted 7 lines

if we drop the clock/at91.h from u-boot, the sam9x75 will pass using the includes from upstream Linux but will break other SoC that has not migrated to OF_UPSTREAM yet.

Or we can align u-boot's clock/at91.h with Linux and drop clk/at91.h, replace it with clock/at91.h in drivers and DT.
Please let me know if that works.

I would rather favor the U-Boot drivers and DT to directly use dts/upstream/include/dt-bindings/clock/at91.h instead and drop local DT bindings import. It then becomes easier for other SoCs to migrate to OF_UPSTREAM too.

-Sumit

Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
include/dt-bindings/clock/at91.h +0 -1
   #ifndef _DT_BINDINGS_CLK_AT91_H
   #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

--
Thanks and Regards,
Manikandan M.

#7 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Quoted 66 lines · Sumit Garg
Quoted 65 lines · On Fri, 28 Feb 2025 at 15:20, <[email protected]> wrote:

Hi Eugen,

Quoted 61 lines · Eugen Hristev

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 38 lines · On 2/27/25 12:37, [email protected] wrote:

Hi Sumit,

Quoted 5 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 1 line · Manikandan Muralidharan
Quoted 7 lines
Quoted 3 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

Other SoC DTs where OF_UPSTREAM migration is not added yet, depends on the local DT bindings header, dropping this will lead to issues with compilation.
We can drop this altogether when we sync the u-boot clock framework with Linux.

Quoted 18 lines

-Sumit

Quoted 15 lines
---
   include/dt-bindings/clk/at91.h   | 3 +++
   include/dt-bindings/clock/at91.h | 2 ++
   2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
   #define USB_UTMI2              1
   #define USB_UTMI3              2
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clk/at91.h line 28

Quoted 2 lines
include/dt-bindings/clk/at91.h +2 -0
+#define PMC_MCK                        1
+#define PMC_UTMI               2

Where in the patch series do you need these defines ?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
include/dt-bindings/clk/at91.h +1 -0
+
   #endif
include/dt-bindings/clock/at91.h +0 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
    * Licensed under GPLv2 or later.
    */
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clock/at91.h line 10

Quoted 2 lines
include/dt-bindings/clock/at91.h +2 -0
+#include <dt-bindings/clk/at91.h>
+

I find this odd to include one at91.h in another at91.h

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Let's consider to remove one of these files in the future, and have just one that is identical with the bindings one from Linux

Meanwhile, let's see where do you need the PMC_*

The PMC_MCK and PMC_UTMI are defined in the dts/upstream sam9x7 SoC DT. since during compilation the clock/at91.h from u-boot is used and to resolve the syntax issues I had to declare them in clk/at91.h and include the header in clock/at91.h

I don't understand this. So , compiling sam9x7 upstream DT with upstream at91.h should work.
Do you have issues with sam9x7-u-boot.dtsi that fails build ?

Quoted 4 lines
Quoted 4 lines

if we drop the clock/at91.h from u-boot, the sam9x75 will pass using the includes from upstream Linux but will break other SoC that has not migrated to OF_UPSTREAM yet.

So you need to include clock/at91.h from upstream for sam9x75 and the other at91.h for older SoC.
Does that work ?

Quoted 9 lines
Quoted 4 lines

Or we can align u-boot's clock/at91.h with Linux and drop clk/at91.h, replace it with clock/at91.h in drivers and DT.
Please let me know if that works.

I would rather favor the U-Boot drivers and DT to directly use dts/upstream/include/dt-bindings/clock/at91.h instead and drop local DT bindings import. It then becomes easier for other SoCs to migrate to OF_UPSTREAM too.

Sumit,

The problem is that there are two at91.h with different definitions for the same macros. (I know... legacy reasons..)
The drivers have to be reworked to cope with the new values. Meanwhile I would say that at least the new SoCs should use the right macros/bindings

Quoted 17 lines

-Sumit

Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
include/dt-bindings/clock/at91.h +0 -1
   #ifndef _DT_BINDINGS_CLK_AT91_H
   #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

--
Thanks and Regards,
Manikandan M.

#8 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Quoted 84 lines · Eugen Hristev
Quoted 66 lines · Sumit Garg
Quoted 65 lines · On Fri, 28 Feb 2025 at 15:20, <[email protected]> wrote:

Hi Eugen,

Quoted 61 lines · Eugen Hristev

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 38 lines · On 2/27/25 12:37, [email protected] wrote:

Hi Sumit,

Quoted 5 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 1 line · Manikandan Muralidharan
Quoted 7 lines
Quoted 3 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

Other SoC DTs where OF_UPSTREAM migration is not added yet, depends on the local DT bindings header, dropping this will lead to issues with compilation.
We can drop this altogether when we sync the u-boot clock framework with Linux.

Quoted 18 lines

-Sumit

Quoted 15 lines
---
   include/dt-bindings/clk/at91.h   | 3 +++
   include/dt-bindings/clock/at91.h | 2 ++
   2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
   #define USB_UTMI2              1
   #define USB_UTMI3              2
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clk/at91.h line 28

Quoted 2 lines
include/dt-bindings/clk/at91.h +2 -0
+#define PMC_MCK                        1
+#define PMC_UTMI               2

Where in the patch series do you need these defines ?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
include/dt-bindings/clk/at91.h +1 -0
+
   #endif
include/dt-bindings/clock/at91.h +0 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
    * Licensed under GPLv2 or later.
    */
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clock/at91.h line 10

Quoted 2 lines
include/dt-bindings/clock/at91.h +2 -0
+#include <dt-bindings/clk/at91.h>
+

I find this odd to include one at91.h in another at91.h

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Let's consider to remove one of these files in the future, and have just one that is identical with the bindings one from Linux

Meanwhile, let's see where do you need the PMC_*

The PMC_MCK and PMC_UTMI are defined in the dts/upstream sam9x7 SoC DT. since during compilation the clock/at91.h from u-boot is used and to resolve the syntax issues I had to declare them in clk/at91.h and include the header in clock/at91.h

I don't understand this. So , compiling sam9x7 upstream DT with upstream at91.h should work.
Do you have issues with sam9x7-u-boot.dtsi that fails build ?

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

if we drop the clock/at91.h from u-boot, the sam9x75 will pass using the includes from upstream Linux but will break other SoC that has not migrated to OF_UPSTREAM yet.

So you need to include clock/at91.h from upstream for sam9x75 and the other at91.h for older SoC.
Does that work ?

The way it works currently is you can have a single clock/at91.h available where preference is currently given to local U-Boot copy (for backwards compatibility) over what is available in upstream DT. So can't have different versions of clock/at91.h available.

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

Or we can align u-boot's clock/at91.h with Linux and drop clk/at91.h, replace it with clock/at91.h in drivers and DT.
Please let me know if that works.

I would rather favor the U-Boot drivers and DT to directly use dts/upstream/include/dt-bindings/clock/at91.h instead and drop local DT bindings import. It then becomes easier for other SoCs to migrate to OF_UPSTREAM too.

Quoted 6 lines

Sumit,

The problem is that there are two at91.h with different definitions for the same macros. (I know... legacy reasons..)
The drivers have to be reworked to cope with the new values. Meanwhile I would say that at least the new SoCs should use the right macros/bindings

Since the drivers are also common for both new and older SoCs, it's rather better to adapt them to common bindings rather than supporting 2 different versions of clock/at91.h. If you want to do that as part of this series or later will be based on your preference.

-Sumit

Quoted 19 lines
Quoted 18 lines

-Sumit

Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
include/dt-bindings/clock/at91.h +0 -1
   #ifndef _DT_BINDINGS_CLK_AT91_H
   #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

--
Thanks and Regards,
Manikandan M.

#9 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Hi Eugen and Sumit,

Quoted 118 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 84 lines · Eugen Hristev
Quoted 66 lines · Sumit Garg
Quoted 65 lines · On Fri, 28 Feb 2025 at 15:20, <[email protected]> wrote:

Hi Eugen,

Quoted 61 lines · Eugen Hristev

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 38 lines · On 2/27/25 12:37, [email protected] wrote:

Hi Sumit,

Quoted 5 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 1 line · Manikandan Muralidharan
Quoted 7 lines
Quoted 3 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

Other SoC DTs where OF_UPSTREAM migration is not added yet, depends on the local DT bindings header, dropping this will lead to issues with compilation.
We can drop this altogether when we sync the u-boot clock framework with Linux.

Quoted 18 lines

-Sumit

Quoted 15 lines
---
    include/dt-bindings/clk/at91.h   | 3 +++
    include/dt-bindings/clock/at91.h | 2 ++
    2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
    #define USB_UTMI2              1
    #define USB_UTMI3              2
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clk/at91.h line 28

Quoted 2 lines
include/dt-bindings/clk/at91.h +2 -0
+#define PMC_MCK                        1
+#define PMC_UTMI               2

Where in the patch series do you need these defines ?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
include/dt-bindings/clk/at91.h +1 -0
+
    #endif
include/dt-bindings/clock/at91.h +0 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
     * Licensed under GPLv2 or later.
     */
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clock/at91.h line 10

Quoted 2 lines
include/dt-bindings/clock/at91.h +2 -0
+#include <dt-bindings/clk/at91.h>
+

I find this odd to include one at91.h in another at91.h

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Let's consider to remove one of these files in the future, and have just one that is identical with the bindings one from Linux

Meanwhile, let's see where do you need the PMC_*

The PMC_MCK and PMC_UTMI are defined in the dts/upstream sam9x7 SoC DT. since during compilation the clock/at91.h from u-boot is used and to resolve the syntax issues I had to declare them in clk/at91.h and include the header in clock/at91.h

I don't understand this. So , compiling sam9x7 upstream DT with upstream at91.h should work.
Do you have issues with sam9x7-u-boot.dtsi that fails build ?

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

if we drop the clock/at91.h from u-boot, the sam9x75 will pass using the includes from upstream Linux but will break other SoC that has not migrated to OF_UPSTREAM yet.

So you need to include clock/at91.h from upstream for sam9x75 and the other at91.h for older SoC.
Does that work ?

The way it works currently is you can have a single clock/at91.h available where preference is currently given to local U-Boot copy (for backwards compatibility) over what is available in upstream DT. So can't have different versions of clock/at91.h available.

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

Or we can align u-boot's clock/at91.h with Linux and drop clk/at91.h, replace it with clock/at91.h in drivers and DT.
Please let me know if that works.

I would rather favor the U-Boot drivers and DT to directly use dts/upstream/include/dt-bindings/clock/at91.h instead and drop local DT bindings import. It then becomes easier for other SoCs to migrate to OF_UPSTREAM too.

Quoted 6 lines

Sumit,

The problem is that there are two at91.h with different definitions for the same macros. (I know... legacy reasons..)
The drivers have to be reworked to cope with the new values. Meanwhile I would say that at least the new SoCs should use the right macros/bindings

Quoted 4 lines

Since the drivers are also common for both new and older SoCs, it's rather better to adapt them to common bindings rather than supporting 2 different versions of clock/at91.h. If you want to do that as part of this series or later will be based on your preference.

To ensure consistency and compatibility with upstream, I'll rename the local clock/at91.h to clock/at91-pmc-status.h in U-Boot and update the relevant legacy SoC Device Trees to reflect this change. This will allow the new sam9x7 SoC DT and driver to utilize the standard upstream dt-bindings/clock/at91.h without modifications.
We shall later refine at91-pmc-status.h during clock synchronization with Linux.
Please let me know if this sounds good

Quoted 22 lines

-Sumit

Quoted 19 lines
Quoted 18 lines

-Sumit

Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
include/dt-bindings/clock/at91.h +0 -1
    #ifndef _DT_BINDINGS_CLK_AT91_H
    #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

--
Thanks and Regards,
Manikandan M.

Signature · 2 lines
Thanks and Regards,
Manikandan M.
#10 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Quoted 126 lines · On Mon, Mar 03, 2025 at 10:26:15AM +0000, [email protected] wrote:

Hi Eugen and Sumit,

Quoted 118 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 84 lines · Eugen Hristev
Quoted 66 lines · Sumit Garg
Quoted 65 lines · On Fri, 28 Feb 2025 at 15:20, <[email protected]> wrote:

Hi Eugen,

Quoted 61 lines · Eugen Hristev

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 38 lines · On 2/27/25 12:37, [email protected] wrote:

Hi Sumit,

Quoted 5 lines · Sumit Garg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 1 line · Manikandan Muralidharan
Quoted 7 lines
Quoted 3 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

You should rather drop these local DT bindings headers which will allow dts/upstream/include/dt-bindings/clock/at91.h to be included automatically.

Other SoC DTs where OF_UPSTREAM migration is not added yet, depends on the local DT bindings header, dropping this will lead to issues with compilation.
We can drop this altogether when we sync the u-boot clock framework with Linux.

Quoted 18 lines

-Sumit

Quoted 15 lines
---
    include/dt-bindings/clk/at91.h   | 3 +++
    include/dt-bindings/clock/at91.h | 2 ++
    2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644
@@ -24,4 +24,7 @@
    #define USB_UTMI2              1
    #define USB_UTMI3              2
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clk/at91.h line 28

Quoted 2 lines
include/dt-bindings/clk/at91.h +2 -0
+#define PMC_MCK                        1
+#define PMC_UTMI               2

Where in the patch series do you need these defines ?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
include/dt-bindings/clk/at91.h +1 -0
+
    #endif
include/dt-bindings/clock/at91.h +0 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
     * Licensed under GPLv2 or later.
     */
 
Quoted 2 lines
Quoted 2 lines

include/dt-bindings/clock/at91.h line 10

Quoted 2 lines
include/dt-bindings/clock/at91.h +2 -0
+#include <dt-bindings/clk/at91.h>
+

I find this odd to include one at91.h in another at91.h

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Let's consider to remove one of these files in the future, and have just one that is identical with the bindings one from Linux

Meanwhile, let's see where do you need the PMC_*

The PMC_MCK and PMC_UTMI are defined in the dts/upstream sam9x7 SoC DT. since during compilation the clock/at91.h from u-boot is used and to resolve the syntax issues I had to declare them in clk/at91.h and include the header in clock/at91.h

I don't understand this. So , compiling sam9x7 upstream DT with upstream at91.h should work.
Do you have issues with sam9x7-u-boot.dtsi that fails build ?

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

if we drop the clock/at91.h from u-boot, the sam9x75 will pass using the includes from upstream Linux but will break other SoC that has not migrated to OF_UPSTREAM yet.

So you need to include clock/at91.h from upstream for sam9x75 and the other at91.h for older SoC.
Does that work ?

The way it works currently is you can have a single clock/at91.h available where preference is currently given to local U-Boot copy (for backwards compatibility) over what is available in upstream DT. So can't have different versions of clock/at91.h available.

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

Or we can align u-boot's clock/at91.h with Linux and drop clk/at91.h, replace it with clock/at91.h in drivers and DT.
Please let me know if that works.

I would rather favor the U-Boot drivers and DT to directly use dts/upstream/include/dt-bindings/clock/at91.h instead and drop local DT bindings import. It then becomes easier for other SoCs to migrate to OF_UPSTREAM too.

Quoted 6 lines

Sumit,

The problem is that there are two at91.h with different definitions for the same macros. (I know... legacy reasons..)
The drivers have to be reworked to cope with the new values. Meanwhile I would say that at least the new SoCs should use the right macros/bindings

Quoted 4 lines

Since the drivers are also common for both new and older SoCs, it's rather better to adapt them to common bindings rather than supporting 2 different versions of clock/at91.h. If you want to do that as part of this series or later will be based on your preference.

Quoted 9 lines

To ensure consistency and compatibility with upstream, I'll rename the local clock/at91.h to clock/at91-pmc-status.h in U-Boot and update the relevant legacy SoC Device Trees to reflect this change. This will allow the new sam9x7 SoC DT and driver to utilize the standard upstream dt-bindings/clock/at91.h without modifications.
We shall later refine at91-pmc-status.h during clock synchronization with Linux.
Please let me know if this sounds good

Sounds reasonable to me.

-Sumit

#11 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

In reply to Manikandan Muralidharan

Hei hei,

Am Thu, Feb 27, 2025 at 03:05:52PM +0530 schrieb Manikandan Muralidharan:

Quoted 15 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

---
 include/dt-bindings/clk/at91.h   | 3 +++
 include/dt-bindings/clock/at91.h | 2 ++
 2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644

include/dt-bindings/clk/at91.h line 28

Quoted 5 lines
include/dt-bindings/clk/at91.h +2 -0
@@ -24,4 +24,7 @@
 #define USB_UTMI2		1
 #define USB_UTMI3		2
 
+#define PMC_MCK			1
+#define PMC_UTMI		2

These are in include/dt-bindings/clock/at91.h in Linux.

include/dt-bindings/clock/at91.h line 9

Quoted 11 lines
include/dt-bindings/clk/at91.h +1 -0
+
 #endif
include/dt-bindings/clock/at91.h +1 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
  * Licensed under GPLv2 or later.
  */
 
+#include <dt-bindings/clk/at91.h>

If the u-boot driver or some *-u-boot.dtsi needs that additional header, I would include it there.

Besides this, you might be interested those bindings are in a process of rework in Linux currently. Especially the PMC clock IDs you ported from Linux are about to be split out into SoC specific headers. Discussion over here:

https://lore.kernel.org/linux-clk/[email protected]/

Greets
Alex

Quoted 7 lines
include/dt-bindings/clock/at91.h +1 -0
+
 #ifndef _DT_BINDINGS_CLK_AT91_H
 #define _DT_BINDINGS_CLK_AT91_H
 
Signature · 1 line
2.25.1
#12 lore raw

Re: [PATCH v2 1/8] dt-bindings: clk: define additional PMC clocks

Quoted 42 lines · Alexander Dahl

Hei hei,

Am Thu, Feb 27, 2025 at 03:05:52PM +0530 schrieb Manikandan Muralidharan:

Quoted 15 lines

Add PMC clock definitions for MCK and UTMI which will be required for the sam9x7 OF_upstream DT since the clock framework is not in sync with Linux and also include this header in 'clock/at91.h' file

---
 include/dt-bindings/clk/at91.h   | 3 +++
 include/dt-bindings/clock/at91.h | 2 ++
 2 files changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +0 -0
index a178b94157b..016c6e0c620 100644

include/dt-bindings/clk/at91.h line 28

Quoted 5 lines
include/dt-bindings/clk/at91.h +2 -0
@@ -24,4 +24,7 @@
 #define USB_UTMI2            1
 #define USB_UTMI3            2
 
+#define PMC_MCK                      1
+#define PMC_UTMI             2

These are in include/dt-bindings/clock/at91.h in Linux.

include/dt-bindings/clock/at91.h line 9

Quoted 11 lines
include/dt-bindings/clk/at91.h +1 -0
+
 #endif
include/dt-bindings/clock/at91.h +1 -0
index ab3ee241d10..7235b3ba01e 100644
@@ -6,6 +6,8 @@
  * Licensed under GPLv2 or later.
  */
 
+#include <dt-bindings/clk/at91.h>

If the u-boot driver or some *-u-boot.dtsi needs that additional header, I would include it there.

Quoted 6 lines

Besides this, you might be interested those bindings are in a process of rework in Linux currently. Especially the PMC clock IDs you ported from Linux are about to be split out into SoC specific headers. Discussion over here:

https://lore.kernel.org/linux-clk/[email protected]/

AFAICS, currently you are just creating duplicate SoC headers. I suppose you don't plan to drop bits from include/dt-bindings/clock/at91.h since that will be a backwards incompatible change and will break U-Boot drivers since they will rely on it.

-Sumit

Quoted 12 lines

Greets
Alex

Quoted 7 lines
include/dt-bindings/clock/at91.h +1 -1
+
 #ifndef _DT_BINDINGS_CLK_AT91_H
 #define _DT_BINDINGS_CLK_AT91_H
 
--

2.25.1

#13 lore raw

PATCH v2 2/8 clk: at91: sam9x60-pll: add support for core clock frequency inputs

In reply to Manikandan Muralidharan

From: Varshini Rajendran <[email protected]>

Add support for different core clock frequency input ranges for different PLL IDs in the PLL driver and align sam9x60, sama7g5 SOC platforms.

---
 drivers/clk/at91/clk-sam9x60-pll.c | 17 ++++++++---------
 drivers/clk/at91/pmc.h             |  1 +
 drivers/clk/at91/sam9x60.c         |  7 +++++++
 drivers/clk/at91/sama7g5.c         |  6 ++++++
 4 files changed, 22 insertions(+), 9 deletions(-)
drivers/clk/at91/clk-sam9x60-pll.c +8 -9
index a30035eb8ce..676ad8294a6 100644
@@ -31,9 +31,6 @@
 #define UPLL_DIV		2
 #define PLL_MUL_MAX		(FIELD_GET(PMC_PLL_CTRL1_MUL_MSK, UINT_MAX) + 1)
 
-#define FCORE_MIN		(600000000)
-#define FCORE_MAX		(1200000000)
-
 #define PLL_MAX_ID		7
 
 struct sam9x60_pll {
@@ -55,14 +52,15 @@ static inline bool sam9x60_pll_ready(void __iomem *base, int id)
 	return !!(status & BIT(id));
 }
 
-static long sam9x60_frac_pll_compute_mul_frac(u32 *mul, u32 *frac, ulong rate,
+static long sam9x60_frac_pll_compute_mul_frac(const struct clk_range *core_clk,
+					      u32 *mul, u32 *frac, ulong rate,
 					      ulong parent_rate)
 {
 	unsigned long tmprate, remainder;
 	unsigned long nmul = 0;
 	unsigned long nfrac = 0;
 
-	if (rate < FCORE_MIN || rate > FCORE_MAX)
+	if (rate < core_clk->min || rate > core_clk->max)
 		return -ERANGE;
 
 	/*
@@ -82,7 +80,7 @@ static long sam9x60_frac_pll_compute_mul_frac(u32 *mul, u32 *frac, ulong rate,
 	}
 
 	/* Check if resulted rate is valid.  */
-	if (tmprate < FCORE_MIN || tmprate > FCORE_MAX)
+	if (tmprate < core_clk[0].min || tmprate > core_clk[0].max)
 		return -ERANGE;
 
 	*mul = nmul - 1;
@@ -103,8 +101,8 @@ static ulong sam9x60_frac_pll_set_rate(struct clk *clk, ulong rate)
 	if (!parent_rate)
 		return 0;
 
-	ret = sam9x60_frac_pll_compute_mul_frac(&nmul, &nfrac, rate,
-						parent_rate);
+	ret = sam9x60_frac_pll_compute_mul_frac(pll->characteristics->core_output,
+						&nmul, &nfrac, rate, parent_rate);
 	if (ret < 0)
 		return 0;
 
@@ -163,7 +161,8 @@ static int sam9x60_frac_pll_enable(struct clk *clk)
 	ulong crate;
 
 	crate = sam9x60_frac_pll_get_rate(clk);
-	if (crate < FCORE_MIN || crate > FCORE_MAX)
+	if (crate < pll->characteristics->core_output[0].min ||
+	    crate > pll->characteristics->core_output[0].max)
 		return -ERANGE;
 
 	pmc_update_bits(base, AT91_PMC_PLL_UPDT, AT91_PMC_PLL_UPDT_ID_MSK,
drivers/clk/at91/pmc.h +1 -0
index ff464522aa0..49134531564 100644
@@ -38,6 +38,7 @@ struct clk_pll_characteristics {
 	struct clk_range input;
 	int num_output;
 	const struct clk_range *output;
+	const struct clk_range *core_output;
 	u16 *icpll;
 	u8 *out;
 	u8 upll : 1;
drivers/clk/at91/sam9x60.c +7 -0
index b7d64bdbb3d..e04266a2be2 100644
@@ -112,17 +112,24 @@ static const struct clk_range upll_outputs[] = {
 	{ .min = 300000000, .max = 500000000 },
 };
 
+/* Fractional PLL core output range. */
+static const struct clk_range core_outputs[] = {
+	{ .min = 600000000, .max = 1200000000 },
+};
+
 /* PLL characteristics. */
 static const struct clk_pll_characteristics apll_characteristics = {
 	.input = { .min = 12000000, .max = 48000000 },
 	.num_output = ARRAY_SIZE(plla_outputs),
 	.output = plla_outputs,
+	.core_output = core_outputs,
 };
 
 static const struct clk_pll_characteristics upll_characteristics = {
 	.input = { .min = 12000000, .max = 48000000 },
 	.num_output = ARRAY_SIZE(upll_outputs),
 	.output = upll_outputs,
+	.core_output = core_outputs,
 	.upll = true,
 };
 
drivers/clk/at91/sama7g5.c +6 -0
index 63b2c647467..c0e27828b1a 100644
@@ -158,11 +158,17 @@ static const struct clk_range pll_outputs[] = {
 	{ .min = 2343750, .max = 1200000000 },
 };
 
+/* Fractional PLL core output range. */
+static const struct clk_range core_outputs[] = {
+	{ .min = 600000000, .max = 1200000000 },
+};
+
 /* PLL characteristics. */
 static const struct clk_pll_characteristics pll_characteristics = {
 	.input = { .min = 12000000, .max = 50000000 },
 	.num_output = ARRAY_SIZE(pll_outputs),
 	.output = pll_outputs,
+	.core_output = core_outputs,
 };
 
 /* Layout for fractional PLLs. */
Signature · 1 line
2.25.1
#14 lore raw

PATCH v2 3/8 clk: at91: sam9x60-pll: add support for HW PLL freq dividers

In reply to Manikandan Muralidharan

From: Varshini Rajendran <[email protected]>

Add support for hardware dividers for PLL IDs.In sam9x7 SoC, PLL_ID_PLLA and PLL_ID_PLLA_DIV2 has /2 hardware dividers each.

fcorepllack -----> HW Div = 2 -+--> fpllack

                               |
                               +--> HW Div = 2 ---> fplladiv2ck
---
 drivers/clk/at91/clk-sam9x60-pll.c | 38 +++++++++++++++++++++++++++++-
 drivers/clk/at91/pmc.h             |  1 +
 2 files changed, 38 insertions(+), 1 deletion(-)
drivers/clk/at91/clk-sam9x60-pll.c +37 -1
index 676ad8294a6..df8172bccac 100644
@@ -22,6 +22,7 @@
 
 #define UBOOT_DM_CLK_AT91_SAM9X60_DIV_PLL	"at91-sam9x60-div-pll-clk"
 #define UBOOT_DM_CLK_AT91_SAM9X60_FRAC_PLL	"at91-sam9x60-frac-pll-clk"
+#define UBOOT_DM_CLK_AT91_SAM9X60_FIXED_DIV_PLL	"at91-sam9x60-fixed-div-pll-clk"
 
 #define	PMC_PLL_CTRL0_DIV_MSK	GENMASK(7, 0)
 #define	PMC_PLL_CTRL1_MUL_MSK	GENMASK(31, 24)
@@ -140,6 +141,7 @@ static ulong sam9x60_frac_pll_get_rate(struct clk *clk)
 	void __iomem *base = pll->base;
 	ulong parent_rate = clk_get_parent_rate(clk);
 	u32 mul, frac, val;
+	ulong pll_rate;
 
 	if (!parent_rate)
 		return 0;
@@ -149,8 +151,12 @@ static ulong sam9x60_frac_pll_get_rate(struct clk *clk)
 	pmc_read(base, AT91_PMC_PLL_CTRL1, &val);
 	mul = (val & pll->layout->mul_mask) >> pll->layout->mul_shift;
 	frac = (val & pll->layout->frac_mask) >> pll->layout->frac_shift;
+	pll_rate = (parent_rate * (mul + 1) + ((u64)parent_rate * frac >> 22));
 
-	return (parent_rate * (mul + 1) + ((u64)parent_rate * frac >> 22));
+	if (pll->layout->div2)
+		pll_rate >>= 1;
+
+	return pll_rate;
 }
 
 static int sam9x60_frac_pll_enable(struct clk *clk)
@@ -359,6 +365,16 @@ static ulong sam9x60_div_pll_get_rate(struct clk *clk)
 	return parent_rate / (div + 1);
 }
 
+static ulong sam9x60_fixed_div_pll_get_rate(struct clk *clk)
+{
+	ulong parent_rate = clk_get_parent_rate(clk);
+
+	if (!parent_rate)
+		return 0;
+
+	return parent_rate >> 1;
+}
+
 static const struct clk_ops sam9x60_div_pll_ops = {
 	.enable = sam9x60_div_pll_enable,
 	.disable = sam9x60_div_pll_disable,
@@ -366,6 +382,12 @@ static const struct clk_ops sam9x60_div_pll_ops = {
 	.get_rate = sam9x60_div_pll_get_rate,
 };
 
+static const struct clk_ops sam9x60_fixed_div_pll_ops = {
+	.enable = sam9x60_div_pll_enable,
+	.disable = sam9x60_div_pll_disable,
+	.get_rate = sam9x60_fixed_div_pll_get_rate,
+};
+
 static struct clk *
 sam9x60_clk_register_pll(void __iomem *base, const char *type,
 			 const char *name, const char *parent_name, u8 id,
@@ -406,6 +428,13 @@ sam9x60_clk_register_div_pll(void __iomem *base, const char *name,
 			     const struct clk_pll_characteristics *characteristics,
 			     const struct clk_pll_layout *layout, bool critical)
 {
+	if (layout->div2) {
+		return sam9x60_clk_register_pll(base,
+			UBOOT_DM_CLK_AT91_SAM9X60_FIXED_DIV_PLL, name, parent_name,
+			id, characteristics, layout,
+			CLK_GET_RATE_NOCACHE | (critical ? CLK_IS_CRITICAL : 0));
+	}
+
 	return sam9x60_clk_register_pll(base,
 		UBOOT_DM_CLK_AT91_SAM9X60_DIV_PLL, name, parent_name, id,
 		characteristics, layout,
@@ -431,6 +460,13 @@ U_BOOT_DRIVER(at91_sam9x60_div_pll_clk) = {
 	.flags = DM_FLAG_PRE_RELOC,
 };
 
+U_BOOT_DRIVER(at91_sam9x60_fixed_div_pll_clk) = {
+	.name = UBOOT_DM_CLK_AT91_SAM9X60_FIXED_DIV_PLL,
+	.id = UCLASS_CLK,
+	.ops = &sam9x60_fixed_div_pll_ops,
+	.flags = DM_FLAG_PRE_RELOC,
+};
+
 U_BOOT_DRIVER(at91_sam9x60_frac_pll_clk) = {
 	.name = UBOOT_DM_CLK_AT91_SAM9X60_FRAC_PLL,
 	.id = UCLASS_CLK,
drivers/clk/at91/pmc.h +1 -0
index 49134531564..580c9964ff4 100644
@@ -54,6 +54,7 @@ struct clk_pll_layout {
 	u8 frac_shift;
 	u8 div_shift;
 	u8 endiv_shift;
+	u8 div2;
 };
 
 struct clk_programmable_layout {
Signature · 1 line
2.25.1
#15 lore raw

PATCH v2 4/8 clk: at91: sam9x7: add pmc driver for sam9x7 SoC family

In reply to Manikandan Muralidharan

From: Varshini Rajendran <[email protected]>

Add PMC driver support for sam9x7 SoC family

---
 drivers/clk/at91/Makefile |    1 +
 drivers/clk/at91/sam9x7.c | 1094 +++++++++++++++++++++++++++++++++++++
 2 files changed, 1095 insertions(+)
 create mode 100644 drivers/clk/at91/sam9x7.c
drivers/clk/at91/Makefile +1 -0
index e53dcb4ca7a..6cca861f81c 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_AT91_SAM9X60_PLL)	+= clk-sam9x60-pll.o
 obj-$(CONFIG_AT91_SAM9X60_USB)	+= clk-sam9x60-usb.o
 obj-$(CONFIG_SAMA7G5)		+= sama7g5.o
 obj-$(CONFIG_SAM9X60)		+= sam9x60.o
+obj-$(CONFIG_SAM9X7)		+= sam9x7.o
 else
 obj-y += compat.o
 endif
drivers/clk/at91/sam9x7.c new file +1094 -0

1,094 lines not on this page · raw message

Signature · 1 line
2.25.1
#16 lore raw

PATCH v2 5/8 ARM: at91: Add sam9x7 soc

In reply to Manikandan Muralidharan

From: Varshini Rajendran <[email protected]>

Add new Microchip sam9x7 SoC based on an ARM926.

---
 arch/arm/mach-at91/Kconfig                    |   4 +
 arch/arm/mach-at91/arm926ejs/Makefile         |   1 +
 arch/arm/mach-at91/arm926ejs/sam9x7_devices.c |  49 +++++
 arch/arm/mach-at91/include/mach/hardware.h    |   2 +
 arch/arm/mach-at91/include/mach/sam9x7.h      | 172 ++++++++++++++++++
 5 files changed, 228 insertions(+)
 create mode 100644 arch/arm/mach-at91/arm926ejs/sam9x7_devices.c
 create mode 100644 arch/arm/mach-at91/include/mach/sam9x7.h
arch/arm/mach-at91/Kconfig +4 -0
index 7c4ccc427c8..5429257875d 100644
@@ -43,6 +43,10 @@ config SAM9X60
 	bool
 	select CPU_ARM926EJS
 
+config SAM9X7
+	bool
+	select CPU_ARM926EJS
+
 config SAMA7G5
 	bool
 	select CPU_V7A
arch/arm/mach-at91/arm926ejs/Makefile +1 -0
index 8f0bc5d997e..977299a5911 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_AT91SAM9G45)	+= at91sam9m10g45_devices.o
 obj-$(CONFIG_AT91SAM9N12)	+= at91sam9n12_devices.o
 obj-$(CONFIG_AT91SAM9X5)	+= at91sam9x5_devices.o
 obj-$(CONFIG_SAM9X60)		+= sam9x60_devices.o
+obj-$(CONFIG_SAM9X7)		+= sam9x7_devices.o
 obj-y += clock.o
 obj-y += cpu.o
 ifndef CONFIG_$(PHASE_)SYSRESET
arch/arm/mach-at91/arm926ejs/sam9x7_devices.c new file +49 -0

49 lines not on this page · raw message

arch/arm/mach-at91/include/mach/hardware.h +2 -0
index 988ef492b62..de89714b097 100644
@@ -23,6 +23,8 @@
 # include <asm/arch/at91sam9x5.h>
 #elif defined(CONFIG_SAM9X60)
 # include <asm/arch/sam9x60.h>
+#elif defined(CONFIG_SAM9X7)
+# include <asm/arch/sam9x7.h>
 #elif defined(CONFIG_SAMA7G5)
 # include <asm/arch/sama7g5.h>
 #elif defined(CONFIG_SAMA5D2)
arch/arm/mach-at91/include/mach/sam9x7.h new file +172 -0

172 lines not on this page · raw message

Signature · 1 line
2.25.1
#17 lore raw

PATCH v2 6/8 ARM: dts: at91: sam9x75_curiosity: add tweaks for sam9x75 curiosity board

In reply to Manikandan Muralidharan

Since the SoC and board DT are already available in dts/upstream, add the difference from upstream DTS to at91-sam9x75_curiosity-u-boot.dtsi

---
 .../dts/at91-sam9x75_curiosity-u-boot.dtsi    | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 arch/arm/dts/at91-sam9x75_curiosity-u-boot.dtsi
arch/arm/dts/at91-sam9x75_curiosity-u-boot.dtsi new file +107 -0
new file mode 100644
index 00000000000..dc4fef950ec
@@ -0,0 +1,107 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * at91-sam9x75_curiosity-u-boot.dtsi - Device Tree file for SAM9X75
+ * CURIOSITY board.
+ *
+ * Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Manikandan Muralidharan <[email protected]>
+ */
+
+/ {
+	cpus {
+		cpu@0 {
+			clocks = <&pmc PMC_TYPE_CORE 25>, <&pmc PMC_TYPE_CORE 17>, <&main_xtal>;
+			clock-names = "cpu", "master", "xtal";
+		};
+	};
+
+	clocks {
+		slow_rc_osc: slow_rc_osc {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			clock-frequency = <18500>;
+		};
+
+		main_rc: main_rc {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			clock-frequency = <12000000>;
+		};
+	};
+
+	ahb {
+		bootph-all;
+
+		apb {
+			bootph-all;
+
+			pinctrl {
+				bootph-all;
+			};
+		};
+	};
+
+	chosen {
+		bootph-all;
+	};
+};
+
+&clk32k {
+	bootph-all;
+	clocks = <&slow_rc_osc>, <&slow_xtal>;
+};
+
+&dbgu {
+	bootph-all;
+};
+
+&gmac {
+	compatible = "microchip,sam9x7-gem", "cdns,sama7g5-gem";
+};
+
+&main_rc {
+	bootph-all;
+};
+
+&main_xtal {
+	bootph-all;
+};
+
+&pinctrl_dbgu_default {
+	bootph-all;
+};
+
+&pinctrl_sdmmc0_default {
+	bootph-all;
+};
+
+&pioA {
+	bootph-all;
+};
+
+&pioB {
+	bootph-all;
+};
+
+&pit64b0 {
+	bootph-all;
+};
+
+&pmc {
+	bootph-all;
+	clocks = <&clk32k 1>, <&clk32k 0>, <&main_xtal>, <&main_rc>;
+	clock-names = "td_slck", "md_slck", "main_xtal", "main_rc";
+};
+
+&sdmmc0 {
+	bootph-all;
+};
+
+&slow_xtal {
+	bootph-all;
+};
+
+&slow_rc_osc {
+	bootph-all;
+};
Signature · 1 line
2.25.1
#18 lore raw

PATCH v2 7/8 board: sam9x75_curiosity: Add support for sam9x75 curiosity

In reply to Manikandan Muralidharan

Add board specific functions for sam9x75 curiosity

---
 arch/arm/mach-at91/Kconfig                    |  8 +++
 board/atmel/sam9x75_curiosity/Kconfig         | 15 +++++
 board/atmel/sam9x75_curiosity/MAINTAINERS     |  6 ++
 board/atmel/sam9x75_curiosity/Makefile        |  7 ++
 .../sam9x75_curiosity/sam9x75_curiosity.c     | 66 +++++++++++++++++++
 include/configs/sam9x75_curiosity.h           | 23 +++++++
 6 files changed, 125 insertions(+)
 create mode 100644 board/atmel/sam9x75_curiosity/Kconfig
 create mode 100644 board/atmel/sam9x75_curiosity/MAINTAINERS
 create mode 100644 board/atmel/sam9x75_curiosity/Makefile
 create mode 100644 board/atmel/sam9x75_curiosity/sam9x75_curiosity.c
 create mode 100644 include/configs/sam9x75_curiosity.h
arch/arm/mach-at91/Kconfig +8 -0
index 5429257875d..d21534ce883 100644
@@ -158,6 +158,13 @@ config TARGET_SAM9X60_CURIOSITY
         select BOARD_EARLY_INIT_F
         select BOARD_LATE_INIT
 
+config TARGET_SAM9X75_CURIOSITY
+	bool "SAM9X75 CURIOSITY board"
+	select SAM9X7
+	select BOARD_EARLY_INIT_F
+	select BOARD_LATE_INIT
+	imply OF_UPSTREAM
+
 config TARGET_SAMA5D2_PTC_EK
 	bool "SAMA5D2 PTC EK board"
 	select BOARD_EARLY_INIT_F
@@ -355,6 +362,7 @@ source "board/atmel/at91sam9rlek/Kconfig"
 source "board/atmel/at91sam9x5ek/Kconfig"
 source "board/atmel/sam9x60ek/Kconfig"
 source "board/atmel/sam9x60_curiosity/Kconfig"
+source "board/atmel/sam9x75_curiosity/Kconfig"
 source "board/atmel/sama7g5ek/Kconfig"
 source "board/atmel/sama7g54_curiosity/Kconfig"
 source "board/atmel/sama5d2_ptc_ek/Kconfig"
board/atmel/sam9x75_curiosity/Kconfig new file +15 -0
new file mode 100644
index 00000000000..8ea93a21aa3
@@ -0,0 +1,15 @@
+if TARGET_SAM9X75_CURIOSITY
+
+config SYS_BOARD
+	default "sam9x75_curiosity"
+
+config SYS_VENDOR
+	default "atmel"
+
+config SYS_SOC
+	default "at91"
+
+config SYS_CONFIG_NAME
+	default "sam9x75_curiosity"
+
+endif
board/atmel/sam9x75_curiosity/MAINTAINERS new file +6 -0
new file mode 100644
index 00000000000..a175053418f
@@ -0,0 +1,6 @@
+SAM9X75 CURIOSITY BOARD
+M:	Manikandan Muralidharan <[email protected]>
+S:	Maintained
+F:	board/atmel/sam9x75_curiosity/
+F:	include/configs/sam9x75_curiosity.h
+F:	arch/arm/dts/at91-sam9x75_curiosity-u-boot.dtsi
board/atmel/sam9x75_curiosity/Makefile new file +7 -0
new file mode 100644
index 00000000000..1f36d613229
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
+#
+# Author: Manikandan Muralidharan <[email protected]>
+
+obj-y += sam9x75_curiosity.o
board/atmel/sam9x75_curiosity/sam9x75_curiosity.c new file +66 -0

66 lines not on this page · raw message

include/configs/sam9x75_curiosity.h new file +23 -0
new file mode 100644
index 00000000000..62a855d9f01
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration settings for the SAM9X75 CURIOSITY board.
+ *
+ * Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Manikandan Muralidharan <[email protected]>
+ */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define CFG_SYS_AT91_SLOW_CLOCK	32768
+#define CFG_SYS_AT91_MAIN_CLOCK	24000000	/* 24 MHz crystal */
+
+#define CFG_USART_BASE   ATMEL_BASE_DBGU
+#define CFG_USART_ID     0 /* ignored in arm */
+
+/* SDRAM */
+#define CFG_SYS_SDRAM_BASE		0x20000000
+#define CFG_SYS_SDRAM_SIZE		0x10000000      /* 256 megs */
+
+#endif
Signature · 1 line
2.25.1
#19 lore raw

PATCH v2 8/8 configs: sam9x75_curiosity: Add initial mmc default config

In reply to Manikandan Muralidharan

Add default configuration for sd-card to boot the linux kernel.

---
 board/atmel/sam9x75_curiosity/MAINTAINERS |  1 +
 configs/sam9x75_curiosity_mmc_defconfig   | 73 +++++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 configs/sam9x75_curiosity_mmc_defconfig
board/atmel/sam9x75_curiosity/MAINTAINERS +1 -0
index a175053418f..f0dfdbe8d5c 100644
@@ -4,3 +4,4 @@ S:	Maintained
 F:	board/atmel/sam9x75_curiosity/
 F:	include/configs/sam9x75_curiosity.h
 F:	arch/arm/dts/at91-sam9x75_curiosity-u-boot.dtsi
+F:	configs/sam9x75_curiosity_mmc_defconfig
configs/sam9x75_curiosity_mmc_defconfig new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
2.25.1