Skip to content

Commit c8cee35

Browse files
Lukasz Majewskisverdlin
authored andcommitted
ARM: ep93xx: ts72xx: Add support for BK3 board - ts72xx derivative
The BK3 board is a derivative of the ts72xx reference design. Signed-off-by: Lukasz Majewski <lukma@denx.de> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
1 parent e41f1e8 commit c8cee35

5 files changed

Lines changed: 155 additions & 0 deletions

File tree

‎MAINTAINERS‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,12 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
12541254
S: Supported
12551255
F: drivers/net/ethernet/cavium/thunder/
12561256

1257+
ARM/CIRRUS LOGIC BK3 MACHINE SUPPORT
1258+
M: Lukasz Majewski <lukma@denx.de>
1259+
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1260+
S: Maintained
1261+
F: arch/arm/mach-ep93xx/ts72xx.c
1262+
12571263
ARM/CIRRUS LOGIC CLPS711X ARM ARCHITECTURE
12581264
M: Alexander Shiyan <shc_work@mail.ru>
12591265
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)

‎arch/arm/mach-ep93xx/Kconfig‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ config MACH_ADSSPHERE
2121
Say 'Y' here if you want your kernel to support the ADS
2222
Sphere board.
2323

24+
config MACH_BK3
25+
bool "Support Liebherr BK3.1"
26+
select MACH_TS72XX
27+
help
28+
Say 'Y' here if you want your kernel to support the
29+
Liebherr controller BK3.1.
30+
2431
config MACH_EDB93XX
2532
bool
2633

‎arch/arm/mach-ep93xx/ts72xx.c‎

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@
1919
#include <linux/mtd/rawnand.h>
2020
#include <linux/mtd/partitions.h>
2121
#include <linux/spi/spi.h>
22+
#include <linux/spi/flash.h>
23+
#include <linux/spi/mmc_spi.h>
24+
#include <linux/mmc/host.h>
2225
#include <linux/platform_data/spi-ep93xx.h>
2326

2427
#include <mach/gpio-ep93xx.h>
2528
#include <mach/hardware.h>
29+
#include <mach/irqs.h>
30+
#include <mach/gpio-ep93xx.h>
2631

2732
#include <asm/mach-types.h>
2833
#include <asm/mach/map.h>
@@ -50,6 +55,11 @@ static struct map_desc ts72xx_io_desc[] __initdata = {
5055
.pfn = __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE),
5156
.length = TS72XX_OPTIONS2_SIZE,
5257
.type = MT_DEVICE,
58+
}, {
59+
.virtual = (unsigned long)TS72XX_CPLDVER_VIRT_BASE,
60+
.pfn = __phys_to_pfn(TS72XX_CPLDVER_PHYS_BASE),
61+
.length = TS72XX_CPLDVER_SIZE,
62+
.type = MT_DEVICE,
5363
}
5464
};
5565

@@ -211,6 +221,69 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
211221
.phy_id = 1,
212222
};
213223

