1/*
2 *  MikroTik RouterBOARD 750 definitions
3 *
4 *  Copyright (C) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
5 *
6 *  This program is free software; you can redistribute it and/or modify it
7 *  under the terms of the GNU General Public License version 2 as published
8 *  by the Free Software Foundation.
9 */
10#ifndef _MACH_RB750_H
11#define _MACH_RB750_H
12
13#include <linux/bitops.h>
14
15#define RB750_GPIO_LVC573_LE	0	/* Latch enable on LVC573 */
16#define RB750_GPIO_NAND_IO0	1	/* NAND I/O 0 */
17#define RB750_GPIO_NAND_IO1	2	/* NAND I/O 1 */
18#define RB750_GPIO_NAND_IO2	3	/* NAND I/O 2 */
19#define RB750_GPIO_NAND_IO3	4	/* NAND I/O 3 */
20#define RB750_GPIO_NAND_IO4	5	/* NAND I/O 4 */
21#define RB750_GPIO_NAND_IO5	6	/* NAND I/O 5 */
22#define RB750_GPIO_NAND_IO6	7	/* NAND I/O 6 */
23#define RB750_GPIO_NAND_IO7	8	/* NAND I/O 7 */
24#define RB750_GPIO_NAND_NCE	11	/* NAND Chip Enable (active low) */
25#define RB750_GPIO_NAND_RDY	12	/* NAND Ready */
26#define RB750_GPIO_NAND_CLE	14	/* NAND Command Latch Enable */
27#define RB750_GPIO_NAND_ALE	15	/* NAND Address Latch Enable */
28#define RB750_GPIO_NAND_NRE	16	/* NAND Read Enable (active low) */
29#define RB750_GPIO_NAND_NWE	17	/* NAND Write Enable (active low) */
30
31#define RB750_GPIO_BTN_RESET	1
32#define RB750_GPIO_SPI_CS0	2
33#define RB750_GPIO_LED_ACT	12
34#define RB750_GPIO_LED_PORT1	13
35#define RB750_GPIO_LED_PORT2	14
36#define RB750_GPIO_LED_PORT3	15
37#define RB750_GPIO_LED_PORT4	16
38#define RB750_GPIO_LED_PORT5	17
39
40#define RB750_LED_ACT		BIT(RB750_GPIO_LED_ACT)
41#define RB750_LED_PORT1		BIT(RB750_GPIO_LED_PORT1)
42#define RB750_LED_PORT2		BIT(RB750_GPIO_LED_PORT2)
43#define RB750_LED_PORT3		BIT(RB750_GPIO_LED_PORT3)
44#define RB750_LED_PORT4		BIT(RB750_GPIO_LED_PORT4)
45#define RB750_LED_PORT5		BIT(RB750_GPIO_LED_PORT5)
46#define RB750_NAND_NCE		BIT(RB750_GPIO_NAND_NCE)
47
48#define RB750_LVC573_LE		BIT(RB750_GPIO_LVC573_LE)
49
50#define RB750_LED_BITS	(RB750_LED_PORT1 | RB750_LED_PORT2 | RB750_LED_PORT3 | \
51			 RB750_LED_PORT4 | RB750_LED_PORT5 | RB750_LED_ACT)
52
53#define RB7XX_GPIO_NAND_NCE	0
54#define RB7XX_GPIO_MON		9
55#define RB7XX_GPIO_LED_ACT	11
56#define RB7XX_GPIO_USB_POWERON	13
57
58#define RB7XX_NAND_NCE		BIT(RB7XX_GPIO_NAND_NCE)
59#define RB7XX_LED_ACT		BIT(RB7XX_GPIO_LED_ACT)
60#define RB7XX_MONITOR		BIT(RB7XX_GPIO_MON)
61#define RB7XX_USB_POWERON	BIT(RB7XX_GPIO_USB_POWERON)
62
63struct rb750_led_data {
64	char	*name;
65	char	*default_trigger;
66	u32	mask;
67	int	active_low;
68};
69
70struct rb750_led_platform_data {
71	int			num_leds;
72	struct rb750_led_data	*leds;
73	void			(*latch_change)(u32 clear, u32 set);
74};
75
76struct rb7xx_nand_platform_data {
77	u32 nce_line;
78
79	void (*enable_pins)(void);
80	void (*disable_pins)(void);
81	void (*latch_change)(u32, u32);
82};
83
84#endif /* _MACH_RB750_H */