]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/zipitz2/zipitz2.c
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 #include <asm/mach-types.h>
21 DECLARE_GLOBAL_DATA_PTR
;
26 inline void lcd_start(void) {};
30 * Miscelaneous platform dependent initialisations
34 /* arch number of Z2 */
35 gd
->bd
->bi_arch_number
= MACH_TYPE_ZIPIT2
;
37 /* adress of boot parameters */
38 gd
->bd
->bi_boot_params
= 0xa0000100;
49 gd
->ram_size
= PHYS_SDRAM_1_SIZE
;
54 int board_usb_init(int index
, enum usb_init_type init
)
57 writel(readl(UP2OCR
) | UP2OCR_HXOE
| UP2OCR_HXS
|
58 UP2OCR_DMPDE
| UP2OCR_DPPDE
, UP2OCR
);
63 int board_usb_cleanup(int index
, enum usb_init_type init
)
68 void usb_board_stop(void)
73 int dram_init_banksize(void)
75 gd
->bd
->bi_dram
[0].start
= PHYS_SDRAM_1
;
76 gd
->bd
->bi_dram
[0].size
= PHYS_SDRAM_1_SIZE
;
82 int board_mmc_init(bd_t
*bis
)
101 { 0x13, 0x0040, 50 },
103 { 0x13, 0x0070, 200 },
129 { 0x07, 0x0015, 30 },
136 void zipitz2_spi_sda(int set
)
140 writel((1 << 13), GPSR0
);
142 writel((1 << 13), GPCR0
);
145 void zipitz2_spi_scl(int set
)
149 writel((1 << 22), GPCR0
);
151 writel((1 << 22), GPSR0
);
154 unsigned char zipitz2_spi_read(void)
157 return !!(readl(GPLR1
) & (1 << 8));
160 int spi_cs_is_valid(unsigned int bus
, unsigned int cs
)
166 void spi_cs_activate(struct spi_slave
*slave
)
169 writel((1 << 24), GPCR2
);
172 void spi_cs_deactivate(struct spi_slave
*slave
)
175 writel((1 << 24), GPSR2
);
181 unsigned char reg
[3] = { 0x74, 0x00, 0 };
182 unsigned char data
[3] = { 0x76, 0, 0 };
183 unsigned char dummy
[3] = { 0, 0, 0 };
186 writel(readl(GAFR0_L
) | 0x00800000, GAFR0_L
);
187 /* Enable clock to all PWM */
188 writel(readl(CKEN
) | 0x3, CKEN
);
190 writel(0x4f, PWM_CTRL2
);
191 writel(0x2ff, PWM_PWDUTY2
);
192 writel(792, PWM_PERVAL2
);
194 /* Toggle the reset pin to reset the LCD */
195 writel((1 << 19), GPSR0
);
197 writel((1 << 19), GPCR0
);
199 writel((1 << 19), GPSR0
);
202 /* Program the LCD init sequence */
203 for (i
= 0; i
< sizeof(lcd_data
) / sizeof(lcd_data
[0]); i
++) {
206 reg
[2] = lcd_data
[i
].reg
;
207 spi_xfer(NULL
, 24, reg
, dummy
, SPI_XFER_BEGIN
| SPI_XFER_END
);
210 data
[1] = lcd_data
[i
].data
>> 8;
211 data
[2] = lcd_data
[i
].data
& 0xff;
212 spi_xfer(NULL
, 24, data
, dummy
, SPI_XFER_BEGIN
| SPI_XFER_END
);
214 if (lcd_data
[i
].mdelay
)
215 udelay(lcd_data
[i
].mdelay
* 1000);
218 writel((1 << 11), GPSR0
);