Merge branch 'for-next/rpi'
This commit is contained in:
commit
ded25480d8
|
@ -229,7 +229,7 @@ static void at91sam9x5ek_devices_detect_one(const char *name)
|
|||
|
||||
#define NODE_NAME_LEN 128
|
||||
|
||||
static int cm_cogent_fixup(struct device_node *root)
|
||||
static int cm_cogent_fixup(struct device_node *root, void *unused)
|
||||
{
|
||||
int ret;
|
||||
struct device_node *node;
|
||||
|
@ -260,5 +260,5 @@ void at91sam9x5ek_devices_detect_hw(void)
|
|||
armlinux_set_serial(sn);
|
||||
|
||||
if (at91sam9x5ek_cm_is_vendor(VENDOR_COGENT))
|
||||
of_register_fixup(cm_cogent_fixup);
|
||||
of_register_fixup(cm_cogent_fixup, NULL);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
struct fdt_header *fdt = NULL;
|
||||
|
||||
static int hb_fixup(struct device_node *root)
|
||||
static int hb_fixup(struct device_node *root, void *unused)
|
||||
{
|
||||
struct device_node *node;
|
||||
u32 reg = readl(sregs_base + HB_SREG_A9_PWRDOM_DATA);
|
||||
|
@ -108,7 +108,7 @@ mem_initcall(highbank_mem_init);
|
|||
|
||||
static int highbank_devices_init(void)
|
||||
{
|
||||
of_register_fixup(hb_fixup);
|
||||
of_register_fixup(hb_fixup, NULL);
|
||||
if (!fdt) {
|
||||
highbank_register_gpio(0);
|
||||
highbank_register_gpio(1);
|
||||
|
|
|
@ -5,4 +5,4 @@ if [ "$1" = menu ]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
global.linux.bootargs.base="console=ttymxc0,115200"
|
||||
global.linux.bootargs.base="console=ttyAMA0,115200"
|
||||
|
|
|
@ -15,15 +15,82 @@
|
|||
|
||||
#include <common.h>
|
||||
#include <init.h>
|
||||
#include <fs.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <envfs.h>
|
||||
#include <asm/armlinux.h>
|
||||
#include <generated/mach-types.h>
|
||||
|
||||
#include <mach/core.h>
|
||||
#include <mach/mbox.h>
|
||||
|
||||
struct msg_get_arm_mem {
|
||||
struct bcm2835_mbox_hdr hdr;
|
||||
struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
|
||||
u32 end_tag;
|
||||
};
|
||||
|
||||
struct msg_get_clock_rate {
|
||||
struct bcm2835_mbox_hdr hdr;
|
||||
struct bcm2835_mbox_tag_get_clock_rate get_clock_rate;
|
||||
u32 end_tag;
|
||||
};
|
||||
|
||||
static int rpi_get_arm_mem(u32 *size)
|
||||
{
|
||||
BCM2835_MBOX_STACK_ALIGN(struct msg_get_arm_mem, msg);
|
||||
int ret;
|
||||
|
||||
BCM2835_MBOX_INIT_HDR(msg);
|
||||
BCM2835_MBOX_INIT_TAG(&msg->get_arm_mem, GET_ARM_MEMORY);
|
||||
|
||||
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*size = msg->get_arm_mem.body.resp.mem_size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rpi_register_clkdev(u32 clock_id, const char *name)
|
||||
{
|
||||
BCM2835_MBOX_STACK_ALIGN(struct msg_get_clock_rate, msg);
|
||||
struct clk *clk;
|
||||
int ret;
|
||||
|
||||
BCM2835_MBOX_INIT_HDR(msg);
|
||||
BCM2835_MBOX_INIT_TAG(&msg->get_clock_rate, GET_CLOCK_RATE);
|
||||
msg->get_clock_rate.body.req.clock_id = clock_id;
|
||||
|
||||
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
clk = clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
|
||||
if (!clk_register_clkdev(clk, NULL, name))
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rpi_mem_init(void)
|
||||
{
|
||||
bcm2835_add_device_sdram(0);
|
||||
return 0;
|
||||
u32 size = 0;
|
||||
int ret;
|
||||
|
||||
ret = rpi_get_arm_mem(&size);
|
||||
if (ret)
|
||||
printf("could not query ARM memory size\n");
|
||||
|
||||
bcm2835_add_device_sdram(size);
|
||||
|
||||
return ret;
|
||||
}
|
||||
mem_initcall(rpi_mem_init);
|
||||
|
||||
|
@ -37,11 +104,46 @@ static int rpi_console_init(void)
|
|||
}
|
||||
console_initcall(rpi_console_init);
|
||||
|
||||
static int rpi_devices_init(void)
|
||||
static int rpi_clock_init(void)
|
||||
{
|
||||
armlinux_set_architecture(MACH_TYPE_BCM2708);
|
||||
armlinux_set_bootparams((void *)(0x00000100));
|
||||
rpi_register_clkdev(BCM2835_MBOX_CLOCK_ID_EMMC, "bcm2835_mci0");
|
||||
return 0;
|
||||
}
|
||||
postconsole_initcall(rpi_clock_init);
|
||||
|
||||
static int rpi_env_init(void)
|
||||
{
|
||||
struct stat s;
|
||||
const char *diskdev = "/dev/disk0.0";
|
||||
int ret;
|
||||
|
||||
device_detect_by_name("mci0");
|
||||
|
||||
ret = stat(diskdev, &s);
|
||||
if (ret) {
|
||||
printf("no %s. using default env\n", diskdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mkdir("/boot", 0666);
|
||||
ret = mount(diskdev, "fat", "/boot");
|
||||
if (ret) {
|
||||
printf("failed to mount %s\n", diskdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
default_environment_path = "/boot/barebox.env";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
device_initcall(rpi_devices_init);
|
||||
static int rpi_devices_init(void)
|
||||
{
|
||||
bcm2835_register_mci();
|
||||
bcm2835_register_fb();
|
||||
armlinux_set_architecture(MACH_TYPE_BCM2708);
|
||||
armlinux_set_bootparams((void *)(0x00000100));
|
||||
rpi_env_init();
|
||||
return 0;
|
||||
}
|
||||
late_initcall(rpi_devices_init);
|
||||
|
|
|
@ -1,41 +1,66 @@
|
|||
CONFIG_ARCH_BCM2835=y
|
||||
CONFIG_GPIO_BCM2835=y
|
||||
CONFIG_AEABI=y
|
||||
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
|
||||
CONFIG_ARM_UNWIND=y
|
||||
CONFIG_MMU=y
|
||||
CONFIG_MALLOC_TLSF=y
|
||||
CONFIG_KALLSYMS=y
|
||||
CONFIG_PROMPT="R-Pi> "
|
||||
CONFIG_LONGHELP=y
|
||||
CONFIG_GLOB=y
|
||||
CONFIG_HUSH_FANCY_PROMPT=y
|
||||
CONFIG_CMDLINE_EDITING=y
|
||||
CONFIG_AUTO_COMPLETE=y
|
||||
CONFIG_MENU=y
|
||||
CONFIG_PARTITION=y
|
||||
CONFIG_BLSPEC=y
|
||||
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
|
||||
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/raspberry-pi/env"
|
||||
CONFIG_CMD_EDIT=y
|
||||
CONFIG_CMD_SLEEP=y
|
||||
CONFIG_CMD_MSLEEP=y
|
||||
CONFIG_CMD_SAVEENV=y
|
||||
CONFIG_CMD_LOADENV=y
|
||||
CONFIG_CMD_EXPORT=y
|
||||
CONFIG_CMD_PRINTENV=y
|
||||
CONFIG_CMD_READLINE=y
|
||||
CONFIG_CMD_LET=y
|
||||
CONFIG_CMD_MENU=y
|
||||
CONFIG_CMD_MENU_MANAGEMENT=y
|
||||
CONFIG_CMD_PASSWD=y
|
||||
CONFIG_CMD_TIME=y
|
||||
CONFIG_CMD_LN=y
|
||||
CONFIG_CMD_FILETYPE=y
|
||||
CONFIG_CMD_ECHO_E=y
|
||||
CONFIG_CMD_LOADB=y
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MTEST=y
|
||||
CONFIG_CMD_MTEST_ALTERNATIVE=y
|
||||
CONFIG_CMD_BOOTM_ZLIB=y
|
||||
CONFIG_CMD_BOOTM_BZLIB=y
|
||||
CONFIG_CMD_IOMEM=y
|
||||
CONFIG_CMD_MM=y
|
||||
CONFIG_CMD_CRC=y
|
||||
CONFIG_CMD_CRC_CMP=y
|
||||
CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_CMD_BOOTM_SHOW_TYPE=y
|
||||
CONFIG_CMD_BOOTM_VERBOSE=y
|
||||
CONFIG_CMD_BOOTM_INITRD=y
|
||||
CONFIG_CMD_BOOTM_OFTREE=y
|
||||
CONFIG_CMD_UIMAGE=y
|
||||
CONFIG_CMD_RESET=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_GO=y
|
||||
CONFIG_CMD_OFTREE=y
|
||||
CONFIG_CMD_OF_PROPERTY=y
|
||||
CONFIG_CMD_OF_NODE=y
|
||||
CONFIG_CMD_TIMEOUT=y
|
||||
CONFIG_CMD_PARTITION=y
|
||||
CONFIG_CMD_UNCOMPRESS=y
|
||||
CONFIG_CMD_MAGICVAR=y
|
||||
CONFIG_CMD_MAGICVAR_HELP=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_UNCOMPRESS=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DETECT=y
|
||||
CONFIG_SERIAL_AMBA_PL011=y
|
||||
CONFIG_MCI=y
|
||||
CONFIG_MCI_BCM2835=y
|
||||
CONFIG_GPIO_BCM2835=y
|
||||
CONFIG_FS_EXT4=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_FAT_WRITE=y
|
||||
CONFIG_FS_FAT_LFN=y
|
||||
CONFIG_SHA1=y
|
||||
CONFIG_SHA256=y
|
||||
|
|
|
@ -41,32 +41,38 @@ DEFINE_CPU_FNS(v7)
|
|||
|
||||
void __dma_clean_range(unsigned long start, unsigned long end)
|
||||
{
|
||||
cache_fns->dma_clean_range(start, end);
|
||||
if (cache_fns)
|
||||
cache_fns->dma_clean_range(start, end);
|
||||
}
|
||||
|
||||
void __dma_flush_range(unsigned long start, unsigned long end)
|
||||
{
|
||||
cache_fns->dma_flush_range(start, end);
|
||||
if (cache_fns)
|
||||
cache_fns->dma_flush_range(start, end);
|
||||
}
|
||||
|
||||
void __dma_inv_range(unsigned long start, unsigned long end)
|
||||
{
|
||||
cache_fns->dma_inv_range(start, end);
|
||||
if (cache_fns)
|
||||
cache_fns->dma_inv_range(start, end);
|
||||
}
|
||||
|
||||
void __mmu_cache_on(void)
|
||||
{
|
||||
cache_fns->mmu_cache_on();
|
||||
if (cache_fns)
|
||||
cache_fns->mmu_cache_on();
|
||||
}
|
||||
|
||||
void __mmu_cache_off(void)
|
||||
{
|
||||
cache_fns->mmu_cache_off();
|
||||
if (cache_fns)
|
||||
cache_fns->mmu_cache_off();
|
||||
}
|
||||
|
||||
void __mmu_cache_flush(void)
|
||||
{
|
||||
cache_fns->mmu_cache_flush();
|
||||
if (cache_fns)
|
||||
cache_fns->mmu_cache_flush();
|
||||
}
|
||||
|
||||
int arm_set_cache_functions(void)
|
||||
|
|
|
@ -70,7 +70,9 @@ static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
|
|||
endmem &= ~0x3fff;
|
||||
endmem -= SZ_16K; /* ttb */
|
||||
|
||||
if (!IS_ENABLED(CONFIG_PBL_IMAGE)) {
|
||||
if (IS_ENABLED(CONFIG_PBL_IMAGE)) {
|
||||
arm_set_cache_functions();
|
||||
} else {
|
||||
arm_early_mmu_cache_invalidate();
|
||||
mmu_early_enable(membase, memsize, endmem);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
obj-y += core.o
|
||||
obj-y += core.o mbox.o
|
||||
|
|
|
@ -32,45 +32,28 @@
|
|||
#include <mach/core.h>
|
||||
#include <linux/amba/bus.h>
|
||||
|
||||
enum brcm_clks {
|
||||
dummy, clk_ref_3, clk_ref_1, clks_max
|
||||
};
|
||||
|
||||
static struct clk *clks[clks_max];
|
||||
|
||||
static int bcm2835_clk_init(void)
|
||||
{
|
||||
int ret;
|
||||
struct clk *clk;
|
||||
|
||||
clks[dummy] = clk_fixed("dummy", 0);
|
||||
clks[clk_ref_3] = clk_fixed("ref3", 3 * 1000 * 1000);
|
||||
clks[clk_ref_1] = clk_fixed("ref1", 1 * 1000 * 1000);
|
||||
clk = clk_fixed("apb_pclk", 0);
|
||||
clk_register_clkdev(clk, "apb_pclk", NULL);
|
||||
|
||||
ret = clk_register_clkdev(clks[dummy], "apb_pclk", NULL);
|
||||
if (ret)
|
||||
goto clk_err;
|
||||
clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000);
|
||||
clk_register_clkdev(clk, NULL, "uart0-pl0110");
|
||||
|
||||
ret = clk_register_clkdev(clks[clk_ref_3], NULL, "uart0-pl0110");
|
||||
if (ret)
|
||||
goto clk_err;
|
||||
clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
|
||||
clk_register_clkdev(clk, NULL, "bcm2835-cs");
|
||||
|
||||
ret = clk_register_clkdev(clks[clk_ref_1], NULL, "bcm2835-cs");
|
||||
if (ret)
|
||||
goto clk_err;
|
||||
add_generic_device("bcm2835-cs", DEVICE_ID_SINGLE, NULL, BCM2835_ST_BASE, 0x1C, IORESOURCE_MEM, NULL);
|
||||
|
||||
return 0;
|
||||
|
||||
clk_err:
|
||||
return ret;
|
||||
|
||||
}
|
||||
postcore_initcall(bcm2835_clk_init);
|
||||
|
||||
static int bcm2835_dev_init(void)
|
||||
{
|
||||
add_generic_device("bcm2835-gpio", 0, NULL, BCM2835_GPIO_BASE, 0xB0, IORESOURCE_MEM, NULL);
|
||||
add_generic_device("bcm2835-cs", DEVICE_ID_SINGLE, NULL, BCM2835_ST_BASE, 0x1C, IORESOURCE_MEM, NULL);
|
||||
add_generic_device("bcm2835_mci", 0, NULL, BCM2835_EMMC_BASE, 0xFC, IORESOURCE_MEM, NULL);
|
||||
return 0;
|
||||
}
|
||||
coredevice_initcall(bcm2835_dev_init);
|
||||
|
|
|
@ -16,7 +16,20 @@
|
|||
#ifndef __BCM2835_CORE_H__
|
||||
#define __BCM2835_CORE_H__
|
||||
|
||||
#include <mach/platform.h>
|
||||
|
||||
void bcm2835_register_uart(void);
|
||||
void bcm2835_add_device_sdram(u32 size);
|
||||
|
||||
static void inline bcm2835_register_mci(void)
|
||||
{
|
||||
add_generic_device("bcm2835_mci", 0, NULL, BCM2835_EMMC_BASE, 0xFC,
|
||||
IORESOURCE_MEM, NULL);
|
||||
}
|
||||
|
||||
static void inline bcm2835_register_fb(void)
|
||||
{
|
||||
add_generic_device("bcm2835_fb", 0, NULL, 0, 0, 0, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,421 @@
|
|||
/*
|
||||
* based on U-Boot code
|
||||
*
|
||||
* (C) Copyright 2012 Stephen Warren
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _BCM2835_MBOX_H
|
||||
#define _BCM2835_MBOX_H
|
||||
|
||||
#include <common.h>
|
||||
|
||||
/*
|
||||
* The BCM2835 SoC contains (at least) two CPUs; the VideoCore (a/k/a "GPU")
|
||||
* and the ARM CPU. The ARM CPU is often thought of as the main CPU.
|
||||
* However, the VideoCore actually controls the initial SoC boot, and hides
|
||||
* much of the hardware behind a protocol. This protocol is transported
|
||||
* using the SoC's mailbox hardware module.
|
||||
*
|
||||
* The mailbox hardware supports passing 32-bit values back and forth.
|
||||
* Presumably by software convention of the firmware, the bottom 4 bits of the
|
||||
* value are used to indicate a logical channel, and the upper 28 bits are the
|
||||
* actual payload. Various channels exist using these simple raw messages. See
|
||||
* https://github.com/raspberrypi/firmware/wiki/Mailboxes for a list. As an
|
||||
* example, the messages on the power management channel are a bitmask of
|
||||
* devices whose power should be enabled.
|
||||
*
|
||||
* The property mailbox channel passes messages that contain the (16-byte
|
||||
* aligned) ARM physical address of a memory buffer. This buffer is passed to
|
||||
* the VC for processing, is modified in-place by the VC, and the address then
|
||||
* passed back to the ARM CPU as the response mailbox message to indicate
|
||||
* request completion. The buffers have a generic and extensible format; each
|
||||
* buffer contains a standard header, a list of "tags", and a terminating zero
|
||||
* entry. Each tag contains an ID indicating its type, and length fields for
|
||||
* generic parsing. With some limitations, an arbitrary set of tags may be
|
||||
* combined together into a single message buffer. This file defines structs
|
||||
* representing the header and many individual tag layouts and IDs.
|
||||
*/
|
||||
|
||||
/* Raw mailbox HW */
|
||||
|
||||
#define BCM2835_MBOX_PHYSADDR 0x2000b880
|
||||
|
||||
struct bcm2835_mbox_regs {
|
||||
u32 read;
|
||||
u32 rsvd0[5];
|
||||
u32 status;
|
||||
u32 config;
|
||||
u32 write;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_STATUS_WR_FULL 0x80000000
|
||||
#define BCM2835_MBOX_STATUS_RD_EMPTY 0x40000000
|
||||
|
||||
/* Lower 4-bits are channel ID */
|
||||
#define BCM2835_CHAN_MASK 0xf
|
||||
#define BCM2835_MBOX_PACK(chan, data) (((data) & (~BCM2835_CHAN_MASK)) | \
|
||||
(chan & BCM2835_CHAN_MASK))
|
||||
#define BCM2835_MBOX_UNPACK_CHAN(val) ((val) & BCM2835_CHAN_MASK)
|
||||
#define BCM2835_MBOX_UNPACK_DATA(val) ((val) & (~BCM2835_CHAN_MASK))
|
||||
|
||||
/* Property mailbox buffer structures */
|
||||
|
||||
#define BCM2835_MBOX_PROP_CHAN 8
|
||||
|
||||
/* All message buffers must start with this header */
|
||||
struct bcm2835_mbox_hdr {
|
||||
u32 buf_size;
|
||||
u32 code;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_REQ_CODE 0
|
||||
#define BCM2835_MBOX_RESP_CODE_SUCCESS 0x80000000
|
||||
|
||||
#define BCM2835_MBOX_STACK_ALIGN(type, name) \
|
||||
STACK_ALIGN_ARRAY(type, name, 1, BCM2835_CHAN_MASK + 1)
|
||||
|
||||
#define BCM2835_MBOX_INIT_HDR(_m_) { \
|
||||
memset((_m_), 0, sizeof(*(_m_))); \
|
||||
(_m_)->hdr.buf_size = sizeof(*(_m_)); \
|
||||
(_m_)->hdr.code = 0; \
|
||||
(_m_)->end_tag = 0; \
|
||||
}
|
||||
|
||||
/*
|
||||
* A message buffer contains a list of tags. Each tag must also start with
|
||||
* a standardized header.
|
||||
*/
|
||||
struct bcm2835_mbox_tag_hdr {
|
||||
u32 tag;
|
||||
u32 val_buf_size;
|
||||
u32 val_len;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_INIT_TAG(_t_, _id_) { \
|
||||
(_t_)->tag_hdr.tag = BCM2835_MBOX_TAG_##_id_; \
|
||||
(_t_)->tag_hdr.val_buf_size = sizeof((_t_)->body); \
|
||||
(_t_)->tag_hdr.val_len = sizeof((_t_)->body.req); \
|
||||
}
|
||||
|
||||
#define BCM2835_MBOX_INIT_TAG_NO_REQ(_t_, _id_) { \
|
||||
(_t_)->tag_hdr.tag = BCM2835_MBOX_TAG_##_id_; \
|
||||
(_t_)->tag_hdr.val_buf_size = sizeof((_t_)->body); \
|
||||
(_t_)->tag_hdr.val_len = 0; \
|
||||
}
|
||||
|
||||
/* When responding, the VC sets this bit in val_len to indicate a response */
|
||||
#define BCM2835_MBOX_TAG_VAL_LEN_RESPONSE 0x80000000
|
||||
|
||||
/*
|
||||
* Below we define the ID and struct for many possible tags. This header only
|
||||
* defines individual tag structs, not entire message structs, since in
|
||||
* general an arbitrary set of tags may be combined into a single message.
|
||||
* Clients of the mbox API are expected to define their own overall message
|
||||
* structures by combining the header, a set of tags, and a terminating
|
||||
* entry. For example,
|
||||
*
|
||||
* struct msg {
|
||||
* struct bcm2835_mbox_hdr hdr;
|
||||
* struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
|
||||
* ... perhaps other tags here ...
|
||||
* u32 end_tag;
|
||||
* };
|
||||
*/
|
||||
|
||||
#define BCM2835_MBOX_TAG_GET_ARM_MEMORY 0x00010005
|
||||
|
||||
struct bcm2835_mbox_tag_get_arm_mem {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
} req;
|
||||
struct {
|
||||
u32 mem_base;
|
||||
u32 mem_size;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_GET_CLOCK_RATE 0x00030002
|
||||
|
||||
#define BCM2835_MBOX_CLOCK_ID_EMMC 1
|
||||
#define BCM2835_MBOX_CLOCK_ID_UART 2
|
||||
#define BCM2835_MBOX_CLOCK_ID_ARM 3
|
||||
#define BCM2835_MBOX_CLOCK_ID_CORE 4
|
||||
#define BCM2835_MBOX_CLOCK_ID_V3D 5
|
||||
#define BCM2835_MBOX_CLOCK_ID_H264 6
|
||||
#define BCM2835_MBOX_CLOCK_ID_ISP 7
|
||||
#define BCM2835_MBOX_CLOCK_ID_SDRAM 8
|
||||
#define BCM2835_MBOX_CLOCK_ID_PIXEL 9
|
||||
#define BCM2835_MBOX_CLOCK_ID_PWM 10
|
||||
|
||||
struct bcm2835_mbox_tag_get_clock_rate {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
u32 clock_id;
|
||||
} req;
|
||||
struct {
|
||||
u32 clock_id;
|
||||
u32 rate_hz;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_ALLOCATE_BUFFER 0x00040001
|
||||
|
||||
struct bcm2835_mbox_tag_allocate_buffer {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
u32 alignment;
|
||||
} req;
|
||||
struct {
|
||||
u32 fb_address;
|
||||
u32 fb_size;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_RELEASE_BUFFER 0x00048001
|
||||
|
||||
struct bcm2835_mbox_tag_release_buffer {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
} req;
|
||||
struct {
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_BLANK_SCREEN 0x00040002
|
||||
|
||||
struct bcm2835_mbox_tag_blank_screen {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
/* bit 0 means on, other bits reserved */
|
||||
u32 state;
|
||||
} req;
|
||||
struct {
|
||||
u32 state;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
/* Physical means output signal */
|
||||
#define BCM2835_MBOX_TAG_GET_PHYSICAL_W_H 0x00040003
|
||||
#define BCM2835_MBOX_TAG_TEST_PHYSICAL_W_H 0x00044003
|
||||
#define BCM2835_MBOX_TAG_SET_PHYSICAL_W_H 0x00048003
|
||||
|
||||
struct bcm2835_mbox_tag_physical_w_h {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
/* req not used for get */
|
||||
struct {
|
||||
u32 width;
|
||||
u32 height;
|
||||
} req;
|
||||
struct {
|
||||
u32 width;
|
||||
u32 height;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
/* Virtual means display buffer */
|
||||
#define BCM2835_MBOX_TAG_GET_VIRTUAL_W_H 0x00040004
|
||||
#define BCM2835_MBOX_TAG_TEST_VIRTUAL_W_H 0x00044004
|
||||
#define BCM2835_MBOX_TAG_SET_VIRTUAL_W_H 0x00048004
|
||||
|
||||
struct bcm2835_mbox_tag_virtual_w_h {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
/* req not used for get */
|
||||
struct {
|
||||
u32 width;
|
||||
u32 height;
|
||||
} req;
|
||||
struct {
|
||||
u32 width;
|
||||
u32 height;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_GET_DEPTH 0x00040005
|
||||
#define BCM2835_MBOX_TAG_TEST_DEPTH 0x00044005
|
||||
#define BCM2835_MBOX_TAG_SET_DEPTH 0x00048005
|
||||
|
||||
struct bcm2835_mbox_tag_depth {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
/* req not used for get */
|
||||
struct {
|
||||
u32 bpp;
|
||||
} req;
|
||||
struct {
|
||||
u32 bpp;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_GET_PIXEL_ORDER 0x00040006
|
||||
#define BCM2835_MBOX_TAG_TEST_PIXEL_ORDER 0x00044005
|
||||
#define BCM2835_MBOX_TAG_SET_PIXEL_ORDER 0x00048006
|
||||
|
||||
#define BCM2835_MBOX_PIXEL_ORDER_BGR 0
|
||||
#define BCM2835_MBOX_PIXEL_ORDER_RGB 1
|
||||
|
||||
struct bcm2835_mbox_tag_pixel_order {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
/* req not used for get */
|
||||
struct {
|
||||
u32 order;
|
||||
} req;
|
||||
struct {
|
||||
u32 order;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_GET_ALPHA_MODE 0x00040007
|
||||
#define BCM2835_MBOX_TAG_TEST_ALPHA_MODE 0x00044007
|
||||
#define BCM2835_MBOX_TAG_SET_ALPHA_MODE 0x00048007
|
||||
|
||||
#define BCM2835_MBOX_ALPHA_MODE_0_OPAQUE 0
|
||||
#define BCM2835_MBOX_ALPHA_MODE_0_TRANSPARENT 1
|
||||
#define BCM2835_MBOX_ALPHA_MODE_IGNORED 2
|
||||
|
||||
struct bcm2835_mbox_tag_alpha_mode {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
/* req not used for get */
|
||||
struct {
|
||||
u32 alpha;
|
||||
} req;
|
||||
struct {
|
||||
u32 alpha;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_GET_PITCH 0x00040008
|
||||
|
||||
struct bcm2835_mbox_tag_pitch {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
} req;
|
||||
struct {
|
||||
u32 pitch;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
/* Offset of display window within buffer */
|
||||
#define BCM2835_MBOX_TAG_GET_VIRTUAL_OFFSET 0x00040009
|
||||
#define BCM2835_MBOX_TAG_TEST_VIRTUAL_OFFSET 0x00044009
|
||||
#define BCM2835_MBOX_TAG_SET_VIRTUAL_OFFSET 0x00048009
|
||||
|
||||
struct bcm2835_mbox_tag_virtual_offset {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
/* req not used for get */
|
||||
struct {
|
||||
u32 x;
|
||||
u32 y;
|
||||
} req;
|
||||
struct {
|
||||
u32 x;
|
||||
u32 y;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_GET_OVERSCAN 0x0004000a
|
||||
#define BCM2835_MBOX_TAG_TEST_OVERSCAN 0x0004400a
|
||||
#define BCM2835_MBOX_TAG_SET_OVERSCAN 0x0004800a
|
||||
|
||||
struct bcm2835_mbox_tag_overscan {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
/* req not used for get */
|
||||
struct {
|
||||
u32 top;
|
||||
u32 bottom;
|
||||
u32 left;
|
||||
u32 right;
|
||||
} req;
|
||||
struct {
|
||||
u32 top;
|
||||
u32 bottom;
|
||||
u32 left;
|
||||
u32 right;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_GET_PALETTE 0x0004000b
|
||||
|
||||
struct bcm2835_mbox_tag_get_palette {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
} req;
|
||||
struct {
|
||||
u32 data[1024];
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_TEST_PALETTE 0x0004400b
|
||||
|
||||
struct bcm2835_mbox_tag_test_palette {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
u32 offset;
|
||||
u32 num_entries;
|
||||
u32 data[256];
|
||||
} req;
|
||||
struct {
|
||||
u32 is_invalid;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
#define BCM2835_MBOX_TAG_SET_PALETTE 0x0004800b
|
||||
|
||||
struct bcm2835_mbox_tag_set_palette {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
u32 offset;
|
||||
u32 num_entries;
|
||||
u32 data[256];
|
||||
} req;
|
||||
struct {
|
||||
u32 is_invalid;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
/*
|
||||
* Pass a complete property-style buffer to the VC, and wait until it has
|
||||
* been processed.
|
||||
*
|
||||
* This function expects a pointer to the mbox_hdr structure in an attempt
|
||||
* to ensure some degree of type safety. However, some number of tags and
|
||||
* a termination value are expected to immediately follow the header in
|
||||
* memory, as required by the property protocol.
|
||||
*
|
||||
* Returns 0 for success, any other value for error.
|
||||
*/
|
||||
int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* based on U-Boot code
|
||||
*
|
||||
* (C) Copyright 2012 Stephen Warren
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/mmu.h>
|
||||
#include <common.h>
|
||||
#include <clock.h>
|
||||
|
||||
#include <mach/mbox.h>
|
||||
|
||||
#define TIMEOUT (MSECOND * 100) /* 100mS */
|
||||
|
||||
static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
|
||||
u32 *recv)
|
||||
{
|
||||
struct bcm2835_mbox_regs __iomem *regs =
|
||||
(struct bcm2835_mbox_regs *)BCM2835_MBOX_PHYSADDR;
|
||||
uint64_t starttime = get_time_ns();
|
||||
u32 send = virt_to_phys(buffer);
|
||||
u32 val;
|
||||
|
||||
if (send & BCM2835_CHAN_MASK) {
|
||||
printf("mbox: Illegal mbox data 0x%08x\n", send);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Drain any stale responses */
|
||||
for (;;) {
|
||||
val = readl(®s->status);
|
||||
if (val & BCM2835_MBOX_STATUS_RD_EMPTY)
|
||||
break;
|
||||
if (is_timeout(starttime, TIMEOUT)) {
|
||||
printf("mbox: Timeout draining stale responses\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
val = readl(®s->read);
|
||||
}
|
||||
|
||||
/* Wait for space to send */
|
||||
for (;;) {
|
||||
val = readl(®s->status);
|
||||
if (!(val & BCM2835_MBOX_STATUS_WR_FULL))
|
||||
break;
|
||||
if (is_timeout(starttime, TIMEOUT)) {
|
||||
printf("mbox: Timeout waiting for send space\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send the request */
|
||||
val = BCM2835_MBOX_PACK(chan, send);
|
||||
debug("mbox: TX raw: 0x%08x\n", val);
|
||||
dma_flush_range(send, send + buffer->buf_size);
|
||||
writel(val, ®s->write);
|
||||
|
||||
/* Wait for the response */
|
||||
for (;;) {
|
||||
val = readl(®s->status);
|
||||
if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY))
|
||||
break;
|
||||
if (is_timeout(starttime, TIMEOUT)) {
|
||||
printf("mbox: Timeout waiting for response\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the response */
|
||||
val = readl(®s->read);
|
||||
debug("mbox: RX raw: 0x%08x\n", val);
|
||||
dma_inv_range(send, send + buffer->buf_size);
|
||||
|
||||
/* Validate the response */
|
||||
if (BCM2835_MBOX_UNPACK_CHAN(val) != chan) {
|
||||
printf("mbox: Response channel mismatch\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
*recv = BCM2835_MBOX_UNPACK_DATA(val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void dump_buf(struct bcm2835_mbox_hdr *buffer)
|
||||
{
|
||||
u32 *p;
|
||||
u32 words;
|
||||
int i;
|
||||
|
||||
p = (u32 *)buffer;
|
||||
words = buffer->buf_size / 4;
|
||||
for (i = 0; i < words; i++)
|
||||
printf(" 0x%04x: 0x%08x\n", i * 4, p[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
|
||||
{
|
||||
int ret;
|
||||
u32 rbuffer;
|
||||
struct bcm2835_mbox_tag_hdr *tag;
|
||||
int tag_index;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mbox: TX buffer\n");
|
||||
dump_buf(buffer);
|
||||
#endif
|
||||
|
||||
ret = bcm2835_mbox_call_raw(chan, buffer, &rbuffer);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (rbuffer != (u32)buffer) {
|
||||
printf("mbox: Response buffer mismatch\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mbox: RX buffer\n");
|
||||
dump_buf(buffer);
|
||||
#endif
|
||||
|
||||
/* Validate overall response status */
|
||||
if (buffer->code != BCM2835_MBOX_RESP_CODE_SUCCESS) {
|
||||
printf("mbox: Header response code invalid\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* Validate each tag's response status */
|
||||
tag = (void *)(buffer + 1);
|
||||
tag_index = 0;
|
||||
while (tag->tag) {
|
||||
if (!(tag->val_len & BCM2835_MBOX_TAG_VAL_LEN_RESPONSE)) {
|
||||
printf("mbox: Tag %d missing val_len response bit\n",
|
||||
tag_index);
|
||||
return -EIO;
|
||||
}
|
||||
/*
|
||||
* Clear the reponse bit so clients can just look right at the
|
||||
* length field without extra processing
|
||||
*/
|
||||
tag->val_len &= ~BCM2835_MBOX_TAG_VAL_LEN_RESPONSE;
|
||||
tag = (void *)(((u8 *)tag) + sizeof(*tag) + tag->val_buf_size);
|
||||
tag_index++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -77,7 +77,7 @@ void __noreturn reset_cpu (unsigned long addr)
|
|||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_OFTREE
|
||||
static int of_mpc5200_fixup(struct device_node *root)
|
||||
static int of_mpc5200_fixup(struct device_node *root, void *unused)
|
||||
{
|
||||
struct device_node *node;
|
||||
|
||||
|
@ -103,7 +103,7 @@ static int of_mpc5200_fixup(struct device_node *root)
|
|||
|
||||
static int of_register_mpc5200_fixup(void)
|
||||
{
|
||||
return of_register_fixup(of_mpc5200_fixup);
|
||||
return of_register_fixup(of_mpc5200_fixup, NULL);
|
||||
}
|
||||
late_initcall(of_register_mpc5200_fixup);
|
||||
#endif
|
||||
|
|
|
@ -89,7 +89,7 @@ error:
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
static int fdt_cpu_setup(struct device_node *blob)
|
||||
static int fdt_cpu_setup(struct device_node *blob, void *unused)
|
||||
{
|
||||
struct device_node *node;
|
||||
struct sys_info sysinfo;
|
||||
|
@ -139,6 +139,6 @@ static int fdt_cpu_setup(struct device_node *blob)
|
|||
|
||||
static int of_register_mpc85xx_fixup(void)
|
||||
{
|
||||
return of_register_fixup(fdt_cpu_setup);
|
||||
return of_register_fixup(fdt_cpu_setup, NULL);
|
||||
}
|
||||
late_initcall(of_register_mpc85xx_fixup);
|
||||
|
|
|
@ -163,7 +163,7 @@ int release_sdram_region(struct resource *res)
|
|||
|
||||
#ifdef CONFIG_OFTREE
|
||||
|
||||
static int of_memory_fixup(struct device_node *node)
|
||||
static int of_memory_fixup(struct device_node *node, void *unused)
|
||||
{
|
||||
struct memory_bank *bank;
|
||||
int err;
|
||||
|
@ -200,7 +200,7 @@ static int of_memory_fixup(struct device_node *node)
|
|||
|
||||
static int of_register_memory_fixup(void)
|
||||
{
|
||||
return of_register_fixup(of_memory_fixup);
|
||||
return of_register_fixup(of_memory_fixup, NULL);
|
||||
}
|
||||
late_initcall(of_register_memory_fixup);
|
||||
#endif
|
||||
|
|
|
@ -113,7 +113,7 @@ void of_print_cmdline(struct device_node *root)
|
|||
printf("commandline: %s\n", cmdline);
|
||||
}
|
||||
|
||||
static int of_fixup_bootargs(struct device_node *root)
|
||||
static int of_fixup_bootargs(struct device_node *root, void *unused)
|
||||
{
|
||||
struct device_node *node;
|
||||
const char *str;
|
||||
|
@ -135,22 +135,24 @@ static int of_fixup_bootargs(struct device_node *root)
|
|||
|
||||
static int of_register_bootargs_fixup(void)
|
||||
{
|
||||
return of_register_fixup(of_fixup_bootargs);
|
||||
return of_register_fixup(of_fixup_bootargs, NULL);
|
||||
}
|
||||
late_initcall(of_register_bootargs_fixup);
|
||||
|
||||
struct of_fixup {
|
||||
int (*fixup)(struct device_node *);
|
||||
int (*fixup)(struct device_node *, void *);
|
||||
void *context;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
static LIST_HEAD(of_fixup_list);
|
||||
|
||||
int of_register_fixup(int (*fixup)(struct device_node *))
|
||||
int of_register_fixup(int (*fixup)(struct device_node *, void *), void *context)
|
||||
{
|
||||
struct of_fixup *of_fixup = xzalloc(sizeof(*of_fixup));
|
||||
|
||||
of_fixup->fixup = fixup;
|
||||
of_fixup->context = context;
|
||||
|
||||
list_add_tail(&of_fixup->list, &of_fixup_list);
|
||||
|
||||
|
@ -167,7 +169,7 @@ int of_fix_tree(struct device_node *node)
|
|||
int ret;
|
||||
|
||||
list_for_each_entry(of_fixup, &of_fixup_list, list) {
|
||||
ret = of_fixup->fixup(node);
|
||||
ret = of_fixup->fixup(node, of_fixup->context);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -87,4 +87,4 @@ static int bcm2835_cs_init(void)
|
|||
{
|
||||
return platform_driver_register(&bcm2835_cs_driver);
|
||||
}
|
||||
coredevice_initcall(bcm2835_cs_init);
|
||||
core_initcall(bcm2835_cs_init);
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <io.h>
|
||||
#include <malloc.h>
|
||||
#include <clock.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include "mci-bcm2835.h"
|
||||
#include "sdhci.h"
|
||||
|
||||
|
@ -468,53 +470,32 @@ int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev)
|
|||
return bcm2835_mci_wait_command_done(host);
|
||||
}
|
||||
|
||||
static u32 bcm2835_mci_get_emmc_clock(struct msg_get_clock_rate *clk_data)
|
||||
static int bcm2835_mci_detect(struct device_d *dev)
|
||||
{
|
||||
u32 val;
|
||||
struct bcm2835_mbox_regs *regs =
|
||||
(struct bcm2835_mbox_regs *) BCM2835_MBOX_PHYSADDR;
|
||||
struct bcm2835_mci_host *host = dev->priv;
|
||||
|
||||
/*Read out old msg*/
|
||||
while (true) {
|
||||
val = readl(®s->status);
|
||||
if (val & BCM2835_MBOX_STATUS_RD_EMPTY)
|
||||
break;
|
||||
val = readl(®s->read);
|
||||
}
|
||||
|
||||
/*Check for ok to write*/
|
||||
while (true) {
|
||||
val = readl(®s->status);
|
||||
if (!(val & BCM2835_MBOX_STATUS_WR_FULL))
|
||||
break;
|
||||
}
|
||||
val = BCM2835_MBOX_PROP_CHAN + ((u32) &clk_data->hdr);
|
||||
writel(val, ®s->write);
|
||||
|
||||
while (true) {
|
||||
/* Wait for the response */
|
||||
while (true) {
|
||||
val = readl(®s->status);
|
||||
if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Read the response */
|
||||
val = readl(®s->read);
|
||||
if ((val & 0x0F) == BCM2835_MBOX_PROP_CHAN)
|
||||
break;
|
||||
}
|
||||
if ((val & ~0x0F) == ((u32) &clk_data->hdr))
|
||||
if (clk_data->get_clock_rate.tag_hdr.val_len
|
||||
& BCM2835_MBOX_TAG_VAL_LEN_RESPONSE)
|
||||
return 1;
|
||||
return 0;
|
||||
return mci_detect_card(&host->mci);
|
||||
}
|
||||
|
||||
static int bcm2835_mci_probe(struct device_d *hw_dev)
|
||||
{
|
||||
struct bcm2835_mci_host *host;
|
||||
struct msg_get_clock_rate *clk_data;
|
||||
static struct clk *clk;
|
||||
int ret;
|
||||
|
||||
clk = clk_get(hw_dev, NULL);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
dev_err(hw_dev, "clock not found: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = clk_enable(clk);
|
||||
if (ret) {
|
||||
dev_err(hw_dev, "clock failed to enable: %d\n", ret);
|
||||
clk_put(clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
host = xzalloc(sizeof(*host));
|
||||
host->mci.send_cmd = bcm2835_mci_request;
|
||||
|
@ -522,31 +503,7 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
|
|||
host->mci.init = bcm2835_mci_reset;
|
||||
host->mci.hw_dev = hw_dev;
|
||||
host->hw_dev = hw_dev;
|
||||
|
||||
/* Allocate a buffer thats 16 bytes aligned in memory
|
||||
* Of the 32 bits address passed into the mbox 28 bits
|
||||
* are the address of the buffer, lower 4 bits is channel
|
||||
*/
|
||||
clk_data = memalign(16, sizeof(struct msg_get_clock_rate));
|
||||
memset(clk_data, 0, sizeof(struct msg_get_clock_rate));
|
||||
clk_data->hdr.buf_size = sizeof(struct msg_get_clock_rate);
|
||||
clk_data->get_clock_rate.tag_hdr.tag = BCM2835_MBOX_TAG_GET_CLOCK_RATE;
|
||||
clk_data->get_clock_rate.tag_hdr.val_buf_size =
|
||||
sizeof(clk_data->get_clock_rate.body);
|
||||
clk_data->get_clock_rate.tag_hdr.val_len =
|
||||
sizeof(clk_data->get_clock_rate.body.req);
|
||||
clk_data->get_clock_rate.body.req.clock_id = BCM2835_MBOX_CLOCK_ID_EMMC;
|
||||
|
||||
if (!bcm2835_mci_get_emmc_clock(clk_data)) {
|
||||
dev_warn(host->hw_dev,
|
||||
"Failed getting emmc clock, lets go anyway with 50MHz\n");
|
||||
host->max_clock = 50000000;
|
||||
} else {
|
||||
host->max_clock = clk_data->get_clock_rate.body.resp.rate_hz;
|
||||
dev_info(host->hw_dev, "Got emmc clock at %d Hz\n",
|
||||
host->max_clock);
|
||||
}
|
||||
|
||||
host->max_clock = clk_get_rate(clk);
|
||||
host->regs = dev_request_mem_region(hw_dev, 0);
|
||||
if (host->regs == NULL) {
|
||||
dev_err(host->hw_dev, "Failed request mem region, aborting...\n");
|
||||
|
@ -561,6 +518,9 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
|
|||
host->mci.f_min = MIN_FREQ;
|
||||
host->mci.f_max = host->max_clock;
|
||||
|
||||
hw_dev->priv = host;
|
||||
hw_dev->detect = bcm2835_mci_detect,
|
||||
|
||||
/*
|
||||
* The Arasan has a bugette whereby it may lose the content of
|
||||
* successive writes to registers that are within two SD-card clock
|
||||
|
|
|
@ -23,51 +23,3 @@
|
|||
|
||||
#define MAX_CLK_DIVIDER_V3 2046
|
||||
#define MAX_CLK_DIVIDER_V2 256
|
||||
|
||||
/*this is only for mbox comms*/
|
||||
#define BCM2835_MBOX_PHYSADDR 0x2000b880
|
||||
#define BCM2835_MBOX_TAG_GET_CLOCK_RATE 0x00030002
|
||||
#define BCM2835_MBOX_CLOCK_ID_EMMC 1
|
||||
#define BCM2835_MBOX_STATUS_WR_FULL 0x80000000
|
||||
#define BCM2835_MBOX_STATUS_RD_EMPTY 0x40000000
|
||||
#define BCM2835_MBOX_PROP_CHAN 8
|
||||
#define BCM2835_MBOX_TAG_VAL_LEN_RESPONSE 0x80000000
|
||||
|
||||
struct bcm2835_mbox_regs {
|
||||
u32 read;
|
||||
u32 rsvd0[5];
|
||||
u32 status;
|
||||
u32 config;
|
||||
u32 write;
|
||||
};
|
||||
|
||||
|
||||
struct bcm2835_mbox_hdr {
|
||||
u32 buf_size;
|
||||
u32 code;
|
||||
};
|
||||
|
||||
struct bcm2835_mbox_tag_hdr {
|
||||
u32 tag;
|
||||
u32 val_buf_size;
|
||||
u32 val_len;
|
||||
};
|
||||
|
||||
struct bcm2835_mbox_tag_get_clock_rate {
|
||||
struct bcm2835_mbox_tag_hdr tag_hdr;
|
||||
union {
|
||||
struct {
|
||||
u32 clock_id;
|
||||
} req;
|
||||
struct {
|
||||
u32 clock_id;
|
||||
u32 rate_hz;
|
||||
} resp;
|
||||
} body;
|
||||
};
|
||||
|
||||
struct msg_get_clock_rate {
|
||||
struct bcm2835_mbox_hdr hdr;
|
||||
struct bcm2835_mbox_tag_get_clock_rate get_clock_rate;
|
||||
u32 end_tag;
|
||||
};
|
||||
|
|
|
@ -71,4 +71,17 @@ config DRIVER_VIDEO_PXA
|
|||
Add support for the frame buffer device found on the PXA270
|
||||
CPU.
|
||||
|
||||
config DRIVER_VIDEO_BCM2835
|
||||
bool "BCM2835 framebuffer driver"
|
||||
depends on ARCH_BCM2835
|
||||
help
|
||||
Add support for the BCM2835/VideoCore frame buffer device.
|
||||
|
||||
config DRIVER_VIDEO_SIMPLEFB
|
||||
bool "Simple framebuffer support"
|
||||
depends on OFTREE
|
||||
help
|
||||
Add support for setting up the kernel's simple framebuffer driver
|
||||
based on the active barebox framebuffer.
|
||||
|
||||
endif
|
||||
|
|
|
@ -9,3 +9,5 @@ obj-$(CONFIG_DRIVER_VIDEO_S3C24XX) += s3c24xx.o
|
|||
obj-$(CONFIG_DRIVER_VIDEO_PXA) += pxa.o
|
||||
obj-$(CONFIG_DRIVER_VIDEO_SDL) += sdl.o
|
||||
obj-$(CONFIG_DRIVER_VIDEO_OMAP) += omap.o
|
||||
obj-$(CONFIG_DRIVER_VIDEO_BCM2835) += bcm2835.o
|
||||
obj-$(CONFIG_DRIVER_VIDEO_SIMPLEFB) += simplefb.o
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* BCM2835 framebuffer driver
|
||||
*
|
||||
* Copyright (C) 2013 Andre Heider
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <driver.h>
|
||||
#include <errno.h>
|
||||
#include <fb.h>
|
||||
#include <init.h>
|
||||
#include <malloc.h>
|
||||
#include <xfuncs.h>
|
||||
|
||||
#include <mach/mbox.h>
|
||||
|
||||
struct bcm2835fb_info {
|
||||
struct fb_info fbi;
|
||||
struct fb_videomode mode;
|
||||
};
|
||||
|
||||
struct msg_fb_query {
|
||||
struct bcm2835_mbox_hdr hdr;
|
||||
struct bcm2835_mbox_tag_physical_w_h physical_w_h;
|
||||
u32 end_tag;
|
||||
};
|
||||
|
||||
struct msg_fb_setup {
|
||||
struct bcm2835_mbox_hdr hdr;
|
||||
struct bcm2835_mbox_tag_physical_w_h physical_w_h;
|
||||
struct bcm2835_mbox_tag_virtual_w_h virtual_w_h;
|
||||
struct bcm2835_mbox_tag_depth depth;
|
||||
struct bcm2835_mbox_tag_pixel_order pixel_order;
|
||||
struct bcm2835_mbox_tag_alpha_mode alpha_mode;
|
||||
struct bcm2835_mbox_tag_virtual_offset virtual_offset;
|
||||
struct bcm2835_mbox_tag_allocate_buffer allocate_buffer;
|
||||
struct bcm2835_mbox_tag_pitch pitch;
|
||||
u32 end_tag;
|
||||
};
|
||||
|
||||
static void bcm2835fb_enable(struct fb_info *info)
|
||||
{
|
||||
}
|
||||
|
||||
static void bcm2835fb_disable(struct fb_info *info)
|
||||
{
|
||||
}
|
||||
|
||||
static struct fb_ops bcm2835fb_ops = {
|
||||
.fb_enable = bcm2835fb_enable,
|
||||
.fb_disable = bcm2835fb_disable,
|
||||
};
|
||||
|
||||
static int bcm2835fb_probe(struct device_d *dev)
|
||||
{
|
||||
BCM2835_MBOX_STACK_ALIGN(struct msg_fb_query, msg_query);
|
||||
BCM2835_MBOX_STACK_ALIGN(struct msg_fb_setup, msg_setup);
|
||||
struct bcm2835fb_info *info;
|
||||
u32 w, h;
|
||||
int ret;
|
||||
|
||||
BCM2835_MBOX_INIT_HDR(msg_query);
|
||||
BCM2835_MBOX_INIT_TAG_NO_REQ(&msg_query->physical_w_h,
|
||||
GET_PHYSICAL_W_H);
|
||||
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_query->hdr);
|
||||
if (ret) {
|
||||
dev_err(dev, "could not query display resolution\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
w = msg_query->physical_w_h.body.resp.width;
|
||||
h = msg_query->physical_w_h.body.resp.height;
|
||||
|
||||
BCM2835_MBOX_INIT_HDR(msg_setup);
|
||||
BCM2835_MBOX_INIT_TAG(&msg_setup->physical_w_h, SET_PHYSICAL_W_H);
|
||||
msg_setup->physical_w_h.body.req.width = w;
|
||||
msg_setup->physical_w_h.body.req.height = h;
|
||||
BCM2835_MBOX_INIT_TAG(&msg_setup->virtual_w_h, SET_VIRTUAL_W_H);
|
||||
msg_setup->virtual_w_h.body.req.width = w;
|
||||
msg_setup->virtual_w_h.body.req.height = h;
|
||||
BCM2835_MBOX_INIT_TAG(&msg_setup->depth, SET_DEPTH);
|
||||
msg_setup->depth.body.req.bpp = 16;
|
||||
BCM2835_MBOX_INIT_TAG(&msg_setup->pixel_order, SET_PIXEL_ORDER);
|
||||
msg_setup->pixel_order.body.req.order = BCM2835_MBOX_PIXEL_ORDER_BGR;
|
||||
BCM2835_MBOX_INIT_TAG(&msg_setup->alpha_mode, SET_ALPHA_MODE);
|
||||
msg_setup->alpha_mode.body.req.alpha = BCM2835_MBOX_ALPHA_MODE_IGNORED;
|
||||
BCM2835_MBOX_INIT_TAG(&msg_setup->virtual_offset, SET_VIRTUAL_OFFSET);
|
||||
msg_setup->virtual_offset.body.req.x = 0;
|
||||
msg_setup->virtual_offset.body.req.y = 0;
|
||||
BCM2835_MBOX_INIT_TAG(&msg_setup->allocate_buffer, ALLOCATE_BUFFER);
|
||||
msg_setup->allocate_buffer.body.req.alignment = 0x100;
|
||||
BCM2835_MBOX_INIT_TAG_NO_REQ(&msg_setup->pitch, GET_PITCH);
|
||||
|
||||
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_setup->hdr);
|
||||
if (ret) {
|
||||
dev_err(dev, "could not configure display\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
info = xzalloc(sizeof *info);
|
||||
info->fbi.fbops = &bcm2835fb_ops;
|
||||
info->fbi.screen_base =
|
||||
(void *)msg_setup->allocate_buffer.body.resp.fb_address;
|
||||
info->fbi.xres = msg_setup->physical_w_h.body.resp.width;
|
||||
info->fbi.yres = msg_setup->physical_w_h.body.resp.height;
|
||||
info->fbi.bits_per_pixel = 16;
|
||||
info->fbi.line_length = msg_setup->pitch.body.resp.pitch;
|
||||
info->fbi.red.length = 5;
|
||||
info->fbi.red.offset = 11;
|
||||
info->fbi.green.length = 6;
|
||||
info->fbi.green.offset = 5;
|
||||
info->fbi.blue.length = 5;
|
||||
info->fbi.blue.offset = 0;
|
||||
|
||||
info->fbi.mode = &info->mode;
|
||||
info->fbi.mode->xres = info->fbi.xres;
|
||||
info->fbi.mode->yres = info->fbi.yres;
|
||||
|
||||
ret = register_framebuffer(&info->fbi);
|
||||
if (ret) {
|
||||
free(info);
|
||||
dev_err(dev, "failed to register framebuffer: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_info(dev, "registered\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct driver_d bcm2835fb_driver = {
|
||||
.name = "bcm2835_fb",
|
||||
.probe = bcm2835fb_probe,
|
||||
};
|
||||
device_platform_driver(bcm2835fb_driver);
|
|
@ -72,12 +72,16 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
|
|||
|
||||
info->xres = info->mode->xres;
|
||||
info->yres = info->mode->yres;
|
||||
info->line_length = 0;
|
||||
|
||||
ret = info->fbops->fb_activate_var(info);
|
||||
|
||||
if (!info->line_length)
|
||||
info->line_length = info->xres * (info->bits_per_pixel >> 3);
|
||||
|
||||
if (!ret) {
|
||||
dev->resource[0].start = (resource_size_t)info->screen_base;
|
||||
info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
|
||||
info->cdev.size = info->line_length * info->yres;
|
||||
dev->resource[0].end = dev->resource[0].start + info->cdev.size - 1;
|
||||
dev_param_set_generic(dev, param, val);
|
||||
} else
|
||||
|
@ -122,9 +126,12 @@ int register_framebuffer(struct fb_info *info)
|
|||
|
||||
dev = &info->dev;
|
||||
|
||||
if (!info->line_length)
|
||||
info->line_length = info->xres * (info->bits_per_pixel >> 3);
|
||||
|
||||
info->cdev.ops = &fb_ops;
|
||||
info->cdev.name = asprintf("fb%d", id);
|
||||
info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
|
||||
info->cdev.size = info->line_length * info->yres;
|
||||
info->cdev.dev = dev;
|
||||
info->cdev.priv = info;
|
||||
dev->resource = xzalloc(sizeof(struct resource));
|
||||
|
@ -156,6 +163,13 @@ int register_framebuffer(struct fb_info *info)
|
|||
if (ret)
|
||||
goto err_unregister;
|
||||
|
||||
if (IS_ENABLED(CONFIG_DRIVER_VIDEO_SIMPLEFB)) {
|
||||
ret = fb_register_simplefb(info);
|
||||
if (ret)
|
||||
dev_err(&info->dev, "failed to register simplefb: %s\n",
|
||||
strerror(-ret));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_unregister:
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* SimpleFB driver
|
||||
*
|
||||
* Copyright (C) 2013 Andre Heider
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "simplefb: " fmt
|
||||
|
||||
#include <common.h>
|
||||
#include <errno.h>
|
||||
#include <fb.h>
|
||||
#include <fcntl.h>
|
||||
#include <fs.h>
|
||||
#include <init.h>
|
||||
#include <xfuncs.h>
|
||||
|
||||
struct simplefb_mode {
|
||||
const char *format;
|
||||
u32 bpp;
|
||||
struct fb_bitfield red;
|
||||
struct fb_bitfield green;
|
||||
struct fb_bitfield blue;
|
||||
struct fb_bitfield transp;
|
||||
};
|
||||
|
||||
/*
|
||||
* These values have to match the kernel's simplefb driver.
|
||||
* See Documentation/devicetree/bindings/video/simple-framebuffer.txt
|
||||
*/
|
||||
static const struct simplefb_mode simplefb_modes[] = {
|
||||
{
|
||||
.format = "r5g6b5",
|
||||
.bpp = 16,
|
||||
.red = { .length = 5, .offset = 11 },
|
||||
.green = { .length = 6, .offset = 5 },
|
||||
.blue = { .length = 5, .offset = 0 },
|
||||
.transp = { .length = 0, .offset = 0 },
|
||||
},
|
||||
};
|
||||
|
||||
static bool simplefb_bitfield_cmp(const struct fb_bitfield *a,
|
||||
const struct fb_bitfield *b)
|
||||
{
|
||||
if (a->offset != b->offset)
|
||||
return false;
|
||||
if (a->length != b->length)
|
||||
return false;
|
||||
if (a->msb_right != b->msb_right)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const struct simplefb_mode *simplefb_find_mode(const struct fb_info *fbi)
|
||||
{
|
||||
const struct simplefb_mode *mode;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(simplefb_modes); ++i) {
|
||||
mode = &simplefb_modes[i];
|
||||
|
||||
if (fbi->bits_per_pixel != mode->bpp)
|
||||
continue;
|
||||
if (!simplefb_bitfield_cmp(&fbi->red, &mode->red))
|
||||
continue;
|
||||
if (!simplefb_bitfield_cmp(&fbi->green, &mode->green))
|
||||
continue;
|
||||
if (!simplefb_bitfield_cmp(&fbi->blue, &mode->blue))
|
||||
continue;
|
||||
if (!simplefb_bitfield_cmp(&fbi->transp, &mode->transp))
|
||||
continue;
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int simplefb_create_node(struct device_node *root,
|
||||
const struct fb_info *fbi, const char *format)
|
||||
{
|
||||
const char *compat = "simple-framebuffer";
|
||||
const char *disabled = "disabled";
|
||||
const char *okay = "okay";
|
||||
struct device_node *node;
|
||||
u32 cells[2];
|
||||
int ret;
|
||||
|
||||
node = of_create_node(root, "/framebuffer");
|
||||
if (!node)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = of_set_property(node, "status", disabled,
|
||||
strlen(disabled) + 1, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = of_set_property(node, "compatible", compat, strlen(compat) + 1, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
cells[0] = cpu_to_be32((u32)fbi->screen_base);
|
||||
cells[1] = cpu_to_be32(fbi->line_length * fbi->yres);
|
||||
ret = of_set_property(node, "reg", cells, sizeof(cells[0]) * 2, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
cells[0] = cpu_to_be32(fbi->xres);
|
||||
ret = of_set_property(node, "width", cells, sizeof(cells[0]), 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
cells[0] = cpu_to_be32(fbi->yres);
|
||||
ret = of_set_property(node, "height", cells, sizeof(cells[0]), 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
cells[0] = cpu_to_be32(fbi->line_length);
|
||||
ret = of_set_property(node, "stride", cells, sizeof(cells[0]), 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = of_set_property(node, "format", format, strlen(format) + 1, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return of_set_property(node, "status", okay, strlen(okay) + 1, 1);
|
||||
}
|
||||
|
||||
static int simplefb_of_fixup(struct device_node *root, void *ctx)
|
||||
{
|
||||
struct fb_info *info = ctx;
|
||||
const struct simplefb_mode *mode;
|
||||
int ret;
|
||||
|
||||
/* only create node if we are requested to */
|
||||
if (!info->register_simplefb)
|
||||
return 0;
|
||||
|
||||
/* do not create node for disabled framebuffers */
|
||||
if (!info->enabled)
|
||||
return 0;
|
||||
|
||||
mode = simplefb_find_mode(info);
|
||||
if (!mode) {
|
||||
dev_err(&info->dev, "fb format is incompatible with simplefb\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = simplefb_create_node(root, info, mode->format);
|
||||
if (ret)
|
||||
dev_err(&info->dev, "failed to create node: %d\n", ret);
|
||||
else
|
||||
dev_info(&info->dev, "created %s node\n", mode->format);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int fb_register_simplefb(struct fb_info *info)
|
||||
{
|
||||
dev_add_param_bool(&info->dev, "register_simplefb",
|
||||
NULL, NULL, &info->register_simplefb, NULL);
|
||||
|
||||
return of_register_fixup(simplefb_of_fixup, info);
|
||||
}
|
|
@ -192,6 +192,17 @@ int run_shell(void);
|
|||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
|
||||
#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
|
||||
|
||||
/*
|
||||
* The STACK_ALIGN_ARRAY macro is used to allocate a buffer on the stack that
|
||||
* meets a minimum alignment requirement.
|
||||
*
|
||||
* Note that the size parameter is the number of array elements to allocate,
|
||||
* not the number of bytes.
|
||||
*/
|
||||
#define STACK_ALIGN_ARRAY(type, name, size, align) \
|
||||
char __##name[sizeof(type) * (size) + (align) - 1]; \
|
||||
type *name = (type *)ALIGN((uintptr_t)__##name, align)
|
||||
|
||||
/**
|
||||
* container_of - cast a member of a structure out to the containing structure
|
||||
* @ptr: the pointer to the member.
|
||||
|
|
|
@ -94,6 +94,7 @@ struct fb_info {
|
|||
u32 xres; /* visible resolution */
|
||||
u32 yres;
|
||||
u32 bits_per_pixel; /* guess what */
|
||||
u32 line_length; /* length of a line in bytes */
|
||||
|
||||
u32 grayscale; /* != 0 Graylevels instead of colors */
|
||||
|
||||
|
@ -104,6 +105,9 @@ struct fb_info {
|
|||
|
||||
int enabled;
|
||||
int p_enable;
|
||||
int register_simplefb; /* If true a simplefb device node will
|
||||
* be created.
|
||||
*/
|
||||
};
|
||||
|
||||
int register_framebuffer(struct fb_info *info);
|
||||
|
@ -114,5 +118,9 @@ int register_framebuffer(struct fb_info *info);
|
|||
|
||||
extern struct bus_type fb_bus;
|
||||
|
||||
/* fb internal functions */
|
||||
|
||||
int fb_register_simplefb(struct fb_info *info);
|
||||
|
||||
#endif /* __FB_H */
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ struct device_d;
|
|||
struct driver_d;
|
||||
|
||||
int of_fix_tree(struct device_node *);
|
||||
int of_register_fixup(int (*fixup)(struct device_node *));
|
||||
int of_register_fixup(int (*fixup)(struct device_node *, void *), void *context);
|
||||
|
||||
int of_match(struct device_d *dev, struct driver_d *drv);
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ static int bmp_renderer(struct screen *sc, struct surface *s, struct image *img)
|
|||
image = (char *)bmp +
|
||||
le32_to_cpu(bmp->header.data_offset);
|
||||
image += (img->height - y - 1) * img->width * (bits_per_pixel >> 3);
|
||||
adr = buf + ((y + starty) * sc->s.width + startx) *
|
||||
(sc->info.bits_per_pixel >> 3);
|
||||
adr = buf + (y + starty) * sc->info.line_length +
|
||||
startx * (sc->info.bits_per_pixel >> 3);
|
||||
for (x = 0; x < width; x++) {
|
||||
int pixel;
|
||||
|
||||
|
@ -100,8 +100,8 @@ static int bmp_renderer(struct screen *sc, struct surface *s, struct image *img)
|
|||
image = (char *)bmp +
|
||||
le32_to_cpu(bmp->header.data_offset);
|
||||
image += (img->height - y - 1) * img->width * (bits_per_pixel >> 3);
|
||||
adr = buf + ((y + starty) * sc->s.width + startx) *
|
||||
(sc->info.bits_per_pixel >> 3);
|
||||
adr = buf + (y + starty) * sc->info.line_length +
|
||||
startx * (sc->info.bits_per_pixel >> 3);
|
||||
for (x = 0; x < width; x++) {
|
||||
char *pixel;
|
||||
|
||||
|
|
|
@ -167,18 +167,18 @@ void rgba_blend(struct fb_info *info, struct image *img, void* buf, int height,
|
|||
{
|
||||
unsigned char *adr;
|
||||
int x, y;
|
||||
int xres;
|
||||
int line_length;
|
||||
int img_byte_per_pixel = 3;
|
||||
void *image;
|
||||
|
||||
if (is_rgba)
|
||||
img_byte_per_pixel++;
|
||||
|
||||
xres = info->xres;
|
||||
line_length = info->line_length;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
adr = buf + ((y + starty) * xres + startx) *
|
||||
(info->bits_per_pixel >> 3);
|
||||
adr = buf + (y + starty) * line_length +
|
||||
startx * (info->bits_per_pixel >> 3);
|
||||
image = img->data + (y * img->width *img_byte_per_pixel);
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
|
@ -219,7 +219,7 @@ int fb_open(const char * fbdev, struct screen *sc, bool offscreen)
|
|||
sc->s.y = 0;
|
||||
sc->s.width = sc->info.xres;
|
||||
sc->s.height = sc->info.yres;
|
||||
sc->fbsize = sc->s.width * sc->s.height * (sc->info.bits_per_pixel >> 3);
|
||||
sc->fbsize = sc->info.line_length * sc->s.height;
|
||||
|
||||
if (offscreen) {
|
||||
/* Don't fail if malloc fails, just continue rendering directly
|
||||
|
|
|
@ -274,7 +274,7 @@ static int eth_set_ethaddr(struct device_d *dev, struct param_d *param, const ch
|
|||
}
|
||||
|
||||
#ifdef CONFIG_OFTREE
|
||||
static int eth_of_fixup(struct device_node *root)
|
||||
static int eth_of_fixup(struct device_node *root, void *unused)
|
||||
{
|
||||
struct eth_device *edev;
|
||||
struct device_node *node;
|
||||
|
@ -316,7 +316,7 @@ static int eth_of_fixup(struct device_node *root)
|
|||
|
||||
static int eth_register_of_fixup(void)
|
||||
{
|
||||
return of_register_fixup(eth_of_fixup);
|
||||
return of_register_fixup(eth_of_fixup, NULL);
|
||||
}
|
||||
late_initcall(eth_register_of_fixup);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue