Changeset f64f7a2f in rtems


Ignore:
Timestamp:
Nov 21, 2017, 2:13:46 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
c59479f
Parents:
86a80ee1
git-author:
Sebastian Huber <sebastian.huber@…> (11/21/17 14:13:46)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/22/17 08:40:24)
Message:

bsp/qoriq: Implement bsp_reset()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/qoriq/startup/bspreset.c

    r86a80ee1 rf64f7a2f  
    88
    99/*
    10  * Copyright (c) 2010 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2010, 2017 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
    13  *  Obere Lagerstr. 30
     13 *  Dornierstr. 4
    1414 *  82178 Puchheim
    1515 *  Germany
     
    2121 */
    2222
    23 #include <stdbool.h>
     23#include <bsp/bootcard.h>
     24#include <bsp/fdt.h>
     25#include <bsp/qoriq.h>
    2426
    25 #include <bsp/bootcard.h>
     27#include <libfdt.h>
     28
     29static int find_rstcr_node(const void *fdt, int node)
     30{
     31  return fdt_node_offset_by_prop_value(fdt, node, "fsl,has-rstcr", NULL, 0);
     32}
    2633
    2734void bsp_reset(void)
    2835{
     36  rtems_interrupt_level level;
     37  const char *fdt;
     38
     39  rtems_interrupt_local_disable(level);
     40  (void) level;
     41
     42  fdt = bsp_fdt_get();
     43
     44  /* If we do not find a RSTCR, then loop forever */
    2945  while (true) {
    30     /* Do nothing */
     46    int node;
     47
     48    node = -1;
     49
     50    while ((node = find_rstcr_node(fdt, node)) >= 0) {
     51      const uint32_t *reg;
     52      int len;
     53
     54      reg = fdt_getprop(fdt, node, "reg", &len);
     55      if (reg != NULL && len >= 4) {
     56        volatile uint32_t *rstcr;
     57
     58        rstcr = (volatile uint32_t *)
     59          ((uintptr_t) &qoriq + fdt32_to_cpu(reg[0]) + 0xb0);
     60        *rstcr = 0x2;
     61      }
     62    }
    3163  }
    3264}
Note: See TracChangeset for help on using the changeset viewer.