From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Herrmann Date: Thu, 20 Sep 2012 21:37:37 +0200 Subject: [U-Boot] [PATCH 01/11] DM: add block device core In-Reply-To: <1348169867-2917-1-git-send-email-morpheus.ibis@gmail.com> References: <1348169867-2917-1-git-send-email-morpheus.ibis@gmail.com> Message-ID: <1348169867-2917-2-git-send-email-morpheus.ibis@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This core will register all block devices (disk, cards, partitons) and provide unfied access to them, instead of current method with device + partition offset Signed-off-by: Pavel Herrmann --- Makefile | 1 + drivers/blockdev/Makefile | 42 ++++++++++++++++ include/dm/blockdev.h | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 drivers/blockdev/Makefile create mode 100644 include/dm/blockdev.h diff --git a/Makefile b/Makefile index ba74696..e43fd9d 100644 --- a/Makefile +++ b/Makefile @@ -303,6 +303,7 @@ LIBS-y += test/libtest.o LIBS-$(CONFIG_DM) += common/dm/libdm.o LIBS-$(CONFIG_DM) += drivers/demo/libdemo.o +LIBS-${CONFIG_DM_BLOCK} += drivers/blockdev/libblockdev.o ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),) LIBS-y += $(CPUDIR)/omap-common/libomap-common.o diff --git a/drivers/blockdev/Makefile b/drivers/blockdev/Makefile new file mode 100644 index 0000000..693e236 --- /dev/null +++ b/drivers/blockdev/Makefile @@ -0,0 +1,42 @@ +# See file CREDITS for list of people who contributed to this +# project. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB := $(obj)libblockdev.o + +COBJS-${CONFIG_DM_BLOCK} := core.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/include/dm/blockdev.h b/include/dm/blockdev.h new file mode 100644 index 0000000..828eb2b --- /dev/null +++ b/include/dm/blockdev.h @@ -0,0 +1,121 @@ +/* + * (C) Copyright 2012 + * Pavel Herrmann + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _DM_BLOCKDEV_H_ +#define _DM_BLOCKDEV_H_ 1 + +#include +#include + +#define BLOCKDEV_IFTYPE_BITS 4 +#define BLOCKDEV_IFTYPE_COUNT (1<