nmhw24: code cleanup
This commit is contained in:
parent
5345ae1a18
commit
70b14b3131
|
|
@ -22,10 +22,6 @@
|
|||
#include <asm/arch/clk_synthesizer.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/mmc_host_def.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <asm/arch/mem.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/emif.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <i2c.h>
|
||||
#include <miiphy.h>
|
||||
|
|
@ -121,9 +117,8 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
|
|||
|
||||
static BD_Context bdctx[3]; /* The descriptor contexts */
|
||||
|
||||
// #define CONFIG_OF_BOARD_SETUP
|
||||
// TODO: Why is this here, would belong to .h file
|
||||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
|
||||
static void request_and_set_gpio(int gpio, const char *name, int value)
|
||||
{
|
||||
|
|
@ -150,16 +145,20 @@ err_free_gpio:
|
|||
#define REQUEST_AND_SET_GPIO(N) request_and_set_gpio(N, #N, 1);
|
||||
#define REQUEST_AND_CLEAR_GPIO(N) request_and_set_gpio(N, #N, 0);
|
||||
|
||||
#endif
|
||||
|
||||
static void init_leds(void)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Only green color available
|
||||
static void set_status_led(int red, int green)
|
||||
{
|
||||
int bus;
|
||||
|
||||
/*
|
||||
* Note: Only green color LED is available in nmhw24
|
||||
* Enable LED when either red or green is desired.
|
||||
*/
|
||||
bus = da9063_claim_i2c_bus();
|
||||
da9063_set_gpio(PMIC_LED1, red | green);
|
||||
da9063_release_i2c_bus(bus);
|
||||
|
|
@ -169,6 +168,7 @@ static void set_indicator_led(int red, int green)
|
|||
{
|
||||
int bus;
|
||||
|
||||
/* See above */
|
||||
bus = da9063_claim_i2c_bus();
|
||||
da9063_set_gpio(PMIC_LED0, red | green);
|
||||
da9063_release_i2c_bus(bus);
|
||||
|
|
@ -177,9 +177,6 @@ static void set_indicator_led(int red, int green)
|
|||
|
||||
static void init_i2c(void)
|
||||
{
|
||||
// TODO: Create define for i2c busses
|
||||
// #define I2C_BUS_PMIC 0
|
||||
// #define I2C_BUS_EEPROM 2
|
||||
i2c_set_bus_num(0);
|
||||
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
|
||||
i2c_set_bus_num(2);
|
||||
|
|
@ -204,12 +201,10 @@ static int _bd_init(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* TODO: Check if we can finally remove this...
|
||||
if (bd_get_context(&bdctx[2], BD_EEPROM_ADDR, PARTITION_ADDRESS) != 0) {
|
||||
printf("%s() no valid partition table found\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
bd_register_context_list(bdctx, ARRAY_SIZE(bdctx));
|
||||
|
||||
|
|
@ -301,11 +296,6 @@ struct dpll_params dpll_ddr = {
|
|||
DDR3_CLOCK_FREQUENCY, OSC-1, 1, -1, -1, -1, -1
|
||||
};
|
||||
|
||||
static void pmic_fix_config(void)
|
||||
{
|
||||
/* TODO: Update later, currently no fixes are required */
|
||||
}
|
||||
|
||||
static void pmic_ignition_gate_on(void)
|
||||
{
|
||||
uint8_t val;
|
||||
|
|
@ -336,21 +326,12 @@ static void init_pmic_spl(void)
|
|||
|
||||
bus = da9063_claim_i2c_bus();
|
||||
|
||||
/* Fix old configs (mainly prototype boards) */
|
||||
pmic_fix_config();
|
||||
|
||||
/* Enable +3V3_GNSS (LDO6) */
|
||||
(void)da9063_set_reg(PMIC_REG_LDO6_CONT, PMIC_LDOx_EN_MASK);
|
||||
mdelay(2);
|
||||
|
||||
pmic_ignition_gate_on();
|
||||
|
||||
/* Trim RTC to compensate +18ppm crystal deviation */
|
||||
// TODO: Check, caps have been changed
|
||||
/*
|
||||
(void)da9063_set_reg(PMIC_REG_TRIM_CLDR, (-18*10)/19);
|
||||
*/
|
||||
|
||||
/* Enable charging of RTC backup capacitor (1mA, 3.1V) */
|
||||
(void)da9063_set_reg(PMIC_REG_BBAT_CONT, 0xAF);
|
||||
|
||||
|
|
@ -426,7 +407,6 @@ void sdram_init(void)
|
|||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
|
||||
// TODO: required?
|
||||
/*
|
||||
* Override for Ethernet link timeout definition,
|
||||
* with option to specify via environment variable linktimeout
|
||||
|
|
@ -468,7 +448,6 @@ static void init_ethernet(void)
|
|||
mdelay(1);
|
||||
gpio_set_value(GPIO_RST_ETH_N, 1);
|
||||
|
||||
// TODO: Check
|
||||
/* Give clocks time to stabilize */
|
||||
mdelay(1);
|
||||
}
|
||||
|
|
@ -640,10 +619,7 @@ static void get_hw_version(void)
|
|||
bd_get_hw_version(&hw_ver, &hw_rev);
|
||||
bd_get_hw_patch(&hw_patch);
|
||||
|
||||
printf("MB: V%d.%d\n", hw_ver, hw_rev);
|
||||
// TODO: Which one
|
||||
// printf("HW24: V%d.%d\n", hw_ver, hw_rev);
|
||||
|
||||
printf("HW24: V%d.%d\n", hw_ver, hw_rev);
|
||||
}
|
||||
|
||||
static void get_pmic_version(void)
|
||||
|
|
@ -880,9 +856,8 @@ int board_late_init(void)
|
|||
get_hw_version();
|
||||
get_pmic_version();
|
||||
|
||||
// TODO
|
||||
//set_root_partition();
|
||||
//set_devicetree_name();
|
||||
set_root_partition();
|
||||
set_devicetree_name();
|
||||
|
||||
/* Initialize pins */
|
||||
REQUEST_AND_CLEAR_GPIO(GPIO_WLAN_EN);
|
||||
|
|
@ -1042,6 +1017,7 @@ int board_fit_config_name_match(const char *name)
|
|||
|
||||
#if defined(CONFIG_OF_BOARD_SETUP) && !defined(CONFIG_SPL_BUILD)
|
||||
|
||||
#if 0
|
||||
static void ft_enable_node(void* blob, const char* name)
|
||||
{
|
||||
int node_ofs = -1;
|
||||
|
|
@ -1098,6 +1074,7 @@ static void ft_dcan(void *blob, int shield_type)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void ft_bootloader_version(void *blob)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@ void da9063_release_i2c_bus(int bus)
|
|||
revert_i2c_bus(bus);
|
||||
}
|
||||
|
||||
int da9063_get_reg(uint32_t reg, u8* val)
|
||||
int da9063_get_reg(uint32_t reg, uint8_t* val)
|
||||
{
|
||||
int ret;
|
||||
u8 temp;
|
||||
uint8_t temp;
|
||||
|
||||
/* Argument check */
|
||||
if ((reg >= 0x200) || (val==0)) {
|
||||
|
|
@ -86,7 +86,7 @@ int da9063_get_reg(uint32_t reg, u8* val)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int da9063_set_reg(uint32_t reg, u8 val)
|
||||
int da9063_set_reg(uint32_t reg, uint8_t val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -116,8 +116,8 @@ void da9063_set_gpio(unsigned bit, int state)
|
|||
{
|
||||
int pmic_reg;
|
||||
int ret;
|
||||
u8 bitmask;
|
||||
u8 reg = 0x00;
|
||||
uint8_t bitmask;
|
||||
uint8_t reg = 0x00;
|
||||
|
||||
if (bit <= 7) {
|
||||
pmic_reg = PMIC_REG_GPIO_MODE0_7;
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@
|
|||
#ifndef DA9063_H
|
||||
#define DA9063_H
|
||||
|
||||
// TODO: Add include for uint32_t (stdtypes.h)
|
||||
|
||||
/*
|
||||
TODO: Add include for uint32_t (stdtypes.h)
|
||||
#include <types.h>
|
||||
*/
|
||||
|
||||
#define CONFIG_PMIC_I2C_BUS 0
|
||||
#define CONFIG_PMIC_I2C_ADDR 0x58 /* Pages 0 and 1, Pages 2 and 3 -> 0x59 */
|
||||
|
|
@ -59,8 +61,8 @@ extern void da9063_init(int i2c_bus);
|
|||
extern int da9063_claim_i2c_bus(void);
|
||||
extern void da9063_release_i2c_bus(int bus);
|
||||
|
||||
extern int da9063_get_reg(uint32_t reg, u8* val);
|
||||
extern int da9063_set_reg(uint32_t reg, u8 val);
|
||||
extern int da9063_get_reg(uint32_t reg, uint8_t* val);
|
||||
extern int da9063_set_reg(uint32_t reg, uint8_t val);
|
||||
|
||||
extern void da9063_set_gpio(unsigned bit, int state);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
DEST=/media/sf_D_DRIVE/data/TFTP/nmhw24
|
||||
DEST_EMMC=$DEST/u-boot
|
||||
DEST_XMODEM=$DEST/u-boot
|
||||
|
||||
function copy_tftp {
|
||||
echo "Copying SPL (xModem) to $DEST_XMODEM"
|
||||
cp spl/u-boot-spl.bin $DEST_XMODEM/spl-u-boot-am335x-nmhw24.xmodem.bin
|
||||
|
||||
echo "Copying U-Boot (xModem) to $DEST_XMODEM"
|
||||
cp u-boot.bin $DEST_XMODEM/u-boot-am335x-nmhw24.xmodem.bin
|
||||
|
||||
|
||||
echo "Copying SPL (eMMC) to $DEST_EMMC"
|
||||
cp MLO $DEST_EMMC/spl-u-boot-am335x-nmhw24.img
|
||||
|
||||
echo "Copying U-Boot (eMMC) to $DEST_EMMC"
|
||||
cp u-boot.img $DEST_EMMC/u-boot-am335x-nmhw24.img
|
||||
}
|
||||
|
||||
function build {
|
||||
echo "Building NMHW24 U-Boot"
|
||||
# make am335x_nmhw24_defconfig
|
||||
make -j4
|
||||
}
|
||||
|
||||
#echo ${ARCH+x}
|
||||
#if [ -z ${ARCH+x} ]; then
|
||||
# echo "Sourcing toolchain";
|
||||
# source /opt/netmodule-linux/0.1.0/environment-setup-cortexa8hf-neon-netmodule-linux-gnueabi
|
||||
#else
|
||||
# echo "Toolchain already sourced";
|
||||
#fi
|
||||
# TODO: if not working, tells us toochain already installed
|
||||
source /opt/netmodule-linux/0.1.0/environment-setup-cortexa8hf-neon-netmodule-linux-gnueabi
|
||||
|
||||
build
|
||||
copy_tftp
|
||||
Loading…
Reference in New Issue