Re: [U-Boot] [PATCH v2 1/7] dm: cache: Add enable and disable ops for cache uclass

2019-07-17 Thread Rick Chen
Hi Bin

>
> On Tue, Jul 9, 2019 at 5:33 PM Andes  wrote:
> >
> > From: Rick Chen 
> >
> > The L2 cache will be enabled in init flow of dm cache
> > driver when it detect L2 node in dtb.
> >
> > When U-Boot jump to Linux Kernel, the disable ops will
>
> jumps
>
> > be called to flush and disable the L2 cache via the dm
> > cache driver.
> >
> > Signed-off-by: Rick Chen 
> > Cc: KC Lin 
> > ---
> >  drivers/cache/cache-uclass.c | 20 
> >  include/cache.h  | 31 +++
> >  test/dm/cache.c  |  2 ++
> >  3 files changed, 53 insertions(+)
> >
> > diff --git a/drivers/cache/cache-uclass.c b/drivers/cache/cache-uclass.c
> > index 97ce024..3b20a10 100644
> > --- a/drivers/cache/cache-uclass.c
> > +++ b/drivers/cache/cache-uclass.c
> > @@ -17,6 +17,26 @@ int cache_get_info(struct udevice *dev, struct 
> > cache_info *info)
> > return ops->get_info(dev, info);
> >  }
> >
> > +int cache_enable(struct udevice *dev)
> > +{
> > +   struct cache_ops *ops = cache_get_ops(dev);
> > +
> > +   if (!ops->enable)
> > +   return -ENOSYS;
> > +
> > +   return ops->enable(dev);
> > +}
> > +
> > +int cache_disable(struct udevice *dev)
> > +{
> > +   struct cache_ops *ops = cache_get_ops(dev);
> > +
> > +   if (!ops->disable)
> > +   return -ENOSYS;
> > +
> > +   return ops->disable(dev);
> > +}
> > +
> >  UCLASS_DRIVER(cache) = {
> > .id = UCLASS_CACHE,
> > .name   = "cache",
> > diff --git a/include/cache.h b/include/cache.h
> > index c6334ca..32f59fd 100644
> > --- a/include/cache.h
> > +++ b/include/cache.h
> > @@ -22,6 +22,22 @@ struct cache_ops {
> >  * @return 0 if OK, -ve on error
> >  */
> > int (*get_info)(struct udevice *dev, struct cache_info *info);
> > +
> > +   /**
> > +* enable() - Enable cache
> > +*
> > +* @dev:Device to check (UCLASS_CACHE)
> > +* @return 0 if OK, -ve on error
> > +*/
> > +   int (*enable)(struct udevice *dev);
> > +
> > +   /**
> > +* disable() - Flush and disable cache
> > +*
> > +* @dev:Device to check (UCLASS_CACHE)
> > +* @return 0 if OK, -ve on error
> > +*/
> > +   int (*disable)(struct udevice *dev);
> >  };
> >
> >  #define cache_get_ops(dev) ((struct cache_ops *)(dev)->driver->ops)
> > @@ -35,4 +51,19 @@ struct cache_ops {
> >   */
> >  int cache_get_info(struct udevice *dev, struct cache_info *info);
> >
> > +/**
> > + * cache_enable() - Enable cache
> > + *
> > + * @dev:   Device to check (UCLASS_CACHE)
> > + * @return 0 if OK, -ve on error
> > + */
> > +int cache_enable(struct udevice *dev);
> > +
> > +/**
> > + * cache_disable() - Flush and disable cache
> > + *
> > + * @dev:   Device to check (UCLASS_CACHE)
> > + * @return 0 if OK, -ve on error
> > + */
> > +int cache_disable(struct udevice *dev);
> >  #endif
> > diff --git a/test/dm/cache.c b/test/dm/cache.c
>
> Please separate the test case changes in another patch, together with
> sandbox_cache.c changes. (see below)

OK
I will separate it.

>
> > index d4144aa..2e244b1 100644
> > --- a/test/dm/cache.c
> > +++ b/test/dm/cache.c
> > @@ -14,6 +14,8 @@ static int dm_test_reset(struct unit_test_state *uts)
> >
> > ut_assertok(uclass_get_device(UCLASS_CACHE, 0, &dev_cache));
> > ut_assertok(cache_get_info(dev, &info));
> > +   ut_assertok(cache_enable(dev));
> > +   ut_assertok(cache_disable(dev));
>
> This can't be passed as you did not update sandbox_cache.c to add the
> enable/disable OP.

OK
I will update sandbox_cache.c .

Thanks
Rick

>
> >
> > return 0;
>
> Regards,
> Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/7] dm: cache: Add enable and disable ops for cache uclass

2019-07-10 Thread Bin Meng
On Tue, Jul 9, 2019 at 5:33 PM Andes  wrote:
>
> From: Rick Chen 
>
> The L2 cache will be enabled in init flow of dm cache
> driver when it detect L2 node in dtb.
>
> When U-Boot jump to Linux Kernel, the disable ops will

jumps

> be called to flush and disable the L2 cache via the dm
> cache driver.
>
> Signed-off-by: Rick Chen 
> Cc: KC Lin 
> ---
>  drivers/cache/cache-uclass.c | 20 
>  include/cache.h  | 31 +++
>  test/dm/cache.c  |  2 ++
>  3 files changed, 53 insertions(+)
>
> diff --git a/drivers/cache/cache-uclass.c b/drivers/cache/cache-uclass.c
> index 97ce024..3b20a10 100644
> --- a/drivers/cache/cache-uclass.c
> +++ b/drivers/cache/cache-uclass.c
> @@ -17,6 +17,26 @@ int cache_get_info(struct udevice *dev, struct cache_info 
> *info)
> return ops->get_info(dev, info);
>  }
>
> +int cache_enable(struct udevice *dev)
> +{
> +   struct cache_ops *ops = cache_get_ops(dev);
> +
> +   if (!ops->enable)
> +   return -ENOSYS;
> +
> +   return ops->enable(dev);
> +}
> +
> +int cache_disable(struct udevice *dev)
> +{
> +   struct cache_ops *ops = cache_get_ops(dev);
> +
> +   if (!ops->disable)
> +   return -ENOSYS;
> +
> +   return ops->disable(dev);
> +}
> +
>  UCLASS_DRIVER(cache) = {
> .id = UCLASS_CACHE,
> .name   = "cache",
> diff --git a/include/cache.h b/include/cache.h
> index c6334ca..32f59fd 100644
> --- a/include/cache.h
> +++ b/include/cache.h
> @@ -22,6 +22,22 @@ struct cache_ops {
>  * @return 0 if OK, -ve on error
>  */
> int (*get_info)(struct udevice *dev, struct cache_info *info);
> +
> +   /**
> +* enable() - Enable cache
> +*
> +* @dev:Device to check (UCLASS_CACHE)
> +* @return 0 if OK, -ve on error
> +*/
> +   int (*enable)(struct udevice *dev);
> +
> +   /**
> +* disable() - Flush and disable cache
> +*
> +* @dev:Device to check (UCLASS_CACHE)
> +* @return 0 if OK, -ve on error
> +*/
> +   int (*disable)(struct udevice *dev);
>  };
>
>  #define cache_get_ops(dev) ((struct cache_ops *)(dev)->driver->ops)
> @@ -35,4 +51,19 @@ struct cache_ops {
>   */
>  int cache_get_info(struct udevice *dev, struct cache_info *info);
>
> +/**
> + * cache_enable() - Enable cache
> + *
> + * @dev:   Device to check (UCLASS_CACHE)
> + * @return 0 if OK, -ve on error
> + */
> +int cache_enable(struct udevice *dev);
> +
> +/**
> + * cache_disable() - Flush and disable cache
> + *
> + * @dev:   Device to check (UCLASS_CACHE)
> + * @return 0 if OK, -ve on error
> + */
> +int cache_disable(struct udevice *dev);
>  #endif
> diff --git a/test/dm/cache.c b/test/dm/cache.c

Please separate the test case changes in another patch, together with
sandbox_cache.c changes. (see below)

> index d4144aa..2e244b1 100644
> --- a/test/dm/cache.c
> +++ b/test/dm/cache.c
> @@ -14,6 +14,8 @@ static int dm_test_reset(struct unit_test_state *uts)
>
> ut_assertok(uclass_get_device(UCLASS_CACHE, 0, &dev_cache));
> ut_assertok(cache_get_info(dev, &info));
> +   ut_assertok(cache_enable(dev));
> +   ut_assertok(cache_disable(dev));

This can't be passed as you did not update sandbox_cache.c to add the
enable/disable OP.

>
> return 0;

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/7] dm: cache: Add enable and disable ops for cache uclass

2019-07-09 Thread Andes
From: Rick Chen 

The L2 cache will be enabled in init flow of dm cache
driver when it detect L2 node in dtb.

When U-Boot jump to Linux Kernel, the disable ops will
be called to flush and disable the L2 cache via the dm
cache driver.

Signed-off-by: Rick Chen 
Cc: KC Lin 
---
 drivers/cache/cache-uclass.c | 20 
 include/cache.h  | 31 +++
 test/dm/cache.c  |  2 ++
 3 files changed, 53 insertions(+)

diff --git a/drivers/cache/cache-uclass.c b/drivers/cache/cache-uclass.c
index 97ce024..3b20a10 100644
--- a/drivers/cache/cache-uclass.c
+++ b/drivers/cache/cache-uclass.c
@@ -17,6 +17,26 @@ int cache_get_info(struct udevice *dev, struct cache_info 
*info)
return ops->get_info(dev, info);
 }
 
