add SAM9X60 clock support
Subsystems (3)
cover add SAM9X60 clock support
Hi,
This series adds SAM9X60 clock support, CCF compatible, so that SAM9X60 based boards (e.g. SAM9X60-EK in this case) to be able to boot with mainline code.
This series is based on u-boot-atmel/next.
Thank you,
Claudiu Beznea
Claudiu Beznea (7):
board: atmel: sam9x60ek: add SYS_MALLOC_F_LEN to SYS_INIT_SP_ADDR
clk: at91: sam9x60: add support compatible with CCF
ARM: dts: sam9x60ek: add clock frequencies to board file
ARM: dts: sam9x60: use u-boot,dm-pre-reloc
ARM: dts: sam9x60: use slow clock CCF compatible bindings
ARM: dts: sam9x60: use CCF compatibles for PMC
configs: sam9x60ek: update defconfigs for CCF
arch/arm/dts/sam9x60.dtsi | 177 +++------- arch/arm/dts/sam9x60ek-u-boot.dtsi | 69 +--- arch/arm/dts/sam9x60ek.dts | 12 +- configs/sam9x60ek_mmc_defconfig | 4 +- configs/sam9x60ek_nandflash_defconfig | 4 +- configs/sam9x60ek_qspiflash_defconfig | 4 +- drivers/clk/at91/Makefile | 1 + drivers/clk/at91/sam9x60.c | 594 ++++++++++++++++++++++++++++++++++ include/configs/sam9x60ek.h | 3 +- 9 files changed, 659 insertions(+), 209 deletions(-) create mode 100644 drivers/clk/at91/sam9x60.c
Signature · 1 line
2.7.4
PATCH 1/7 board: atmel: sam9x60ek: add SYS_MALLOC_F_LEN to SYS_INIT_SP_ADDR
Heap base address is computed based on SYS_INIT_SP_ADDR by subtracting the SYS_MALLOC_F_LEN value in board_init_f_init_reserve().
--- include/configs/sam9x60ek.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/configs/sam9x60ek.h +2 -1
@@ -40,7 +40,8 @@#define CONFIG_SYS_SDRAM_SIZE 0x10000000/* 256 megs */ #define CONFIG_SYS_INIT_SP_ADDR \ - (CONFIG_SYS_SDRAM_BASE + 16 * 1024 - GENERATED_GBL_DATA_SIZE) + (CONFIG_SYS_SDRAM_BASE + 16 * 1024 + CONFIG_SYS_MALLOC_F_LEN - \ + GENERATED_GBL_DATA_SIZE)/* NAND flash */ #ifdef CONFIG_CMD_NAND
Signature · 1 line
2.7.4
PATCH 2/7 clk: at91: sam9x60: add support compatible with CCF
In reply to Claudiu BezneaAdd SAM9X60 clock support compatible with CCF.
--- drivers/clk/at91/Makefile | 1 + drivers/clk/at91/sam9x60.c | 594 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 595 insertions(+) create mode 100644 drivers/clk/at91/sam9x60.c
drivers/clk/at91/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_AT91_GENERIC_CLK) += clk-generic.o obj-$(CONFIG_AT91_UTMI) += clk-utmi.o obj-$(CONFIG_AT91_SAM9X60_PLL) += clk-sam9x60-pll.o obj-$(CONFIG_SAMA7G5) += sama7g5.o +obj-$(CONFIG_SAM9X60) += sam9x60.o else obj-y += compat.o endif
drivers/clk/at91/sam9x60.c new file +594 -0
594 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 2/7 clk: at91: sam9x60: add support compatible with CCF
Quoted 4 lines · Claudiu Beznea
Add SAM9X60 clock support compatible with CCF.
Signed-off-by Claudiu Beznea <[email protected]>---
Hi Claudiu,
Quoted 389 lines
drivers/clk/at91/Makefile | 1 + drivers/clk/at91/sam9x60.c | 594 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 595 insertions(+)create mode 100644
drivers/clk/at91/sam9x60.cdrivers/clk/at91/Makefile +1
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_AT91_GENERIC_CLK) += clk-generic.o obj-$(CONFIG_AT91_UTMI) += clk-utmi.o obj-$(CONFIG_AT91_SAM9X60_PLL) += clk-sam9x60-pll.o obj-$(CONFIG_SAMA7G5) += sama7g5.o +obj-$(CONFIG_SAM9X60) += sam9x60.o else obj-y += compat.o endifdrivers/clk/at91/sam9x60.c new file +366
-0@@ -0,0 +1,594 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries +* +* Author: Claudiu Beznea <[email protected]> +* +* Based on sam9x60.c on Linux. +*/ + +#include <common.h> +#include <clk-uclass.h> +#include <dm.h> +#include <dt-bindings/clk/at91.h> +#include <linux/clk-provider.h> + +#include "pmc.h" + +/** +* Clock identifiers to be used in conjunction with macros like +* AT91_TO_CLK_ID() +* +* @ID_MD_SLCK: TD slow clock identifier +* @ID_TD_SLCK: MD slow clock identifier +* @ID_MAIN_XTAL: Main Xtal clock identifier +* @ID_MAIN_RC: Main RC clock identifier +* @ID_MAIN_RC_OSC: Main RC Oscillator clock identifier +* @ID_MAIN_OSC: Main Oscillator clock identifier +* @ID_MAINCK: MAINCK clock identifier +* @ID_PLL_U_FRAC: UPLL fractional clock identifier +* @ID_PLL_U_DIV: UPLL divider clock identifier +* @ID_PLL_A_FRAC: APLL fractional clock identifier +* @ID_PLL_A_DIV: APLL divider clock identifier + +* @ID_MCK: MCK clock identifier + +* @ID_UTMI: UTMI clock identifier + +* @ID_PROG0: Programmable 0 clock identifier +* @ID_PROG1: Programmable 1 clock identifier + +* @ID_PCK0: PCK0 system clock identifier +* @ID_PCK1: PCK1 system clock identifier +* @ID_DDR: DDR system clock identifier +* @ID_QSPI: QSPI system clock identifier +* +* Note: if changing the values of this enums please sync them with +* device tree +*/ +enum pmc_clk_ids { +ID_MD_SLCK =0 , +ID_TD_SLCK =1 , +ID_MAIN_XTAL =2 , +ID_MAIN_RC =3 , +ID_MAIN_RC_OSC =4 , +ID_MAIN_OSC =5 , +ID_MAINCK =6 , + +ID_PLL_U_FRAC =7 , +ID_PLL_U_DIV =8 , +ID_PLL_A_FRAC =9 , +ID_PLL_A_DIV =10 , + +ID_MCK =11 , + +ID_UTMI =12 , + +ID_PROG0 =13 , +ID_PROG1 =14 , + +ID_PCK0 =15 , +ID_PCK1 =16 , + +ID_DDR =17 , +ID_QSPI =18 , + +ID_MAX , +}; + +/** +* PLL type identifiers +* @PLL_TYPE_FRAC: fractional PLL identifier +* @PLL_TYPE_DIV: divider PLL identifier +*/ +enum pll_type { +PLL_TYPE_FRAC , +PLL_TYPE_DIV , +}; + +/* Clock names used as parents for multiple clocks. */ +static const char *clk_names[] = { + [ID_MAIN_RC_OSC ] ="main_rc_osc" , + [ID_MAIN_OSC ] ="main_osc" , + [ID_MAINCK ] ="mainck" , + [ID_PLL_U_DIV ] ="upll_divpmcck" , + [ID_PLL_A_DIV ] ="plla_divpmcck" , + [ID_MCK ] ="mck" , +}; + +/* Fractional PLL output range. */ +static const struct clk_range plla_outputs[] = { + { .min =2343750 , .max =1200000000 }, +}; + +static const struct clk_range upll_outputs[] = { + { .min =300000000 , .max =500000000 }, +}; + +/* PLL characteristics. */ +static const struct clk_pll_characteristics apll_characteristics = { + .input = { .min =12000000 , .max =48000000 }, + .num_output =ARRAY_SIZE (plla_outputs), + .output = plla_outputs, +}; + +static const struct clk_pll_characteristics upll_characteristics = { + .input = { .min =12000000 , .max =48000000 }, + .num_output =ARRAY_SIZE (upll_outputs), + .output = upll_outputs, + .upll = true, +}; + +/* Layout for fractional PLLs. */ +static const struct clk_pll_layout pll_layout_frac = { + .mul_mask =GENMASK (31 ,24 ), + .frac_mask =GENMASK (21 ,0 ), + .mul_shift =24 , + .frac_shift =0 , +}; + +/* Layout for DIV PLLs. */ +static const struct clk_pll_layout pll_layout_div = { + .div_mask =GENMASK (7 ,0 ), + .endiv_mask =BIT (29 ), + .div_shift =0 , + .endiv_shift =29 , +}; + +/* MCK characteristics. */ +static const struct clk_master_characteristics mck_characteristics = { + .output = { .min =140000000 , .max =200000000 }, + .divisors = {1 ,2 ,4 ,3 }, + .have_div3_pres =1 , +}; + +/* MCK layout. */ +static const struct clk_master_layout mck_layout = { + .mask =0x373 , + .pres_shift =4 , + .offset =0x28 , +}; + +/* Programmable clock layout. */ +static const struct clk_programmable_layout programmable_layout = { + .pres_mask =0xff , + .pres_shift =8 , + .css_mask =0x1f , + .have_slck_mck =0 , + .is_pres_direct =1 , +}; + +/* Peripheral clock layout. */ +static const struct clk_pcr_layout pcr_layout = { + .offset =0x88 , + .cmd =BIT (31 ), + .gckcss_mask =GENMASK (12 ,8 ), + .pid_mask =GENMASK (6 ,0 ), +}; + +/** +* PLL clocks description +* @n: clock name +* @p: clock parent +* @l: clock layout +* @t: clock type +* @f: true if clock is fixed and not changeable by driver +* @id: clock id corresponding to PLL driver +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +const char *p; +const struct clk_pll_layout *l; +const struct clk_pll_characteristics *c; +u8 t; +u8 f; +u8 id; +u8 cid; +} sam9x60_plls[] = { + { + .n ="plla_fracck" , + .p ="mainck" , + .l = &pll_layout_frac, + .c = &apll_characteristics, + .t =PLL_TYPE_FRAC , + .f =1 , + .id =0 , + .cid =ID_PLL_A_FRAC , + }, + + { + .n ="plla_divpmcck" , + .p ="plla_fracck" , + .l = &pll_layout_div, + .c = &apll_characteristics, + .t =PLL_TYPE_DIV , + .f =1 , + .id =0 , + .cid =ID_PLL_A_DIV , + }, + + { + .n ="upll_fracck" , + .p ="main_osc" , + .l = &pll_layout_frac, + .c = &upll_characteristics, + .t =PLL_TYPE_FRAC , + .f =1 , + .id =1 , + .cid =ID_PLL_U_FRAC , + }, + + { + .n ="upll_divpmcck" , + .p ="upll_fracck" , + .l = &pll_layout_div, + .c = &upll_characteristics, + .t =PLL_TYPE_DIV , + .f =1 , + .id =1 , + .cid =ID_PLL_U_DIV , + }, +}; + +/** +* Programmable clock description +* @n: clock name +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +u8 cid; +} sam9x60_prog[] = { + { .n ="prog0" , .cid =ID_PROG0 , }, + { .n ="prog1" , .cid =ID_PROG1 , }, +}; + +/* Mux table for programmable clocks. */ +static u32 sam9x60_prog_mux_table[] = {0 ,1 ,2 ,3 ,4 ,5 , }; + +/** +* System clock description +* @n: clock name +* @p: parent clock name +* @id: clock id corresponding to system clock driver +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +const char *p; +u8 id; +u8 cid; +} sam9x60_systemck[] = { + { .n ="ddrck" , .p ="mck" , .id =2 , .cid =ID_DDR , }, + { .n ="pck0" , .p ="prog0" , .id =8 , .cid =ID_PCK0 , }, + { .n ="pck1" , .p ="prog1" , .id =9 , .cid =ID_PCK1 , }, + { .n ="qspick" , .p ="mck" , .id =19 , .cid =ID_QSPI , }, +}; + +/** +* Peripheral clock description +* @n: clock name +* @id: clock id +*/ +static const struct { +const char *n; +u8 id; +} sam9x60_periphck[] = { + { .n ="pioA_clk" , .id =2 , }, + { .n ="pioB_clk" , .id =3 , }, + { .n ="pioC_clk" , .id =4 , }, + { .n ="flex0_clk" , .id =5 , }, + { .n ="flex1_clk" , .id =6 , }, + { .n ="flex2_clk" , .id =7 , }, + { .n ="flex3_clk" , .id =8 , }, + { .n ="flex6_clk" , .id =9 , }, + { .n ="flex7_clk" , .id =10 , }, + { .n ="flex8_clk" , .id =11 , }, + { .n ="sdmmc0_clk" , .id =12 , }, + { .n ="flex4_clk" , .id =13 , }, + { .n ="flex5_clk" , .id =14 , }, + { .n ="flex9_clk" , .id =15 , }, + { .n ="flex10_clk" , .id =16 , }, + { .n ="tcb0_clk" , .id =17 , }, + { .n ="pwm_clk" , .id =18 , }, + { .n ="adc_clk" , .id =19 , }, + { .n ="dma0_clk" , .id =20 , }, + { .n ="matrix_clk" , .id =21 , }, + { .n ="uhphs_clk" , .id =22 , }, + { .n ="udphs_clk" , .id =23 , }, + { .n ="macb0_clk" , .id =24 , }, + { .n ="lcd_clk" , .id =25 , }, + { .n ="sdmmc1_clk" , .id =26 , }, + { .n ="macb1_clk" , .id =27 , }, + { .n ="ssc_clk" , .id =28 , }, + { .n ="can0_clk" , .id =29 , }, + { .n ="can1_clk" , .id =30 , }, + { .n ="flex11_clk" , .id =32 , }, + { .n ="flex12_clk" , .id =33 , }, + { .n ="i2s_clk" , .id =34 , }, + { .n ="qspi_clk" , .id =35 , }, + { .n ="gfx2d_clk" , .id =36 , }, + { .n ="pit64b_clk" , .id =37 , }, + { .n ="trng_clk" , .id =38 , }, + { .n ="aes_clk" , .id =39 , }, + { .n ="tdes_clk" , .id =40 , }, + { .n ="sha_clk" , .id =41 , }, + { .n ="classd_clk" , .id =42 , }, + { .n ="isi_clk" , .id =43 , }, + { .n ="pioD_clk" , .id =44 , }, + { .n ="tcb1_clk" , .id =45 , }, + { .n ="dbgu_clk" , .id =47 , }, + { .n ="mpddr_clk" , .id =49 , }, +}; + +/** +* Generic clock description +* @n: clock name +* @ep: extra parents parents names +* @ep_mux_table: extra parents mux table +* @ep_clk_mux_table: extra parents clock mux table (for CCF) +* @r: clock output range +* @ep_count: extra parents count +* @id: clock id +*/ +static const struct { +const char *n; +struct clk_range r; +u8 id; +} sam9x60_gck[] = { + { .n ="flex0_gclk" , .id =5 , }, + { .n ="flex1_gclk" , .id =6 , }, + { .n ="flex2_gclk" , .id =7 , }, + { .n ="flex3_gclk" , .id =8 , }, + { .n ="flex6_gclk" , .id =9 , }, + { .n ="flex7_gclk" , .id =10 , }, + { .n ="flex8_gclk" , .id =11 , }, + { .n ="sdmmc0_gclk" , .id =12 , .r = { .min =0 , .max =105000000 }, }, + { .n ="flex4_gclk" , .id =13 , }, + { .n ="flex5_gclk" , .id =14 , }, + { .n ="flex9_gclk" , .id =15 , }, + { .n ="flex10_gclk" , .id =16 , }, + { .n ="tcb0_gclk" , .id =17 , }, + { .n ="adc_gclk" , .id =19 , }, + { .n ="lcd_gclk" , .id =25 , .r = { .min =0 , .max =140000000 }, }, + { .n ="sdmmc1_gclk" , .id =26 , .r = { .min =0 , .max =105000000 }, }, + { .n ="flex11_gclk" , .id =32 , }, + { .n ="flex12_gclk" , .id =33 , }, + { .n ="i2s_gclk" , .id =34 , .r = { .min =0 , .max =105000000 }, }, + { .n ="pit64b_gclk" , .id =37 , }, + { .n ="classd_gclk" , .id =42 , .r = { .min =0 , .max =100000000 }, }, + { .n ="tcb1_gclk" , .id =45 , }, + { .n ="dbgu_gclk" , .id =47 , }, +}; + +#define prepare_mux_table (_allocs, _index, _dst, _src, _num, _label) \ + do { \
drivers/clk/at91/sam9x60.c line 376
Quoted 10 lines
drivers/clk/at91/sam9x60.c new file +10
-0+int _i; \ + (_dst) =kzalloc (sizeof (*(_dst)) * (_num),GFP_KERNEL ); \ +if (!(_dst)) \ + goto _label; \ + (_allocs)[(_index)++] = (_dst); \ +for (_i =0 ; _i < (_num); _i++) \ + (_dst)[_i] = (_src)[_i]; \ + }while (0 ) + +
Double blank line
Quoted 129 lines
drivers/clk/at91/sam9x60.c new file +129
-0+static int sam9x60_clk_probe (struct udevice *dev) +{ +void __iomem *base = (void *)devfdt_get_addr_ptr (dev); +unsigned int *clkmuxallocs[64 ], *muxallocs[64 ]; +const char *p[10 ]; +unsigned int cm[10 ], m[10 ], *tmpclkmux, *tmpmux; +struct clk clk, *c; +bool main_osc_bypass; +int ret, muxallocindex =0 , clkmuxallocindex =0 , i; +static const struct clk_range r = {0 ,0 }; + +if (!base) +return -EINVAL ; + +memset (muxallocs,0 ,ARRAY_SIZE (muxallocs)); +memset (clkmuxallocs,0 ,ARRAY_SIZE (clkmuxallocs)); + + ret =clk_get_by_index (dev,0 , &clk); +if (ret) +return ret; + + ret =clk_get_by_id (clk.id, &c); +if (ret) +return ret; + + clk_names[ID_TD_SLCK ] =kmemdup (clk_hw_get_name (c), +strlen (clk_hw_get_name (c)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_TD_SLCK ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,1 , &clk); +if (ret) +return ret; + + ret =clk_get_by_id (clk.id, &c); +if (ret) +return ret; + + clk_names[ID_MD_SLCK ] =kmemdup (clk_hw_get_name (c), +strlen (clk_hw_get_name (c)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_MD_SLCK ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,2 , &clk); +if (ret) +return ret; + + clk_names[ID_MAIN_XTAL ] =kmemdup (clk_hw_get_name (&clk), +strlen (clk_hw_get_name (&clk)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_MAIN_XTAL ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,3 , &clk); +if (ret) + goto fail; + + clk_names[ID_MAIN_RC ] =kmemdup (clk_hw_get_name (&clk), +strlen (clk_hw_get_name (&clk)) +1 ,GFP_KERNEL ); +if (ret) + goto fail; + + main_osc_bypass =dev_read_bool (dev,"atmel,main-osc-bypass" ); + +/* Register main rc oscillator. */ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_RC_OSC ), +at91_clk_main_rc (base, clk_names[ID_MAIN_RC_OSC ], + clk_names[ID_MAIN_RC ])); + +/* Register main oscillator. */ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_OSC ), +at91_clk_main_osc (base, clk_names[ID_MAIN_OSC ], + clk_names[ID_MAIN_XTAL ], main_osc_bypass)); + +/* Register mainck. */ + p[0 ] = clk_names[ID_MAIN_RC_OSC ]; + p[1 ] = clk_names[ID_MAIN_OSC ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_RC_OSC ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_OSC ); +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm,2 , + fail); +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ), +at91_clk_sam9x5_main (base, clk_names[ID_MAINCK ], p, +2 , tmpclkmux,PMC_TYPE_CORE )); + +/* Register PLL fracs clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_plls); i++) { +if (sam9x60_plls[i].t !=PLL_TYPE_FRAC ) +continue ; + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_plls[i].cid), +sam9x60_clk_register_frac_pll (base, sam9x60_plls[i].n, + sam9x60_plls[i].p, sam9x60_plls[i].id, + sam9x60_plls[i].c, sam9x60_plls[i].l, + sam9x60_plls[i].f)); + } + +/* Register PLL div clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_plls); i++) { +if (sam9x60_plls[i].t !=PLL_TYPE_DIV ) +continue ; + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_plls[i].cid), +sam9x60_clk_register_div_pll (base, sam9x60_plls[i].n, + sam9x60_plls[i].p, sam9x60_plls[i].id, + sam9x60_plls[i].c, sam9x60_plls[i].l, + sam9x60_plls[i].f)); + } + +/* Register MCK clock. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_MAINCK ]; + p[2 ] = clk_names[ID_PLL_A_DIV ]; + p[3 ] = clk_names[ID_PLL_U_DIV ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm,4 , + fail); +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ), +at91_clk_register_master (base, clk_names[ID_MCK ], p, +4 , &mck_layout, &mck_characteristics, tmpclkmux)); + +/* Register programmable clocks. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_TD_SLCK ]; + p[2 ] = clk_names[ID_MAINCK ]; + p[3 ] = clk_names[ID_MCK ]; + p[4 ] = clk_names[ID_PLL_A_DIV ];
drivers/clk/at91/sam9x60.c line 515
Quoted 10 lines
drivers/clk/at91/sam9x60.c new file +10
-0+ p[5 ] = clk_names[ID_PLL_U_DIV ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_TD_SLCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ); + cm[4 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[5 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +for (i =0 ; i <ARRAY_SIZE (sam9x60_prog); i++) { +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm, +6 , fail);
Nitpick:
Could you have a look at alignment here and in some other points, as checkpatch is reporting checks :
CHECK: Alignment should match open parenthesis
#547: FILE: drivers/clk/at91/sam9x60.c:515:
+ prepare_mux_table(clkmuxallocs, clkmuxallocindex, tmpclkmux, cm,
+ 6, fail);
Quoted 80 lines
drivers/clk/at91/sam9x60.c new file +79
-0+ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_prog[i].cid), +at91_clk_register_programmable (base, sam9x60_prog[i].n, + p,10 , i, &programmable_layout, tmpclkmux, + sam9x60_prog_mux_table)); + } + +/* System clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_systemck); i++) { +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_SYSTEM , sam9x60_systemck[i].cid), +at91_clk_register_system (base, sam9x60_systemck[i].n, + sam9x60_systemck[i].p, sam9x60_systemck[i].id)); + } + +/* Peripheral clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_periphck); i++) { +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_PERIPHERAL , + sam9x60_periphck[i].id), +at91_clk_register_sam9x5_peripheral (base, + &pcr_layout, sam9x60_periphck[i].n, + clk_names[ID_MCK ], sam9x60_periphck[i].id, &r)); + } + +/* Generic clocks. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_TD_SLCK ]; + p[2 ] = clk_names[ID_MAINCK ]; + p[3 ] = clk_names[ID_MCK ]; + p[4 ] = clk_names[ID_PLL_A_DIV ]; + p[5 ] = clk_names[ID_PLL_U_DIV ]; + m[0 ] =0 ; + m[1 ] =1 ; + m[2 ] =2 ; + m[3 ] =3 ; + m[4 ] =4 ; + m[5 ] =5 ; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_TD_SLCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ); + cm[4 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[5 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +for (i =0 ; i <ARRAY_SIZE (sam9x60_gck); i++) { +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm, +6 , fail); +prepare_mux_table (muxallocs, muxallocindex, tmpmux, m, +6 , fail); + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_GCK , sam9x60_gck[i].id), +at91_clk_register_generic (base, &pcr_layout, + sam9x60_gck[i].n, p, tmpclkmux, tmpmux, +6 , sam9x60_gck[i].id, &sam9x60_gck[i].r)); + } + +return 0 ; + +fail: +for (i =0 ; i <ARRAY_SIZE (muxallocs); i++) +kfree (muxallocs[i]); + +for (i =0 ; i <ARRAY_SIZE (clkmuxallocs); i++) +kfree (clkmuxallocs[i]); + +return -ENOMEM ; +} + +static const struct udevice_id sam9x60_clk_ids[] = { + { .compatible ="microchip,sam9x60-pmc" }, + {/* Sentinel. */ }, +}; + +U_BOOT_DRIVER (at91_sam9x60_pmc) = { + .name ="at91-sam9x60-pmc" , + .id =UCLASS_CLK , + .of_match = sam9x60_clk_ids, + .ops = &at91_clk_ops, + .probe = sam9x60_clk_probe, + .flags =DM_FLAG_PRE_RELOC , +};
PATCH 2/7 clk: at91: sam9x60: add support compatible with CCF
Hi Eugen,
Quoted 552 lines · On 06.10.2020 09:32, Eugen Hristev - M18282 wrote:
Quoted 4 lines · Claudiu Beznea
Add SAM9X60 clock support compatible with CCF.
Signed-off-by Claudiu Beznea <[email protected]>---
Hi Claudiu,
Quoted 389 lines
drivers/clk/at91/Makefile | 1 + drivers/clk/at91/sam9x60.c | 594 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 595 insertions(+)create mode 100644
drivers/clk/at91/sam9x60.cdrivers/clk/at91/Makefile +1
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_AT91_GENERIC_CLK) += clk-generic.o obj-$(CONFIG_AT91_UTMI) += clk-utmi.o obj-$(CONFIG_AT91_SAM9X60_PLL) += clk-sam9x60-pll.o obj-$(CONFIG_SAMA7G5) += sama7g5.o +obj-$(CONFIG_SAM9X60) += sam9x60.o else obj-y += compat.o endifdrivers/clk/at91/sam9x60.c new file +366
-0@@ -0,0 +1,594 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries +* +* Author: Claudiu Beznea <[email protected]> +* +* Based on sam9x60.c on Linux. +*/ + +#include <common.h> +#include <clk-uclass.h> +#include <dm.h> +#include <dt-bindings/clk/at91.h> +#include <linux/clk-provider.h> + +#include "pmc.h" + +/** +* Clock identifiers to be used in conjunction with macros like +* AT91_TO_CLK_ID() +* +* @ID_MD_SLCK: TD slow clock identifier +* @ID_TD_SLCK: MD slow clock identifier +* @ID_MAIN_XTAL: Main Xtal clock identifier +* @ID_MAIN_RC: Main RC clock identifier +* @ID_MAIN_RC_OSC: Main RC Oscillator clock identifier +* @ID_MAIN_OSC: Main Oscillator clock identifier +* @ID_MAINCK: MAINCK clock identifier +* @ID_PLL_U_FRAC: UPLL fractional clock identifier +* @ID_PLL_U_DIV: UPLL divider clock identifier +* @ID_PLL_A_FRAC: APLL fractional clock identifier +* @ID_PLL_A_DIV: APLL divider clock identifier + +* @ID_MCK: MCK clock identifier + +* @ID_UTMI: UTMI clock identifier + +* @ID_PROG0: Programmable 0 clock identifier +* @ID_PROG1: Programmable 1 clock identifier + +* @ID_PCK0: PCK0 system clock identifier +* @ID_PCK1: PCK1 system clock identifier +* @ID_DDR: DDR system clock identifier +* @ID_QSPI: QSPI system clock identifier +* +* Note: if changing the values of this enums please sync them with +* device tree +*/ +enum pmc_clk_ids { +ID_MD_SLCK =0 , +ID_TD_SLCK =1 , +ID_MAIN_XTAL =2 , +ID_MAIN_RC =3 , +ID_MAIN_RC_OSC =4 , +ID_MAIN_OSC =5 , +ID_MAINCK =6 , + +ID_PLL_U_FRAC =7 , +ID_PLL_U_DIV =8 , +ID_PLL_A_FRAC =9 , +ID_PLL_A_DIV =10 , + +ID_MCK =11 , + +ID_UTMI =12 , + +ID_PROG0 =13 , +ID_PROG1 =14 , + +ID_PCK0 =15 , +ID_PCK1 =16 , + +ID_DDR =17 , +ID_QSPI =18 , + +ID_MAX , +}; + +/** +* PLL type identifiers +* @PLL_TYPE_FRAC: fractional PLL identifier +* @PLL_TYPE_DIV: divider PLL identifier +*/ +enum pll_type { +PLL_TYPE_FRAC , +PLL_TYPE_DIV , +}; + +/* Clock names used as parents for multiple clocks. */ +static const char *clk_names[] = { + [ID_MAIN_RC_OSC ] ="main_rc_osc" , + [ID_MAIN_OSC ] ="main_osc" , + [ID_MAINCK ] ="mainck" , + [ID_PLL_U_DIV ] ="upll_divpmcck" , + [ID_PLL_A_DIV ] ="plla_divpmcck" , + [ID_MCK ] ="mck" , +}; + +/* Fractional PLL output range. */ +static const struct clk_range plla_outputs[] = { + { .min =2343750 , .max =1200000000 }, +}; + +static const struct clk_range upll_outputs[] = { + { .min =300000000 , .max =500000000 }, +}; + +/* PLL characteristics. */ +static const struct clk_pll_characteristics apll_characteristics = { + .input = { .min =12000000 , .max =48000000 }, + .num_output =ARRAY_SIZE (plla_outputs), + .output = plla_outputs, +}; + +static const struct clk_pll_characteristics upll_characteristics = { + .input = { .min =12000000 , .max =48000000 }, + .num_output =ARRAY_SIZE (upll_outputs), + .output = upll_outputs, + .upll = true, +}; + +/* Layout for fractional PLLs. */ +static const struct clk_pll_layout pll_layout_frac = { + .mul_mask =GENMASK (31 ,24 ), + .frac_mask =GENMASK (21 ,0 ), + .mul_shift =24 , + .frac_shift =0 , +}; + +/* Layout for DIV PLLs. */ +static const struct clk_pll_layout pll_layout_div = { + .div_mask =GENMASK (7 ,0 ), + .endiv_mask =BIT (29 ), + .div_shift =0 , + .endiv_shift =29 , +}; + +/* MCK characteristics. */ +static const struct clk_master_characteristics mck_characteristics = { + .output = { .min =140000000 , .max =200000000 }, + .divisors = {1 ,2 ,4 ,3 }, + .have_div3_pres =1 , +}; + +/* MCK layout. */ +static const struct clk_master_layout mck_layout = { + .mask =0x373 , + .pres_shift =4 , + .offset =0x28 , +}; + +/* Programmable clock layout. */ +static const struct clk_programmable_layout programmable_layout = { + .pres_mask =0xff , + .pres_shift =8 , + .css_mask =0x1f , + .have_slck_mck =0 , + .is_pres_direct =1 , +}; + +/* Peripheral clock layout. */ +static const struct clk_pcr_layout pcr_layout = { + .offset =0x88 , + .cmd =BIT (31 ), + .gckcss_mask =GENMASK (12 ,8 ), + .pid_mask =GENMASK (6 ,0 ), +}; + +/** +* PLL clocks description +* @n: clock name +* @p: clock parent +* @l: clock layout +* @t: clock type +* @f: true if clock is fixed and not changeable by driver +* @id: clock id corresponding to PLL driver +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +const char *p; +const struct clk_pll_layout *l; +const struct clk_pll_characteristics *c; +u8 t; +u8 f; +u8 id; +u8 cid; +} sam9x60_plls[] = { + { + .n ="plla_fracck" , + .p ="mainck" , + .l = &pll_layout_frac, + .c = &apll_characteristics, + .t =PLL_TYPE_FRAC , + .f =1 , + .id =0 , + .cid =ID_PLL_A_FRAC , + }, + + { + .n ="plla_divpmcck" , + .p ="plla_fracck" , + .l = &pll_layout_div, + .c = &apll_characteristics, + .t =PLL_TYPE_DIV , + .f =1 , + .id =0 , + .cid =ID_PLL_A_DIV , + }, + + { + .n ="upll_fracck" , + .p ="main_osc" , + .l = &pll_layout_frac, + .c = &upll_characteristics, + .t =PLL_TYPE_FRAC , + .f =1 , + .id =1 , + .cid =ID_PLL_U_FRAC , + }, + + { + .n ="upll_divpmcck" , + .p ="upll_fracck" , + .l = &pll_layout_div, + .c = &upll_characteristics, + .t =PLL_TYPE_DIV , + .f =1 , + .id =1 , + .cid =ID_PLL_U_DIV , + }, +}; + +/** +* Programmable clock description +* @n: clock name +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +u8 cid; +} sam9x60_prog[] = { + { .n ="prog0" , .cid =ID_PROG0 , }, + { .n ="prog1" , .cid =ID_PROG1 , }, +}; + +/* Mux table for programmable clocks. */ +static u32 sam9x60_prog_mux_table[] = {0 ,1 ,2 ,3 ,4 ,5 , }; + +/** +* System clock description +* @n: clock name +* @p: parent clock name +* @id: clock id corresponding to system clock driver +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +const char *p; +u8 id; +u8 cid; +} sam9x60_systemck[] = { + { .n ="ddrck" , .p ="mck" , .id =2 , .cid =ID_DDR , }, + { .n ="pck0" , .p ="prog0" , .id =8 , .cid =ID_PCK0 , }, + { .n ="pck1" , .p ="prog1" , .id =9 , .cid =ID_PCK1 , }, + { .n ="qspick" , .p ="mck" , .id =19 , .cid =ID_QSPI , }, +}; + +/** +* Peripheral clock description +* @n: clock name +* @id: clock id +*/ +static const struct { +const char *n; +u8 id; +} sam9x60_periphck[] = { + { .n ="pioA_clk" , .id =2 , }, + { .n ="pioB_clk" , .id =3 , }, + { .n ="pioC_clk" , .id =4 , }, + { .n ="flex0_clk" , .id =5 , }, + { .n ="flex1_clk" , .id =6 , }, + { .n ="flex2_clk" , .id =7 , }, + { .n ="flex3_clk" , .id =8 , }, + { .n ="flex6_clk" , .id =9 , }, + { .n ="flex7_clk" , .id =10 , }, + { .n ="flex8_clk" , .id =11 , }, + { .n ="sdmmc0_clk" , .id =12 , }, + { .n ="flex4_clk" , .id =13 , }, + { .n ="flex5_clk" , .id =14 , }, + { .n ="flex9_clk" , .id =15 , }, + { .n ="flex10_clk" , .id =16 , }, + { .n ="tcb0_clk" , .id =17 , }, + { .n ="pwm_clk" , .id =18 , }, + { .n ="adc_clk" , .id =19 , }, + { .n ="dma0_clk" , .id =20 , }, + { .n ="matrix_clk" , .id =21 , }, + { .n ="uhphs_clk" , .id =22 , }, + { .n ="udphs_clk" , .id =23 , }, + { .n ="macb0_clk" , .id =24 , }, + { .n ="lcd_clk" , .id =25 , }, + { .n ="sdmmc1_clk" , .id =26 , }, + { .n ="macb1_clk" , .id =27 , }, + { .n ="ssc_clk" , .id =28 , }, + { .n ="can0_clk" , .id =29 , }, + { .n ="can1_clk" , .id =30 , }, + { .n ="flex11_clk" , .id =32 , }, + { .n ="flex12_clk" , .id =33 , }, + { .n ="i2s_clk" , .id =34 , }, + { .n ="qspi_clk" , .id =35 , }, + { .n ="gfx2d_clk" , .id =36 , }, + { .n ="pit64b_clk" , .id =37 , }, + { .n ="trng_clk" , .id =38 , }, + { .n ="aes_clk" , .id =39 , }, + { .n ="tdes_clk" , .id =40 , }, + { .n ="sha_clk" , .id =41 , }, + { .n ="classd_clk" , .id =42 , }, + { .n ="isi_clk" , .id =43 , }, + { .n ="pioD_clk" , .id =44 , }, + { .n ="tcb1_clk" , .id =45 , }, + { .n ="dbgu_clk" , .id =47 , }, + { .n ="mpddr_clk" , .id =49 , }, +}; + +/** +* Generic clock description +* @n: clock name +* @ep: extra parents parents names +* @ep_mux_table: extra parents mux table +* @ep_clk_mux_table: extra parents clock mux table (for CCF) +* @r: clock output range +* @ep_count: extra parents count +* @id: clock id +*/ +static const struct { +const char *n; +struct clk_range r; +u8 id; +} sam9x60_gck[] = { + { .n ="flex0_gclk" , .id =5 , }, + { .n ="flex1_gclk" , .id =6 , }, + { .n ="flex2_gclk" , .id =7 , }, + { .n ="flex3_gclk" , .id =8 , }, + { .n ="flex6_gclk" , .id =9 , }, + { .n ="flex7_gclk" , .id =10 , }, + { .n ="flex8_gclk" , .id =11 , }, + { .n ="sdmmc0_gclk" , .id =12 , .r = { .min =0 , .max =105000000 }, }, + { .n ="flex4_gclk" , .id =13 , }, + { .n ="flex5_gclk" , .id =14 , }, + { .n ="flex9_gclk" , .id =15 , }, + { .n ="flex10_gclk" , .id =16 , }, + { .n ="tcb0_gclk" , .id =17 , }, + { .n ="adc_gclk" , .id =19 , }, + { .n ="lcd_gclk" , .id =25 , .r = { .min =0 , .max =140000000 }, }, + { .n ="sdmmc1_gclk" , .id =26 , .r = { .min =0 , .max =105000000 }, }, + { .n ="flex11_gclk" , .id =32 , }, + { .n ="flex12_gclk" , .id =33 , }, + { .n ="i2s_gclk" , .id =34 , .r = { .min =0 , .max =105000000 }, }, + { .n ="pit64b_gclk" , .id =37 , }, + { .n ="classd_gclk" , .id =42 , .r = { .min =0 , .max =100000000 }, }, + { .n ="tcb1_gclk" , .id =45 , }, + { .n ="dbgu_gclk" , .id =47 , }, +}; + +#define prepare_mux_table (_allocs, _index, _dst, _src, _num, _label) \ + do { \drivers/clk/at91/sam9x60.c line 376
Quoted 10 lines
drivers/clk/at91/sam9x60.c new file +10
-0+int _i; \ + (_dst) =kzalloc (sizeof (*(_dst)) * (_num),GFP_KERNEL ); \ +if (!(_dst)) \ + goto _label; \ + (_allocs)[(_index)++] = (_dst); \ +for (_i =0 ; _i < (_num); _i++) \ + (_dst)[_i] = (_src)[_i]; \ + }while (0 ) + +Double blank line
Quoted 129 lines
drivers/clk/at91/sam9x60.c new file +129
-0+static int sam9x60_clk_probe (struct udevice *dev) +{ +void __iomem *base = (void *)devfdt_get_addr_ptr (dev); +unsigned int *clkmuxallocs[64 ], *muxallocs[64 ]; +const char *p[10 ]; +unsigned int cm[10 ], m[10 ], *tmpclkmux, *tmpmux; +struct clk clk, *c; +bool main_osc_bypass; +int ret, muxallocindex =0 , clkmuxallocindex =0 , i; +static const struct clk_range r = {0 ,0 }; + +if (!base) +return -EINVAL ; + +memset (muxallocs,0 ,ARRAY_SIZE (muxallocs)); +memset (clkmuxallocs,0 ,ARRAY_SIZE (clkmuxallocs)); + + ret =clk_get_by_index (dev,0 , &clk); +if (ret) +return ret; + + ret =clk_get_by_id (clk.id, &c); +if (ret) +return ret; + + clk_names[ID_TD_SLCK ] =kmemdup (clk_hw_get_name (c), +strlen (clk_hw_get_name (c)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_TD_SLCK ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,1 , &clk); +if (ret) +return ret; + + ret =clk_get_by_id (clk.id, &c); +if (ret) +return ret; + + clk_names[ID_MD_SLCK ] =kmemdup (clk_hw_get_name (c), +strlen (clk_hw_get_name (c)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_MD_SLCK ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,2 , &clk); +if (ret) +return ret; + + clk_names[ID_MAIN_XTAL ] =kmemdup (clk_hw_get_name (&clk), +strlen (clk_hw_get_name (&clk)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_MAIN_XTAL ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,3 , &clk); +if (ret) + goto fail; + + clk_names[ID_MAIN_RC ] =kmemdup (clk_hw_get_name (&clk), +strlen (clk_hw_get_name (&clk)) +1 ,GFP_KERNEL ); +if (ret) + goto fail; + + main_osc_bypass =dev_read_bool (dev,"atmel,main-osc-bypass" ); + +/* Register main rc oscillator. */ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_RC_OSC ), +at91_clk_main_rc (base, clk_names[ID_MAIN_RC_OSC ], + clk_names[ID_MAIN_RC ])); + +/* Register main oscillator. */ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_OSC ), +at91_clk_main_osc (base, clk_names[ID_MAIN_OSC ], + clk_names[ID_MAIN_XTAL ], main_osc_bypass)); + +/* Register mainck. */ + p[0 ] = clk_names[ID_MAIN_RC_OSC ]; + p[1 ] = clk_names[ID_MAIN_OSC ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_RC_OSC ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_OSC ); +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm,2 , + fail); +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ), +at91_clk_sam9x5_main (base, clk_names[ID_MAINCK ], p, +2 , tmpclkmux,PMC_TYPE_CORE )); + +/* Register PLL fracs clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_plls); i++) { +if (sam9x60_plls[i].t !=PLL_TYPE_FRAC ) +continue ; + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_plls[i].cid), +sam9x60_clk_register_frac_pll (base, sam9x60_plls[i].n, + sam9x60_plls[i].p, sam9x60_plls[i].id, + sam9x60_plls[i].c, sam9x60_plls[i].l, + sam9x60_plls[i].f)); + } + +/* Register PLL div clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_plls); i++) { +if (sam9x60_plls[i].t !=PLL_TYPE_DIV ) +continue ; + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_plls[i].cid), +sam9x60_clk_register_div_pll (base, sam9x60_plls[i].n, + sam9x60_plls[i].p, sam9x60_plls[i].id, + sam9x60_plls[i].c, sam9x60_plls[i].l, + sam9x60_plls[i].f)); + } + +/* Register MCK clock. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_MAINCK ]; + p[2 ] = clk_names[ID_PLL_A_DIV ]; + p[3 ] = clk_names[ID_PLL_U_DIV ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm,4 , + fail); +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ), +at91_clk_register_master (base, clk_names[ID_MCK ], p, +4 , &mck_layout, &mck_characteristics, tmpclkmux)); + +/* Register programmable clocks. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_TD_SLCK ]; + p[2 ] = clk_names[ID_MAINCK ]; + p[3 ] = clk_names[ID_MCK ]; + p[4 ] = clk_names[ID_PLL_A_DIV ];drivers/clk/at91/sam9x60.c line 515
Quoted 10 lines
drivers/clk/at91/sam9x60.c new file +10
-0+ p[5 ] = clk_names[ID_PLL_U_DIV ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_TD_SLCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ); + cm[4 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[5 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +for (i =0 ; i <ARRAY_SIZE (sam9x60_prog); i++) { +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm, +6 , fail);Nitpick:
Quoted 2 lines
Could you have a look at alignment here and in some other points, as checkpatch is reporting checks :
OK! I kept it like this as if I allign to the open parathesis the alignment would become worse than this (but this is just personal favor).
Thank you,
Claudiu Beznea
Quoted 88 lines
CHECK: Alignment should match open parenthesis
#547: FILE:drivers/clk/at91/sam9x60.c:515:(quoted diff) +2
-0+ prepare_mux_table(clkmuxallocs, clkmuxallocindex, tmpclkmux, cm, + 6, fail);Quoted 82 lines
drivers/clk/at91/sam9x60.c new file +79
-0+ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_prog[i].cid), +at91_clk_register_programmable (base, sam9x60_prog[i].n, + p,10 , i, &programmable_layout, tmpclkmux, + sam9x60_prog_mux_table)); + } + +/* System clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_systemck); i++) { +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_SYSTEM , sam9x60_systemck[i].cid), +at91_clk_register_system (base, sam9x60_systemck[i].n, + sam9x60_systemck[i].p, sam9x60_systemck[i].id)); + } + +/* Peripheral clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_periphck); i++) { +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_PERIPHERAL , + sam9x60_periphck[i].id), +at91_clk_register_sam9x5_peripheral (base, + &pcr_layout, sam9x60_periphck[i].n, + clk_names[ID_MCK ], sam9x60_periphck[i].id, &r)); + } + +/* Generic clocks. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_TD_SLCK ]; + p[2 ] = clk_names[ID_MAINCK ]; + p[3 ] = clk_names[ID_MCK ]; + p[4 ] = clk_names[ID_PLL_A_DIV ]; + p[5 ] = clk_names[ID_PLL_U_DIV ]; + m[0 ] =0 ; + m[1 ] =1 ; + m[2 ] =2 ; + m[3 ] =3 ; + m[4 ] =4 ; + m[5 ] =5 ; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_TD_SLCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ); + cm[4 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[5 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +for (i =0 ; i <ARRAY_SIZE (sam9x60_gck); i++) { +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm, +6 , fail); +prepare_mux_table (muxallocs, muxallocindex, tmpmux, m, +6 , fail); + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_GCK , sam9x60_gck[i].id), +at91_clk_register_generic (base, &pcr_layout, + sam9x60_gck[i].n, p, tmpclkmux, tmpmux, +6 , sam9x60_gck[i].id, &sam9x60_gck[i].r)); + } + +return 0 ; + +fail: +for (i =0 ; i <ARRAY_SIZE (muxallocs); i++) +kfree (muxallocs[i]); + +for (i =0 ; i <ARRAY_SIZE (clkmuxallocs); i++) +kfree (clkmuxallocs[i]); + +return -ENOMEM ; +} + +static const struct udevice_id sam9x60_clk_ids[] = { + { .compatible ="microchip,sam9x60-pmc" }, + {/* Sentinel. */ }, +}; + +U_BOOT_DRIVER (at91_sam9x60_pmc) = { + .name ="at91-sam9x60-pmc" , + .id =UCLASS_CLK , + .of_match = sam9x60_clk_ids, + .ops = &at91_clk_ops, + .probe = sam9x60_clk_probe, + .flags =DM_FLAG_PRE_RELOC , +};
PATCH 2/7 clk: at91: sam9x60: add support compatible with CCF
Quoted 556 lines · On 06.10.2020 09:59, Claudiu Beznea - M18063 wrote:
Hi Eugen,
Quoted 552 lines · On 06.10.2020 09:32, Eugen Hristev - M18282 wrote:
Quoted 4 lines · Claudiu Beznea
Add SAM9X60 clock support compatible with CCF.
Signed-off-by Claudiu Beznea <[email protected]>---
Hi Claudiu,
Quoted 389 lines
drivers/clk/at91/Makefile | 1 + drivers/clk/at91/sam9x60.c | 594 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 595 insertions(+)create mode 100644
drivers/clk/at91/sam9x60.cdrivers/clk/at91/Makefile +1
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_AT91_GENERIC_CLK) += clk-generic.o obj-$(CONFIG_AT91_UTMI) += clk-utmi.o obj-$(CONFIG_AT91_SAM9X60_PLL) += clk-sam9x60-pll.o obj-$(CONFIG_SAMA7G5) += sama7g5.o +obj-$(CONFIG_SAM9X60) += sam9x60.o else obj-y += compat.o endifdrivers/clk/at91/sam9x60.c new file +366
-0@@ -0,0 +1,594 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries +* +* Author: Claudiu Beznea <[email protected]> +* +* Based on sam9x60.c on Linux. +*/ + +#include <common.h> +#include <clk-uclass.h> +#include <dm.h> +#include <dt-bindings/clk/at91.h> +#include <linux/clk-provider.h> + +#include "pmc.h" + +/** +* Clock identifiers to be used in conjunction with macros like +* AT91_TO_CLK_ID() +* +* @ID_MD_SLCK: TD slow clock identifier +* @ID_TD_SLCK: MD slow clock identifier +* @ID_MAIN_XTAL: Main Xtal clock identifier +* @ID_MAIN_RC: Main RC clock identifier +* @ID_MAIN_RC_OSC: Main RC Oscillator clock identifier +* @ID_MAIN_OSC: Main Oscillator clock identifier +* @ID_MAINCK: MAINCK clock identifier +* @ID_PLL_U_FRAC: UPLL fractional clock identifier +* @ID_PLL_U_DIV: UPLL divider clock identifier +* @ID_PLL_A_FRAC: APLL fractional clock identifier +* @ID_PLL_A_DIV: APLL divider clock identifier + +* @ID_MCK: MCK clock identifier + +* @ID_UTMI: UTMI clock identifier + +* @ID_PROG0: Programmable 0 clock identifier +* @ID_PROG1: Programmable 1 clock identifier + +* @ID_PCK0: PCK0 system clock identifier +* @ID_PCK1: PCK1 system clock identifier +* @ID_DDR: DDR system clock identifier +* @ID_QSPI: QSPI system clock identifier +* +* Note: if changing the values of this enums please sync them with +* device tree +*/ +enum pmc_clk_ids { +ID_MD_SLCK =0 , +ID_TD_SLCK =1 , +ID_MAIN_XTAL =2 , +ID_MAIN_RC =3 , +ID_MAIN_RC_OSC =4 , +ID_MAIN_OSC =5 , +ID_MAINCK =6 , + +ID_PLL_U_FRAC =7 , +ID_PLL_U_DIV =8 , +ID_PLL_A_FRAC =9 , +ID_PLL_A_DIV =10 , + +ID_MCK =11 , + +ID_UTMI =12 , + +ID_PROG0 =13 , +ID_PROG1 =14 , + +ID_PCK0 =15 , +ID_PCK1 =16 , + +ID_DDR =17 , +ID_QSPI =18 , + +ID_MAX , +}; + +/** +* PLL type identifiers +* @PLL_TYPE_FRAC: fractional PLL identifier +* @PLL_TYPE_DIV: divider PLL identifier +*/ +enum pll_type { +PLL_TYPE_FRAC , +PLL_TYPE_DIV , +}; + +/* Clock names used as parents for multiple clocks. */ +static const char *clk_names[] = { + [ID_MAIN_RC_OSC ] ="main_rc_osc" , + [ID_MAIN_OSC ] ="main_osc" , + [ID_MAINCK ] ="mainck" , + [ID_PLL_U_DIV ] ="upll_divpmcck" , + [ID_PLL_A_DIV ] ="plla_divpmcck" , + [ID_MCK ] ="mck" , +}; + +/* Fractional PLL output range. */ +static const struct clk_range plla_outputs[] = { + { .min =2343750 , .max =1200000000 }, +}; + +static const struct clk_range upll_outputs[] = { + { .min =300000000 , .max =500000000 }, +}; + +/* PLL characteristics. */ +static const struct clk_pll_characteristics apll_characteristics = { + .input = { .min =12000000 , .max =48000000 }, + .num_output =ARRAY_SIZE (plla_outputs), + .output = plla_outputs, +}; + +static const struct clk_pll_characteristics upll_characteristics = { + .input = { .min =12000000 , .max =48000000 }, + .num_output =ARRAY_SIZE (upll_outputs), + .output = upll_outputs, + .upll = true, +}; + +/* Layout for fractional PLLs. */ +static const struct clk_pll_layout pll_layout_frac = { + .mul_mask =GENMASK (31 ,24 ), + .frac_mask =GENMASK (21 ,0 ), + .mul_shift =24 , + .frac_shift =0 , +}; + +/* Layout for DIV PLLs. */ +static const struct clk_pll_layout pll_layout_div = { + .div_mask =GENMASK (7 ,0 ), + .endiv_mask =BIT (29 ), + .div_shift =0 , + .endiv_shift =29 , +}; + +/* MCK characteristics. */ +static const struct clk_master_characteristics mck_characteristics = { + .output = { .min =140000000 , .max =200000000 }, + .divisors = {1 ,2 ,4 ,3 }, + .have_div3_pres =1 , +}; + +/* MCK layout. */ +static const struct clk_master_layout mck_layout = { + .mask =0x373 , + .pres_shift =4 , + .offset =0x28 , +}; + +/* Programmable clock layout. */ +static const struct clk_programmable_layout programmable_layout = { + .pres_mask =0xff , + .pres_shift =8 , + .css_mask =0x1f , + .have_slck_mck =0 , + .is_pres_direct =1 , +}; + +/* Peripheral clock layout. */ +static const struct clk_pcr_layout pcr_layout = { + .offset =0x88 , + .cmd =BIT (31 ), + .gckcss_mask =GENMASK (12 ,8 ), + .pid_mask =GENMASK (6 ,0 ), +}; + +/** +* PLL clocks description +* @n: clock name +* @p: clock parent +* @l: clock layout +* @t: clock type +* @f: true if clock is fixed and not changeable by driver +* @id: clock id corresponding to PLL driver +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +const char *p; +const struct clk_pll_layout *l; +const struct clk_pll_characteristics *c; +u8 t; +u8 f; +u8 id; +u8 cid; +} sam9x60_plls[] = { + { + .n ="plla_fracck" , + .p ="mainck" , + .l = &pll_layout_frac, + .c = &apll_characteristics, + .t =PLL_TYPE_FRAC , + .f =1 , + .id =0 , + .cid =ID_PLL_A_FRAC , + }, + + { + .n ="plla_divpmcck" , + .p ="plla_fracck" , + .l = &pll_layout_div, + .c = &apll_characteristics, + .t =PLL_TYPE_DIV , + .f =1 , + .id =0 , + .cid =ID_PLL_A_DIV , + }, + + { + .n ="upll_fracck" , + .p ="main_osc" , + .l = &pll_layout_frac, + .c = &upll_characteristics, + .t =PLL_TYPE_FRAC , + .f =1 , + .id =1 , + .cid =ID_PLL_U_FRAC , + }, + + { + .n ="upll_divpmcck" , + .p ="upll_fracck" , + .l = &pll_layout_div, + .c = &upll_characteristics, + .t =PLL_TYPE_DIV , + .f =1 , + .id =1 , + .cid =ID_PLL_U_DIV , + }, +}; + +/** +* Programmable clock description +* @n: clock name +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +u8 cid; +} sam9x60_prog[] = { + { .n ="prog0" , .cid =ID_PROG0 , }, + { .n ="prog1" , .cid =ID_PROG1 , }, +}; + +/* Mux table for programmable clocks. */ +static u32 sam9x60_prog_mux_table[] = {0 ,1 ,2 ,3 ,4 ,5 , }; + +/** +* System clock description +* @n: clock name +* @p: parent clock name +* @id: clock id corresponding to system clock driver +* @cid: clock id corresponding to clock subsystem +*/ +static const struct { +const char *n; +const char *p; +u8 id; +u8 cid; +} sam9x60_systemck[] = { + { .n ="ddrck" , .p ="mck" , .id =2 , .cid =ID_DDR , }, + { .n ="pck0" , .p ="prog0" , .id =8 , .cid =ID_PCK0 , }, + { .n ="pck1" , .p ="prog1" , .id =9 , .cid =ID_PCK1 , }, + { .n ="qspick" , .p ="mck" , .id =19 , .cid =ID_QSPI , }, +}; + +/** +* Peripheral clock description +* @n: clock name +* @id: clock id +*/ +static const struct { +const char *n; +u8 id; +} sam9x60_periphck[] = { + { .n ="pioA_clk" , .id =2 , }, + { .n ="pioB_clk" , .id =3 , }, + { .n ="pioC_clk" , .id =4 , }, + { .n ="flex0_clk" , .id =5 , }, + { .n ="flex1_clk" , .id =6 , }, + { .n ="flex2_clk" , .id =7 , }, + { .n ="flex3_clk" , .id =8 , }, + { .n ="flex6_clk" , .id =9 , }, + { .n ="flex7_clk" , .id =10 , }, + { .n ="flex8_clk" , .id =11 , }, + { .n ="sdmmc0_clk" , .id =12 , }, + { .n ="flex4_clk" , .id =13 , }, + { .n ="flex5_clk" , .id =14 , }, + { .n ="flex9_clk" , .id =15 , }, + { .n ="flex10_clk" , .id =16 , }, + { .n ="tcb0_clk" , .id =17 , }, + { .n ="pwm_clk" , .id =18 , }, + { .n ="adc_clk" , .id =19 , }, + { .n ="dma0_clk" , .id =20 , }, + { .n ="matrix_clk" , .id =21 , }, + { .n ="uhphs_clk" , .id =22 , }, + { .n ="udphs_clk" , .id =23 , }, + { .n ="macb0_clk" , .id =24 , }, + { .n ="lcd_clk" , .id =25 , }, + { .n ="sdmmc1_clk" , .id =26 , }, + { .n ="macb1_clk" , .id =27 , }, + { .n ="ssc_clk" , .id =28 , }, + { .n ="can0_clk" , .id =29 , }, + { .n ="can1_clk" , .id =30 , }, + { .n ="flex11_clk" , .id =32 , }, + { .n ="flex12_clk" , .id =33 , }, + { .n ="i2s_clk" , .id =34 , }, + { .n ="qspi_clk" , .id =35 , }, + { .n ="gfx2d_clk" , .id =36 , }, + { .n ="pit64b_clk" , .id =37 , }, + { .n ="trng_clk" , .id =38 , }, + { .n ="aes_clk" , .id =39 , }, + { .n ="tdes_clk" , .id =40 , }, + { .n ="sha_clk" , .id =41 , }, + { .n ="classd_clk" , .id =42 , }, + { .n ="isi_clk" , .id =43 , }, + { .n ="pioD_clk" , .id =44 , }, + { .n ="tcb1_clk" , .id =45 , }, + { .n ="dbgu_clk" , .id =47 , }, + { .n ="mpddr_clk" , .id =49 , }, +}; + +/** +* Generic clock description +* @n: clock name +* @ep: extra parents parents names +* @ep_mux_table: extra parents mux table +* @ep_clk_mux_table: extra parents clock mux table (for CCF) +* @r: clock output range +* @ep_count: extra parents count +* @id: clock id +*/ +static const struct { +const char *n; +struct clk_range r; +u8 id; +} sam9x60_gck[] = { + { .n ="flex0_gclk" , .id =5 , }, + { .n ="flex1_gclk" , .id =6 , }, + { .n ="flex2_gclk" , .id =7 , }, + { .n ="flex3_gclk" , .id =8 , }, + { .n ="flex6_gclk" , .id =9 , }, + { .n ="flex7_gclk" , .id =10 , }, + { .n ="flex8_gclk" , .id =11 , }, + { .n ="sdmmc0_gclk" , .id =12 , .r = { .min =0 , .max =105000000 }, }, + { .n ="flex4_gclk" , .id =13 , }, + { .n ="flex5_gclk" , .id =14 , }, + { .n ="flex9_gclk" , .id =15 , }, + { .n ="flex10_gclk" , .id =16 , }, + { .n ="tcb0_gclk" , .id =17 , }, + { .n ="adc_gclk" , .id =19 , }, + { .n ="lcd_gclk" , .id =25 , .r = { .min =0 , .max =140000000 }, }, + { .n ="sdmmc1_gclk" , .id =26 , .r = { .min =0 , .max =105000000 }, }, + { .n ="flex11_gclk" , .id =32 , }, + { .n ="flex12_gclk" , .id =33 , }, + { .n ="i2s_gclk" , .id =34 , .r = { .min =0 , .max =105000000 }, }, + { .n ="pit64b_gclk" , .id =37 , }, + { .n ="classd_gclk" , .id =42 , .r = { .min =0 , .max =100000000 }, }, + { .n ="tcb1_gclk" , .id =45 , }, + { .n ="dbgu_gclk" , .id =47 , }, +}; + +#define prepare_mux_table (_allocs, _index, _dst, _src, _num, _label) \ + do { \drivers/clk/at91/sam9x60.c line 376
Quoted 10 lines
drivers/clk/at91/sam9x60.c new file +10
-0+int _i; \ + (_dst) =kzalloc (sizeof (*(_dst)) * (_num),GFP_KERNEL ); \ +if (!(_dst)) \ + goto _label; \ + (_allocs)[(_index)++] = (_dst); \ +for (_i =0 ; _i < (_num); _i++) \ + (_dst)[_i] = (_src)[_i]; \ + }while (0 ) + +Double blank line
Quoted 129 lines
drivers/clk/at91/sam9x60.c new file +129
-0+static int sam9x60_clk_probe (struct udevice *dev) +{ +void __iomem *base = (void *)devfdt_get_addr_ptr (dev); +unsigned int *clkmuxallocs[64 ], *muxallocs[64 ]; +const char *p[10 ]; +unsigned int cm[10 ], m[10 ], *tmpclkmux, *tmpmux; +struct clk clk, *c; +bool main_osc_bypass; +int ret, muxallocindex =0 , clkmuxallocindex =0 , i; +static const struct clk_range r = {0 ,0 }; + +if (!base) +return -EINVAL ; + +memset (muxallocs,0 ,ARRAY_SIZE (muxallocs)); +memset (clkmuxallocs,0 ,ARRAY_SIZE (clkmuxallocs)); + + ret =clk_get_by_index (dev,0 , &clk); +if (ret) +return ret; + + ret =clk_get_by_id (clk.id, &c); +if (ret) +return ret; + + clk_names[ID_TD_SLCK ] =kmemdup (clk_hw_get_name (c), +strlen (clk_hw_get_name (c)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_TD_SLCK ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,1 , &clk); +if (ret) +return ret; + + ret =clk_get_by_id (clk.id, &c); +if (ret) +return ret; + + clk_names[ID_MD_SLCK ] =kmemdup (clk_hw_get_name (c), +strlen (clk_hw_get_name (c)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_MD_SLCK ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,2 , &clk); +if (ret) +return ret; + + clk_names[ID_MAIN_XTAL ] =kmemdup (clk_hw_get_name (&clk), +strlen (clk_hw_get_name (&clk)) +1 ,GFP_KERNEL ); +if (!clk_names[ID_MAIN_XTAL ]) +return -ENOMEM ; + + ret =clk_get_by_index (dev,3 , &clk); +if (ret) + goto fail; + + clk_names[ID_MAIN_RC ] =kmemdup (clk_hw_get_name (&clk), +strlen (clk_hw_get_name (&clk)) +1 ,GFP_KERNEL ); +if (ret) + goto fail; + + main_osc_bypass =dev_read_bool (dev,"atmel,main-osc-bypass" ); + +/* Register main rc oscillator. */ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_RC_OSC ), +at91_clk_main_rc (base, clk_names[ID_MAIN_RC_OSC ], + clk_names[ID_MAIN_RC ])); + +/* Register main oscillator. */ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_OSC ), +at91_clk_main_osc (base, clk_names[ID_MAIN_OSC ], + clk_names[ID_MAIN_XTAL ], main_osc_bypass)); + +/* Register mainck. */ + p[0 ] = clk_names[ID_MAIN_RC_OSC ]; + p[1 ] = clk_names[ID_MAIN_OSC ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_RC_OSC ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAIN_OSC ); +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm,2 , + fail); +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ), +at91_clk_sam9x5_main (base, clk_names[ID_MAINCK ], p, +2 , tmpclkmux,PMC_TYPE_CORE )); + +/* Register PLL fracs clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_plls); i++) { +if (sam9x60_plls[i].t !=PLL_TYPE_FRAC ) +continue ; + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_plls[i].cid), +sam9x60_clk_register_frac_pll (base, sam9x60_plls[i].n, + sam9x60_plls[i].p, sam9x60_plls[i].id, + sam9x60_plls[i].c, sam9x60_plls[i].l, + sam9x60_plls[i].f)); + } + +/* Register PLL div clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_plls); i++) { +if (sam9x60_plls[i].t !=PLL_TYPE_DIV ) +continue ; + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_plls[i].cid), +sam9x60_clk_register_div_pll (base, sam9x60_plls[i].n, + sam9x60_plls[i].p, sam9x60_plls[i].id, + sam9x60_plls[i].c, sam9x60_plls[i].l, + sam9x60_plls[i].f)); + } + +/* Register MCK clock. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_MAINCK ]; + p[2 ] = clk_names[ID_PLL_A_DIV ]; + p[3 ] = clk_names[ID_PLL_U_DIV ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm,4 , + fail); +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ), +at91_clk_register_master (base, clk_names[ID_MCK ], p, +4 , &mck_layout, &mck_characteristics, tmpclkmux)); + +/* Register programmable clocks. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_TD_SLCK ]; + p[2 ] = clk_names[ID_MAINCK ]; + p[3 ] = clk_names[ID_MCK ]; + p[4 ] = clk_names[ID_PLL_A_DIV ];drivers/clk/at91/sam9x60.c line 515
Quoted 10 lines
drivers/clk/at91/sam9x60.c new file +10
-0+ p[5 ] = clk_names[ID_PLL_U_DIV ]; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_TD_SLCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ); + cm[4 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[5 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +for (i =0 ; i <ARRAY_SIZE (sam9x60_prog); i++) { +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm, +6 , fail);Nitpick:
Quoted 8 lines
Quoted 2 lines
Could you have a look at alignment here and in some other points, as checkpatch is reporting checks :
OK! I kept it like this as if I allign to the open parathesis the alignment would become worse than this (but this is just personal favor).
Thank you,
Claudiu Beznea
In this specific case, it looks like '6, fail);' is unaligned with the open paranthesis.
If your file comes directly from Linux and it's identical in Linux with this aligment, then it's better to leave it like that I guess. If nobody has anything against it, then it's fine.
Quoted 88 lines
Quoted 88 lines
CHECK: Alignment should match open parenthesis
#547: FILE:drivers/clk/at91/sam9x60.c:515:(quoted diff) +2
-0+ prepare_mux_table(clkmuxallocs, clkmuxallocindex, tmpclkmux, cm, + 6, fail);Quoted 82 lines
drivers/clk/at91/sam9x60.c new file +79
-0+ +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_CORE , sam9x60_prog[i].cid), +at91_clk_register_programmable (base, sam9x60_prog[i].n, + p,10 , i, &programmable_layout, tmpclkmux, + sam9x60_prog_mux_table)); + } + +/* System clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_systemck); i++) { +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_SYSTEM , sam9x60_systemck[i].cid), +at91_clk_register_system (base, sam9x60_systemck[i].n, + sam9x60_systemck[i].p, sam9x60_systemck[i].id)); + } + +/* Peripheral clocks. */ +for (i =0 ; i <ARRAY_SIZE (sam9x60_periphck); i++) { +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_PERIPHERAL , + sam9x60_periphck[i].id), +at91_clk_register_sam9x5_peripheral (base, + &pcr_layout, sam9x60_periphck[i].n, + clk_names[ID_MCK ], sam9x60_periphck[i].id, &r)); + } + +/* Generic clocks. */ + p[0 ] = clk_names[ID_MD_SLCK ]; + p[1 ] = clk_names[ID_TD_SLCK ]; + p[2 ] = clk_names[ID_MAINCK ]; + p[3 ] = clk_names[ID_MCK ]; + p[4 ] = clk_names[ID_PLL_A_DIV ]; + p[5 ] = clk_names[ID_PLL_U_DIV ]; + m[0 ] =0 ; + m[1 ] =1 ; + m[2 ] =2 ; + m[3 ] =3 ; + m[4 ] =4 ; + m[5 ] =5 ; + cm[0 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MD_SLCK ); + cm[1 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_TD_SLCK ); + cm[2 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MAINCK ); + cm[3 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_MCK ); + cm[4 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_A_DIV ); + cm[5 ] =AT91_TO_CLK_ID (PMC_TYPE_CORE ,ID_PLL_U_DIV ); +for (i =0 ; i <ARRAY_SIZE (sam9x60_gck); i++) { +prepare_mux_table (clkmuxallocs, clkmuxallocindex, tmpclkmux, cm, +6 , fail); +prepare_mux_table (muxallocs, muxallocindex, tmpmux, m, +6 , fail); + +clk_dm (AT91_TO_CLK_ID (PMC_TYPE_GCK , sam9x60_gck[i].id), +at91_clk_register_generic (base, &pcr_layout, + sam9x60_gck[i].n, p, tmpclkmux, tmpmux, +6 , sam9x60_gck[i].id, &sam9x60_gck[i].r)); + } + +return 0 ; + +fail: +for (i =0 ; i <ARRAY_SIZE (muxallocs); i++) +kfree (muxallocs[i]); + +for (i =0 ; i <ARRAY_SIZE (clkmuxallocs); i++) +kfree (clkmuxallocs[i]); + +return -ENOMEM ; +} + +static const struct udevice_id sam9x60_clk_ids[] = { + { .compatible ="microchip,sam9x60-pmc" }, + {/* Sentinel. */ }, +}; + +U_BOOT_DRIVER (at91_sam9x60_pmc) = { + .name ="at91-sam9x60-pmc" , + .id =UCLASS_CLK , + .of_match = sam9x60_clk_ids, + .ops = &at91_clk_ops, + .probe = sam9x60_clk_probe, + .flags =DM_FLAG_PRE_RELOC , +};
PATCH 3/7 ARM: dts: sam9x60ek: add clock frequencies to board file
In reply to Claudiu BezneaSlow Xtal and Main Xtal are board specific. Add their proper frequency to board file.
--- arch/arm/dts/sam9x60.dtsi | 2 -- arch/arm/dts/sam9x60ek.dts | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/dts/sam9x60.dtsi +0 -2
@@ -30,13 +30,11 @@ slow_xtal: slow_xtal { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <0>; }; main_xtal: main_xtal { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <0>; }; };
arch/arm/dts/sam9x60ek.dts +10 -0
@@ -18,6 +18,16 @@ i2c0 = &flx0; }; + clocks { + slow_xtal: slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal: main_xtal { + clock-frequency = <24000000>; + }; + }; + onewire_tm: onewire { gpios = <&pioD 14 0>; pinctrl-names = "default";
Signature · 1 line
2.7.4
PATCH 4/7 ARM: dts: sam9x60: use u-boot,dm-pre-reloc
In reply to Claudiu BezneaUse u-boot,dm-pre-reloc for slow xtal and main xtal.
--- arch/arm/dts/sam9x60.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/dts/sam9x60.dtsi +2 -0
@@ -30,11 +30,13 @@ slow_xtal: slow_xtal { compatible = "fixed-clock"; #clock-cells = <0>; + u-boot,dm-pre-reloc; }; main_xtal: main_xtal { compatible = "fixed-clock"; #clock-cells = <0>; + u-boot,dm-pre-reloc; }; };
Signature · 1 line
2.7.4
PATCH 4/7 ARM: dts: sam9x60: use u-boot,dm-pre-reloc
Quoted 4 lines · Claudiu Beznea
Use u-boot,dm-pre-reloc for slow xtal and main xtal.
Signed-off-by Claudiu Beznea <[email protected]>---
Hi Claudiu,
For this patch and the following DT patches:
the u-boot,dm-pre-reloc property must be added to the file sam9x60ek-u-boot.dtsi (or sam9x60-u-boot.dtsi if needed to be created )
Eugen
Quoted 22 lines
arch/arm/dts/sam9x60.dtsi | 2 ++ 1 file changed, 2 insertions(+)arch/arm/dts/sam9x60.dtsi +2
-0@@ -30,11 +30,13 @@ slow_xtal: slow_xtal { compatible = "fixed-clock"; #clock-cells = <0>; + u-boot,dm-pre-reloc; }; main_xtal: main_xtal { compatible = "fixed-clock"; #clock-cells = <0>; + u-boot,dm-pre-reloc; }; };
PATCH 4/7 ARM: dts: sam9x60: use u-boot,dm-pre-reloc
Hi Eugen,
Quoted 6 lines · On 06.10.2020 09:39, Eugen Hristev - M18282 wrote:
Quoted 4 lines · Claudiu Beznea
Use u-boot,dm-pre-reloc for slow xtal and main xtal.
Signed-off-by Claudiu Beznea <[email protected]>---
Quoted 6 lines
Hi Claudiu,
For this patch and the following DT patches:
the u-boot,dm-pre-reloc property must be added to the file
sam9x60ek-u-boot.dtsi(orsam9x60-u-boot.dtsiif needed to be created )
For clocks section in device tree (which contains these fixed clocks) there is no entry in sam9x60ek-u-boot.dtsi. Would you like me to add u-boot,dm-pre-reloc only per section or for each clock in the clocks section?
Thank you,
Claudiu Beznea
Quoted 26 lines
Eugen
Quoted 22 lines
arch/arm/dts/sam9x60.dtsi | 2 ++ 1 file changed, 2 insertions(+)arch/arm/dts/sam9x60.dtsi +2
-0@@ -30,11 +30,13 @@ slow_xtal: slow_xtal { compatible = "fixed-clock"; #clock-cells = <0>; + u-boot,dm-pre-reloc; }; main_xtal: main_xtal { compatible = "fixed-clock"; #clock-cells = <0>; + u-boot,dm-pre-reloc; }; };
PATCH 4/7 ARM: dts: sam9x60: use u-boot,dm-pre-reloc
Quoted 11 lines · On 06.10.2020 09:57, Claudiu Beznea - M18063 wrote:
Hi Eugen,
Quoted 8 lines · On 06.10.2020 09:39, Eugen Hristev - M18282 wrote:
Quoted 4 lines · Claudiu Beznea
Use u-boot,dm-pre-reloc for slow xtal and main xtal.
Signed-off-by Claudiu Beznea <[email protected]>---
Hi Claudiu,
Quoted 8 lines
Quoted 4 lines
For this patch and the following DT patches:
the u-boot,dm-pre-reloc property must be added to the file
sam9x60ek-u-boot.dtsi(orsam9x60-u-boot.dtsiif needed to be created )For clocks section in device tree (which contains these fixed clocks) there is no entry in
sam9x60ek-u-boot.dtsi. Would you like me to add u-boot,dm-pre-reloc only per section or for each clock in the clocks section?
If your patch adds u-boot,dm-pre-reloc in a section, then add this section to the sam9x60ek-u-boot.dtsi file (you can add just a pointer to the section like §ion { u-boot-dm,pre-reloc; }; )
If your patch adds the property to a clock, then you can just add a pointer to that clock in the sam9x60ek-u-boot.dtsi file
Quoted 29 lines
Thank you,
Claudiu BezneaQuoted 25 lines
Eugen
Quoted 22 lines
arch/arm/dts/sam9x60.dtsi | 2 ++ 1 file changed, 2 insertions(+)arch/arm/dts/sam9x60.dtsi +2
-0@@ -30,11 +30,13 @@ slow_xtal: slow_xtal { compatible = "fixed-clock"; #clock-cells = <0>; + u-boot,dm-pre-reloc; }; main_xtal: main_xtal { compatible = "fixed-clock"; #clock-cells = <0>; + u-boot,dm-pre-reloc; }; };
PATCH 5/7 ARM: dts: sam9x60: use slow clock CCF compatible bindings
In reply to Claudiu BezneaUse slow clock CCF compatible DT bindings. This will not break the above functionality as the SoC is not booting with current PMC bindings.
--- arch/arm/dts/sam9x60.dtsi | 42 +++++++++++++------------------------- arch/arm/dts/sam9x60ek-u-boot.dtsi | 17 +-------------- 2 files changed, 15 insertions(+), 44 deletions(-)
arch/arm/dts/sam9x60.dtsi +14 -28
@@ -27,6 +27,13 @@ }; clocks { + slow_rc_osc: slow_rc_osc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + u-boot,dm-pre-reloc; + }; + slow_xtal: slow_xtal { compatible = "fixed-clock"; #clock-cells = <0>;
@@ -198,7 +205,7 @@ mck: masterck { compatible = "atmel,at91sam9x5-clk-master"; #clock-cells = <0>; - clocks = <&md_slck>, <&main>, <&plla>; + clocks = <&clk32 0>, <&main>, <&plla>; atmel,clk-output-range = <140000000 200000000>; atmel,clk-divisors = <1 2 4 6>; };
@@ -266,7 +273,7 @@ compatible = "microchip,sam9x60-clk-generated"; #address-cells = <1>; #size-cells = <0>; - clocks = <&md_slck>, <&td_slck>, <&main>, <&mck>, <&plla>; + clocks = <&clk32 0>, <&clk32 1>, <&main>, <&mck>, <&plla>; sdhci0_gclk: sdhci0_gclk { #clock-cells = <0>;
@@ -281,33 +288,12 @@ clocks = <&mck>; }; - slowckc: sckc at fffffe50 { - compatible = "atmel,at91sam9x5-sckc"; + clk32: sckc at fffffe50 { + compatible = "microchip,sam9x60-sckc"; reg = <0xfffffe50 0x4>; - - slow_osc: slow_osc { - compatible = "atmel,at91sam9x5-clk-slow-osc"; - #clock-cells = <0>; - clocks = <&slow_xtal>; - }; - - slow_rc_osc: slow_rc_osc { - compatible = "atmel,at91sam9x5-clk-slow-rc-osc"; - #clock-cells = <0>; - clock-frequency = <32768>; - }; - - td_slck: td_slck { - compatible = "atmel,at91sam9x5-clk-slow"; - #clock-cells = <0>; - clocks = <&slow_rc_osc>, <&slow_osc>; - }; - - md_slck: md_slck { - compatible = "atmel,at91sam9x5-clk-slow"; - #clock-cells = <0>; - clocks = <&slow_rc_osc>; - }; + clocks = <&slow_rc_osc>, <&slow_xtal>; + #clock-cells = <1>; + u-boot,dm-pre-reloc; }; }; };
arch/arm/dts/sam9x60ek-u-boot.dtsi +1 -16
@@ -111,22 +111,7 @@ u-boot,dm-pre-reloc; }; -&slowckc { +&clk32 { u-boot,dm-pre-reloc; }; -&slow_osc { - u-boot,dm-pre-reloc; -}; - -&slow_rc_osc { - u-boot,dm-pre-reloc; -}; - -&td_slck { - u-boot,dm-pre-reloc; -}; - -&md_slck { - u-boot,dm-pre-reloc; -};
Signature · 1 line
2.7.4
PATCH 6/7 ARM: dts: sam9x60: use CCF compatibles for PMC
In reply to Claudiu BezneaUse CCF compatible for PMC. With this, the board/SoC will be able to boot.
--- arch/arm/dts/sam9x60.dtsi | 135 ++++++++----------------------------- arch/arm/dts/sam9x60ek-u-boot.dtsi | 52 -------------- arch/arm/dts/sam9x60ek.dts | 2 +- 3 files changed, 28 insertions(+), 161 deletions(-)
arch/arm/dts/sam9x60.dtsi +27 -108
@@ -12,7 +12,7 @@ #include <dt-bindings/pinctrl/at91.h> #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/gpio/gpio.h> -#include <dt-bindings/clock/at91.h> +#include <dt-bindings/clk/at91.h> /{ model = "Microchip SAM9X60 SoC";
@@ -34,6 +34,13 @@ u-boot,dm-pre-reloc; }; + main_rc: main_rc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <12000000>; + u-boot,dm-pre-reloc; + }; + slow_xtal: slow_xtal { compatible = "fixed-clock"; #clock-cells = <0>;
@@ -56,8 +63,11 @@ sdhci0: sdhci-host at 80000000 { compatible = "microchip,sam9x60-sdhci"; reg = <0x80000000 0x300>; - clocks = <&sdhci0_clk>, <&sdhci0_gclk>, <&main>; - clock-names = "hclock", "multclk", "baseclk"; + clocks = <&pmc PMC_TYPE_PERIPHERAL 12>, <&pmc PMC_TYPE_GCK 12>; + clock-names = "hclock", "multclk"; + assigned-clocks = <&pmc PMC_TYPE_GCK 12>; + assigned-clock-rates = <100000000>; + assigned-clock-parents = <&pmc PMC_TYPE_CORE 10>; /* ID_PLL_A_DIV */ bus-width = <4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_sdhci0>;
@@ -73,7 +83,7 @@ compatible = "microchip,sam9x60-qspi"; reg = <0xf0014000 0x100>, <0x70000000 0x10000000>; reg-names = "qspi_base", "qspi_mmap"; - clocks = <&qspi_clk>, <&qspick>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 35>, <&pmc PMC_TYPE_SYSTEM 18>; /* ID_QSPI */ clock-names = "pclk", "qspick"; #address-cells = <1>; #size-cells = <0>;
@@ -83,7 +93,7 @@ flx0: flexcom at f801c600 { compatible = "atmel,sama5d2-flexcom"; reg = <0xf801c000 0x200>; - clocks = <&flx0_clk>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 5>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0xf801c000 0x800>;
@@ -96,7 +106,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_macb0_rmii>; clock-names = "hclk", "pclk"; - clocks = <&macb0_clk>, <&macb0_clk>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_PERIPHERAL 24>; status = "disabled"; };
@@ -105,7 +115,7 @@ reg = <0xfffff200 0x200>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_dbgu>; - clocks = <&dbgu_clk>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 47>; clock-names = "usart"; };
@@ -162,7 +172,7 @@ reg = <0xfffff400 0x200>; #gpio-cells = <2>; gpio-controller; - clocks = <&pioA_clk>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 2>; }; pioB: gpio at fffff600 {
@@ -170,7 +180,7 @@ reg = <0xfffff600 0x200>; #gpio-cells = <2>; gpio-controller; - clocks = <&pioB_clk>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 3>; }; pioD: gpio at fffffa00 {
@@ -178,114 +188,23 @@ reg = <0xfffffa00 0x200>; #gpio-cells = <2>; gpio-controller; - clocks = <&pioD_clk>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 44>; }; pmc: pmc at fffffc00 { - compatible = "atmel,at91sam9x5-pmc"; + compatible = "microchip,sam9x60-pmc"; reg = <0xfffffc00 0x200>; - #address-cells = <1>; - #size-cells = <0>; - - main: mainck { - compatible = "atmel,at91sam9x5-clk-main"; - #clock-cells = <0>; - }; - - plla: pllack { - compatible = "microchip,sam9x60-clk-pll"; - #clock-cells = <0>; - clocks = <&main>; - reg = <0>; - atmel,clk-input-range = <8000000 24000000>; - #atmel,pll-clk-output-range-cells = <4>; - atmel,pll-clk-output-ranges = <140000000 1200000000 0 0>; - }; - - mck: masterck { - compatible = "atmel,at91sam9x5-clk-master"; - #clock-cells = <0>; - clocks = <&clk32 0>, <&main>, <&plla>; - atmel,clk-output-range = <140000000 200000000>; - atmel,clk-divisors = <1 2 4 6>; - }; - - system: systemck { - compatible = "atmel,at91rm9200-clk-system"; - #address-cells = <1>; - #size-cells = <0>; - - qspick: qspick { - #clock-cells = <0>; - reg = <19>; - clocks = <&mck>; - }; - }; - - periph: periphck { - compatible = "microchip,sam9x60-clk-peripheral"; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&mck>; - - pioA_clk: pioA_clk { - #clock-cells = <0>; - reg = <2>; - }; - - pioB_clk: pioB_clk { - #clock-cells = <0>; - reg = <3>; - }; - - flx0_clk: flx0_clk { - #clock-cells = <0>; - reg = <5>; - }; - - pioD_clk: pioD_clk { - #clock-cells = <0>; - reg = <44>; - }; - - sdhci0_clk: sdhci0_clk { - #clock-cells = <0>; - reg = <12>; - }; - - dbgu_clk: dbgu_clk { - #clock-cells = <0>; - reg = <47>; - }; - - macb0_clk: macb0_clk { - #clock-cells = <0>; - reg = <24>; - }; - - qspi_clk: qspi_clk { - #clock-cells = <0>; - reg = <35>; - }; - }; - - generic: gck { - compatible = "microchip,sam9x60-clk-generated"; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clk32 0>, <&clk32 1>, <&main>, <&mck>, <&plla>; - - sdhci0_gclk: sdhci0_gclk { - #clock-cells = <0>; - reg = <12>; - }; - }; + #clock-cells = <2>; + clocks = <&clk32 1>, <&clk32 0>, <&main_xtal>, <&main_rc>; + clock-names = "td_slck", "md_slck", "main_xtal", "main_rc"; + u-boot,dm-pre-reloc; + status = "okay"; }; pit: timer at fffffe40 { compatible = "atmel,at91sam9260-pit"; reg = <0xfffffe40 0x10>; - clocks = <&mck>; + clocks = <&pmc PMC_TYPE_CORE 11>; /* ID_MCK. */ }; clk32: sckc at fffffe50 {
arch/arm/dts/sam9x60ek-u-boot.dtsi +0 -52
58 lines not on this page · raw message
arch/arm/dts/sam9x60ek.dts +1 -1
@@ -67,7 +67,7 @@ pinctrl-0 = <&pinctrl_flx0>; #address-cells = <1>; #size-cells = <0>; - clocks = <&flx0_clk>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 5>; status = "okay"; eeprom at 53 {
Signature · 1 line
2.7.4
PATCH 7/7 configs: sam9x60ek: update defconfigs for CCF
In reply to Claudiu BezneaUpdate defconfigs for using common clock framework compatible clocks.
--- configs/sam9x60ek_mmc_defconfig | 4 +++- configs/sam9x60ek_nandflash_defconfig | 4 +++- configs/sam9x60ek_qspiflash_defconfig | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)
configs/sam9x60ek_mmc_defconfig +3 -1
@@ -2,7 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_AT91=y CONFIG_SYS_TEXT_BASE=0x23f00000 CONFIG_TARGET_SAM9X60EK=y -CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x4000 CONFIG_DM_GPIO=y
@@ -36,8 +36,10 @@ CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM=y CONFIG_CLK=y +CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y CONFIG_AT91_GENERIC_CLK=y +CONFIG_AT91_SAM9X60_PLL=y CONFIG_AT91_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_AT91=y
configs/sam9x60ek_nandflash_defconfig +3 -1
@@ -2,7 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_AT91=y CONFIG_SYS_TEXT_BASE=0x23f00000 CONFIG_TARGET_SAM9X60EK=y -CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_NR_DRAM_BANKS=8 CONFIG_DM_GPIO=y CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -40,8 +40,10 @@ CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM=y CONFIG_CLK=y +CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y CONFIG_AT91_GENERIC_CLK=y +CONFIG_AT91_SAM9X60_PLL=y CONFIG_AT91_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_AT91=y
configs/sam9x60ek_qspiflash_defconfig +3 -1
@@ -2,7 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_AT91=y CONFIG_SYS_TEXT_BASE=0x23f00000 CONFIG_TARGET_SAM9X60EK=y -CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_DM_GPIO=y
@@ -48,8 +48,10 @@ CONFIG_ENV_SPI_MODE=0x0 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM=y CONFIG_CLK=y +CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y CONFIG_AT91_GENERIC_CLK=y +CONFIG_AT91_SAM9X60_PLL=y CONFIG_AT91_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_AT91=y
Signature · 1 line
2.7.4