Skip to content

Commit 24cf58a

Browse files
pistachio: marduk: Switch on heartbeat LED
Signed-off-by: Francois Berder <[email protected]>
1 parent be81566 commit 24cf58a

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

board/imgtec/pistachio_bub/mfio.c

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,22 @@ static struct pistachio_mfio_reg pistachio_mfio_regs[] =
103103
{MFIO_89_FUNC_SEL_START, MFIO_89_FUNC_SEL_END},
104104
};
105105

106+
static void pistachio_select_gpio(u32 mfio, bool output)
107+
{
108+
u32 reg, val;
109+
reg = PISTACHIO_GPIO + 0x204 + (((mfio) / 16) * 0x24);
110+
val = 0x10000 | ((output) ? (1) : (0));
111+
val <<= (mfio % 16);
112+
__raw_writel(val, reg);
113+
}
114+
106115
static void pistachio_select_gpio_input(u32 mfio, bool gpio)
107116
{
108117
u32 reg, val;
109118

110-
if(gpio)
111-
{
112-
/* make GPIO input */
113-
reg = PISTACHIO_GPIO + 0x204 + (((mfio) / 16) * 0x24);
114-
val = 0x10000 << (mfio % 16);
115-
__raw_writel(val, reg);
119+
if (gpio) {
120+
/* make GPIO input */
121+
pistachio_select_gpio(mfio, 0);
116122
}
117123

118124
reg = PISTACHIO_GPIO + 0x200 + (((mfio) / 16) * 0x24);
@@ -308,3 +314,23 @@ void mfio_setup_usb_pwr(void)
308314
__raw_writel(val, USBPHYCONTROL0_ADDR);
309315
}
310316
#endif
317+
318+
#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
319+
/*
320+
* On Marduk, gpio 76 controls the heartbeat led.
321+
* This function configures it as an output and sets it to 1.
322+
*/
323+
void mfio_setup_led(void)
324+
{
325+
u32 reg, val;
326+
327+
/* make GPIO output */
328+
pistachio_select_gpio(76, 1);
329+
330+
/* Switch on LED */
331+
reg = PISTACHIO_GPIO + 0x208 + (((76) / 16) * 0x24);
332+
val = 0x10001;
333+
val <<= (76 % 16);
334+
__raw_writel(val, reg);
335+
}
336+
#endif

board/imgtec/pistachio_bub/mfio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,7 @@ void mfio_setup_i2c(u8 interface);
185185
defined(CONFIG_TARGET_PISTACHIO_BEETLE)
186186
void mfio_setup_usb_pwr(void);
187187
#endif
188+
189+
#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
190+
void mfio_setup_led(void);
191+
#endif

board/imgtec/pistachio_bub/spl_pistachio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ void spl_lowlevel_init(void) {
6565
*/
6666
setup_clk_gate_defaults();
6767

68+
#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
69+
/* Setup LED */
70+
mfio_setup_led();
71+
#endif
72+
6873
/* Setup SPIM1 MFIOs */
6974
mfio_setup_spim1();
7075

0 commit comments

Comments
 (0)