From: Sascha Hauer <s.hauer@pengutronix.de>
To: Denis Orlov <denorl2009@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 01/16] ata: ahci: use abstract read/write functions uniformly
Date: Thu, 5 May 2022 09:48:21 +0200 [thread overview]
Message-ID: <20220505074821.GI4012@pengutronix.de> (raw)
In-Reply-To: <20220504092553.27961-1-denorl2009@gmail.com>
On Wed, May 04, 2022 at 12:25:38PM +0300, Denis Orlov wrote:
> Currently those are used in some routines side by side with underlying
> functions with no apparent reason for it. Make their usage uniform, this
> cleans up code a bit and allows to remove unneeded variables.
>
> Signed-off-by: Denis Orlov <denorl2009@gmail.com>
> ---
> drivers/ata/ahci.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
Applied all, thanks
Sascha
>
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 3c0b0a5450..ad9e2f950f 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -172,7 +172,7 @@ static int ahci_io(struct ahci_port *ahci_port, u8 *fis, int fis_len, void *rbuf
> ahci_port_write_f(ahci_port, PORT_CMD_ISSUE, 1);
>
> ret = wait_on_timeout(WAIT_DATAIO,
> - (readl(ahci_port->port_mmio + PORT_CMD_ISSUE) & 0x1) == 0);
> + (ahci_port_read(ahci_port, PORT_CMD_ISSUE) & 0x1) == 0);
> if (ret)
> return -ETIMEDOUT;
>
> @@ -274,12 +274,9 @@ static int ahci_write(struct ata_port *ata, const void *buf, sector_t block,
>
> static int ahci_init_port(struct ahci_port *ahci_port)
> {
> - void __iomem *port_mmio;
> u32 val, cmd;
> int ret;
>
> - port_mmio = ahci_port->port_mmio;
> -
> /* make sure port is not active */
> val = ahci_port_read(ahci_port, PORT_CMD);
> if (val & (PORT_CMD_LIST_ON | PORT_CMD_FIS_ON | PORT_CMD_FIS_RX | PORT_CMD_START)) {
> @@ -375,16 +372,16 @@ static int ahci_init_port(struct ahci_port *ahci_port)
> ahci_port_info(ahci_port, "Spinning up device...\n");
>
> ret = wait_on_timeout(WAIT_SPINUP,
> - ((readl(port_mmio + PORT_TFDATA) &
> + ((ahci_port_read(ahci_port, PORT_TFDATA) &
> (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0)
> - || ((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1));
> + || ((ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 1));
> if (ret) {
> ahci_port_info(ahci_port, "timeout.\n");
> ret = -ENODEV;
> goto err_init;
> }
>
> - if ((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1) {
> + if ((ahci_port_read(ahci_port, PORT_SCR_STAT) & 0xf) == 1) {
> ahci_port_info(ahci_port, "down.\n");
> ret = -ENODEV;
> goto err_init;
> @@ -570,7 +567,6 @@ static int ahci_detect(struct device_d *dev)
>
> int ahci_add_host(struct ahci_device *ahci)
> {
> - u8 *mmio = (u8 *)ahci->mmio_base;
> u32 tmp, cap_save;
> int i, ret;
>
> @@ -584,7 +580,7 @@ int ahci_add_host(struct ahci_device *ahci)
>
> ahci_debug(ahci, "ahci_host_init: start\n");
>
> - cap_save = readl(mmio + HOST_CAP);
> + cap_save = ahci_ioread(ahci, HOST_CAP);
> cap_save &= ((1 << 28) | (1 << 17));
> cap_save |= (1 << 27); /* Staggered Spin-up. Not needed. */
>
> @@ -597,7 +593,7 @@ int ahci_add_host(struct ahci_device *ahci)
> * reset must complete within 1 second, or
> * the hardware should be considered fried.
> */
> - ret = wait_on_timeout(SECOND, (readl(mmio + HOST_CTL) & HOST_RESET) == 0);
> + ret = wait_on_timeout(SECOND, (ahci_ioread(ahci, HOST_CTL) & HOST_RESET) == 0);
> if (ret) {
> ahci_debug(ahci,"controller reset failed (0x%x)\n", tmp);
> return -ENODEV;
> @@ -620,7 +616,7 @@ int ahci_add_host(struct ahci_device *ahci)
> ahci_port->num = i;
> ahci_port->ahci = ahci;
> ahci_port->ata.dev = ahci->dev;
> - ahci_port->port_mmio = ahci_port_base(mmio, i);
> + ahci_port->port_mmio = ahci_port_base(ahci->mmio_base, i);
> ahci_port->ata.ops = &ahci_ops;
> ata_port_register(&ahci_port->ata);
> }
> --
> 2.20.1
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2022-05-05 7:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 9:25 Denis Orlov
2022-05-04 9:25 ` [PATCH 02/16] ata: ahci: replace magic numbers with named constants Denis Orlov
2022-05-04 9:25 ` [PATCH 03/16] ata: ahci: fix missing whitespace in ahci_add_host() Denis Orlov
2022-05-04 9:25 ` [PATCH 04/16] ata: ahci: simplify fis structure creation Denis Orlov
2022-05-04 9:25 ` [PATCH 05/16] ata: ahci: do not ignore dma handles Denis Orlov
2022-05-04 9:25 ` [PATCH 06/16] ata: ahci: adjust debug messages in ahci_init_port() Denis Orlov
2022-05-04 9:25 ` [PATCH 07/16] ata: ahci: correct named constants values and names Denis Orlov
2022-05-04 9:25 ` [PATCH 08/16] ata: ahci: properly fill scatter/gather table Denis Orlov
2022-05-04 9:25 ` [PATCH 09/16] ata: ahci: use named constants for capabilities bits Denis Orlov
2022-05-04 9:25 ` [PATCH 10/16] ata: ahci: map buffers properly Denis Orlov
2022-05-04 9:25 ` [PATCH 11/16] ata: ahci: use 64-bit addressing if available Denis Orlov
2022-05-04 9:25 ` [PATCH 12/16] ata: ahci: make rx_fis field in ahci_port of type void* Denis Orlov
2022-05-04 9:25 ` [PATCH 13/16] ata: ahci: add missing capability in ahci_print_info() Denis Orlov
2022-05-04 9:25 ` [PATCH 14/16] ata: ahci: remove redundant cast in ahci_io() Denis Orlov
2022-05-04 9:25 ` [PATCH 15/16] ata: ahci: register only implemented ports Denis Orlov
2022-05-04 9:25 ` [PATCH 16/16] ata: ahci: allocate memory in one call in ahci_init_port() Denis Orlov
2022-05-05 7:48 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220505074821.GI4012@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=denorl2009@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox