forked from Minki/linux
Second SoC batch for 3.18:
- introduction of the new SAMA5D4 SoC and associated Evaluation Kit - low level soc detection and early printk code - taking advantage of this, documentation of all AT91 SoC DT strings -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAABAgAGBQJUIB6OAAoJEAf03oE53VmQL+IIALNg2XPS49u2Y6VMjL3srFLt 7CUdNoGB7GJKoGrIXPSyAhJLkRlWREgRsEk/RSYqfBpyBZV4PIx9R6dIz1L+VxGU 9neXLkZGrYNzN8qJPz82+ARuCXdCF13N8ClVfXkNDhwbDnlbZgTkh4hNV118mKLt +PF0d3w354ujieUD7D0pOcdRlny487qMNjtc/0U4P+H2sp2EtL0PpFHicn79InPT V36PpFtUMEgbw2wQPNtlFkjQWstyZ7WJJGUbIX/2P3PASCwKsgrbmkvDvmfp5tUT FdclJwJnxgcpni2fDvbz8Vq04i3hixl2Olm8tAvIXOI/hdVcurvZSfweJ5BrfDk= =fMfO -----END PGP SIGNATURE----- Merge tag 'at91-soc2' of git://github.com/at91linux/linux-at91 into next/soc Pull "Second SoC batch for 3.18" from Nicolas Ferre: - introduction of the new SAMA5D4 SoC and associated Evaluation Kit - low level soc detection and early printk code - taking advantage of this, documentation of all AT91 SoC DT strings Signed-off-by: Arnd Bergmann <arnd@arndb.de> * tag 'at91-soc2' of git://github.com/at91linux/linux-at91: ARM: at91: document Atmel SMART compatibles ARM: at91: add sama5d4 support to sama5_defconfig ARM: at91: dt: add device tree file for SAMA5D4ek board ARM: at91: dt: add device tree file for SAMA5D4 SoC ARM: at91: SAMA5D4 SoC detection code and low level routines ARM: at91: introduce basic SAMA5D4 support clk: at91: add a driver for the h32mx clock
This commit is contained in:
commit
6d50424a39
@ -1,6 +1,43 @@
|
||||
Atmel AT91 device tree bindings.
|
||||
================================
|
||||
|
||||
Boards with a SoC of the Atmel AT91 or SMART family shall have the following
|
||||
properties:
|
||||
|
||||
Required root node properties:
|
||||
compatible: must be one of:
|
||||
* "atmel,at91rm9200"
|
||||
|
||||
* "atmel,at91sam9" for SoCs using an ARM926EJ-S core, shall be extended with
|
||||
the specific SoC family or compatible:
|
||||
o "atmel,at91sam9260"
|
||||
o "atmel,at91sam9261"
|
||||
o "atmel,at91sam9263"
|
||||
o "atmel,at91sam9x5" for the 5 series, shall be extended with the specific
|
||||
SoC compatible:
|
||||
- "atmel,at91sam9g15"
|
||||
- "atmel,at91sam9g25"
|
||||
- "atmel,at91sam9g35"
|
||||
- "atmel,at91sam9x25"
|
||||
- "atmel,at91sam9x35"
|
||||
o "atmel,at91sam9g20"
|
||||
o "atmel,at91sam9g45"
|
||||
o "atmel,at91sam9n12"
|
||||
o "atmel,at91sam9rl"
|
||||
* "atmel,sama5" for SoCs using a Cortex-A5, shall be extended with the specific
|
||||
SoC family:
|
||||
o "atmel,sama5d3" shall be extended with the specific SoC compatible:
|
||||
- "atmel,sama5d31"
|
||||
- "atmel,sama5d33"
|
||||
- "atmel,sama5d34"
|
||||
- "atmel,sama5d35"
|
||||
- "atmel,sama5d36"
|
||||
o "atmel,sama5d4" shall be extended with the specific SoC compatible:
|
||||
- "atmel,sama5d41"
|
||||
- "atmel,sama5d42"
|
||||
- "atmel,sama5d43"
|
||||
- "atmel,sama5d44"
|
||||
|
||||
PIT Timer required properties:
|
||||
- compatible: Should be "atmel,at91sam9260-pit"
|
||||
- reg: Should contain registers location and length
|
||||
|
@ -74,6 +74,9 @@ Required properties:
|
||||
"atmel,at91sam9x5-clk-utmi":
|
||||
at91 utmi clock
|
||||
|
||||
"atmel,sama5d4-clk-h32mx":
|
||||
at91 h32mx clock
|
||||
|
||||
Required properties for SCKC node:
|
||||
- reg : defines the IO memory reserved for the SCKC.
|
||||
- #size-cells : shall be 0 (reg is used to encode clk id).
|
||||
@ -447,3 +450,14 @@ For example:
|
||||
#clock-cells = <0>;
|
||||
clocks = <&main>;
|
||||
};
|
||||
|
||||
Required properties for 32 bits bus Matrix clock (h32mx clock):
|
||||
- #clock-cells : from common clock binding; shall be set to 0.
|
||||
- clocks : shall be the master clock source phandle.
|
||||
|
||||
For example:
|
||||
h32ck: h32mxck {
|
||||
#clock-cells = <0>;
|
||||
compatible = "atmel,sama5d4-clk-h32mx";
|
||||
clocks = <&mck>;
|
||||
};
|
||||
|
@ -101,6 +101,10 @@ choice
|
||||
bool "Kernel low-level debugging on 9263 and 9g45"
|
||||
depends on HAVE_AT91_DBGU1
|
||||
|
||||
config AT91_DEBUG_LL_DBGU2
|
||||
bool "Kernel low-level debugging on sama5d4"
|
||||
depends on HAVE_AT91_DBGU2
|
||||
|
||||
config DEBUG_BCM2835
|
||||
bool "Kernel low-level debugging on BCM2835 PL011 UART"
|
||||
depends on ARCH_BCM2835
|
||||
|
@ -48,6 +48,8 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb
|
||||
dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb
|
||||
dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
|
||||
dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb
|
||||
# sama5d4
|
||||
dtb-$(CONFIG_ARCH_AT91) += at91-sama5d4ek.dtb
|
||||
|
||||
dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
|
||||
dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
|
||||
|
260
arch/arm/boot/dts/at91-sama5d4ek.dts
Normal file
260
arch/arm/boot/dts/at91-sama5d4ek.dts
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
* at91-sama5d4ek.dts - Device Tree file for SAMA5D4 Evaluation Kit
|
||||
*
|
||||
* Copyright (C) 2014 Atmel,
|
||||
* 2014 Nicolas Ferre <nicolas.ferre@atmel.com>
|
||||
*
|
||||
* This file is dual-licensed: you can use it either under the terms
|
||||
* of the GPL or the X11 license, at your option. Note that this dual
|
||||
* licensing only applies to this file, and not this project as a
|
||||
* whole.
|
||||
*
|
||||
* a) This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that 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.
|
||||
*
|
||||
* Or, alternatively,
|
||||
*
|
||||
* b) Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/dts-v1/;
|
||||
#include "sama5d4.dtsi"
|
||||
|
||||
/ {
|
||||
model = "Atmel SAMA5D4-EK";
|
||||
compatible = "atmel,sama5d4ek", "atmel,sama5d4", "atmel,sama5";
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200 ignore_loglevel earlyprintk";
|
||||
};
|
||||
|
||||
memory {
|
||||
reg = <0x20000000 0x20000000>;
|
||||
};
|
||||
|
||||
clocks {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ranges;
|
||||
|
||||
main_clock: clock@0 {
|
||||
compatible = "atmel,osc", "fixed-clock";
|
||||
clock-frequency = <12000000>;
|
||||
};
|
||||
|
||||
slow_xtal {
|
||||
clock-frequency = <32768>;
|
||||
};
|
||||
|
||||
main_xtal {
|
||||
clock-frequency = <12000000>;
|
||||
};
|
||||
};
|
||||
|
||||
ahb {
|
||||
apb {
|
||||
lcd_bus@f0000000 {
|
||||
status = "okay";
|
||||
|
||||
lcd@f0000000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
lcdovl1@f0000140 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
lcdovl2@f0000240 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
lcdheo1@f0000340 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
adc0: adc@fc034000 {
|
||||
/* The vref depends on JP22 of EK. If connect 1-2 then use 3.3V. connect 2-3 use 3.0V */
|
||||
atmel,adc-vref = <3300>;
|
||||
/*atmel,adc-ts-wires = <4>;*/ /* Set up ADC touch screen */
|
||||
status = "okay"; /* Enable ADC IIO support */
|
||||
};
|
||||
|
||||
mmc0: mmc@f8000000 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_cd>;
|
||||
slot@1 {
|
||||
reg = <1>;
|
||||
bus-width = <4>;
|
||||
cd-gpios = <&pioE 5 0>;
|
||||
};
|
||||
};
|
||||
|
||||
spi0: spi@f8010000 {
|
||||
cs-gpios = <&pioC 3 0>, <0>, <0>, <0>;
|
||||
status = "okay";
|
||||
m25p80@0 {
|
||||
compatible = "atmel,at25df321a";
|
||||
spi-max-frequency = <50000000>;
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c0: i2c@f8014000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
macb0: ethernet@f8020000 {
|
||||
phy-mode = "rmii";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
mmc1: mmc@fc000000 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3 &pinctrl_mmc1_cd>;
|
||||
status = "okay";
|
||||
slot@0 {
|
||||
reg = <0>;
|
||||
bus-width = <4>;
|
||||
cd-gpios = <&pioE 6 0>;
|
||||
};
|
||||
};
|
||||
|
||||
usart2: serial@fc008000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
usart3: serial@fc00c000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
usart4: serial@fc010000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
watchdog@fc068640 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
pinctrl@fc06a000 {
|
||||
board {
|
||||
pinctrl_mmc0_cd: mmc0_cd {
|
||||
atmel,pins =
|
||||
<AT91_PIOE 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
|
||||
};
|
||||
pinctrl_mmc1_cd: mmc1_cd {
|
||||
atmel,pins =
|
||||
<AT91_PIOE 6 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
|
||||
};
|
||||
pinctrl_usba_vbus: usba_vbus {
|
||||
atmel,pins =
|
||||
<AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
|
||||
};
|
||||
pinctrl_key_gpio: key_gpio_0 {
|
||||
atmel,pins =
|
||||
<AT91_PIOE 13 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PE13 gpio */
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
usb0: gadget@00400000 {
|
||||
atmel,vbus-gpio = <&pioE 31 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_usba_vbus>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
usb1: ohci@00500000 {
|
||||
num-ports = <3>;
|
||||
atmel,vbus-gpio = <0 /* &pioE 10 GPIO_ACTIVE_LOW */
|
||||
&pioE 11 GPIO_ACTIVE_LOW
|
||||
&pioE 12 GPIO_ACTIVE_LOW
|
||||
>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
usb2: ehci@00600000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
nand0: nand@80000000 {
|
||||
nand-bus-width = <8>;
|
||||
nand-ecc-mode = "hw";
|
||||
nand-on-flash-bbt;
|
||||
atmel,has-pmecc;
|
||||
status = "okay";
|
||||
|
||||
at91bootstrap@0 {
|
||||
label = "at91bootstrap";
|
||||
reg = <0x0 0x40000>;
|
||||
};
|
||||
|
||||
bootloader@40000 {
|
||||
label = "bootloader";
|
||||
reg = <0x40000 0x80000>;
|
||||
};
|
||||
|
||||
bootloaderenv@c0000 {
|
||||
label = "bootloader env";
|
||||
reg = <0xc0000 0xc0000>;
|
||||
};
|
||||
|
||||
dtb@180000 {
|
||||
label = "device tree";
|
||||
reg = <0x180000 0x80000>;
|
||||
};
|
||||
|
||||
kernel@200000 {
|
||||
label = "kernel";
|
||||
reg = <0x200000 0x600000>;
|
||||
};
|
||||
|
||||
rootfs@800000 {
|
||||
label = "rootfs";
|
||||
reg = <0x800000 0x0f800000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keys {
|
||||
compatible = "gpio-keys";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_key_gpio>;
|
||||
|
||||
pb_user1 {
|
||||
label = "pb_user1";
|
||||
gpios = <&pioE 13 GPIO_ACTIVE_HIGH>;
|
||||
linux,code = <0x100>;
|
||||
gpio-key,wakeup;
|
||||
};
|
||||
};
|
||||
};
|
1240
arch/arm/boot/dts/sama5d4.dtsi
Normal file
1240
arch/arm/boot/dts/sama5d4.dtsi
Normal file
File diff suppressed because it is too large
Load Diff
@ -19,6 +19,7 @@ CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
CONFIG_ARCH_AT91=y
|
||||
CONFIG_SOC_SAM_V7=y
|
||||
CONFIG_SOC_SAMA5D3=y
|
||||
CONFIG_SOC_SAMA5D4=y
|
||||
CONFIG_MACH_SAMA5_DT=y
|
||||
CONFIG_AEABI=y
|
||||
# CONFIG_OABI_COMPAT is not set
|
||||
|
@ -12,6 +12,9 @@ config HAVE_AT91_DBGU0
|
||||
config HAVE_AT91_DBGU1
|
||||
bool
|
||||
|
||||
config HAVE_AT91_DBGU2
|
||||
bool
|
||||
|
||||
config AT91_USE_OLD_CLK
|
||||
bool
|
||||
|
||||
@ -42,6 +45,9 @@ config AT91_SAM9_TIME
|
||||
config HAVE_AT91_SMD
|
||||
bool
|
||||
|
||||
config HAVE_AT91_H32MX
|
||||
bool
|
||||
|
||||
config SOC_AT91SAM9
|
||||
bool
|
||||
select AT91_SAM9_TIME
|
||||
@ -103,6 +109,21 @@ config SOC_SAMA5D3
|
||||
help
|
||||
Select this if you are using one of Atmel's SAMA5D3 family SoC.
|
||||
This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36.
|
||||
|
||||
config SOC_SAMA5D4
|
||||
bool "SAMA5D4 family"
|
||||
select SOC_SAMA5
|
||||
select HAVE_AT91_DBGU2
|
||||
select CLKSRC_MMIO
|
||||
select CACHE_L2X0
|
||||
select CACHE_PL310
|
||||
select HAVE_FB_ATMEL
|
||||
select HAVE_AT91_UTMI
|
||||
select HAVE_AT91_SMD
|
||||
select HAVE_AT91_USB_CLK
|
||||
select HAVE_AT91_H32MX
|
||||
help
|
||||
Select this if you are using one of Atmel's SAMA5D4 family SoC.
|
||||
endif
|
||||
|
||||
if SOC_SAM_V4_V5
|
||||
|
@ -23,6 +23,7 @@ obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o
|
||||
obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o
|
||||
obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o
|
||||
obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
|
||||
obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
|
||||
|
||||
obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o
|
||||
obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o
|
||||
|
@ -73,7 +73,7 @@ static void __init sama5_dt_device_init(void)
|
||||
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
|
||||
}
|
||||
|
||||
static const char *sama5_dt_board_compat[] __initdata = {
|
||||
static const char *sama5_dt_board_compat[] __initconst = {
|
||||
"atmel,sama5",
|
||||
NULL
|
||||
};
|
||||
@ -88,3 +88,17 @@ DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
|
||||
.init_machine = sama5_dt_device_init,
|
||||
.dt_compat = sama5_dt_board_compat,
|
||||
MACHINE_END
|
||||
|
||||
static const char *sama5_alt_dt_board_compat[] __initconst = {
|
||||
"atmel,sama5d4",
|
||||
NULL
|
||||
};
|
||||
|
||||
DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)")
|
||||
/* Maintainer: Atmel */
|
||||
.map_io = at91_alt_map_io,
|
||||
.init_early = at91_dt_initialize,
|
||||
.init_machine = sama5_dt_device_init,
|
||||
.dt_compat = sama5_alt_dt_board_compat,
|
||||
.l2c_aux_mask = ~0UL,
|
||||
MACHINE_END
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
/* Map io */
|
||||
extern void __init at91_map_io(void);
|
||||
extern void __init at91_alt_map_io(void);
|
||||
extern void __init at91_init_sram(int bank, unsigned long base,
|
||||
unsigned int length);
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#define ARCH_ID_AT91M40807 0x14080745
|
||||
#define ARCH_ID_AT91R40008 0x44000840
|
||||
|
||||
#define ARCH_ID_SAMA5D3 0x8A5C07C0
|
||||
#define ARCH_ID_SAMA5 0x8A5C07C0
|
||||
|
||||
#define ARCH_EXID_AT91SAM9M11 0x00000001
|
||||
#define ARCH_EXID_AT91SAM9M10 0x00000002
|
||||
@ -49,12 +49,19 @@
|
||||
#define ARCH_EXID_AT91SAM9G25 0x00000003
|
||||
#define ARCH_EXID_AT91SAM9X25 0x00000004
|
||||
|
||||
#define ARCH_EXID_SAMA5D3 0x00004300
|
||||
#define ARCH_EXID_SAMA5D31 0x00444300
|
||||
#define ARCH_EXID_SAMA5D33 0x00414300
|
||||
#define ARCH_EXID_SAMA5D34 0x00414301
|
||||
#define ARCH_EXID_SAMA5D35 0x00584300
|
||||
#define ARCH_EXID_SAMA5D36 0x00004301
|
||||
|
||||
#define ARCH_EXID_SAMA5D4 0x00000007
|
||||
#define ARCH_EXID_SAMA5D41 0x00000001
|
||||
#define ARCH_EXID_SAMA5D42 0x00000002
|
||||
#define ARCH_EXID_SAMA5D43 0x00000003
|
||||
#define ARCH_EXID_SAMA5D44 0x00000004
|
||||
|
||||
#define ARCH_FAMILY_AT91X92 0x09200000
|
||||
#define ARCH_FAMILY_AT91SAM9 0x01900000
|
||||
#define ARCH_FAMILY_AT91SAM9XE 0x02900000
|
||||
@ -86,6 +93,9 @@ enum at91_soc_type {
|
||||
/* SAMA5D3 */
|
||||
AT91_SOC_SAMA5D3,
|
||||
|
||||
/* SAMA5D4 */
|
||||
AT91_SOC_SAMA5D4,
|
||||
|
||||
/* Unknown type */
|
||||
AT91_SOC_UNKNOWN,
|
||||
};
|
||||
@ -108,6 +118,10 @@ enum at91_soc_subtype {
|
||||
AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34,
|
||||
AT91_SOC_SAMA5D35, AT91_SOC_SAMA5D36,
|
||||
|
||||
/* SAMA5D4 */
|
||||
AT91_SOC_SAMA5D41, AT91_SOC_SAMA5D42, AT91_SOC_SAMA5D43,
|
||||
AT91_SOC_SAMA5D44,
|
||||
|
||||
/* No subtype for this SoC */
|
||||
AT91_SOC_SUBTYPE_NONE,
|
||||
|
||||
@ -211,6 +225,12 @@ static inline int at91_soc_is_detected(void)
|
||||
#define cpu_is_sama5d3() (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SOC_SAMA5D4
|
||||
#define cpu_is_sama5d4() (at91_soc_initdata.type == AT91_SOC_SAMA5D4)
|
||||
#else
|
||||
#define cpu_is_sama5d4() (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Since this is ARM, we will never run on any AVR32 CPU. But these
|
||||
* definitions may reduce clutter in common drivers.
|
||||
|
@ -16,8 +16,11 @@
|
||||
|
||||
#if defined(CONFIG_AT91_DEBUG_LL_DBGU0)
|
||||
#define AT91_DBGU AT91_BASE_DBGU0
|
||||
#else
|
||||
#elif defined(CONFIG_AT91_DEBUG_LL_DBGU1)
|
||||
#define AT91_DBGU AT91_BASE_DBGU1
|
||||
#else
|
||||
/* On sama5d4, use USART3 as low level serial console */
|
||||
#define AT91_DBGU SAMA5D4_BASE_USART3
|
||||
#endif
|
||||
|
||||
.macro addruart, rp, rv, tmp
|
||||
|
@ -19,8 +19,10 @@
|
||||
/* DBGU base */
|
||||
/* rm9200, 9260/9g20, 9261/9g10, 9rl */
|
||||
#define AT91_BASE_DBGU0 0xfffff200
|
||||
/* 9263, 9g45 */
|
||||
/* 9263, 9g45, sama5d3 */
|
||||
#define AT91_BASE_DBGU1 0xffffee00
|
||||
/* sama5d4 */
|
||||
#define AT91_BASE_DBGU2 0xfc069000
|
||||
|
||||
#if defined(CONFIG_ARCH_AT91X40)
|
||||
#include <mach/at91x40.h>
|
||||
@ -34,6 +36,7 @@
|
||||
#include <mach/at91sam9x5.h>
|
||||
#include <mach/at91sam9n12.h>
|
||||
#include <mach/sama5d3.h>
|
||||
#include <mach/sama5d4.h>
|
||||
|
||||
/*
|
||||
* On all at91 except rm9200 and x40 have the System Controller starts
|
||||
@ -47,6 +50,11 @@
|
||||
* and map the same memory space
|
||||
*/
|
||||
#define AT91_BASE_SYS 0xffffc000
|
||||
|
||||
/*
|
||||
* On sama5d4 there is no system controller, we map some needed peripherals
|
||||
*/
|
||||
#define AT91_ALT_BASE_SYS 0xfc069000
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -69,6 +77,13 @@
|
||||
*/
|
||||
#define AT91_IO_PHYS_BASE 0xFFF78000
|
||||
#define AT91_IO_VIRT_BASE IOMEM(0xFF000000 - AT91_IO_SIZE)
|
||||
|
||||
/*
|
||||
* On sama5d4, remap the peripherals from address 0xFC069000 .. 0xFC06F000
|
||||
* to 0xFB069000 .. 0xFB06F000. (24Kb)
|
||||
*/
|
||||
#define AT91_ALT_IO_PHYS_BASE AT91_ALT_BASE_SYS
|
||||
#define AT91_ALT_IO_VIRT_BASE IOMEM(0xFB069000)
|
||||
#else
|
||||
/*
|
||||
* Identity mapping for the non MMU case.
|
||||
@ -81,11 +96,13 @@
|
||||
|
||||
/* Convert a physical IO address to virtual IO address */
|
||||
#define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE)
|
||||
#define AT91_ALT_IO_P2V(x) ((x) - AT91_ALT_IO_PHYS_BASE + AT91_ALT_IO_VIRT_BASE)
|
||||
|
||||
/*
|
||||
* Virtual to Physical Address mapping for IO devices.
|
||||
*/
|
||||
#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS)
|
||||
#define AT91_ALT_VA_BASE_SYS AT91_ALT_IO_P2V(AT91_ALT_BASE_SYS)
|
||||
|
||||
/* Internal SRAM is mapped below the IO devices */
|
||||
#define AT91_SRAM_MAX SZ_1M
|
||||
|
33
arch/arm/mach-at91/include/mach/sama5d4.h
Normal file
33
arch/arm/mach-at91/include/mach/sama5d4.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Chip-specific header file for the SAMA5D4 family
|
||||
*
|
||||
* Copyright (C) 2013 Atmel Corporation,
|
||||
* Nicolas Ferre <nicolas.ferre@atmel.com>
|
||||
*
|
||||
* Common definitions.
|
||||
* Based on SAMA5D4 datasheet.
|
||||
*
|
||||
* Licensed under GPLv2 or later.
|
||||
*/
|
||||
|
||||
#ifndef SAMA5D4_H
|
||||
#define SAMA5D4_H
|
||||
|
||||
/*
|
||||
* User Peripheral physical base addresses.
|
||||
*/
|
||||
#define SAMA5D4_BASE_USART3 0xfc00c000 /* (USART3 non-secure) Base Address */
|
||||
#define SAMA5D4_BASE_PMC 0xf0018000 /* (PMC) Base Address */
|
||||
#define SAMA5D4_BASE_MPDDRC 0xf0010000 /* (MPDDRC) Base Address */
|
||||
#define SAMA5D4_BASE_PIOD 0xfc068000 /* (PIOD) Base Address */
|
||||
|
||||
/* Some other peripherals */
|
||||
#define SAMA5D4_BASE_SYS2 SAMA5D4_BASE_PIOD
|
||||
|
||||
/*
|
||||
* Internal Memory.
|
||||
*/
|
||||
#define SAMA5D4_NS_SRAM_BASE 0x00210000 /* Internal SRAM base address Non-Secure */
|
||||
#define SAMA5D4_NS_SRAM_SIZE (64 * SZ_1K) /* Internal SRAM size Non-Secure part (64Kb) */
|
||||
|
||||
#endif
|
@ -94,7 +94,7 @@ static const u32 uarts_sam9x5[] = {
|
||||
0,
|
||||
};
|
||||
|
||||
static const u32 uarts_sama5[] = {
|
||||
static const u32 uarts_sama5d3[] = {
|
||||
AT91_BASE_DBGU1,
|
||||
SAMA5D3_BASE_USART0,
|
||||
SAMA5D3_BASE_USART1,
|
||||
@ -103,6 +103,12 @@ static const u32 uarts_sama5[] = {
|
||||
0,
|
||||
};
|
||||
|
||||
static const u32 uarts_sama5d4[] = {
|
||||
AT91_BASE_DBGU2,
|
||||
SAMA5D4_BASE_USART3,
|
||||
0,
|
||||
};
|
||||
|
||||
static inline const u32* decomp_soc_detect(void __iomem *dbgu_base)
|
||||
{
|
||||
u32 cidr, socid;
|
||||
@ -134,8 +140,14 @@ static inline const u32* decomp_soc_detect(void __iomem *dbgu_base)
|
||||
case ARCH_ID_AT91SAM9X5:
|
||||
return uarts_sam9x5;
|
||||
|
||||
case ARCH_ID_SAMA5D3:
|
||||
return uarts_sama5;
|
||||
case ARCH_ID_SAMA5:
|
||||
cidr = __raw_readl(dbgu_base + AT91_DBGU_EXID);
|
||||
if (cidr & ARCH_EXID_SAMA5D3)
|
||||
return uarts_sama5d3;
|
||||
else if (cidr & ARCH_EXID_SAMA5D4)
|
||||
return uarts_sama5d4;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* at91sam9g10 */
|
||||
@ -156,9 +168,10 @@ static inline void arch_decomp_setup(void)
|
||||
const u32* usarts;
|
||||
|
||||
usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU0);
|
||||
|
||||
if (!usarts)
|
||||
usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU1);
|
||||
if (!usarts)
|
||||
usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU2);
|
||||
if (!usarts) {
|
||||
at91_uart = NULL;
|
||||
return;
|
||||
|
64
arch/arm/mach-at91/sama5d4.c
Normal file
64
arch/arm/mach-at91/sama5d4.c
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Chip-specific setup code for the SAMA5D4 family
|
||||
*
|
||||
* Copyright (C) 2013 Atmel Corporation,
|
||||
* Nicolas Ferre <nicolas.ferre@atmel.com>
|
||||
*
|
||||
* Licensed under GPLv2 or later.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/clk/at91_pmc.h>
|
||||
|
||||
#include <asm/irq.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <mach/sama5d4.h>
|
||||
#include <mach/cpu.h>
|
||||
#include <mach/hardware.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "generic.h"
|
||||
#include "sam9_smc.h"
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* Processor initialization
|
||||
* -------------------------------------------------------------------- */
|
||||
static struct map_desc at91_io_desc[] __initdata = {
|
||||
{
|
||||
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC),
|
||||
.pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC),
|
||||
.length = SZ_512,
|
||||
.type = MT_DEVICE,
|
||||
},
|
||||
{
|
||||
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC),
|
||||
.pfn = __phys_to_pfn(SAMA5D4_BASE_PMC),
|
||||
.length = SZ_512,
|
||||
.type = MT_DEVICE,
|
||||
},
|
||||
{ /* On sama5d4, we use USART3 as serial console */
|
||||
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3),
|
||||
.pfn = __phys_to_pfn(SAMA5D4_BASE_USART3),
|
||||
.length = SZ_256,
|
||||
.type = MT_DEVICE,
|
||||
},
|
||||
{ /* A bunch of peripheral with fine grained IO space */
|
||||
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2),
|
||||
.pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2),
|
||||
.length = SZ_2K,
|
||||
.type = MT_DEVICE,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static void __init sama5d4_map_io(void)
|
||||
{
|
||||
iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc));
|
||||
at91_init_sram(0, SAMA5D4_NS_SRAM_BASE, SAMA5D4_NS_SRAM_SIZE);
|
||||
}
|
||||
|
||||
AT91_SOC_START(sama5d4)
|
||||
.map_io = sama5d4_map_io,
|
||||
AT91_SOC_END
|
@ -96,6 +96,13 @@ static struct map_desc at91_io_desc __initdata __maybe_unused = {
|
||||
.type = MT_DEVICE,
|
||||
};
|
||||
|
||||
static struct map_desc at91_alt_io_desc __initdata __maybe_unused = {
|
||||
.virtual = (unsigned long)AT91_ALT_VA_BASE_SYS,
|
||||
.pfn = __phys_to_pfn(AT91_ALT_BASE_SYS),
|
||||
.length = 24 * SZ_1K,
|
||||
.type = MT_DEVICE,
|
||||
};
|
||||
|
||||
static void __init soc_detect(u32 dbgu_base)
|
||||
{
|
||||
u32 cidr, socid;
|
||||
@ -158,9 +165,12 @@ static void __init soc_detect(u32 dbgu_base)
|
||||
at91_boot_soc = at91sam9n12_soc;
|
||||
break;
|
||||
|
||||
case ARCH_ID_SAMA5D3:
|
||||
at91_soc_initdata.type = AT91_SOC_SAMA5D3;
|
||||
at91_boot_soc = sama5d3_soc;
|
||||
case ARCH_ID_SAMA5:
|
||||
at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
|
||||
if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) {
|
||||
at91_soc_initdata.type = AT91_SOC_SAMA5D3;
|
||||
at91_boot_soc = sama5d3_soc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -183,7 +193,8 @@ static void __init soc_detect(u32 dbgu_base)
|
||||
at91_soc_initdata.cidr = cidr;
|
||||
|
||||
/* sub version of soc */
|
||||
at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
|
||||
if (!at91_soc_initdata.exid)
|
||||
at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
|
||||
|
||||
if (at91_soc_initdata.type == AT91_SOC_SAM9G45) {
|
||||
switch (at91_soc_initdata.exid) {
|
||||
@ -240,6 +251,54 @@ static void __init soc_detect(u32 dbgu_base)
|
||||
}
|
||||
}
|
||||
|
||||
static void __init alt_soc_detect(u32 dbgu_base)
|
||||
{
|
||||
u32 cidr, socid;
|
||||
|
||||
/* SoC ID */
|
||||
cidr = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_CIDR);
|
||||
socid = cidr & ~AT91_CIDR_VERSION;
|
||||
|
||||
switch (socid) {
|
||||
case ARCH_ID_SAMA5:
|
||||
at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
|
||||
if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) {
|
||||
at91_soc_initdata.type = AT91_SOC_SAMA5D3;
|
||||
at91_boot_soc = sama5d3_soc;
|
||||
} else if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D4) {
|
||||
at91_soc_initdata.type = AT91_SOC_SAMA5D4;
|
||||
at91_boot_soc = sama5d4_soc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!at91_soc_is_detected())
|
||||
return;
|
||||
|
||||
at91_soc_initdata.cidr = cidr;
|
||||
|
||||
/* sub version of soc */
|
||||
if (!at91_soc_initdata.exid)
|
||||
at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
|
||||
|
||||
if (at91_soc_initdata.type == AT91_SOC_SAMA5D4) {
|
||||
switch (at91_soc_initdata.exid) {
|
||||
case ARCH_EXID_SAMA5D41:
|
||||
at91_soc_initdata.subtype = AT91_SOC_SAMA5D41;
|
||||
break;
|
||||
case ARCH_EXID_SAMA5D42:
|
||||
at91_soc_initdata.subtype = AT91_SOC_SAMA5D42;
|
||||
break;
|
||||
case ARCH_EXID_SAMA5D43:
|
||||
at91_soc_initdata.subtype = AT91_SOC_SAMA5D43;
|
||||
break;
|
||||
case ARCH_EXID_SAMA5D44:
|
||||
at91_soc_initdata.subtype = AT91_SOC_SAMA5D44;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char *soc_name[] = {
|
||||
[AT91_SOC_RM9200] = "at91rm9200",
|
||||
[AT91_SOC_SAM9260] = "at91sam9260",
|
||||
@ -252,6 +311,7 @@ static const char *soc_name[] = {
|
||||
[AT91_SOC_SAM9X5] = "at91sam9x5",
|
||||
[AT91_SOC_SAM9N12] = "at91sam9n12",
|
||||
[AT91_SOC_SAMA5D3] = "sama5d3",
|
||||
[AT91_SOC_SAMA5D4] = "sama5d4",
|
||||
[AT91_SOC_UNKNOWN] = "Unknown",
|
||||
};
|
||||
|
||||
@ -279,6 +339,10 @@ static const char *soc_subtype_name[] = {
|
||||
[AT91_SOC_SAMA5D34] = "sama5d34",
|
||||
[AT91_SOC_SAMA5D35] = "sama5d35",
|
||||
[AT91_SOC_SAMA5D36] = "sama5d36",
|
||||
[AT91_SOC_SAMA5D41] = "sama5d41",
|
||||
[AT91_SOC_SAMA5D42] = "sama5d42",
|
||||
[AT91_SOC_SAMA5D43] = "sama5d43",
|
||||
[AT91_SOC_SAMA5D44] = "sama5d44",
|
||||
[AT91_SOC_SUBTYPE_NONE] = "None",
|
||||
[AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown",
|
||||
};
|
||||
@ -341,6 +405,31 @@ void __init at91_ioremap_rstc(u32 base_addr)
|
||||
panic("Impossible to ioremap at91_rstc_base\n");
|
||||
}
|
||||
|
||||
void __init at91_alt_map_io(void)
|
||||
{
|
||||
/* Map peripherals */
|
||||
iotable_init(&at91_alt_io_desc, 1);
|
||||
|
||||
at91_soc_initdata.type = AT91_SOC_UNKNOWN;
|
||||
at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_UNKNOWN;
|
||||
|
||||
alt_soc_detect(AT91_BASE_DBGU2);
|
||||
if (!at91_soc_is_detected())
|
||||
panic("AT91: Impossible to detect the SOC type");
|
||||
|
||||
pr_info("AT91: Detected soc type: %s\n",
|
||||
at91_get_soc_type(&at91_soc_initdata));
|
||||
if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE)
|
||||
pr_info("AT91: Detected soc subtype: %s\n",
|
||||
at91_get_soc_subtype(&at91_soc_initdata));
|
||||
|
||||
if (!at91_soc_is_enabled())
|
||||
panic("AT91: Soc not enabled");
|
||||
|
||||
if (at91_boot_soc.map_io)
|
||||
at91_boot_soc.map_io();
|
||||
}
|
||||
|
||||
void __iomem *at91_matrix_base;
|
||||
EXPORT_SYMBOL_GPL(at91_matrix_base);
|
||||
|
||||
|
@ -24,6 +24,7 @@ extern struct at91_init_soc at91sam9rl_soc;
|
||||
extern struct at91_init_soc at91sam9x5_soc;
|
||||
extern struct at91_init_soc at91sam9n12_soc;
|
||||
extern struct at91_init_soc sama5d3_soc;
|
||||
extern struct at91_init_soc sama5d4_soc;
|
||||
|
||||
#define AT91_SOC_START(_name) \
|
||||
struct at91_init_soc __initdata _name##_soc \
|
||||
@ -74,3 +75,7 @@ static inline int at91_soc_is_enabled(void)
|
||||
#if !defined(CONFIG_SOC_SAMA5D3)
|
||||
#define sama5d3_soc at91_boot_soc
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SOC_SAMA5D4)
|
||||
#define sama5d4_soc at91_boot_soc
|
||||
#endif
|
||||
|
@ -9,3 +9,4 @@ obj-y += clk-system.o clk-peripheral.o clk-programmable.o
|
||||
obj-$(CONFIG_HAVE_AT91_UTMI) += clk-utmi.o
|
||||
obj-$(CONFIG_HAVE_AT91_USB_CLK) += clk-usb.o
|
||||
obj-$(CONFIG_HAVE_AT91_SMD) += clk-smd.o
|
||||
obj-$(CONFIG_HAVE_AT91_H32MX) += clk-h32mx.o
|
||||
|
123
drivers/clk/at91/clk-h32mx.c
Normal file
123
drivers/clk/at91/clk-h32mx.c
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* clk-h32mx.c
|
||||
*
|
||||
* Copyright (C) 2014 Atmel
|
||||
*
|
||||
* Alexandre Belloni <alexandre.belloni@free-electrons.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk/at91_pmc.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/wait.h>
|
||||
|
||||
#include "pmc.h"
|
||||
|
||||
#define H32MX_MAX_FREQ 90000000
|
||||
|
||||
struct clk_sama5d4_h32mx {
|
||||
struct clk_hw hw;
|
||||
struct at91_pmc *pmc;
|
||||
};
|
||||
|
||||
#define to_clk_sama5d4_h32mx(hw) container_of(hw, struct clk_sama5d4_h32mx, hw)
|
||||
|
||||
static unsigned long clk_sama5d4_h32mx_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_sama5d4_h32mx *h32mxclk = to_clk_sama5d4_h32mx(hw);
|
||||
|
||||
if (pmc_read(h32mxclk->pmc, AT91_PMC_MCKR) & AT91_PMC_H32MXDIV)
|
||||
return parent_rate / 2;
|
||||
|
||||
if (parent_rate > H32MX_MAX_FREQ)
|
||||
pr_warn("H32MX clock is too fast\n");
|
||||
return parent_rate;
|
||||
}
|
||||
|
||||
static long clk_sama5d4_h32mx_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *parent_rate)
|
||||
{
|
||||
unsigned long div;
|
||||
|
||||
if (rate > *parent_rate)
|
||||
return *parent_rate;
|
||||
div = *parent_rate / 2;
|
||||
if (rate < div)
|
||||
return div;
|
||||
|
||||
if (rate - div < *parent_rate - rate)
|
||||
return div;
|
||||
|
||||
return *parent_rate;
|
||||
}
|
||||
|
||||
static int clk_sama5d4_h32mx_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_sama5d4_h32mx *h32mxclk = to_clk_sama5d4_h32mx(hw);
|
||||
struct at91_pmc *pmc = h32mxclk->pmc;
|
||||
u32 tmp;
|
||||
|
||||
if (parent_rate != rate && (parent_rate / 2) != rate)
|
||||
return -EINVAL;
|
||||
|
||||
pmc_lock(pmc);
|
||||
tmp = pmc_read(pmc, AT91_PMC_MCKR) & ~AT91_PMC_H32MXDIV;
|
||||
if ((parent_rate / 2) == rate)
|
||||
tmp |= AT91_PMC_H32MXDIV;
|
||||
pmc_write(pmc, AT91_PMC_MCKR, tmp);
|
||||
pmc_unlock(pmc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops h32mx_ops = {
|
||||
.recalc_rate = clk_sama5d4_h32mx_recalc_rate,
|
||||
.round_rate = clk_sama5d4_h32mx_round_rate,
|
||||
.set_rate = clk_sama5d4_h32mx_set_rate,
|
||||
};
|
||||
|
||||
void __init of_sama5d4_clk_h32mx_setup(struct device_node *np,
|
||||
struct at91_pmc *pmc)
|
||||
{
|
||||
struct clk_sama5d4_h32mx *h32mxclk;
|
||||
struct clk_init_data init;
|
||||
const char *parent_name;
|
||||
struct clk *clk;
|
||||
|
||||
h32mxclk = kzalloc(sizeof(*h32mxclk), GFP_KERNEL);
|
||||
if (!h32mxclk)
|
||||
return;
|
||||
|
||||
parent_name = of_clk_get_parent_name(np, 0);
|
||||
|
||||
init.name = np->name;
|
||||
init.ops = &h32mx_ops;
|
||||
init.parent_names = parent_name ? &parent_name : NULL;
|
||||
init.num_parents = parent_name ? 1 : 0;
|
||||
init.flags = CLK_SET_RATE_GATE;
|
||||
|
||||
h32mxclk->hw.init = &init;
|
||||
h32mxclk->pmc = pmc;
|
||||
|
||||
clk = clk_register(NULL, &h32mxclk->hw);
|
||||
if (!clk)
|
||||
return;
|
||||
|
||||
of_clk_add_provider(np, of_clk_src_simple_get, clk);
|
||||
}
|
@ -336,6 +336,12 @@ static const struct of_device_id pmc_clk_ids[] __initconst = {
|
||||
.compatible = "atmel,at91sam9x5-clk-smd",
|
||||
.data = of_at91sam9x5_clk_smd_setup,
|
||||
},
|
||||
#endif
|
||||
#if defined(CONFIG_HAVE_AT91_H32MX)
|
||||
{
|
||||
.compatible = "atmel,sama5d4-clk-h32mx",
|
||||
.data = of_sama5d4_clk_h32mx_setup,
|
||||
},
|
||||
#endif
|
||||
{ /*sentinel*/ }
|
||||
};
|
||||
|
@ -120,4 +120,9 @@ extern void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
|
||||
struct at91_pmc *pmc);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_HAVE_AT91_SMD)
|
||||
extern void __init of_sama5d4_clk_h32mx_setup(struct device_node *np,
|
||||
struct at91_pmc *pmc);
|
||||
#endif
|
||||
|
||||
#endif /* __PMC_H_ */
|
||||
|
@ -125,6 +125,7 @@ extern void __iomem *at91_pmc_base;
|
||||
#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */
|
||||
#define AT91_PMC_PLLADIV2_OFF (0 << 12)
|
||||
#define AT91_PMC_PLLADIV2_ON (1 << 12)
|
||||
#define AT91_PMC_H32MXDIV BIT(24)
|
||||
|
||||
#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */
|
||||
#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
|
||||
|
Loading…
Reference in New Issue
Block a user