Merge branch 'for-next/misc'
Conflicts: commands/devinfo.c
This commit is contained in:
commit
6331e58a2c
|
@ -82,6 +82,7 @@ obj-$(CONFIG_MACH_RPI) += raspberry-pi/
|
|||
obj-$(CONFIG_MACH_SABRELITE) += freescale-mx6-sabrelite/
|
||||
obj-$(CONFIG_MACH_SABRESD) += freescale-mx6-sabresd/
|
||||
obj-$(CONFIG_MACH_SAMA5D3XEK) += sama5d3xek/
|
||||
obj-$(CONFIG_MACH_SAMA5D3_XPLAINED) += sama5d3_xplained/
|
||||
obj-$(CONFIG_MACH_SCB9328) += scb9328/
|
||||
obj-$(CONFIG_MACH_SOCFPGA_EBV_SOCRATES) += ebv-socrates/
|
||||
obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += terasic-sockit/
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
obj-y += init.o
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
|
||||
# use 'dhcp' to do dhcp in barebox and in kernel
|
||||
# use 'none' if you want to skip kernel ip autoconfiguration
|
||||
ip=dhcp-barebox
|
||||
|
||||
# or set your networking parameters here
|
||||
#eth0.ipaddr=a.b.c.d
|
||||
#eth0.netmask=a.b.c.d
|
||||
#eth0.gateway=a.b.c.d
|
||||
#eth0.serverip=a.b.c.d
|
||||
|
||||
# can be either 'nfs', 'tftp', 'nor' or 'nand'
|
||||
kernel_loc=nfs
|
||||
# can be either 'net', 'nor', 'nand' or 'initrd'
|
||||
rootfs_loc=net
|
||||
# can be either 'nfs', 'tftp', 'nand' or empty
|
||||
oftree_loc=nfs
|
||||
|
||||
# can be either 'jffs2' or 'ubifs'
|
||||
rootfs_type=ubifs
|
||||
rootfsimage=root.$rootfs_type
|
||||
ubiroot=rootfs
|
||||
|
||||
# The image type of the kernel. Can be uimage, zimage, raw, or raw_lzo
|
||||
kernelimage=zImage
|
||||
#kernelimage=uImage
|
||||
#kernelimage=Image
|
||||
#kernelimage=Image.lzo
|
||||
|
||||
nand_device=atmel_nand
|
||||
nand_parts="256k(at91bootstrap),384k(barebox)ro,256k@768k(bareboxenv),256k(bareboxenv2),128k@1536k(oftree),5M@2M(kernel),-@8M(rootfs)"
|
||||
rootfs_mtdblock_nand=6
|
||||
|
||||
m25p80_parts="64k(bootstrap),384k(barebox),256k(bareboxenv),256k(bareboxenv2),128k(oftree),-(updater)"
|
||||
|
||||
autoboot_timeout=3
|
||||
|
||||
bootargs="console=ttyS0,115200"
|
||||
|
||||
# set a fancy prompt (if support is compiled in)
|
||||
PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m\n# "
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* Copyright (C) 2014 Bo Shen <voice.shen@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <net.h>
|
||||
#include <init.h>
|
||||
#include <environment.h>
|
||||
#include <asm/armlinux.h>
|
||||
#include <generated/mach-types.h>
|
||||
#include <partition.h>
|
||||
#include <fs.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <nand.h>
|
||||
#include <sizes.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <mach/board.h>
|
||||
#include <mach/at91sam9_smc.h>
|
||||
#include <gpio.h>
|
||||
#include <mach/io.h>
|
||||
#include <mach/iomux.h>
|
||||
#include <mach/at91_pmc.h>
|
||||
#include <mach/at91_rstc.h>
|
||||
#include <mach/at91sam9x5_matrix.h>
|
||||
#include <readkey.h>
|
||||
#include <poller.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/micrel_phy.h>
|
||||
|
||||
#if defined(CONFIG_NAND_ATMEL)
|
||||
static struct atmel_nand_data nand_pdata = {
|
||||
.ale = 21,
|
||||
.cle = 22,
|
||||
.det_pin = -EINVAL,
|
||||
.rdy_pin = -EINVAL,
|
||||
.enable_pin = -EINVAL,
|
||||
.ecc_mode = NAND_ECC_HW,
|
||||
.pmecc_sector_size = 512,
|
||||
.pmecc_corr_cap = 4,
|
||||
#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
|
||||
.bus_width_16 = 1,
|
||||
#endif
|
||||
.on_flash_bbt = 1,
|
||||
};
|
||||
|
||||
static struct sam9_smc_config sama5d3_xplained_nand_smc_config = {
|
||||
.ncs_read_setup = 0,
|
||||
.nrd_setup = 1,
|
||||
.ncs_write_setup = 0,
|
||||
.nwe_setup = 1,
|
||||
|
||||
.ncs_read_pulse = 6,
|
||||
.nrd_pulse = 4,
|
||||
.ncs_write_pulse = 5,
|
||||
.nwe_pulse = 3,
|
||||
|
||||
.read_cycle = 6,
|
||||
.write_cycle = 5,
|
||||
|
||||
.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
|
||||
.tdf_cycles = 1,
|
||||
};
|
||||
|
||||
static void ek_add_device_nand(void)
|
||||
{
|
||||
struct clk *clk = clk_get(NULL, "smc_clk");
|
||||
|
||||
clk_enable(clk);
|
||||
|
||||
/* setup bus-width (8 or 16) */
|
||||
if (nand_pdata.bus_width_16)
|
||||
sama5d3_xplained_nand_smc_config.mode |= AT91_SMC_DBW_16;
|
||||
else
|
||||
sama5d3_xplained_nand_smc_config.mode |= AT91_SMC_DBW_8;
|
||||
|
||||
/* configure chip-select 3 (NAND) */
|
||||
sam9_smc_configure(0, 3, &sama5d3_xplained_nand_smc_config);
|
||||
|
||||
at91_add_device_nand(&nand_pdata);
|
||||
}
|
||||
#else
|
||||
static void ek_add_device_nand(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DRIVER_NET_MACB)
|
||||
static struct macb_platform_data gmac_pdata = {
|
||||
.phy_interface = PHY_INTERFACE_MODE_RGMII,
|
||||
.phy_addr = 7,
|
||||
};
|
||||
|
||||
static struct macb_platform_data macb_pdata = {
|
||||
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||
.phy_addr = 0,
|
||||
};
|
||||
|
||||
static void ek_add_device_eth(void)
|
||||
{
|
||||
at91_add_device_eth(0, &gmac_pdata);
|
||||
at91_add_device_eth(1, &macb_pdata);
|
||||
}
|
||||
#else
|
||||
static void ek_add_device_eth(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MCI_ATMEL)
|
||||
/*
|
||||
* MCI (SD/MMC)
|
||||
*/
|
||||
static struct atmel_mci_platform_data mci0_data = {
|
||||
.bus_width = 8,
|
||||
.detect_pin = AT91_PIN_PE0,
|
||||
.wp_pin = -EINVAL,
|
||||
};
|
||||
|
||||
static void ek_add_device_mci(void)
|
||||
{
|
||||
/* MMC0 */
|
||||
at91_add_device_mci(0, &mci0_data);
|
||||
}
|
||||
#else
|
||||
static void ek_add_device_mci(void) {}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LED_GPIO
|
||||
struct gpio_led leds[] = {
|
||||
{
|
||||
.gpio = AT91_PIN_PE23,
|
||||
.active_low = 1,
|
||||
.led = {
|
||||
.name = "d2",
|
||||
},
|
||||
}, {
|
||||
.gpio = AT91_PIN_PE24,
|
||||
.active_low = 1,
|
||||
.led = {
|
||||
.name = "d3",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static void ek_add_led(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(leds); i++) {
|
||||
at91_set_gpio_output(leds[i].gpio, leds[i].active_low);
|
||||
led_gpio_register(&leds[i]);
|
||||
}
|
||||
led_set_trigger(LED_TRIGGER_HEARTBEAT, &leds[0].led);
|
||||
}
|
||||
#else
|
||||
static void ek_add_led(void) {}
|
||||
#endif
|
||||
|
||||
static int sama5d3_xplained_mem_init(void)
|
||||
{
|
||||
at91_add_device_sdram(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
mem_initcall(sama5d3_xplained_mem_init);
|
||||
|
||||
static const struct devfs_partition sama5d3_xplained_nand0_partitions[] = {
|
||||
{
|
||||
.offset = 0x00000,
|
||||
.size = SZ_256K,
|
||||
.flags = DEVFS_PARTITION_FIXED,
|
||||
.name = "at91bootstrap_raw",
|
||||
.bbname = "at91bootstrap",
|
||||
}, {
|
||||
.offset = DEVFS_PARTITION_APPEND, /* 256 KiB */
|
||||
.size = SZ_256K + SZ_128K,
|
||||
.flags = DEVFS_PARTITION_FIXED,
|
||||
.name = "self_raw",
|
||||
.bbname = "self0",
|
||||
},
|
||||
/* hole of 128 KiB */
|
||||
{
|
||||
.offset = SZ_512K + SZ_256K,
|
||||
.size = SZ_256K,
|
||||
.flags = DEVFS_PARTITION_FIXED,
|
||||
.name = "env_raw",
|
||||
.bbname = "env0",
|
||||
}, {
|
||||
.offset = DEVFS_PARTITION_APPEND, /* 1 MiB */
|
||||
.size = SZ_256K,
|
||||
.flags = DEVFS_PARTITION_FIXED,
|
||||
.name = "env_raw1",
|
||||
.bbname = "env1",
|
||||
}, {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
|
||||
static int sama5d3_xplained_devices_init(void)
|
||||
{
|
||||
ek_add_device_nand();
|
||||
ek_add_led();
|
||||
ek_add_device_eth();
|
||||
ek_add_device_mci();
|
||||
|
||||
devfs_create_partitions("nand0", sama5d3_xplained_nand0_partitions);
|
||||
|
||||
return 0;
|
||||
}
|
||||
device_initcall(sama5d3_xplained_devices_init);
|
||||
|
||||
static int sama5d3_xplained_console_init(void)
|
||||
{
|
||||
barebox_set_model("Atmel sama5d3_xplained");
|
||||
barebox_set_hostname("sama5d3_xplained");
|
||||
|
||||
at91_register_uart(0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
console_initcall(sama5d3_xplained_console_init);
|
||||
|
||||
static int sama5d3_xplained_main_clock(void)
|
||||
{
|
||||
at91_set_main_clock(12000000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
pure_initcall(sama5d3_xplained_main_clock);
|
|
@ -0,0 +1,82 @@
|
|||
CONFIG_ARCH_SAMA5D3=y
|
||||
CONFIG_MACH_SAMA5D3_XPLAINED=y
|
||||
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x60000
|
||||
CONFIG_AEABI=y
|
||||
# CONFIG_CMD_ARM_CPUINFO is not set
|
||||
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
|
||||
CONFIG_PBL_IMAGE=y
|
||||
CONFIG_MMU=y
|
||||
CONFIG_TEXT_BASE=0x26f00000
|
||||
CONFIG_MALLOC_SIZE=0xA00000
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_MALLOC_TLSF=y
|
||||
CONFIG_PROMPT="A5D3_XPLD:"
|
||||
CONFIG_LONGHELP=y
|
||||
CONFIG_GLOB=y
|
||||
CONFIG_PROMPT_HUSH_PS2="y"
|
||||
CONFIG_HUSH_FANCY_PROMPT=y
|
||||
CONFIG_CMDLINE_EDITING=y
|
||||
CONFIG_AUTO_COMPLETE=y
|
||||
CONFIG_CONSOLE_ACTIVATE_ALL=y
|
||||
CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
|
||||
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/sama5d3_xplained/env"
|
||||
CONFIG_CMD_EDIT=y
|
||||
CONFIG_CMD_SLEEP=y
|
||||
CONFIG_CMD_SAVEENV=y
|
||||
CONFIG_CMD_EXPORT=y
|
||||
CONFIG_CMD_PRINTENV=y
|
||||
CONFIG_CMD_READLINE=y
|
||||
CONFIG_CMD_TFTP=y
|
||||
CONFIG_CMD_FILETYPE=y
|
||||
CONFIG_CMD_ECHO_E=y
|
||||
CONFIG_CMD_LOADB=y
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_FLASH=y
|
||||
CONFIG_CMD_BOOTM_SHOW_TYPE=y
|
||||
CONFIG_CMD_BOOTM_VERBOSE=y
|
||||
CONFIG_CMD_BOOTM_INITRD=y
|
||||
CONFIG_CMD_BOOTM_OFTREE=y
|
||||
CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
|
||||
CONFIG_CMD_UIMAGE=y
|
||||
# CONFIG_CMD_BOOTU is not set
|
||||
CONFIG_CMD_RESET=y
|
||||
CONFIG_CMD_GO=y
|
||||
CONFIG_CMD_OFTREE=y
|
||||
CONFIG_CMD_SPLASH=y
|
||||
CONFIG_CMD_TIMEOUT=y
|
||||
CONFIG_CMD_PARTITION=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_I2C=y
|
||||
CONFIG_CMD_LED=y
|
||||
CONFIG_CMD_LED_TRIGGER=y
|
||||
CONFIG_CMD_MIITOOL=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_DHCP=y
|
||||
CONFIG_NET_NFS=y
|
||||
CONFIG_NET_PING=y
|
||||
CONFIG_NET_NETCONSOLE=y
|
||||
CONFIG_DRIVER_NET_MACB=y
|
||||
CONFIG_MICREL_PHY=y
|
||||
# CONFIG_SPI is not set
|
||||
CONFIG_I2C=y
|
||||
CONFIG_MTD=y
|
||||
# CONFIG_MTD_OOB_DEVICE is not set
|
||||
CONFIG_NAND=y
|
||||
# CONFIG_NAND_ECC_SOFT is not set
|
||||
# CONFIG_NAND_ECC_HW_SYNDROME is not set
|
||||
# CONFIG_NAND_ECC_HW_NONE is not set
|
||||
CONFIG_NAND_ATMEL=y
|
||||
CONFIG_NAND_ATMEL_PMECC=y
|
||||
CONFIG_VIDEO=y
|
||||
CONFIG_MCI=y
|
||||
CONFIG_MCI_STARTUP=y
|
||||
CONFIG_MCI_ATMEL=y
|
||||
CONFIG_LED=y
|
||||
CONFIG_LED_GPIO=y
|
||||
CONFIG_LED_TRIGGERS=y
|
||||
CONFIG_FS_EXT4=y
|
||||
CONFIG_FS_TFTP=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_FAT_WRITE=y
|
||||
CONFIG_FS_FAT_LFN=y
|
||||
CONFIG_PNG=y
|
|
@ -461,6 +461,11 @@ config MACH_SAMA5D3XEK
|
|||
help
|
||||
Select this if you are using Atmel's SAMA5D3X-EK Evaluation Kit.
|
||||
|
||||
config MACH_SAMA5D3_XPLAINED
|
||||
bool "Atmel SAMA5D3_XPLAINED Evaluation Kit"
|
||||
help
|
||||
Select this if you are using Atmel's SAMA5D3_XPLAINED Evaluation Kit.
|
||||
|
||||
endchoice
|
||||
|
||||
endif
|
||||
|
|
|
@ -33,9 +33,10 @@ static int do_devinfo_subtree(struct device_d *dev, int depth)
|
|||
list_for_each_entry(cdev, &dev->cdevs, devices_list) {
|
||||
for (i = 0; i < depth + 1; i++)
|
||||
printf(" ");
|
||||
printf("`-- 0x%08llx-0x%08llx: /dev/%s\n",
|
||||
printf("`-- 0x%08llx-0x%08llx (%10s): /dev/%s\n",
|
||||
cdev->offset,
|
||||
cdev->offset + cdev->size - 1,
|
||||
size_human_readable(cdev->size),
|
||||
cdev->name);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -734,6 +734,7 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
|
|||
char *p;
|
||||
glob_t globbuf = {};
|
||||
int ret;
|
||||
int rcode;
|
||||
# if __GNUC__
|
||||
/* Avoid longjmp clobbering */
|
||||
(void) &i;
|
||||
|
@ -753,8 +754,6 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
|
|||
child = &pi->progs[0];
|
||||
|
||||
if (child->group) {
|
||||
int rcode;
|
||||
|
||||
debug("non-subshell grouping\n");
|
||||
rcode = run_list_real(ctx, child->group);
|
||||
|
||||
|
@ -789,7 +788,9 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
|
|||
|
||||
free(name);
|
||||
p = insert_var_value(child->argv[i]);
|
||||
set_local_var(p, export_me);
|
||||
rcode = set_local_var(p, export_me);
|
||||
if (rcode)
|
||||
return 1;
|
||||
|
||||
if (p != child->argv[i])
|
||||
free(p);
|
||||
|
@ -798,7 +799,9 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
|
|||
}
|
||||
for (i = 0; is_assignment(child->argv[i]); i++) {
|
||||
p = insert_var_value(child->argv[i]);
|
||||
set_local_var(p, 0);
|
||||
rcode = set_local_var(p, 0);
|
||||
if (rcode)
|
||||
return 1;
|
||||
|
||||
if (p != child->argv[i]) {
|
||||
child->sp--;
|
||||
|
@ -808,7 +811,6 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
|
|||
if (child->sp) {
|
||||
char * str = NULL;
|
||||
struct p_context ctx1;
|
||||
int rcode;
|
||||
|
||||
str = make_string((child->argv + i));
|
||||
rcode = parse_string_outer(&ctx1, str, FLAG_EXIT_FROM_LOOP | FLAG_REPARSING);
|
||||
|
|
|
@ -238,27 +238,94 @@ static struct file_operations at25_fops = {
|
|||
.lseek = dev_lseek_default,
|
||||
};
|
||||
|
||||
static int at25_np_to_chip(struct device_d *dev,
|
||||
struct device_node *np,
|
||||
struct spi_eeprom *chip)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_OFDEVICE))
|
||||
return -ENODEV;
|
||||
|
||||
memset(chip, 0, sizeof(*chip));
|
||||
strncpy(chip->name, np->name, sizeof(chip->name));
|
||||
|
||||
if (of_property_read_u32(np, "size", &val) == 0 ||
|
||||
of_property_read_u32(np, "at25,byte-len", &val) == 0) {
|
||||
chip->size = val;
|
||||
} else {
|
||||
dev_err(dev, "Error: missing \"size\" property\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(np, "pagesize", &val) == 0 ||
|
||||
of_property_read_u32(np, "at25,page-size", &val) == 0) {
|
||||
chip->page_size = (u16)val;
|
||||
} else {
|
||||
dev_err(dev, "Error: missing \"pagesize\" property\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(np, "at25,addr-mode", &val) == 0) {
|
||||
chip->flags = (u16)val;
|
||||
} else {
|
||||
if (of_property_read_u32(np, "address-width", &val)) {
|
||||
dev_err(dev,
|
||||
"Error: missing \"address-width\" property\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
switch (val) {
|
||||
case 8:
|
||||
chip->flags |= EE_ADDR1;
|
||||
break;
|
||||
case 16:
|
||||
chip->flags |= EE_ADDR2;
|
||||
break;
|
||||
case 24:
|
||||
chip->flags |= EE_ADDR3;
|
||||
break;
|
||||
default:
|
||||
dev_err(dev,
|
||||
"Error: bad \"address-width\" property: %u\n",
|
||||
val);
|
||||
return -ENODEV;
|
||||
}
|
||||
if (of_find_property(np, "read-only", NULL))
|
||||
chip->flags |= EE_READONLY;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int at25_probe(struct device_d *dev)
|
||||
{
|
||||
int err, sr;
|
||||
int addrlen;
|
||||
struct at25_data *at25 = NULL;
|
||||
const struct spi_eeprom *chip;
|
||||
struct spi_eeprom *chip;
|
||||
|
||||
at25 = xzalloc(sizeof(*at25));
|
||||
|
||||
/* Chip description */
|
||||
chip = dev->platform_data;
|
||||
if (!chip) {
|
||||
dev_dbg(dev, "no chip description\n");
|
||||
err = -ENODEV;
|
||||
goto fail;
|
||||
if (dev->device_node) {
|
||||
err = at25_np_to_chip(dev, dev->device_node, &at25->chip);
|
||||
if (err)
|
||||
goto fail;
|
||||
} else {
|
||||
chip = dev->platform_data;
|
||||
if (!chip) {
|
||||
dev_dbg(dev, "no chip description\n");
|
||||
err = -ENODEV;
|
||||
goto fail;
|
||||
}
|
||||
at25->chip = *chip;
|
||||
}
|
||||
|
||||
/* For now we only support 8/16/24 bit addressing */
|
||||
if (chip->flags & EE_ADDR1) {
|
||||
if (at25->chip.flags & EE_ADDR1) {
|
||||
addrlen = 1;
|
||||
} else if (chip->flags & EE_ADDR2) {
|
||||
} else if (at25->chip.flags & EE_ADDR2) {
|
||||
addrlen = 2;
|
||||
} else if (chip->flags & EE_ADDR3) {
|
||||
} else if (at25->chip.flags & EE_ADDR3) {
|
||||
addrlen = 3;
|
||||
} else {
|
||||
dev_dbg(dev, "unsupported address type\n");
|
||||
|
@ -266,14 +333,12 @@ static int at25_probe(struct device_d *dev)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
at25 = xzalloc(sizeof(*at25));
|
||||
at25->chip = *chip;
|
||||
at25->addrlen = addrlen;
|
||||
at25->spi = dev->type_data;
|
||||
at25->spi->mode = SPI_MODE_0;
|
||||
at25->spi->bits_per_word = 8;
|
||||
at25->cdev.ops = &at25_fops;
|
||||
at25->cdev.size = chip->size;
|
||||
at25->cdev.size = at25->chip.size;
|
||||
at25->cdev.dev = dev;
|
||||
at25->cdev.name = at25->chip.name[0] ? at25->chip.name : DRIVERNAME;
|
||||
at25->cdev.priv = at25;
|
||||
|
@ -299,8 +364,17 @@ fail:
|
|||
return err;
|
||||
}
|
||||
|
||||
static __maybe_unused struct of_device_id at25_dt_ids[] = {
|
||||
{
|
||||
.compatible = "atmel,at25",
|
||||
}, {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
|
||||
static struct driver_d at25_driver = {
|
||||
.name = DRIVERNAME,
|
||||
.of_compatible = DRV_OF_COMPAT(at25_dt_ids),
|
||||
.probe = at25_probe,
|
||||
};
|
||||
device_spi_driver(at25_driver);
|
||||
|
|
|
@ -659,8 +659,10 @@ static const struct platform_device_id m25p_ids[] = {
|
|||
{ "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
|
||||
|
||||
/* Micron */
|
||||
{ "n25q128", INFO(0x20ba18, 0, 64 * 1024, 256, 0) },
|
||||
{ "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K) },
|
||||
{ "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, 0) },
|
||||
{ "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, 0) },
|
||||
{ "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, 0) },
|
||||
{ "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K) },
|
||||
|
||||
/* Spansion -- single (large) sector size only, at least
|
||||
* for the chips listed here (without boot sectors).
|
||||
|
|
|
@ -112,10 +112,13 @@ struct mtd_info *mtd_add_partition(struct mtd_info *mtd, off_t offset,
|
|||
part->numeraseregions = end - start;
|
||||
|
||||
part->read = mtd_part_read;
|
||||
part->write = mtd_part_write;
|
||||
part->erase = mtd_part_erase;
|
||||
if (IS_ENABLED(CONFIG_MTD_WRITE)) {
|
||||
part->write = mtd_part_write;
|
||||
part->erase = mtd_part_erase;
|
||||
part->block_markbad = mtd->block_markbad ? mtd_part_block_markbad : NULL;
|
||||
}
|
||||
|
||||
part->block_isbad = mtd->block_isbad ? mtd_part_block_isbad : NULL;
|
||||
part->block_markbad = mtd->block_markbad ? mtd_part_block_markbad : NULL;
|
||||
part->size = size;
|
||||
part->name = strdup(name);
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
/* get the precision */
|
||||
precision = -1;
|
||||
if (*fmt == '.') {
|
||||
++fmt;
|
||||
++fmt;
|
||||
if (isdigit(*fmt))
|
||||
precision = skip_atoi(&fmt);
|
||||
else if (*fmt == '*') {
|
||||
|
@ -534,7 +534,8 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
{
|
||||
int i;
|
||||
|
||||
i=vsnprintf(buf,size,fmt,args);
|
||||
i = vsnprintf(buf, size, fmt, args);
|
||||
|
||||
return (i >= size) ? (size - 1) : i;
|
||||
}
|
||||
EXPORT_SYMBOL(vscnprintf);
|
||||
|
@ -566,13 +567,13 @@ int sprintf(char * buf, const char *fmt, ...)
|
|||
int i;
|
||||
|
||||
va_start(args, fmt);
|
||||
i=vsprintf(buf,fmt,args);
|
||||
i = vsprintf(buf, fmt, args);
|
||||
va_end(args);
|
||||
return i;
|
||||
}
|
||||
EXPORT_SYMBOL(sprintf);
|
||||
|
||||
int snprintf(char * buf, size_t size, const char *fmt, ...)
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
int i;
|
||||
|
@ -620,7 +621,7 @@ EXPORT_SYMBOL(asprintf);
|
|||
|
||||
void __noreturn panic(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
putchar('\n');
|
||||
|
|
Loading…
Reference in New Issue