Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce6e1188 authored by Purna Chandra Mandal's avatar Purna Chandra Mandal Committed by Ralf Baechle
Browse files

CLK: microchip: Add Microchip PIC32 clock driver.



This clock driver implements PIC32 specific clock-tree. clock-tree
entities can only be configured through device-tree file (OF).

Signed-off-by: default avatarPurna Chandra Mandal <purna.mandal@microchip.com>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-clk@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/13247/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent d863dc9e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -197,6 +197,9 @@ config COMMON_CLK_PXA
	---help---
	  Support for the Marvell PXA SoC.

config COMMON_CLK_PIC32
	def_bool COMMON_CLK && MACH_PIC32

source "drivers/clk/bcm/Kconfig"
source "drivers/clk/hisilicon/Kconfig"
source "drivers/clk/mvebu/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ obj-$(CONFIG_ARCH_MXC) += imx/
obj-$(CONFIG_MACH_INGENIC)		+= ingenic/
obj-$(CONFIG_COMMON_CLK_KEYSTONE)	+= keystone/
obj-$(CONFIG_ARCH_MEDIATEK)		+= mediatek/
obj-$(CONFIG_MACH_PIC32)		+= microchip/
ifeq ($(CONFIG_COMMON_CLK), y)
obj-$(CONFIG_ARCH_MMP)			+= mmp/
endif
+2 −0
Original line number Diff line number Diff line
obj-$(CONFIG_COMMON_CLK_PIC32) += clk-core.o
obj-$(CONFIG_PIC32MZDA) += clk-pic32mzda.o
+1031 −0

File added.

Preview size limit exceeded, changes collapsed.

+84 −0
Original line number Diff line number Diff line
/*
 * Purna Chandra Mandal,<purna.mandal@microchip.com>
 * Copyright (C) 2015 Microchip Technology Inc.  All rights reserved.
 *
 * This program is free software; you can distribute it and/or modify it
 * under the terms of the GNU General Public License (Version 2) as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */
#ifndef __MICROCHIP_CLK_PIC32_H_
#define __MICROCHIP_CLK_PIC32_H_

#include <linux/clk-provider.h>

/* PIC32 clock data */
struct pic32_clk_common {
	struct device *dev;
	void __iomem *iobase;
	spinlock_t reg_lock; /* clock lock */
};

/* System PLL clock */
struct pic32_sys_pll_data {
	struct clk_init_data init_data;
	const u32 ctrl_reg;
	const u32 status_reg;
	const u32 lock_mask;
};

/* System clock */
struct pic32_sys_clk_data {
	struct clk_init_data init_data;
	const u32 mux_reg;
	const u32 slew_reg;
	const u32 *parent_map;
	const u32 slew_div;
};

/* Reference Oscillator clock */
struct pic32_ref_osc_data {
	struct clk_init_data init_data;
	const u32 ctrl_reg;
	const u32 *parent_map;
};

/* Peripheral Bus clock */
struct pic32_periph_clk_data {
	struct clk_init_data init_data;
	const u32 ctrl_reg;
};

/* External Secondary Oscillator clock  */
struct pic32_sec_osc_data {
	struct clk_init_data init_data;
	const u32 enable_reg;
	const u32 status_reg;
	const u32 enable_mask;
	const u32 status_mask;
	const unsigned long fixed_rate;
};

extern const struct clk_ops pic32_pbclk_ops;
extern const struct clk_ops pic32_sclk_ops;
extern const struct clk_ops pic32_sclk_no_div_ops;
extern const struct clk_ops pic32_spll_ops;
extern const struct clk_ops pic32_roclk_ops;
extern const struct clk_ops pic32_sosc_ops;

struct clk *pic32_periph_clk_register(const struct pic32_periph_clk_data *data,
				      struct pic32_clk_common *core);
struct clk *pic32_refo_clk_register(const struct pic32_ref_osc_data *data,
				    struct pic32_clk_common *core);
struct clk *pic32_sys_clk_register(const struct pic32_sys_clk_data *data,
				   struct pic32_clk_common *core);
struct clk *pic32_spll_clk_register(const struct pic32_sys_pll_data *data,
				    struct pic32_clk_common *core);
struct clk *pic32_sosc_clk_register(const struct pic32_sec_osc_data *data,
				    struct pic32_clk_common *core);

#endif /* __MICROCHIP_CLK_PIC32_H_*/
Loading