224+
/*************************************************************************
225+
* SPI SD/MMC host
226+
*************************************************************************/
227+
#define BK3_EN_SDCARD_PHYS_BASE 0x12400000
228+
#define BK3_EN_SDCARD_PWR 0x0
229+
#define BK3_DIS_SDCARD_PWR 0x0C
230+
static void bk3_mmc_spi_setpower(struct device *dev, unsigned int vdd)
231+
{
232+
void __iomem *pwr_sd = ioremap(BK3_EN_SDCARD_PHYS_BASE, SZ_4K);
233+
234+
if (!pwr_sd) {
235+
pr_err("Failed to enable SD card power!");
236+
return;
237+
}
238+
239+
pr_debug("%s: SD card pwr %s VDD:0x%x\n", __func__,
240+
!!vdd ? "ON" : "OFF", vdd);
241+
242+
if (!!vdd)
243+
__raw_writeb(BK3_EN_SDCARD_PWR, pwr_sd);
244+
else
245+
__raw_writeb(BK3_DIS_SDCARD_PWR, pwr_sd);
246+
247+
iounmap(pwr_sd);
248+
}
249+
250+
static struct mmc_spi_platform_data bk3_spi_mmc_data = {
251+
.detect_delay = 500,
252+
.powerup_msecs = 100,
253+
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
254+
.caps = MMC_CAP_NONREMOVABLE,
255+
.setpower = bk3_mmc_spi_setpower,
256+
};
257+
258+
/*************************************************************************
259+
* SPI Bus - SD card access
260+
*************************************************************************/
261+
static struct spi_board_info bk3_spi_board_info[] __initdata = {
262+
{
263+
.modalias = "mmc_spi",
264+
.platform_data = &bk3_spi_mmc_data,
265+
.max_speed_hz = 7.4E6,
266+
.bus_num = 0,
267+
.chip_select = 0,
268+
.mode = SPI_MODE_0,
269+
},
270+
};
271+
272+
/*
273+
* This is a stub -> the FGPIO[3] pin is not connected on the schematic
274+
* The all work is performed automatically by !SPI_FRAME (SFRM1) and
275+
* goes through CPLD
276+
*/
277+
static int bk3_spi_chipselects[] __initdata = {
278+
EP93XX_GPIO_LINE_F(3),
279+
};
280+
281+
static struct ep93xx_spi_info bk3_spi_master __initdata = {
282+
.chipselect = bk3_spi_chipselects,
283+
.num_chipselect = ARRAY_SIZE(bk3_spi_chipselects),
284+
.use_dma = 1,
285+
};
286+
214287
/*************************************************************************
215288
* TS72XX support code
216289
*************************************************************************/
@@ -285,3 +358,66 @@ MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
285358
.init_late = ep93xx_init_late,
286359
.restart = ep93xx_restart,
287360
MACHINE_END
361+
362+
/*************************************************************************
363+
* EP93xx I2S audio peripheral handling
364+
*************************************************************************/
365+
static struct resource ep93xx_i2s_resource[] = {
366+
DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100),
367+
DEFINE_RES_IRQ_NAMED(IRQ_EP93XX_SAI, "spilink i2s slave"),
368+
};
369+
370+
static struct platform_device ep93xx_i2s_device = {
371+
.name = "ep93xx-spilink-i2s",
372+
.id = -1,
373+
.num_resources = ARRAY_SIZE(ep93xx_i2s_resource),
374+
.resource = ep93xx_i2s_resource,
375+
};
376+
377+
/*************************************************************************
378+
* BK3 support code
379+
*************************************************************************/
380+
static struct mtd_partition bk3_nand_parts[] = {
381+
{
382+
.name = "System",
383+
.offset = 0x00000000,
384+
.size = 0x01e00000,
385+
}, {
386+
.name = "Data",
387+
.offset = 0x01e00000,
388+
.size = 0x05f20000
389+
}, {
390+
.name = "RedBoot",
391+
.offset = 0x07d20000,
392+
.size = 0x002e0000,
393+
.mask_flags = MTD_WRITEABLE, /* force RO */
394+
},
395+
};
396+
397+
static void __init bk3_init_machine(void)
398+
{
399+
ep93xx_init_devices();
400+
401+
ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts),
402+
EP93XX_CS6_PHYS_BASE);
403+
404+
ep93xx_register_eth(&ts72xx_eth_data, 1);
405+
406+
ep93xx_register_spi(&bk3_spi_master, bk3_spi_board_info,
407+
ARRAY_SIZE(bk3_spi_board_info));
408+
409+
/* Configure ep93xx's I2S to use AC97 pins */
410+
ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97);
411+
platform_device_register(&ep93xx_i2s_device);
412+
}
413+
414+
MACHINE_START(BK3, "Liebherr controller BK3.1")
415+
/* Maintainer: Lukasz Majewski <lukma@denx.de> */
416+
.atag_offset = 0x100,
417+
.map_io = ts72xx_map_io,
418+
.init_irq = ep93xx_init_irq,
419+
.init_time = ep93xx_timer_init,
420+
.init_machine = bk3_init_machine,
421+
.init_late = ep93xx_init_late,
422+
.restart = ep93xx_restart,
423+
MACHINE_END

‎arch/arm/mach-ep93xx/ts72xx.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* febff000 22000000 4K model number register (bits 0-2)
1111
* febfe000 22400000 4K options register
1212
* febfd000 22800000 4K options register #2
13+
* febfc000 23400000 4K CPLD version register
1314
*/
1415

1516
#ifndef __TS72XX_H_
@@ -42,6 +43,10 @@
4243
#define TS72XX_OPTIONS2_TS9420 0x04
4344
#define TS72XX_OPTIONS2_TS9420_BOOT 0x02
4445

46+
#define TS72XX_CPLDVER_PHYS_BASE 0x23400000
47+
#define TS72XX_CPLDVER_VIRT_BASE IOMEM(0xfebfc000)
48+
#define TS72XX_CPLDVER_SIZE 0x00001000
49+
4550
#ifndef __ASSEMBLY__
4651

4752
static inline int ts72xx_model(void)

‎arch/arm/tools/mach-types‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ mxlads MACH_MXLADS MXLADS 1851
345345
linkstation_mini MACH_LINKSTATION_MINI LINKSTATION_MINI 1858
346346
afeb9260 MACH_AFEB9260 AFEB9260 1859
347347
imx27ipcam MACH_IMX27IPCAM IMX27IPCAM 1871
348+
bk3 MACH_BK3 BK3 1880
348349
rd88f6183ap_ge MACH_RD88F6183AP_GE RD88F6183AP_GE 1894
349350
realview_pba8 MACH_REALVIEW_PBA8 REALVIEW_PBA8 1897
350351
realview_pbx MACH_REALVIEW_PBX REALVIEW_PBX 1901

0 commit comments

Comments
 (0)