Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
dc76a1a
Documentation
arch
alpha
arc
arm
boot
common
configs
crypto
include
kernel
kvm
lib
mach-at91
mach-bcm
mach-bcm2835
mach-clps711x
mach-cns3xxx
mach-davinci
mach-dove
mach-ebsa110
mach-ep93xx
mach-exynos
mach-footbridge
mach-gemini
mach-highbank
mach-imx
devices
3ds_debugboard.c
3ds_debugboard.h
Kconfig
Makefile
anatop.c
avic.c
board-mx31lilly.h
board-mx31lite.h
board-mx31moboard.h
board-pcm038.h
clk-busy.c
clk-fixup-div.c
clk-fixup-mux.c
clk-gate2.c
clk-imx1.c
clk-imx21.c
clk-imx25.c
clk-imx27.c
clk-imx31.c
clk-imx35.c
clk-imx51-imx53.c
clk-imx6q.c
clk-imx6sl.c
clk-pfd.c
clk-pllv1.c
clk-pllv2.c
clk-pllv3.c
clk-vf610.c
clk.c
clk.h
common.h
cpu-imx25.c
cpu-imx27.c
cpu-imx31.c
cpu-imx35.c
cpu-imx5.c
cpu.c
cpuidle-imx5.c
cpuidle-imx6q.c
cpuidle.h
crm-regs-imx5.h
crmregs-imx3.h
devices-imx1.h
devices-imx21.h
devices-imx25.h
devices-imx27.h
devices-imx31.h
devices-imx35.h
devices-imx51.h
ehci-imx25.c
ehci-imx27.c
ehci-imx31.c
ehci-imx35.c
ehci-imx5.c
epit.c
eukrea-baseboards.h
eukrea_mbimx27-baseboard.c
eukrea_mbimxsd25-baseboard.c
eukrea_mbimxsd35-baseboard.c
eukrea_mbimxsd51-baseboard.c
gpc.c
hardware.h
headsmp.S
hotplug.c
iim.h
imx25-dt.c
imx27-dt.c
imx31-dt.c
imx51-dt.c
iomux-imx31.c
iomux-mx1.h
iomux-mx21.h
iomux-mx25.h
iomux-mx27.h
iomux-mx2x.h
iomux-mx3.h
iomux-mx35.h
iomux-mx51.h
iomux-v1.c
iomux-v1.h
iomux-v3.c
iomux-v3.h
irq-common.c
irq-common.h
mach-apf9328.c
mach-armadillo5x0.c
mach-bug.c
mach-cpuimx27.c
mach-cpuimx35.c
mach-cpuimx51sd.c
mach-eukrea_cpuimx25.c
mach-imx27_visstrim_m10.c
mach-imx27ipcam.c
mach-imx27lite.c
mach-imx53.c
mach-imx6q.c
mach-imx6sl.c
mach-kzm_arm11_01.c
mach-mx1ads.c
mach-mx21ads.c
mach-mx25_3ds.c
mach-mx27_3ds.c
mach-mx27ads.c
mach-mx31_3ds.c
mach-mx31ads.c
mach-mx31lilly.c
mach-mx31lite.c
mach-mx31moboard.c
mach-mx35_3ds.c
mach-mx51_babbage.c
mach-mxt_td60.c
mach-pca100.c
mach-pcm037.c
mach-pcm037_eet.c
mach-pcm038.c
mach-pcm043.c
mach-qong.c
mach-scb9328.c
mach-vf610.c
mach-vpr200.c
mm-imx1.c
mm-imx21.c
mm-imx25.c
mm-imx27.c
mm-imx3.c
mm-imx5.c
mmdc.c
mx1-camera-fiq-ksym.c
mx1-camera-fiq.S
mx1.h
mx21.h
mx25.h
mx27.h
mx2x.h
mx31.h
mx31lilly-db.c
mx31lite-db.c
mx31moboard-devboard.c
mx31moboard-marxbot.c
mx31moboard-smartbot.c
mx35.h
mx3x.h
mx51.h
mx53.h
mxc.h
pcm037.h
pcm970-baseboard.c
platsmp.c
pm-imx27.c
pm-imx3.c
pm-imx5.c
pm-imx6q.c
src.c
ssi-fiq-ksym.c
ssi-fiq.S
system.c
time.c
tzic.c
ulpi.h
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone
mach-kirkwood
mach-ks8695
mach-lpc32xx
mach-mmp
mach-msm
mach-mv78xx0
mach-mvebu
mach-mxs
mach-netx
mach-nomadik
mach-nspire
mach-omap1
mach-omap2
mach-orion5x
mach-picoxcell
mach-prima2
mach-pxa
mach-realview
mach-rockchip
mach-rpc
mach-s3c24xx
mach-s3c64xx
mach-s5p64x0
mach-s5pc100
mach-s5pv210
mach-sa1100
mach-shark
mach-shmobile
mach-socfpga
mach-spear
mach-sti
mach-sunxi
mach-tegra
mach-u300
mach-ux500
mach-versatile
mach-vexpress
mach-virt
mach-vt8500
mach-w90x900
mach-zynq
mm
net
nwfpe
oprofile
plat-iop
plat-omap
plat-orion
plat-pxa
plat-samsung
plat-versatile
tools
vfp
xen
Kconfig
Kconfig-nommu
Kconfig.debug
Makefile
arm64
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt/kvm
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
arm
/
mach-imx
/
mach-imx6q.c
Copy path
Blame
Blame
Latest commit
History
History
384 lines (324 loc) · 8.59 KB
Breadcrumbs
linux
/
arch
/
arm
/
mach-imx
/
mach-imx6q.c
Top
File metadata and controls
Code
Blame
384 lines (324 loc) · 8.59 KB
Raw
/* * Copyright 2011-2013 Freescale Semiconductor, Inc. * Copyright 2011 Linaro Ltd. * * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License * Version 2 or later at the following locations: * * http://www.opensource.org/licenses/gpl-license.html * http://www.gnu.org/copyleft/gpl.html */ #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/clkdev.h> #include <linux/clocksource.h> #include <linux/cpu.h> #include <linux/delay.h> #include <linux/export.h> #include <linux/init.h> #include <linux/io.h> #include <linux/irq.h> #include <linux/irqchip.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/opp.h> #include <linux/phy.h> #include <linux/reboot.h> #include <linux/regmap.h> #include <linux/micrel_phy.h> #include <linux/mfd/syscon.h> #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/system_misc.h> #include "common.h" #include "cpuidle.h" #include "hardware.h" static u32 chip_revision; int imx6q_revision(void) { return chip_revision; } static void __init imx6q_init_revision(void) { u32 rev = imx_anatop_get_digprog(); switch (rev & 0xff) { case 0: chip_revision = IMX_CHIP_REVISION_1_0; break; case 1: chip_revision = IMX_CHIP_REVISION_1_1; break; case 2: chip_revision = IMX_CHIP_REVISION_1_2; break; default: chip_revision = IMX_CHIP_REVISION_UNKNOWN; } mxc_set_cpu_type(rev >> 16 & 0xff); } static void imx6q_restart(enum reboot_mode mode, const char *cmd) { struct device_node *np; void __iomem *wdog_base; np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-wdt"); wdog_base = of_iomap(np, 0); if (!wdog_base) goto soft; imx_src_prepare_restart(); /* enable wdog */ writew_relaxed(1 << 2, wdog_base); /* write twice to ensure the request will not get ignored */ writew_relaxed(1 << 2, wdog_base); /* wait for reset to assert ... */ mdelay(500); pr_err("Watchdog reset failed to assert reset\n"); /* delay to allow the serial port to show the message */ mdelay(50); soft: /* we'll take a jump through zero as a poor second */ soft_restart(0); } /* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */ static int ksz9021rn_phy_fixup(struct phy_device *phydev) { if (IS_BUILTIN(CONFIG_PHYLIB)) { /* min rx data delay */ phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL, 0x8000 | MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW); phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0x0000); /* max rx/tx clock delay, min rx/tx control delay */ phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL, 0x8000 | MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW); phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0xf0f0); phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL, MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW); } return 0; } static void mmd_write_reg(struct phy_device *dev, int device, int reg, int val) { phy_write(dev, 0x0d, device); phy_write(dev, 0x0e, reg); phy_write(dev, 0x0d, (1 << 14) | device); phy_write(dev, 0x0e, val); } static int ksz9031rn_phy_fixup(struct phy_device *dev) { /* * min rx data delay, max rx/tx clock delay, * min rx/tx control delay */ mmd_write_reg(dev, 2, 4, 0); mmd_write_reg(dev, 2, 5, 0); mmd_write_reg(dev, 2, 8, 0x003ff); return 0; } static int ar8031_phy_fixup(struct phy_device *dev) { u16 val; /* To enable AR8031 output a 125MHz clk from CLK_25M */ phy_write(dev, 0xd, 0x7); phy_write(dev, 0xe, 0x8016); phy_write(dev, 0xd, 0x4007); val = phy_read(dev, 0xe); val &= 0xffe3; val |= 0x18; phy_write(dev, 0xe, val); /* introduce tx clock delay */ phy_write(dev, 0x1d, 0x5); val = phy_read(dev, 0x1e); val |= 0x0100; phy_write(dev, 0x1e, val); return 0; } static void __init imx6q_sabrelite_cko1_setup(void) { struct clk *cko1_sel, *ahb, *cko1; unsigned long rate; cko1_sel = clk_get_sys(NULL, "cko1_sel"); ahb = clk_get_sys(NULL, "ahb"); cko1 = clk_get_sys(NULL, "cko1"); if (IS_ERR(cko1_sel) || IS_ERR(ahb) || IS_ERR(cko1)) { pr_err("cko1 setup failed!\n"); goto put_clk; } clk_set_parent(cko1_sel, ahb); rate = clk_round_rate(cko1, 16000000); clk_set_rate(cko1, rate); put_clk: if (!IS_ERR(cko1_sel)) clk_put(cko1_sel); if (!IS_ERR(ahb)) clk_put(ahb); if (!IS_ERR(cko1)) clk_put(cko1); } #define PHY_ID_AR8031 0x004dd074 static void __init imx6q_enet_phy_init(void) { if (IS_BUILTIN(CONFIG_PHYLIB)) { phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, ksz9021rn_phy_fixup); phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK, ksz9031rn_phy_fixup); phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff, ar8031_phy_fixup); } } static void __init imx6q_sabresd_cko1_setup(void) { struct clk *cko1_sel, *pll4, *pll4_post, *cko1; unsigned long rate; cko1_sel = clk_get_sys(NULL, "cko1_sel"); pll4 = clk_get_sys(NULL, "pll4_audio"); pll4_post = clk_get_sys(NULL, "pll4_post_div"); cko1 = clk_get_sys(NULL, "cko1"); if (IS_ERR(cko1_sel) || IS_ERR(pll4) || IS_ERR(pll4_post) || IS_ERR(cko1)) { pr_err("cko1 setup failed!\n"); goto put_clk; } /* * Setting pll4 at 768MHz (24MHz * 32) * So its child clock can get 24MHz easily */ clk_set_rate(pll4, 768000000); clk_set_parent(cko1_sel, pll4_post); rate = clk_round_rate(cko1, 24000000); clk_set_rate(cko1, rate); put_clk: if (!IS_ERR(cko1_sel)) clk_put(cko1_sel); if (!IS_ERR(pll4_post)) clk_put(pll4_post); if (!IS_ERR(pll4)) clk_put(pll4); if (!IS_ERR(cko1)) clk_put(cko1); } static void __init imx6q_sabresd_init(void) { imx6q_sabresd_cko1_setup(); } static void __init imx6q_1588_init(void) { struct regmap *gpr; gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); if (!IS_ERR(gpr)) regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_ENET_CLK_SEL_MASK, IMX6Q_GPR1_ENET_CLK_SEL_ANATOP); else pr_err("failed to find fsl,imx6q-iomux-gpr regmap\n"); } static void __init imx6q_init_machine(void) { if (of_machine_is_compatible("fsl,imx6q-sabrelite")) imx6q_sabrelite_cko1_setup(); else if (of_machine_is_compatible("fsl,imx6q-sabresd") || of_machine_is_compatible("fsl,imx6dl-sabresd")) imx6q_sabresd_init(); imx6q_enet_phy_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); imx_anatop_init(); imx6q_pm_init(); imx6q_1588_init(); } #define OCOTP_CFG3 0x440 #define OCOTP_CFG3_SPEED_SHIFT 16 #define OCOTP_CFG3_SPEED_1P2GHZ 0x3 static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev) { struct device_node *np; void __iomem *base; u32 val; np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-ocotp"); if (!np) { pr_warn("failed to find ocotp node\n"); return; } base = of_iomap(np, 0); if (!base) { pr_warn("failed to map ocotp\n"); goto put_node; } val = readl_relaxed(base + OCOTP_CFG3); val >>= OCOTP_CFG3_SPEED_SHIFT; if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ) if (opp_disable(cpu_dev, 1200000000)) pr_warn("failed to disable 1.2 GHz OPP\n"); put_node: of_node_put(np); } static void __init imx6q_opp_init(struct device *cpu_dev) { struct device_node *np; np = of_find_node_by_path("/cpus/cpu@0"); if (!np) { pr_warn("failed to find cpu0 node\n"); return; } cpu_dev->of_node = np; if (of_init_opp_table(cpu_dev)) { pr_warn("failed to init OPP table\n"); goto put_node; } imx6q_opp_check_1p2ghz(cpu_dev); put_node: of_node_put(np); } static struct platform_device imx6q_cpufreq_pdev = { .name = "imx6q-cpufreq", }; static void __init imx6q_init_late(void) { /* * WAIT mode is broken on TO 1.0 and 1.1, so there is no point * to run cpuidle on them. */ if (imx6q_revision() > IMX_CHIP_REVISION_1_1) imx6q_cpuidle_init(); if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) { imx6q_opp_init(&imx6q_cpufreq_pdev.dev); platform_device_register(&imx6q_cpufreq_pdev); } } static void __init imx6q_map_io(void) { debug_ll_io_init(); imx_scu_map_io(); } static void __init imx6q_init_irq(void) { imx6q_init_revision(); imx_init_l2cache(); imx_src_init(); imx_gpc_init(); irqchip_init(); } static void __init imx6q_timer_init(void) { of_clk_init(NULL); clocksource_of_init(); imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q", imx6q_revision()); } static const char *imx6q_dt_compat[] __initdata = { "fsl,imx6dl", "fsl,imx6q", NULL, }; DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)") .smp = smp_ops(imx_smp_ops), .map_io = imx6q_map_io, .init_irq = imx6q_init_irq, .init_time = imx6q_timer_init, .init_machine = imx6q_init_machine, .init_late = imx6q_init_late, .dt_compat = imx6q_dt_compat, .restart = imx6q_restart, MACHINE_END
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
You can’t perform that action at this time.