Commit 61fe8442 authored by Andrey Filippov's avatar Andrey Filippov

First time recognized SSD

parent 45172cb6
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
<listOptionValue builtIn="false" value="CONFIG_GPIOLIB=1"/> <listOptionValue builtIn="false" value="CONFIG_GPIOLIB=1"/>
<listOptionValue builtIn="false" value="CONFIG_BLOCK=1"/> <listOptionValue builtIn="false" value="CONFIG_BLOCK=1"/>
<listOptionValue builtIn="false" value="CONFIG_HZ=100"/> <listOptionValue builtIn="false" value="CONFIG_HZ=100"/>
<listOptionValue builtIn="false" value="MODULE_ARCH_INIT={}"/>
<listOptionValue builtIn="false" value="CONFIG_MMU=1"/>
</option> </option>
<option id="gnu.c.compiler.option.include.paths.1702086126" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <option id="gnu.c.compiler.option.include.paths.1702086126" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="${workspace_loc:/linux-elphel/linux/include/generated}"/> <listOptionValue builtIn="false" value="${workspace_loc:/linux-elphel/linux/include/generated}"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="linux-xlnx -c compile_kernelmodules -f"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> <launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder"/>
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/> <mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
......
...@@ -59,6 +59,16 @@ ...@@ -59,6 +59,16 @@
</dictionary> </dictionary>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/kernel modules [Builder].launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.cdt.core.cnature</nature> <nature>org.eclipse.cdt.core.cnature</nature>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<project> <project>
<configuration id="cdt.managedbuild.toolchain.gnu.base.1636449201" name="Default"> <configuration id="cdt.managedbuild.toolchain.gnu.base.1636449201" name="Default">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
</extension> </extension>
</configuration> </configuration>
......
This diff is collapsed.
...@@ -43,6 +43,9 @@ struct elphel_ahci_priv { ...@@ -43,6 +43,9 @@ struct elphel_ahci_priv {
u32 base_addr; u32 base_addr;
}; };
// What about port_stop and freeing/unmapping ?
// Or at least check if it is re-started and memory is already allocated/mapped
static int elphel_port_start(struct ata_port *ap) static int elphel_port_start(struct ata_port *ap)
{ {
void *mem; void *mem;
...@@ -52,6 +55,10 @@ static int elphel_port_start(struct ata_port *ap) ...@@ -52,6 +55,10 @@ static int elphel_port_start(struct ata_port *ap)
struct ahci_host_priv *hpriv = ap->host->private_data; struct ahci_host_priv *hpriv = ap->host->private_data;
const struct elphel_ahci_priv *dpriv = hpriv->plat_data; const struct elphel_ahci_priv *dpriv = hpriv->plat_data;
// const ssize_t align_cdt = 128;
const ssize_t align_cdt = 4096; // just trying - page align
u32 * dbg_p;
int dbg_i;
libahci_debug_init(ap->host); libahci_debug_init(ap->host);
dev_info(dev, "starting port %d", ap->port_no); dev_info(dev, "starting port %d", ap->port_no);
...@@ -61,12 +68,40 @@ static int elphel_port_start(struct ata_port *ap) ...@@ -61,12 +68,40 @@ static int elphel_port_start(struct ata_port *ap)
if (!pp) if (!pp)
return -ENOMEM; return -ENOMEM;
// Seems that dmam_alloc_coherent() in Zynq does not really make it "coherent" (write buffers), but stream functions work
/*
Command Table Descriptor Base Address (CTBA): Indicates the 32-bit physical address of
the command table, which contains the command FIS, ATAPI Command, and PRD table. This
address must be aligned to a 128-byte cache line, indicated by bits 06:00 being reserved.
mem = dmam_alloc_coherent(dev, AHCI_CMD_TBL_AR_SZ, &mem_dma, GFP_KERNEL); mem = dmam_alloc_coherent(dev, AHCI_CMD_TBL_AR_SZ, &mem_dma, GFP_KERNEL);
if (!mem) if (!mem)
return -ENOMEM; return -ENOMEM;
memset(mem, 0, AHCI_CMD_TBL_AR_SZ); memset(mem, 0, AHCI_CMD_TBL_AR_SZ); // dmam_alloc_coherent() does this
pp->cmd_tbl = mem; void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int flag);
pp->cmd_tbl_dma = mem_dma; dma_addr_t dma_map_single(struct device *dev, void *buffer, size_t size, enum dma_data_direction direction);
void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction direction);
*/
// mem = devm_kzalloc(dev, AHCI_CMD_TBL_AR_SZ + align_cdt - 1, GFP_KERNEL);
// mem = devm_kmalloc(dev, AHCI_CMD_TBL_AR_SZ + align_cdt - 1, GFP_KERNEL); // let some junk be there
mem = devm_kmalloc(dev, 0x100000, GFP_KERNEL); // AHCI_CMD_TBL_AR_SZ = 0x16000
dbg_p = (u32*) mem;
for (dbg_i=0; dbg_i < ((AHCI_CMD_TBL_AR_SZ + align_cdt)>>2); dbg_i++) {
dbg_p[dbg_i] = dbg_i;
}
dbg_i = 0;
/*
if (((u32) mem) & (align_cdt - 1)) {
// mem += align_cdt - (((u32) mem) & (align_cdt - 1));
dbg_i = align_cdt - (((u32) mem) & (align_cdt - 1));
}
*/
mem_dma = dma_map_single(dev, mem, AHCI_CMD_TBL_AR_SZ, DMA_TO_DEVICE); // maybe DMA_BIDIRECTIONAL, but currently we do not use DMA for received FISes
dev_info(dev, "ahci_elphel.c: dbg_i= 0x%08x, mem= 0x%08x, mem_dma= 0x%08x", dbg_i, (u32) mem, (u32) mem_dma);
pp->cmd_tbl = mem + dbg_i;
pp->cmd_tbl_dma = mem_dma + dbg_i;
dev_info(dev, "ahci_elphel.c: dbg_i= 0x%08x, pp->cmd_tbl= 0x%08x, pp->cmd_tbl_dma= 0x%08x", dbg_i, (u32) pp->cmd_tbl, (u32) pp->cmd_tbl_dma);
/* /*
* Set predefined addresses * Set predefined addresses
...@@ -99,7 +134,7 @@ static int elphel_port_start(struct ata_port *ap) ...@@ -99,7 +134,7 @@ static int elphel_port_start(struct ata_port *ap)
//libahci_debug_saxigp1_save(ap, 0x3000); //libahci_debug_saxigp1_save(ap, 0x3000);
//libahci_debug_saxigp1_save(ap, 0x3000); //libahci_debug_saxigp1_save(ap, 0x3000);
dev_info(dev, "ahci_elphel.c: Calling ahci_port_resume()");
return ahci_port_resume(ap); return ahci_port_resume(ap);
} }
...@@ -218,7 +253,7 @@ static unsigned int elphel_read_id(struct ata_device *dev, struct ata_taskfile * ...@@ -218,7 +253,7 @@ static unsigned int elphel_read_id(struct ata_device *dev, struct ata_taskfile *
if (err_mask) if (err_mask)
return err_mask; return err_mask;
dev_info(d, "issue identify command"); dev_info(d, "elphel_read_id(): issue identify command finished");
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <elphel/elphel393-mem.h> #include <elphel/elphel393-mem.h>
#include "libahci_debug.h" #include "libahci_debug.h"
#include <asm/io.h> // ioremap(), copy_fromio #include <asm/io.h> // ioremap(), copy_fromio
#include <linux/jiffies.h>
/* /*
struct elphel_buf_t struct elphel_buf_t
{ {
...@@ -489,7 +490,7 @@ void libahci_debug_event(const struct ata_port *port, char *msg, size_t msg_sz) ...@@ -489,7 +490,7 @@ void libahci_debug_event(const struct ata_port *port, char *msg, size_t msg_sz)
i = libahci_debug_saxigp1_save(port, 0x3000); i = libahci_debug_saxigp1_save(port, 0x3000);
tmp = libahci_debug_get_fsm_state(); tmp = libahci_debug_get_fsm_state();
len = snprintf(format_msg, LIBAHCI_DEBUG_BUFSZ, "%s [%08u; fsm: 0x%08x] %s\n", EVT_MARKER, i, tmp, msg); len = snprintf(format_msg, LIBAHCI_DEBUG_BUFSZ, "%s [%08u; fsm: 0x%08x @0x%08x] %s\n", EVT_MARKER, i, tmp, jiffies, msg);
spin_lock_irqsave(&pos->debug_list_lock, flags); spin_lock_irqsave(&pos->debug_list_lock, flags);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
pos->libahci_debug_buf[(pos->tail+ i) % LIBAHCI_DEBUG_BUFSZ] = format_msg[i]; pos->libahci_debug_buf[(pos->tail+ i) % LIBAHCI_DEBUG_BUFSZ] = format_msg[i];
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*!***************************************************************************
*! FILE NAME : elphel393-mem.h
*! DESCRIPTION:
*! Copyright (C) 2015 Elphel, Inc.
*! -----------------------------------------------------------------------------**
*!
*! 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 3 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, see <http://www.gnu.org/licenses/>.
*!****************************************************************************/
struct elphel_buf_t
{
void *vaddr;
dma_addr_t paddr;
ssize_t size;
};
extern struct elphel_buf_t elphel_buf;
...@@ -19,9 +19,25 @@ ...@@ -19,9 +19,25 @@
*!****************************************************************************/ *!****************************************************************************/
struct elphel_buf_t struct elphel_buf_t
{ {
// Coherent DMA buffer
void *vaddr; void *vaddr;
dma_addr_t paddr; dma_addr_t paddr;
ssize_t size; ssize_t size;
// Host to device stream DMA buffer
void *h2d_vaddr;
dma_addr_t h2d_paddr;
ssize_t h2d_size;
// Device to host stream DMA buffer
void *d2h_vaddr;
dma_addr_t d2h_paddr;
ssize_t d2h_size;
// Bidirectional stream DMA buffer
void *bidir_vaddr;
dma_addr_t bidir_paddr;
ssize_t bidir_size;
}; };
extern struct elphel_buf_t *pElphel_buf; extern struct elphel_buf_t *pElphel_buf;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment