blob: 9988caec12502823df6ff3dc3e6b088c3cd5a94a [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Stefan Roese5d6050f2014-12-10 10:15:23 +01002/*
3 * Copyright (C) 2014 Stefan Roese <sr@denx.de>
Stefan Roese5d6050f2014-12-10 10:15:23 +01004 */
5
6#ifndef _PLATINUM_H_
7#define _PLATINUM_H_
8
9#include <miiphy.h>
10#include <asm/arch/crm_regs.h>
Stefano Babic5ba49e72015-01-22 10:09:00 +010011#include <asm/io.h>
Stefan Roese5d6050f2014-12-10 10:15:23 +010012
13/* Defines */
14
15#define ECSPI1_PAD_CLK (PAD_CTL_SRE_SLOW | PAD_CTL_PUS_100K_DOWN | \
16 PAD_CTL_SPEED_LOW | PAD_CTL_DSE_40ohm | \
17 PAD_CTL_HYS)
18#define ECSPI2_PAD_CLK (PAD_CTL_SRE_FAST | PAD_CTL_PUS_100K_DOWN | \
19 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
20 PAD_CTL_HYS)
21#define ECSPI_PAD_MOSI (PAD_CTL_SRE_SLOW | PAD_CTL_PUS_100K_DOWN | \
22 PAD_CTL_SPEED_LOW | PAD_CTL_DSE_120ohm | \
23 PAD_CTL_HYS)
24#define ECSPI_PAD_MISO (PAD_CTL_SRE_FAST | PAD_CTL_PUS_100K_DOWN | \
25 PAD_CTL_SPEED_LOW | PAD_CTL_DSE_40ohm | \
26 PAD_CTL_HYS)
27#define ECSPI_PAD_SS (PAD_CTL_SRE_SLOW | PAD_CTL_PUS_100K_UP | \
28 PAD_CTL_SPEED_LOW | PAD_CTL_DSE_120ohm | \
29 PAD_CTL_HYS)
30
31#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
32 PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
33
34#define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
35 PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
36 PAD_CTL_ODE | PAD_CTL_SRE_FAST)
37#define I2C_PAD_CTRL_SCL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_LOW | \
38 PAD_CTL_DSE_80ohm | PAD_CTL_HYS | \
39 PAD_CTL_ODE | PAD_CTL_SRE_SLOW)
40
41#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
42 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | \
43 PAD_CTL_HYS)
44
45#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
46 PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | \
47 PAD_CTL_HYS)
48
49
50#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
51#define PC_SCL MUX_PAD_CTRL(I2C_PAD_CTRL_SCL)
52
53/* Prototypes */
54
55int platinum_setup_enet(void);
56int platinum_setup_i2c(void);
57int platinum_setup_spi(void);
58int platinum_setup_uart(void);
59int platinum_phy_config(struct phy_device *phydev);
60int platinum_init_gpio(void);
61int platinum_init_usb(void);
62int platinum_init_finished(void);
63
64static inline void ccgr_init(void)
65{
66 struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
67
68 writel(0x00C03F3F, &ccm->CCGR0);
69 writel(0x0030FC03, &ccm->CCGR1);
70 writel(0x0FFFC000, &ccm->CCGR2);
71 writel(0x3FF00000, &ccm->CCGR3);
72 writel(0xFFFFF300, &ccm->CCGR4); /* enable NAND/GPMI/BCH clks */
73 writel(0x0F0000C3, &ccm->CCGR5);
74 writel(0x000003FF, &ccm->CCGR6);
75}
76
Stefan Roese5d6050f2014-12-10 10:15:23 +010077#endif /* _PLATINUM_H_ */