3 * Marek Vasut <marek.vasut@gmail.com>
5 * Heavily based on pxa255_idp platform
7 * SPDX-License-Identifier: GPL-2.0+
13 #include <asm/arch/hardware.h>
14 #include <asm/arch/pxa.h>
15 #include <asm/arch/regs-mmc.h>
19 DECLARE_GLOBAL_DATA_PTR;
24 inline void lcd_start(void) {};
28 * Miscelaneous platform dependent initialisations
33 /* We have RAM, disable cache */
37 /* arch number of Z2 */
38 gd->bd->bi_arch_number = MACH_TYPE_ZIPIT2;
40 /* adress of boot parameters */
41 gd->bd->bi_boot_params = 0xa0000100;
52 gd->ram_size = PHYS_SDRAM_1_SIZE;
56 void dram_init_banksize(void)
58 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
59 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
63 int board_mmc_init(bd_t *bis)
84 { 0x13, 0x0070, 200 },
110 { 0x07, 0x0015, 30 },
117 void zipitz2_spi_sda(int set)
121 writel((1 << 13), GPSR0);
123 writel((1 << 13), GPCR0);
126 void zipitz2_spi_scl(int set)
130 writel((1 << 22), GPCR0);
132 writel((1 << 22), GPSR0);
135 unsigned char zipitz2_spi_read(void)
138 return !!(readl(GPLR1) & (1 << 8));
141 int spi_cs_is_valid(unsigned int bus, unsigned int cs)
147 void spi_cs_activate(struct spi_slave *slave)
150 writel((1 << 24), GPCR2);
153 void spi_cs_deactivate(struct spi_slave *slave)
156 writel((1 << 24), GPSR2);
163 unsigned char reg[3] = { 0x74, 0x00, 0 };
164 unsigned char data[3] = { 0x76, 0, 0 };
165 unsigned char dummy[3] = { 0, 0, 0 };
168 writel(readl(GAFR0_L) | 0x00800000, GAFR0_L);
169 /* Enable clock to all PWM */
170 writel(readl(CKEN) | 0x3, CKEN);
172 writel(0x4f, PWM_CTRL2);
173 writel(0x2ff, PWM_PWDUTY2);
174 writel(792, PWM_PERVAL2);
176 /* Toggle the reset pin to reset the LCD */
177 writel((1 << 19), GPSR0);
179 writel((1 << 19), GPCR0);
181 writel((1 << 19), GPSR0);
184 /* Program the LCD init sequence */
185 for (i = 0; i < sizeof(lcd_data) / sizeof(lcd_data[0]); i++) {
188 reg[2] = lcd_data[i].reg;
189 spi_xfer(NULL, 24, reg, dummy, SPI_XFER_BEGIN | SPI_XFER_END);
192 data[1] = lcd_data[i].data >> 8;
193 data[2] = lcd_data[i].data & 0xff;
194 spi_xfer(NULL, 24, data, dummy, SPI_XFER_BEGIN | SPI_XFER_END);
196 if (lcd_data[i].mdelay)
197 udelay(lcd_data[i].mdelay * 1000);
200 writel((1 << 11), GPSR0);