Skip to content

Commit

Permalink
Fixup pflash build for ast refactor
Browse files Browse the repository at this point in the history
Fixes: 5b1bc2f
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
stewartsmith committed Jul 18, 2018
1 parent 13e9a66 commit f651e8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion external/common/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ARCH_OBJS := $(addprefix common-,$(ARCH_FILES:.c=.o))
# Arch links are like this so we can have dependencies work (so that we don't
# run the rule when the links exist), pretty build output (knowing the target
# name) and a list of the files so we can clean them up.
ARCH_LINKS ?= common/ast-sf-ctrl.c common/ast.h common/io.h
ARCH_LINKS ?= common/ast-sf-ctrl.c common/ast.h common/io.h common/lpc.h

arch_links: $(ARCH_LINKS)
common/ast.h : ../../include/ast.h | common
Expand All @@ -61,6 +61,9 @@ common/io.h : ../common/arch_flash_$(arch)_io.h | common
common/ast-sf-ctrl.c : ../../hw/ast-bmc/ast-sf-ctrl.c | common
$(Q_LN)ln -sf ../../hw/ast-bmc/ast-sf-ctrl.c common/ast-sf-ctrl.c

common/lpc.h: ../../include/lpc.h | common
$(Q_LN)ln -sf ../../include/lpc.h common/lpc.h

.PHONY: arch_clean
arch_clean:
rm -rf $(ARCH_OBJS) $(ARCH_LINKS)
Expand Down
10 changes: 9 additions & 1 deletion hw/ast-bmc/ast-sf-ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

#include <libflash/libflash.h>
#include <libflash/libflash-priv.h>
#include <lpc.h>
#ifdef __SKIBOOT__
#include "lpc.h"
#endif

#include "ast.h"

Expand Down Expand Up @@ -69,6 +71,7 @@ static const uint32_t ast_ct_hclk_divs[] = {
0xd, /* HCLK/5 */
};

#ifdef __SKIBOOT__
#define PNOR_AHB_ADDR 0x30000000
static uint32_t pnor_lpc_offset;

Expand Down Expand Up @@ -152,6 +155,7 @@ static int ast_copy_from_ahb(void *dst, uint32_t reg, uint32_t len)
prerror("AST_IO: Attempted read bytes access to %08x\n", reg);
return -EINVAL;
}
#endif /* __SKIBOOT__ */

static int ast_sf_start_cmd(struct ast_sf_ctrl *ct, uint8_t cmd)
{
Expand Down Expand Up @@ -942,7 +946,9 @@ static int ast_mem_erase(struct spi_flash_ctrl *ctrl, uint32_t addr, uint32_t si
int ast_sf_open(uint8_t type, struct spi_flash_ctrl **ctrl)
{
struct ast_sf_ctrl *ct;
#ifdef __SKIBOOT__
uint32_t hicr7;
#endif /* __SKIBOOT__ */

if (type != AST_SF_TYPE_PNOR && type != AST_SF_TYPE_BMC
&& type != AST_SF_TYPE_MEM)
Expand Down Expand Up @@ -985,13 +991,15 @@ int ast_sf_open(uint8_t type, struct spi_flash_ctrl **ctrl)
goto fail;
}

#ifdef __SKIBOOT__
/* Read the configuration of the LPC->AHB bridge for PNOR
* to extract the PNOR LPC offset which can be different
* depending on flash size
*/
hicr7 = ast_ahb_readl(LPC_HICR7);
pnor_lpc_offset = (hicr7 & 0xffffu) << 16;
prlog(PR_DEBUG, "AST: PNOR LPC offset: 0x%08x\n", pnor_lpc_offset);
#endif /* __SKIBOOT__ */

*ctrl = &ct->ops;

Expand Down

0 comments on commit f651e8e

Please sign in to comment.