+int cache_enable(struct udevice *dev)
+{
+   struct cache_ops *ops = cache_get_ops(dev);
+
+   if (!ops->enable)
+   return -ENOSYS;
+
+   return ops->enable(dev);
+}
+
+int cache_disable(struct udevice *dev)
+{
+   struct cache_ops *ops = cache_get_ops(dev);
+
+   if (!ops->disable)
+   return -ENOSYS;
+
+   return ops->disable(dev);
+}
+
 UCLASS_DRIVER(cache) = {
.id = UCLASS_CACHE,
.name   = "cache",
diff --git a/include/cache.h b/include/cache.h
index c6334ca..32f59fd 100644
--- a/include/cache.h
+++ b/include/cache.h
@@ -22,6 +22,22 @@ struct cache_ops {
 * @return 0 if OK, -ve on error
 */
int (*get_info)(struct udevice *dev, struct cache_info *info);
+
+   /**
+* enable() - Enable cache
+*
+* @dev:Device to check (UCLASS_CACHE)
+* @return 0 if OK, -ve on error
+*/
+   int (*enable)(struct udevice *dev);
+
+   /**
+* disable() - Flush and disable cache
+*
+* @dev:Device to check (UCLASS_CACHE)
+* @return 0 if OK, -ve on error
+*/
+   int (*disable)(struct udevice *dev);
 };
 
 #define cache_get_ops(dev) ((struct cache_ops *)(dev)->driver->ops)
@@ -35,4 +51,19 @@ struct cache_ops {
  */
 int cache_get_info(struct udevice *dev, struct cache_info *info);
 
+/**
+ * cache_enable() - Enable cache
+ *
+ * @dev:   Device to check (UCLASS_CACHE)
+ * @return 0 if OK, -ve on error
+ */
+int cache_enable(struct udevice *dev);
+
+/**
+ * cache_disable() - Flush and disable cache
+ *
+ * @dev:   Device to check (UCLASS_CACHE)
+ * @return 0 if OK, -ve on error
+ */
+int cache_disable(struct udevice *dev);
 #endif
diff --git a/test/dm/cache.c b/test/dm/cache.c
index d4144aa..2e244b1 100644
--- a/test/dm/cache.c
+++ b/test/dm/cache.c
@@ -14,6 +14,8 @@ static int dm_test_reset(struct unit_test_state *uts)
 
ut_assertok(uclass_get_device(UCLASS_CACHE, 0, &dev_cache));
ut_assertok(cache_get_info(dev, &info));
+   ut_assertok(cache_enable(dev));
+   ut_assertok(cache_disable(dev));
 
return 0;
 }
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot