diff options
author | Daniel Golle <daniel@makrotopia.org> | 2018-05-31 17:28:38 +0200 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2018-06-18 18:44:14 +0200 |
commit | 6f398aa76248dfdbd1ea31b8ef32431be0f762ee (patch) | |
tree | e9c8f6380fdabb0a5e00b6bdd335c9397e93b6ad /target/linux/oxnas/files/drivers/ata/sata_oxnas.c | |
parent | d6ee5e462c34a337a1b53994df5581a507e2c342 (diff) | |
download | upstream-6f398aa76248dfdbd1ea31b8ef32431be0f762ee.tar.gz upstream-6f398aa76248dfdbd1ea31b8ef32431be0f762ee.tar.bz2 upstream-6f398aa76248dfdbd1ea31b8ef32431be0f762ee.zip |
oxnas: reboot target
Reboot the oxnas target based on Linux 4.14 by rebasing our support on
top of the now-existing upstream kernel support.
This commit brings oxnas support to the level of v4.17 having upstream
drivers for Ethernet, Serial and NAND flash.
Botch up OpenWrt's local drivers for EHCI, SATA and PCIe based on the
new platform code and device-tree.
Re-introduce base-files from old oxnas target which works for now but
needs further clean-up towards generic board support.
Functional issues:
* PCIe won't come up (hence no USB3 on Shuttle KD20)
* I2C bus of Akitio myCloud device is likely not to work (missing
debounce support in new pinctrl driver)
Code-style issues:
* plla/pllb needs further cleanup -- currently their users are writing
into the syscon regmap after acquireling the clk instead of using
defined clk_*_*() functions to setup multipliers and dividors.
* PCIe phy needs its own little driver.
* SATA driver is a monster and should be split into an mfd having
a raidctrl regmap, sata controller, sata ports and sata phy.
Tested on MitraStar STG-212 aka. Medion Akoya MD86xxx and Shuttle KD20.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(squash-picked commit 17511a7ea8 and commit dcc34574ef from master)
Diffstat (limited to 'target/linux/oxnas/files/drivers/ata/sata_oxnas.c')
-rw-r--r-- | target/linux/oxnas/files/drivers/ata/sata_oxnas.c | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c index 291a06f959..64afa728a1 100644 --- a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c +++ b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c @@ -29,7 +29,35 @@ #include <linux/clk.h> #include <linux/reset.h> -#include <mach/utils.h> +#include <linux/io.h> +#include <linux/sizes.h> + +static inline void oxnas_register_clear_mask(void __iomem *p, unsigned mask) +{ + u32 val = readl_relaxed(p); + + val &= ~mask; + writel_relaxed(val, p); +} + +static inline void oxnas_register_set_mask(void __iomem *p, unsigned mask) +{ + u32 val = readl_relaxed(p); + + val |= mask; + writel_relaxed(val, p); +} + +static inline void oxnas_register_value_mask(void __iomem *p, + unsigned mask, unsigned new_value) +{ + /* TODO sanity check mask & new_value = new_value */ + u32 val = readl_relaxed(p); + + val &= ~mask; + val |= new_value; + writel_relaxed(val, p); +} /* sgdma request structure */ struct sgdma_request { @@ -848,7 +876,7 @@ wait_for_lock: * list so want to give reentrant accessors a chance to get * access ASAP */ - if (!list_empty(&hd->scsi_wait_queue.task_list)) + if (!list_empty(&hd->scsi_wait_queue.head)) wake_up(&hd->scsi_wait_queue); } @@ -867,7 +895,7 @@ int sata_core_has_fast_waiters(struct ata_host *ah) struct sata_oxnas_host_priv *hd = ah->private_data; spin_lock_irqsave(&hd->core_lock, flags); - has_waiters = !list_empty(&hd->fast_wait_queue.task_list); + has_waiters = !list_empty(&hd->fast_wait_queue.head); spin_unlock_irqrestore(&hd->core_lock, flags); return has_waiters; @@ -882,7 +910,7 @@ int sata_core_has_scsi_waiters(struct ata_host *ah) spin_lock_irqsave(&hd->core_lock, flags); has_waiters = hd->scsi_nonblocking_attempts || - !list_empty(&hd->scsi_wait_queue.task_list); + !list_empty(&hd->scsi_wait_queue.head); spin_unlock_irqrestore(&hd->core_lock, flags); return has_waiters; @@ -954,7 +982,7 @@ static void sata_oxnas_release_hw(struct ata_port *ap) hd->locker_uid = 0; hd->core_locked = 0; released = 1; - wake_up(!list_empty(&hd->scsi_wait_queue.task_list) ? + wake_up(!list_empty(&hd->scsi_wait_queue.head) ? &hd->scsi_wait_queue : &hd->fast_wait_queue); } |