18c2ecf20Sopenharmony_ci* NXP LPC1850 Clock Generation Unit (CGU)
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciThe CGU generates multiple independent clocks for the core and the
48c2ecf20Sopenharmony_ciperipheral blocks of the LPC18xx. Each independent clock is called
58c2ecf20Sopenharmony_cia base clock and itself is one of the inputs to the two Clock
68c2ecf20Sopenharmony_ciControl Units (CCUs) which control the branch clocks to the
78c2ecf20Sopenharmony_ciindividual peripherals.
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciThe CGU selects the inputs to the clock generators from multiple
108c2ecf20Sopenharmony_ciclock sources, controls the clock generation, and routes the outputs
118c2ecf20Sopenharmony_ciof the clock generators through the clock source bus to the output
128c2ecf20Sopenharmony_cistages. Each output stage provides an independent clock source and
138c2ecf20Sopenharmony_cicorresponds to one of the base clocks for the LPC18xx.
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci - Above text taken from NXP LPC1850 User Manual.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciThis binding uses the common clock binding:
198c2ecf20Sopenharmony_ci    Documentation/devicetree/bindings/clock/clock-bindings.txt
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciRequired properties:
228c2ecf20Sopenharmony_ci- compatible:
238c2ecf20Sopenharmony_ci	Should be "nxp,lpc1850-cgu"
248c2ecf20Sopenharmony_ci- reg:
258c2ecf20Sopenharmony_ci	Shall define the base and range of the address space
268c2ecf20Sopenharmony_ci	containing clock control registers
278c2ecf20Sopenharmony_ci- #clock-cells:
288c2ecf20Sopenharmony_ci	Shall have value <1>.  The permitted clock-specifier values
298c2ecf20Sopenharmony_ci	are the base clock numbers defined below.
308c2ecf20Sopenharmony_ci- clocks:
318c2ecf20Sopenharmony_ci	Shall contain a list of phandles for the external input
328c2ecf20Sopenharmony_ci	sources to the CGU. The list shall be in the following
338c2ecf20Sopenharmony_ci	order: xtal, 32khz, enet_rx_clk, enet_tx_clk, gp_clkin.
348c2ecf20Sopenharmony_ci- clock-indices:
358c2ecf20Sopenharmony_ci	Shall be an ordered list of numbers defining the base clock
368c2ecf20Sopenharmony_ci	number provided by the CGU.
378c2ecf20Sopenharmony_ci- clock-output-names:
388c2ecf20Sopenharmony_ci	Shall be an ordered list of strings defining the names of
398c2ecf20Sopenharmony_ci	the clocks provided by the CGU.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciWhich base clocks that are available on the CGU depends on the
428c2ecf20Sopenharmony_cispecific LPC part. Base clocks are numbered from 0 to 27.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciNumber:		Name:			Description:
458c2ecf20Sopenharmony_ci 0		BASE_SAFE_CLK		Base safe clock (always on) for WWDT
468c2ecf20Sopenharmony_ci 1		BASE_USB0_CLK		Base clock for USB0
478c2ecf20Sopenharmony_ci 2		BASE_PERIPH_CLK		Base clock for Cortex-M0SUB subsystem,
488c2ecf20Sopenharmony_ci					SPI, and SGPIO
498c2ecf20Sopenharmony_ci 3		BASE_USB1_CLK		Base clock for USB1
508c2ecf20Sopenharmony_ci 4		BASE_CPU_CLK		System base clock for ARM Cortex-M core
518c2ecf20Sopenharmony_ci					and APB peripheral blocks #0 and #2
528c2ecf20Sopenharmony_ci 5		BASE_SPIFI_CLK		Base clock for SPIFI
538c2ecf20Sopenharmony_ci 6		BASE_SPI_CLK		Base clock for SPI
548c2ecf20Sopenharmony_ci 7		BASE_PHY_RX_CLK		Base clock for Ethernet PHY Receive clock
558c2ecf20Sopenharmony_ci 8		BASE_PHY_TX_CLK		Base clock for Ethernet PHY Transmit clock
568c2ecf20Sopenharmony_ci 9		BASE_APB1_CLK		Base clock for APB peripheral block # 1
578c2ecf20Sopenharmony_ci10		BASE_APB3_CLK		Base clock for APB peripheral block # 3
588c2ecf20Sopenharmony_ci11		BASE_LCD_CLK		Base clock for LCD
598c2ecf20Sopenharmony_ci12		BASE_ADCHS_CLK		Base clock for ADCHS
608c2ecf20Sopenharmony_ci13		BASE_SDIO_CLK		Base clock for SD/MMC
618c2ecf20Sopenharmony_ci14		BASE_SSP0_CLK		Base clock for SSP0
628c2ecf20Sopenharmony_ci15		BASE_SSP1_CLK		Base clock for SSP1
638c2ecf20Sopenharmony_ci16		BASE_UART0_CLK		Base clock for UART0
648c2ecf20Sopenharmony_ci17		BASE_UART1_CLK		Base clock for UART1
658c2ecf20Sopenharmony_ci18		BASE_UART2_CLK		Base clock for UART2
668c2ecf20Sopenharmony_ci19		BASE_UART3_CLK		Base clock for UART3
678c2ecf20Sopenharmony_ci20		BASE_OUT_CLK		Base clock for CLKOUT pin
688c2ecf20Sopenharmony_ci24-21		-			Reserved
698c2ecf20Sopenharmony_ci25		BASE_AUDIO_CLK		Base clock for audio system (I2S)
708c2ecf20Sopenharmony_ci26 		BASE_CGU_OUT0_CLK	Base clock for CGU_OUT0 clock output
718c2ecf20Sopenharmony_ci27 		BASE_CGU_OUT1_CLK	Base clock for CGU_OUT1 clock output
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciBASE_PERIPH_CLK and BASE_SPI_CLK is only available on LPC43xx.
748c2ecf20Sopenharmony_ciBASE_ADCHS_CLK is only available on LPC4370.
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ciExample board file:
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/ {
808c2ecf20Sopenharmony_ci	clocks {
818c2ecf20Sopenharmony_ci		xtal: xtal {
828c2ecf20Sopenharmony_ci			compatible = "fixed-clock";
838c2ecf20Sopenharmony_ci			#clock-cells = <0>;
848c2ecf20Sopenharmony_ci			clock-frequency = <12000000>;
858c2ecf20Sopenharmony_ci		};
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci		xtal32: xtal32 {
888c2ecf20Sopenharmony_ci			compatible = "fixed-clock";
898c2ecf20Sopenharmony_ci			#clock-cells = <0>;
908c2ecf20Sopenharmony_ci			clock-frequency = <32768>;
918c2ecf20Sopenharmony_ci		};
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci		enet_rx_clk: enet_rx_clk {
948c2ecf20Sopenharmony_ci			compatible = "fixed-clock";
958c2ecf20Sopenharmony_ci			#clock-cells = <0>;
968c2ecf20Sopenharmony_ci			clock-frequency = <0>;
978c2ecf20Sopenharmony_ci			clock-output-names = "enet_rx_clk";
988c2ecf20Sopenharmony_ci		};
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci		enet_tx_clk: enet_tx_clk {
1018c2ecf20Sopenharmony_ci			compatible = "fixed-clock";
1028c2ecf20Sopenharmony_ci			#clock-cells = <0>;
1038c2ecf20Sopenharmony_ci			clock-frequency = <0>;
1048c2ecf20Sopenharmony_ci			clock-output-names = "enet_tx_clk";
1058c2ecf20Sopenharmony_ci		};
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci		gp_clkin: gp_clkin {
1088c2ecf20Sopenharmony_ci			compatible = "fixed-clock";
1098c2ecf20Sopenharmony_ci			#clock-cells = <0>;
1108c2ecf20Sopenharmony_ci			clock-frequency = <0>;
1118c2ecf20Sopenharmony_ci			clock-output-names = "gp_clkin";
1128c2ecf20Sopenharmony_ci		};
1138c2ecf20Sopenharmony_ci	};
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci	soc {
1168c2ecf20Sopenharmony_ci		cgu: clock-controller@40050000 {
1178c2ecf20Sopenharmony_ci			compatible = "nxp,lpc1850-cgu";
1188c2ecf20Sopenharmony_ci			reg = <0x40050000 0x1000>;
1198c2ecf20Sopenharmony_ci			#clock-cells = <1>;
1208c2ecf20Sopenharmony_ci			clocks = <&xtal>, <&creg_clk 1>, <&enet_rx_clk>, <&enet_tx_clk>, <&gp_clkin>;
1218c2ecf20Sopenharmony_ci		};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci		/* A CGU and CCU clock consumer */
1248c2ecf20Sopenharmony_ci		lcdc: lcdc@40008000 {
1258c2ecf20Sopenharmony_ci			...
1268c2ecf20Sopenharmony_ci			clocks = <&cgu BASE_LCD_CLK>, <&ccu1 CLK_CPU_LCD>;
1278c2ecf20Sopenharmony_ci			clock-names = "clcdclk", "apb_pclk";
1288c2ecf20Sopenharmony_ci			...
1298c2ecf20Sopenharmony_ci		};
1308c2ecf20Sopenharmony_ci	};
1318c2ecf20Sopenharmony_ci};
132