author | ivan.nie <ivan.nie@amlogic.com> | 2018-04-02 13:42:08 (GMT) |
---|---|---|
committer | Xindong Xu <xindong.xu@amlogic.com> | 2018-04-21 07:57:46 (GMT) |
commit | e634130803c7799af8b1e996f908bfc7468cf404 (patch) | |
tree | 8aa23426e9e663c8e5443efffc8a73e8f53819ac | |
parent | 6e024ef744a2d59a8b2a6c3937a72ed1f5b1e874 (diff) | |
download | uboot-o-amlogic.zip uboot-o-amlogic.tar.gz uboot-o-amlogic.tar.bz2 |
atom: for rgb led
Change-Id: I7c766d42691f638da2ca82cd41664a3305156cd9
-rw-r--r-- | board/harman/atom_v1/atom_v1.c | 58 | ||||
-rw-r--r-- | board/harman/configs/atom_v1.h | 10 |
2 files changed, 68 insertions, 0 deletions
diff --git a/board/harman/atom_v1/atom_v1.c b/board/harman/atom_v1/atom_v1.c index 2e6cb21..a5a605e 100644 --- a/board/harman/atom_v1/atom_v1.c +++ b/board/harman/atom_v1/atom_v1.c @@ -350,6 +350,62 @@ static void hdmi_tx_set_hdmi_5v(void) } #endif +#ifdef CONFIG_AML_SPICC +#include <amlogic/spicc.h> +#include <dm.h> +#include <amlogic/spicc.h> +#include <asm/arch/secure_apb.h> + +/* generic config in arch gpio/clock.c */ +extern int spicc0_clk_enable(bool enable); + +/* generic pins control for txlx spicc0. + 285 * if deleted, you have to add it into all txlx board files as necessary. + 286 * GPIOZ_0: MOSI:regB[19:16]=3 + 287 * GPIOZ_1: MISO:regB[23:20]=3 + 288 * GPIOZ_2: CLK:regB[31:28]=3 + 289 * GPIOZ_3: SS0:regB[27:24]=3 + 290 */ +int atom_spicc0_pinctrl_enable(bool enable) +{ + u32 regv; + + regv = readl(P_PERIPHS_PIN_MUX_4); + regv &= ~0x80000000; + if (enable) { + regv |= 0x80000000; + regv &= ~0x2000000; + } + writel(regv, P_PERIPHS_PIN_MUX_4); + + if (enable) { + regv = readl(P_PERIPHS_PIN_MUX_3); + regv &= ~0x210000; + writel(regv, P_PERIPHS_PIN_MUX_3); + } + + return 0; +} + + +static const struct spicc_platdata spicc0_platdata = { + .compatible = "amlogic,meson-txl-spicc", + .reg = (void __iomem *)0xffd13000, + .clk_rate = 166666666, + .clk_enable = spicc0_clk_enable, + .pinctrl_enable = atom_spicc0_pinctrl_enable, + /* case one slave without cs: {"no_cs", 0} */ + .cs_gpio_names = {"no_cs", 0}, + }; + +U_BOOT_DEVICE(spicc0) = { + .name = "spicc", + .platdata = &spicc0_platdata, + }; +#endif /* CONFIG_AML_SPICC */ + + + extern void aml_pwm_cal_init(int mode); int board_init(void) @@ -397,6 +453,8 @@ int board_late_init(void) #endif } + run_command("sspi 0:0.0.3300000.8 384 888EEEEE888EEEEE888EEEEE888EEEEE888EEEEE888EEEEE888EEEEE888EEEEE888EEEEE888EEEEE888EEEEE888EEEEE", 0); + run_command("gpio clear gpiodv_5", 0); //amp 0: mute; 1: unmute run_command("gpio clear gpioz_2", 0); //amp 0: power down; 1: normal run_command("gpio set gpiodv_4", 1); //amp 1: supply power diff --git a/board/harman/configs/atom_v1.h b/board/harman/configs/atom_v1.h index 94e564b..4587317 100644 --- a/board/harman/configs/atom_v1.h +++ b/board/harman/configs/atom_v1.h @@ -462,5 +462,15 @@ #endif #define ETHERNET_INTERNAL_PHY +/* meson SPI */ +#define CONFIG_AML_SPIFC +#define CONFIG_AML_SPICC +#define MAX_SPI_BYTES 48 +#if defined CONFIG_AML_SPIFC || defined CONFIG_AML_SPICC + #define CONFIG_OF_SPI + #define CONFIG_DM_SPI + #define CONFIG_CMD_SPI +#endif + #endif |